Kaydet (Commit) 7fd1ed86 authored tarafından Michael Meeks's avatar Michael Meeks

vcl: add BitmapEx load from icon theme constructor.

Change-Id: I3dbad69664b7417928a6be10ac561307dd94f67b
üst 72e901c1
...@@ -46,6 +46,7 @@ public: ...@@ -46,6 +46,7 @@ public:
BitmapEx(); BitmapEx();
BitmapEx( const ResId& rResId ); BitmapEx( const ResId& rResId );
BitmapEx( const OUString& rIconName );
BitmapEx( const BitmapEx& rBitmapEx ); BitmapEx( const BitmapEx& rBitmapEx );
BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ); BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize );
BitmapEx( const Bitmap& rBmp ); BitmapEx( const Bitmap& rBmp );
...@@ -460,6 +461,7 @@ public: ...@@ -460,6 +461,7 @@ public:
private: private:
friend class ImpGraphic; friend class ImpGraphic;
friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm); friend bool VCL_DLLPUBLIC WriteDIBBitmapEx(const BitmapEx& rSource, SvStream& rOStm);
void loadFromIconTheme( const OUString& rIconName );
Bitmap aBitmap; Bitmap aBitmap;
Bitmap aMask; Bitmap aMask;
......
...@@ -85,11 +85,15 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) : ...@@ -85,11 +85,15 @@ BitmapEx::BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize ) :
CopyPixel( aDestRect, aSrcRect, &rBitmapEx ); CopyPixel( aDestRect, aSrcRect, &rBitmapEx );
} }
BitmapEx::BitmapEx( const OUString& rIconName )
{
loadFromIconTheme( rIconName );
}
BitmapEx::BitmapEx( const ResId& rResId ) : BitmapEx::BitmapEx( const ResId& rResId ) :
eTransparent( TRANSPARENT_NONE ), eTransparent( TRANSPARENT_NONE ),
bAlpha ( false ) bAlpha ( false )
{ {
static ImplImageTreeSingletonRef aImageTree;
ResMgr* pResMgr = NULL; ResMgr* pResMgr = NULL;
ResMgr::GetResourceSkipHeader( rResId.SetRT( RSC_BITMAP ), &pResMgr ); ResMgr::GetResourceSkipHeader( rResId.SetRT( RSC_BITMAP ), &pResMgr );
...@@ -97,13 +101,20 @@ BitmapEx::BitmapEx( const ResId& rResId ) : ...@@ -97,13 +101,20 @@ BitmapEx::BitmapEx( const ResId& rResId ) :
pResMgr->ReadLong(); pResMgr->ReadLong();
const OUString aFileName( pResMgr->ReadString() ); const OUString aFileName( pResMgr->ReadString() );
loadFromIconTheme( aFileName );
}
void BitmapEx::loadFromIconTheme( const OUString& rIconName )
{
static ImplImageTreeSingletonRef aImageTree;
OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); OUString aIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme();
if( !aImageTree->loadImage( aFileName, aIconTheme, *this, true ) ) if( !aImageTree->loadImage( rIconName, aIconTheme, *this, true ) )
{ {
#ifdef DBG_UTIL #ifdef DBG_UTIL
OStringBuffer aErrorStr( OStringBuffer aErrorStr(
"BitmapEx::BitmapEx( const ResId& rResId ): could not load image <"); "BitmapEx::BitmapEx(): could not load image <");
aErrorStr.append(OUStringToOString(aFileName, RTL_TEXTENCODING_ASCII_US)).append("> via icon theme "); aErrorStr.append(OUStringToOString(aFileName, RTL_TEXTENCODING_ASCII_US)).append("> via icon theme ");
aErrorStr.append(OUStringToOString(aIconTheme, RTL_TEXTENCODING_ASCII_US)).append('.'); aErrorStr.append(OUStringToOString(aIconTheme, RTL_TEXTENCODING_ASCII_US)).append('.');
OSL_FAIL(aErrorStr.getStr()); OSL_FAIL(aErrorStr.getStr());
......
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