[Libreoffice-commits] core.git: compilerplugins/clang sw/inc sw/Library_sw.mk sw/qa sw/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Apr 11 08:21:20 UTC 2017


 compilerplugins/clang/mergeclasses.results        |    1 
 sw/Library_sw.mk                                  |    2 
 sw/inc/AnnotationWin.hxx                          |  221 +++++++++++++++-
 sw/inc/PostItMgr.hxx                              |   27 --
 sw/inc/SidebarWin.hxx                             |  256 -------------------
 sw/inc/pch/precompiled_sw.hxx                     |    1 
 sw/inc/postithelper.hxx                           |   10 
 sw/qa/extras/uiwriter/uiwriter.cxx                |    2 
 sw/source/core/fields/postithelper.cxx            |    2 
 sw/source/uibase/docvw/AnnotationMenuButton.cxx   |    8 
 sw/source/uibase/docvw/AnnotationMenuButton.hxx   |    8 
 sw/source/uibase/docvw/AnnotationWin.cxx          |  126 +++++++++
 sw/source/uibase/docvw/AnnotationWin2.cxx         |  292 +++++-----------------
 sw/source/uibase/docvw/PostItMgr.cxx              |   70 ++---
 sw/source/uibase/docvw/SidebarScrollBar.cxx       |    4 
 sw/source/uibase/docvw/SidebarScrollBar.hxx       |   10 
 sw/source/uibase/docvw/SidebarTxtControl.cxx      |    8 
 sw/source/uibase/docvw/SidebarTxtControl.hxx      |    9 
 sw/source/uibase/docvw/SidebarWinAcc.cxx          |    8 
 sw/source/uibase/docvw/SidebarWinAcc.hxx          |    9 
 sw/source/uibase/docvw/edtwin.cxx                 |    4 
 sw/source/uibase/docvw/frmsidebarwincontainer.cxx |   12 
 sw/source/uibase/docvw/frmsidebarwincontainer.hxx |   10 
 sw/source/uibase/shells/annotsh.cxx               |    2 
 sw/source/uibase/shells/textfld.cxx               |    1 
 sw/source/uibase/uiview/viewmdi.cxx               |    2 
 sw/source/uibase/uno/unotxdoc.cxx                 |    5 
 sw/source/uibase/utlui/content.cxx                |    2 
 28 files changed, 513 insertions(+), 599 deletions(-)

New commits:
commit bf6449230ad2b4dfb427a062663e5ff2b9ddf3b6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 10 14:12:30 2017 +0200

    loplugin:mergeclasses merge SwAnnotationWin and SwSidebarWin
    
    Change-Id: Idaf7d7e8e4da37e0ba423dca3e22dc6711ba806a
    Reviewed-on: https://gerrit.libreoffice.org/36380
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results
index 126c7d3cd7d8..7031a522f436 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -353,7 +353,6 @@ merge sw::WriterListener with SwClient
 merge sw::mark::ContentIdxStore with (anonymous namespace)::ContentIdxStoreImpl
 merge sw::mark::IBookmark with sw::mark::Bookmark
 merge sw::mark::ICheckboxFieldmark with sw::mark::CheckboxFieldmark
-merge sw::sidebarwindows::SwSidebarWin with sw::annotation::SwAnnotationWin
 merge sw::util::WrtRedlineAuthor with WW8_WrtRedlineAuthor
 merge unographic::GraphicTransformer with unographic::Graphic
 merge vcl::DeletionNotifier with SalFrame
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 847d061af188..8e6aea178073 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -598,6 +598,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/uibase/docvw/AnchorOverlayObject \
     sw/source/uibase/docvw/AnnotationMenuButton \
     sw/source/uibase/docvw/AnnotationWin \
+    sw/source/uibase/docvw/AnnotationWin2 \
     sw/source/uibase/docvw/DashedLine \
     sw/source/uibase/docvw/FrameControlsManager \
     sw/source/uibase/docvw/PageBreakWin \
@@ -607,7 +608,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/uibase/docvw/SidebarScrollBar \
     sw/source/uibase/docvw/SidebarTxtControl \
     sw/source/uibase/docvw/SidebarTxtControlAcc \
-    sw/source/uibase/docvw/SidebarWin \
     sw/source/uibase/docvw/SidebarWinAcc \
     sw/source/uibase/docvw/HeaderFooterWin \
     sw/source/uibase/docvw/edtdd \
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 04122ce9f70b..256441bc9dfb 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -20,15 +20,44 @@
 #ifndef INCLUDED_SW_INC_ANNOTATIONWIN_HXX
 #define INCLUDED_SW_INC_ANNOTATIONWIN_HXX
 
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <editeng/editstat.hxx>
+#include <tools/date.hxx>
+#include <vcl/lineinfo.hxx>
+#include <vcl/window.hxx>
+
 #include <docufld.hxx>
-#include <SidebarWin.hxx>
+#include <postithelper.hxx>
+#include <swrect.hxx>
+#include <SidebarWindowsTypes.hxx>
 
 class PopupMenu;
 class OutlinerParaObject;
+class SwPostItMgr;
+class SwPostItField;
+class OutlinerView;
+class Outliner;
+class ScrollBar;
+class SwEditWin;
+class SwView;
+class Edit;
+class MenuButton;
+class SwFrame;
+
+namespace sw { namespace overlay {
+    class OverlayRanges;
+}}
+
+namespace sw { namespace sidebarwindows {
+    class SidebarTextControl;
+    class AnchorOverlayObject;
+    class ShadowOverlayObject;
+}}
 
 namespace sw { namespace annotation {
 
-class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
+class SwAnnotationWin : public vcl::Window
 {
     public:
         SwAnnotationWin( SwEditWin& rEditWin,
@@ -39,36 +68,194 @@ class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
         virtual ~SwAnnotationWin() override;
         virtual void dispose() override;
 
-        virtual void    UpdateData() override;
-        virtual void    SetPostItText() override;
-        virtual void    Delete() override;
-        virtual void    GotoPos() override;
+        void    UpdateData();
+        void    SetPostItText();
+        void    Delete();
+        void    GotoPos();
         const SwPostItField* GetPostItField() { return mpField; }
         void UpdateText(const OUString& aText);
 
-        virtual OUString GetAuthor() override;
-        virtual Date    GetDate() override;
-        virtual tools::Time GetTime() override;
+        OUString GetAuthor();
+        Date     GetDate();
+        tools::Time GetTime();
 
-        virtual sal_uInt32 MoveCaret() override;
+        sal_uInt32 MoveCaret();
 
         /// Calculate parent postit id of current annotation window
-        virtual sal_uInt32    CalcParent() override;
-        void            InitAnswer(OutlinerParaObject* pText);
+        sal_uInt32 CalcParent();
+        void       InitAnswer(OutlinerParaObject* pText);
+
+        bool IsProtected();
+
+        void SetSize( const Size& rNewSize );
+        void SetPosSizePixelRect( long nX,
+                                  long nY,
+                                  long nWidth,
+                                  long nHeight,
+                                  const SwRect& aAnchorRect,
+                                  const long PageBorder);
+        void SetPosAndSize();
+        void TranslateTopPosition(const long aAmount);
+        void CheckMetaText();
+
+        Point GetAnchorPos() { return mAnchorRect.Pos(); }
+        const SwRect& GetAnchorRect() { return mAnchorRect; }
+        bool IsAnchorRectChanged() { return mbAnchorRectChanged; }
+        void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
+        const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() { return maAnnotationTextRanges; }
+        SwEditWin& EditWin();
+        SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
+
+        OutlinerView* GetOutlinerView() { return mpOutlinerView;}
+        bool HasScrollbar() const;
+        bool IsScrollbarVisible() const;
+        ScrollBar* Scrollbar() { return mpVScrollbar; }
+        ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
+        ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
+        ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
+
+        long            GetPostItTextHeight();
+
+        void            SwitchToPostIt(sal_uInt16 aDirection);
+        void            SwitchToFieldPos();
+
+        void            ExecuteCommand(sal_uInt16 nSlot);
+        void            InitControls();
+        void            DoResize();
+        void            ResizeIfNecessary(long aOldHeight, long aNewHeight);
+        void            SetScrollbar();
+
+        void            SetVirtualPosSize( const Point& aPoint, const Size& aSize);
+        const Point     VirtualPos()    { return mPosSize.TopLeft(); }
+        const Size      VirtualSize()   { return mPosSize.GetSize(); }
+
+        void            ShowAnchorOnly(const Point &aPoint);
+        void            ShowNote();
+        void            HideNote();
+        void            InvalidateControl();
+
+        void            ResetAttributes();
+
+        void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
+        void            SetReadonly(bool bSet);
+        bool            IsReadOnly()
+        {
+            return mbReadonly;
+        }
+
+        void         SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
+        const Color& ColorAnchor() { return mColorAnchor; }
+        const Color& ColorDark() { return mColorDark; }
+        const Color& ColorLight() { return mColorLight; }
+        void         Rescale();
+
+        void            SetViewState(::sw::sidebarwindows::ViewState bViewState);
+
+        bool            IsFollow() { return mbIsFollow; }
+        void            SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
+
+        sal_Int32   GetMetaHeight();
+        sal_Int32   GetMinimumSizeWithMeta();
+        sal_Int32   GetMinimumSizeWithoutMeta();
+        sal_Int32   GetMetaButtonAreaWidth();
+        sal_Int32   GetScrollbarWidth();
+
+        void    SetSpellChecking();
+
+        void    ToggleInsMode();
+
+        void    ActivatePostIt();
+        void    DeactivatePostIt();
 
-        virtual bool    IsProtected() override;
+        void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
+                                const Color& aColor);
+        SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
+        const Color& GetChangeColor() { return mChangeColor; }
 
-    protected:
-        virtual VclPtr<MenuButton> CreateMenuButton() override;
+        DECL_LINK( WindowEventListener, VclWindowEvent&, void );
+        bool IsMouseOverSidebarWin() const { return mbMouseOver; }
+
+        void SetLanguage(const SvxLanguageItem& rNewItem);
+
+        void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
+        virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
+
+        virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
+        virtual void KeyInput(const KeyEvent& rKeyEvt) override;
+        virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
+        virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
+        virtual void MouseMove(const MouseEvent& rMouseEvent) override;
+        void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
+        /// Is there a matching sub-widget inside this sidebar widget for rPointLogic?
+        bool IsHitWindow(const Point& rPointLogic);
+        /// Allows adjusting the point or mark of the selection to a document coordinate.
+        void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
 
     private:
-        virtual SvxLanguageItem GetLanguage() override;
+        VclPtr<MenuButton> CreateMenuButton();
+        virtual void    LoseFocus() override;
+        virtual void    Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+        virtual void    GetFocus() override;
+
+        void        SetSizePixel( const Size& rNewSize ) override;
+        SfxItemSet  DefaultItem();
+
+        DECL_LINK(ModifyHdl, LinkParamNone*, void);
+        DECL_LINK(ScrollHdl, ScrollBar*, void);
+        DECL_LINK(DeleteHdl, void*, void);
+
+        SwView& DocView() { return mrView;}
+        SwPostItMgr& Mgr() { return mrMgr; }
+        Outliner* Engine() { return mpOutliner;}
+
         sal_uInt32 CountFollowing();
+        SwAnnotationWin*   GetTopReplyNote();
+        SvxLanguageItem GetLanguage();
+
+        SwPostItMgr&    mrMgr;
+        SwView&         mrView;
+
+        ImplSVEvent *   mnEventId;
+
+        OutlinerView*   mpOutlinerView;
+        Outliner*       mpOutliner;
+
+        VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl;
+        VclPtr<ScrollBar>      mpVScrollbar;
+        VclPtr<Edit>           mpMetadataAuthor;
+        VclPtr<Edit>           mpMetadataDate;
+        VclPtr<MenuButton>     mpMenuButton;
+
+        sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
+        sw::sidebarwindows::ShadowOverlayObject* mpShadow;
+        sw::overlay::OverlayRanges* mpTextRangeOverlay;
+
+        Color           mColorAnchor;
+        Color           mColorDark;
+        Color           mColorLight;
+        Color           mChangeColor;
+
+        sw::sidebarwindows::SidebarPosition meSidebarPosition;
+
+        tools::Rectangle       mPosSize;
+        SwRect          mAnchorRect;
+        long            mPageBorder;
+        bool            mbAnchorRectChanged;
+
+        std::vector<basegfx::B2DRange> maAnnotationTextRanges;
+
+        bool            mbMouseOver;
+        SwPostItHelper::SwLayoutStatus mLayoutStatus;
+
+        bool            mbReadonly;
+        bool            mbIsFollow;
+
+        SwSidebarItem& mrSidebarItem;
+        const SwFrame* mpAnchorFrame;
 
         SwFormatField*       mpFormatField;
         SwPostItField*       mpField;
         VclPtr<PopupMenu>    mpButtonPopup;
-
 };
 
 } } // end of namespace sw::annotation
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 137080292eb3..6f25c4cb72bd 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -57,7 +57,6 @@ namespace sw { namespace annotation {
     class SwAnnotationWin;
 }}
 namespace sw { namespace sidebarwindows {
-    class SwSidebarWin;
     class SwFrameSidebarWinContainer;
 }}
 class SwSidebarItem;
