diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-06-12 12:18:07 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-08-23 09:10:49 +0200 |
commit | 24c17dab2f10ad1b7ba342fbd40dc65b7d8f9b24 (patch) | |
tree | 5449a884fc53cf66fe1f02dfa21a5abd268bc3c1 /sw/source | |
parent | dd7d90055545cb20aa5c12c0be44cccaefdeac47 (diff) |
tdf#39593 extract UnoTunnelId comparison to template function
Change-Id: Ia2b5dea273c8de7b8c54e74780193a8d4cba7b45
Reviewed-on: https://gerrit.libreoffice.org/73874
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/unocore/TextCursorHelper.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unosrch.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 3 | ||||
-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 | 6 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 10 |
16 files changed, 30 insertions, 68 deletions
diff --git a/sw/source/core/unocore/TextCursorHelper.cxx b/sw/source/core/unocore/TextCursorHelper.cxx index df4a49001ba4..f8bf5dd9a026 100644 --- a/sw/source/core/unocore/TextCursorHelper.cxx +++ b/sw/source/core/unocore/TextCursorHelper.cxx @@ -37,12 +37,10 @@ const uno::Sequence< sal_Int8 > & OTextCursorHelper::getUnoTunnelId() sal_Int64 SAL_CALL OTextCursorHelper::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); - } + if( isUnoTunnelId<OTextCursorHelper>(rId) ) + { + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); + } return 0; } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index db84c2e13a2c..895cf5b7e5c3 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1901,9 +1901,7 @@ const uno::Sequence< sal_Int8 > & SwChartDataSequence::getUnoTunnelId() sal_Int64 SAL_CALL SwChartDataSequence::getSomething( const uno::Sequence< sal_Int8 > &rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwChartDataSequence>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index f3f4dfbf4115..69eefbb45a06 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -850,9 +850,7 @@ const uno::Sequence< sal_Int8 > & SwXShape::getUnoTunnelId() sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXShape>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 2481e6d4b661..5ed7b51c6cc6 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1174,9 +1174,7 @@ const ::uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId() sal_Int64 SAL_CALL SwXFrame::getSomething( const ::uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXFrame>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index e97e65b32f98..3e580633b0ab 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -787,9 +787,7 @@ const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId() sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXTextPortion>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index b80c9d5dd8ac..bf7fca58e5fc 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -310,9 +310,7 @@ const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXTextPortionEnumeration>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); } diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index f58685cd2ba6..2da70bd5cdcc 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -1040,9 +1040,7 @@ const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId() // return implementation specific data sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXNumberingRules>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } @@ -2555,9 +2553,7 @@ const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXTextColumns>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index c324ab47d1b8..603c4063e5d4 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -463,9 +463,7 @@ const uno::Sequence< sal_Int8 > & SwXTextSearch::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextSearch::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXTextSearch>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 57d645baf495..48438301f112 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -773,9 +773,7 @@ const uno::Sequence< sal_Int8 > & SwXCell::getUnoTunnelId() sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXCell>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } @@ -2018,8 +2016,7 @@ const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if(rId.getLength() == 16 - && 0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16)) + if(isUnoTunnelId<SwXTextTable>(rId)) { return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); } @@ -3222,9 +3219,7 @@ const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId() sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXCellRange>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 20457677a024..28745ab2f023 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -489,9 +489,7 @@ const Sequence< sal_Int8 > & SwXMLExport::getUnoTunnelId() throw() sal_Int64 SAL_CALL SwXMLExport::getSomething( const Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXMLExport>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index fcfdd47b6231..1c633585c8d1 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -471,9 +471,7 @@ const Sequence< sal_Int8 > & SwXMLImport::getUnoTunnelId() throw() sal_Int64 SAL_CALL SwXMLImport::getSomething( const Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXMLImport>(rId) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 0d5a46119ab3..a786c4e352b3 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -3898,8 +3898,7 @@ const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId() sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) { sal_Int64 nRet; - if( ( rId.getLength() == 16 ) && - ( 0 == memcmp( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) + if( isUnoTunnelId<SwTransferable>(rId) ) { nRet = sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); } diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx index 4987717d9a25..1e3fe183463b 100644 --- a/sw/source/uibase/uno/unoatxt.cxx +++ b/sw/source/uibase/uno/unoatxt.cxx @@ -222,11 +222,9 @@ const uno::Sequence< sal_Int8 > & SwXAutoTextGroup::getUnoTunnelId() sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXAutoTextGroup>(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } return 0; } @@ -689,11 +687,9 @@ const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId() sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXAutoTextEntry>(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } return 0; } diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx index 40353c7baba3..822b467d35ad 100644 --- a/sw/source/uibase/uno/unodispatch.cxx +++ b/sw/source/uibase/uno/unodispatch.cxx @@ -163,11 +163,9 @@ const uno::Sequence< sal_Int8 > & SwXDispatchProviderInterceptor::getUnoTunnelId sal_Int64 SwXDispatchProviderInterceptor::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) { - if( aIdentifier.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - aIdentifier.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXDispatchProviderInterceptor>(aIdentifier) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } return 0; } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 3299a6f043e9..6dd0738d85d1 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -298,11 +298,9 @@ const Sequence< sal_Int8 > & SwXTextDocument::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + if( isUnoTunnelId<SwXTextDocument>(rId) ) { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); } if( rId.getLength() == 16 && 0 == memcmp( SfxObjectShell::getUnoTunnelId().getConstArray(), diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 9bc4abcfd985..dd04e6f53a5f 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1680,12 +1680,10 @@ const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId() sal_Int64 SAL_CALL SwXTextViewCursor::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( rId.getLength() == 16 - && 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); - } + if( isUnoTunnelId<SwXTextViewCursor>(rId) ) + { + return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this )); + } return OTextCursorHelper::getSomething(rId); } |