From 09c657ebe69fe1c2516a10a4452996870f4237d2 Mon Sep 17 00:00:00 2001 From: Arkadiy Illarionov Date: Sat, 1 Jun 2019 20:50:37 +0300 Subject: tdf#39593 use UNO3_GETIMPLEMENTATION* macros Change-Id: I4e9af3b43a5baf19e100f42b3f37a2ade89ada5d Reviewed-on: https://gerrit.libreoffice.org/73320 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sc/source/ui/unoobj/afmtuno.cxx | 32 +------------- sc/source/ui/unoobj/cellsuno.cxx | 64 +-------------------------- sc/source/ui/unoobj/datauno.cxx | 32 +------------- sc/source/ui/unoobj/fielduno.cxx | 32 +------------- sc/source/ui/unoobj/fmtuno.cxx | 63 +-------------------------- sc/source/ui/unoobj/srchuno.cxx | 32 +------------- sc/source/ui/unoobj/styleuno.cxx | 31 +------------ sc/source/ui/unoobj/textuno.cxx | 94 ++-------------------------------------- sc/source/ui/unoobj/viewuno.cxx | 32 +------------- 9 files changed, 13 insertions(+), 399 deletions(-) (limited to 'sc/source') diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 56c711623df0..2ca01d150496 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -379,36 +378,7 @@ void ScAutoFormatObj::InitFormat( sal_uInt16 nNewIndex ) // XUnoTunnel -sal_Int64 SAL_CALL ScAutoFormatObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScAutoFormatObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScAutoFormatObjUnoTunnelId> {}; -} - -const uno::Sequence& ScAutoFormatObj::getUnoTunnelId() -{ - return theScAutoFormatObjUnoTunnelId::get().getSeq(); -} - -ScAutoFormatObj* ScAutoFormatObj::getImplementation(const uno::Reference& rObj) -{ - ScAutoFormatObj* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScAutoFormatObj); // XTableAutoFormat diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 2948db62e5c3..fe61b8b6b5b6 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -4067,36 +4066,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScCellRangesBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellRangesBaseUnoTunnelId> {}; -} - -const uno::Sequence& ScCellRangesBase::getUnoTunnelId() -{ - return theScCellRangesBaseUnoTunnelId::get().getSeq(); -} - -ScCellRangesBase* ScCellRangesBase::getImplementation(const uno::Reference& rObj) -{ - ScCellRangesBase* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScCellRangesBase); typedef std::vector ScNamedEntryArr_Impl; @@ -8423,37 +8393,7 @@ uno::Sequence SAL_CALL ScTableSheetObj::getSupportedServiceNames() // XUnoTunnel -sal_Int64 SAL_CALL ScTableSheetObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - - return ScCellRangeObj::getSomething( rId ); -} - -namespace -{ - class theScTableSheetObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableSheetObjUnoTunnelId> {}; -} - -const uno::Sequence& ScTableSheetObj::getUnoTunnelId() -{ - return theScTableSheetObjUnoTunnelId::get().getSeq(); -} - -ScTableSheetObj* ScTableSheetObj::getImplementation(const uno::Reference& rObj) -{ - ScTableSheetObj* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION2_IMPL(ScTableSheetObj, ScCellRangeObj); ScTableColumnObj::ScTableColumnObj( ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab ) : ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol,MAXROW,nTab) ), diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index cafc2522bb07..83b69c87480f 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -57,7 +57,6 @@ #include #include -#include #include #include @@ -740,36 +739,7 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScSubTotalDescriptorBase ) // XUnoTunnel -sal_Int64 SAL_CALL ScSubTotalDescriptorBase::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScSubTotalDescriptorBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScSubTotalDescriptorBaseUnoTunnelId> {}; -} - -const uno::Sequence& ScSubTotalDescriptorBase::getUnoTunnelId() -{ - return theScSubTotalDescriptorBaseUnoTunnelId::get().getSeq(); -} - -ScSubTotalDescriptorBase* ScSubTotalDescriptorBase::getImplementation(const uno::Reference& rObj) -{ - ScSubTotalDescriptorBase* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScSubTotalDescriptorBase); ScSubTotalDescriptor::ScSubTotalDescriptor() { diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index c8baf225cd99..a80a5f48abd6 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -1284,36 +1283,7 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScEditFieldObj ) // XUnoTunnel -sal_Int64 SAL_CALL ScEditFieldObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScEditFieldObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScEditFieldObjUnoTunnelId> {}; -} - -const uno::Sequence& ScEditFieldObj::getUnoTunnelId() -{ - return theScEditFieldObjUnoTunnelId::get().getSeq(); -} - -ScEditFieldObj* ScEditFieldObj::getImplementation(const uno::Reference& xObj) -{ - ScEditFieldObj* pRet = nullptr; - uno::Reference xUT( xObj, uno::UNO_QUERY ); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScEditFieldObj); // XServiceInfo diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 4cd31ca6aae9..1e7464858111 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -453,36 +452,7 @@ sal_Bool SAL_CALL ScTableConditionalFormat::hasByName( const OUString& aName ) // XUnoTunnel -sal_Int64 SAL_CALL ScTableConditionalFormat::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScTableConditionalFormatUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableConditionalFormatUnoTunnelId> {}; -} - -const uno::Sequence& ScTableConditionalFormat::getUnoTunnelId() -{ - return theScTableConditionalFormatUnoTunnelId::get().getSeq(); -} - -ScTableConditionalFormat* ScTableConditionalFormat::getImplementation(const uno::Reference& rObj) -{ - ScTableConditionalFormat* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScTableConditionalFormat); ScTableConditionalEntry::ScTableConditionalEntry(const ScCondFormatEntryItem& aItem) : aData( aItem ) @@ -951,35 +921,6 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScTableValidationObj ) // XUnoTunnel -sal_Int64 SAL_CALL ScTableValidationObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScTableValidationObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTableValidationObjUnoTunnelId> {}; -} - -const uno::Sequence& ScTableValidationObj::getUnoTunnelId() -{ - return theScTableValidationObjUnoTunnelId::get().getSeq(); -} - -ScTableValidationObj* ScTableValidationObj::getImplementation(const uno::Reference& rObj) -{ - ScTableValidationObj* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScTableValidationObj); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx index 177c0453f5ee..d7d42b70bddb 100644 --- a/sc/source/ui/unoobj/srchuno.cxx +++ b/sc/source/ui/unoobj/srchuno.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -198,35 +197,6 @@ uno::Sequence SAL_CALL ScCellSearchObj::getSupportedServiceNames() // XUnoTunnel -sal_Int64 SAL_CALL ScCellSearchObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScCellSearchObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellSearchObjUnoTunnelId> {}; -} - -const uno::Sequence& ScCellSearchObj::getUnoTunnelId() -{ - return theScCellSearchObjUnoTunnelId::get().getSeq(); -} - -ScCellSearchObj* ScCellSearchObj::getImplementation(const uno::Reference& rObj) -{ - ScCellSearchObj* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScCellSearchObj); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 7785d4b984c1..6ef7d575aeb2 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -956,36 +956,7 @@ ScStyleObj::~ScStyleObj() // XUnoTunnel -sal_Int64 SAL_CALL ScStyleObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScStyleObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScStyleObjUnoTunnelId> {}; -} - -const uno::Sequence& ScStyleObj::getUnoTunnelId() -{ - return theScStyleObjUnoTunnelId::get().getSeq(); -} - -ScStyleObj* ScStyleObj::getImplementation(const uno::Reference& rObj) -{ - ScStyleObj* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScStyleObj); void ScStyleObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) { diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 5fad23d0df1a..fd35986dcda8 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -613,36 +613,7 @@ uno::Reference SAL_CALL ScCellTextCursor::getEnd() // XUnoTunnel -sal_Int64 SAL_CALL ScCellTextCursor::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return SvxUnoTextCursor::getSomething( rId ); -} - -namespace -{ - class theScCellTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScCellTextCursorUnoTunnelId> {}; -} - -const uno::Sequence& ScCellTextCursor::getUnoTunnelId() -{ - return theScCellTextCursorUnoTunnelId::get().getSeq(); -} - -ScCellTextCursor* ScCellTextCursor::getImplementation(const uno::Reference& rObj) -{ - ScCellTextCursor* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION2_IMPL(ScCellTextCursor, SvxUnoTextCursor); ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(rtl::Reference const & rText) : SvxUnoTextCursor( rText->GetUnoText() ), @@ -695,37 +666,7 @@ uno::Reference SAL_CALL ScHeaderFooterTextCursor::getEnd() // XUnoTunnel -sal_Int64 SAL_CALL ScHeaderFooterTextCursor::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return SvxUnoTextCursor::getSomething( rId ); -} - -namespace -{ - class theScHeaderFooterTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScHeaderFooterTextCursorUnoTunnelId> {}; -} - -const uno::Sequence& ScHeaderFooterTextCursor::getUnoTunnelId() -{ - return theScHeaderFooterTextCursorUnoTunnelId::get().getSeq(); -} - -ScHeaderFooterTextCursor* ScHeaderFooterTextCursor::getImplementation( - const uno::Reference& rObj) -{ - ScHeaderFooterTextCursor* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION2_IMPL(ScHeaderFooterTextCursor, SvxUnoTextCursor); ScDrawTextCursor::ScDrawTextCursor( const uno::Reference& xParent, const SvxUnoTextBase& rText ) : @@ -783,36 +724,7 @@ uno::Reference SAL_CALL ScDrawTextCursor::getEnd() // XUnoTunnel -sal_Int64 SAL_CALL ScDrawTextCursor::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return SvxUnoTextCursor::getSomething( rId ); -} - -namespace -{ - class theScDrawTextCursorUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScDrawTextCursorUnoTunnelId> {}; -} - -const uno::Sequence& ScDrawTextCursor::getUnoTunnelId() -{ - return theScDrawTextCursorUnoTunnelId::get().getSeq(); -} - -ScDrawTextCursor* ScDrawTextCursor::getImplementation(const uno::Reference& rObj) -{ - ScDrawTextCursor* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION2_IMPL(ScDrawTextCursor, SvxUnoTextCursor); ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() { diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index ebf219248295..080d70d4f75b 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -2063,36 +2062,7 @@ uno::Sequence SAL_CALL ScTabViewObj::getSupportedServiceNames() // XUnoTunnel -sal_Int64 SAL_CALL ScTabViewObj::getSomething( - const uno::Sequence& rId ) -{ - if ( rId.getLength() == 16 && - 0 == memcmp( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast(reinterpret_cast(this)); - } - return 0; -} - -namespace -{ - class theScTabViewObjUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theScTabViewObjUnoTunnelId> {}; -} - -const uno::Sequence& ScTabViewObj::getUnoTunnelId() -{ - return theScTabViewObjUnoTunnelId::get().getSeq(); -} - -ScTabViewObj* ScTabViewObj::getImplementation(const uno::Reference& rObj) -{ - ScTabViewObj* pRet = nullptr; - uno::Reference xUT(rObj, uno::UNO_QUERY); - if (xUT.is()) - pRet = reinterpret_cast(sal::static_int_cast(xUT->getSomething(getUnoTunnelId()))); - return pRet; -} +UNO3_GETIMPLEMENTATION_IMPL(ScTabViewObj); css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL ScTabViewObj::getTransferable() { -- cgit