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 
27 class SwLayoutFrame;
28 class SwContentNode;
29 class SwBorderAttrs;
30 class SwAttrSetChg;
31 class SwTextFrame;
32 
33 // implemented in cntfrm.cxx, used in cntfrm.cxx and crsrsh.cxx
34 extern bool GetFrameInPage( const SwContentFrame*, SwWhichPage, SwPosPage, SwPaM* );
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,
46  SetNextCompletePaint = 0x80,
47 };
48 
49 namespace o3tl {
50  template<> struct typed_flags<SwContentFrameInvFlags> : is_typed_flags<SwContentFrameInvFlags, 0xff> {};
51 }
52 
53 class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, public SwFlowFrame
54 {
55  friend void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ); // calls MakePrtArea
56 
57  // parameter <bObjsInNewUpper> indicates that objects exist in remaining
58  // area of new upper
59  bool WouldFit_( SwTwips nSpace,
60  SwLayoutFrame *pNewUpper,
61  bool bTstMove,
62  const bool bObjsInNewUpper );
63 
64  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
65 
66  void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, SwContentFrameInvFlags &,
67  SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
68 
69  virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool& ) override;
70 
71  const SwContentFrame* ImplGetNextContentFrame( bool bFwd ) const;
72 
73 protected:
74  void MakePrtArea( const SwBorderAttrs & );
75 
76  virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
77  virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
78  virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
79 
81 
82  virtual void DestroyImpl() override;
83  virtual ~SwContentFrame() override;
84 
85 public:
86 
87  virtual void Cut() override;
88  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
89 
90  inline const SwContentFrame *GetFollow() const;
91  inline SwContentFrame *GetFollow();
92  SwTextFrame* FindMaster() const;
93 
94  // layout dependent cursor travelling
95  virtual bool LeftMargin(SwPaM *) const = 0;
96  virtual bool RightMargin(SwPaM *, bool bAPI = false) const = 0;
97  virtual bool UnitUp( SwPaM *, const SwTwips nOffset,
98  bool bSetInReadOnly ) const;
99  virtual bool UnitDown( SwPaM *, const SwTwips nOffset,
100  bool bSetInReadOnly ) const;
101 
102  // nMaxHeight is the required height
103  // bSplit indicates that the paragraph has to be split
104  // bTst indicates that we are currently doing a test formatting
105  virtual bool WouldFit( SwTwips &nMaxHeight, bool &bSplit, bool bTst );
106 
107  bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrame* ); // called by MoveFwd if content
108 
109  inline SwContentFrame* GetNextContentFrame() const;
110  inline SwContentFrame* GetPrevContentFrame() const;
111  static bool CalcLowers(SwLayoutFrame & rLay, SwLayoutFrame const& rDontLeave,
112  tools::Long nBottom, bool bSkipRowSpanCells);
113 };
114 
116 {
117  if ( GetNext() && GetNext()->IsContentFrame() )
118  return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetNext()));
119  else
120  return const_cast<SwContentFrame*>(ImplGetNextContentFrame( true ));
121 }
122 
124 {
125  if ( GetPrev() && GetPrev()->IsContentFrame() )
126  return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetPrev()));
127  else
128  return const_cast<SwContentFrame*>(ImplGetNextContentFrame( false ));
129 }
130 
132 {
133  return static_cast<const SwContentFrame*>(SwFlowFrame::GetFollow());
134 }
136 {
137  return static_cast<SwContentFrame*>(SwFlowFrame::GetFollow());
138 }
139 
140 #endif
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:315
Base class that provides the general functionalities for frames that are allowed at page breaks (flow...
Definition: flowfrm.hxx:58
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:159
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:115
long Long
SwContentFrameInvFlags
Definition: cntfrm.hxx:36
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:371
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:123
virtual void DestroyImpl()
Definition: ssfrm.cxx:326
virtual void Cut()=0
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
bool IsContentFrame() const
Definition: frame.hxx:1231
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:131
virtual bool ShouldBwdMoved(SwLayoutFrame *pNewUpper, bool &rReformat)=0
SwLayoutFrame *(* SwWhichPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:34
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:474
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
SwFrame * GetPrev()
Definition: frame.hxx:678
tools::Long SwTwips
Definition: swtypes.hxx:52
void MakeNxt(SwFrame *pFrame, SwFrame *pNxt)
Definition: calcmove.cxx:1921
SwContentFrame *(* SwPosPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:38
unsigned char sal_uInt8
bool GetFrameInPage(const SwContentFrame *, SwWhichPage, SwPosPage, SwPaM *)
Returns the first/last Contentframe (controlled using the parameter fnPosPage) of the current/previou...
Definition: trvlfrm.cxx:1094
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
SwFrame * GetNext()
Definition: frame.hxx:677