diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-19 01:45:57 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-19 02:27:55 +0200 |
commit | c43a25a7268c1b6ab81e9ba694a1f22223a24afa (patch) | |
tree | af58a6ce8af4900ab6b148210a701ef1ad0aaaf4 | |
parent | 0a9b99787c65e49f08b27566d277eab8306cca54 (diff) |
replace import with direct ScCompiler calls, related tdf#91367
Change-Id: Ib605536d002071ae753e7da87137deae00529272
-rw-r--r-- | sc/source/filter/inc/defnamesbuffer.hxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/defnamesbuffer.cxx | 17 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sc/source/filter/inc/defnamesbuffer.hxx b/sc/source/filter/inc/defnamesbuffer.hxx index 2ce69753d101..41775435cb12 100644 --- a/sc/source/filter/inc/defnamesbuffer.hxx +++ b/sc/source/filter/inc/defnamesbuffer.hxx @@ -23,6 +23,10 @@ #include "formulabase.hxx" #include "rangenam.hxx" +#include <memory> + +class ScTokenArray; + namespace com { namespace sun { namespace star { namespace sheet { class XNamedRange; } } } } @@ -111,6 +115,7 @@ public: /** Converts the formula string or BIFF token array for this defined name. */ void convertFormula(); ApiTokenSequence getTokens(); + std::unique_ptr<ScTokenArray> getScTokens(); /** Returns true, if this defined name is global in the document. */ inline bool isGlobalName() const { return mnCalcSheet < 0; } /** Returns true, if this defined name is a special builtin name. */ diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index dc30444b2c7e..a24c96a67b2a 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -37,6 +37,7 @@ #include "worksheetbuffer.hxx" #include "tokenarray.hxx" #include "tokenuno.hxx" +#include "compiler.hxx" namespace oox { namespace xls { @@ -380,6 +381,16 @@ DefinedName::getTokens() return aTokens; } +std::unique_ptr<ScTokenArray> DefinedName::getScTokens() +{ + ScTokenArray aTokenArray; + ScCompiler aCompiler(&getScDocument(), ScAddress(0, 0, mnCalcSheet)); + aCompiler.SetGrammar(formula::FormulaGrammar::GRAM_OOXML); + std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(maModel.maFormula)); + + return pArray; +} + void DefinedName::convertFormula() { // macro function or vba procedure @@ -389,10 +400,8 @@ void DefinedName::convertFormula() // convert and set formula of the defined name if ( getFilterType() == FILTER_OOXML ) { - ApiTokenSequence aTokens = getTokens(); - ScTokenArray aTokenArray; - (void)ScTokenConversion::ConvertToTokenArray( this->getScDocument(), aTokenArray, aTokens ); - mpScRangeData->SetCode( aTokenArray ); + std::unique_ptr<ScTokenArray> pTokenArray = getScTokens(); + mpScRangeData->SetCode( *pTokenArray ); } ScTokenArray* pTokenArray = mpScRangeData->GetCode(); |