diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-01 20:50:37 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-06-03 09:32:50 +0200 |
commit | 09c657ebe69fe1c2516a10a4452996870f4237d2 (patch) | |
tree | 1e0d6154aa3674599994bd8a4a90e1e4a83af813 /xmloff | |
parent | 675a3928e1cab27cf310c316be65acdbb764ed65 (diff) |
tdf#39593 use UNO3_GETIMPLEMENTATION* macros
Change-Id: I4e9af3b43a5baf19e100f42b3f37a2ade89ada5d
Reviewed-on: https://gerrit.libreoffice.org/73320
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/StyleMap.hxx | 8 | ||||
-rw-r--r-- | xmloff/source/core/attrlist.cxx | 36 | ||||
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 36 | ||||
-rw-r--r-- | xmloff/source/style/StyleMap.cxx | 39 |
4 files changed, 5 insertions, 114 deletions
diff --git a/xmloff/inc/StyleMap.hxx b/xmloff/inc/StyleMap.hxx index aef67399b8cd..887a1de3d52d 100644 --- a/xmloff/inc/StyleMap.hxx +++ b/xmloff/inc/StyleMap.hxx @@ -21,6 +21,7 @@ #define INCLUDED_XMLOFF_INC_STYLEMAP_HXX #include <com/sun/star/lang/XUnoTunnel.hpp> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <boost/functional/hash.hpp> #include <unordered_map> @@ -71,13 +72,8 @@ public: StyleMap(); virtual ~StyleMap() override; - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); - static StyleMap* getImplementation( - const css::uno::Reference< css::uno::XInterface >& ) throw(); - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( - const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + UNO3_GETIMPLEMENTATION_DECL(StyleMap) }; #endif // INCLUDED_XMLOFF_INC_STYLEMAP_HXX diff --git a/xmloff/source/core/attrlist.cxx b/xmloff/source/core/attrlist.cxx index e58707c6953c..4d94dff3609f 100644 --- a/xmloff/source/core/attrlist.cxx +++ b/xmloff/source/core/attrlist.cxx @@ -22,7 +22,6 @@ #include <vector> #include <osl/diagnose.h> #include <xmloff/xmltoken.hxx> -#include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <xmloff/attrlist.hxx> @@ -220,41 +219,8 @@ sal_Int16 SvXMLAttributeList::GetIndexByName( const OUString& rName ) const return -1; } -namespace -{ - class theSvXMLAttributeListUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvXMLAttributeListUnoTunnelId> {}; -} - // XUnoTunnel & co -const uno::Sequence< sal_Int8 > & SvXMLAttributeList::getUnoTunnelId() throw() -{ - return theSvXMLAttributeListUnoTunnelId::get().getSeq(); -} - -SvXMLAttributeList* SvXMLAttributeList::getImplementation( const uno::Reference< uno::XInterface >& xInt ) throw() -{ - uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY ); - if( xUT.is() ) - { - return - reinterpret_cast<SvXMLAttributeList*>( - sal::static_int_cast<sal_IntPtr>( - xUT->getSomething( SvXMLAttributeList::getUnoTunnelId()))); - } - else - return nullptr; -} - -// XUnoTunnel -sal_Int64 SAL_CALL SvXMLAttributeList::getSomething( const uno::Sequence< sal_Int8 >& rId ) -{ - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0; -} +UNO3_GETIMPLEMENTATION_IMPL(SvXMLAttributeList) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index c6746b3ea51b..2234f40f7c84 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -81,7 +81,6 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <comphelper/extract.hxx> -#include <comphelper/servicehelper.hxx> #include <PropertySetMerger.hxx> #include <svl/urihelper.hxx> @@ -2038,41 +2037,8 @@ XMLImageMapExport& SvXMLExport::GetImageMapExport() return *mpImageMapExport; } -namespace -{ - class theSvXMLExportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvXMLExportUnoTunnelId> {}; -} - // XUnoTunnel & co -const uno::Sequence< sal_Int8 > & SvXMLExport::getUnoTunnelId() throw() -{ - return theSvXMLExportUnoTunnelId::get().getSeq(); -} - -SvXMLExport* SvXMLExport::getImplementation( const uno::Reference< uno::XInterface >& xInt ) throw() -{ - uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY ); - if( xUT.is() ) - { - return - reinterpret_cast<SvXMLExport*>( - sal::static_int_cast<sal_IntPtr>( - xUT->getSomething( SvXMLExport::getUnoTunnelId()))); - } - else - return nullptr; -} - -// XUnoTunnel -sal_Int64 SAL_CALL SvXMLExport::getSomething( const uno::Sequence< sal_Int8 >& rId ) -{ - if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0; -} +UNO3_GETIMPLEMENTATION_IMPL(SvXMLExport); void SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent > const & rComp ) { diff --git a/xmloff/source/style/StyleMap.cxx b/xmloff/source/style/StyleMap.cxx index b5c3b7bfce59..1a8c63c62531 100644 --- a/xmloff/source/style/StyleMap.cxx +++ b/xmloff/source/style/StyleMap.cxx @@ -19,21 +19,11 @@ #include <string.h> -#include <comphelper/servicehelper.hxx> - #include <StyleMap.hxx> using namespace css::uno; using namespace css::lang; -namespace -{ - -class theStyleMapUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theStyleMapUnoTunnelId> -{}; - -} // end anonymous namespace - StyleMap::StyleMap() { } @@ -43,33 +33,6 @@ StyleMap::~StyleMap() } // XUnoTunnel & co -const Sequence<sal_Int8>& StyleMap::getUnoTunnelId() throw() -{ - return theStyleMapUnoTunnelId::get().getSeq(); -} - -StyleMap* StyleMap::getImplementation(const Reference<XInterface>& xInterface) throw() -{ - Reference<XUnoTunnel> xUnoTunnel(xInterface, UNO_QUERY); - if (xUnoTunnel.is()) - { - return reinterpret_cast<StyleMap*>(xUnoTunnel->getSomething(StyleMap::getUnoTunnelId())); - } - - return nullptr; -} - -// XUnoTunnel -sal_Int64 SAL_CALL StyleMap::getSomething(const Sequence<sal_Int8>& rId) -{ - if (rId.getLength() == 16 && - memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0) - { - return reinterpret_cast<sal_Int64>(this); - } - - return 0; -} - +UNO3_GETIMPLEMENTATION_IMPL(StyleMap); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |