[Libreoffice-commits] core.git: dbaccess/source include/comphelper include/sfx2 include/svl include/svx include/xmloff sc/inc sc/source sfx2/source svl/source svx/source xmloff/inc xmloff/source xmlsecurity/source

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 3 07:33:45 UTC 2019


 dbaccess/source/ui/browser/sbagrid.cxx                                |   29 ---
 dbaccess/source/ui/inc/sbagrid.hxx                                    |    5 
 include/comphelper/servicehelper.hxx                                  |    2 
 include/sfx2/asyncfunc.hxx                                            |    7 
 include/svl/numuno.hxx                                                |    7 
 include/svx/AccessibleShape.hxx                                       |    5 
 include/svx/fmgridif.hxx                                              |    5 
 include/xmloff/attrlist.hxx                                           |    6 
 include/xmloff/xmlexp.hxx                                             |    6 
 sc/inc/afmtuno.hxx                                                    |    7 
 sc/inc/cellsuno.hxx                                                   |   12 -
 sc/inc/datauno.hxx                                                    |    6 
 sc/inc/fielduno.hxx                                                   |    6 
 sc/inc/fmtuno.hxx                                                     |   11 -
 sc/inc/srchuno.hxx                                                    |    7 
 sc/inc/styleuno.hxx                                                   |    7 
 sc/inc/textuno.hxx                                                    |   16 -
 sc/inc/viewuno.hxx                                                    |    7 
 sc/source/ui/unoobj/afmtuno.cxx                                       |   32 ---
 sc/source/ui/unoobj/cellsuno.cxx                                      |   64 ------
 sc/source/ui/unoobj/datauno.cxx                                       |   32 ---
 sc/source/ui/unoobj/fielduno.cxx                                      |   32 ---
 sc/source/ui/unoobj/fmtuno.cxx                                        |   63 ------
 sc/source/ui/unoobj/srchuno.cxx                                       |   32 ---
 sc/source/ui/unoobj/styleuno.cxx                                      |   31 ---
 sc/source/ui/unoobj/textuno.cxx                                       |   94 ----------
 sc/source/ui/unoobj/viewuno.cxx                                       |   32 ---
 sfx2/source/control/asyncfunc.cxx                                     |   35 ---
 svl/source/numbers/numuno.cxx                                         |   36 ---
 svx/source/accessibility/AccessibleShape.cxx                          |   39 ----
 svx/source/fmcomp/fmgridif.cxx                                        |   39 ----
 xmloff/inc/StyleMap.hxx                                               |    8 
 xmloff/source/core/attrlist.cxx                                       |   36 ---
 xmloff/source/core/xmlexp.cxx                                         |   36 ---
 xmloff/source/style/StyleMap.cxx                                      |   39 ----
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   29 ---
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx |    6 
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx     |   27 --
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx     |    6 
 39 files changed, 66 insertions(+), 833 deletions(-)

New commits:
commit 09c657ebe69fe1c2516a10a4452996870f4237d2
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sat Jun 1 20:50:37 2019 +0300
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jun 3 09:32:50 2019 +0200

    tdf#39593 use UNO3_GETIMPLEMENTATION* macros
    
    Change-Id: I4e9af3b43a5baf19e100f42b3f37a2ade89ada5d
    Reviewed-on: https://gerrit.libreoffice.org/73320
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index c41a4e395c67..0bf3e8a4fec8 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -71,7 +71,6 @@
 #include <connectivity/dbconversion.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <comphelper/processfactory.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <comphelper/types.hxx>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/sdbc/DataType.hpp>
@@ -506,16 +505,6 @@ void SAL_CALL SbaXGridPeer::removeStatusListener(const Reference< css::frame::XS
         pCont->removeInterface(xControl);
 }
 
-namespace
-{
-    class theSbaXGridPeerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSbaXGridPeerUnoTunnelId > {};
-}
-
-const Sequence< sal_Int8 > & SbaXGridPeer::getUnoTunnelId()
-{
-    return theSbaXGridPeerUnoTunnelId::get().getSeq();
-}
-
 Sequence< Type > SAL_CALL SbaXGridPeer::getTypes()
 {
     return comphelper::concatSequences(
@@ -523,23 +512,7 @@ Sequence< Type > SAL_CALL SbaXGridPeer::getTypes()
         Sequence { cppu::UnoType<css::frame::XDispatch>::get() });
 }
 
