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 class SwTabFrame: public SwLayoutFrame, public SwFlowFrame
31 {
32  friend void CalcContent( SwLayoutFrame *pLay, bool bNoColl );
33 
34  // does the special treatment for Get_[Next|Prev]Leaf()
35  using SwFrame::GetLeaf;
36 
38 
39  bool m_bComplete :1;
40  bool m_bCalcLowers :1;
45  bool m_bLockBackMove :1;
47 
51  bool m_bONECalcLowers :1;
52 
57  bool m_bIsRebuildLastLine :1;
60  // want any notification to the master table
62 
63  bool m_bRestrictTableGrowth :1; // Usually, the table may grow infinitely,
64  // as the table can be split in SwTabFrame::MakeAll
65  // In MakeAll, this flag is set to indicate that
66  // the table may only grow inside its upper. This
67  // is necessary, in order to let the text flow into
68  // the FollowFlowLine
69 
71 
72  // #i26945#
73  bool m_bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
74  // are considered during the calculation
75  // for the minimal cell height.
76  // For the splitting table rows algorithm
77  // we need not to consider floating
78  // screen object for the preparation
79  // of the re-calculation of the
80  // last table row.
81  // #i26945#
82  bool m_bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
83  // indicates, if the floating screen objects fits
84 
86 
87  bool m_bSplitRowDisabled : 1; // loop control
88 
94  bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
95  void Join();
96 
97  void UpdateAttr_(
98  const SfxPoolItem*,
99  const SfxPoolItem*, sal_uInt8 &,
100  SwAttrSetChg *pa = nullptr,
101  SwAttrSetChg *pb = nullptr );
102 
103  virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool bHead, bool &rReformat ) override;
104 
105  virtual void DestroyImpl() override;
106  virtual ~SwTabFrame() override;
107 
108 protected:
109  virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
110  virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
111  virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
112  // only changes the Framesize, not the PrtArea size
113  virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
114 
115 public:
116  SwTabFrame( SwTable &, SwFrame* ); // calling RegistFlys always after creation _and_pasting!
117  SwTabFrame( SwTabFrame & ); // _only_ for the creation of follows
118 
119  void JoinAndDelFollows(); // for DelFrames of the TableNodes!
120 
121  // calls thr RegistFlys of the rows
122  void RegistFlys();
123 
124  inline const SwTabFrame *GetFollow() const;
125  inline SwTabFrame *GetFollow();
126  SwTabFrame* FindMaster( bool bFirstMaster = false ) const;
127 
128  virtual bool GetInfo( SfxPoolItem &rHint ) const override;
129  virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
130  SwPrintData const*const pPrintData = nullptr ) const override;
131  virtual void CheckDirection( bool bVert ) override;
132 
133  virtual void Cut() override;
134  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
135 
136  virtual bool Prepare( const PrepareHint ePrep = PREP_CLEAR,
137  const void *pVoid = nullptr, bool bNotify = true ) override;
138 
140  inline const SwFrame *FindLastContentOrTable() const;
142  inline const SwContentFrame *FindLastContent() const;
143 
144  const SwTable *GetTable() const { return m_pTable; }
145  SwTable *GetTable() { return m_pTable; }
146 
147  bool IsComplete() { return m_bComplete; }
148  void SetComplete() { m_bComplete = true; }
149  void ResetComplete() { m_bComplete = false; }
150 
151  bool IsLowersFormatted() const { return m_bLowersFormatted; }
153 
154  void SetCalcLowers() { m_bCalcLowers = true; } // use rarely
155  void SetResizeHTMLTable() { m_bResizeHTMLTable = true; } // same
157 
158  // Start: New stuff for breaking table rows
159 
160  bool HasFollowFlowLine() const { return m_bHasFollowFlowLine; }
161  void SetFollowFlowLine(bool bNew) { m_bHasFollowFlowLine = bNew; }
162 
163  bool IsRebuildLastLine() const { return m_bIsRebuildLastLine; }
164  void SetRebuildLastLine(bool bNew) { m_bIsRebuildLastLine = bNew; }
165 
167  void SetRestrictTableGrowth( bool bNew ) { m_bRestrictTableGrowth = bNew; }
168 
171 
172  bool IsInRecalcLowerRow() const
173  {
174  return m_bInRecalcLowerRow;
175  }
176  void SetInRecalcLowerRow( bool bNew )
177  {
178  m_bInRecalcLowerRow = bNew;
179  }
180  bool IsSplitRowDisabled() const
181  {
182  return m_bSplitRowDisabled;
183  }
185  {
186  m_bSplitRowDisabled = true;
187  }
188 
189  // #i26945#
191  {
193  }
194  void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
195  {
196  m_bConsiderObjsForMinCellHeight = bConsiderObjsForMinCellHeight;
197  }
198 
199  // #i26945#
200  bool DoesObjsFit() const
201  {
202  return m_bObjsDoesFit;
203  }
204  void SetDoesObjsFit(bool const bObjsDoesFit)
205  {
206  m_bObjsDoesFit = bObjsDoesFit;
207  }
208 
209  bool RemoveFollowFlowLine();
210 
211  // End: New stuff for breaking table rows
212 
213  bool CalcFlyOffsets(
214  SwTwips& rUpper,
215  long& rLeftOffset,
216  long& rRightOffset ) const;
217 
219 
220  bool IsInHeadline( const SwFrame& rFrame ) const;
222 
223  bool IsLayoutSplitAllowed() const;
224 
225  // #i29550#
226  bool IsCollapsingBorders() const;
227 
228  sal_uInt16 GetBottomLineSize() const;
229 
230  virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
231 };
232 
234 {
235  return const_cast<SwTabFrame*>(this)->FindLastContentOrTable();
236 }
237 
239 {
240  return const_cast<SwTabFrame*>(this)->FindLastContent();
241 }
242 
243 inline const SwTabFrame *SwTabFrame::GetFollow() const
244 {
245  return static_cast<const SwTabFrame*>(SwFlowFrame::GetFollow());
246 }
248 {
249  return static_cast<SwTabFrame*>(SwFlowFrame::GetFollow());
250 }
251 
252 #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
253 
254 /* 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
virtual void Cut() override
Definition: tabfrm.cxx:3526
bool IsLayoutSplitAllowed() const
Definition: tabfrm.cxx:5385
void SetCalcLowers()
Definition: tabfrm.hxx:154
void SetRestrictTableGrowth(bool bNew)
Definition: tabfrm.hxx:167
void SetLowersFormatted(bool b)
Definition: tabfrm.hxx:152
bool IsComplete()
Definition: tabfrm.hxx:147
bool m_bSplitRowDisabled
Definition: tabfrm.hxx:87
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: tabfrm.cxx:3629
bool DoesObjsFit() const
Definition: tabfrm.hxx:200
void RegistFlys()
Definition: tabfrm.cxx:156
const SwTable * GetTable() const
Definition: tabfrm.hxx:144
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the frame; Frame and PrtArea.
Definition: tabfrm.cxx:2807
void SetDoesObjsFit(bool const bObjsDoesFit)
Definition: tabfrm.hxx:204
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:30
void ResetComplete()
Definition: tabfrm.hxx:149
bool IsCollapsingBorders() const
Definition: tabfrm.cxx:5407
virtual bool GetInfo(SfxPoolItem &rHint) const override
Definition: tabfrm.cxx:3313
long SwTwips
Definition: swtypes.hxx:49
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:59
bool IsLowersFormatted() const
Definition: tabfrm.hxx:151
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:560
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:1008
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: tabfrm.cxx:3076
void SetResizeHTMLTable()
Definition: tabfrm.hxx:155
void JoinAndDelFollows()
Definition: tabfrm.cxx:146
bool IsConsiderObjsForMinCellHeight() const
Definition: tabfrm.hxx:190
sal_uInt16 GetBottomLineSize() const
Definition: tabfrm.cxx:5392
bool RemoveFollowFlowLine()
Definition: tabfrm.cxx:872
void SetONECalcLowers()
Definition: tabfrm.hxx:156
bool m_bHasFollowFlowLine
Primarily for the StarONE SS The Contents are formatted via Calc() on MakeAll in any case...
Definition: tabfrm.hxx:56
void SetComplete()
Definition: tabfrm.hxx:148
virtual bool Prepare(const PrepareHint ePrep=PREP_CLEAR, const void *pVoid=nullptr, bool bNotify=true) override
Definition: tabfrm.cxx:3690
virtual bool ShouldBwdMoved(SwLayoutFrame *pNewUpper, bool bHead, bool &rReformat) override
Return value defines if the frm needs to be relocated.
Definition: tabfrm.cxx:3423
friend void CalcContent(SwLayoutFrame *pLay, bool bNoColl)
Definition: fly.cxx:1368
void SetSplitRowDisabled()
Definition: tabfrm.hxx:184
bool m_bComplete
Definition: tabfrm.hxx:39
SwContentFrame * FindLastContent()
Definition: tabfrm.cxx:3409
void Join()
Definition: tabfrm.cxx:1346
struct _xmlTextWriter * xmlTextWriterPtr
bool IsInRecalcLowerRow() const
Definition: tabfrm.hxx:172
SwFrame * FindLastContentOrTable()
Definition: tabfrm.cxx:3339
PrepareHint
Definition: swtypes.hxx:204
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:715
void SetFollowFlowLine(bool bNew)
Definition: tabfrm.hxx:161
bool m_bObjsDoesFit
Definition: tabfrm.hxx:82
bool m_bInRecalcLowerRow
Definition: tabfrm.hxx:85
void SetRemoveFollowFlowLinePending(bool bNew)
Definition: tabfrm.hxx:170
bool m_bResizeHTMLTable
The Master took care of the BackMove test.
Definition: tabfrm.hxx:46
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: tabfrm.cxx:3158
bool IsSplitRowDisabled() const
Definition: tabfrm.hxx:180
bool m_bConsiderObjsForMinCellHeight
Definition: tabfrm.hxx:73
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: tabfrm.cxx:1811
bool m_bLowersFormatted
For stability of the content in MakeAll.
Definition: tabfrm.hxx:44
bool m_bRestrictTableGrowth
Means that currently the last line of the.
Definition: tabfrm.hxx:63
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Definition: paintfrm.cxx:4143
void SetInRecalcLowerRow(bool bNew)
Definition: tabfrm.hxx:176
bool m_bLockBackMove
Communication between MakeAll and Layact.
Definition: tabfrm.hxx:45
bool IsRestrictTableGrowth() const
Definition: tabfrm.hxx:166
bool CalcFlyOffsets(SwTwips &rUpper, long &rLeftOffset, long &rRightOffset) const
Calculate the offsets arising because of FlyFrames.
Definition: tabfrm.cxx:2673
SwTable * GetTable()
Definition: tabfrm.hxx:145
SwRowFrame * GetFirstNonHeadlineRow() const
Definition: tabfrm.cxx:5352
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
Definition: flowfrm.cxx:784
unsigned char sal_uInt8
bool IsRemoveFollowFlowLinePending() const
Definition: tabfrm.hxx:169
bool m_bCalcLowers
Set entries for Repaint without needing to set the base class' CompletePaint With that we would want ...
Definition: tabfrm.hxx:43
SwTabFrame(SwTable &, SwFrame *)
Definition: tabfrm.cxx:68
void SetRebuildLastLine(bool bNew)
Definition: tabfrm.hxx:164
SwTable * m_pTable
Definition: tabfrm.hxx:37
virtual void DestroyImpl() override
Definition: tabfrm.cxx:133
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:243
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:51
void UpdateAttr_(const SfxPoolItem *, const SfxPoolItem *, sal_uInt8 &, SwAttrSetChg *pa=nullptr, SwAttrSetChg *pb=nullptr)
Definition: tabfrm.cxx:3221
virtual ~SwTabFrame() override
Definition: tabfrm.cxx:142
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
bool HasFollowFlowLine() const
Definition: tabfrm.hxx:160
void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
Definition: tabfrm.hxx:194
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:434
bool m_bRemoveFollowFlowLinePending
Definition: tabfrm.hxx:70
SwTwips CalcHeightOfFirstContentLine() const
Function to calculate height of first text row.
Definition: tabfrm.cxx:5559
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:28
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5333
bool IsRebuildLastLine() const
Definition: tabfrm.hxx:163