sw/source/core/inc/unofield.hxx | 8 -------- sw/source/core/inc/unoflatpara.hxx | 7 ------- sw/source/core/unocore/unofield.cxx | 19 ++----------------- sw/source/core/unocore/unoflatpara.cxx | 27 ++++----------------------- sw/source/core/unocore/unotext.cxx | 3 +-- 5 files changed, 7 insertions(+), 57 deletions(-)
New commits: commit 500a3b85a621cda94ea1502b58a4e2cacf58261e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jan 19 10:20:52 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 20 08:46:13 2023 +0000 XUnoTunnel->dynamic_cast in SwXFlatParagraph Change-Id: I6bbe75ae26d5411d2d032311e8877632b1e4d850 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145862 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/inc/unoflatpara.hxx b/sw/source/core/inc/unoflatpara.hxx index 6523609a6a5c..1d68a7d1c8db 100644 --- a/sw/source/core/inc/unoflatpara.hxx +++ b/sw/source/core/inc/unoflatpara.hxx @@ -23,7 +23,6 @@ #include <cppuhelper/implbase.hxx> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/text/XFlatParagraph.hpp> #include <com/sun/star/text/XFlatParagraphIterator.hpp> #include <svl/listener.hxx> @@ -42,7 +41,6 @@ typedef ::cppu::ImplInheritanceHelper < SwXTextMarkup , css::beans::XPropertySet , css::text::XFlatParagraph -, css::lang::XUnoTunnel > SwXFlatParagraph_Base; class SwXFlatParagraph final @@ -95,11 +93,6 @@ public: using SwXTextMarkup::GetTextNode; - static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId(); - - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 >& rId) override; - private: SwXFlatParagraph( const SwXFlatParagraph & ) = delete; SwXFlatParagraph & operator = ( const SwXFlatParagraph & ) = delete; diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index ea86284fb4ab..94adf66e08b6 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -328,20 +328,6 @@ css::uno::Sequence< ::sal_Int32 > SAL_CALL SwXFlatParagraph::getLanguagePortions return css::uno::Sequence< ::sal_Int32>(); } -const uno::Sequence< sal_Int8 >& -SwXFlatParagraph::getUnoTunnelId() -{ - static const comphelper::UnoIdInit theSwXFlatParagraphUnoTunnelId; - return theSwXFlatParagraphUnoTunnelId.getSeq(); -} - -sal_Int64 SAL_CALL -SwXFlatParagraph::getSomething( - const uno::Sequence< sal_Int8 >& rId) -{ - return comphelper::getSomethingImpl(rId, this); -} - SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType, bool bAutomatic ) : mpDoc( &rDoc ), mnType( nType ), @@ -519,10 +505,8 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co if (!mpDoc) return xRet; - const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY); - SAL_WARN_IF(!xFPTunnel.is(), "sw.core", "invalid argument"); - SwXFlatParagraph* const pFlatParagraph(comphelper::getFromUnoTunnel<SwXFlatParagraph>(xFPTunnel)); - + SwXFlatParagraph* const pFlatParagraph(dynamic_cast<SwXFlatParagraph*>(xPara.get())); + SAL_WARN_IF(!pFlatParagraph, "sw.core", "invalid argument"); if ( !pFlatParagraph ) return xRet; @@ -564,11 +548,8 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c if (!mpDoc) return xRet; - const uno::Reference<lang::XUnoTunnel> xFPTunnel(xPara, uno::UNO_QUERY); - - SAL_WARN_IF(!xFPTunnel.is(), "sw.core", "invalid argument"); - SwXFlatParagraph* const pFlatParagraph(comphelper::getFromUnoTunnel<SwXFlatParagraph>(xFPTunnel)); - + SwXFlatParagraph* const pFlatParagraph(dynamic_cast<SwXFlatParagraph*>(xPara.get())); + SAL_WARN_IF(!pFlatParagraph, "sw.core", "invalid argument"); if ( !pFlatParagraph ) return xRet; commit 468a50db510f2d001e656cbfb285445e265af47c Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jan 19 10:18:43 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jan 20 08:46:05 2023 +0000 XUnoTunnel->dynamic_cast in SwXTextField Change-Id: I31dcd7a498e2742c49d98e5626f10aa7dcafa8f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145861 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx index 0de0e886df6b..4a8138bf8df9 100644 --- a/sw/source/core/inc/unofield.hxx +++ b/sw/source/core/inc/unofield.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX #define INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX -#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/util/XUpdatable.hpp> @@ -109,7 +108,6 @@ typedef ::cppu::WeakImplHelper < css::text::XDependentTextField , css::lang::XServiceInfo , css::beans::XPropertySet -, css::lang::XUnoTunnel , css::util::XUpdatable > SwXTextField_Base; @@ -142,12 +140,6 @@ public: CreateXTextField(SwDoc * pDoc, SwFormatField const* pFormat, SwServiceType nServiceId = SwServiceType::Invalid); - static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( - const css::uno::Sequence< sal_Int8 >& rIdentifier) override; - // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService( diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 7dffffa18e20..f32c01c4b07f 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1158,18 +1158,6 @@ public: virtual void Notify(const SfxHint&) override; }; -const uno::Sequence< sal_Int8 > & SwXTextField::getUnoTunnelId() -{ - static const comphelper::UnoIdInit theSwXTextFieldUnoTunnelId; - return theSwXTextFieldUnoTunnelId.getSeq(); -} - -sal_Int64 SAL_CALL -SwXTextField::getSomething(const uno::Sequence< sal_Int8 >& rId) -{ - return comphelper::getSomethingImpl<SwXTextField>(rId, this); -} - SwXTextField::SwXTextField( SwServiceType nServiceId, SwDoc* pDoc) @@ -1250,11 +1238,8 @@ SwServiceType SwXTextField::GetServiceId() const void SwXTextField::TransmuteLeadToInputField(SwSetExpField & rField) { assert(rField.GetFormatField()->Which() == (rField.GetInputFlag() ? RES_TXTATR_INPUTFIELD : RES_TXTATR_FIELD)); - rtl::Reference<SwXTextField> const xField( + rtl::Reference<SwXTextField> const pXField( rField.GetFormatField()->GetXTextField()); - SwXTextField *const pXField = xField.is() - ? comphelper::getFromUnoTunnel<SwXTextField>(uno::Reference<lang::XUnoTunnel>(xField)) - : nullptr; if (pXField) pXField->m_pImpl->SetFormatField(nullptr, nullptr); SwTextField *const pOldAttr(rField.GetFormatField()->GetTextField()); @@ -1283,7 +1268,7 @@ void SwXTextField::TransmuteLeadToInputField(SwSetExpField & rField) if (pXField) { pXField->m_pImpl->SetFormatField(const_cast<SwFormatField*>(&rNewFormat), &rNode.GetDoc()); - const_cast<SwFormatField&>(rNewFormat).SetXTextField(xField); + const_cast<SwFormatField&>(rNewFormat).SetXTextField(pXField); } } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index f6f9abf50ffb..85b7caa92395 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -579,8 +579,7 @@ SwXText::insertTextContent( SwXMeta *const pMeta = comphelper::getFromUnoTunnel<SwXMeta>(xContentTunnel); auto* pContentControl = dynamic_cast<SwXContentControl*>(xContent.get()); - SwXTextField* pTextField = - comphelper::getFromUnoTunnel<SwXTextField>(xContentTunnel); + SwXTextField* pTextField = dynamic_cast<SwXTextField*>(xContent.get()); if (pTextField && pTextField->GetServiceId() != SwServiceType::FieldTypeAnnotation) pTextField = nullptr;