@@ -151,7 +150,7 @@ class SwPostItMgr: public SfxListener
         std::vector<SwPostItPageItem*>  mPages;
         ImplSVEvent *                   mnEventId;
         bool                            mbWaitingForCalcRects;
-        VclPtr<sw::sidebarwindows::SwSidebarWin> mpActivePostIt;
+        VclPtr<sw::annotation::SwAnnotationWin> mpActivePostIt;
         bool                            mbLayout;
         long                            mbLayoutHeight;
         bool                            mbLayouting;
@@ -162,18 +161,18 @@ class SwPostItMgr: public SfxListener
         OUString                        maAnswerText;
         bool                            mbIsShowAnchor;
 
-        // data structure to collect the <SwSidebarWin> instances for certain <SwFrame> instances.
+        // data structure to collect the <SwAnnotationWin> instances for certain <SwFrame> instances.
         sw::sidebarwindows::SwFrameSidebarWinContainer* mpFrameSidebarWinContainer;
 
-        typedef std::list<sw::sidebarwindows::SwSidebarWin*>::iterator  SwSidebarWin_iterator;
+        typedef std::list<sw::annotation::SwAnnotationWin*>::iterator  SwAnnotationWin_iterator;
 
         void            AddPostIts(bool bCheckExistance = true,bool bFocus = true);
         void            RemoveSidebarWin();
         void            PreparePageContainer();
         void            Scroll(const long lScroll,const unsigned long aPage );
-        void            AutoScroll(const sw::sidebarwindows::SwSidebarWin* pPostIt,const unsigned long aPage );
+        void            AutoScroll(const sw::annotation::SwAnnotationWin* pPostIt,const unsigned long aPage );
         bool            ScrollbarHit(const unsigned long aPage,const Point &aPoint);
-        bool            LayoutByPage( std::list<sw::sidebarwindows::SwSidebarWin*> &aVisiblePostItList,
+        bool            LayoutByPage( std::list<sw::annotation::SwAnnotationWin*> &aVisiblePostItList,
                                       const tools::Rectangle& rBorder,
                                       long lNeededHeight);
         void            CheckForRemovedPostIts();
@@ -188,7 +187,7 @@ class SwPostItMgr: public SfxListener
         void            SetReadOnlyState();
         DECL_LINK( CalcHdl, void*, void);
 
-        sw::sidebarwindows::SwSidebarWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const;
+        sw::annotation::SwAnnotationWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const;
 
         SwSidebarItem*  InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
         void            RemoveItem( SfxBroadcaster* pBroadcast );
@@ -206,7 +205,7 @@ class SwPostItMgr: public SfxListener
         void LayoutPostIts();
         bool CalcRects();
 
-        void MakeVisible( const sw::sidebarwindows::SwSidebarWin* pPostIt);
+        void MakeVisible( const sw::annotation::SwAnnotationWin* pPostIt);
 
         bool ShowScrollbar(const unsigned long aPage) const;
         bool HasNotes() const ;
@@ -244,12 +243,12 @@ class SwPostItMgr: public SfxListener
         sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pField) const;
         sw::annotation::SwAnnotationWin* GetAnnotationWin(const sal_uInt32 nPostItId) const;
 
-        sw::sidebarwindows::SwSidebarWin* GetNextPostIt( sal_uInt16 aDirection,
-                                                         sw::sidebarwindows::SwSidebarWin* aPostIt);
+        sw::annotation::SwAnnotationWin* GetNextPostIt( sal_uInt16 aDirection,
+                                                        sw::annotation::SwAnnotationWin* aPostIt);
         long GetNextBorder();
 
-        sw::sidebarwindows::SwSidebarWin* GetActiveSidebarWin() { return mpActivePostIt; }
-        void SetActiveSidebarWin( sw::sidebarwindows::SwSidebarWin* p);
+        sw::annotation::SwAnnotationWin* GetActiveSidebarWin() { return mpActivePostIt; }
+        void SetActiveSidebarWin( sw::annotation::SwAnnotationWin* p);
         bool HasActiveSidebarWin() const;
         bool HasActiveAnnotationWin() const;
         void GrabFocusOnActiveSidebarWin();
@@ -283,9 +282,9 @@ class SwPostItMgr: public SfxListener
 
         void ConnectSidebarWinToFrame( const SwFrame& rFrame,
                                      const SwFormatField& rFormatField,
-                                     sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+                                     sw::annotation::SwAnnotationWin& rSidebarWin );
         void DisconnectSidebarWinFromFrame( const SwFrame& rFrame,
-                                          sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+                                          sw::annotation::SwAnnotationWin& rSidebarWin );
         bool HasFrameConnectedSidebarWins( const SwFrame& rFrame );
         vcl::Window* GetSidebarWinForFrameByIndex( const SwFrame& rFrame,
                                             const sal_Int32 nIndex );
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
deleted file mode 100644
index d4692890b153..000000000000
--- a/sw/inc/SidebarWin.hxx
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SW_INC_SIDEBARWIN_HXX
-#define INCLUDED_SW_INC_SIDEBARWIN_HXX
-
-#include <postithelper.hxx>
-#include <SidebarWindowsTypes.hxx>
-
-#include <vcl/window.hxx>
-#include <swrect.hxx>
-
-#include <tools/date.hxx>
-
-#include <vcl/lineinfo.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/range/b2drange.hxx>
-#include <editeng/editstat.hxx>
-
-class SwPostItMgr;
-class SwPostItField;
-class OutlinerView;
-class Outliner;
-class ScrollBar;
-class SwEditWin;
-class SwView;
-class Edit;
-class MenuButton;
-class SwFrame;
-
-namespace sw { namespace overlay {
-    class OverlayRanges;
-}}
-
-namespace sw { namespace sidebarwindows {
-
-class SidebarTextControl;
-class AnchorOverlayObject;
-class ShadowOverlayObject;
-
-class SwSidebarWin : public vcl::Window
-{
-    public:
-        SwSidebarWin( SwEditWin& rEditWin,
-                      WinBits nBits,
-                      SwPostItMgr& aMgr,
-                      SwSidebarItem& rSidebarItem );
-        virtual ~SwSidebarWin() override;
-        virtual void dispose() override;
-
-        void SetSize( const Size& rNewSize );
-        void SetPosSizePixelRect( long nX,
-                                  long nY,
-                                  long nWidth,
-                                  long nHeight,
-                                  const SwRect& aAnchorRect,
-                                  const long PageBorder);
-        void SetPosAndSize();
-        void TranslateTopPosition(const long aAmount);
-        void CheckMetaText();
-
-        Point GetAnchorPos() { return mAnchorRect.Pos(); }
-        const SwRect& GetAnchorRect() { return mAnchorRect; }
-        bool IsAnchorRectChanged() { return mbAnchorRectChanged; }
-        void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
-        const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() { return maAnnotationTextRanges; }
-        SwEditWin& EditWin();
-        SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
-
-        OutlinerView* GetOutlinerView() { return mpOutlinerView;}
-        bool HasScrollbar() const;
-        bool IsScrollbarVisible() const;
-        ScrollBar* Scrollbar() { return mpVScrollbar; }
-        ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
-        ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
-        ::sw::overlay::OverlayRanges* TextRange() { return mpTextRangeOverlay;}
-
-        long            GetPostItTextHeight();
-
-        void            SwitchToPostIt(sal_uInt16 aDirection);
-        void    SwitchToFieldPos();
-
-        virtual sal_uInt32 MoveCaret() = 0;
-
-        virtual void    UpdateData() = 0;
-        virtual void    SetPostItText() = 0;
-        virtual void    Delete();
-        virtual void    GotoPos() = 0;
-
-        virtual OUString GetAuthor() = 0;
-        virtual Date    GetDate() = 0;
-        virtual tools::Time GetTime() = 0;
-
-        void            ExecuteCommand(sal_uInt16 nSlot);
-        void            InitControls();
-        void            DoResize();
-        void            ResizeIfNecessary(long aOldHeight, long aNewHeight);
-        void            SetScrollbar();
-
-        void            SetVirtualPosSize( const Point& aPoint, const Size& aSize);
-        const Point     VirtualPos()    { return mPosSize.TopLeft(); }
-        const Size      VirtualSize()   { return mPosSize.GetSize(); }
-
-        void            ShowAnchorOnly(const Point &aPoint);
-        void            ShowNote();
-        void            HideNote();
-        void            InvalidateControl();
-
-        void            ResetAttributes();
-
-        void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
-        void            SetReadonly(bool bSet);
-        bool            IsReadOnly()
-        {
-            return mbReadonly;
-        }
-
-        void         SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor);
-        const Color& ColorAnchor() { return mColorAnchor; }
-        const Color& ColorDark() { return mColorDark; }
-        const Color& ColorLight() { return mColorLight; }
-        void         Rescale();
-
-        void            SetViewState(::sw::sidebarwindows::ViewState bViewState);
-
-        bool            IsFollow() { return mbIsFollow; }
-        void            SetFollow( bool bIsFollow) { mbIsFollow = bIsFollow; };
-        virtual sal_uInt32    CalcParent() = 0;
-
-        sal_Int32   GetMetaHeight();
-        sal_Int32   GetMinimumSizeWithMeta();
-        sal_Int32   GetMinimumSizeWithoutMeta();
-        sal_Int32   GetMetaButtonAreaWidth();
-        sal_Int32   GetScrollbarWidth();
-
-        void    SetSpellChecking();
-
-        void    ToggleInsMode();
-
-        void    ActivatePostIt();
-        void    DeactivatePostIt();
-
-        void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
-                                const Color& aColor);
-        SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
-        const Color& GetChangeColor() { return mChangeColor; }
-
-        virtual bool IsProtected()
-        {
-            return mbReadonly;
-        }
-
-        DECL_LINK( WindowEventListener, VclWindowEvent&, void );
-        bool IsMouseOverSidebarWin() const { return mbMouseOver; }
-
-        void SetLanguage(const SvxLanguageItem& rNewItem);
-
-        void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
-        virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
-
-        virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
-        virtual void KeyInput(const KeyEvent& rKeyEvt) override;
-        virtual void MouseButtonDown(const MouseEvent& rMouseEvent) override;
-        virtual void MouseButtonUp(const MouseEvent& rMouseEvent) override;
-        virtual void MouseMove(const MouseEvent& rMouseEvent) override;
-        void PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
-        /// Is there a matching sub-widget inside this sidebar widget for rPointLogic?
-        bool IsHitWindow(const Point& rPointLogic);
-        /// Allows adjusting the point or mark of the selection to a document coordinate.
-        void SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark);
-
-    protected:
-        virtual void    LoseFocus() override;
-        virtual void    Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
-        virtual void    GetFocus() override;
-        virtual VclPtr<MenuButton> CreateMenuButton() = 0;
-
-        void        SetSizePixel( const Size& rNewSize ) override;
-        SfxItemSet  DefaultItem();
-
-        DECL_LINK(ModifyHdl, LinkParamNone*, void);
-        DECL_LINK(ScrollHdl, ScrollBar*, void);
-        DECL_LINK(DeleteHdl, void*, void);
-
-        SwView& DocView() { return mrView;}
-        SwPostItMgr& Mgr() { return mrMgr; }
-        Outliner* Engine() { return mpOutliner;}
-
-    private:
-        SwSidebarWin*   GetTopReplyNote();
-
-        virtual SvxLanguageItem GetLanguage();
-
-        SwPostItMgr&    mrMgr;
-        SwView&         mrView;
-
-        ImplSVEvent *   mnEventId;
-
-        OutlinerView*   mpOutlinerView;
-        Outliner*       mpOutliner;
-
-        VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl;
-        VclPtr<ScrollBar>      mpVScrollbar;
-        VclPtr<Edit>           mpMetadataAuthor;
-        VclPtr<Edit>           mpMetadataDate;
-        VclPtr<MenuButton>     mpMenuButton;
-
-        sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
-        sw::sidebarwindows::ShadowOverlayObject* mpShadow;
-        sw::overlay::OverlayRanges* mpTextRangeOverlay;
-
-        Color           mColorAnchor;
-        Color           mColorDark;
-        Color           mColorLight;
-        Color           mChangeColor;
-
-        sw::sidebarwindows::SidebarPosition meSidebarPosition;
-
-        tools::Rectangle       mPosSize;
-        SwRect          mAnchorRect;
-        long            mPageBorder;
-        bool            mbAnchorRectChanged;
-
-        std::vector<basegfx::B2DRange> maAnnotationTextRanges;
-
-        bool            mbMouseOver;
-        SwPostItHelper::SwLayoutStatus mLayoutStatus;
-
-        bool            mbReadonly;
-        bool            mbIsFollow;
-
-        SwSidebarItem& mrSidebarItem;
-        const SwFrame* mpAnchorFrame;
-};
-
-} } // eof namespace sw::sidebarwindows
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index 86738867aff1..fdd62fe29f30 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -146,7 +146,6 @@
 #include <IDocumentUndoRedo.hxx>
 #include <IMark.hxx>
 #include <PostItMgr.hxx>
