From 647f348c62d0a08fc26625aa58708fe9495d6904 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 3 May 2013 17:09:59 +0200 Subject: [PATCH] fdo#46808, Use service constructor for rendering::CanvasFactory Change-Id: If6bebe0d2dfb30c3fffd0fb284cd766e3f315b49 --- sw/CppunitTest_sw_ooxmlexport.mk | 1 + sw/CppunitTest_sw_rtfimport.mk | 1 + vcl/source/gdi/outdev.cxx | 20 +++++++----------- vcl/source/window/window.cxx | 36 ++++++++++++++++---------------- 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/sw/CppunitTest_sw_ooxmlexport.mk b/sw/CppunitTest_sw_ooxmlexport.mk index 524e70a8b4d1..e96961fade5b 100644 --- a/sw/CppunitTest_sw_ooxmlexport.mk +++ b/sw/CppunitTest_sw_ooxmlexport.mk @@ -50,6 +50,7 @@ $(eval $(call gb_CppunitTest_use_ure,sw_ooxmlexport)) $(eval $(call gb_CppunitTest_use_components,sw_ooxmlexport,\ basic/util/sb \ + canvas/source/factory/canvasfactory \ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ diff --git a/sw/CppunitTest_sw_rtfimport.mk b/sw/CppunitTest_sw_rtfimport.mk index e5b4f3079266..8cedeeb1e082 100644 --- a/sw/CppunitTest_sw_rtfimport.mk +++ b/sw/CppunitTest_sw_rtfimport.mk @@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_ure,sw_rtfimport)) $(eval $(call gb_CppunitTest_use_components,sw_rtfimport,\ basic/util/sb \ + canvas/source/factory/canvasfactory \ comphelper/util/comphelp \ configmgr/source/configmgr \ embeddedobj/util/embobj \ diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index f134388fbacb..7c03af02aed3 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -2565,22 +2566,17 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const aArg[ 3 ] = uno::makeAny( sal_False ); aArg[ 5 ] = GetSystemGfxDataAny(); - uno::Reference xFactory = comphelper::getProcessServiceFactory(); - - uno::Reference xCanvas; + uno::Reference xContext = comphelper::getProcessComponentContext(); // Create canvas instance with window handle // ========================================= - static uno::Reference xCanvasFactory( - xFactory->createInstance( "com.sun.star.rendering.CanvasFactory" ), + static uno::Reference xCanvasFactory( rendering::CanvasFactory::create( xContext ) ); + + uno::Reference xCanvas; + xCanvas.set( + xCanvasFactory->createInstanceWithArgumentsAndContext( + "com.sun.star.rendering.Canvas", aArg, xContext ), uno::UNO_QUERY ); - if(xCanvasFactory.is()) - { - xCanvas.set( - xCanvasFactory->createInstanceWithArguments( - "com.sun.star.rendering.Canvas", aArg ), - uno::UNO_QUERY ); - } return xCanvas; } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 4201c39fa260..b32078a558ef 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -75,23 +75,24 @@ #include "dndlcon.hxx" #include "dndevdis.hxx" +#include "com/sun/star/accessibility/XAccessible.hpp" +#include "com/sun/star/accessibility/AccessibleRole.hpp" #include "com/sun/star/awt/XWindowPeer.hpp" -#include "com/sun/star/rendering/XCanvas.hpp" -#include "com/sun/star/rendering/XSpriteCanvas.hpp" +#include "com/sun/star/awt/XTopWindow.hpp" #include "com/sun/star/awt/XWindow.hpp" -#include "comphelper/processfactory.hxx" +#include "com/sun/star/awt/XDisplayConnection.hpp" #include "com/sun/star/datatransfer/dnd/XDragSource.hpp" #include "com/sun/star/datatransfer/dnd/XDropTarget.hpp" #include "com/sun/star/datatransfer/clipboard/XClipboard.hpp" #include "com/sun/star/datatransfer/clipboard/SystemClipboard.hpp" #include "com/sun/star/datatransfer/clipboard/SystemClipboardExt.hpp" -#include "com/sun/star/awt/XTopWindow.hpp" -#include "com/sun/star/awt/XDisplayConnection.hpp" #include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XComponent.hpp" #include "com/sun/star/lang/XServiceName.hpp" -#include "com/sun/star/accessibility/XAccessible.hpp" -#include "com/sun/star/accessibility/AccessibleRole.hpp" +#include "com/sun/star/rendering/CanvasFactory.hpp" +#include "com/sun/star/rendering/XCanvas.hpp" +#include "com/sun/star/rendering/XSpriteCanvas.hpp" +#include "comphelper/processfactory.hxx" #include #include @@ -9467,16 +9468,13 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr const_cast(this)->GetComponentInterface(), uno::UNO_QUERY )); - uno::Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); // Create canvas instance with window handle // ========================================= - static ::vcl::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( - uno::Reference( - xFactory->createInstance( - OUString( "com.sun.star.rendering.CanvasFactory" ) ), - UNO_QUERY )); - uno::Reference xCanvasFactory(xStaticCanvasFactory.get()); + static ::vcl::DeleteUnoReferenceOnDeinit xStaticCanvasFactory( + rendering::CanvasFactory::create( xContext ) ); + uno::Reference xCanvasFactory(xStaticCanvasFactory.get()); if(xCanvasFactory.is()) { @@ -9489,22 +9487,24 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay; if( (nDisplay >= Application::GetScreenCount()) ) { - xCanvas.set( xCanvasFactory->createInstanceWithArguments( + xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext( bSpriteCanvas ? OUString( "com.sun.star.rendering.SpriteCanvas.MultiScreen" ) : OUString( "com.sun.star.rendering.Canvas.MultiScreen" ), - aArg ), + aArg, + xContext ), UNO_QUERY ); } else { #endif - xCanvas.set( xCanvasFactory->createInstanceWithArguments( + xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext( bSpriteCanvas ? OUString( "com.sun.star.rendering.SpriteCanvas" ) : OUString( "com.sun.star.rendering.Canvas" ), - aArg ), + aArg, + xContext ), UNO_QUERY ); #ifdef WNT