merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / postithelper.hxx
blob992377ceb20ed59f3ae06a3ea435701face7a36f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: postithelper.hxx,v $
10 * $Revision: 1.2.118.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _POSTITHELPER_HXX
31 #define _POSTITHELPER_HXX
33 #include <swrect.hxx>
34 #include <fmtfld.hxx>
35 #include <redline.hxx>
36 #include <vector>
37 #include <vcl/window.hxx>
38 #include <svtools/brdcst.hxx>
40 class SwTxtFld;
41 class SwRootFrm;
42 class SwPostIt;
43 class String;
44 class SwMarginWin;
45 class SwPostItMgr;
47 struct SwPosition;
49 typedef sal_Int64 SwPostItBits;
51 struct SwLayoutInfo
53 SwRect mPosition;
54 SwRect mPageFrame;
55 SwRect mPagePrtArea;
56 unsigned long mnPageNumber;
57 bool mbMarginSide;
58 USHORT mRedlineAuthor;
61 namespace SwPostItHelper
63 enum SwLayoutStatus
65 INVISIBLE, VISIBLE, INSERTED, DELETED, NONE, HIDDEN
68 SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwPosition& );
69 SwLayoutStatus getLayoutInfos( std::vector< SwLayoutInfo >&, SwTxtFld* );
70 long getLayoutHeight( const SwRootFrm* pRoot );
71 void setSidebarChanged( SwRootFrm* pRoot, bool bBrowseMode );
72 unsigned long getPageInfo( SwRect& rPageFrm, const SwRootFrm* , const Point& );
75 class SwMarginItem
77 public:
78 SwMarginWin* pPostIt;
79 bool bShow;
80 bool bFocus;
81 bool bMarginSide;
82 SwRect mPos;
83 SwRect mFramePos;
84 SwRect mPagePos;
85 unsigned long mnPageNumber;
86 SwPostItHelper::SwLayoutStatus mLayoutStatus;
87 USHORT mRedlineAuthor;
88 SwMarginItem(bool aShow, bool aFocus)
89 : pPostIt(0),
90 bShow(aShow),
91 bFocus(aFocus),
92 bMarginSide(false),
93 mnPageNumber(1),
94 mLayoutStatus( SwPostItHelper::INVISIBLE ),
95 mRedlineAuthor(0)
97 virtual ~SwMarginItem(){}
98 virtual SwPosition GetPosition() = 0;
99 virtual bool UseElement() = 0;
100 virtual SwFmtFld* GetFmtFld() = 0;
101 virtual SfxBroadcaster* GetBroadCaster() const = 0;
102 virtual SwMarginWin* GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits) = 0;
105 class SwRedCommentItem: public SwMarginItem
107 private:
108 SwRedline* pRedline;
109 public:
111 SwRedCommentItem( SwRedline* pRed, bool aShow, bool aFocus)
112 : SwMarginItem(aShow,aFocus),
113 pRedline(pRed) {}
114 virtual ~SwRedCommentItem() {}
115 virtual SwPosition GetPosition();
116 virtual bool UseElement();
117 virtual SwFmtFld* GetFmtFld() {return 0; }
118 virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pRedline); }
119 virtual SwMarginWin* GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits);
123 class SwPostItItem: public SwMarginItem
125 private:
126 SwFmtFld* pFmtFld;
128 public:
129 SwPostItItem( SwFmtFld* p, bool aShow, bool aFocus)
130 : SwMarginItem(aShow,aFocus) ,
131 pFmtFld(p)
134 virtual ~SwPostItItem() {}
135 virtual SwPosition GetPosition();
136 virtual bool UseElement();
137 virtual SwFmtFld* GetFmtFld() {return pFmtFld;}
138 virtual SfxBroadcaster* GetBroadCaster() const { return dynamic_cast<SfxBroadcaster *> (pFmtFld); }
139 virtual SwMarginWin* GetMarginWindow(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits);
142 #endif // _POSTITHELPER_HXX