fdo#46808, Use service constructor for rendering::CanvasFactory
Change-Id: If6bebe0d2dfb30c3fffd0fb284cd766e3f315b49
This commit is contained in:
@@ -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 \
|
||||
|
@@ -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 \
|
||||
|
@@ -56,6 +56,7 @@
|
||||
#include <com/sun/star/awt/XGraphics.hpp>
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <com/sun/star/rendering/XCanvas.hpp>
|
||||
#include <com/sun/star/rendering/CanvasFactory.hpp>
|
||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
|
||||
@@ -2565,22 +2566,17 @@ SystemGraphicsData OutputDevice::GetSystemGfxData() const
|
||||
aArg[ 3 ] = uno::makeAny( sal_False );
|
||||
aArg[ 5 ] = GetSystemGfxDataAny();
|
||||
|
||||
uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
|
||||
|
||||
uno::Reference<rendering::XCanvas> xCanvas;
|
||||
uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
|
||||
|
||||
// Create canvas instance with window handle
|
||||
// =========================================
|
||||
static uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(
|
||||
xFactory->createInstance( "com.sun.star.rendering.CanvasFactory" ),
|
||||
static uno::Reference<lang::XMultiComponentFactory> xCanvasFactory( rendering::CanvasFactory::create( xContext ) );
|
||||
|
||||
uno::Reference<rendering::XCanvas> 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;
|
||||
}
|
||||
|
@@ -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 <sal/macros.h>
|
||||
#include <rtl/strbuf.hxx>
|
||||
@@ -9467,16 +9468,13 @@ uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscr
|
||||
const_cast<Window*>(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<lang::XMultiServiceFactory> xStaticCanvasFactory(
|
||||
uno::Reference<lang::XMultiServiceFactory>(
|
||||
xFactory->createInstance(
|
||||
OUString( "com.sun.star.rendering.CanvasFactory" ) ),
|
||||
UNO_QUERY ));
|
||||
uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get());
|
||||
static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiComponentFactory> xStaticCanvasFactory(
|
||||
rendering::CanvasFactory::create( xContext ) );
|
||||
uno::Reference<lang::XMultiComponentFactory> 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
|
||||
|
Reference in New Issue
Block a user