sc/source/core/data/formulacell.cxx | 10 - sc/source/core/data/simpleformulacalc.cxx | 2 sc/source/core/inc/interpre.hxx | 4 sc/source/core/tool/interpr1.cxx | 286 +++++++++++++++--------------- sc/source/core/tool/interpr2.cxx | 52 ++--- sc/source/core/tool/interpr3.cxx | 34 +-- sc/source/core/tool/interpr4.cxx | 220 +++++++++++------------ sc/source/core/tool/interpr5.cxx | 30 +-- sc/source/core/tool/interpr6.cxx | 14 - sc/source/core/tool/interpr7.cxx | 22 +- sc/source/core/tool/interpr8.cxx | 14 - 11 files changed, 344 insertions(+), 344 deletions(-)
New commits: commit 6cf2d7e9b5ea749fe4770a4cf7d12d86a4791978 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Sep 12 14:23:16 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Sep 13 15:14:43 2020 +0200 establish ScInterpreter::pDok is never null Change-Id: I493eedebcb35fbbf4917ea77f812be43989db6ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102523 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 24d77cb2369a..79b7738e3471 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1928,7 +1928,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa } else { - pScopedInterpreter.reset(new ScInterpreter( this, pDocument, rContext, aPos, *pCode )); + pScopedInterpreter.reset(new ScInterpreter( this, *pDocument, rContext, aPos, *pCode )); pInterpreter = pScopedInterpreter.get(); } @@ -2354,7 +2354,7 @@ void ScFormulaCell::HandleStuffAfterParallelCalculation(ScInterpreter* pInterpre pInterpreter->Init(this, aPos, *pCode); else { - pScopedInterpreter.reset(new ScInterpreter( this, pDocument, pDocument->GetNonThreadedContext(), aPos, *pCode )); + pScopedInterpreter.reset(new ScInterpreter( this, *pDocument, pDocument->GetNonThreadedContext(), aPos, *pCode )); pInterpreter = pScopedInterpreter.get(); } @@ -4928,7 +4928,7 @@ bool ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope { context = aContextGetterGuard.GetInterpreterContextForThreadIdx(i); assert(!context->pInterpreter); - aInterpreters[i].reset(new ScInterpreter(this, pDocument, *context, mxGroup->mpTopCell->aPos, *pCode, true)); + aInterpreters[i].reset(new ScInterpreter(this, *pDocument, *context, mxGroup->mpTopCell->aPos, *pCode, true)); context->pInterpreter = aInterpreters[i].get(); ScDocument::SetupFromNonThreadedContext(*context, i); rThreadPool.pushTask(std::make_unique<Executor>(aTag, i, nThreadCount, pDocument, context, mxGroup->mpTopCell->aPos, @@ -5181,14 +5181,14 @@ bool ScFormulaCell::InterpretInvariantFormulaGroup() ScCompiler aComp(pDocument, aPos, aCode, pDocument->GetGrammar(), true, cMatrixFlag != ScMatrixMode::NONE); aComp.CompileTokenArray(); // Create RPN token array. - ScInterpreter aInterpreter(this, pDocument, pDocument->GetNonThreadedContext(), aPos, aCode); + ScInterpreter aInterpreter(this, *pDocument, pDocument->GetNonThreadedContext(), aPos, aCode); aInterpreter.Interpret(); aResult.SetToken(aInterpreter.GetResultToken().get()); } else { // Formula contains no references. - ScInterpreter aInterpreter(this, pDocument, pDocument->GetNonThreadedContext(), aPos, *pCode); + ScInterpreter aInterpreter(this, *pDocument, pDocument->GetNonThreadedContext(), aPos, *pCode); aInterpreter.Interpret(); aResult.SetToken(aInterpreter.GetResultToken().get()); } diff --git a/sc/source/core/data/simpleformulacalc.cxx b/sc/source/core/data/simpleformulacalc.cxx index caeef59e7e61..e11d1beb3aef 100644 --- a/sc/source/core/data/simpleformulacalc.cxx +++ b/sc/source/core/data/simpleformulacalc.cxx @@ -46,7 +46,7 @@ void ScSimpleFormulaCalculator::Calculate() mbCalculated = true; - ScInterpreter aInt(mrDoc.GetFormulaCell( maAddr ), &mrDoc, mrDoc.GetNonThreadedContext(), maAddr, *mpCode); + ScInterpreter aInt(mrDoc.GetFormulaCell( maAddr ), mrDoc, mrDoc.GetNonThreadedContext(), maAddr, *mpCode); if (mbMatrixFormula) aInt.AssertFormulaMatrix(); diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 9aaeeb96259c..7c024e6e9150 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -197,7 +197,7 @@ private: ScAddress aPos; ScTokenArray* pArr; ScInterpreterContext& mrContext; - ScDocument* pDok; + ScDocument& mrDoc; sfx2::LinkManager* mpLinkManager; svl::SharedStringPool& mrStrPool; formula::FormulaConstTokenRef xResult; @@ -1006,7 +1006,7 @@ private: double GetTInv( double fAlpha, double fSize, int nType ); public: - ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc, ScInterpreterContext& rContext, + ScInterpreter( ScFormulaCell* pCell, ScDocument& rDoc, ScInterpreterContext& rContext, const ScAddress&, ScTokenArray&, bool bForGroupThreading = false ); ~ScInterpreter(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 44e0f9293617..b66d84ae41e2 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -282,7 +282,7 @@ void ScInterpreter::ScIfError( bool bNAonly ) else { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); nGlobalError = GetCellErrCode(aCell); if (nGlobalError != FormulaError::NONE) bError = true; @@ -597,7 +597,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) } else { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasEmptyValue()) pJumpMatrix->PutResultEmpty( nC, nR ); else if (aCell.hasNumeric()) @@ -675,7 +675,7 @@ bool ScInterpreter::JumpMatrix( short nStackLevel ) nRow = aRange.aStart.Row(); aAdr.SetCol( static_cast<SCCOL>(nCol) ); aAdr.SetRow( static_cast<SCROW>(nRow) ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasEmptyValue()) pJumpMatrix->PutResultEmpty( nC, nR ); else if (aCell.hasNumeric()) @@ -886,7 +886,7 @@ double ScInterpreter::Compare( ScQueryOp eOp ) { sc::Compare aComp; aComp.meOp = eOp; - aComp.mbIgnoreCase = pDok->GetDocOptions().IsIgnoreCase(); + aComp.mbIgnoreCase = mrDoc.GetDocOptions().IsIgnoreCase(); for( short i = 1; i >= 0; i-- ) { sc::Compare::Cell& rCell = aComp.maCells[i]; @@ -912,7 +912,7 @@ double ScInterpreter::Compare( ScQueryOp eOp ) ScAddress aAdr; if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasEmptyValue()) rCell.mbEmpty = true; else if (aCell.hasString()) @@ -983,7 +983,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, sc::CompareOptions* pO { sc::Compare aComp; aComp.meOp = eOp; - aComp.mbIgnoreCase = pDok->GetDocOptions().IsIgnoreCase(); + aComp.mbIgnoreCase = mrDoc.GetDocOptions().IsIgnoreCase(); sc::RangeMatrix aMat[2]; ScAddress aAdr; for( short i = 1; i >= 0; i-- ) @@ -1008,7 +1008,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, sc::CompareOptions* pO case svSingleRef: { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasEmptyValue()) rCell.mbEmpty = true; else if (aCell.hasString()) @@ -1295,7 +1295,7 @@ void ScInterpreter::ScAnd() PopSingleRef( aAdr ); if ( nGlobalError == FormulaError::NONE ) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { bHaveValue = true; @@ -1314,7 +1314,7 @@ void ScInterpreter::ScAnd() { double fVal; FormulaError nErr = FormulaError::NONE; - ScValueIterator aValIter( pDok, aRange ); + ScValueIterator aValIter( &mrDoc, aRange ); if ( aValIter.GetFirst( fVal, nErr ) && nErr == FormulaError::NONE ) { bHaveValue = true; @@ -1393,7 +1393,7 @@ void ScInterpreter::ScOr() PopSingleRef( aAdr ); if ( nGlobalError == FormulaError::NONE ) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { bHaveValue = true; @@ -1412,7 +1412,7 @@ void ScInterpreter::ScOr() { double fVal; FormulaError nErr = FormulaError::NONE; - ScValueIterator aValIter( pDok, aRange ); + ScValueIterator aValIter( &mrDoc, aRange ); if ( aValIter.GetFirst( fVal, nErr ) ) { bHaveValue = true; @@ -1493,7 +1493,7 @@ void ScInterpreter::ScXor() PopSingleRef( aAdr ); if ( nGlobalError == FormulaError::NONE ) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { bHaveValue = true; @@ -1514,7 +1514,7 @@ void ScInterpreter::ScXor() { double fVal; FormulaError nErr = FormulaError::NONE; - ScValueIterator aValIter( pDok, aRange ); + ScValueIterator aValIter( &mrDoc, aRange ); if ( aValIter.GetFirst( fVal, nErr ) ) { bHaveValue = true; @@ -1988,7 +1988,7 @@ void ScInterpreter::ScIsEmpty() // NOTE: this differs from COUNTBLANK() ScCountEmptyCells() that // may treat ="" in the referenced cell as blank for Excel // interoperability. - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.meType == CELLTYPE_NONE) nRes = 1; } @@ -2037,7 +2037,7 @@ bool ScInterpreter::IsString() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (GetCellErrCode(aCell) == FormulaError::NONE) { switch (aCell.meType) @@ -2110,7 +2110,7 @@ void ScInterpreter::ScIsLogical() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (GetCellErrCode(aCell) == FormulaError::NONE) { if (aCell.hasNumeric()) @@ -2151,7 +2151,7 @@ void ScInterpreter::ScType() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (GetCellErrCode(aCell) == FormulaError::NONE) { switch (aCell.meType) @@ -2268,7 +2268,7 @@ void ScInterpreter::ScCell() PushIllegalParameter(); else { - ScRefCellValue aCell(*pDok, aCellPos); + ScRefCellValue aCell(mrDoc, aCellPos); ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell); @@ -2288,20 +2288,20 @@ void ScInterpreter::ScCell() else if( aInfoType == "ADDRESS" ) { // address formatted as [['FILENAME'#]$TABLE.]$COL$ROW ScRefFlags nFlags = (aCellPos.Tab() == aPos.Tab()) ? ScRefFlags::ADDR_ABS : ScRefFlags::ADDR_ABS_3D; - OUString aStr(aCellPos.Format(nFlags, pDok, pDok->GetAddressConvention())); + OUString aStr(aCellPos.Format(nFlags, &mrDoc, mrDoc.GetAddressConvention())); PushString(aStr); } else if( aInfoType == "FILENAME" ) { // file name and table name: 'FILENAME'#$TABLE SCTAB nTab = aCellPos.Tab(); OUString aFuncResult; - if( nTab < pDok->GetTableCount() ) + if( nTab < mrDoc.GetTableCount() ) { - if( pDok->GetLinkMode( nTab ) == ScLinkMode::VALUE ) - pDok->GetName( nTab, aFuncResult ); + if( mrDoc.GetLinkMode( nTab ) == ScLinkMode::VALUE ) + mrDoc.GetName( nTab, aFuncResult ); else { - SfxObjectShell* pShell = pDok->GetDocumentShell(); + SfxObjectShell* pShell = mrDoc.GetDocumentShell(); if( pShell && pShell->GetMedium() ) { OUStringBuffer aBuf; @@ -2310,7 +2310,7 @@ void ScInterpreter::ScCell() aBuf.append(rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)); aBuf.append("'#$"); OUString aTabName; - pDok->GetName( nTab, aTabName ); + mrDoc.GetName( nTab, aTabName ); aBuf.append(aTabName); aFuncResult = aBuf.makeStringAndClear(); } @@ -2323,10 +2323,10 @@ void ScInterpreter::ScCell() // Yes, passing tab as col is intentional! OUString aCellStr1 = ScAddress( static_cast<SCCOL>(aCellPos.Tab()), 0, 0 ).Format( - (ScRefFlags::COL_ABS|ScRefFlags::COL_VALID), nullptr, pDok->GetAddressConvention() ); + (ScRefFlags::COL_ABS|ScRefFlags::COL_VALID), nullptr, mrDoc.GetAddressConvention() ); OUString aCellStr2 = aCellPos.Format((ScRefFlags::COL_ABS|ScRefFlags::COL_VALID|ScRefFlags::ROW_ABS|ScRefFlags::ROW_VALID), - nullptr, pDok->GetAddressConvention()); + nullptr, mrDoc.GetAddressConvention()); OUString aFuncResult = aCellStr1 + ":" + aCellStr2; PushString( aFuncResult ); } @@ -2354,19 +2354,19 @@ void ScInterpreter::ScCell() } else if( aInfoType == "WIDTH" ) { // column width (rounded off as count of zero characters in standard font and size) - Printer* pPrinter = pDok->GetPrinter(); + Printer* pPrinter = mrDoc.GetPrinter(); MapMode aOldMode( pPrinter->GetMapMode() ); vcl::Font aOldFont( pPrinter->GetFont() ); vcl::Font aDefFont; pPrinter->SetMapMode(MapMode(MapUnit::MapTwip)); // font color doesn't matter here - pDok->GetDefPattern()->GetFont( aDefFont, SC_AUTOCOL_BLACK, pPrinter ); + mrDoc.GetDefPattern()->GetFont( aDefFont, SC_AUTOCOL_BLACK, pPrinter ); pPrinter->SetFont( aDefFont ); long nZeroWidth = pPrinter->GetTextWidth( OUString( '0' ) ); pPrinter->SetFont( aOldFont ); pPrinter->SetMapMode( aOldMode ); - int nZeroCount = static_cast<int>(pDok->GetColWidth( aCellPos.Col(), aCellPos.Tab() ) / nZeroWidth); + int nZeroCount = static_cast<int>(mrDoc.GetColWidth( aCellPos.Col(), aCellPos.Tab() ) / nZeroWidth); PushInt( nZeroCount ); } else if( aInfoType == "PREFIX" ) @@ -2374,7 +2374,7 @@ void ScInterpreter::ScCell() sal_Unicode c = 0; if (aCell.hasString()) { - const SvxHorJustifyItem* pJustAttr = pDok->GetAttr( aCellPos, ATTR_HOR_JUSTIFY ); + const SvxHorJustifyItem* pJustAttr = mrDoc.GetAttr( aCellPos, ATTR_HOR_JUSTIFY ); switch( pJustAttr->GetValue() ) { case SvxCellHorJustify::Standard: @@ -2389,7 +2389,7 @@ void ScInterpreter::ScCell() } else if( aInfoType == "PROTECT" ) { // 1 = cell locked - const ScProtectionAttr* pProtAttr = pDok->GetAttr( aCellPos, ATTR_PROTECTION ); + const ScProtectionAttr* pProtAttr = mrDoc.GetAttr( aCellPos, ATTR_PROTECTION ); PushInt( pProtAttr->GetProtection() ? 1 : 0 ); } @@ -2397,18 +2397,18 @@ void ScInterpreter::ScCell() else if( aInfoType == "FORMAT" ) { // specific format code for standard formats OUString aFuncResult; - sal_uInt32 nFormat = pDok->GetNumberFormat( aCellPos ); + sal_uInt32 nFormat = mrDoc.GetNumberFormat( aCellPos ); getFormatString(pFormatter, nFormat, aFuncResult); PushString( aFuncResult ); } else if( aInfoType == "COLOR" ) { // 1 = negative values are colored, otherwise 0 - const SvNumberformat* pFormat = pFormatter->GetEntry( pDok->GetNumberFormat( aCellPos ) ); + const SvNumberformat* pFormat = pFormatter->GetEntry( mrDoc.GetNumberFormat( aCellPos ) ); PushInt( lcl_FormatHasNegColor( pFormat ) ? 1 : 0 ); } else if( aInfoType == "PARENTHESES" ) { // 1 = format string contains a '(' character, otherwise 0 - const SvNumberformat* pFormat = pFormatter->GetEntry( pDok->GetNumberFormat( aCellPos ) ); + const SvNumberformat* pFormat = pFormatter->GetEntry( mrDoc.GetNumberFormat( aCellPos ) ); PushInt( lcl_FormatHasOpenPar( pFormat ) ? 1 : 0 ); } else @@ -2450,7 +2450,7 @@ void ScInterpreter::ScCellExternal() aRef.SetAbsTab(-1); // revert the value. ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell); - ScExternalRefManager* pRefMgr = pDok->GetExternalRefManager(); + ScExternalRefManager* pRefMgr = mrDoc.GetExternalRefManager(); if ( aInfoType == "COL" ) PushInt(nCol + 1); @@ -2469,9 +2469,9 @@ void ScInterpreter::ScCellExternal() else if ( aInfoType == "ADDRESS" ) { // ODF 1.2 says we need to always display address using the ODF A1 grammar. - ScTokenArray aArray(pDok); + ScTokenArray aArray(&mrDoc); aArray.AddExternalSingleReference(nFileId, svl::SharedString( aTabName), aRef); // string not interned - ScCompiler aComp(pDok, aPos, aArray, formula::FormulaGrammar::GRAM_ODFF_A1); + ScCompiler aComp(&mrDoc, aPos, aArray, formula::FormulaGrammar::GRAM_ODFF_A1); OUString aStr; aComp.CreateStringFromTokenArray(aStr); PushString(aStr); @@ -2626,7 +2626,7 @@ void ScInterpreter::ScIsValue() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (GetCellErrCode(aCell) == FormulaError::NONE) { switch (aCell.meType) @@ -2721,7 +2721,7 @@ void ScInterpreter::ScIsFormula() for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) { aAdr.SetRow(nRow); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); pResMat->PutBoolean( (aCell.meType == CELLTYPE_FORMULA), i,j); ++j; } @@ -2739,7 +2739,7 @@ void ScInterpreter::ScIsFormula() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - bRes = (pDok->GetCellType(aAdr) == CELLTYPE_FORMULA); + bRes = (mrDoc.GetCellType(aAdr) == CELLTYPE_FORMULA); } break; default: @@ -2783,7 +2783,7 @@ void ScInterpreter::ScFormula() for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) { aAdr.SetRow(nRow); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); switch (aCell.meType) { case CELLTYPE_FORMULA : @@ -2809,7 +2809,7 @@ void ScInterpreter::ScFormula() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); switch (aCell.meType) { case CELLTYPE_FORMULA : @@ -2842,7 +2842,7 @@ void ScInterpreter::ScIsNV() bRes = true; else if (bOk) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); FormulaError nErr = GetCellErrCode(aCell); bRes = (nErr == FormulaError::NotAvailable); } @@ -2899,7 +2899,7 @@ void ScInterpreter::ScIsErr() bRes = true; else { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); FormulaError nErr = GetCellErrCode(aCell); bRes = (nErr != FormulaError::NONE && nErr != FormulaError::NotAvailable); } @@ -2966,7 +2966,7 @@ void ScInterpreter::ScIsError() bRes = true; else { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); bRes = (GetCellErrCode(aCell) != FormulaError::NONE); } } @@ -3020,7 +3020,7 @@ bool ScInterpreter::IsEven() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); FormulaError nErr = GetCellErrCode(aCell); if (nErr != FormulaError::NONE) SetError(nErr); @@ -3206,7 +3206,7 @@ void ScInterpreter::ScT() return ; } bool bValue = false; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (GetCellErrCode(aCell) == FormulaError::NONE) { switch (aCell.meType) @@ -3283,7 +3283,7 @@ void ScInterpreter::ScValue() PushInt(0); return; } - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasString()) { svl::SharedString aSS; @@ -3639,7 +3639,7 @@ void ScInterpreter::ScMin( bool bTextAsZero ) case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { nVal = GetCellValue(aAdr, aCell); @@ -3668,7 +3668,7 @@ void ScInterpreter::ScMin( bool bTextAsZero ) { FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParamCount, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags, bTextAsZero ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags, bTextAsZero ); aValIter.SetInterpreterContext( &mrContext ); if (aValIter.GetFirst(nVal, nErr)) { @@ -3797,7 +3797,7 @@ void ScInterpreter::ScMax( bool bTextAsZero ) case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { nVal = GetCellValue(aAdr, aCell); @@ -3826,7 +3826,7 @@ void ScInterpreter::ScMax( bool bTextAsZero ) { FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParamCount, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags, bTextAsZero ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags, bTextAsZero ); aValIter.SetInterpreterContext( &mrContext ); if (aValIter.GetFirst(nVal, nErr)) { @@ -3956,7 +3956,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -4002,7 +4002,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double ArrayRefListValue& rArrayValue = vArrayValues[nRefArrayPos]; FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParamCount, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags, bTextAsZero ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags, bTextAsZero ); if (aValIter.GetFirst(fVal, nErr)) { do @@ -4027,7 +4027,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double { FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParamCount, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags, bTextAsZero ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags, bTextAsZero ); if (aValIter.GetFirst(fVal, nErr)) { do @@ -4247,7 +4247,7 @@ void ScInterpreter::ScColumns() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(pDok, aPos); + ScRange aAbs = aRef.toAbs(&mrDoc, aPos); nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1) * static_cast<sal_uLong>(aAbs.aEnd.Col() - aAbs.aStart.Col() + 1); } @@ -4304,7 +4304,7 @@ void ScInterpreter::ScRows() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(pDok, aPos); + ScRange aAbs = aRef.toAbs(&mrDoc, aPos); nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1) * static_cast<sal_uLong>(aAbs.aEnd.Row() - aAbs.aStart.Row() + 1); } @@ -4322,7 +4322,7 @@ void ScInterpreter::ScSheets() sal_uInt8 nParamCount = GetByte(); sal_uLong nVal; if ( nParamCount == 0 ) - nVal = pDok->GetTableCount(); + nVal = mrDoc.GetTableCount(); else { nVal = 0; @@ -4351,7 +4351,7 @@ void ScInterpreter::ScSheets() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(pDok, aPos); + ScRange aAbs = aRef.toAbs(&mrDoc, aPos); nVal += static_cast<sal_uLong>(aAbs.aEnd.Tab() - aAbs.aStart.Tab() + 1); } break; @@ -4416,7 +4416,7 @@ void ScInterpreter::ScColumn() OUString aTabName; ScSingleRefData aRef; PopExternalSingleRef( nFileId, aTabName, aRef ); - ScAddress aAbsRef = aRef.toAbs(pDok, aPos); + ScAddress aAbsRef = aRef.toAbs(&mrDoc, aPos); nVal = static_cast<double>( aAbsRef.Col() + 1 ); } break; @@ -4440,7 +4440,7 @@ void ScInterpreter::ScColumn() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef ); - ScRange aAbs = aRef.toAbs(pDok, aPos); + ScRange aAbs = aRef.toAbs(&mrDoc, aPos); nCol1 = aAbs.aStart.Col(); nCol2 = aAbs.aEnd.Col(); } @@ -4520,7 +4520,7 @@ void ScInterpreter::ScRow() OUString aTabName; ScSingleRefData aRef; PopExternalSingleRef( nFileId, aTabName, aRef ); - ScAddress aAbsRef = aRef.toAbs(pDok, aPos); + ScAddress aAbsRef = aRef.toAbs(&mrDoc, aPos); nVal = static_cast<double>( aAbsRef.Row() + 1 ); } break; @@ -4543,7 +4543,7 @@ void ScInterpreter::ScRow() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef( nFileId, aTabName, aRef ); - ScRange aAbs = aRef.toAbs(pDok, aPos); + ScRange aAbs = aRef.toAbs(&mrDoc, aPos); nRow1 = aAbs.aStart.Row(); nRow2 = aAbs.aEnd.Row(); } @@ -4587,7 +4587,7 @@ void ScInterpreter::ScSheet() case svString : { svl::SharedString aStr = PopString(); - if ( pDok->GetTable(aStr.getString(), nVal)) + if ( mrDoc.GetTable(aStr.getString(), nVal)) ++nVal; else SetError( FormulaError::IllegalArgument ); @@ -4874,7 +4874,7 @@ void ScInterpreter::ScMatch() PushInt(0); return ; } - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -4928,12 +4928,12 @@ void ScInterpreter::ScMatch() } if (rItem.meType == ScQueryEntry::ByString) { - bool bIsVBAMode = pDok->IsInVBAMode(); + bool bIsVBAMode = mrDoc.IsInVBAMode(); if ( bIsVBAMode ) rParam.eSearchType = utl::SearchParam::SearchType::Wildcard; else - rParam.eSearchType = DetectSearchType(rEntry.GetQueryItem().maString.getString(), pDok); + rParam.eSearchType = DetectSearchType(rEntry.GetQueryItem().maString.getString(), &mrDoc); } if (pMatSrc) // The source data is matrix array. @@ -5053,7 +5053,7 @@ void ScInterpreter::ScMatch() rParam.bByRow = false; rParam.nRow2 = nRow1; rEntry.nField = nCol1; - ScQueryCellIterator aCellIter(pDok, mrContext, nTab1, rParam, false); + ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam, false); // Advance Entry.nField in Iterator if column changed aCellIter.SetAdvanceQueryParamEntryField( true ); if (fTyp == 0.0) @@ -5135,7 +5135,7 @@ void ScInterpreter::ScCountEmptyCells() nMaxCount = 1; ScAddress aAdr; PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (!isCellContentEmpty(aCell)) nCount = 1; } @@ -5156,7 +5156,7 @@ void ScInterpreter::ScCountEmptyCells() static_cast<sal_uLong>(aRange.aEnd.Col() - aRange.aStart.Col() + 1) * static_cast<sal_uLong>(aRange.aEnd.Tab() - aRange.aStart.Tab() + 1); - ScCellIterator aIter( pDok, aRange, mnSubTotalFlags); + ScCellIterator aIter( &mrDoc, aRange, mnSubTotalFlags); for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { const ScRefCellValue& rCell = aIter.getRefCellValue(); @@ -5279,7 +5279,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) return; } - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); switch (aCell.meType) { case CELLTYPE_VALUE : @@ -5434,8 +5434,8 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) } else { - nMaxCol = pDok->MaxCol(); - nMaxRow = pDok->MaxRow(); + nMaxCol = mrDoc.MaxCol(); + nMaxRow = mrDoc.MaxRow(); } if (nCol3 + nColDelta > nMaxCol) { @@ -5473,9 +5473,9 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) } else { - rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0, pFormatter); + rParam.FillInExcelSyntax(mrDoc.GetSharedStringPool(), aString.getString(), 0, pFormatter); if (rItem.meType == ScQueryEntry::ByString) - rParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); + rParam.eSearchType = DetectSearchType(rItem.maString.getString(), &mrDoc); } ScAddress aAdr; aAdr.SetTab( nTab3 ); @@ -5487,7 +5487,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) if (pQueryMatrix) { // Never case-sensitive. - sc::CompareOptions aOptions( pDok, rEntry, rParam.eSearchType); + sc::CompareOptions aOptions( &mrDoc, rEntry, rParam.eSearchType); ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions); if (nGlobalError != FormulaError::NONE || !pResultMatrix) { @@ -5531,7 +5531,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) { aAdr.SetCol( nCol + nColDiff); aAdr.SetRow( nRow + nRowDiff); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -5551,7 +5551,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) } else { - ScQueryCellIterator aCellIter(pDok, mrContext, nTab1, rParam, false); + ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam, false); // Increment Entry.nField in iterator when switching to next column. aCellIter.SetAdvanceQueryParamEntryField( true ); if ( aCellIter.GetFirst() ) @@ -5582,7 +5582,7 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) { aAdr.SetCol( aCellIter.GetCol() + nColDiff); aAdr.SetRow( aCellIter.GetRow() + nRowDiff); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -5658,7 +5658,7 @@ void ScInterpreter::ScCountIf() PushInt(0); return ; } - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); switch (aCell.meType) { case CELLTYPE_VALUE : @@ -5787,9 +5787,9 @@ void ScInterpreter::ScCountIf() } else { - rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0, pFormatter); + rParam.FillInExcelSyntax(mrDoc.GetSharedStringPool(), aString.getString(), 0, pFormatter); if (rItem.meType == ScQueryEntry::ByString) - rParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); + rParam.eSearchType = DetectSearchType(rItem.maString.getString(), &mrDoc); } rParam.nCol1 = nCol1; rParam.nCol2 = nCol2; @@ -5797,7 +5797,7 @@ void ScInterpreter::ScCountIf() if (pQueryMatrix) { // Never case-sensitive. - sc::CompareOptions aOptions( pDok, rEntry, rParam.eSearchType); + sc::CompareOptions aOptions( &mrDoc, rEntry, rParam.eSearchType); ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions); if (nGlobalError != FormulaError::NONE || !pResultMatrix) { @@ -5815,7 +5815,7 @@ void ScInterpreter::ScCountIf() } else { - ScCountIfCellIterator aCellIter(pDok, mrContext, nTab1, rParam); + ScCountIfCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam); fCount += aCellIter.GetCount(); } } @@ -5884,7 +5884,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf { // Shrink the range to actual data content. aSubRange = aMainRange; - pDok->GetDataAreaSubrange(aSubRange); + mrDoc.GetDataAreaSubrange(aSubRange); nStartColDiff = aSubRange.aStart.Col() - aMainRange.aStart.Col(); nStartRowDiff = aSubRange.aStart.Row() - aMainRange.aStart.Row(); @@ -5921,7 +5921,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf return; } - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); switch (aCell.meType) { case CELLTYPE_VALUE : @@ -6132,9 +6132,9 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf } else { - rParam.FillInExcelSyntax(pDok->GetSharedStringPool(), aString.getString(), 0, pFormatter); + rParam.FillInExcelSyntax(mrDoc.GetSharedStringPool(), aString.getString(), 0, pFormatter); if (rItem.meType == ScQueryEntry::ByString) - rParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); + rParam.eSearchType = DetectSearchType(rItem.maString.getString(), &mrDoc); } rParam.nCol1 = nCol1; rParam.nCol2 = nCol2; @@ -6144,7 +6144,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf if (pQueryMatrix) { // Never case-sensitive. - sc::CompareOptions aOptions( pDok, rEntry, rParam.eSearchType); + sc::CompareOptions aOptions(&mrDoc, rEntry, rParam.eSearchType); ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions); if (nGlobalError != FormulaError::NONE || !pResultMatrix) { @@ -6170,7 +6170,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf } else { - ScQueryCellIterator aCellIter(pDok, mrContext, nTab1, rParam, false); + ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam, false); // Increment Entry.nField in iterator when switching to next column. aCellIter.SetAdvanceQueryParamEntryField( true ); if ( aCellIter.GetFirst() ) @@ -6437,7 +6437,7 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf { aAdr.SetCol( nCol + nMainCol1); aAdr.SetRow( nRow + nMainRow1); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -6717,7 +6717,7 @@ void ScInterpreter::ScLookup() case svSingleRef: { PopSingleRef( aDataAdr ); - ScRefCellValue aCell(*pDok, aDataAdr); + ScRefCellValue aCell(mrDoc, aDataAdr); if (aCell.hasEmptyValue()) { // Empty cells aren't found anywhere, bail out early. @@ -7021,7 +7021,7 @@ void ScInterpreter::ScLookup() if (bResVertical) { SCROW nTempRow = static_cast<SCROW>(nResRow1 + nDelta); - if (nTempRow > pDok->MaxRow()) + if (nTempRow > mrDoc.MaxRow()) { PushDouble(0); return; @@ -7032,7 +7032,7 @@ void ScInterpreter::ScLookup() else { SCCOL nTempCol = static_cast<SCCOL>(nResCol1 + nDelta); - if (nTempCol > pDok->MaxCol()) + if (nTempCol > mrDoc.MaxCol()) { PushDouble(0); return; @@ -7079,9 +7079,9 @@ void ScInterpreter::ScLookup() rEntry.nField = nCol1; ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); if (rItem.meType == ScQueryEntry::ByString) - aParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); + aParam.eSearchType = DetectSearchType(rItem.maString.getString(), &mrDoc); - ScQueryCellIterator aCellIter(pDok, mrContext, nTab1, aParam, false); + ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, aParam, false); SCCOL nC; SCROW nR; // Advance Entry.nField in iterator upon switching columns if @@ -7119,7 +7119,7 @@ void ScInterpreter::ScLookup() if (bResVertical) { SCROW nTempRow = static_cast<SCROW>(nResRow1 + nDelta); - if (nTempRow > pDok->MaxRow()) + if (nTempRow > mrDoc.MaxRow()) { PushDouble(0); return; @@ -7130,7 +7130,7 @@ void ScInterpreter::ScLookup() else { SCCOL nTempCol = static_cast<SCCOL>(nResCol1 + nDelta); - if (nTempCol > pDok->MaxCol()) + if (nTempCol > mrDoc.MaxCol()) { PushDouble(0); return; @@ -7180,7 +7180,7 @@ void ScInterpreter::ScLookup() if (bVertical) { SCROW nTempRow = static_cast<SCROW>(nRow1 + nDelta); - if (nTempRow > pDok->MaxRow()) + if (nTempRow > mrDoc.MaxRow()) { PushDouble(0); return; @@ -7191,7 +7191,7 @@ void ScInterpreter::ScLookup() else { SCCOL nTempCol = static_cast<SCCOL>(nCol1 + nDelta); - if (nTempCol > pDok->MaxCol()) + if (nTempCol > mrDoc.MaxCol()) { PushDouble(0); return; @@ -7310,7 +7310,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); if (rItem.meType == ScQueryEntry::ByString) - aParam.eSearchType = DetectSearchType(rItem.maString.getString(), pDok); + aParam.eSearchType = DetectSearchType(rItem.maString.getString(), &mrDoc); if (pMat) { SCSIZE nMatCount = bHLookup ? nC : nR; @@ -7428,7 +7428,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) rEntry.eOp = SC_LESS_EQUAL; if ( bHLookup ) { - ScQueryCellIterator aCellIter(pDok, mrContext, nTab1, aParam, false); + ScQueryCellIterator aCellIter(&mrDoc, mrContext, nTab1, aParam, false); // advance Entry.nField in Iterator upon switching columns aCellIter.SetAdvanceQueryParamEntryField( true ); if ( bSorted ) @@ -7487,7 +7487,7 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry) PushInt(0); return false; } - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { rItem.meType = ScQueryEntry::ByValue; @@ -7703,7 +7703,7 @@ std::unique_ptr<ScDBQueryParamBase> ScInterpreter::GetDBParams( bool& rMissingFi { ScAddress aAdr; PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) nVal = GetCellValue(aAdr, aCell); else @@ -7769,7 +7769,7 @@ std::unique_ptr<ScDBQueryParamBase> ScInterpreter::GetDBParams( bool& rMissingFi SetError(nErr); } - if (!pDok->ValidCol(nField)) + if (!mrDoc.ValidCol(nField)) return nullptr; unique_ptr<ScDBQueryParamBase> pParam( pDBRef->createQueryParam(pQueryRef.get()) ); @@ -7798,7 +7798,7 @@ std::unique_ptr<ScDBQueryParamBase> ScInterpreter::GetDBParams( bool& rMissingFi rItem.meType = bNumber ? ScQueryEntry::ByValue : ScQueryEntry::ByString; if (!bNumber && pParam->eSearchType == utl::SearchParam::SearchType::Normal) - pParam->eSearchType = DetectSearchType(aQueryStr, pDok); + pParam->eSearchType = DetectSearchType(aQueryStr, &mrDoc); } return pParam; } @@ -7820,7 +7820,7 @@ void ScInterpreter::DBIterator( ScIterFunc eFunc ) SetError(FormulaError::NoValue); return; } - ScDBQueryDataIterator aValIter(pDok, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(&mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if ( aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE ) { @@ -7908,7 +7908,7 @@ void ScInterpreter::ScDBCount() // so the source range has to be restricted, like before the introduction // of ScDBQueryParamBase. p->nCol1 = p->nCol2 = p->mnField; - ScQueryCellIterator aCellIter( pDok, mrContext, nTab, *p, true); + ScQueryCellIterator aCellIter( &mrDoc, mrContext, nTab, *p, true); if ( aCellIter.GetFirst() ) { do @@ -7924,7 +7924,7 @@ void ScInterpreter::ScDBCount() SetError(FormulaError::NoValue); return; } - ScDBQueryDataIterator aValIter( pDok, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter( &mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if ( aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE ) { @@ -7955,7 +7955,7 @@ void ScInterpreter::ScDBCount2() } sal_uLong nCount = 0; pQueryParam->mbSkipString = false; - ScDBQueryDataIterator aValIter( pDok, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter( &mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if ( aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE ) { @@ -8009,7 +8009,7 @@ void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount ) SetError(FormulaError::NoValue); return; } - ScDBQueryDataIterator aValIter(pDok, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(&mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if (aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE) { @@ -8072,7 +8072,7 @@ void ScInterpreter::ScIndirect() FormulaGrammar::AddressConvention eConv = maCalcConfig.meStringRefAddressSyntax; if (eConv == FormulaGrammar::CONV_UNSPECIFIED) // Use the current address syntax if unspecified. - eConv = pDok->GetAddressConvention(); + eConv = mrDoc.GetAddressConvention(); // either CONV_A1_XL_A1 was explicitly configured, or it wasn't possible // to determine which syntax to use during doc import @@ -8092,8 +8092,8 @@ void ScInterpreter::ScIndirect() OUString sRefStr = GetString().getString(); ScRefAddress aRefAd, aRefAd2; ScAddress::ExternalInfo aExtInfo; - if ( ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || - ( bTryXlA1 && ConvertDoubleRef(pDok, sRefStr, nTab, aRefAd, + if ( ConvertDoubleRef(&mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || + ( bTryXlA1 && ConvertDoubleRef(&mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetailsXlA1, &aExtInfo) ) ) { if (aExtInfo.mbExternal) @@ -8106,8 +8106,8 @@ void ScInterpreter::ScIndirect() else PushDoubleRef( aRefAd, aRefAd2); } - else if ( ConvertSingleRef(pDok, sRefStr, nTab, aRefAd, aDetails, &aExtInfo) || - ( bTryXlA1 && ConvertSingleRef (pDok, sRefStr, nTab, aRefAd, + else if ( ConvertSingleRef(&mrDoc, sRefStr, nTab, aRefAd, aDetails, &aExtInfo) || + ( bTryXlA1 && ConvertSingleRef (&mrDoc, sRefStr, nTab, aRefAd, aDetailsXlA1, &aExtInfo) ) ) { if (aExtInfo.mbExternal) @@ -8122,7 +8122,7 @@ void ScInterpreter::ScIndirect() { do { - ScRangeData* pData = ScRangeStringConverter::GetRangeDataFromString(sRefStr, nTab, pDok); + ScRangeData* pData = ScRangeStringConverter::GetRangeDataFromString(sRefStr, nTab, &mrDoc); if (!pData) break; @@ -8152,7 +8152,7 @@ void ScInterpreter::ScIndirect() do { OUString aName( ScGlobal::getCharClassPtr()->uppercase( sRefStr)); - ScDBCollection::NamedDBs& rDBs = pDok->GetDBCollection()->getNamedDBs(); + ScDBCollection::NamedDBs& rDBs = mrDoc.GetDBCollection()->getNamedDBs(); const ScDBData* pData = rDBs.findByUpperName( aName); if (!pData) break; @@ -8193,7 +8193,7 @@ void ScInterpreter::ScIndirect() { do { - ScCompiler aComp( pDok, aPos, pDok->GetGrammar()); + ScCompiler aComp( &mrDoc, aPos, mrDoc.GetGrammar()); aComp.SetRefConvention( eConv); // must be after grammar std::unique_ptr<ScTokenArray> pTokArr( aComp.CompileString( sRefStr)); @@ -8253,7 +8253,7 @@ void ScInterpreter::ScAddressFunc() // that, and if it is unspecified then the document's address syntax. FormulaGrammar::AddressConvention eForceConv = maCalcConfig.meStringRefAddressSyntax; if (eForceConv == FormulaGrammar::CONV_UNSPECIFIED) - eForceConv = pDok->GetAddressConvention(); + eForceConv = mrDoc.GetAddressConvention(); if (eForceConv == FormulaGrammar::CONV_XL_A1 || eForceConv == FormulaGrammar::CONV_XL_R1C1) eConv = FormulaGrammar::CONV_XL_A1; // for anything Excel use Excel A1 } @@ -8294,7 +8294,7 @@ void ScInterpreter::ScAddressFunc() --nCol; --nRow; - if (nGlobalError != FormulaError::NONE || !pDok->ValidCol( nCol) || !pDok->ValidRow( nRow)) + if (nGlobalError != FormulaError::NONE || !mrDoc.ValidCol( nCol) || !mrDoc.ValidRow( nRow)) { PushIllegalArgument(); return; @@ -8302,7 +8302,7 @@ void ScInterpreter::ScAddressFunc() const ScAddress::Details aDetails( eConv, aPos ); const ScAddress aAdr( nCol, nRow, 0); - OUString aRefStr(aAdr.Format(nFlags, pDok, aDetails)); + OUString aRefStr(aAdr.Format(nFlags, &mrDoc, aDetails)); if( nParamCount >= 5 && !sTabStr.isEmpty() ) { @@ -8390,7 +8390,7 @@ void ScInterpreter::ScOffset() { nCol1 = static_cast<SCCOL>(static_cast<long>(nCol1) + nColPlus); nRow1 = static_cast<SCROW>(static_cast<long>(nRow1) + nRowPlus); - if (!pDok->ValidCol(nCol1) || !pDok->ValidRow(nRow1)) + if (!mrDoc.ValidCol(nCol1) || !mrDoc.ValidRow(nRow1)) PushIllegalArgument(); else PushSingleRef(nCol1, nRow1, nTab1); @@ -8401,8 +8401,8 @@ void ScInterpreter::ScOffset() nRow1 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowPlus); nCol2 = static_cast<SCCOL>(static_cast<long>(nCol1)+nColNew-1); nRow2 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowNew-1); - if (!pDok->ValidCol(nCol1) || !pDok->ValidRow(nRow1) || - !pDok->ValidCol(nCol2) || !pDok->ValidRow(nRow2)) + if (!mrDoc.ValidCol(nCol1) || !mrDoc.ValidRow(nRow1) || + !mrDoc.ValidCol(nCol2) || !mrDoc.ValidRow(nRow2)) PushIllegalArgument(); else PushDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab1); @@ -8415,7 +8415,7 @@ void ScInterpreter::ScOffset() OUString aTabName; ScSingleRefData aRef; PopExternalSingleRef(nFileId, aTabName, aRef); - ScAddress aAbsRef = aRef.toAbs(pDok, aPos); + ScAddress aAbsRef = aRef.toAbs(&mrDoc, aPos); nCol1 = aAbsRef.Col(); nRow1 = aAbsRef.Row(); nTab1 = aAbsRef.Tab(); @@ -8424,7 +8424,7 @@ void ScInterpreter::ScOffset() { nCol1 = static_cast<SCCOL>(static_cast<long>(nCol1) + nColPlus); nRow1 = static_cast<SCROW>(static_cast<long>(nRow1) + nRowPlus); - if (!pDok->ValidCol(nCol1) || !pDok->ValidRow(nRow1)) + if (!mrDoc.ValidCol(nCol1) || !mrDoc.ValidRow(nRow1)) PushIllegalArgument(); else PushExternalSingleRef(nFileId, aTabName, nCol1, nRow1, nTab1); @@ -8436,8 +8436,8 @@ void ScInterpreter::ScOffset() nCol2 = static_cast<SCCOL>(static_cast<long>(nCol1)+nColNew-1); nRow2 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowNew-1); nTab2 = nTab1; - if (!pDok->ValidCol(nCol1) || !pDok->ValidRow(nRow1) || - !pDok->ValidCol(nCol2) || !pDok->ValidRow(nRow2)) + if (!mrDoc.ValidCol(nCol1) || !mrDoc.ValidRow(nRow1) || + !mrDoc.ValidCol(nCol2) || !mrDoc.ValidRow(nRow2)) PushIllegalArgument(); else PushExternalDoubleRef(nFileId, aTabName, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); @@ -8455,8 +8455,8 @@ void ScInterpreter::ScOffset() nRow1 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowPlus); nCol2 = static_cast<SCCOL>(static_cast<long>(nCol1)+nColNew-1); nRow2 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowNew-1); - if (!pDok->ValidCol(nCol1) || !pDok->ValidRow(nRow1) || - !pDok->ValidCol(nCol2) || !pDok->ValidRow(nRow2) || nTab1 != nTab2) + if (!mrDoc.ValidCol(nCol1) || !mrDoc.ValidRow(nRow1) || + !mrDoc.ValidCol(nCol2) || !mrDoc.ValidRow(nRow2) || nTab1 != nTab2) PushIllegalArgument(); else PushDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab1); @@ -8468,7 +8468,7 @@ void ScInterpreter::ScOffset() OUString aTabName; ScComplexRefData aRef; PopExternalDoubleRef(nFileId, aTabName, aRef); - ScRange aAbs = aRef.toAbs(pDok, aPos); + ScRange aAbs = aRef.toAbs(&mrDoc, aPos); nCol1 = aAbs.aStart.Col(); nRow1 = aAbs.aStart.Row(); nTab1 = aAbs.aStart.Tab(); @@ -8483,8 +8483,8 @@ void ScInterpreter::ScOffset() nRow1 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowPlus); nCol2 = static_cast<SCCOL>(static_cast<long>(nCol1)+nColNew-1); nRow2 = static_cast<SCROW>(static_cast<long>(nRow1)+nRowNew-1); - if (!pDok->ValidCol(nCol1) || !pDok->ValidRow(nRow1) || - !pDok->ValidCol(nCol2) || !pDok->ValidRow(nRow2) || nTab1 != nTab2) + if (!mrDoc.ValidCol(nCol1) || !mrDoc.ValidRow(nRow1) || + !mrDoc.ValidCol(nCol2) || !mrDoc.ValidRow(nRow2) || nTab1 != nTab2) PushIllegalArgument(); else PushExternalDoubleRef(nFileId, aTabName, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); @@ -9237,7 +9237,7 @@ void ScInterpreter::ScSearchB() // search aSubStr for asStr sal_Int32 nPos = 0; sal_Int32 nEndPos = aSubStr.getLength(); - utl::SearchParam::SearchType eSearchType = DetectSearchType( asStr, pDok ); + utl::SearchParam::SearchType eSearchType = DetectSearchType( asStr, &mrDoc ); utl::SearchParam sPar( asStr, eSearchType, false, '~', false ); utl::TextSearch sT( sPar, *ScGlobal::getCharClassPtr() ); if ( !sT.SearchForward( aSubStr, &nPos, &nEndPos ) ) @@ -9313,7 +9313,7 @@ void ScInterpreter::ScSearch() PushNoValue(); else { - utl::SearchParam::SearchType eSearchType = DetectSearchType( SearchStr, pDok ); + utl::SearchParam::SearchType eSearchType = DetectSearchType( SearchStr, &mrDoc ); utl::SearchParam sPar(SearchStr, eSearchType, false, '~', false); utl::TextSearch sT( sPar, *ScGlobal::getCharClassPtr() ); bool bBool = sT.SearchForward(sStr, &nPos, &nEndPos); @@ -9618,7 +9618,7 @@ void ScInterpreter::ScText() OUString aResult; const Color* pColor = nullptr; LanguageType eCellLang; - const ScPatternAttr* pPattern = pDok->GetPattern( + const ScPatternAttr* pPattern = mrDoc.GetPattern( aPos.Col(), aPos.Row(), aPos.Tab() ); if ( pPattern ) eCellLang = pPattern->GetItem( ATTR_LANGUAGE_FORMAT ).GetValue(); @@ -9764,7 +9764,7 @@ FormulaError ScInterpreter::GetErrorType() { ScAddress aAdr; if ( DoubleRefToPosSingleRef( aRange, aAdr ) ) - nErr = pDok->GetErrCode( aAdr ); + nErr = mrDoc.GetErrCode( aAdr ); else nErr = nGlobalError; } @@ -9782,7 +9782,7 @@ FormulaError ScInterpreter::GetErrorType() { ScAddress aAdr; if ( DoubleRefToPosSingleRef( aRange, aAdr ) ) - nErr = pDok->GetErrCode( aAdr ); + nErr = mrDoc.GetErrCode( aAdr ); else nErr = nGlobalError; } @@ -9795,7 +9795,7 @@ FormulaError ScInterpreter::GetErrorType() if ( nGlobalError != FormulaError::NONE ) nErr = nGlobalError; else - nErr = pDok->GetErrCode( aAdr ); + nErr = mrDoc.GetErrCode( aAdr ); } break; default: @@ -10016,12 +10016,12 @@ bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos, * direct lookups here. We could even further attribute volatility per * parameter so it would affect only the lookup range parameter. */ if (!bColumnsMatch || GetVolatileType() != NOT_VOLATILE) - bFound = lcl_LookupQuery( o_rResultPos, pDok, mrContext, rParam, rEntry); + bFound = lcl_LookupQuery( o_rResultPos, &mrDoc, mrContext, rParam, rEntry); else { ScRange aLookupRange( rParam.nCol1, rParam.nRow1, rParam.nTab, rParam.nCol2, rParam.nRow2, rParam.nTab); - ScLookupCache& rCache = pDok->GetLookupCache( aLookupRange, &mrContext ); + ScLookupCache& rCache = mrDoc.GetLookupCache( aLookupRange, &mrContext ); ScLookupCache::QueryCriteria aCriteria( rEntry); ScLookupCache::Result eCacheResult = rCache.lookup( o_rResultPos, aCriteria, aPos); @@ -10047,7 +10047,7 @@ bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos, { case ScLookupCache::NOT_CACHED : case ScLookupCache::CRITERIA_DIFFERENT : - bFound = lcl_LookupQuery( o_rResultPos, pDok, mrContext, rParam, rEntry); + bFound = lcl_LookupQuery( o_rResultPos, &mrDoc, mrContext, rParam, rEntry); if (eCacheResult == ScLookupCache::NOT_CACHED) rCache.insert( o_rResultPos, aCriteria, aPos, bFound); break; diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 5e17d8bf188e..083601458a5d 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -1341,7 +1341,7 @@ void ScInterpreter::ScNPV() { ScAddress aAdr; PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (!aCell.hasEmptyValue() && aCell.hasNumeric()) { double fCellVal = GetCellValue(aAdr, aCell); @@ -1356,7 +1356,7 @@ void ScInterpreter::ScNPV() FormulaError nErr = FormulaError::NONE; double fCellVal; PopDoubleRef( aRange, nParamCount, nRefInList); - ScHorizontalValueIterator aValIter( pDok, aRange ); + ScHorizontalValueIterator aValIter( &mrDoc, aRange ); while ((nErr == FormulaError::NONE) && aValIter.GetNext(fCellVal, nErr)) { fVal += (fCellVal / pow(1.0 + fRate, fCount)); @@ -1446,7 +1446,7 @@ void ScInterpreter::ScIRR() double fDenom = 0.0; FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange ); - ScValueIterator aValIter(pDok, aRange, mnSubTotalFlags); + ScValueIterator aValIter(&mrDoc, aRange, mnSubTotalFlags); if (aValIter.GetFirst(fValue, nErr)) { double fCount = 0.0; @@ -1557,7 +1557,7 @@ void ScInterpreter::ScMIRR() } else { - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); double fCellValue; FormulaError nIterError = FormulaError::NONE; @@ -2465,12 +2465,12 @@ void ScInterpreter::ScIntersect() ScRefList* pRefList = xRes->GetRefList(); for (const auto& rRef1 : *x1->GetRefList()) { - const ScAddress& r11 = rRef1.Ref1.toAbs(pDok, aPos); - const ScAddress& r12 = rRef1.Ref2.toAbs(pDok, aPos); + const ScAddress& r11 = rRef1.Ref1.toAbs(&mrDoc, aPos); + const ScAddress& r12 = rRef1.Ref2.toAbs(&mrDoc, aPos); for (const auto& rRef2 : *x2->GetRefList()) { - const ScAddress& r21 = rRef2.Ref1.toAbs(pDok, aPos); - const ScAddress& r22 = rRef2.Ref2.toAbs(pDok, aPos); + const ScAddress& r21 = rRef2.Ref1.toAbs(&mrDoc, aPos); + const ScAddress& r22 = rRef2.Ref2.toAbs(&mrDoc, aPos); SCCOL nCol1 = ::std::max( r11.Col(), r21.Col()); SCROW nRow1 = ::std::max( r11.Row(), r21.Row()); SCTAB nTab1 = ::std::max( r11.Tab(), r21.Tab()); @@ -2494,9 +2494,9 @@ void ScInterpreter::ScIntersect() { const ScComplexRefData& rRef = (*pRefList)[0]; if (rRef.Ref1 == rRef.Ref2) - PushTempToken( new ScSingleRefToken(pDok->GetSheetLimits(), rRef.Ref1)); + PushTempToken( new ScSingleRefToken(mrDoc.GetSheetLimits(), rRef.Ref1)); else - PushTempToken( new ScDoubleRefToken(pDok->GetSheetLimits(), rRef)); + PushTempToken( new ScDoubleRefToken(mrDoc.GetSheetLimits(), rRef)); } else PushTokenRef( xRes); @@ -2516,14 +2516,14 @@ void ScInterpreter::ScIntersect() case svDoubleRef: { { - const ScAddress& r = pt[i]->GetSingleRef()->toAbs(pDok, aPos); + const ScAddress& r = pt[i]->GetSingleRef()->toAbs(&mrDoc, aPos); nC1[i] = r.Col(); nR1[i] = r.Row(); nT1[i] = r.Tab(); } if (sv[i] == svDoubleRef) { - const ScAddress& r = pt[i]->GetSingleRef2()->toAbs(pDok, aPos); + const ScAddress& r = pt[i]->GetSingleRef2()->toAbs(&mrDoc, aPos); nC2[i] = r.Col(); nR2[i] = r.Row(); nT2[i] = r.Tab(); @@ -2568,7 +2568,7 @@ void ScInterpreter::ScRangeFunc() // We explicitly tell extendRangeReference() to not reuse the token, // casting const away spares two clones. FormulaTokenRef xRes = extendRangeReference( - pDok->GetSheetLimits(), const_cast<FormulaToken&>(*x1), const_cast<FormulaToken&>(*x2), aPos, false); + mrDoc.GetSheetLimits(), const_cast<FormulaToken&>(*x1), const_cast<FormulaToken&>(*x2), aPos, false); if (!xRes) PushIllegalArgument(); else @@ -2677,16 +2677,16 @@ void ScInterpreter::ScStyle() nTimeOut = 0; // Execute request to apply template - if ( !pDok->IsClipOrUndo() ) + if ( !mrDoc.IsClipOrUndo() ) { - SfxObjectShell* pShell = pDok->GetDocumentShell(); + SfxObjectShell* pShell = mrDoc.GetDocumentShell(); if (pShell) { // notify object shell directly! bool bNotify = true; if (aStyle2.isEmpty()) { - const ScStyleSheet* pStyle = pDok->GetStyle(aPos.Col(), aPos.Row(), aPos.Tab()); + const ScStyleSheet* pStyle = mrDoc.GetStyle(aPos.Col(), aPos.Row(), aPos.Tab()); if (pStyle && pStyle->GetName() == aStyle1) bNotify = false; @@ -2757,7 +2757,7 @@ void ScInterpreter::ScDde() // temporary documents (ScFunctionAccess) have no DocShell // and no LinkManager -> abort - //sfx2::LinkManager* pLinkMgr = pDok->GetLinkManager(); + //sfx2::LinkManager* pLinkMgr = mrDoc.GetLinkManager(); if (!mpLinkManager) { PushNoValue(); @@ -2769,25 +2769,25 @@ void ScInterpreter::ScDde() // while the link is not evaluated, idle must be disabled (to avoid circular references) - bool bOldEnabled = pDok->IsIdleEnabled(); - pDok->EnableIdle(false); + bool bOldEnabled = mrDoc.IsIdleEnabled(); + mrDoc.EnableIdle(false); // Get/ Create link object ScDdeLink* pLink = lcl_GetDdeLink( mpLinkManager, aAppl, aTopic, aItem, nMode ); //TODO: Save Dde-links (in addition) more efficient at document !!!!! - // ScDdeLink* pLink = pDok->GetDdeLink( aAppl, aTopic, aItem ); + // ScDdeLink* pLink = mrDoc.GetDdeLink( aAppl, aTopic, aItem ); bool bWasError = ( pMyFormulaCell && pMyFormulaCell->GetRawError() != FormulaError::NONE ); if (!pLink) { - pLink = new ScDdeLink( pDok, aAppl, aTopic, aItem, nMode ); + pLink = new ScDdeLink( &mrDoc, aAppl, aTopic, aItem, nMode ); mpLinkManager->InsertDDELink( pLink, aAppl, aTopic, aItem ); if ( mpLinkManager->GetLinks().size() == 1 ) // the first one? { - SfxBindings* pBindings = pDok->GetViewBindings(); + SfxBindings* pBindings = mrDoc.GetViewBindings(); if (pBindings) pBindings->Invalidate( SID_LINKS ); // Link-Manager enabled } @@ -2795,7 +2795,7 @@ void ScInterpreter::ScDde() //if the document was just loaded, but the ScDdeLink entry was missing, then //don't update this link until the links are updated in response to the users //decision - if (!pDok->HasLinkFormulaNeedingCheck()) + if (!mrDoc.HasLinkFormulaNeedingCheck()) { //TODO: evaluate asynchron ??? pLink->TryUpdate(); // TryUpdate doesn't call Update multiple times @@ -2838,7 +2838,7 @@ void ScInterpreter::ScDde() else PushNA(); - pDok->EnableIdle(bOldEnabled); + mrDoc.EnableIdle(bOldEnabled); mpLinkManager->CloseCachedComps(); } @@ -3218,7 +3218,7 @@ void ScInterpreter::ScHyperLink() if ( !PopDoubleRefOrSingleRef( aAdr ) ) break; - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasEmptyValue()) nResultType = ScMatValType::Empty; else @@ -3701,7 +3701,7 @@ void ScInterpreter::ScGetPivotData() // NOTE : MS Excel docs claim to use the 'most recent' which is not // exactly the same as what we do in ScDocument::GetDPAtBlock // However we do need to use GetDPABlock - ScDPObject* pDPObj = pDok->GetDPAtBlock(aBlock); + ScDPObject* pDPObj = mrDoc.GetDPAtBlock(aBlock); if (!pDPObj) { PushError(FormulaError::NoRef); diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 0c4bbe9f2ed7..ad850a8ca105 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2490,7 +2490,7 @@ void ScInterpreter::ScZTest() { ScAddress aAdr; PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -2510,7 +2510,7 @@ void ScInterpreter::ScZTest() ScRange aRange; FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParam, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst(fVal, nErr)) { fSum += fVal; @@ -2942,7 +2942,7 @@ void ScInterpreter::ScHarMean() case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { double x = GetCellValue(aAdr, aCell); @@ -2962,7 +2962,7 @@ void ScInterpreter::ScHarMean() FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParamCount, nRefInList); double nCellVal; - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst(nCellVal, nErr)) { if (nCellVal > 0.0) @@ -3072,7 +3072,7 @@ void ScInterpreter::ScGeoMean() case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { double x = GetCellValue(aAdr, aCell); @@ -3100,7 +3100,7 @@ void ScInterpreter::ScGeoMean() FormulaError nErr = FormulaError::NONE; PopDoubleRef( aRange, nParamCount, nRefInList); double nCellVal; - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter(&mrDoc, aRange, mnSubTotalFlags); if (aValIter.GetFirst(nCellVal, nErr)) { if (nCellVal > 0.0) @@ -3251,7 +3251,7 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std:: case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { fVal = GetCellValue(aAdr, aCell); @@ -3266,7 +3266,7 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std:: { PopDoubleRef( aRange, nParamCount, nRefInList); FormulaError nErr = FormulaError::NONE; - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst(fVal, nErr)) { fSum += fVal; @@ -3870,7 +3870,7 @@ std::vector<double> ScInterpreter::GetTopNumberArray( SCSIZE& rCol, SCSIZE& rRow { ScAddress aAdr; PopSingleRef(aAdr); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { aArray.push_back(GetCellValue(aAdr, aCell)); @@ -3901,7 +3901,7 @@ std::vector<double> ScInterpreter::GetTopNumberArray( SCSIZE& rCol, SCSIZE& rRow FormulaError nErr = FormulaError::NONE; double fCellVal; - ScValueIterator aValIter(pDok, aRange, mnSubTotalFlags); + ScValueIterator aValIter(&mrDoc, aRange, mnSubTotalFlags); if (aValIter.GetFirst(fCellVal, nErr)) { do @@ -3961,7 +3961,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (bIgnoreErrVal && aCell.hasError()) ; // nothing else if (aCell.hasNumeric()) @@ -3982,7 +3982,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double FormulaError nErr = FormulaError::NONE; double fCellVal; - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst( fCellVal, nErr)) { if (bIgnoreErrVal) @@ -4128,7 +4128,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double void ScInterpreter::GetSortArray( sal_uInt8 nParamCount, vector<double>& rSortArray, vector<long>* pIndexOrder, bool bConvertTextInArray, bool bAllowEmptyArray ) { GetNumberSequenceArray( nParamCount, rSortArray, bConvertTextInArray ); - if (rSortArray.size() > MAX_COUNT_DOUBLE_FOR_SORT(pDok->GetSheetLimits())) + if (rSortArray.size() > MAX_COUNT_DOUBLE_FOR_SORT(mrDoc.GetSheetLimits())) SetError( FormulaError::MatrixSize); else if ( rSortArray.empty() ) { @@ -4306,7 +4306,7 @@ void ScInterpreter::ScAveDev() case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) { rVal += GetCellValue(aAdr, aCell); @@ -4320,7 +4320,7 @@ void ScInterpreter::ScAveDev() FormulaError nErr = FormulaError::NONE; double nCellVal; PopDoubleRef( aRange, nParam, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst(nCellVal, nErr)) { rVal += nCellVal; @@ -4388,7 +4388,7 @@ void ScInterpreter::ScAveDev() case svSingleRef : { PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasNumeric()) rVal += fabs(GetCellValue(aAdr, aCell) - nMiddle); } @@ -4399,7 +4399,7 @@ void ScInterpreter::ScAveDev() FormulaError nErr = FormulaError::NONE; double nCellVal; PopDoubleRef( aRange, nParam, nRefInList); - ScValueIterator aValIter( pDok, aRange, mnSubTotalFlags ); + ScValueIterator aValIter( &mrDoc, aRange, mnSubTotalFlags ); if (aValIter.GetFirst(nCellVal, nErr)) { rVal += (fabs(nCellVal - nMiddle)); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 347377ed0a90..1d5b37fff09b 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -92,10 +92,10 @@ thread_local bool ScInterpreter::bGlobalStackInUse = false; void ScInterpreter::ReplaceCell( ScAddress& rPos ) { - size_t ListSize = pDok->m_TableOpList.size(); + size_t ListSize = mrDoc.m_TableOpList.size(); for ( size_t i = 0; i < ListSize; ++i ) { - ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ]; + ScInterpreterTableOpParams *const pTOp = mrDoc.m_TableOpList[ i ]; if ( rPos == pTOp->aOld1 ) { rPos = pTOp->aNew1; @@ -115,10 +115,10 @@ bool ScInterpreter::IsTableOpInRange( const ScRange& rRange ) return false; // not considered to be a range in TableOp sense // we can't replace a single cell in a range - size_t ListSize = pDok->m_TableOpList.size(); + size_t ListSize = mrDoc.m_TableOpList.size(); for ( size_t i = 0; i < ListSize; ++i ) { - ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ]; + ScInterpreterTableOpParams *const pTOp = mrDoc.m_TableOpList[ i ]; if ( rRange.In( pTOp->aOld1 ) ) return true; if ( rRange.In( pTOp->aOld2 ) ) @@ -133,7 +133,7 @@ sal_uInt32 ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, ScRefCellV FormulaError nErr; if (rCell.isEmpty()) { - nFormat = pDok->GetNumberFormat( mrContext, rPos ); + nFormat = mrDoc.GetNumberFormat( mrContext, rPos ); nErr = FormulaError::NONE; } else @@ -142,7 +142,7 @@ sal_uInt32 ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, ScRefCellV nErr = rCell.mpFormula->GetErrCode(); else nErr = FormulaError::NONE; - nFormat = pDok->GetNumberFormat( mrContext, rPos ); + nFormat = mrDoc.GetNumberFormat( mrContext, rPos ); } SetError(nErr); @@ -154,8 +154,8 @@ double ScInterpreter::GetValueCellValue( const ScAddress& rPos, double fOrig ) { if ( bCalcAsShown && fOrig != 0.0 ) { - sal_uInt32 nFormat = pDok->GetNumberFormat( mrContext, rPos ); - fOrig = pDok->RoundValueAsShown( fOrig, nFormat, &mrContext ); + sal_uInt32 nFormat = mrDoc.GetNumberFormat( mrContext, rPos ); + fOrig = mrDoc.RoundValueAsShown( fOrig, nFormat, &mrContext ); } return fOrig; } @@ -206,7 +206,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue& if (pFCell->IsValue()) { fValue = pFCell->GetValue(); - pDok->GetNumberFormatInfo( mrContext, nCurFmtType, nCurFmtIndex, + mrDoc.GetNumberFormatInfo( mrContext, nCurFmtType, nCurFmtIndex, rPos ); } else @@ -224,10 +224,10 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue& case CELLTYPE_VALUE: { fValue = rCell.mfValue; - nCurFmtIndex = pDok->GetNumberFormat( mrContext, rPos ); + nCurFmtIndex = mrDoc.GetNumberFormat( mrContext, rPos ); nCurFmtType = mrContext.GetNumberFormatType( nCurFmtIndex ); if ( bCalcAsShown && fValue != 0.0 ) - fValue = pDok->RoundValueAsShown( fValue, nCurFmtIndex, &mrContext ); + fValue = mrDoc.RoundValueAsShown( fValue, nCurFmtIndex, &mrContext ); } break; case CELLTYPE_STRING: @@ -235,7 +235,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, ScRefCellValue& { // SUM(A1:A2) differs from A1+A2. No good. But people insist on // it ... #i5658# - OUString aStr = rCell.getString(pDok); + OUString aStr = rCell.getString(&mrDoc); fValue = ConvertStringToValue( aStr ); } break; @@ -255,7 +255,7 @@ void ScInterpreter::GetCellString( svl::SharedString& rStr, ScRefCellValue& rCel { case CELLTYPE_STRING: case CELLTYPE_EDIT: - rStr = mrStrPool.intern(rCell.getString(pDok)); + rStr = mrStrPool.intern(rCell.getString(&mrDoc)); break; case CELLTYPE_FORMULA: { @@ -316,7 +316,7 @@ bool ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { aAdr.SetCol( nCol ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (!aCell.isEmpty()) { FormulaError nErr = FormulaError::NONE; @@ -394,7 +394,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol = nCol1; while (nCol <= nCol2) { - ScRefCellValue aCell(*pDok, ScAddress(nCol, nRow, nTab)); + ScRefCellValue aCell(mrDoc, ScAddress(nCol, nRow, nTab)); if (!aCell.isEmpty()) { OUString aStr; @@ -404,7 +404,7 @@ bool ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { case CELLTYPE_STRING: case CELLTYPE_EDIT: - aStr = aCell.getString(pDok); + aStr = aCell.getString(&mrDoc); break; case CELLTYPE_FORMULA: if (!aCell.mpFormula->IsValue()) @@ -495,7 +495,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, while (nCol <= nCol2) { aAdr.SetCol( nCol ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (!aCell.isEmpty()) { FormulaError nErr = FormulaError::NONE; @@ -507,7 +507,7 @@ bool ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { case CELLTYPE_STRING : case CELLTYPE_EDIT : - aStr = aCell.getString(pDok); + aStr = aCell.getString(&mrDoc); nType = 1; break; case CELLTYPE_VALUE : @@ -689,12 +689,12 @@ void ScInterpreter::PushTokenRef( const formula::FormulaConstTokenRef& x ) void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString, const ScAddress & rAddress, SvNumFormatType * pRetTypeExpr, sal_uInt32 * pRetIndexExpr, bool bFinalResult ) { - ScRefCellValue aCell(*pDok, rAddress); + ScRefCellValue aCell(mrDoc, rAddress); if (aCell.hasEmptyValue()) { bool bInherited = (aCell.meType == CELLTYPE_FORMULA); if (pRetTypeExpr && pRetIndexExpr) - pDok->GetNumberFormatInfo(mrContext, *pRetTypeExpr, *pRetIndexExpr, rAddress); + mrDoc.GetNumberFormatInfo(mrContext, *pRetTypeExpr, *pRetIndexExpr, rAddress); PushTempToken( new ScEmptyCellToken( bInherited, bDisplayEmptyAsString)); return; } @@ -880,17 +880,17 @@ void ScInterpreter::SingleRefToVars( const ScSingleRefData & rRef, else rTab = rRef.Tab(); - if( !pDok->ValidCol( rCol) || rRef.IsColDeleted() ) + if( !mrDoc.ValidCol( rCol) || rRef.IsColDeleted() ) { SetError( FormulaError::NoRef ); rCol = 0; } - if( !pDok->ValidRow( rRow) || rRef.IsRowDeleted() ) + if( !mrDoc.ValidRow( rRow) || rRef.IsRowDeleted() ) { SetError( FormulaError::NoRef ); rRow = 0; } - if( !ValidTab( rTab, pDok->GetTableCount() - 1) || rRef.IsTabDeleted() ) + if( !ValidTab( rTab, mrDoc.GetTableCount() - 1) || rRef.IsTabDeleted() ) { SetError( FormulaError::NoRef ); rTab = 0; @@ -931,7 +931,7 @@ void ScInterpreter::PopSingleRef( ScAddress& rAdr ) SCTAB nTab; SingleRefToVars( *pRefData, nCol, nRow, nTab); rAdr.Set( nCol, nRow, nTab ); - if (!pDok->m_TableOpList.empty()) + if (!mrDoc.m_TableOpList.empty()) ReplaceCell( rAdr ); } break; @@ -956,7 +956,7 @@ void ScInterpreter::DoubleRefToVars( const formula::FormulaToken* p, std::swap( rRow2, rRow1); if (rTab2 < rTab1) std::swap( rTab2, rTab1); - if (!pDok->m_TableOpList.empty()) + if (!mrDoc.m_TableOpList.empty()) { ScRange aRange( rCol1, rRow1, rTab1, rCol2, rRow2, rTab2 ); if ( IsTableOpInRange( aRange ) ) @@ -983,7 +983,7 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef() PopDoubleRef(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2); if (nGlobalError != FormulaError::NONE) break; - return new ScDBInternalRange(pDok, + return new ScDBInternalRange(&mrDoc, ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2)); } case svMatrix: @@ -996,7 +996,7 @@ ScDBRangeBase* ScInterpreter::PopDBDoubleRef() PopExternalDoubleRef(pMat); if (nGlobalError != FormulaError::NONE) break; - return new ScDBExternalRange(pDok, pMat); + return new ScDBExternalRange(&mrDoc, pMat); } default: SetError( FormulaError::IllegalParameter); @@ -1039,7 +1039,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef, SingleRefToVars( rCRef.Ref2, nCol, nRow, nTab); rRange.aEnd.Set( nCol, nRow, nTab ); rRange.PutInOrder(); - if (!pDok->m_TableOpList.empty() && !bDontCheckForTableOp) + if (!mrDoc.m_TableOpList.empty() && !bDontCheckForTableOp) { if ( IsTableOpInRange( rRange ) ) SetError( FormulaError::IllegalParameter ); @@ -1165,7 +1165,7 @@ void ScInterpreter::PopExternalSingleRef( if (nGlobalError != FormulaError::NONE) return; - ScExternalRefManager* pRefMgr = pDok->GetExternalRefManager(); + ScExternalRefManager* pRefMgr = mrDoc.GetExternalRefManager(); const OUString* pFile = pRefMgr->getExternalFileName(rFileId); if (!pFile) { @@ -1180,7 +1180,7 @@ void ScInterpreter::PopExternalSingleRef( return; } - ScAddress aAddr = rRef.toAbs(pDok, aPos); + ScAddress aAddr = rRef.toAbs(&mrDoc, aPos); ScExternalRefCache::CellFormat aFmt; ScExternalRefCache::TokenRef xNew = pRefMgr->getSingleRefToken( rFileId, rTabName, aAddr, &aPos, nullptr, &aFmt); @@ -1266,7 +1266,7 @@ void ScInterpreter::PopExternalDoubleRef(ScMatrixRef& rMat) void ScInterpreter::GetExternalDoubleRef( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rData, ScExternalRefCache::TokenArrayRef& rArray) { - ScExternalRefManager* pRefMgr = pDok->GetExternalRefManager(); + ScExternalRefManager* pRefMgr = mrDoc.GetExternalRefManager(); const OUString* pFile = pRefMgr->getExternalFileName(nFileId); if (!pFile) { @@ -1281,8 +1281,8 @@ void ScInterpreter::GetExternalDoubleRef( } ScComplexRefData aData(rData); - ScRange aRange = aData.toAbs(pDok, aPos); - if (!pDok->ValidColRow(aRange.aStart.Col(), aRange.aStart.Row()) || !pDok->ValidColRow(aRange.aEnd.Col(), aRange.aEnd.Row())) + ScRange aRange = aData.toAbs(&mrDoc, aPos); + if (!mrDoc.ValidColRow(aRange.aStart.Col(), aRange.aStart.Row()) || !mrDoc.ValidColRow(aRange.aEnd.Col(), aRange.aEnd.Row())) { SetError(FormulaError::NoRef); return; @@ -1369,7 +1369,7 @@ void ScInterpreter::PopRefListPushMatrixOrRef() if (nEntries == 1) { --sp; - PushTempTokenWithoutError( new ScDoubleRefToken( pDok->GetSheetLimits(), (*pv)[0] )); + PushTempTokenWithoutError( new ScDoubleRefToken( mrDoc.GetSheetLimits(), (*pv)[0] )); } else if (bMatrixFormula) { @@ -1391,13 +1391,13 @@ void ScInterpreter::PopRefListPushMatrixOrRef() if (nGlobalError == FormulaError::NONE) { ScAddress aAdr( nCol, nRow, nTab); - ScRefCellValue aCell( *pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); if (aCell.hasError()) xMat->PutError( aCell.mpFormula->GetErrCode(), 0, i); else if (aCell.hasEmptyValue()) xMat->PutEmpty( 0, i); else if (aCell.hasString()) - xMat->PutString( mrStrPool.intern( aCell.getString( pDok)), 0, i); + xMat->PutString( mrStrPool.intern( aCell.getString(&mrDoc)), 0, i); else xMat->PutDouble( aCell.getValue(), 0, i); } @@ -1791,7 +1791,7 @@ void ScInterpreter::PushStringBuffer( const sal_Unicode* pString ) { if ( pString ) { - svl::SharedString aSS = pDok->GetSharedStringPool().intern(OUString(pString)); + svl::SharedString aSS = mrDoc.GetSharedStringPool().intern(OUString(pString)); PushString(aSS); } else @@ -1800,7 +1800,7 @@ void ScInterpreter::PushStringBuffer( const sal_Unicode* pString ) void ScInterpreter::PushString( const OUString& rStr ) { - PushString(pDok->GetSharedStringPool().intern(rStr)); + PushString(mrDoc.GetSharedStringPool().intern(rStr)); } void ScInterpreter::PushString( const svl::SharedString& rString ) @@ -1815,7 +1815,7 @@ void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab) { ScSingleRefData aRef; aRef.InitAddress(ScAddress(nCol,nRow,nTab)); - PushTempTokenWithoutError( new ScSingleRefToken( pDok->GetSheetLimits(), aRef ) ); + PushTempTokenWithoutError( new ScSingleRefToken( mrDoc.GetSheetLimits(), aRef ) ); } } @@ -1826,7 +1826,7 @@ void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, { ScComplexRefData aRef; aRef.InitRange(ScRange(nCol1,nRow1,nTab1,nCol2,nRow2,nTab2)); - PushTempTokenWithoutError( new ScDoubleRefToken( pDok->GetSheetLimits(), aRef ) ); + PushTempTokenWithoutError( new ScDoubleRefToken( mrDoc.GetSheetLimits(), aRef ) ); } } @@ -1838,7 +1838,7 @@ void ScInterpreter::PushExternalSingleRef( ScSingleRefData aRef; aRef.InitAddress(ScAddress(nCol,nRow,nTab)); PushTempTokenWithoutError( new ScExternalSingleRefToken(nFileId, - pDok->GetSharedStringPool().intern( rTabName), aRef)) ; + mrDoc.GetSharedStringPool().intern( rTabName), aRef)) ; } } @@ -1851,7 +1851,7 @@ void ScInterpreter::PushExternalDoubleRef( ScComplexRefData aRef; aRef.InitRange(ScRange(nCol1,nRow1,nTab1,nCol2,nRow2,nTab2)); PushTempTokenWithoutError( new ScExternalDoubleRefToken(nFileId, - pDok->GetSharedStringPool().intern( rTabName), aRef) ); + mrDoc.GetSharedStringPool().intern( rTabName), aRef) ); } } @@ -1860,8 +1860,8 @@ void ScInterpreter::PushSingleRef( const ScRefAddress& rRef ) if (!IfErrorPushError()) { ScSingleRefData aRef; - aRef.InitFromRefAddress( pDok, rRef, aPos); - PushTempTokenWithoutError( new ScSingleRefToken( pDok->GetSheetLimits(), aRef ) ); + aRef.InitFromRefAddress( &mrDoc, rRef, aPos); + PushTempTokenWithoutError( new ScSingleRefToken( mrDoc.GetSheetLimits(), aRef ) ); } } @@ -1870,8 +1870,8 @@ void ScInterpreter::PushDoubleRef( const ScRefAddress& rRef1, const ScRefAddress if (!IfErrorPushError()) { ScComplexRefData aRef; - aRef.InitFromRefAddresses( pDok, rRef1, rRef2, aPos); - PushTempTokenWithoutError( new ScDoubleRefToken( pDok->GetSheetLimits(), aRef ) ); + aRef.InitFromRefAddresses( &mrDoc, rRef1, rRef2, aPos); + PushTempTokenWithoutError( new ScDoubleRefToken( mrDoc.GetSheetLimits(), aRef ) ); } } @@ -2085,7 +2085,7 @@ double ScInterpreter::GetDouble() { ScAddress aAdr; PopSingleRef( aAdr ); - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); nVal = GetCellValue(aAdr, aCell); } break; @@ -2096,7 +2096,7 @@ double ScInterpreter::GetDouble() ScAddress aAdr; if ( nGlobalError == FormulaError::NONE && DoubleRefToPosSingleRef( aRange, aAdr ) ) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); nVal = GetCellValue(aAdr, aCell); } else @@ -2268,7 +2268,7 @@ bool ScInterpreter::GetDoubleOrString( double& rDouble, svl::SharedString& rStri rDouble = 0.0; return true; // caller needs to check nGlobalError } - ScRefCellValue aCell( *pDok, aAdr); + ScRefCellValue aCell( mrDoc, aAdr); if (aCell.hasNumeric()) { rDouble = GetCellValue( aAdr, aCell); @@ -2330,7 +2330,7 @@ svl::SharedString ScInterpreter::GetString() PopSingleRef( aAdr ); if (nGlobalError == FormulaError::NONE) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); svl::SharedString aSS; GetCellString(aSS, aCell); return aSS; @@ -2345,7 +2345,7 @@ svl::SharedString ScInterpreter::GetString() ScAddress aAdr; if ( nGlobalError == FormulaError::NONE && DoubleRefToPosSingleRef( aRange, aAdr ) ) { - ScRefCellValue aCell(*pDok, aAdr); + ScRefCellValue aCell(mrDoc, aAdr); svl::SharedString aSS; GetCellString(aSS, aCell); return aSS; @@ -2491,7 +2491,7 @@ void ScInterpreter::ScDBGet() } pQueryParam->mbSkipString = false; - ScDBQueryDataIterator aValIter(pDok, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(&mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if (!aValIter.GetFirst(aValue) || aValue.mnError != FormulaError::NONE) { @@ -2673,14 +2673,14 @@ void ScInterpreter::ScExternal() ScAddInAsync* pAs = ScAddInAsync::Get( nHandle ); if ( !pAs ) { - pAs = new ScAddInAsync(nHandle, pLegacyFuncData, pDok); + pAs = new ScAddInAsync(nHandle, pLegacyFuncData, &mrDoc); pMyFormulaCell->StartListening( *pAs ); } else { pMyFormulaCell->StartListening( *pAs ); - if ( !pAs->HasDocument( pDok ) ) - pAs->AddDocument( pDok ); + if ( !pAs->HasDocument( &mrDoc ) ) + pAs->AddDocument( &mrDoc ); } if ( pAs->IsValid() ) { @@ -2729,14 +2729,14 @@ void ScInterpreter::ScExternal() if ( aCall.NeedsCaller() && GetError() == FormulaError::NONE ) { - SfxObjectShell* pShell = pDok->GetDocumentShell(); + SfxObjectShell* pShell = mrDoc.GetDocumentShell(); if (pShell) aCall.SetCallerFromObjectShell( pShell ); else { // use temporary model object (without document) to supply options aCall.SetCaller( static_cast<beans::XPropertySet*>( - new ScDocOptionsObj( pDok->GetDocOptions() ) ) ); + new ScDocOptionsObj( mrDoc.GetDocOptions() ) ) ); } } @@ -2796,7 +2796,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillLongArray( aParam, pDok, aRange )) + if (!ScRangeToSequence::FillLongArray( aParam, &mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; @@ -2827,7 +2827,7 @@ void ScInterpreter::ScExternal() { ScRange aRange; PopDoubleRef( aRange ); - if (!ScRangeToSequence::FillDoubleArray( aParam, pDok, aRange )) + if (!ScRangeToSequence::FillDoubleArray( aParam, &mrDoc, aRange )) SetError(FormulaError::IllegalParameter); } break; @@ -2858,7 +2858,7 @@ void ScInterpreter::ScExternal() { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits