move GetXGraphic to its only user

Change-Id: I72ec4a7e72ca3355a97f987fab70b3e3a8e45168
This commit is contained in:
Caolán McNamara
2017-01-20 17:21:59 +00:00
parent 879aebdf9c
commit f9b87a2e50
6 changed files with 19 additions and 19 deletions

View File

@@ -717,6 +717,14 @@ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
return false; return false;
} }
namespace
{
css::uno::Reference< css::graphic::XGraphic > GetXGraphic(const Image &rImage)
{
return Graphic(rImage.GetBitmapEx()).GetXGraphic();
}
}
Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages( Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages(
::sal_Int16 nImageType, ::sal_Int16 nImageType,
const Sequence< OUString >& aCommandURLSequence ) const Sequence< OUString >& aCommandURLSequence )
@@ -759,7 +767,7 @@ throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException )
aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] ); aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] );
} }
aGraphSeq[n] = aImage.GetXGraphic(); aGraphSeq[n] = GetXGraphic(aImage);
} }
return aGraphSeq; return aGraphSeq;
@@ -909,7 +917,7 @@ throw ( css::lang::IllegalArgumentException,
{ {
if ( !pReplacedImages ) if ( !pReplacedImages )
pReplacedImages = new CmdToXGraphicNameAccess(); pReplacedImages = new CmdToXGraphicNameAccess();
pReplacedImages->addElement( aCommandURLSequence[i], aNewImage.GetXGraphic() ); pReplacedImages->addElement(aCommandURLSequence[i], GetXGraphic(aNewImage));
} }
} // if ( m_bUseGlobal ) } // if ( m_bUseGlobal )
else else
@@ -1013,14 +1021,14 @@ void ImageManagerImpl::reload()
if ( !pReplacedImages ) if ( !pReplacedImages )
pReplacedImages = new CmdToXGraphicNameAccess(); pReplacedImages = new CmdToXGraphicNameAccess();
pReplacedImages->addElement( aNewUserCmdImageSet[j], pReplacedImages->addElement( aNewUserCmdImageSet[j],
pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() ); GetXGraphic(pImageList->GetImage(aNewUserCmdImageSet[j])) );
} }
else else
{ {
if ( !pInsertedImages ) if ( !pInsertedImages )
pInsertedImages = new CmdToXGraphicNameAccess(); pInsertedImages = new CmdToXGraphicNameAccess();
pInsertedImages->addElement( aNewUserCmdImageSet[j], pInsertedImages->addElement( aNewUserCmdImageSet[j],
pImageList->GetImage( aNewUserCmdImageSet[j] ).GetXGraphic() ); GetXGraphic(pImageList->GetImage(aNewUserCmdImageSet[j])) );
} }
} }
@@ -1058,7 +1066,7 @@ void ImageManagerImpl::reload()
// Image has been found in the module/global image list => replace user image // Image has been found in the module/global image list => replace user image
if ( !pReplacedImages ) if ( !pReplacedImages )
pReplacedImages = new CmdToXGraphicNameAccess(); pReplacedImages = new CmdToXGraphicNameAccess();
pReplacedImages->addElement( pIter->first, aImage.GetXGraphic() ); pReplacedImages->addElement(pIter->first, GetXGraphic(aImage));
} }
} // if ( m_bUseGlobal ) } // if ( m_bUseGlobal )
else else

View File

@@ -65,7 +65,6 @@ public:
Size GetSizePixel() const; Size GetSizePixel() const;
BitmapEx GetBitmapEx() const; BitmapEx GetBitmapEx() const;
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const;
bool operator!() const { return !mpImplData; } bool operator!() const { return !mpImplData; }
bool operator==( const Image& rImage ) const; bool operator==( const Image& rImage ) const;

View File

@@ -201,19 +201,19 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co
OUString sImageName( rResourceURL.copy( nIndex ) ); OUString sImageName( rResourceURL.copy( nIndex ) );
if ( sImageName == "info" ) if ( sImageName == "info" )
{ {
xRet = InfoBox::GetStandardImage().GetXGraphic(); xRet = Graphic(InfoBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
} }
else if ( sImageName == "warning" ) else if ( sImageName == "warning" )
{ {
xRet = WarningBox::GetStandardImage().GetXGraphic(); xRet = Graphic(WarningBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
} }
else if ( sImageName == "error" ) else if ( sImageName == "error" )
{ {
xRet = ErrorBox::GetStandardImage().GetXGraphic(); xRet = Graphic(ErrorBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
} }
else if ( sImageName == "query" ) else if ( sImageName == "query" )
{ {
xRet = QueryBox::GetStandardImage().GetXGraphic(); xRet = Graphic(QueryBox::GetStandardImage().GetBitmapEx()).GetXGraphic();
} }
} }
return xRet; return xRet;

View File

@@ -873,7 +873,7 @@ throw (css::uno::RuntimeException, std::exception)
{ {
Image aImage = mpMenu->GetItemImage( nItemId ); Image aImage = mpMenu->GetItemImage( nItemId );
if ( !!aImage ) if ( !!aImage )
rxGraphic = aImage.GetXGraphic(); rxGraphic = Graphic(aImage.GetBitmapEx()).GetXGraphic();
} }
return rxGraphic; return rxGraphic;
} }

View File

@@ -294,7 +294,7 @@ css::uno::Any VCLXGraphicControl::getProperty( const OUString& PropertyName ) th
switch ( nPropType ) switch ( nPropType )
{ {
case BASEPROPERTY_GRAPHIC: case BASEPROPERTY_GRAPHIC:
aProp <<= maImage.GetXGraphic(); aProp <<= Graphic(maImage.GetBitmapEx()).GetXGraphic();
break; break;
case BASEPROPERTY_IMAGEALIGN: case BASEPROPERTY_IMAGEALIGN:
{ {

View File

@@ -110,13 +110,6 @@ BitmapEx Image::GetBitmapEx() const
return aRet; return aRet;
} }
css::uno::Reference< css::graphic::XGraphic > Image::GetXGraphic() const
{
const Graphic aGraphic( GetBitmapEx() );
return aGraphic.GetXGraphic();
}
bool Image::operator==(const Image& rImage) const bool Image::operator==(const Image& rImage) const
{ {
bool bRet = false; bool bRet = false;