1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frame.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <svtools/svarray.hxx>
33 #include "swtypes.hxx" // fuer SwTwips
35 #include "calbck.hxx" // fuer SwClient
56 class SwSelectionList
;
58 struct SwCrsrMoveState
;
60 // --> OD 2004-07-06 #i28701#
62 class SwAnchoredObject
;
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
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
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)
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
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:
118 #define FRMC_COLUMN 2
119 #define FRMC_HEADER 3
120 #define FRMC_FOOTER 4
121 #define FRMC_FTNCONT 5
125 #define FRMC_SECTION 9
126 #define FRMC_UNUSED 10
131 #define FRMC_NOTXT 15
133 #define FRM_NEIGHBOUR 0x2004
134 #define FRM_NOTE_VERT 0x7a60
135 #define FRM_HEADFOOT 0x0018
136 #define FRM_BODYFTNC 0x00a0
139 typedef long (SwFrm:: *SwFrmGet
)() const;
140 typedef BOOL (SwFrm:: *SwFrmMax
)( long );
141 typedef void (SwFrm:: *SwFrmMakePos
)( const SwFrm
*, const SwFrm
*, BOOL
);
142 typedef long (*SwOperator
)( long, long );
143 typedef void (SwFrm:: *SwFrmSet
)( long, long );
145 struct SwRectFnCollection
148 SwRectGet fnGetBottom
;
150 SwRectGet fnGetRight
;
151 SwRectGet fnGetWidth
;
152 SwRectGet fnGetHeight
;
153 SwRectPoint fnGetPos
;
154 SwRectSize fnGetSize
;
157 SwRectSet fnSetBottom
;
159 SwRectSet fnSetRight
;
160 SwRectSet fnSetWidth
;
161 SwRectSet fnSetHeight
;
164 SwRectSet fnAddBottom
;
166 SwRectSet fnAddRight
;
167 SwRectSet fnAddWidth
;
168 SwRectSet fnAddHeight
;
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
;
188 SwRectMax fnOverStep
;
190 SwRectSetPos fnSetPos
;
191 SwFrmMakePos fnMakePos
;
197 SwRectSetTwice fnSetLeftAndWidth
;
198 SwRectSetTwice fnSetTopAndHeight
;
201 typedef SwRectFnCollection
* SwRectFn
;
202 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(); \
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 #define POS_DIFF( aFrm1, aFrm2 ) \
226 ( (aFrm1.*fnRect->fnGetTop)() != (aFrm2.*fnRect->fnGetTop)() || \
227 (aFrm1.*fnRect->fnGetLeft)() != (aFrm2.*fnRect->fnGetLeft)() )
230 //Fuer GetNextLeaf/GetPrevLeaf.
233 MAKEPAGE_NONE
, //Keine Seite bzw. Fussnote anlegen
234 MAKEPAGE_APPEND
, //Nur ggf. Seite anhaengen
235 MAKEPAGE_INSERT
, //Seite ggf. anhaengen oder einfuegen.
236 MAKEPAGE_FTN
, //Fussnote ggf. einfuegen.
237 MAKEPAGE_NOSECTION
// Don't create section frames
240 // OD 2004-05-06 #i28701# - replaced by new class <SwSortedObjs>
241 //typedef SdrObject* SdrObjectPtr;
242 //SV_DECL_PTRARR(SwDrawObjs,SdrObjectPtr,1,1);
244 class SwFrm
: public SwClient
247 friend class SwFlowFrm
;
248 friend class SwLayoutFrm
; // Sw3FrameIo: fuer pNext, pPrev
249 friend class SwLooping
; // LoopControlling (layouter.cxx)
251 //Hebt die Lower waehrend eines Spaltenumbaus auf.
252 friend SwFrm
*SaveCntnt( SwLayoutFrm
*, SwFrm
* pStart
= NULL
);
253 friend void RestoreCntnt( SwFrm
*, SwLayoutFrm
*, SwFrm
*pSibling
, bool bGrow
);
255 //Checkt ob sich beim MakePos die Pos des Frm aendert oder nicht
257 friend BOOL
CheckPos( SwFrm
*pFrm
);
259 #if OSL_DEBUG_LEVEL > 1
260 //entfernt leere SwSectionFrms aus einer Kette
261 friend SwFrm
* SwClearDummies( SwFrm
* pFrm
);
264 //Zum validieren eines unsinnig invalidierten in SwCntntFrm::MakeAll
265 friend void ValidateSz( SwFrm
*pFrm
);
266 // Implementiert in text/txtftn.cxx, verhindert Ftn-Oszillation
267 friend void ValidateTxt( SwFrm
*pFrm
);
269 // friend void CalcAnchorAndKeep( SwFlyFrm * );
271 friend void MakeNxt( SwFrm
*pFrm
, SwFrm
*pNxt
);
273 //Cache fuer (Umrandungs-)Attribute.
274 static SwCache
*pCache
;
276 // --> OD 2006-05-10 #i65250#
277 // frame ID is now in general available - used for layout loop control
278 static sal_uInt32 mnLastFrmId
;
279 const sal_uInt32 mnFrmId
;
289 /** method to determine next content frame in the same environment
290 for a flow frame (content frame, table frame, section frame)
292 OD 2005-11-30 #i27138# - adding documentation:
293 Travelling downwards through the layout to determine the next content
294 frame in the same environment. There are several environments in a
295 document, which form a closed context regarding this function. These
299 - Each unlinked fly frame
300 - Each group of linked fly frames
302 - All document body frames
303 OD 2005-11-30 #i27138# - adding parameter <_bInSameFtn>
304 Its default value is <false>. If its value is <true>, the environment
305 'All footnotes' is no longer treated. Instead each footnote is treated
306 as an own environment.
311 input parameter - boolean indicating, that the found next content
312 frame has to be in the same footnote frame. This parameter is only
313 relevant for flow frames in footnotes.
316 pointer to the found next content frame. It's NULL, if none exists.
318 SwCntntFrm
* _FindNextCnt( const bool _bInSameFtn
= false );
320 /** method to determine previous content frame in the same environment
321 for a flow frame (content frame, table frame, section frame)
323 OD 2005-11-30 #i27138#
324 Travelling upwards through the layout to determine the previous content
325 frame in the same environment. There are several environments in a
326 document, which form a closed context regarding this function. These
330 - Each unlinked fly frame
331 - Each group of linked fly frames
333 - All document body frames
334 OD 2005-11-30 #i27138# - adding parameter <_bInSameFtn>
335 Its default value is <false>. If its value is <true>, the environment
336 'All footnotes' is no longer treated. Instead each footnote is treated
337 as an own environment.
342 input parameter - boolean indicating, that the found previous content
343 frame has to be in the same footnote frame. This parameter is only
344 relevant for flow frames in footnotes.
347 pointer to the found previous content frame. It's NULL, if none exists.
349 SwCntntFrm
* _FindPrevCnt( const bool _bInSameFtn
= false );
352 void _UpdateAttrFrm( SfxPoolItem
*, SfxPoolItem
*, BYTE
& );
353 SwFrm
* _GetIndNext();
354 void SetDirFlags( BOOL bVert
);
356 SwFrm( SwFrm
& ); //Kopieren ist nicht erlaubt.
358 const SwLayoutFrm
* ImplGetNextLayoutLeaf( bool bFwd
) const;
361 SwSortedObjs
* pDrawObjs
; //Hier haengen die DrawObjs, kann 0 sein
363 SwRect aFrm
; //Absolute Dokumentposition und groesse des Frm
364 SwRect aPrt
; //Position der PrtArea rel zum Frm und groesse der PrtArea
371 USHORT bReverse
: 1; // Next line above/at the right side instead
372 // under/at the left side of the previous line.
373 USHORT bInvalidR2L
: 1;
374 USHORT bDerivedR2L
: 1;
375 USHORT bRightToLeft
: 1;
376 USHORT bInvalidVert
: 1;
377 USHORT bDerivedVert
: 1;
379 USHORT nType
: 4; //Who am I?
382 BOOL bValidPrtArea
: 1;
384 BOOL bValidLineNum
: 1;
387 BOOL bCompletePaint
: 1; //Frame wird ganz gepaintet wenn TRUE, auch
388 //wenn der Inhalt nur teilw. veraendert ist;
389 //Bei CntntFrms wird ausschliesslich wenn TRUE
390 //der Border (von Action) gemalt.
391 BOOL bRetouche
: 1; //Der Frame ist fuer Retusche verantwortlich
396 BOOL bInfInvalid
: 1; //InfoFlags sind Invalid.
397 BOOL bInfBody
: 1; //Frm steht im DokumentBody.
398 BOOL bInfTab
: 1; //Frm steht in einer Tabelle.
399 BOOL bInfFly
: 1; //Frm steht in einem Fly.
400 BOOL bInfFtn
: 1; //Frm steht in einer Fussnote.
401 BOOL bInfSct
: 1; //Frm steht in einem Bereich.
402 BOOL bColLocked
: 1; //Grow/Shrink sperren bei spaltigen Section-
403 //oder Fly-Frames, wird im Format gesetzt
405 void ColLock() { bColLocked
= TRUE
; }
406 void ColUnlock() { bColLocked
= FALSE
; }
408 SwPageFrm
*InsertPage( SwPageFrm
*pSibling
, BOOL bFtn
);
410 void OptPrepareMake();
412 // --> OD 2005-09-28 #b6329202#
413 // method formats next frame of table frame to assure keep attribute.
414 // in case of nested tables method <SwFrm::MakeAll()> is called to
415 // avoid format of superior table frame.
416 friend SwFrm
* lcl_FormatNextCntntForKeep( SwTabFrm
* pTabFrm
);
418 virtual void MakeAll() = 0;
419 //Adjustierung der Frames einer Seite
420 SwTwips
AdjustNeighbourhood( SwTwips nDiff
, BOOL bTst
= FALSE
);
423 //Aendern nur die Framesize, nicht die PrtArea-SSize
424 virtual SwTwips
ShrinkFrm( SwTwips
, BOOL bTst
= FALSE
, BOOL bInfo
= FALSE
) = 0;
425 virtual SwTwips
GrowFrm ( SwTwips
, BOOL bTst
= FALSE
, BOOL bInfo
= FALSE
) = 0;
427 SwModify
*GetDep() { return pRegisteredIn
; }
428 const SwModify
*GetDep() const { return pRegisteredIn
; }
432 void CheckDir( UINT16 nDir
, BOOL bVert
, BOOL bOnlyBiDi
, BOOL bBrowse
);
434 /** enumeration for the different invalidations
436 OD 2004-05-19 #i28701#
440 enum InvalidationType
442 INVALID_SIZE
, INVALID_PRTAREA
, INVALID_POS
, INVALID_LINENUM
, INVALID_ALL
445 /** method to determine, if an invalidation is allowed.
447 OD 2004-05-19 #i28701
451 virtual bool _InvalidationAllowed( const InvalidationType _nInvalid
) const;
453 /** method to perform additional actions on an invalidation
455 OD 2004-05-19 #i28701#
456 Method has *only* to contain actions, which has to be performed on
457 *every* assignment of the corresponding flag to <FALSE>.
461 virtual void _ActionOnInvalidation( const InvalidationType _nInvalid
);
463 //Schatten und Umrandung painten
464 void PaintShadow( const SwRect
&, SwRect
&, const SwBorderAttrs
& ) const;
467 TYPEINFO(); //Bereits in Basisklasse Client drin.
469 USHORT
GetType() const { return 0x1 << nType
; }
471 static SwCache
&GetCache() { return *pCache
; }
472 static SwCache
*GetCachePtr() { return pCache
; }
473 static void SetCache( SwCache
*pNew
) { pCache
= pNew
; }
475 //Aendern die PrtArea-SSize und die FrmSize.
476 SwTwips
Shrink( SwTwips
, BOOL bTst
= FALSE
, BOOL bInfo
= FALSE
);
477 SwTwips
Grow ( SwTwips
, BOOL bTst
= FALSE
, BOOL bInfo
= FALSE
);
479 //Wir brauchen unterschiedliche Methoden (wg. Performance) fuer das
480 //Einfuegenin den Layout Baum:
482 //Einfuegen vor pBehind oder am Ende der Kette unter pUpper
483 void InsertBefore( SwLayoutFrm
* pParent
, SwFrm
* pBehind
);
484 //Einfuegen hinter pBefore oder am Anfang der Kette unter pUpper
485 void InsertBehind( SwLayoutFrm
*pParent
, SwFrm
*pBefore
);
486 //Einfuegen vor pBehind oder am Ende der Kette, unter Beruecksichtigung
487 //der Geschwister von pSct
488 void InsertGroupBefore( SwFrm
* pParent
, SwFrm
* pWhere
, SwFrm
* pSct
);
491 //For internal use only; wer es anders macht wird
492 //in einen Sack gesteckt und muss zwei Tage drin hocken bleiben.
493 //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch (Tabellen).
494 SwLayoutFrm
*GetLeaf( MakePageType eMakePage
, BOOL bFwd
);
495 SwLayoutFrm
*GetNextLeaf ( MakePageType eMakePage
);
496 SwLayoutFrm
*GetNextFtnLeaf( MakePageType eMakePage
);
497 SwLayoutFrm
*GetNextSctLeaf( MakePageType eMakePage
);
498 SwLayoutFrm
*GetNextCellLeaf( MakePageType eMakePage
);
499 SwLayoutFrm
*GetPrevLeaf ( MakePageType eMakeFtn
= MAKEPAGE_FTN
);
500 SwLayoutFrm
*GetPrevFtnLeaf( MakePageType eMakeFtn
= MAKEPAGE_FTN
);
501 SwLayoutFrm
*GetPrevSctLeaf( MakePageType eMakeFtn
= MAKEPAGE_FTN
);
502 SwLayoutFrm
*GetPrevCellLeaf( MakePageType eMakeFtn
= MAKEPAGE_FTN
);
503 const SwLayoutFrm
*GetLeaf ( MakePageType eMakePage
, BOOL bFwd
,
504 const SwFrm
*pAnch
) const;
506 BOOL
WrongPageDesc( SwPageFrm
* pNew
);
508 // --> OD 2004-07-02 #i28701# - new methods to append/remove drawing objects
509 void AppendDrawObj( SwAnchoredObject
& _rNewObj
);
510 void RemoveDrawObj( SwAnchoredObject
& _rToRemoveObj
);
513 //Arbeiten mit der Kette der FlyFrms
514 void AppendFly( SwFlyFrm
*pNew
);
515 void RemoveFly( SwFlyFrm
*pToRemove
);
516 const SwSortedObjs
*GetDrawObjs() const { return pDrawObjs
; }
517 SwSortedObjs
*GetDrawObjs() { return pDrawObjs
; }
518 // --> OD 2004-07-01 #i28701# - change purpose of method and adjust its name
519 void InvalidateObjs( const bool _bInvaPosOnly
,
520 const bool _bNoInvaOfAsCharAnchoredObjs
= true );
522 virtual void PaintBorder( const SwRect
&, const SwPageFrm
*pPage
,
523 const SwBorderAttrs
& ) const;
524 void PaintBaBo( const SwRect
&, const SwPageFrm
*pPage
= 0,
525 const BOOL bLowerBorder
= FALSE
) const;
526 void PaintBackground( const SwRect
&, const SwPageFrm
*pPage
,
527 const SwBorderAttrs
&,
528 const BOOL bLowerMode
= FALSE
,
529 const BOOL bLowerBorder
= FALSE
) const;
530 void PaintBorderLine( const SwRect
&, const SwRect
&, const SwPageFrm
*,
531 const Color
*pColor
) const;
533 //Retouche, nicht im Bereich des uebergebenen Rect!
534 void Retouche( const SwPageFrm
*pPage
, const SwRect
&rRect
) const;
536 BOOL
GetBackgroundBrush( const SvxBrushItem
*& rpBrush
,
537 const Color
*& rpColor
,
539 BOOL bLowerMode
) const;
541 inline void SetCompletePaint() const;
542 inline void ResetCompletePaint() const;
543 inline BOOL
IsCompletePaint() const { return bCompletePaint
; }
545 inline void SetRetouche() const;
546 inline void ResetRetouche() const;
547 inline BOOL
IsRetouche() const { return bRetouche
; }
549 void SetInfFlags(); //Setzen der InfoFlags
550 inline void InvalidateInfFlags() { bInfInvalid
= TRUE
; }
551 inline BOOL
IsInDocBody() const; //Benutzen die InfoFlags.
552 inline BOOL
IsInFtn() const; //ggf. werden die Flags ermittelt.
553 inline BOOL
IsInTab() const;
554 inline BOOL
IsInFly() const;
555 inline BOOL
IsInSct() const;
557 // If frame is inside a split table row, this function returns
558 // the corresponding row frame in the follow table.
559 const SwRowFrm
* IsInSplitTableRow() const;
561 // If frame is inside a follow flow row, this function returns
562 // the corresponding row frame master table
563 const SwRowFrm
* IsInFollowFlowRow() const;
565 bool IsInBalancedSection() const;
567 inline BOOL
IsReverse() const { return bReverse
; }
568 inline void SetReverse( BOOL bNew
){ bReverse
= bNew
? 1 : 0; }
569 inline BOOL
IsVertical() const;
570 inline BOOL
GetVerticalFlag() const;
571 inline void SetVertical( BOOL bNew
){ bVertical
= bNew
? 1 : 0; }
572 inline void SetDerivedVert( BOOL bNew
){ bDerivedVert
= bNew
? 1 : 0; }
573 inline void SetInvalidVert( BOOL bNew
) { bInvalidVert
= bNew
? 1 : 0; }
574 inline BOOL
IsRightToLeft() const;
575 inline BOOL
GetRightToLeftFlag() const;
576 inline void SetRightToLeft( BOOL bNew
){ bRightToLeft
= bNew
? 1 : 0; }
577 inline void SetDerivedR2L( BOOL bNew
) { bDerivedR2L
= bNew
? 1 : 0; }
578 inline void SetInvalidR2L( BOOL bNew
) { bInvalidR2L
= bNew
? 1 : 0; }
579 void CheckDirChange();
580 // returns upper left frame position for LTR and
581 // upper right frame position for Asian / RTL frames
582 Point
GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame
) const;
584 /** determine, if frame is moveable in given environment
586 OD 08.08.2003 #110978#
587 method replaced 'old' method <BOOL IsMoveable() const>.
588 Determines, if frame is moveable in given environment. if no environment
589 is given (parameter _pLayoutFrm == 0L), the movability in the actual
590 environment (<this->GetUpper()) is checked.
595 input parameter - given environment (layout frame), in which the movability
596 will be checked. If not set ( == 0L ), actual environment is taken.
598 @return boolean, indicating, if frame is moveable in given environment
600 // BOOL IsMoveable() const;
601 bool IsMoveable( const SwLayoutFrm
* _pLayoutFrm
= 0L ) const;
603 //Ist es fuer den (Txt)Frm in der aktuellen Umgebung erlaubt eine
604 //Fussnote einzufuegen (nicht z.B. in wiederholten TabellenHeadlines).
605 BOOL
IsFtnAllowed() const;
607 virtual void Modify( SfxPoolItem
*, SfxPoolItem
* );
608 virtual void Format( const SwBorderAttrs
*pAttrs
= 0 );
610 virtual void CheckDirection( BOOL bVert
);
612 void ReinitializeFrmSizeAttrFlags();
614 const SwAttrSet
*GetAttrSet() const;
616 inline BOOL
HasFixSize() const { return bFixSize
; }
617 inline void SetFixSize( BOOL bNew
) { bFixSize
= bNew
; }
619 //Kann 0 liefern, pruefen auch ob die Shell zum richtigen Dokument
620 //gehoert. Impl in frmsh.hxx
621 ViewShell
*GetShell() const;
623 //Prueft alle Seiten ab der Uebergebenen und korrigiert ggf.
624 static void CheckPageDescs( SwPageFrm
*pStart
, BOOL bNotifyFields
= TRUE
);
626 //Koennen 0 liefern, einmal const einmal nicht
627 SwFrm
*GetNext() { return pNext
; }
628 SwFrm
*GetPrev() { return pPrev
; }
629 SwLayoutFrm
*GetUpper() { return pUpper
; }
630 SwRootFrm
*FindRootFrm();
631 SwPageFrm
*FindPageFrm();
633 SwRowFrm
*FindRowFrm();
634 SwFtnBossFrm
*FindFtnBossFrm( BOOL bFootnotes
= FALSE
);
635 SwTabFrm
*ImplFindTabFrm();
636 SwFtnFrm
*ImplFindFtnFrm();
637 SwFlyFrm
*ImplFindFlyFrm();
638 SwSectionFrm
*ImplFindSctFrm();
639 SwFrm
*FindFooterOrHeader();
641 const SwFrm
*GetNext() const { return pNext
; }
642 const SwFrm
*GetPrev() const { return pPrev
; }
643 const SwLayoutFrm
*GetUpper() const { return pUpper
; }
644 inline SwTabFrm
*FindTabFrm();
645 inline SwFtnFrm
*FindFtnFrm();
646 inline SwFlyFrm
*FindFlyFrm();
647 inline SwSectionFrm
*FindSctFrm();
648 inline SwFrm
*FindNext();
649 // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
650 inline SwCntntFrm
* FindNextCnt( const bool _bInSameFtn
= false );
652 inline SwFrm
*FindPrev();
653 inline const SwPageFrm
*FindPageFrm() const;
654 inline const SwRootFrm
*FindRootFrm() const;
655 inline const SwFtnBossFrm
*FindFtnBossFrm( BOOL bFtn
= FALSE
) const;
656 inline const SwFrm
*FindColFrm() const;
657 inline const SwFrm
*FindFooterOrHeader() const;
658 inline const SwTabFrm
*FindTabFrm() const;
659 inline const SwFtnFrm
*FindFtnFrm() const;
660 inline const SwFlyFrm
*FindFlyFrm() const;
661 inline const SwSectionFrm
*FindSctFrm() const;
662 inline const SwFrm
*FindNext() const;
663 // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
664 inline const SwCntntFrm
* FindNextCnt( const bool _bInSameFtn
= false ) const;
666 inline const SwFrm
*FindPrev() const;
667 const SwFrm
*GetLower() const;
669 /** inline wrapper method for <_FindPrevCnt(..)>
671 OD 2005-11-30 #i27138#
675 inline SwCntntFrm
* FindPrevCnt( const bool _bInSameFtn
= false )
677 if ( GetPrev() && GetPrev()->IsCntntFrm() )
678 return (SwCntntFrm
*)(GetPrev());
680 return _FindPrevCnt( _bInSameFtn
);
683 /** inline const wrapper method for <_FindPrevCnt(..)>
685 OD 2005-11-30 #i27138#
689 inline const SwCntntFrm
* FindPrevCnt( const bool _bInSameFtn
= false ) const
691 if ( GetPrev() && GetPrev()->IsCntntFrm() )
692 return (const SwCntntFrm
*)(GetPrev());
694 return const_cast<SwFrm
*>(this)->_FindPrevCnt( _bInSameFtn
);
697 // --> OD 2007-09-04 #i79774#, #b6596954#
698 SwFrm
* _GetIndPrev() const;
699 SwFrm
* GetIndPrev() const
700 { return ( pPrev
|| !IsInSct() ) ? pPrev
: _GetIndPrev(); }
701 // const SwFrm* GetIndPrev() const { return ((SwFrm*)this)->GetIndPrev(); }
704 { return ( pNext
|| !IsInSct() ) ? pNext
: _GetIndNext(); }
705 const SwFrm
* GetIndNext() const { return ((SwFrm
*)this)->GetIndNext(); }
707 USHORT
GetPhyPageNum() const; //Seitennummer ohne Offset
708 USHORT
GetVirtPageNum() const; //Seitenummer mit Offset
709 BOOL
OnRightPage() const { return 0 != GetPhyPageNum() % 2; };
710 BOOL
WannaRightPage() const;
713 inline const SwLayoutFrm
*GetPrevLayoutLeaf() const;
714 inline const SwLayoutFrm
*GetNextLayoutLeaf() const;
715 inline SwLayoutFrm
*GetPrevLayoutLeaf();
716 inline SwLayoutFrm
*GetNextLayoutLeaf();
718 inline void Calc() const; //Hier wird ggf. 'Formatiert'
719 inline void OptCalc() const; //Hier wird zur Optimierung davon ausgegangen,
720 //das die Vorgaenger bereits formatiert sind.
722 inline Point
GetRelPos() const;
723 const SwRect
&Frm() const { return aFrm
; }
724 const SwRect
&Prt() const { return aPrt
; }
726 // The PaintArea is the area, where content may be displayed.
727 // The margin of the page or the space between columns belongs to her.
728 const SwRect
PaintArea() const;
729 // The UnionFrm is the union of frm- and prt-area, normally identical
730 // to the frm-area except the case of negative prt-margins.
731 const SwRect
UnionFrm( BOOL bBorder
= FALSE
) const;
733 //Der Zugriff auf die Member wird hier ausnahmsweiste gestattet,
734 //dies soll aber nicht dazu dienen die Werte wahllos zu veraendern;
735 //es ist nur die einzige Moeglichkeit die Compilerprobleme zu umgehen
736 //(gleiche Methode mal public mal protected).
737 SwRect
&Frm() { return aFrm
; }
738 SwRect
&Prt() { return aPrt
; }
740 virtual Size
ChgSize( const Size
& aNewSize
);
742 virtual void Cut() = 0;
743 virtual void Paste( SwFrm
* pParent
, SwFrm
* pSibling
= 0 ) = 0;
745 void ValidateLineNum() { bValidLineNum
= TRUE
; }
747 BOOL
GetValidPosFlag() const { return bValidPos
; }
748 BOOL
GetValidPrtAreaFlag()const { return bValidPrtArea
; }
749 BOOL
GetValidSizeFlag() const { return bValidSize
; }
750 BOOL
GetValidLineNumFlag()const { return bValidLineNum
; }
751 BOOL
IsValid() const { return bValidPos
&& bValidSize
&& bValidPrtArea
; }
753 //Invalideren nur den Frm
754 // OD 2004-05-19 #i28701# - add call to method <_ActionOnInvalidation(..)>
755 // for all invalidation methods.
756 // OD 2004-05-19 #i28701# - use method <_InvalidationAllowed(..)> to
757 // decide, if invalidation will to be performed or not.
758 // --> OD 2004-10-08 #i26945# - no additional invalidation, if it's already
760 void _InvalidateSize()
762 if ( bValidSize
&& _InvalidationAllowed( INVALID_SIZE
) )
765 _ActionOnInvalidation( INVALID_SIZE
);
768 void _InvalidatePrt()
770 if ( bValidPrtArea
&& _InvalidationAllowed( INVALID_PRTAREA
) )
772 bValidPrtArea
= FALSE
;
773 _ActionOnInvalidation( INVALID_PRTAREA
);
776 void _InvalidatePos()
778 if ( bValidPos
&& _InvalidationAllowed( INVALID_POS
) )
781 _ActionOnInvalidation( INVALID_POS
);
784 void _InvalidateLineNum()
786 if ( bValidLineNum
&& _InvalidationAllowed( INVALID_LINENUM
) )
788 bValidLineNum
= FALSE
;
789 _ActionOnInvalidation( INVALID_LINENUM
);
792 void _InvalidateAll()
794 if ( ( bValidSize
|| bValidPrtArea
|| bValidPos
) &&
795 _InvalidationAllowed( INVALID_ALL
) )
797 bValidSize
= bValidPrtArea
= bValidPos
= FALSE
;
798 _ActionOnInvalidation( INVALID_ALL
);
802 //Benachrichtigen gleich die Seite mit.
803 inline void InvalidateSize();
804 inline void InvalidatePrt();
805 inline void InvalidatePos();
806 inline void InvalidateLineNum();
807 inline void InvalidateAll();
808 void ImplInvalidateSize();
809 void ImplInvalidatePrt();
810 void ImplInvalidatePos();
811 void ImplInvalidateLineNum();
813 inline void InvalidateNextPos( BOOL bNoFtn
= FALSE
);
814 void ImplInvalidateNextPos( BOOL bNoFtn
= FALSE
);
816 /** method to invalidate printing area of next frame
818 OD 09.01.2004 #i11859#
822 void InvalidateNextPrtArea();
824 void InvalidatePage( const SwPageFrm
*pPage
= 0 ) const;
826 virtual bool FillSelection( SwSelectionList
& rList
, const SwRect
& rRect
) const;
828 virtual BOOL
GetCrsrOfst( SwPosition
*, Point
&,
829 SwCrsrMoveState
* = 0 ) const;
830 virtual BOOL
GetCharRect( SwRect
&, const SwPosition
&,
831 SwCrsrMoveState
* = 0 ) const;
832 virtual void Paint( const SwRect
& ) const;
834 // der "kurze Dienstweg" zwischen den Frames und der Formatierung.
835 // Wer den void* falsch Casted ist selbst schuld!
836 // Auf jedenfall muss der void* auf 0 geprueft werden.
837 virtual void Prepare( const PrepareHint ePrep
= PREP_CLEAR
,
838 const void *pVoid
= 0, BOOL bNotify
= TRUE
);
840 //TRUE wenn's die richtige Klasse ist, FALSE sonst
841 inline BOOL
IsLayoutFrm() const;
842 inline BOOL
IsRootFrm() const;
843 inline BOOL
IsPageFrm() const;
844 inline BOOL
IsColumnFrm() const;
845 inline BOOL
IsFtnBossFrm() const; // Fussnotenbosse sind PageFrms und ColumnFrms
846 inline BOOL
IsHeaderFrm() const;
847 inline BOOL
IsFooterFrm() const;
848 inline BOOL
IsFtnContFrm() const;
849 inline BOOL
IsFtnFrm() const;
850 inline BOOL
IsBodyFrm() const;
851 inline BOOL
IsColBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb ColumnFrm
852 inline BOOL
IsPageBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb PageFrm
853 inline BOOL
IsFlyFrm() const;
854 inline BOOL
IsSctFrm() const;
855 inline BOOL
IsTabFrm() const;
856 inline BOOL
IsRowFrm() const;
857 inline BOOL
IsCellFrm() const;
858 inline BOOL
IsCntntFrm() const;
859 inline BOOL
IsTxtFrm() const;
860 inline BOOL
IsNoTxtFrm() const;
861 inline BOOL
IsFlowFrm() const; //Frms deren PrtArea von den Nachbarn
862 //abhaengen und die halt im Inhaltsfluss
864 inline BOOL
IsRetoucheFrm() const; //Frms die Retouchefaehig sind bzw. die
865 //u.U. hinter sich Retouchieren muessen.
866 inline BOOL
IsAccessibleFrm() const;
868 void PrepareCrsr(); //Die CrsrShell darf.
870 //Ist der Frm (bzw. die Section in der er steht) geschuetzt?
871 //Auch Fly in Fly in ... und Fussnoten
872 BOOL
IsProtected() const;
874 BOOL
IsColLocked() const { return bColLocked
; }
878 // No inline cause we need the function pointers
879 long GetTopMargin() const;
880 long GetBottomMargin() const;
881 long GetLeftMargin() const;
882 long GetRightMargin() const;
883 void SetTopBottomMargins( long, long );
884 void SetBottomTopMargins( long, long );
885 void SetLeftRightMargins( long, long );
886 void SetRightLeftMargins( long, long );
887 void SetLeftAndWidth( long nLeft
, long nWidth
);
888 void SetTopAndHeight( long nTop
, long nHeight
);
889 void SetRightAndWidth( long nRight
, long nWidth
);
890 void SetBottomAndHeight( long nBottom
, long nHeight
);
891 long GetPrtLeft() const;
892 long GetPrtBottom() const;
893 long GetPrtRight() const;
894 long GetPrtTop() const;
895 BOOL
SetMinLeft( long );
896 BOOL
SetMaxBottom( long );
897 BOOL
SetMaxRight( long );
898 BOOL
SetMinTop( long );
899 void MakeBelowPos( const SwFrm
*, const SwFrm
*, BOOL
);
900 void MakeUpperPos( const SwFrm
*, const SwFrm
*, BOOL
);
901 void MakeLeftPos( const SwFrm
*, const SwFrm
*, BOOL
);
902 void MakeRightPos( const SwFrm
*, const SwFrm
*, BOOL
);
903 inline BOOL
IsNeighbourFrm() const
904 { return GetType() & FRM_NEIGHBOUR
? TRUE
: FALSE
; }
906 // --> OD 2006-05-10 #i65250#
907 inline sal_uInt32
GetFrmId() const { return mnFrmId
; }
908 inline sal_uInt32
GetLastFrmId() const { return mnLastFrmId
; }
912 // Some functions for covered/covering table cells. This way unnessessary
913 // includes can be avoided
914 bool IsLeaveUpperAllowed() const;
915 bool IsCoveredCell() const;
916 bool IsInCoveredCell() const;
918 // FME 2007-08-30 #i81146# new loop control
919 void ValidateThisAndAllLowers( const USHORT nStage
);
922 bool IsCollapse() const;
925 inline BOOL
SwFrm::IsInDocBody() const
928 ((SwFrm
*)this)->SetInfFlags();
931 inline BOOL
SwFrm::IsInFtn() const
934 ((SwFrm
*)this)->SetInfFlags();
937 inline BOOL
SwFrm::IsInTab() const
940 ((SwFrm
*)this)->SetInfFlags();
943 inline BOOL
SwFrm::IsInFly() const
946 ((SwFrm
*)this)->SetInfFlags();
949 inline BOOL
SwFrm::IsInSct() const
952 ((SwFrm
*)this)->SetInfFlags();
955 BOOL
SwFrm::IsVertical() const
958 ((SwFrm
*)this)->SetDirFlags( TRUE
);
959 return bVertical
!= 0;
961 BOOL
SwFrm::GetVerticalFlag() const
963 return bVertical
!= 0;
965 inline BOOL
SwFrm::IsRightToLeft() const
968 ((SwFrm
*)this)->SetDirFlags( FALSE
);
969 return bRightToLeft
!= 0;
971 BOOL
SwFrm::GetRightToLeftFlag() const
973 return bRightToLeft
!= 0;
976 inline void SwFrm::SetCompletePaint() const
978 ((SwFrm
*)this)->bCompletePaint
= TRUE
;
980 inline void SwFrm::ResetCompletePaint() const
982 ((SwFrm
*)this)->bCompletePaint
= FALSE
;
985 inline void SwFrm::SetRetouche() const
987 ((SwFrm
*)this)->bRetouche
= TRUE
;
989 inline void SwFrm::ResetRetouche() const
991 ((SwFrm
*)this)->bRetouche
= FALSE
;
994 inline SwLayoutFrm
*SwFrm::GetNextLayoutLeaf()
996 return (SwLayoutFrm
*)((const SwFrm
*)this)->GetNextLayoutLeaf();
999 inline SwLayoutFrm
*SwFrm::GetPrevLayoutLeaf()
1001 return (SwLayoutFrm
*)((const SwFrm
*)this)->GetPrevLayoutLeaf();
1004 inline const SwLayoutFrm
*SwFrm::GetNextLayoutLeaf() const
1006 return ImplGetNextLayoutLeaf( true );
1009 inline const SwLayoutFrm
*SwFrm::GetPrevLayoutLeaf() const
1011 return ImplGetNextLayoutLeaf( false );
1014 inline void SwFrm::InvalidateSize()
1017 ImplInvalidateSize();
1019 inline void SwFrm::InvalidatePrt()
1021 if ( bValidPrtArea
)
1022 ImplInvalidatePrt();
1024 inline void SwFrm::InvalidatePos()
1027 ImplInvalidatePos();
1029 inline void SwFrm::InvalidateLineNum()
1031 if ( bValidLineNum
)
1032 ImplInvalidateLineNum();
1035 inline void SwFrm::InvalidateAll()
1037 if ( _InvalidationAllowed( INVALID_ALL
) )
1039 if ( bValidPrtArea
&& bValidSize
&& bValidPos
)
1040 ImplInvalidatePos();
1041 bValidPrtArea
= bValidSize
= bValidPos
= FALSE
;
1043 // OD 2004-05-19 #i28701#
1044 _ActionOnInvalidation( INVALID_ALL
);
1048 inline void SwFrm::InvalidateNextPos( BOOL bNoFtn
)
1050 if ( pNext
&& !pNext
->IsSctFrm() )
1051 pNext
->InvalidatePos();
1052 #ifndef C30 // vielleicht geht es ja bei C40 ?
1054 ImplInvalidateNextPos( bNoFtn
);
1057 ImplInvalidateNextPos( bNoFtn
);
1061 inline void SwFrm::Calc() const
1063 if ( !bValidPos
|| !bValidPrtArea
|| !bValidSize
)
1064 ((SwFrm
*)this)->PrepareMake();
1066 inline void SwFrm::OptCalc() const
1068 if ( !bValidPos
|| !bValidPrtArea
|| !bValidSize
)
1069 ((SwFrm
*)this)->OptPrepareMake();
1072 inline Point
SwFrm::GetRelPos() const
1074 Point
aRet( aFrm
.Pos() );
1075 //hier wird gecasted, weil die Klasse SwLayoutFrm nur vorward-
1077 aRet
-= ((SwFrm
*)GetUpper())->Prt().Pos();
1078 aRet
-= ((SwFrm
*)GetUpper())->Frm().Pos();
1082 inline const SwPageFrm
*SwFrm::FindPageFrm() const
1084 return ((SwFrm
*)this)->FindPageFrm();
1086 inline const SwRootFrm
*SwFrm::FindRootFrm() const
1088 return ((SwFrm
*)this)->FindRootFrm();
1090 inline const SwFrm
*SwFrm::FindColFrm() const
1092 return ((SwFrm
*)this)->FindColFrm();
1094 inline const SwFrm
*SwFrm::FindFooterOrHeader() const
1096 return ((SwFrm
*)this)->FindFooterOrHeader();
1098 inline SwTabFrm
*SwFrm::FindTabFrm()
1100 return IsInTab() ? ImplFindTabFrm() : 0;
1102 inline const SwFtnBossFrm
*SwFrm::FindFtnBossFrm( BOOL bFtn
) const
1104 return ((SwFrm
*)this)->FindFtnBossFrm( bFtn
);
1106 inline SwFtnFrm
*SwFrm::FindFtnFrm()
1108 return IsInFtn() ? ImplFindFtnFrm() : 0;
1110 inline SwFlyFrm
*SwFrm::FindFlyFrm()
1112 return IsInFly() ? ImplFindFlyFrm() : 0;
1114 inline SwSectionFrm
*SwFrm::FindSctFrm()
1116 return IsInSct() ? ImplFindSctFrm() : 0;
1119 inline const SwTabFrm
*SwFrm::FindTabFrm() const
1121 return IsInTab() ? ((SwFrm
*)this)->ImplFindTabFrm() : 0;
1123 inline const SwFtnFrm
*SwFrm::FindFtnFrm() const
1125 return IsInFtn() ? ((SwFrm
*)this)->ImplFindFtnFrm() : 0;
1127 inline const SwFlyFrm
*SwFrm::FindFlyFrm() const
1129 return IsInFly() ? ((SwFrm
*)this)->ImplFindFlyFrm() : 0;
1131 inline const SwSectionFrm
*SwFrm::FindSctFrm() const
1133 return IsInSct() ? ((SwFrm
*)this)->ImplFindSctFrm() : 0;
1135 inline SwFrm
*SwFrm::FindNext()
1142 inline const SwFrm
*SwFrm::FindNext() const
1147 return ((SwFrm
*)this)->_FindNext();
1149 // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
1150 inline SwCntntFrm
*SwFrm::FindNextCnt( const bool _bInSameFtn
)
1152 if ( pNext
&& pNext
->IsCntntFrm() )
1153 return (SwCntntFrm
*)pNext
;
1155 return _FindNextCnt( _bInSameFtn
);
1158 // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn>
1159 inline const SwCntntFrm
*SwFrm::FindNextCnt( const bool _bInSameFtn
) const
1161 if ( pNext
&& pNext
->IsCntntFrm() )
1162 return (SwCntntFrm
*)pNext
;
1164 return ((SwFrm
*)this)->_FindNextCnt( _bInSameFtn
);
1167 inline SwFrm
*SwFrm::FindPrev()
1169 if ( pPrev
&& !pPrev
->IsSctFrm() )
1174 inline const SwFrm
*SwFrm::FindPrev() const
1176 if ( pPrev
&& !pPrev
->IsSctFrm() )
1179 return ((SwFrm
*)this)->_FindPrev();
1183 inline BOOL
SwFrm::IsLayoutFrm() const
1185 return GetType() & FRM_LAYOUT
? TRUE
: FALSE
;
1187 inline BOOL
SwFrm::IsRootFrm() const
1189 return nType
== FRMC_ROOT
;
1191 inline BOOL
SwFrm::IsPageFrm() const
1193 return nType
== FRMC_PAGE
;
1195 inline BOOL
SwFrm::IsColumnFrm() const
1197 return nType
== FRMC_COLUMN
;
1199 inline BOOL
SwFrm::IsFtnBossFrm() const
1201 return GetType() & FRM_FTNBOSS
? TRUE
: FALSE
;
1203 inline BOOL
SwFrm::IsHeaderFrm() const
1205 return nType
== FRMC_HEADER
;
1207 inline BOOL
SwFrm::IsFooterFrm() const
1209 return nType
== FRMC_FOOTER
;
1211 inline BOOL
SwFrm::IsFtnContFrm() const
1213 return nType
== FRMC_FTNCONT
;
1215 inline BOOL
SwFrm::IsFtnFrm() const
1217 return nType
== FRMC_FTN
;
1219 inline BOOL
SwFrm::IsBodyFrm() const
1221 return nType
== FRMC_BODY
;
1223 inline BOOL
SwFrm::IsFlyFrm() const
1225 return nType
== FRMC_FLY
;
1227 inline BOOL
SwFrm::IsSctFrm() const
1229 return nType
== FRMC_SECTION
;
1231 inline BOOL
SwFrm::IsTabFrm() const
1233 return nType
== FRMC_TAB
;
1235 inline BOOL
SwFrm::IsRowFrm() const
1237 return nType
== FRMC_ROW
;
1239 inline BOOL
SwFrm::IsCellFrm() const
1241 return nType
== FRMC_CELL
;
1243 inline BOOL
SwFrm::IsCntntFrm() const
1245 return GetType() & FRM_CNTNT
? TRUE
: FALSE
;
1247 inline BOOL
SwFrm::IsTxtFrm() const
1249 return nType
== FRMC_TXT
;
1251 inline BOOL
SwFrm::IsNoTxtFrm() const
1253 return nType
== FRMC_NOTXT
;
1255 inline BOOL
SwFrm::IsFlowFrm() const
1257 return GetType() & 0xCA00 ? TRUE
: FALSE
; //TabFrm, CntntFrm, SectionFrm
1259 inline BOOL
SwFrm::IsRetoucheFrm() const
1261 return GetType() & 0xCA40 ? TRUE
: FALSE
; //TabFrm, CntntFrm, SectionFrm, Ftnfrm
1263 inline BOOL
SwFrm::IsAccessibleFrm() const
1265 return GetType() & FRM_ACCESSIBLE
? TRUE
: FALSE
;