-// return implementation specific data
-sal_Int64 SAL_CALL SbaXGridPeer::getSomething( const Sequence< sal_Int8 > & rId )
-{
-    if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),  rId.getConstArray(), 16 ) )
-        return reinterpret_cast< sal_Int64 >( this );
-
-    return FmXGridPeer::getSomething(rId);
-}
-
-SbaXGridPeer* SbaXGridPeer::getImplementation(const Reference< XInterface >& _rxIFace)
-{
-    Reference< XUnoTunnel > xTunnel(
-        _rxIFace, UNO_QUERY);
-    if (xTunnel.is())
-        return reinterpret_cast<SbaXGridPeer*>(xTunnel->getSomething(getUnoTunnelId()));
-    return nullptr;
-}
+UNO3_GETIMPLEMENTATION2_IMPL(SbaXGridPeer, FmXGridPeer);
 
 VclPtr<FmGridControl> SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, WinBits nStyle)
 {
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 1629fbdb1463..4401a527cf46 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/sdb/XSQLQueryComposer.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
 #include <com/sun/star/util/URL.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/uno3.hxx>
 #include "sbamultiplex.hxx"
 #include <svx/dataaccessdescriptor.hxx>
@@ -114,9 +115,7 @@ namespace dbaui
 
         virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
 
-        static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-        sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 > & rId ) override;
-        static SbaXGridPeer* getImplementation(const css::uno::Reference< css::uno::XInterface>& _rxIFace);
+        UNO3_GETIMPLEMENTATION_DECL(SbaXGridPeer)
 
         // css::frame::XDispatch
         virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
diff --git a/include/comphelper/servicehelper.hxx b/include/comphelper/servicehelper.hxx
index 38641e10d7db..466e1761f7d2 100644
--- a/include/comphelper/servicehelper.hxx
+++ b/include/comphelper/servicehelper.hxx
@@ -65,7 +65,7 @@ const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
     return the##classname##UnoTunnelId::get().getSeq(); \
 } \
 \
-classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \
+classname* classname::getImplementation( const css::uno::Reference< css::uno::XInterface >& xInt ) \
 { \
     css::uno::Reference< css::lang::XUnoTunnel > xUT( xInt, css::uno::UNO_QUERY ); \
     if( xUT.is() ) \
diff --git a/include/sfx2/asyncfunc.hxx b/include/sfx2/asyncfunc.hxx
index 6fd68899fb99..f9d3d92917ad 100644
--- a/include/sfx2/asyncfunc.hxx
+++ b/include/sfx2/asyncfunc.hxx
@@ -13,6 +13,7 @@
 #include <functional>
 
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 
 class AsyncFunc : public cppu::WeakImplHelper<css::lang::XUnoTunnel>
@@ -24,14 +25,10 @@ public:
     AsyncFunc(const std::function<void()>&);
     virtual ~AsyncFunc() override;
 
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static AsyncFunc* getImplementation(const css::uno::Reference<css::uno::XInterface>&);
-
     void Execute();
 
     //XUnoTunnel
-    virtual sal_Int64 SAL_CALL
-    getSomething(const css::uno::Sequence<sal_Int8>& aIdentifier) override;
+    UNO3_GETIMPLEMENTATION_DECL(AsyncFunc)
 };
 
 #endif
diff --git a/include/svl/numuno.hxx b/include/svl/numuno.hxx
index e88ef3fa7632..a439b95599ae 100644
--- a/include/svl/numuno.hxx
+++ b/include/svl/numuno.hxx
@@ -22,6 +22,7 @@
 #include <svl/svldllapi.h>
 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase2.hxx>
 #include <memory>
 
@@ -59,11 +60,7 @@ public:
                                 getNumberFormats() override;
 
                                 // XUnoTunnel
-    virtual sal_Int64 SAL_CALL  getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static SvNumberFormatsSupplierObj* getImplementation( const css::uno::Reference<
-                                    css::util::XNumberFormatsSupplier>& rObj );
+    UNO3_GETIMPLEMENTATION_DECL(SvNumberFormatsSupplierObj)
 
     ::comphelper::SharedMutex&  getSharedMutex() const;
 };
diff --git a/include/svx/AccessibleShape.hxx b/include/svx/AccessibleShape.hxx
index 895825675216..79f44f439c45 100644
--- a/include/svx/AccessibleShape.hxx
+++ b/include/svx/AccessibleShape.hxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/uno/Type.hxx>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <editeng/AccessibleContextBase.hxx>
 #include <editeng/AccessibleComponentBase.hxx>
 #include <rtl/ustring.hxx>
@@ -327,9 +328,7 @@ public:
 
     //===== XUnoTunnel ========================================================
 
-    static const css::uno::Sequence< sal_Int8 >&   getUnoTunnelImplementationId() throw();
-    static AccessibleShape*                                     getImplementation( const css::uno::Reference< css::uno::XInterface >& _rxIFace ) throw();
-    sal_Int64                                                   SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
+    UNO3_GETIMPLEMENTATION_DECL(AccessibleShape)
 
     //===== XAccessibleHypertext ========================================================
     virtual sal_Int32 SAL_CALL getHyperLinkCount() override;
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
index 873ad62ad43b..593619f98b15 100644
--- a/include/svx/fmgridif.hxx
+++ b/include/svx/fmgridif.hxx
@@ -44,6 +44,7 @@
 #include <tools/wintypes.hxx>
 #include <toolkit/controls/unocontrol.hxx>
 #include <toolkit/awt/vclxwindow.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/uno3.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/implbase10.hxx>
