sw/inc/unotbl.hxx | 19 +++---------------- sw/source/core/unocore/unocrsrhelper.cxx | 6 ++---- sw/source/core/unocore/unotbl.cxx | 30 +----------------------------- sw/source/core/unocore/unotext.cxx | 12 ++++-------- sw/source/filter/xml/xmltble.cxx | 3 +-- sw/source/filter/xml/xmltbli.cxx | 2 +- sw/source/ui/vba/vbatablehelper.cxx | 3 +-- 7 files changed, 13 insertions(+), 62 deletions(-)
New commits: commit 7d2bee35c46018e9699d76f117f9a80f71cb4597 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 18 15:21:27 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 19 17:56:25 2023 +0000 XUnoTunnel->dynamic_cast in SwXTextTable Change-Id: I18c229f31738707e4a379c9379425141ba4dc690 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145787 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index c9483a020bfc..d7074b5919bf 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -246,7 +246,7 @@ struct SwRangeDescriptor void Normalize(); }; -class SAL_DLLPUBLIC_RTTI SwXTextTable final : public cppu::WeakImplHelper +class SW_DLLPUBLIC SwXTextTable final : public cppu::WeakImplHelper < css::text::XTextTable, css::lang::XServiceInfo, @@ -256,7 +256,6 @@ class SAL_DLLPUBLIC_RTTI SwXTextTable final : public cppu::WeakImplHelper css::container::XNamed, css::table::XAutoFormattable, css::util::XSortable, - css::lang::XUnoTunnel, css::sheet::XCellRangeData > { @@ -272,15 +271,9 @@ public: static rtl::Reference<SwXTextTable> CreateXTextTable(SwFrameFormat * pFrameFormat); - SW_DLLPUBLIC static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - - SW_DLLPUBLIC static void GetCellPosition(std::u16string_view aCellName, sal_Int32& o_rColumn, sal_Int32& o_rRow); - - SW_DLLPUBLIC SwFrameFormat* GetFrameFormat(); - - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static void GetCellPosition(std::u16string_view aCellName, sal_Int32& o_rColumn, sal_Int32& o_rRow); + SwFrameFormat* GetFrameFormat(); //XTextTable virtual void SAL_CALL initialize( sal_Int32 nRows, sal_Int32 nColumns ) override; diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 0c4721c954bd..d41bf32e4ba9 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -202,8 +202,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc, return; } - SwXTextTable *const pTextTable( - comphelper::getFromUnoTunnel<SwXTextTable>(xTunnel)); + SwXTextTable *const pTextTable = dynamic_cast<SwXTextTable*>(xIfc.get()); if (pTextTable) { SwFrameFormat *const pFrameFormat(pTextTable->GetFrameFormat()); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 18fde41a8e7a..0aaedfa8b8d3 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1947,18 +1947,6 @@ public: }; -const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId() -{ - static const comphelper::UnoIdInit theSwXTextTableUnoTunnelId; - return theSwXTextTableUnoTunnelId.getSeq(); -} - -sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId ) -{ - return comphelper::getSomethingImpl(rId, this); -} - - SwXTextTable::SwXTextTable() : m_pImpl(new Impl(nullptr)) { @@ -2072,7 +2060,7 @@ SwXTextTable::attach(const uno::Reference<text::XTextRange> & xTextRange) if (!m_pImpl->IsDescriptor()) /* already attached ? */ throw uno::RuntimeException("SwXTextTable: already attached to range.", static_cast<cppu::OWeakObject*>(this)); - uno::Reference<XUnoTunnel> xRangeTunnel(xTextRange, uno::UNO_QUERY); + uno::Reference<lang::XUnoTunnel> xRangeTunnel(xTextRange, uno::UNO_QUERY); SwXTextRange* pRange(comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel)); OTextCursorHelper* pCursor(dynamic_cast<OTextCursorHelper*>(xTextRange.get())); SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor ? pCursor->GetDoc() : nullptr; diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 6248e0dfc8e3..52df5295dea7 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -647,8 +647,7 @@ SwXText::insertTextContentBefore( uno::UNO_QUERY); SwXTextSection *const pXSection = comphelper::getFromUnoTunnel<SwXTextSection>(xSuccTunnel); - SwXTextTable *const pXTable = - comphelper::getFromUnoTunnel<SwXTextTable>(xSuccTunnel); + SwXTextTable *const pXTable = dynamic_cast<SwXTextTable*>(xSuccessor.get()); SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; SwTextNode * pTextNode = nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) @@ -701,8 +700,7 @@ SwXText::insertTextContentAfter( uno::UNO_QUERY); SwXTextSection *const pXSection = comphelper::getFromUnoTunnel<SwXTextSection>(xPredTunnel); - SwXTextTable *const pXTable = - comphelper::getFromUnoTunnel<SwXTextTable>(xPredTunnel); + SwXTextTable *const pXTable = dynamic_cast<SwXTextTable*>(xPredecessor.get()); SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; bool bRet = false; SwTextNode * pTextNode = nullptr; @@ -751,8 +749,7 @@ SwXText::removeTextContentBefore( uno::UNO_QUERY); SwXTextSection *const pXSection = comphelper::getFromUnoTunnel<SwXTextSection>(xSuccTunnel); - SwXTextTable *const pXTable = - comphelper::getFromUnoTunnel<SwXTextTable>(xSuccTunnel); + SwXTextTable *const pXTable = dynamic_cast<SwXTextTable*>(xSuccessor.get()); SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) { @@ -803,8 +800,7 @@ SwXText::removeTextContentAfter( uno::UNO_QUERY); SwXTextSection *const pXSection = comphelper::getFromUnoTunnel<SwXTextSection>(xPredTunnel); - SwXTextTable *const pXTable = - comphelper::getFromUnoTunnel<SwXTextTable>(xPredTunnel); + SwXTextTable *const pXTable = dynamic_cast<SwXTextTable*>(xPredecessor.get()); SwFrameFormat *const pTableFormat = pXTable ? pXTable->GetFrameFormat() : nullptr; if(pTableFormat && pTableFormat->GetDoc() == GetDoc()) { diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index e6cbbcaea693..4181a869ce45 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -1208,8 +1208,7 @@ void SwXMLTextParagraphExport::exportTable( OSL_ENSURE( xTextTable.is(), "text table missing" ); if( xTextTable.is() ) { - Reference<XUnoTunnel> xTableTunnel( rTextContent, UNO_QUERY); - SwXTextTable* pXTable = comphelper::getFromUnoTunnel<SwXTextTable>(xTableTunnel); + SwXTextTable* pXTable = dynamic_cast<SwXTextTable*>(rTextContent.get()); if( pXTable ) { SwFrameFormat *const pFormat = pXTable->GetFrameFormat(); diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index cb369afc08a5..0e884e3c5fce 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1213,7 +1213,7 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport, // xml:id for RDF metadata GetImport().SetXmlId(xTable, sXmlId); - pXTable = comphelper::getFromUnoTunnel<SwXTextTable>(xTable); + pXTable = dynamic_cast<SwXTextTable*>(xTable.get()); Reference < XCellRange > xCellRange( xTable, UNO_QUERY ); Reference < XCell > xCell = xCellRange->getCellByPosition( 0, 0 ); diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx index 8252436227c2..2d7a1b393ef8 100644 --- a/sw/source/ui/vba/vbatablehelper.cxx +++ b/sw/source/ui/vba/vbatablehelper.cxx @@ -36,8 +36,7 @@ SwVbaTableHelper::SwVbaTableHelper( uno::Reference< text::XTextTable > xTextTabl SwTable* SwVbaTableHelper::GetSwTable( const uno::Reference< text::XTextTable >& xTextTable ) { - uno::Reference< lang::XUnoTunnel > xTunnel( xTextTable, uno::UNO_QUERY_THROW ); - SwXTextTable* pXTextTable = comphelper::getFromUnoTunnel<SwXTextTable>(xTunnel); + SwXTextTable* pXTextTable = dynamic_cast<SwXTextTable*>(xTextTable.get()); if( !pXTextTable ) throw uno::RuntimeException(); commit 0c25ccbd0e6e08750aff9efff5b579b21651d3b6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 18 15:15:08 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jan 19 17:56:13 2023 +0000 XUnoTunnel->dynamic_cast in SwXCellRange Change-Id: Ib2ffd8a58eb696dfa845a08f6d05fd9898ff7db8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145785 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index 4bd7e2efe118..c9483a020bfc 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -353,7 +353,6 @@ class SwXCellRange final : public cppu::WeakImplHelper < css::table::XCellRange, css::lang::XServiceInfo, - css::lang::XUnoTunnel, css::beans::XPropertySet, css::chart::XChartDataArray, css::util::XSortable, @@ -372,17 +371,12 @@ public: const sw::UnoCursorPointer& pCursor, SwFrameFormat& rFrameFormat, SwRangeDescriptor const & rDesc); - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - void SetLabels(bool bFirstRowAsLabel, bool bFirstColumnAsLabel); std::vector<css::uno::Reference<css::table::XCell>> GetCells(); const SwUnoCursor* GetTableCursor() const; - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; - //XCellRange virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) override; virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) override; diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 830b53f4be39..0c4721c954bd 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -245,8 +245,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc, return; } - SwXCellRange *const pCellRange( - comphelper::getFromUnoTunnel<SwXCellRange>(xTunnel)); + SwXCellRange *const pCellRange = dynamic_cast<SwXCellRange*>(xIfc.get()); if (pCellRange) { SwUnoCursor const*const pUnoCursor(pCellRange->GetTableCursor()); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 12de30955116..18fde41a8e7a 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3144,22 +3144,6 @@ public: }; -namespace -{ -} - -const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId() -{ - static const comphelper::UnoIdInit theSwXCellRangeUnoTunnelId; - return theSwXCellRangeUnoTunnelId.getSeq(); -} - -sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId ) -{ - return comphelper::getSomethingImpl(rId, this); -} - - OUString SwXCellRange::getImplementationName() { return "SwXCellRange"; }