sw/inc/TextCursorHelper.hxx | 10 ++++++++-- sw/inc/unotbl.hxx | 8 ++++---- sw/inc/unotextcursor.hxx | 8 +++----- sw/source/core/unocore/unotext.cxx | 2 +- sw/source/uibase/inc/unotxvw.hxx | 6 +++--- 5 files changed, 19 insertions(+), 15 deletions(-)
New commits: commit 765bdfcf1b5fe3ed5e800ce1594315c3192d8e14 Author: Noel Grandin <[email protected]> AuthorDate: Fri Feb 6 13:43:44 2026 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sun Feb 8 11:51:27 2026 +0100 simplify Sw*Cursor inheritance structure OTextCursorHelper can be a base class, no need for it to a mixin Change-Id: I8a0ade963bddab4f805ffabb5e5bbc4f3a56c620 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198832 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/sw/inc/TextCursorHelper.hxx b/sw/inc/TextCursorHelper.hxx index 41a91ed47626..6982d2e76272 100644 --- a/sw/inc/TextCursorHelper.hxx +++ b/sw/inc/TextCursorHelper.hxx @@ -20,12 +20,18 @@ #include "swdllapi.h" -#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/implbase.hxx> class SwDoc; class SwPaM; -class SW_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") OTextCursorHelper +typedef cppu::WeakImplHelper<css::beans::XPropertySet> OTextCursorHelper_Base; + +/** + base class for SwXTextViewCursor and SwXTextTableCursor and SwXTextCursor + */ +class SW_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") OTextCursorHelper : public OTextCursorHelper_Base { public: diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index caae1436db59..94ecd2f80be2 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -182,14 +182,14 @@ public: void Notify(const SfxHint&) override; }; -typedef cppu::WeakImplHelper< + +typedef cppu::ImplInheritanceHelper< + OTextCursorHelper, css::text::XTextTableCursor, - css::lang::XServiceInfo, - css::beans::XPropertySet> SwXTextTableCursor_Base; + css::lang::XServiceInfo> SwXTextTableCursor_Base; class SW_DLLPUBLIC SwXTextTableCursor final : public SwXTextTableCursor_Base , public SvtListener - , public OTextCursorHelper { SwFrameFormat* m_pFrameFormat; const SfxItemPropertySet* m_pPropSet; diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx index 4d54d3072c68..ff46303c0b7b 100644 --- a/sw/inc/unotextcursor.hxx +++ b/sw/inc/unotextcursor.hxx @@ -21,7 +21,6 @@ #define INCLUDED_SW_INC_UNOTEXTCURSOR_HXX #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertyStates.hpp> @@ -48,9 +47,9 @@ struct SwPosition; class SwXTextRange; class SfxItemPropertySet; -typedef ::cppu::WeakImplHelper -< css::lang::XServiceInfo -, css::beans::XPropertySet +typedef ::cppu::ImplInheritanceHelper +< OTextCursorHelper +, css::lang::XServiceInfo , css::beans::XPropertyState , css::beans::XMultiPropertySet , css::beans::XMultiPropertyStates @@ -67,7 +66,6 @@ typedef ::cppu::WeakImplHelper class SW_DLLPUBLIC SwXTextCursor final : public SwXTextCursor_Base - , public OTextCursorHelper { private: diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index e861d0396a94..e53e322aac70 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -527,7 +527,7 @@ SwXText::insertTextContent( pRange->DeleteAndInsert(u"", ::sw::DeleteAndInsertMode::ForceReplace | (bForceExpandHints ? ::sw::DeleteAndInsertMode::ForceExpandHints : ::sw::DeleteAndInsertMode::Default)); } - else if (SwXTextCursor *const pCursor = dynamic_cast<SwXTextCursor*>(dynamic_cast<OTextCursorHelper*>(xRange.get()))) + else if (SwXTextCursor *const pCursor = dynamic_cast<SwXTextCursor*>(xRange.get())) { pCursor->DeleteAndInsert(u"", ::sw::DeleteAndInsertMode::ForceReplace | (bForceExpandHints ? ::sw::DeleteAndInsertMode::ForceExpandHints : ::sw::DeleteAndInsertMode::Default)); diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx index e4f8b1a1483e..db2a0bc05a63 100644 --- a/sw/source/uibase/inc/unotxvw.hxx +++ b/sw/source/uibase/inc/unotxvw.hxx @@ -149,18 +149,18 @@ public: SfxObjectShellLock BuildTmpSelectionDoc(); }; -typedef cppu::WeakImplHelper< +typedef cppu::ImplInheritanceHelper< + OTextCursorHelper, css::text::XTextViewCursor, css::lang::XServiceInfo, css::text::XPageCursor, css::view::XScreenCursor, css::view::XViewCursor, css::view::XLineCursor, - css::beans::XPropertySet, css::beans::XPropertyState > SwXTextViewCursor_Base; -class SwXTextViewCursor final: public SwXTextViewCursor_Base, public OTextCursorHelper +class SwXTextViewCursor final: public SwXTextViewCursor_Base { SwView* m_pView; const SfxItemPropertySet* m_pPropSet;