@@ -377,9 +378,7 @@ public:
     void Create(vcl::Window* pParent, WinBits nStyle);
 
 // css::lang::XUnoTunnel
-    static const css::uno::Sequence< sal_Int8 >&   getUnoTunnelImplementationId() throw();
-    static FmXGridPeer*                                         getImplementation( const css::uno::Reference< css::uno::XInterface >& _rxIFace ) throw();
-    sal_Int64                                                   SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
+    UNO3_GETIMPLEMENTATION_DECL(FmXGridPeer)
 
 // css::form::XGridPeer
     virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL getColumns(  ) override;
diff --git a/include/xmloff/attrlist.hxx b/include/xmloff/attrlist.hxx
index 0d8aa945c4c4..4b2895a01d8e 100644
--- a/include/xmloff/attrlist.hxx
+++ b/include/xmloff/attrlist.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <memory>
 
@@ -45,11 +46,8 @@ public:
         css::xml::sax::XAttributeList> & rAttrList );
     virtual ~SvXMLAttributeList() override;
 
-    static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
-    static SvXMLAttributeList* 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(SvXMLAttributeList)
 
     // css::xml::sax::XAttributeList
     virtual sal_Int16 SAL_CALL getLength() override;
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index 7bed9eb22643..81b50d0ad483 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -45,6 +45,7 @@
 #include <unotools/saveopt.hxx>
 
 #include <xmloff/XMLPageExport.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <tools/fldunit.hxx>
 #include <vcl/errcode.hxx>
@@ -289,9 +290,6 @@ public:
 
     virtual void collectAutoStyles();
 
-    static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
-    static SvXMLExport* getImplementation( const css::uno::Reference< css::uno::XInterface >& ) throw();
-
     // XExporter
     virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
 
