Commits

Anonymous committed b51e42c

cws swcoreseparation: #i117814#: remove dependency on SwPostItMgr in core by using an interface for the needed methods

  • Participants
  • Parent commits 8280dfb

Comments (0)

Files changed (23)

File sw/Library_sw.mk

 	sw/source/ui/docvw/AnchorOverlayObject \
 	sw/source/ui/docvw/AnnotationMenuButton \
 	sw/source/ui/docvw/AnnotationWin \
+	sw/source/ui/docvw/postititem \
 	sw/source/ui/docvw/PostItMgr \
 	sw/source/ui/docvw/ShadowOverlayObject \
 	sw/source/ui/docvw/SidebarTxtControl \

File sw/inc/AnnotationWin.hxx

-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile:  $
- *
- * $Revision:  $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ANNOTATIONWIN_HXX
-#define _ANNOTATIONWIN_HXX
-
-#include <SidebarWin.hxx>
-
-class PopupMenu;
-class OutlinerParaObject;
-
-namespace sw { namespace annotation {
-
-class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
-{
-	public:
-        SwAnnotationWin( SwEditWin& rEditWin,
-                         WinBits nBits,
-                         SwPostItMgr& aMgr,
-                         SwPostItBits aBits,
-                         SwSidebarItem& rSidebarItem,
-                         SwFmtFld* aField );
-        virtual ~SwAnnotationWin();
-
-		virtual void	UpdateData();
-		virtual void	SetPostItText();
-		virtual void	Delete();
-		virtual void	GotoPos();
-
-		virtual String	GetAuthor();
-		virtual Date	GetDate();
-		virtual Time	GetTime();
-
-        virtual sal_uInt32 MoveCaret();
-
-		virtual bool	CalcFollow();
-		void			InitAnswer(OutlinerParaObject* pText);
-
-		virtual bool	IsProtected();
-
-    protected:
-        virtual MenuButton* CreateMenuButton();
-
-    private:
-        virtual SvxLanguageItem GetLanguage(void);
-        sal_uInt32 CountFollowing();
-
-        SwFmtFld*       mpFmtFld;
-        SwPostItField*  mpFld;
-        PopupMenu*      mpButtonPopup;
-
-};
-
-} } // end of namespace sw::annotation
-#endif

File sw/inc/PostItMgr.hxx

