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 _FLOWFRM_HXX
24cdf0e10cSrcweir #define _FLOWFRM_HXX
25cdf0e10cSrcweir
26cdf0e10cSrcweir //Der FlowFrm gibt die Funktionalitaet fuer alle Frms vor, die fliessen und
27cdf0e10cSrcweir //die sich aufspalten koennen (wie CntntFrm oder TabFrm).
28cdf0e10cSrcweir //Teile der Funktionalitaet sind im FlowFrm implementiert, andere Teile werden
29cdf0e10cSrcweir //von den spezifischen Frms implementiert.
30cdf0e10cSrcweir //Der FlowFrm ist kein eigenstaender Frm, es kann also auch niemals eine
31cdf0e10cSrcweir //eigenstaendige Instanz vom FlowFrm existieren.
32cdf0e10cSrcweir //Der FlowFrm ist nicht einmal ein echter Frm. Die naheliegende Implementierung
33cdf0e10cSrcweir //waere ein FlowFrm der virtual vom SwFrm abgeleitet ist und direkt auf den
34cdf0e10cSrcweir //eigenen Instanzdaten arbeitet. Abgeleitete Klassen muessten sich
35cdf0e10cSrcweir //vom FlowFrm und (ueber mehrere Basisklassen weil der Klassenbaum sich direkt
36cdf0e10cSrcweir //vom SwFrm zu SwCntntFrm und zum SwLayoutFrm spaltet) virtual vom SwFrm
37cdf0e10cSrcweir //ableiten.
38cdf0e10cSrcweir //Leider entstehen dadurch - neben Problemen mit Compilern und Debuggern -
39cdf0e10cSrcweir //erhebliche zusaetzliche Kosten, die wir uns heutzutage IMHO nicht erlauben
40cdf0e10cSrcweir //koennen.
41cdf0e10cSrcweir //Ich greife deshalb auf eine andere Technik zurueck: Der FlowFrm hat eine
42cdf0e10cSrcweir //Referenz auf den SwFrm - der er genau betrachtet selbst ist - und ist mit
43cdf0e10cSrcweir //diesem befreundet. So kann der FlowFrm anstelle des this-Pointer mit der
44cdf0e10cSrcweir //Referenz auf den SwFrm arbeiten.
45cdf0e10cSrcweir
46cdf0e10cSrcweir //#include "frame.hxx" //fuer inlines
47cdf0e10cSrcweir
48cdf0e10cSrcweir class SwPageFrm;
49cdf0e10cSrcweir class SwRect;
50cdf0e10cSrcweir class SwBorderAttrs;
51cdf0e10cSrcweir class SwDoc;
52cdf0e10cSrcweir class SwNodeIndex;
53cdf0e10cSrcweir // --> OD 2005-03-04 #i44049#
54cdf0e10cSrcweir class SwObjectFormatterTxtFrm;
55cdf0e10cSrcweir // <--
56cdf0e10cSrcweir
57cdf0e10cSrcweir void MakeFrms( SwDoc *, const SwNodeIndex &, const SwNodeIndex & );
58cdf0e10cSrcweir
59cdf0e10cSrcweir class SwFlowFrm
60cdf0e10cSrcweir {
61cdf0e10cSrcweir //PrepareMake darf Locken/Unlocken (Robustheit)
62cdf0e10cSrcweir friend inline void PrepareLock ( SwFlowFrm * );
63cdf0e10cSrcweir friend inline void PrepareUnlock( SwFlowFrm * );
64cdf0e10cSrcweir friend inline void TableSplitRecalcLock( SwFlowFrm * );
65cdf0e10cSrcweir friend inline void TableSplitRecalcUnlock( SwFlowFrm * );
66cdf0e10cSrcweir // --> OD 2005-03-04 #i44049#
67cdf0e10cSrcweir friend class SwObjectFormatterTxtFrm;
68cdf0e10cSrcweir // <--
69cdf0e10cSrcweir
70cdf0e10cSrcweir //TblSel darf das Follow-Bit zuruecksetzen.
71cdf0e10cSrcweir friend inline void UnsetFollow( SwFlowFrm *pFlow );
72cdf0e10cSrcweir
73cdf0e10cSrcweir friend void MakeFrms( SwDoc *, const SwNodeIndex &, const SwNodeIndex & );
74cdf0e10cSrcweir
75cdf0e10cSrcweir friend class SwNode2LayImpl;
76cdf0e10cSrcweir
77cdf0e10cSrcweir SwFrm &rThis;
78cdf0e10cSrcweir
79cdf0e10cSrcweir //Hilfsfunktionen fuer MoveSubTree()
80cdf0e10cSrcweir static SwLayoutFrm *CutTree( SwFrm* );
81cdf0e10cSrcweir static sal_Bool PasteTree( SwFrm *, SwLayoutFrm *, SwFrm *, SwFrm* );
82cdf0e10cSrcweir
83cdf0e10cSrcweir //Wird fuer das Zusammenspiel von _GetPrevxxx und MoveBwd gebraucht, damit
84cdf0e10cSrcweir //mehrere Blaetter gleichzeitig uebersprungen werden koennen.
85cdf0e10cSrcweir //Wird auch vom MoveBwd des TabFrm ausgewertet!
86cdf0e10cSrcweir static sal_Bool bMoveBwdJump;
87cdf0e10cSrcweir
88cdf0e10cSrcweir /** helper method to determine previous frame for calculation of the
89cdf0e10cSrcweir upper space
90cdf0e10cSrcweir
91cdf0e10cSrcweir OD 2004-03-10 #i11860#
92cdf0e10cSrcweir
93cdf0e10cSrcweir @param _pProposedPrevFrm
94cdf0e10cSrcweir optional input parameter - pointer to frame, which should be used
95cdf0e10cSrcweir instead of the direct previous frame.
96cdf0e10cSrcweir
97cdf0e10cSrcweir @author OD
98cdf0e10cSrcweir */
99cdf0e10cSrcweir const SwFrm* _GetPrevFrmForUpperSpaceCalc( const SwFrm* _pProposedPrevFrm = 0L ) const;
100cdf0e10cSrcweir
101cdf0e10cSrcweir /** method to detemine the upper space amount, which is considered for
102cdf0e10cSrcweir the previous frame
103cdf0e10cSrcweir
104cdf0e10cSrcweir OD 2004-03-11 #i11860#
105cdf0e10cSrcweir
106cdf0e10cSrcweir @author OD
107cdf0e10cSrcweir */
108cdf0e10cSrcweir SwTwips _GetUpperSpaceAmountConsideredForPrevFrm() const;
109cdf0e10cSrcweir
110cdf0e10cSrcweir /** method to detemine the upper space amount, which is considered for
111cdf0e10cSrcweir the page grid
112cdf0e10cSrcweir
113cdf0e10cSrcweir OD 2004-03-12 #i11860#
114cdf0e10cSrcweir
115cdf0e10cSrcweir @author OD
116cdf0e10cSrcweir */
117cdf0e10cSrcweir SwTwips _GetUpperSpaceAmountConsideredForPageGrid(
118cdf0e10cSrcweir const SwTwips _nUpperSpaceWithoutGrid ) const;
119cdf0e10cSrcweir
120cdf0e10cSrcweir protected:
121cdf0e10cSrcweir
122cdf0e10cSrcweir SwFlowFrm *pFollow;
123cdf0e10cSrcweir
124cdf0e10cSrcweir sal_Bool bIsFollow :1; //Ist's ein Follow
125cdf0e10cSrcweir sal_Bool bLockJoin :1; //Join (und damit deleten) verboten wenn sal_True!
126cdf0e10cSrcweir sal_Bool bUndersized:1; // wir sind kleiner als gewuenscht
127cdf0e10cSrcweir sal_Bool bFtnAtEnd :1; // For sectionfrms only: footnotes at the end of section
128cdf0e10cSrcweir sal_Bool bEndnAtEnd :1; // " " " : endnotes at the end of section
129cdf0e10cSrcweir sal_Bool bCntntLock :1; // " " " : content locked
130cdf0e10cSrcweir sal_Bool bOwnFtnNum :1; // " " " : special numbering of footnotes
131cdf0e10cSrcweir sal_Bool bFtnLock :1; // " " " : ftn, don't leave this section bwd
132cdf0e10cSrcweir sal_Bool bFlyLock :1; // Stop positioning of at-character flyframes
133cdf0e10cSrcweir
134cdf0e10cSrcweir //Prueft ob Vorwaertsfluss noch Sinn macht Endloswanderschaften (unterbinden)
135cdf0e10cSrcweir inline sal_Bool IsFwdMoveAllowed();
136cdf0e10cSrcweir // --> OD 2005-03-08 #i44049# - method <CalcCntnt(..)> has to check this property.
137cdf0e10cSrcweir friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow );
138cdf0e10cSrcweir // <--
139cdf0e10cSrcweir sal_Bool IsKeepFwdMoveAllowed(); //Wie oben, Move fuer Keep.
140cdf0e10cSrcweir
141cdf0e10cSrcweir //Prueft ob ein Obj das Umlauf wuenscht ueberlappt.
142cdf0e10cSrcweir //eine Null bedeutet, kein Objekt ueberlappt,
143cdf0e10cSrcweir // 1 heisst, Objekte, die am FlowFrm selbst verankert sind, ueberlappen
144cdf0e10cSrcweir // 2 heisst, Objekte, die woanders verankert sind, ueberlappen
145cdf0e10cSrcweir // 3 heistt, beiderlei verankerte Objekte ueberlappen
146cdf0e10cSrcweir sal_uInt8 BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect );
147cdf0e10cSrcweir
LockJoin()148cdf0e10cSrcweir void LockJoin() { bLockJoin = sal_True; }
UnlockJoin()149cdf0e10cSrcweir void UnlockJoin() { bLockJoin = sal_False; }
150cdf0e10cSrcweir
151cdf0e10cSrcweir sal_Bool CheckMoveFwd( sal_Bool &rbMakePage, sal_Bool bKeep, sal_Bool bMovedBwd );
152cdf0e10cSrcweir sal_Bool MoveFwd( sal_Bool bMakePage, sal_Bool bPageBreak, sal_Bool bMoveAlways = sal_False );
153cdf0e10cSrcweir virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat )=0;
154cdf0e10cSrcweir sal_Bool MoveBwd( sal_Bool &rbReformat );
155cdf0e10cSrcweir
156cdf0e10cSrcweir public:
157cdf0e10cSrcweir SwFlowFrm( SwFrm &rFrm );
158cdf0e10cSrcweir
GetFrm() const159cdf0e10cSrcweir const SwFrm *GetFrm() const { return &rThis; }
GetFrm()160cdf0e10cSrcweir SwFrm *GetFrm() { return &rThis; }
161cdf0e10cSrcweir
IsMoveBwdJump()162cdf0e10cSrcweir static sal_Bool IsMoveBwdJump() { return bMoveBwdJump; }
SetMoveBwdJump(sal_Bool bNew)163cdf0e10cSrcweir static void SetMoveBwdJump( sal_Bool bNew ){ bMoveBwdJump = bNew; }
164cdf0e10cSrcweir
SetUndersized(const sal_Bool bNew)165cdf0e10cSrcweir inline void SetUndersized( const sal_Bool bNew ) { bUndersized = bNew; }
IsUndersized() const166cdf0e10cSrcweir inline sal_Bool IsUndersized() const { return bUndersized; }
167cdf0e10cSrcweir
168cdf0e10cSrcweir sal_Bool IsPrevObjMove() const;
169cdf0e10cSrcweir
170cdf0e10cSrcweir //Die Kette mit minimalen Operationen und Benachrichtigungen unter den
171cdf0e10cSrcweir //neuen Parent Moven.
172cdf0e10cSrcweir void MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling = 0 );
173cdf0e10cSrcweir
HasFollow() const174cdf0e10cSrcweir sal_Bool HasFollow() const { return pFollow ? sal_True : sal_False; }
IsFollow() const175cdf0e10cSrcweir sal_Bool IsFollow() const { return bIsFollow; }
_SetIsFollow(sal_Bool bSet)176cdf0e10cSrcweir inline void _SetIsFollow( sal_Bool bSet ) { bIsFollow = bSet; }
GetFollow() const177cdf0e10cSrcweir const SwFlowFrm *GetFollow() const { return pFollow; }
GetFollow()178cdf0e10cSrcweir SwFlowFrm *GetFollow() { return pFollow; }
179cdf0e10cSrcweir sal_Bool IsAnFollow( const SwFlowFrm *pFlow ) const;
SetFollow(SwFlowFrm * pNew)180cdf0e10cSrcweir inline void SetFollow( SwFlowFrm *pNew ) { pFollow = pNew; }
181cdf0e10cSrcweir
IsJoinLocked() const182cdf0e10cSrcweir sal_Bool IsJoinLocked() const { return bLockJoin; }
IsAnyJoinLocked() const183cdf0e10cSrcweir sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); }
IsFtnAtEnd() const184cdf0e10cSrcweir sal_Bool IsFtnAtEnd() const { return bFtnAtEnd; }
IsEndnAtEnd() const185cdf0e10cSrcweir sal_Bool IsEndnAtEnd() const { return bEndnAtEnd; }
IsAnyNoteAtEnd() const186cdf0e10cSrcweir sal_Bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
AreNotesAtEnd() const187cdf0e10cSrcweir sal_Bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
188cdf0e10cSrcweir
189cdf0e10cSrcweir sal_Bool IsPageBreak( sal_Bool bAct ) const;
190cdf0e10cSrcweir sal_Bool IsColBreak( sal_Bool bAct ) const;
191cdf0e10cSrcweir
192cdf0e10cSrcweir //Ist ein Keep zu beruecksichtigen (Breaks!)
193cdf0e10cSrcweir sal_Bool IsKeep( const SwAttrSet& rAttrs, bool bBreakCheck = false ) const;
194cdf0e10cSrcweir
195cdf0e10cSrcweir sal_Bool HasLockedFollow() const;
196cdf0e10cSrcweir
197cdf0e10cSrcweir sal_Bool HasParaSpaceAtPages( sal_Bool bSct ) const;
198cdf0e10cSrcweir
199cdf0e10cSrcweir /** method to determine the upper space hold by the frame
200cdf0e10cSrcweir
201cdf0e10cSrcweir OD 2004-03-12 #i11860# - add 3rd parameter <_bConsiderGrid> to get
202cdf0e10cSrcweir the upper space with and without considering the page grid
203cdf0e10cSrcweir (default value: <sal_True>)
204cdf0e10cSrcweir
205cdf0e10cSrcweir @author ?
206cdf0e10cSrcweir */
207cdf0e10cSrcweir SwTwips CalcUpperSpace( const SwBorderAttrs *pAttrs = NULL,
208cdf0e10cSrcweir const SwFrm* pPr = NULL,
209cdf0e10cSrcweir const bool _bConsiderGrid = true ) const;
210cdf0e10cSrcweir
211cdf0e10cSrcweir /** method to determine the upper space amount, which is considered for
212cdf0e10cSrcweir the previous frame and the page grid, if option 'Use former object
213cdf0e10cSrcweir positioning' is OFF
214cdf0e10cSrcweir
215cdf0e10cSrcweir OD 2004-03-18 #i11860#
216cdf0e10cSrcweir
217cdf0e10cSrcweir @author OD
218cdf0e10cSrcweir */
219cdf0e10cSrcweir SwTwips GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid() const;
220cdf0e10cSrcweir
221cdf0e10cSrcweir /** calculation of lower space
222cdf0e10cSrcweir
223cdf0e10cSrcweir OD 2004-03-02 #106629#
224cdf0e10cSrcweir
225cdf0e10cSrcweir @author OD
226cdf0e10cSrcweir */
227cdf0e10cSrcweir SwTwips CalcLowerSpace( const SwBorderAttrs* _pAttrs = 0L ) const;
228cdf0e10cSrcweir
229cdf0e10cSrcweir /** calculation of the additional space to be considered, if flow frame
230cdf0e10cSrcweir is the last inside a table cell
231cdf0e10cSrcweir
232cdf0e10cSrcweir OD 2004-07-16 #i26250
233cdf0e10cSrcweir
234cdf0e10cSrcweir @author OD
235cdf0e10cSrcweir
236cdf0e10cSrcweir @param _pAttrs
237cdf0e10cSrcweir optional input parameter - border attributes of the flow frame.
238cdf0e10cSrcweir Used for optimization, if caller has already determined the border
239cdf0e10cSrcweir attributes.
240cdf0e10cSrcweir
241cdf0e10cSrcweir @return SwTwips
242cdf0e10cSrcweir */
243cdf0e10cSrcweir SwTwips CalcAddLowerSpaceAsLastInTableCell(
244cdf0e10cSrcweir const SwBorderAttrs* _pAttrs = 0L ) const;
245cdf0e10cSrcweir
246cdf0e10cSrcweir void CheckKeep();
247cdf0e10cSrcweir
SetFtnLock(sal_Bool bNew)248cdf0e10cSrcweir void SetFtnLock( sal_Bool bNew ){ bFtnLock = bNew; }
IsFtnLock() const249cdf0e10cSrcweir sal_Bool IsFtnLock() const { return bFtnLock; }
SetFlyLock(sal_Bool bNew)250cdf0e10cSrcweir void SetFlyLock( sal_Bool bNew ){ bFlyLock = bNew; }
IsFlyLock() const251cdf0e10cSrcweir sal_Bool IsFlyLock() const { return bFlyLock; }
SetOwnFtnNum(sal_Bool bNew)252cdf0e10cSrcweir void SetOwnFtnNum( sal_Bool bNew ){ bOwnFtnNum = bNew; }
IsOwnFtnNum() const253cdf0e10cSrcweir sal_Bool IsOwnFtnNum() const { return bOwnFtnNum; }
SetCntntLock(sal_Bool bNew)254cdf0e10cSrcweir void SetCntntLock( sal_Bool bNew ){ bCntntLock = bNew; }
IsCntntLocked() const255cdf0e10cSrcweir sal_Bool IsCntntLocked() const { return bCntntLock; }
256cdf0e10cSrcweir
257cdf0e10cSrcweir //casten einen Frm auf einen FlowFrm - wenns denn einer ist, sonst 0
258cdf0e10cSrcweir //Diese Methoden muessen fuer neue Ableitungen geaendert werden!
259cdf0e10cSrcweir static SwFlowFrm *CastFlowFrm( SwFrm *pFrm );
260cdf0e10cSrcweir static const SwFlowFrm *CastFlowFrm( const SwFrm *pFrm );
261cdf0e10cSrcweir };
262cdf0e10cSrcweir
IsFwdMoveAllowed()263cdf0e10cSrcweir inline sal_Bool SwFlowFrm::IsFwdMoveAllowed()
264cdf0e10cSrcweir {
265cdf0e10cSrcweir return rThis.GetIndPrev() != 0;
266cdf0e10cSrcweir }
267cdf0e10cSrcweir
268cdf0e10cSrcweir
269cdf0e10cSrcweir #endif
270