@@ -312,7 +310,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) final override;
 
     // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+    UNO3_GETIMPLEMENTATION_DECL(SvXMLExport)
 
     /** ensures that the given namespace is in scope at the next started
         element.
diff --git a/sc/inc/afmtuno.hxx b/sc/inc/afmtuno.hxx
index 5e13886815d7..d39e5e41a294 100644
--- a/sc/inc/afmtuno.hxx
+++ b/sc/inc/afmtuno.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 
 class ScAutoFormatFieldObj;
@@ -145,11 +146,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
-                                    sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScAutoFormatObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScAutoFormatObj)
 };
 
 class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper<
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 865a5d5433b0..4abc19c6b7d9 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -84,6 +84,7 @@
 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
 #include <com/sun/star/sheet/XExternalSheetName.hpp>
 #include <com/sun/star/document/XEventsSupplier.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/weakref.hxx>
 
@@ -382,10 +383,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScCellRangesBase* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScCellRangesBase)
 
                             // XTypeProvider
     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
@@ -968,11 +966,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
-                                    sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScTableSheetObj* getImplementation(const css::uno::Reference< css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScTableSheetObj);
 
                             // XTypeProvider
     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index 95b79b220243..92f172532a4c 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -42,6 +42,7 @@
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/util/XRefreshable.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <rtl/ref.hxx>
 #include <svl/itemprop.hxx>
@@ -161,10 +162,7 @@ public:
                                     const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScSubTotalDescriptorBase* getImplementation(const css::uno::Reference<css::sheet::XSubTotalDescriptor>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScSubTotalDescriptorBase)
 
                             // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index a1678d68ee8e..f5e4f45a2fbe 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/util/XRefreshable.hpp>
 #include <com/sun/star/util/DateTime.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/component.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <osl/mutex.hxx>
@@ -199,9 +200,6 @@ private:
     void setPropertyValueSheet(const OUString& rName, const css::uno::Any& rVal);
 
 public:
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScEditFieldObj* getImplementation(const css::uno::Reference<css::text::XTextContent>& xObj);
-
     ScEditFieldObj(
         const css::uno::Reference<css::text::XTextRange>& rContent,
         std::unique_ptr<ScEditSource> pEditSrc, sal_Int32 eType, const ESelection& rSel);
@@ -244,7 +242,7 @@ public:
                                     const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+    UNO3_GETIMPLEMENTATION_DECL(ScEditFieldObj)
 
                             // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index 9d82f81c95cb..a8344bcd4d88 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -36,6 +36,7 @@
 
 #include <com/sun/star/sheet/XMultiFormulaTokens.hpp>
 #include <com/sun/star/sheet/FormulaToken.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 
 #include "address.hxx"
@@ -108,10 +109,7 @@ public:
     virtual sal_Bool SAL_CALL hasElements() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScTableConditionalFormat* getImplementation(const css::uno::Reference<css::sheet::XSheetConditionalEntries>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScTableConditionalFormat)
 
                             // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
@@ -235,10 +233,7 @@ public:
                                     const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScTableValidationObj* getImplementation(const css::uno::Reference<css::beans::XPropertySet>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScTableValidationObj)
 
                             // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
diff --git a/sc/inc/srchuno.hxx b/sc/inc/srchuno.hxx
index d2c94846209c..7d485ba688b4 100644
--- a/sc/inc/srchuno.hxx
+++ b/sc/inc/srchuno.hxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <svl/itemprop.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 
 class SvxSearchItem;
@@ -71,11 +72,7 @@ public:
                                     const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
 
                                 // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
-                                    sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScCellSearchObj* getImplementation(const css::uno::Reference<css::util::XSearchDescriptor>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScCellSearchObj)
 
                             // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx
index 34fa814451db..5552ef28c9a8 100644
--- a/sc/inc/styleuno.hxx
+++ b/sc/inc/styleuno.hxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/beans/XPropertyState.hpp>
 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 
 namespace com { namespace sun { namespace star { namespace container { class XIndexReplace; } } } }
@@ -264,11 +265,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScStyleObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
-
+    UNO3_GETIMPLEMENTATION_DECL(ScStyleObj)
 };
 
 #endif
diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index 5467c4eb6726..7666c2691249 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/weakref.hxx>
 
@@ -236,10 +237,7 @@ public:
                             getEnd() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScCellTextCursor* getImplementation(const css::uno::Reference< css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScCellTextCursor)
 };
 
 class ScHeaderFooterTextCursor : public SvxUnoTextCursor
@@ -265,10 +263,7 @@ public:
                             getEnd() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScHeaderFooterTextCursor* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScHeaderFooterTextCursor)
 };
 
 class ScDrawTextCursor : public SvxUnoTextCursor
@@ -295,10 +290,7 @@ public:
                             getEnd() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScDrawTextCursor* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScDrawTextCursor)
 };
 
 // ScAnnotationTextCursor isn't needed anymore - SvxUnoTextCursor is used instead
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 1846ca6cb844..3546b50fc5ed 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
+#include <comphelper/servicehelper.hxx>
 
 #include "types.hxx"
 
@@ -268,11 +269,7 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
                             // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
-                                    sal_Int8 >& aIdentifier ) override;
-
-    static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
-    static ScTabViewObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
+    UNO3_GETIMPLEMENTATION_DECL(ScTabViewObj)
 
                             // XTypeProvider
     virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 56c711623df0..2ca01d150496 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -26,7 +26,6 @@
 #include <vcl/svapp.hxx>
 #include <svx/unomid.hxx>
 #include <unowids.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <com/sun/star/table/BorderLine.hpp>
 #include <com/sun/star/table/CellVertJustify2.hpp>
@@ -379,36 +378,7 @@ void ScAutoFormatObj::InitFormat( sal_uInt16 nNewIndex )
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScAutoFormatObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScAutoFormatObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScAutoFormatObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScAutoFormatObj::getUnoTunnelId()
-{
-    return theScAutoFormatObjUnoTunnelId::get().getSeq();
-}
-
-ScAutoFormatObj* ScAutoFormatObj::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScAutoFormatObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScAutoFormatObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScAutoFormatObj);
 
 // XTableAutoFormat
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2948db62e5c3..fe61b8b6b5b6 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -42,7 +42,6 @@
 #include <sfx2/bindings.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <float.h>
 
@@ -4067,36 +4066,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScCellRangesBase::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScCellRangesBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScCellRangesBase::getUnoTunnelId()
-{
-    return theScCellRangesBaseUnoTunnelId::get().getSeq();
-}
-
-ScCellRangesBase* ScCellRangesBase::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScCellRangesBase* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScCellRangesBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScCellRangesBase);
 
 typedef std::vector<ScNamedEntry> ScNamedEntryArr_Impl;
 
@@ -8423,37 +8393,7 @@ uno::Sequence<OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScTableSheetObj::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_IntPtr>(this));
-    }
-
-    return ScCellRangeObj::getSomething( rId );
-}
-
-namespace
-{
-    class theScTableSheetObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScTableSheetObj::getUnoTunnelId()
-{
-    return theScTableSheetObjUnoTunnelId::get().getSeq();
-}
-
-ScTableSheetObj* ScTableSheetObj::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScTableSheetObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScTableSheetObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION2_IMPL(ScTableSheetObj, ScCellRangeObj);
 
 ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) :
     ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ),
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index cafc2522bb07..83b69c87480f 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -57,7 +57,6 @@
 #include <dpobject.hxx>
 
 #include <comphelper/extract.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <svx/dataaccessdescriptor.hxx>
 
@@ -740,36 +739,7 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScSubTotalDescriptorBase )
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScSubTotalDescriptorBase::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScSubTotalDescriptorBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScSubTotalDescriptorBaseUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScSubTotalDescriptorBase::getUnoTunnelId()
-{
-    return theScSubTotalDescriptorBaseUnoTunnelId::get().getSeq();
-}
-
-ScSubTotalDescriptorBase* ScSubTotalDescriptorBase::getImplementation(const uno::Reference<sheet::XSubTotalDescriptor>& rObj)
-{
-    ScSubTotalDescriptorBase* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScSubTotalDescriptorBase*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScSubTotalDescriptorBase);
 
 ScSubTotalDescriptor::ScSubTotalDescriptor()
 {
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index c8baf225cd99..a80a5f48abd6 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -38,7 +38,6 @@
 #include <editeng/editobj.hxx>
 #include <editeng/flditem.hxx>
 #include <comphelper/sequence.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -1284,36 +1283,7 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScEditFieldObj )
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScEditFieldObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScEditFieldObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScEditFieldObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScEditFieldObj::getUnoTunnelId()
-{
-    return theScEditFieldObjUnoTunnelId::get().getSeq();
-}
-
-ScEditFieldObj* ScEditFieldObj::getImplementation(const uno::Reference<text::XTextContent>& xObj)
-{
-    ScEditFieldObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
-    if (xUT.is())
-        pRet = reinterpret_cast<ScEditFieldObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScEditFieldObj);
 
 // XServiceInfo
 
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 4cd31ca6aae9..1e7464858111 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -21,7 +21,6 @@
 
 #include <osl/diagnose.h>
 #include <vcl/svapp.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <com/sun/star/sheet/ConditionOperator2.hpp>
 #include <com/sun/star/sheet/ValidationAlertStyle.hpp>
@@ -453,36 +452,7 @@ sal_Bool SAL_CALL ScTableConditionalFormat::hasByName( const OUString& aName )
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScTableConditionalFormat::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScTableConditionalFormatUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableConditionalFormatUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScTableConditionalFormat::getUnoTunnelId()
-{
-    return theScTableConditionalFormatUnoTunnelId::get().getSeq();
-}
-
-ScTableConditionalFormat* ScTableConditionalFormat::getImplementation(const uno::Reference<sheet::XSheetConditionalEntries>& rObj)
-{
-    ScTableConditionalFormat* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScTableConditionalFormat*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScTableConditionalFormat);
 
 ScTableConditionalEntry::ScTableConditionalEntry(const ScCondFormatEntryItem& aItem) :
     aData( aItem )
@@ -951,35 +921,6 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScTableValidationObj )
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScTableValidationObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScTableValidationObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableValidationObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScTableValidationObj::getUnoTunnelId()
-{
-    return theScTableValidationObjUnoTunnelId::get().getSeq();
-}
-
-ScTableValidationObj* ScTableValidationObj::getImplementation(const uno::Reference<beans::XPropertySet>& rObj)
-{
-    ScTableValidationObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScTableValidationObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScTableValidationObj);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx
index 177c0453f5ee..d7d42b70bddb 100644
--- a/sc/source/ui/unoobj/srchuno.cxx
+++ b/sc/source/ui/unoobj/srchuno.cxx
@@ -20,7 +20,6 @@
 #include <scitems.hxx>
 #include <svl/srchitem.hxx>
 #include <vcl/svapp.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
 
@@ -198,35 +197,6 @@ uno::Sequence<OUString> SAL_CALL ScCellSearchObj::getSupportedServiceNames()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScCellSearchObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScCellSearchObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellSearchObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScCellSearchObj::getUnoTunnelId()
-{
-    return theScCellSearchObjUnoTunnelId::get().getSeq();
-}
-
-ScCellSearchObj* ScCellSearchObj::getImplementation(const uno::Reference<util::XSearchDescriptor>& rObj)
-{
-    ScCellSearchObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScCellSearchObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScCellSearchObj);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 7785d4b984c1..6ef7d575aeb2 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -956,36 +956,7 @@ ScStyleObj::~ScStyleObj()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScStyleObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScStyleObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScStyleObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScStyleObj::getUnoTunnelId()
-{
-    return theScStyleObjUnoTunnelId::get().getSeq();
-}
-
-ScStyleObj* ScStyleObj::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScStyleObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScStyleObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScStyleObj);
 
 void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 5fad23d0df1a..fd35986dcda8 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -613,36 +613,7 @@ uno::Reference<text::XTextRange> SAL_CALL ScCellTextCursor::getEnd()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScCellTextCursor::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_IntPtr>(this));
-    }
-    return SvxUnoTextCursor::getSomething( rId );
-}
-
-namespace
-{
-    class theScCellTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellTextCursorUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScCellTextCursor::getUnoTunnelId()
-{
-    return theScCellTextCursorUnoTunnelId::get().getSeq();
-}
-
-ScCellTextCursor* ScCellTextCursor::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScCellTextCursor* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScCellTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION2_IMPL(ScCellTextCursor, SvxUnoTextCursor);
 
 ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(rtl::Reference<ScHeaderFooterTextObj> const & rText) :
     SvxUnoTextCursor( rText->GetUnoText() ),
@@ -695,37 +666,7 @@ uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getEnd()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScHeaderFooterTextCursor::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_IntPtr>(this));
-    }
-    return SvxUnoTextCursor::getSomething( rId );
-}
-
-namespace
-{
-    class theScHeaderFooterTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScHeaderFooterTextCursorUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScHeaderFooterTextCursor::getUnoTunnelId()
-{
-    return theScHeaderFooterTextCursorUnoTunnelId::get().getSeq();
-}
-
-ScHeaderFooterTextCursor* ScHeaderFooterTextCursor::getImplementation(
-                                const uno::Reference<uno::XInterface>& rObj)
-{
-    ScHeaderFooterTextCursor* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScHeaderFooterTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION2_IMPL(ScHeaderFooterTextCursor, SvxUnoTextCursor);
 
 ScDrawTextCursor::ScDrawTextCursor( const uno::Reference<text::XText>& xParent,
                                     const SvxUnoTextBase& rText ) :
@@ -783,36 +724,7 @@ uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScDrawTextCursor::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_IntPtr>(this));
-    }
-    return SvxUnoTextCursor::getSomething( rId );
-}
-
-namespace
-{
-    class theScDrawTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScDrawTextCursorUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScDrawTextCursor::getUnoTunnelId()
-{
-    return theScDrawTextCursorUnoTunnelId::get().getSeq();
-}
-
-ScDrawTextCursor* ScDrawTextCursor::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScDrawTextCursor* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScDrawTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION2_IMPL(ScDrawTextCursor, SvxUnoTextCursor);
 
 ScSimpleEditSourceHelper::ScSimpleEditSourceHelper()
 {
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index ebf219248295..080d70d4f75b 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -40,7 +40,6 @@
 #include <sfx2/request.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <comphelper/profilezone.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <toolkit/helper/convert.hxx>
@@ -2063,36 +2062,7 @@ uno::Sequence<OUString> SAL_CALL ScTabViewObj::getSupportedServiceNames()
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL ScTabViewObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theScTabViewObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTabViewObjUnoTunnelId> {};
-}
-
-const uno::Sequence<sal_Int8>& ScTabViewObj::getUnoTunnelId()
-{
-    return theScTabViewObjUnoTunnelId::get().getSeq();
-}
-
-ScTabViewObj* ScTabViewObj::getImplementation(const uno::Reference<uno::XInterface>& rObj)
-{
-    ScTabViewObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<ScTabViewObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(ScTabViewObj);
 
 css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL ScTabViewObj::getTransferable()
 {
diff --git a/sfx2/source/control/asyncfunc.cxx b/sfx2/source/control/asyncfunc.cxx
index f27931dcbf09..b64d9f88d78d 100644
--- a/sfx2/source/control/asyncfunc.cxx
+++ b/sfx2/source/control/asyncfunc.cxx
@@ -8,17 +8,9 @@
  */
 
 #include <sfx2/asyncfunc.hxx>
