[Libreoffice-commits] .: sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Sun Nov 6 07:37:13 PST 2011


 sc/source/filter/xml/xmlsubti.cxx |   10 +++++-----
 sc/source/filter/xml/xmltabi.cxx  |   30 ++++++++++++++++--------------
 2 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit b2e42f5cfa6b7e762098c6dc2e2acf920354b3f2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Nov 6 14:56:18 2011 +0100

    little refactoring in ods import code

diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 2bc5b7c..315bf2b 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -523,7 +523,8 @@ void ScMyTables::NewTable(sal_Int32 nTempSpannedCols)
     maTables.push_back(new ScMyTableData(nCurrentSheet));
     pCurrentTab = & maTables.back();
 
-    if (maTables.size() > 1)
+    size_t nTables = maTables.size();
+    if (nTables > 1)
     {
         ScMyTableData& rFirstTab = maTables.front();
 
@@ -551,10 +552,9 @@ void ScMyTables::NewTable(sal_Int32 nTempSpannedCols)
 
     pCurrentTab->SetSpannedCols(nTempSpannedCols);
 
-    size_t n = maTables.size();
-    if (n > 1)
+    if (nTables > 1)
     {
-        maTables[n-2].SetSubTableSpanned(pCurrentTab->GetSpannedCols());
+        maTables[nTables-2].SetSubTableSpanned(pCurrentTab->GetSpannedCols());
         UnMerge();
     }
 }
@@ -615,7 +615,7 @@ void ScMyTables::DeleteTable()
             pCurrentTab = NULL;
     }
 
-    if (maTables.empty()) // only set the styles if all subtables are importet and the table is finished
+    if (maTables.empty()) // only set the styles if all subtables are imported and the table is finished
     {
         rImport.GetStylesImportHelper()->SetStylesToRanges();
         rImport.SetStylesToRangesFinished();
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index e8f8b81..189eb1c 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -372,16 +372,18 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( sal_uInt16 nPrefix,
 void ScXMLTableContext::EndElement()
 {
     ScXMLImport::MutexGuard aMutexGuard(GetScImport());
-    GetScImport().GetStylesImportHelper()->EndTable();
-    ScDocument* pDoc(GetScImport().GetDocument());
+    ScXMLImport& rImport = GetScImport();
+    rImport.GetStylesImportHelper()->EndTable();
+    ScDocument* pDoc(rImport.GetDocument());
     if (!pDoc)
         return;
 
-    SCTAB nCurTab = GetScImport().GetTables().GetCurrentSheet();
+    ScMyTables& rTables = rImport.GetTables();
+    SCTAB nCurTab = rTables.GetCurrentSheet();
     if (sPrintRanges.getLength())
     {
         Reference< sheet::XPrintAreas > xPrintAreas(
-            GetScImport().GetTables().GetCurrentXSheet(), UNO_QUERY);
+            rTables.GetCurrentXSheet(), UNO_QUERY);
 
         if( xPrintAreas.is() )
         {
@@ -423,26 +425,26 @@ void ScXMLTableContext::EndElement()
             }
         }
     }
-    if (GetScImport().GetTables().HasDrawPage())
+    if (rTables.HasDrawPage())
     {
-        if (GetScImport().GetTables().HasXShapes())
+        if (rTables.HasXShapes())
         {
-            GetScImport().GetShapeImport()->popGroupAndSort();
-            uno::Reference < drawing::XShapes > xTempShapes(GetScImport().GetTables().GetCurrentXShapes());
-            GetScImport().GetShapeImport()->endPage(xTempShapes);
+            rImport.GetShapeImport()->popGroupAndSort();
+            uno::Reference < drawing::XShapes > xTempShapes(rTables.GetCurrentXShapes());
+            rImport.GetShapeImport()->endPage(xTempShapes);
         }
         if (bStartFormPage)
-            GetScImport().GetFormImport()->endPage();
+            rImport.GetFormImport()->endPage();
     }
 
-    GetScImport().GetTables().DeleteTable();
-    GetScImport().ProgressBarIncrement(false);
+    rTables.DeleteTable();
+    rImport.ProgressBarIncrement(false);
 
     // store stream positions
     if (!pExternalRefInfo.get() && nStartOffset >= 0 /* && nEndOffset >= 0 */)
     {
-        ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData();
-        SCTAB nTab = GetScImport().GetTables().GetCurrentSheet();
+        ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData();
+        SCTAB nTab = rTables.GetCurrentSheet();
         // pSheetData->AddStreamPos( nTab, nStartOffset, nEndOffset );
         pSheetData->StartStreamPos( nTab, nStartOffset );
     }


More information about the Libreoffice-commits mailing list