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 /sfx2 | |
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>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/unoctitm.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/bindings.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/sfxstatuslistener.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/statcach.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailviewacc.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/statbar/stbitem.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 2 |
9 files changed, 13 insertions, 28 deletions
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 )); } |