1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SW_SOURCE_CORE_INC_FRAME_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_FRAME_HXX
23 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
24 #include <editeng/borderline.hxx>
25 #include <svl/poolitem.hxx>
26 #include <swtypes.hxx>
29 #include <svl/SfxBroadcaster.hxx>
30 #include <o3tl/typed_flags_set.hxx>
31 #include <com/sun/star/style/TabStop.hpp>
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 #include <vcl/outdev.hxx>
38 namespace drawinglayer::processor2d
{ class BaseProcessor2D
; }
46 class SwFootnoteFrame
;
47 class SwFootnoteBossFrame
;
56 class SvxFormatBreakItem
;
57 class SwFormatPageDesc
;
58 class SwSelectionList
;
60 struct SwCursorMoveState
;
64 class SwAnchoredObject
;
65 enum class SvxFrameDirection
;
66 class IDocumentDrawModelAccess
;
68 // Each FrameType is represented here as a bit.
69 // The bits must be set in a way that it can be determined with masking of
70 // which kind of FrameType an instance is _and_ from what classes it was derived.
71 // Each frame has in its base class a member that must be set by the
72 // constructors accordingly.
73 enum class SwFrameType
96 template<> struct typed_flags
<SwFrameType
> : is_typed_flags
<SwFrameType
, 0xfbff> {};
99 // for internal use some common combinations
100 #define FRM_LAYOUT SwFrameType(0x3bFF)
101 #define FRM_ALL SwFrameType(0xfbff)
102 #define FRM_CNTNT (SwFrameType::Txt | SwFrameType::NoTxt)
103 #define FRM_FTNBOSS (SwFrameType::Page | SwFrameType::Column)
104 #define FRM_ACCESSIBLE (SwFrameType::Root | SwFrameType::Page | SwFrameType::Header | SwFrameType::Footer | SwFrameType::Ftn | SwFrameType::Fly | SwFrameType::Tab | SwFrameType::Cell | SwFrameType::Txt)
105 #define FRM_NEIGHBOUR (SwFrameType::Column | SwFrameType::Cell)
106 #define FRM_NOTE_VERT (SwFrameType::FtnCont | SwFrameType::Ftn | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | SwFrameType::Txt)
107 #define FRM_HEADFOOT (SwFrameType::Header | SwFrameType::Footer)
108 #define FRM_BODYFTNC (SwFrameType::FtnCont | SwFrameType::Body)
110 // for GetNextLeaf/GetPrevLeaf.
113 MAKEPAGE_NONE
, // do not create page/footnote
114 MAKEPAGE_APPEND
, // only append page if needed
115 MAKEPAGE_INSERT
, // add or append page if needed
116 MAKEPAGE_FTN
, // add footnote if needed
117 MAKEPAGE_NOSECTION
// Don't create section frames
120 namespace drawinglayer::attribute
{
121 class SdrAllFillAttributesHelper
;
122 typedef std::shared_ptr
< SdrAllFillAttributesHelper
> SdrAllFillAttributesHelperPtr
;
125 /// Helper class to isolate geometry-defining members of SwFrame
126 /// and to control their accesses. Moved to own class to have no
127 /// hidden accesses to 'private' members anymore.
129 /// Added most important flags about the state of this geometric
130 /// information and if it is valid or not
131 class SAL_DLLPUBLIC_RTTI SwFrameAreaDefinition
134 friend void FriendHackInvalidateRowFrame(SwFrameAreaDefinition
&);
136 // The absolute position and size of the SwFrame in the document.
137 // This values are set by the layouter implementations
140 // The 'inner' Frame Area defined by a SwRect relative to FrameArea:
141 // When identical to FrameArea, Pos() will be (0, 0) and Size identical.
142 SwRect maFramePrintArea
;
145 bool mbFrameAreaPositionValid
: 1;
146 bool mbFrameAreaSizeValid
: 1;
147 bool mbFramePrintAreaValid
: 1;
150 // frame ID is now in general available - used for layout loop control
151 static sal_uInt32 mnLastFrameId
;
152 const sal_uInt32 mnFrameId
;
155 // write access to mb*Valid flags
156 void setFrameAreaPositionValid(bool bNew
);
157 void setFrameAreaSizeValid(bool bNew
);
158 void setFramePrintAreaValid(bool bNew
);
161 SwFrameAreaDefinition();
162 virtual ~SwFrameAreaDefinition();
164 // read access to mb*Valid flags
165 bool isFrameAreaPositionValid() const { return mbFrameAreaPositionValid
; }
166 bool isFrameAreaSizeValid() const { return mbFrameAreaSizeValid
; }
167 bool isFramePrintAreaValid() const { return mbFramePrintAreaValid
; }
169 // syntactic sugar: test whole FrameAreaDefinition
170 bool isFrameAreaDefinitionValid() const { return isFrameAreaPositionValid() && isFrameAreaSizeValid() && isFramePrintAreaValid(); }
173 sal_uInt32
GetFrameId() const { return mnFrameId
; }
175 // read accesses to FrameArea definitions - only const access allowed.
176 // Do *not* const_cast results, it is necessary to track changes. use
177 // the below offered WriteAccess helper classes instead
178 const SwRect
& getFrameArea() const { return maFrameArea
; }
179 const SwRect
& getFramePrintArea() const { return maFramePrintArea
; }
181 // helper class(es) for FrameArea manipulation. These
182 // have to be used to apply changes to FrameAreas. They hold a copy of the
183 // SwRect for manipulation. It gets written back at destruction. Thus, this
184 // mechanism depends on scope usage, take care. It prevents errors using
185 // different instances of SwFrame in get/set methods which is more safe
186 class FrameAreaWriteAccess
: public SwRect
189 SwFrameAreaDefinition
& mrTarget
;
191 FrameAreaWriteAccess(const FrameAreaWriteAccess
&) = delete;
192 FrameAreaWriteAccess
& operator=(const FrameAreaWriteAccess
&) = delete;
195 FrameAreaWriteAccess(SwFrameAreaDefinition
& rTarget
) : SwRect(rTarget
.getFrameArea()), mrTarget(rTarget
) {}
196 ~FrameAreaWriteAccess();
197 void setSwRect(const SwRect
& rNew
) { *reinterpret_cast< SwRect
* >(this) = rNew
; }
200 // same helper for FramePrintArea
201 class FramePrintAreaWriteAccess
: public SwRect
204 SwFrameAreaDefinition
& mrTarget
;
206 FramePrintAreaWriteAccess(const FramePrintAreaWriteAccess
&) = delete;
207 FramePrintAreaWriteAccess
& operator=(const FramePrintAreaWriteAccess
&) = delete;
210 FramePrintAreaWriteAccess(SwFrameAreaDefinition
& rTarget
) : SwRect(rTarget
.getFramePrintArea()), mrTarget(rTarget
) {}
211 ~FramePrintAreaWriteAccess();
212 void setSwRect(const SwRect
& rNew
) { *reinterpret_cast< SwRect
* >(this) = rNew
; }
215 // RotateFlyFrame3 - Support for Transformations
216 // Hand out the Transformations for the current FrameAreaDefinition
217 // for the FrameArea and FramePrintArea.
218 // FramePrintArea is not relative to FrameArea in this
219 // transformation representation (to make it easier to use and understand).
220 // There is no 'set' method since SwFrame is a layout object. For
221 // some cases rotation will be included (used for SwGrfNode in inner
222 // SwFrame of a SwFlyFrame)
223 virtual basegfx::B2DHomMatrix
getFrameAreaTransformation() const;
224 virtual basegfx::B2DHomMatrix
getFramePrintAreaTransformation() const;
226 // RotateFlyFrame3 - Support for Transformations
227 // Modify current transformations by applying given translation
228 virtual void transform_translate(const Point
& rOffset
);
231 /// RotateFlyFrame3: Helper class when you want to make your SwFrame derivate
232 /// transformable. It provides some tooling to do so. To use, add as member
233 /// (see e.g. SwFlyFreeFrame which uses 'std::unique_ptr< TransformableSwFrame >')
234 class TransformableSwFrame
237 // The SwFrameAreaDefinition to work on
238 SwFrameAreaDefinition
& mrSwFrameAreaDefinition
;
240 // FrameAreaTransformation and FramePrintAreaTransformation
241 // !identity when needed (translate/scale is used (e.g. rotation))
242 basegfx::B2DHomMatrix maFrameAreaTransformation
;
243 basegfx::B2DHomMatrix maFramePrintAreaTransformation
;
246 TransformableSwFrame(SwFrameAreaDefinition
& rSwFrameAreaDefinition
)
247 : mrSwFrameAreaDefinition(rSwFrameAreaDefinition
),
248 maFrameAreaTransformation(),
249 maFramePrintAreaTransformation()
253 // get SwFrameArea in transformation form
254 const basegfx::B2DHomMatrix
& getLocalFrameAreaTransformation() const
256 return maFrameAreaTransformation
;
259 // get SwFramePrintArea in transformation form
260 const basegfx::B2DHomMatrix
& getLocalFramePrintAreaTransformation() const
262 return maFramePrintAreaTransformation
;
265 // Helpers to re-create the untransformed SwRect(s) originally
266 // in the SwFrameAreaDefinition, based on the current Transformations.
267 SwRect
getUntransformedFrameArea() const;
268 SwRect
getUntransformedFramePrintArea() const;
270 // Helper method to re-create FrameAreaTransformations based on the
271 // current FrameAreaDefinition transformed by given rotation and Center
272 void createFrameAreaTransformations(
274 const basegfx::B2DPoint
& rCenter
);
276 // Tooling method to reset the SwRect(s) in the current
277 // SwFrameAreaDefinition which are already adapted to
278 // Transformation back to the untransformed state, using
279 // the getUntransformedFrame*Area calls above when needed.
280 // Only the SwRect(s) are changed back, not the transformations.
281 void restoreFrameAreas();
283 // Re-Creates the SwRect(s) as BoundAreas based on the current
284 // set Transformations.
285 void adaptFrameAreasToTransformations();
287 // Modify current definitions by applying the given transformation
288 void transform(const basegfx::B2DHomMatrix
& aTransform
);
292 * Base class of the Writer layout elements.
294 * This includes not only fly frames, but everything down to the paragraph
295 * level: pages, headers, footers, etc. (Inside a paragraph SwLinePortion
296 * instances are used.)
298 class SW_DLLPUBLIC SwFrame
: public SwFrameAreaDefinition
, public SwClient
, public SfxBroadcaster
301 friend class SwFlowFrame
;
302 friend class SwLayoutFrame
;
303 friend class SwLooping
;
304 friend class SwDeletionChecker
; // for GetDep()
306 // voids lower during creation of a column
307 friend SwFrame
*SaveContent( SwLayoutFrame
*, SwFrame
* pStart
);
308 friend void RestoreContent( SwFrame
*, SwLayoutFrame
*, SwFrame
*pSibling
);
310 // for validating a mistakenly invalidated one in SwContentFrame::MakeAll
311 friend void ValidateSz( SwFrame
*pFrame
);
312 // implemented in text/txtftn.cxx, prevents Footnote oscillation
313 friend void ValidateText( SwFrame
*pFrame
);
315 friend void MakeNxt( SwFrame
*pFrame
, SwFrame
*pNxt
);
317 // cache for (border) attributes
318 static SwCache
*mpCache
;
321 SwLayoutFrame
*mpUpper
;
325 // sw_redlinehide: hide these dangerous SwClient functions
326 using SwClient::GetRegisteredInNonConst
;
327 using SwClient::GetRegisteredIn
;
329 SwFrame
*FindNext_();
330 SwFrame
*FindPrev_();
332 /** method to determine next content frame in the same environment
333 for a flow frame (content frame, table frame, section frame)
335 #i27138# - adding documentation:
336 Travelling downwards through the layout to determine the next content
337 frame in the same environment. There are several environments in a
338 document, which form a closed context regarding this function. These
342 - Each unlinked fly frame
343 - Each group of linked fly frames
345 - All document body frames
346 #i27138# - adding parameter <_bInSameFootnote>
347 Its default value is <false>. If its value is <true>, the environment
348 'All footnotes' is no longer treated. Instead each footnote is treated
349 as an own environment.
351 @param _bInSameFootnote
352 input parameter - boolean indicating, that the found next content
353 frame has to be in the same footnote frame. This parameter is only
354 relevant for flow frames in footnotes.
356 @return SwContentFrame*
357 pointer to the found next content frame. It's NULL, if none exists.
359 SwContentFrame
* FindNextCnt_( const bool _bInSameFootnote
);
361 /** method to determine previous content frame in the same environment
362 for a flow frame (content frame, table frame, section frame)
365 Travelling upwards through the layout to determine the previous content
366 frame in the same environment. There are several environments in a
367 document, which form a closed context regarding this function. These
371 - Each unlinked fly frame
372 - Each group of linked fly frames
374 - All document body frames
375 #i27138# - adding parameter <_bInSameFootnote>
376 Its default value is <false>. If its value is <true>, the environment
377 'All footnotes' is no longer treated. Instead each footnote is treated
378 as an own environment.
380 The found previous content frame has to be in the same footnote frame. This is only
381 relevant for flow frames in footnotes.
383 @return SwContentFrame*
384 pointer to the found previous content frame. It's NULL, if none exists.
386 SwContentFrame
* FindPrevCnt_();
388 void UpdateAttrFrame( const SfxPoolItem
*, const SfxPoolItem
*, sal_uInt8
& );
389 SwFrame
* GetIndNext_();
390 void SetDirFlags( bool bVert
);
392 const SwLayoutFrame
* ImplGetNextLayoutLeaf( bool bFwd
) const;
394 SwPageFrame
* ImplFindPageFrame();
397 std::unique_ptr
<SwSortedObjs
> m_pDrawObjs
; // draw objects, can be null
398 SwFrameType mnFrameType
; //Who am I?
401 bool mbInvalidR2L
: 1;
402 bool mbDerivedR2L
: 1;
403 bool mbRightToLeft
: 1;
404 bool mbInvalidVert
: 1;
405 bool mbDerivedVert
: 1;
411 bool mbValidLineNum
: 1;
414 // if true, frame will be painted completely even content was changed
415 // only partially. For ContentFrames a border (from Action) will exclusively
416 // painted if <mbCompletePaint> is true.
417 bool mbCompletePaint
: 1;
419 bool mbRetouche
: 1; // frame is responsible for retouching
421 bool mbInfInvalid
: 1; // InfoFlags are invalid
422 bool mbInfBody
: 1; // Frame is in document body
423 bool mbInfTab
: 1; // Frame is in a table
424 bool mbInfFly
: 1; // Frame is in a Fly
425 bool mbInfFootnote
: 1; // Frame is in a footnote
426 bool mbInfSct
: 1; // Frame is in a section
427 bool mbColLocked
: 1; // lock Grow/Shrink for column-wise section
428 // or fly frames, will be set in Format
429 bool m_isInDestroy
: 1;
430 bool mbForbidDelete
: 1;
432 void ColLock() { mbColLocked
= true; }
433 void ColUnlock() { mbColLocked
= false; }
435 virtual void DestroyImpl();
436 virtual ~SwFrame() override
;
438 // Only used by SwRootFrame Ctor to get 'this' into mpRoot...
439 void setRootFrame( SwRootFrame
* pRoot
) { mpRoot
= pRoot
; }
441 SwPageFrame
*InsertPage( SwPageFrame
*pSibling
, bool bFootnote
);
442 void PrepareMake(vcl::RenderContext
* pRenderContext
);
443 void OptPrepareMake();
444 virtual void MakePos();
445 // Format next frame of table frame to assure keeping attributes.
446 // In case of nested tables method <SwFrame::MakeAll()> is called to
447 // avoid formatting of superior table frame.
448 friend SwFrame
* sw_FormatNextContentForKeep( SwTabFrame
* pTabFrame
);
450 virtual void MakeAll(vcl::RenderContext
* pRenderContext
) = 0;
451 // adjust frames of a page
452 SwTwips
AdjustNeighbourhood( SwTwips nDiff
, bool bTst
= false );
454 // change only frame size not the size of PrtArea
455 virtual SwTwips
ShrinkFrame( SwTwips
, bool bTst
= false, bool bInfo
= false ) = 0;
456 virtual SwTwips
GrowFrame ( SwTwips
, bool bTst
= false, bool bInfo
= false ) = 0;
458 /// use these so we can grep for SwFrame's GetRegisteredIn accesses
459 /// beware that SwTextFrame may return sw::WriterMultiListener
460 sw::BroadcastingModify
* GetDep()
461 { return static_cast<sw::BroadcastingModify
*>(GetRegisteredInNonConst()); }
462 const sw::BroadcastingModify
* GetDep() const
463 { return static_cast<const sw::BroadcastingModify
*>(GetRegisteredIn()); }
465 SwFrame( sw::BroadcastingModify
*, SwFrame
* );
467 void CheckDir( SvxFrameDirection nDir
, bool bVert
, bool bOnlyBiDi
, bool bBrowse
);
469 /** enumeration for the different invalidations
472 enum InvalidationType
474 INVALID_SIZE
, INVALID_PRTAREA
, INVALID_POS
, INVALID_LINENUM
, INVALID_ALL
477 /** method to determine, if an invalidation is allowed.
480 virtual bool InvalidationAllowed( const InvalidationType _nInvalid
) const;
482 /** method to perform additional actions on an invalidation
485 Method has *only* to contain actions, which has to be performed on
486 *every* assignment of the corresponding flag to <false>.
488 virtual void ActionOnInvalidation( const InvalidationType _nInvalid
);
490 // draw shadow and borders
491 void PaintShadow( const SwRect
&, SwRect
&, const SwBorderAttrs
& ) const;
492 virtual void Modify( const SfxPoolItem
*, const SfxPoolItem
* ) override
;
494 virtual const IDocumentDrawModelAccess
& getIDocumentDrawModelAccess( );
497 virtual css::uno::Sequence
< css::style::TabStop
> GetTabStopInfo( SwTwips
)
499 return css::uno::Sequence
< css::style::TabStop
>();
503 SwFrameType
GetType() const { return mnFrameType
; }
505 static SwCache
&GetCache() { return *mpCache
; }
506 static SwCache
*GetCachePtr() { return mpCache
; }
507 static void SetCache( SwCache
*pNew
) { mpCache
= pNew
; }
509 // change PrtArea size and FrameSize
510 SwTwips
Shrink( SwTwips
, bool bTst
= false, bool bInfo
= false );
511 SwTwips
Grow ( SwTwips
, bool bTst
= false, bool bInfo
= false );
513 // different methods for inserting in layout tree (for performance reasons)
515 // insert before pBehind or at the end of the chain below mpUpper
516 void InsertBefore( SwLayoutFrame
* pParent
, SwFrame
* pBehind
);
517 // insert after pBefore or at the beginning of the chain below mpUpper
518 void InsertBehind( SwLayoutFrame
*pParent
, SwFrame
*pBefore
);
519 // insert before pBehind or at the end of the chain while considering
520 // the siblings of pSct
521 bool InsertGroupBefore( SwFrame
* pParent
, SwFrame
* pWhere
, SwFrame
* pSct
);
522 void RemoveFromLayout();
524 // For internal use only - who ignores this will be put in a sack and has
525 // to stay there for two days
526 // Does special treatment for Get_[Next|Prev]Leaf() (for tables).
527 SwLayoutFrame
*GetLeaf( MakePageType eMakePage
, bool bFwd
);
528 SwLayoutFrame
*GetNextLeaf ( MakePageType eMakePage
);
529 SwLayoutFrame
*GetNextFootnoteLeaf( MakePageType eMakePage
);
530 SwLayoutFrame
*GetNextSctLeaf( MakePageType eMakePage
);
531 SwLayoutFrame
*GetNextCellLeaf();
532 SwLayoutFrame
*GetPrevLeaf ();
533 SwLayoutFrame
*GetPrevFootnoteLeaf( MakePageType eMakeFootnote
);
534 SwLayoutFrame
*GetPrevSctLeaf();
535 SwLayoutFrame
*GetPrevCellLeaf();
536 const SwLayoutFrame
*GetLeaf ( MakePageType eMakePage
, bool bFwd
,
537 const SwFrame
*pAnch
) const;
539 bool WrongPageDesc( SwPageFrame
* pNew
);
541 //#i28701# - new methods to append/remove drawing objects
542 void AppendDrawObj( SwAnchoredObject
& _rNewObj
);
543 void RemoveDrawObj( SwAnchoredObject
& _rToRemoveObj
);
545 // work with chain of FlyFrames
546 void AppendFly( SwFlyFrame
*pNew
);
547 void RemoveFly( SwFlyFrame
*pToRemove
);
548 const SwSortedObjs
*GetDrawObjs() const { return m_pDrawObjs
.get(); }
549 SwSortedObjs
*GetDrawObjs() { return m_pDrawObjs
.get(); }
550 // #i28701# - change purpose of method and adjust its name
551 void InvalidateObjs( const bool _bNoInvaOfAsCharAnchoredObjs
= true );
553 virtual void PaintSwFrameShadowAndBorder(
555 const SwPageFrame
* pPage
,
556 const SwBorderAttrs
&) const;
557 void PaintBaBo( const SwRect
&, const SwPageFrame
*pPage
,
558 const bool bOnlyTextBackground
= false) const;
559 void PaintSwFrameBackground( const SwRect
&, const SwPageFrame
*pPage
,
560 const SwBorderAttrs
&,
561 const bool bLowerMode
= false,
562 const bool bLowerBorder
= false,
563 const bool bOnlyTextBackground
= false ) const;
564 void PaintBorderLine( const SwRect
&, const SwRect
&, const SwPageFrame
*,
566 const SvxBorderLineStyle
= SvxBorderLineStyle::SOLID
) const;
568 std::unique_ptr
<drawinglayer::processor2d::BaseProcessor2D
> CreateProcessor2D( ) const;
569 void ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DContainer
& rSequence
) const;
571 // retouch, not in the area of the given Rect!
572 void Retouch( const SwPageFrame
*pPage
, const SwRect
&rRect
) const;
574 bool GetBackgroundBrush(
575 drawinglayer::attribute::SdrAllFillAttributesHelperPtr
& rFillAttributes
,
576 const SvxBrushItem
*& rpBrush
,
577 std::optional
<Color
>& rxColor
,
580 bool bConsiderTextBox
) const;
582 inline void SetCompletePaint() const;
583 inline void ResetCompletePaint() const;
584 bool IsCompletePaint() const { return mbCompletePaint
; }
586 inline void SetRetouche() const;
587 inline void ResetRetouche() const;
588 bool IsRetouche() const { return mbRetouche
; }
591 void InvalidateInfFlags() { mbInfInvalid
= true; }
592 inline bool IsInDocBody() const; // use InfoFlags, determine flags
593 inline bool IsInFootnote() const; // if necessary
594 inline bool IsInTab() const;
595 inline bool IsInFly() const;
596 inline bool IsInSct() const;
598 // If frame is inside a split table row, this function returns
599 // the corresponding row frame in the follow table.
600 const SwRowFrame
* IsInSplitTableRow() const;
602 // If frame is inside a follow flow row, this function returns
603 // the corresponding row frame master table
604 const SwRowFrame
* IsInFollowFlowRow() const;
606 bool IsInBalancedSection() const;
608 inline bool IsVertical() const;
609 inline bool IsVertLR() const;
610 inline bool IsVertLRBT() const;
612 void SetDerivedVert( bool bNew
){ mbDerivedVert
= bNew
; }
613 void SetInvalidVert( bool bNew
) { mbInvalidVert
= bNew
; }
614 inline bool IsRightToLeft() const;
615 void SetDerivedR2L( bool bNew
) { mbDerivedR2L
= bNew
; }
617 void CheckDirChange();
618 // returns upper left frame position for LTR and
619 // upper right frame position for Asian / RTL frames
620 Point
GetFrameAnchorPos( bool bIgnoreFlysAnchoredAtThisFrame
) const;
622 /** determine, if frame is moveable in given environment
624 method replaced 'old' method <bool IsMoveable() const>.
625 Determines, if frame is moveable in given environment. if no environment
626 is given (parameter _pLayoutFrame == 0), the movability in the actual
627 environment (<GetUpper()) is checked.
630 input parameter - given environment (layout frame), in which the movability
631 will be checked. If not set ( == 0 ), actual environment is taken.
633 @return boolean, indicating, if frame is moveable in given environment
635 bool IsMoveable( const SwLayoutFrame
* _pLayoutFrame
= nullptr ) const;
637 // Is it permitted for the (Text)Frame to add a footnote in the current
638 // environment (not e.g. for repeating table headlines)
639 bool IsFootnoteAllowed() const;
641 virtual void Format( vcl::RenderContext
* pRenderContext
, const SwBorderAttrs
*pAttrs
= nullptr );
643 virtual void CheckDirection( bool bVert
);
645 void ReinitializeFrameSizeAttrFlags();
647 /// WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for
648 /// SwTextFrame, use GetBreakItem()/GetPageDescItem() instead
649 const SwAttrSet
*GetAttrSet() const;
650 virtual const SvxFormatBreakItem
& GetBreakItem() const;
651 virtual const SwFormatPageDesc
& GetPageDescItem() const;
653 bool HasFixSize() const { return mbFixSize
; }
655 // check all pages (starting from the given) and correct them if needed
656 static void CheckPageDescs( SwPageFrame
*pStart
, bool bNotifyFields
= true, SwPageFrame
** ppPrev
= nullptr);
658 // might return 0, with and without const
659 SwFrame
*GetNext() { return mpNext
; }
660 SwFrame
*GetPrev() { return mpPrev
; }
661 SwLayoutFrame
*GetUpper() { return mpUpper
; }
662 SwRootFrame
*getRootFrame(){ return mpRoot
; }
663 SwPageFrame
*FindPageFrame() { return IsPageFrame() ? reinterpret_cast<SwPageFrame
*>(this) : ImplFindPageFrame(); }
664 SwFrame
*FindColFrame();
665 SwRowFrame
*FindRowFrame();
666 SwFootnoteBossFrame
*FindFootnoteBossFrame( bool bFootnotes
= false );
667 SwTabFrame
*ImplFindTabFrame();
668 SwFootnoteFrame
*ImplFindFootnoteFrame();
669 SwFlyFrame
*ImplFindFlyFrame();
670 SwSectionFrame
*ImplFindSctFrame();
671 const SwBodyFrame
*ImplFindBodyFrame() const;
672 SwFrame
*FindFooterOrHeader();
674 const SwFrame
*GetNext() const { return mpNext
; }
675 const SwFrame
*GetPrev() const { return mpPrev
; }
676 const SwLayoutFrame
*GetUpper() const { return mpUpper
; }
677 const SwRootFrame
*getRootFrame() const { return mpRoot
; }
678 inline SwTabFrame
*FindTabFrame();
679 inline SwFootnoteFrame
*FindFootnoteFrame();
680 inline SwFlyFrame
*FindFlyFrame();
681 inline SwSectionFrame
*FindSctFrame();
682 inline SwFrame
*FindNext();
683 // #i27138# - add parameter <_bInSameFootnote>
684 SwContentFrame
* FindNextCnt( const bool _bInSameFootnote
= false );
685 inline SwFrame
*FindPrev();
686 inline const SwPageFrame
*FindPageFrame() const;
687 inline const SwFootnoteBossFrame
*FindFootnoteBossFrame( bool bFootnote
= false ) const;
688 inline const SwFrame
*FindColFrame() const;
689 inline const SwFrame
*FindFooterOrHeader() const;
690 inline const SwTabFrame
*FindTabFrame() const;
691 inline const SwFootnoteFrame
*FindFootnoteFrame() const;
692 inline const SwFlyFrame
*FindFlyFrame() const;
693 inline const SwSectionFrame
*FindSctFrame() const;
694 inline const SwBodyFrame
*FindBodyFrame() const;
695 inline const SwFrame
*FindNext() const;
696 // #i27138# - add parameter <_bInSameFootnote>
697 const SwContentFrame
* FindNextCnt( const bool _bInSameFootnote
= false ) const;
698 inline const SwFrame
*FindPrev() const;
699 const SwFrame
*GetLower() const;
701 SwContentFrame
* FindPrevCnt();
703 const SwContentFrame
* FindPrevCnt() const;
706 SwFrame
* GetIndPrev_() const;
707 SwFrame
* GetIndPrev() const
708 { return ( mpPrev
|| !IsInSct() ) ? mpPrev
: GetIndPrev_(); }
710 SwFrame
* GetIndNext()
711 { return ( mpNext
|| !IsInSct() ) ? mpNext
: GetIndNext_(); }
712 const SwFrame
* GetIndNext() const { return const_cast<SwFrame
*>(this)->GetIndNext(); }
714 sal_uInt16
GetPhyPageNum() const; // page number without offset
715 sal_uInt16
GetVirtPageNum() const; // page number with offset
716 bool OnRightPage() const { return 0 != GetPhyPageNum() % 2; };
717 bool WannaRightPage() const;
718 bool OnFirstPage() const;
720 inline const SwLayoutFrame
*GetPrevLayoutLeaf() const;
721 inline const SwLayoutFrame
*GetNextLayoutLeaf() const;
722 inline SwLayoutFrame
*GetPrevLayoutLeaf();
723 inline SwLayoutFrame
*GetNextLayoutLeaf();
725 virtual void Calc(vcl::RenderContext
* pRenderContext
) const; // here might be "formatted"
726 inline void OptCalc() const; // here we assume (for optimization) that
727 // the predecessors are already formatted
728 Point
GetRelPos() const;
730 // PaintArea is the area where content might be displayed.
731 // The margin of a page or the space between columns belongs to it.
732 SwRect
GetPaintArea() const;
734 // UnionFrame is the union of Frame- and PrtArea, normally identical
735 // to the FrameArea except in case of negative Prt margins.
736 SwRect
UnionFrame( bool bBorder
= false ) const;
738 virtual Size
ChgSize( const Size
& aNewSize
);
740 virtual void Cut() = 0;
741 virtual void Paste( SwFrame
* pParent
, SwFrame
* pSibling
= nullptr ) = 0;
743 void ValidateLineNum() { mbValidLineNum
= true; }
745 bool GetValidLineNumFlag()const { return mbValidLineNum
; }
747 // Only invalidate Frame
748 // #i28701# - add call to method <ActionOnInvalidation(..)>
749 // for all invalidation methods.
750 // #i28701# - use method <InvalidationAllowed(..)> to
751 // decide, if invalidation will to be performed or not.
752 // #i26945# - no additional invalidation, if it's already
754 void InvalidateSize_()
756 if ( isFrameAreaSizeValid() && InvalidationAllowed( INVALID_SIZE
) )
758 setFrameAreaSizeValid(false);
759 ActionOnInvalidation( INVALID_SIZE
);
762 void InvalidatePrt_()
764 if ( isFramePrintAreaValid() && InvalidationAllowed( INVALID_PRTAREA
) )
766 setFramePrintAreaValid(false);
767 ActionOnInvalidation( INVALID_PRTAREA
);
770 void InvalidatePos_()
772 if ( isFrameAreaPositionValid() && InvalidationAllowed( INVALID_POS
) )
774 setFrameAreaPositionValid(false);
775 ActionOnInvalidation( INVALID_POS
);
778 void InvalidateLineNum_()
780 if ( mbValidLineNum
&& InvalidationAllowed( INVALID_LINENUM
) )
782 mbValidLineNum
= false;
783 ActionOnInvalidation( INVALID_LINENUM
);
786 void InvalidateAll_()
788 if ( ( isFrameAreaSizeValid() || isFramePrintAreaValid() || isFrameAreaPositionValid() ) && InvalidationAllowed( INVALID_ALL
) )
790 setFrameAreaSizeValid(false);
791 setFrameAreaPositionValid(false);
792 setFramePrintAreaValid(false);
793 ActionOnInvalidation( INVALID_ALL
);
796 // also notify page at the same time
797 inline void InvalidateSize();
798 inline void InvalidatePrt();
799 inline void InvalidatePos();
800 inline void InvalidateLineNum();
801 inline void InvalidateAll();
802 void ImplInvalidateSize();
803 void ImplInvalidatePrt();
804 void ImplInvalidatePos();
805 void ImplInvalidateLineNum();
807 inline void InvalidateNextPos( bool bNoFootnote
= false );
808 void ImplInvalidateNextPos( bool bNoFootnote
);
810 /** method to invalidate printing area of next frame
813 void InvalidateNextPrtArea();
815 void InvalidatePage( const SwPageFrame
*pPage
= nullptr ) const;
817 virtual bool FillSelection( SwSelectionList
& rList
, const SwRect
& rRect
) const;
819 virtual bool GetModelPositionForViewPoint( SwPosition
*, Point
&,
820 SwCursorMoveState
* = nullptr, bool bTestBackground
= false ) const;
821 virtual bool GetCharRect( SwRect
&, const SwPosition
&,
822 SwCursorMoveState
* = nullptr, bool bAllowFarAway
= true ) const;
823 virtual void PaintSwFrame( vcl::RenderContext
& rRenderContext
, SwRect
const&,
824 SwPrintData
const*const pPrintData
= nullptr ) const;
826 // HACK: shortcut between frame and formatting
827 // It's your own fault if you cast void* incorrectly! In any case check
829 virtual bool Prepare( const PrepareHint ePrep
= PrepareHint::Clear
,
830 const void *pVoid
= nullptr, bool bNotify
= true );
832 // true if it is the correct class, false otherwise
833 inline bool IsLayoutFrame() const;
834 inline bool IsRootFrame() const;
835 inline bool IsPageFrame() const;
836 inline bool IsColumnFrame() const;
837 inline bool IsFootnoteBossFrame() const; // footnote bosses might be PageFrames or ColumnFrames
838 inline bool IsHeaderFrame() const;
839 inline bool IsFooterFrame() const;
840 inline bool IsFootnoteContFrame() const;
841 inline bool IsFootnoteFrame() const;
842 inline bool IsBodyFrame() const;
843 inline bool IsColBodyFrame() const; // implemented in layfrm.hxx, BodyFrame above ColumnFrame
844 inline bool IsPageBodyFrame() const; // implemented in layfrm.hxx, BodyFrame above PageFrame
845 inline bool IsFlyFrame() const;
846 inline bool IsSctFrame() const;
847 inline bool IsTabFrame() const;
848 inline bool IsRowFrame() const;
849 inline bool IsCellFrame() const;
850 inline bool IsContentFrame() const;
851 inline bool IsTextFrame() const;
852 inline bool IsNoTextFrame() const;
853 // Frames where its PrtArea depends on their neighbors and that are
854 // positioned in the content flow
855 inline bool IsFlowFrame() const;
856 // Frames that are capable of retouching or that might need to retouch behind
858 inline bool IsRetoucheFrame() const;
859 inline bool IsAccessibleFrame() const;
861 void PrepareCursor(); // CursorShell is allowed to call this
863 // Is the Frame (or the section containing it) protected? Same for Fly in
864 // Fly in ... and footnotes
865 bool IsProtected() const;
867 bool IsColLocked() const { return mbColLocked
; }
868 virtual bool IsDeleteForbidden() const { return mbForbidDelete
; }
870 /// this is the only way to delete a SwFrame instance
871 static void DestroyFrame(SwFrame
*const pFrame
);
873 bool IsInDtor() const { return mbInDtor
; }
875 // No inline cause we need the function pointers
876 tools::Long
GetTopMargin() const;
877 tools::Long
GetBottomMargin() const;
878 tools::Long
GetLeftMargin() const;
879 tools::Long
GetRightMargin() const;
880 void SetTopBottomMargins( tools::Long
, tools::Long
);
881 void SetLeftRightMargins( tools::Long
, tools::Long
);
882 void SetRightLeftMargins( tools::Long
, tools::Long
);
883 tools::Long
GetPrtLeft() const;
884 tools::Long
GetPrtBottom() const;
885 tools::Long
GetPrtRight() const;
886 tools::Long
GetPrtTop() const;
887 bool SetMinLeft( tools::Long
);
888 bool SetMaxBottom( tools::Long
);
889 bool SetMaxRight( tools::Long
);
890 void MakeBelowPos( const SwFrame
*, const SwFrame
*, bool );
891 void MakeLeftPos( const SwFrame
*, const SwFrame
*, bool );
892 void MakeRightPos( const SwFrame
*, const SwFrame
*, bool );
893 bool IsNeighbourFrame() const
894 { return bool(GetType() & FRM_NEIGHBOUR
); }
897 // Some functions for covered/covering table cells. This way unnecessary
898 // includes can be avoided
899 virtual bool IsLeaveUpperAllowed() const;
900 virtual bool IsCoveredCell() const;
901 bool IsInCoveredCell() const;
903 // #i81146# new loop control
904 bool KnowsFormat( const SwFormat
& rFormat
) const;
905 void RegisterToFormat( SwFormat
& rFormat
);
906 void ValidateThisAndAllLowers( const sal_uInt16 nStage
);
908 void ForbidDelete() { mbForbidDelete
= true; }
909 void AllowDelete() { mbForbidDelete
= false; }
911 drawinglayer::attribute::SdrAllFillAttributesHelperPtr
getSdrAllFillAttributesHelper() const;
912 bool supportsFullDrawingLayerFillAttributeSet() const;
915 // if writer is NULL, dumps the layout structure as XML in layout.xml
916 virtual void dumpAsXml(xmlTextWriterPtr writer
= nullptr) const;
917 void dumpTopMostAsXml(xmlTextWriterPtr writer
= nullptr) const;
918 void dumpInfosAsXml(xmlTextWriterPtr writer
) const;
919 virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer
) const;
920 void dumpChildrenAsXml(xmlTextWriterPtr writer
) const;
921 bool IsCollapse() const;
924 inline bool SwFrame::IsInDocBody() const
927 const_cast<SwFrame
*>(this)->SetInfFlags();
930 inline bool SwFrame::IsInFootnote() const
933 const_cast<SwFrame
*>(this)->SetInfFlags();
934 return mbInfFootnote
;
936 inline bool SwFrame::IsInTab() const
939 const_cast<SwFrame
*>(this)->SetInfFlags();
942 inline bool SwFrame::IsInFly() const
945 const_cast<SwFrame
*>(this)->SetInfFlags();
948 inline bool SwFrame::IsInSct() const
951 const_cast<SwFrame
*>(this)->SetInfFlags();
954 bool SwFrame::IsVertical() const
957 const_cast<SwFrame
*>(this)->SetDirFlags( true );
960 inline bool SwFrame::IsVertLR() const
964 inline bool SwFrame::IsVertLRBT() const
968 inline bool SwFrame::IsRightToLeft() const
971 const_cast<SwFrame
*>(this)->SetDirFlags( false );
972 return mbRightToLeft
;
975 inline void SwFrame::SetCompletePaint() const
977 const_cast<SwFrame
*>(this)->mbCompletePaint
= true;
979 inline void SwFrame::ResetCompletePaint() const
981 const_cast<SwFrame
*>(this)->mbCompletePaint
= false;
984 inline void SwFrame::SetRetouche() const
986 const_cast<SwFrame
*>(this)->mbRetouche
= true;
988 inline void SwFrame::ResetRetouche() const
990 const_cast<SwFrame
*>(this)->mbRetouche
= false;
993 inline SwLayoutFrame
*SwFrame::GetNextLayoutLeaf()
995 return const_cast<SwLayoutFrame
*>(static_cast<const SwFrame
*>(this)->GetNextLayoutLeaf());
997 inline SwLayoutFrame
*SwFrame::GetPrevLayoutLeaf()
999 return const_cast<SwLayoutFrame
*>(static_cast<const SwFrame
*>(this)->GetPrevLayoutLeaf());
1001 inline const SwLayoutFrame
*SwFrame::GetNextLayoutLeaf() const
1003 return ImplGetNextLayoutLeaf( true );
1005 inline const SwLayoutFrame
*SwFrame::GetPrevLayoutLeaf() const
1007 return ImplGetNextLayoutLeaf( false );
1010 inline void SwFrame::InvalidateSize()
1012 if ( isFrameAreaSizeValid() )
1014 ImplInvalidateSize();
1017 inline void SwFrame::InvalidatePrt()
1019 if ( isFramePrintAreaValid() )
1021 ImplInvalidatePrt();
1024 inline void SwFrame::InvalidatePos()
1026 if ( isFrameAreaPositionValid() )
1028 ImplInvalidatePos();
1031 inline void SwFrame::InvalidateLineNum()
1033 if ( mbValidLineNum
)
1034 ImplInvalidateLineNum();
1036 inline void SwFrame::InvalidateAll()
1038 if ( InvalidationAllowed( INVALID_ALL
) )
1040 if ( isFrameAreaDefinitionValid() )
1042 ImplInvalidatePos();
1045 setFrameAreaSizeValid(false);
1046 setFrameAreaPositionValid(false);
1047 setFramePrintAreaValid(false);
1050 ActionOnInvalidation( INVALID_ALL
);
1053 inline void SwFrame::InvalidateNextPos( bool bNoFootnote
)
1055 if ( mpNext
&& !mpNext
->IsSctFrame() )
1056 mpNext
->InvalidatePos();
1058 ImplInvalidateNextPos( bNoFootnote
);
1061 inline void SwFrame::OptCalc() const
1063 if ( !isFrameAreaPositionValid() || !isFramePrintAreaValid() || !isFrameAreaSizeValid() )
1065 const_cast<SwFrame
*>(this)->OptPrepareMake();
1068 inline const SwPageFrame
*SwFrame::FindPageFrame() const
1070 return const_cast<SwFrame
*>(this)->FindPageFrame();
1072 inline const SwFrame
*SwFrame::FindColFrame() const
1074 return const_cast<SwFrame
*>(this)->FindColFrame();
1076 inline const SwFrame
*SwFrame::FindFooterOrHeader() const
1078 return const_cast<SwFrame
*>(this)->FindFooterOrHeader();
1080 inline SwTabFrame
*SwFrame::FindTabFrame()
1082 return IsInTab() ? ImplFindTabFrame() : nullptr;
1084 inline const SwFootnoteBossFrame
*SwFrame::FindFootnoteBossFrame( bool bFootnote
) const
1086 return const_cast<SwFrame
*>(this)->FindFootnoteBossFrame( bFootnote
);
1088 inline SwFootnoteFrame
*SwFrame::FindFootnoteFrame()
1090 return IsInFootnote() ? ImplFindFootnoteFrame() : nullptr;
1092 inline SwFlyFrame
*SwFrame::FindFlyFrame()
1094 return IsInFly() ? ImplFindFlyFrame() : nullptr;
1096 inline SwSectionFrame
*SwFrame::FindSctFrame()
1098 return IsInSct() ? ImplFindSctFrame() : nullptr;
1101 inline const SwBodyFrame
*SwFrame::FindBodyFrame() const
1103 return IsInDocBody() ? ImplFindBodyFrame() : nullptr;
1106 inline const SwTabFrame
*SwFrame::FindTabFrame() const
1108 return IsInTab() ? const_cast<SwFrame
*>(this)->ImplFindTabFrame() : nullptr;
1110 inline const SwFootnoteFrame
*SwFrame::FindFootnoteFrame() const
1112 return IsInFootnote() ? const_cast<SwFrame
*>(this)->ImplFindFootnoteFrame() : nullptr;
1114 inline const SwFlyFrame
*SwFrame::FindFlyFrame() const
1116 return IsInFly() ? const_cast<SwFrame
*>(this)->ImplFindFlyFrame() : nullptr;
1118 inline const SwSectionFrame
*SwFrame::FindSctFrame() const
1120 return IsInSct() ? const_cast<SwFrame
*>(this)->ImplFindSctFrame() : nullptr;
1122 inline SwFrame
*SwFrame::FindNext()
1129 inline const SwFrame
*SwFrame::FindNext() const
1134 return const_cast<SwFrame
*>(this)->FindNext_();
1136 inline SwFrame
*SwFrame::FindPrev()
1138 if ( mpPrev
&& !mpPrev
->IsSctFrame() )
1143 inline const SwFrame
*SwFrame::FindPrev() const
1145 if ( mpPrev
&& !mpPrev
->IsSctFrame() )
1148 return const_cast<SwFrame
*>(this)->FindPrev_();
1151 inline bool SwFrame::IsLayoutFrame() const
1153 return bool(GetType() & FRM_LAYOUT
);
1155 inline bool SwFrame::IsRootFrame() const
1157 return mnFrameType
== SwFrameType::Root
;
1159 inline bool SwFrame::IsPageFrame() const
1161 return mnFrameType
== SwFrameType::Page
;
1163 inline bool SwFrame::IsColumnFrame() const
1165 return mnFrameType
== SwFrameType::Column
;
1167 inline bool SwFrame::IsFootnoteBossFrame() const
1169 return bool(GetType() & FRM_FTNBOSS
);
1171 inline bool SwFrame::IsHeaderFrame() const
1173 return mnFrameType
== SwFrameType::Header
;
1175 inline bool SwFrame::IsFooterFrame() const
1177 return mnFrameType
== SwFrameType::Footer
;
1179 inline bool SwFrame::IsFootnoteContFrame() const
1181 return mnFrameType
== SwFrameType::FtnCont
;
1183 inline bool SwFrame::IsFootnoteFrame() const
1185 return mnFrameType
== SwFrameType::Ftn
;
1187 inline bool SwFrame::IsBodyFrame() const
1189 return mnFrameType
== SwFrameType::Body
;
1191 inline bool SwFrame::IsFlyFrame() const
1193 return mnFrameType
== SwFrameType::Fly
;
1195 inline bool SwFrame::IsSctFrame() const
1197 return mnFrameType
== SwFrameType::Section
;
1199 inline bool SwFrame::IsTabFrame() const
1201 return mnFrameType
== SwFrameType::Tab
;
1203 inline bool SwFrame::IsRowFrame() const
1205 return mnFrameType
== SwFrameType::Row
;
1207 inline bool SwFrame::IsCellFrame() const
1209 return mnFrameType
== SwFrameType::Cell
;
1211 inline bool SwFrame::IsContentFrame() const
1213 return bool(GetType() & FRM_CNTNT
);
1215 inline bool SwFrame::IsTextFrame() const
1217 return mnFrameType
== SwFrameType::Txt
;
1219 inline bool SwFrame::IsNoTextFrame() const
1221 return mnFrameType
== SwFrameType::NoTxt
;
1223 inline bool SwFrame::IsFlowFrame() const
1225 return bool(GetType() & (FRM_CNTNT
|SwFrameType::Tab
|SwFrameType::Section
));
1227 inline bool SwFrame::IsRetoucheFrame() const
1229 return bool(GetType() & (FRM_CNTNT
|SwFrameType::Tab
|SwFrameType::Section
|SwFrameType::Ftn
));
1231 inline bool SwFrame::IsAccessibleFrame() const
1233 return bool(GetType() & FRM_ACCESSIBLE
);
1236 //use this to protect a SwFrame for a given scope from getting deleted
1237 class SwFrameDeleteGuard
1240 SwFrame
*m_pForbidFrame
;
1242 //Flag pFrame for SwFrameDeleteGuard lifetime that we shouldn't delete
1243 //it in e.g. SwSectionFrame::MergeNext etc because we will need it
1244 //again after the SwFrameDeleteGuard dtor
1245 explicit SwFrameDeleteGuard(SwFrame
* pFrame
)
1246 : m_pForbidFrame((pFrame
&& !pFrame
->IsDeleteForbidden()) ?
1250 m_pForbidFrame
->ForbidDelete();
1253 SwFrameDeleteGuard(const SwFrameDeleteGuard
&) =delete;
1255 ~SwFrameDeleteGuard()
1258 m_pForbidFrame
->AllowDelete();
1261 SwFrameDeleteGuard
& operator=(const SwFrameDeleteGuard
&) =delete;
1264 typedef tools::Long (SwFrame::*SwFrameGet
)() const;
1265 typedef bool (SwFrame::*SwFrameMax
)( tools::Long
);
1266 typedef void (SwFrame::*SwFrameMakePos
)( const SwFrame
*, const SwFrame
*, bool );
1267 typedef tools::Long (*SwOperator
)( tools::Long
, tools::Long
);
1268 typedef void (SwFrame::*SwFrameSet
)( tools::Long
, tools::Long
);
1270 struct SwRectFnCollection
1273 SwRectGet fnGetBottom
;
1274 SwRectGet fnGetLeft
;
1275 SwRectGet fnGetRight
;
1276 SwRectGet fnGetWidth
;
1277 SwRectGet fnGetHeight
;
1278 SwRectPoint fnGetPos
;
1279 SwRectSize fnGetSize
;
1282 SwRectSet fnSetBottom
;
1283 SwRectSet fnSetLeft
;
1284 SwRectSet fnSetRight
;
1285 SwRectSet fnSetWidth
;
1286 SwRectSet fnSetHeight
;
1289 SwRectSet fnAddBottom
;
1290 SwRectSet fnSubLeft
;
1291 SwRectSet fnAddRight
;
1292 SwRectSet fnAddWidth
;
1293 SwRectSet fnAddHeight
;
1295 SwRectSet fnSetPosX
;
1296 SwRectSet fnSetPosY
;
1298 SwFrameGet fnGetTopMargin
;
1299 SwFrameGet fnGetBottomMargin
;
1300 SwFrameGet fnGetLeftMargin
;
1301 SwFrameGet fnGetRightMargin
;
1302 SwFrameSet fnSetXMargins
;
1303 SwFrameSet fnSetYMargins
;
1304 SwFrameGet fnGetPrtTop
;
1305 SwFrameGet fnGetPrtBottom
;
1306 SwFrameGet fnGetPrtLeft
;
1307 SwFrameGet fnGetPrtRight
;
1308 SwRectDist fnTopDist
;
1309 SwRectDist fnBottomDist
;
1310 SwRectDist fnLeftDist
;
1311 SwRectDist fnRightDist
;
1312 SwFrameMax fnSetLimit
;
1313 SwRectMax fnOverStep
;
1315 SwRectSetPos fnSetPos
;
1316 SwFrameMakePos fnMakePos
;
1322 SwRectSetTwice fnSetLeftAndWidth
;
1323 SwRectSetTwice fnSetTopAndHeight
;
1326 typedef SwRectFnCollection
* SwRectFn
;
1328 // This class allows to use proper methods regardless of orientation (LTR/RTL, horizontal or vertical)
1329 extern SwRectFn fnRectHori
, fnRectVert
, fnRectVertL2R
, fnRectVertL2RB2T
;
1332 explicit SwRectFnSet(const SwFrame
*pFrame
)
1333 : m_bVert(pFrame
->IsVertical())
1334 , m_bVertL2R(pFrame
->IsVertLR())
1335 , m_bVertL2RB2T(pFrame
->IsVertLRBT())
1337 m_fnRect
= m_bVert
? (m_bVertL2R
? (m_bVertL2RB2T
? fnRectVertL2RB2T
: fnRectVertL2R
) : fnRectVert
) : fnRectHori
;
1340 void Refresh(const SwFrame
*pFrame
)
1342 m_bVert
= pFrame
->IsVertical();
1343 m_bVertL2R
= pFrame
->IsVertLR();
1344 m_bVertL2RB2T
= pFrame
->IsVertLRBT();
1345 m_fnRect
= m_bVert
? (m_bVertL2R
? (m_bVertL2RB2T
? fnRectVertL2RB2T
: fnRectVertL2R
) : fnRectVert
) : fnRectHori
;
1348 bool IsVert() const { return m_bVert
; }
1349 bool IsVertL2R() const { return m_bVertL2R
; }
1350 SwRectFn
FnRect() const { return m_fnRect
; }
1352 bool PosDiff(const SwRect
&rRect1
, const SwRect
&rRect2
) const
1354 return ((rRect1
.*m_fnRect
->fnGetTop
)() != (rRect2
.*m_fnRect
->fnGetTop
)()
1355 || (rRect1
.*m_fnRect
->fnGetLeft
)() != (rRect2
.*m_fnRect
->fnGetLeft
)());
1358 tools::Long
GetTop (const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetTop
) (); }
1359 tools::Long
GetBottom(const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetBottom
)(); }
1360 tools::Long
GetLeft (const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetLeft
) (); }
1361 tools::Long
GetRight (const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetRight
) (); }
1362 tools::Long
GetWidth (const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetWidth
) (); }
1363 tools::Long
GetHeight(const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetHeight
)(); }
1364 Point
GetPos (const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetPos
) (); }
1365 Size
GetSize (const SwRect
& rRect
) const { return (rRect
.*m_fnRect
->fnGetSize
) (); }
1367 void SetTop (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetTop
) (nNew
); }
1368 void SetBottom(SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetBottom
)(nNew
); }
1369 void SetLeft (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetLeft
) (nNew
); }
1370 void SetRight (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetRight
) (nNew
); }
1371 void SetWidth (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetWidth
) (nNew
); }
1372 void SetHeight(SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetHeight
)(nNew
); }
1374 void SubTop (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSubTop
) (nNew
); }
1375 void AddBottom(SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnAddBottom
)(nNew
); }
1376 void SubLeft (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSubLeft
) (nNew
); }
1377 void AddRight (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnAddRight
) (nNew
); }
1378 void AddWidth (SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnAddWidth
) (nNew
); }
1379 void AddHeight(SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnAddHeight
)(nNew
); }
1381 void SetPosX(SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetPosX
)(nNew
); }
1382 void SetPosY(SwRect
& rRect
, tools::Long nNew
) const { (rRect
.*m_fnRect
->fnSetPosY
)(nNew
); }
1384 tools::Long
GetTopMargin (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetTopMargin
) (); }
1385 tools::Long
GetBottomMargin(const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetBottomMargin
)(); }
1386 tools::Long
GetLeftMargin (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetLeftMargin
) (); }
1387 tools::Long
GetRightMargin (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetRightMargin
) (); }
1388 void SetXMargins(SwFrame
& rFrame
, tools::Long nLeft
, tools::Long nRight
) const { (rFrame
.*m_fnRect
->fnSetXMargins
)(nLeft
, nRight
); }
1389 void SetYMargins(SwFrame
& rFrame
, tools::Long nTop
, tools::Long nBottom
) const { (rFrame
.*m_fnRect
->fnSetYMargins
)(nTop
, nBottom
); }
1390 tools::Long
GetPrtTop (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetPrtTop
) (); }
1391 tools::Long
GetPrtBottom (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetPrtBottom
) (); }
1392 tools::Long
GetPrtLeft (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetPrtLeft
) (); }
1393 tools::Long
GetPrtRight (const SwFrame
& rFrame
) const { return (rFrame
.*m_fnRect
->fnGetPrtRight
) (); }
1394 tools::Long
TopDist (const SwRect
& rRect
, tools::Long nPos
) const { return (rRect
.*m_fnRect
->fnTopDist
) (nPos
); }
1395 tools::Long
BottomDist(const SwRect
& rRect
, tools::Long nPos
) const { return (rRect
.*m_fnRect
->fnBottomDist
) (nPos
); }
1396 tools::Long
LeftDist (const SwRect
& rRect
, tools::Long nPos
) const { return (rRect
.*m_fnRect
->fnLeftDist
) (nPos
); }
1397 tools::Long
RightDist (const SwRect
& rRect
, tools::Long nPos
) const { return (rRect
.*m_fnRect
->fnRightDist
) (nPos
); }
1398 void SetLimit (SwFrame
& rFrame
, tools::Long nNew
) const { (rFrame
.*m_fnRect
->fnSetLimit
) (nNew
); }
1399 bool OverStep (const SwRect
& rRect
, tools::Long nPos
) const { return (rRect
.*m_fnRect
->fnOverStep
) (nPos
); }
1401 void SetPos(SwRect
& rRect
, const Point
& rNew
) const { (rRect
.*m_fnRect
->fnSetPos
)(rNew
); }
1402 void MakePos(SwFrame
& rFrame
, const SwFrame
* pUp
, const SwFrame
* pPrv
, bool bNotify
) const { (rFrame
.*m_fnRect
->fnMakePos
)(pUp
, pPrv
, bNotify
); }
1403 tools::Long
XDiff(tools::Long n1
, tools::Long n2
) const { return (m_fnRect
->fnXDiff
) (n1
, n2
); }
1404 tools::Long
YDiff(tools::Long n1
, tools::Long n2
) const { return (m_fnRect
->fnYDiff
) (n1
, n2
); }
1405 tools::Long
XInc (tools::Long n1
, tools::Long n2
) const { return (m_fnRect
->fnXInc
) (n1
, n2
); }
1406 tools::Long
YInc (tools::Long n1
, tools::Long n2
) const { return (m_fnRect
->fnYInc
) (n1
, n2
); }
1408 void SetLeftAndWidth(SwRect
& rRect
, tools::Long nLeft
, tools::Long nWidth
) const { (rRect
.*m_fnRect
->fnSetLeftAndWidth
)(nLeft
, nWidth
); }
1409 void SetTopAndHeight(SwRect
& rRect
, tools::Long nTop
, tools::Long nHeight
) const { (rRect
.*m_fnRect
->fnSetTopAndHeight
)(nTop
, nHeight
); }
1420 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */