summaryrefslogtreecommitdiff
path: root/svx/source/unodraw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-03-11 01:11:22 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-03-11 01:51:25 +0100
commitcfb90793b42ff57281d1cdd8b0c609652664ffe9 (patch)
tree73ba6b430c47b46b3ae5bb9f5c4d12cc6b7b4e44 /svx/source/unodraw
parent7ba32a63cf6064b5ad6e27c95ea3d9fa01ef19b1 (diff)
svx: convert XBitmap directly to XGraphic
Change-Id: If2bd8419d9073625f0392f59f671d70193bf990c Reviewed-on: https://gerrit.libreoffice.org/51048 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/unodraw')
-rw-r--r--svx/source/unodraw/unoshap2.cxx32
1 files changed, 15 insertions, 17 deletions
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index bf8b7b706c0d..453e6a254cfb 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1308,25 +1308,24 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
bOk = true;
}
}
- else if( (rValue.getValueType() == cppu::UnoType<awt::XBitmap>::get()) || (rValue.getValueType() == cppu::UnoType<graphic::XGraphic>::get()))
+ else if (rValue.getValueType() == cppu::UnoType<graphic::XGraphic>::get())
{
- Reference< graphic::XGraphic> xGraphic( rValue, UNO_QUERY );
- if( xGraphic.is() )
+ auto xGraphic = rValue.get<uno::Reference<graphic::XGraphic>>();
+ if (xGraphic.is())
{
static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(Graphic(xGraphic));
bOk = true;
}
- else
+ }
+ else if (rValue.getValueType() == cppu::UnoType<awt::XBitmap>::get())
+ {
+ auto xBitmap = rValue.get<uno::Reference<awt::XBitmap>>();
+ if (xBitmap.is())
{
- // pack bitmap in the object
- Reference< awt::XBitmap > xBmp( rValue, UNO_QUERY );
- if( xBmp.is() )
- {
- // apply bitmap
- Graphic aGraphic(VCLUnoHelper::GetBitmap( xBmp ));
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
- bOk = true;
- }
+ uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
+ Graphic aGraphic(xGraphic);
+ static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
+ bOk = true;
}
}
break;
@@ -1479,12 +1478,11 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
{
case OWN_ATTR_VALUE_FILLBITMAP:
{
- const Graphic& rGraphic = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic();
+ const Graphic& rGraphic = static_cast<SdrGrafObj*>(mpObj.get())->GetGraphic();
- if(rGraphic.GetType() != GraphicType::GdiMetafile)
+ if (rGraphic.GetType() != GraphicType::GdiMetafile)
{
- // pack object in a bitmap
- Reference< css::awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap(static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic().GetBitmapEx()) );
+ uno::Reference<awt::XBitmap> xBitmap(rGraphic.GetXGraphic(), uno::UNO_QUERY);
rValue <<= xBitmap;
}
else