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 
128 public:
129  SwTabFrame( SwTable &, SwFrame* ); // calling RegistFlys always after creation _and_pasting!
130  SwTabFrame( SwTabFrame & ); // _only_ for the creation of follows
131 
132  void JoinAndDelFollows(); // for DelFrames of the TableNodes!
133 
134  // calls thr RegistFlys of the rows
135  void RegistFlys();
136 
137  inline const SwTabFrame *GetFollow() const;
138  inline SwTabFrame *GetFollow();
139  SwTabFrame* FindMaster( bool bFirstMaster = false ) const;
140 
141  virtual bool GetInfo( SfxPoolItem &rHint ) const override;
142  virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
143  SwPrintData const*const pPrintData = nullptr ) const override;
144  virtual void CheckDirection( bool bVert ) override;
145 
146  virtual void Cut() override;
147  virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
148 
149  virtual bool Prepare( const PrepareHint ePrep = PrepareHint::Clear,
150  const void *pVoid = nullptr, bool bNotify = true ) override;
151 
153  inline const SwFrame *FindLastContentOrTable() const;
155  inline const SwContentFrame *FindLastContent() const;
156 
157  const SwTable *GetTable() const { return m_pTable; }
158  SwTable *GetTable() { return m_pTable; }
159 
160  bool IsComplete() const { return m_bComplete; }
161  void SetComplete() { m_bComplete = true; }
162  void ResetComplete() { m_bComplete = false; }
163 
164  bool IsLowersFormatted() const { return m_bLowersFormatted; }
166 
167  void SetCalcLowers() { m_bCalcLowers = true; } // use rarely
168  void SetResizeHTMLTable() { m_bResizeHTMLTable = true; } // same
170 
171  // Start: New stuff for breaking table rows
172 
173  bool HasFollowFlowLine() const { return m_bHasFollowFlowLine; }
174  void SetFollowFlowLine(bool bNew) { m_bHasFollowFlowLine = bNew; }
175 
176  bool IsRebuildLastLine() const { return m_bIsRebuildLastLine; }
177  void SetRebuildLastLine(bool bNew) { m_bIsRebuildLastLine = bNew; }
178 
180  void SetRestrictTableGrowth( bool bNew ) { m_bRestrictTableGrowth = bNew; }
181 
184 
185  bool IsInRecalcLowerRow() const
186  {
187  return m_bInRecalcLowerRow;
188  }
189  void SetInRecalcLowerRow( bool bNew )
190  {
191  m_bInRecalcLowerRow = bNew;
192  }
193 
194  // #i26945#
196  {
198  }
199  void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
200  {
201  m_bConsiderObjsForMinCellHeight = bConsiderObjsForMinCellHeight;
202  }
203 
204  // #i26945#
205  bool DoesObjsFit() const
206  {
207  return m_bObjsDoesFit;
208  }
209  void SetDoesObjsFit(bool const bObjsDoesFit)
210  {
211  m_bObjsDoesFit = bObjsDoesFit;
212  }
213 
214  bool RemoveFollowFlowLine();
215 
216  // End: New stuff for breaking table rows
217 
218  bool CalcFlyOffsets(
219  SwTwips& rUpper,
220  tools::Long& rLeftOffset,
221  tools::Long& rRightOffset,
222  SwTwips * pSpaceBelowBottom) const;
223 
225 
226  bool IsInHeadline( const SwFrame& rFrame ) const;
228 
229  bool IsLayoutSplitAllowed() const;
230 
231  // #i29550#
232  bool IsCollapsingBorders() const;
233 
234  sal_uInt16 GetBottomLineSize() const;
235 
236  virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
237 };
238 
240 {
241  return const_cast<SwTabFrame*>(this)->FindLastContentOrTable();
242 }
243 
245 {
246  return const_cast<SwTabFrame*>(this)->FindLastContent();
247 }
248 
249 inline const SwTabFrame *SwTabFrame::GetFollow() const
250 {
251  return static_cast<const SwTabFrame*>(SwFlowFrame::GetFollow());
252 }
254 {
255  return static_cast<SwTabFrame*>(SwFlowFrame::GetFollow());
256 }
257 
258 #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
259 
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class of the Writer layout elements.
Definition: frame.hxx:313
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:3679
bool IsLayoutSplitAllowed() const
Definition: tabfrm.cxx:5760
void SetCalcLowers()
Definition: tabfrm.hxx:167
void SetRestrictTableGrowth(bool bNew)
Definition: tabfrm.hxx:180
void SetLowersFormatted(bool b)
Definition: tabfrm.hxx:165
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: tabfrm.cxx:3784
bool DoesObjsFit() const
Definition: tabfrm.hxx:205
void RegistFlys()
Definition: tabfrm.cxx:156
const SwTable * GetTable() const
Definition: tabfrm.hxx:157
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the frame; Frame and PrtArea.
Definition: tabfrm.cxx:2944
long Long
void SetDoesObjsFit(bool const bObjsDoesFit)
Definition: tabfrm.hxx:209
bool IsComplete() const
Definition: tabfrm.hxx:160
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:46
void ResetComplete()
Definition: tabfrm.hxx:162
bool IsCollapsingBorders() const
Definition: tabfrm.cxx:5782
virtual bool GetInfo(SfxPoolItem &rHint) const override
Definition: tabfrm.cxx:3457
void UpdateAttr_(const SfxPoolItem *, const SfxPoolItem *, SwTabFrameInvFlags &, SwAttrSetChg *pa=nullptr, SwAttrSetChg *pb=nullptr)
Definition: tabfrm.cxx:3360
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
bool m_bIsRebuildLastLine
Means that the first line in the follow.
Definition: tabfrm.hxx:75
bool IsLowersFormatted() const
Definition: tabfrm.hxx:164
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override
Definition: xmldump.cxx:637
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:1010
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: tabfrm.cxx:3212
void SetResizeHTMLTable()
Definition: tabfrm.hxx:168
void JoinAndDelFollows()
Definition: tabfrm.cxx:146
bool IsConsiderObjsForMinCellHeight() const
Definition: tabfrm.hxx:195
sal_uInt16 GetBottomLineSize() const
Definition: tabfrm.cxx:5767
bool RemoveFollowFlowLine()
Definition: tabfrm.cxx:874
void SetONECalcLowers()
Definition: tabfrm.hxx:169
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:161
friend void CalcContent(SwLayoutFrame *pLay, bool bNoColl)
Definition: fly.cxx:1411
bool m_bComplete
Definition: tabfrm.hxx:55
SwContentFrame * FindLastContent()
Definition: tabfrm.cxx:3553
void Join()
Definition: tabfrm.cxx:1358
struct _xmlTextWriter * xmlTextWriterPtr
bool IsInRecalcLowerRow() const
Definition: tabfrm.hxx:185
SwFrame * FindLastContentOrTable()
Definition: tabfrm.cxx:3483
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
Definition: tabfrm.cxx:3845
PrepareHint
Definition: swtypes.hxx:194
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:774
void SetFollowFlowLine(bool bNew)
Definition: tabfrm.hxx:174
bool m_bObjsDoesFit
Definition: tabfrm.hxx:98
bool m_bInRecalcLowerRow
Definition: tabfrm.hxx:101
void SetRemoveFollowFlowLinePending(bool bNew)
Definition: tabfrm.hxx:183
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:3567
bool m_bConsiderObjsForMinCellHeight
Definition: tabfrm.hxx:89
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: tabfrm.cxx:1850
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: tabfrm.cxx:3294
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:49
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:111
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Definition: paintfrm.cxx:4274
void SetInRecalcLowerRow(bool bNew)
Definition: tabfrm.hxx:189
bool m_bLockBackMove
Communication between MakeAll and Layact.
Definition: tabfrm.hxx:61
bool IsRestrictTableGrowth() const
Definition: tabfrm.hxx:179
SwTable * GetTable()
Definition: tabfrm.hxx:158
SwRowFrame * GetFirstNonHeadlineRow() const
Definition: tabfrm.cxx:5727
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
Definition: flowfrm.cxx:843
unsigned char sal_uInt8
bool IsRemoveFollowFlowLinePending() const
Definition: tabfrm.hxx:182
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:70
void SetRebuildLastLine(bool bNew)
Definition: tabfrm.hxx:177
SwTable * m_pTable
Definition: tabfrm.hxx:53
virtual void DestroyImpl() override
Definition: tabfrm.cxx:133
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:249
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:142
bool CalcFlyOffsets(SwTwips &rUpper, tools::Long &rLeftOffset, tools::Long &rRightOffset, SwTwips *pSpaceBelowBottom) const
Calculate the offsets arising because of FlyFrames.
Definition: tabfrm.cxx:2739
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
bool HasFollowFlowLine() const
Definition: tabfrm.hxx:173
void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
Definition: tabfrm.hxx:199
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:437
bool m_bRemoveFollowFlowLinePending
Definition: tabfrm.hxx:86
SwTwips CalcHeightOfFirstContentLine() const
Function to calculate height of first text row.
Definition: tabfrm.cxx:5934
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:28
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5708
bool IsRebuildLastLine() const
Definition: tabfrm.hxx:176