diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 17:06:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-09-09 17:46:39 +0200 |
commit | 7275be15191c08009ac9c359163e3eeb1be25ca7 (patch) | |
tree | a42ab599617c664c8e2a304c244b426ddc8960d6 /vcl | |
parent | 4209a6127d96c61295fad6e8f2c512644aadf850 (diff) |
sb140: #i117291# do not mis-use XTypeProvider.getImplementationId in XUnoTunnel.getSomething
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/graph.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/graph.cxx | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index 837393575aff..acb72717a395 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -40,6 +40,7 @@ #include <vcl/graph.h> #include <vcl/gfxlink.hxx> #include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } } @@ -94,6 +95,7 @@ public: SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mpImpGraphic; } public: + static com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId(); TYPEINFO(); diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 1bb208bff8e4..8205a6b7cdc2 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -42,6 +42,8 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <cppuhelper/typeprovider.hxx> +#include <rtl/instance.hxx> // ----------------------- // - Compression defines - @@ -210,6 +212,16 @@ static void ImplDrawDefault( OutputDevice* pOutDev, const UniString* pText, // - Graphic - // ----------- +namespace { + +struct Id: public rtl::Static< cppu::OImplementationId, Id > {}; + +} + +uno::Sequence< sal_Int8 > Graphic::getUnoTunnelId() { + return Id::get().getImplementationId(); +} + TYPEINIT1_AUTOFACTORY( Graphic, SvDataCopyStream ); // ------------------------------------------------------------------------ @@ -266,9 +278,8 @@ Graphic::Graphic( const GDIMetaFile& rMtf ) Graphic::Graphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic ) { uno::Reference< lang::XUnoTunnel > xTunnel( rxGraphic, uno::UNO_QUERY ); - uno::Reference< lang::XTypeProvider > xProv( rxGraphic, uno::UNO_QUERY ); - const ::Graphic* pGraphic = ( ( xTunnel.is() && xProv.is() ) ? - reinterpret_cast< ::Graphic* >( xTunnel->getSomething( xProv->getImplementationId() ) ) : + const ::Graphic* pGraphic = ( xTunnel.is() ? + reinterpret_cast< ::Graphic* >( xTunnel->getSomething( getUnoTunnelId() ) ) : NULL ); if( pGraphic ) |