diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-22 15:38:05 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:18 +0100 |
commit | 60285fdc868635f99644ef1d8a195a2be87074c7 (patch) | |
tree | dbd69b9d424b527357c2ba33c2256e99edca3d91 /svtools | |
parent | 3af7ae5ef74756b33d35a67b7a6cee44acf79737 (diff) |
Related: #i122041# More unifications for FillStyles
better defaults and better preview visualizations
(cherry picked from commit 35c9acfc98fc98399005815e0464b1944f327d4e)
Conflicts:
officecfg/registry/schema/org/openoffice/Office/Common.xcs
svtools/inc/svtools/accessibilityoptions.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/config/accessibilityoptions.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/valueset.cxx
svtools/source/inc/configitems/accessibilityoptions_const.hxx
svx/inc/svx/dlgctrl.hxx
svx/inc/svx/xtable.hxx
svx/source/dialog/dlgctrl.cxx
svx/source/tbxctrls/SvxColorValueSet.cxx
svx/source/xoutdev/xtabdash.cxx
svx/source/xoutdev/xtable.cxx
vcl/inc/ilstbox.hxx
vcl/inc/vcl/combobox.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/settings.hxx
vcl/source/app/settings.cxx
vcl/source/control/combobox.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/lstbox.cxx
Change-Id: I905b6814cb796a35aa23fedb9ce716f77e2bfda0
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/config/accessibilityoptions.cxx | 171 | ||||
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 32 | ||||
-rw-r--r-- | svtools/source/control/valueset.cxx | 58 |
3 files changed, 114 insertions, 147 deletions
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index a830a9998c82..35e612e720b4 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -58,6 +58,7 @@ namespace const char s_sColorValueSetEntryEdgeLength[] = "ColorValueSetEntryEdgeLength"; const char s_sColorValueSetColumnCount[] = "ColorValueSetColumnCount"; const char s_sEdgeBlending[] = "EdgeBlending"; + const char s_sListBoxMaximumLineCount[] = "ListBoxMaximumLineCount"; } // class SvtAccessibilityOptions_Impl --------------------------------------------- @@ -82,10 +83,8 @@ 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; + sal_Int16 GetListBoxMaximumLineCount() const; void SetAutoDetectSystemHC(sal_Bool bSet); void SetIsForPagePreviews(sal_Bool bSet); @@ -96,10 +95,8 @@ 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); + void SetListBoxMaximumLineCount(sal_Int16 nSet); sal_Bool IsModified() const { return bIsModified; }; }; @@ -304,51 +301,15 @@ 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 +sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nRet = 12; + sal_Int16 nRet = 35; try { if(xNode.is()) - xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet; + xNode->getPropertyValue(s_sEdgeBlending) >>= nRet; } catch(const css::uno::Exception& ex) { @@ -358,15 +319,15 @@ sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const return nRet; } -sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const +sal_Int16 SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const { css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - sal_Int16 nRet = 35; + sal_Int16 nRet = 25; try { if(xNode.is()) - xNode->getPropertyValue(s_sEdgeBlending) >>= nRet; + xNode->getPropertyValue(s_sListBoxMaximumLineCount) >>= nRet; } catch(const css::uno::Exception& ex) { @@ -558,70 +519,58 @@ void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet) void SvtAccessibilityOptions_Impl::SetVCLSettings() { - AllSettings aAllSettings = Application::GetSettings(); - HelpSettings aHelpSettings = aAllSettings.GetHelpSettings(); + AllSettings aAllSettings(Application::GetSettings()); + StyleSettings aStyleSettings(aAllSettings.GetStyleSettings()); + HelpSettings aHelpSettings(aAllSettings.GetHelpSettings()); + bool StyleSettingsChanged(false); + aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT); aAllSettings.SetHelpSettings(aHelpSettings); - if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() ) + + if(aStyleSettings.GetUseSystemUIFonts() != GetIsSystemFont()) { - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() ); - aAllSettings.SetStyleSettings(aStyleSettings); - Application::MergeSystemSettings( aAllSettings ); + aStyleSettings.SetUseSystemUIFonts(GetIsSystemFont()); + StyleSettingsChanged = true; } - Application::SetSettings(aAllSettings); -} - -void SvtAccessibilityOptions_Impl::SetColorValueSetMaximumRowCount(sal_Int16 nSet) -{ - css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + const sal_Int16 nEdgeBlendingCountA(GetEdgeBlending()); + OSL_ENSURE(nEdgeBlendingCountA >= 0, "OOps, negative values for EdgeBlending are not allowed (!)"); + const sal_uInt16 nEdgeBlendingCountB(static_cast< sal_uInt16 >(nEdgeBlendingCountA >= 0 ? nEdgeBlendingCountA : 0)); - try + if(aStyleSettings.GetEdgeBlending() != nEdgeBlendingCountB) { - 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); + aStyleSettings.SetEdgeBlending(nEdgeBlendingCountB); + StyleSettingsChanged = true; } -} -void SvtAccessibilityOptions_Impl::SetColorValueSetEntryEdgeLength(sal_Int16 nSet) -{ - css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + const sal_Int16 nMaxLineCountA(GetListBoxMaximumLineCount()); + OSL_ENSURE(nMaxLineCountA >= 0, "OOps, negative values for ListBoxMaximumLineCount are not allowed (!)"); + const sal_uInt16 nMaxLineCountB(static_cast< sal_uInt16 >(nMaxLineCountA >= 0 ? nMaxLineCountA : 0)); - try + if(aStyleSettings.GetListBoxMaximumLineCount() != nMaxLineCountB) { - if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength)!=nSet) - { - xNode->setPropertyValue(s_sColorValueSetEntryEdgeLength, css::uno::makeAny(nSet)); - ::comphelper::ConfigurationHelper::flush(m_xCfg); - - bIsModified = sal_True; - } + aStyleSettings.SetListBoxMaximumLineCount(nMaxLineCountB); + StyleSettingsChanged = true; } - catch(const css::uno::Exception& ex) + + if(StyleSettingsChanged) { - SAL_WARN("svtools", "Caught unexpected: " << ex.Message); + aAllSettings.SetStyleSettings(aStyleSettings); + Application::MergeSystemSettings(aAllSettings); } + + Application::SetSettings(aAllSettings); } -void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet) +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_sColorValueSetColumnCount)!=nSet) + if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet) { - xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet)); + xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet)); ::comphelper::ConfigurationHelper::flush(m_xCfg); bIsModified = sal_True; @@ -633,15 +582,15 @@ void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet) } } -void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet) +void SvtAccessibilityOptions_Impl::SetListBoxMaximumLineCount(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) + if(xNode.is() && xNode->getPropertyValue(s_sListBoxMaximumLineCount)!=nSet) { - xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet)); + xNode->setPropertyValue(s_sListBoxMaximumLineCount, css::uno::makeAny(nSet)); ::comphelper::ConfigurationHelper::flush(m_xCfg); bIsModified = sal_True; @@ -745,26 +694,14 @@ 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(); } +sal_Int16 SvtAccessibilityOptions::GetListBoxMaximumLineCount() const +{ + return sm_pSingleImplConfig->GetListBoxMaximumLineCount(); +} // ----------------------------------------------------------------------- void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet) @@ -807,22 +744,14 @@ 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); } +void SvtAccessibilityOptions::SetListBoxMaximumLineCount(sal_Int16 nSet) +{ + sm_pSingleImplConfig->SetListBoxMaximumLineCount(nSet); +} // ----------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 603165d52596..37cf88741fac 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -80,10 +80,9 @@ public: void ColorListBox::ImplInit() { pColorList = new ImpColorList(); - aImageSize.Width() = GetTextWidth( OUString("xxx") ); - aImageSize.Height() = GetTextHeight(); - aImageSize.Height() -= 2; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + aImageSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); EnableUserDraw( sal_True ); SetUserItemSize( aImageSize ); } @@ -103,6 +102,7 @@ ColorListBox::ColorListBox( Window* pParent, WinBits nWinStyle ) : ListBox( pParent, nWinStyle ) { ImplInit(); + SetEdgeBlending(true); } // ----------------------------------------------------------------------- @@ -111,6 +111,7 @@ ColorListBox::ColorListBox( Window* pParent, const ResId& rResId ) : ListBox( pParent, rResId ) { ImplInit(); + SetEdgeBlending(true); } namespace @@ -289,13 +290,36 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt ) if ( pData->bColor ) { Point aPos( rUDEvt.GetRect().TopLeft() ); + aPos.X() += 2; aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aImageSize.Height() ) / 2; + + const Rectangle aRect(aPos, aImageSize); + rUDEvt.GetDevice()->Push(); rUDEvt.GetDevice()->SetFillColor( pData->aColor ); rUDEvt.GetDevice()->SetLineColor( rUDEvt.GetDevice()->GetTextColor() ); - rUDEvt.GetDevice()->DrawRect( Rectangle( aPos, aImageSize ) ); + rUDEvt.GetDevice()->DrawRect(aRect); rUDEvt.GetDevice()->Pop(); + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); + + if(nEdgeBlendingPercent) + { + Bitmap aBitmap(rUDEvt.GetDevice()->GetBitmap(aRect.TopLeft(), aRect.GetSize())); + + if(!aBitmap.IsEmpty()) + { + const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); + const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); + const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); + + aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight); + rUDEvt.GetDevice()->DrawBitmap(aRect.TopLeft(), aBitmap); + } + } + ListBox::DrawEntry( rUDEvt, sal_False, sal_True, sal_False ); } else diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 1006bf0d6800..9623b29f4d50 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -28,7 +28,6 @@ #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> @@ -82,6 +81,7 @@ void ValueSet::ImplInit() mbDoubleSel = false; mbScroll = false; mbFullMode = true; + mbEdgeBlending = false; mbHasVisibleItems = false; // #106446#, #106601# force mirroring of virtual device @@ -266,9 +266,10 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect ) if ( (aRect.GetHeight() > 0) && (aRect.GetWidth() > 0) ) { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + if ( pItem == mpNoneItem ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); maVirDev.SetFont( GetFont() ); maVirDev.SetTextColor( ( nStyle & WB_MENUSTYLEVALUESET ) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor() ); maVirDev.SetTextFillColor(); @@ -294,29 +295,9 @@ 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 { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); if ( IsColor() ) maVirDev.SetFillColor( maColor ); else if ( nStyle & WB_MENUSTYLEVALUESET ) @@ -355,6 +336,23 @@ void ValueSet::ImplFormatItem( ValueSetItem* pItem, Rectangle aRect ) maVirDev.DrawImage( aPos, pItem->maImage, nImageStyle ); } } + + const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); + + if(nEdgeBlendingPercent) + { + Bitmap aBitmap(maVirDev.GetBitmap(aRect.TopLeft(), aRect.GetSize())); + + if(!aBitmap.IsEmpty()) + { + const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); + const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); + const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); + + aBitmap.DrawBlendFrame(nAlpha, rTopLeft, rBottomRight); + maVirDev.DrawBitmap(aRect.TopLeft(), aBitmap); + } + } } } @@ -2466,4 +2464,20 @@ Size ValueSet::GetOptimalSize() const return CalcWindowSizePixel(aLargestItemSize); } +// ----------------------------------------------------------------------- + +void ValueSet::SetEdgeBlending(bool bNew) +{ + if(mbEdgeBlending != bNew) + { + mbEdgeBlending = bNew; + mbFormat = true; + + if(IsReallyVisible() && IsUpdateMode()) + { + Invalidate(); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |