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 <swdllapi.h>
24#include "frame.hxx"
25#include "flowfrm.hxx"
26#include <cshtyp.hxx>
27
28class SwLayoutFrame;
29class SwContentNode;
30class SwBorderAttrs;
31class SwAttrSetChg;
32class SwTextFrame;
33
34// implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
36
38{
39 NONE = 0x00,
40 SetCompletePaint = 0x01,
41 InvalidatePos = 0x02,
42 InvalidateSize = 0x04,
43 InvalidateSectPrt = 0x08,
44 InvalidateNextPrt = 0x10,
45 InvalidatePrevPrt = 0x20,
46 InvalidateNextPos = 0x40,
48};
49
50namespace o3tl {
51 template<> struct typed_flags<SwContentFrameInvFlags> : is_typed_flags<SwContentFrameInvFlags, 0xff> {};
52}
53
58class SW_DLLPUBLIC SwContentFrame: public SwFrame, public SwFlowFrame
59{
60 friend void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ); // calls MakePrtArea
61
62 // parameter <bObjsInNewUpper> indicates that objects exist in remaining
63 // area of new upper
64 bool WouldFit_( SwTwips nSpace,
65 SwLayoutFrame *pNewUpper,
66 bool bTstMove,
67 const bool bObjsInNewUpper );
68
69 virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
70
71 void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwContentFrameInvFlags &,
72 SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
73
74 virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool& ) override;
75
76 const SwContentFrame* ImplGetNextContentFrame( bool bFwd ) const;
77
78protected:
79 void MakePrtArea( const SwBorderAttrs & );
80
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;
84
86
87 virtual void DestroyImpl() override;
88 virtual ~SwContentFrame() override;
89
90public:
91
92 virtual void Cut() override;
93 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
94
95 inline const SwContentFrame *GetFollow() const;
96 inline SwContentFrame *GetFollow();
97 SwTextFrame* FindMaster() const;
98
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;
106
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);
111
112 bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrame* ); // called by MoveFwd if content
113
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);
118};
119
121{
122 if ( GetNext() && GetNext()->IsContentFrame() )
123 return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetNext()));
124 else
125 return const_cast<SwContentFrame*>(ImplGetNextContentFrame( true ));
126}
127
129{
130 if ( GetPrev() && GetPrev()->IsContentFrame() )
131 return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetPrev()));
132 else
133 return const_cast<SwContentFrame*>(ImplGetNextContentFrame( false ));
134}
135
137{
138 return static_cast<const SwContentFrame*>(SwFlowFrame::GetFollow());
139}
141{
142 return static_cast<SwContentFrame*>(SwFlowFrame::GetFollow());
143}
144
145#endif
146
147/* 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:59
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:128
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:136
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:426
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:120
virtual bool LeftMargin(SwPaM *) const =0
virtual bool RightMargin(SwPaM *, bool bAPI=false) const =0
Base class of the Writer layout elements.
Definition: frame.hxx:315
virtual void Cut()=0
virtual void DestroyImpl()
Definition: ssfrm.cxx:329
SwFrame * GetNext()
Definition: frame.hxx:682
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
void InvalidateNextPos(bool bNoFootnote=false)
Definition: frame.hxx:1078
friend void MakeNxt(SwFrame *pFrame, SwFrame *pNxt)
Definition: calcmove.cxx:1902
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:482
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
void InvalidatePos()
Definition: frame.hxx:1049
void SetCompletePaint() const
Definition: frame.hxx:1000
bool IsContentFrame() const
Definition: frame.hxx:1236
SwFrame * GetPrev()
Definition: frame.hxx:683
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
void InvalidateSize()
Definition: frame.hxx:1035
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:188
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwContentFrameInvFlags
Definition: cntfrm.hxx:38
bool GetFrameInPage(const SwContentFrame *, SwWhichPage, SwPosPage, SwPaM *)
Returns the first/last Contentframe (controlled using the parameter fnPosPage) of the current/previou...
Definition: trvlfrm.cxx:1091
SwLayoutFrame *(* SwWhichPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:34
SwContentFrame *(* SwPosPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:38
NONE
long Long
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
tools::Long SwTwips
Definition: swtypes.hxx:51
unsigned char sal_uInt8