diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-02-21 02:23:13 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-02-21 02:28:39 +0100 |
commit | 7c351c32ea9b34f7b798c2487854753bb4693110 (patch) | |
tree | 1942b9a8594385e51f5439730bc27bb73bcf0ea6 /sc | |
parent | fix win build (diff) | |
download | core-7c351c32ea9b34f7b798c2487854753bb4693110.tar.gz core-7c351c32ea9b34f7b798c2487854753bb4693110.zip |
delay importing all drawing elements until content is loaded, fdo#60488
Otherwise charts with data ranges on other sheets will not be painted
correctly as the data is missing when the chart is rendered for the
first time. This was not a problem before the cached value import
because the hard recalc would have forced a repaint anyway.
The new way should also be a bit quicker.
Change-Id: Ieeee6a010a4dffad6ebe2264b8312f93b16d9c87
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/worksheethelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookfragment.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 14 |
3 files changed, 27 insertions, 2 deletions
diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx index 32db180b423f..2efa6e4a19cd 100644 --- a/sc/source/filter/inc/worksheethelper.hxx +++ b/sc/source/filter/inc/worksheethelper.hxx @@ -303,6 +303,8 @@ public: void initializeWorksheetImport(); /** Final conversion after importing the worksheet. */ void finalizeWorksheetImport(); + /** Final import of drawing objects. Has to be called after all content has been imported */ + void finalizeDrawingImport(); void setCellFormula( const ::com::sun::star::table::CellAddress& rTokenAddress, const rtl::OUString& ); void setCellFormula( const ::com::sun::star::table::CellAddress& rTokenAddress, sal_Int32 ); diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index ba0c2fdd86b4..41a6ce71098c 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -231,6 +231,7 @@ void WorkbookFragment::finalizeImport() typedef ::std::pair< WorksheetGlobalsRef, FragmentHandlerRef > SheetFragmentHandler; typedef ::std::vector< SheetFragmentHandler > SheetFragmentVector; SheetFragmentVector aSheetFragments; + std::vector<WorksheetHelper*> maHelpers; WorksheetBuffer& rWorksheets = getWorksheets(); sal_Int32 nWorksheetCount = rWorksheets.getWorksheetCount(); for( sal_Int32 nWorksheet = 0; nWorksheet < nWorksheetCount; ++nWorksheet ) @@ -286,7 +287,10 @@ void WorkbookFragment::finalizeImport() // insert the fragment into the map if( xFragment.is() ) + { aSheetFragments.push_back( SheetFragmentHandler( xSheetGlob, xFragment.get() ) ); + maHelpers.push_back(xFragment.get()); + } } } } @@ -301,6 +305,15 @@ void WorkbookFragment::finalizeImport() { // import the sheet fragment importOoxFragment( aIt->second ); + } + + for( std::vector<WorksheetHelper*>::iterator aIt = maHelpers.begin(), aEnd = maHelpers.end(); aIt != aEnd; ++aIt ) + { + (*aIt)->finalizeDrawingImport(); + } + + for( SheetFragmentVector::iterator aIt = aSheetFragments.begin(), aEnd = aSheetFragments.end(); aIt != aEnd; ++aIt ) + { // delete fragment object and WorkbookGlobals object, will free all allocated sheet buffers aIt->second.clear(); aIt->first.reset(); diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index fe072cb54996..c56b4783287c 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -343,6 +343,8 @@ public: /** Final conversion after importing the worksheet. */ void finalizeWorksheetImport(); + void finalizeDrawingImport(); + private: typedef ::std::vector< sal_Int32 > OutlineLevelVec; typedef ::std::pair< ColumnModel, sal_Int32 > ColumnModelRange; @@ -957,9 +959,12 @@ void WorksheetGlobals::finalizeWorksheetImport() lclUpdateProgressBar( mxFinalProgress, 0.5 ); convertColumns(); convertRows(); - lclUpdateProgressBar( mxFinalProgress, 0.75 ); - finalizeDrawings(); lclUpdateProgressBar( mxFinalProgress, 1.0 ); +} + +void WorksheetGlobals::finalizeDrawingImport() +{ + finalizeDrawings(); // forget current sheet index in global data setCurrentSheetIndex( -1 ); @@ -1580,6 +1585,11 @@ void WorksheetHelper::finalizeWorksheetImport() mrSheetGlob.finalizeWorksheetImport(); } +void WorksheetHelper::finalizeDrawingImport() +{ + mrSheetGlob.finalizeDrawingImport(); +} + void WorksheetHelper::setCellFormula( const ::com::sun::star::table::CellAddress& rTokenAddress, const rtl::OUString& rTokenStr ) { getFormulaBuffer().setCellFormula( rTokenAddress, rTokenStr ); |