Line data Source code
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 <tools/mempool.hxx>
23 : #include "layfrm.hxx"
24 : #include "flowfrm.hxx"
25 :
26 : class SwTable;
27 : class SwBorderAttrs;
28 : class SwAttrSetChg;
29 :
30 : /// SwTabFrm is one table in the document layout, containing rows (which contain cells).
31 : class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
32 : {
33 : friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow );
34 :
35 : // does the special treatment for _Get[Next|Prev]Leaf()
36 : using SwFrm::GetLeaf;
37 : SwLayoutFrm *GetLeaf( MakePageType eMakePage, bool bFwd );
38 :
39 : SwTable* pTable;
40 :
41 : bool bComplete :1; /// Set entries for Repaint without needing to
42 : /// set the base class' CompletePaint
43 : /// With that we would want to avoid unnecessary
44 : /// table repaints
45 : bool bCalcLowers :1; /// For stability of the content in MakeAll
46 : bool bLowersFormatted :1; /// Communication between MakeAll and Layact
47 : bool bLockBackMove :1; /// The Master took care of the BackMove test
48 : bool bResizeHTMLTable :1; /// Call the Resize of the HTMLTableLayout in the MakeAll
49 : /// This is an optimization, so that we don't have to call
50 : /// it in CntntFrm::Grow; there it might be called for
51 : /// _every_ Cell
52 :
53 : bool bONECalcLowers :1; /// Primarily for the StarONE SS
54 : /// The Cntnts are formatted via Calc() on MakeAll in any
55 : /// case. There are no further invalidations and that path can
56 : /// hardly give any guarantees
57 :
58 : bool bHasFollowFlowLine :1; /// Means that the first line in the follow
59 : /// is indented to contain content from a broken
60 : /// cell
61 : bool bIsRebuildLastLine :1; /// Means that currently the last line of the
62 : /// TabFrame is rebuilt. In this case we do not
63 : // want any notification to the master table
64 :
65 : bool bRestrictTableGrowth :1; // Usually, the table may grow infinitely,
66 : // as the table can be split in SwTabFrm::MakeAll
67 : // In MakeAll, this flag is set to indicate that
68 : // the table may only grow inside its upper. This
69 : // is necessary, in order to let the text flow into
70 : // the FollowFlowLine
71 :
72 : bool bRemoveFollowFlowLinePending :1;
73 :
74 : // #i26945#
75 : bool bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
76 : // are considered during the calculation
77 : // for the minimal cell height.
78 : // For the splitting table rows algorithm
79 : // we need not to consider floating
80 : // screen object for the preparation
81 : // of the re-calculation of the
82 : // last table row.
83 : // #i26945#
84 : bool bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
85 : // indicates, if the floating screen objects fits
86 :
87 : bool mbInRecalcLowerRow : 1;
88 :
89 : /**
90 : * Split() splits the Frm at the specified position: a Follow is
91 : * created and constructed and insterted directly after this.
92 : * Join() gets the Follow's content and destroys it.
93 : */
94 : bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
95 : bool Join();
96 :
97 : void _UpdateAttr(
98 : const SfxPoolItem*,
99 : const SfxPoolItem*, sal_uInt8 &,
100 : SwAttrSetChg *pa = 0,
101 : SwAttrSetChg *pb = 0 );
102 :
103 : virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool bHead, bool &rReformat ) SAL_OVERRIDE;
104 :
105 : protected:
106 : virtual void MakeAll() SAL_OVERRIDE;
107 : virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
108 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
109 : // only changes the Framesize, not the PrtArea size
110 : virtual SwTwips GrowFrm ( SwTwips, bool bTst = false, bool bInfo = false ) SAL_OVERRIDE;
111 :
112 : public:
113 : SwTabFrm( SwTable &, SwFrm* ); // calling Regist Flys always after creation _and_pasting!
114 : SwTabFrm( SwTabFrm & ); // _only_ for the creation of follows
115 : virtual ~SwTabFrm();
116 :
117 : void JoinAndDelFollows(); // for DelFrms of the TableNodes!
118 :
119 : // calls thr RegistFlys of the rows
120 : void RegistFlys();
121 :
122 : inline const SwTabFrm *GetFollow() const;
123 : inline SwTabFrm *GetFollow();
124 : SwTabFrm* FindMaster( bool bFirstMaster = false ) const;
125 :
126 : virtual bool GetInfo( SfxPoolItem &rHnt ) const SAL_OVERRIDE;
127 : virtual void Paint( SwRect const&,
128 : SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
129 : virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
130 :
131 : virtual void Cut() SAL_OVERRIDE;
132 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
133 :
134 : virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
135 : const void *pVoid = 0, bool bNotify = true ) SAL_OVERRIDE;
136 :
137 : SwCntntFrm *FindLastCntnt();
138 : inline const SwCntntFrm *FindLastCntnt() const;
139 :
140 52454 : const SwTable *GetTable() const { return pTable; }
141 59028 : SwTable *GetTable() { return pTable; }
142 :
143 2244 : bool IsComplete() { return bComplete; }
144 24976 : void SetComplete() { bComplete = true; }
145 927 : void ResetComplete() { bComplete = false; }
146 :
147 4180 : bool IsLowersFormatted() const { return bLowersFormatted; }
148 4162 : void SetLowersFormatted( bool b ) { bLowersFormatted = b; }
149 :
150 12 : void SetCalcLowers() { bCalcLowers = true; } // use rarely
151 222 : void SetResizeHTMLTable() { bResizeHTMLTable = true; } // same
152 714 : void SetONECalcLowers() { bONECalcLowers = true; }
153 :
154 : // Start: New stuff for breaking table rows
155 :
156 86104 : bool HasFollowFlowLine() const { return bHasFollowFlowLine; }
157 41280 : void SetFollowFlowLine( bool bNew ) { bHasFollowFlowLine = bNew; }
158 : //return the SwTabFrm (if any) that this SwTabFrm is a follow flow line for
159 : SwTabFrm* GetFollowFlowLineFor();
160 :
161 43632 : bool IsRebuildLastLine() const { return bIsRebuildLastLine; }
162 624 : void SetRebuildLastLine( bool bNew ) { bIsRebuildLastLine = bNew; }
163 :
164 18810 : bool IsRestrictTableGrowth() const { return bRestrictTableGrowth; }
165 29366 : void SetRestrictTableGrowth( bool bNew ) { bRestrictTableGrowth = bNew; }
166 :
167 7640 : bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; }
168 6 : void SetRemoveFollowFlowLinePending( bool bNew ) { bRemoveFollowFlowLinePending = bNew; }
169 :
170 392 : bool IsInRecalcLowerRow() const
171 : {
172 392 : return mbInRecalcLowerRow;
173 : }
174 1024 : void SetInRecalcLowerRow( bool bNew )
175 : {
176 1024 : mbInRecalcLowerRow = bNew;
177 1024 : }
178 :
179 : // #i26945#
180 82814 : bool IsConsiderObjsForMinCellHeight() const
181 : {
182 82814 : return bConsiderObjsForMinCellHeight;
183 : }
184 624 : void SetConsiderObjsForMinCellHeight( bool _bNewConsiderObjsForMinCellHeight )
185 : {
186 624 : bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight;
187 624 : }
188 :
189 : // #i26945#
190 140 : bool DoesObjsFit() const
191 : {
192 140 : return bObjsDoesFit;
193 : }
194 624 : void SetDoesObjsFit( bool _bNewObjsDoesFit )
195 : {
196 624 : bObjsDoesFit = _bNewObjsDoesFit;
197 624 : }
198 :
199 : bool RemoveFollowFlowLine();
200 :
201 : // End: New stuff for breaking table rows
202 :
203 : bool CalcFlyOffsets(
204 : SwTwips& rUpper,
205 : long& rLeftOffset,
206 : long& rRightOffset ) const;
207 :
208 : SwTwips CalcHeightOfFirstContentLine() const;
209 :
210 : bool IsInHeadline( const SwFrm& rFrm ) const;
211 : SwRowFrm* GetFirstNonHeadlineRow() const;
212 :
213 : bool IsLayoutSplitAllowed() const;
214 :
215 : // #i29550#
216 : bool IsCollapsingBorders() const;
217 :
218 : sal_uInt16 GetBottomLineSize() const;
219 :
220 : virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const SAL_OVERRIDE;
221 :
222 3136 : DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
223 : };
224 :
225 56 : inline const SwCntntFrm *SwTabFrm::FindLastCntnt() const
226 : {
227 56 : return ((SwTabFrm*)this)->FindLastCntnt();
228 : }
229 :
230 194446 : inline const SwTabFrm *SwTabFrm::GetFollow() const
231 : {
232 194446 : return (const SwTabFrm*)SwFlowFrm::GetFollow();
233 : }
234 229906 : inline SwTabFrm *SwTabFrm::GetFollow()
235 : {
236 229906 : return (SwTabFrm*)SwFlowFrm::GetFollow();
237 : }
238 :
239 : #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
240 :
241 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|