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