diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-03 17:23:20 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-06 11:27:50 +0200 |
commit | 46662428b2b17043e1d09c4107e7a5c0cf490b86 (patch) | |
tree | 1bc8f69d26e2a401d6f8f784e4c4498416d22c18 /sfx2/source | |
parent | 6e0d0934d0cbb74bb5a4fbf05b4448832f6d4722 (diff) |
fdo#46808, Convert graphic::Primitive2DTools to new style
Change-Id: I9719b43dbf98cfca29638f54cc907e48c7ad28b7
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/appl/appmisc.cxx | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index f6d1597148a9..06f18fbe1c13 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/rendering/XIntegerReadOnlyBitmap.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/graphic/XPrimitive2DRenderer.hpp> +#include <com/sun/star/graphic/Primitive2DTools.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/uno/Reference.h> @@ -218,44 +218,39 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid // UNO dance to render from drawinglayer // --------------------------------------------------------------------- - uno::Reference< lang::XMultiServiceFactory > xFactory(::comphelper::getProcessServiceFactory()); - const OUString aServiceName("com.sun.star.graphic.Primitive2DTools"); + uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); try { - const uno::Reference< graphic::XPrimitive2DRenderer > xPrimitive2DRenderer( - xFactory->createInstance(aServiceName), - uno::UNO_QUERY_THROW); - - if(xPrimitive2DRenderer.is()) + const uno::Reference< graphic::XPrimitive2DRenderer > xPrimitive2DRenderer = + graphic::Primitive2DTools::create( xContext ); + + // cancel out rasterize's mm2pixel conversion + // see fFactor100th_mmToInch in + // drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx + const double fFakeDPI=2.54 * 1000.0; + + geometry::RealRectangle2D aRealRect( + 0, 0, + nWidth, nWidth / fAspectRatio); + + const uno::Reference< rendering::XBitmap > xBitmap( + xPrimitive2DRenderer->rasterize( + drawinglayer::primitive2d::Primitive2DSequence(&xTransformRef, 1), + uno::Sequence< beans::PropertyValue >(), + fFakeDPI, + fFakeDPI, + aRealRect, + 500000)); + + if(xBitmap.is()) { - // cancel out rasterize's mm2pixel conversion - // see fFactor100th_mmToInch in - // drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx - const double fFakeDPI=2.54 * 1000.0; - - geometry::RealRectangle2D aRealRect( - 0, 0, - nWidth, nWidth / fAspectRatio); - - const uno::Reference< rendering::XBitmap > xBitmap( - xPrimitive2DRenderer->rasterize( - drawinglayer::primitive2d::Primitive2DSequence(&xTransformRef, 1), - uno::Sequence< beans::PropertyValue >(), - fFakeDPI, - fFakeDPI, - aRealRect, - 500000)); - - if(xBitmap.is()) - { - const uno::Reference< rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW); + const uno::Reference< rendering::XIntegerReadOnlyBitmap> xIntBmp(xBitmap, uno::UNO_QUERY_THROW); - if(xIntBmp.is()) - { - rBitmap = vcl::unotools::bitmapExFromXBitmap(xIntBmp); - return true; - } + if(xIntBmp.is()) + { + rBitmap = vcl::unotools::bitmapExFromXBitmap(xIntBmp); + return true; } } } |