-#include <SidebarWin.hxx>
 #include <SwNodeNum.hxx>
 #include <SwRewriter.hxx>
 #include <SwSmartTagMgr.hxx>
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 90cfaf3a5d7e..26eb10186233 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -32,8 +32,8 @@ class SwTextField;
 class SwRootFrame;
 class SwPostItMgr;
 class SwEditWin;
-namespace sw { namespace sidebarwindows {
-    class SwSidebarWin;
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
 } }
 
 struct SwPosition;
@@ -88,7 +88,7 @@ namespace SwPostItHelper
 class SwSidebarItem
 {
 public:
-    VclPtr<sw::sidebarwindows::SwSidebarWin> pPostIt;
+    VclPtr<sw::annotation::SwAnnotationWin> pPostIt;
     bool bShow;
     bool bFocus;
     bool bPendingLayout;
@@ -114,7 +114,7 @@ public:
     virtual bool UseElement() = 0;
     virtual const SwFormatField& GetFormatField() const = 0;
     virtual const SfxBroadcaster* GetBroadCaster() const = 0;
-    virtual VclPtr<sw::sidebarwindows::SwSidebarWin> GetSidebarWindow( SwEditWin& rEditWin,
+    virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow( SwEditWin& rEditWin,
                                                                 SwPostItMgr& aMgr) = 0;
 };
 
@@ -139,7 +139,7 @@ public:
     {
         return dynamic_cast<const SfxBroadcaster *> (&mrFormatField);
     }
-    virtual VclPtr<sw::sidebarwindows::SwSidebarWin> GetSidebarWindow(
+    virtual VclPtr<sw::annotation::SwAnnotationWin> GetSidebarWindow(
         SwEditWin& rEditWin,
         SwPostItMgr& aMgr ) override;
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 292d9dec34d2..7bb8a1dfb757 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -43,7 +43,7 @@
 #include <pagedesc.hxx>
 #include <postithelper.hxx>
 #include <PostItMgr.hxx>
-#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
 #include "com/sun/star/text/XDefaultNumberingProvider.hpp"
 #include "com/sun/star/awt/FontUnderline.hpp"
 
diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx
index cd607e8b5f3d..cfe556c76e56 100644
--- a/sw/source/core/fields/postithelper.cxx
+++ b/sw/source/core/fields/postithelper.cxx
@@ -143,7 +143,7 @@ bool SwAnnotationItem::UseElement()
     return mrFormatField.IsFieldInDoc();
 }
 
-VclPtr<sw::sidebarwindows::SwSidebarWin> SwAnnotationItem::GetSidebarWindow(
+VclPtr<sw::annotation::SwAnnotationWin> SwAnnotationItem::GetSidebarWindow(
                                                             SwEditWin& rEditWin,
                                                             SwPostItMgr& aMgr)
 {
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index 0eff9dc8aa93..a7f56ffe650c 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -32,7 +32,7 @@
 #include <vcl/settings.hxx>
 
 #include <cmdid.h>
-#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
 
 namespace sw { namespace annotation {
 
@@ -43,11 +43,11 @@ Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, co
                  sal_uInt8(aFront.GetBlue()  * aTransparency / 255.0 + aBack.GetBlue()  * (1 - aTransparency / 255.0)));
 }
 
-AnnotationMenuButton::AnnotationMenuButton(sw::sidebarwindows::SwSidebarWin& rSidebarWin)
+AnnotationMenuButton::AnnotationMenuButton(sw::annotation::SwAnnotationWin& rSidebarWin)
     : MenuButton(&rSidebarWin)
     , mrSidebarWin(rSidebarWin)
 {
-    AddEventListener(LINK(&mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener));
+    AddEventListener(LINK(&mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener));
 
     SetAccessibleName(SW_RES(STR_ACCESS_ANNOTATION_BUTTON_NAME));
     SetAccessibleDescription(SW_RES(STR_ACCESS_ANNOTATION_BUTTON_DESC));
@@ -61,7 +61,7 @@ AnnotationMenuButton::~AnnotationMenuButton()
 
 void AnnotationMenuButton::dispose()
 {
-    RemoveEventListener(LINK(&mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener));
+    RemoveEventListener(LINK(&mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener));
     MenuButton::dispose();
 }
 
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.hxx b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
index 6a7694d4caae..74bbcc5a02ab 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.hxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.hxx
@@ -22,8 +22,8 @@
 
 #include <vcl/menubtn.hxx>
 
-namespace sw { namespace sidebarwindows {
-    class SwSidebarWin;
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
 } }
 
 namespace sw { namespace annotation {
@@ -31,7 +31,7 @@ namespace sw { namespace annotation {
 class AnnotationMenuButton : public MenuButton
 {
     public:
-        AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+        AnnotationMenuButton( sw::annotation::SwAnnotationWin& rSidebarWin );
         virtual ~AnnotationMenuButton() override;
         virtual void dispose() override;
 
@@ -44,7 +44,7 @@ class AnnotationMenuButton : public MenuButton
         virtual void KeyInput( const KeyEvent& rKeyEvt ) override;
 
     private:
-        sw::sidebarwindows::SwSidebarWin& mrSidebarWin;
+        sw::annotation::SwAnnotationWin& mrSidebarWin;
 };
 
 } } // end of namespace sw::annotation
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 7809c3bc18b3..9f70393f637e 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -51,6 +51,11 @@
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
 #include <SwUndoField.hxx>
+#include <edtwin.hxx>
+#include <ShadowOverlayObject.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <OverlayRanges.hxx>
+#include <SidebarTxtControl.hxx>
 
 #include <memory>
 
@@ -61,11 +66,49 @@ SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
                                   SwPostItMgr& aMgr,
                                   SwSidebarItem& rSidebarItem,
                                   SwFormatField* aField )
-    : SwSidebarWin( rEditWin, nBits, aMgr, rSidebarItem )
+    : Window(&rEditWin, nBits)
+    , mrMgr(aMgr)
+    , mrView(rEditWin.GetView())
+    , mnEventId(nullptr)
+    , mpOutlinerView(nullptr)
+    , mpOutliner(nullptr)
+    , mpSidebarTextControl(nullptr)
+    , mpVScrollbar(nullptr)
+    , mpMetadataAuthor(nullptr)
+    , mpMetadataDate(nullptr)
+    , mpMenuButton(nullptr)
+    , mpAnchor(nullptr)
+    , mpShadow(nullptr)
+    , mpTextRangeOverlay(nullptr)
+    , mColorAnchor()
+    , mColorDark()
+    , mColorLight()
+    , mChangeColor()
+    , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
+    , mPosSize()
+    , mAnchorRect()
+    , mPageBorder(0)
+    , mbAnchorRectChanged(false)
+    , mbMouseOver(false)
+    , mLayoutStatus(SwPostItHelper::INVISIBLE)
+    , mbReadonly(false)
+    , mbIsFollow(false)
+    , mrSidebarItem(rSidebarItem)
+    , mpAnchorFrame(rSidebarItem.maLayoutInfo.mpAnchorFrame)
     , mpFormatField(aField)
     , mpField( static_cast<SwPostItField*>(aField->GetField()))
     , mpButtonPopup(nullptr)
 {
+    mpShadow = sidebarwindows::ShadowOverlayObject::CreateShadowOverlayObject( mrView );
+    if ( mpShadow )
+    {
+        mpShadow->setVisible(false);
+    }
+
+    mrMgr.ConnectSidebarWinToFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
+                                  mrSidebarItem.GetFormatField(),
+                                  *this );
+
     if (SupportsDoubleBuffering())
         // When double-buffering, allow parents to paint on our area. That's
         // necessary when parents paint the complete buffer.
@@ -80,7 +123,71 @@ SwAnnotationWin::~SwAnnotationWin()
 void SwAnnotationWin::dispose()
 {
     mpButtonPopup.disposeAndClear();
-    sw::sidebarwindows::SwSidebarWin::dispose();
+
+    if (IsDisposed())
+        return;
+
+    mrMgr.DisconnectSidebarWinFromFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
+                                       *this );
+
+    Disable();
+
+    if ( mpSidebarTextControl )
+    {
+        if ( mpOutlinerView )
+        {
+            mpOutlinerView->SetWindow( nullptr );
+        }
+    }
+    mpSidebarTextControl.disposeAndClear();
+
+    if ( mpOutlinerView )
+    {
+        delete mpOutlinerView;
+        mpOutlinerView = nullptr;
+    }
+
+    if (mpOutliner)
+    {
+        delete mpOutliner;
+        mpOutliner = nullptr;
+    }
+
+    if (mpMetadataAuthor)
+    {
+        mpMetadataAuthor->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+    }
+    mpMetadataAuthor.disposeAndClear();
+
+    if (mpMetadataDate)
+    {
+        mpMetadataDate->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+    }
+    mpMetadataDate.disposeAndClear();
+
+    if (mpVScrollbar)
+    {
+        mpVScrollbar->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+    }
+    mpVScrollbar.disposeAndClear();
+
+    RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+
+    sidebarwindows::AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
+    mpAnchor = nullptr;
+
+    sidebarwindows::ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
+    mpShadow = nullptr;
+
+    delete mpTextRangeOverlay;
+    mpTextRangeOverlay = nullptr;
+
+    mpMenuButton.disposeAndClear();
+
+    if (mnEventId)
+        Application::RemoveUserEvent( mnEventId );
+
+    vcl::Window::dispose();
 }
 
 void SwAnnotationWin::SetPostItText()
@@ -155,7 +262,16 @@ void SwAnnotationWin::Delete()
 {
     if (DocView().GetWrtShellPtr()->GotoField(*mpFormatField))
     {
-        SwSidebarWin::Delete();
+        if ( mrMgr.GetActiveSidebarWin() == this)
+        {
+            mrMgr.SetActiveSidebarWin(nullptr);
+            // if the note is empty, the previous line will send a delete event, but we are already there
+            if (mnEventId)
+            {
+                Application::RemoveUserEvent( mnEventId );
+                mnEventId = nullptr;
+            }
+        }
         // we delete the field directly, the Mgr cleans up the PostIt by listening
         GrabFocusToDocument();
         DocView().GetWrtShellPtr()->ClearMark();
@@ -245,7 +361,7 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
         return;
 
     //collect our old meta data
-    SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
+    SwAnnotationWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
     const SvtSysLocale aSysLocale;
     const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
     SwRewriter aRewriter;
@@ -323,7 +439,7 @@ SvxLanguageItem SwAnnotationWin::GetLanguage()
 
 bool SwAnnotationWin::IsProtected()
 {
-    return SwSidebarWin::IsProtected() ||
+    return mbReadonly ||
            GetLayoutStatus() == SwPostItHelper::DELETED ||
            ( mpFormatField && mpFormatField->IsProtect() );
 }
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
similarity index 85%
rename from sw/source/uibase/docvw/SidebarWin.cxx
rename to sw/source/uibase/docvw/AnnotationWin2.cxx
index 7c3d69c7d69e..30d5648f652b 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -22,9 +22,9 @@
 #include <cstddef>
 #include <cstdlib>
 
-#include <SidebarWin.hxx>
 #include <SidebarWinAcc.hxx>
 #include <PostItMgr.hxx>
+#include <AnnotationWin.hxx>
 #include <basegfx/range/b2drange.hxx>
 #include <comphelper/string.hxx>
 #include <SidebarTxtControl.hxx>
@@ -87,6 +87,8 @@
 #include <IDocumentDrawModelAccess.hxx>
 #include <drawdoc.hxx>
 
+using namespace sw::sidebarwindows;
+
 namespace
 {
 
@@ -122,7 +124,7 @@ void lcl_translateTwips(vcl::Window& rParent, vcl::Window& rChild, MouseEvent* p
 }
 
 /// Decide which one from the children of rParent should get rMouseEvent.
-vcl::Window* lcl_getHitWindow(sw::sidebarwindows::SwSidebarWin& rParent, const MouseEvent& rMouseEvent)
+vcl::Window* lcl_getHitWindow(sw::annotation::SwAnnotationWin& rParent, const MouseEvent& rMouseEvent)
 {
     vcl::Window* pRet = nullptr;
 
@@ -148,7 +150,7 @@ vcl::Window* lcl_getHitWindow(sw::sidebarwindows::SwSidebarWin& rParent, const M
 
 }
 
-namespace sw { namespace sidebarwindows {
+namespace sw { namespace annotation {
 
 #define METABUTTON_WIDTH        16
 #define METABUTTON_HEIGHT       18
@@ -156,125 +158,8 @@ namespace sw { namespace sidebarwindows {
 #define POSTIT_META_HEIGHT  (sal_Int32)     30
 #define POSTIT_MINIMUMSIZE_WITHOUT_META     50
 
-SwSidebarWin::SwSidebarWin(SwEditWin& rEditWin,
-                           WinBits nBits,
-                           SwPostItMgr& aMgr,
-                           SwSidebarItem& rSidebarItem)
-    : Window(&rEditWin, nBits)
-    , mrMgr(aMgr)
-    , mrView(rEditWin.GetView())
-    , mnEventId(nullptr)
-    , mpOutlinerView(nullptr)
-    , mpOutliner(nullptr)
-    , mpSidebarTextControl(nullptr)
-    , mpVScrollbar(nullptr)
-    , mpMetadataAuthor(nullptr)
-    , mpMetadataDate(nullptr)
-    , mpMenuButton(nullptr)
-    , mpAnchor(nullptr)
-    , mpShadow(nullptr)
-    , mpTextRangeOverlay(nullptr)
-    , mColorAnchor()
-    , mColorDark()
-    , mColorLight()
-    , mChangeColor()
-    , meSidebarPosition(sw::sidebarwindows::SidebarPosition::NONE)
-    , mPosSize()
-    , mAnchorRect()
-    , mPageBorder(0)
-    , mbAnchorRectChanged(false)
-    , mbMouseOver(false)
-    , mLayoutStatus(SwPostItHelper::INVISIBLE)
-    , mbReadonly(false)
-    , mbIsFollow(false)
-    , mrSidebarItem(rSidebarItem)
-    , mpAnchorFrame(rSidebarItem.maLayoutInfo.mpAnchorFrame)
-{
-    mpShadow = ShadowOverlayObject::CreateShadowOverlayObject( mrView );
-    if ( mpShadow )
-    {
-        mpShadow->setVisible(false);
-    }
-
-    mrMgr.ConnectSidebarWinToFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
-                                  mrSidebarItem.GetFormatField(),
-                                  *this );
-}
-
-SwSidebarWin::~SwSidebarWin()
-{
-    disposeOnce();
-}
-
-void SwSidebarWin::dispose()
-{
-    if (IsDisposed())
-        return;
-
-    mrMgr.DisconnectSidebarWinFromFrame( *(mrSidebarItem.maLayoutInfo.mpAnchorFrame),
-                                       *this );
-
-    Disable();
-
-    if ( mpSidebarTextControl )
-    {
-        if ( mpOutlinerView )
-        {
-            mpOutlinerView->SetWindow( nullptr );
-        }
-    }
-    mpSidebarTextControl.disposeAndClear();
-
-    if ( mpOutlinerView )
-    {
-        delete mpOutlinerView;
-        mpOutlinerView = nullptr;
-    }
-
-    if (mpOutliner)
-    {
-        delete mpOutliner;
-        mpOutliner = nullptr;
-    }
-
-    if (mpMetadataAuthor)
-    {
-        mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
-    }
-    mpMetadataAuthor.disposeAndClear();
-
-    if (mpMetadataDate)
-    {
-        mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
-    }
-    mpMetadataDate.disposeAndClear();
-
-    if (mpVScrollbar)
-    {
-        mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
-    }
-    mpVScrollbar.disposeAndClear();
-
-    RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
-
-    AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
-    mpAnchor = nullptr;
-
-    ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
-    mpShadow = nullptr;
-
-    delete mpTextRangeOverlay;
-    mpTextRangeOverlay = nullptr;
-
-    mpMenuButton.disposeAndClear();
 
-    if (mnEventId)
-        Application::RemoveUserEvent( mnEventId );
-
-    vcl::Window::dispose();
-}
-
-void SwSidebarWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
+void SwAnnotationWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
 {
     Window::Paint(rRenderContext, rRect);
 
@@ -304,7 +189,7 @@ void SwSidebarWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
     }
 }
 
-void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
+void SwAnnotationWin::PaintTile(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
 {
     Paint(rRenderContext, rRect);
 
@@ -363,13 +248,13 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const tools::Re
     rRenderContext.Push(PushFlags::NONE);
 }
 
-bool SwSidebarWin::IsHitWindow(const Point& rPointLogic)
+bool SwAnnotationWin::IsHitWindow(const Point& rPointLogic)
 {
     tools::Rectangle aRectangleLogic(EditWin().PixelToLogic(GetPosPixel()), EditWin().PixelToLogic(GetSizePixel()));
     return aRectangleLogic.IsInside(rPointLogic);
 }
 
-void SwSidebarWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
+void SwAnnotationWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
 {
     mpSidebarTextControl->Push(PushFlags::MAPMODE);
     MouseEvent aMouseEvent(rPosition);
@@ -382,7 +267,7 @@ void SwSidebarWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, b
     mpSidebarTextControl->Pop();
 }
 
-void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, DrawFlags nInFlags)
+void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, DrawFlags nInFlags)
 {
     if (mpMetadataAuthor->IsVisible() )
     {
@@ -450,7 +335,7 @@ void SwSidebarWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz, D
     }
 }
 
-void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent)
+void SwAnnotationWin::KeyInput(const KeyEvent& rKeyEvent)
 {
     if (mpSidebarTextControl)
     {
@@ -463,7 +348,7 @@ void SwSidebarWin::KeyInput(const KeyEvent& rKeyEvent)
     }
 }
 
-void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent)
+void SwAnnotationWin::MouseMove(const MouseEvent& rMouseEvent)
 {
     if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
     {
@@ -477,7 +362,7 @@ void SwSidebarWin::MouseMove(const MouseEvent& rMouseEvent)
     }
 }
 
-void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent)
+void SwAnnotationWin::MouseButtonDown(const MouseEvent& rMouseEvent)
 {
     if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
     {
@@ -491,7 +376,7 @@ void SwSidebarWin::MouseButtonDown(const MouseEvent& rMouseEvent)
     }
 }
 
-void SwSidebarWin::MouseButtonUp(const MouseEvent& rMouseEvent)
+void SwAnnotationWin::MouseButtonUp(const MouseEvent& rMouseEvent)
 {
     if (vcl::Window* pHit = lcl_getHitWindow(*this, rMouseEvent))
     {
@@ -505,7 +390,7 @@ void SwSidebarWin::MouseButtonUp(const MouseEvent& rMouseEvent)
     }
 }
 
-void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight,
+void SwAnnotationWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeight,
                                        const SwRect& aAnchorRect, const long aPageBorder)
 {
     mPosSize = tools::Rectangle(Point(nX,nY),Size(nWidth,nHeight));
@@ -515,22 +400,22 @@ void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeig
     mPageBorder = aPageBorder;
 }
 
-void SwSidebarWin::SetSize( const Size& rNewSize )
+void SwAnnotationWin::SetSize( const Size& rNewSize )
 {
     mPosSize.SetSize(rNewSize);
 }
 
-void SwSidebarWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
+void SwAnnotationWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
 {
     mPosSize = tools::Rectangle(aPoint,aSize);
 }
 
-void SwSidebarWin::TranslateTopPosition(const long aAmount)
+void SwAnnotationWin::TranslateTopPosition(const long aAmount)
 {
     mPosSize.Move(0,aAmount);
 }
 
-void SwSidebarWin::ShowAnchorOnly(const Point &aPoint)
+void SwAnnotationWin::ShowAnchorOnly(const Point &aPoint)
 {
     HideNote();
     SetPosAndSize();
@@ -545,16 +430,16 @@ void SwSidebarWin::ShowAnchorOnly(const Point &aPoint)
         mpShadow->setVisible(false);
 }
 
-SfxItemSet SwSidebarWin::DefaultItem()
+SfxItemSet SwAnnotationWin::DefaultItem()
 {
     SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
     aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
     return aItem;
 }
 
-void SwSidebarWin::InitControls()
+void SwAnnotationWin::InitControls()
 {
-    AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+    AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
 
     // actual window which holds the user text
     mpSidebarTextControl = VclPtr<SidebarTextControl>::Create( *this,
@@ -569,7 +454,7 @@ void SwSidebarWin::InitControls()
     mpMetadataAuthor->SetReadOnly();
     mpMetadataAuthor->AlwaysDisableInput(true);
     mpMetadataAuthor->SetCallHandlersOnInputDisabled(true);
-    mpMetadataAuthor->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+    mpMetadataAuthor->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
     // we should leave this setting alone, but for this we need a better layout algo
     // with variable meta size height
     {
@@ -588,7 +473,7 @@ void SwSidebarWin::InitControls()
     mpMetadataDate->SetReadOnly();
     mpMetadataDate->AlwaysDisableInput(true);
     mpMetadataDate->SetCallHandlersOnInputDisabled(true);
-    mpMetadataDate->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+    mpMetadataDate->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
     // we should leave this setting alone, but for this we need a better layout algo
     // with variable meta size height
     {
@@ -625,9 +510,9 @@ void SwSidebarWin::InitControls()
     mpVScrollbar = VclPtr<SidebarScrollBar>::Create(*this, WB_3DLOOK |WB_VSCROLL|WB_DRAG, mrView);
     mpVScrollbar->EnableNativeWidget(false);
     mpVScrollbar->EnableRTL( false );
-    mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
+    mpVScrollbar->SetScrollHdl(LINK(this, SwAnnotationWin, ScrollHdl));
     mpVScrollbar->EnableDrag();
-    mpVScrollbar->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+    mpVScrollbar->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
 
     const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
     EEControlBits nCntrl = mpOutliner->GetControlWord();
@@ -663,7 +548,7 @@ void SwSidebarWin::InitControls()
     mpVScrollbar->Show();
 }
 
-void SwSidebarWin::CheckMetaText()
+void SwAnnotationWin::CheckMetaText()
 {
     const SvtSysLocale aSysLocale;
     const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
@@ -700,7 +585,7 @@ void SwSidebarWin::CheckMetaText()
     }
 }
 
-void SwSidebarWin::Rescale()
+void SwAnnotationWin::Rescale()
 {
     MapMode aMode = GetParent()->GetMapMode();
     aMode.SetOrigin( Point() );
@@ -726,7 +611,7 @@ void SwSidebarWin::Rescale()
     }
 }
 
-void SwSidebarWin::SetPosAndSize()
+void SwAnnotationWin::SetPosAndSize()
 {
     bool bChange = false;
 
@@ -776,7 +661,7 @@ void SwSidebarWin::SetPosAndSize()
             }
             break;
             default:
-                OSL_FAIL( "<SwSidebarWin::SetPosAndSize()> - unexpected position of sidebar" );
+                OSL_FAIL( "<SwAnnotationWin::SetPosAndSize()> - unexpected position of sidebar" );
             break;
         }
 
@@ -860,7 +745,7 @@ void SwSidebarWin::SetPosAndSize()
             {
                 mpAnchor->SetAnchorState(AnchorState::All);
             }
-            SwSidebarWin* pWin = GetTopReplyNote();
+            SwAnnotationWin* pWin = GetTopReplyNote();
             // #i111964#
             if ( pWin && pWin->Anchor() )
             {
@@ -962,7 +847,7 @@ void SwSidebarWin::SetPosAndSize()
     }
 }
 
-void SwSidebarWin::DoResize()
+void SwAnnotationWin::DoResize()
 {
     long aTextHeight    =  LogicToPixel( mpOutliner->CalcTextSize()).Height();
     long aHeight        =  GetSizePixel().Height();
@@ -1032,7 +917,7 @@ void SwSidebarWin::DoResize()
                                    METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() );
 }
 
-void SwSidebarWin::SetSizePixel( const Size& rNewSize )
+void SwAnnotationWin::SetSizePixel( const Size& rNewSize )
 {
     Window::SetSizePixel(rNewSize);
 
@@ -1044,12 +929,12 @@ void SwSidebarWin::SetSizePixel( const Size& rNewSize )
     }
 }
 
-void SwSidebarWin::SetScrollbar()
+void SwAnnotationWin::SetScrollbar()
 {
     mpVScrollbar->SetThumbPos(mpOutlinerView->GetVisArea().Top());
 }
 
-void SwSidebarWin::ResizeIfNecessary(long aOldHeight, long aNewHeight)
+void SwAnnotationWin::ResizeIfNecessary(long aOldHeight, long aNewHeight)
 {
     if (aOldHeight != aNewHeight)
     {
@@ -1087,7 +972,7 @@ void SwSidebarWin::ResizeIfNecessary(long aOldHeight, long aNewHeight)
     }
 }
 
-void SwSidebarWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
+void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
 {
     mColorDark =  aColorDark;
     mColorLight = aColorLight;
@@ -1124,18 +1009,18 @@ void SwSidebarWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnch
     }
 }
 
-void SwSidebarWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
+void SwAnnotationWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
 {
     meSidebarPosition = eSidebarPosition;
 }
 
-void SwSidebarWin::SetReadonly(bool bSet)
+void SwAnnotationWin::SetReadonly(bool bSet)
 {
     mbReadonly = bSet;
     GetOutlinerView()->SetReadOnly(bSet);
 }
 
-void SwSidebarWin::SetLanguage(const SvxLanguageItem& rNewItem)
+void SwAnnotationWin::SetLanguage(const SvxLanguageItem& rNewItem)
 {
     Link<LinkParamNone*,void> aLink = Engine()->GetModifyHdl();
     Engine()->SetModifyHdl( Link<LinkParamNone*,void>() );
@@ -1167,17 +1052,17 @@ void SwSidebarWin::SetLanguage(const SvxLanguageItem& rNewItem)
     Invalidate();
 }
 
-void SwSidebarWin::GetFocus()
+void SwAnnotationWin::GetFocus()
 {
     if (mpSidebarTextControl)
         mpSidebarTextControl->GrabFocus();
 }
 
-void SwSidebarWin::LoseFocus()
+void SwAnnotationWin::LoseFocus()
 {
 }
 
-void SwSidebarWin::ShowNote()
+void SwAnnotationWin::ShowNote()
 {
     SetPosAndSize();
     if (!IsVisible())
@@ -1191,7 +1076,7 @@ void SwSidebarWin::ShowNote()
     InvalidateControl();
 }
 
-void SwSidebarWin::HideNote()
+void SwAnnotationWin::HideNote()
 {
     if (IsVisible())
         Window::Hide();
@@ -1206,7 +1091,7 @@ void SwSidebarWin::HideNote()
         mpShadow->setVisible(false);
 }
 
-void SwSidebarWin::InvalidateControl()
+void SwAnnotationWin::InvalidateControl()
 {
     // Invalidate.
     mpSidebarTextControl->Push(PushFlags::MAPMODE);
@@ -1215,7 +1100,7 @@ void SwSidebarWin::InvalidateControl()
     mpSidebarTextControl->Pop();
 }
 
-void SwSidebarWin::ActivatePostIt()
+void SwAnnotationWin::ActivatePostIt()
 {
     mrMgr.AssureStdModeAtShell();
 
@@ -1232,7 +1117,7 @@ void SwSidebarWin::ActivatePostIt()
         GetOutlinerView()->SetBackgroundColor(mColorDark);
 }
 
-void SwSidebarWin::DeactivatePostIt()
+void SwAnnotationWin::DeactivatePostIt()
 {
     // remove selection, #i87073#
     if (GetOutlinerView()->GetEditView().HasSelection())
@@ -1260,11 +1145,11 @@ void SwSidebarWin::DeactivatePostIt()
 
     if ( !IsProtected() && Engine()->GetEditEngine().GetText().isEmpty() )
     {
-        mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), nullptr, true );
+        mnEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
     }
 }
 
-void SwSidebarWin::ToggleInsMode()
+void SwAnnotationWin::ToggleInsMode()
 {
     if (!mrView.GetWrtShell().IsRedlineOn())
     {
@@ -1279,7 +1164,7 @@ void SwSidebarWin::ToggleInsMode()
     }
 }
 
-void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot)
+void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
 {
     mrMgr.AssureStdModeAtShell();
 
@@ -1304,7 +1189,7 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot)
         case FN_DELETE_COMMENT:
 
             //Delete(); // do not kill the parent of our open popup menu