-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _POSTITMGR_HXX
-#define _POSTITMGR_HXX
-
-#include <list>
-#include <vector>
-#include <editeng/outlobj.hxx>
-#include <tools/string.hxx>
-#include <tools/link.hxx>
-#include <tools/debug.hxx>
-#include <swrect.hxx>
-#include <unotools/configitem.hxx>
-#include <unotools/options.hxx>
-#include <com/sun/star/util/SearchOptions.hpp>
-#include <com/sun/star/uno/Any.hxx>
-#include <SidebarWindowsTypes.hxx>
-#include <svl/lstner.hxx>
-
-class SwWrtShell;
-class SwDoc;
-class SwView;
-class SwPostItField;
-class SwFmtFld;
-class SwField;
-class SfxBroadcaster;
-class SfxHint;
-class SwEditWin;
-class Color;
-class SvxSearchItem;
-class SvxLanguageItem;
-namespace sw { namespace annotation {
-    class SwAnnotationWin;
-}}
-namespace sw { namespace sidebarwindows {
-    class SwSidebarWin;
-    class SwFrmSidebarWinContainer;
-}}
-class SwSidebarItem;
-class SwFrm;
-class Window;
-
-#define SORT_POS	1
-#define SORT_AUTHOR	2
-#define SORT_DATE	3
-
-#define COL_NOTES_SIDEPANE_ARROW_ENABLED	RGB_COLORDATA(0,0,0)
-#define COL_NOTES_SIDEPANE_ARROW_DISABLED	RGB_COLORDATA(172,168,153)
-
-typedef std::list<SwSidebarItem*> SwSidebarItem_list;
-typedef std::list<SwSidebarItem*>::iterator SwSidebarItem_iterator;
-
-
-struct SwPostItPageItem
-{
-	bool bScrollbar;
-    sw::sidebarwindows::SidebarPosition eSidebarPosition;
-	long lOffset;
-	SwRect mPageRect;
-    SwSidebarItem_list* mList;
-	SwPostItPageItem(): bScrollbar(false),lOffset(0)
-	{
-        mList = new SwSidebarItem_list;
-	}
-	~SwPostItPageItem()
-	{
-		mList->clear();
-		delete mList;
-	}
-
-};
-
-struct FieldShadowState
-{
-	const SwPostItField* mpShadowFld;
-	bool bCursor;
-	bool bMouse;
-	FieldShadowState(): mpShadowFld(0),bCursor(false),bMouse(false)
-	{
-	}
-};
-
-class SwNoteProps: public utl::ConfigItem
-{
-	private:
-        bool bIsShowAnchor;
-	public:
-        SwNoteProps()
-            : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes"))
-            , bIsShowAnchor(false)
-		{
-            const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames = GetPropertyNames();
-                ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aValues = GetProperties(rNames);
-                const ::com::sun::star::uno::Any* pValues = aValues.getConstArray();
-   			DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
-        		if (aValues.getLength())
-                pValues[0]>>=bIsShowAnchor;
-		}
-
-        bool IsShowAnchor()
-		{
-            return bIsShowAnchor;
-		}
-            ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetPropertyNames()
-        	{
-            static ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames;
-     			if(!aNames.getLength())
-     			{
-             			static const char* aPropNames[] =
-             			{
-                			"ShowAnkor"
-                   		};
-             			const int nCount = sizeof(aPropNames)/sizeof(const char*);
-             			aNames.realloc(nCount);
-                        ::rtl::OUString* pNames = aNames.getArray();
-         			for(int i = 0; i < nCount; i++)
-                            pNames[i] = ::rtl::OUString::createFromAscii(aPropNames[i]);
-     			}
-     			return aNames;
-        	}
-
-	virtual void Commit();
-	virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
-};
-
-class SwPostItMgr: public SfxListener
-{
-	private:
-		SwView*							mpView;
-		SwWrtShell*						mpWrtShell;
-		SwEditWin*						mpEditWin;
-        std::list< SwSidebarItem*>      mvPostItFlds;
-		std::vector<SwPostItPageItem*>	mPages;
-		sal_uLong							mnEventId;
-		bool							mbWaitingForCalcRects;
-        sw::sidebarwindows::SwSidebarWin* mpActivePostIt;
-		bool							mbLayout;
-		long							mbLayoutHeight;
-		long							mbLayouting;
-		bool							mbReadOnly;
-		bool							mbDeleteNote;
-		FieldShadowState				mShadowState;
-		OutlinerParaObject*				mpAnswer;
-        bool                            mbIsShowAnchor;
-
-        // data structure to collect the <SwSidebarWin> instances for certain <SwFrm> instances.
-        sw::sidebarwindows::SwFrmSidebarWinContainer* mpFrmSidebarWinContainer;
-
-        typedef std::list<sw::sidebarwindows::SwSidebarWin*>::iterator  SwSidebarWin_iterator;
-
-		void			AddPostIts(bool bCheckExistance = true,bool bFocus = true);
-		//void			AddRedlineComments(bool bCheckExistance, bool bFocus);
-        void            RemoveSidebarWin();
-		void			PreparePageContainer();
-		void			Scroll(const long lScroll,const unsigned long aPage );
-        void            AutoScroll(const sw::sidebarwindows::SwSidebarWin* pPostIt,const unsigned long aPage );
-		bool			ScrollbarHit(const unsigned long aPage,const Point &aPoint);
-        bool            LayoutByPage( std::list<sw::sidebarwindows::SwSidebarWin*> &aVisiblePostItList,
-                                      const Rectangle aBorder,
-                                      long lNeededHeight);
-		void			CheckForRemovedPostIts();
-        	bool            	ArrowEnabled(sal_uInt16 aDirection,unsigned long aPage) const;
-        	bool            	BorderOverPageBorder(unsigned long aPage) const;
-        	bool 		       	HasScrollbars() const;
-		void			Focus(SfxBroadcaster& rBC);
-
-	        sal_Int32       	GetInitialAnchorDistance() const;
-        	sal_Int32       	GetScrollSize() const;
-        	sal_Int32       	GetSpaceBetween() const;
-		void			SetReadOnlyState();
-					DECL_LINK( CalcHdl, void*);
-
-        sw::sidebarwindows::SwSidebarWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const;
-
-        void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
-        void RemoveItem( SfxBroadcaster* pBroadcast );
-
-        void Sort(const short aType);
-
-	public:
-			SwPostItMgr(SwView* aDoc);
-			~SwPostItMgr();
-
-            typedef std::list< SwSidebarItem* >::const_iterator const_iterator;
-			const_iterator begin()	const { return mvPostItFlds.begin(); }
-			const_iterator end()	const { return mvPostItFlds.end();	}
-
-			void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
-			void LayoutPostIts();
-			bool CalcRects();
-
-            void MakeVisible( const sw::sidebarwindows::SwSidebarWin* pPostIt,
-                              long aPage = -1);
-
-            bool ShowScrollbar(const unsigned long aPage) const;
-            bool HasNotes() const ;
-            bool ShowNotes() const;
-            bool IsShowAnchor() { return mbIsShowAnchor;}
-            unsigned long GetSidebarWidth(bool bPx = false) const;
-            unsigned long GetSidebarBorderWidth(bool bPx = false) const;
-			unsigned long GetNoteWidth();
-
-			void PrepareView(bool bIgnoreCount = false);
-
-			void CorrectPositions();
-
-			void SetLayout() { mbLayout = true; };
-			void Delete(String aAuthor);
-			void Delete();
-
-#if 0            
-            void Hide( SwPostItField* pPostItField );
-#endif
-			void Hide( const String& rAuthor );
-			void Hide();
-			void Show();
-
-			void Rescale();
-
-            Rectangle GetBottomScrollRect(const unsigned long aPage) const;
-            Rectangle GetTopScrollRect(const unsigned long aPage) const;
-
-            bool IsHit(const Point &aPointPixel);
-            Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const;
-
-            sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pFld) const;
-
-            sw::sidebarwindows::SwSidebarWin* GetNextPostIt( sal_uInt16 aDirection,
-                                                             sw::sidebarwindows::SwSidebarWin* aPostIt);
-			long GetNextBorder();
-
-            sw::sidebarwindows::SwSidebarWin* GetActiveSidebarWin() { return mpActivePostIt; }
-            void SetActiveSidebarWin( sw::sidebarwindows::SwSidebarWin* p);
-            bool HasActiveSidebarWin() const;
-            bool HasActiveAnnotationWin() const;
-            void GrabFocusOnActiveSidebarWin();
-            void UpdateDataOnActiveSidebarWin();
-            void DeleteActiveSidebarWin();
-            void HideActiveSidebarWin();
-            void ToggleInsModeOnActiveSidebarWin();
-
-            sal_Int32 GetMinimumSizeWithMeta() const;
-            sal_Int32 GetSidebarScrollerHeight() const;
-
-			void SetShadowState(const SwPostItField* pFld,bool bCursor = true);
-
-			void SetSpellChecking();
-
-			Color			GetColorDark(sal_uInt16 aAuthorIndex);
-			Color			GetColorLight(sal_uInt16 aAuthorIndex);
-            Color           GetColorAnchor(sal_uInt16 aAuthorIndex);
-
-
-			void				RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
-			OutlinerParaObject* IsAnswer() {return mpAnswer;}
-			void CheckMetaText();
-			void StartSpelling();
-
-			sal_uInt16 Replace(SvxSearchItem* pItem);
-			sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
-			sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
-
-            void AssureStdModeAtShell();
-
-            void ConnectSidebarWinToFrm( const SwFrm& rFrm,
-                                         const SwFmtFld& rFmtFld,
-                                         sw::sidebarwindows::SwSidebarWin& rSidebarWin );
-            void DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
-                                              sw::sidebarwindows::SwSidebarWin& rSidebarWin );
-            bool HasFrmConnectedSidebarWins( const SwFrm& rFrm );
-            Window* GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
-                                                const sal_Int32 nIndex );
-            void GetAllSidebarWinForFrm( const SwFrm& rFrm,
-                                         std::vector< Window* >* pChildren );
-};
-
-#endif
-
-
-
-

File sw/inc/SidebarWin.hxx

