[Libreoffice-commits] core.git: sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Feb 20 17:28:23 PST 2013


 sc/source/filter/inc/worksheethelper.hxx  |    2 ++
 sc/source/filter/oox/workbookfragment.cxx |   13 +++++++++++++
 sc/source/filter/oox/worksheethelper.cxx  |   14 ++++++++++++--
 3 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 7c351c32ea9b34f7b798c2487854753bb4693110
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Feb 21 02:23:13 2013 +0100

    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

diff --git a/sc/source/filter/inc/worksheethelper.hxx b/sc/source/filter/inc/worksheethelper.hxx
index 32db180..2efa6e4 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 ba0c2fd..41a6ce7 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 fe072cb..c56b478 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 );


More information about the Libreoffice-commits mailing list