-            mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), nullptr, true );
+            mnEventId = Application::PostUserEvent( LINK( this, SwAnnotationWin, DeleteHdl), nullptr, true );
             break;
         case FN_FORMAT_ALL_NOTES:
         case FN_DELETE_ALL_NOTES:
@@ -1329,24 +1214,24 @@ void SwSidebarWin::ExecuteCommand(sal_uInt16 nSlot)
     }
 }
 
-SwEditWin&  SwSidebarWin::EditWin()
+SwEditWin&  SwAnnotationWin::EditWin()
 {
     return mrView.GetEditWin();
 }
 
-long SwSidebarWin::GetPostItTextHeight()
+long SwAnnotationWin::GetPostItTextHeight()
 {
     return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
 }
 
-void SwSidebarWin::SwitchToPostIt(sal_uInt16 aDirection)
+void SwAnnotationWin::SwitchToPostIt(sal_uInt16 aDirection)
 {
-    SwSidebarWin* pPostIt = mrMgr.GetNextPostIt(aDirection, this);
+    SwAnnotationWin* pPostIt = mrMgr.GetNextPostIt(aDirection, this);
     if (pPostIt)
         pPostIt->GrabFocus();
 }
 
-IMPL_LINK( SwSidebarWin, WindowEventListener, VclWindowEvent&, rEvent, void )
+IMPL_LINK( SwAnnotationWin, WindowEventListener, VclWindowEvent&, rEvent, void )
 {
     if ( rEvent.GetId() == VclEventId::WindowMouseMove )
     {
@@ -1381,73 +1266,59 @@ IMPL_LINK( SwSidebarWin, WindowEventListener, VclWindowEvent&, rEvent, void )
     }
 }
 