-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SIDEBARWIN_HXX
-#define _SIDEBARWIN_HXX
-
-#include <postithelper.hxx>
-#include <SidebarWindowsTypes.hxx>
-
-#include <vcl/window.hxx>
-#include <swrect.hxx>
-
-#include <tools/datetime.hxx>
-#include <tools/date.hxx>
-
-#include <vcl/lineinfo.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <editeng/editstat.hxx>
-
-class SwPostItMgr;
-class SwPostItField;
-class OutlinerView;
-class Outliner;
-class ScrollBar;
-class SwEditWin;
-class SwView;
-class Edit;
-class MenuButton;
-//class SwRedline;
-class SwFrm;
-
-
-namespace sw { namespace sidebarwindows {
-
-class SidebarTxtControl;
-class AnchorOverlayObject;
-class ShadowOverlayObject;
-
-typedef sal_Int64 SwPostItBits;
-
-#define PB_Preview ((SwPostItBits)0x00000001)
-
-
-class SwSidebarWin : public Window
-{
-	public:
-        SwSidebarWin( SwEditWin& rEditWin,
-                      WinBits nBits,
-                      SwPostItMgr& aMgr,
-                      SwPostItBits aBits,
-                      SwSidebarItem& rSidebarItem );
-        virtual ~SwSidebarWin();
-
-        void SetSize( const Size& rNewSize );
-        void SetPosSizePixelRect( long nX,
-                                  long nY,
-                                  long nWidth,
-                                  long nHeight,
-                                  const SwRect &aRect,
-                                  const long PageBorder);
-        void SetPosAndSize();
-        void TranslateTopPosition(const long aAmount);
-        virtual void CheckMetaText();
-
-        inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
-        SwEditWin* EditWin();
-
-        inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
-        bool HasScrollbar() const;
-        bool IsScrollbarVisible() const;
-        inline ScrollBar* Scrollbar() { return mpVScrollbar; }
-        inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
-        inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
-
-        long            GetPostItTextHeight();
-
-		void			SwitchToPostIt(sal_uInt16 aDirection);
-		virtual void	SwitchToFieldPos();
-
-        virtual sal_uInt32 MoveCaret() = 0;
-
-		virtual void	UpdateData() = 0;
-		virtual void	SetPostItText() = 0;
-		virtual void	Delete();
-		virtual void	GotoPos() = 0;
-
-        virtual String  GetAuthor() = 0;
-        virtual Date    GetDate() = 0;
-        virtual Time    GetTime() = 0;
-
-		void			ExecuteCommand(sal_uInt16 nSlot);
-		void			InitControls();
-        void            HidePostIt();
-        void            DoResize();
-		void			ResizeIfNeccessary(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			ResetAttributes();
-
-        void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
-		void			SetReadonly(sal_Bool bSet);
-		sal_Bool			IsReadOnly()		{ return mbReadonly;}
-		bool			IsPreview()			{ return nFlags & PB_Preview;}
-
-        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 bool    CalcFollow() = 0;
-
-#if 0
-#endif
-
-		sal_Int32		GetMetaHeight();
-		sal_Int32		GetMinimumSizeWithMeta();
-		sal_Int32		GetMinimumSizeWithoutMeta();
-		sal_Int32		GetMetaButtonAreaWidth();
-		sal_Int32		GetScrollbarWidth();
-
-		void			SetSpellChecking();
-
-		void			ToggleInsMode();
-
-		virtual	void	ActivatePostIt();
-		virtual void	DeactivatePostIt();
-
-        void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
-                                const Color& aColor);
-        SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
-        Color GetChangeColor() { return mChangeColor; }
-
-		virtual bool	IsProtected() {return mbReadonly;};
-
-        DECL_LINK( WindowEventListener, VclSimpleEvent* );
-        inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
-
-        void SetLanguage(const SvxLanguageItem aNewItem);
-
-        void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
-
-    protected:
-        virtual void    DataChanged( const DataChangedEvent& aEvent);
-        virtual void    LoseFocus();
-        virtual void    Paint( const Rectangle& rRect);
-        virtual void    GetFocus();
-        virtual MenuButton* CreateMenuButton() = 0;
-
-        void        SetSizePixel( const Size& rNewSize );
-        SfxItemSet  DefaultItem();
-
-        DECL_LINK(ModifyHdl, void*);
-        DECL_LINK(ScrollHdl, ScrollBar*);
-        DECL_LINK(DeleteHdl, void*);
-
-        inline SwView& DocView() { return mrView;}
-        inline SwPostItMgr& Mgr() { return mrMgr; }
-        inline Outliner* Engine() { return mpOutliner;}
-
-    private:
-        SwSidebarWin*   GetTopReplyNote();
-
-        virtual SvxLanguageItem GetLanguage(void);
-
-        SwPostItMgr&    mrMgr;
-        SwView&         mrView;
-        const SwPostItBits nFlags;
-
-        sal_uLong           mnEventId;
-
-        OutlinerView*   mpOutlinerView;
-        Outliner*       mpOutliner;
-
-        sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
-        ScrollBar*      mpVScrollbar;
-        Edit*           mpMetadataAuthor;
-        Edit*           mpMetadataDate;
-        MenuButton*     mpMenuButton;
-
-        sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
-        sw::sidebarwindows::ShadowOverlayObject* mpShadow;
-
-        Color           mColorAnchor;
-        Color           mColorDark;
-        Color           mColorLight;
-        Color           mChangeColor;
-
-        sw::sidebarwindows::SidebarPosition meSidebarPosition;
-
-        Rectangle       mPosSize;
-        SwRect          mAnchorRect;
-        long            mPageBorder;
-
-        bool            mbMouseOver;
-        SwPostItHelper::SwLayoutStatus mLayoutStatus;
-
-        bool            mbReadonly;
-        bool            mbIsFollow;
-
-        SwSidebarItem& mrSidebarItem;
-        const SwFrm* mpAnchorFrm;
-};
-
-} } // eof namespace sw::sidebarwindows
-
-
-// implementation for change tracking comments, fully functional, but not yet used
-/*
-class SwRedComment : public SwSidebarWin
-{
-	private:
-		SwRedline*		pRedline;
-
-	protected:
-		virtual void	MouseButtonDown( const MouseEvent& rMEvt );
-	public:
-		SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed);
-		virtual ~SwRedComment() {};
-
-		virtual void	UpdateData();
-		virtual void	SetPostItText();
-		virtual void	Delete();
-		virtual void	GotoPos();
-		virtual void	SetPopup();
-		virtual void	ActivatePostIt();
-		virtual void	DeactivatePostIt();
-
-		virtual String	GetAuthor();
-		virtual Date	GetDate();
-		virtual Time	GetTime();
-
-		virtual bool	IsProtected();
-};
-*/
-
-#endif

File sw/inc/ipostitmgr.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _IPOSTITMGR_HXX
+#define _IPOSTITMGR_HXX
+
+#include <vector>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <tools/color.hxx>
+
+class SwFrm;
+class SwFmtFld;
+class Window;
+
+class IPostItMgr
+{
+public:
+    virtual ~IPostItMgr();
+    virtual void LayoutPostIts() = 0;
+    virtual bool CalcRects() = 0;
+    virtual bool ShowScrollbar(const unsigned long aPage) const = 0;
+    virtual bool HasNotes() const  = 0;
+    virtual bool ShowNotes() const = 0;
+    virtual void CorrectPositions() = 0;
+    virtual void Rescale() = 0;
+    virtual unsigned long GetSidebarWidth(bool bPx = false) const = 0;
+    virtual unsigned long GetSidebarBorderWidth(bool bPx = false) const = 0;
+    virtual sal_Int32 GetSidebarScrollerHeight() const = 0;
+    virtual Color GetArrowColor(sal_uInt16 aDirection, unsigned long aPage) const = 0;
+    virtual bool HasFrmConnectedSidebarWins( const SwFrm& rFrm ) = 0;
+    virtual Window* GetSidebarWinForFrmByIndex( const SwFrm& rFrm, const sal_Int32 nIndex ) = 0;
+    virtual void GetAllSidebarWinForFrm( const SwFrm& rFrm, std::vector< Window* >* pChildren ) = 0;
+    virtual bool HasActiveSidebarWin() const = 0;
+    virtual void ResetActiveSidebarWin() = 0;
+    virtual sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward) = 0;
+    virtual sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward) = 0;
+};
+
+#endif
+
+
+
+

File sw/inc/postithelper.hxx

 
 #include <swrect.hxx>
 #include <fmtfld.hxx>
-#include <redline.hxx>
 #include <vector>
-#include <vcl/window.hxx>
 #include <SidebarWindowsTypes.hxx>
-#include <svl/brdcst.hxx>
 
 class SwTxtFld;
 class SwRootFrm;
 class SwPostIt;
 class String;