-#include <comphelper/servicehelper.hxx>
 
 #include <com/sun/star/uno/Reference.hxx>
 
-namespace
-{
-class theAsyncFuncUnoTunnelId : public rtl::Static<UnoTunnelIdInit, theAsyncFuncUnoTunnelId>
-{
-};
-}
-
 AsyncFunc::AsyncFunc(const std::function<void()>& rAsyncFunc)
     : m_pAsyncFunc(rAsyncFunc)
 {
@@ -32,32 +24,7 @@ void AsyncFunc::Execute()
         m_pAsyncFunc();
 }
 
-const css::uno::Sequence<sal_Int8>& AsyncFunc::getUnoTunnelId()
-{
-    return theAsyncFuncUnoTunnelId::get().getSeq();
-}
-
-AsyncFunc* AsyncFunc::getImplementation(const css::uno::Reference<css::uno::XInterface>& xInterface)
-{
-    css::uno::Reference<css::lang::XUnoTunnel> xUnoTunnel(xInterface, css::uno::UNO_QUERY);
-    if (xUnoTunnel.is())
-    {
-        return reinterpret_cast<AsyncFunc*>(xUnoTunnel->getSomething(AsyncFunc::getUnoTunnelId()));
-    }
-
-    return nullptr;
-}
-
 //XUnoTunnel
