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