sc/inc/scmatrix.hxx | 30 +++++++++++++++++----------- sc/source/core/data/dociter.cxx | 4 +-- sc/source/core/tool/compiler.cxx | 2 - sc/source/core/tool/interpr1.cxx | 40 +++++++++++++++++++------------------- sc/source/core/tool/interpr3.cxx | 32 +++++++++++++++--------------- sc/source/core/tool/interpr4.cxx | 2 - sc/source/core/tool/interpr5.cxx | 4 +-- sc/source/core/tool/interpr8.cxx | 6 ++--- sc/source/core/tool/rangeseq.cxx | 8 +++---- sc/source/core/tool/scmatrix.cxx | 26 ++++++++++++------------ sc/source/core/tool/token.cxx | 2 - sc/source/ui/unoobj/chart2uno.cxx | 2 - 12 files changed, 82 insertions(+), 76 deletions(-)
New commits: commit adc6ba2ad502f095dde8f36242fda9aaa6c276fd Author: Eike Rathke <[email protected]> Date: Sat Mar 10 21:52:07 2018 +0100 Rename ScMatrix::IsString() to IsStringOrEmpty() ... to prevent further confusion what it acually returns. Follow-up inspection of places where used might be necessary, and whether an IsEmpty() is used and necessary or an IsAnyEmpty() or some such would be needed. Change-Id: I7975a97f0d16442cf195956d148bfb7fbdf89c6a Reviewed-on: https://gerrit.libreoffice.org/51055 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins <[email protected]> diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index 4acd2c937f91..9be335fbc06b 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -315,11 +315,13 @@ public: /// an empty string! virtual ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const = 0; - /// @return <TRUE/> if string or empty or empty path, in fact non-value. - virtual bool IsString( SCSIZE nIndex ) const = 0; + /** @return <TRUE/> if string or any empty, empty cell, empty result, empty + path, in fact non-value. */ + virtual bool IsStringOrEmpty( SCSIZE nIndex ) const = 0; - /// @return <TRUE/> if string or empty or empty path, in fact non-value. - virtual bool IsString( SCSIZE nC, SCSIZE nR ) const = 0; + /** @return <TRUE/> if string or any empty, empty cell, empty result, empty + path, in fact non-value. */ + virtual bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const = 0; /// @return <TRUE/> if empty or empty cell or empty result, not empty path. virtual bool IsEmpty( SCSIZE nC, SCSIZE nR ) const = 0; @@ -531,11 +533,13 @@ public: /// an empty string! virtual ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const override; - /// @return <TRUE/> if string or empty or empty path, in fact non-value. - virtual bool IsString( SCSIZE nIndex ) const override; + /** @return <TRUE/> if string or any empty, empty cell, empty result, empty + path, in fact non-value. */ + virtual bool IsStringOrEmpty( SCSIZE nIndex ) const override; - /// @return <TRUE/> if string or empty or empty path, in fact non-value. - virtual bool IsString( SCSIZE nC, SCSIZE nR ) const override; + /** @return <TRUE/> if string or any empty, empty cell, empty result, empty + path, in fact non-value. */ + virtual bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const override; /// @return <TRUE/> if empty or empty cell or empty result, not empty path. virtual bool IsEmpty( SCSIZE nC, SCSIZE nR ) const override; @@ -750,11 +754,13 @@ public: /// an empty string! virtual ScMatrixValue Get(SCSIZE nC, SCSIZE nR) const override; - /// @return <TRUE/> if string or empty or empty path, in fact non-value. - virtual bool IsString(SCSIZE nIndex) const override; + /** @return <TRUE/> if string or any empty, empty cell, empty result, empty + path, in fact non-value. */ + virtual bool IsStringOrEmpty(SCSIZE nIndex) const override; - /// @return <TRUE/> if string or empty or empty path, in fact non-value. - virtual bool IsString(SCSIZE nC, SCSIZE nR) const override; + /** @return <TRUE/> if string or any empty, empty cell, empty result, empty + path, in fact non-value. */ + virtual bool IsStringOrEmpty(SCSIZE nC, SCSIZE nR) const override; /// @return <TRUE/> if empty or empty cell or empty result, not empty path. virtual bool IsEmpty(SCSIZE nC, SCSIZE nR) const override; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index cd8c247ee3d5..90f240e32a3a 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -540,7 +540,7 @@ bool ScDBQueryDataIterator::DataAccessMatrix::getCurrent(Value& rValue) // Don't take empty values into account. continue; - bool bIsStrVal = rMat.IsString(mpParam->mnField, mnCurRow); + bool bIsStrVal = rMat.IsStringOrEmpty(mpParam->mnField, mnCurRow); if (bIsStrVal && mpParam->mbSkipString) continue; @@ -598,7 +598,7 @@ bool isQueryByString(const ScQueryEntry& rEntry, const ScQueryEntry::Item& rItem ; } - return rItem.meType == ScQueryEntry::ByString && rMat.IsString(nCol, nRow); + return rItem.meType == ScQueryEntry::ByString && rMat.IsStringOrEmpty(nCol, nRow); } } diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 68e814e23c44..4b574a3a2bca 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4984,7 +4984,7 @@ void ScCompiler::CreateStringFromMatrix( OUStringBuffer& rBuffer, const FormulaT } else if( pMatrix->IsEmpty( nC, nR ) ) ; - else if( pMatrix->IsString( nC, nR ) ) + else if( pMatrix->IsStringOrEmpty( nC, nR ) ) AppendString( rBuffer, pMatrix->GetString(nC, nR).getString() ); } } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 21fecb197b1e..06fc60b8a18e 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -912,7 +912,7 @@ double ScInterpreter::Compare( ScQueryOp eOp ) } if (pMat->IsEmpty(0, 0)) rCell.mbEmpty = true; - else if (pMat->IsString(0, 0)) + else if (pMat->IsStringOrEmpty(0, 0)) { rCell.maStr = pMat->GetString(0, 0); rCell.mbValue = false; @@ -1039,7 +1039,7 @@ sc::RangeMatrix ScInterpreter::CompareMat( ScQueryOp eOp, sc::CompareOptions* pO { sc::Compare::Cell& rCell = aComp.maCells[i]; - if (aMat[i].mpMat->IsString(j, k)) + if (aMat[i].mpMat->IsStringOrEmpty(j, k)) { rCell.mbValue = false; rCell.maStr = aMat[i].mpMat->GetString(j, k); @@ -1958,14 +1958,14 @@ bool ScInterpreter::IsString() if ( !pMat ) ; // nothing else if ( !pJumpMatrix ) - bRes = pMat->IsString(0, 0) && !pMat->IsEmpty(0, 0); + bRes = pMat->IsStringOrEmpty(0, 0) && !pMat->IsEmpty(0, 0); else { SCSIZE nCols, nRows, nC, nR; pMat->GetDimensions( nCols, nRows); pJumpMatrix->GetPos( nC, nR); if ( nC < nCols && nR < nRows ) - bRes = pMat->IsString( nC, nR) && !pMat->IsEmpty( nC, nR); + bRes = pMat->IsStringOrEmpty( nC, nR) && !pMat->IsEmpty( nC, nR); } } break; @@ -3952,7 +3952,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, double(*VarResult)( double { for (SCSIZE nMatRow = 0; nMatRow < nR; nMatRow++) { - if (!pMat->IsString(nMatCol,nMatRow)) + if (!pMat->IsStringOrEmpty(nMatCol,nMatRow)) { fVal= pMat->GetDouble(nMatCol,nMatRow); if (nGlobalError == FormulaError::NONE) @@ -4494,9 +4494,9 @@ public: return mbColVec ? mrMat.IsValue(0, i) : mrMat.IsValue(i, 0); } - bool IsString(SCSIZE i) const + bool IsStringOrEmpty(SCSIZE i) const { - return mbColVec ? mrMat.IsString(0, i) : mrMat.IsString(i, 0); + return mbColVec ? mrMat.IsStringOrEmpty(0, i) : mrMat.IsStringOrEmpty(i, 0); } double GetDouble(SCSIZE i) const @@ -4586,7 +4586,7 @@ void lcl_GetLastMatch( SCSIZE& rIndex, const VectorMatrixAccessor& rMat, nVal == rMat.GetDouble(rIndex+1)) ++rIndex; } - // Order of IsEmptyPath, IsEmpty, IsString is significant! + // Order of IsEmptyPath, IsEmpty, IsStringOrEmpty is significant! else if (rMat.IsEmptyPath(rIndex)) { if (bReverse) @@ -4605,15 +4605,15 @@ void lcl_GetLastMatch( SCSIZE& rIndex, const VectorMatrixAccessor& rMat, while (rIndex < nMatCount-1 && rMat.IsEmpty(rIndex+1)) ++rIndex; } - else if (rMat.IsString(rIndex)) + else if (rMat.IsStringOrEmpty(rIndex)) { OUString aStr( rMat.GetString(rIndex)); if (bReverse) - while (rIndex > 0 && rMat.IsString(rIndex-1) && + while (rIndex > 0 && rMat.IsStringOrEmpty(rIndex-1) && aStr == rMat.GetString(rIndex-1)) --rIndex; else - while (rIndex < nMatCount-1 && rMat.IsString(rIndex+1) && + while (rIndex < nMatCount-1 && rMat.IsStringOrEmpty(rIndex+1) && aStr == rMat.GetString(rIndex+1)) ++rIndex; } @@ -7013,7 +7013,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) CollatorWrapper* pCollator = ScGlobal::GetCollator(); for (SCSIZE i = 0; i < nMatCount; i++) { - if (bHLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i)) + if (bHLookup ? pMat->IsStringOrEmpty(i, 0) : pMat->IsStringOrEmpty(0, i)) { sal_Int32 nRes = pCollator->compareString( @@ -7033,7 +7033,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) { for (SCSIZE i = 0; i < nMatCount; i++) { - if (pMat->IsString(i, 0)) + if (pMat->IsStringOrEmpty(i, 0)) { if (pMat->GetString(i,0).getDataIgnoreCase() == aParamStr.getDataIgnoreCase()) { @@ -7056,7 +7056,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) // #i2168# ignore strings for (SCSIZE i = 0; i < nMatCount; i++) { - if (!(bHLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i))) + if (!(bHLookup ? pMat->IsStringOrEmpty(i, 0) : pMat->IsStringOrEmpty(0, i))) { if ((bHLookup ? pMat->GetDouble(i,0) : pMat->GetDouble(0,i)) <= rItem.mfVal) nDelta = i; @@ -7071,7 +7071,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) { for (SCSIZE i = 0; i < nMatCount; i++) { - if (! pMat->IsString(i, 0) ) + if (! pMat->IsStringOrEmpty(i, 0) ) { if ( pMat->GetDouble(i,0) == rItem.mfVal) { @@ -7097,7 +7097,7 @@ void ScInterpreter::CalculateLookup(bool bHLookup) nY = static_cast<SCSIZE>(nZIndex); } assert( nX < nC && nY < nR ); - if ( pMat->IsString( nX, nY) ) + if ( pMat->IsStringOrEmpty( nX, nY) ) PushString(pMat->GetString( nX,nY).getString()); else PushDouble(pMat->GetDouble( nX,nY)); @@ -8224,7 +8224,7 @@ void ScInterpreter::ScIndex() else if (bVector) { --nElement; - if (pMat->IsString( nElement)) + if (pMat->IsStringOrEmpty( nElement)) PushString( pMat->GetString(nElement).getString()); else PushDouble( pMat->GetDouble( nElement)); @@ -8236,7 +8236,7 @@ void ScInterpreter::ScIndex() { SCSIZE nRowMinus1 = static_cast<SCSIZE>(nRow - 1); for (SCSIZE i = 0; i < nC; i++) - if (!pMat->IsString(i, nRowMinus1)) + if (!pMat->IsStringOrEmpty(i, nRowMinus1)) pResMat->PutDouble(pMat->GetDouble(i, nRowMinus1), i, 0); else @@ -8254,7 +8254,7 @@ void ScInterpreter::ScIndex() { SCSIZE nColMinus1 = static_cast<SCSIZE>(nCol - 1); for (SCSIZE i = 0; i < nR; i++) - if (!pMat->IsString(nColMinus1, i)) + if (!pMat->IsStringOrEmpty(nColMinus1, i)) pResMat->PutDouble(pMat->GetDouble(nColMinus1, i), i); else @@ -8266,7 +8266,7 @@ void ScInterpreter::ScIndex() } else { - if (!pMat->IsString( static_cast<SCSIZE>(nCol-1), + if (!pMat->IsStringOrEmpty( static_cast<SCSIZE>(nCol-1), static_cast<SCSIZE>(nRow-1))) PushDouble( pMat->GetDouble( static_cast<SCSIZE>(nCol-1), diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index f7ca635cc2f9..edbb01b4e0fa 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -2541,7 +2541,7 @@ void ScInterpreter::ScZTest() else { for (SCSIZE i = 0; i < nCount; i++) - if (!pMat->IsString(i)) + if (!pMat->IsStringOrEmpty(i)) { fVal= pMat->GetDouble(i); fSum += fVal; @@ -2586,7 +2586,7 @@ bool ScInterpreter::CalculateTest(bool _bTemplin for (i = 0; i < nC1; i++) for (j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j)) { fVal = pMat1->GetDouble(i,j); fSum1 += fVal; @@ -2597,7 +2597,7 @@ bool ScInterpreter::CalculateTest(bool _bTemplin for (i = 0; i < nC2; i++) for (j = 0; j < nR2; j++) { - if (!pMat2->IsString(i,j)) + if (!pMat2->IsStringOrEmpty(i,j)) { fVal = pMat2->GetDouble(i,j); fSum2 += fVal; @@ -2677,7 +2677,7 @@ void ScInterpreter::ScTTest() for (i = 0; i < nC1; i++) for (j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { fVal1 = pMat1->GetDouble(i,j); fVal2 = pMat2->GetDouble(i,j); @@ -2814,7 +2814,7 @@ void ScInterpreter::ScChiTest() if (!(pMat1->IsEmpty(i,j) || pMat2->IsEmpty(i,j))) { bEmpty = false; - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { double fValX = pMat1->GetDouble(i,j); double fValE = pMat2->GetDouble(i,j); @@ -2998,7 +2998,7 @@ void ScInterpreter::ScHarMean() else { for (SCSIZE nElem = 0; nElem < nCount; nElem++) - if (!pMat->IsString(nElem)) + if (!pMat->IsStringOrEmpty(nElem)) { double x = pMat->GetDouble(nElem); if (x > 0.0) @@ -3161,7 +3161,7 @@ void ScInterpreter::ScGeoMean() { for (SCSIZE ui = 0; ui < nCount; ui++) { - if (!pMat->IsString(ui)) + if (!pMat->IsStringOrEmpty(ui)) { double x = pMat->GetDouble(ui); if (x > 0.0) @@ -3290,7 +3290,7 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std:: else { for (SCSIZE nElem = 0; nElem < nCount; nElem++) - if (!pMat->IsString(nElem)) + if (!pMat->IsStringOrEmpty(nElem)) { fVal = pMat->GetDouble(nElem); fSum += fVal; @@ -4053,7 +4053,7 @@ void ScInterpreter::ScAveDev() else { for (SCSIZE nElem = 0; nElem < nCount; nElem++) - if (!pMat->IsString(nElem)) + if (!pMat->IsStringOrEmpty(nElem)) { rVal += pMat->GetDouble(nElem); rValCount++; @@ -4126,7 +4126,7 @@ void ScInterpreter::ScAveDev() { for (SCSIZE nElem = 0; nElem < nCount; nElem++) { - if (!pMat->IsString(nElem)) + if (!pMat->IsStringOrEmpty(nElem)) rVal += fabs(pMat->GetDouble(nElem) - nMiddle); } } @@ -4267,7 +4267,7 @@ void ScInterpreter::CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _b { for (SCSIZE j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { double fValX = pMat1->GetDouble(i,j); double fValY = pMat2->GetDouble(i,j); @@ -4290,7 +4290,7 @@ void ScInterpreter::CalculatePearsonCovar( bool _bPearson, bool _bStexy, bool _b { for (SCSIZE j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { const double fValX = pMat1->GetDouble(i,j); const double fValY = pMat2->GetDouble(i,j); @@ -4377,7 +4377,7 @@ void ScInterpreter::CalculateSlopeIntercept(bool bSlope) { for (SCSIZE j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { double fValX = pMat1->GetDouble(i,j); double fValY = pMat2->GetDouble(i,j); @@ -4399,7 +4399,7 @@ void ScInterpreter::CalculateSlopeIntercept(bool bSlope) { for (SCSIZE j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { double fValX = pMat1->GetDouble(i,j); double fValY = pMat2->GetDouble(i,j); @@ -4460,7 +4460,7 @@ void ScInterpreter::ScForecast() { for (SCSIZE j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { double fValX = pMat1->GetDouble(i,j); double fValY = pMat2->GetDouble(i,j); @@ -4482,7 +4482,7 @@ void ScInterpreter::ScForecast() { for (SCSIZE j = 0; j < nR1; j++) { - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { double fValX = pMat1->GetDouble(i,j); double fValY = pMat2->GetDouble(i,j); diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index c1cd4f835398..727976c14655 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3383,7 +3383,7 @@ void ScInterpreter::ScMacro() { nIdx[ 1 ] = static_cast<sal_Int32>(nMatCol+1); SbxVariable* p = refArray->Get32( nIdx ); - if (pMat->IsString(nMatCol, nMatRow)) + if (pMat->IsStringOrEmpty(nMatCol, nMatRow)) { p->PutString( pMat->GetString(nMatCol, nMatRow).getString() ); } diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index a83e5599c476..1e61811ab997 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -1134,7 +1134,7 @@ static ScMatrixRef lcl_MatrixCalculation( { xResMat->PutError( nErr, i, j); } - else if ((!bVal1 && rMat1.IsString(i,j)) || (!bVal2 && rMat2.IsString(i,j))) + else if ((!bVal1 && rMat1.IsStringOrEmpty(i,j)) || (!bVal2 && rMat2.IsStringOrEmpty(i,j))) { FormulaError nError1 = FormulaError::NONE; SvNumFormatType nFmt1 = SvNumFormatType::ALL; @@ -1772,7 +1772,7 @@ void ScInterpreter::CalculateSumX2MY2SumX2DY2(bool _bSumX2DY2) double fVal, fSum = 0.0; for (i = 0; i < nC1; i++) for (j = 0; j < nR1; j++) - if (!pMat1->IsString(i,j) && !pMat2->IsString(i,j)) + if (!pMat1->IsStringOrEmpty(i,j) && !pMat2->IsStringOrEmpty(i,j)) { fVal = pMat1->GetDouble(i,j); fSum += fVal * fVal; diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index 2161e916b7f5..d838ed110706 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -1466,7 +1466,7 @@ void ScInterpreter::ScConcat_MS() { for (SCSIZE k = 0; k < nR; k++ ) { - if ( pMat->IsString( j, k ) ) + if ( pMat->IsStringOrEmpty( j, k ) ) aResBuf.append( pMat->GetString( j, k ).getString() ); else { @@ -1588,7 +1588,7 @@ void ScInterpreter::ScTextJoin_MS() { if ( !pMat->IsEmpty( j, k ) ) { - if ( pMat->IsString( j, k ) ) + if ( pMat->IsStringOrEmpty( j, k ) ) aDelimiters.push_back( pMat->GetString( j, k ).getString() ); else { @@ -1765,7 +1765,7 @@ void ScInterpreter::ScTextJoin_MS() { if ( !pMat->IsEmpty( j, k ) ) { - if ( pMat->IsString( j, k ) ) + if ( pMat->IsStringOrEmpty( j, k ) ) aStr = pMat->GetString( j, k ).getString(); else { diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx index 89de8ef80084..32bc09e5109c 100644 --- a/sc/source/core/tool/rangeseq.cxx +++ b/sc/source/core/tool/rangeseq.cxx @@ -99,7 +99,7 @@ bool ScRangeToSequence::FillLongArray( uno::Any& rAny, const ScMatrix* pMatrix ) uno::Sequence<sal_Int32> aColSeq( static_cast<sal_Int32>(nColCount) ); sal_Int32* pColAry = aColSeq.getArray(); for (SCSIZE nCol = 0; nCol < nColCount; nCol++) - if ( pMatrix->IsString( nCol, nRow ) ) + if ( pMatrix->IsStringOrEmpty( nCol, nRow ) ) pColAry[nCol] = 0; else pColAry[nCol] = lcl_DoubleToLong( pMatrix->GetDouble( nCol, nRow ) ); @@ -152,7 +152,7 @@ bool ScRangeToSequence::FillDoubleArray( uno::Any& rAny, const ScMatrix* pMatrix uno::Sequence<double> aColSeq( static_cast<sal_Int32>(nColCount) ); double* pColAry = aColSeq.getArray(); for (SCSIZE nCol = 0; nCol < nColCount; nCol++) - if ( pMatrix->IsString( nCol, nRow ) ) + if ( pMatrix->IsStringOrEmpty( nCol, nRow ) ) pColAry[nCol] = 0.0; else pColAry[nCol] = pMatrix->GetDouble( nCol, nRow ); @@ -214,7 +214,7 @@ bool ScRangeToSequence::FillStringArray( uno::Any& rAny, const ScMatrix* pMatrix for (SCSIZE nCol = 0; nCol < nColCount; nCol++) { OUString aStr; - if ( pMatrix->IsString( nCol, nRow ) ) + if ( pMatrix->IsStringOrEmpty( nCol, nRow ) ) { if ( !pMatrix->IsEmpty( nCol, nRow ) ) aStr = pMatrix->GetString(nCol, nRow).getString(); @@ -299,7 +299,7 @@ bool ScRangeToSequence::FillMixedArray( uno::Any& rAny, const ScMatrix* pMatrix, uno::Any* pColAry = aColSeq.getArray(); for (SCSIZE nCol = 0; nCol < nColCount; nCol++) { - if ( pMatrix->IsString( nCol, nRow ) ) + if ( pMatrix->IsStringOrEmpty( nCol, nRow ) ) { OUString aStr; if ( !pMatrix->IsEmpty( nCol, nRow ) ) diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index d22fdd347e26..705a1bc0b992 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -266,8 +266,8 @@ public: svl::SharedString GetString( SCSIZE nIndex) const; svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const; ScMatrixValue Get(SCSIZE nC, SCSIZE nR) const; - bool IsString( SCSIZE nIndex ) const; - bool IsString( SCSIZE nC, SCSIZE nR ) const; + bool IsStringOrEmpty( SCSIZE nIndex ) const; + bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const; bool IsEmpty( SCSIZE nC, SCSIZE nR ) const; bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const; bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const; @@ -767,14 +767,14 @@ ScMatrixValue ScMatrixImpl::Get(SCSIZE nC, SCSIZE nR) const return aVal; } -bool ScMatrixImpl::IsString( SCSIZE nIndex ) const +bool ScMatrixImpl::IsStringOrEmpty( SCSIZE nIndex ) const { SCSIZE nC, nR; CalcPosition(nIndex, nC, nR); - return IsString(nC, nR); + return IsStringOrEmpty(nC, nR); } -bool ScMatrixImpl::IsString( SCSIZE nC, SCSIZE nR ) const +bool ScMatrixImpl::IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const { ValidColRowReplicated( nC, nR ); switch (maMat.get_type(nR, nC)) @@ -3035,14 +3035,14 @@ ScMatrixValue ScFullMatrix::Get(SCSIZE nC, SCSIZE nR) const return pImpl->Get(nC, nR); } -bool ScFullMatrix::IsString( SCSIZE nIndex ) const +bool ScFullMatrix::IsStringOrEmpty( SCSIZE nIndex ) const { - return pImpl->IsString(nIndex); + return pImpl->IsStringOrEmpty(nIndex); } -bool ScFullMatrix::IsString( SCSIZE nC, SCSIZE nR ) const +bool ScFullMatrix::IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const { - return pImpl->IsString(nC, nR); + return pImpl->IsStringOrEmpty(nC, nR); } bool ScFullMatrix::IsEmpty( SCSIZE nC, SCSIZE nR ) const @@ -3914,16 +3914,16 @@ ScMatrixValue ScVectorRefMatrix::Get(SCSIZE nC, SCSIZE nR) const return mpFullMatrix->Get(nC, nR); } -bool ScVectorRefMatrix::IsString(SCSIZE nIndex) const +bool ScVectorRefMatrix::IsStringOrEmpty(SCSIZE nIndex) const { const_cast<ScVectorRefMatrix*>(this)->ensureFullMatrix(); - return mpFullMatrix->IsString(nIndex); + return mpFullMatrix->IsStringOrEmpty(nIndex); } -bool ScVectorRefMatrix::IsString(SCSIZE nC, SCSIZE nR) const +bool ScVectorRefMatrix::IsStringOrEmpty(SCSIZE nC, SCSIZE nR) const { const_cast<ScVectorRefMatrix*>(this)->ensureFullMatrix(); - return mpFullMatrix->IsString(nC, nR); + return mpFullMatrix->IsStringOrEmpty(nC, nR); } bool ScVectorRefMatrix::IsEmpty(SCSIZE nC, SCSIZE nR) const diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 868e92928d6e..e51b3c120ed4 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -5056,7 +5056,7 @@ void appendTokenByType( sc::TokenStringContext& rCxt, OUStringBuffer& rBuf, cons { // Skip it. } - else if (pMat->IsString(nC, nR)) + else if (pMat->IsStringOrEmpty(nC, nR)) appendString(rBuf, pMat->GetString(nC, nR).getString()); } } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index e0def91cb78b..aa88e72a1122 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2645,7 +2645,7 @@ sal_Int32 ScChart2DataSequence::FillCacheFromExternalRef(const ScTokenRef& pToke m_aDataArray.push_back(aItem); ++nDataCount; } - else if (pMat->IsString(nC, nR)) + else if (pMat->IsStringOrEmpty(nC, nR)) { Item aItem; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