-class SwPostItMgr;
-class SwEditWin;
-namespace sw { namespace sidebarwindows {
-    class SwSidebarWin;
-} }
-
+class SwFrm;
 struct SwPosition;
 
 typedef sal_Int64 SwPostItBits;
     unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& );
 }
 
-class SwSidebarItem
-{
-public:
-    sw::sidebarwindows::SwSidebarWin* pPostIt;
-    bool bShow;
-    bool bFocus;
-
-    SwPostItHelper::SwLayoutStatus mLayoutStatus;
-    SwLayoutInfo maLayoutInfo;
-
-    SwSidebarItem( const bool aShow,
-                   const bool aFocus)
-        : pPostIt(0)
-        , bShow(aShow)
-        , bFocus(aFocus)
-        , mLayoutStatus( SwPostItHelper::INVISIBLE )
-        , maLayoutInfo()
-	{}
-    virtual ~SwSidebarItem(){}
-    virtual SwPosition GetAnchorPosition() const = 0;
-	virtual bool UseElement() = 0;
-    virtual SwFmtFld* GetFmtFld() const = 0;
-	virtual SfxBroadcaster* GetBroadCaster() const = 0;
-    virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
-                                                                WinBits nBits,
-                                                                SwPostItMgr& aMgr,
-                                                                SwPostItBits aBits) = 0;
-};
-/*
-class SwRedCommentItem: public SwSidebarItem
-{
-private:
-	SwRedline* pRedline;
-public:
-
-	SwRedCommentItem( SwRedline* pRed, bool aShow, bool aFocus)
-        : SwSidebarItem(aShow,aFocus),
-		pRedline(pRed) {}
-	virtual ~SwRedCommentItem() {}
-    virtual SwPosition GetAnchorPosition() const;
-	virtual bool UseElement();
-    virtual SwFmtFld* GetFmtFld() const {return 0; }
-	virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pRedline); }
-    virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
-                                                                WinBits nBits,
-                                                                SwPostItMgr& aMgr,
-                                                                SwPostItBits aBits);
-};
-*/
-
-class SwAnnotationItem: public SwSidebarItem
-{
-	private:
-	SwFmtFld* pFmtFld;
-
-	public:
-    SwAnnotationItem( SwFmtFld* p,
-                      const bool aShow,
-                      const bool aFocus)
-        : SwSidebarItem( aShow, aFocus )
-        , pFmtFld(p)
-    {}
-    virtual ~SwAnnotationItem() {}
-    virtual SwPosition GetAnchorPosition() const;
-	virtual bool UseElement();
-    virtual SwFmtFld* GetFmtFld() const {return pFmtFld;}
-	virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); }
-    virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
-                                                                WinBits nBits,
-                                                                SwPostItMgr& aMgr,
-                                                                SwPostItBits aBits);
-};
-
 #endif // _POSTITHELPER_HXX

File sw/inc/viewsh.hxx

 
 struct SwAccessibilityOptions;
 class Region;
-class SwPostItMgr;
+class IPostItMgr;
 class SdrPaintWindow;
 class SwAccessibleMap;
 
     static void DeleteReplacementBitmaps();
     // <--
 
-    const SwPostItMgr* GetPostItMgr() const { return (const_cast<ViewShell*>(this))->GetPostItMgr(); }
-    SwPostItMgr* GetPostItMgr();
+    const IPostItMgr* GetConstPostItMgr() const { return (const_cast<ViewShell*>(this))->GetPostItMgr(); }
+    virtual IPostItMgr* GetPostItMgr();
     virtual void FrameNotify( FlyMode eMode );
     virtual bool IsScrollMDI( const SwRect &rRect );
     virtual void ScrollMDI( const SwRect &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY );

File sw/source/core/access/acccontext.cxx

 #include <acccontext.hxx>
 #include <svx/AccessibleShape.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
