xref: /trunk/main/sw/source/core/inc/ftnboss.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _FTNBOSS_HXX
24cdf0e10cSrcweir #define _FTNBOSS_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "layfrm.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir class SwFtnBossFrm;
29cdf0e10cSrcweir class SwFtnContFrm;
30cdf0e10cSrcweir class SwFtnFrm;
31cdf0e10cSrcweir class SwTxtFtn;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //Setzen des maximalen Fussnotenbereiches. Restaurieren des alten Wertes im DTor.
35cdf0e10cSrcweir //Implementierung im ftnfrm.cxx
36cdf0e10cSrcweir class SwSaveFtnHeight
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     SwFtnBossFrm *pBoss;
39cdf0e10cSrcweir     const SwTwips nOldHeight;
40cdf0e10cSrcweir     SwTwips nNewHeight;
41cdf0e10cSrcweir public:
42cdf0e10cSrcweir     SwSaveFtnHeight( SwFtnBossFrm *pBs, const SwTwips nDeadLine );
43cdf0e10cSrcweir     ~SwSaveFtnHeight();
44cdf0e10cSrcweir };
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #define NA_ONLY_ADJUST 0
47cdf0e10cSrcweir #define NA_GROW_SHRINK 1
48cdf0e10cSrcweir #define NA_GROW_ADJUST 2
49cdf0e10cSrcweir #define NA_ADJUST_GROW 3
50cdf0e10cSrcweir 
51cdf0e10cSrcweir class SwFtnBossFrm: public SwLayoutFrm
52cdf0e10cSrcweir {
53cdf0e10cSrcweir     //Fuer die privaten Fussnotenoperationen
54cdf0e10cSrcweir     friend class SwFrm;
55cdf0e10cSrcweir     friend class SwSaveFtnHeight;
56cdf0e10cSrcweir     friend class SwPageFrm; // fuer das Setzen der MaxFtnHeight
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     //Maximale Hoehe des Fussnotencontainers fuer diese Seite.
59cdf0e10cSrcweir     SwTwips nMaxFtnHeight;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     SwFtnContFrm *MakeFtnCont();
62cdf0e10cSrcweir     SwFtnFrm     *FindFirstFtn();
63cdf0e10cSrcweir     sal_uInt8 _NeighbourhoodAdjustment( const SwFrm* pFrm ) const;
64cdf0e10cSrcweir protected:
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     void          InsertFtn( SwFtnFrm * );
67cdf0e10cSrcweir     static void   ResetFtn( const SwFtnFrm *pAssumed );
68cdf0e10cSrcweir public:
SwFtnBossFrm(SwFrmFmt * pFmt,SwFrm * pSib)69cdf0e10cSrcweir     inline SwFtnBossFrm( SwFrmFmt* pFmt, SwFrm* pSib ) : SwLayoutFrm( pFmt, pSib ) {}
70cdf0e10cSrcweir 
71cdf0e10cSrcweir                  SwLayoutFrm *FindBodyCont();
72cdf0e10cSrcweir     inline const SwLayoutFrm *FindBodyCont() const;
SetMaxFtnHeight(const SwTwips nNewMax)73cdf0e10cSrcweir     inline void SetMaxFtnHeight( const SwTwips nNewMax ) { nMaxFtnHeight = nNewMax; }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     //Fussnotenschnittstelle
76cdf0e10cSrcweir     void AppendFtn( SwCntntFrm *, SwTxtFtn * );
77cdf0e10cSrcweir     void RemoveFtn( const SwCntntFrm *, const SwTxtFtn *, sal_Bool bPrep = sal_True );
78cdf0e10cSrcweir     static       SwFtnFrm     *FindFtn( const SwCntntFrm *, const SwTxtFtn * );
79cdf0e10cSrcweir                  SwFtnContFrm *FindFtnCont();
80cdf0e10cSrcweir     inline const SwFtnContFrm *FindFtnCont() const;
81cdf0e10cSrcweir            const SwFtnFrm     *FindFirstFtn( SwCntntFrm* ) const;
82cdf0e10cSrcweir                  SwFtnContFrm *FindNearestFtnCont( sal_Bool bDontLeave = sal_False );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     void ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *,
85cdf0e10cSrcweir                        SwCntntFrm *pNew );
86cdf0e10cSrcweir     void RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock = sal_False,
87cdf0e10cSrcweir                         const SwTxtFtn *pAttr = 0 );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     //SS damit der Textformatierer Temporaer die Fussnotenhoehe begrenzen
90cdf0e10cSrcweir     //kann. DeadLine in Dokumentkoordinaten.
91cdf0e10cSrcweir     void    SetFtnDeadLine( const SwTwips nDeadLine );
GetMaxFtnHeight() const92cdf0e10cSrcweir     SwTwips GetMaxFtnHeight() const { return nMaxFtnHeight; }
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     //Liefert den Wert, der noch uebrig ist, bis der Body seine minimale
95cdf0e10cSrcweir     //Hoehe erreicht hat.
96cdf0e10cSrcweir     SwTwips GetVarSpace() const;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         //Layoutseitig benoetigte Methoden
99cdf0e10cSrcweir     /// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and
100cdf0e10cSrcweir     /// <_pRefFtnBossFrm> in order to control, if only footnotes, which are positioned
101cdf0e10cSrcweir     /// before the given reference footnote boss frame have to be collected.
102cdf0e10cSrcweir     /// Note: if parameter <_bCollectOnlyPreviousFtns> is true, then parameter
103cdf0e10cSrcweir     /// <_pRefFtnBossFrm> have to be referenced to an object.
104cdf0e10cSrcweir     static void _CollectFtns( const SwCntntFrm*   _pRef,
105cdf0e10cSrcweir                               SwFtnFrm*           _pFtn,
106cdf0e10cSrcweir                               SvPtrarr&           _rFtnArr,
107cdf0e10cSrcweir                               const sal_Bool      _bCollectOnlyPreviousFtns = sal_False,
108cdf0e10cSrcweir                               const SwFtnBossFrm* _pRefFtnBossFrm = NULL);
109cdf0e10cSrcweir     /// OD 03.04.2003 #108446# - add parameter <_bCollectOnlyPreviousFtns> in
110cdf0e10cSrcweir     /// order to control, if only footnotes, which are positioned before the
111cdf0e10cSrcweir     /// footnote boss frame <this> have to be collected.
112cdf0e10cSrcweir     void    CollectFtns( const SwCntntFrm* _pRef,
113cdf0e10cSrcweir                          SwFtnBossFrm*     _pOld,
114cdf0e10cSrcweir                          SvPtrarr&         _rFtnArr,
115cdf0e10cSrcweir                          const sal_Bool    _bCollectOnlyPreviousFtns = sal_False );
116cdf0e10cSrcweir     void    _MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc = sal_False );
117cdf0e10cSrcweir     void    MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
118cdf0e10cSrcweir                       SwTxtFtn *pAttr );
119cdf0e10cSrcweir     // Sollte AdjustNeighbourhood gerufen werden (oder Grow/Shrink)?
NeighbourhoodAdjustment(const SwFrm * pFrm) const120cdf0e10cSrcweir     sal_uInt8 NeighbourhoodAdjustment( const SwFrm* pFrm ) const
121cdf0e10cSrcweir         { return IsPageFrm() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrm ); }
122cdf0e10cSrcweir };
123cdf0e10cSrcweir 
FindBodyCont() const124cdf0e10cSrcweir inline const SwLayoutFrm *SwFtnBossFrm::FindBodyCont() const
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     return ((SwFtnBossFrm*)this)->FindBodyCont();
127cdf0e10cSrcweir }
FindFtnCont() const128cdf0e10cSrcweir inline const SwFtnContFrm *SwFtnBossFrm::FindFtnCont() const
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     return ((SwFtnBossFrm*)this)->FindFtnCont();
131cdf0e10cSrcweir }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir #endif  //_FTNBOSS_HXX
134