diff options
author | Martin Hosken <martin_hosken@sil.org> | 2016-11-16 00:53:59 +0000 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-11-17 17:16:52 +0000 |
commit | 6b35e804198ac45386805e80a3d413ed3405c3b4 (patch) | |
tree | 1132517e5e139e6387016e04d20a5660e8c39064 /svtools | |
parent | 3b94229fb74dfe43e2b7349d6f580dc375f28814 (diff) |
Fix tdf#103855 add language codes and names to language lists from extensions
Rationale for changes to languagetag.hxx can be found in the bug
tdf#103855.
Change-Id: I7fa7c8a3f7b219ce08df69a3965f544ae156beab
Reviewed-on: https://gerrit.libreoffice.org/30882
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/misc/langtab.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 3540c316e472..272f8edf3fc6 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -17,7 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/i18n/DirectionProperty.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Any.h> #include <i18nlangtag/lang.h> #include <i18nlangtag/mslangid.hxx> @@ -28,6 +31,7 @@ #include <svtools/langtab.hxx> #include <unotools/syslocale.hxx> #include <tools/resary.hxx> +#include <officecfg/VCL.hxx> using namespace ::com::sun::star; @@ -129,6 +133,28 @@ const OUString ApplyLreOrRleEmbedding( const OUString &rText ) SvtLanguageTableImpl::SvtLanguageTableImpl() : ResStringArray( SvtResId( STR_ARR_SVT_LANGUAGE_TABLE ) ) { + auto xNA = officecfg::VCL::ExtraLanguages::get(); + uno::Sequence <OUString> rElementNames = xNA->getElementNames(); + sal_Int32 nLen = rElementNames.getLength(); + for (sal_Int32 i = 0; i < nLen; ++i) + { + OUString aName; + sal_Int32 nType = 0; + uno::Reference <container::XNameAccess> xNB; + xNA->getByName(rElementNames[i]) >>= xNB; + bool bSuccess = (xNB->getByName("Name") >>= aName) && + (xNB->getByName("ScriptType") >>= nType); + if (bSuccess) + { + LanguageTag aLang(rElementNames[i]); + LanguageType nLangType = aLang.getLanguageType(); + if (nType <= LanguageTag::ScriptType::RTL && nType > LanguageTag::ScriptType::UNKNOWN) + aLang.setScriptType(LanguageTag::ScriptType(nType)); + sal_uInt32 nPos = FindIndex(nLangType); + if (nPos == RESARRAY_INDEX_NOTFOUND) + AddItem((aName.isEmpty() ? rElementNames[i] : aName), nLangType); + } + } } SvtLanguageTableImpl::~SvtLanguageTableImpl() |