1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
#define INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
#include <swdllapi.h>
#include "layfrm.hxx"
#include "flowfrm.hxx"
class SwTable;
class SwBorderAttrs;
class SwAttrSetChg;
enum class SwTabFrameInvFlags : sal_uInt8
{
NONE = 0x00,
InvalidatePrt = 0x02,
InvalidateIndNextPrt = 0x04,
InvalidatePrevPrt = 0x08,
SetIndNextCompletePaint = 0x10,
InvalidateBrowseWidth = 0x20,
InvalidatePos = 0x40,
InvalidateNextPos = 0x80,
};
namespace o3tl {
template<> struct typed_flags<SwTabFrameInvFlags> : is_typed_flags<SwTabFrameInvFlags, 0xfe> {};
}
/// SwTabFrame is one table in the document layout, containing rows (which contain cells).
class SW_DLLPUBLIC SwTabFrame final: public SwLayoutFrame, public SwFlowFrame
{
friend void CalcContent( SwLayoutFrame *pLay, bool bNoColl );
// does the special treatment for Get_[Next|Prev]Leaf()
using SwFrame::GetLeaf;
SwTable * m_pTable;
bool m_bComplete :1; /// Set entries for Repaint without needing to
/// set the base class' CompletePaint
/// With that we would want to avoid unnecessary
/// table repaints
bool m_bCalcLowers :1; /// For stability of the content in MakeAll
bool m_bLowersFormatted :1; /// Communication between MakeAll and Layact
bool m_bLockBackMove :1; /// The Master took care of the BackMove test
bool m_bWantBackMove :1; /// Table wants to move back but was locked
bool m_bResizeHTMLTable :1; /// Call the Resize of the HTMLTableLayout in the MakeAll
/// This is an optimization, so that we don't have to call
/// it in ContentFrame::Grow; there it might be called for
/// _every_ Cell
bool m_bONECalcLowers :1; /// Primarily for the StarONE SS
/// The Contents are formatted via Calc() on MakeAll in any
/// case. There are no further invalidations and that path can
/// hardly give any guarantees
bool m_bHasFollowFlowLine :1; /// Means that the first line in the follow
/// is indented to contain content from a broken
/// cell
bool m_bIsRebuildLastLine :1; /// Means that currently the last line of the
/// TabFrame is rebuilt. In this case we do not
// want any notification to the master table
bool m_bRestrictTableGrowth :1; // Usually, the table may grow infinitely,
// as the table can be split in SwTabFrame::MakeAll
// In MakeAll, this flag is set to indicate that
// the table may only grow inside its upper. This
// is necessary, in order to let the text flow into
// the FollowFlowLine
bool m_bRemoveFollowFlowLinePending :1;
// #i26945#
bool m_bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
// are considered during the calculation
// for the minimal cell height.
// For the splitting table rows algorithm
// we need not to consider floating
// screen object for the preparation
// of the re-calculation of the
// last table row.
// #i26945#
bool m_bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
// indicates, if the floating screen objects fits
bool m_bInRecalcLowerRow : 1;
/**
* Split() splits the Frame at the specified position: a Follow is
* created and constructed and inserted directly after this.
* Join() gets the Follow's content and destroys it.
*/
bool Split(const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep, bool & rIsFootnoteGrowth);
void Join();
void UpdateAttr_(
const SfxPoolItem*,
const SfxPoolItem*, SwTabFrameInvFlags &,
SwAttrSetChg *pa = nullptr,
SwAttrSetChg *pb = nullptr );
void Invalidate(SwTabFrameInvFlags);
void HandleTableHeadlineChange();
virtual bool ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat ) override;
virtual void DestroyImpl() override;
virtual ~SwTabFrame() override;
virtual void MakeAll(vcl::RenderContext* pRenderContext) override;
virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override;
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
// only changes the Framesize, not the PrtArea size
virtual SwTwips GrowFrame ( SwTwips, bool bTst = false, bool bInfo = false ) override;
virtual const SwTabFrame* DynCastTabFrame() const override { return this; }
public:
SwTabFrame( SwTable &, SwFrame* ); // calling RegistFlys always after creation _and_pasting!
SwTabFrame( SwTabFrame & ); // _only_ for the creation of follows
void JoinAndDelFollows(); // for DelFrames of the TableNodes!
// calls thr RegistFlys of the rows
void RegistFlys();
inline const SwTabFrame *GetFollow() const;
inline SwTabFrame *GetFollow();
SwTabFrame* FindMaster( bool bFirstMaster = false ) const;
virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const&,
SwPrintData const*const pPrintData = nullptr ) const override;
virtual void CheckDirection( bool bVert ) override;
virtual void Cut() override;
virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
virtual bool Prepare( const PrepareHint ePrep = PrepareHint::Clear,
const void *pVoid = nullptr, bool bNotify = true ) override;
SwFrame *FindLastContentOrTable();
inline const SwFrame *FindLastContentOrTable() const;
SwContentFrame *FindLastContent();
inline const SwContentFrame *FindLastContent() const;
const SwTable *GetTable() const { return m_pTable; }
SwTable *GetTable() { return m_pTable; }
bool IsComplete() const { return m_bComplete; }
void SetComplete() { m_bComplete = true; }
void ResetComplete() { m_bComplete = false; }
bool IsLowersFormatted() const { return m_bLowersFormatted; }
void SetLowersFormatted(bool b) { m_bLowersFormatted = b; }
void SetCalcLowers() { m_bCalcLowers = true; } // use rarely
void SetResizeHTMLTable() { m_bResizeHTMLTable = true; } // same
void SetONECalcLowers() { m_bONECalcLowers = true; }
// Start: New stuff for breaking table rows
bool HasFollowFlowLine() const { return m_bHasFollowFlowLine; }
void SetFollowFlowLine(bool bNew) { m_bHasFollowFlowLine = bNew; }
bool IsRebuildLastLine() const { return m_bIsRebuildLastLine; }
void SetRebuildLastLine(bool bNew) { m_bIsRebuildLastLine = bNew; }
bool IsRestrictTableGrowth() const { return m_bRestrictTableGrowth; }
void SetRestrictTableGrowth( bool bNew ) { m_bRestrictTableGrowth = bNew; }
bool IsRemoveFollowFlowLinePending() const { return m_bRemoveFollowFlowLinePending; }
void SetRemoveFollowFlowLinePending(bool bNew) { m_bRemoveFollowFlowLinePending = bNew; }
bool IsInRecalcLowerRow() const
{
return m_bInRecalcLowerRow;
}
void SetInRecalcLowerRow( bool bNew )
{
m_bInRecalcLowerRow = bNew;
}
// #i26945#
bool IsConsiderObjsForMinCellHeight() const
{
return m_bConsiderObjsForMinCellHeight;
}
void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
{
m_bConsiderObjsForMinCellHeight = bConsiderObjsForMinCellHeight;
}
// #i26945#
bool DoesObjsFit() const
{
return m_bObjsDoesFit;
}
void SetDoesObjsFit(bool const bObjsDoesFit)
{
m_bObjsDoesFit = bObjsDoesFit;
}
bool RemoveFollowFlowLine();
// End: New stuff for breaking table rows
bool CalcFlyOffsets(
SwTwips& rUpper,
tools::Long& rLeftOffset,
tools::Long& rRightOffset,
SwTwips * pSpaceBelowBottom) const;
SwTwips CalcHeightOfFirstContentLine() const;
bool IsInHeadline( const SwFrame& rFrame ) const;
SwRowFrame* GetFirstNonHeadlineRow() const;
bool IsLayoutSplitAllowed() const;
// #i29550#
bool IsCollapsingBorders() const;
sal_uInt16 GetBottomLineSize() const;
void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
};
inline const SwFrame *SwTabFrame::FindLastContentOrTable() const
{
return const_cast<SwTabFrame*>(this)->FindLastContentOrTable();
}
inline const SwContentFrame *SwTabFrame::FindLastContent() const
{
return const_cast<SwTabFrame*>(this)->FindLastContent();
}
inline const SwTabFrame *SwTabFrame::GetFollow() const
{
return static_cast<const SwTabFrame*>(SwFlowFrame::GetFollow());
}
inline SwTabFrame *SwTabFrame::GetFollow()
{
return static_cast<SwTabFrame*>(SwFlowFrame::GetFollow());
}
#endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|