Kaydet (Commit) 600ad9d1 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

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 27d94c48
- that commit is mostly innocent in itself though, only exposing
  omissions from b8f21298
- 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
üst d9c1921c
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment