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 /sw | |
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 'sw')
-rw-r--r-- | sw/source/core/unocore/TextCursorHelper.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unosrch.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 19 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unoatxt.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/uno/unodispatch.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 7 |
17 files changed, 25 insertions, 97 deletions
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) |