summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/formulagroup.hxx2
-rw-r--r--sc/source/core/data/formulacell.cxx6
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx12
-rw-r--r--sc/source/core/tool/formulagroup.cxx10
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx4
5 files changed, 10 insertions, 24 deletions
diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 24e26d9adf9d..fb7692bcd2ed 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -85,8 +85,6 @@ class SC_DLLPUBLIC FormulaGroupInterpreter
FormulaGroupInterpreter() {}
virtual ~FormulaGroupInterpreter() {}
- static void generateRPNCode(ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rCode);
-
public:
static FormulaGroupInterpreter *getStatic();
static void fillOpenCLInfo(std::vector<OpenclPlatformInfo>& rPlatforms);
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 5e92efa27a5b..07f865681f66 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3468,6 +3468,7 @@ public:
bool convert(ScTokenArray& rCode)
{
+#if 0
{ // debug to start with:
ScCompiler aComp( &mrDoc, mrPos, rCode);
aComp.SetGrammar(formula::FormulaGrammar::GRAM_NATIVE_XL_R1C1);
@@ -3475,6 +3476,7 @@ public:
aComp.CreateStringFromTokenArray(aAsString);
SAL_DEBUG("interpret formula: " << aAsString.makeStringAndClear());
}
+#endif
rCode.Reset();
for (const formula::FormulaToken* p = rCode.First(); p; p = rCode.Next())
@@ -3614,6 +3616,10 @@ public:
}
}
+ ScCompiler aComp(&mrDoc, mrPos, mrGroupTokens);
+ aComp.SetGrammar(mrDoc.GetGrammar());
+ aComp.CompileTokenArray(); // Regenerate RPN tokens.
+
return true;
}
};
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 60b126c3c530..c6ae8e8e235a 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1416,20 +1416,9 @@ public:
virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat );
virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos,
const ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode );
- void generateRPNCode(ScDocument& rDoc,
- const ScAddress& rPos, ScTokenArray& rCode);
DynamicKernel *mpKernel;
};
-void FormulaGroupInterpreterOpenCL::generateRPNCode(ScDocument& rDoc,
- const ScAddress& rPos, ScTokenArray& rCode)
-{
- // First, generate an RPN (reverse polish notation) token array.
- ScCompiler aComp(&rDoc, rPos, rCode);
- aComp.SetGrammar(rDoc.GetGrammar());
- aComp.CompileTokenArray(); // Create RPN token array.
-}
-
ScMatrixRef FormulaGroupInterpreterOpenCL::inverseMatrix( const ScMatrix& )
{
return NULL;
@@ -1439,7 +1428,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
const ScAddress& rTopPos, const ScFormulaCellGroupRef& xGroup,
ScTokenArray& rCode )
{
- generateRPNCode(rDoc, rTopPos, rCode);
// printf("Vector width = %d\n", xGroup->mnLength);
// Constructing "AST"
FormulaTokenIterator aCode = rCode;
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 257335909e81..8d87e246607a 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -425,7 +425,6 @@ bool FormulaGroupInterpreterSoftware::interpret(ScDocument& rDoc, const ScAddres
if (!pDest)
return false;
- generateRPNCode(rDoc, aTmpPos, aCode2);
ScInterpreter aInterpreter(pDest, &rDoc, aTmpPos, aCode2);
aInterpreter.Interpret();
aResults.push_back(aInterpreter.GetResultToken());
@@ -676,15 +675,6 @@ void FormulaGroupInterpreter::enableOpenCL(bool bEnable)
ScInterpreter::SetGlobalConfig(aConfig);
}
-void FormulaGroupInterpreter::generateRPNCode(ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rCode)
-{
- // First, generate an RPN (reverse polish notation) token array.
- ScCompiler aComp(&rDoc, rPos, rCode);
- aComp.SetGrammar(rDoc.GetGrammar());
- aComp.CompileTokenArray(); // Create RPN token array.
- // Now, calling FirstRPN() and NextRPN() will return tokens from the RPN token array.
-}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index 4bdb6ae7a5ca..6f0c99168cb6 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -135,7 +135,10 @@ void applySharedFormulas(
aComp.SetGrammar(formula::FormulaGrammar::GRAM_ENGLISH_XL_OOX);
ScTokenArray* pArray = aComp.CompileString(rTokenStr);
if (pArray)
+ {
+ aComp.CompileTokenArray(); // Generate RPN tokens.
aGroups.set(nId, pArray);
+ }
}
}
@@ -222,6 +225,7 @@ void applyCellFormulas(
if (!pCode)
continue;
+ aCompiler.CompileTokenArray(); // Generate RPN tokens.
ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, pCode);
rDoc.setFormulaCell(aPos, pCell);
rCache.store(aPos, pCell);