Kaydet (Commit) c43a25a7 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

replace import with direct ScCompiler calls, related tdf#91367

Change-Id: Ib605536d002071ae753e7da87137deae00529272
üst 0a9b9978
......@@ -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. */
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment