sc/inc/compiler.hxx | 4 ++-- sc/qa/unit/helper/qahelper.cxx | 4 ++-- sc/qa/unit/ucalc_condformat.cxx | 12 ++++++------ sc/qa/unit/ucalc_formula.cxx | 12 ++++++------ sc/source/core/data/column.cxx | 2 +- sc/source/core/data/column4.cxx | 12 ++++++------ sc/source/core/data/conditio.cxx | 6 +++--- sc/source/core/data/formulacell.cxx | 18 +++++++++--------- sc/source/core/data/simpleformulacalc.cxx | 4 ++-- sc/source/core/opencl/formulagroupcl.cxx | 2 +- sc/source/core/tool/compiler.cxx | 12 ++++++------ sc/source/core/tool/interpr1.cxx | 4 ++-- sc/source/core/tool/rangenam.cxx | 10 +++++----- sc/source/core/tool/reftokenhelper.cxx | 2 +- sc/source/filter/excel/xechart.cxx | 2 +- sc/source/filter/excel/xename.cxx | 2 +- sc/source/filter/excel/xeroot.cxx | 2 +- sc/source/filter/excel/xichart.cxx | 2 +- sc/source/filter/oox/defnamesbuffer.cxx | 2 +- sc/source/filter/oox/formulabuffer.cxx | 6 +++--- sc/source/filter/oox/revisionfragment.cxx | 2 +- sc/source/filter/orcus/interface.cxx | 4 ++-- sc/source/filter/xml/xmlcondformat.cxx | 3 ++- sc/source/filter/xml/xmlimprt.cxx | 2 +- sc/source/ui/app/inputhdl.cxx | 2 +- sc/source/ui/condformat/condformatdlgentry.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/docshell/impex.cxx | 2 +- sc/source/ui/formdlg/formula.cxx | 6 +++--- sc/source/ui/miscdlgs/anyrefdg.cxx | 2 +- sc/source/ui/namedlg/namedefdlg.cxx | 2 +- sc/source/ui/namedlg/namedlg.cxx | 2 +- sc/source/ui/unoobj/chart2uno.cxx | 4 ++-- sc/source/ui/unoobj/condformatuno.cxx | 4 ++-- sc/source/ui/unoobj/funcuno.cxx | 2 +- sc/source/ui/unoobj/servuno.cxx | 2 +- sc/source/ui/unoobj/tokenuno.cxx | 8 ++++---- sc/source/ui/vba/vbaname.cxx | 2 +- sc/source/ui/vba/vbanames.cxx | 2 +- sc/source/ui/vba/vbarange.cxx | 4 ++-- sc/source/ui/view/tabvwsha.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 2 +- sc/source/ui/view/viewfun4.cxx | 2 +- sc/source/ui/view/viewfunc.cxx | 2 +- 44 files changed, 94 insertions(+), 93 deletions(-)
New commits: commit 44af87f7392792e045e5afe5df19e946ef81241b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 15 19:16:12 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Sep 17 15:04:06 2020 +0200 ScCompiler ctors never passed a null ScDocument* add one assert to ScXMLConditionalFormatContext where this isn't immediately certain. Change-Id: I2103c5cd42288e0a5d2a1c2e2d2d031f806773bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102906 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 79b8c2cd2ff1..887c3c426792 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -361,7 +361,7 @@ public: /** If eGrammar == GRAM_UNSPECIFIED then the grammar of pDocument is used, if pDocument==nullptr then GRAM_DEFAULT. */ - ScCompiler( ScDocument* pDocument, const ScAddress&, + ScCompiler( ScDocument& rDocument, const ScAddress&, formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED, bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr ); @@ -371,7 +371,7 @@ public: /** If eGrammar == GRAM_UNSPECIFIED then the grammar of pDocument is used, if pDocument==nullptr then GRAM_DEFAULT. */ - ScCompiler( ScDocument* pDocument, const ScAddress&, ScTokenArray& rArr, + ScCompiler( ScDocument& rDocument, const ScAddress&, ScTokenArray& rArr, formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED, bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr ); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index cc675cdb593d..560d4c51fd21 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -489,7 +489,7 @@ std::unique_ptr<ScTokenArray> compileFormula( formula::FormulaGrammar::Grammar eGram ) { ScAddress aPos(0,0,0); - ScCompiler aComp(pDoc, aPos, eGram); + ScCompiler aComp(*pDoc, aPos, eGram); return aComp.CompileString(rFormula); } @@ -562,7 +562,7 @@ bool isFormulaWithoutError(ScDocument& rDoc, const ScAddress& rPos) OUString toString( ScDocument& rDoc, const ScAddress& rPos, ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram) { - ScCompiler aComp(&rDoc, rPos, rArray, eGram); + ScCompiler aComp(rDoc, rPos, rArray, eGram); OUStringBuffer aBuf; aComp.CreateStringFromTokenArray(aBuf); return aBuf.makeStringAndClear(); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index b0d66091fe2b..118377c970e6 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -787,7 +787,7 @@ void Test::testFormulaListenerSingleCellToSingleCell() { m_pDoc->InsertTab(0, "test"); - ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); @@ -805,7 +805,7 @@ void Test::testFormulaListenerSingleCellToMultipleCells() { m_pDoc->InsertTab(0, "test"); - ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); @@ -823,7 +823,7 @@ void Test::testFormulaListenerMultipleCellsToSingleCell() { m_pDoc->InsertTab(0, "test"); - ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); @@ -841,7 +841,7 @@ void Test::testFormulaListenerMultipleCellsToMultipleCells() { m_pDoc->InsertTab(0, "test"); - ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); @@ -859,7 +859,7 @@ void Test::testFormulaListenerUpdateInsertTab() { m_pDoc->InsertTab(0, "test"); - ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*m_pDoc, ScAddress(10, 10, 0), formula::FormulaGrammar::GRAM_ENGLISH); std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); ScFormulaListener aListener(*m_pDoc); @@ -884,7 +884,7 @@ void Test::testFormulaListenerUpdateDeleteTab() m_pDoc->InsertTab(0, "test"); m_pDoc->InsertTab(0, "to_delete"); - ScCompiler aCompiler(m_pDoc, ScAddress(10, 10, 1), formula::FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*m_pDoc, ScAddress(10, 10, 1), formula::FormulaGrammar::GRAM_ENGLISH); std::unique_ptr<ScTokenArray> pTokenArray(aCompiler.CompileString("A1")); ScFormulaListener aListener(*m_pDoc); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 371692f01a56..b82f1271fb12 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -190,7 +190,7 @@ void Test::testFormulaCreateStringFromTokens() #if 0 OUString aFormula = OUString::createFromAscii(aTests[i]); #endif - ScCompiler aComp(m_pDoc, aPos, FormulaGrammar::GRAM_ENGLISH); + ScCompiler aComp(*m_pDoc, aPos, FormulaGrammar::GRAM_ENGLISH); #if 0 // TODO: This call to CompileString() causes the cppunittester to somehow fail on Windows. pArray.reset(aComp.CompileString(aFormula)); CPPUNIT_ASSERT_MESSAGE("Failed to compile formula string.", pArray.get()); @@ -1022,7 +1022,7 @@ void Test::testFormulaCompilerJumpReordering() CPPUNIT_ASSERT(pCode); // Then generate RPN tokens. - ScCompiler aCompRPN(m_pDoc, ScAddress(), *pCode, FormulaGrammar::GRAM_NATIVE); + ScCompiler aCompRPN(*m_pDoc, ScAddress(), *pCode, FormulaGrammar::GRAM_NATIVE); aCompRPN.CompileTokenArray(); // RPN tokens should be ordered: B1, ocIf, C1, ocSep, D1, ocClose. @@ -1050,7 +1050,7 @@ void Test::testFormulaCompilerJumpReordering() // Generate RPN tokens again, but this time no jump command reordering. pCode->DelRPN(); - ScCompiler aCompRPN2(m_pDoc, ScAddress(), *pCode, FormulaGrammar::GRAM_NATIVE); + ScCompiler aCompRPN2(*m_pDoc, ScAddress(), *pCode, FormulaGrammar::GRAM_NATIVE); aCompRPN2.EnableJumpCommandReorder(false); aCompRPN2.CompileTokenArray(); @@ -4332,7 +4332,7 @@ void Test::testTokenArrayRefUpdateMove() for (const OUString& aTest : aTests) { - ScCompiler aComp(m_pDoc, aPos, m_pDoc->GetGrammar()); + ScCompiler aComp(*m_pDoc, aPos, m_pDoc->GetGrammar()); std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(aTest)); OUString aStr = pArray->CreateString(aCxt, aPos); @@ -8616,7 +8616,7 @@ void Test::testRefR1C1WholeCol() CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test")); ScAddress aPos(1, 1, 1); - ScCompiler aComp(m_pDoc, aPos, FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + ScCompiler aComp(*m_pDoc, aPos, FormulaGrammar::GRAM_ENGLISH_XL_R1C1); std::unique_ptr<ScTokenArray> pTokens(aComp.CompileString("=C[10]")); sc::TokenStringContext aCxt(*m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH); OUString aFormula = pTokens->CreateString(aCxt, aPos); @@ -8631,7 +8631,7 @@ void Test::testRefR1C1WholeRow() CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test")); ScAddress aPos(1, 1, 1); - ScCompiler aComp(m_pDoc, aPos, FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + ScCompiler aComp(*m_pDoc, aPos, FormulaGrammar::GRAM_ENGLISH_XL_R1C1); std::unique_ptr<ScTokenArray> pTokens(aComp.CompileString("=R[3]")); sc::TokenStringContext aCxt(*m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH); OUString aFormula = pTokens->CreateString(aCxt, aPos); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index a50cdffc702f..1647dfaa0b5a 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2147,7 +2147,7 @@ class UpdateRefOnNonCopy // We need to re-compile the token array when a range name is // modified, to correctly reflect the new references in the // name. - ScCompiler aComp(&mpCxt->mrDoc, rTopCell.aPos, *rTopCell.GetCode(), mpCxt->mrDoc.GetGrammar(), + ScCompiler aComp(mpCxt->mrDoc, rTopCell.aPos, *rTopCell.GetCode(), mpCxt->mrDoc.GetGrammar(), true, rTopCell.GetMatrixFlag() != ScMatrixMode::NONE); aComp.CompileTokenArray(); } diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 3c7339573e89..1d21b8b2bca1 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -870,13 +870,13 @@ public: class CompileHybridFormulaHandler { - ScDocument* mpDoc; + ScDocument& mrDoc; sc::StartListeningContext& mrStartListenCxt; sc::CompileFormulaContext& mrCompileFormulaCxt; public: - CompileHybridFormulaHandler( ScDocument* pDoc, sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt ) : - mpDoc(pDoc), + CompileHybridFormulaHandler(ScDocument& rDoc, sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt ) : + mrDoc(rDoc), mrStartListenCxt(rStartListenCxt), mrCompileFormulaCxt(rCompileCxt) {} @@ -896,7 +896,7 @@ public: ScFormulaCellGroupRef xGroup = pTop->GetCellGroup(); assert(xGroup); xGroup->setCode(std::move(pNewCode)); - xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar()); + xGroup->compileCode(mrDoc, pTop->aPos, mrDoc.GetGrammar()); // Propagate the new token array to all formula cells in the group. ScFormulaCell** pp = rEntry.mpCells; @@ -922,7 +922,7 @@ public: std::unique_ptr<ScTokenArray> pNewCode = aComp.CompileString(aFormula); // Generate RPN tokens. - ScCompiler aComp2(mpDoc, pCell->aPos, *pNewCode, formula::FormulaGrammar::GRAM_UNSPECIFIED, + ScCompiler aComp2(mrDoc, pCell->aPos, *pNewCode, formula::FormulaGrammar::GRAM_UNSPECIFIED, true, pCell->GetMatrixFlag() != ScMatrixMode::NONE); aComp2.CompileTokenArray(); @@ -971,7 +971,7 @@ void ScColumn::CompileHybridFormula( // Collect all formula groups. std::vector<sc::FormulaGroupEntry> aGroups = GetFormulaGroupEntries(); - CompileHybridFormulaHandler aFunc(&GetDoc(), rStartListenCxt, rCompileCxt); + CompileHybridFormulaHandler aFunc(GetDoc(), rStartListenCxt, rCompileCxt); std::for_each(aGroups.begin(), aGroups.end(), aFunc); } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 2fa970066e9c..ee70b5d70a03 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -343,7 +343,7 @@ void ScConditionEntry::Compile( const OUString& rExpr1, const OUString& rExpr2, { if ( !rExpr1.isEmpty() || !rExpr2.isEmpty() ) { - ScCompiler aComp( mpDoc, aSrcPos ); + ScCompiler aComp( *mpDoc, aSrcPos ); if ( !rExpr1.isEmpty() ) { @@ -1246,7 +1246,7 @@ OUString ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 n { if ( pFormula1 ) { - ScCompiler aComp(mpDoc, rCursor, *pFormula1, eGrammar); + ScCompiler aComp(*mpDoc, rCursor, *pFormula1, eGrammar); OUStringBuffer aBuffer; aComp.CreateStringFromTokenArray( aBuffer ); aRet = aBuffer.makeStringAndClear(); @@ -1262,7 +1262,7 @@ OUString ScConditionEntry::GetExpression( const ScAddress& rCursor, sal_uInt16 n { if ( pFormula2 ) { - ScCompiler aComp(mpDoc, rCursor, *pFormula2, eGrammar); + ScCompiler aComp(*mpDoc, rCursor, *pFormula2, eGrammar); OUStringBuffer aBuffer; aComp.CreateStringFromTokenArray( aBuffer ); aRet = aBuffer.makeStringAndClear(); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 17b4dd5f4ef1..05e2fe385705 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -562,7 +562,7 @@ void ScFormulaCellGroup::compileCode( if (mpCode->GetLen() && mpCode->GetCodeError() == FormulaError::NONE && !mpCode->GetCodeLen()) { bool bMatrixFormula = mpTopCell->GetMatrixFlag() != ScMatrixMode::NONE; - ScCompiler aComp(&rDoc, rPos, *mpCode, eGram, true, bMatrixFormula); + ScCompiler aComp(rDoc, rPos, *mpCode, eGram, true, bMatrixFormula); mbSubTotal = aComp.CompileTokenArray(); mnFormatType = aComp.GetNumFormatType(); } @@ -704,7 +704,7 @@ ScFormulaCell::ScFormulaCell( // Generate RPN token array. if (pCode->GetLen() && pCode->GetCodeError() == FormulaError::NONE && !pCode->GetCodeLen()) { - ScCompiler aComp( &rDocument, aPos, *pCode, eTempGrammar, true, cMatrixFlag != ScMatrixMode::NONE ); + ScCompiler aComp(rDocument, aPos, *pCode, eTempGrammar, true, cMatrixFlag != ScMatrixMode::NONE); bSubTotal = aComp.CompileTokenArray(); nFormatType = aComp.GetNumFormatType(); } @@ -752,7 +752,7 @@ ScFormulaCell::ScFormulaCell( // RPN array generation if( pCode->GetLen() && pCode->GetCodeError() == FormulaError::NONE && !pCode->GetCodeLen() ) { - ScCompiler aComp( &rDocument, aPos, *pCode, eTempGrammar, true, cMatrixFlag != ScMatrixMode::NONE ); + ScCompiler aComp( rDocument, aPos, *pCode, eTempGrammar, true, cMatrixFlag != ScMatrixMode::NONE ); bSubTotal = aComp.CompileTokenArray(); nFormatType = aComp.GetNumFormatType(); } @@ -1002,7 +1002,7 @@ void ScFormulaCell::GetFormula( OUStringBuffer& rBuffer, } else { - ScCompiler aComp( &rDocument, aPos, *pCode, eGrammar, false, false, pContext ); + ScCompiler aComp( rDocument, aPos, *pCode, eGrammar, false, false, pContext ); aComp.CreateStringFromTokenArray( rBuffer ); } } @@ -1013,7 +1013,7 @@ void ScFormulaCell::GetFormula( OUStringBuffer& rBuffer, } else { - ScCompiler aComp( &rDocument, aPos, *pCode, eGrammar, false, false, pContext ); + ScCompiler aComp( rDocument, aPos, *pCode, eGrammar, false, false, pContext ); aComp.CreateStringFromTokenArray( rBuffer ); } @@ -1134,7 +1134,7 @@ void ScFormulaCell::Compile( const OUString& rFormula, bool bNoListening, if ( pCode ) pCode->Clear(); ScTokenArray* pCodeOld = pCode; - ScCompiler aComp( &rDocument, aPos, eGrammar); + ScCompiler aComp( rDocument, aPos, eGrammar); pCode = aComp.CompileString( rFormula ).release(); assert(!mxGroup); delete pCodeOld; @@ -1212,7 +1212,7 @@ void ScFormulaCell::CompileTokenArray( bool bNoListening ) if( !bNoListening && pCode->GetCodeLen() ) EndListeningTo( rDocument ); - ScCompiler aComp(&rDocument, aPos, *pCode, rDocument.GetGrammar(), true, cMatrixFlag != ScMatrixMode::NONE); + ScCompiler aComp(rDocument, aPos, *pCode, rDocument.GetGrammar(), true, cMatrixFlag != ScMatrixMode::NONE); bSubTotal = aComp.CompileTokenArray(); if( pCode->GetCodeError() == FormulaError::NONE ) { @@ -5067,7 +5067,7 @@ bool ScFormulaCell::InterpretFormulaGroupOpenCL(sc::FormulaLogger::GroupScope& a ScTokenArray aCode(rDocument); ScGroupTokenConverter aConverter(aCode, rDocument, *this, xGroup->mpTopCell->aPos); // TODO avoid this extra compilation - ScCompiler aComp( &rDocument, xGroup->mpTopCell->aPos, *pCode, formula::FormulaGrammar::GRAM_UNSPECIFIED, true, cMatrixFlag != ScMatrixMode::NONE ); + ScCompiler aComp( rDocument, xGroup->mpTopCell->aPos, *pCode, formula::FormulaGrammar::GRAM_UNSPECIFIED, true, cMatrixFlag != ScMatrixMode::NONE ); aComp.CompileTokenArray(); if (aComp.HasUnhandledPossibleImplicitIntersections() || !aConverter.convert(*pCode, aScope)) { @@ -5179,7 +5179,7 @@ bool ScFormulaCell::InterpretInvariantFormulaGroup() } } - ScCompiler aComp(&rDocument, aPos, aCode, rDocument.GetGrammar(), true, cMatrixFlag != ScMatrixMode::NONE); + ScCompiler aComp(rDocument, aPos, aCode, rDocument.GetGrammar(), true, cMatrixFlag != ScMatrixMode::NONE); aComp.CompileTokenArray(); // Create RPN token array. ScInterpreter aInterpreter(this, rDocument, rDocument.GetNonThreadedContext(), aPos, aCode); aInterpreter.Interpret(); diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx index e11d1beb3aef..ad26a135c98c 100644 --- a/sc/source/core/data/simpleformulacalc.cxx +++ b/sc/source/core/data/simpleformulacalc.cxx @@ -29,7 +29,7 @@ ScSimpleFormulaCalculator::ScSimpleFormulaCalculator( ScDocument& rDoc, const Sc , mbMatrixFormula(bMatrixFormula) { // compile already here - ScCompiler aComp(&mrDoc, maAddr, eGram, true, bMatrixFormula); + ScCompiler aComp(mrDoc, maAddr, eGram, true, bMatrixFormula); mpCode = aComp.CompileString(rFormula); if(mpCode->GetCodeError() == FormulaError::NONE && mpCode->GetLen()) aComp.CompileTokenArray(); @@ -56,7 +56,7 @@ void ScSimpleFormulaCalculator::Calculate() formula::StackVar aIntType = aInt.Interpret(); if ( aIntType == formula::svMatrixCell ) { - ScCompiler aComp(&mrDoc, maAddr, maGram); + ScCompiler aComp(mrDoc, maAddr, maGram); OUStringBuffer aStr; aComp.CreateStringFromToken(aStr, aInt.GetResultToken().get()); diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 59e4ff1480bf..a12e69ebad07 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -4385,7 +4385,7 @@ CLInterpreterContext createCLInterpreterContext( const ScCalcConfig& rConfig, void genRPNTokens( ScDocument& rDoc, const ScAddress& rTopPos, ScTokenArray& rCode ) { - ScCompiler aComp(&rDoc, rTopPos, rCode, rDoc.GetGrammar()); + ScCompiler aComp(rDoc, rTopPos, rCode, rDoc.GetGrammar()); // Disable special ordering for jump commands for the OpenCL interpreter. aComp.EnableJumpCommandReorder(false); aComp.CompileTokenArray(); // Regenerate RPN tokens. diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 00602e665030..ab7077eca06e 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -1829,11 +1829,11 @@ ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, SetGrammar(rCxt.getGrammar()); } -ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos, ScTokenArray& rArr, +ScCompiler::ScCompiler( ScDocument& rDocument, const ScAddress& rPos, ScTokenArray& rArr, formula::FormulaGrammar::Grammar eGrammar, bool bComputeII, bool bMatrixFlag, const ScInterpreterContext* pContext ) : FormulaCompiler(rArr, bComputeII, bMatrixFlag), - pDoc( pDocument ), + pDoc( &rDocument ), aPos( rPos ), mpFormatter(pContext ? pContext->GetFormatTable() : pDoc->GetFormatTable()), mpInterpreterContext(pContext), @@ -1849,7 +1849,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos, ScTokenArr mbRewind( false ) { SetGrammar( (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED) ? - pDocument->GetGrammar() : + rDocument.GetGrammar() : eGrammar ); } @@ -1874,11 +1874,11 @@ ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, SetGrammar(rCxt.getGrammar()); } -ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos, +ScCompiler::ScCompiler( ScDocument& rDocument, const ScAddress& rPos, formula::FormulaGrammar::Grammar eGrammar, bool bComputeII, bool bMatrixFlag, const ScInterpreterContext* pContext ) : FormulaCompiler(bComputeII, bMatrixFlag), - pDoc( pDocument ), + pDoc( &rDocument ), aPos( rPos ), mpFormatter(pContext ? pContext->GetFormatTable() : pDoc ? pDoc->GetFormatTable() : nullptr), mpInterpreterContext(pContext), @@ -1894,7 +1894,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos, mbRewind( false ) { SetGrammar( (eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED) ? - (pDocument ? pDocument->GetGrammar() : formula::FormulaGrammar::GRAM_DEFAULT) : + rDocument.GetGrammar() : eGrammar ); } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 7e906aa18ea5..cc2c337f3930 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2471,7 +2471,7 @@ void ScInterpreter::ScCellExternal() // ODF 1.2 says we need to always display address using the ODF A1 grammar. ScTokenArray aArray(mrDoc); aArray.AddExternalSingleReference(nFileId, svl::SharedString( aTabName), aRef); // string not interned - ScCompiler aComp(&mrDoc, aPos, aArray, formula::FormulaGrammar::GRAM_ODFF_A1); + ScCompiler aComp(mrDoc, aPos, aArray, formula::FormulaGrammar::GRAM_ODFF_A1); OUString aStr; aComp.CreateStringFromTokenArray(aStr); PushString(aStr); @@ -8193,7 +8193,7 @@ void ScInterpreter::ScIndirect() { do { - ScCompiler aComp( &mrDoc, aPos, mrDoc.GetGrammar()); + ScCompiler aComp( mrDoc, aPos, mrDoc.GetGrammar()); aComp.SetRefConvention( eConv); // must be after grammar std::unique_ptr<ScTokenArray> pTokArr( aComp.CompileString( sRefStr)); diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index 639b7734da92..5f84aa08742f 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -116,7 +116,7 @@ ScRangeData::ScRangeData( ScDocument& rDok, aRefData.SetFlag3D( true ); pCode->AddSingleReference( aRefData ); pCode->SetFromRangeName(true); - ScCompiler aComp( &rDoc, aPos, *pCode, rDoc.GetGrammar() ); + ScCompiler aComp( rDoc, aPos, *pCode, rDoc.GetGrammar() ); aComp.CompileTokenArray(); if ( pCode->GetCodeError() == FormulaError::NONE ) eType |= Type::AbsPos; @@ -150,7 +150,7 @@ void ScRangeData::CompileRangeData( const OUString& rSymbol, bool bSetError ) eTempGrammar = FormulaGrammar::GRAM_NATIVE; } - ScCompiler aComp( &rDoc, aPos, eTempGrammar ); + ScCompiler aComp( rDoc, aPos, eTempGrammar ); if (bSetError) aComp.SetExtendedErrorDetection( ScCompiler::EXTENDED_ERROR_DETECTION_NAME_NO_BREAK); pCode = aComp.CompileString( rSymbol ); @@ -245,14 +245,14 @@ void ScRangeData::GuessPosition() void ScRangeData::GetSymbol( OUString& rSymbol, const FormulaGrammar::Grammar eGrammar ) const { - ScCompiler aComp(&rDoc, aPos, *pCode, eGrammar); + ScCompiler aComp(rDoc, aPos, *pCode, eGrammar); aComp.CreateStringFromTokenArray( rSymbol ); } void ScRangeData::GetSymbol( OUString& rSymbol, const ScAddress& rPos, const FormulaGrammar::Grammar eGrammar ) const { OUString aStr; - ScCompiler aComp(&rDoc, rPos, *pCode, eGrammar); + ScCompiler aComp(rDoc, rPos, *pCode, eGrammar); aComp.CreateStringFromTokenArray( aStr ); rSymbol = aStr; } @@ -260,7 +260,7 @@ void ScRangeData::GetSymbol( OUString& rSymbol, const ScAddress& rPos, const For void ScRangeData::UpdateSymbol( OUStringBuffer& rBuffer, const ScAddress& rPos ) { std::unique_ptr<ScTokenArray> pTemp( pCode->Clone() ); - ScCompiler aComp(&rDoc, rPos, *pTemp, formula::FormulaGrammar::GRAM_DEFAULT); + ScCompiler aComp(rDoc, rPos, *pTemp, formula::FormulaGrammar::GRAM_DEFAULT); aComp.MoveRelWrap(); aComp.CreateStringFromTokenArray( rBuffer ); } diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx index a1ae5510e2d3..1250061e0f53 100644 --- a/sc/source/core/tool/reftokenhelper.cxx +++ b/sc/source/core/tool/reftokenhelper.cxx @@ -51,7 +51,7 @@ void ScRefTokenHelper::compileRangeRepresentation( if (nOffset < 0) break; - ScCompiler aCompiler(&rDoc, ScAddress(0,0,0), eGrammar); + ScCompiler aCompiler(rDoc, ScAddress(0,0,0), eGrammar); std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(aToken)); // There MUST be exactly one reference per range token and nothing diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 7d6ba12e0154..95ece38d976d 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -891,7 +891,7 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > c // Compile the range representation string into token array. Note that the // source range text depends on the current grammar. OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation(); - ScCompiler aComp( &GetDoc(), ScAddress(), GetDoc().GetGrammar() ); + ScCompiler aComp( GetDoc(), ScAddress(), GetDoc().GetGrammar() ); std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(aRangeRepr)); if( !pArray ) return nDefCount; diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 5d32147ecb23..ed729725695d 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -641,7 +641,7 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, const ScRangeData& rRa xTokArr = GetFormulaCompiler().CreateFormula(EXC_FMLATYPE_NAME, *pTokenCopy); if ( GetOutput() != EXC_OUTPUT_BINARY ) { - ScCompiler aComp(&GetDoc(), rRangeData.GetPos(), *pTokenCopy, + ScCompiler aComp(GetDoc(), rRangeData.GetPos(), *pTokenCopy, formula::FormulaGrammar::GRAM_OOXML); aComp.CreateStringFromTokenArray( sSymbol ); } diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index ef3e619ebe10..575aee0c540f 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -252,7 +252,7 @@ void XclExpRoot::InitializeGlobals() SAL_WARN( "sc", "XclExpRoot::InitializeGlobals - no OpCodeMap"); break; } - ScCompiler aCompiler( &rDoc, ScAddress(), rDoc.GetGrammar()); + ScCompiler aCompiler( rDoc, ScAddress(), rDoc.GetGrammar()); mrExpData.mxOpCodeMap = formula::FormulaCompiler::CreateOpCodeMap( aOpCodeMapping, true); } while(false); } diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 10650658d8be..4d74f16fc81b 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -836,7 +836,7 @@ Reference< XDataSequence > XclImpChSourceLink::CreateDataSequence( const OUStrin { if ( mxTokenArray ) { - ScCompiler aComp( &GetDoc(), ScAddress(), *mxTokenArray, GetDoc().GetGrammar() ); + ScCompiler aComp( GetDoc(), ScAddress(), *mxTokenArray, GetDoc().GetGrammar() ); OUStringBuffer aRangeRep; aComp.CreateStringFromTokenArray( aRangeRep ); try diff --git a/sc/source/filter/oox/defnamesbuffer.cxx b/sc/source/filter/oox/defnamesbuffer.cxx index 467fba66e804..aa8a9b30139e 100644 --- a/sc/source/filter/oox/defnamesbuffer.cxx +++ b/sc/source/filter/oox/defnamesbuffer.cxx @@ -241,7 +241,7 @@ void DefinedName::createNameObject( sal_Int32 nIndex ) std::unique_ptr<ScTokenArray> DefinedName::getScTokens( const css::uno::Sequence<css::sheet::ExternalLinkInfo>& rExternalLinks ) { - ScCompiler aCompiler(&getScDocument(), ScAddress(0, 0, mnCalcSheet), formula::FormulaGrammar::GRAM_OOXML); + ScCompiler aCompiler(getScDocument(), ScAddress(0, 0, mnCalcSheet), formula::FormulaGrammar::GRAM_OOXML); aCompiler.SetExternalLinks( rExternalLinks); std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(maModel.maFormula)); // Compile the tokens into RPN once to populate information into tokens diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 50e93944850a..e47fb744d281 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -115,7 +115,7 @@ void applySharedFormulas( sal_Int32 nId = rEntry.mnSharedId; const OUString& rTokenStr = rEntry.maTokenStr; - ScCompiler aComp(&rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML, true, false); + ScCompiler aComp(rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML, true, false); aComp.SetNumberFormatter(&rFormatter); std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(rTokenStr); if (pArray) @@ -234,7 +234,7 @@ void applyCellFormulas( continue; } - ScCompiler aCompiler(&rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML, true, false); + ScCompiler aCompiler(rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML, true, false); aCompiler.SetNumberFormatter(&rFormatter); aCompiler.SetExternalLinks(rExternalLinks); std::unique_ptr<ScTokenArray> pCode = aCompiler.CompileString(rItem.maTokenStr); @@ -257,7 +257,7 @@ void applyArrayFormulas( { const ScAddress& aPos = rAddressItem.maTokenAndAddress.maAddress; - ScCompiler aComp(&rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML); + ScCompiler aComp(rDoc.getDoc(), aPos, formula::FormulaGrammar::GRAM_OOXML); aComp.SetNumberFormatter(&rFormatter); std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(rAddressItem.maTokenAndAddress.maTokenStr)); if (pArray) diff --git a/sc/source/filter/oox/revisionfragment.cxx b/sc/source/filter/oox/revisionfragment.cxx index 72269cf8d3b3..537149108597 100644 --- a/sc/source/filter/oox/revisionfragment.cxx +++ b/sc/source/filter/oox/revisionfragment.cxx @@ -118,7 +118,7 @@ protected: { // formula string ScDocument& rDoc = getScDocument(); - ScCompiler aComp(&rDoc, mrPos, formula::FormulaGrammar::GRAM_OOXML); + ScCompiler aComp(rDoc, mrPos, formula::FormulaGrammar::GRAM_OOXML); std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(rChars); if (!pArray) break; diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index 2b1b0aa459a0..ccce5bb9e436 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -496,7 +496,7 @@ void ScOrcusFactory::finalize() aRange.aEnd.IncCol(rToken.mnIndex1-1); aRange.aEnd.IncRow(rToken.mnIndex2-1); - ScCompiler aComp(&maDoc.getDoc(), aRange.aStart, rToken.meGrammar); + ScCompiler aComp(maDoc.getDoc(), aRange.aStart, rToken.meGrammar); std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(rToken.maStr1)); if (!pArray) break; @@ -1010,7 +1010,7 @@ void ScOrcusFormula::commit() // topmost shared formula with new formula token. // Compile the formula expression into tokens. - ScCompiler aComp(&mrSheet.getDoc().getDoc(), aPos, meGrammar); + ScCompiler aComp(mrSheet.getDoc().getDoc(), aPos, meGrammar); std::unique_ptr<ScTokenArray> pArray = aComp.CompileString(maFormula); if (!pArray) // Tokenization failed. diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 318e7c079458..6344714fff3a 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -231,6 +231,7 @@ static bool HasOneSingleFullyRelativeReference( const ScTokenArray* pTokens, ScS void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElement*/ ) { ScDocument* pDoc = GetScImport().GetDocument(); + assert(pDoc); SCTAB nTab = GetScImport().GetTables().GetCurrentSheet(); std::unique_ptr<ScConditionalFormat> pFormat(std::move(mxFormat)); @@ -256,7 +257,7 @@ void SAL_CALL ScXMLConditionalFormatContext::endFastElement( sal_Int32 /*nElemen OUString aSrcString = pCondFormatEntry->GetSrcString(); if ( !aSrcString.isEmpty() ) aSrcPos.Parse( aSrcString, pDoc ); - ScCompiler aComp( pDoc, aSrcPos ); + ScCompiler aComp( *pDoc, aSrcPos ); aComp.SetGrammar( formula::FormulaGrammar::GRAM_ODFF ); pTokens = aComp.CompileString( pCondFormatEntry->GetExpression(aSrcPos, 0), "" ); if (HasRelRefIgnoringSheet0Relative( pDoc, pTokens.get() )) diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 142d794c26da..f4c90522d324 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1350,7 +1350,7 @@ void SAL_CALL ScXMLImport::setTargetDocument( const css::uno::Reference< css::la throw lang::IllegalArgumentException(); mpDocImport.reset(new ScDocumentImport(*pDoc)); - mpComp.reset(new ScCompiler(pDoc, ScAddress(), formula::FormulaGrammar::GRAM_ODFF)); + mpComp.reset(new ScCompiler(*pDoc, ScAddress(), formula::FormulaGrammar::GRAM_ODFF)); uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY); if (xActionLockable.is()) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8794f70eefa6..6712b3c97930 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -107,7 +107,7 @@ const sal_Unicode cParenthesesReplacement = 0x0001; sal_Unicode lcl_getSheetSeparator(ScDocument* pDoc) { - ScCompiler aComp(pDoc, ScAddress(), pDoc->GetGrammar()); + ScCompiler aComp(*pDoc, ScAddress(), pDoc->GetGrammar()); return aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR); } diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 5836221cba22..fc2f19cd7559 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -254,7 +254,7 @@ IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, formula::RefEdit&, rRefEdit, void) return; } - ScCompiler aComp( mpDoc, maPos, mpDoc->GetGrammar() ); + ScCompiler aComp( *mpDoc, maPos, mpDoc->GetGrammar() ); std::unique_ptr<ScTokenArray> ta(aComp.CompileString(aFormula)); // Error, warn the user diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index a3bfe3096566..e70b6c7c1c02 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4367,7 +4367,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, } else if (bEnglish) { - ScCompiler aComp( &rDoc, rRange.aStart, eGrammar); + ScCompiler aComp( rDoc, rRange.aStart, eGrammar); std::unique_ptr<ScTokenArray> pCode = aComp.CompileString( rString ); rDoc.InsertMatrixFormula( nStartCol, nStartRow, nEndCol, nEndRow, aMark, EMPTY_OUSTRING, pCode.get(), eGrammar); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index b4beea0c2f3d..4bae9f2a798b 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1943,7 +1943,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) * R1C1 is what Excel writes in SYLK, or even * better GRAM_ENGLISH_XL_R1C1. */ const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_PODF_A1; - ScCompiler aComp( &rDoc, aPos, eGrammar); + ScCompiler aComp(rDoc, aPos, eGrammar); std::unique_ptr<ScTokenArray> xCode(aComp.CompileString(aText)); // ctor/InsertMatrixFormula did copy TokenArray rDoc.CheckLinkFormulaNeedingCheck(*xCode); if ( ch == 'M' ) diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index b1d703ecd60f..36a8905fa10e 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -363,7 +363,7 @@ bool ScFormulaDlg::calculateValue( const OUString& rStrExp, OUString& rStrResult std::shared_ptr<formula::FormulaCompiler> ScFormulaDlg::getCompiler() const { if (!m_xCompiler) - m_xCompiler = std::make_shared<ScCompiler>( m_pDoc, m_CursorPos, m_pDoc->GetGrammar()); + m_xCompiler = std::make_shared<ScCompiler>(*m_pDoc, m_CursorPos, m_pDoc->GetGrammar()); return m_xCompiler; } @@ -373,7 +373,7 @@ std::unique_ptr<formula::FormulaCompiler> ScFormulaDlg::createCompiler( formula: ScTokenArray* pArr = dynamic_cast<ScTokenArray*>(&rArray); assert(pArr); // violation of contract and not created using convertToTokenArray()? if (pArr) - pCompiler = new ScCompiler( m_pDoc, m_CursorPos, *pArr, m_pDoc->GetGrammar()); + pCompiler = new ScCompiler(*m_pDoc, m_CursorPos, *pArr, m_pDoc->GetGrammar()); return std::unique_ptr<formula::FormulaCompiler>(pCompiler); } @@ -464,7 +464,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument& rRefDoc ) aArray.AddSingleReference(aRefData.Ref1); else aArray.AddDoubleReference(aRefData); - ScCompiler aComp(m_pDoc, m_CursorPos, aArray, m_pDoc->GetGrammar()); + ScCompiler aComp(*m_pDoc, m_CursorPos, aArray, m_pDoc->GetGrammar()); OUStringBuffer aBuf; aComp.CreateStringFromTokenArray(aBuf); aRefStr = aBuf.makeStringAndClear(); diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 968bb5f4cf69..a30218118bcc 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -325,7 +325,7 @@ void ScFormulaReferenceHelper::Init() SCTAB nTab = pViewData->GetTabNo(); ScAddress aCursorPos( nCol, nRow, nTab ); - m_pRefComp.reset( new ScCompiler( &rDoc, aCursorPos, rDoc.GetGrammar()) ); + m_pRefComp.reset( new ScCompiler( rDoc, aCursorPos, rDoc.GetGrammar()) ); m_pRefComp->EnableJumpCommandReorder(false); m_pRefComp->EnableStopOnError(false); diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index fe1db9e5a1aa..c5404c634ac4 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -103,7 +103,7 @@ void ScNameDefDlg::CancelPushed() bool ScNameDefDlg::IsFormulaValid() { - ScCompiler aComp( &mrDoc, maCursorPos, mrDoc.GetGrammar()); + ScCompiler aComp(mrDoc, maCursorPos, mrDoc.GetGrammar()); std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdRange->GetText()); if (pCode->GetCodeError() != FormulaError::NONE) { diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 6ba2852a1122..85e391890182 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -266,7 +266,7 @@ bool ScNameDlg::IsNameValid() bool ScNameDlg::IsFormulaValid() { - ScCompiler aComp( &mrDoc, maCursorPos, mrDoc.GetGrammar()); + ScCompiler aComp(mrDoc, maCursorPos, mrDoc.GetGrammar()); std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdAssign->GetText()); if (pCode->GetCodeError() != FormulaError::NONE) { diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index a888ebc4ccbe..2d3a61972efa 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -824,7 +824,7 @@ public: void operator() (const ScTokenRef& rToken) { - ScCompiler aCompiler(mpDoc, ScAddress(0,0,0), meGrammar); + ScCompiler aCompiler(*mpDoc, ScAddress(0,0,0), meGrammar); OUString aStr; aCompiler.CreateStringFromToken(aStr, rToken.get()); if (mbFirst) @@ -877,7 +877,7 @@ public: OSL_ENSURE(bValidToken, "invalid token"); if (!bValidToken) return; - ScCompiler aCompiler(mpDoc, ScAddress(0,0,0), FormulaGrammar::GRAM_ENGLISH); + ScCompiler aCompiler(*mpDoc, ScAddress(0,0,0), FormulaGrammar::GRAM_ENGLISH); { OUString aStr; aCompiler.CreateStringFromToken(aStr, aStart.get()); diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index ed037323e819..241c443d040d 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -720,7 +720,7 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue( OUString aFormula; if ((aValue >>= aFormula) && !aFormula.isEmpty()) { - ScCompiler aComp(&mpDocShell->GetDocument(), getCoreObject()->GetSrcPos()); + ScCompiler aComp(mpDocShell->GetDocument(), getCoreObject()->GetSrcPos()); aComp.SetGrammar(mpDocShell->GetDocument().GetGrammar()); std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aFormula)); getCoreObject()->SetFormula1(*pArr); @@ -732,7 +732,7 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue( OUString aFormula; if ((aValue >>= aFormula) && !aFormula.isEmpty()) { - ScCompiler aComp(&mpDocShell->GetDocument(), getCoreObject()->GetSrcPos()); + ScCompiler aComp(mpDocShell->GetDocument(), getCoreObject()->GetSrcPos()); aComp.SetGrammar(mpDocShell->GetDocument().GetGrammar()); std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aFormula)); getCoreObject()->SetFormula2(*pArr); diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 7e853fea6f07..89ea794a3583 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -467,7 +467,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, /// TODO: check ScAddress aAdr; - ScCompiler aCompiler(pDoc, aAdr, pDoc->GetGrammar()); + ScCompiler aCompiler(*pDoc, aAdr, pDoc->GetGrammar()); // find function diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 3a009a977bef..b3e650d5d41e 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -558,7 +558,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( { ScDocument& rDoc = pDocShell->GetDocument(); ScAddress aAddress; - ScCompiler* pComp = new ScCompiler(&rDoc, aAddress, rDoc.GetGrammar()); + ScCompiler* pComp = new ScCompiler(rDoc, aAddress, rDoc.GetGrammar()); xRet.set(static_cast<sheet::XFormulaOpCodeMapper*>(new ScFormulaOpCodeMapperObj(::std::unique_ptr<formula::FormulaCompiler> (pComp)))); break; } diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 713d924e28c7..4f461777c056 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -135,7 +135,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula( ScAddress aRefPos( ScAddress::UNINITIALIZED ); ScUnoConversion::FillScAddress( aRefPos, rReferencePos ); - ScCompiler aCompiler( &rDoc, aRefPos, rDoc.GetGrammar()); + ScCompiler aCompiler( rDoc, aRefPos, rDoc.GetGrammar()); SetCompilerFlags( aCompiler ); std::unique_ptr<ScTokenArray> pCode = aCompiler.CompileString( aFormula ); @@ -158,7 +158,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, rDoc.GetGrammar()); + ScCompiler aCompiler(rDoc, aRefPos, aCode, rDoc.GetGrammar()); SetCompilerFlags( aCompiler ); OUStringBuffer aBuffer; @@ -198,7 +198,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( if (mxOpCodeMap && mbEnglish != bOldEnglish) { ScDocument& rDoc = mpDocShell->GetDocument(); - ScCompiler aCompiler( &rDoc, ScAddress(), rDoc.GetGrammar()); + ScCompiler aCompiler( rDoc, ScAddress(), rDoc.GetGrammar()); mxOpCodeMap = formula::FormulaCompiler::CreateOpCodeMap( maOpCodeMapping, mbEnglish); } @@ -217,7 +217,7 @@ void SAL_CALL ScFormulaParserObj::setPropertyValue( throw lang::IllegalArgumentException(); ScDocument& rDoc = mpDocShell->GetDocument(); - ScCompiler aCompiler( &rDoc, ScAddress(), rDoc.GetGrammar()); + ScCompiler aCompiler(rDoc, ScAddress(), rDoc.GetGrammar()); mxOpCodeMap = formula::FormulaCompiler::CreateOpCodeMap( maOpCodeMapping, mbEnglish); } diff --git a/sc/source/ui/vba/vbaname.cxx b/sc/source/ui/vba/vbaname.cxx index 45e88a4c1395..5f923da844dd 100644 --- a/sc/source/ui/vba/vbaname.cxx +++ b/sc/source/ui/vba/vbaname.cxx @@ -114,7 +114,7 @@ void ScVbaName::setContent( const OUString& rContent, const formula::FormulaGra if (pOldData) { // Shorter way of doing this ? - ScCompiler aComp( &rDoc, pOldData->GetPos(), eGrammar ); + ScCompiler aComp( rDoc, pOldData->GetPos(), eGrammar ); std::unique_ptr<ScTokenArray> pArray(aComp.CompileString(sContent)); pOldData->SetCode(*pArray); } diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 1b498536ad9f..79a7a80ab68c 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -149,7 +149,7 @@ ScVbaNames::Add( const css::uno::Any& Name , if ( !xRange.is() && !sFormula.isEmpty() ) { ScAddress aBlank; - ScCompiler aComp( &getScDocument(), aBlank, eGram ); + ScCompiler aComp( getScDocument(), aBlank, eGram ); std::unique_ptr<ScTokenArray> pTokens(aComp.CompileString(sFormula)); if ( pTokens ) { diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 0efbaa4965b9..9624c8ae15a4 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -877,7 +877,7 @@ protected: if ( pUnoRangesBase ) { ScRangeList aCellRanges = pUnoRangesBase->GetRangeList(); - ScCompiler aCompiler( &m_rDoc, aCellRanges.front().aStart, m_eGrammar ); + ScCompiler aCompiler( m_rDoc, aCellRanges.front().aStart, m_eGrammar ); // compile the string in the format passed in std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(sFormula)); // set desired convention to that of the document @@ -920,7 +920,7 @@ public: pUnoRangesBase ) { ScRangeList aCellRanges = pUnoRangesBase->GetRangeList(); - ScCompiler aCompiler( &m_rDoc, aCellRanges.front().aStart, formula::FormulaGrammar::GRAM_DEFAULT ); + ScCompiler aCompiler( m_rDoc, aCellRanges.front().aStart, formula::FormulaGrammar::GRAM_DEFAULT ); std::unique_ptr<ScTokenArray> pArray(aCompiler.CompileString(sVal)); // set desired convention aCompiler.SetGrammar( m_eGrammar ); diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 3a1e19672f97..6abcb03825d8 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -604,7 +604,7 @@ bool ScTabViewShell::IsRefInputMode() const const ScViewData& rViewData = GetViewData(); ScDocument& rDoc = rViewData.GetDocument(); const ScAddress aPos( rViewData.GetCurPos() ); - ScCompiler aComp( &rDoc, aPos, rDoc.GetGrammar() ); + ScCompiler aComp( rDoc, aPos, rDoc.GetGrammar() ); aComp.SetCloseBrackets( false ); std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aString)); if ( pArr && pArr->MayReferenceFollow() ) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index fcf925afaad9..2bdd53892bf3 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -838,7 +838,7 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub pArray->AddOpCode(ocClose); - ScCompiler aComp(&rDoc, rAddr, *pArray, rDoc.GetGrammar()); + ScCompiler aComp(rDoc, rAddr, *pArray, rDoc.GetGrammar()); OUStringBuffer aBuf; aComp.CreateStringFromTokenArray(aBuf); OUString aFormula = aBuf.makeStringAndClear(); diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 24dd97e9ba9e..c3bb7fff8f9e 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -264,7 +264,7 @@ void ScViewFunc::DoRefConversion() { ScAddress aPos = pCell->aPos; const OUString& aNew = aFinder.GetText(); - ScCompiler aComp( &rDoc, aPos, rDoc.GetGrammar()); + ScCompiler aComp( rDoc, aPos, rDoc.GetGrammar()); std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew)); ScFormulaCell* pNewCell = new ScFormulaCell( diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index fd9650c149c0..31a357325aa5 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -405,7 +405,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { // formula, compile with autoCorrection i = rMark.GetFirstSelected(); ScAddress aPos( nCol, nRow, i ); - ScCompiler aComp( &rDoc, aPos, rDoc.GetGrammar(), true, false ); + ScCompiler aComp( rDoc, aPos, rDoc.GetGrammar(), true, false ); //2do: enable/disable autoCorrection via calcoptions aComp.SetAutoCorrection( true ); if ( rString[0] == '+' || rString[0] == '-' ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits