diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-03-25 01:29:08 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-03-25 08:27:40 +0000 |
commit | 91455345aa2a15309032b9b3c6e6c32f8701fb33 (patch) | |
tree | af884f47b68dfe55e1f417d9bafa755f7d7c8296 /vcl/source/window | |
parent | cb47752029f0a2b84ed9020a24eb65e11cd32a63 (diff) |
tdf#94734: fix icon in sidebar disappears when changing font colour
- properly initalize maImageOriginal along with maImage in various
places
- this is a regression from 27d94c482e82ea5d4f202109614c6fb3578fb0a4
- that commit is mostly innocent in itself though, only exposing
omissions from b8f21298288890d52c06fef6c84441634c56c986
- having both maImage and maImageOriginal is extremely fragile as-is --
likely I'd be helpful to have them private in ImplToolItem and then a
SetImage accessor with a tristate eOriginal/eCached/eBoth enum
parameter to prevent oversights like this in the future ...
Change-Id: I294d7ed8e07be5cadec0ae251cc08c8d089bd059
Reviewed-on: https://gerrit.libreoffice.org/23505
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 0c916f6c1d75..c3d11735e9bf 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -107,7 +107,8 @@ ImplToolItem::ImplToolItem() ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBits nItemBits ) : - maImage( rImage ) + maImage( rImage ), + maImageOriginal( rImage ) { init(nItemId, nItemBits, false); } @@ -122,6 +123,7 @@ ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const OUString& rText, ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nItemBits ) : maImage( rImage ), + maImageOriginal( rImage ), maText( rText ) { init(nItemId, nItemBits, false); @@ -131,6 +133,7 @@ ImplToolItem::ImplToolItem( const ImplToolItem& rItem ) : mpWindow ( rItem.mpWindow ), mpUserData ( rItem.mpUserData ), maImage ( rItem.maImage ), + maImageOriginal ( rItem.maImageOriginal ), mnImageAngle ( rItem.mnImageAngle ), mbMirrorMode ( rItem.mbMirrorMode ), maText ( rItem.maText ), @@ -169,6 +172,7 @@ ImplToolItem& ImplToolItem::operator=( const ImplToolItem& rItem ) mpWindow = rItem.mpWindow; mpUserData = rItem.mpUserData; maImage = rItem.maImage; + maImageOriginal = rItem.maImageOriginal; mnImageAngle = rItem.mnImageAngle; mbMirrorMode = rItem.mbMirrorMode; maText = rItem.maText; @@ -487,6 +491,7 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) Bitmap aBmp = Bitmap( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) ); IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) ); aItem.maImage = Image( aBmp, IMAGE_STDBTN_COLOR ); + aItem.maImageOriginal = aItem.maImage; bImage = true; } if ( nObjMask & RSC_TOOLBOXITEM_IMAGE ) @@ -509,7 +514,10 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) // if no image is loaded, try to load one from the image list if ( !bImage && aItem.mnId ) + { aItem.maImage = maImageList.GetImage( aItem.mnId ); + aItem.maImageOriginal = aItem.maImage; + } // if this is a ButtonItem, check ID bool bNewCalc; |