From cfb90793b42ff57281d1cdd8b0c609652664ffe9 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Sun, 11 Mar 2018 01:11:22 +0900 Subject: svx: convert XBitmap directly to XGraphic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If2bd8419d9073625f0392f59f671d70193bf990c Reviewed-on: https://gerrit.libreoffice.org/51048 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- svx/source/unodraw/unoshap2.cxx | 32 +++++++++++++++----------------- 1 file 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::get()) || (rValue.getValueType() == cppu::UnoType::get())) + else if (rValue.getValueType() == cppu::UnoType::get()) { - Reference< graphic::XGraphic> xGraphic( rValue, UNO_QUERY ); - if( xGraphic.is() ) + auto xGraphic = rValue.get>(); + if (xGraphic.is()) { static_cast(mpObj.get())->SetGraphic(Graphic(xGraphic)); bOk = true; } - else + } + else if (rValue.getValueType() == cppu::UnoType::get()) + { + auto xBitmap = rValue.get>(); + 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(mpObj.get())->SetGraphic(aGraphic); - bOk = true; - } + uno::Reference xGraphic(xBitmap, uno::UNO_QUERY); + Graphic aGraphic(xGraphic); + static_cast(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(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 xBitmap(rGraphic.GetXGraphic(), uno::UNO_QUERY); rValue <<= xBitmap; } else -- cgit v1.2.3