[Libreoffice-commits] core.git: include/vcl svtools/source vcl/source
Stephan Bergmann
sbergman at redhat.com
Fri Mar 7 10:46:55 PST 2014
include/vcl/graph.hxx | 2 ++
svtools/source/graphic/graphic.cxx | 4 ++--
vcl/source/gdi/graph.cxx | 16 +++++++++++++---
3 files changed, 17 insertions(+), 5 deletions(-)
New commits:
commit b901f7699dae0c9985e80c22d4b9824b8386bdc1
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Mar 7 19:39:54 2014 +0100
x->getSomething(x->getImplementationId()) doesn't make any sense
...the point of the aIdentifier parameter to css.lang.XUnoTunnel.getSomething is
so that caller and callee can verify they know each other and the value passed
back (pointer in local address space, in this case) will actually make sense for
the caller.
Change-Id: Id79c419307992b30ea6ef7997b74a015631ad21c
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index e6fe04f..1639f5b 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -198,6 +198,8 @@ public:
virtual void Assign( const SvDataCopyStream& );
const SvgDataPtr& getSvgData() const;
+
+ static css::uno::Sequence<sal_Int8> getUnoTunnelId();
};
#endif // INCLUDED_VCL_GRAPH_HXX
diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx
index 49b0f359..1248f6a 100644
--- a/svtools/source/graphic/graphic.cxx
+++ b/svtools/source/graphic/graphic.cxx
@@ -251,14 +251,14 @@ const ::Graphic* Graphic::getImplementation( const uno::Reference< uno::XInterfa
throw()
{
uno::Reference< lang::XUnoTunnel > xTunnel( rxIFace, uno::UNO_QUERY );
- return( xTunnel.is() ? reinterpret_cast< ::Graphic* >( xTunnel->getSomething( getImplementationId_Static() ) ) : NULL );
+ return( xTunnel.is() ? reinterpret_cast< ::Graphic* >( xTunnel->getSomething( ::Graphic::getUnoTunnelId() ) ) : NULL );
}
sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId )
throw( uno::RuntimeException, std::exception )
{
- return( ( rId.getLength() == 16 && 0 == memcmp( getImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) ?
+ return( ( rId.getLength() == 16 && 0 == memcmp( ::Graphic::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ?
reinterpret_cast< sal_Int64 >( mpGraphic ) :
0 );
}
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index be6af17..d604122 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -29,6 +29,7 @@
#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>
using namespace ::com::sun::star;
@@ -224,9 +225,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 )
@@ -587,4 +587,14 @@ const SvgDataPtr& Graphic::getSvgData() const
return mpImpGraphic->getSvgData();
}
+namespace {
+
+struct Id: public rtl::Static<cppu::OImplementationId, Id> {};
+
+}
+
+css::uno::Sequence<sal_Int8> Graphic::getUnoTunnelId() {
+ return Id::get().getImplementationId();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list