xref: /aoo42x/main/sw/source/core/inc/ftnfrm.hxx (revision cdf0e10c)
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 _FTNFRM_HXX
28 #define _FTNFRM_HXX
29 
30 #include "layfrm.hxx"
31 
32 class SwCntntFrm;
33 class SwTxtFtn;
34 class SwBorderAttrs;
35 class SwFtnFrm;
36 
37 //Fuer Fussnoten gibt es einen Speziellen Bereich auf der Seite. Dieser
38 //Bereich ist ein SwFtnContFrm.
39 //Jede Fussnote ist durch einen SwFtnFrm abgegrenzt, dieser nimmt die
40 //Fussnotenabsaetze auf. SwFtnFrm koennen aufgespalten werden, sie gehen
41 //dann auf einer anderen Seite weiter.
42 
43 class SwFtnContFrm: public SwLayoutFrm
44 {
45 public:
46 	SwFtnContFrm( SwFrmFmt*, SwFrm* );
47 
48 	const SwFtnFrm* FindFootNote() const;
49 
50     virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
51     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
52 	virtual void    Format( const SwBorderAttrs *pAttrs = 0 );
53 	virtual void    PaintBorder( const SwRect &, const SwPageFrm *pPage,
54 								 const SwBorderAttrs & ) const;
55 			void    PaintLine( const SwRect &, const SwPageFrm * ) const;
56 };
57 
58 class SwFtnFrm: public SwLayoutFrm
59 {
60 	//Zeiger auf den FtnFrm in dem die Fussnote weitergefuehrt wird:
61 	// 0     wenn kein Follow vorhanden,
62 	// this  beim letzten
63 	// der Follow sonst.
64 	SwFtnFrm	 *pFollow;
65 	SwFtnFrm	 *pMaster;		//Der FtnFrm dessen Follow ich bin.
66 	SwCntntFrm	 *pRef;			//In diesem CntntFrm steht die Fussnotenref.
67 	SwTxtFtn	 *pAttr;		//Fussnotenattribut (zum wiedererkennen)
68 
69     sal_Bool bBackMoveLocked : 1;   //Absaetze in dieser Fussnote duerfen derzeit
70 								//nicht rueckwaerts fliessen.
71     // --> OD 2005-05-18 #i49383# - control unlock of position of lower anchored objects.
72     bool mbUnlockPosOfLowerObjs : 1;
73     // <--
74 #ifdef DBG_UTIL
75 protected:
76     virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
77     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
78 #endif
79 
80 
81 public:
82 	SwFtnFrm( SwFrmFmt*, SwFrm*, SwCntntFrm*, SwTxtFtn* );
83 
84 	virtual void Cut();
85 	virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
86 
87 	sal_Bool operator<( const SwTxtFtn* pTxtFtn ) const;
88 
89 #ifndef DBG_UTIL
90 	const SwCntntFrm *GetRef() const	{ return pRef; }
91 		 SwCntntFrm  *GetRef()  		{ return pRef; }
92 #else
93 	//JP 15.10.2001: in a non pro version test if the attribute has the same
94 	//				meaning which his reference is
95 	const SwCntntFrm *GetRef() const;
96 		 SwCntntFrm  *GetRef();
97 #endif
98 	const SwCntntFrm *GetRefFromAttr()  const;
99 		  SwCntntFrm *GetRefFromAttr();
100 
101 	const SwFtnFrm *GetFollow() const 	{ return pFollow; }
102 		  SwFtnFrm *GetFollow() 		{ return pFollow; }
103 
104 	const SwFtnFrm *GetMaster() const	{ return pMaster; }
105 		  SwFtnFrm *GetMaster() 		{ return pMaster; }
106 
107 	const SwTxtFtn   *GetAttr() const 	{ return pAttr; }
108 		  SwTxtFtn	 *GetAttr() 	  	{ return pAttr; }
109 
110 	void SetFollow( SwFtnFrm *pNew ) { pFollow = pNew; }
111 	void SetMaster( SwFtnFrm *pNew ) { pMaster = pNew; }
112 	void SetRef   ( SwCntntFrm *pNew ) { pRef = pNew; }
113 
114 	void InvalidateNxtFtnCnts( SwPageFrm* pPage );
115 
116 	void LockBackMove()		{ bBackMoveLocked = sal_True; }
117 	void UnlockBackMove()   { bBackMoveLocked = sal_False;}
118 	sal_Bool IsBackMoveLocked() { return bBackMoveLocked; }
119 
120 	// Verhindert, dass der letzte Inhalt den SwFtnFrm mitloescht (Cut())
121 	inline void ColLock()		{ bColLocked = sal_True; }
122 	inline void ColUnlock()   	{ bColLocked = sal_False; }
123 
124     // --> OD 2005-05-18 #i49383#
125     inline void UnlockPosOfLowerObjs()
126     {
127         mbUnlockPosOfLowerObjs = true;
128     }
129     inline void KeepLockPosOfLowerObjs()
130     {
131         mbUnlockPosOfLowerObjs = false;
132     }
133     inline bool IsUnlockPosOfLowerObjs()
134     {
135         return mbUnlockPosOfLowerObjs;
136     }
137     // <--
138     /** search for last content in the current footnote frame
139 
140         OD 2005-12-02 #i27138#
141 
142         @author OD
143 
144         @return SwCntntFrm*
145         pointer to found last content frame. NULL, if none is found.
146     */
147     SwCntntFrm* FindLastCntnt();
148 };
149 
150 #endif	//_FTNFRM_HXX
151