summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-05-27 19:28:36 +0200
committerAndras Timar <andras.timar@collabora.com>2014-06-02 19:01:57 +0200
commit46890f289592257673ba38b95cbd3759f09d04d7 (patch)
treea1353afa7687013e338f3633b0a0d5f2d29c3817 /sc
parent35fe58f8dee2ed15cfa3e37a9a83fbc548813ca0 (diff)
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 (cherry picked from commit f68eed1518fe689fe8a535bebc8d2b6c9f257b9c) Reviewed-on: https://gerrit.libreoffice.org/9511 Tested-by: Kohei Yoshida <libreoffice@kohei.us> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/formulacell.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 3f3b18b9bc8c..d4324a39f2c5 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1672,10 +1672,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;
}