LibreOffice Module sw (master)  1
tabfrm.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_TABFRM_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
21 
22 #include "layfrm.hxx"
23 #include "flowfrm.hxx"
24 
25 class SwTable;
26 class SwBorderAttrs;
27 class SwAttrSetChg;
28 
30 {
31  NONE = 0x00,
32  InvalidatePrt = 0x02,
33  InvalidateIndNextPrt = 0x04,
34  InvalidatePrevPrt = 0x08,
36  InvalidateBrowseWidth = 0x20,
37  InvalidatePos = 0x40,
38  InvalidateNextPos = 0x80,
39 };
40 
41 namespace o3tl {
42  template<> struct typed_flags<SwTabFrameInvFlags> : is_typed_flags<SwTabFrameInvFlags, 0xfe> {};
43 }
44 
46 class SwTabFrame final: public SwLayoutFrame, public SwFlowFrame
47 {
48  friend void CalcContent( SwLayoutFrame *pLay, bool bNoColl );
49 
50  // does the special treatment for Get_[Next|Prev]Leaf()
51  using SwFrame::GetLeaf;
52 
54 
55  bool m_bComplete :1;
56  bool m_bCalcLowers :1;
61  bool m_bLockBackMove :1;
63 
67  bool m_bONECalcLowers :1;
68 
73  bool m_bIsRebuildLastLine :1;
76  // want any notification to the master table
78 
79  bool m_bRestrictTableGrowth :1; // Usually, the table may grow infinitely,
80  // as the table can be split in SwTabFrame::MakeAll
81  // In MakeAll, this flag is set to indicate that
82  // the table may only grow inside its upper. This
83  // is necessary, in order to let the text flow into
84  // the FollowFlowLine
85 
87 
88  // #i26945#
89  bool m_bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
90  // are considered during the calculation
91  // for the minimal cell height.
92  // For the splitting table rows algorithm
93  // we need not to consider floating
94  // screen object for the preparation
95  // of the re-calculation of the
96  // last table row.
97  // #i26945#
98  bool m_bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
99  // indicates, if the floating screen objects fits
100 
102 
108  bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
109  void Join();
110 
111  void UpdateAttr_(
112  const SfxPoolItem*,
114  SwAttrSetChg *pa = nullptr,
115  SwAttrSetChg *pb = nullptr );
116 
117  virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat ) override;
118 
119  virtual void DestroyImpl() override;
120  virtual ~SwTabFrame() override;
121 
122  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
123  virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
124  virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
125  // only changes the Framesize, not the PrtArea size
126  virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
127  virtual const SwTabFrame* DynCastTabFrame() const override { return this; }
128 
129 public:
130  SwTabFrame( SwTable &, SwFrame* ); // calling RegistFlys always after creation _and_pasting!
131  SwTabFrame( SwTabFrame & ); // _only_ for the creation of follows
132 
133  void JoinAndDelFollows(); // for DelFrames of the TableNodes!
134 
135  // calls thr RegistFlys of the rows
136  void RegistFlys();
137 
138  inline const SwTabFrame *GetFollow() const;
139  inline SwTabFrame *GetFollow();
140  SwTabFrame* FindMaster( bool bFirstMaster = false ) const;
141 
142  virtual bool GetInfo( SfxPoolItem &rHint ) const override;
143  virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
144  SwPrintData const*const pPrintData = nullptr ) const override;
145  virtual void CheckDirection( bool bVert ) override;
146 
147  virtual void Cut() override;
148  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
149 
150  virtual bool Prepare( const PrepareHint ePrep = PrepareHint::Clear,
151  const void *pVoid = nullptr, bool bNotify = true ) override;
152 
154  inline const SwFrame *FindLastContentOrTable() const;
156  inline const SwContentFrame *FindLastContent() const;
157 
158  const SwTable *GetTable() const { return m_pTable; }
159  SwTable *GetTable() { return m_pTable; }
160 
161  bool IsComplete() const { return m_bComplete; }
162  void SetComplete() { m_bComplete = true; }
163  void ResetComplete() { m_bComplete = false; }
164 
165  bool IsLowersFormatted() const { return m_bLowersFormatted; }
167 
168  void SetCalcLowers() { m_bCalcLowers = true; } // use rarely
169  void SetResizeHTMLTable() { m_bResizeHTMLTable = true; } // same
171 
172  // Start: New stuff for breaking table rows
173 
174  bool HasFollowFlowLine() const { return m_bHasFollowFlowLine; }
175  void SetFollowFlowLine(bool bNew) { m_bHasFollowFlowLine = bNew; }
176 
177  bool IsRebuildLastLine() const { return m_bIsRebuildLastLine; }
178  void SetRebuildLastLine(bool bNew) { m_bIsRebuildLastLine = bNew; }
179 
181  void SetRestrictTableGrowth( bool bNew ) { m_bRestrictTableGrowth = bNew; }
182 
185 
186  bool IsInRecalcLowerRow() const
187  {
188  return m_bInRecalcLowerRow;
189  }
190  void SetInRecalcLowerRow( bool bNew )
191  {
192  m_bInRecalcLowerRow = bNew;
193  }
194 
195  // #i26945#
197  {
199  }
200  void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
201  {
202  m_bConsiderObjsForMinCellHeight = bConsiderObjsForMinCellHeight;
203  }
204 
205  // #i26945#
206  bool DoesObjsFit() const
207  {
208  return m_bObjsDoesFit;
209  }
210  void SetDoesObjsFit(bool const bObjsDoesFit)
211  {
212  m_bObjsDoesFit = bObjsDoesFit;
213  }
214 
215  bool RemoveFollowFlowLine();
216 
217  // End: New stuff for breaking table rows
218 
219  bool CalcFlyOffsets(
220  SwTwips& rUpper,
221  tools::Long& rLeftOffset,
222  tools::Long& rRightOffset,
223  SwTwips * pSpaceBelowBottom) const;
224 
226 
227  bool IsInHeadline( const SwFrame& rFrame ) const;
229 
230  bool IsLayoutSplitAllowed() const;
231 
232  // #i29550#
233  bool IsCollapsingBorders() const;
234 
235  sal_uInt16 GetBottomLineSize() const;
236 
237  virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
238 };
239 
241 {
242  return const_cast<SwTabFrame*>(this)->FindLastContentOrTable();
243 }
244 
246 {
247  return const_cast<SwTabFrame*>(this)->FindLastContent();
248 }
249 
250 inline const SwTabFrame *SwTabFrame::GetFollow() const
251 {
252  return static_cast<const SwTabFrame*>(SwFlowFrame::GetFollow());
253 }
255 {
256  return static_cast<SwTabFrame*>(SwFlowFrame::GetFollow());
257 }
258 
259 #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
260 
261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual const SwTabFrame * DynCastTabFrame() const override
Definition: tabfrm.hxx:127
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
virtual void Cut() override
Definition: tabfrm.cxx:3689
bool IsLayoutSplitAllowed() const
Definition: tabfrm.cxx:5770
void SetCalcLowers()
Definition: tabfrm.hxx:168
void SetRestrictTableGrowth(bool bNew)
Definition: tabfrm.hxx:181
void SetLowersFormatted(bool b)
Definition: tabfrm.hxx:166
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: tabfrm.cxx:3794
bool DoesObjsFit() const
Definition: tabfrm.hxx:206
void RegistFlys()
Definition: tabfrm.cxx:164
const SwTable * GetTable() const
Definition: tabfrm.hxx:158
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the frame; Frame and PrtArea.
Definition: tabfrm.cxx:2954
long Long
void SetDoesObjsFit(bool const bObjsDoesFit)
Definition: tabfrm.hxx:210
bool IsComplete() const
Definition: tabfrm.hxx:161
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:46
void ResetComplete()
Definition: tabfrm.hxx:163
bool IsCollapsingBorders() const
Definition: tabfrm.cxx:5792
virtual bool GetInfo(SfxPoolItem &rHint) const override
Definition: tabfrm.cxx:3467
void UpdateAttr_(const SfxPoolItem *, const SfxPoolItem *, SwTabFrameInvFlags &, SwAttrSetChg *pa=nullptr, SwAttrSetChg *pb=nullptr)
Definition: tabfrm.cxx:3370
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool m_bIsRebuildLastLine
Means that the first line in the follow.
Definition: tabfrm.hxx:75
bool IsLowersFormatted() const
Definition: tabfrm.hxx:165
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:643
bool Split(const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep)
Split() splits the Frame at the specified position: a Follow is created and constructed and inserted ...
Definition: tabfrm.cxx:1018
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: tabfrm.cxx:3222
void SetResizeHTMLTable()
Definition: tabfrm.hxx:169
void JoinAndDelFollows()
Definition: tabfrm.cxx:154
bool IsConsiderObjsForMinCellHeight() const
Definition: tabfrm.hxx:196
sal_uInt16 GetBottomLineSize() const
Definition: tabfrm.cxx:5777
bool RemoveFollowFlowLine()
Definition: tabfrm.cxx:882
void SetONECalcLowers()
Definition: tabfrm.hxx:170
bool m_bHasFollowFlowLine
Primarily for the StarONE SS The Contents are formatted via Calc() on MakeAll in any case...
Definition: tabfrm.hxx:72
void SetComplete()
Definition: tabfrm.hxx:162
friend void CalcContent(SwLayoutFrame *pLay, bool bNoColl)
Definition: fly.cxx:1410
bool m_bComplete
Definition: tabfrm.hxx:55
SwContentFrame * FindLastContent()
Definition: tabfrm.cxx:3563
void Join()
Definition: tabfrm.cxx:1366
struct _xmlTextWriter * xmlTextWriterPtr
bool IsInRecalcLowerRow() const
Definition: tabfrm.hxx:186
SwFrame * FindLastContentOrTable()
Definition: tabfrm.cxx:3493
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
Definition: tabfrm.cxx:3855
PrepareHint
Definition: swtypes.hxx:194
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:774
void SetFollowFlowLine(bool bNew)
Definition: tabfrm.hxx:175
bool m_bObjsDoesFit
Definition: tabfrm.hxx:98
bool m_bInRecalcLowerRow
Definition: tabfrm.hxx:101
void SetRemoveFollowFlowLinePending(bool bNew)
Definition: tabfrm.hxx:184
bool m_bResizeHTMLTable
The Master took care of the BackMove test.
Definition: tabfrm.hxx:62
SwTabFrameInvFlags
Definition: tabfrm.hxx:29
virtual bool ShouldBwdMoved(SwLayoutFrame *pNewUpper, bool &rReformat) override
Return value defines if the frm needs to be relocated.
Definition: tabfrm.cxx:3577
bool m_bConsiderObjsForMinCellHeight
Definition: tabfrm.hxx:89
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: tabfrm.cxx:1858
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: tabfrm.cxx:3304
bool m_bLowersFormatted
For stability of the content in MakeAll.
Definition: tabfrm.hxx:60
bool m_bRestrictTableGrowth
Means that currently the last line of the.
Definition: tabfrm.hxx:79
tools::Long SwTwips
Definition: swtypes.hxx:52
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:112
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Definition: paintfrm.cxx:4276
void SetInRecalcLowerRow(bool bNew)
Definition: tabfrm.hxx:190
bool m_bLockBackMove
Communication between MakeAll and Layact.
Definition: tabfrm.hxx:61
bool IsRestrictTableGrowth() const
Definition: tabfrm.hxx:180
SwTable * GetTable()
Definition: tabfrm.hxx:159
SwRowFrame * GetFirstNonHeadlineRow() const
Definition: tabfrm.cxx:5737
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
Definition: flowfrm.cxx:843
unsigned char sal_uInt8
bool IsRemoveFollowFlowLinePending() const
Definition: tabfrm.hxx:183
bool m_bCalcLowers
Set entries for Repaint without needing to set the base class' CompletePaint With that we would want ...
Definition: tabfrm.hxx:59
SwTabFrame(SwTable &, SwFrame *)
Definition: tabfrm.cxx:71
void SetRebuildLastLine(bool bNew)
Definition: tabfrm.hxx:178
SwTable * m_pTable
Definition: tabfrm.hxx:53
virtual void DestroyImpl() override
Definition: tabfrm.cxx:141
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:250
bool m_bONECalcLowers
Call the Resize of the HTMLTableLayout in the MakeAll This is an optimization, so that we don't have ...
Definition: tabfrm.hxx:67
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
virtual ~SwTabFrame() override
Definition: tabfrm.cxx:150
bool CalcFlyOffsets(SwTwips &rUpper, tools::Long &rLeftOffset, tools::Long &rRightOffset, SwTwips *pSpaceBelowBottom) const
Calculate the offsets arising because of FlyFrames.
Definition: tabfrm.cxx:2749
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
bool HasFollowFlowLine() const
Definition: tabfrm.hxx:174
void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
Definition: tabfrm.hxx:200
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:434
bool m_bRemoveFollowFlowLinePending
Definition: tabfrm.hxx:86
SwTwips CalcHeightOfFirstContentLine() const
Function to calculate height of first text row.
Definition: tabfrm.cxx:5944
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:28
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5718
bool IsRebuildLastLine() const
Definition: tabfrm.hxx:177