diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-14 08:19:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-15 06:07:36 +0200 |
commit | 05bc93db2de56000f65764d7e394d03747cac23d (patch) | |
tree | 975de9ae83572aac8a5c3ea8db281e1017ee5be0 /sfx2 | |
parent | 8cbb414ed737f9ffc76e1258e6671769bf63fc6c (diff) |
Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1
The header got some changes:
1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace
2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace
of uses of OImplementationId with it, including in XTypeProvider
3. Introduce convenience functions 'getSomething_cast' to cast between
sal_Int64 and object pointers uniformly.
4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make
it a bit shorter, and to reflect its function better. Templatize it
to take also css::uno::Any for convenience.
5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it
handle cases both with and without fallback to parent.
6. Adjust UNO3_GETIMPLEMENTATION_* macros
TODO (in separate commits):
- Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation
- Replace all uses of OImplementationId in core with UnoIdInit
- Deprecate OImplementationId in <cppuhelper/typeprovider.hxx>
- Change implementations of getSomething to use getSomethingImpl
- Revise uses of getSomething to use getFromUnoTunnel
Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailviewacc.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 613b8cf0f7b7..111f39ec5593 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1732,7 +1732,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c aEvent.ExecutePosition.Y = aPos.Y(); xPopupController->setPopupMenu( xPopupMenu ); - VCLXMenu* pAwtMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ); + VCLXMenu* pAwtMenu = comphelper::getFromUnoTunnel<VCLXMenu>( xPopupMenu ); PopupMenu* pVCLMenu = static_cast< PopupMenu* >( pAwtMenu->GetMenu() ); if (comphelper::LibreOfficeKit::isActive()) { diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index 468a93cf66f6..cc0fdd592617 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -48,7 +48,7 @@ ThumbnailViewAcc::~ThumbnailViewAcc() const uno::Sequence< sal_Int8 >& ThumbnailViewAcc::getUnoTunnelId() { - static const UnoTunnelIdInit theSfxValueSetAccUnoTunnelId; + static const comphelper::UnoIdInit theSfxValueSetAccUnoTunnelId; return theSfxValueSetAccUnoTunnelId.getSeq(); } @@ -57,7 +57,7 @@ ThumbnailViewAcc* ThumbnailViewAcc::getImplementation( const uno::Reference< uno { try { - return comphelper::getUnoTunnelImplementation<ThumbnailViewAcc>(rxData); + return comphelper::getFromUnoTunnel<ThumbnailViewAcc>(rxData); } catch(const css::uno::Exception&) { @@ -441,7 +441,7 @@ sal_Int64 SAL_CALL ThumbnailViewAcc::getSomething( const uno::Sequence< sal_Int8 { sal_Int64 nRet; - if( isUnoTunnelId<ThumbnailViewAcc>(rId) ) + if( comphelper::isUnoTunnelId<ThumbnailViewAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; @@ -548,7 +548,7 @@ void ThumbnailViewAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOld const uno::Sequence< sal_Int8 >& ThumbnailViewItemAcc::getUnoTunnelId() { - static const UnoTunnelIdInit theValueItemAccUnoTunnelId; + static const comphelper::UnoIdInit theValueItemAccUnoTunnelId; return theValueItemAccUnoTunnelId.getSeq(); } @@ -557,7 +557,7 @@ ThumbnailViewItemAcc* ThumbnailViewItemAcc::getImplementation( const uno::Refere { try { - return comphelper::getUnoTunnelImplementation<ThumbnailViewItemAcc>(rxData); + return comphelper::getFromUnoTunnel<ThumbnailViewItemAcc>(rxData); } catch(const css::uno::Exception&) { @@ -873,7 +873,7 @@ sal_Int64 SAL_CALL ThumbnailViewItemAcc::getSomething( const uno::Sequence< sal_ { sal_Int64 nRet; - if( isUnoTunnelId<ThumbnailViewItemAcc>(rId) ) + if( comphelper::isUnoTunnelId<ThumbnailViewItemAcc>(rId) ) nRet = reinterpret_cast< sal_Int64 >( this ); else nRet = 0; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 5da675a3dcb4..b38383e23a8f 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -626,7 +626,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) css::uno::Reference< css::uno::XInterface > xInterface; const SfxUnoAnyItem* pUnoAny = pReq->GetArg<SfxUnoAnyItem>(FN_PARAM_2); AsyncFunc* pAsyncFunc = pUnoAny && (pUnoAny->GetValue() >>= xInterface ) ? - comphelper::getUnoTunnelImplementation<AsyncFunc>(xInterface) : nullptr; + comphelper::getFromUnoTunnel<AsyncFunc>(xInterface) : nullptr; if (pAsyncFunc) pAsyncFunc->Execute(); @@ -2063,7 +2063,7 @@ void SfxObjectShell::SignScriptingContent(weld::Window* pDialogParent) const uno::Sequence<sal_Int8>& SfxObjectShell::getUnoTunnelId() { - static const UnoTunnelIdInit theSfxObjectShellUnoTunnelId; + static const comphelper::UnoIdInit theSfxObjectShellUnoTunnelId; return theSfxObjectShellUnoTunnelId.getSeq(); } |