From 3642472bea67c6e0c35bee1e6567e1fe9d560e1a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 27 Dec 2024 15:48:45 +0200 Subject: merge SwSidebarItem and SwAnnotationItem classes Because the separation is not doing useful. Which reveals that SwAnnotationWin::ChangeSidebarItem was doing some very dodgy object slicing when assigning to mrSidebarItem. Fix that by using a pointer in SwAnnotationWin instead. Change-Id: I516dfaac7066d8f1effe351ef388c03dd1127fd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179445 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sw/inc/postithelper.hxx | 48 +++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) (limited to 'sw/inc/postithelper.hxx') diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx index 174e103231bd..30c9606a0d4d 100644 --- a/sw/inc/postithelper.hxx +++ b/sw/inc/postithelper.hxx @@ -94,63 +94,41 @@ namespace SwPostItHelper void ImportHTML(Outliner& rOutliner, const OUString& rHtml); } -class SAL_DLLPUBLIC_RTTI SwSidebarItem +class SwAnnotationItem final { public: VclPtr mpPostIt; bool mbShow; bool mbFocus; bool mbPendingLayout; - SwPostItHelper::SwLayoutStatus mLayoutStatus; SwLayoutInfo maLayoutInfo; - SwSidebarItem( const bool aFocus); - - virtual ~SwSidebarItem(); - - SwSidebarItem(SwSidebarItem const &) = default; - SwSidebarItem(SwSidebarItem &&) = default; - SwSidebarItem & operator =(SwSidebarItem const &) = default; - SwSidebarItem & operator =(SwSidebarItem &&) = default; - - virtual SwPosition GetAnchorPosition() const = 0; - virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) = 0; - virtual const SwFormatField& GetFormatField() const = 0; - virtual SwFormatField& GetFormatField() = 0; - virtual const SfxBroadcaster* GetBroadcaster() const = 0; - virtual VclPtr GetSidebarWindow( SwEditWin& rEditWin, - SwPostItMgr& aMgr) = 0; -}; - -class SwAnnotationItem final : public SwSidebarItem -{ -public: SwAnnotationItem( SwFormatField& rFormatField, - const bool aFocus) - : SwSidebarItem( aFocus ) - , mrFormatField( rFormatField ) - { - } + const bool aFocus); + virtual ~SwAnnotationItem(); + + SwAnnotationItem(SwAnnotationItem const &) = default; + SwAnnotationItem(SwAnnotationItem &&) = default; - virtual SwPosition GetAnchorPosition() const override; - virtual bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&) override; - virtual const SwFormatField& GetFormatField() const override + SwPosition GetAnchorPosition() const; + bool UseElement(SwRootFrame const&, IDocumentRedlineAccess const&); + const SwFormatField& GetFormatField() const { return mrFormatField; } - SwFormatField& GetFormatField() override + SwFormatField& GetFormatField() { return mrFormatField; } - virtual const SfxBroadcaster* GetBroadcaster() const override + const SfxBroadcaster* GetBroadcaster() const { return &mrFormatField; } - virtual VclPtr GetSidebarWindow( + VclPtr GetSidebarWindow( SwEditWin& rEditWin, - SwPostItMgr& aMgr ) override; + SwPostItMgr& aMgr ); private: SwFormatField& mrFormatField; -- cgit