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_CNTFRM_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_CNTFRM_HXX
25 #include "flowfrm.hxx"
34 // implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
35 extern bool GetFrameInPage( const SwContentFrame
*, SwWhichPage
, SwPosPage
, SwPaM
* );
37 enum class SwContentFrameInvFlags
: sal_uInt8
40 SetCompletePaint
= 0x01,
42 InvalidateSize
= 0x04,
43 InvalidateSectPrt
= 0x08,
44 InvalidateNextPrt
= 0x10,
45 InvalidatePrevPrt
= 0x20,
46 InvalidateNextPos
= 0x40,
47 SetNextCompletePaint
= 0x80,
51 template<> struct typed_flags
<SwContentFrameInvFlags
> : is_typed_flags
<SwContentFrameInvFlags
, 0xff> {};
55 * SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and
56 * non-text (e.g. graphic) frames.
58 class SW_DLLPUBLIC SwContentFrame
: public SwFrame
, public SwFlowFrame
60 friend void MakeNxt( SwFrame
*pFrame
, SwFrame
*pNxt
); // calls MakePrtArea
62 // parameter <bObjsInNewUpper> indicates that objects exist in remaining
64 bool WouldFit_( SwTwips nSpace
,
65 SwLayoutFrame
*pNewUpper
,
67 const bool bObjsInNewUpper
);
69 virtual void MakeAll(vcl::RenderContext
* pRenderContext
) override
;
71 void UpdateAttr_( const SfxPoolItem
*, const SfxPoolItem
*, SwContentFrameInvFlags
&,
72 SwAttrSetChg
*pa
= nullptr, SwAttrSetChg
*pb
= nullptr );
74 virtual bool ShouldBwdMoved( SwLayoutFrame
*pNewUpper
, bool& ) override
;
76 const SwContentFrame
* ImplGetNextContentFrame( bool bFwd
) const;
79 void MakePrtArea( const SwBorderAttrs
& );
81 virtual void SwClientNotify(const SwModify
&, const SfxHint
&) override
;
82 virtual SwTwips
ShrinkFrame( SwTwips
, bool bTst
= false, bool bInfo
= false ) override
;
83 virtual SwTwips
GrowFrame ( SwTwips
, bool bTst
= false, bool bInfo
= false ) override
;
85 SwContentFrame( SwContentNode
* const, SwFrame
* );
87 virtual void DestroyImpl() override
;
88 virtual ~SwContentFrame() override
;
92 virtual void Cut() override
;
93 virtual void Paste( SwFrame
* pParent
, SwFrame
* pSibling
= nullptr ) override
;
95 inline const SwContentFrame
*GetFollow() const;
96 inline SwContentFrame
*GetFollow();
97 SwTextFrame
* FindMaster() const;
99 // layout dependent cursor travelling
100 virtual bool LeftMargin(SwPaM
*) const = 0;
101 virtual bool RightMargin(SwPaM
*, bool bAPI
= false) const = 0;
102 virtual bool UnitUp( SwPaM
*, const SwTwips nOffset
,
103 bool bSetInReadOnly
) const;
104 virtual bool UnitDown( SwPaM
*, const SwTwips nOffset
,
105 bool bSetInReadOnly
) const;
107 // nMaxHeight is the required height
108 // bSplit indicates that the paragraph has to be split
109 // bTst indicates that we are currently doing a test formatting
110 virtual bool WouldFit(SwTwips
&nMaxHeight
, bool &bSplit
, bool bTst
, bool);
112 bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrame
* ); // called by MoveFwd if content
114 inline SwContentFrame
* GetNextContentFrame() const;
115 inline SwContentFrame
* GetPrevContentFrame() const;
116 static bool CalcLowers(SwLayoutFrame
& rLay
, SwLayoutFrame
const& rDontLeave
,
117 tools::Long nBottom
, bool bSkipRowSpanCells
);
120 inline SwContentFrame
* SwContentFrame::GetNextContentFrame() const
122 if ( GetNext() && GetNext()->IsContentFrame() )
123 return const_cast<SwContentFrame
*>(static_cast<const SwContentFrame
*>(GetNext()));
125 return const_cast<SwContentFrame
*>(ImplGetNextContentFrame( true ));
128 inline SwContentFrame
* SwContentFrame::GetPrevContentFrame() const
130 if ( GetPrev() && GetPrev()->IsContentFrame() )
131 return const_cast<SwContentFrame
*>(static_cast<const SwContentFrame
*>(GetPrev()));
133 return const_cast<SwContentFrame
*>(ImplGetNextContentFrame( false ));
136 inline const SwContentFrame
*SwContentFrame::GetFollow() const
138 return static_cast<const SwContentFrame
*>(SwFlowFrame::GetFollow());
140 inline SwContentFrame
*SwContentFrame::GetFollow()
142 return static_cast<SwContentFrame
*>(SwFlowFrame::GetFollow());
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */