diff options
Diffstat (limited to 'sw/inc/PostItMgr.hxx')
-rw-r--r-- | sw/inc/PostItMgr.hxx | 129 |
1 files changed, 81 insertions, 48 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index e3d46238a286..e99c636ccedb 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -39,6 +39,7 @@ #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; @@ -53,9 +54,16 @@ class SwEditWin; class Color; class SvxSearchItem; class SvxLanguageItem; -class SwPostIt; -class SwMarginWin; -class SwMarginItem; +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 @@ -64,23 +72,20 @@ class SwMarginItem; #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<SwMarginItem*> SwMarginItem_list; -typedef std::list<SwMarginItem*>::iterator SwMarginItem_iterator; +typedef std::list<SwSidebarItem*> SwSidebarItem_list; +typedef std::list<SwSidebarItem*>::iterator SwSidebarItem_iterator; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using ::rtl::OUString; struct SwPostItPageItem { bool bScrollbar; - bool bMarginSide; + sw::sidebarwindows::SidebarPosition eSidebarPosition; long lOffset; SwRect mPageRect; - SwMarginItem_list* mList; + SwSidebarItem_list* mList; SwPostItPageItem(): bScrollbar(false),lOffset(0) { - mList = new SwMarginItem_list; + mList = new SwSidebarItem_list; } ~SwPostItPageItem() { @@ -103,25 +108,27 @@ struct FieldShadowState class SwNoteProps: public utl::ConfigItem { private: - bool bIsShowAnkor; + bool bIsShowAnchor; public: - SwNoteProps() : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes")), bIsShowAnkor(false) + SwNoteProps() + : ConfigItem(::rtl::OUString::createFromAscii("Office.Writer/Notes")) + , bIsShowAnchor(false) { - const Sequence<OUString>& rNames = GetPropertyNames(); - Sequence<Any> aValues = GetProperties(rNames); - const Any* pValues = aValues.getConstArray(); + 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]>>=bIsShowAnkor; + pValues[0]>>=bIsShowAnchor; } - bool IsShowAnkor() + bool IsShowAnchor() { - return bIsShowAnkor; + return bIsShowAnchor; } - Sequence<OUString>& GetPropertyNames() + ::com::sun::star::uno::Sequence< ::rtl::OUString >& GetPropertyNames() { - static Sequence<OUString> aNames; + static ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames; if(!aNames.getLength()) { static const char* aPropNames[] = @@ -130,9 +137,9 @@ class SwNoteProps: public utl::ConfigItem }; const int nCount = sizeof(aPropNames)/sizeof(const char*); aNames.realloc(nCount); - OUString* pNames = aNames.getArray(); + ::rtl::OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) - pNames[i] = OUString::createFromAscii(aPropNames[i]); + pNames[i] = ::rtl::OUString::createFromAscii(aPropNames[i]); } return aNames; } @@ -147,11 +154,11 @@ class SwPostItMgr: public SfxListener SwView* mpView; SwWrtShell* mpWrtShell; SwEditWin* mpEditWin; - std::list< SwMarginItem*> mvPostItFlds; + std::list< SwSidebarItem*> mvPostItFlds; std::vector<SwPostItPageItem*> mPages; ULONG mnEventId; bool mbWaitingForCalcRects; - SwMarginWin* mpActivePostIt; + sw::sidebarwindows::SwSidebarWin* mpActivePostIt; bool mbLayout; long mbLayoutHeight; long mbLayouting; @@ -159,18 +166,23 @@ class SwPostItMgr: public SfxListener bool mbDeleteNote; FieldShadowState mShadowState; OutlinerParaObject* mpAnswer; - bool mpIsShowAnkor; + bool mbIsShowAnchor; - typedef std::list<SwMarginWin*>::iterator SwMarginWin_iterator; + // 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 RemoveMarginWin(); + void RemoveSidebarWin(); void PreparePageContainer(); void Scroll(const long lScroll,const unsigned long aPage ); - void AutoScroll(const SwMarginWin* pPostIt,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<SwMarginWin*> &aVisiblePostItList,const Rectangle aBorder,long lNeededHeight); + bool LayoutByPage( std::list<sw::sidebarwindows::SwSidebarWin*> &aVisiblePostItList, + const Rectangle aBorder, + long lNeededHeight); void CheckForRemovedPostIts(); bool ArrowEnabled(USHORT aDirection,unsigned long aPage) const; bool BorderOverPageBorder(unsigned long aPage) const; @@ -182,29 +194,34 @@ class SwPostItMgr: public SfxListener sal_Int32 GetSpaceBetween() const; void SetReadOnlyState(); DECL_LINK( CalcHdl, void*); - protected: + + 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< SwMarginItem* >::const_iterator const_iterator; + typedef std::list< SwSidebarItem* >::const_iterator const_iterator; const_iterator begin() const { return mvPostItFlds.begin(); } const_iterator end() const { return mvPostItFlds.end(); } - void InsertItem( SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus); - void RemoveItem( SfxBroadcaster* pBroadcast ); void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); void LayoutPostIts(); bool CalcRects(); - void MakeVisible(const SwMarginWin* pPostIt,long aPage = -1); + void MakeVisible( const sw::sidebarwindows::SwSidebarWin* pPostIt, + long aPage = -1); bool ShowScrollbar(const unsigned long aPage) const; bool HasNotes() const ; bool ShowNotes() const; - bool IsShowAnkor() { return mpIsShowAnkor;} + bool IsShowAnchor() { return mbIsShowAnchor;} unsigned long GetSidebarWidth(bool bPx = false) const; unsigned long GetSidebarBorderWidth(bool bPx = false) const; unsigned long GetNoteWidth(); @@ -213,8 +230,6 @@ class SwPostItMgr: public SfxListener void CorrectPositions(); - void Sort(const short aType); - void SetLayout() { mbLayout = true; }; void Delete(String aAuthor); void Delete(); @@ -232,25 +247,32 @@ class SwPostItMgr: public SfxListener bool IsHit(const Point &aPointPixel); Color GetArrowColor(USHORT aDirection,unsigned long aPage) const; - SwMarginWin* GetNextPostIt(USHORT aDirection, SwMarginWin* aPostIt); + sw::annotation::SwAnnotationWin* GetAnnotationWin(const SwPostItField* pFld) const; + + sw::sidebarwindows::SwSidebarWin* GetNextPostIt( USHORT aDirection, + sw::sidebarwindows::SwSidebarWin* aPostIt); long GetNextBorder(); - SwMarginWin* GetActivePostIt() { return mpActivePostIt; } - void SetActivePostIt( SwMarginWin* p); + + 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; - SwMarginWin* GetPostIt(const SfxBroadcaster* pBroadcaster) const; - SwMarginWin* GetPostIt(SfxBroadcaster* pBroadcaster) const; - SwPostIt* GetPostIt(const SwPostItField* pFld) const; - SwPostIt* GetPostIt(SwPostItField* pFld) const; - void SetShadowState(const SwPostItField* pFld,bool bCursor = true); void SetSpellChecking(); Color GetColorDark(sal_uInt16 aAuthorIndex); Color GetColorLight(sal_uInt16 aAuthorIndex); - Color GetColorAnkor(sal_uInt16 aAuthorIndex); + Color GetColorAnchor(sal_uInt16 aAuthorIndex); bool ShowPreview(const SwField* pFld,SwFmtFld*& pFmtFld) const; @@ -263,7 +285,18 @@ class SwPostItMgr: public SfxListener 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 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 |