Revert "reduce symbol visibility in sw"
[LibreOffice.git] / sw / source / core / inc / tabfrm.hxx
blob80bbcd2b3d2f8b0fd13a7ac6902385fdc73105c9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
22 #include <swdllapi.h>
24 #include "layfrm.hxx"
25 #include "flowfrm.hxx"
27 class SwTable;
28 class SwBorderAttrs;
29 class SwAttrSetChg;
31 enum class SwTabFrameInvFlags : sal_uInt8
33 NONE = 0x00,
34 InvalidatePrt = 0x02,
35 InvalidateIndNextPrt = 0x04,
36 InvalidatePrevPrt = 0x08,
37 SetIndNextCompletePaint = 0x10,
38 InvalidateBrowseWidth = 0x20,
39 InvalidatePos = 0x40,
40 InvalidateNextPos = 0x80,
43 namespace o3tl {
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;
55 SwTable * m_pTable;
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
60 /// table repaints
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
68 /// _every_ Cell
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
77 /// cell
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
87 // the FollowFlowLine
89 bool m_bRemoveFollowFlowLinePending :1;
91 // #i26945#
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
99 // last table row.
100 // #i26945#
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);
112 void Join();
114 void UpdateAttr_(
115 const SfxPoolItem*,
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; }
134 public:
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
141 void RegistFlys();
143 inline const SwTabFrame *GetFollow() const;
144 inline SwTabFrame *GetFollow();
145 SwTabFrame* FindMaster( bool bFirstMaster = false ) const;
147 virtual void PaintSwFrame( vcl::RenderContext& rRenderContext, SwRect const& ) const override;
148 virtual void CheckDirection( bool bVert ) override;
150 virtual void Cut() override;
151 virtual void Paste( SwFrame* pParent, SwFrame* pSibling = nullptr ) override;
153 virtual bool Prepare( const PrepareHint ePrep = PrepareHint::Clear,
154 const void *pVoid = nullptr, bool bNotify = true ) override;
156 SwFrame *FindLastContentOrTable();
157 inline const SwFrame *FindLastContentOrTable() const;
158 SwContentFrame *FindLastContent();
159 inline const SwContentFrame *FindLastContent() const;
161 const SwTable *GetTable() const { return m_pTable; }
162 SwTable *GetTable() { return m_pTable; }
164 bool IsComplete() const { return m_bComplete; }
165 void SetComplete() { m_bComplete = true; }
166 void ResetComplete() { m_bComplete = false; }
168 bool IsLowersFormatted() const { return m_bLowersFormatted; }
169 void SetLowersFormatted(bool b) { m_bLowersFormatted = b; }
171 void SetCalcLowers() { m_bCalcLowers = true; } // use rarely
172 void SetResizeHTMLTable() { m_bResizeHTMLTable = true; } // same
173 void SetONECalcLowers() { m_bONECalcLowers = true; }
175 // Start: New stuff for breaking table rows
177 bool HasFollowFlowLine() const { return m_bHasFollowFlowLine; }
178 void SetFollowFlowLine(bool bNew) { m_bHasFollowFlowLine = bNew; }
180 bool IsRebuildLastLine() const { return m_bIsRebuildLastLine; }
181 void SetRebuildLastLine(bool bNew) { m_bIsRebuildLastLine = bNew; }
183 bool IsRestrictTableGrowth() const { return m_bRestrictTableGrowth; }
184 void SetRestrictTableGrowth( bool bNew ) { m_bRestrictTableGrowth = bNew; }
186 bool IsRemoveFollowFlowLinePending() const { return m_bRemoveFollowFlowLinePending; }
187 void SetRemoveFollowFlowLinePending(bool bNew) { m_bRemoveFollowFlowLinePending = bNew; }
189 bool IsInRecalcLowerRow() const
191 return m_bInRecalcLowerRow;
193 void SetInRecalcLowerRow( bool bNew )
195 m_bInRecalcLowerRow = bNew;
198 // #i26945#
199 bool IsConsiderObjsForMinCellHeight() const
201 return m_bConsiderObjsForMinCellHeight;
203 void SetConsiderObjsForMinCellHeight(bool const bConsiderObjsForMinCellHeight)
205 m_bConsiderObjsForMinCellHeight = bConsiderObjsForMinCellHeight;
208 // #i26945#
209 bool DoesObjsFit() const
211 return m_bObjsDoesFit;
213 void SetDoesObjsFit(bool const bObjsDoesFit)
215 m_bObjsDoesFit = bObjsDoesFit;
218 bool RemoveFollowFlowLine();
220 // End: New stuff for breaking table rows
222 bool CalcFlyOffsets(
223 SwTwips& rUpper,
224 tools::Long& rLeftOffset,
225 tools::Long& rRightOffset,
226 SwTwips * pSpaceBelowBottom) const;
228 SwTwips CalcHeightOfFirstContentLine() const;
230 bool IsInHeadline( const SwFrame& rFrame ) const;
231 SwRowFrame* GetFirstNonHeadlineRow() const;
233 bool IsLayoutSplitAllowed() const;
235 // #i29550#
236 bool IsCollapsingBorders() const;
238 sal_uInt16 GetBottomLineSize() const;
240 void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
243 inline const SwFrame *SwTabFrame::FindLastContentOrTable() const
245 return const_cast<SwTabFrame*>(this)->FindLastContentOrTable();
248 inline const SwContentFrame *SwTabFrame::FindLastContent() const
250 return const_cast<SwTabFrame*>(this)->FindLastContent();
253 inline const SwTabFrame *SwTabFrame::GetFollow() const
255 return static_cast<const SwTabFrame*>(SwFlowFrame::GetFollow());
257 inline SwTabFrame *SwTabFrame::GetFollow()
259 return static_cast<SwTabFrame*>(SwFlowFrame::GetFollow());
262 #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */