1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _POSTITHELPER_HXX 28 #define _POSTITHELPER_HXX 29 30 #include <swrect.hxx> 31 #include <fmtfld.hxx> 32 #include <redline.hxx> 33 #include <vector> 34 #include <vcl/window.hxx> 35 #include <SidebarWindowsTypes.hxx> 36 #include <svl/brdcst.hxx> 37 38 class SwTxtFld; 39 class SwRootFrm; 40 class SwPostIt; 41 class String; 42 class SwPostItMgr; 43 class SwEditWin; 44 namespace sw { namespace sidebarwindows { 45 class SwSidebarWin; 46 } } 47 48 struct SwPosition; 49 50 typedef sal_Int64 SwPostItBits; 51 52 struct SwLayoutInfo 53 { 54 const SwFrm* mpAnchorFrm; 55 SwRect mPosition; 56 SwRect mPageFrame; 57 SwRect mPagePrtArea; 58 unsigned long mnPageNumber; 59 sw::sidebarwindows::SidebarPosition meSidebarPosition; 60 sal_uInt16 mRedlineAuthor; 61 62 SwLayoutInfo() 63 : mpAnchorFrm(0) 64 , mPosition() 65 , mPageFrame() 66 , mPagePrtArea() 67 , mnPageNumber(1) 68 , meSidebarPosition(sw::sidebarwindows::SIDEBAR_NONE) 69 , mRedlineAuthor(0) 70 {} 71 }; 72 73 namespace SwPostItHelper 74 { 75 enum SwLayoutStatus 76 { 77 INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN 78 }; 79 80 SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwPosition& ); 81 long getLayoutHeight( const SwRootFrm* pRoot ); 82 void setSidebarChanged( SwRootFrm* pRoot, bool bBrowseMode ); 83 unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& ); 84 } 85 86 class SwSidebarItem 87 { 88 public: 89 sw::sidebarwindows::SwSidebarWin* pPostIt; 90 bool bShow; 91 bool bFocus; 92 93 SwPostItHelper::SwLayoutStatus mLayoutStatus; 94 SwLayoutInfo maLayoutInfo; 95 96 SwSidebarItem( const bool aShow, 97 const bool aFocus) 98 : pPostIt(0) 99 , bShow(aShow) 100 , bFocus(aFocus) 101 , mLayoutStatus( SwPostItHelper::INVISIBLE ) 102 , maLayoutInfo() 103 {} 104 virtual ~SwSidebarItem(){} 105 virtual SwPosition GetAnchorPosition() const = 0; 106 virtual bool UseElement() = 0; 107 virtual SwFmtFld* GetFmtFld() const = 0; 108 virtual SfxBroadcaster* GetBroadCaster() const = 0; 109 virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin, 110 WinBits nBits, 111 SwPostItMgr& aMgr, 112 SwPostItBits aBits) = 0; 113 }; 114 /* 115 class SwRedCommentItem: public SwSidebarItem 116 { 117 private: 118 SwRedline* pRedline; 119 public: 120 121 SwRedCommentItem( SwRedline* pRed, bool aShow, bool aFocus) 122 : SwSidebarItem(aShow,aFocus), 123 pRedline(pRed) {} 124 virtual ~SwRedCommentItem() {} 125 virtual SwPosition GetAnchorPosition() const; 126 virtual bool UseElement(); 127 virtual SwFmtFld* GetFmtFld() const {return 0; } 128 virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pRedline); } 129 virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin, 130 WinBits nBits, 131 SwPostItMgr& aMgr, 132 SwPostItBits aBits); 133 }; 134 */ 135 136 class SwAnnotationItem: public SwSidebarItem 137 { 138 private: 139 SwFmtFld* pFmtFld; 140 141 public: 142 SwAnnotationItem( SwFmtFld* p, 143 const bool aShow, 144 const bool aFocus) 145 : SwSidebarItem( aShow, aFocus ) 146 , pFmtFld(p) 147 {} 148 virtual ~SwAnnotationItem() {} 149 virtual SwPosition GetAnchorPosition() const; 150 virtual bool UseElement(); 151 virtual SwFmtFld* GetFmtFld() const {return pFmtFld;} 152 virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); } 153 virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin, 154 WinBits nBits, 155 SwPostItMgr& aMgr, 156 SwPostItBits aBits); 157 }; 158 159 #endif // _POSTITHELPER_HXX 160