diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-09 14:00:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-10 11:22:25 +0100 |
commit | 60a66bd57d17a2f72fbf852faf1eaad87eac6dec (patch) | |
tree | 6b9e514c3422fdf2ef436533db48ee6fbb68c663 /sc/source/filter/oox | |
parent | 612941b64970b3e1f246652a8661fbaa56373242 (diff) |
pass ScTokenArray around by unique_ptr
Change-Id: I611554b1c4cbc506dbfc32748e9f14c9e8eb5156
Reviewed-on: https://gerrit.libreoffice.org/66022
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/oox')
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/oox/revisionfragment.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/worksheethelper.cxx | 6 |
3 files changed, 10 insertions, 9 deletions
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 1ce45b0b7720..ab7aaecc87bd 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -117,11 +117,11 @@ void applySharedFormulas( ScCompiler aComp(&rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML, true, false); aComp.SetNumberFormatter(&rFormatter); - ScTokenArray* pArray = aComp.CompileString(rTokenStr); + std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(rTokenStr); if (pArray) { aComp.CompileTokenArray(); // Generate RPN tokens. - aGroups.set(nId, pArray); + aGroups.set(nId, std::move(pArray)); } } } @@ -222,13 +222,13 @@ void applyCellFormulas( ScCompiler aCompiler(&rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML, true, false); aCompiler.SetNumberFormatter(&rFormatter); aCompiler.SetExternalLinks(rExternalLinks); - ScTokenArray* pCode = aCompiler.CompileString(rItem.maTokenStr); + std::unique_ptr<ScTokenArray> pCode = aCompiler.CompileString(rItem.maTokenStr); if (!pCode) continue; aCompiler.CompileTokenArray(); // Generate RPN tokens. - ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, pCode); + ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, std::move(pCode)); rDoc.setFormulaCell(aPos, pCell); rCache.store(aPos, pCell); } diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index bc1c58d48121..58d27a43f758 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -29,6 +29,7 @@ #include <formulacell.hxx> #include <chgviset.hxx> #include <richstringcontext.hxx> +#include <tokenarray.hxx> #include <com/sun/star/util/DateTime.hpp> @@ -118,11 +119,11 @@ protected: // formula string ScDocument& rDoc = getScDocument(); ScCompiler aComp(&rDoc, mrPos, formula::FormulaGrammar::GRAM_OOXML); - ScTokenArray* pArray = aComp.CompileString(rChars); + std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(rChars); if (!pArray) break; - mrCellValue.set(new ScFormulaCell(&rDoc, mrPos, pArray)); + mrCellValue.set(new ScFormulaCell(&rDoc, mrPos, std::move(pArray))); } break; default: diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 42bc0a397277..64c05c9442cd 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1543,9 +1543,9 @@ void WorksheetHelper::putRichString( const ScAddress& rAddress, const RichString void WorksheetHelper::putFormulaTokens( const ScAddress& rAddress, const ApiTokenSequence& rTokens ) { ScDocumentImport& rDoc = getDocImport(); - ScTokenArray aTokenArray; - ScTokenConversion::ConvertToTokenArray(rDoc.getDoc(), aTokenArray, rTokens); - rDoc.setFormulaCell(rAddress, new ScTokenArray(aTokenArray)); + std::unique_ptr<ScTokenArray> pTokenArray(new ScTokenArray); + ScTokenConversion::ConvertToTokenArray(rDoc.getDoc(), *pTokenArray, rTokens); + rDoc.setFormulaCell(rAddress, std::move(pTokenArray)); } void WorksheetHelper::initializeWorksheetImport() |