summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-04-16 08:41:07 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-05-20 11:33:13 +0100
commit35aa48d80b4b800d408d26bd72fbdfd711abbb6f (patch)
tree2756d4aa78cd67be7d1597b4222f0da0657c770d /svtools
parent05038d1bd0a7bc9ecb6676ba1309576ac74f849f (diff)
Resolves: #i122041# Unified and centralized control for Color ValueSets
(cherry picked from commit 68e707bbc6fe23881b822e6efab8a2933343dc1a) Conflicts: cui/source/inc/backgrnd.hxx cui/source/inc/cuitabarea.hxx cui/source/tabpages/backgrnd.cxx cui/source/tabpages/tpcolor.cxx sd/source/ui/view/drviews6.cxx svx/Package_inc.mk svx/inc/svx/colrctrl.hxx svx/source/sidebar/tools/ColorControl.cxx svx/source/tbxctrls/colorwindow.hxx svx/source/tbxctrls/colrctrl.cxx svx/source/tbxctrls/tbcontrl.cxx Change-Id: Ie06fe355846b737ec8aae9aade4d408232c83193 Related: #i122041# Add a11y values for defining behaviour of ColorValueSets (cherry picked from commit 401e8f2db607081e62eaaa1f08a8cd8971a3f637) Conflicts: cui/source/tabpages/backgrnd.cxx officecfg/registry/schema/org/openoffice/Office/Common.xcs sc/source/ui/miscdlgs/tabbgcolordlg.cxx svtools/inc/svtools/accessibilityoptions.hxx svtools/source/inc/configitems/accessibilityoptions_const.hxx vcl/inc/vcl/bitmap.hxx vcl/source/gdi/bitmap4.cxx Change-Id: If9d0db5f22974cad1ac886eca3719ca92ca7f240
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/config/accessibilityoptions.cxx201
-rw-r--r--svtools/source/control/valueset.cxx21
2 files changed, 220 insertions, 2 deletions
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx
index 4bc165317aaf..a830a9998c82 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -54,6 +54,10 @@ namespace
const char s_sIsAutomaticFontColor[] = "IsAutomaticFontColor";
const char s_sIsSystemFont[] = "IsSystemFont";
const char s_sIsSelectionInReadonly[] = "IsSelectionInReadonly";
+ const char s_sColorValueSetMaximumRowCount[] = "ColorValueSetMaximumRowCount";
+ const char s_sColorValueSetEntryEdgeLength[] = "ColorValueSetEntryEdgeLength";
+ const char s_sColorValueSetColumnCount[] = "ColorValueSetColumnCount";
+ const char s_sEdgeBlending[] = "EdgeBlending";
}
// class SvtAccessibilityOptions_Impl ---------------------------------------------
@@ -78,6 +82,10 @@ public:
sal_Bool GetIsSystemFont() const;
sal_Int16 GetHelpTipSeconds() const;
sal_Bool IsSelectionInReadonly() const;
+ sal_Int16 GetColorValueSetMaximumRowCount() const;
+ sal_Int16 GetColorValueSetEntryEdgeLength() const;
+ sal_Int16 GetColorValueSetColumnCount() const;
+ sal_Int16 GetEdgeBlending() const;
void SetAutoDetectSystemHC(sal_Bool bSet);
void SetIsForPagePreviews(sal_Bool bSet);
@@ -88,6 +96,10 @@ public:
void SetIsSystemFont(sal_Bool bSet);
void SetHelpTipSeconds(sal_Int16 nSet);
void SetSelectionInReadonly(sal_Bool bSet);
+ void SetColorValueSetMaximumRowCount(sal_Int16 nSet);
+ void SetColorValueSetEntryEdgeLength(sal_Int16 nSet);
+ void SetColorValueSetColumnCount(sal_Int16 nSet);
+ void SetEdgeBlending(sal_Int16 nSet);
sal_Bool IsModified() const { return bIsModified; };
};
@@ -292,6 +304,78 @@ sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const
return bRet;
}
+sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetMaximumRowCount() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nRet = 40;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sColorValueSetMaximumRowCount) >>= nRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+
+ return nRet;
+}
+
+sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetEntryEdgeLength() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nRet = 14;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength) >>= nRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+
+ return nRet;
+}
+
+sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nRet = 12;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+
+ return nRet;
+}
+
+sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nRet = 35;
+
+ try
+ {
+ if(xNode.is())
+ xNode->getPropertyValue(s_sEdgeBlending) >>= nRet;
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+
+ return nRet;
+}
+
void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet)
{
css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
@@ -489,6 +573,86 @@ void SvtAccessibilityOptions_Impl::SetVCLSettings()
Application::SetSettings(aAllSettings);
}
+void SvtAccessibilityOptions_Impl::SetColorValueSetMaximumRowCount(sal_Int16 nSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetMaximumRowCount)!=nSet)
+ {
+ xNode->setPropertyValue(s_sColorValueSetMaximumRowCount, css::uno::makeAny(nSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+}
+
+void SvtAccessibilityOptions_Impl::SetColorValueSetEntryEdgeLength(sal_Int16 nSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength)!=nSet)
+ {
+ xNode->setPropertyValue(s_sColorValueSetEntryEdgeLength, css::uno::makeAny(nSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+}
+
+void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetColumnCount)!=nSet)
+ {
+ xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+}
+
+void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet)
+{
+ css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
+
+ try
+ {
+ if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet)
+ {
+ xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+
+ bIsModified = sal_True;
+ }
+ }
+ catch(const css::uno::Exception& ex)
+ {
+ SAL_WARN("svtools", "Caught unexpected: " << ex.Message);
+ }
+}
+
// -----------------------------------------------------------------------
// class SvtAccessibilityOptions --------------------------------------------------
@@ -582,6 +746,26 @@ sal_Bool SvtAccessibilityOptions::IsSelectionInReadonly() const
return sm_pSingleImplConfig->IsSelectionInReadonly();
}
+sal_Int16 SvtAccessibilityOptions::GetColorValueSetMaximumRowCount() const
+{
+ return sm_pSingleImplConfig->GetColorValueSetMaximumRowCount();
+}
+
+sal_Int16 SvtAccessibilityOptions::GetColorValueSetEntryEdgeLength() const
+{
+ return sm_pSingleImplConfig->GetColorValueSetEntryEdgeLength();
+}
+
+sal_Int16 SvtAccessibilityOptions::GetColorValueSetColumnCount() const
+{
+ return sm_pSingleImplConfig->GetColorValueSetColumnCount();
+}
+
+sal_Int16 SvtAccessibilityOptions::GetEdgeBlending() const
+{
+ return sm_pSingleImplConfig->GetEdgeBlending();
+}
+
// -----------------------------------------------------------------------
void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet)
{
@@ -619,11 +803,26 @@ void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet)
{
sm_pSingleImplConfig->SetSelectionInReadonly(bSet);
}
-
void SvtAccessibilityOptions::SetVCLSettings()
{
sm_pSingleImplConfig->SetVCLSettings();
}
+void SvtAccessibilityOptions::SetColorValueSetMaximumRowCount(sal_Int16 nSet)
+{
+ sm_pSingleImplConfig->SetColorValueSetMaximumRowCount(nSet);
+}
+void SvtAccessibilityOptions::SetColorValueSetEntryEdgeLength(sal_Int16 nSet)
+{
+ sm_pSingleImplConfig->SetColorValueSetEntryEdgeLength(nSet);
+}
+void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet)
+{
+ sm_pSingleImplConfig->SetColorValueSetColumnCount(nSet);
+}
+void SvtAccessibilityOptions::SetEdgeBlending(sal_Int16 nSet)
+{
+ sm_pSingleImplConfig->SetEdgeBlending(nSet);
+}
// -----------------------------------------------------------------------
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 9eb212488195..1006bf0d6800 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -28,7 +28,7 @@
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <rtl/ustring.hxx>
-
+#include <svtools/accessibilityoptions.hxx>
#include "valueimp.hxx"
#include <svtools/valueset.hxx>
@@ -294,6 +294,25 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect )
{
maVirDev.SetFillColor( pItem->maColor );
maVirDev.DrawRect( aRect );
+
+ const SvtAccessibilityOptions aOptions;
+ const sal_Int16 nEdgeBlendingPercent(aOptions.GetEdgeBlending());
+ static bool bTest(false);
+
+ if(nEdgeBlendingPercent && bTest)
+ {
+ Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize()));
+
+ if(!aBitmap.IsEmpty())
+ {
+ const Color aTopLeft(COL_WHITE);
+ const Color aBottomRight(COL_BLACK);
+ const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
+
+ aBitmap.DrawBlendFrame(nAlpha, aTopLeft, aBottomRight);
+ maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap);
+ }
+ }
}
else
{