diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-07 09:26:42 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-05-07 12:23:40 +0200 |
commit | ac0112ecefd64094b150390fc36f9f56d19a4d87 (patch) | |
tree | a550a1ef50cd2759f16b6c1bed580f13d55edde9 /unotools/source | |
parent | b46a0a7f9f88a0213b0a5ca2712b6eb93b74d088 (diff) |
tdf#132796: use LO language settings to set default XLS language
This partially reverts fixes for i#63105 and i#71033, i.e. parts of
commits 6ca96e7aee937affef218e0bb892e6904f4ef358 and
35777f0b401ba7bee21a24c32739e86598ba608b.
Instead of using hard-coded Win-1252 for Excel files by default, use
LibreOffice locale language or default document language (as used for
old WMF, DXF and RTF files - see
20f6a6b159c69771dc0e087f63b6c701908e32e2,
1a9a77f84cac68bd5374df3e9ee4df88dc87a0ac, and
f26bbdb386f9e66b1a154d0589b1a446ea2dd8d5).
When a font in XLS specifies ANSI_CHARSET (0), allow using the default
encoding, not the corresponding Win-1252. This mimics Excel behaviour
for such fonts.
Do not use first font's encoding as file default encoding, as Excel
doesn't do that.
Do not consider font-specified encoding in ImportExcel::Rstring to
mimic Excel behaviour for cell number formats (but keep using it in
ImportExcel::ReadLabel for cell content).
Change-Id: I9860013a1244dc12f06f30c81a67909012c04913
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93612
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/misc/defaultencoding.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unotools/source/misc/defaultencoding.cxx b/unotools/source/misc/defaultencoding.cxx index b0e473d099bd..552f3b8c40d7 100644 --- a/unotools/source/misc/defaultencoding.cxx +++ b/unotools/source/misc/defaultencoding.cxx @@ -13,14 +13,20 @@ #include <unotools/defaultencoding.hxx> #include <officecfg/Office/Linguistic.hxx> #include <officecfg/Setup.hxx> +#include <officecfg/System.hxx> OUString utl_getLocaleForGlobalDefaultEncoding() { if (utl::ConfigManager::IsFuzzing()) return "en-US"; + // First try document default language OUString result(officecfg::Office::Linguistic::General::DefaultLocale::get()); + // Fallback to LO locale if (result.isEmpty()) result = officecfg::Setup::L10N::ooSetupSystemLocale::get(); + // Fallback to system locale + if (result.isEmpty()) + result = officecfg::System::L10N::Locale::get(); return result; } |