diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-01-16 21:42:47 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-01-21 11:53:05 +0000 |
commit | 23221e48495262d0384c9169a0d8a01db8a5dab5 (patch) | |
tree | 6c83a23b079150e5df1f741df9b2150d5cdd9eb4 | |
parent | b038679c550d2a0178c1beca368a86598dd0c80b (diff) |
fdo#71511: in autodetected a11y HC mode, pull background color from theme
- ... and reload ColorConfig after tweaking relevant a11y settings
- dark theme default to high contrast
- as per fdo#35365, having a dark document background is inconvenient
for non-a11y endusers
- a11y standard require the (rather ugly) background for a11y
- thus, when "automatically detect high contract mode of operating
system"
in Tools->Options->a11y is enabled, use the dark document
backgroundby default, otherwise use a white default
note that the autodetect HC option is somewhat broken anyway:
it resets the icon theme hard, so there are not simple roundtrips
enableing/disabling it for that, but those havent been there before
either.
(includes: Ia35a41717224dfb7437054bb885c61d7e0b189d7)
Change-Id: Id8ad1eb3d57b3708ac5a241092208e3a8d98ade0
Reviewed-on: https://gerrit.libreoffice.org/7484
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | include/svtools/colorcfg.hxx | 1 | ||||
-rw-r--r-- | svtools/source/config/accessibilityoptions.cxx | 4 | ||||
-rw-r--r-- | svtools/source/config/colorcfg.cxx | 36 |
3 files changed, 39 insertions, 2 deletions
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx index 2872f4c03977..ddc84850bf71 100644 --- a/include/svtools/colorcfg.hxx +++ b/include/svtools/colorcfg.hxx @@ -105,6 +105,7 @@ public: // instead of the automatic color ColorConfigValue GetColorValue(ColorConfigEntry eEntry, sal_Bool bSmart = sal_True)const; static Color GetDefaultColor(ColorConfigEntry eEntry); + void Reload(); }; class SVT_DLLPUBLIC EditableColorConfig diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 4294e7cc091a..84f0e1c30b7e 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -31,6 +31,8 @@ #include <svl/smplhint.hxx> +#include <svtools/colorcfg.hxx> + #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <rtl/instance.hxx> @@ -386,7 +388,7 @@ void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet) { xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet)); ::comphelper::ConfigurationHelper::flush(m_xCfg); - + svtools::ColorConfig().Reload(); bIsModified = sal_True; } } diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 850bd93868a4..a8e5ba89929a 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -23,7 +23,9 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> #include <unotools/configitem.hxx> +#include <unotools/confignode.hxx> #include <unotools/configpaths.hxx> #include <com/sun/star/uno/Sequence.h> #include <svl/poolitem.hxx> @@ -64,6 +66,7 @@ class ColorConfig_Impl : public utl::ConfigItem sal_Bool m_bEditMode; OUString m_sIsVisible; OUString m_sLoadedScheme; + bool m_bAutoDetectSystemHC; uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme); public: @@ -91,6 +94,7 @@ public: void SetModified(){ConfigItem::SetModified();} void ClearModified(){ConfigItem::ClearModified();} void SettingsChanged(); + bool GetAutoDetectSystemHC() {return m_bAutoDetectSystemHC;} // #100822# DECL_LINK( DataChangedEventListener, VclWindowEvent* ); @@ -183,7 +187,8 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const OUString& rSch ColorConfig_Impl::ColorConfig_Impl(sal_Bool bEditMode) : ConfigItem("Office.UI/ColorScheme"), m_bEditMode(bEditMode), - m_sIsVisible("/IsVisible") + m_sIsVisible("/IsVisible"), + m_bAutoDetectSystemHC(true) { if(!m_bEditMode) { @@ -237,6 +242,15 @@ void ColorConfig_Impl::Load(const OUString& rScheme) if(pColorNames[nIndex].match(m_sIsVisible, pColorNames[nIndex].getLength() - m_sIsVisible.getLength())) m_aConfigValues[i / 2].bIsVisible = Any2Bool(pColors[nIndex++]); } + // fdo#71511: check if we are running in a11y autodetect + { + utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(comphelper::getProcessComponentContext(),OUString("org.openoffice.Office.Common/Accessibility") ); + if(aNode.isValid()) + { + uno::Any aValue = aNode.getNodeValue(OUString("AutoDetectSystemHC")); + aValue >>= m_bAutoDetectSystemHC; + } + } } void ColorConfig_Impl::Notify( const uno::Sequence<OUString>& ) @@ -466,6 +480,21 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) default: aRet = aAutoColors[eEntry]; } + // fdo#71511: if in autodetected a11y HC mode, do pull background color from theme + if(m_pImpl && m_pImpl->GetAutoDetectSystemHC()) + { + switch(eEntry) + { + case DOCCOLOR : + aRet = Application::GetSettings().GetStyleSettings().GetWindowColor(); + break; + case FONTCOLOR : + aRet = Application::GetSettings().GetStyleSettings().GetWindowTextColor(); + break; + default: + break; + } + } return aRet; } @@ -481,6 +510,11 @@ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, sal_Bool bS return aRet; } +void ColorConfig::Reload() +{ + m_pImpl->Load(OUString()); +} + EditableColorConfig::EditableColorConfig() : m_pImpl(new ColorConfig_Impl), m_bModified(sal_False) |