summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-01-16 21:42:47 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-01-16 21:45:17 +0100
commit7b0e8b9c8541250be65ce228b67ff5adb105b732 (patch)
tree8279d0e0278803a9e216f7b816a7663f9e49427d
parent43bfe1ecb8fe8fb3ed37d2b0d6ab2246e5ab55ba (diff)
fdo#71511: in autodetected a11y HC mode, pull background color from theme
- 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 background by default, otherwise use a white default Change-Id: Id8ad1eb3d57b3708ac5a241092208e3a8d98ade0
-rw-r--r--svtools/source/config/colorcfg.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index 850bd93868a4..81a1b20440d5 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;
}