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 
36 {
37  // The SwFrame in disguise
38  friend class SwFlowFrame;
39  friend class SwFrame;
40 
41  // Releases the Lower while restructuring columns
42  friend SwFrame* SaveContent( SwLayoutFrame *, SwFrame * );
43  friend void RestoreContent( SwFrame *, SwLayoutFrame *, SwFrame *pSibling );
44 
45 protected:
46 
47  virtual void DestroyImpl() override;
48  virtual ~SwLayoutFrame() override;
49 
50  virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
51  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
52 
54  std::vector<SwAnchoredObject*> m_VertPosOrientFramesFor;
55 
56  virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
57  virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
58 
59  long CalcRel( const SwFormatFrameSize &rSz ) const;
60 
61 public:
62  // --> #i28701#
63 
64  virtual void PaintSubsidiaryLines( const SwPageFrame*, const SwRect& ) const;
65  void RefreshLaySubsidiary( const SwPageFrame*, const SwRect& ) const;
66  void RefreshExtraData( const SwRect & ) const;
67 
69  void ChgLowersProp( const Size& rOldSize );
70 
71  void AdjustColumns( const SwFormatCol *pCol, bool bAdjustAttributes );
72 
73  void ChgColumns( const SwFormatCol &rOld, const SwFormatCol &rNew,
74  const bool bChgFootnote = false );
75 
77  void PaintColLines( const SwRect &, const SwFormatCol &,
78  const SwPageFrame * ) const;
79 
80  virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const override;
81 
82  virtual bool GetCursorOfst( SwPosition *, Point&,
83  SwCursorMoveState* = nullptr, bool bTestBackground = false ) const override;
84 
85  virtual void Cut() override;
86  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
87 
92  const SwContentFrame* GetContentPos( Point &rPoint, const bool bDontLeave,
93  const bool bBodyOnly = false,
94  SwCursorMoveState *pCMS = nullptr,
95  const bool bDefaultExpand = true ) const;
96 
98 
99  virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
100  SwPrintData const*const pPrintData = nullptr ) const override;
101  const SwFrame *Lower() const { return m_pLower; }
102  SwFrame *Lower() { return m_pLower; }
103  const SwContentFrame *ContainsContent() const;
104  inline SwContentFrame *ContainsContent();
105  const SwCellFrame *FirstCell() const;
106  inline SwCellFrame *FirstCell();
107 
115  const SwFrame *ContainsAny( const bool _bInvestigateFootnoteForSections = false ) const;
116  inline SwFrame *ContainsAny( const bool _bInvestigateFootnoteForSections = false );
117  bool IsAnLower( const SwFrame * ) const;
118 
119  virtual const SwFrameFormat *GetFormat() const;
120  virtual SwFrameFormat *GetFormat();
121  void SetFrameFormat( SwFrameFormat* );
122 
129  bool MoveLowerFootnotes( SwContentFrame *pStart, SwFootnoteBossFrame *pOldBoss,
130  SwFootnoteBossFrame *pNewBoss, const bool bFootnoteNums );
131 
132  // --> #i28701# - change purpose of method and its name
133  // --> #i44016# - add parameter <_bUnlockPosOfObjs> to
135  void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
136 
142  void InvaPercentLowers( SwTwips nDiff = 0 );
143 
145  void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
146  const SwTwips nMinHeight );
147 
152  SwTwips InnerHeight() const;
153 
166  bool IsBefore( const SwLayoutFrame* _pCheckRefLayFrame ) const;
167 
168  const SwFrame* GetLastLower() const;
169  inline SwFrame* GetLastLower();
170 
171  virtual void PaintBreak() const;
172 
174  {
175  m_VertPosOrientFramesFor.push_back(pObj);
176  }
177 
179  {
180  m_VertPosOrientFramesFor.erase(
181  std::remove(m_VertPosOrientFramesFor.begin(),
182  m_VertPosOrientFramesFor.end(), pObj),
183  m_VertPosOrientFramesFor.end());
184  }
185 };
186 
192 {
193  return const_cast<SwContentFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsContent());
194 }
195 
197 {
198  return const_cast<SwCellFrame*>(static_cast<const SwLayoutFrame*>(this)->FirstCell());
199 }
200 
201 inline SwFrame* SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSections )
202 {
203  return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->ContainsAny( _bInvestigateFootnoteForSections ));
204 }
205 
209 inline bool SwFrame::IsColBodyFrame() const
210 {
212 }
213 
214 inline bool SwFrame::IsPageBodyFrame() const
215 {
217 }
218 
220 {
221  return const_cast<SwFrame*>(static_cast<const SwLayoutFrame*>(this)->GetLastLower());
222 }
223 
224 #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
225 
226 /* 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:2781
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:173
wrapper class for the positioning of Writer fly frames and drawing objects
bool IsPageBodyFrame() const
Definition: layfrm.hxx:214
virtual bool FillSelection(SwSelectionList &rList, const SwRect &rRect) const
Definition: unusedf.cxx:40
void ClearVertPosOrientFrameFor(SwAnchoredObject *pObj)
Definition: layfrm.hxx:178
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:2618
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:54
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:53
const SwFrame * Lower() const
Definition: layfrm.hxx:101
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:209
SwFrameType mnFrameType
Definition: frame.hxx:395
bool IsPageFrame() const
Definition: frame.hxx:1154
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
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:102