-void SwSidebarWin::Delete()
-{
-    if ( mrMgr.GetActiveSidebarWin() == this)
-    {
-        mrMgr.SetActiveSidebarWin(nullptr);
-        // if the note is empty, the previous line will send a delete event, but we are already there
-        if (mnEventId)
-        {
-            Application::RemoveUserEvent( mnEventId );
-            mnEventId = nullptr;
-        }
-    }
-}
-
-IMPL_LINK(SwSidebarWin, ScrollHdl, ScrollBar*, pScroll, void)
+IMPL_LINK(SwAnnotationWin, ScrollHdl, ScrollBar*, pScroll, void)
 {
     long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
     GetOutlinerView()->Scroll( 0, nDiff );
 }
 
-IMPL_LINK_NOARG(SwSidebarWin, ModifyHdl, LinkParamNone*, void)
+IMPL_LINK_NOARG(SwAnnotationWin, ModifyHdl, LinkParamNone*, void)
 {
     mrView.GetDocShell()->SetModified();
 }
 
-IMPL_LINK_NOARG(SwSidebarWin, DeleteHdl, void*, void)
+IMPL_LINK_NOARG(SwAnnotationWin, DeleteHdl, void*, void)
 {
     mnEventId = nullptr;
     Delete();
 }
 
-void SwSidebarWin::ResetAttributes()
+void SwAnnotationWin::ResetAttributes()
 {
     mpOutlinerView->RemoveAttribsKeepLanguages(true);
     mpOutliner->RemoveFields();
     mpOutlinerView->SetAttribs(DefaultItem());
 }
 
