summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorJeremy Brown <jeremy.r.brown@gmail.com>2012-11-11 08:06:46 +0100
committerTor Lillqvist <tml@iki.fi>2012-11-12 10:23:58 +0000
commitb4d1aaa074e2be9fd778134c40f99d2ab8a01e93 (patch)
treee98461df70117ee86bea8103722d9d97d85dbbf0 /unotools
parentfa637c4dff0a59922a726ff42fdf1f5f0354d2d6 (diff)
fdo#36324 fdo#42929 - option to ingore system input language changes
Created a new checkbox on the Langauges options page: [] Ignore system input language This is unchecked by default so that the current behavior remains the default, i.e. newly entered text will be flagged as whatever the current system input language is. When checked however, this instructs LibreOffice to ignore the system language (on Windows for example, the language from the Language Bar) when determining the language for newly entered text. This is handled in the lcl_isNonDefaultLanguage method of sw/source/ui/docvw/edtwin.cxx. The option is also saved in registrymodifications.xcu There are two main use cases: 1. This allows someone to use a single "international" keyboard on Windows to type in multiple languages, (e.g. English, French, Spanish) without changing the system keyboard. The person is then responsible for setting the language for each word or run of text themselves in LibreOffice. This seems to be the preferred workflow for some translators and some educators developing language materials. 2. This allows someone writing in a minority language that is not represented in one of Windows' locale options to still be able to type in LibreOffice in their language using a keyboard tagged for another language. Once they set the language in LibreOffice (e.g. to Teke-Eboo [ebo_CG]), they can type with a keyboard as being for "Swahili" but still succeed in entering new text in their language. This allows spell-checking to work properly without them having to select each new word they enter and reset the language of that word to Teke-Eboo (as is currently the case). Change-Id: I86248f5865b69048eb1f3e427a8c03b093138796 Reviewed-on: https://gerrit.libreoffice.org/1029 Reviewed-by: Tor Lillqvist <tml@iki.fi> Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/inc/unotools/syslocaleoptions.hxx6
-rw-r--r--unotools/source/config/syslocaleoptions.cxx62
2 files changed, 65 insertions, 3 deletions
diff --git a/unotools/inc/unotools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx
index 1c62ad809492..a7d1f84bbe9a 100644
--- a/unotools/inc/unotools/syslocaleoptions.hxx
+++ b/unotools/inc/unotools/syslocaleoptions.hxx
@@ -36,6 +36,7 @@ const sal_uLong SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002;
const sal_uLong SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004;
const sal_uLong SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008;
const sal_uLong SYSLOCALEOPTIONS_HINT_DATEPATTERNS = 0x00000010;
+const sal_uLong SYSLOCALEOPTIONS_HINT_IGNORELANG = 0x00000020;
class SvtSysLocaleOptions_Impl;
class SvtListener;
@@ -121,6 +122,11 @@ public:
sal_Bool IsDecimalSeparatorAsLocale() const;
void SetDecimalSeparatorAsLocale( sal_Bool bSet);
+ // determine whether to ignore changes to the system keyboard/locale/language when
+ // determining the language for newly entered text
+ sal_Bool IsIgnoreLanguageChange() const;
+ void SetIgnoreLanguageChange( sal_Bool bSet);
+
// convenience methods
/// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 961ac7544c17..4f0f964034cb 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -79,12 +79,14 @@ class SvtSysLocaleOptions_Impl : public utl::ConfigItem
OUString m_aCurrencyString; // USD-en-US or EUR-de-DE
OUString m_aDatePatternsString; // "Y-M-D;M-D"
sal_Bool m_bDecimalSeparator; //use decimal separator same as locale
+ sal_Bool m_bIgnoreLanguageChange; //OS language change doesn't affect LO document language
sal_Bool m_bROLocale;
sal_Bool m_bROUILocale;
sal_Bool m_bROCurrency;
sal_Bool m_bRODatePatterns;
sal_Bool m_bRODecimalSeparator;
+ sal_Bool m_bROIgnoreLanguageChange;
static const Sequence< /* const */ OUString > GetPropertyNames();
void MakeRealLocale();
@@ -115,6 +117,9 @@ public:
sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;}
void SetDecimalSeparatorAsLocale( sal_Bool bSet);
+
+ sal_Bool IsIgnoreLanguageChange() const { return m_bIgnoreLanguageChange;}
+ void SetIgnoreLanguageChange( sal_Bool bSet);
sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
const Locale& GetRealLocale() { return m_aRealLocale; }
@@ -131,14 +136,17 @@ public:
#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency"))
#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale"))
#define PROPERTYNAME_DATEPATTERNS OUString(RTL_CONSTASCII_USTRINGPARAM("DateAcceptancePatterns"))
+#define PROPERTYNAME_IGNORELANGCHANGE OUString(RTL_CONSTASCII_USTRINGPARAM("IgnoreLanguageChange"))
#define PROPERTYHANDLE_LOCALE 0
#define PROPERTYHANDLE_UILOCALE 1
#define PROPERTYHANDLE_CURRENCY 2
#define PROPERTYHANDLE_DECIMALSEPARATOR 3
#define PROPERTYHANDLE_DATEPATTERNS 4
+#define PROPERTYHANDLE_IGNORELANGCHANGE 5
-#define PROPERTYCOUNT 5
+//#define PROPERTYCOUNT 5
+#define PROPERTYCOUNT 6
const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
{
@@ -148,7 +156,8 @@ const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
PROPERTYNAME_UILOCALE,
PROPERTYNAME_CURRENCY,
PROPERTYNAME_DECIMALSEPARATOR,
- PROPERTYNAME_DATEPATTERNS
+ PROPERTYNAME_DATEPATTERNS,
+ PROPERTYNAME_IGNORELANGCHANGE
};
const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
return seqPropertyNames;
@@ -164,6 +173,7 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
, m_bROCurrency(CFG_READONLY_DEFAULT)
, m_bRODatePatterns(CFG_READONLY_DEFAULT)
, m_bRODecimalSeparator(sal_False)
+ , m_bROIgnoreLanguageChange(sal_False)
{
if ( IsValidConfigMgr() )
@@ -243,6 +253,18 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
m_bRODatePatterns = pROStates[nProp];
}
break;
+ case PROPERTYHANDLE_IGNORELANGCHANGE :
+ {
+ sal_Bool bValue = sal_Bool();
+ if ( pValues[nProp] >>= bValue )
+ m_bIgnoreLanguageChange = bValue;
+ else
+ {
+ SAL_WARN( "unotools.config", "Wrong property type!" );
+ }
+ m_bROIgnoreLanguageChange = pROStates[nProp];
+ }
+ break;
default:
SAL_WARN( "unotools.config", "Wrong property type!" );
}
@@ -368,7 +390,7 @@ void SvtSysLocaleOptions_Impl::Commit()
}
}
break;
- case PROPERTYHANDLE_DECIMALSEPARATOR:
+ case PROPERTYHANDLE_DECIMALSEPARATOR:
if( !m_bRODecimalSeparator )
{
pNames[nRealCount] = aOrgNames[nProp];
@@ -384,6 +406,14 @@ void SvtSysLocaleOptions_Impl::Commit()
++nRealCount;
}
break;
+ case PROPERTYHANDLE_IGNORELANGCHANGE :
+ if (!m_bROIgnoreLanguageChange)
+ {
+ pNames[nRealCount] = aOrgNames[nProp];
+ pValues[nRealCount] <<= m_bIgnoreLanguageChange;
+ ++nRealCount;
+ }
+ break;
default:
SAL_WARN( "unotools.config", "invalid index to save a path" );
}
@@ -454,6 +484,16 @@ void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet)
}
}
+void SvtSysLocaleOptions_Impl::SetIgnoreLanguageChange( sal_Bool bSet)
+{
+ if(bSet != m_bIgnoreLanguageChange)
+ {
+ m_bIgnoreLanguageChange = bSet;
+ SetModified();
+ NotifyListeners( SYSLOCALEOPTIONS_HINT_IGNORELANG );
+ }
+}
+
void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames )
{
sal_uLong nHint = 0;
@@ -492,6 +532,11 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope
seqValues[nProp] >>= m_bDecimalSeparator;
m_bRODecimalSeparator = seqROStates[nProp];
}
+ else if( seqPropertyNames[nProp] == PROPERTYNAME_IGNORELANGCHANGE )
+ {
+ seqValues[nProp] >>= m_bIgnoreLanguageChange;
+ m_bROIgnoreLanguageChange = seqROStates[nProp];
+ }
else if( seqPropertyNames[nProp] == PROPERTYNAME_DATEPATTERNS )
{
DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "DatePatterns property type" );
@@ -628,6 +673,17 @@ void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet)
pOptions->SetDecimalSeparatorAsLocale(bSet);
}
+sal_Bool SvtSysLocaleOptions::IsIgnoreLanguageChange() const
+{
+ MutexGuard aGuard( GetMutex() );
+ return pOptions->IsIgnoreLanguageChange();
+}
+
+void SvtSysLocaleOptions::SetIgnoreLanguageChange( sal_Bool bSet)
+{
+ MutexGuard aGuard( GetMutex() );
+ pOptions->SetIgnoreLanguageChange(bSet);
+}
sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const
{