1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _POSTITHELPER_HXX 24 #define _POSTITHELPER_HXX 25 26 #include <swrect.hxx> 27 #include <fmtfld.hxx> 28 #include <redline.hxx> 29 #include <vector> 30 #include <vcl/window.hxx> 31 #include <SidebarWindowsTypes.hxx> 32 #include <svl/brdcst.hxx> 33 34 class SwTxtFld; 35 class SwRootFrm; 36 class SwPostIt; 37 class String; 38 class SwPostItMgr; 39 class SwEditWin; 40 namespace sw { namespace sidebarwindows { 41 class SwSidebarWin; 42 } } 43 44 struct SwPosition; 45 46 typedef sal_Int64 SwPostItBits; 47 48 struct SwLayoutInfo 49 { 50 const SwFrm* mpAnchorFrm; 51 SwRect mPosition; 52 SwRect mPageFrame; 53 SwRect mPagePrtArea; 54 unsigned long mnPageNumber; 55 sw::sidebarwindows::SidebarPosition meSidebarPosition; 56 sal_uInt16 mRedlineAuthor; 57 58 SwLayoutInfo() 59 : mpAnchorFrm(0) 60 , mPosition() 61 , mPageFrame() 62 , mPagePrtArea() 63 , mnPageNumber(1) 64 , meSidebarPosition(sw::sidebarwindows::SIDEBAR_NONE) 65 , mRedlineAuthor(0) 66 {} 67 }; 68 69 namespace SwPostItHelper 70 { 71 enum SwLayoutStatus 72 { 73 INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN 74 }; 75 76 SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwPosition& ); 77 long getLayoutHeight( const SwRootFrm* pRoot ); 78 void setSidebarChanged( SwRootFrm* pRoot, bool bBrowseMode ); 79 unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& ); 80 } 81 82 class SwSidebarItem 83 { 84 public: 85 sw::sidebarwindows::SwSidebarWin* pPostIt; 86 bool bShow; 87 bool bFocus; 88 89 SwPostItHelper::SwLayoutStatus mLayoutStatus; 90 SwLayoutInfo maLayoutInfo; 91 92 SwSidebarItem( const bool aShow, 93 const bool aFocus) 94 : pPostIt(0) 95 , bShow(aShow) 96 , bFocus(aFocus) 97 , mLayoutStatus( SwPostItHelper::INVISIBLE ) 98 , maLayoutInfo() 99 {} 100 virtual ~SwSidebarItem(){} 101 virtual SwPosition GetAnchorPosition() const = 0; 102 virtual bool UseElement() = 0; 103 virtual SwFmtFld* GetFmtFld() const = 0; 104 virtual SfxBroadcaster* GetBroadCaster() const = 0; 105 virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin, 106 WinBits nBits, 107 SwPostItMgr& aMgr, 108 SwPostItBits aBits) = 0; 109 }; 110 /* 111 class SwRedCommentItem: public SwSidebarItem 112 { 113 private: 114 SwRedline* pRedline; 115 public: 116 117 SwRedCommentItem( SwRedline* pRed, bool aShow, bool aFocus) 118 : SwSidebarItem(aShow,aFocus), 119 pRedline(pRed) {} 120 virtual ~SwRedCommentItem() {} 121 virtual SwPosition GetAnchorPosition() const; 122 virtual bool UseElement(); 123 virtual SwFmtFld* GetFmtFld() const {return 0; } 124 virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pRedline); } 125 virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin, 126 WinBits nBits, 127 SwPostItMgr& aMgr, 128 SwPostItBits aBits); 129 }; 130 */ 131 132 class SwAnnotationItem: public SwSidebarItem 133 { 134 private: 135 SwFmtFld* pFmtFld; 136 137 public: 138 SwAnnotationItem( SwFmtFld* p, 139 const bool aShow, 140 const bool aFocus) 141 : SwSidebarItem( aShow, aFocus ) 142 , pFmtFld(p) 143 {} 144 virtual ~SwAnnotationItem() {} 145 virtual SwPosition GetAnchorPosition() const; 146 virtual bool UseElement(); 147 virtual SwFmtFld* GetFmtFld() const {return pFmtFld;} 148 virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); } 149 virtual sw::sidebarwindows::SwSidebarWin* GetSidebarWindow( SwEditWin& rEditWin, 150 WinBits nBits, 151 SwPostItMgr& aMgr, 152 SwPostItBits aBits); 153 }; 154 155 #endif // _POSTITHELPER_HXX 156