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