[PATCH] Change in core[libreoffice-4-0]: for error value in matrix force recalc, fdo#59293

Markus Mohrhard (via Code Review) gerrit at gerrit.libreoffice.org
Mon Jan 14 20:16:59 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1683

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/83/1683/1

for error value in matrix force recalc, fdo#59293

Change-Id: I202526bb3cf6e0f6c55913b44a15694e0794e273
---
M sc/source/filter/xml/xmlcelli.cxx
1 file changed, 28 insertions(+), 6 deletions(-)



diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index bdf5748..6e73782 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -736,7 +736,7 @@
             pFCell->SetHybridDouble(fValue);
             pFCell->ResetDirty();
         }
-
+        pFCell->StartListeningTo(rXMLImport.GetDocument());
         // Leave the cell dirty when the cached result is not given.
     }
 }
@@ -754,15 +754,36 @@
         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 @@
             ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
             SetFormulaCell(pFCell);
         }
+
     }
     else  //regular value cell
     {
@@ -1036,7 +1058,6 @@
             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 @@
                         nMatrixCols, nMatrixRows, pMat, new formula::FormulaDoubleToken(fValue));
                     pFCell->ResetDirty();
                 }
+                pFCell->StartListeningTo(rXMLImport.GetDocument());
             }
         }
         else

-- 
To view, visit https://gerrit.libreoffice.org/1683
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I202526bb3cf6e0f6c55913b44a15694e0794e273
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Markus Mohrhard <markus.mohrhard at googlemail.com>



More information about the LibreOffice mailing list