1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
20 #define INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
25 #include "flowfrm.hxx"
31 enum class SwTabFrameInvFlags
: sal_uInt8
35 InvalidateIndNextPrt
= 0x04,
36 InvalidatePrevPrt
= 0x08,
37 SetIndNextCompletePaint
= 0x10,
38 InvalidateBrowseWidth
= 0x20,
40 InvalidateNextPos
= 0x80,
44 template<> struct typed_flags
<SwTabFrameInvFlags
> : is_typed_flags
<SwTabFrameInvFlags
, 0xfe> {};
47 /// SwTabFrame is one table in the document layout, containing rows (which contain cells).
48 class SW_DLLPUBLIC SwTabFrame final
: public SwLayoutFrame
, public SwFlowFrame
50 friend void CalcContent( SwLayoutFrame
*pLay
, bool bNoColl
);
52 // does the special treatment for Get_[Next|Prev]Leaf()
53 using SwFrame::GetLeaf
;
57 bool m_bComplete
:1; /// Set entries for Repaint without needing to
58 /// set the base class' CompletePaint
59 /// With that we would want to avoid unnecessary
61 bool m_bCalcLowers
:1; /// For stability of the content in MakeAll
62 bool m_bLowersFormatted
:1; /// Communication between MakeAll and Layact
63 bool m_bLockBackMove
:1; /// The Master took care of the BackMove test
64 bool m_bWantBackMove
:1; /// Table wants to move back but was locked
65 bool m_bResizeHTMLTable
:1; /// Call the Resize of the HTMLTableLayout in the MakeAll
66 /// This is an optimization, so that we don't have to call
67 /// it in ContentFrame::Grow; there it might be called for
70 bool m_bONECalcLowers
:1; /// Primarily for the StarONE SS
71 /// The Contents are formatted via Calc() on MakeAll in any
72 /// case. There are no further invalidations and that path can
73 /// hardly give any guarantees
75 bool m_bHasFollowFlowLine
:1; /// Means that the first line in the follow
76 /// is indented to contain content from a broken
78 bool m_bIsRebuildLastLine
:1; /// Means that currently the last line of the
79 /// TabFrame is rebuilt. In this case we do not
80 // want any notification to the master table
82 bool m_bRestrictTableGrowth
:1; // Usually, the table may grow infinitely,
83 // as the table can be split in SwTabFrame::MakeAll
84 // In MakeAll, this flag is set to indicate that
85 // the table may only grow inside its upper. This
86 // is necessary, in order to let the text flow into
89 bool m_bRemoveFollowFlowLinePending
:1;
92 bool m_bConsiderObjsForMinCellHeight
:1; // Usually, the floating screen objects
93 // are considered during the calculation
94 // for the minimal cell height.
95 // For the splitting table rows algorithm
96 // we need not to consider floating
97 // screen object for the preparation
98 // of the re-calculation of the
101 bool m_bObjsDoesFit
:1; // For splitting table rows algorithm, this boolean
102 // indicates, if the floating screen objects fits
104 bool m_bInRecalcLowerRow
: 1;
107 * Split() splits the Frame at the specified position: a Follow is
108 * created and constructed and inserted directly after this.
109 * Join() gets the Follow's content and destroys it.
111 bool Split(const SwTwips nCutPos
, bool bTryToSplit
, bool bTableRowKeep
, bool & rIsFootnoteGrowth
);
116 const SfxPoolItem
*, SwTabFrameInvFlags
&,
117 SwAttrSetChg
*pa
= nullptr,
118 SwAttrSetChg
*pb
= nullptr );
119 void Invalidate(SwTabFrameInvFlags
);
120 void HandleTableHeadlineChange();
122 virtual bool ShouldBwdMoved( SwLayoutFrame
*pNewUpper
, bool &rReformat
) override
;
124 virtual void DestroyImpl() override
;
125 virtual ~SwTabFrame() override
;
127 virtual void MakeAll(vcl::RenderContext
* pRenderContext
) override
;
128 virtual void Format( vcl::RenderContext
* pRenderContext
, const SwBorderAttrs
*pAttrs
= nullptr ) override
;
129 virtual void SwClientNotify(const SwModify
&, const SfxHint
&) override
;
130 // only changes the Framesize, not the PrtArea size
131 virtual SwTwips
GrowFrame ( SwTwips
, bool bTst
= false, bool bInfo
= false ) override
;
132 virtual const SwTabFrame
* DynCastTabFrame() const override
{ return this; }
135 SwTabFrame( SwTable
&, SwFrame
* ); // calling RegistFlys always after creation _and_pasting!
136 SwTabFrame( SwTabFrame
& ); // _only_ for the creation of follows
138 void JoinAndDelFollows(); // for DelFrames of the TableNodes!
140 // calls thr RegistFlys of the rows
143 inline const SwTabFrame
*GetFollow() const;
144 inline SwTabFrame
*GetFollow();
145 SwTabFrame
* FindMaster( bool bFirstMaster
= false ) const;
147 virtual bool GetInfo( SfxPoolItem
&rHint
) const override
;
148 virtual void PaintSwFrame( vcl::RenderContext
& rRenderContext
, SwRect
const&,
149 SwPrintData
const*const pPrintData
= nullptr ) const override
;
150 virtual void CheckDirection( bool bVert
) override
;
152 virtual void Cut() override
;
153 virtual void Paste( SwFrame
* pParent
, SwFrame
* pSibling
= nullptr ) override
;
155 virtual bool Prepare( const PrepareHint ePrep
= PrepareHint::Clear
,
156 const void *pVoid
= nullptr, bool bNotify
= true ) override
;
158 SwFrame
*FindLastContentOrTable();
159 inline const SwFrame
*FindLastContentOrTable() const;
160 SwContentFrame
*FindLastContent();
161 inline const SwContentFrame
*FindLastContent() const;
163 const SwTable
*GetTable() const { return m_pTable
; }
164 SwTable
*GetTable() { return m_pTable
; }
166 bool IsComplete() const { return m_bComplete
; }
167 void SetComplete() { m_bComplete
= true; }
168 void ResetComplete() { m_bComplete
= false; }
170 bool IsLowersFormatted() const { return m_bLowersFormatted
; }
171 void SetLowersFormatted(bool b
) { m_bLowersFormatted
= b
; }
173 void SetCalcLowers() { m_bCalcLowers
= true; } // use rarely
174 void SetResizeHTMLTable() { m_bResizeHTMLTable
= true; } // same
175 void SetONECalcLowers() { m_bONECalcLowers
= true; }
177 // Start: New stuff for breaking table rows
179 bool HasFollowFlowLine() const { return m_bHasFollowFlowLine
; }
180 void SetFollowFlowLine(bool bNew
) { m_bHasFollowFlowLine
= bNew
; }
182 bool IsRebuildLastLine() const { return m_bIsRebuildLastLine
; }
183 void SetRebuildLastLine(bool bNew
) { m_bIsRebuildLastLine
= bNew
; }
185 bool IsRestrictTableGrowth() const { return m_bRestrictTableGrowth
; }
186 void SetRestrictTableGrowth( bool bNew
) { m_bRestrictTableGrowth
= bNew
; }
188 bool IsRemoveFollowFlowLinePending() const { return m_bRemoveFollowFlowLinePending
; }
189 void SetRemoveFollowFlowLinePending(bool bNew
) { m_bRemoveFollowFlowLinePending
= bNew
; }
191 bool IsInRecalcLowerRow() const
193 return m_bInRecalcLowerRow
;
195 void SetInRecalcLowerRow( bool bNew
)
197 m_bInRecalcLowerRow
= bNew
;
201 bool IsConsiderObjsForMinCellHeight() const
203 return m_bConsiderObjsForMinCellHeight
;
205 void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight
)
207 m_bConsiderObjsForMinCellHeight
= bConsiderObjsForMinCellHeight
;
211 bool DoesObjsFit() const
213 return m_bObjsDoesFit
;
215 void SetDoesObjsFit(bool const bObjsDoesFit
)
217 m_bObjsDoesFit
= bObjsDoesFit
;
220 bool RemoveFollowFlowLine();
222 // End: New stuff for breaking table rows
226 tools::Long
& rLeftOffset
,
227 tools::Long
& rRightOffset
,
228 SwTwips
* pSpaceBelowBottom
) const;
230 SwTwips
CalcHeightOfFirstContentLine() const;
232 bool IsInHeadline( const SwFrame
& rFrame
) const;
233 SwRowFrame
* GetFirstNonHeadlineRow() const;
235 bool IsLayoutSplitAllowed() const;
238 bool IsCollapsingBorders() const;
240 sal_uInt16
GetBottomLineSize() const;
242 virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer
) const override
;
243 void dumpAsXml(xmlTextWriterPtr writer
= nullptr) const override
;
246 inline const SwFrame
*SwTabFrame::FindLastContentOrTable() const
248 return const_cast<SwTabFrame
*>(this)->FindLastContentOrTable();
251 inline const SwContentFrame
*SwTabFrame::FindLastContent() const
253 return const_cast<SwTabFrame
*>(this)->FindLastContent();
256 inline const SwTabFrame
*SwTabFrame::GetFollow() const
258 return static_cast<const SwTabFrame
*>(SwFlowFrame::GetFollow());
260 inline SwTabFrame
*SwTabFrame::GetFollow()
262 return static_cast<SwTabFrame
*>(SwFlowFrame::GetFollow());
265 #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */