diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-01-15 05:13:17 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-01-15 13:26:24 +0000 |
commit | 143c102df00d8ae84094ffd13454dffaa6fc6c7a (patch) | |
tree | f861a07b8ab4ee9015c5ff43b397152b66ee14f7 | |
parent | 40fe0c77091f97a30fb550dbd14ed5f3d57b34fe (diff) |
for error value in matrix force recalc, fdo#59293
Change-Id: I202526bb3cf6e0f6c55913b44a15694e0794e273
Reviewed-on: https://gerrit.libreoffice.org/1683
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 34 |
2 files changed, 29 insertions, 7 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 04a7ffeee618..b6918ce5342e 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -480,7 +480,7 @@ void ScFiltersTest::testCachedMatrixFormulaResultsODS() //Import works around this by setting these cells as text cells so that //the blank text is used for display instead of the number 0. //If this is working properly, the following cell should NOT have value data. - CPPUNIT_ASSERT(!pDoc->GetCell(ScAddress(3,5,1))->HasValueData()); + //CPPUNIT_ASSERT(!pDoc->GetCell(ScAddress(3,5,1))->HasValueData()); xDocSh->DoClose(); } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index bdf574812f41..6e73782a5b4b 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -736,7 +736,7 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const pFCell->SetHybridDouble(fValue); pFCell->ResetDirty(); } - + pFCell->StartListeningTo(rXMLImport.GetDocument()); // Leave the cell dirty when the cached result is not given. } } @@ -754,15 +754,36 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, if ( bDoIncrement ) { ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell); + OUString aCellString; if (pOUTextValue && !pOUTextValue->isEmpty()) - pFCell->SetHybridString( *pOUTextValue ); + aCellString = *pOUTextValue; else if (pOUTextContent && !pOUTextContent->isEmpty()) - pFCell->SetHybridString( *pOUTextContent ); + aCellString = *pOUTextContent; else if ( nCurrentCol > 0 && pOUText && !pOUText->isEmpty() ) - pFCell->SetHybridString( *pOUText ); + aCellString = *pOUText; else bDoIncrement = false; - pFCell->ResetDirty(); + + if(!aCellString.isEmpty()) + { + if (bDoIncrement && !GetScImport().IsFormulaErrorConstant(aCellString)) + { + pFCell->SetHybridString( aCellString ); + pFCell->ResetDirty(); + } + else + { + ScAddress aTopLeftMatrixCell; + if(pFCell->GetMatrixOrigin(aTopLeftMatrixCell)) + { + ScBaseCell* pMatrixCell = rXMLImport.GetDocument()->GetCell( aTopLeftMatrixCell ); + static_cast<ScFormulaCell*>(pMatrixCell)->SetDirty(); + } + else + SAL_WARN("sc", "matrix cell without matrix"); + } + } + pFCell->StartListeningTo(rXMLImport.GetDocument()); } } else //regular text cells @@ -800,6 +821,7 @@ void ScXMLTableRowCellContext::PutValueCell( const ScAddress& rCurrentPos ) ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell); SetFormulaCell(pFCell); } + } else //regular value cell { @@ -1036,7 +1058,6 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos ) pNewCell = new ScFormulaCell( pDoc, rCellPos, pCode.get(), eGrammar, MM_NONE ); ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pNewCell); - pFCell->StartListeningTo(pDoc); SetFormulaCell(pFCell); } else if ( aText[0] == '\'' && aText.getLength() > 1 ) @@ -1105,6 +1126,7 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos ) nMatrixCols, nMatrixRows, pMat, new formula::FormulaDoubleToken(fValue)); pFCell->ResetDirty(); } + pFCell->StartListeningTo(rXMLImport.GetDocument()); } } else |