diff options
author | Eike Rathke <erack@redhat.com> | 2020-09-28 21:02:23 +0200 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@collabora.com> | 2020-10-18 22:36:40 +0200 |
commit | af75098d524311416a5f7caf6ae76055cc689ad1 (patch) | |
tree | 43b7e44dcea355b2237895ba0af4a9c14a059e22 /formula | |
parent | eda0fa64b5de798e6fd73a4bc598b86fb4bd1fb1 (diff) |
Resolves: tdf#137091 Use CharClass matching the formula language
This is a combination of 3 commits.
Resolves: tdf#137091 Use CharClass matching the formula language
... not the current locale. Specifically important for
uppercase/lowercase conversions that may yield different results
for example in Turkish i with/without dot.
I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103588
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 3c6177be2705303044e3de262689d593f3d0f282)
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Current sytem locale's CharClass for user defined names, tdf#137091 follow-up
I5f025a12ca183acb3f80d2a7527677aceb9ffbd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103593
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit d41c45a522c5e973d7043d36bc6c82e77735ab9b)
Determine CharClass difference once, tdf#137091 follow-up
As a side note:
Clang plugin simplifybool for
!(rLT1.getLanguage() == "en" && rLT2.getLanguage() == "en")
told "error: logical negation of logical op containing negation, can be simplified"
which is nonsense (the message stayed the same while the checks evolved).
It actually complained about !(a==b && c==d) to be rewritten as
(a!=b || c!=d) whether that makes sense or not.. it may save one
boolean operation, yes, but..
Ib478d46d7ff926c1c9f65fec059c7a3f31fa7ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103601
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 1acf517906b7cdc4931dd26319d467dff53ae7d2)
Conflicts:
sc/source/core/tool/compiler.cxx
Change-Id: I2aa57cdcf530d7a0697c4ffbd5dccb86bb526d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103598
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104486
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'formula')
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 16e58f9c8e71..5de0b8d76491 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -31,6 +31,9 @@ #include <svl/zforlist.hxx> #include <unotools/resmgr.hxx> #include <unotools/charclass.hxx> +#include <vcl/svapp.hxx> +#include <vcl/settings.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp> #include <com/sun/star/sheet/FormulaMapGroup.hpp> #include <com/sun/star/sheet/FormulaMapGroupSpecialOffset.hpp> @@ -143,6 +146,14 @@ void lclPushOpCodeMapEntries( ::std::vector< sheet::FormulaOpCodeMapEntry >& rVe lclPushOpCodeMapEntry( rVec, pTable, *pnOpCodes ); } +CharClass* createCharClassIfNonEnglishUI() +{ + const LanguageTag& rLanguageTag( Application::GetSettings().GetUILanguageTag()); + if (rLanguageTag.getLanguage() == "en") + return nullptr; + return new CharClass( ::comphelper::getProcessComponentContext(), rLanguageTag); +} + class OpCodeList { public: @@ -166,8 +177,8 @@ OpCodeList::OpCodeList(bool bLocalized, const std::pair<const char*, int>* pSymb , mpSymbols(pSymbols) , mbLocalized(bLocalized) { - SvtSysLocale aSysLocale; - const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : aSysLocale.GetCharClassPtr()); + std::unique_ptr<CharClass> xCharClass( xMap->isEnglish() ? nullptr : createCharClassIfNonEnglishUI()); + const CharClass* pCharClass = xCharClass.get(); if (meSepType == FormulaCompiler::SeparatorType::RESOURCE_BASE) { for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i) @@ -813,8 +824,8 @@ FormulaCompiler::OpCodeMapPtr FormulaCompiler::CreateOpCodeMap( NonConstOpCodeMapPtr xMap( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1, false, FormulaGrammar::mergeToGrammar( FormulaGrammar::setEnglishBit( FormulaGrammar::GRAM_EXTERNAL, bEnglish), FormulaGrammar::CONV_UNSPECIFIED))); - SvtSysLocale aSysLocale; - const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : aSysLocale.GetCharClassPtr()); + std::unique_ptr<CharClass> xCharClass( xMap->isEnglish() ? nullptr : createCharClassIfNonEnglishUI()); + const CharClass* pCharClass = xCharClass.get(); for (auto const& rMapEntry : rMapping) { OpCode eOp = OpCode(rMapEntry.Token.OpCode); |