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 
36 class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, public SwFlowFrame
37 {
38  friend void MakeNxt( SwFrame *pFrame, SwFrame *pNxt ); // calls MakePrtArea
39 
40  // parameter <bObjsInNewUpper> indicates that objects exist in remaining
41  // area of new upper
42  bool WouldFit_( SwTwips nSpace,
43  SwLayoutFrame *pNewUpper,
44  bool bTstMove,
45  const bool bObjsInNewUpper );
46 
47  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
48 
49  void UpdateAttr_( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
50  SwAttrSetChg *pa = nullptr, SwAttrSetChg *pb = nullptr );
51 
52  virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool& ) override;
53 
54  const SwContentFrame* ImplGetNextContentFrame( bool bFwd ) const;
55 
56 protected:
57  void MakePrtArea( const SwBorderAttrs & );
58 
59  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
60  virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
61  virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
62 
64 
65  virtual void DestroyImpl() override;
66  virtual ~SwContentFrame() override;
67 
68 public:
69 
70  virtual void Cut() override;
71  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
72 
73  inline const SwContentFrame *GetFollow() const;
74  inline SwContentFrame *GetFollow();
75  SwTextFrame* FindMaster() const;
76 
77  // layout dependent cursor travelling
78  virtual bool LeftMargin(SwPaM *) const = 0;
79  virtual bool RightMargin(SwPaM *, bool bAPI = false) const = 0;
80  virtual bool UnitUp( SwPaM *, const SwTwips nOffset,
81  bool bSetInReadOnly ) const;
82  virtual bool UnitDown( SwPaM *, const SwTwips nOffset,
83  bool bSetInReadOnly ) const;
84 
85  // nMaxHeight is the required height
86  // bSplit indicates that the paragraph has to be split
87  // bTst indicates that we are currently doing a test formatting
88  virtual bool WouldFit( SwTwips &nMaxHeight, bool &bSplit, bool bTst );
89 
90  bool MoveFootnoteCntFwd( bool, SwFootnoteBossFrame* ); // called by MoveFwd if content
91 
92  inline SwContentFrame* GetNextContentFrame() const;
93  inline SwContentFrame* GetPrevContentFrame() const;
94  static bool CalcLowers(SwLayoutFrame & rLay, SwLayoutFrame const& rDontLeave,
95  long nBottom, bool bSkipRowSpanCells);
96 };
97 
99 {
100  if ( GetNext() && GetNext()->IsContentFrame() )
101  return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetNext()));
102  else
103  return const_cast<SwContentFrame*>(ImplGetNextContentFrame( true ));
104 }
105 
107 {
108  if ( GetPrev() && GetPrev()->IsContentFrame() )
109  return const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetPrev()));
110  else
111  return const_cast<SwContentFrame*>(ImplGetNextContentFrame( false ));
112 }
113 
115 {
116  return static_cast<const SwContentFrame*>(SwFlowFrame::GetFollow());
117 }
119 {
120  return static_cast<SwContentFrame*>(SwFlowFrame::GetFollow());
121 }
122 
123 #endif
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:295
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:149
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:98
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: wsfrm.cxx:474
long SwTwips
Definition: swtypes.hxx:49
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:370
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:106
virtual void DestroyImpl()
Definition: ssfrm.cxx:324
virtual void Cut()=0
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
bool IsContentFrame() const
Definition: frame.hxx:1206
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:114
virtual bool ShouldBwdMoved(SwLayoutFrame *pNewUpper, bool &rReformat)=0
SwLayoutFrame *(* SwWhichPage)(const SwLayoutFrame *)
Definition: cshtyp.hxx:34
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
SwFrame * GetPrev()
Definition: frame.hxx:655
void MakeNxt(SwFrame *pFrame, SwFrame *pNxt)
Definition: calcmove.cxx:1915
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:1089
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
SwFrame * GetNext()
Definition: frame.hxx:654