[Libreoffice-commits] core.git: formula/source sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 18 21:21:51 UTC 2018


 formula/source/core/api/FormulaCompiler.cxx |    1 +
 sc/source/filter/xml/xmlcelli.cxx           |   12 +++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit a014a9bcf071229eef93c307c705a4c639635bd5
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Wed Jul 18 22:04:09 2018 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Wed Jul 18 23:21:26 2018 +0200

    Do not force all string results to be recalculated if no style set
    
    Results are forced to recalculate for cells with General format in
    case they need to inherit a format that then can be set. However,
    a General format will never lead to some other format being set
    for any string results and almost all string result cells will
    have General format because the string is already what is being
    displayed. So for formula cells with a string result available do
    not allow to use ScFormulaCell::SetNeedNumberFormat() forcing the
    need to recalculate.
    
    This popped up during intercepting for tdf#118735 when the formula
    cell containing a WEBSERVICE() call is set dirty, through
    CompileXMLHandler::operator()(...)
    
        if (pCell->NeedsNumberFormat())
            pCell->SetDirtyVar();
    
    Which again, as WEBSERVICE() has to be recalculated to populate
    the link manager, made it necessary to add that to
    ScRecalcMode::ONLOAD_LENIENT (which it should already had been
    before (when that was ONLOAD), but no harm in this case).
    
    Change-Id: I0dc2cdfe35c56d9843f0edd24a6d14e3de79f7ef
    Reviewed-on: https://gerrit.libreoffice.org/57700
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 5d4c3e76ec5b..d11bd25a08d1 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1436,6 +1436,7 @@ void FormulaCompiler::Factor()
                 case ocDde:
                 case ocMacro:
                 case ocExternal:
+                case ocWebservice:
                     pArr->AddRecalcMode( ScRecalcMode::ONLOAD_LENIENT );
                 break;
                     // If the referred cell is moved the value changes.
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 32a0cb1e6392..c9899457f23c 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1009,6 +1009,8 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
 {
     if(pFCell)
     {
+        bool bMayForceNumberformat = true;
+
         if(mbErrorValue)
         {
             // don't do anything here
@@ -1021,6 +1023,9 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
                 ScDocument* pDoc = rXMLImport.GetDocument();
                 pFCell->SetHybridString(pDoc->GetSharedStringPool().intern(*maStringValue));
                 pFCell->ResetDirty();
+                // A General format doesn't force any other format for a string
+                // result, don't attempt to recalculate this later.
+                bMayForceNumberformat = false;
             }
         }
         else if (rtl::math::isFinite(fValue))
@@ -1035,6 +1040,10 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
             else
                 pFCell->ResetDirty();
         }
+
+        if (bMayForceNumberformat)
+            // Re-calculate to get number format only when style is not set.
+            pFCell->SetNeedNumberFormat(!mbHasStyle);
     }
 }
 
@@ -1398,9 +1407,6 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
         ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, eGrammar, ScMatrixMode::NONE);
         SetFormulaCell(pNewCell);
         rDoc.setFormulaCell(rCellPos, pNewCell);
-
-        // Re-calculate to get number format only when style is not set.
-        pNewCell->SetNeedNumberFormat(!mbHasStyle);
     }
 }
 


More information about the Libreoffice-commits mailing list