-sal_Int32 SwSidebarWin::GetScrollbarWidth()
+sal_Int32 SwAnnotationWin::GetScrollbarWidth()
 {
     return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
 }
 
-sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
+sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth()
 {
     const Fraction& f( GetMapMode().GetScaleX() );
     return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
 }
 
-sal_Int32 SwSidebarWin::GetMetaHeight()
+sal_Int32 SwAnnotationWin::GetMetaHeight()
 {
     const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
     return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
 }
 
-sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
+sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta()
 {
     return mrMgr.GetMinimumSizeWithMeta();
 }
 
-sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
+sal_Int32 SwAnnotationWin::GetMinimumSizeWithoutMeta()
 {
     const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
     return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
 }
 
-void SwSidebarWin::SetSpellChecking()
+void SwAnnotationWin::SetSpellChecking()
 {
     const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
     EEControlBits nCntrl = mpOutliner->GetControlWord();
@@ -1461,7 +1332,7 @@ void SwSidebarWin::SetSpellChecking()
     Invalidate();
 }
 
-void SwSidebarWin::SetViewState(ViewState bViewState)
+void SwAnnotationWin::SetViewState(ViewState bViewState)
 {
     switch (bViewState)
     {
@@ -1470,7 +1341,7 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
             if (mpAnchor)
             {
                 mpAnchor->SetAnchorState(AnchorState::All);
-                SwSidebarWin* pWin = GetTopReplyNote();
+                SwAnnotationWin* pWin = GetTopReplyNote();
                 // #i111964#
                 if ( pWin && pWin->Anchor() )
                 {
@@ -1509,8 +1380,8 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
                     // if there is no visible parent note, we want to see the complete anchor ??
                     //if (IsAnyStackParentVisible())
                     mpAnchor->SetAnchorState(AnchorState::End);
-                    SwSidebarWin* pTopWinSelf = GetTopReplyNote();
-                    SwSidebarWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
+                    SwAnnotationWin* pTopWinSelf = GetTopReplyNote();
+                    SwAnnotationWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
                                                   ? mrMgr.GetActiveSidebarWin()->GetTopReplyNote()
                                                   : nullptr;
                     // #i111964#
@@ -1543,10 +1414,10 @@ void SwSidebarWin::SetViewState(ViewState bViewState)
     }
 }
 
-SwSidebarWin* SwSidebarWin::GetTopReplyNote()
+SwAnnotationWin* SwAnnotationWin::GetTopReplyNote()
 {
-    SwSidebarWin* pTopNote = nullptr;
-    SwSidebarWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
+    SwAnnotationWin* pTopNote = nullptr;
+    SwAnnotationWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : nullptr;
     while (pSidebarWin)
     {
         pTopNote = pSidebarWin;
@@ -1555,7 +1426,7 @@ SwSidebarWin* SwSidebarWin::GetTopReplyNote()
     return pTopNote;
 }
 
-void SwSidebarWin::SwitchToFieldPos()
+void SwAnnotationWin::SwitchToFieldPos()
 {
     if ( mrMgr.GetActiveSidebarWin() == this )
             mrMgr.SetActiveSidebarWin(nullptr);
@@ -1566,12 +1437,7 @@ void SwSidebarWin::SwitchToFieldPos()
     GrabFocusToDocument();
 }
 
-SvxLanguageItem SwSidebarWin::GetLanguage()
-{
-    return SvxLanguageItem(SwLangHelper::GetLanguage(mrView.GetWrtShell(),RES_CHRATR_LANGUAGE),RES_CHRATR_LANGUAGE);
-}
-
-void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayoutStatus,
+void SwAnnotationWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayoutStatus,
                                       const Color& aChangeColor )
 {
     if ( (mLayoutStatus != aLayoutStatus) ||
@@ -1583,17 +1449,17 @@ void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayo
     }
 }
 
-bool SwSidebarWin::HasScrollbar() const
+bool SwAnnotationWin::HasScrollbar() const
 {
     return mpVScrollbar != nullptr;
 }
 
-bool SwSidebarWin::IsScrollbarVisible() const
+bool SwAnnotationWin::IsScrollbarVisible() const
 {
     return HasScrollbar() && mpVScrollbar->IsVisible();
 }
 
-void SwSidebarWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
+void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
 {
     const bool bAnchorChanged = mpAnchorFrame != rSidebarItem.maLayoutInfo.mpAnchorFrame;
     if ( bAnchorChanged )
@@ -1609,7 +1475,7 @@ void SwSidebarWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
         SidebarWinAccessible* pAcc =
                         static_cast<SidebarWinAccessible*>( GetWindowPeer() );
         OSL_ENSURE( dynamic_cast<SidebarWinAccessible*>( GetWindowPeer() ),
-                "<SwSidebarWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
+                "<SwAnnotationWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
         pAcc->ChangeSidebarItem( mrSidebarItem );
     }
 
@@ -1621,7 +1487,7 @@ void SwSidebarWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
     }
 }
 
-css::uno::Reference< css::accessibility::XAccessible > SwSidebarWin::CreateAccessible()
+css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
 {
     SidebarWinAccessible* pAcc( new SidebarWinAccessible( *this,
                                                           mrView.GetWrtShell(),
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index c5e3b99d5f1c..2e67fc07aa2e 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -23,7 +23,6 @@
 #include <postithelper.hxx>
 
 #include <AnnotationWin.hxx>
-#include <SidebarWin.hxx>
 #include <frmsidebarwincontainer.hxx>
 #include <accmap.hxx>
 
@@ -99,6 +98,7 @@
 #define MAX_LOOP_COUNT                      50
 
 using namespace sw::sidebarwindows;
+using namespace sw::annotation;
 
 namespace {
 
@@ -149,7 +149,7 @@ namespace {
         aAnnotation.put("id", nPostItId);
         if (nType != CommentNotificationType::Remove && pItem != nullptr)
         {
-            sw::annotation::SwAnnotationWin* pWin = static_cast<sw::annotation::SwAnnotationWin*>((pItem)->pPostIt.get());
+            sw::annotation::SwAnnotationWin* pWin = pItem->pPostIt.get();
 
             const SwPostItField* pField = pWin->GetPostItField();
             const SwRect& aRect = pWin->GetAnchorRect();
@@ -696,7 +696,7 @@ void SwPostItMgr::LayoutPostIts()
             // only layout if there are notes on this page
             if (pPage->mList->size()>0)
             {
-                std::list<SwSidebarWin*>    aVisiblePostItList;
+                std::list<SwAnnotationWin*> aVisiblePostItList;
                 unsigned long           lNeededHeight = 0;
                 long                    mlPageBorder = 0;
                 long                    mlPageEnd = 0;
@@ -704,7 +704,7 @@ void SwPostItMgr::LayoutPostIts()
                 for(SwSidebarItem_iterator i = pPage->mList->begin(); i != pPage->mList->end(); ++i)
                 {
                     SwSidebarItem* pItem = (*i);
-                    VclPtr<SwSidebarWin> pPostIt = pItem->pPostIt;
+                    VclPtr<SwAnnotationWin> pPostIt = pItem->pPostIt;
 
                     if (pPage->eSidebarPosition == sw::sidebarwindows::SidebarPosition::LEFT )
                     {
@@ -741,7 +741,7 @@ void SwPostItMgr::LayoutPostIts()
                             if (mpAnswer)
                             {
                                 if (static_cast<bool>(pPostIt->CalcParent())) //do we really have another note in front of this one
-                                    static_cast<sw::annotation::SwAnnotationWin*>(pPostIt.get())->InitAnswer(mpAnswer);
+                                    pPostIt.get()->InitAnswer(mpAnswer);
                                 delete mpAnswer;
                                 mpAnswer = nullptr;
                             }
@@ -807,7 +807,7 @@ void SwPostItMgr::LayoutPostIts()
                                        - enlarge all notes till GetNextBorder(), as we resized to average value before
                                        */
                     //lets hide the ones which overlap the page
-                    for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+                    for(SwAnnotationWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
                     {
                         if (pPage->lOffset != 0)
                             (*i)->TranslateTopPosition(pPage->lOffset);
@@ -857,7 +857,7 @@ void SwPostItMgr::LayoutPostIts()
                 }
                 else
                 {
-                    for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+                    for(SwAnnotationWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
                     {
                         (*i)->SetPosAndSize();
                     }
@@ -867,7 +867,7 @@ void SwPostItMgr::LayoutPostIts()
                     bUpdate = (bOldScrollbar != pPage->bScrollbar) || bUpdate;
                 }
 
-                for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+                for(SwAnnotationWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
                 {
                     if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isTiledAnnotations())
                     {
@@ -962,7 +962,7 @@ void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
         return;
     for(SwSidebarItem_iterator i = mPages[nPage]->mList->begin(); i != mPages[nPage]->mList->end(); ++i)
     {
-        SwSidebarWin* pPostIt = (*i)->pPostIt;
+        SwAnnotationWin* pPostIt = (*i)->pPostIt;
         if (!pPostIt)
             continue;
         Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
@@ -975,7 +975,7 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const tools::Rectangle
 {
     for (SwSidebarItem* pItem : mvPostItFields)
     {
-        SwSidebarWin* pPostIt = pItem->pPostIt;
+        SwAnnotationWin* pPostIt = pItem->pPostIt;
         if (!pPostIt)
             continue;
 
@@ -1009,7 +1009,7 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
     const long aSidebarheight = mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height();
     for(SwSidebarItem_iterator i = mPages[aPage-1]->mList->begin(); i != mPages[aPage-1]->mList->end(); ++i)
     {
-        SwSidebarWin* pPostIt = (*i)->pPostIt;
+        SwAnnotationWin* pPostIt = (*i)->pPostIt;
         // if this is an answer, we should take the normal position and not the real, slightly moved position
         pPostIt->SetVirtualPosSize(pPostIt->GetPosPixel(),pPostIt->GetSizePixel());
         pPostIt->TranslateTopPosition(lScroll);
@@ -1049,7 +1049,7 @@ void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
     }
 }
 
-void SwPostItMgr::AutoScroll(const SwSidebarWin* pPostIt,const unsigned long aPage )
+void SwPostItMgr::AutoScroll(const SwAnnotationWin* pPostIt,const unsigned long aPage )
 {
     // otherwise all notes are visible
     if (mPages[aPage-1]->bScrollbar)
@@ -1069,7 +1069,7 @@ void SwPostItMgr::AutoScroll(const SwSidebarWin* pPostIt,const unsigned long aPa
     }
 }
 
-void SwPostItMgr::MakeVisible(const SwSidebarWin* pPostIt )
+void SwPostItMgr::MakeVisible(const SwAnnotationWin* pPostIt )
 {
     long aPage = -1;
     // we don't know the page yet, lets find it ourselves
@@ -1125,7 +1125,7 @@ Color SwPostItMgr::GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) cons
     }
 }
 
-bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList, const tools::Rectangle& rBorder, long lNeededHeight)
+bool SwPostItMgr::LayoutByPage(std::list<SwAnnotationWin*> &aVisiblePostItList, const tools::Rectangle& rBorder, long lNeededHeight)
 {
     /*** General layout idea:***/
     //  - if we have space left, we always move the current one up,
@@ -1152,12 +1152,12 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList, con
             bScrollbars = true;
             lTopBorder += GetSidebarScrollerHeight() + 10;
             lBottomBorder -= (GetSidebarScrollerHeight() + 10);
-                for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+                for(SwAnnotationWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
                     (*i)->SetSize(Size((*i)->VirtualSize().getWidth(),(*i)->GetMinimumSizeWithMeta()));
         }
         else
         {
-            for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+            for(SwAnnotationWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
             {
                 if ( (*i)->VirtualSize().getHeight() > lAverageHeight)
                     (*i)->SetSize(Size((*i)->VirtualSize().getWidth(),lAverageHeight));
@@ -1176,9 +1176,9 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList, con
             loop++;
             bDone = true;
             long lSpaceUsed = lTopBorder + GetSpaceBetween();
-            for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+            for(SwAnnotationWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
             {
-                SwSidebarWin_iterator aNextPostIt = i;
+                SwAnnotationWin_iterator aNextPostIt = i;
                 ++aNextPostIt;
 
                 if (aNextPostIt != aVisiblePostItList.end())
@@ -1241,7 +1241,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList, con
                 else
                 {
                     //(*i) is the last visible item
-                    SwSidebarWin_iterator aPrevPostIt = i;
+                    SwAnnotationWin_iterator aPrevPostIt = i;
                     --aPrevPostIt;
                     lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() ) - (*i)->VirtualPos().Y();
                     if (lTranslatePos > 0)
@@ -1282,7 +1282,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList, con
     else
     {
         // only one left, make sure it is not hidden at the top or bottom
-        SwSidebarWin_iterator i = aVisiblePostItList.begin();
+        SwAnnotationWin_iterator i = aVisiblePostItList.begin();
         lTranslatePos = lTopBorder - (*i)->VirtualPos().Y();
         if (lTranslatePos>0)
         {
@@ -1513,7 +1513,7 @@ void SwPostItMgr::Delete(sal_uInt32 nPostItId)
 {
     mpWrtShell->StartAllAction();
     if (HasActiveSidebarWin() &&
-        static_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt.get())->GetPostItField()->GetPostItId() == nPostItId)
+        mpActivePostIt.get()->GetPostItField()->GetPostItId() == nPostItId)
     {
         SetActiveSidebarWin(nullptr);
     }
@@ -1563,8 +1563,8 @@ void SwPostItMgr::ExecuteFormatAllDialog(SwView& rView)
 {
     if (mvPostItFields.empty())
         return;
-    sw::sidebarwindows::SwSidebarWin *pOrigActiveWin = GetActiveSidebarWin();
-    sw::sidebarwindows::SwSidebarWin *pWin = pOrigActiveWin;
+    sw::annotation::SwAnnotationWin *pOrigActiveWin = GetActiveSidebarWin();
+    sw::annotation::SwAnnotationWin *pWin = pOrigActiveWin;
     if (!pWin)
     {
         for (SwSidebarItem_iterator i = mvPostItFields.begin(); i != mvPostItFields.end(); ++i)
@@ -1664,7 +1664,7 @@ void SwPostItMgr::Show()
     LayoutPostIts();
 }
 
-SwSidebarWin* SwPostItMgr::GetSidebarWin( const SfxBroadcaster* pBroadcaster) const
+SwAnnotationWin* SwPostItMgr::GetSidebarWin( const SfxBroadcaster* pBroadcaster) const
 {
     for(const_iterator i = mvPostItFields.begin(); i != mvPostItFields.end() ; ++i)
     {
@@ -1694,8 +1694,8 @@ sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const sal_uInt32
     return nullptr;
 }
 
-SwSidebarWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
-                                          SwSidebarWin* aPostIt )
+SwAnnotationWin* SwPostItMgr::GetNextPostIt( sal_uInt16 aDirection,
+                                          SwAnnotationWin* aPostIt )
 {
     if (mvPostItFields.size()>1)
     {
@@ -1878,7 +1878,7 @@ vcl::Window* SwPostItMgr::IsHitSidebarWindow(const Point& rPointLogic)
 
         for (SwSidebarItem* pItem : mvPostItFields)
         {
-            SwSidebarWin* pPostIt = pItem->pPostIt;
+            SwAnnotationWin* pPostIt = pItem->pPostIt;
             if (!pPostIt)
                 continue;
 
@@ -1956,7 +1956,7 @@ void SwPostItMgr::CorrectPositions()
         return;
 
     // find first valid note
-    SwSidebarWin *pFirstPostIt = nullptr;
+    SwAnnotationWin *pFirstPostIt = nullptr;
     for(SwSidebarItem_iterator i = mvPostItFields.begin(); i != mvPostItFields.end() ; ++i)
     {
         pFirstPostIt = (*i)->pPostIt;
@@ -2088,14 +2088,14 @@ Color SwPostItMgr::GetColorAnchor(std::size_t aAuthorIndex)
         return Color(COL_WHITE);
 }
 
-void SwPostItMgr::SetActiveSidebarWin( SwSidebarWin* p)
+void SwPostItMgr::SetActiveSidebarWin( SwAnnotationWin* p)
 {
     if ( p != mpActivePostIt )
     {
         // we need the temp variable so we can set mpActivePostIt before we call DeactivatePostIt
         // therefore we get a new layout in DOCCHANGED when switching from postit to document,
         // otherwise, GetActivePostIt() would still hold our old postit
-        SwSidebarWin* pActive = mpActivePostIt;
+        SwAnnotationWin* pActive = mpActivePostIt;
         mpActivePostIt = p;
         if (pActive)
         {
@@ -2192,7 +2192,7 @@ void SwPostItMgr::CheckMetaText()
 
 sal_uInt16 SwPostItMgr::Replace(SvxSearchItem* pItem)
 {
-    SwSidebarWin* pWin = GetActiveSidebarWin();
+    SwAnnotationWin* pWin = GetActiveSidebarWin();
     sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( *pItem );
     if (!aResult)
         SetActiveSidebarWin(nullptr);
@@ -2201,7 +2201,7 @@ sal_uInt16 SwPostItMgr::Replace(SvxSearchItem* pItem)
 
 sal_uInt16 SwPostItMgr::FinishSearchReplace(const i18nutil::SearchOptions2& rSearchOptions, bool bSrchForward)
 {
-    SwSidebarWin* pWin = GetActiveSidebarWin();
+    SwAnnotationWin* pWin = GetActiveSidebarWin();
     SvxSearchItem aItem(SID_SEARCH_ITEM );
     aItem.SetSearchOptions(rSearchOptions);
     aItem.SetBackward(!bSrchForward);
@@ -2214,7 +2214,7 @@ sal_uInt16 SwPostItMgr::FinishSearchReplace(const i18nutil::SearchOptions2& rSea
 sal_uInt16 SwPostItMgr::SearchReplace(const SwFormatField &pField, const i18nutil::SearchOptions2& rSearchOptions, bool bSrchForward)
 {
     sal_uInt16 aResult = 0;
-    SwSidebarWin* pWin = GetSidebarWin(&pField);
+    SwAnnotationWin* pWin = GetSidebarWin(&pField);
     if (pWin)
     {
         ESelection aOldSelection = pWin->GetOutlinerView()->GetSelection();
@@ -2315,7 +2315,7 @@ void SwPostItMgr::ToggleInsModeOnActiveSidebarWin()
 
 void SwPostItMgr::ConnectSidebarWinToFrame( const SwFrame& rFrame,
                                           const SwFormatField& rFormatField,
-                                          SwSidebarWin& rSidebarWin )
+                                          SwAnnotationWin& rSidebarWin )
 {
     if ( mpFrameSidebarWinContainer == nullptr )
     {
@@ -2331,7 +2331,7 @@ void SwPostItMgr::ConnectSidebarWinToFrame( const SwFrame& rFrame,
 }
 
 void SwPostItMgr::DisconnectSidebarWinFromFrame( const SwFrame& rFrame,
-                                               SwSidebarWin& rSidebarWin )
+                                               SwAnnotationWin& rSidebarWin )
 {
     if ( mpFrameSidebarWinContainer != nullptr )
     {
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx
index bb23abe47369..7ad03a6c5225 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.cxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx
@@ -13,17 +13,17 @@
 #include <comphelper/lok.hxx>
 #include <sfx2/lokhelper.hxx>
 
-#include <SidebarWin.hxx>
 #include <view.hxx>
 #include <wrtsh.hxx>
 #include <edtwin.hxx>
+#include <AnnotationWin.hxx>
 
 namespace sw
 {
 namespace sidebarwindows
 {
 
-SidebarScrollBar::SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView)
+SidebarScrollBar::SidebarScrollBar(sw::annotation::SwAnnotationWin& rSidebarWin, WinBits nStyle, SwView& rView)
     : ScrollBar(&rSidebarWin, nStyle),
       m_rSidebarWin(rSidebarWin),
       m_rView(rView)
diff --git a/sw/source/uibase/docvw/SidebarScrollBar.hxx b/sw/source/uibase/docvw/SidebarScrollBar.hxx
index 19dae0a8b782..e85eaedf0798 100644
--- a/sw/source/uibase/docvw/SidebarScrollBar.hxx
+++ b/sw/source/uibase/docvw/SidebarScrollBar.hxx
@@ -14,17 +14,19 @@
 
 class SwView;
 
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
+} }
+
 namespace sw
 {
 namespace sidebarwindows
 {
 
-class SwSidebarWin;
-
 /// Similar to the VCL scrollbar, but instrumented with Writer-specific details for LOK.
 class SidebarScrollBar : public ScrollBar
 {
-    SwSidebarWin& m_rSidebarWin;
+    sw::annotation::SwAnnotationWin& m_rSidebarWin;
     SwView& m_rView;
 
 protected:
@@ -33,7 +35,7 @@ protected:
     void MouseMove(const MouseEvent& rMouseEvent) override;
     void MouseButtonUp(const MouseEvent& rMouseEvent) override;
 public:
-    SidebarScrollBar(SwSidebarWin& rSidebarWin, WinBits nStyle, SwView& rView);
+    SidebarScrollBar(sw::annotation::SwAnnotationWin& rSidebarWin, WinBits nStyle, SwView& rView);
     virtual ~SidebarScrollBar() override;
 };
 
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 32d43744524e..0d4cf9f0a41b 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -23,7 +23,6 @@
 #include <docsh.hxx>
 #include <doc.hxx>
 
-#include <SidebarWin.hxx>
 #include <PostItMgr.hxx>
 #include <edtwin.hxx>
 
@@ -56,11 +55,12 @@
 #include <view.hxx>
 #include <wrtsh.hxx>
 #include <shellres.hxx>
+#include <AnnotationWin.hxx>
 #include <memory>
 
 namespace sw { namespace sidebarwindows {
 
-SidebarTextControl::SidebarTextControl( SwSidebarWin& rSidebarWin,
+SidebarTextControl::SidebarTextControl( sw::annotation::SwAnnotationWin& rSidebarWin,
                                       WinBits nBits,
                                       SwView& rDocView,
                                       SwPostItMgr& rPostItMgr )
@@ -69,7 +69,7 @@ SidebarTextControl::SidebarTextControl( SwSidebarWin& rSidebarWin,
     , mrDocView( rDocView )
     , mrPostItMgr( rPostItMgr )
 {
-    AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+    AddEventListener( LINK( &mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener ) );
 }
 
 SidebarTextControl::~SidebarTextControl()
@@ -79,7 +79,7 @@ SidebarTextControl::~SidebarTextControl()
 
 void SidebarTextControl::dispose()
 {
-    RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+    RemoveEventListener( LINK( &mrSidebarWin, sw::annotation::SwAnnotationWin, WindowEventListener ) );
     Control::dispose();
 }
 
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
index daf9ab54fba6..7c13e62d93ab 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
@@ -26,15 +26,16 @@ class OutlinerView;
 class SwView;
 class SwPostItMgr;
 struct SpellCallbackInfo;
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
+} }
 
 namespace sw { namespace sidebarwindows {
 
-class SwSidebarWin;
-
 class SidebarTextControl : public Control
 {
     private:
-        SwSidebarWin& mrSidebarWin;
+        sw::annotation::SwAnnotationWin& mrSidebarWin;
         SwView& mrDocView;
         SwPostItMgr& mrPostItMgr;
 
@@ -49,7 +50,7 @@ class SidebarTextControl : public Control
         virtual Selection GetSurroundingTextSelection() const override;
 
     public:
-        SidebarTextControl( SwSidebarWin& rSidebarWin,
+        SidebarTextControl( sw::annotation::SwAnnotationWin& rSidebarWin,
                            WinBits nBits,
                            SwView& rDocView,
                            SwPostItMgr& rPostItMgr );
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx b/sw/source/uibase/docvw/SidebarWinAcc.cxx
index 1edda6d00bb2..ea1cb8de7b49 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.cxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx
@@ -18,8 +18,8 @@
  */
 
 #include <SidebarWinAcc.hxx>
+#include <AnnotationWin.hxx>
 
-#include <SidebarWin.hxx>
 #include <viewsh.hxx>
 #include <accmap.hxx>
 #include <toolkit/awt/vclxaccessiblecomponent.hxx>
@@ -32,7 +32,7 @@ namespace sw { namespace sidebarwindows {
 class SidebarWinAccessibleContext : public VCLXAccessibleComponent
 {
     public:
-        explicit SidebarWinAccessibleContext( SwSidebarWin& rSidebarWin,
+        explicit SidebarWinAccessibleContext( sw::annotation::SwAnnotationWin& rSidebarWin,
                                               SwViewShell& rViewShell,
                                               const SwFrame* pAnchorFrame )
             : VCLXAccessibleComponent( rSidebarWin.GetWindowPeer() )
@@ -89,8 +89,8 @@ class SidebarWinAccessibleContext : public VCLXAccessibleComponent
         ::osl::Mutex maMutex;
 };
 
-// implementation of accessible for <SwSidebarWin> instance
-SidebarWinAccessible::SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+// implementation of accessible for <SwAnnotationWin> instance
+SidebarWinAccessible::SidebarWinAccessible( sw::annotation::SwAnnotationWin& rSidebarWin,
                                             SwViewShell& rViewShell,
                                             const SwSidebarItem& rSidebarItem )
     : VCLXWindow()
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.hxx b/sw/source/uibase/docvw/SidebarWinAcc.hxx
index 869d06be4426..4d3880aa1374 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.hxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.hxx
@@ -25,15 +25,16 @@
 class SwViewShell;
 class SwSidebarItem;
 class SwFrame;
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
+} }
 
 namespace sw { namespace sidebarwindows {
 
-class SwSidebarWin;
-
 class SidebarWinAccessible : public VCLXWindow
 {
     public:
-        explicit SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+        explicit SidebarWinAccessible( sw::annotation::SwAnnotationWin& rSidebarWin,
                                        SwViewShell& rViewShell,
                                        const SwSidebarItem& rSidebarItem );
         virtual ~SidebarWinAccessible() override;
@@ -44,7 +45,7 @@ class SidebarWinAccessible : public VCLXWindow
         void ChangeSidebarItem( const SwSidebarItem& rSidebarItem );
 
     private:
-        SwSidebarWin& mrSidebarWin;
+        sw::annotation::SwAnnotationWin& mrSidebarWin;
         SwViewShell& mrViewShell;
         const SwFrame* mpAnchorFrame;
         bool bAccContextCreated;
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index b50bdd97b72e..ffede7f6c1a8 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -147,8 +147,8 @@
 #include <xmloff/odffields.hxx>
 
 #include <PostItMgr.hxx>
-#include <SidebarWin.hxx>
 #include <FrameControlsManager.hxx>
+#include <AnnotationWin.hxx>
 
 #include <algorithm>
 #include <vector>
@@ -6408,7 +6408,7 @@ void SwEditWin::SetCursorTwipPosition(const Point& rPosition, bool bPoint, bool
 
     if (m_rView.GetPostItMgr())
     {
-        if (sw::sidebarwindows::SwSidebarWin* pWin = m_rView.GetPostItMgr()->GetActiveSidebarWin())
+        if (sw::annotation::SwAnnotationWin* pWin = m_rView.GetPostItMgr()->GetActiveSidebarWin())
         {
             // Editing postit text.
             pWin->SetCursorLogicPosition(rPosition, bPoint, bClearMark);
diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
index 76e58c39609f..dc03b70ae055 100644
--- a/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
+++ b/sw/source/uibase/docvw/frmsidebarwincontainer.cxx
@@ -22,7 +22,7 @@
 #include <map>
 #include <fmtfld.hxx>
 #include <txtfld.hxx>
-#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
 
 namespace {
     struct SidebarWinKey
@@ -39,7 +39,7 @@ namespace {
         }
     };
 
-    typedef std::map < SidebarWinKey, VclPtr<sw::sidebarwindows::SwSidebarWin> > SidebarWinContainer;
+    typedef std::map < SidebarWinKey, VclPtr<sw::annotation::SwAnnotationWin> > SidebarWinContainer;
 
     struct FrameKey
     {
@@ -76,7 +76,7 @@ SwFrameSidebarWinContainer::~SwFrameSidebarWinContainer()
 
 bool SwFrameSidebarWinContainer::insert( const SwFrame& rFrame,
                                        const SwFormatField& rFormatField,
-                                       SwSidebarWin& rSidebarWin )
+                                       sw::annotation::SwAnnotationWin& rSidebarWin )
 {
     bool bInserted( false );
 
@@ -95,7 +95,7 @@ bool SwFrameSidebarWinContainer::insert( const SwFrame& rFrame,
 }
 
 bool SwFrameSidebarWinContainer::remove( const SwFrame& rFrame,
-                                       const SwSidebarWin& rSidebarWin )
+                                         const sw::annotation::SwAnnotationWin & rSidebarWin )
 {
     bool bRemoved( false );
 
@@ -134,10 +134,10 @@ bool SwFrameSidebarWinContainer::empty( const SwFrame& rFrame )
     return bEmpty;
 }
 
-SwSidebarWin* SwFrameSidebarWinContainer::get( const SwFrame& rFrame,
+sw::annotation::SwAnnotationWin* SwFrameSidebarWinContainer::get( const SwFrame& rFrame,
                                              const sal_Int32 nIndex )
 {
-    SwSidebarWin* pRet( nullptr );
+    sw::annotation::SwAnnotationWin* pRet( nullptr );
 
     FrameKey aFrameKey( &rFrame );
     FrameSidebarWinContainer::iterator aFrameIter = mpFrameSidebarWinContainer->find( aFrameKey );
diff --git a/sw/source/uibase/docvw/frmsidebarwincontainer.hxx b/sw/source/uibase/docvw/frmsidebarwincontainer.hxx
index 77594c969985..bfac1090cb12 100644
--- a/sw/source/uibase/docvw/frmsidebarwincontainer.hxx
+++ b/sw/source/uibase/docvw/frmsidebarwincontainer.hxx
@@ -25,10 +25,12 @@
 class SwFrame;
 class SwFormatField;
 namespace vcl { class Window; }
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
+} }
 
 namespace sw { namespace sidebarwindows {
 
-class SwSidebarWin;
 class FrameSidebarWinContainer;
 
 class SwFrameSidebarWinContainer
@@ -39,14 +41,14 @@ class SwFrameSidebarWinContainer
 
         bool insert( const SwFrame& rFrame,
                      const SwFormatField& rFormatField,
-                     SwSidebarWin& rSidebarWin );
+                     sw::annotation::SwAnnotationWin& rSidebarWin );
 
         bool remove( const SwFrame& rFrame,
-                     const SwSidebarWin& rSidebarWin );
+                     const sw::annotation::SwAnnotationWin& rSidebarWin );
 
         bool empty( const SwFrame& rFrame );
 
-        SwSidebarWin* get( const SwFrame& rFrame,
+        sw::annotation::SwAnnotationWin* get( const SwFrame& rFrame,
                            const sal_Int32 nIndex );
 
         void getAll( const SwFrame& rFrame,
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 93a10ee30cac..b58ef60fea11 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -94,7 +94,7 @@
 #include "annotsh.hxx"
 #include "view.hxx"
 #include <PostItMgr.hxx>
-#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
 
 #include "swtypes.hxx"
 
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 8b769879ee07..9fcea1ed4e33 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -21,7 +21,6 @@
 #include <comphelper/lok.hxx>
 #include <chrdlgmodes.hxx>
 #include <hintids.hxx>
-#include <SidebarWin.hxx>
 #include <IDocumentFieldsAccess.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/kernitem.hxx>
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index d2fe2fdc0f29..e8dd1a8ce4ea 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -417,7 +417,7 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
         case NID_POSTIT:
             {
                 rSh.EnterStdMode();
-                sw::sidebarwindows::SwSidebarWin* pPostIt = GetPostItMgr()->GetActiveSidebarWin();
+                sw::annotation::SwAnnotationWin* pPostIt = GetPostItMgr()->GetActiveSidebarWin();
                 if (pPostIt)
                     GetPostItMgr()->SetActiveSidebarWin(nullptr);
                 SwFieldType* pFieldType = rSh.GetFieldType(0, SwFieldIds::Postit);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 07530d82e1bc..33eef3dc62bb 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -148,7 +148,6 @@
 #include <srcview.hxx>
 #include <edtwin.hxx>
 #include <swdtflvr.hxx>
-#include <SidebarWin.hxx>
 #include <PostItMgr.hxx>
 
 #include <svtools/langtab.hxx>
@@ -3238,7 +3237,7 @@ OUString SwXTextDocument::getPostIts()
     for (std::list<SwSidebarItem*>::const_iterator i = pDocShell->GetView()->GetPostItMgr()->begin();
          i != pDocShell->GetView()->GetPostItMgr()->end(); ++i )
     {
-        sw::annotation::SwAnnotationWin* pWin = static_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt.get());
+        sw::annotation::SwAnnotationWin* pWin = (*i)->pPostIt.get();
 
         const SwPostItField* pField = pWin->GetPostItField();
         const SwRect& aRect = pWin->GetAnchorRect();
@@ -3457,7 +3456,7 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType, OString& rUsedM
 
     if (SwPostItMgr* pPostItMgr = pDocShell->GetView()->GetPostItMgr())
     {
-        if (sw::sidebarwindows::SwSidebarWin* pWin = pPostItMgr->GetActiveSidebarWin())
+        if (sw::annotation::SwAnnotationWin* pWin = pPostItMgr->GetActiveSidebarWin())
         {
             // Editing postit text.
             EditView& rEditView = pWin->GetOutlinerView()->GetEditView();
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index cf178dbf3895..293d0b493687 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -91,7 +91,7 @@
 #include <unomid.h>
 
 #include "navmgr.hxx"
-#include "SidebarWin.hxx"
+#include "AnnotationWin.hxx"
 #include <memory>
 
 #define CTYPE_CNT   0


More information about the Libreoffice-commits mailing list