-sal_Int64 SAL_CALL AsyncFunc::getSomething(const css::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_IntPtr>(this));
-    }
-
-    return 0;
-}
+UNO3_GETIMPLEMENTATION_IMPL(AsyncFunc)
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx
index a7d3b7907ff4..4ac35a90f94b 100644
--- a/svl/source/numbers/numuno.cxx
+++ b/svl/source/numbers/numuno.cxx
@@ -18,8 +18,6 @@
  */
 
 
-#include <comphelper/servicehelper.hxx>
-
 #include <svl/numuno.hxx>
 #include "numfmuno.hxx"
 #include <svl/zforlist.hxx>
@@ -87,38 +85,6 @@ uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNum
 
 // XUnoTunnel
 
-sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::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_IntPtr>(this));
-    }
-    return 0;
-}
-
-namespace
-{
-    class theSvNumberFormatsSupplierObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvNumberFormatsSupplierObjUnoTunnelId > {};
-}
-
-// static
-const uno::Sequence<sal_Int8>& SvNumberFormatsSupplierObj::getUnoTunnelId()
-{
-    return theSvNumberFormatsSupplierObjUnoTunnelId::get().getSeq();
-}
-
-// static
-SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation(
-                                const uno::Reference<util::XNumberFormatsSupplier>& rObj )
-{
-    SvNumberFormatsSupplierObj* pRet = nullptr;
-    uno::Reference<lang::XUnoTunnel> xUT(rObj, uno::UNO_QUERY);
-    if (xUT.is())
-        pRet = reinterpret_cast<SvNumberFormatsSupplierObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( getUnoTunnelId() )));
-    return pRet;
-}
+UNO3_GETIMPLEMENTATION_IMPL(SvNumberFormatsSupplierObj);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 1a15f61459db..832852576472 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -57,7 +57,6 @@
 #include <svx/svdview.hxx>
 #include <tools/diagnose_ex.h>
 #include <cppuhelper/queryinterface.hxx>
