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, sal_Bool bFwd );
38 :
39 : SwTable* pTable;
40 :
41 : sal_Bool bComplete :1; //Eintrage als Repaint ohne das CompletePaint
42 : //der Basisklasse gesetzt werden muss. Damit
43 : //sollen unertraegliche Tabellen-Repaints
44 : //vermieden werden.
45 : sal_Bool bCalcLowers :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet
46 : //des Inhaltes sorgen.
47 : sal_Bool bLowersFormatted :1;//Kommunikation zwischen MakeAll und Layact
48 : sal_Bool bLockBackMove :1; //BackMove-Test hat der Master erledigt.
49 : sal_Bool bResizeHTMLTable :1; //Resize des HTMLTableLayout rufen im MakeAll
50 : //Zur Optimierung, damit dies nicht im
51 : //CntntFrm::Grow gerufen werden muss, denn dann
52 : //wird es ggf. fuer jede Zelle gerufen #47483#
53 : sal_Bool bONECalcLowers :1; //Primaer fuer die StarONE-SS. Beim MakeAll werden
54 : //die Cntnts auf jedenfall per Calc() formatiert.
55 : //es finden keine zusaetzlichen Invalidierungen
56 : //statt und dieser Weg kann auch kaum garantien
57 : //geben.
58 :
59 : sal_Bool bHasFollowFlowLine :1; // Means that the first line in the follow
60 : // is indented to contain content from a broken
61 : // cell
62 : sal_Bool bIsRebuildLastLine :1; // Means that currently the last line of the
63 : // TabFrame is rebuilded. In this case we
64 : // do not want any notification to the master
65 : // table
66 : sal_Bool bRestrictTableGrowth :1; // Usually, the table may grow infinite,
67 : // because the table can be split in
68 : // SwTabFrm::MakeAll. In MakeAll, this
69 : // flag is set to indicate that the table
70 : // may only grow inside its upper. This
71 : // is necessary, in order to let the text
72 : // flow into the FollowFlowLine
73 : sal_Bool bRemoveFollowFlowLinePending :1;
74 : // #i26945#
75 : sal_Bool bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
76 : // are considered on the calculation
77 : // for the minimal cell height.
78 : // For splitting table rows algorithm
79 : // it's needed not to consider floating
80 : // screen object for the preparation
81 : // of the re-calculation of the
82 : // last table row.
83 : // #i26945#
84 : sal_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 : //Split() spaltet den Frm an der angegebenen Stelle, es wird ein
90 : //Follow erzeugt und aufgebaut und direkt hinter this gepastet.
91 : //Join() Holt sich den Inhalt aus dem Follow und vernichtet diesen.
92 : bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
93 : bool Join();
94 :
95 : void _UpdateAttr(
96 : const SfxPoolItem*,
97 : const SfxPoolItem*, sal_uInt8 &,
98 : SwAttrSetChg *pa = 0,
99 : SwAttrSetChg *pb = 0 );
100 :
101 : virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool bHead, bool &rReformat ) SAL_OVERRIDE;
102 :
103 : protected:
104 : virtual void MakeAll() SAL_OVERRIDE;
105 : virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
106 : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
107 : // only changes the Framesize, not the PrtArea size
108 : virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) SAL_OVERRIDE;
109 :
110 : public:
111 : SwTabFrm( SwTable &, SwFrm* ); // calling Regist Flys always after creation _and_pasting!
112 : SwTabFrm( SwTabFrm & ); // _only_ for the creation of follows
113 : virtual ~SwTabFrm();
114 :
115 : void JoinAndDelFollows(); // for DelFrms of the TableNodes!
116 :
117 : // calls thr RegistFlys of the rows
118 : void RegistFlys();
119 :
120 : inline const SwTabFrm *GetFollow() const;
121 : inline SwTabFrm *GetFollow();
122 : SwTabFrm* FindMaster( bool bFirstMaster = false ) const;
123 :
124 : virtual bool GetInfo( SfxPoolItem &rHnt ) const SAL_OVERRIDE;
125 : virtual void Paint( SwRect const&,
126 : SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
127 : virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
128 :
129 : virtual void Cut() SAL_OVERRIDE;
130 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
131 :
132 : virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
133 : const void *pVoid = 0, bool bNotify = true ) SAL_OVERRIDE;
134 :
135 : SwCntntFrm *FindLastCntnt();
136 : inline const SwCntntFrm *FindLastCntnt() const;
137 :
138 0 : const SwTable *GetTable() const { return pTable; }
139 0 : SwTable *GetTable() { return pTable; }
140 :
141 0 : sal_Bool IsComplete() { return bComplete; }
142 0 : void SetComplete() { bComplete = sal_True; }
143 0 : void ResetComplete() { bComplete = sal_False; }
144 :
145 0 : sal_Bool IsLowersFormatted() const { return bLowersFormatted; }
146 0 : void SetLowersFormatted( sal_Bool b ) { bLowersFormatted = b; }
147 :
148 0 : void SetCalcLowers() { bCalcLowers = sal_True; } // use rarely
149 0 : void SetResizeHTMLTable() { bResizeHTMLTable = sal_True; } // same
150 0 : void SetONECalcLowers() { bONECalcLowers = sal_True; }
151 :
152 : // Start: New stuff for breaking table rows
153 :
154 0 : sal_Bool HasFollowFlowLine() const { return bHasFollowFlowLine; }
155 0 : void SetFollowFlowLine( sal_Bool bNew ) { bHasFollowFlowLine = bNew; }
156 : //return the SwTabFrm (if any) that this SwTabFrm is a follow flow line for
157 : SwTabFrm* GetFollowFlowLineFor();
158 :
159 0 : sal_Bool IsRebuildLastLine() const { return bIsRebuildLastLine; }
160 0 : void SetRebuildLastLine( sal_Bool bNew ) { bIsRebuildLastLine = bNew; }
161 :
162 0 : sal_Bool IsRestrictTableGrowth() const { return bRestrictTableGrowth; }
163 0 : void SetRestrictTableGrowth( sal_Bool bNew ) { bRestrictTableGrowth = bNew; }
164 :
165 0 : sal_Bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; }
166 0 : void SetRemoveFollowFlowLinePending( sal_Bool bNew ) { bRemoveFollowFlowLinePending = bNew; }
167 :
168 0 : bool IsInRecalcLowerRow() const
169 : {
170 0 : return mbInRecalcLowerRow;
171 : }
172 0 : void SetInRecalcLowerRow( bool bNew )
173 : {
174 0 : mbInRecalcLowerRow = bNew;
175 0 : }
176 :
177 : // #i26945#
178 0 : sal_Bool IsConsiderObjsForMinCellHeight() const
179 : {
180 0 : return bConsiderObjsForMinCellHeight;
181 : }
182 0 : void SetConsiderObjsForMinCellHeight( sal_Bool _bNewConsiderObjsForMinCellHeight )
183 : {
184 0 : bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight;
185 0 : }
186 :
187 : // #i26945#
188 0 : sal_Bool DoesObjsFit() const
189 : {
190 0 : return bObjsDoesFit;
191 : }
192 0 : void SetDoesObjsFit( sal_Bool _bNewObjsDoesFit )
193 : {
194 0 : bObjsDoesFit = _bNewObjsDoesFit;
195 0 : }
196 :
197 : bool RemoveFollowFlowLine();
198 :
199 : // End: New stuff for breaking table rows
200 :
201 : sal_Bool CalcFlyOffsets(
202 : SwTwips& rUpper,
203 : long& rLeftOffset,
204 : long& rRightOffset ) const;
205 :
206 : SwTwips CalcHeightOfFirstContentLine() const;
207 :
208 : bool IsInHeadline( const SwFrm& rFrm ) const;
209 : SwRowFrm* GetFirstNonHeadlineRow() const;
210 :
211 : bool IsLayoutSplitAllowed() const;
212 :
213 : // #i29550#
214 : bool IsCollapsingBorders() const;
215 :
216 : sal_uInt16 GetBottomLineSize() const;
217 :
218 : virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) SAL_OVERRIDE;
219 :
220 0 : DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
221 : };
222 :
223 0 : inline const SwCntntFrm *SwTabFrm::FindLastCntnt() const
224 : {
225 0 : return ((SwTabFrm*)this)->FindLastCntnt();
226 : }
227 :
228 0 : inline const SwTabFrm *SwTabFrm::GetFollow() const
229 : {
230 0 : return (const SwTabFrm*)SwFlowFrm::GetFollow();
231 : }
232 0 : inline SwTabFrm *SwTabFrm::GetFollow()
233 : {
234 0 : return (SwTabFrm*)SwFlowFrm::GetFollow();
235 : }
236 :
237 : #endif // INCLUDED_SW_SOURCE_CORE_INC_TABFRM_HXX
238 :
239 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|