[Libreoffice-commits] core.git: 2 commits - sc/source
Eike Rathke
erack at redhat.com
Fri May 12 14:54:30 UTC 2017
sc/source/filter/xml/xmlsubti.cxx | 9 ++++-----
sc/source/ui/docshell/docfunc.cxx | 16 ++++------------
2 files changed, 8 insertions(+), 17 deletions(-)
New commits:
commit 15074f1bfa99d1959bab9975c10d7739d81c603f
Author: Eike Rathke <erack at redhat.com>
Date: Fri May 12 16:53:09 2017 +0200
Use ScTokenArray::AssignXMLString() and ScTokenArray stack object
Change-Id: I75477b3e9b5f71384084212b634faeaae3dddefa
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index e45e94f4e3b4..c44ac7e5c25e 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -269,11 +269,10 @@ void ScMyTables::AddMatrixRange(
maMatrixRangeList.Append(aScRange);
ScDocumentImport& rDoc = rImport.GetDoc();
- std::unique_ptr<ScTokenArray> pCode(new ScTokenArray);
- pCode->AddStringXML( rFormula );
- if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) && !rFormulaNmsp.isEmpty() )
- pCode->AddStringXML( rFormulaNmsp );
- rDoc.setMatrixCells(aScRange, *pCode, eGrammar);
+ ScTokenArray aCode;
+ aCode.AssignXMLString( rFormula,
+ ((eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) ? rFormulaNmsp : OUString()));
+ rDoc.setMatrixCells(aScRange, aCode, eGrammar);
rDoc.getDoc().IncXMLImportedFormulaCount( rFormula.getLength() );
}
commit bffe1113a31bb1f58aafbdba9b50b4232816f2f5
Author: Eike Rathke <erack at redhat.com>
Date: Fri May 12 16:50:27 2017 +0200
Use ScTokenArray::AssignXMLString() and ScTokenArray stack object
Change-Id: Iac149278019932da7f269d85871c949f6b19f7c2
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index b9f4e59de321..06a0030c1aac 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1154,15 +1154,6 @@ void ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
}
}
-static ScTokenArray* lcl_ScDocFunc_CreateTokenArrayXML( const OUString& rText, const OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar )
-{
- ScTokenArray* pCode = new ScTokenArray;
- pCode->AddStringXML( rText );
- if( (eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) && (!rFormulaNmsp.isEmpty()) )
- pCode->AddStringXML( rFormulaNmsp );
- return pCode;
-}
-
bool ScDocFunc::SetCellText(
const ScAddress& rPos, const OUString& rText, bool bInterpret, bool bEnglish, bool bApi,
const formula::FormulaGrammar::Grammar eGrammar )
@@ -4160,10 +4151,11 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
}
else if ( rDoc.IsImportingXML() )
{
- ScTokenArray* pCode = lcl_ScDocFunc_CreateTokenArrayXML( rString, rFormulaNmsp, eGrammar );
+ ScTokenArray aCode;
+ aCode.AssignXMLString( rString,
+ ((eGrammar == formula::FormulaGrammar::GRAM_EXTERNAL) ? rFormulaNmsp : OUString()));
rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow,
- aMark, EMPTY_OUSTRING, pCode, eGrammar);
- delete pCode;
+ aMark, EMPTY_OUSTRING, &aCode, eGrammar);
rDoc.IncXMLImportedFormulaCount( rString.getLength() );
}
else if (bEnglish)
More information about the Libreoffice-commits
mailing list