xref: /aoo4110/main/sw/source/core/inc/ftnboss.hxx (revision b1cdbd2c)
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 _FTNBOSS_HXX
24 #define _FTNBOSS_HXX
25 
26 #include "layfrm.hxx"
27 
28 class SwFtnBossFrm;
29 class SwFtnContFrm;
30 class SwFtnFrm;
31 class SwTxtFtn;
32 
33 
34 //Setzen des maximalen Fussnotenbereiches. Restaurieren des alten Wertes im DTor.
35 //Implementierung im ftnfrm.cxx
36 class SwSaveFtnHeight
37 {
38 	SwFtnBossFrm *pBoss;
39 	const SwTwips nOldHeight;
40 	SwTwips nNewHeight;
41 public:
42 	SwSaveFtnHeight( SwFtnBossFrm *pBs, const SwTwips nDeadLine );
43 	~SwSaveFtnHeight();
44 };
45 
46 #define NA_ONLY_ADJUST 0
47 #define NA_GROW_SHRINK 1
48 #define NA_GROW_ADJUST 2
49 #define NA_ADJUST_GROW 3
50 
51 class SwFtnBossFrm: public SwLayoutFrm
52 {
53 	//Fuer die privaten Fussnotenoperationen
54 	friend class SwFrm;
55 	friend class SwSaveFtnHeight;
56 	friend class SwPageFrm; // fuer das Setzen der MaxFtnHeight
57 
58 	//Maximale Hoehe des Fussnotencontainers fuer diese Seite.
59 	SwTwips nMaxFtnHeight;
60 
61 	SwFtnContFrm *MakeFtnCont();
62 	SwFtnFrm	 *FindFirstFtn();
63 	sal_uInt8 _NeighbourhoodAdjustment( const SwFrm* pFrm ) const;
64 protected:
65 
66 	void		  InsertFtn( SwFtnFrm * );
67 	static void	  ResetFtn( const SwFtnFrm *pAssumed );
68 public:
SwFtnBossFrm(SwFrmFmt * pFmt,SwFrm * pSib)69 	inline SwFtnBossFrm( SwFrmFmt* pFmt, SwFrm* pSib ) : SwLayoutFrm( pFmt, pSib ) {}
70 
71 				 SwLayoutFrm *FindBodyCont();
72 	inline const SwLayoutFrm *FindBodyCont() const;
SetMaxFtnHeight(const SwTwips nNewMax)73 	inline void SetMaxFtnHeight( const SwTwips nNewMax ) { nMaxFtnHeight = nNewMax; }
74 
75 	//Fussnotenschnittstelle
76 	void AppendFtn( SwCntntFrm *, SwTxtFtn * );
77 	void RemoveFtn( const SwCntntFrm *, const SwTxtFtn *, sal_Bool bPrep = sal_True );
78 	static		 SwFtnFrm 	  *FindFtn( const SwCntntFrm *, const SwTxtFtn * );
79 				 SwFtnContFrm *FindFtnCont();
80 	inline const SwFtnContFrm *FindFtnCont() const;
81 		   const SwFtnFrm	  *FindFirstFtn( SwCntntFrm* ) const;
82 				 SwFtnContFrm *FindNearestFtnCont( sal_Bool bDontLeave = sal_False );
83 
84 	void ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *,
85 					   SwCntntFrm *pNew );
86 	void RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock = sal_False,
87 						const SwTxtFtn *pAttr = 0 );
88 
89 	//SS damit der Textformatierer Temporaer die Fussnotenhoehe begrenzen
90 	//kann. DeadLine in Dokumentkoordinaten.
91 	void	SetFtnDeadLine( const SwTwips nDeadLine );
GetMaxFtnHeight() const92 	SwTwips GetMaxFtnHeight() const { return nMaxFtnHeight; }
93 
94 	//Liefert den Wert, der noch uebrig ist, bis der Body seine minimale
95 	//Hoehe erreicht hat.
96 	SwTwips GetVarSpace() const;
97 
98 		//Layoutseitig benoetigte Methoden
99     /// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and
100     /// <_pRefFtnBossFrm> in order to control, if only footnotes, which are positioned
101     /// before the given reference footnote boss frame have to be collected.
102     /// Note: if parameter <_bCollectOnlyPreviousFtns> is true, then parameter
103     /// <_pRefFtnBossFrm> have to be referenced to an object.
104     static void _CollectFtns( const SwCntntFrm*   _pRef,
105                               SwFtnFrm*           _pFtn,
106                               SvPtrarr&           _rFtnArr,
107                               const sal_Bool      _bCollectOnlyPreviousFtns = sal_False,
108                               const SwFtnBossFrm* _pRefFtnBossFrm = NULL);
109     /// OD 03.04.2003 #108446# - add parameter <_bCollectOnlyPreviousFtns> in
110     /// order to control, if only footnotes, which are positioned before the
111     /// footnote boss frame <this> have to be collected.
112     void    CollectFtns( const SwCntntFrm* _pRef,
113                          SwFtnBossFrm*     _pOld,
114                          SvPtrarr&         _rFtnArr,
115                          const sal_Bool    _bCollectOnlyPreviousFtns = sal_False );
116 	void	_MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc = sal_False );
117 	void	MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
118 					  SwTxtFtn *pAttr );
119 	// Sollte AdjustNeighbourhood gerufen werden (oder Grow/Shrink)?
NeighbourhoodAdjustment(const SwFrm * pFrm) const120 	sal_uInt8 NeighbourhoodAdjustment( const SwFrm* pFrm ) const
121 		{ return IsPageFrm() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrm ); }
122 };
123 
FindBodyCont() const124 inline const SwLayoutFrm *SwFtnBossFrm::FindBodyCont() const
125 {
126 	return ((SwFtnBossFrm*)this)->FindBodyCont();
127 }
FindFtnCont() const128 inline const SwFtnContFrm *SwFtnBossFrm::FindFtnCont() const
129 {
130 	return ((SwFtnBossFrm*)this)->FindFtnCont();
131 }
132 
133 #endif	//_FTNBOSS_HXX
134