diff options
Diffstat (limited to 'canvas/source/tools/canvastools.cxx')
-rw-r--r-- | canvas/source/tools/canvastools.cxx | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 02af4bb333db..1ff393005758 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -51,10 +51,9 @@ #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp> #include <com/sun/star/util/Endianness.hpp> #include <cppuhelper/implbase.hxx> -#include <rtl/instance.hxx> #include <sal/log.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/canvastools.hxx> #include <vcl/window.hxx> @@ -843,33 +842,18 @@ namespace canvas::tools } }; - struct StandardColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, - StandardColorSpaceHolder> - { - uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() - { - return new StandardColorSpace(); - } - }; - - struct StandardNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, - StandardNoAlphaColorSpaceHolder> - { - uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() - { - return new StandardNoAlphaColorSpace(); - } - }; } uno::Reference<rendering::XIntegerBitmapColorSpace> const & getStdColorSpace() { - return StandardColorSpaceHolder::get(); + static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new StandardColorSpace(); + return SPACE; } uno::Reference<rendering::XIntegerBitmapColorSpace> const & getStdColorSpaceWithoutAlpha() { - return StandardNoAlphaColorSpaceHolder::get(); + static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new StandardNoAlphaColorSpace(); + return SPACE; } rendering::IntegerBitmapLayout getStdMemoryLayout( const geometry::IntegerSize2D& rBmpSize ) @@ -1096,27 +1080,25 @@ namespace canvas::tools { o_rxParams.realloc( 0 ); - if( i_rxCanvas.is() ) + if( !i_rxCanvas.is() ) + return o_rxParams; + + try { - try - { - uno::Reference< rendering::XGraphicDevice > xDevice( i_rxCanvas->getDevice(), - uno::UNO_SET_THROW ); + uno::Reference< rendering::XGraphicDevice > xDevice( i_rxCanvas->getDevice(), + uno::UNO_SET_THROW ); - uno::Reference< lang::XServiceInfo > xServiceInfo( xDevice, - uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xPropSet( xDevice, + uno::Reference< lang::XServiceInfo > xServiceInfo( xDevice, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( xDevice, + uno::UNO_QUERY_THROW ); - o_rxParams.realloc( 2 ); - - o_rxParams[ 0 ] <<= xServiceInfo->getImplementationName(); - o_rxParams[ 1 ] = xPropSet->getPropertyValue( "DeviceHandle" ); - } - catch( const uno::Exception& ) - { - // ignore, but return empty sequence - } + o_rxParams = { uno::Any(xServiceInfo->getImplementationName()), + xPropSet->getPropertyValue( "DeviceHandle" ) }; + } + catch( const uno::Exception& ) + { + // ignore, but return empty sequence } return o_rxParams; |