[Libreoffice-commits] .: Branch 'feature/gsoc-calc-perf' - sc/source

Daniel Bankston dbank at kemper.freedesktop.org
Fri May 25 19:14:21 PDT 2012


 sc/source/filter/xml/xmlsubti.cxx |   26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 89a6f4d896a591273b555b72886d1e5ab1516eb9
Author: Daniel Bankston <daniel.e.bankston at gmail.com>
Date:   Fri May 25 21:07:41 2012 -0500

    Remove ScDocFunc layer on ODS import for matrices
    
    Also, since it is unnecessary during import, removed code path where
    ScDocFunc::DeleteContents is called.
    
    Change-Id: Iafe2e261d27d674be6d5ec7f26edccc218879598

diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index b830a6f..16d2b00 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -43,6 +43,7 @@
 #include "convuno.hxx"
 #include "docsh.hxx"
 #include "docfunc.hxx"
+#include "tokenarray.hxx"
 #include <svx/svdpage.hxx>
 
 #include <sax/tools/converter.hxx>
@@ -807,17 +808,20 @@ bool ScMyTables::IsPartOfMatrix(const SCCOL nColumn, const SCROW nRow)
 void ScMyTables::SetMatrix(const ScRange& rScRange, const rtl::OUString& rFormula,
         const rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar)
 {
-    ScDocShell* pDocSh = static_cast< ScDocShell* >( rImport.GetDocument()->GetDocumentShell() );
-    if ( !rFormula.isEmpty() )
-        pDocSh->GetDocFunc().EnterMatrix( rScRange, NULL, NULL, rFormula, sal_True, sal_True, rFormulaNmsp, eGrammar );
-    else
-    {
-        //  empty string -> erase array formula
-        ScMarkData aMark;
-        aMark.SetMarkArea( rScRange );
-        aMark.SelectTable( rScRange.aStart.Tab(), sal_True );
-        pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
-    }
+    ScDocument* pDoc = rImport.GetDocument();
+    ScMarkData aMark;
+    aMark.SetMarkArea( rScRange );
+    aMark.SelectTable( rScRange.aStart.Tab(), sal_True );
+    ScTokenArray* pCode = new ScTokenArray;
+    pCode->AddStringXML( rFormula );
+    if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) && (rFormulaNmsp.getLength() > 0) )
+        pCode->AddStringXML( rFormulaNmsp );
+    pDoc->InsertMatrixFormula(
+        rScRange.aStart.Col(), rScRange.aStart.Row(),
+        rScRange.aEnd.Col(), rScRange.aEnd.Row(),
+        aMark, EMPTY_STRING, pCode, eGrammar );
+    delete pCode;
+    pDoc->IncXMLImportedFormulaCount( rFormula.getLength() );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list