summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/tokenuno.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-18 14:59:54 +0200
committerEike Rathke <erack@redhat.com>2017-05-18 15:02:50 +0200
commit1469a83ca1d712e30131597d70dad1b3eb322175 (patch)
tree7354ed4bd79adf5b846d5712004e3e3f7b6e9861 /sc/source/ui/unoobj/tokenuno.cxx
parent47a0e1554add5cc10c068275697108a663cd7a9a (diff)
Pass grammar to ScCompiler ctor instead of subsequent SetGrammar()
Not only to have more concise code but also to avoid setting grammar twice if the actual grammar differs from the document's default one. Change-Id: I7bfd151c22c48a40aea05f5f983fa0370d9fd9ae
Diffstat (limited to 'sc/source/ui/unoobj/tokenuno.cxx')
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 5998f9503047..80b41cc4b5b4 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -135,8 +135,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula(
ScAddress aRefPos( ScAddress::UNINITIALIZED );
ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
- ScCompiler aCompiler( &rDoc, aRefPos);
- aCompiler.SetGrammar(rDoc.GetGrammar());
+ ScCompiler aCompiler( &rDoc, aRefPos, rDoc.GetGrammar());
SetCompilerFlags( aCompiler );
ScTokenArray* pCode = aCompiler.CompileString( aFormula );
@@ -160,8 +159,7 @@ OUString SAL_CALL ScFormulaParserObj::printFormula(
(void)ScTokenConversion::ConvertToTokenArray( rDoc, aCode, aTokens );
ScAddress aRefPos( ScAddress::UNINITIALIZED );
ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
- ScCompiler aCompiler( &rDoc, aRefPos, aCode);
- aCompiler.SetGrammar(rDoc.GetGrammar());
+ ScCompiler aCompiler( &rDoc, aRefPos, aCode, rDoc.GetGrammar());
SetCompilerFlags( aCompiler );
OUStringBuffer aBuffer;
@@ -200,8 +198,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
if (mxOpCodeMap.get() && mbEnglish != bOldEnglish)
{
ScDocument& rDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( &rDoc, ScAddress());
- aCompiler.SetGrammar(rDoc.GetGrammar());
+ ScCompiler aCompiler( &rDoc, ScAddress(), rDoc.GetGrammar());
mxOpCodeMap = formula::FormulaCompiler::CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
}
@@ -221,8 +218,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue(
if (aValue >>= maOpCodeMapping)
{
ScDocument& rDoc = mpDocShell->GetDocument();
- ScCompiler aCompiler( &rDoc, ScAddress());
- aCompiler.SetGrammar(rDoc.GetGrammar());
+ ScCompiler aCompiler( &rDoc, ScAddress(), rDoc.GetGrammar());
mxOpCodeMap = formula::FormulaCompiler::CreateOpCodeMap( maOpCodeMapping, mbEnglish);
}
else