diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-13 11:29:37 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-15 06:08:14 +0200 |
commit | 3f65724ec5fc92d5a0078a99932358ef7091435c (patch) | |
tree | 94dd9bf1d0ecd42dbf7f94db45bc7e1bf29b83ce | |
parent | 6444b026b4039458d01ada5fee58eae98166585b (diff) |
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4
- Change implementations of getSomething to use getSomethingImpl
Or where that's impossible, use getSomething_cast to unify this and
reduce number of places where we reinterpret_cast.
All static methods getting tunnel ids were renamed to getUnoTunnelId,
to comply with the convention used in <comphelper/servicehelper.hxx>.
TODO (in separate commits):
- Revise uses of getSomething to use getFromUnoTunnel
Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
126 files changed, 184 insertions, 598 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index 891dd74b757e..50a600e3cbef 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -34,7 +34,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> -#include <cppuhelper/typeprovider.hxx> using namespace ::comphelper; using namespace ::com::sun::star; @@ -141,10 +140,7 @@ namespace sal_Int64 SAL_CALL OToolBoxWindowItem::getSomething( const Sequence< sal_Int8 >& _rId ) { - if (comphelper::isUnoTunnelId<OToolBoxWindowItem>(_rId)) - return reinterpret_cast< sal_Int64>( this ); - - return 0; + return comphelper::getSomethingImpl(_rId, this); } } diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 4f365409c3fc..71d4ab97e9e2 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -2090,15 +2090,7 @@ void SAL_CALL AnimationNode::removeChangesListener( const Reference< XChangesLis // XUnoTunnel ::sal_Int64 SAL_CALL AnimationNode::getSomething( const Sequence< ::sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<AnimationNode>(rId) ) - { - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); - - } - else - { - return 0; - } + return comphelper::getSomethingImpl(rId, this); } const css::uno::Sequence< sal_Int8 > & AnimationNode::getUnoTunnelId() diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 499bb55c1504..6c150f3e0abf 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1204,12 +1204,7 @@ sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlav // ____ XUnoTunnel ___ ::sal_Int64 SAL_CALL ChartView::getSomething( const uno::Sequence< ::sal_Int8 >& aIdentifier ) { - if( comphelper::isUnoTunnelId<ExplicitValueProvider>(aIdentifier) ) - { - ExplicitValueProvider* pProvider = this; - return reinterpret_cast<sal_Int64>(pProvider); - } - return 0; + return comphelper::getSomethingImpl<ExplicitValueProvider>(aIdentifier, this); } // lang::XServiceInfo diff --git a/comphelper/source/misc/accimplaccess.cxx b/comphelper/source/misc/accimplaccess.cxx index d663a2bd8116..be8065725636 100644 --- a/comphelper/source/misc/accimplaccess.cxx +++ b/comphelper/source/misc/accimplaccess.cxx @@ -19,7 +19,6 @@ #include <comphelper/accimplaccess.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <string.h> @@ -48,10 +47,7 @@ namespace comphelper sal_Int64 SAL_CALL OAccessibleImplementationAccess::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - if (comphelper::isUnoTunnelId<OAccessibleImplementationAccess>(_rIdentifier)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(_rIdentifier, this); } } // namespace comphelper diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 28ef91000fb1..816262d3f812 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -2162,7 +2162,7 @@ rtl::Reference< ChildAccess > Access::getFreeSetMember( if (tunnel.is()) { freeAcc.set( reinterpret_cast< ChildAccess * >( - tunnel->getSomething(ChildAccess::getTunnelId()))); + tunnel->getSomething(ChildAccess::getUnoTunnelId()))); } if (!freeAcc.is() || freeAcc->getParentAccess().is() || (freeAcc->isInTransaction() && diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index 221a98e24f67..87def984be17 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -55,7 +55,7 @@ namespace configmgr { -css::uno::Sequence< sal_Int8 > const & ChildAccess::getTunnelId() +css::uno::Sequence< sal_Int8 > const & ChildAccess::getUnoTunnelId() { static const comphelper::UnoIdInit theChildAccessUnoTunnelId; return theChildAccessUnoTunnelId.getSeq(); @@ -164,8 +164,7 @@ sal_Int64 ChildAccess::getSomething( assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); - return aIdentifier == getTunnelId() - ? reinterpret_cast< sal_Int64 >(this) : 0; + return comphelper::getSomethingImpl(aIdentifier, this); } void ChildAccess::bind( diff --git a/configmgr/source/childaccess.hxx b/configmgr/source/childaccess.hxx index 2c0eabfcaa4e..d063a28c9c9c 100644 --- a/configmgr/source/childaccess.hxx +++ b/configmgr/source/childaccess.hxx @@ -52,7 +52,7 @@ class ChildAccess: public css::lang::XUnoTunnel { public: - static css::uno::Sequence< sal_Int8 > const & getTunnelId(); + static css::uno::Sequence< sal_Int8 > const & getUnoTunnelId(); ChildAccess( Components & components, rtl::Reference< RootAccess > const & root, diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx index 614c91b7440b..264002e5dc57 100644 --- a/connectivity/source/commontools/ConnectionWrapper.cxx +++ b/connectivity/source/commontools/ConnectionWrapper.cxx @@ -25,7 +25,6 @@ #include <comphelper/servicehelper.hxx> #include <comphelper/hash.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/reflection/ProxyFactory.hpp> #include <algorithm> @@ -155,7 +154,7 @@ Sequence< Type > SAL_CALL OConnectionWrapper::getTypes( ) sal_Int64 SAL_CALL OConnectionWrapper::getSomething( const Sequence< sal_Int8 >& rId ) { if (comphelper::isUnoTunnelId<OConnectionWrapper>(rId)) - return reinterpret_cast< sal_Int64 >( this ); + return comphelper::getSomething_cast(this); if(m_xUnoTunnel.is()) return m_xUnoTunnel->getSomething(rId); diff --git a/connectivity/source/commontools/TConnection.cxx b/connectivity/source/commontools/TConnection.cxx index e15b5ad464d9..25997b512a3e 100644 --- a/connectivity/source/commontools/TConnection.cxx +++ b/connectivity/source/commontools/TConnection.cxx @@ -18,7 +18,6 @@ */ #include <TConnection.hxx> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <connectivity/dbexception.hxx> @@ -57,9 +56,7 @@ void OMetaConnection::disposing() //XUnoTunnel sal_Int64 SAL_CALL OMetaConnection::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - return (comphelper::isUnoTunnelId<OMetaConnection>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : sal_Int64(0); + return comphelper::getSomethingImpl(rId, this); } Sequence< sal_Int8 > OMetaConnection::getUnoTunnelId() diff --git a/connectivity/source/drivers/ado/AColumn.cxx b/connectivity/source/drivers/ado/AColumn.cxx index 5315f858c7b2..98b4c899595a 100644 --- a/connectivity/source/drivers/ado/AColumn.cxx +++ b/connectivity/source/drivers/ado/AColumn.cxx @@ -24,7 +24,6 @@ #include <ado/AColumn.hxx> #include <ado/AConnection.hxx> #include <ado/Awrapado.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <comphelper/extract.hxx> #include <comphelper/servicehelper.hxx> @@ -89,9 +88,8 @@ Sequence< sal_Int8 > OAdoColumn::getUnoTunnelId() sal_Int64 OAdoColumn::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoColumn>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OColumn_ADO::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OColumn_ADO>{}); } void OAdoColumn::construct() diff --git a/connectivity/source/drivers/ado/AConnection.cxx b/connectivity/source/drivers/ado/AConnection.cxx index 394fe0ed3666..19276dfac73c 100644 --- a/connectivity/source/drivers/ado/AConnection.cxx +++ b/connectivity/source/drivers/ado/AConnection.cxx @@ -33,7 +33,6 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <connectivity/dbexception.hxx> #include <osl/file.hxx> #include <strings.hrc> @@ -490,11 +489,8 @@ void OConnection::disposing() sal_Int64 SAL_CALL OConnection::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - return comphelper::isUnoTunnelId<OConnection>(rId) - ? - reinterpret_cast< sal_Int64 >( this ) - : - OConnection_BASE::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OConnection_BASE>{}); } Sequence< sal_Int8 > OConnection::getUnoTunnelId() diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx index 2504616a9f6d..f4ed2b12adbc 100644 --- a/connectivity/source/drivers/ado/AGroup.cxx +++ b/connectivity/source/drivers/ado/AGroup.cxx @@ -21,7 +21,6 @@ #include <ado/AGroup.hxx> #include <ado/AUsers.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <ado/AConnection.hxx> @@ -92,9 +91,8 @@ Sequence< sal_Int8 > OAdoGroup::getUnoTunnelId() sal_Int64 OAdoGroup::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoGroup>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OGroup_ADO::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OGroup_ADO>{}); } diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx index 44d562bfea61..6b58900893b8 100644 --- a/connectivity/source/drivers/ado/AIndex.cxx +++ b/connectivity/source/drivers/ado/AIndex.cxx @@ -20,7 +20,6 @@ #include <ado/AIndex.hxx> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> -#include <cppuhelper/typeprovider.hxx> #include <ado/AColumns.hxx> #include <TConnection.hxx> #include <comphelper/servicehelper.hxx> @@ -81,9 +80,8 @@ Sequence< sal_Int8 > OAdoIndex::getUnoTunnelId() sal_Int64 OAdoIndex::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoIndex>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : sdbcx::OIndex::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<sdbcx::OIndex>{}); } void SAL_CALL OAdoIndex::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx index d27d93e8ce3f..35e121c6bb7a 100644 --- a/connectivity/source/drivers/ado/AKey.cxx +++ b/connectivity/source/drivers/ado/AKey.cxx @@ -21,7 +21,6 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <ado/AColumns.hxx> #include <ado/AConnection.hxx> @@ -77,9 +76,8 @@ Sequence< sal_Int8 > OAdoKey::getUnoTunnelId() sal_Int64 OAdoKey::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoKey>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OKey_ADO::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OKey_ADO>{}); } void OAdoKey::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx index d656dad7ff45..12280d9bc002 100644 --- a/connectivity/source/drivers/ado/ATable.cxx +++ b/connectivity/source/drivers/ado/ATable.cxx @@ -31,7 +31,6 @@ #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbcx/KeyType.hpp> #include <com/sun/star/sdbc/KeyRule.hpp> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <ado/Awrapado.hxx> @@ -138,9 +137,8 @@ Sequence< sal_Int8 > OAdoTable::getUnoTunnelId() sal_Int64 OAdoTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoTable>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OTable_TYPEDEF::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{}); } // XRename diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx index da73707489ae..09585ed81e44 100644 --- a/connectivity/source/drivers/ado/AUser.cxx +++ b/connectivity/source/drivers/ado/AUser.cxx @@ -21,7 +21,6 @@ #include <ado/ACatalog.hxx> #include <ado/AGroups.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <ado/AConnection.hxx> @@ -76,9 +75,8 @@ Sequence< sal_Int8 > OAdoUser::getUnoTunnelId() sal_Int64 OAdoUser::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoUser>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OUser_TYPEDEF::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OUser_TYPEDEF>{}); } diff --git a/connectivity/source/drivers/ado/AView.cxx b/connectivity/source/drivers/ado/AView.cxx index 32ed99a112ff..15f6a5cc9a6d 100644 --- a/connectivity/source/drivers/ado/AView.cxx +++ b/connectivity/source/drivers/ado/AView.cxx @@ -20,7 +20,6 @@ #include <ado/AView.hxx> #include <com/sun/star/lang/DisposedException.hpp> #include <ado/adoimp.hxx> -#include <cppuhelper/typeprovider.hxx> #include <ado/Awrapado.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> @@ -51,9 +50,8 @@ Sequence< sal_Int8 > OAdoView::getUnoTunnelId() sal_Int64 OAdoView::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OAdoView>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OView_ADO::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OView_ADO>{}); } diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx index 676ffa051371..8e37cdd99071 100644 --- a/connectivity/source/drivers/calc/CTable.cxx +++ b/connectivity/source/drivers/calc/CTable.cxx @@ -41,7 +41,6 @@ #include <rtl/math.hxx> #include <tools/time.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> using namespace connectivity; using namespace connectivity::calc; @@ -620,9 +619,8 @@ Sequence< sal_Int8 > OCalcTable::getUnoTunnelId() sal_Int64 OCalcTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (comphelper::isUnoTunnelId<OCalcTable>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : OCalcTable_BASE::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OCalcTable_BASE>{}); } bool OCalcTable::fetchRow( OValueRefRow& _rRow, const OSQLColumns & _rCols, diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 0c269bf847d6..ca2e3e107e1a 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -30,7 +30,6 @@ #include <unotools/ucbhelper.hxx> #include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> -#include <cppuhelper/typeprovider.hxx> #include <connectivity/dbexception.hxx> #include <dbase/DResultSet.hxx> #include <strings.hrc> @@ -110,9 +109,8 @@ Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelId() sal_Int64 ODbaseIndex::getSomething( const Sequence< sal_Int8 > & rId ) { - return (comphelper::isUnoTunnelId<ODbaseIndex>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : ODbaseIndex_BASE::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<ODbaseIndex_BASE>{}); } ONDXPagePtr const & ODbaseIndex::getRoot() diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 32b599e03129..8ffb7775af4b 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -43,7 +43,6 @@ #include <unotools/tempfile.hxx> #include <unotools/ucbhelper.hxx> #include <comphelper/types.hxx> -#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/queryinterface.hxx> #include <connectivity/dbtools.hxx> @@ -741,9 +740,8 @@ Sequence< sal_Int8 > ODbaseTable::getUnoTunnelId() sal_Int64 ODbaseTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (comphelper::isUnoTunnelId<ODbaseTable>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : ODbaseTable_BASE::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<ODbaseTable_BASE>{}); } bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData) diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx index 4d28d218bca6..0fba732c9f04 100644 --- a/connectivity/source/drivers/file/FConnection.cxx +++ b/connectivity/source/drivers/file/FConnection.cxx @@ -21,7 +21,6 @@ #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <file/FConnection.hxx> #include <file/FDatabaseMetaData.hxx> #include <file/FDriver.hxx> @@ -401,9 +400,7 @@ Reference< XDynamicResultSet > OConnection::getDir() const sal_Int64 SAL_CALL OConnection::getSomething( const Sequence< sal_Int8 >& rId ) { - return (comphelper::isUnoTunnelId<OConnection>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : sal_Int64(0); + return comphelper::getSomethingImpl(rId, this); } Sequence< sal_Int8 > OConnection::getUnoTunnelId() diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 13a678656fae..0a4040ddc590 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1390,9 +1390,7 @@ Sequence< sal_Int8 > OResultSet::getUnoTunnelId() sal_Int64 OResultSet::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OResultSet>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : 0; + return comphelper::getSomethingImpl(rId, this); } void OResultSet::setBoundedColumns(const OValueRefRow& _rRow, diff --git a/connectivity/source/drivers/file/FTable.cxx b/connectivity/source/drivers/file/FTable.cxx index 6a6c10886c89..d56b5f86f969 100644 --- a/connectivity/source/drivers/file/FTable.cxx +++ b/connectivity/source/drivers/file/FTable.cxx @@ -23,7 +23,6 @@ #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <unotools/ucbstreamhelper.hxx> using namespace connectivity; @@ -129,9 +128,8 @@ Sequence< sal_Int8 > OFileTable::getUnoTunnelId() sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return comphelper::isUnoTunnelId<OFileTable>(rId) - ? reinterpret_cast< sal_Int64 >( this ) - : OTable_TYPEDEF::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{}); } void OFileTable::FileClose() diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index a4ed730c896c..7122d80b7a15 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -47,7 +47,6 @@ #include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/typeprovider.hxx> #include <unotools/tempfile.hxx> #include <unotools/localfilehelper.hxx> @@ -382,7 +381,7 @@ Reference< XClob> Connection::createClob(ISC_QUAD const * pBlobId) // virtual sal_Int64 SAL_CALL Connection::getSomething(const css::uno::Sequence<sal_Int8>& rId) { - return (comphelper::isUnoTunnelId<Connection>(rId)) ? reinterpret_cast<sal_Int64>(this) : sal_Int64(0); + return comphelper::getSomethingImpl(rId, this); } // static diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index efc24d3bed4b..ea47022d026f 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -30,7 +30,6 @@ #include <tools/solar.h> #include <tools/urlobj.hxx> #include <cppuhelper/queryinterface.hxx> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/numbers.hxx> #include <comphelper/servicehelper.hxx> #include <com/sun/star/util/NumberFormat.hpp> @@ -561,9 +560,8 @@ Sequence< sal_Int8 > OFlatTable::getUnoTunnelId() sal_Int64 OFlatTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (comphelper::isUnoTunnelId<OFlatTable>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : OFlatTable_BASE::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OFlatTable_BASE>{}); } bool OFlatTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool bRetrieveData) diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index 21179a69778f..a60898eb44f4 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -18,7 +18,6 @@ */ #include <hsqldb/HTable.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <comphelper/property.hxx> @@ -126,9 +125,8 @@ Sequence< sal_Int8 > OHSQLTable::getUnoTunnelId() sal_Int64 OHSQLTable::getSomething( const Sequence< sal_Int8 > & rId ) { - return (comphelper::isUnoTunnelId<OHSQLTable>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : OTable_TYPEDEF::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{}); } // XAlterTable diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx index 83a8cb2081af..54b8915cab63 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx @@ -19,7 +19,6 @@ #include <mysql/YTable.hxx> #include <mysql/YTables.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <comphelper/property.hxx> @@ -127,8 +126,8 @@ Sequence<sal_Int8> OMySQLTable::getUnoTunnelId() sal_Int64 OMySQLTable::getSomething(const Sequence<sal_Int8>& rId) { - return (comphelper::isUnoTunnelId<OMySQLTable>(rId)) ? reinterpret_cast<sal_Int64>(this) - : OTable_TYPEDEF::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTable_TYPEDEF>{}); } // XAlterTable diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx index 8248973a80af..2f76fc4a09d0 100644 --- a/connectivity/source/drivers/writer/WTable.cxx +++ b/connectivity/source/drivers/writer/WTable.cxx @@ -31,7 +31,6 @@ #include <connectivity/sdbcx/VColumn.hxx> #include <sal/log.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> namespace com::sun::star::text { @@ -219,8 +218,8 @@ uno::Sequence<sal_Int8> OWriterTable::getUnoTunnelId() sal_Int64 OWriterTable::getSomething(const uno::Sequence<sal_Int8>& rId) { - return (comphelper::isUnoTunnelId<OWriterTable>(rId)) ? reinterpret_cast<sal_Int64>(this) - : OWriterTable_BASE::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OWriterTable_BASE>{}); } bool OWriterTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns& _rCols, bool bRetrieveData) diff --git a/connectivity/source/sdbcx/VDescriptor.cxx b/connectivity/source/sdbcx/VDescriptor.cxx index 4741b5896612..9023a2076a74 100644 --- a/connectivity/source/sdbcx/VDescriptor.cxx +++ b/connectivity/source/sdbcx/VDescriptor.cxx @@ -46,9 +46,7 @@ namespace connectivity::sdbcx // css::lang::XUnoTunnel sal_Int64 SAL_CALL ODescriptor::getSomething( const Sequence< sal_Int8 >& rId ) { - return (comphelper::isUnoTunnelId<ODescriptor>(rId)) - ? reinterpret_cast< sal_Int64 >( this ) - : 0; + return comphelper::getSomethingImpl(rId, this); } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 22369333205a..fb10287e9d3f 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -437,10 +437,7 @@ void SAL_CALL ORowSet::release() noexcept // css::XUnoTunnel sal_Int64 SAL_CALL ORowSet::getSomething( const Sequence< sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ORowSet>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } Sequence< sal_Int8 > ORowSet::getUnoTunnelId() @@ -2907,10 +2904,7 @@ Sequence< sal_Int8 > ORowSetClone::getUnoTunnelId() // css::XUnoTunnel sal_Int64 SAL_CALL ORowSetClone::getSomething( const Sequence< sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ORowSetClone>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue) diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index 9cf3538de89c..60cbce747e01 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -26,7 +26,6 @@ #include <osl/diagnose.h> #include <sal/log.hxx> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/property.hxx> #include <comphelper/servicehelper.hxx> #include <com/sun/star/sdbc/SQLException.hpp> @@ -452,7 +451,7 @@ OUString SAL_CALL ODBTableDecorator::getName() sal_Int64 SAL_CALL ODBTableDecorator::getSomething( const Sequence< sal_Int8 >& rId ) { if (comphelper::isUnoTunnelId<ODBTableDecorator>(rId)) - return reinterpret_cast<sal_Int64>(this); + return comphelper::getSomething_cast(this); sal_Int64 nRet = 0; Reference<XUnoTunnel> xTunnel(m_xTable,UNO_QUERY); diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx index 012efe81793f..9a70092512e0 100644 --- a/dbaccess/source/core/api/querydescriptor.cxx +++ b/dbaccess/source/core/api/querydescriptor.cxx @@ -22,7 +22,6 @@ #include <stringconstants.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> using namespace ::com::sun::star::uno; @@ -140,10 +139,7 @@ OQueryDescriptor_Base::~OQueryDescriptor_Base() sal_Int64 SAL_CALL OQueryDescriptor_Base::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - if (comphelper::isUnoTunnelId<OQueryDescriptor_Base>(_rIdentifier)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(_rIdentifier, this); } css::uno::Sequence<sal_Int8> OQueryDescriptor_Base::getUnoTunnelId() diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 11ca5852b99a..f11008555ca9 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -26,7 +26,6 @@ #include "CIndexes.hxx" #include <osl/diagnose.h> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/servicehelper.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sdbc/SQLException.hpp> @@ -296,13 +295,8 @@ void SAL_CALL ODBTable::alterColumnByName( const OUString& _rName, const Referen sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet(0); - if (comphelper::isUnoTunnelId<ODBTable>(rId)) - nRet = reinterpret_cast<sal_Int64>(this); - else - nRet = OTable_Base::getSomething(rId); - - return nRet; + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTable_Base>{}); } Sequence< sal_Int8 > ODBTable::getUnoTunnelId() diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 0cb510dc3dd5..1035a2e6260a 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -33,7 +33,6 @@ #include <ucbhelper/contentidentifier.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <tools/diagnose_ex.h> #include <apitools.hxx> #include <sdbcoretools.hxx> @@ -545,10 +544,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent // css::lang::XUnoTunnel sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId ) { - if (comphelper::isUnoTunnelId<OContentHelper>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } Reference< XInterface > SAL_CALL OContentHelper::getParent( ) diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index d47fa88c3f16..79c657db3054 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -52,7 +52,6 @@ #include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/weak.hxx> #include <rtl/uri.hxx> @@ -709,10 +708,7 @@ void ODatabaseContext::databaseDocumentURLChange( const OUString& _rOldURL, cons sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ODatabaseContext>(rId)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(rId, this); } Sequence< sal_Int8 > ODatabaseContext::getUnoTunnelId() diff --git a/dbaccess/source/ui/querydesign/JoinExchange.cxx b/dbaccess/source/ui/querydesign/JoinExchange.cxx index 051fbd8c4928..9a06fa7ab488 100644 --- a/dbaccess/source/ui/querydesign/JoinExchange.cxx +++ b/dbaccess/source/ui/querydesign/JoinExchange.cxx @@ -20,7 +20,6 @@ #include <JoinExchange.hxx> #include <sot/formats.hxx> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> namespace dbaui { @@ -70,10 +69,7 @@ namespace dbaui sal_Int64 SAL_CALL OJoinExchObj::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - if (comphelper::isUnoTunnelId<OJoinExchObj>(_rIdentifier)) - return reinterpret_cast<sal_Int64>(this); - - return 0; + return comphelper::getSomethingImpl(_rIdentifier, this); } void OJoinExchObj::AddSupportedFormats() diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index efe9165ea647..0e1dab6db253 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -237,11 +237,7 @@ const css::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() noexcep sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SvxUnoTextField>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) noexcept diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 7696a5dbd648..3ad90c4709c3 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2141,14 +2141,8 @@ const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SvxUnoTextBase>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - else - { - return SvxUnoTextRangeBase::getSomething( rId ); - } + return comphelper::getSomethingImpl( + rId, this, comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>{}); } SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) noexcept @@ -2215,14 +2209,8 @@ const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SvxUnoText>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - else - { - return SvxUnoTextBase::getSomething( rId ); - } + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>{}); } diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 3834d4098170..6122bdd6a156 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -35,6 +35,7 @@ #include <comphelper/multicontainer2.hxx> #include <comphelper/mimeconfighelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/windowserrorstring.hxx> #include <osl/file.hxx> #include <rtl/ref.hxx> @@ -1705,7 +1706,7 @@ sal_Int64 SAL_CALL OleComponent::getSomething( const css::uno::Sequence< sal_Int { uno::Sequence < sal_Int8 > aCLSID = GetCLSID(); if ( MimeConfigurationHelper::ClassIDsEqual( aIdentifier, aCLSID ) ) - return reinterpret_cast<sal_Int64>(static_cast<IUnknown*>(m_pNativeImpl->m_pObj)); + return comphelper::getSomething_cast(static_cast<IUnknown*>(m_pNativeImpl->m_pObj)); // compatibility hack for old versions: CLSID was used in wrong order (SvGlobalName order) sal_Int32 nLength = aIdentifier.getLength(); diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx index 0dbe216cc506..b92b99768912 100644 --- a/forms/source/component/Columns.cxx +++ b/forms/source/component/Columns.cxx @@ -119,7 +119,7 @@ sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence<sal_Int8>& _rIdenti if ( comphelper::isUnoTunnelId<OGridColumn>(_rIdentifier) ) { - nReturn = reinterpret_cast<sal_Int64>(this); + nReturn = comphelper::getSomething_cast(this); } else { diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx index 84c103ae6a2b..7498a4a9d2b8 100644 --- a/forms/source/richtext/richtextmodel.cxx +++ b/forms/source/richtext/richtextmodel.cxx @@ -29,7 +29,6 @@ #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/guarding.hxx> #include <comphelper/servicehelper.hxx> #include <svl/itempool.hxx> @@ -549,7 +548,7 @@ namespace frm sal_Int64 SAL_CALL ORichTextModel::getSomething( const Sequence< sal_Int8 >& _rId ) { if (comphelper::isUnoTunnelId<ORichTextModel>(_rId)) - return reinterpret_cast< sal_Int64 >( m_pEngine.get() ); + return comphelper::getSomething_cast(m_pEngine.get()); // Note returning a different type Reference< XUnoTunnel > xAggTunnel; if ( query_aggregation( m_xAggregate, xAggTunnel ) ) diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index 0d8add6108d0..3b6983f05daf 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -53,7 +53,6 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> using namespace com::sun::star::xml::xpath; using namespace com::sun::star::xml::dom::events; @@ -1168,7 +1167,7 @@ void Binding::handleEvent( const css::uno::Reference<css::xml::dom::events::XEve sal_Int64 Binding::getSomething( const css::uno::Sequence<sal_Int8>& xId ) { - return reinterpret_cast<sal_Int64>( ( xId == getUnoTunnelId() ) ? this : nullptr ); + return comphelper::getSomethingImpl(xId, this); } diff --git a/forms/source/xforms/model.cxx b/forms/source/xforms/model.cxx index 0668028f5af8..d5bf2182abe7 100644 --- a/forms/source/xforms/model.cxx +++ b/forms/source/xforms/model.cxx @@ -35,8 +35,8 @@ #include <tools/debug.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <algorithm> @@ -589,7 +589,7 @@ void Model::update() sal_Int64 Model::getSomething( const css::uno::Sequence<sal_Int8>& xId ) { - return reinterpret_cast<sal_Int64>( ( xId == getUnoTunnelId() ) ? this : nullptr ); + return comphelper::getSomethingImpl(xId, this); } Sequence<sal_Int8> Model::getImplementationId() diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index 909ce530bc9e..c33f1fc39f58 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -44,7 +44,6 @@ #include <com/sun/star/xforms/InvalidDataOnSubmitException.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/interaction.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> @@ -367,7 +366,7 @@ void SAL_CALL Submission::setName( const OUString& sID ) sal_Int64 SAL_CALL Submission::getSomething( const Sequence<sal_Int8>& aId ) { - return ( aId == getUnoTunnelId() ) ? reinterpret_cast<sal_Int64>(this) : 0; + return comphelper::getSomethingImpl(aId, this); } diff --git a/framework/inc/classes/imagewrapper.hxx b/framework/inc/classes/imagewrapper.hxx index 54b2ee404fcc..eea43c4e0394 100644 --- a/framework/inc/classes/imagewrapper.hxx +++ b/framework/inc/classes/imagewrapper.hxx @@ -39,7 +39,7 @@ class ImageWrapper final : public ::cppu::WeakImplHelper< css::awt::XBitmap, return m_aImage; } - static css::uno::Sequence< sal_Int8 > const & GetUnoTunnelId(); + static css::uno::Sequence<sal_Int8> const& getUnoTunnelId(); // XBitmap virtual css::awt::Size SAL_CALL getSize() override; diff --git a/framework/inc/classes/rootactiontriggercontainer.hxx b/framework/inc/classes/rootactiontriggercontainer.hxx index 601d7c6bcc09..151a7c7338d4 100644 --- a/framework/inc/classes/rootactiontriggercontainer.hxx +++ b/framework/inc/classes/rootactiontriggercontainer.hxx @@ -78,6 +78,7 @@ class RootActionTriggerContainer final : public PropertySetContainer, // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static const css::uno::Sequence<sal_Int8>& getUnoTunnelId() noexcept; // XTypeProvider virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; diff --git a/framework/source/fwe/classes/imagewrapper.cxx b/framework/source/fwe/classes/imagewrapper.cxx index b95bbbc34e01..978ef77a474f 100644 --- a/framework/source/fwe/classes/imagewrapper.cxx +++ b/framework/source/fwe/classes/imagewrapper.cxx @@ -18,6 +18,7 @@ */ #include <classes/imagewrapper.hxx> +#include <comphelper/servicehelper.hxx> #include <vcl/svapp.hxx> #include <vcl/bitmapex.hxx> #include <vcl/BitmapTools.hxx> @@ -45,10 +46,7 @@ ImageWrapper::~ImageWrapper() { } -Sequence< sal_Int8 > const & ImageWrapper::GetUnoTunnelId() -{ - return impl_getStaticIdentifier(); -} +Sequence<sal_Int8> const& ImageWrapper::getUnoTunnelId() { return impl_getStaticIdentifier(); } // XBitmap css::awt::Size SAL_CALL ImageWrapper::getSize() @@ -80,10 +78,7 @@ Sequence< sal_Int8 > SAL_CALL ImageWrapper::getMaskDIB() // XUnoTunnel sal_Int64 SAL_CALL ImageWrapper::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if ( aIdentifier == impl_getStaticIdentifier() ) - return reinterpret_cast< sal_Int64 >( this ); - else - return 0; + return comphelper::getSomethingImpl(aIdentifier, this); } } diff --git a/framework/source/fwe/classes/rootactiontriggercontainer.cxx b/framework/source/fwe/classes/rootactiontriggercontainer.cxx index 0732959d1a80..f49cf9c70c5e 100644 --- a/framework/source/fwe/classes/rootactiontriggercontainer.cxx +++ b/framework/source/fwe/classes/rootactiontriggercontainer.cxx @@ -21,6 +21,7 @@ #include <classes/actiontriggercontainer.hxx> #include <classes/actiontriggerpropertyset.hxx> #include <classes/actiontriggerseparatorpropertyset.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/typeprovider.hxx> @@ -36,7 +37,7 @@ using namespace com::sun::star::beans; namespace framework { -static Sequence< sal_Int8 > const & impl_getStaticIdentifier() +const css::uno::Sequence<sal_Int8>& RootActionTriggerContainer::getUnoTunnelId() noexcept { static const sal_uInt8 pGUID[16] = { 0x17, 0x0F, 0xA2, 0xC9, 0xCA, 0x50, 0x4A, 0xD3, 0xA6, 0x3B, 0x39, 0x99, 0xC5, 0x96, 0x43, 0x27 }; static css::uno::Sequence< sal_Int8 > seqID(reinterpret_cast<const sal_Int8*>(pGUID), 16); @@ -211,10 +212,7 @@ Sequence< OUString > SAL_CALL RootActionTriggerContainer::getSupportedServiceNam // XUnoTunnel sal_Int64 SAL_CALL RootActionTriggerContainer::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if ( aIdentifier == impl_getStaticIdentifier() ) - return reinterpret_cast< sal_Int64 >( this ); - else - return 0; + return comphelper::getSomethingImpl(aIdentifier, this); } // XTypeProvider diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index ac9f9c41a3ff..9cff941e23c3 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -155,7 +155,7 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer if ( xUnoTunnel.is() ) { // Try to get implementation pointer through XUnoTunnel - sal_Int64 nPointer = xUnoTunnel->getSomething( ImageWrapper::GetUnoTunnelId() ); + sal_Int64 nPointer = xUnoTunnel->getSomething( ImageWrapper::getUnoTunnelId() ); if ( nPointer ) { // This is our own optimized implementation of menu images! diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx index 8c39d7ee763d..ef76a51e5cc0 100644 --- a/framework/source/fwi/uielement/constitemcontainer.cxx +++ b/framework/source/fwi/uielement/constitemcontainer.cxx @@ -162,11 +162,7 @@ Reference< XIndexAccess > ConstItemContainer::deepCopyContainer( const Reference // XUnoTunnel sal_Int64 ConstItemContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( comphelper::isUnoTunnelId<ConstItemContainer>(rIdentifier) ) - { - return reinterpret_cast< sal_Int64 >( this ); - } - return 0; + return comphelper::getSomethingImpl(rIdentifier, this); } const Sequence< sal_Int8 >& ConstItemContainer::getUnoTunnelId() noexcept diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx index 2dacda65fe3b..480c5b23d7b9 100644 --- a/framework/source/fwi/uielement/rootitemcontainer.cxx +++ b/framework/source/fwi/uielement/rootitemcontainer.cxx @@ -141,9 +141,7 @@ Reference< XIndexAccess > RootItemContainer::deepCopyContainer( const Reference< // XUnoTunnel sal_Int64 RootItemContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( comphelper::isUnoTunnelId<RootItemContainer>(rIdentifier) ) - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - return 0; + return comphelper::getSomethingImpl(rIdentifier, this); } const Sequence< sal_Int8 >& RootItemContainer::getUnoTunnelId() noexcept diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 4b220862c0e3..491a942e206c 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -60,7 +60,6 @@ #include <com/sun/star/xml/crypto/DigestID.hpp> #include <com/sun/star/xml/crypto/CipherID.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/typeprovider.hxx> #include <rtl/uri.hxx> #include <rtl/random.h> #include <osl/diagnose.h> @@ -1682,9 +1681,7 @@ Sequence< sal_Int8 > ZipPackage::getUnoTunnelId() sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if ( comphelper::isUnoTunnelId<ZipPackage>(aIdentifier) ) - return reinterpret_cast < sal_Int64 > ( this ); - return 0; + return comphelper::getSomethingImpl(aIdentifier, this); } uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo() diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 1c9207b1c09a..4c94a78abed9 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -30,7 +30,6 @@ #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <osl/diagnose.h> #include <sal/log.hxx> #include <rtl/digest.h> @@ -344,10 +343,7 @@ void ZipPackageFolder::saveContents( sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - sal_Int64 nMe = 0; - if ( comphelper::isUnoTunnelId<ZipPackageFolder>(aIdentifier) ) - nMe = reinterpret_cast < sal_Int64 > ( this ); - return nMe; + return comphelper::getSomethingImpl(aIdentifier, this); } void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) { diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 3facbb48addf..2b3bf5b5e7e3 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -50,7 +50,6 @@ #include <comphelper/storagehelper.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <rtl/random.h> #include <sal/log.hxx> @@ -1107,10 +1106,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream( sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - sal_Int64 nMe = 0; - if ( comphelper::isUnoTunnelId<ZipPackageStream>(aIdentifier) ) - nMe = reinterpret_cast < sal_Int64 > ( this ); - return nMe; + return comphelper::getSomethingImpl(aIdentifier, this); } // XPropertySet diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx index 3bca5c232a11..daef59488cc2 100644 --- a/pyuno/source/module/pyuno_adapter.cxx +++ b/pyuno/source/module/pyuno_adapter.cxx @@ -29,7 +29,6 @@ #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/typeprovider.hxx> using com::sun::star::beans::XIntrospectionAccess; @@ -75,9 +74,7 @@ Sequence<sal_Int8> Adapter::getUnoTunnelId() sal_Int64 Adapter::getSomething( const Sequence< sal_Int8 > &id) { - if (comphelper::isUnoTunnelId<Adapter>(id)) - return reinterpret_cast<sal_Int64>(this); - return 0; + return comphelper::getSomethingImpl(id, this); } void raiseInvocationTargetExceptionWhenNeeded( const Runtime &runtime ) diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 4d9f078827f7..6c0892ceecc3 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -97,7 +97,6 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <comphelper/types.hxx> #include <dbaccess/dbaundomanager.hxx> #include <editeng/paperinf.hxx> @@ -1938,7 +1937,7 @@ sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int { sal_Int64 nRet = 0; if (comphelper::isUnoTunnelId<OReportDefinition>(rId) ) - nRet = reinterpret_cast<sal_Int64>(this); + nRet = comphelper::getSomething_cast(this); else { uno::Reference< lang::XUnoTunnel> xUnoTunnel(m_pImpl->m_xNumberFormatsSupplier,uno::UNO_QUERY); diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index b3255bc290e0..bed193b3242f 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -20,7 +20,6 @@ #include <comphelper/enumhelper.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> #include <com/sun/star/report/XReportComponent.hpp> #include <com/sun/star/report/ForceNewPage.hpp> #include <com/sun/star/lang/NoSupportException.hpp> @@ -567,7 +566,7 @@ sal_Bool SAL_CALL OSection::hasForms() sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) { if (comphelper::isUnoTunnelId<OSection>(rId) ) - return reinterpret_cast<sal_Int64>(this); + return comphelper::getSomething_cast(this); return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0; } diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index ed18de670554..180571472da5 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -743,14 +743,8 @@ const css::uno::Sequence< sal_Int8 >& ScDrawTransferObj::getUnoTunnelId() sal_Int64 SAL_CALL ScDrawTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - if( comphelper::isUnoTunnelId<ScDrawTransferObj>(rId) ) - { - nRet = reinterpret_cast< sal_Int64 >( this ); - } - else - nRet = TransferDataContainer::getSomething(rId); - return nRet; + return comphelper::getSomethingImpl( + rId, this, comphelper::FallbackToGetSomethingOf<TransferDataContainer>{}); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index a9bc88b03e83..9a3d12059945 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -928,14 +928,8 @@ const css::uno::Sequence< sal_Int8 >& ScTransferObj::getUnoTunnelId() sal_Int64 SAL_CALL ScTransferObj::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - if( comphelper::isUnoTunnelId<ScTransferObj>(rId) ) - { - nRet = reinterpret_cast< sal_Int64 >( this ); - } - else - nRet = TransferDataContainer::getSomething(rId); - return nRet; + return comphelper::getSomethingImpl( + rId, this, comphelper::FallbackToGetSomethingOf<TransferDataContainer>{}); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 1ce82e6bc1d0..e5f058f8aaa8 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -980,11 +980,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotDescriptorBase::getDataLayoutFi sal_Int64 SAL_CALL ScDataPilotDescriptorBase::getSomething( const Sequence<sal_Int8 >& rId ) { - if ( comphelper::isUnoTunnelId<ScDataPilotDescriptorBase>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } const Sequence<sal_Int8>& ScDataPilotDescriptorBase::getUnoTunnelId() diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 2f814cd37f3e..96b2e03e06a2 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -3094,12 +3094,12 @@ sal_Int64 SAL_CALL ScModelObj::getSomething( { if ( comphelper::isUnoTunnelId<ScModelObj>(rId) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + return comphelper::getSomething_cast(this); } if ( comphelper::isUnoTunnelId<SfxObjectShell>(rId) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(pDocShell )); + return comphelper::getSomething_cast(pDocShell); } // aggregated number formats supplier has XUnoTunnel, too diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index f1b439cb54cb..b327ef6bab0a 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -426,11 +426,7 @@ uno::Sequence<OUString> SAL_CALL ScNamedRangeObj::getSupportedServiceNames() sal_Int64 SAL_CALL ScNamedRangeObj::getSomething( const uno::Sequence<sal_Int8 >& rId ) { - if ( comphelper::isUnoTunnelId<ScNamedRangeObj>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } const uno::Sequence<sal_Int8>& ScNamedRangeObj::getUnoTunnelId() diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index bb1135ac3d87..683f85f8cdfc 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -135,11 +135,7 @@ uno::Reference<text::XText> SAL_CALL ScHeaderFooterContentObj::getRightText() sal_Int64 SAL_CALL ScHeaderFooterContentObj::getSomething( const uno::Sequence<sal_Int8 >& rId ) { - if ( comphelper::isUnoTunnelId<ScHeaderFooterContentObj>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } const uno::Sequence<sal_Int8>& ScHeaderFooterContentObj::getUnoTunnelId() diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index 07e35344a371..cabe2fe375e8 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -408,9 +408,9 @@ ScVbaWorkbook::getCodeName() sal_Int64 ScVbaWorkbook::getSomething(const uno::Sequence<sal_Int8 >& rId ) { - if (comphelper::isUnoTunnelId<ScVbaWorksheet>(rId)) + if (comphelper::isUnoTunnelId<ScVbaWorksheet>(rId)) // ??? { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + return comphelper::getSomething_cast(this); } return 0; } diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index ef5c851ed938..1cdc1c111b97 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -1039,11 +1039,7 @@ ScVbaWorksheet::PrintOut( const uno::Any& From, const uno::Any& To, const uno::A sal_Int64 SAL_CALL ScVbaWorksheet::getSomething(const uno::Sequence<sal_Int8 > & rId) { - if (comphelper::isUnoTunnelId<ScVbaWorksheet>(rId)) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index ea67e78c6adc..eb8bef68b8dd 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -710,18 +710,7 @@ void SdTransferable::SetPageBookmarks( const std::vector<OUString> &rPageBookmar sal_Int64 SAL_CALL SdTransferable::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if( comphelper::isUnoTunnelId<SdTransferable>(rId) ) - { - nRet = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - else - { - nRet = 0; - } - - return nRet; + return comphelper::getSomethingImpl(rId, this); } void SdTransferable::AddUserData (const std::shared_ptr<UserData>& rpData) diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index e4ce13798207..2b8a6142ef0b 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -114,16 +114,8 @@ void SdPageObjsTLV::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction ) sal_Int64 SAL_CALL SdPageObjsTLV::SdPageObjsTransferable::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if (comphelper::isUnoTunnelId<SdPageObjsTLV::SdPageObjsTransferable>(rId)) - { - nRet = static_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - else - nRet = SdTransferable::getSomething(rId); - - return nRet; + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SdTransferable>{}); } const css::uno::Sequence<sal_Int8>& SdPageObjsTLV::SdPageObjsTransferable::getUnoTunnelId() diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index bbf081c85c16..ffbb5e001d4e 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -146,14 +146,7 @@ const Sequence<sal_Int8>& Pane::getUnoTunnelId() sal_Int64 SAL_CALL Pane::getSomething (const Sequence<sal_Int8>& rId) { - sal_Int64 nResult = 0; - - if (comphelper::isUnoTunnelId<Pane>(rId)) - { - nResult = reinterpret_cast<sal_Int64>(this); - } - - return nResult; + return comphelper::getSomethingImpl(rId, this); } Reference<rendering::XCanvas> Pane::CreateCanvas() diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index a689f8882842..d5604e79d5cb 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -219,14 +219,7 @@ const Sequence<sal_Int8>& ViewShellWrapper::getUnoTunnelId() sal_Int64 SAL_CALL ViewShellWrapper::getSomething (const Sequence<sal_Int8>& rId) { - sal_Int64 nResult = 0; - - if (comphelper::isUnoTunnelId<ViewShellWrapper>(rId)) - { - nResult = reinterpret_cast<sal_Int64>(this); - } - - return nResult; + return comphelper::getSomethingImpl(rId, this); } //===== awt::XWindowListener ================================================== diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index 1c95efb35646..65b67839958e 100644 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -101,6 +101,9 @@ public: */ std::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const; + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId) override; + protected: virtual void AddSupportedFormats() override; @@ -108,8 +111,6 @@ protected: virtual bool WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override; virtual void ObjectReleased() override final; - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rId ) override; - private: SfxObjectShellRef maDocShellRef; diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 39a763ec8c45..66e1fd142f27 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -561,14 +561,7 @@ const Sequence<sal_Int8>& DrawController::getUnoTunnelId() sal_Int64 SAL_CALL DrawController::getSomething (const Sequence<sal_Int8>& rId) { - sal_Int64 nResult = 0; - - if (comphelper::isUnoTunnelId<DrawController>(rId)) - { - nResult = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - - return nResult; + return comphelper::getSomethingImpl(rId, this); } //===== Properties ============================================================ diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 55d1ff923d92..632be3183bef 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -344,13 +344,11 @@ const css::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() noex sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( comphelper::isUnoTunnelId<SdXImpressDocument>(rIdentifier) ) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + if (comphelper::isUnoTunnelId<SdrModel>(rIdentifier)) + return comphelper::getSomething_cast(mpDoc); - if( comphelper::isUnoTunnelId<SdrModel>(rIdentifier) ) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc)); - - return SfxBaseModel::getSomething( rIdentifier ); + return comphelper::getSomethingImpl(rIdentifier, this, + comphelper::FallbackToGetSomethingOf<SfxBaseModel>{}); } // XTypeProvider diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 9010a31f448d..e9ff103f34e0 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -330,14 +330,8 @@ const css::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() noexc sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SdGenericDrawPage>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - else - { - return SvxFmDrawPage::getSomething( rId ); - } + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvxFmDrawPage>{}); } SdGenericDrawPage::SdGenericDrawPage(SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet) diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index 92bfd880ad55..da624e6094ba 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -281,14 +281,7 @@ const Sequence<sal_Int8>& ViewTabBar::getUnoTunnelId() sal_Int64 SAL_CALL ViewTabBar::getSomething (const Sequence<sal_Int8>& rId) { - sal_Int64 nResult = 0; - - if (comphelper::isUnoTunnelId<ViewTabBar>(rId)) - { - nResult = reinterpret_cast<sal_Int64>(this); - } - - return nResult; + return comphelper::getSomethingImpl(rId, this); } bool ViewTabBar::ActivatePage(size_t nIndex) diff --git a/sfx2/inc/unoctitm.hxx b/sfx2/inc/unoctitm.hxx index d68b707e369f..a88a64c261ef 100644 --- a/sfx2/inc/unoctitm.hxx +++ b/sfx2/inc/unoctitm.hxx @@ -91,7 +91,7 @@ public: // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override ; - static const css::uno::Sequence< sal_Int8 >& impl_getStaticIdentifier(); + static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); static bool IsMasterUnoCommand( const css::util::URL& aURL ); static OUString GetMasterUnoCommand( const css::util::URL& aURL ); diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 26d6926016e7..9feef5f541f0 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -1532,7 +1532,7 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, std::unique_ptr<SfxPoolI SfxOfficeDispatch* pDisp = nullptr; if ( xTunnel.is() ) { - sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier()); + sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::getUnoTunnelId()); pDisp = reinterpret_cast< SfxOfficeDispatch* >( sal::static_int_cast< sal_IntPtr >( nImplementation )); } diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx index 38e26b055059..bae714699bc2 100644 --- a/sfx2/source/control/sfxstatuslistener.cxx +++ b/sfx2/source/control/sfxstatuslistener.cxx @@ -146,7 +146,7 @@ void SAL_CALL SfxStatusListener::statusChanged( const FeatureStateEvent& rEvent) SfxOfficeDispatch* pDisp = nullptr; if ( xTunnel.is() ) { - sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier()); + sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::getUnoTunnelId()); pDisp = reinterpret_cast< SfxOfficeDispatch* >(sal::static_int_cast< sal_IntPtr >( nImplementation )); } diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 5bf5a27f3d88..e24650cc0d35 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -266,7 +266,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons SfxOfficeDispatch* pDisp = nullptr; if ( xTunnel.is() ) { - sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier()); + sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::getUnoTunnelId()); pDisp = reinterpret_cast< SfxOfficeDispatch* >(sal::static_int_cast< sal_IntPtr >( nImplementation )); } diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index cc0fdd592617..4c789823dad2 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -439,14 +439,7 @@ void SAL_CALL ThumbnailViewAcc::deselectAccessibleChild( sal_Int32 ) sal_Int64 SAL_CALL ThumbnailViewAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if( comphelper::isUnoTunnelId<ThumbnailViewAcc>(rId) ) - nRet = reinterpret_cast< sal_Int64 >( this ); - else - nRet = 0; - - return nRet; + return comphelper::getSomethingImpl(rId, this); } void SAL_CALL ThumbnailViewAcc::disposing() @@ -871,14 +864,7 @@ sal_Int32 SAL_CALL ThumbnailViewItemAcc::getBackground( ) sal_Int64 SAL_CALL ThumbnailViewItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if( comphelper::isUnoTunnelId<ThumbnailViewItemAcc>(rId) ) - nRet = reinterpret_cast< sal_Int64 >( this ); - else - nRet = 0; - - return nRet; + return comphelper::getSomethingImpl(rId, this); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 125dc88c7bb1..cfce51145f15 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -77,6 +77,7 @@ #include <sal/log.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> +#include <comphelper/servicehelper.hxx> #include <desktop/crashreport.hxx> #include <vcl/threadex.hxx> @@ -164,10 +165,7 @@ void SAL_CALL SfxStatusDispatcher::removeStatusListener( const css::uno::Referen // XUnoTunnel sal_Int64 SAL_CALL SfxOfficeDispatch::getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) { - if ( aIdentifier == impl_getStaticIdentifier() ) - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - else - return 0; + return comphelper::getSomethingImpl(aIdentifier, this); } SfxOfficeDispatch::SfxOfficeDispatch( SfxBindings& rBindings, SfxDispatcher* pDispat, const SfxSlot* pSlot, const css::util::URL& rURL ) @@ -197,7 +195,7 @@ SfxOfficeDispatch::~SfxOfficeDispatch() } } -const css::uno::Sequence< sal_Int8 >& SfxOfficeDispatch::impl_getStaticIdentifier() +const css::uno::Sequence< sal_Int8 >& SfxOfficeDispatch::getUnoTunnelId() { // {38 57 CA 80 09 36 11 d4 83 FE 00 50 04 52 6B 21} static const sal_uInt8 pGUID[16] = { 0x38, 0x57, 0xCA, 0x80, 0x09, 0x36, 0x11, 0xd4, 0x83, 0xFE, 0x00, 0x50, 0x04, 0x52, 0x6B, 0x21 }; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 6903b81709a7..75a5c732eecc 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -80,6 +80,7 @@ #include <vcl/salctype.hxx> #include <vcl/gdimtf.hxx> #include <comphelper/fileformat.h> +#include <comphelper/servicehelper.hxx> #include <comphelper/storagehelper.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/transfer.hxx> @@ -3380,7 +3381,7 @@ sal_Int64 SAL_CALL SfxBaseModel::getSomething( const Sequence< sal_Int8 >& aIden SfxObjectShell *const pObjectShell(GetObjectShell()); if (pObjectShell) { - return reinterpret_cast<sal_Int64>(pObjectShell); + return comphelper::getSomething_cast(pObjectShell); } } diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 494bb186ba03..d9deef15bda5 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -187,7 +187,7 @@ void SAL_CALL SfxStatusBarControl::statusChanged( const frame::FeatureStateEvent SfxOfficeDispatch* pDisp = nullptr; if ( xTunnel.is() ) { - sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier()); + sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::getUnoTunnelId()); pDisp = reinterpret_cast< SfxOfficeDispatch* >(sal::static_int_cast< sal_IntPtr >( nImplementation )); } diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index ff42a28a3be0..8b383e21593b 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -297,7 +297,7 @@ void SAL_CALL SfxToolBoxControl::statusChanged( const FeatureStateEvent& rEvent SfxOfficeDispatch* pDisp = nullptr; if ( xTunnel.is() ) { - sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier()); + sal_Int64 nImplementation = xTunnel->getSomething(SfxOfficeDispatch::getUnoTunnelId()); pDisp = reinterpret_cast< SfxOfficeDispatch* >( sal::static_int_cast< sal_IntPtr >( nImplementation )); } diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index a1e768bd71bd..3ddc86bbc943 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -446,9 +446,8 @@ SmMLExportWrapper::WriteThroughComponentMS(const Reference<XComponent>& xCompone sal_Int64 SAL_CALL SmMLExport::getSomething(const uno::Sequence<sal_Int8>& rId) { - if (comphelper::isUnoTunnelId<SmMLExport>(rId)) - return reinterpret_cast<intptr_t>(this); - return SvXMLExport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvXMLExport>{}); } const uno::Sequence<sal_Int8>& SmMLExport::getUnoTunnelId() noexcept diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index b03f9cefbbdd..1da11b86fc76 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -1213,10 +1213,8 @@ const uno::Sequence<sal_Int8>& SmMLImport::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SmMLImport::getSomething(const uno::Sequence<sal_Int8>& rId) { - if (comphelper::isUnoTunnelId<SmMLImport>(rId)) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - - return SvXMLImport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvXMLImport>{}); } SvXMLImportContext* diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 7e35757536b6..dedd6532f8a5 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -324,10 +324,8 @@ SmXMLExport::SmXMLExport(const css::uno::Reference<css::uno::XComponentContext>& sal_Int64 SAL_CALL SmXMLExport::getSomething(const uno::Sequence<sal_Int8>& rId) { - if (comphelper::isUnoTunnelId<SmXMLExport>(rId)) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - - return SvXMLExport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvXMLExport>{}); } const uno::Sequence<sal_Int8>& SmXMLExport::getUnoTunnelId() noexcept diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index db5426cd927b..e2db20a6d376 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -438,10 +438,8 @@ Math_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext* pCtx, sal_Int64 SAL_CALL SmXMLImport::getSomething(const uno::Sequence<sal_Int8>& rId) { - if (comphelper::isUnoTunnelId<SmXMLImport>(rId)) - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - - return SvXMLImport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvXMLImport>{}); } void SmXMLImport::endDocument() diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index c9f27f4dd082..8dd538c3a326 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -363,12 +363,8 @@ const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SmModel>(rId) ) - { - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - } - - return SfxBaseModel::getSomething( rId ); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SfxBaseModel>{}); } static sal_Int16 lcl_AnyToINT16(const uno::Any& rAny) diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 7c5fc0f224dd..d07cb9c906d5 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -1189,7 +1189,9 @@ void ImplIntrospectionAccess::set(Any& array, sal_Int32 index, const Any& value) // Methods from XUnoTunnel sal_Int64 ImplIntrospectionAccess::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - return Reference<XUnoTunnel>::query( mxIface )->getSomething( aIdentifier ); + if (Reference<XUnoTunnel> xUnoTunnel{ mxIface, css::uno::UNO_QUERY }) + return xUnoTunnel->getSomething(aIdentifier); + return 0; } diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 206b20f10f97..13b3d949027c 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -896,12 +896,7 @@ SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const css::uno::Reference< */ ::sal_Int64 SAL_CALL SfxUnoStyleSheet::getSomething( const css::uno::Sequence< ::sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SfxUnoStyleSheet>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - - return 0; + return comphelper::getSomethingImpl(rId, this); } void diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 8915c319497d..de0873a7aad6 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -395,14 +395,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getBackground( ) sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if( comphelper::isUnoTunnelId<ValueItemAcc>(rId) ) - nRet = reinterpret_cast< sal_Int64 >( this ); - else - nRet = 0; - - return nRet; + return comphelper::getSomethingImpl(rId, this); } void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue ) @@ -914,14 +907,7 @@ void SAL_CALL ValueSetAcc::deselectAccessibleChild( sal_Int32 nChildIndex ) sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if( comphelper::isUnoTunnelId<ValueSetAcc>(rId) ) - nRet = reinterpret_cast< sal_Int64 >( this ); - else - nRet = 0; - - return nRet; + return comphelper::getSomethingImpl(rId, this); } diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index fb932ef7809f..e74ba2df0cb7 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -4405,14 +4405,7 @@ FmXFilterCell::~FmXFilterCell() // XUnoTunnel sal_Int64 SAL_CALL FmXFilterCell::getSomething( const Sequence< sal_Int8 >& _rIdentifier ) { - sal_Int64 nReturn(0); - - if ( comphelper::isUnoTunnelId<FmXFilterCell>(_rIdentifier) ) - { - nReturn = reinterpret_cast<sal_Int64>(this); - } - - return nReturn; + return comphelper::getSomethingImpl(_rIdentifier, this); } const Sequence<sal_Int8>& FmXFilterCell::getUnoTunnelId() diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 1afb2f8fa73a..b900d7a35eed 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -310,14 +310,7 @@ const css::uno::Sequence< sal_Int8 > & SvxShape::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SvxShape::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SvxShape>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - else - { - return 0; - } + return comphelper::getSomethingImpl(rId, this); } diff --git a/sw/source/core/unocore/TextCursorHelper.cxx b/sw/source/core/unocore/TextCursorHelper.cxx index bf522698d051..7c2e10be0189 100644 --- a/sw/source/core/unocore/TextCursorHelper.cxx +++ b/sw/source/core/unocore/TextCursorHelper.cxx @@ -32,11 +32,7 @@ const uno::Sequence< sal_Int8 > & OTextCursorHelper::getUnoTunnelId() sal_Int64 SAL_CALL OTextCursorHelper::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<OTextCursorHelper>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 2fc30b19998d..b1adbc7b5731 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1880,11 +1880,7 @@ const uno::Sequence< sal_Int8 > & SwChartDataSequence::getUnoTunnelId() sal_Int64 SAL_CALL SwChartDataSequence::getSomething( const uno::Sequence< sal_Int8 > &rId ) { - if( comphelper::isUnoTunnelId<SwChartDataSequence>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index e9e2a67e8174..1506cb7fb41f 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -856,7 +856,7 @@ sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId { if( comphelper::isUnoTunnelId<SwXShape>(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); + return comphelper::getSomething_cast(this); } if( m_xShapeAgg.is() ) diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index eb7e22d10a7a..a3cb0ff14d6f 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1167,11 +1167,7 @@ const ::uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId() sal_Int64 SAL_CALL SwXFrame::getSomething( const ::uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXFrame>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index b54b049c9393..7431ffbc06a3 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -780,11 +780,7 @@ const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId() sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXTextPortion>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames() diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index bf2bed1d1a70..b63cce639daf 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -287,11 +287,7 @@ const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXTextPortionEnumeration>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } OUString SwXTextPortionEnumeration::getImplementationName() diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 770ef5d4b879..3c681ae8ff6d 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1027,11 +1027,7 @@ const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId() // return implementation specific data sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) { - if( comphelper::isUnoTunnelId<SwXNumberingRules>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } OUString SwXNumberingRules::getImplementationName() diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index 666e36b73edc..ce3776fd92af 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -353,11 +353,7 @@ const uno::Sequence< sal_Int8 > & SwXTextSearch::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextSearch::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXTextSearch>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } OUString SwXTextSearch::getSearchString() diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 19e0f8d8710e..3182cb2b9ac7 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1215,11 +1215,7 @@ const uno::Sequence<sal_Int8>& SwXStyle::getUnoTunnelId() sal_Int64 SAL_CALL SwXStyle::getSomething(const uno::Sequence<sal_Int8>& rId) { - if(comphelper::isUnoTunnelId<SwXStyle>(rId)) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 92a3aea81a17..e746623f6a06 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -761,12 +761,7 @@ const uno::Sequence< sal_Int8 > & SwXCell::getUnoTunnelId() sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXCell>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - else - return SwXText::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<SwXText>{}); } uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes( ) @@ -1982,11 +1977,7 @@ const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if(comphelper::isUnoTunnelId<SwXTextTable>(rId)) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } @@ -3189,11 +3180,7 @@ const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId() sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXCellRange>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 3ee1856c2a16..f0255f7833f2 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -483,11 +483,8 @@ const Sequence< sal_Int8 > & SwXMLExport::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SwXMLExport::getSomething( const Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXMLExport>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return SvXMLExport::getSomething( rId ); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvXMLExport>{}); } SwDoc* SwXMLExport::getDoc() diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 9e2d709f6d92..6bfdcf0f0698 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -368,11 +368,8 @@ const Sequence< sal_Int8 > & SwXMLImport::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SwXMLImport::getSomething( const Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXMLImport>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } - return SvXMLImport::getSomething( rId ); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<SvXMLImport>{}); } static OTextCursorHelper *lcl_xml_GetSwXTextCursor( const Reference < XTextCursor >& rTextCursor ) diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 9d51e1e29633..f5ed67967644 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -4202,14 +4202,8 @@ const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId() sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - if( comphelper::isUnoTunnelId<SwTransferable>(rId) ) - { - nRet = sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); - } - else - nRet = TransferableHelper::getSomething(rId); - return nRet; + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<TransferableHelper>{}); } SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData ) diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index f1423d00c05a..f93592628c1e 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -212,11 +212,7 @@ const uno::Sequence< sal_Int8 > & SwXAutoTextGroup::getUnoTunnelId() sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXAutoTextGroup>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } SwXAutoTextGroup::SwXAutoTextGroup(const OUString& rName, @@ -674,11 +670,7 @@ const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId() sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXAutoTextEntry>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } SwXAutoTextEntry::SwXAutoTextEntry(SwGlossaries* pGlss, const OUString& rGroupName, diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx index 0e73893d29c0..233b7a868885 100644 --- a/sw/source/uibase/uno/unodispatch.cxx +++ b/sw/source/uibase/uno/unodispatch.cxx @@ -159,11 +159,7 @@ const uno::Sequence< sal_Int8 > & SwXDispatchProviderInterceptor::getUnoTunnelId sal_Int64 SwXDispatchProviderInterceptor::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if( comphelper::isUnoTunnelId<SwXDispatchProviderInterceptor>(aIdentifier) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } - return 0; + return comphelper::getSomethingImpl(aIdentifier, this); } void SwXDispatchProviderInterceptor::Invalidate() diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 83d2499fd32a..403b7d33e3b2 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -279,11 +279,11 @@ sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rI { if( comphelper::isUnoTunnelId<SwXTextDocument>(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return comphelper::getSomething_cast(this); } if( comphelper::isUnoTunnelId<SfxObjectShell>(rId) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(m_pDocShell )); + return comphelper::getSomething_cast(m_pDocShell); } sal_Int64 nRet = SfxBaseModel::getSomething( rId ); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 265a909bc47c..dc24b31c55fd 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1699,11 +1699,8 @@ const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextViewCursor::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SwXTextViewCursor>(rId) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } - return OTextCursorHelper::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf<OTextCursorHelper>{}); } IMPLEMENT_FORWARD_XINTERFACE2(SwXTextViewCursor,SwXTextViewCursor_Base,OTextCursorHelper) diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index 6db45b9ee00a..fa2119d434bc 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -23,7 +23,6 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> namespace toolkit { @@ -285,9 +284,7 @@ namespace toolkit sal_Int64 SAL_CALL GridColumn::getSomething( const Sequence< sal_Int8 >& i_identifier ) { - if ( comphelper::isUnoTunnelId<GridColumn>(i_identifier) ) - return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); - return 0; + return comphelper::getSomethingImpl(i_identifier, this); } diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index c30c5c6b3788..9f62a1ebc241 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -429,10 +429,7 @@ const css::uno::Sequence< sal_Int8 >& UnoControlModel::getUnoTunnelId() noexcept sal_Int64 UnoControlModel::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) { - if( comphelper::isUnoTunnelId<UnoControlModel>(rIdentifier) ) - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); - - return 0; + return comphelper::getSomethingImpl(rIdentifier, this); } // XInterface diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx index 64545d877753..14c5dc454da1 100644 --- a/unoxml/source/dom/node.cxx +++ b/unoxml/source/dom/node.cxx @@ -978,12 +978,7 @@ namespace DOM ::sal_Int64 SAL_CALL CNode::getSomething(Sequence< ::sal_Int8 > const& rId) { - if (comphelper::isUnoTunnelId<CNode>(rId)) - { - return ::sal::static_int_cast< sal_Int64 >( - reinterpret_cast< sal_IntPtr >(this) ); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } } diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 3e8814192dbf..f03164873448 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -25,7 +25,6 @@ #include <impgraph.hxx> #include <com/sun/star/graphic/XGraphic.hpp> #include <comphelper/servicehelper.hxx> -#include <cppuhelper/typeprovider.hxx> #include <graphic/UnoGraphic.hxx> #include <vcl/GraphicExternalLink.hxx> diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx index bfb7fd1853c8..9d6d79532fb8 100644 --- a/vcl/source/graphic/UnoGraphic.cxx +++ b/vcl/source/graphic/UnoGraphic.cxx @@ -184,8 +184,7 @@ uno::Sequence<sal_Int8> SAL_CALL Graphic::getMaskDIB() sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - return( ( comphelper::isUnoTunnelId<::Graphic>(rId) ) ? - reinterpret_cast<sal_Int64>(&maGraphic) : 0 ); + return comphelper::getSomethingImpl(rId, &maGraphic); } diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 23be0750e6bf..5483fb32a4a2 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -517,16 +517,7 @@ void SAL_CALL TransferableHelper::dropActionChanged( const DragSourceDragEvent& sal_Int64 SAL_CALL TransferableHelper::getSomething( const Sequence< sal_Int8 >& rId ) { - sal_Int64 nRet; - - if( comphelper::isUnoTunnelId<TransferableHelper>(rId) ) - { - nRet = sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); - } - else - nRet = 0; - - return nRet; + return comphelper::getSomethingImpl(rId, this); } diff --git a/xmloff/source/core/unoatrcn.cxx b/xmloff/source/core/unoatrcn.cxx index 1745e73f4bf0..9125e6cfb93c 100644 --- a/xmloff/source/core/unoatrcn.cxx +++ b/xmloff/source/core/unoatrcn.cxx @@ -94,11 +94,7 @@ const css::uno::Sequence< sal_Int8 > & SvUnoAttributeContainer::getUnoTunnelId() sal_Int64 SAL_CALL SvUnoAttributeContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SvUnoAttributeContainer>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } // container::XNameAccess diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 4957fad331f8..3c2ae8ea7a61 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -474,11 +474,7 @@ const css::uno::Sequence<sal_Int8>& SvXMLImport::getUnoTunnelId() noexcept // XUnoTunnel sal_Int64 SAL_CALL SvXMLImport::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<SvXMLImport>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } namespace diff --git a/xmloff/source/transform/MutableAttrList.cxx b/xmloff/source/transform/MutableAttrList.cxx index 9373055ab1df..f6fc026ae91b 100644 --- a/xmloff/source/transform/MutableAttrList.cxx +++ b/xmloff/source/transform/MutableAttrList.cxx @@ -67,11 +67,7 @@ const css::uno::Sequence<sal_Int8>& XMLMutableAttributeList::getUnoTunnelId() no sal_Int64 SAL_CALL XMLMutableAttributeList::getSomething( const Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<XMLMutableAttributeList>(rId) ) - { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0; + return comphelper::getSomethingImpl(rId, this); } sal_Int16 SAL_CALL XMLMutableAttributeList::getLength() diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index 243fd6b708db..2a6111ca6256 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1953,12 +1953,7 @@ const css::uno::Sequence<sal_Int8>& OOo2OasisTransformer::getUnoTunnelId() noexc // XUnoTunnel sal_Int64 SAL_CALL OOo2OasisTransformer::getSomething( const Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<OOo2OasisTransformer>(rId) ) - { - return reinterpret_cast< sal_Int64 >( this ); - } - - return sal_Int64(0); + return comphelper::getSomethingImpl(rId, this); } // XServiceInfo diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx index 5c9cd31a9372..3a4516dd621a 100644 --- a/xmloff/source/transform/Oasis2OOo.cxx +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -1952,12 +1952,7 @@ const css::uno::Sequence<sal_Int8>& Oasis2OOoTransformer::getUnoTunnelId() noexc // XUnoTunnel sal_Int64 SAL_CALL Oasis2OOoTransformer::getSomething( const Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId<Oasis2OOoTransformer>(rId) ) - { - return reinterpret_cast< sal_Int64 >( this ); - } - - return sal_Int64(0); + return comphelper::getSomethingImpl(rId, this); } // XServiceInfo diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index 5a6d8d0bc921..523c2d6d959c 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -196,10 +196,7 @@ sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage() /* XUnoTunnel */ sal_Int64 SAL_CALL CertificateImpl::getSomething(const Sequence< sal_Int8 >& aIdentifier) { - if( comphelper::isUnoTunnelId<CertificateImpl>(aIdentifier) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0 ; + return comphelper::getSomethingImpl(aIdentifier, this); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index 792b55763e1f..f7b524da6763 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -93,10 +93,7 @@ SecurityEnvironmentGpg::~SecurityEnvironmentGpg() /* XUnoTunnel */ sal_Int64 SAL_CALL SecurityEnvironmentGpg::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( comphelper::isUnoTunnelId<SecurityEnvironmentGpg>(aIdentifier) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0 ; + return comphelper::getSomethingImpl(aIdentifier, this); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 17bc19ec33bd..f3f22330fb42 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -154,10 +154,7 @@ Sequence< OUString > SAL_CALL SecurityEnvironment_NssImpl::getSupportedServiceNa /* XUnoTunnel */ sal_Int64 SAL_CALL SecurityEnvironment_NssImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( comphelper::isUnoTunnelId<SecurityEnvironment_NssImpl>(aIdentifier) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0 ; + return comphelper::getSomethingImpl(aIdentifier, this); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index 8a0b3f719eef..9aa964fcc917 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -344,10 +344,7 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey() /* XUnoTunnel */ sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const Sequence< sal_Int8 >& aIdentifier ) { - if( comphelper::isUnoTunnelId<X509Certificate_NssImpl>(aIdentifier) ) { - return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this)); - } - return 0 ; + return comphelper::getSomethingImpl(aIdentifier, this); } /* XUnoTunnel extension */ diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx index e1000689bd46..9de3930731ab 100644 --- a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx @@ -22,7 +22,6 @@ #include "xmlelementwrapper_xmlsecimpl.hxx" #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> -#include <cppuhelper/typeprovider.hxx> namespace com::sun::star::uno { class XComponentContext; } @@ -42,12 +41,7 @@ uno::Sequence< sal_Int8 > XMLElementWrapper_XmlSecImpl::getUnoTunnelId() sal_Int64 SAL_CALL XMLElementWrapper_XmlSecImpl::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if (comphelper::isUnoTunnelId<XMLElementWrapper_XmlSecImpl>(aIdentifier)) - { - return reinterpret_cast < sal_Int64 > ( this ); - } - - return 0; + return comphelper::getSomethingImpl(aIdentifier, this); } /* XServiceInfo */ |