diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 10 | ||||
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 23 |
2 files changed, 29 insertions, 4 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 58bc0046148a..473f40d6381c 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1879,6 +1879,16 @@ void ScInterpreter::QueryMatrixType(ScMatrixRef& xMat, short& rRetTypeExpr, sal_ PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get())); rRetTypeExpr = NUMBERFORMAT_LOGICAL; } + else if ( xMat->IsEmptyResult( 0, 0)) + { // empty formula result + FormulaTokenRef xRes = new ScEmptyCellToken( true, true); // inherited, display empty + PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get())); + } + else if ( xMat->IsEmpty( 0, 0)) + { // empty or empty cell + FormulaTokenRef xRes = new ScEmptyCellToken( false, true); // not inherited, display empty + PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get())); + } else { svl::SharedString aStr( nMatVal.GetString()); diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index b71cc1dd6e28..9afb2a6562b7 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -254,6 +254,7 @@ public: bool IsString( 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; bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const; bool IsValue( SCSIZE nIndex ) const; bool IsValue( SCSIZE nC, SCSIZE nR ) const; @@ -686,8 +687,8 @@ bool ScMatrixImpl::IsString( SCSIZE nC, SCSIZE nR ) const bool ScMatrixImpl::IsEmpty( SCSIZE nC, SCSIZE nR ) const { - // Flag must indicate an empty element instead of an - // 'empty path' element. + // Flag must indicate an 'empty' or 'empty cell' or 'empty result' element, + // but not an 'empty path' element. ValidColRowReplicated( nC, nR ); return maMat.get_type(nR, nC) == mdds::mtm::element_empty && maMatFlag.get<TMatFlag>(nR, nC) != SC_MATFLAG_EMPTYPATH; @@ -695,13 +696,22 @@ bool ScMatrixImpl::IsEmpty( SCSIZE nC, SCSIZE nR ) const bool ScMatrixImpl::IsEmptyCell( SCSIZE nC, SCSIZE nR ) const { - // Flag must indicate an 'empty' element instead of an - // 'empty result' or 'empty path' element. + // Flag must indicate an 'empty cell' element instead of an + // 'empty' or 'empty result' or 'empty path' element. ValidColRowReplicated( nC, nR ); return maMat.get_type(nR, nC) == mdds::mtm::element_empty && maMatFlag.get<TMatFlag>(nR, nC) == SC_MATFLAG_EMPTYCELL; } +bool ScMatrixImpl::IsEmptyResult( SCSIZE nC, SCSIZE nR ) const +{ + // Flag must indicate an 'empty result' element instead of an + // 'empty' or 'empty cell' or 'empty path' element. + ValidColRowReplicated( nC, nR ); + return maMat.get_type(nR, nC) == mdds::mtm::element_empty && + maMatFlag.get<TMatFlag>(nR, nC) == SC_MATFLAG_EMPTYRESULT; +} + bool ScMatrixImpl::IsEmptyPath( SCSIZE nC, SCSIZE nR ) const { // Flag must indicate an 'empty path' element. @@ -2117,6 +2127,11 @@ bool ScMatrix::IsEmptyCell( SCSIZE nC, SCSIZE nR ) const return pImpl->IsEmptyCell(nC, nR); } +bool ScMatrix::IsEmptyResult( SCSIZE nC, SCSIZE nR ) const +{ + return pImpl->IsEmptyResult(nC, nR); +} + bool ScMatrix::IsEmptyPath( SCSIZE nC, SCSIZE nR ) const { return pImpl->IsEmptyPath(nC, nR); |