summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-03-25 01:29:08 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-03-25 02:27:56 +0100
commit600ad9d1552e5458bb0a8c47c892bebe219ebb01 (patch)
treeb5c7a32f6793acc2d8cfc44c2c740300401d0995
parentd9c1921c5031e5b372ee9d8db1e00fe7211cdd31 (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
-rw-r--r--vcl/source/window/toolbox2.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index f52211f0f613..ff1536115527 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -106,7 +106,8 @@ ImplToolItem::ImplToolItem()
ImplToolItem::ImplToolItem( sal_uInt16 nItemId, const Image& rImage,
ToolBoxItemBits nItemBits ) :
- maImage( rImage )
+ maImage( rImage ),
+ maImageOriginal( rImage )
{
init(nItemId, nItemBits, false);
}
@@ -121,6 +122,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);
@@ -130,6 +132,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 ),
@@ -168,6 +171,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;
@@ -484,6 +488,7 @@ void ToolBox::InsertItem( const ResId& rResId )
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 )
@@ -506,7 +511,10 @@ void ToolBox::InsertItem( const ResId& rResId )
// 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;