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

Laurent Godard lgodard.libre at laposte.net
Fri Mar 27 16:34:20 PDT 2015


 sc/source/core/data/document.cxx |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

New commits:
commit c79bdd062f657d1be98aa815d9b882d144f35e04
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Fri Mar 20 12:02:31 2015 +0100

    tdf#90042 only handle formula group if useful
    
    Change-Id: I497a5bae4b08b46357415501ddbafc70585adfb0
    Reviewed-on: https://gerrit.libreoffice.org/14920
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 506cb2d..98ea133 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3214,19 +3214,29 @@ bool ScDocument::SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString&
     if (!pTab)
         return false;
 
-    // In case setting this string affects an existing formula group, record
-    // its above and below position for later listening.
+    bool bNumFmtSet = false;
 
-    std::vector<ScAddress> aGroupPos;
-    sc::EndListeningContext aCxt(*this);
-    ScAddress aPos(nCol, nRow, nTab);
-    EndListeningIntersectedGroup(aCxt, aPos, &aGroupPos);
-    aCxt.purgeEmptyBroadcasters();
+    const ScFormulaCell* pCurCellFormula = pTab->GetFormulaCell(nCol, nRow);
+    if (pCurCellFormula && pCurCellFormula->IsShared())
+    {
+        // In case setting this string affects an existing formula group, record
+        // its above and below position for later listening.
 
-    bool bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam);
+        std::vector<ScAddress> aGroupPos;
+        sc::EndListeningContext aCxt(*this);
+        ScAddress aPos(nCol, nRow, nTab);
+        EndListeningIntersectedGroup(aCxt, aPos, &aGroupPos);
+        aCxt.purgeEmptyBroadcasters();
 
-    SetNeedsListeningGroups(aGroupPos);
-    StartNeededListeners();
+        bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam);
+
+        SetNeedsListeningGroups(aGroupPos);
+        StartNeededListeners();
+    }
+    else
+    {
+        bNumFmtSet = pTab->SetString(nCol, nRow, nTab, rString, pParam);
+    }
 
     return bNumFmtSet;
 }


More information about the Libreoffice-commits mailing list