diff options
author | Daniel Bankston <daniel.e.bankston@gmail.com> | 2012-05-25 21:07:41 -0500 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-06-01 19:40:09 +0200 |
commit | 07bfdbaa2d57403a7136079f4221ab2ed8f7c0b2 (patch) | |
tree | e8565376a1089b857a5fec25c11e02709b1b18f6 /sc | |
parent | 66ff25666ddb390e5c4bddaaa7d706991297a975 (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/xmlsubti.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx index b830a6f3550d..16d2b00ee88d 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: */ |