xref: /aoo42x/main/sw/source/core/inc/frame.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 SW_FRAME_HXX
28 #define SW_FRAME_HXX
29 
30 #include <svl/svarray.hxx>
31 #include "swtypes.hxx"	// fuer SwTwips
32 #include "swrect.hxx"
33 #include "calbck.hxx"	// fuer SwClient
34 #include <svl/brdcst.hxx>
35 
36 class SwLayoutFrm;
37 class SwRootFrm;
38 class SwPageFrm;
39 class SwFlyFrm;
40 class SwSectionFrm;
41 class SdrObject;
42 class SwFtnFrm;
43 class SwFtnBossFrm;
44 class SwTabFrm;
45 class SwRowFrm;
46 class SwFlowFrm;
47 class SwCntntFrm;
48 class SfxPoolItem;
49 class SwAttrSet;
50 class ViewShell;
51 class Color;
52 class SwBorderAttrs;
53 class SwCache;
54 class SvxBrushItem;
55 class SwSelectionList;
56 struct SwPosition;
57 struct SwCrsrMoveState;
58 class SwFmt;
59 class SwPrintData;
60 class SwSortedObjs;
61 class SwAnchoredObject;
62 
63 //Jeder FrmTyp findet sich hier in einem Bit wieder.
64 //Die Bits muessen so gesetzt werden, dass mit einer Maskierung festgestellt
65 //werden kann was fuer ein FrmTyp eine Instanz ist _und_ von welchen Klassen
66 //sie abgeleitet ist.
67 //Der Frm hat in der Basisklasse einen Member der von den CToren der
68 //einzelnen Frms entsprechend gesetzt werden muss.
69 #define	FRM_ROOT		0x0001
70 #define	FRM_PAGE		0x0002
71 #define	FRM_COLUMN		0x0004
72 #define	FRM_HEADER		0x0008
73 #define FRM_FOOTER		0x0010
74 #define	FRM_FTNCONT		0x0020
75 #define	FRM_FTN			0x0040
76 #define	FRM_BODY		0x0080
77 #define	FRM_FLY     	0x0100
78 #define	FRM_SECTION  	0x0200
79 #define	FRM_UNUSED    	0x0400
80 #define	FRM_TAB			0x0800
81 #define	FRM_ROW			0x1000
82 #define	FRM_CELL		0x2000
83 #define	FRM_TXT			0x4000
84 #define	FRM_NOTXT		0x8000
85 
86 //Fuer den internen Gebrauch ein paar gebraeuchliche Verknuepfungen.
87 #define FRM_LAYOUT		0x3FFF
88 #define FRM_CNTNT		0xC000
89 #define FRM_FTNBOSS		0x0006
90 #define FRM_ACCESSIBLE (FRM_HEADER|FRM_FOOTER|FRM_FTN|FRM_TXT|FRM_ROOT|FRM_FLY|FRM_TAB|FRM_CELL|FRM_PAGE)
91 
92 		//Weils so schon ist das ganze als Bitfeld....
93 //0000 0000 0000 0001	ROOT
94 //0000 0000 0000 0010	PAGE
95 //0000 0000 0000 0100	COLUMN
96 //0000 0000 0000 1000	HEADER
97 //0000 0000 0001 0000	FOOTER
98 //0000 0000 0010 0000	FTNCONT
99 //0000 0000 0100 0000	FTN
100 //0000 0000 1000 0000	BODY
101 //0000 0001 0000 0000	FLY
102 //0000 0010 0000 0000	SECTION
103 //0000 0100 0000 0000	UNUSED
104 //0000 1000 0000 0000	TAB
105 //0001 0000 0000 0000	ROW
106 //0010 0000 0000 0000	CELL
107 //0100 0000 0000 0000	TXT
108 //1000 0000 0000 0000	NOTXT
109 
110 // The type of the frame is internal represented by the 4-bit value nType,
111 // which can expanded to the types above by shifting a bit (0x1 << nType)
112 // Here are the corresponding defines for the compressed representation:
113 
114 #define FRMC_ROOT        0
115 #define FRMC_PAGE        1
116 #define FRMC_COLUMN      2
117 #define FRMC_HEADER      3
118 #define FRMC_FOOTER      4
119 #define FRMC_FTNCONT     5
120 #define FRMC_FTN         6
121 #define FRMC_BODY        7
122 #define FRMC_FLY         8
123 #define FRMC_SECTION     9
124 #define FRMC_UNUSED      10
125 #define FRMC_TAB         11
126 #define FRMC_ROW         12
127 #define FRMC_CELL        13
128 #define FRMC_TXT         14
129 #define FRMC_NOTXT       15
130 
131 #define FRM_NEIGHBOUR   0x2004
132 #define FRM_NOTE_VERT   0x7a60
133 #define FRM_HEADFOOT    0x0018
134 #define FRM_BODYFTNC    0x00a0
135 
136 class SwFrm;
137 typedef long (SwFrm:: *SwFrmGet)() const;
138 typedef sal_Bool (SwFrm:: *SwFrmMax)( long );
139 typedef void (SwFrm:: *SwFrmMakePos)( const SwFrm*, const SwFrm*, sal_Bool );
140 typedef long (*SwOperator)( long, long );
141 typedef void (SwFrm:: *SwFrmSet)( long, long );
142 
143 struct SwRectFnCollection
144 {
145     SwRectGet     fnGetTop;
146     SwRectGet     fnGetBottom;
147     SwRectGet     fnGetLeft;
148     SwRectGet     fnGetRight;
149     SwRectGet     fnGetWidth;
150     SwRectGet     fnGetHeight;
151     SwRectPoint   fnGetPos;
152     SwRectSize    fnGetSize;
153 
154     SwRectSet     fnSetTop;
155     SwRectSet     fnSetBottom;
156     SwRectSet     fnSetLeft;
157     SwRectSet     fnSetRight;
158     SwRectSet     fnSetWidth;
159     SwRectSet     fnSetHeight;
160 
161     SwRectSet     fnSubTop;
162     SwRectSet     fnAddBottom;
163     SwRectSet     fnSubLeft;
164     SwRectSet     fnAddRight;
165     SwRectSet     fnAddWidth;
166     SwRectSet     fnAddHeight;
167 
168     SwRectSet     fnSetPosX;
169     SwRectSet     fnSetPosY;
170 
171     SwFrmGet      fnGetTopMargin;
172     SwFrmGet      fnGetBottomMargin;
173     SwFrmGet      fnGetLeftMargin;
174     SwFrmGet      fnGetRightMargin;
175     SwFrmSet      fnSetXMargins;
176     SwFrmSet      fnSetYMargins;
177     SwFrmGet      fnGetPrtTop;
178     SwFrmGet      fnGetPrtBottom;
179     SwFrmGet      fnGetPrtLeft;
180     SwFrmGet      fnGetPrtRight;
181     SwRectDist    fnTopDist;
182     SwRectDist    fnBottomDist;
183     SwRectDist    fnLeftDist;
184     SwRectDist    fnRightDist;
185     SwFrmMax      fnSetLimit;
186     SwRectMax     fnOverStep;
187 
188     SwRectSetPos  fnSetPos;
189     SwFrmMakePos  fnMakePos;
190     SwOperator    fnXDiff;
191     SwOperator    fnYDiff;
192     SwOperator    fnXInc;
193     SwOperator    fnYInc;
194 
195     SwRectSetTwice fnSetLeftAndWidth;
196     SwRectSetTwice fnSetTopAndHeight;
197 };
198 
199 typedef SwRectFnCollection* SwRectFn;
200 /*
201 extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R;
202 #define SWRECTFN( pFrm )    sal_Bool bVert = pFrm->IsVertical(); \
203                             sal_Bool bRev = pFrm->IsReverse(); \
204                             SwRectFn fnRect = bVert ? \
205                                 ( bRev ? fnRectVL2R : fnRectVert ): \
206                                 ( bRev ? fnRectB2T : fnRectHori );
207 #define SWRECTFNX( pFrm )   sal_Bool bVertX = pFrm->IsVertical(); \
208                             sal_Bool bRevX = pFrm->IsReverse(); \
209                             SwRectFn fnRectX = bVertX ? \
210                                 ( bRevX ? fnRectVL2R : fnRectVert ): \
211                                 ( bRevX ? fnRectB2T : fnRectHori );
212 #define SWREFRESHFN( pFrm ) { if( bVert != pFrm->IsVertical() || \
213                                   bRev  != pFrm->IsReverse() ) \
214                                 bVert = pFrm->IsVertical(); \
215                                 bRev = pFrm->IsReverse(); \
216                                 fnRect = bVert ? \
217                                     ( bRev ? fnRectVL2R : fnRectVert ): \
218                                     ( bRev ? fnRectB2T : fnRectHori ); }
219 #define SWRECTFN2( pFrm )   sal_Bool bVert = pFrm->IsVertical(); \
220                             sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \
221                             SwRectFn fnRect = bVert == bNeighb ? \
222                                 fnRectHori : fnRectVert;
223 */
224 
225 //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
226 extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R, fnRectVertL2R;
227 #define SWRECTFN( pFrm )    sal_Bool bVert = pFrm->IsVertical(); \
228                             sal_Bool bRev = pFrm->IsReverse(); \
229                             sal_Bool bVertL2R = pFrm->IsVertLR(); \
230                             SwRectFn fnRect = bVert ? \
231                                 ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \
232                                 ( bRev ? fnRectB2T : fnRectHori );
233 #define SWRECTFNX( pFrm )   sal_Bool bVertX = pFrm->IsVertical(); \
234                             sal_Bool bRevX = pFrm->IsReverse(); \
235                             sal_Bool bVertL2RX = pFrm->IsVertLR(); \
236                             SwRectFn fnRectX = bVertX ? \
237                                 ( bRevX ? fnRectVL2R : ( bVertL2RX ? fnRectVertL2R : fnRectVert ) ): \
238                                 ( bRevX ? fnRectB2T : fnRectHori );
239 #define SWREFRESHFN( pFrm ) { if( bVert != pFrm->IsVertical() || \
240                                   bRev  != pFrm->IsReverse() ) \
241                                 bVert = pFrm->IsVertical(); \
242                                 bRev = pFrm->IsReverse(); \
243                                 bVertL2R = pFrm->IsVertLR(); \
244                                 fnRect = bVert ? \
245                                     ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \
246                                     ( bRev ? fnRectB2T : fnRectHori ); }
247 #define SWRECTFN2( pFrm )   sal_Bool bVert = pFrm->IsVertical(); \
248 			    sal_Bool bVertL2R = pFrm->IsVertLR(); \
249                             sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \
250                             SwRectFn fnRect = bVert == bNeighb ? \
251                                 fnRectHori : ( bVertL2R ? fnRectVertL2R : fnRectVert );
252 //End of SCMS
253 #define POS_DIFF( aFrm1, aFrm2 ) \
254             ( (aFrm1.*fnRect->fnGetTop)() != (aFrm2.*fnRect->fnGetTop)() || \
255             (aFrm1.*fnRect->fnGetLeft)() != (aFrm2.*fnRect->fnGetLeft)() )
256 
257 
258 //Fuer GetNextLeaf/GetPrevLeaf.
259 enum MakePageType
260 {
261 	MAKEPAGE_NONE,		//Keine Seite bzw. Fussnote anlegen
262 	MAKEPAGE_APPEND,	//Nur ggf. Seite anhaengen
263 	MAKEPAGE_INSERT,	//Seite ggf. anhaengen oder einfuegen.
264 	MAKEPAGE_FTN,		//Fussnote ggf. einfuegen.
265 	MAKEPAGE_NOSECTION	// Don't create section frames
266 };
267 
268 // OD 2004-05-06 #i28701# - replaced by new class <SwSortedObjs>
269 //typedef SdrObject* SdrObjectPtr;
270 //SV_DECL_PTRARR(SwDrawObjs,SdrObjectPtr,1,1);
271 
272 class SwFrm: public SwClient, public SfxBroadcaster
273 {
274 	//Der verkappte Frm
275 	friend class SwFlowFrm;
276 	friend class SwLayoutFrm;		// Sw3FrameIo: fuer pNext, pPrev
277 	friend class SwLooping;         // LoopControlling  (layouter.cxx)
278 
279     //Hebt die Lower waehrend eines Spaltenumbaus auf.
280 	friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL );
281     friend void   RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
282 
283 #if OSL_DEBUG_LEVEL > 1
284 	//entfernt leere SwSectionFrms aus einer Kette
285 	friend SwFrm* SwClearDummies( SwFrm* pFrm );
286 #endif
287 
288 		//Zum validieren eines unsinnig invalidierten in SwCntntFrm::MakeAll
289 	friend void ValidateSz( SwFrm *pFrm );
290 		// Implementiert in text/txtftn.cxx, verhindert Ftn-Oszillation
291 	friend void ValidateTxt( SwFrm *pFrm );
292 
293 //	friend void CalcAnchorAndKeep( SwFlyFrm * );
294 
295 	friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt );
296 
297 	//Cache fuer (Umrandungs-)Attribute.
298 	static SwCache *pCache;
299 
300     // --> OD 2006-05-10 #i65250#
301     // frame ID is now in general available - used for layout loop control
302     static sal_uInt32 mnLastFrmId;
303     const  sal_uInt32 mnFrmId;
304     // <--
305 
306     SwRootFrm   *mpRoot;
307 	SwLayoutFrm *pUpper;
308     SwFrm       *pNext;
309     SwFrm       *pPrev;
310 
311     SwFrm *_FindNext();
312 	SwFrm *_FindPrev();
313 
314     /** method to determine next content frame in the same environment
315         for a flow frame (content frame, table frame, section frame)
316 
317         OD 2005-11-30 #i27138# - adding documentation:
318         Travelling downwards through the layout to determine the next content
319         frame in the same environment. There are several environments in a
320         document, which form a closed context regarding this function. These
321         environments are:
322         - Each page header
323         - Each page footer
324         - Each unlinked fly frame
325         - Each group of linked fly frames
326         - All footnotes
327         - All document body frames
328         OD 2005-11-30 #i27138# - adding parameter <_bInSameFtn>
329         Its default value is <false>. If its value is <true>, the environment
330         'All footnotes' is no longer treated. Instead each footnote is treated
331         as an own environment.
332 
333         @author OD
334 
335         @param _bInSameFtn
336         input parameter - boolean indicating, that the found next content
337         frame has to be in the same footnote frame. This parameter is only
338         relevant for flow frames in footnotes.
339 
340         @return SwCntntFrm*
341         pointer to the found next content frame. It's NULL, if none exists.
342     */
343     SwCntntFrm* _FindNextCnt( const bool _bInSameFtn = false );
344 
345     /** method to determine previous content frame in the same environment
346         for a flow frame (content frame, table frame, section frame)
347 
348         OD 2005-11-30 #i27138#
349         Travelling upwards through the layout to determine the previous content
350         frame in the same environment. There are several environments in a
351         document, which form a closed context regarding this function. These
352         environments are:
353         - Each page header
354         - Each page footer
355         - Each unlinked fly frame
356         - Each group of linked fly frames
357         - All footnotes
358         - All document body frames
359         OD 2005-11-30 #i27138# - adding parameter <_bInSameFtn>
360         Its default value is <false>. If its value is <true>, the environment
361         'All footnotes' is no longer treated. Instead each footnote is treated
362         as an own environment.
363 
364         @author OD
365 
366         @param _bInSameFtn
367         input parameter - boolean indicating, that the found previous content
368         frame has to be in the same footnote frame. This parameter is only
369         relevant for flow frames in footnotes.
370 
371         @return SwCntntFrm*
372         pointer to the found previous content frame. It's NULL, if none exists.
373     */
374     SwCntntFrm* _FindPrevCnt( const bool _bInSameFtn = false );
375 
376 
377 	void _UpdateAttrFrm( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 & );
378 	SwFrm* _GetIndNext();
379     void SetDirFlags( sal_Bool bVert );
380 
381 	SwFrm( SwFrm & );		//Kopieren ist nicht erlaubt.
382 
383     const SwLayoutFrm* ImplGetNextLayoutLeaf( bool bFwd ) const;
384 
385 protected:
386     SwSortedObjs* pDrawObjs;    //Hier haengen die DrawObjs, kann 0 sein
387 
388 	SwRect	aFrm;	//Absolute Dokumentposition und groesse des Frm
389 	SwRect	aPrt;	//Position der PrtArea rel zum Frm und groesse der PrtArea
390 
391     sal_uInt16 bFlag01:         1;
392     sal_uInt16 bFlag02:         1;
393     sal_uInt16 bFlag03:         1;
394     sal_uInt16 bFlag04:         1;
395     sal_uInt16 bFlag05:         1;
396     sal_uInt16 bReverse:        1; // Next line above/at the right side instead
397                                // under/at the left side of the previous line.
398     sal_uInt16 bInvalidR2L:     1;
399     sal_uInt16 bDerivedR2L:     1;
400     sal_uInt16 bRightToLeft:    1;
401     sal_uInt16 bInvalidVert:    1;
402     sal_uInt16 bDerivedVert:    1;
403     sal_uInt16 bVertical:       1;
404     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
405     sal_uInt16 bVertLR:         1;
406     //End of SCMS
407     sal_uInt16 nType:         4;  //Who am I?
408 
409 	sal_Bool bValidPos:			1;
410 	sal_Bool bValidPrtArea:		1;
411 	sal_Bool bValidSize:		1;
412 	sal_Bool bValidLineNum:		1;
413     sal_Bool bFixSize:          1;
414     sal_Bool bUnUsed1:          1;
415 	sal_Bool bCompletePaint:	1;	//Frame wird ganz gepaintet wenn sal_True, auch
416 								//wenn der Inhalt nur teilw. veraendert ist;
417 								//Bei CntntFrms wird ausschliesslich wenn sal_True
418 								//der Border (von Action) gemalt.
419 	sal_Bool bRetouche:			1;	//Der Frame ist fuer Retusche verantwortlich
420 								//wenn sal_True.
421 public:
422     sal_Bool bUnUsed2:          1;
423 protected:
424 	sal_Bool bInfInvalid:		1;	//InfoFlags sind Invalid.
425 	sal_Bool bInfBody:			1;	//Frm steht im DokumentBody.
426 	sal_Bool bInfTab:			1;	//Frm steht in einer Tabelle.
427 	sal_Bool bInfFly:			1;	//Frm steht in einem Fly.
428 	sal_Bool bInfFtn:			1;	//Frm steht in einer Fussnote.
429 	sal_Bool bInfSct:			1;  //Frm steht in einem Bereich.
430 	sal_Bool bColLocked:		1;  //Grow/Shrink sperren bei spaltigen Section-
431 								//oder Fly-Frames, wird im Format gesetzt
432 
433 	void ColLock()		{ bColLocked = sal_True; }
434 	void ColUnlock()   	{ bColLocked = sal_False; }
435 
436     // Only used by SwRootFrm Ctor to get 'this' into mpRoot...
437 	void setRootFrm( SwRootFrm* pRoot )	{ mpRoot = pRoot; }
438 
439 	SwPageFrm *InsertPage( SwPageFrm *pSibling, sal_Bool bFtn );
440 	void PrepareMake();
441 	void OptPrepareMake();
442 	void MakePos();
443     // --> OD 2005-09-28 #b6329202#
444     // method formats next frame of table frame to assure keep attribute.
445     // in case of nested tables method <SwFrm::MakeAll()> is called to
446     // avoid format of superior table frame.
447     friend SwFrm* lcl_FormatNextCntntForKeep( SwTabFrm* pTabFrm );
448     // <--
449     virtual void MakeAll() = 0;
450 		//Adjustierung der Frames einer Seite
451 	SwTwips AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst = sal_False );
452 
453 
454 		//Aendern nur die Framesize, nicht die PrtArea-SSize
455     virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) = 0;
456     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) = 0;
457 
458 	SwModify	  	*GetDep()		{ return GetRegisteredInNonConst(); }
459 	const SwModify	*GetDep() const { return GetRegisteredIn(); }
460 
461 	SwFrm( SwModify*, SwFrm* );
462 
463     void CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse );
464 
465     /** enumeration for the different invalidations
466 
467         OD 2004-05-19 #i28701#
468 
469         @author OD
470     */
471     enum InvalidationType
472     {
473         INVALID_SIZE, INVALID_PRTAREA, INVALID_POS, INVALID_LINENUM, INVALID_ALL
474     };
475 
476     /** method to determine, if an invalidation is allowed.
477 
478         OD 2004-05-19 #i28701
479 
480         @author OD
481     */
482     virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const;
483 
484     /** method to perform additional actions on an invalidation
485 
486         OD 2004-05-19 #i28701#
487         Method has *only* to contain actions, which has to be performed on
488         *every* assignment of the corresponding flag to <sal_False>.
489 
490         @author OD
491     */
492     virtual void _ActionOnInvalidation( const InvalidationType _nInvalid );
493 
494         //Schatten und Umrandung painten
495     void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const;
496 	virtual	void  Modify( const SfxPoolItem*, const SfxPoolItem* );
497 
498 public:
499 	TYPEINFO();	//Bereits in Basisklasse Client drin.
500 
501     sal_uInt16 GetType() const { return 0x1 << nType; }
502 
503 	static SwCache &GetCache() 				  { return *pCache; }
504 	static SwCache *GetCachePtr()			  { return pCache;	}
505 	static void		SetCache( SwCache *pNew ) { pCache = pNew;	}
506 
507 		//Aendern die PrtArea-SSize und die FrmSize.
508     SwTwips Shrink( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
509     SwTwips Grow  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
510 
511 	//Wir brauchen unterschiedliche Methoden (wg. Performance) fuer das
512 	//Einfuegenin den Layout Baum:
513 
514 	//Einfuegen vor pBehind  oder am Ende der Kette unter pUpper
515 	void InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind );
516 	//Einfuegen hinter pBefore oder am Anfang der Kette unter pUpper
517 	void InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore );
518 	//Einfuegen vor pBehind oder am Ende der Kette, unter Beruecksichtigung
519 	//der Geschwister von pSct
520 	void InsertGroupBefore( SwFrm* pParent, SwFrm* pWhere, SwFrm* pSct );
521 	void Remove();
522 
523 	//For internal use only; wer es anders macht wird
524 	//in einen Sack gesteckt und muss zwei Tage drin hocken bleiben.
525 	//Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch (Tabellen).
526 	SwLayoutFrm *GetLeaf( MakePageType eMakePage, sal_Bool bFwd );
527 	SwLayoutFrm *GetNextLeaf   ( MakePageType eMakePage );
528 	SwLayoutFrm *GetNextFtnLeaf( MakePageType eMakePage );
529 	SwLayoutFrm *GetNextSctLeaf( MakePageType eMakePage );
530     SwLayoutFrm *GetNextCellLeaf( MakePageType eMakePage );
531     SwLayoutFrm *GetPrevLeaf   ( MakePageType eMakeFtn = MAKEPAGE_FTN );
532 	SwLayoutFrm *GetPrevFtnLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
533 	SwLayoutFrm *GetPrevSctLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
534     SwLayoutFrm *GetPrevCellLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
535     const SwLayoutFrm *GetLeaf ( MakePageType eMakePage, sal_Bool bFwd,
536 								 const SwFrm *pAnch ) const;
537 
538     sal_Bool WrongPageDesc( SwPageFrm* pNew );
539 
540     // --> OD 2004-07-02 #i28701# - new methods to append/remove drawing objects
541     void AppendDrawObj( SwAnchoredObject& _rNewObj );
542     void RemoveDrawObj( SwAnchoredObject& _rToRemoveObj );
543     // <--
544 
545 	//Arbeiten mit der Kette der FlyFrms
546 	void  AppendFly( SwFlyFrm *pNew );
547 	void  RemoveFly( SwFlyFrm *pToRemove );
548     const SwSortedObjs *GetDrawObjs() const { return pDrawObjs; }
549           SwSortedObjs *GetDrawObjs()         { return pDrawObjs; }
550     // --> OD 2004-07-01 #i28701# - change purpose of method and adjust its name
551     void InvalidateObjs( const bool _bInvaPosOnly,
552                          const bool _bNoInvaOfAsCharAnchoredObjs = true );
553 
554 	virtual	void PaintBorder( const SwRect&, const SwPageFrm *pPage,
555 							  const SwBorderAttrs & ) const;
556 	void PaintBaBo( const SwRect&, const SwPageFrm *pPage = 0,
557 					const sal_Bool bLowerBorder = sal_False ) const;
558 	void PaintBackground( const SwRect&, const SwPageFrm *pPage,
559 						  const SwBorderAttrs &,
560 						  const sal_Bool bLowerMode = sal_False,
561 						  const sal_Bool bLowerBorder = sal_False ) const;
562 	void PaintBorderLine( const SwRect&, const SwRect&, const SwPageFrm*,
563 						  const Color *pColor ) const;
564 
565 	//Retouche, nicht im Bereich des uebergebenen Rect!
566 	void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const;
567 
568 	sal_Bool GetBackgroundBrush( const SvxBrushItem*& rpBrush,
569 							 const Color*& rpColor,
570 							 SwRect &rOrigRect,
571 							 sal_Bool bLowerMode ) const;
572 
573 	inline void SetCompletePaint() const;
574 	inline void ResetCompletePaint() const;
575 	inline sal_Bool IsCompletePaint() const { return bCompletePaint; }
576 
577 	inline void SetRetouche() const;
578 	inline void ResetRetouche() const;
579 	inline sal_Bool IsRetouche() const { return bRetouche; }
580 
581 	void SetInfFlags();					//Setzen der InfoFlags
582 	inline void InvalidateInfFlags() { bInfInvalid = sal_True; }
583 	inline sal_Bool	IsInDocBody() const;	//Benutzen die InfoFlags.
584 	inline sal_Bool	IsInFtn() const;		//ggf. werden die Flags ermittelt.
585 	inline sal_Bool IsInTab() const;
586 	inline sal_Bool IsInFly() const;
587 	inline sal_Bool IsInSct() const;
588 
589     // If frame is inside a split table row, this function returns
590     // the corresponding row frame in the follow table.
591     const SwRowFrm* IsInSplitTableRow() const;
592 
593     // If frame is inside a follow flow row, this function returns
594     // the corresponding row frame master table
595     const SwRowFrm* IsInFollowFlowRow() const;
596 
597     bool IsInBalancedSection() const;
598 
599     inline sal_Bool IsReverse() const { return bReverse; }
600     inline void SetReverse( sal_Bool bNew ){ bReverse = bNew ? 1 : 0; }
601     inline sal_Bool IsVertical() const;
602     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
603     inline sal_Bool IsVertLR() const;
604     //End of SCMS
605     inline sal_Bool GetVerticalFlag() const;
606     inline void SetVertical( sal_Bool bNew ){ bVertical = bNew ? 1 : 0; }
607     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
608     inline void SetbVertLR( sal_Bool bNew ) { bVertLR = bNew ? 1 : 0; }
609     //End of SCMS
610     inline void SetDerivedVert( sal_Bool bNew ){ bDerivedVert = bNew ? 1 : 0; }
611     inline void SetInvalidVert( sal_Bool bNew) { bInvalidVert = bNew ? 1 : 0; }
612     inline sal_Bool IsRightToLeft() const;
613     inline sal_Bool GetRightToLeftFlag() const;
614     inline void SetRightToLeft( sal_Bool bNew ){ bRightToLeft = bNew ? 1 : 0; }
615     inline void SetDerivedR2L( sal_Bool bNew ) { bDerivedR2L  = bNew ? 1 : 0; }
616     inline void SetInvalidR2L( sal_Bool bNew ) { bInvalidR2L  = bNew ? 1 : 0; }
617 
618     void CheckDirChange();
619     // returns upper left frame position for LTR and
620     // upper right frame position for Asian / RTL frames
621     Point   GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const;
622 
623     /** determine, if frame is moveable in given environment
624 
625         OD 08.08.2003 #110978#
626         method replaced 'old' method <sal_Bool IsMoveable() const>.
627         Determines, if frame is moveable in given environment. if no environment
628         is given (parameter _pLayoutFrm == 0L), the movability in the actual
629         environment (<this->GetUpper()) is checked.
630 
631         @author OD
632 
633         @param _pLayoutFrm
634         input parameter - given environment (layout frame), in which the movability
635         will be checked. If not set ( == 0L ), actual environment is taken.
636 
637         @return boolean, indicating, if frame is moveable in given environment
638     */
639 //    sal_Bool IsMoveable() const;
640     bool IsMoveable( const SwLayoutFrm* _pLayoutFrm = 0L ) const;
641 
642 	//Ist es fuer den (Txt)Frm in der aktuellen Umgebung erlaubt eine
643 	//Fussnote einzufuegen (nicht z.B. in wiederholten TabellenHeadlines).
644 	sal_Bool IsFtnAllowed() const;
645 
646 	virtual void  Format( const SwBorderAttrs *pAttrs = 0 );
647 
648     virtual void  CheckDirection( sal_Bool bVert );
649 
650 	void ReinitializeFrmSizeAttrFlags();
651 
652 	const SwAttrSet	*GetAttrSet() const;
653 
654     inline sal_Bool HasFixSize() const { return bFixSize; }
655     inline void SetFixSize( sal_Bool bNew ) { bFixSize = bNew; }
656 
657 	//Prueft alle Seiten ab der Uebergebenen und korrigiert ggf.
658 	static void CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields = sal_True );
659 
660 		//Koennen 0 liefern, einmal const einmal nicht
661 	SwFrm				*GetNext()	{ return pNext; }
662 	SwFrm				*GetPrev()	{ return pPrev; }
663 	SwLayoutFrm			*GetUpper()	{ return pUpper; }
664 	SwRootFrm			*getRootFrm(){ return mpRoot; }
665 	SwPageFrm	   		*FindPageFrm();
666 	SwFrm				*FindColFrm();
667 	SwFtnBossFrm		*FindFtnBossFrm( sal_Bool bFootnotes = sal_False );
668 	SwTabFrm			*ImplFindTabFrm();
669 	SwFtnFrm			*ImplFindFtnFrm();
670 	SwFlyFrm 			*ImplFindFlyFrm();
671 	SwSectionFrm		*ImplFindSctFrm();
672 	SwFrm				*FindFooterOrHeader();
673 	SwFrm				*GetLower();
674 	const SwFrm			*GetNext()	const { return pNext; }
675 	const SwFrm			*GetPrev()	const { return pPrev; }
676 	const SwLayoutFrm	*GetUpper()	const { return pUpper; }
677 	const SwRootFrm     *getRootFrm()	const { return mpRoot; }
678 	inline SwTabFrm		*FindTabFrm();
679 	inline SwFtnFrm		*FindFtnFrm();
680 	inline SwFlyFrm 	*FindFlyFrm();
681 	inline SwSectionFrm	*FindSctFrm();
682 	inline SwFrm		*FindNext();
683     // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
684     inline SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false );
685     // <--
686 	inline SwFrm		*FindPrev();
687 	inline const SwPageFrm *FindPageFrm() const;
688 	inline const SwFtnBossFrm *FindFtnBossFrm( sal_Bool bFtn = sal_False ) const;
689 	inline const SwFrm     *FindColFrm() const;
690 	inline const SwFrm     *FindFooterOrHeader() const;
691 	inline const SwTabFrm  *FindTabFrm() const;
692 	inline const SwFtnFrm  *FindFtnFrm() const;
693 	inline const SwFlyFrm  *FindFlyFrm() const;
694 	inline const SwSectionFrm *FindSctFrm() const;
695 	inline const SwFrm	   *FindNext() const;
696     // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
697     inline const SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false ) const;
698     // <--
699 	inline const SwFrm	   *FindPrev() const;
700 		   const SwFrm	   *GetLower()	const;
701 
702     /** inline wrapper method for <_FindPrevCnt(..)>
703 
704         OD 2005-11-30 #i27138#
705 
706         @author OD
707     */
708     inline SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false )
709     {
710         if ( GetPrev() && GetPrev()->IsCntntFrm() )
711             return (SwCntntFrm*)(GetPrev());
712         else
713             return _FindPrevCnt( _bInSameFtn );
714     }
715 
716     /** inline const wrapper method for <_FindPrevCnt(..)>
717 
718         OD 2005-11-30 #i27138#
719 
720         @author OD
721     */
722     inline const SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false ) const
723     {
724         if ( GetPrev() && GetPrev()->IsCntntFrm() )
725             return (const SwCntntFrm*)(GetPrev());
726         else
727             return const_cast<SwFrm*>(this)->_FindPrevCnt( _bInSameFtn );
728     }
729 
730     // --> OD 2007-09-04 #i79774#, #b6596954#
731     SwFrm* _GetIndPrev() const;
732     SwFrm* GetIndPrev() const
733 		{ return ( pPrev || !IsInSct() ) ? pPrev : _GetIndPrev(); }
734 //    const SwFrm* GetIndPrev() const { return ((SwFrm*)this)->GetIndPrev(); }
735     // <--
736 	SwFrm* GetIndNext()
737 		{ return ( pNext || !IsInSct() ) ? pNext : _GetIndNext(); }
738 	const SwFrm* GetIndNext() const { return ((SwFrm*)this)->GetIndNext(); }
739 
740 	sal_uInt16 GetPhyPageNum() const;	//Seitennummer ohne Offset
741 	sal_uInt16 GetVirtPageNum() const;	//Seitenummer mit Offset
742 	sal_Bool OnRightPage() const { return 0 != GetPhyPageNum() % 2; };
743 	sal_Bool WannaRightPage() const;
744 
745 
746     inline const  SwLayoutFrm *GetPrevLayoutLeaf() const;
747     inline const  SwLayoutFrm *GetNextLayoutLeaf() const;
748     inline SwLayoutFrm *GetPrevLayoutLeaf();
749 	inline SwLayoutFrm *GetNextLayoutLeaf();
750 
751     inline void Calc() const;       //Hier wird ggf. 'Formatiert'
752 	inline void OptCalc() const;    //Hier wird zur Optimierung davon ausgegangen,
753 									//das die Vorgaenger bereits formatiert sind.
754 
755 	inline Point   GetRelPos() const;
756 	const  SwRect &Frm() const { return aFrm; }
757 	const  SwRect &Prt() const { return aPrt; }
758 
759 	// The PaintArea is the area, where content may be displayed.
760 	// The margin of the page or the space between columns belongs to her.
761 	const SwRect PaintArea() const;
762 	// The UnionFrm is the union of frm- and prt-area, normally identical
763 	// to the frm-area except the case of negative prt-margins.
764 	const SwRect UnionFrm( sal_Bool bBorder = sal_False ) const;
765 
766 	//Der Zugriff auf die Member wird hier ausnahmsweiste gestattet,
767 	//dies soll aber nicht dazu dienen die Werte wahllos zu veraendern;
768 	//es ist nur die einzige Moeglichkeit die Compilerprobleme zu umgehen
769 	//(gleiche Methode mal public mal protected).
770 	SwRect &Frm() { return aFrm; }
771 	SwRect &Prt() { return aPrt; }
772 
773 	virtual Size ChgSize( const Size& aNewSize );
774 
775 	virtual void Cut() = 0;
776 	virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) = 0;
777 
778 	void ValidateLineNum() { bValidLineNum = sal_True; }
779 
780 	sal_Bool GetValidPosFlag()	  const { return bValidPos; }
781 	sal_Bool GetValidPrtAreaFlag()const { return bValidPrtArea; }
782 	sal_Bool GetValidSizeFlag()	  const { return bValidSize; }
783 	sal_Bool GetValidLineNumFlag()const { return bValidLineNum; }
784 	sal_Bool IsValid() const { return bValidPos && bValidSize && bValidPrtArea; }
785 
786     //Invalideren nur den Frm
787     // OD 2004-05-19 #i28701# - add call to method <_ActionOnInvalidation(..)>
788     // for all invalidation methods.
789     // OD 2004-05-19 #i28701# - use method <_InvalidationAllowed(..)> to
790     // decide, if invalidation will to be performed or not.
791     // --> OD 2004-10-08 #i26945# - no additional invalidation, if it's already
792     // invalidate.
793     void _InvalidateSize()
794     {
795         if ( bValidSize && _InvalidationAllowed( INVALID_SIZE ) )
796         {
797             bValidSize = sal_False;
798             _ActionOnInvalidation( INVALID_SIZE );
799         }
800     }
801     void _InvalidatePrt()
802     {
803         if ( bValidPrtArea && _InvalidationAllowed( INVALID_PRTAREA ) )
804         {
805             bValidPrtArea = sal_False;
806             _ActionOnInvalidation( INVALID_PRTAREA );
807         }
808     }
809     void _InvalidatePos()
810     {
811         if ( bValidPos && _InvalidationAllowed( INVALID_POS ) )
812         {
813             bValidPos = sal_False;
814             _ActionOnInvalidation( INVALID_POS );
815         }
816     }
817     void _InvalidateLineNum()
818     {
819         if ( bValidLineNum && _InvalidationAllowed( INVALID_LINENUM ) )
820         {
821             bValidLineNum = sal_False;
822             _ActionOnInvalidation( INVALID_LINENUM );
823         }
824     }
825     void _InvalidateAll()
826     {
827         if ( ( bValidSize || bValidPrtArea || bValidPos ) &&
828              _InvalidationAllowed( INVALID_ALL ) )
829         {
830             bValidSize = bValidPrtArea = bValidPos = sal_False;
831             _ActionOnInvalidation( INVALID_ALL );
832         }
833     }
834     // <--
835 	//Benachrichtigen gleich die Seite mit.
836 	inline void InvalidateSize();
837 	inline void InvalidatePrt();
838 	inline void InvalidatePos();
839 	inline void InvalidateLineNum();
840 	inline void InvalidateAll();
841 	void ImplInvalidateSize();
842 	void ImplInvalidatePrt();
843 	void ImplInvalidatePos();
844 	void ImplInvalidateLineNum();
845 
846 	inline void InvalidateNextPos( sal_Bool bNoFtn = sal_False );
847 	void ImplInvalidateNextPos( sal_Bool bNoFtn = sal_False );
848 
849     /** method to invalidate printing area of next frame
850 
851         OD 09.01.2004 #i11859#
852 
853         @author OD
854     */
855     void InvalidateNextPrtArea();
856 
857 	void InvalidatePage( const SwPageFrm *pPage = 0 ) const;
858 
859 	virtual bool    FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
860 
861 	virtual sal_Bool	GetCrsrOfst( SwPosition *, Point&,
862 								 SwCrsrMoveState* = 0 ) const;
863 	virtual sal_Bool	GetCharRect( SwRect &, const SwPosition&,
864 								 SwCrsrMoveState* = 0 ) const;
865     virtual void Paint( SwRect const&,
866                         SwPrintData const*const pPrintData = NULL ) const;
867 
868 	// der "kurze Dienstweg" zwischen den Frames und der Formatierung.
869 	// Wer den void* falsch Casted ist selbst schuld!
870 	// Auf jedenfall muss der void* auf 0 geprueft werden.
871 	virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
872 						  const void *pVoid = 0, sal_Bool bNotify = sal_True );
873 
874 	//sal_True wenn's die richtige Klasse ist, sal_False sonst
875 	inline sal_Bool IsLayoutFrm() const;
876 	inline sal_Bool IsRootFrm() const;
877 	inline sal_Bool IsPageFrm() const;
878 	inline sal_Bool IsColumnFrm() const;
879 	inline sal_Bool IsFtnBossFrm() const; // Fussnotenbosse sind PageFrms und ColumnFrms
880 	inline sal_Bool IsHeaderFrm() const;
881 	inline sal_Bool IsFooterFrm() const;
882 	inline sal_Bool IsFtnContFrm() const;
883 	inline sal_Bool IsFtnFrm() const;
884 	inline sal_Bool IsBodyFrm() const;
885 	inline sal_Bool IsColBodyFrm() const;	// in layfrm.hxx implementiert, BodyFrm unterhalb ColumnFrm
886 	inline sal_Bool IsPageBodyFrm() const;  // in layfrm.hxx implementiert, BodyFrm unterhalb PageFrm
887 	inline sal_Bool IsFlyFrm() const;
888 	inline sal_Bool IsSctFrm() const;
889 	inline sal_Bool IsTabFrm() const;
890 	inline sal_Bool IsRowFrm() const;
891 	inline sal_Bool IsCellFrm() const;
892 	inline sal_Bool IsCntntFrm() const;
893 	inline sal_Bool IsTxtFrm() const;
894 	inline sal_Bool IsNoTxtFrm() const;
895 	inline sal_Bool IsFlowFrm() const;		//Frms deren PrtArea von den Nachbarn
896 										//abhaengen und die halt im Inhaltsfluss
897 										//stehen.
898 	inline sal_Bool IsRetoucheFrm() const;	//Frms die Retouchefaehig sind bzw. die
899 										//u.U. hinter sich Retouchieren muessen.
900 	inline sal_Bool IsAccessibleFrm() const;
901 
902 	void PrepareCrsr();					//Die CrsrShell darf.
903 
904 	//Ist der Frm (bzw. die Section in der er steht) geschuetzt?
905 	//Auch Fly in Fly in ... und Fussnoten
906 	sal_Bool IsProtected() const;
907 
908 	sal_Bool IsColLocked()	const { return bColLocked; }
909 
910 	virtual ~SwFrm();
911 
912     // No inline cause we need the function pointers
913     long GetTopMargin() const;
914     long GetBottomMargin() const;
915     long GetLeftMargin() const;
916     long GetRightMargin() const;
917     void SetTopBottomMargins( long, long );
918     void SetBottomTopMargins( long, long );
919     void SetLeftRightMargins( long, long );
920     void SetRightLeftMargins( long, long );
921     void SetLeftAndWidth( long nLeft, long nWidth );
922     void SetTopAndHeight( long nTop, long nHeight );
923     void SetRightAndWidth( long nRight, long nWidth );
924     void SetBottomAndHeight( long nBottom, long nHeight );
925     long GetPrtLeft() const;
926     long GetPrtBottom() const;
927     long GetPrtRight() const;
928     long GetPrtTop() const;
929     sal_Bool SetMinLeft( long );
930     sal_Bool SetMaxBottom( long );
931     sal_Bool SetMaxRight( long );
932     sal_Bool SetMinTop( long );
933     void MakeBelowPos( const SwFrm*, const SwFrm*, sal_Bool );
934     void MakeUpperPos( const SwFrm*, const SwFrm*, sal_Bool );
935     void MakeLeftPos( const SwFrm*, const SwFrm*, sal_Bool );
936     void MakeRightPos( const SwFrm*, const SwFrm*, sal_Bool );
937     inline sal_Bool IsNeighbourFrm() const
938         { return GetType() & FRM_NEIGHBOUR ? sal_True : sal_False; }
939 
940     // --> OD 2006-05-10 #i65250#
941     inline sal_uInt32 GetFrmId() const { return mnFrmId; }
942     inline sal_uInt32 GetLastFrmId() const { return mnLastFrmId; }
943     // <--
944 
945     // NEW TABELS
946     // Some functions for covered/covering table cells. This way unnessessary
947     // includes can be avoided
948     bool IsLeaveUpperAllowed() const;
949     bool IsCoveredCell() const;
950     bool IsInCoveredCell() const;
951 
952     // FME 2007-08-30 #i81146# new loop control
953     bool KnowsFormat( const SwFmt& rFmt ) const;
954     void RegisterToFormat( SwFmt& rFmt );
955     void ValidateThisAndAllLowers( const sal_uInt16 nStage );
956 };
957 
958 inline sal_Bool	SwFrm::IsInDocBody() const
959 {
960 	if ( bInfInvalid )
961 		((SwFrm*)this)->SetInfFlags();
962 	return bInfBody;
963 }
964 inline sal_Bool	SwFrm::IsInFtn() const
965 {
966 	if ( bInfInvalid )
967 		((SwFrm*)this)->SetInfFlags();
968 	return bInfFtn;
969 }
970 inline sal_Bool SwFrm::IsInTab() const
971 {
972 	if ( bInfInvalid )
973 		((SwFrm*)this)->SetInfFlags();
974 	return bInfTab;
975 }
976 inline sal_Bool SwFrm::IsInFly() const
977 {
978 	if ( bInfInvalid )
979 		((SwFrm*)this)->SetInfFlags();
980 	return bInfFly;
981 }
982 inline sal_Bool SwFrm::IsInSct() const
983 {
984 	if ( bInfInvalid )
985 		((SwFrm*)this)->SetInfFlags();
986 	return bInfSct;
987 }
988 sal_Bool SwFrm::IsVertical() const
989 {
990     if( bInvalidVert )
991         ((SwFrm*)this)->SetDirFlags( sal_True );
992     return bVertical != 0;
993 }
994 //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
995 inline sal_Bool SwFrm::IsVertLR() const
996 {
997 	return bVertLR != 0;
998 }
999 //End of SCMS
1000 sal_Bool SwFrm::GetVerticalFlag() const
1001 {
1002     return bVertical != 0;
1003 }
1004 inline sal_Bool SwFrm::IsRightToLeft() const
1005 {
1006     if( bInvalidR2L )
1007         ((SwFrm*)this)->SetDirFlags( sal_False );
1008     return bRightToLeft != 0;
1009 }
1010 sal_Bool SwFrm::GetRightToLeftFlag() const
1011 {
1012     return bRightToLeft != 0;
1013 }
1014 
1015 inline void SwFrm::SetCompletePaint() const
1016 {
1017 	((SwFrm*)this)->bCompletePaint = sal_True;
1018 }
1019 inline void SwFrm::ResetCompletePaint() const
1020 {
1021 	((SwFrm*)this)->bCompletePaint = sal_False;
1022 }
1023 
1024 inline void SwFrm::SetRetouche() const
1025 {
1026 	((SwFrm*)this)->bRetouche = sal_True;
1027 }
1028 inline void SwFrm::ResetRetouche() const
1029 {
1030 	((SwFrm*)this)->bRetouche = sal_False;
1031 }
1032 
1033 inline SwLayoutFrm *SwFrm::GetNextLayoutLeaf()
1034 {
1035     return (SwLayoutFrm*)((const SwFrm*)this)->GetNextLayoutLeaf();
1036 }
1037 
1038 inline SwLayoutFrm *SwFrm::GetPrevLayoutLeaf()
1039 {
1040 	return (SwLayoutFrm*)((const SwFrm*)this)->GetPrevLayoutLeaf();
1041 }
1042 
1043 inline const SwLayoutFrm *SwFrm::GetNextLayoutLeaf() const
1044 {
1045     return ImplGetNextLayoutLeaf( true );
1046 }
1047 
1048 inline const SwLayoutFrm *SwFrm::GetPrevLayoutLeaf() const
1049 {
1050     return ImplGetNextLayoutLeaf( false );
1051 }
1052 
1053 inline void SwFrm::InvalidateSize()
1054 {
1055 	if ( bValidSize )
1056 		ImplInvalidateSize();
1057 }
1058 inline void SwFrm::InvalidatePrt()
1059 {
1060 	if ( bValidPrtArea )
1061 		ImplInvalidatePrt();
1062 }
1063 inline void SwFrm::InvalidatePos()
1064 {
1065 	if ( bValidPos )
1066 		ImplInvalidatePos();
1067 }
1068 inline void SwFrm::InvalidateLineNum()
1069 {
1070 	if ( bValidLineNum )
1071 		ImplInvalidateLineNum();
1072 }
1073 
1074 inline void SwFrm::InvalidateAll()
1075 {
1076     if ( _InvalidationAllowed( INVALID_ALL ) )
1077     {
1078         if ( bValidPrtArea && bValidSize && bValidPos  )
1079             ImplInvalidatePos();
1080         bValidPrtArea = bValidSize = bValidPos = sal_False;
1081 
1082         // OD 2004-05-19 #i28701#
1083         _ActionOnInvalidation( INVALID_ALL );
1084     }
1085 }
1086 
1087 inline void SwFrm::InvalidateNextPos( sal_Bool bNoFtn )
1088 {
1089 	if ( pNext && !pNext->IsSctFrm() )
1090 		pNext->InvalidatePos();
1091 #ifndef C30 // vielleicht geht es ja bei C40 ?
1092 	else
1093 		ImplInvalidateNextPos( bNoFtn );
1094 #else
1095 	if ( !pNext )
1096 		ImplInvalidateNextPos( bNoFtn );
1097 #endif
1098 }
1099 
1100 inline void SwFrm::Calc() const
1101 {
1102 	if ( !bValidPos || !bValidPrtArea || !bValidSize )
1103 		((SwFrm*)this)->PrepareMake();
1104 }
1105 inline void SwFrm::OptCalc() const
1106 {
1107 	if ( !bValidPos || !bValidPrtArea || !bValidSize )
1108 		((SwFrm*)this)->OptPrepareMake();
1109 }
1110 
1111 inline Point SwFrm::GetRelPos() const
1112 {
1113 	Point aRet( aFrm.Pos() );
1114 		//hier wird gecasted, weil die Klasse SwLayoutFrm nur vorward-
1115 		//declariert ist.
1116 	aRet -= ((SwFrm*)GetUpper())->Prt().Pos();
1117 	aRet -= ((SwFrm*)GetUpper())->Frm().Pos();
1118 	return aRet;
1119 }
1120 
1121 inline const SwPageFrm *SwFrm::FindPageFrm() const
1122 {
1123 	return ((SwFrm*)this)->FindPageFrm();
1124 }
1125 inline const SwFrm *SwFrm::FindColFrm() const
1126 {
1127 	return ((SwFrm*)this)->FindColFrm();
1128 }
1129 inline const SwFrm *SwFrm::FindFooterOrHeader() const
1130 {
1131 	return ((SwFrm*)this)->FindFooterOrHeader();
1132 }
1133 inline SwTabFrm *SwFrm::FindTabFrm()
1134 {
1135 	return IsInTab() ? ImplFindTabFrm() : 0;
1136 }
1137 inline const SwFtnBossFrm *SwFrm::FindFtnBossFrm( sal_Bool bFtn ) const
1138 {
1139 	return ((SwFrm*)this)->FindFtnBossFrm( bFtn );
1140 }
1141 inline SwFtnFrm *SwFrm::FindFtnFrm()
1142 {
1143 	return IsInFtn() ? ImplFindFtnFrm() : 0;
1144 }
1145 inline SwFlyFrm *SwFrm::FindFlyFrm()
1146 {
1147 	return IsInFly() ? ImplFindFlyFrm() : 0;
1148 }
1149 inline SwSectionFrm *SwFrm::FindSctFrm()
1150 {
1151 	return IsInSct() ? ImplFindSctFrm() : 0;
1152 }
1153 
1154 inline const SwTabFrm *SwFrm::FindTabFrm() const
1155 {
1156 	return IsInTab() ? ((SwFrm*)this)->ImplFindTabFrm() : 0;
1157 }
1158 inline const SwFtnFrm *SwFrm::FindFtnFrm() const
1159 {
1160 	return IsInFtn() ? ((SwFrm*)this)->ImplFindFtnFrm() : 0;
1161 }
1162 inline const SwFlyFrm *SwFrm::FindFlyFrm() const
1163 {
1164 	return IsInFly() ? ((SwFrm*)this)->ImplFindFlyFrm() : 0;
1165 }
1166 inline const SwSectionFrm *SwFrm::FindSctFrm() const
1167 {
1168 	return IsInSct() ? ((SwFrm*)this)->ImplFindSctFrm() : 0;
1169 }
1170 inline SwFrm *SwFrm::FindNext()
1171 {
1172 	if ( pNext )
1173 		return pNext;
1174 	else
1175 		return _FindNext();
1176 }
1177 inline const SwFrm *SwFrm::FindNext() const
1178 {
1179 	if ( pNext )
1180 		return pNext;
1181 	else
1182 		return ((SwFrm*)this)->_FindNext();
1183 }
1184 // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
1185 inline SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn )
1186 {
1187 	if ( pNext && pNext->IsCntntFrm() )
1188 		return (SwCntntFrm*)pNext;
1189 	else
1190         return _FindNextCnt( _bInSameFtn );
1191 }
1192 // <--
1193 // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
1194 inline const SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn ) const
1195 {
1196 	if ( pNext && pNext->IsCntntFrm() )
1197 		return (SwCntntFrm*)pNext;
1198 	else
1199         return ((SwFrm*)this)->_FindNextCnt( _bInSameFtn );
1200 }
1201 // <--
1202 inline SwFrm *SwFrm::FindPrev()
1203 {
1204 	if ( pPrev && !pPrev->IsSctFrm() )
1205 		return pPrev;
1206 	else
1207 		return _FindPrev();
1208 }
1209 inline const SwFrm *SwFrm::FindPrev() const
1210 {
1211 	if ( pPrev && !pPrev->IsSctFrm() )
1212 		return pPrev;
1213 	else
1214 		return ((SwFrm*)this)->_FindPrev();
1215 }
1216 
1217 
1218 inline sal_Bool SwFrm::IsLayoutFrm() const
1219 {
1220     return GetType() & FRM_LAYOUT ? sal_True : sal_False;
1221 }
1222 inline sal_Bool SwFrm::IsRootFrm() const
1223 {
1224     return nType == FRMC_ROOT;
1225 }
1226 inline sal_Bool SwFrm::IsPageFrm() const
1227 {
1228     return nType == FRMC_PAGE;
1229 }
1230 inline sal_Bool SwFrm::IsColumnFrm() const
1231 {
1232     return nType == FRMC_COLUMN;
1233 }
1234 inline sal_Bool SwFrm::IsFtnBossFrm() const
1235 {
1236     return GetType() & FRM_FTNBOSS ? sal_True : sal_False;
1237 }
1238 inline sal_Bool SwFrm::IsHeaderFrm() const
1239 {
1240     return nType == FRMC_HEADER;
1241 }
1242 inline sal_Bool SwFrm::IsFooterFrm() const
1243 {
1244     return nType == FRMC_FOOTER;
1245 }
1246 inline sal_Bool SwFrm::IsFtnContFrm() const
1247 {
1248     return nType == FRMC_FTNCONT;
1249 }
1250 inline sal_Bool SwFrm::IsFtnFrm() const
1251 {
1252     return nType == FRMC_FTN;
1253 }
1254 inline sal_Bool SwFrm::IsBodyFrm() const
1255 {
1256     return nType == FRMC_BODY;
1257 }
1258 inline sal_Bool SwFrm::IsFlyFrm() const
1259 {
1260     return nType == FRMC_FLY;
1261 }
1262 inline sal_Bool SwFrm::IsSctFrm() const
1263 {
1264     return nType == FRMC_SECTION;
1265 }
1266 inline sal_Bool SwFrm::IsTabFrm() const
1267 {
1268     return nType == FRMC_TAB;
1269 }
1270 inline sal_Bool SwFrm::IsRowFrm() const
1271 {
1272     return nType == FRMC_ROW;
1273 }
1274 inline sal_Bool SwFrm::IsCellFrm() const
1275 {
1276     return nType == FRMC_CELL;
1277 }
1278 inline sal_Bool SwFrm::IsCntntFrm() const
1279 {
1280     return GetType() & FRM_CNTNT ? sal_True : sal_False;
1281 }
1282 inline sal_Bool SwFrm::IsTxtFrm() const
1283 {
1284     return nType == FRMC_TXT;
1285 }
1286 inline sal_Bool SwFrm::IsNoTxtFrm() const
1287 {
1288     return nType == FRMC_NOTXT;
1289 }
1290 inline sal_Bool SwFrm::IsFlowFrm() const
1291 {
1292     return GetType() & 0xCA00 ? sal_True : sal_False;   //TabFrm, CntntFrm, SectionFrm
1293 }
1294 inline sal_Bool SwFrm::IsRetoucheFrm() const
1295 {
1296     return GetType() & 0xCA40 ? sal_True : sal_False;   //TabFrm, CntntFrm, SectionFrm, Ftnfrm
1297 }
1298 inline sal_Bool SwFrm::IsAccessibleFrm() const
1299 {
1300     return GetType() & FRM_ACCESSIBLE ? sal_True : sal_False;
1301 }
1302 #endif
1303