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/source/control/ctrlbox.cxx | |
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/source/control/ctrlbox.cxx')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 32 |
1 files changed, 28 insertions, 4 deletions
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 |