LibreOffice Module sw (master) 1
cntfrm.hxx
Go to the documentation of this file.
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_CNTFRM_HXX
21#define INCLUDED_SW_SOURCE_CORE_INC_CNTFRM_HXX
22
23#include "frame.hxx"
24#include "flowfrm.hxx"
25#include <cshtyp.hxx>
26
27class SwLayoutFrame;
28class SwContentNode;
29class SwBorderAttrs;
30class SwAttrSetChg;
31class SwTextFrame;
32
33// implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
35
37{
38 NONE = 0x00,
39 SetCompletePaint = 0x01,
40 InvalidatePos = 0x02,
41 InvalidateSize = 0x04,
42 InvalidateSectPrt = 0x08,
43 InvalidateNextPrt = 0x10,
44 InvalidatePrevPrt = 0x20,
45 InvalidateNextPos = 0x40,
47};
48
49namespace o3tl {
50 template<> struct typed_flags<SwContentFrameInvFlags> : is_typed_flags<SwContentFrameInvFlags, 0xff> {};
51}
52
57class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, public SwFlowFrame
58{
59 friend void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ); // calls MakePrtArea
60
61 // parameter <bObjsInNewUpper> indicates that objects exist in remaining
62 // area of new upper
63 bool WouldFit_( SwTwips nSpace,
64 SwLayoutFrame *pNewUpper,
65 bool bTstMove,
66 const bool bObjsInNewUpper );
67
68 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
69
70 void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwContentFrameInvFlags &,
71 SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
72
73 virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool& ) override;
74
75 const SwContentFrame* ImplGetNextContentFrame( bool bFwd ) const;
76
77protected:
78 void MakePrtArea( const SwBorderAttrs & );
79
80 virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
81 virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
82 virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
83
85
86 virtual void DestroyImpl() override;
87 virtual ~SwContentFrame() override;
88
89public:
90
91 virtual void Cut() override;
92 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
93
94 inline const SwContentFrame *GetFollow() const;
95 inline SwContentFrame *GetFollow();
96 SwTextFrame* FindMaster() const;
97
98 // layout dependent cursor travelling
99 virtual bool LeftMargin(SwPaM *) const = 0;
100 virtual bool RightMargin(SwPaM *, bool bAPI = false) const = 0;
101 virtual bool UnitUp( SwPaM *, const SwTwips nOffset,
102 bool bSetInReadOnly ) const;
103 virtual bool UnitDown( SwPaM *, const SwTwips nOffset,
104 bool bSetInReadOnly ) const;
105
106 // nMaxHeight is the required height
107 // bSplit indicates that the paragraph has to be split
108 // bTst indicates that we are currently doing a test formatting
109 virtual bool WouldFit( SwTwips &nMaxHeight, bool &bSplit, bool bTst );
110
111 bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrame* ); // called by MoveFwd if content
112
113 inline SwContentFrame* GetNextContentFrame() const;
114 inline SwContentFrame* GetPrevContentFrame() const;
115 static bool CalcLowers(SwLayoutFrame & rLay, SwLayoutFrame const& rDontLeave,
116 tools::Long nBottom, bool bSkipRowSpanCells);
117};
118
120{
121 if ( GetNext() && GetNext()->IsContentFrame() )
122 return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetNext()));
123 else
124 return const_cast<SwContentFrame*>(ImplGetNextContentFrame( true ));
125}
126
128{
129 if ( GetPrev() && GetPrev()->IsContentFrame() )
130 return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetPrev()));
131 else
132 return const_cast<SwContentFrame*>(ImplGetNextContentFrame( false ));
133}
134
136{
137 return static_cast<const SwContentFrame*>(SwFlowFrame::GetFollow());
138}
140{
141 return static_cast<SwContentFrame*>(SwFlowFrame::GetFollow());
142}
143
144#endif
145
146/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:127
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:135
const SwContentFrame * ImplGetNextContentFrame(bool bFwd) const
Walk back inside the tree: grab the subordinate Frame if one exists and the last step was not moving ...
Definition: findfrm.cxx:395
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:119
virtual bool LeftMargin(SwPaM *) const =0
virtual bool RightMargin(SwPaM *, bool bAPI=false) const =0
Base class that provides the general functionalities for frames that are allowed at page breaks (flow...
Definition: flowfrm.hxx:60
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:169
virtual bool ShouldBwdMoved(SwLayoutFrame *pNewUpper, bool &rReformat)=0
Base class of the Writer layout elements.
Definition: frame.hxx:315
virtual void Cut()=0
virtual void DestroyImpl()
Definition: ssfrm.cxx:328
SwFrame * GetNext()
Definition: frame.hxx:676
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
void InvalidateNextPos(bool bNoFootnote=false)
Definition: frame.hxx:1072
friend void MakeNxt(SwFrame *pFrame, SwFrame *pNxt)
Definition: calcmove.cxx:1912
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:480
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
void InvalidatePos()
Definition: frame.hxx:1043
void SetCompletePaint() const
Definition: frame.hxx:994
bool IsContentFrame() const
Definition: frame.hxx:1230
SwFrame * GetPrev()
Definition: frame.hxx:677
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
void InvalidateSize()
Definition: frame.hxx:1029
virtual void MakeAll(vcl::RenderContext *pRenderContext)=0
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:165
SwContentFrameInvFlags
Definition: cntfrm.hxx:37
bool GetFrameInPage(const SwContentFrame *, SwWhichPage, SwPosPage, SwPaM *)
Returns the first/last Contentframe (controlled using the parameter fnPosPage) of the current/previou...
Definition: trvlfrm.cxx:1090
SwLayoutFrame *(* SwWhichPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:34
SwContentFrame *(* SwPosPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:38
NONE
long Long
tools::Long SwTwips
Definition: swtypes.hxx:51
unsigned char sal_uInt8