-#include <PostItMgr.hxx>
+#include <ipostitmgr.hxx>
 
 using namespace sw::access;
 
 
     if ( GetFrm()->IsTxtFrm() )
     {
-        SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+        IPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
         if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
         {
             bRet = pPostItMgr->HasFrmConnectedSidebarWins( *(GetFrm()) );
 
     if ( GetFrm()->IsTxtFrm() )
     {
-        SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+        IPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
         if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
         {
             pAdditionalAccessibleChild =
 {
     if ( GetFrm()->IsTxtFrm() )
     {
-        SwPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
+        IPostItMgr* pPostItMgr = GetMap()->GetShell()->GetPostItMgr();
         if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
         {
             pPostItMgr->GetAllSidebarWinForFrm( *(GetFrm()), pChildren );

File sw/source/core/crsr/findtxt.cxx

 #include <swundo.hxx>
 #include <UndoInsert.hxx>
 #include <breakit.hxx>
-
-#include <docsh.hxx>
-#include <PostItMgr.hxx>
+#include <ipostitmgr.hxx>
 #include <viewsh.hxx>
 
 using namespace ::com::sun::star;
 
 			}
 
-            SwDocShell *const pDocShell = pNode->GetDoc()->GetDocShell();
-            ViewShell *const pWrtShell = (pDocShell) ? (ViewShell*)(pDocShell->GetWrtShell()) : 0;
-            SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : 0;
+            ViewShell* pShell = pNode->GetDoc()->GetCurrentViewShell();
+            IPostItMgr* pPostItMgr = pShell ? pShell->GetPostItMgr() : 0;
 
 			xub_StrLen aStart = 0;
 			// do we need to finish a note?
 				}
 				else
 				{
-                    pPostItMgr->SetActiveSidebarWin(0);
+                    pPostItMgr->ResetActiveSidebarWin();
 				}
 			}
 

File sw/source/core/fields/postithelper.cxx

 #include <tools/gen.hxx>
 
 #include <postithelper.hxx>
-#include <PostItMgr.hxx>
-#include <AnnotationWin.hxx>
-
 #include <fmtfld.hxx>
 #include <txtfld.hxx>
 #include <docufld.hxx>
     return nRet;
 }
 
-SwPosition SwAnnotationItem::GetAnchorPosition() const
-{
-	SwTxtFld* pFld = pFmtFld->GetTxtFld();
-	//if( pFld )
-	//{
-		SwTxtNode* pTNd = pFld->GetpTxtNode();
-	//	if( pTNd )
-	//	{
-			SwPosition aPos( *pTNd );
-			aPos.nContent.Assign( pTNd, *pFld->GetStart() );
-			return aPos;
-	//	}
-	//}
-}
-
-bool SwAnnotationItem::UseElement()
-{
-	return pFmtFld->IsFldInDoc();
-}
-
-sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
-                                                            SwEditWin& rEditWin,
-                                                            WinBits nBits,
-                                                            SwPostItMgr& aMgr,
-                                                            SwPostItBits aBits)
-{
-    return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
-                                                aMgr, aBits,
-                                                *this,
-                                                pFmtFld );
-}
-
-/*
-SwPosition SwRedCommentItem::GetAnchorPosition()
-{
-	return *pRedline->Start();
-}
-
-SwSidebarWin* SwRedCommentItem::GetSidebarWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
-{
-	return new SwRedComment(pParent,nBits,aMgr,aBits,pRedline);
-}
-
-bool SwRedCommentItem::UseElement()
-{
-	return true;
-}
-*/

File sw/source/core/layout/layact.cxx

 #include "sectfrm.hxx"
 #include "lineinfo.hxx"
 #include <acmplwrd.hxx>
-// --> OD 2004-06-28 #i28701#
 #include <sortedobjs.hxx>
 #include <objectformatter.hxx>
-#include <PostItMgr.hxx>
+#include <ipostitmgr.hxx>
 
 // <--
 //#pragma optimize("ity",on)
 
-/*************************************************************************
-|*
-|*	SwLayAction Statisches Geraffel
-|*
-|*	Ersterstellung		MA 22. Dec. 93
-|*	Letzte Aenderung	MA 22. Dec. 93
-|*
-|*************************************************************************/
-
 #define IS_FLYS (pPage->GetSortedObjs())
 #define IS_INVAFLY (pPage->IsInvalidFly())
 
                         pImp->GetShell()->GetOut()->PixelToLogic( Size( pPageFrm->ShadowPxWidth(), 0 ) ).Width();
 
 				//mod #i6193# added sidebar width
-                const SwPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr();
+                const IPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr();
 				const int nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
                 switch ( pPageFrm->SidebarPosition() )
                 {

File sw/source/core/layout/paintfrm.cxx

 #include <svx/svdogrp.hxx>
 #include <sortedobjs.hxx>
 #include <EnhancedPDFExportHelper.hxx>
-// <--
-// --> OD #i76669#
 #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
 #include <svx/sdr/contact/viewobjectcontact.hxx>
 #include <svx/sdr/contact/viewcontact.hxx>
-// <--
 
 #include <ndole.hxx>
 #include <svtools/chartprettypainter.hxx>
-#include <PostItMgr.hxx>
+#include <ipostitmgr.hxx>
 #include <tools/color.hxx>
 #include <vcl/svapp.hxx>
 
 }
 
 //mod #i6193# paint sidebar for notes
-//IMPORTANT: if you change the rects here, also change SwPostItMgr::ScrollbarHit
+//IMPORTANT: if you change the rects here, also change IPostItMgr::ScrollbarHit
 /*static*/void SwPageFrm::PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight)
 {
 	//TOOD: cut out scrollbar area and arrows out of sidepane rect, otherwise it could flicker when pressing arrow buttons
     SwRect aPageRect( _rPageRect );
     SwAlignRect( aPageRect, _pViewShell );
 
-    const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
+    const IPostItMgr *pMgr = _pViewShell->GetPostItMgr();
     if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())  // do not show anything in print preview
 	{
         sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
 
 /*static*/ void SwPageFrm::AddSidebarBorders(SwRect &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx)
 {
-    const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
+    const IPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
     if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())
     {
         if (!bRightSidebar)
 
 /*static*/ void SwPageFrm::AddSidebarBorders(Rectangle &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx)
 {
-    const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
+    const IPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
     if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes())
     {
         if (!bRightSidebar)
 
 /*static*/ SwTwips SwPageFrm::GetSidebarBorderWidth( const ViewShell* _pViewShell )
 {
-    const SwPostItMgr* pPostItMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
+    const IPostItMgr* pPostItMgr = _pViewShell ? _pViewShell->GetConstPostItMgr() : 0;
     const SwTwips nRet = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
     return nRet;
 }

File sw/source/core/view/viewsh.cxx

 // --> OD 2004-05-24 #i28701#
 #include <sortedobjs.hxx>
 #include <anchoredobject.hxx>
-// <--
-
-#include "../../ui/inc/view.hxx"
-#include <PostItMgr.hxx>
+
+#include <ipostitmgr.hxx>
 #include <vcl/virdev.hxx>
 
 #include <vcl/svapp.hxx>
 
 	bool bScrolled = false;
 
-    SwPostItMgr* pPostItMgr = GetPostItMgr();
+    IPostItMgr* pPostItMgr = GetPostItMgr();
 
     if ( bFull )
 		GetWin()->Invalidate();
     SwRegionRects aRegion( rRect );
 
 	//mod #i6193: remove sidebar area to avoid flickering
-    const SwPostItMgr* pPostItMgr = GetPostItMgr();
+    const IPostItMgr* pPostItMgr = GetPostItMgr();
     const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ?
                                   pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
                                   0;
 
 sal_Int32 ViewShell::GetBrowseWidth() const
 {
-    const SwPostItMgr* pPostItMgr = GetPostItMgr();
+    const IPostItMgr* pPostItMgr = GetConstPostItMgr();
 	if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
 	{
 		Size aBorder( aBrowseBorder );
 }
 // <--
 
-SwPostItMgr* ViewShell::GetPostItMgr()
+IPostItMgr* ViewShell::GetPostItMgr()
 {
-    SwView* pView =  GetDoc()->GetDocShell() ? GetDoc()->GetDocShell()->GetView() : 0;
-    if ( pView )
-        return pView->GetPostItMgr();
-
     return 0;
 }
 
     return 0;
 }
 
+IPostItMgr::~IPostItMgr()
+{
+}
+
 void ViewShell::FrameNotify( FlyMode )
 {
 }

File sw/source/ui/docvw/PostItMgr.cxx

 
 #include "PostItMgr.hxx"
 #include <postithelper.hxx>
+#include <postititem.hxx>
 
 #include <SidebarWin.hxx>
 #include <AnnotationWin.hxx>
 		return Color(COL_WHITE);
 }
 
+void SwPostItMgr::ResetActiveSidebarWin()
+{
+    SetActiveSidebarWin(0);
+}
+
 void SwPostItMgr::SetActiveSidebarWin( SwSidebarWin* p)
 {
 	if ( p != mpActivePostIt )

File sw/source/ui/docvw/frmsidebarwincontainer.cxx

 #include "precompiled_sw.hxx"
 
 #include <frmsidebarwincontainer.hxx>
+#include <postititem.hxx>
 
 #include <map>
 #include <fmtfld.hxx>

File sw/source/ui/docvw/postititem.cxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <postititem.hxx>
+
+#include <PostItMgr.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <AnnotationWin.hxx>
+
+SwPosition SwAnnotationItem::GetAnchorPosition() const
+{
+	SwTxtFld* pFld = pFmtFld->GetTxtFld();
+		SwTxtNode* pTNd = pFld->GetpTxtNode();
+			SwPosition aPos( *pTNd );
+			aPos.nContent.Assign( pTNd, *pFld->GetStart() );
+			return aPos;
+}
+
+bool SwAnnotationItem::UseElement()
+{
+	return pFmtFld->IsFldInDoc();
+}
+
+sw::sidebarwindows::SwSidebarWin* SwAnnotationItem::GetSidebarWindow(
+                                                            SwEditWin& rEditWin,
+                                                            WinBits nBits,
+                                                            SwPostItMgr& aMgr,
+                                                            SwPostItBits aBits)
+{
+    return new sw::annotation::SwAnnotationWin( rEditWin, nBits,
+                                                aMgr, aBits,
+                                                *this,
+                                                pFmtFld );
+}
+
+/*
+SwPosition SwRedCommentItem::GetAnchorPosition()
+{
+	return *pRedline->Start();
+}
+
+SwSidebarWin* SwRedCommentItem::GetSidebarWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits)
+{
+	return new SwRedComment(pParent,nBits,aMgr,aBits,pRedline);
+}
+
+bool SwRedCommentItem::UseElement()
+{
+	return true;
+}
+*/

File sw/source/ui/inc/AnnotationWin.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:  $
+ *
+ * $Revision:  $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATIONWIN_HXX
+#define _ANNOTATIONWIN_HXX
+
+#include <SidebarWin.hxx>
+
+class PopupMenu;
+class OutlinerParaObject;
+
+namespace sw { namespace annotation {
+
+class SwAnnotationWin : public sw::sidebarwindows::SwSidebarWin
+{
+	public:
+        SwAnnotationWin( SwEditWin& rEditWin,
+                         WinBits nBits,
+                         SwPostItMgr& aMgr,
+                         SwPostItBits aBits,
+                         SwSidebarItem& rSidebarItem,
+                         SwFmtFld* aField );
+        virtual ~SwAnnotationWin();
+
+		virtual void	UpdateData();
+		virtual void	SetPostItText();
+		virtual void	Delete();
+		virtual void	GotoPos();
+
+		virtual String	GetAuthor();
+		virtual Date	GetDate();
+		virtual Time	GetTime();
+
+        virtual sal_uInt32 MoveCaret();
+
+		virtual bool	CalcFollow();
+		void			InitAnswer(OutlinerParaObject* pText);
+
+		virtual bool	IsProtected();
+
+    protected:
+        virtual MenuButton* CreateMenuButton();
+
+    private:
+        virtual SvxLanguageItem GetLanguage(void);
+        sal_uInt32 CountFollowing();
+
+        SwFmtFld*       mpFmtFld;
+        SwPostItField*  mpFld;
+        PopupMenu*      mpButtonPopup;
+
+};
+
+} } // end of namespace sw::annotation
+#endif

File sw/source/ui/inc/PostItMgr.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _POSTITMGR_HXX
+#define _POSTITMGR_HXX
+
+#include <ipostitmgr.hxx>
+#include <list>
+#include <vector>
+#include <editeng/outlobj.hxx>
+#include <tools/string.hxx>
+#include <tools/link.hxx>
+#include <tools/debug.hxx>
+#include <swrect.hxx>
+#include <unotools/configitem.hxx>
+#include <unotools/options.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <SidebarWindowsTypes.hxx>
+#include <svl/lstner.hxx>
+
+class SwWrtShell;
+class SwDoc;
+class SwView;
+class SwPostItField;
+class SwFmtFld;
+class SwField;
+class SfxBroadcaster;
+class SfxHint;
+class SwEditWin;
+class Color;
+class SvxSearchItem;
+class SvxLanguageItem;
+namespace sw { namespace annotation {
+    class SwAnnotationWin;
+}}
+namespace sw { namespace sidebarwindows {
+    class SwSidebarWin;
+    class SwFrmSidebarWinContainer;
+}}
+class SwSidebarItem;
+class SwFrm;
+class Window;
+
+#define SORT_POS	1
+#define SORT_AUTHOR	2
+#define SORT_DATE	3
+
+#define COL_NOTES_SIDEPANE_ARROW_ENABLED	RGB_COLORDATA(0,0,0)
+#define COL_NOTES_SIDEPANE_ARROW_DISABLED	RGB_COLORDATA(172,168,153)
+
+typedef std::list<SwSidebarItem*> SwSidebarItem_list;
+typedef std::list<SwSidebarItem*>::iterator SwSidebarItem_iterator;
+
+
+struct SwPostItPageItem
+{
+	bool bScrollbar;
+    sw::sidebarwindows::SidebarPosition eSidebarPosition;
+	long lOffset;
+	SwRect mPageRect;
+    SwSidebarItem_list* mList;
+	SwPostItPageItem(): bScrollbar(false),lOffset(0)
+	{
+        mList = new SwSidebarItem_list;
+	}
+	~SwPostItPageItem()
+	{
+		mList->clear();
+		delete mList;
+	}
+
+};
+
+struct FieldShadowState
+{
+	const SwPostItField* mpShadowFld;
+	bool bCursor;
+	bool bMouse;
+	FieldShadowState(): mpShadowFld(0),bCursor(false),bMouse(false)
+	{
+	}
+};
+
+class SwNoteProps: public utl::ConfigItem
+{
+	private:
+        bool bIsShowAnchor;
+	public:
+        SwNoteProps()
+            : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes"))
+            , bIsShowAnchor(false)
+		{
+            const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames = GetPropertyNames();
+                ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aValues = GetProperties(rNames);
+                const ::com::sun::star::uno::Any* pValues = aValues.getConstArray();
+   			DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
+        		if (aValues.getLength())
+                pValues[0]>>=bIsShowAnchor;
+		}
+
+        bool IsShowAnchor()
+		{
+            return bIsShowAnchor;
+		}
+            ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetPropertyNames()
+        	{
+            static ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames;
+     			if(!aNames.getLength())
+     			{
+             			static const char* aPropNames[] =
+             			{
+                			"ShowAnkor"
+                   		};
+             			const int nCount = sizeof(aPropNames)/sizeof(const char*);
+             			aNames.realloc(nCount);
+                        ::rtl::OUString* pNames = aNames.getArray();
+         			for(int i = 0; i < nCount; i++)
+                            pNames[i] = ::rtl::OUString::createFromAscii(aPropNames[i]);
+     			}
+     			return aNames;
+        	}
+
+	virtual void Commit();
+	virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+};
+
+class SwPostItMgr: public IPostItMgr, public SfxListener
+{
+	private:
+		SwView*							mpView;
+		SwWrtShell*						mpWrtShell;
+		SwEditWin*						mpEditWin;
+        std::list< SwSidebarItem*>      mvPostItFlds;
+		std::vector<SwPostItPageItem*>	mPages;
+		sal_uLong							mnEventId;
+		bool							mbWaitingForCalcRects;
+        sw::sidebarwindows::SwSidebarWin* mpActivePostIt;
+		bool							mbLayout;
+		long							mbLayoutHeight;
+		long							mbLayouting;
+		bool							mbReadOnly;
+		bool							mbDeleteNote;
+		FieldShadowState				mShadowState;
+		OutlinerParaObject*				mpAnswer;
+        bool                            mbIsShowAnchor;
+
+        // data structure to collect the <SwSidebarWin> instances for certain <SwFrm> instances.
+        sw::sidebarwindows::SwFrmSidebarWinContainer* mpFrmSidebarWinContainer;
+
+        typedef std::list<sw::sidebarwindows::SwSidebarWin*>::iterator  SwSidebarWin_iterator;
+
+		void			AddPostIts(bool bCheckExistance = true,bool bFocus = true);
+		//void			AddRedlineComments(bool bCheckExistance, bool bFocus);
+        void            RemoveSidebarWin();
+		void			PreparePageContainer();
+		void			Scroll(const long lScroll,const unsigned long aPage );
+        void            AutoScroll(const sw::sidebarwindows::SwSidebarWin* pPostIt,const unsigned long aPage );
+		bool			ScrollbarHit(const unsigned long aPage,const Point &aPoint);
+        bool            LayoutByPage( std::list<sw::sidebarwindows::SwSidebarWin*> &aVisiblePostItList,
+                                      const Rectangle aBorder,
+                                      long lNeededHeight);
+		void			CheckForRemovedPostIts();
+        	bool            	ArrowEnabled(sal_uInt16 aDirection,unsigned long aPage) const;
+        	bool            	BorderOverPageBorder(unsigned long aPage) const;
+        	bool 		       	HasScrollbars() const;
+		void			Focus(SfxBroadcaster& rBC);
+
+	        sal_Int32       	GetInitialAnchorDistance() const;
+        	sal_Int32       	GetScrollSize() const;
+        	sal_Int32       	GetSpaceBetween() const;
+		void			SetReadOnlyState();
+					DECL_LINK( CalcHdl, void*);
+
+        sw::sidebarwindows::SwSidebarWin* GetSidebarWin(const SfxBroadcaster* pBroadcaster) const;
+
+        void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus);
+        void RemoveItem( SfxBroadcaster* pBroadcast );
+
+        void Sort(const short aType);
+
+	public:
+			SwPostItMgr(SwView* aDoc);
+			~SwPostItMgr();
+
+            typedef std::list< SwSidebarItem* >::const_iterator const_iterator;
+			const_iterator begin()	const { return mvPostItFlds.begin(); }
+			const_iterator end()	const { return mvPostItFlds.end();	}
+
+			void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+			void LayoutPostIts();
+			bool CalcRects();
+
+            void MakeVisible( const sw::sidebarwindows::SwSidebarWin* pPostIt,
+                              long aPage = -1);
+
+            bool ShowScrollbar(const unsigned long aPage) const;
+            bool HasNotes() const ;
+            bool ShowNotes() const;
+            bool IsShowAnchor() { return mbIsShowAnchor;}
+            unsigned long GetSidebarWidth(bool bPx = false) const;
+            unsigned long GetSidebarBorderWidth(bool bPx = false) const;
+			unsigned long GetNoteWidth();
+
+			void PrepareView(bool bIgnoreCount = false);
+
+			void CorrectPositions();
+
+			void SetLayout() { mbLayout = true; };
+			void Delete(String aAuthor);
+			void Delete();
+
+#if 0            
+            void Hide( SwPostItField* pPostItField );
+#endif
+			void Hide( const String& rAuthor );
+			void Hide();
+			void Show();
+
+			void Rescale();
+
+            Rectangle GetBottomScrollRect(const unsigned long aPage) const;
+            Rectangle GetTopScrollRect(const unsigned long aPage) const;
+
+            bool IsHit(const Point &aPointPixel);
+            Color GetArrowColor(sal_uInt16 aDirection,unsigned long aPage) const;
+
+            sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pFld) const;
+
+            sw::sidebarwindows::SwSidebarWin* GetNextPostIt( sal_uInt16 aDirection,
+                                                             sw::sidebarwindows::SwSidebarWin* aPostIt);
+			long GetNextBorder();
+
+            sw::sidebarwindows::SwSidebarWin* GetActiveSidebarWin() { return mpActivePostIt; }
+            void SetActiveSidebarWin( sw::sidebarwindows::SwSidebarWin* p);
+            void ResetActiveSidebarWin();
+            bool HasActiveSidebarWin() const;
+            bool HasActiveAnnotationWin() const;
+            void GrabFocusOnActiveSidebarWin();
+            void UpdateDataOnActiveSidebarWin();
+            void DeleteActiveSidebarWin();
+            void HideActiveSidebarWin();
+            void ToggleInsModeOnActiveSidebarWin();
+
+            sal_Int32 GetMinimumSizeWithMeta() const;
+            sal_Int32 GetSidebarScrollerHeight() const;
+
+			void SetShadowState(const SwPostItField* pFld,bool bCursor = true);
+
+			void SetSpellChecking();
+
+			Color			GetColorDark(sal_uInt16 aAuthorIndex);
+			Color			GetColorLight(sal_uInt16 aAuthorIndex);
+            Color           GetColorAnchor(sal_uInt16 aAuthorIndex);
+
+
+			void				RegisterAnswer(OutlinerParaObject* pAnswer) { mpAnswer = pAnswer;}
+			OutlinerParaObject* IsAnswer() {return mpAnswer;}
+			void CheckMetaText();
+			void StartSpelling();
+
+			sal_uInt16 Replace(SvxSearchItem* pItem);
+			sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
+			sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
+
+            void AssureStdModeAtShell();
+
+            void ConnectSidebarWinToFrm( const SwFrm& rFrm,
+                                         const SwFmtFld& rFmtFld,
+                                         sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+            void DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
+                                              sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+            bool HasFrmConnectedSidebarWins( const SwFrm& rFrm );
+            Window* GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
+                                                const sal_Int32 nIndex );
+            void GetAllSidebarWinForFrm( const SwFrm& rFrm,
+                                         std::vector< Window* >* pChildren );
+};
+
+#endif
+
+
+
+

File sw/source/ui/inc/SidebarWin.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWIN_HXX
+#define _SIDEBARWIN_HXX
+
+#include <postithelper.hxx>
+#include <postititem.hxx>
+#include <SidebarWindowsTypes.hxx>
+#include <editeng/langitem.hxx>
+#include <vcl/window.hxx>
+#include <swrect.hxx>
+
+#include <tools/datetime.hxx>
+#include <tools/date.hxx>
+
+#include <vcl/lineinfo.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <editeng/editstat.hxx>
+
+class SwPostItMgr;
+class SwPostItField;
+class OutlinerView;
+class Outliner;
+class ScrollBar;
+class SwEditWin;
+class SwView;
+class Edit;
+class MenuButton;
+//class SwRedline;
+class SwFrm;
+
+
+namespace sw { namespace sidebarwindows {
+
+class SidebarTxtControl;
+class AnchorOverlayObject;
+class ShadowOverlayObject;
+
+typedef sal_Int64 SwPostItBits;
+
+#define PB_Preview ((SwPostItBits)0x00000001)
+
+
+class SwSidebarWin : public Window
+{
+	public:
+        SwSidebarWin( SwEditWin& rEditWin,
+                      WinBits nBits,
+                      SwPostItMgr& aMgr,
+                      SwPostItBits aBits,
+                      SwSidebarItem& rSidebarItem );
+        virtual ~SwSidebarWin();
+
+        void SetSize( const Size& rNewSize );
+        void SetPosSizePixelRect( long nX,
+                                  long nY,
+                                  long nWidth,
+                                  long nHeight,
+                                  const SwRect &aRect,
+                                  const long PageBorder);
+        void SetPosAndSize();
+        void TranslateTopPosition(const long aAmount);
+        virtual void CheckMetaText();
+
+        inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
+        SwEditWin* EditWin();
+
+        inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
+        bool HasScrollbar() const;
+        bool IsScrollbarVisible() const;
+        inline ScrollBar* Scrollbar() { return mpVScrollbar; }
+        inline ::sw::sidebarwindows::AnchorOverlayObject* Anchor() { return mpAnchor;}
+        inline ::sw::sidebarwindows::ShadowOverlayObject* Shadow() { return mpShadow;}
+
+        long            GetPostItTextHeight();
+
+		void			SwitchToPostIt(sal_uInt16 aDirection);
+		virtual void	SwitchToFieldPos();
+
+        virtual sal_uInt32 MoveCaret() = 0;
+
+		virtual void	UpdateData() = 0;
+		virtual void	SetPostItText() = 0;
+		virtual void	Delete();
+		virtual void	GotoPos() = 0;
+
+        virtual String  GetAuthor() = 0;
+        virtual Date    GetDate() = 0;
+        virtual Time    GetTime() = 0;
+
+		void			ExecuteCommand(sal_uInt16 nSlot);
+		void			InitControls();
+        void            HidePostIt();
+        void            DoResize();
+		void			ResizeIfNeccessary(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			ResetAttributes();
+
+        void            SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition);
+		void			SetReadonly(sal_Bool bSet);
+		sal_Bool			IsReadOnly()		{ return mbReadonly;}
+		bool			IsPreview()			{ return nFlags & PB_Preview;}
+
+        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 bool    CalcFollow() = 0;
+
+#if 0
+#endif
+
+		sal_Int32		GetMetaHeight();
+		sal_Int32		GetMinimumSizeWithMeta();
+		sal_Int32		GetMinimumSizeWithoutMeta();
+		sal_Int32		GetMetaButtonAreaWidth();
+		sal_Int32		GetScrollbarWidth();
+
+		void			SetSpellChecking();
+
+		void			ToggleInsMode();
+
+		virtual	void	ActivatePostIt();
+		virtual void	DeactivatePostIt();
+
+        void SetChangeTracking( const SwPostItHelper::SwLayoutStatus aStatus,
+                                const Color& aColor);
+        SwPostItHelper::SwLayoutStatus GetLayoutStatus() { return mLayoutStatus; }
+        Color GetChangeColor() { return mChangeColor; }
+
+		virtual bool	IsProtected() {return mbReadonly;};
+
+        DECL_LINK( WindowEventListener, VclSimpleEvent* );
+        inline bool IsMouseOverSidebarWin() const { return mbMouseOver; }
+
+        void SetLanguage(const SvxLanguageItem aNewItem);
+
+        void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
+        virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+    protected:
+        virtual void    DataChanged( const DataChangedEvent& aEvent);
+        virtual void    LoseFocus();
+        virtual void    Paint( const Rectangle& rRect);
+        virtual void    GetFocus();
+        virtual MenuButton* CreateMenuButton() = 0;
+
+        void        SetSizePixel( const Size& rNewSize );
+        SfxItemSet  DefaultItem();
+
+        DECL_LINK(ModifyHdl, void*);
+        DECL_LINK(ScrollHdl, ScrollBar*);
+        DECL_LINK(DeleteHdl, void*);
+
+        inline SwView& DocView() { return mrView;}
+        inline SwPostItMgr& Mgr() { return mrMgr; }
+        inline Outliner* Engine() { return mpOutliner;}
+
+    private:
+        SwSidebarWin*   GetTopReplyNote();
+
+        virtual SvxLanguageItem GetLanguage(void);
+
+        SwPostItMgr&    mrMgr;
+        SwView&         mrView;
+        const SwPostItBits nFlags;
+
+        sal_uLong           mnEventId;
+
+        OutlinerView*   mpOutlinerView;
+        Outliner*       mpOutliner;
+
+        sw::sidebarwindows::SidebarTxtControl* mpSidebarTxtControl;
+        ScrollBar*      mpVScrollbar;
+        Edit*           mpMetadataAuthor;
+        Edit*           mpMetadataDate;
+        MenuButton*     mpMenuButton;
+
+        sw::sidebarwindows::AnchorOverlayObject* mpAnchor;
+        sw::sidebarwindows::ShadowOverlayObject* mpShadow;
+
+        Color           mColorAnchor;
+        Color           mColorDark;
+        Color           mColorLight;
+        Color           mChangeColor;
+
+        sw::sidebarwindows::SidebarPosition meSidebarPosition;
+
+        Rectangle       mPosSize;
+        SwRect          mAnchorRect;
+        long            mPageBorder;
+
+        bool            mbMouseOver;
+        SwPostItHelper::SwLayoutStatus mLayoutStatus;
+
+        bool            mbReadonly;
+        bool            mbIsFollow;
+
+        SwSidebarItem& mrSidebarItem;
+        const SwFrm* mpAnchorFrm;
+};
+
+} } // eof namespace sw::sidebarwindows
+
+
+// implementation for change tracking comments, fully functional, but not yet used
+/*
+class SwRedComment : public SwSidebarWin
+{
+	private:
+		SwRedline*		pRedline;
+
+	protected:
+		virtual void	MouseButtonDown( const MouseEvent& rMEvt );
+	public:
+		SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed);
+		virtual ~SwRedComment() {};
+
+		virtual void	UpdateData();
+		virtual void	SetPostItText();
+		virtual void	Delete();
+		virtual void	GotoPos();
+		virtual void	SetPopup();
+		virtual void	ActivatePostIt();
+		virtual void	DeactivatePostIt();
+
+		virtual String	GetAuthor();
+		virtual Date	GetDate();
+		virtual Time	GetTime();
+
+		virtual bool	IsProtected();
+};
+*/
+
+#endif

File sw/source/ui/inc/postititem.hxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _POSTITITEM_HXX
+#define _POSTITITEM_HXX
+
+#include <postithelper.hxx>
+#include <fmtfld.hxx>
+#include <vcl/window.hxx>
+#include <SidebarWindowsTypes.hxx>
+#include <svl/brdcst.hxx>
+
+class SwTxtFld;
+class SwRootFrm;
+class SwPostIt;
+class String;
+class SwPostItMgr;
+class SwEditWin;
+
+namespace sw { namespace sidebarwindows {
+    class SwSidebarWin;
+} }
+
+struct SwPosition;
+
+typedef sal_Int64 SwPostItBits;
+
+class SwSidebarItem
+{
+public:
+    sw::sidebarwindows::SwSidebarWin* pPostIt;
+    bool bShow;
+    bool bFocus;
+
+    SwPostItHelper::SwLayoutStatus mLayoutStatus;
+    SwLayoutInfo maLayoutInfo;
+
+    SwSidebarItem( const bool aShow,
+                   const bool aFocus)
+        : pPostIt(0)
+        , bShow(aShow)
+        , bFocus(aFocus)
+        , mLayoutStatus( SwPostItHelper::INVISIBLE )
+        , maLayoutInfo()
+	{}
+    virtual ~SwSidebarItem(){}
+    virtual SwPosition GetAnchorPosition() const = 0;
+	virtual bool UseElement() = 0;
+    virtual SwFmtFld* GetFmtFld() const = 0;
+	virtual SfxBroadcaster* GetBroadCaster() const = 0;
+    virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin,
+                                                                WinBits nBits,
+                                                                SwPostItMgr& aMgr,
+                                                                SwPostItBits aBits) = 0;
+};
+/*
+class