-#include <comphelper/servicehelper.hxx>
 #include "AccessibleEmptyEditSource.hxx"
 
 #include <algorithm>
@@ -1002,43 +1001,7 @@ void SAL_CALL
 }
 
 // lang::XUnoTunnel
-namespace
-{
-    class theAccessibleShapeImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleShapeImplementationId > {};
-}
-
-const uno::Sequence< sal_Int8 >&
-    AccessibleShape::getUnoTunnelImplementationId()
-    throw()
-{
-    return theAccessibleShapeImplementationId::get().getSeq();
-}
-
-
-AccessibleShape*
-    AccessibleShape::getImplementation( const uno::Reference< uno::XInterface >& rxIFace )
-    throw()
-{
-    uno::Reference< lang::XUnoTunnel >  xTunnel( rxIFace, uno::UNO_QUERY );
-    AccessibleShape*                    pReturn = nullptr;
-
-    if( xTunnel.is() )
-        pReturn = reinterpret_cast< AccessibleShape* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) );
-
-    return pReturn;
-}
-
-
-sal_Int64 SAL_CALL
-    AccessibleShape::getSomething( const uno::Sequence< sal_Int8 >& rIdentifier )
-{
-    sal_Int64 nReturn( 0 );
-
-    if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) )
-        nReturn = reinterpret_cast< sal_Int64 >( this );
-
-    return nReturn;
-}
+UNO3_GETIMPLEMENTATION_IMPL(AccessibleShape)
 
 // IAccessibleViewForwarderListener
 void AccessibleShape::ViewForwarderChanged()
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 86946e76cdec..6863595afb0b 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -50,7 +50,6 @@
 #include <comphelper/processfactory.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/sequence.hxx>
-#include <comphelper/servicehelper.hxx>
 #include <comphelper/types.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/typeprovider.hxx>
@@ -1079,43 +1078,7 @@ FmXGridPeer::~FmXGridPeer()
     setColumns(Reference< XIndexContainer > ());
 }
 
