diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-05-21 16:46:32 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-05-21 16:46:32 +0200 |
commit | cbedc2f760a642cfb2c19bea504fdea940edb48a (patch) | |
tree | 70c12cb7bc05e0fd85d340f1ed3b65b7d58c9e09 | |
parent | 4f7a90a20425a4319a0a06ca5b6716cac5f9e0cd (diff) |
dr76: #i103453# import visual area for embedded documents
-rw-r--r-- | sc/inc/scextopt.hxx | 1 | ||||
-rw-r--r-- | sc/source/filter/excel/impop.cxx | 67 | ||||
-rw-r--r-- | sc/source/filter/inc/imp_op.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/scextopt.cxx | 1 |
4 files changed, 32 insertions, 38 deletions
diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx index b02df9816ef4..d7586fb8df95 100644 --- a/sc/inc/scextopt.hxx +++ b/sc/inc/scextopt.hxx @@ -38,7 +38,6 @@ /** Extended settings for the document, used in import/export filters. */ struct ScExtDocSettings { - ScRange maOleSize; /// Visible range if embedded. String maGlobCodeName; /// Global codename (VBA module name). double mfTabBarWidth; /// Width of the tabbar, relative to frame window width (0.0 ... 1.0). sal_uInt32 mnLinkCnt; /// Recursive counter for loading external documents. diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index e62f050f2351..bddd99984ada 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -122,7 +122,8 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ): ImportTyp( &rImpData.mrDoc, rImpData.meTextEnc ), XclImpRoot( rImpData ), maStrm( rStrm, GetRoot() ), - aIn( maStrm ) + aIn( maStrm ), + maScOleSize( ScAddress::INITIALIZE_INVALID ) { mnLastRefIdx = 0; nBdshtTab = 0; @@ -919,8 +920,7 @@ void ImportExcel::Olesize( void ) aXclOleSize.Read( maStrm, false ); SCTAB nScTab = GetCurrScTab(); - ScRange& rOleSize = GetExtDocOptions().GetDocSettings().maOleSize; - GetAddressConverter().ConvertRange( rOleSize, aXclOleSize, nScTab, nScTab, false ); + GetAddressConverter().ConvertRange( maScOleSize, aXclOleSize, nScTab, nScTab, false ); } @@ -1204,45 +1204,40 @@ void ImportExcel::PostDocLoad( void ) // process all drawing objects (including OLE, charts, controls; after hiding rows/columns; before visible OLE area) GetObjectManager().ConvertObjects(); - // visible area if embedded OLE - if( ScModelObj* pDocObj = GetDocModelObj() ) + // visible area (used if this document is an embedded OLE object) + if( SfxObjectShell* pDocShell = GetDocShell() ) { - if( SfxObjectShell* pEmbObj = pDocObj->GetEmbeddedObject() ) + // visible area if embedded + const ScExtDocSettings& rDocSett = GetExtDocOptions().GetDocSettings(); + SCTAB nDisplScTab = rDocSett.mnDisplTab; + + /* #i44077# If a new OLE object is inserted from file, there is no + OLESIZE record in the Excel file. Calculate used area from file + contents (used cells and drawing objects). */ + if( !maScOleSize.IsValid() ) { - // visible area if embedded - const ScExtDocSettings& rDocSett = GetExtDocOptions().GetDocSettings(); - SCTAB nDisplScTab = rDocSett.mnDisplTab; - - // first try if there was an OLESIZE record - ScRange aScOleSize = rDocSett.maOleSize; - - /* #i44077# If a new OLE object is inserted from file, there - is no OLESIZE record in the Excel file. Calculate used area - from file contents (used cells and drawing objects). */ - if( !aScOleSize.IsValid() ) - { - // used area of displayed sheet (cell contents) - if( const ScExtTabSettings* pTabSett = GetExtDocOptions().GetTabSettings( nDisplScTab ) ) - aScOleSize = pTabSett->maUsedArea; - // add all valid drawing objects - ScRange aScObjArea = GetObjectManager().GetUsedArea( nDisplScTab ); - if( aScObjArea.IsValid() ) - aScOleSize.ExtendTo( aScObjArea ); - } + // used area of displayed sheet (cell contents) + if( const ScExtTabSettings* pTabSett = GetExtDocOptions().GetTabSettings( nDisplScTab ) ) + maScOleSize = pTabSett->maUsedArea; + // add all valid drawing objects + ScRange aScObjArea = GetObjectManager().GetUsedArea( nDisplScTab ); + if( aScObjArea.IsValid() ) + maScOleSize.ExtendTo( aScObjArea ); + } - // valid size found - set it at the document - if( aScOleSize.IsValid() ) - { - pEmbObj->SetVisArea( GetDoc().GetMMRect( - aScOleSize.aStart.Col(), aScOleSize.aStart.Row(), - aScOleSize.aEnd.Col(), aScOleSize.aEnd.Row(), nDisplScTab ) ); - GetDoc().SetVisibleTab( nDisplScTab ); - } + // valid size found - set it at the document + if( maScOleSize.IsValid() ) + { + pDocShell->SetVisArea( GetDoc().GetMMRect( + maScOleSize.aStart.Col(), maScOleSize.aStart.Row(), + maScOleSize.aEnd.Col(), maScOleSize.aEnd.Row(), nDisplScTab ) ); + GetDoc().SetVisibleTab( nDisplScTab ); } + } - // #111099# open forms in alive mode (has no effect, if no controls in document) + // #111099# open forms in alive mode (has no effect, if no controls in document) + if( ScModelObj* pDocObj = GetDocModelObj() ) pDocObj->setPropertyValue( CREATE_OUSTRING( SC_UNO_APPLYFMDES ), uno::Any( false ) ); - } // enables extended options to be set to the view after import GetExtDocOptions().SetChanged( true ); diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx index 065678d5c792..2df58173a63a 100644 --- a/sc/source/filter/inc/imp_op.hxx +++ b/sc/source/filter/inc/imp_op.hxx @@ -97,6 +97,7 @@ protected: XclImpStream& aIn; // input stream ScfUInt32Vec maSheetOffsets; + ScRange maScOleSize; /// Visible range if embedded. NameBuffer* pExtNameBuff; // ... externe Namen (Ind.-Basis=1) ExcelToSc* pFormConv; // Formel-Konverter diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx index bead62419bb3..1faa105d2bd7 100644 --- a/sc/source/ui/view/scextopt.cxx +++ b/sc/source/ui/view/scextopt.cxx @@ -36,7 +36,6 @@ // ============================================================================ ScExtDocSettings::ScExtDocSettings() : - maOleSize( ScAddress::INITIALIZE_INVALID ), mfTabBarWidth( -1.0 ), mnLinkCnt( 0 ), mnDisplTab( 0 ) |