tdf#168540 Restore automatically enabling RTL/CTL based on locale
This change makes LibreOffice automatically enable RTL/CTL features
based on locale. On Windows, in addition to locale, RTL/CTL features are
enabled if RTL/CTL is installed as an input language.
The code to do this was originally deleted roughly a decade ago, as part
of an effort to make RTL/CTL support enabled by default. That default
doesn't seem to be effective anymore, and without the removed code, this
left LO in a state where all RTL/CTL users had to manually enable
RTL/CTL support in order to see the features they expect.
This reverts commit 23b92427e3.
Change-Id: I15a9bf9ebdb759b49743d464a2ce6f9305e4c8d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191835
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
This commit is contained in:
@@ -77,8 +77,9 @@ namespace SvtLanguageOptions
|
||||
*/
|
||||
namespace SvtSystemLanguageOptions
|
||||
{
|
||||
bool isCJKKeyboardLayoutInstalled();
|
||||
};
|
||||
bool isCJKKeyboardLayoutInstalled();
|
||||
bool isCTLKeyboardLayoutInstalled();
|
||||
}
|
||||
|
||||
#endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
|
||||
|
||||
|
||||
@@ -20,12 +20,18 @@
|
||||
|
||||
#include <svl/ctloptions.hxx>
|
||||
|
||||
#include <svl/languageoptions.hxx>
|
||||
#include <unotools/configitem.hxx>
|
||||
#include <unotools/configmgr.hxx>
|
||||
#include <unotools/syslocale.hxx>
|
||||
#include <com/sun/star/uno/Any.h>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <i18nlangtag/lang.h>
|
||||
#include <i18nlangtag/languagetag.hxx>
|
||||
#include <i18nlangtag/mslangid.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
#include "itemholder2.hxx"
|
||||
#include <officecfg/System.hxx>
|
||||
#include <officecfg/Office/Common.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
@@ -289,6 +295,49 @@ void SvtCTLOptions_Impl::Load()
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_bCTLFontEnabled)
|
||||
{
|
||||
SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
|
||||
//system locale is CTL
|
||||
bool bAutoEnableCTL = bool(nScriptType & SvtScriptType::COMPLEX);
|
||||
|
||||
if (!bAutoEnableCTL)
|
||||
{
|
||||
//windows secondary system locale is CTL
|
||||
OUString sWin16SystemLocale = officecfg::System::L10N::SystemLocale::get();
|
||||
LanguageType eSystemLanguage = LANGUAGE_NONE;
|
||||
if (!sWin16SystemLocale.isEmpty())
|
||||
{
|
||||
eSystemLanguage
|
||||
= LanguageTag::convertToLanguageTypeWithFallback(sWin16SystemLocale);
|
||||
}
|
||||
|
||||
if (eSystemLanguage != LANGUAGE_SYSTEM)
|
||||
{
|
||||
SvtScriptType nWinScript
|
||||
= SvtLanguageOptions::GetScriptTypeOfLanguage(eSystemLanguage);
|
||||
bAutoEnableCTL = bool(nWinScript & SvtScriptType::COMPLEX);
|
||||
}
|
||||
|
||||
//CTL keyboard is installed
|
||||
if (!bAutoEnableCTL)
|
||||
{
|
||||
bAutoEnableCTL = SvtSystemLanguageOptions::isCTLKeyboardLayoutInstalled();
|
||||
}
|
||||
}
|
||||
|
||||
if (bAutoEnableCTL)
|
||||
{
|
||||
m_bCTLFontEnabled = true;
|
||||
LanguageType nLanguage = SvtSysLocale().GetLanguageTag().getLanguageType();
|
||||
//enable sequence checking for the appropriate languages
|
||||
m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace
|
||||
= (MsLangId::needsSequenceChecking(nLanguage)
|
||||
|| MsLangId::needsSequenceChecking(LANGUAGE_SYSTEM));
|
||||
Commit();
|
||||
}
|
||||
}
|
||||
|
||||
m_bIsLoaded = true;
|
||||
}
|
||||
void SvtCTLOptions_Impl::SetCTLFontEnabled( bool _bEnabled )
|
||||
|
||||
@@ -132,6 +132,11 @@ namespace SvtSystemLanguageOptions
|
||||
{
|
||||
return isKeyboardLayoutTypeInstalled(css::i18n::ScriptType::ASIAN);
|
||||
}
|
||||
|
||||
bool isCTLKeyboardLayoutInstalled()
|
||||
{
|
||||
return isKeyboardLayoutTypeInstalled(css::i18n::ScriptType::COMPLEX);
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user