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

Eike Rathke erack at redhat.com
Tue May 27 10:34:19 PDT 2014


 sc/source/core/data/formulacell.cxx |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit f68eed1518fe689fe8a535bebc8d2b6c9f257b9c
Author: Eike Rathke <erack at redhat.com>
Date:   Tue May 27 19:28:36 2014 +0200

    do not replace a General format with a General format
    
    Found when investigating fdo#79228 which was caused by the ScPatternAttr
    change due to the number format being applied.
    
    Change-Id: Ieada557f5e194401a9ce255f26d71d36e0704f35

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index dedba62..afa969d 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1682,10 +1682,21 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
                 nFormatIndex = ScGlobal::GetStandardFormat(*pDocument->GetFormatTable(),
                         nFormatIndex, nFormatType);
 
-            // set number format explicitly
-            pDocument->SetNumberFormat( aPos, nFormatIndex );
+            // Do not replace a General format (which was the reason why
+            // mbNeedsNumberFormat was set) with a General format.
+            // 1. setting a format has quite some overhead in the
+            // ScPatternAttr/ScAttrArray handling, even if identical.
+            // 2. the General formats may be of different locales.
+            // XXX if mbNeedsNumberFormat was set even if the current format
+            // was not General then we'd have to obtain the current format here
+            // and check at least the types.
+            if ((nFormatIndex % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
+            {
+                // set number format explicitly
+                pDocument->SetNumberFormat( aPos, nFormatIndex );
+                bChanged = true;
+            }
 
-            bChanged = true;
             mbNeedsNumberFormat = false;
         }
 


More information about the Libreoffice-commits mailing list