diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-16 15:46:18 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2013-04-16 15:46:18 +0000 |
commit | 401e8f2db607081e62eaaa1f08a8cd8971a3f637 (patch) | |
tree | 4417318a0df957d58915715b874f922487ee7ff1 /svtools | |
parent | 777eacd9f51f2ed17ece469ad714960ae561489c (diff) |
i122041 Added vaues for defining behaviour of ColorValueSets to SvtAccessibilityOptions
Notes
Notes:
merged as: 85f49fdccddef6b5a5bdc1b95f5b04714179c898
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/accessibilityoptions.hxx | 14 | ||||
-rw-r--r-- | svtools/source/config/accessibilityoptions.cxx | 197 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 21 | ||||
-rw-r--r-- | svtools/source/inc/configitems/accessibilityoptions_const.hxx | 5 |
4 files changed, 235 insertions, 2 deletions
diff --git a/svtools/inc/svtools/accessibilityoptions.hxx b/svtools/inc/svtools/accessibilityoptions.hxx index 23fc46fea460..e66ce253eec6 100644 --- a/svtools/inc/svtools/accessibilityoptions.hxx +++ b/svtools/inc/svtools/accessibilityoptions.hxx @@ -56,6 +56,15 @@ public: sal_Bool IsSelectionInReadonly() const; sal_Bool GetAutoDetectSystemHC() const; + // options for configuring the look and feel for the ColorValueSet (color selector) + sal_Int16 GetColorValueSetMaximumRowCount() const; + sal_Int16 GetColorValueSetEntryEdgeLength() const; + sal_Int16 GetColorValueSetColumnCount() const; + + // option to activate EdgeBlending for previews in the UI (ColorValueSet, ColorDropDown, + // FillStyle/LineStyle previews, etc...). 0 == off, 100% == full paint, in-between == alpha + sal_Int16 GetEdgeBlending() const; + void SetIsForPagePreviews(sal_Bool bSet); void SetIsHelpTipsDisappear(sal_Bool bSet); void SetIsAllowAnimatedGraphics(sal_Bool bSet); @@ -66,6 +75,11 @@ public: void SetSelectionInReadonly(sal_Bool bSet); void SetAutoDetectSystemHC(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; void Commit(); diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index b91b9d498513..8ca72433ef87 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -86,6 +86,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); @@ -96,6 +100,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; }; }; @@ -300,6 +308,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) + { + LogHelper::logIt(ex); + } + + 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) + { + LogHelper::logIt(ex); + } + + 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) + { + LogHelper::logIt(ex); + } + + 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) + { + LogHelper::logIt(ex); + } + + return nRet; +} + void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet) { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); @@ -497,6 +577,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) + { + LogHelper::logIt(ex); + } +} + +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) + { + LogHelper::logIt(ex); + } +} + +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) + { + LogHelper::logIt(ex); + } +} + +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) + { + LogHelper::logIt(ex); + } +} + // ----------------------------------------------------------------------- // class SvtAccessibilityOptions -------------------------------------------------- @@ -600,6 +760,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) { @@ -637,9 +817,24 @@ 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); +} // ----------------------------------------------------------------------- diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 6767cf2aeb53..85f5ee93ee9e 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -38,7 +38,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" #define _SV_VALUESET_CXX @@ -284,6 +284,25 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem ) { 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 { diff --git a/svtools/source/inc/configitems/accessibilityoptions_const.hxx b/svtools/source/inc/configitems/accessibilityoptions_const.hxx index fbc2dc3b01af..82818bec297c 100644 --- a/svtools/source/inc/configitems/accessibilityoptions_const.hxx +++ b/svtools/source/inc/configitems/accessibilityoptions_const.hxx @@ -41,6 +41,11 @@ namespace static const ::rtl::OUString s_sIsAutomaticFontColor = ::rtl::OUString::createFromAscii("IsAutomaticFontColor"); static const ::rtl::OUString s_sIsSystemFont = ::rtl::OUString::createFromAscii("IsSystemFont"); static const ::rtl::OUString s_sIsSelectionInReadonly = ::rtl::OUString::createFromAscii("IsSelectionInReadonly"); + + static const ::rtl::OUString s_sColorValueSetMaximumRowCount = ::rtl::OUString::createFromAscii("ColorValueSetMaximumRowCount"); + static const ::rtl::OUString s_sColorValueSetEntryEdgeLength = ::rtl::OUString::createFromAscii("ColorValueSetEntryEdgeLength"); + static const ::rtl::OUString s_sColorValueSetColumnCount = ::rtl::OUString::createFromAscii("ColorValueSetColumnCount"); + static const ::rtl::OUString s_sEdgeBlending = ::rtl::OUString::createFromAscii("EdgeBlending"); } #endif // INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX |