diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-18 15:21:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-19 17:56:25 +0000 |
commit | 7d2bee35c46018e9699d76f117f9a80f71cb4597 (patch) | |
tree | d567779878f3ba58089854d05737c7ffe999a745 | |
parent | 0c25ccbd0e6e08750aff9efff5b579b21651d3b6 (diff) |
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.grandin@collabora.co.uk>
-rw-r--r-- | sw/inc/unotbl.hxx | 13 | ||||
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltble.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltbli.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/vba/vbatablehelper.cxx | 3 |
7 files changed, 12 insertions, 38 deletions
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(); |