summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-08-22 13:16:19 +0200
committerEike Rathke <erack@redhat.com>2018-08-22 19:03:27 +0200
commitd0f8daa0980ba8e403b32006831657c5a0a4ea17 (patch)
tree1baf7f73a6fd5d1c7555403b21e223d7736a9b31 /sc
parent50c9ed67d29d6105f3907cb7a2fe3322685af53c (diff)
Resolves: tdf#73063 preserve and roundtrip LCID from/to Excel number formats
Change-Id: I8e3e5ef5873af108596b387e8900d038e3942981 Reviewed-on: https://gerrit.libreoffice.org/59441 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xestyle.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index f0c4b5e83e08..04884494f467 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -44,6 +44,7 @@
#include <editeng/eeitem.hxx>
#include <editeng/escapementitem.hxx>
#include <editeng/justifyitem.hxx>
+#include <editeng/langitem.hxx>
#include <document.hxx>
#include <stlpool.hxx>
#include <stlsheet.hxx>
@@ -2135,10 +2136,21 @@ void XclExpXF::Init( const SfxItemSet& rItemSet, sal_Int16 nScript,
}
// number format
- mnScNumFmt = (nForceScNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND) ?
- rItemSet.Get( ATTR_VALUE_FORMAT ).GetValue() : nForceScNumFmt;
+ if (nForceScNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ mnXclNumFmt = nForceScNumFmt;
+ else
+ {
+ // Built-in formats of dedicated languages may be attributed using the
+ // system language (or even other?) format with a language attribute,
+ // obtain the "real" format key.
+ mnScNumFmt = rItemSet.Get( ATTR_VALUE_FORMAT ).GetValue();
+ LanguageType nLang = rItemSet.Get( ATTR_LANGUAGE_FORMAT).GetLanguage();
+ if (mnScNumFmt >= SV_COUNTRY_LANGUAGE_OFFSET || nLang != LANGUAGE_SYSTEM)
+ mnScNumFmt = GetFormatter().GetFormatForLanguageIfBuiltIn( mnScNumFmt, nLang);
+ }
mnXclNumFmt = GetNumFmtBuffer().Insert( mnScNumFmt );
mbFmtUsed = ScfTools::CheckItem( rItemSet, ATTR_VALUE_FORMAT, IsStyleXF() );
+
// alignment
mbAlignUsed = maAlignment.FillFromItemSet( rItemSet, bForceLineBreak, GetBiff(), IsStyleXF() );