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