Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SW_FRAME_HXX
21 : #define SW_FRAME_HXX
22 :
23 : #include <vector>
24 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
25 : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
26 : #include <editeng/borderline.hxx>
27 : #include "swtypes.hxx"
28 : #include "swrect.hxx"
29 : #include "calbck.hxx"
30 : #include <svl/brdcst.hxx>
31 : #include "IDocumentDrawModelAccess.hxx"
32 :
33 : class SwLayoutFrm;
34 : class SwRootFrm;
35 : class SwPageFrm;
36 : class SwFlyFrm;
37 : class SwSectionFrm;
38 : class SwFtnFrm;
39 : class SwFtnBossFrm;
40 : class SwTabFrm;
41 : class SwRowFrm;
42 : class SwFlowFrm;
43 : class SwCntntFrm;
44 : class SfxPoolItem;
45 : class SwAttrSet;
46 : class ViewShell;
47 : class Color;
48 : class SwBorderAttrs;
49 : class SwCache;
50 : class SvxBrushItem;
51 : class SwSelectionList;
52 : struct SwPosition;
53 : struct SwCrsrMoveState;
54 : class SwFmt;
55 : class SwPrintData;
56 : class SwSortedObjs;
57 : class SwAnchoredObject;
58 : typedef struct _xmlTextWriter *xmlTextWriterPtr;
59 :
60 : // Each FrmType is represented here as a bit.
61 : // The bits must be set in a way that it can be determined with masking of
62 : // which kind of FrmType an instance is _and_ from what classes it was derived.
63 : // Each frame has in its base class a member that must be set by the
64 : // constructors accordingly.
65 : #define FRM_ROOT 0x0001
66 : #define FRM_PAGE 0x0002
67 : #define FRM_COLUMN 0x0004
68 : #define FRM_HEADER 0x0008
69 : #define FRM_FOOTER 0x0010
70 : #define FRM_FTNCONT 0x0020
71 : #define FRM_FTN 0x0040
72 : #define FRM_BODY 0x0080
73 : #define FRM_FLY 0x0100
74 : #define FRM_SECTION 0x0200
75 : #define FRM_UNUSED 0x0400
76 : #define FRM_TAB 0x0800
77 : #define FRM_ROW 0x1000
78 : #define FRM_CELL 0x2000
79 : #define FRM_TXT 0x4000
80 : #define FRM_NOTXT 0x8000
81 :
82 : // for internal use some common combinations
83 : #define FRM_LAYOUT 0x3FFF
84 : #define FRM_CNTNT 0xC000
85 : #define FRM_FTNBOSS 0x0006
86 : #define FRM_ACCESSIBLE (FRM_HEADER|FRM_FOOTER|FRM_FTN|FRM_TXT|FRM_ROOT|FRM_FLY|FRM_TAB|FRM_CELL|FRM_PAGE)
87 :
88 : // The type of the frame is internal represented by the 4-bit value nType,
89 : // which can expanded to the types above by shifting a bit (0x1 << nType)
90 : // Here are the corresponding defines for the compressed representation:
91 : #define FRMC_ROOT 0
92 : #define FRMC_PAGE 1
93 : #define FRMC_COLUMN 2
94 : #define FRMC_HEADER 3
95 : #define FRMC_FOOTER 4
96 : #define FRMC_FTNCONT 5
97 : #define FRMC_FTN 6
98 : #define FRMC_BODY 7
99 : #define FRMC_FLY 8
100 : #define FRMC_SECTION 9
101 : #define FRMC_UNUSED 10
102 : #define FRMC_TAB 11
103 : #define FRMC_ROW 12
104 : #define FRMC_CELL 13
105 : #define FRMC_TXT 14
106 : #define FRMC_NOTXT 15
107 :
108 : #define FRM_NEIGHBOUR 0x2004
109 : #define FRM_NOTE_VERT 0x7a60
110 : #define FRM_HEADFOOT 0x0018
111 : #define FRM_BODYFTNC 0x00a0
112 :
113 : class SwFrm;
114 : typedef long (SwFrm:: *SwFrmGet)() const;
115 : typedef sal_Bool (SwFrm:: *SwFrmMax)( long );
116 : typedef void (SwFrm:: *SwFrmMakePos)( const SwFrm*, const SwFrm*, sal_Bool );
117 : typedef long (*SwOperator)( long, long );
118 : typedef void (SwFrm:: *SwFrmSet)( long, long );
119 :
120 : struct SwRectFnCollection
121 : {
122 : SwRectGet fnGetTop;
123 : SwRectGet fnGetBottom;
124 : SwRectGet fnGetLeft;
125 : SwRectGet fnGetRight;
126 : SwRectGet fnGetWidth;
127 : SwRectGet fnGetHeight;
128 : SwRectPoint fnGetPos;
129 : SwRectSize fnGetSize;
130 :
131 : SwRectSet fnSetTop;
132 : SwRectSet fnSetBottom;
133 : SwRectSet fnSetLeft;
134 : SwRectSet fnSetRight;
135 : SwRectSet fnSetWidth;
136 : SwRectSet fnSetHeight;
137 :
138 : SwRectSet fnSubTop;
139 : SwRectSet fnAddBottom;
140 : SwRectSet fnSubLeft;
141 : SwRectSet fnAddRight;
142 : SwRectSet fnAddWidth;
143 : SwRectSet fnAddHeight;
144 :
145 : SwRectSet fnSetPosX;
146 : SwRectSet fnSetPosY;
147 :
148 : SwFrmGet fnGetTopMargin;
149 : SwFrmGet fnGetBottomMargin;
150 : SwFrmGet fnGetLeftMargin;
151 : SwFrmGet fnGetRightMargin;
152 : SwFrmSet fnSetXMargins;
153 : SwFrmSet fnSetYMargins;
154 : SwFrmGet fnGetPrtTop;
155 : SwFrmGet fnGetPrtBottom;
156 : SwFrmGet fnGetPrtLeft;
157 : SwFrmGet fnGetPrtRight;
158 : SwRectDist fnTopDist;
159 : SwRectDist fnBottomDist;
160 : SwRectDist fnLeftDist;
161 : SwRectDist fnRightDist;
162 : SwFrmMax fnSetLimit;
163 : SwRectMax fnOverStep;
164 :
165 : SwRectSetPos fnSetPos;
166 : SwFrmMakePos fnMakePos;
167 : SwOperator fnXDiff;
168 : SwOperator fnYDiff;
169 : SwOperator fnXInc;
170 : SwOperator fnYInc;
171 :
172 : SwRectSetTwice fnSetLeftAndWidth;
173 : SwRectSetTwice fnSetTopAndHeight;
174 : };
175 :
176 : typedef SwRectFnCollection* SwRectFn;
177 :
178 : // Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
179 : extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R, fnRectVertL2R;
180 : #define SWRECTFN( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \
181 : sal_Bool bRev = pFrm->IsReverse(); \
182 : sal_Bool bVertL2R = pFrm->IsVertLR(); \
183 : SwRectFn fnRect = bVert ? \
184 : ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \
185 : ( bRev ? fnRectB2T : fnRectHori );
186 : #define SWRECTFNX( pFrm ) sal_Bool bVertX = pFrm->IsVertical(); \
187 : sal_Bool bRevX = pFrm->IsReverse(); \
188 : sal_Bool bVertL2RX = pFrm->IsVertLR(); \
189 : SwRectFn fnRectX = bVertX ? \
190 : ( bRevX ? fnRectVL2R : ( bVertL2RX ? fnRectVertL2R : fnRectVert ) ): \
191 : ( bRevX ? fnRectB2T : fnRectHori );
192 : #define SWREFRESHFN( pFrm ) { if( bVert != pFrm->IsVertical() || \
193 : bRev != pFrm->IsReverse() ) \
194 : bVert = pFrm->IsVertical(); \
195 : bRev = pFrm->IsReverse(); \
196 : bVertL2R = pFrm->IsVertLR(); \
197 : fnRect = bVert ? \
198 : ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \
199 : ( bRev ? fnRectB2T : fnRectHori ); }
200 : #define SWRECTFN2( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \
201 : sal_Bool bVertL2R = pFrm->IsVertLR(); \
202 : sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \
203 : SwRectFn fnRect = bVert == bNeighb ? \
204 : fnRectHori : ( bVertL2R ? fnRectVertL2R : fnRectVert );
205 : //End of SCMS
206 : #define POS_DIFF( aFrm1, aFrm2 ) \
207 : ( (aFrm1.*fnRect->fnGetTop)() != (aFrm2.*fnRect->fnGetTop)() || \
208 : (aFrm1.*fnRect->fnGetLeft)() != (aFrm2.*fnRect->fnGetLeft)() )
209 :
210 : // for GetNextLeaf/GetPrevLeaf.
211 : enum MakePageType
212 : {
213 : MAKEPAGE_NONE, // do not create page/footnote
214 : MAKEPAGE_APPEND, // only append page if needed
215 : MAKEPAGE_INSERT, // add or append page if needed
216 : MAKEPAGE_FTN, // add footnote if needed
217 : MAKEPAGE_NOSECTION // Don't create section frames
218 : };
219 :
220 : /**
221 : * Base class of the Writer layout elements.
222 : *
223 : * This includes not only fly frames, but everything down to the paragraph
224 : * level: pages, headers, footers, etc. (Inside a paragraph SwLinePortion
225 : * instances are used.)
226 : */
227 : class SwFrm: public SwClient, public SfxBroadcaster
228 : {
229 : // the hidden Frm
230 : friend class SwFlowFrm;
231 : friend class SwLayoutFrm;
232 : friend class SwLooping;
233 :
234 : // voids lower during creation of a column
235 : friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL );
236 : friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
237 :
238 : #ifdef DBG_UTIL
239 : // remove empty SwSectionFrms from a chain
240 : friend SwFrm* SwClearDummies( SwFrm* pFrm );
241 : #endif
242 :
243 : // for validating a mistakenly invalidated one in SwCntntFrm::MakeAll
244 : friend void ValidateSz( SwFrm *pFrm );
245 : // implemented in text/txtftn.cxx, prevents Ftn oscillation
246 : friend void ValidateTxt( SwFrm *pFrm );
247 :
248 : friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt );
249 :
250 : // cache for (border) attributes
251 : static SwCache *pCache;
252 :
253 : // #i65250#
254 : // frame ID is now in general available - used for layout loop control
255 : static sal_uInt32 mnLastFrmId;
256 : const sal_uInt32 mnFrmId;
257 :
258 : SwRootFrm *mpRoot;
259 : SwLayoutFrm *pUpper;
260 : SwFrm *pNext;
261 : SwFrm *pPrev;
262 :
263 : SwFrm *_FindNext();
264 : SwFrm *_FindPrev();
265 :
266 : /** method to determine next content frame in the same environment
267 : for a flow frame (content frame, table frame, section frame)
268 :
269 : #i27138# - adding documentation:
270 : Travelling downwards through the layout to determine the next content
271 : frame in the same environment. There are several environments in a
272 : document, which form a closed context regarding this function. These
273 : environments are:
274 : - Each page header
275 : - Each page footer
276 : - Each unlinked fly frame
277 : - Each group of linked fly frames
278 : - All footnotes
279 : - All document body frames
280 : #i27138# - adding parameter <_bInSameFtn>
281 : Its default value is <false>. If its value is <true>, the environment
282 : 'All footnotes' is no longer treated. Instead each footnote is treated
283 : as an own environment.
284 :
285 : @param _bInSameFtn
286 : input parameter - boolean indicating, that the found next content
287 : frame has to be in the same footnote frame. This parameter is only
288 : relevant for flow frames in footnotes.
289 :
290 : @return SwCntntFrm*
291 : pointer to the found next content frame. It's NULL, if none exists.
292 : */
293 : SwCntntFrm* _FindNextCnt( const bool _bInSameFtn = false );
294 :
295 : /** method to determine previous content frame in the same environment
296 : for a flow frame (content frame, table frame, section frame)
297 :
298 : #i27138#
299 : Travelling upwards through the layout to determine the previous content
300 : frame in the same environment. There are several environments in a
301 : document, which form a closed context regarding this function. These
302 : environments are:
303 : - Each page header
304 : - Each page footer
305 : - Each unlinked fly frame
306 : - Each group of linked fly frames
307 : - All footnotes
308 : - All document body frames
309 : #i27138# - adding parameter <_bInSameFtn>
310 : Its default value is <false>. If its value is <true>, the environment
311 : 'All footnotes' is no longer treated. Instead each footnote is treated
312 : as an own environment.
313 :
314 : @param _bInSameFtn
315 : input parameter - boolean indicating, that the found previous content
316 : frame has to be in the same footnote frame. This parameter is only
317 : relevant for flow frames in footnotes.
318 :
319 : @return SwCntntFrm*
320 : pointer to the found previous content frame. It's NULL, if none exists.
321 : */
322 : SwCntntFrm* _FindPrevCnt( const bool _bInSameFtn = false );
323 :
324 : void _UpdateAttrFrm( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 & );
325 : SwFrm* _GetIndNext();
326 : void SetDirFlags( sal_Bool bVert );
327 :
328 : const SwLayoutFrm* ImplGetNextLayoutLeaf( bool bFwd ) const;
329 :
330 : protected:
331 : SwSortedObjs* pDrawObjs; // draw objects, can be 0
332 :
333 : SwRect aFrm; // absolute position in document and size of the Frm
334 : SwRect aPrt; // position relatively to Frm and size of PrtArea
335 :
336 : sal_uInt16 bReverse : 1; // Next line above/at the right side instead
337 : // under/at the left side of the previous line
338 : sal_uInt16 bInvalidR2L : 1;
339 : sal_uInt16 bDerivedR2L : 1;
340 : sal_uInt16 bRightToLeft : 1;
341 : sal_uInt16 bInvalidVert : 1;
342 : sal_uInt16 bDerivedVert : 1;
343 : sal_uInt16 bVertical : 1;
344 : // Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
345 : sal_uInt16 bVertLR : 1;
346 : sal_uInt16 nType : 4; //Who am I?
347 :
348 : sal_Bool bValidPos : 1;
349 : sal_Bool bValidPrtArea : 1;
350 : sal_Bool bValidSize : 1;
351 : sal_Bool bValidLineNum : 1;
352 : sal_Bool bFixSize : 1;
353 : sal_Bool bUnUsed1 : 1;
354 : // if sal_True, frame will be painted completely even content was changed
355 : // only partially. For CntntFrms a border (from Action) will exclusively
356 : // painted if <bCompletePaint> is sal_True.
357 : sal_Bool bCompletePaint : 1;
358 : sal_Bool bRetouche : 1; // frame is responsible for retouching
359 :
360 : protected:
361 : sal_Bool bInfInvalid : 1; // InfoFlags are invalid
362 : sal_Bool bInfBody : 1; // Frm is in document body
363 : sal_Bool bInfTab : 1; // Frm is in a table
364 : sal_Bool bInfFly : 1; // Frm is in a Fly
365 : sal_Bool bInfFtn : 1; // Frm is in a footnote
366 : sal_Bool bInfSct : 1; // Frm is in a section
367 : sal_Bool bColLocked : 1; // lock Grow/Shrink for column-wise section
368 : // or fly frames, will be set in Format
369 :
370 426 : void ColLock() { bColLocked = sal_True; }
371 426 : void ColUnlock() { bColLocked = sal_False; }
372 :
373 : void Destroy(); // for ~SwRootFrm
374 :
375 : // Only used by SwRootFrm Ctor to get 'this' into mpRoot...
376 236 : void setRootFrm( SwRootFrm* pRoot ) { mpRoot = pRoot; }
377 :
378 : SwPageFrm *InsertPage( SwPageFrm *pSibling, sal_Bool bFtn );
379 : void PrepareMake();
380 : void OptPrepareMake();
381 : void MakePos();
382 : // Format next frame of table frame to assure keeping attributes.
383 : // In case of nested tables method <SwFrm::MakeAll()> is called to
384 : // avoid formating of superior table frame.
385 : friend SwFrm* sw_FormatNextCntntForKeep( SwTabFrm* pTabFrm );
386 :
387 : virtual void MakeAll() = 0;
388 : // adjust frames of a page
389 : SwTwips AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst = sal_False );
390 :
391 : // change only frame size not the size of PrtArea
392 : virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) = 0;
393 : virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) = 0;
394 :
395 127097 : SwModify *GetDep() { return GetRegisteredInNonConst(); }
396 86458 : const SwModify *GetDep() const { return GetRegisteredIn(); }
397 :
398 : SwFrm( SwModify*, SwFrm* );
399 :
400 : void CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse );
401 :
402 : /** enumeration for the different invalidations
403 : #i28701#
404 : */
405 : enum InvalidationType
406 : {
407 : INVALID_SIZE, INVALID_PRTAREA, INVALID_POS, INVALID_LINENUM, INVALID_ALL
408 : };
409 :
410 : /** method to determine, if an invalidation is allowed.
411 : #i28701
412 : */
413 : virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const;
414 :
415 : /** method to perform additional actions on an invalidation
416 :
417 : #i28701#
418 : Method has *only* to contain actions, which has to be performed on
419 : *every* assignment of the corresponding flag to <sal_False>.
420 : */
421 : virtual void _ActionOnInvalidation( const InvalidationType _nInvalid );
422 :
423 : // draw shadow and borders
424 : void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const;
425 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
426 :
427 : virtual const IDocumentDrawModelAccess* getIDocumentDrawModelAccess( );
428 :
429 : public:
430 : TYPEINFO(); // already in base class
431 :
432 281440 : sal_uInt16 GetType() const { return 0x1 << nType; }
433 :
434 11452 : static SwCache &GetCache() { return *pCache; }
435 10 : static SwCache *GetCachePtr() { return pCache; }
436 10 : static void SetCache( SwCache *pNew ) { pCache = pNew; }
437 :
438 : // change PrtArea size and FrmSize
439 : SwTwips Shrink( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
440 : SwTwips Grow ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
441 :
442 : // different methods for inserting in layout tree (for performance reasons)
443 :
444 : // insert before pBehind or at the end of the chain below pUpper
445 : void InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind );
446 : // insert after pBefore or at the beginnig of the chain below pUpper
447 : void InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore );
448 : // insert before pBehind or at the end of the chain while considering
449 : // the siblings of pSct
450 : void InsertGroupBefore( SwFrm* pParent, SwFrm* pWhere, SwFrm* pSct );
451 : void Remove();
452 :
453 : // For internal use only - who ignores this will be put in a sack and has
454 : // to stay there for two days
455 : // Does special treatment for _Get[Next|Prev]Leaf() (for tables).
456 : SwLayoutFrm *GetLeaf( MakePageType eMakePage, sal_Bool bFwd );
457 : SwLayoutFrm *GetNextLeaf ( MakePageType eMakePage );
458 : SwLayoutFrm *GetNextFtnLeaf( MakePageType eMakePage );
459 : SwLayoutFrm *GetNextSctLeaf( MakePageType eMakePage );
460 : SwLayoutFrm *GetNextCellLeaf( MakePageType eMakePage );
461 : SwLayoutFrm *GetPrevLeaf ( MakePageType eMakeFtn = MAKEPAGE_FTN );
462 : SwLayoutFrm *GetPrevFtnLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
463 : SwLayoutFrm *GetPrevSctLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
464 : SwLayoutFrm *GetPrevCellLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
465 : const SwLayoutFrm *GetLeaf ( MakePageType eMakePage, sal_Bool bFwd,
466 : const SwFrm *pAnch ) const;
467 :
468 : sal_Bool WrongPageDesc( SwPageFrm* pNew );
469 :
470 : //#i28701# - new methods to append/remove drawing objects
471 : void AppendDrawObj( SwAnchoredObject& _rNewObj );
472 : void RemoveDrawObj( SwAnchoredObject& _rToRemoveObj );
473 :
474 : // work with chain of FlyFrms
475 : void AppendFly( SwFlyFrm *pNew );
476 : void RemoveFly( SwFlyFrm *pToRemove );
477 15133 : const SwSortedObjs *GetDrawObjs() const { return pDrawObjs; }
478 18638 : SwSortedObjs *GetDrawObjs() { return pDrawObjs; }
479 : // #i28701# - change purpose of method and adjust its name
480 : void InvalidateObjs( const bool _bInvaPosOnly,
481 : const bool _bNoInvaOfAsCharAnchoredObjs = true );
482 :
483 : virtual void PaintBorder( const SwRect&, const SwPageFrm *pPage,
484 : const SwBorderAttrs & ) const;
485 : void PaintBaBo( const SwRect&, const SwPageFrm *pPage = 0,
486 : const sal_Bool bLowerBorder = sal_False, const bool bOnlyTxtBackground = false ) const;
487 : void PaintBackground( const SwRect&, const SwPageFrm *pPage,
488 : const SwBorderAttrs &,
489 : const sal_Bool bLowerMode = sal_False,
490 : const sal_Bool bLowerBorder = sal_False,
491 : const bool bOnlyTxtBackground = false ) const;
492 : void PaintBorderLine( const SwRect&, const SwRect&, const SwPageFrm*,
493 : const Color *pColor, const editeng::SvxBorderStyle =
494 : ::com::sun::star::table::BorderLineStyle::SOLID ) const;
495 :
496 : drawinglayer::processor2d::BaseProcessor2D * CreateProcessor2D( ) const;
497 : void ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const;
498 :
499 : // FIXME: EasyHack (refactoring): rename method name in all files
500 : // retouch, not in the area of the given Rect!
501 : void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const;
502 :
503 : sal_Bool GetBackgroundBrush( const SvxBrushItem*& rpBrush,
504 : const Color*& rpColor,
505 : SwRect &rOrigRect,
506 : sal_Bool bLowerMode ) const;
507 :
508 : inline void SetCompletePaint() const;
509 : inline void ResetCompletePaint() const;
510 4645 : inline sal_Bool IsCompletePaint() const { return bCompletePaint; }
511 :
512 : inline void SetRetouche() const;
513 : inline void ResetRetouche() const;
514 1722 : inline sal_Bool IsRetouche() const { return bRetouche; }
515 :
516 : void SetInfFlags();
517 0 : inline void InvalidateInfFlags() { bInfInvalid = sal_True; }
518 : inline bool IsInDocBody() const; // use InfoFlags, determine flags
519 : inline sal_Bool IsInFtn() const; // if necessary
520 : inline sal_Bool IsInTab() const;
521 : inline sal_Bool IsInFly() const;
522 : inline sal_Bool IsInSct() const;
523 :
524 : // If frame is inside a split table row, this function returns
525 : // the corresponding row frame in the follow table.
526 : const SwRowFrm* IsInSplitTableRow() const;
527 :
528 : // If frame is inside a follow flow row, this function returns
529 : // the corresponding row frame master table
530 : const SwRowFrm* IsInFollowFlowRow() const;
531 :
532 : bool IsInBalancedSection() const;
533 :
534 54392 : inline sal_Bool IsReverse() const { return bReverse; }
535 : inline void SetReverse( sal_Bool bNew ){ bReverse = bNew ? 1 : 0; }
536 : inline sal_Bool IsVertical() const;
537 : //Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
538 : inline sal_Bool IsVertLR() const;
539 : inline sal_Bool GetVerticalFlag() const;
540 : inline void SetVertical( sal_Bool bNew ){ bVertical = bNew ? 1 : 0; }
541 : //Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
542 : inline void SetbVertLR( sal_Bool bNew ) { bVertLR = bNew ? 1 : 0; }
543 316 : inline void SetDerivedVert( sal_Bool bNew ){ bDerivedVert = bNew ? 1 : 0; }
544 2893 : inline void SetInvalidVert( sal_Bool bNew) { bInvalidVert = bNew ? 1 : 0; }
545 : inline sal_Bool IsRightToLeft() const;
546 : inline sal_Bool GetRightToLeftFlag() const;
547 : inline void SetRightToLeft( sal_Bool bNew ){ bRightToLeft = bNew ? 1 : 0; }
548 268 : inline void SetDerivedR2L( sal_Bool bNew ) { bDerivedR2L = bNew ? 1 : 0; }
549 69 : inline void SetInvalidR2L( sal_Bool bNew ) { bInvalidR2L = bNew ? 1 : 0; }
550 :
551 : void CheckDirChange();
552 : // returns upper left frame position for LTR and
553 : // upper right frame position for Asian / RTL frames
554 : Point GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const;
555 :
556 : /** determine, if frame is moveable in given environment
557 :
558 : method replaced 'old' method <sal_Bool IsMoveable() const>.
559 : Determines, if frame is moveable in given environment. if no environment
560 : is given (parameter _pLayoutFrm == 0L), the movability in the actual
561 : environment (<this->GetUpper()) is checked.
562 :
563 : @param _pLayoutFrm
564 : input parameter - given environment (layout frame), in which the movability
565 : will be checked. If not set ( == 0L ), actual environment is taken.
566 :
567 : @return boolean, indicating, if frame is moveable in given environment
568 : */
569 : bool IsMoveable( const SwLayoutFrm* _pLayoutFrm = 0L ) const;
570 :
571 : // Is it permitted for the (Txt)Frm to add a footnote in the current
572 : // environment (not e.g. for repeating table headlines)
573 : sal_Bool IsFtnAllowed() const;
574 :
575 : virtual void Format( const SwBorderAttrs *pAttrs = 0 );
576 :
577 : virtual void CheckDirection( sal_Bool bVert );
578 :
579 : void ReinitializeFrmSizeAttrFlags();
580 :
581 : const SwAttrSet *GetAttrSet() const;
582 :
583 3003 : inline sal_Bool HasFixSize() const { return bFixSize; }
584 : inline void SetFixSize( sal_Bool bNew ) { bFixSize = bNew; }
585 :
586 : // check all pages (starting from the given) and correct them if needed
587 : static void CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields = sal_True );
588 :
589 : // might return 0, with and without const
590 40353 : SwFrm *GetNext() { return pNext; }
591 17884 : SwFrm *GetPrev() { return pPrev; }
592 341450 : SwLayoutFrm *GetUpper() { return pUpper; }
593 46997 : SwRootFrm *getRootFrm(){ return mpRoot; }
594 : SwPageFrm *FindPageFrm();
595 : SwFrm *FindColFrm();
596 : SwRowFrm *FindRowFrm();
597 : SwFtnBossFrm *FindFtnBossFrm( sal_Bool bFootnotes = sal_False );
598 : SwTabFrm *ImplFindTabFrm();
599 : SwFtnFrm *ImplFindFtnFrm();
600 : SwFlyFrm *ImplFindFlyFrm();
601 : SwSectionFrm *ImplFindSctFrm();
602 : SwFrm *FindFooterOrHeader();
603 : SwFrm *GetLower();
604 63286 : const SwFrm *GetNext() const { return pNext; }
605 23228 : const SwFrm *GetPrev() const { return pPrev; }
606 170689 : const SwLayoutFrm *GetUpper() const { return pUpper; }
607 38996 : const SwRootFrm *getRootFrm() const { return mpRoot; }
608 : inline SwTabFrm *FindTabFrm();
609 : inline SwFtnFrm *FindFtnFrm();
610 : inline SwFlyFrm *FindFlyFrm();
611 : inline SwSectionFrm *FindSctFrm();
612 : inline SwFrm *FindNext();
613 : // #i27138# - add parameter <_bInSameFtn>
614 : inline SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false );
615 : inline SwFrm *FindPrev();
616 : inline const SwPageFrm *FindPageFrm() const;
617 : inline const SwFtnBossFrm *FindFtnBossFrm( sal_Bool bFtn = sal_False ) const;
618 : inline const SwFrm *FindColFrm() const;
619 : inline const SwFrm *FindFooterOrHeader() const;
620 : inline const SwTabFrm *FindTabFrm() const;
621 : inline const SwFtnFrm *FindFtnFrm() const;
622 : inline const SwFlyFrm *FindFlyFrm() const;
623 : inline const SwSectionFrm *FindSctFrm() const;
624 : inline const SwFrm *FindNext() const;
625 : // #i27138# - add parameter <_bInSameFtn>
626 : inline const SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false ) const;
627 : inline const SwFrm *FindPrev() const;
628 : const SwFrm *GetLower() const;
629 :
630 : /** inline wrapper method for <_FindPrevCnt(..)>
631 : #i27138#
632 : */
633 0 : inline SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false )
634 : {
635 0 : if ( GetPrev() && GetPrev()->IsCntntFrm() )
636 0 : return (SwCntntFrm*)(GetPrev());
637 : else
638 0 : return _FindPrevCnt( _bInSameFtn );
639 : }
640 :
641 : /** inline const wrapper method for <_FindPrevCnt(..)>
642 : #i27138#
643 : */
644 0 : inline const SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false ) const
645 : {
646 0 : if ( GetPrev() && GetPrev()->IsCntntFrm() )
647 0 : return (const SwCntntFrm*)(GetPrev());
648 : else
649 0 : return const_cast<SwFrm*>(this)->_FindPrevCnt( _bInSameFtn );
650 : }
651 :
652 : // #i79774#
653 : SwFrm* _GetIndPrev() const;
654 4144 : SwFrm* GetIndPrev() const
655 4144 : { return ( pPrev || !IsInSct() ) ? pPrev : _GetIndPrev(); }
656 :
657 4598 : SwFrm* GetIndNext()
658 4598 : { return ( pNext || !IsInSct() ) ? pNext : _GetIndNext(); }
659 : const SwFrm* GetIndNext() const { return ((SwFrm*)this)->GetIndNext(); }
660 :
661 : sal_uInt16 GetPhyPageNum() const; // page number without offset
662 : sal_uInt16 GetVirtPageNum() const; // page number with offset
663 98 : sal_Bool OnRightPage() const { return 0 != GetPhyPageNum() % 2; };
664 : sal_Bool WannaRightPage() const;
665 : bool OnFirstPage() const;
666 :
667 : inline const SwLayoutFrm *GetPrevLayoutLeaf() const;
668 : inline const SwLayoutFrm *GetNextLayoutLeaf() const;
669 : inline SwLayoutFrm *GetPrevLayoutLeaf();
670 : inline SwLayoutFrm *GetNextLayoutLeaf();
671 :
672 : inline void Calc() const; // here might be "formatted"
673 : inline void OptCalc() const; // here we assume (for optimization) that
674 : // the predecessors are already formatted
675 :
676 : inline Point GetRelPos() const;
677 110952 : const SwRect &Frm() const { return aFrm; }
678 31937 : const SwRect &Prt() const { return aPrt; }
679 :
680 : // PaintArea is the area where content might be displayed.
681 : // The margin of a page or the space between columns belongs to it.
682 : const SwRect PaintArea() const;
683 : // UnionFrm is the union of Frm- and PrtArea, normally identical
684 : // to the FrmArea except in case of negative Prt margins.
685 : const SwRect UnionFrm( sal_Bool bBorder = sal_False ) const;
686 :
687 : // HACK: Here we exceptionally allow direct access to members.
688 : // This should not delude into changing those value randomly; it is the
689 : // only option to circumvent compiler problems (same method with public
690 : // and protected).
691 141310 : SwRect &Frm() { return aFrm; }
692 104274 : SwRect &Prt() { return aPrt; }
693 :
694 : virtual Size ChgSize( const Size& aNewSize );
695 :
696 : virtual void Cut() = 0;
697 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) = 0;
698 :
699 765 : void ValidateLineNum() { bValidLineNum = sal_True; }
700 :
701 338 : sal_Bool GetValidPosFlag() const { return bValidPos; }
702 10 : sal_Bool GetValidPrtAreaFlag()const { return bValidPrtArea; }
703 4290 : sal_Bool GetValidSizeFlag() const { return bValidSize; }
704 1055 : sal_Bool GetValidLineNumFlag()const { return bValidLineNum; }
705 10410 : sal_Bool IsValid() const { return bValidPos && bValidSize && bValidPrtArea; }
706 :
707 : // Only invalidate Frm
708 : // #i28701# - add call to method <_ActionOnInvalidation(..)>
709 : // for all invalidation methods.
710 : // #i28701# - use method <_InvalidationAllowed(..)> to
711 : // decide, if invalidation will to be performed or not.
712 : // #i26945# - no additional invalidation, if it's already
713 : // invalidate.
714 1740 : void _InvalidateSize()
715 : {
716 1740 : if ( bValidSize && _InvalidationAllowed( INVALID_SIZE ) )
717 : {
718 486 : bValidSize = sal_False;
719 486 : _ActionOnInvalidation( INVALID_SIZE );
720 : }
721 1740 : }
722 1587 : void _InvalidatePrt()
723 : {
724 1587 : if ( bValidPrtArea && _InvalidationAllowed( INVALID_PRTAREA ) )
725 : {
726 624 : bValidPrtArea = sal_False;
727 624 : _ActionOnInvalidation( INVALID_PRTAREA );
728 : }
729 1587 : }
730 1343 : void _InvalidatePos()
731 : {
732 1343 : if ( bValidPos && _InvalidationAllowed( INVALID_POS ) )
733 : {
734 121 : bValidPos = sal_False;
735 121 : _ActionOnInvalidation( INVALID_POS );
736 : }
737 1343 : }
738 135 : void _InvalidateLineNum()
739 : {
740 135 : if ( bValidLineNum && _InvalidationAllowed( INVALID_LINENUM ) )
741 : {
742 1 : bValidLineNum = sal_False;
743 1 : _ActionOnInvalidation( INVALID_LINENUM );
744 : }
745 135 : }
746 1551 : void _InvalidateAll()
747 : {
748 1953 : if ( ( bValidSize || bValidPrtArea || bValidPos ) &&
749 402 : _InvalidationAllowed( INVALID_ALL ) )
750 : {
751 402 : bValidSize = bValidPrtArea = bValidPos = sal_False;
752 402 : _ActionOnInvalidation( INVALID_ALL );
753 : }
754 1551 : }
755 : // also notify page at the same time
756 : inline void InvalidateSize();
757 : inline void InvalidatePrt();
758 : inline void InvalidatePos();
759 : inline void InvalidateLineNum();
760 : inline void InvalidateAll();
761 : void ImplInvalidateSize();
762 : void ImplInvalidatePrt();
763 : void ImplInvalidatePos();
764 : void ImplInvalidateLineNum();
765 :
766 : inline void InvalidateNextPos( sal_Bool bNoFtn = sal_False );
767 : void ImplInvalidateNextPos( sal_Bool bNoFtn = sal_False );
768 :
769 : /** method to invalidate printing area of next frame
770 : #i11859#
771 : */
772 : void InvalidateNextPrtArea();
773 :
774 : void InvalidatePage( const SwPageFrm *pPage = 0 ) const;
775 :
776 : virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
777 :
778 : virtual sal_Bool GetCrsrOfst( SwPosition *, Point&,
779 : SwCrsrMoveState* = 0, bool bTestBackground = false ) const;
780 : virtual sal_Bool GetCharRect( SwRect &, const SwPosition&,
781 : SwCrsrMoveState* = 0 ) const;
782 : virtual void Paint( SwRect const&,
783 : SwPrintData const*const pPrintData = NULL ) const;
784 :
785 : // HACK: shortcut between frame and formatting
786 : // It's your own fault if you cast void* incorrectly! In any case check
787 : // the void* for 0.
788 : virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
789 : const void *pVoid = 0, sal_Bool bNotify = sal_True );
790 :
791 : // sal_True if it is the correct class, sal_False otherwise
792 : inline bool IsLayoutFrm() const;
793 : inline bool IsRootFrm() const;
794 : inline bool IsPageFrm() const;
795 : inline bool IsColumnFrm() const;
796 : inline bool IsFtnBossFrm() const; // footnote bosses might be PageFrms or ColumnFrms
797 : inline bool IsHeaderFrm() const;
798 : inline bool IsFooterFrm() const;
799 : inline bool IsFtnContFrm() const;
800 : inline bool IsFtnFrm() const;
801 : inline bool IsBodyFrm() const;
802 : inline bool IsColBodyFrm() const; // implemented in layfrm.hxx, BodyFrm above ColumnFrm
803 : inline bool IsPageBodyFrm() const; // implemented in layfrm.hxx, BodyFrm above PageFrm
804 : inline bool IsFlyFrm() const;
805 : inline bool IsSctFrm() const;
806 : inline bool IsTabFrm() const;
807 : inline bool IsRowFrm() const;
808 : inline bool IsCellFrm() const;
809 : inline bool IsCntntFrm() const;
810 : inline bool IsTxtFrm() const;
811 : inline bool IsNoTxtFrm() const;
812 : // Frms where its PrtArea depends on their neighbors and that are
813 : // positioned in the content flow
814 : inline bool IsFlowFrm() const;
815 : // Frms that are capable of retouching or that might need to retouch behind
816 : // themselves
817 : inline bool IsRetoucheFrm() const;
818 : inline bool IsAccessibleFrm() const;
819 :
820 : void PrepareCrsr(); // CrsrShell is allowed to call this
821 :
822 : // Is the Frm (or the section containing it) protected? Same for Fly in
823 : // Fly in ... and footnotes
824 : sal_Bool IsProtected() const;
825 :
826 1291 : sal_Bool IsColLocked() const { return bColLocked; }
827 :
828 : virtual ~SwFrm();
829 :
830 : // No inline cause we need the function pointers
831 : long GetTopMargin() const;
832 : long GetBottomMargin() const;
833 : long GetLeftMargin() const;
834 : long GetRightMargin() const;
835 : void SetTopBottomMargins( long, long );
836 : void SetBottomTopMargins( long, long );
837 : void SetLeftRightMargins( long, long );
838 : void SetRightLeftMargins( long, long );
839 : void SetLeftAndWidth( long nLeft, long nWidth );
840 : void SetTopAndHeight( long nTop, long nHeight );
841 : void SetRightAndWidth( long nRight, long nWidth );
842 : void SetBottomAndHeight( long nBottom, long nHeight );
843 : long GetPrtLeft() const;
844 : long GetPrtBottom() const;
845 : long GetPrtRight() const;
846 : long GetPrtTop() const;
847 : sal_Bool SetMinLeft( long );
848 : sal_Bool SetMaxBottom( long );
849 : sal_Bool SetMaxRight( long );
850 : sal_Bool SetMinTop( long );
851 : void MakeBelowPos( const SwFrm*, const SwFrm*, sal_Bool );
852 : void MakeUpperPos( const SwFrm*, const SwFrm*, sal_Bool );
853 : void MakeLeftPos( const SwFrm*, const SwFrm*, sal_Bool );
854 : void MakeRightPos( const SwFrm*, const SwFrm*, sal_Bool );
855 10262 : inline sal_Bool IsNeighbourFrm() const
856 10262 : { return GetType() & FRM_NEIGHBOUR ? sal_True : sal_False; }
857 :
858 : // #i65250#
859 245 : inline sal_uInt32 GetFrmId() const { return mnFrmId; }
860 : inline sal_uInt32 GetLastFrmId() const { return mnLastFrmId; }
861 :
862 : // NEW TABELS
863 : // Some functions for covered/covering table cells. This way unnessessary
864 : // includes can be avoided
865 : bool IsLeaveUpperAllowed() const;
866 : bool IsCoveredCell() const;
867 : bool IsInCoveredCell() const;
868 :
869 : // #i81146# new loop control
870 : bool KnowsFormat( const SwFmt& rFmt ) const;
871 : void RegisterToFormat( SwFmt& rFmt );
872 : void ValidateThisAndAllLowers( const sal_uInt16 nStage );
873 :
874 : public:
875 : // if writer is NULL, dumps the layout structure as XML in layout.xml
876 : virtual void dumpAsXml(xmlTextWriterPtr writer = NULL);
877 : virtual void dumpInfosAsXml(xmlTextWriterPtr writer);
878 : virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
879 : void dumpChildrenAsXml(xmlTextWriterPtr writer);
880 : bool IsCollapse() const;
881 : };
882 :
883 22271 : inline bool SwFrm::IsInDocBody() const
884 : {
885 22271 : if ( bInfInvalid )
886 345 : ((SwFrm*)this)->SetInfFlags();
887 22271 : return bInfBody;
888 : }
889 16394 : inline sal_Bool SwFrm::IsInFtn() const
890 : {
891 16394 : if ( bInfInvalid )
892 37 : ((SwFrm*)this)->SetInfFlags();
893 16394 : return bInfFtn;
894 : }
895 34759 : inline sal_Bool SwFrm::IsInTab() const
896 : {
897 34759 : if ( bInfInvalid )
898 577 : ((SwFrm*)this)->SetInfFlags();
899 34759 : return bInfTab;
900 : }
901 22135 : inline sal_Bool SwFrm::IsInFly() const
902 : {
903 22135 : if ( bInfInvalid )
904 664 : ((SwFrm*)this)->SetInfFlags();
905 22135 : return bInfFly;
906 : }
907 21385 : inline sal_Bool SwFrm::IsInSct() const
908 : {
909 21385 : if ( bInfInvalid )
910 1211 : ((SwFrm*)this)->SetInfFlags();
911 21385 : return bInfSct;
912 : }
913 133612 : sal_Bool SwFrm::IsVertical() const
914 : {
915 133612 : if( bInvalidVert )
916 15391 : ((SwFrm*)this)->SetDirFlags( sal_True );
917 133612 : return bVertical != 0;
918 : }
919 : //Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
920 54840 : inline sal_Bool SwFrm::IsVertLR() const
921 : {
922 54840 : return bVertLR != 0;
923 : }
924 : //End of SCMS
925 69 : sal_Bool SwFrm::GetVerticalFlag() const
926 : {
927 69 : return bVertical != 0;
928 : }
929 69671 : inline sal_Bool SwFrm::IsRightToLeft() const
930 : {
931 69671 : if( bInvalidR2L )
932 2247 : ((SwFrm*)this)->SetDirFlags( sal_False );
933 69671 : return bRightToLeft != 0;
934 : }
935 69 : sal_Bool SwFrm::GetRightToLeftFlag() const
936 : {
937 69 : return bRightToLeft != 0;
938 : }
939 :
940 5837 : inline void SwFrm::SetCompletePaint() const
941 : {
942 5837 : ((SwFrm*)this)->bCompletePaint = sal_True;
943 5837 : }
944 2852 : inline void SwFrm::ResetCompletePaint() const
945 : {
946 2852 : ((SwFrm*)this)->bCompletePaint = sal_False;
947 2852 : }
948 :
949 2177 : inline void SwFrm::SetRetouche() const
950 : {
951 2177 : ((SwFrm*)this)->bRetouche = sal_True;
952 2177 : }
953 808 : inline void SwFrm::ResetRetouche() const
954 : {
955 808 : ((SwFrm*)this)->bRetouche = sal_False;
956 808 : }
957 :
958 29 : inline SwLayoutFrm *SwFrm::GetNextLayoutLeaf()
959 : {
960 29 : return (SwLayoutFrm*)((const SwFrm*)this)->GetNextLayoutLeaf();
961 : }
962 611 : inline SwLayoutFrm *SwFrm::GetPrevLayoutLeaf()
963 : {
964 611 : return (SwLayoutFrm*)((const SwFrm*)this)->GetPrevLayoutLeaf();
965 : }
966 656 : inline const SwLayoutFrm *SwFrm::GetNextLayoutLeaf() const
967 : {
968 656 : return ImplGetNextLayoutLeaf( true );
969 : }
970 623 : inline const SwLayoutFrm *SwFrm::GetPrevLayoutLeaf() const
971 : {
972 623 : return ImplGetNextLayoutLeaf( false );
973 : }
974 :
975 2229 : inline void SwFrm::InvalidateSize()
976 : {
977 2229 : if ( bValidSize )
978 272 : ImplInvalidateSize();
979 2229 : }
980 1176 : inline void SwFrm::InvalidatePrt()
981 : {
982 1176 : if ( bValidPrtArea )
983 966 : ImplInvalidatePrt();
984 1176 : }
985 2474 : inline void SwFrm::InvalidatePos()
986 : {
987 2474 : if ( bValidPos )
988 726 : ImplInvalidatePos();
989 2474 : }
990 796 : inline void SwFrm::InvalidateLineNum()
991 : {
992 796 : if ( bValidLineNum )
993 242 : ImplInvalidateLineNum();
994 796 : }
995 17 : inline void SwFrm::InvalidateAll()
996 : {
997 17 : if ( _InvalidationAllowed( INVALID_ALL ) )
998 : {
999 17 : if ( bValidPrtArea && bValidSize && bValidPos )
1000 11 : ImplInvalidatePos();
1001 17 : bValidPrtArea = bValidSize = bValidPos = sal_False;
1002 :
1003 : // #i28701#
1004 17 : _ActionOnInvalidation( INVALID_ALL );
1005 : }
1006 17 : }
1007 2522 : inline void SwFrm::InvalidateNextPos( sal_Bool bNoFtn )
1008 : {
1009 2522 : if ( pNext && !pNext->IsSctFrm() )
1010 0 : pNext->InvalidatePos();
1011 : #ifndef C30 // maybe it works for C40?
1012 : else
1013 2522 : ImplInvalidateNextPos( bNoFtn );
1014 : #else
1015 : if ( !pNext )
1016 : ImplInvalidateNextPos( bNoFtn );
1017 : #endif
1018 2522 : }
1019 :
1020 15271 : inline void SwFrm::Calc() const
1021 : {
1022 15271 : if ( !bValidPos || !bValidPrtArea || !bValidSize )
1023 3163 : ((SwFrm*)this)->PrepareMake();
1024 15271 : }
1025 2291 : inline void SwFrm::OptCalc() const
1026 : {
1027 2291 : if ( !bValidPos || !bValidPrtArea || !bValidSize )
1028 1041 : ((SwFrm*)this)->OptPrepareMake();
1029 2291 : }
1030 :
1031 0 : inline Point SwFrm::GetRelPos() const
1032 : {
1033 0 : Point aRet( aFrm.Pos() );
1034 : // here we cast since SwLayoutFrm is declared only as forwarded
1035 0 : aRet -= ((SwFrm*)GetUpper())->Prt().Pos();
1036 0 : aRet -= ((SwFrm*)GetUpper())->Frm().Pos();
1037 0 : return aRet;
1038 : }
1039 :
1040 12198 : inline const SwPageFrm *SwFrm::FindPageFrm() const
1041 : {
1042 12198 : return ((SwFrm*)this)->FindPageFrm();
1043 : }
1044 11 : inline const SwFrm *SwFrm::FindColFrm() const
1045 : {
1046 11 : return ((SwFrm*)this)->FindColFrm();
1047 : }
1048 698 : inline const SwFrm *SwFrm::FindFooterOrHeader() const
1049 : {
1050 698 : return ((SwFrm*)this)->FindFooterOrHeader();
1051 : }
1052 3474 : inline SwTabFrm *SwFrm::FindTabFrm()
1053 : {
1054 3474 : return IsInTab() ? ImplFindTabFrm() : 0;
1055 : }
1056 20 : inline const SwFtnBossFrm *SwFrm::FindFtnBossFrm( sal_Bool bFtn ) const
1057 : {
1058 20 : return ((SwFrm*)this)->FindFtnBossFrm( bFtn );
1059 : }
1060 713 : inline SwFtnFrm *SwFrm::FindFtnFrm()
1061 : {
1062 713 : return IsInFtn() ? ImplFindFtnFrm() : 0;
1063 : }
1064 1450 : inline SwFlyFrm *SwFrm::FindFlyFrm()
1065 : {
1066 1450 : return IsInFly() ? ImplFindFlyFrm() : 0;
1067 : }
1068 202 : inline SwSectionFrm *SwFrm::FindSctFrm()
1069 : {
1070 202 : return IsInSct() ? ImplFindSctFrm() : 0;
1071 : }
1072 :
1073 4674 : inline const SwTabFrm *SwFrm::FindTabFrm() const
1074 : {
1075 4674 : return IsInTab() ? ((SwFrm*)this)->ImplFindTabFrm() : 0;
1076 : }
1077 20 : inline const SwFtnFrm *SwFrm::FindFtnFrm() const
1078 : {
1079 20 : return IsInFtn() ? ((SwFrm*)this)->ImplFindFtnFrm() : 0;
1080 : }
1081 9587 : inline const SwFlyFrm *SwFrm::FindFlyFrm() const
1082 : {
1083 9587 : return IsInFly() ? ((SwFrm*)this)->ImplFindFlyFrm() : 0;
1084 : }
1085 29 : inline const SwSectionFrm *SwFrm::FindSctFrm() const
1086 : {
1087 29 : return IsInSct() ? ((SwFrm*)this)->ImplFindSctFrm() : 0;
1088 : }
1089 2228 : inline SwFrm *SwFrm::FindNext()
1090 : {
1091 2228 : if ( pNext )
1092 2081 : return pNext;
1093 : else
1094 147 : return _FindNext();
1095 : }
1096 0 : inline const SwFrm *SwFrm::FindNext() const
1097 : {
1098 0 : if ( pNext )
1099 0 : return pNext;
1100 : else
1101 0 : return ((SwFrm*)this)->_FindNext();
1102 : }
1103 : // #i27138# - add parameter <_bInSameFtn>
1104 1554 : inline SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn )
1105 : {
1106 1554 : if ( pNext && pNext->IsCntntFrm() )
1107 138 : return (SwCntntFrm*)pNext;
1108 : else
1109 1416 : return _FindNextCnt( _bInSameFtn );
1110 : }
1111 : // #i27138# - add parameter <_bInSameFtn>
1112 0 : inline const SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn ) const
1113 : {
1114 0 : if ( pNext && pNext->IsCntntFrm() )
1115 0 : return (SwCntntFrm*)pNext;
1116 : else
1117 0 : return ((SwFrm*)this)->_FindNextCnt( _bInSameFtn );
1118 : }
1119 2718 : inline SwFrm *SwFrm::FindPrev()
1120 : {
1121 2718 : if ( pPrev && !pPrev->IsSctFrm() )
1122 1048 : return pPrev;
1123 : else
1124 1670 : return _FindPrev();
1125 : }
1126 1997 : inline const SwFrm *SwFrm::FindPrev() const
1127 : {
1128 1997 : if ( pPrev && !pPrev->IsSctFrm() )
1129 1450 : return pPrev;
1130 : else
1131 547 : return ((SwFrm*)this)->_FindPrev();
1132 : }
1133 :
1134 :
1135 51098 : inline bool SwFrm::IsLayoutFrm() const
1136 : {
1137 51098 : return GetType() & FRM_LAYOUT;
1138 : }
1139 15273 : inline bool SwFrm::IsRootFrm() const
1140 : {
1141 15273 : return nType == FRMC_ROOT;
1142 : }
1143 175864 : inline bool SwFrm::IsPageFrm() const
1144 : {
1145 175864 : return nType == FRMC_PAGE;
1146 : }
1147 22739 : inline bool SwFrm::IsColumnFrm() const
1148 : {
1149 22739 : return nType == FRMC_COLUMN;
1150 : }
1151 3387 : inline bool SwFrm::IsFtnBossFrm() const
1152 : {
1153 3387 : return GetType() & FRM_FTNBOSS;
1154 : }
1155 6832 : inline bool SwFrm::IsHeaderFrm() const
1156 : {
1157 6832 : return nType == FRMC_HEADER;
1158 : }
1159 11545 : inline bool SwFrm::IsFooterFrm() const
1160 : {
1161 11545 : return nType == FRMC_FOOTER;
1162 : }
1163 4445 : inline bool SwFrm::IsFtnContFrm() const
1164 : {
1165 4445 : return nType == FRMC_FTNCONT;
1166 : }
1167 9595 : inline bool SwFrm::IsFtnFrm() const
1168 : {
1169 9595 : return nType == FRMC_FTN;
1170 : }
1171 13958 : inline bool SwFrm::IsBodyFrm() const
1172 : {
1173 13958 : return nType == FRMC_BODY;
1174 : }
1175 183864 : inline bool SwFrm::IsFlyFrm() const
1176 : {
1177 183864 : return nType == FRMC_FLY;
1178 : }
1179 69876 : inline bool SwFrm::IsSctFrm() const
1180 : {
1181 69876 : return nType == FRMC_SECTION;
1182 : }
1183 68772 : inline bool SwFrm::IsTabFrm() const
1184 : {
1185 68772 : return nType == FRMC_TAB;
1186 : }
1187 59361 : inline bool SwFrm::IsRowFrm() const
1188 : {
1189 59361 : return nType == FRMC_ROW;
1190 : }
1191 62815 : inline bool SwFrm::IsCellFrm() const
1192 : {
1193 62815 : return nType == FRMC_CELL;
1194 : }
1195 141289 : inline bool SwFrm::IsCntntFrm() const
1196 : {
1197 141289 : return GetType() & FRM_CNTNT;
1198 : }
1199 92597 : inline bool SwFrm::IsTxtFrm() const
1200 : {
1201 92597 : return nType == FRMC_TXT;
1202 : }
1203 3342 : inline bool SwFrm::IsNoTxtFrm() const
1204 : {
1205 3342 : return nType == FRMC_NOTXT;
1206 : }
1207 29174 : inline bool SwFrm::IsFlowFrm() const
1208 : {
1209 29174 : return GetType() & 0xCA00; //TabFrm, CntntFrm, SectionFrm
1210 : }
1211 2894 : inline bool SwFrm::IsRetoucheFrm() const
1212 : {
1213 2894 : return GetType() & 0xCA40; //TabFrm, CntntFrm, SectionFrm, Ftnfrm
1214 : }
1215 5002 : inline bool SwFrm::IsAccessibleFrm() const
1216 : {
1217 5002 : return GetType() & FRM_ACCESSIBLE;
1218 : }
1219 : #endif
1220 :
1221 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|