-namespace
-{
-    class theFmXGridPeerImplementationId : public rtl::Static< UnoTunnelIdInit, theFmXGridPeerImplementationId > {};
-}
-
-const Sequence< sal_Int8 >& FmXGridPeer::getUnoTunnelImplementationId() throw()
-{
-    return theFmXGridPeerImplementationId::get().getSeq();
-}
-
-
-FmXGridPeer* FmXGridPeer::getImplementation( const Reference< XInterface >& _rxIFace ) throw()
-{
-    FmXGridPeer* pReturn = nullptr;
-    Reference< XUnoTunnel >  xTunnel(_rxIFace, UNO_QUERY);
-    if (xTunnel.is())
-        pReturn = reinterpret_cast<FmXGridPeer*>(xTunnel->getSomething(getUnoTunnelImplementationId()));
-
-    return pReturn;
-}
-
-
-sal_Int64 SAL_CALL FmXGridPeer::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
-{
-    sal_Int64 nReturn(0);
-
-    if  (   (_rIdentifier.getLength() == 16)
-        &&  (0 == memcmp( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
-        )
-    {
-        nReturn = reinterpret_cast<sal_Int64>(this);
-    }
-    else
-        nReturn = VCLXWindow::getSomething(_rIdentifier);
-
-    return nReturn;
-}
+UNO3_GETIMPLEMENTATION2_IMPL(FmXGridPeer, VCLXWindow);
 
 // XEventListener
 
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: */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 96ad4ac3c8fe..20b7ba4dac9f 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -176,34 +176,7 @@ uno::Sequence< OUString > SAL_CALL SecurityEnvironment_MSCryptImpl::getSupported
 }
 
 /* XUnoTunnel */
-sal_Int64 SAL_CALL SecurityEnvironment_MSCryptImpl::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
-{
-    if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
-        return reinterpret_cast<sal_Int64>(this);
-    }
-    return 0 ;
-}
-
-/* XUnoTunnel extension */
-
-
-namespace
-{
-    class theSecurityEnvironment_MSCryptImplUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSecurityEnvironment_MSCryptImplUnoTunnelId > {};
-}
-
-const uno::Sequence< sal_Int8>& SecurityEnvironment_MSCryptImpl::getUnoTunnelId() {
-    return theSecurityEnvironment_MSCryptImplUnoTunnelId::get().getSeq();
-}
-
-/* XUnoTunnel extension */
-SecurityEnvironment_MSCryptImpl* SecurityEnvironment_MSCryptImpl::getImplementation( const uno::Reference< XInterface >& rObj ) {
-    uno::Reference< XUnoTunnel > xUT( rObj , uno::UNO_QUERY ) ;
-    if( xUT.is() ) {
-        return reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xUT->getSomething( getUnoTunnelId() ));
-    } else
-        return nullptr ;
-}
+UNO3_GETIMPLEMENTATION_IMPL(SecurityEnvironment_MSCryptImpl);
 
 HCRYPTPROV SecurityEnvironment_MSCryptImpl::getCryptoProvider() {
     return m_hProv ;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index 2d7c1e49bc8e..7064cda138e5 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -27,6 +27,7 @@
 #include <wincrypt.h>
 #include <sal/config.h>
 #include <rtl/ustring.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <com/sun/star/uno/Exception.hpp>
@@ -124,10 +125,7 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper<
         virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 
         //Methods from XUnoTunnel
-        virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
-
-        static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
-        static SecurityEnvironment_MSCryptImpl* getImplementation( const css::uno::Reference< css::uno::XInterface >& rObj ) ;
+        UNO3_GETIMPLEMENTATION_DECL(SecurityEnvironment_MSCryptImpl)
 
         /// @throws css::uno::Exception
         /// @throws css::uno::RuntimeException
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 17c8eea1b71b..8f161d3df2c0 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -448,32 +448,7 @@ void X509Certificate_MSCryptImpl::setRawCert( Sequence< sal_Int8 > const & rawCe
 }
 
 /* XUnoTunnel */
-sal_Int64 SAL_CALL X509Certificate_MSCryptImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) {
-    if( aIdentifier.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), aIdentifier.getConstArray(), 16 ) ) {
-        return reinterpret_cast<sal_Int64>(this);
-    }
-    return 0 ;
-}
-
-/* XUnoTunnel extension */
-
-namespace
-{
-    class theX509Certificate_MSCryptImplUnoTunnelId  : public rtl::Static< UnoTunnelIdInit, theX509Certificate_MSCryptImplUnoTunnelId > {};
-}
-
-const Sequence< sal_Int8>& X509Certificate_MSCryptImpl::getUnoTunnelId() {
-    return theX509Certificate_MSCryptImplUnoTunnelId::get().getSeq();
-}
-
-/* XUnoTunnel extension */
-X509Certificate_MSCryptImpl* X509Certificate_MSCryptImpl::getImplementation( const Reference< XInterface >& rObj ) {
-    Reference< XUnoTunnel > xUT( rObj , UNO_QUERY ) ;
-    if( xUT.is() ) {
-        return reinterpret_cast<X509Certificate_MSCryptImpl*>(xUT->getSomething( getUnoTunnelId() ));
-    } else
-        return nullptr ;
-}
+UNO3_GETIMPLEMENTATION_IMPL(X509Certificate_MSCryptImpl);
 
 static OUString findOIDDescription(char const *oid)
 {
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
index d19cd4611934..225d5f6bd5a8 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.hxx
@@ -29,6 +29,7 @@
 #include <rtl/ustring.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -73,7 +74,7 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
         virtual sal_Int32 SAL_CALL getCertificateUsage( ) override;
 
         //Methods from XUnoTunnel
-        virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
+        UNO3_GETIMPLEMENTATION_DECL(X509Certificate_MSCryptImpl)
 
         /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
         virtual css::uno::Sequence<sal_Int8> getSHA256Thumbprint() override;
@@ -81,9 +82,6 @@ class X509Certificate_MSCryptImpl : public ::cppu::WeakImplHelper<
         /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
         virtual svl::crypto::SignatureMethodAlgorithm getSignatureMethodAlgorithm() override;
 
-        static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
-        static X509Certificate_MSCryptImpl* getImplementation( const css::uno::Reference< css::uno::XInterface >& rObj ) ;
-
         //Helper methods
         void setMswcryCert( const CERT_CONTEXT* cert ) ;
         const CERT_CONTEXT* getMswcryCert() const ;


More information about the Libreoffice-commits mailing list