LibreOffice Module sw (master)  1
layfrm.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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
21 
22 #include "frame.hxx"
23 #include <swdllapi.h>
24 
25 class SwAnchoredObject;
26 class SwContentFrame;
27 class SwFormatCol;
28 struct SwCursorMoveState;
29 class SwFrameFormat;
30 class SwBorderAttrs;
31 class SwFormatFrameSize;
32 class SwCellFrame;
33 
35 {
36  // The SwFrame in disguise
37  friend class SwFlowFrame;
38  friend class SwFrame;
39 
40  // Releases the Lower while restructuring columns
41  friend SwFrame* SaveContent( SwLayoutFrame *, SwFrame * );
42  friend void RestoreContent( SwFrame *, SwLayoutFrame *, SwFrame *pSibling );
43 
44 protected:
45 
46  virtual void DestroyImpl() override;
47  virtual ~SwLayoutFrame() override;
48 
49  virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
50  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
51 
53  std::vector<SwAnchoredObject*> m_VertPosOrientFramesFor;
54 
55  virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
56  virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
57 
58  long CalcRel( const SwFormatFrameSize &rSz ) const;
59 
60 public:
61  // --> #i28701#
62 
63  virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const;
64  void RefreshLaySubsidiary( const SwPageFrame*, const SwRect& ) const;
65  void RefreshExtraData( const SwRect & ) const;
66 
68  void ChgLowersProp( const Size& rOldSize );
69 
70  void AdjustColumns( const SwFormatCol *pCol, bool bAdjustAttributes );
71 
72  void ChgColumns( const SwFormatCol &rOld, const SwFormatCol &rNew,
73  const bool bChgFootnote = false );
74 
76  void PaintColLines( const SwRect &, const SwFormatCol &,
77  const SwPageFrame * ) const;
78 
79  virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const override;
80 
81  virtual bool GetCursorOfst( SwPosition *, Point&,
82  SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
83 
84  virtual void Cut() override;
85  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
86 
91  const SwContentFrame* GetContentPos( Point &rPoint, const bool bDontLeave,
92  const bool bBodyOnly = false,
93  SwCursorMoveState *pCMS = nullptr,
94  const bool bDefaultExpand = true ) const;
95 
97 
98  virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
99  SwPrintData const*const pPrintData = nullptr ) const override;
100  const SwFrame *Lower() const { return m_pLower; }
101  SwFrame *Lower() { return m_pLower; }
102  const SwContentFrame *ContainsContent() const;
103  inline SwContentFrame *ContainsContent();
104  const SwCellFrame *FirstCell() const;
105  inline SwCellFrame *FirstCell();
106 
114  const SwFrame *ContainsAny( const bool _bInvestigateFootnoteForSections = false ) const;
115  inline SwFrame *ContainsAny( const bool _bInvestigateFootnoteForSections = false );
116  bool IsAnLower( const SwFrame * ) const;
117 
118  virtual const SwFrameFormat *GetFormat() const;
119  virtual SwFrameFormat *GetFormat();
120  void SetFrameFormat( SwFrameFormat* );
121 
128  bool MoveLowerFootnotes( SwContentFrame *pStart, SwFootnoteBossFrame *pOldBoss,
129  SwFootnoteBossFrame *pNewBoss, const bool bFootnoteNums );
130 
131  // --> #i28701# - change purpose of method and its name
132  // --> #i44016# - add parameter <_bUnlockPosOfObjs> to
134  void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
135 
141  void InvaPercentLowers( SwTwips nDiff = 0 );
142 
144  void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
145  const SwTwips nMinHeight );
146 
151  SwTwips InnerHeight() const;
152 
165  bool IsBefore( const SwLayoutFrame* _pCheckRefLayFrame ) const;
166 
167  const SwFrame* GetLastLower() const;
168  inline SwFrame* GetLastLower();
169 
170  virtual void PaintBreak() const;
171 
173  {
174  m_VertPosOrientFramesFor.push_back(pObj);
175  }
176 
178  {
179  m_VertPosOrientFramesFor.erase(
180  std::remove(m_VertPosOrientFramesFor.begin(),
181  m_VertPosOrientFramesFor.end(), pObj),
182  m_VertPosOrientFramesFor.end());
183  }
184 };
185 
191 {
192  return const_cast<SwContentFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsContent());
193 }
194 
196 {
197  return const_cast<SwCellFrame*>(static_cast<const SwLayoutFrame*>(this)->FirstCell());
198 }
199 
200 inline SwFrame* SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSections )
201 {
202  return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsAny( _bInvestigateFootnoteForSections ));
203 }
204 
208 inline bool SwFrame::IsColBodyFrame() const
209 {
211 }
212 
213 inline bool SwFrame::IsPageBodyFrame() const
214 {
216 }
217 
219 {
220  return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->GetLastLower());
221 }
222 
223 #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
224 
225 /* 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
friend void RestoreContent(SwFrame *, SwLayoutFrame *, SwFrame *pSibling)
Definition: frmtool.cxx:2782
Marks a position in the document model.
Definition: pam.hxx:35
virtual void MakeAll(vcl::RenderContext *pRenderContext)=0
long SwTwips
Definition: swtypes.hxx:49
This class is used as parameter for creation of a block cursor selection.
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void SetVertPosOrientFrameFor(SwAnchoredObject *pObj)
Definition: layfrm.hxx:172
wrapper class for the positioning of Writer fly frames and drawing objects
bool IsPageBodyFrame() const
Definition: layfrm.hxx:213
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const
Definition: unusedf.cxx:40
void ClearVertPosOrientFrameFor(SwAnchoredObject *pObj)
Definition: layfrm.hxx:177
virtual void DestroyImpl()
Definition: ssfrm.cxx:324
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
friend SwFrame * SaveContent(SwLayoutFrame *, SwFrame *pStart)
Definition: frmtool.cxx:2619
virtual void Cut()=0
bool IsColumnFrame() const
Definition: frame.hxx:1158
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
Style of a layout element.
Definition: frmfmt.hxx:57
std::vector< SwAnchoredObject * > m_VertPosOrientFramesFor
Definition: layfrm.hxx:53
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1817
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const
Definition: unusedf.cxx:29
SwFrame * m_pLower
Definition: layfrm.hxx:52
const SwFrame * Lower() const
Definition: layfrm.hxx:100
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr)
Definition: unusedf.cxx:24
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
friend class SwLayoutFrame
Definition: frame.hxx:299
A page of the document layout.
Definition: pagefrm.hxx:40
virtual bool GetCursorOfst(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const
Definition: unusedf.cxx:46
const SwCellFrame * FirstCell() const
Calls ContainsAny first to reach the innermost cell.
Definition: findfrm.cxx:112
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:125
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm.hxx.
Definition: layfrm.hxx:208
SwFrameType mnFrameType
Definition: frame.hxx:395
bool IsPageFrame() const
Definition: frame.hxx:1154
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:66
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
SwFrame * Lower()
Definition: layfrm.hxx:101