Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SW_TABFRM_HXX
29 : : #define SW_TABFRM_HXX
30 : :
31 : : #include <tools/mempool.hxx>
32 : : #include "layfrm.hxx"
33 : : #include "flowfrm.hxx"
34 : :
35 : : class SwTable;
36 : : class SwBorderAttrs;
37 : : class SwAttrSetChg;
38 : :
39 : : class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
40 : : {
41 : : // OD 14.03.2003 #i11760# - adjustment, because of method signature change
42 : : //darf mit den Flags spielen.
43 : : friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow );
44 : :
45 : : //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch.
46 : : using SwFrm::GetLeaf;
47 : : SwLayoutFrm *GetLeaf( MakePageType eMakePage, sal_Bool bFwd );
48 : :
49 : : SwTable* pTable;
50 : :
51 : : sal_Bool bComplete :1; //Eintrage als Repaint ohne das CompletePaint
52 : : //der Basisklasse gesetzt werden muss. Damit
53 : : //sollen unertraegliche Tabellen-Repaints
54 : : //vermieden werden.
55 : : sal_Bool bCalcLowers :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet
56 : : //des Inhaltes sorgen.
57 : : sal_Bool bLowersFormatted :1;//Kommunikation zwischen MakeAll und Layact
58 : : sal_Bool bLockBackMove :1; //BackMove-Test hat der Master erledigt.
59 : : sal_Bool bResizeHTMLTable :1; //Resize des HTMLTableLayout rufen im MakeAll
60 : : //Zur Optimierung, damit dies nicht im
61 : : //CntntFrm::Grow gerufen werden muss, denn dann
62 : : //wird es ggf. fuer jede Zelle gerufen #47483#
63 : : sal_Bool bONECalcLowers :1; //Primaer fuer die StarONE-SS. Beim MakeAll werden
64 : : //die Cntnts auf jedenfall per Calc() formatiert.
65 : : //es finden keine zusaetzlichen Invalidierungen
66 : : //statt und dieser Weg kann auch kaum garantien
67 : : //geben.
68 : :
69 : : sal_Bool bHasFollowFlowLine :1; // Means that the first line in the follow
70 : : // is indented to contain content from a broken
71 : : // cell
72 : : sal_Bool bIsRebuildLastLine :1; // Means that currently the last line of the
73 : : // TabFrame is rebuilded. In this case we
74 : : // do not want any notification to the master
75 : : // table
76 : : sal_Bool bRestrictTableGrowth :1; // Usually, the table may grow infinite,
77 : : // because the table can be split in
78 : : // SwTabFrm::MakeAll. In MakeAll, this
79 : : // flag is set to indicate that the table
80 : : // may only grow inside its upper. This
81 : : // is necessary, in order to let the text
82 : : // flow into the FollowFlowLine
83 : : sal_Bool bRemoveFollowFlowLinePending :1;
84 : : // #i26945#
85 : : sal_Bool bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
86 : : // are considered on the calculation
87 : : // for the minimal cell height.
88 : : // For splitting table rows algorithm
89 : : // it's needed not to consider floating
90 : : // screen object for the preparation
91 : : // of the re-calculation of the
92 : : // last table row.
93 : : // #i26945#
94 : : sal_Bool bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
95 : : // indicates, if the floating screen objects fits
96 : : sal_Bool bDummy4 :1;
97 : :
98 : : //Split() spaltet den Frm an der angegebenen Stelle, es wird ein
99 : : //Follow erzeugt und aufgebaut und direkt hinter this gepastet.
100 : : //Join() Holt sich den Inhalt aus dem Follow und vernichtet diesen.
101 : : bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
102 : : bool Join();
103 : :
104 : : void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
105 : : SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
106 : :
107 : : virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat );
108 : :
109 : : protected:
110 : : virtual void MakeAll();
111 : : virtual void Format( const SwBorderAttrs *pAttrs = 0 );
112 : : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
113 : : //Aendert nur die Framesize, nicht die PrtArea-SSize
114 : : virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
115 : :
116 : : public:
117 : : SwTabFrm( SwTable &, SwFrm* ); //Immer nach dem erzeugen _und_ pasten das
118 : : //Regist Flys rufen!
119 : : SwTabFrm( SwTabFrm & ); //_Nur_ zum erzeugen von Follows
120 : : ~SwTabFrm();
121 : :
122 : : void JoinAndDelFollows(); //Fuer DelFrms des TableNodes!
123 : :
124 : : //Ruft das RegistFlys der Zeilen.
125 : : void RegistFlys();
126 : :
127 : : inline const SwTabFrm *GetFollow() const;
128 : : inline SwTabFrm *GetFollow();
129 : : SwTabFrm* FindMaster( bool bFirstMaster = false ) const;
130 : :
131 : : virtual sal_Bool GetInfo( SfxPoolItem &rHnt ) const;
132 : : virtual void Paint( SwRect const&,
133 : : SwPrintData const*const pPrintData = NULL ) const;
134 : : virtual void CheckDirection( sal_Bool bVert );
135 : :
136 : : virtual void Cut();
137 : : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
138 : :
139 : : virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
140 : : const void *pVoid = 0, sal_Bool bNotify = sal_True );
141 : :
142 : : SwCntntFrm *FindLastCntnt();
143 : : inline const SwCntntFrm *FindLastCntnt() const;
144 : :
145 : 1863 : const SwTable *GetTable() const { return pTable; }
146 : 4285 : SwTable *GetTable() { return pTable; }
147 : :
148 : 573 : sal_Bool IsComplete() { return bComplete; }
149 : 1410 : void SetComplete() { bComplete = sal_True; }
150 : 671 : void ResetComplete() { bComplete = sal_False; }
151 : :
152 : 658 : sal_Bool IsLowersFormatted() const { return bLowersFormatted; }
153 : 458 : void SetLowersFormatted( sal_Bool b ) { bLowersFormatted = b; }
154 : :
155 : 8 : void SetCalcLowers() { bCalcLowers = sal_True; } //Sparsam einsetzen!
156 : 0 : void SetResizeHTMLTable() { bResizeHTMLTable = sal_True; } //dito
157 : 551 : void SetONECalcLowers() { bONECalcLowers = sal_True; }
158 : :
159 : : //
160 : : // Start: New stuff for breaking table rows
161 : : //
162 : 1452 : sal_Bool HasFollowFlowLine() const { return bHasFollowFlowLine; }
163 : 2184 : void SetFollowFlowLine( sal_Bool bNew ) { bHasFollowFlowLine = bNew; }
164 : :
165 : 3880 : sal_Bool IsRebuildLastLine() const { return bIsRebuildLastLine; }
166 : 0 : void SetRebuildLastLine( sal_Bool bNew ) { bIsRebuildLastLine = bNew; }
167 : :
168 : 107 : sal_Bool IsRestrictTableGrowth() const { return bRestrictTableGrowth; }
169 : 1092 : void SetRestrictTableGrowth( sal_Bool bNew ) { bRestrictTableGrowth = bNew; }
170 : :
171 : 1068 : sal_Bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; }
172 : 0 : void SetRemoveFollowFlowLinePending( sal_Bool bNew ) { bRemoveFollowFlowLinePending = bNew; }
173 : :
174 : : // #i26945#
175 : 6728 : sal_Bool IsConsiderObjsForMinCellHeight() const
176 : : {
177 : 6728 : return bConsiderObjsForMinCellHeight;
178 : : }
179 : 0 : void SetConsiderObjsForMinCellHeight( sal_Bool _bNewConsiderObjsForMinCellHeight )
180 : : {
181 : 0 : bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight;
182 : 0 : }
183 : : // #i26945#
184 : 0 : sal_Bool DoesObjsFit() const
185 : : {
186 : 0 : return bObjsDoesFit;
187 : : }
188 : 0 : void SetDoesObjsFit( sal_Bool _bNewObjsDoesFit )
189 : : {
190 : 0 : bObjsDoesFit = _bNewObjsDoesFit;
191 : 0 : }
192 : :
193 : : bool RemoveFollowFlowLine();
194 : : //
195 : : // End: New stuff for breaking table rows
196 : : //
197 : :
198 : : sal_Bool CalcFlyOffsets( SwTwips& rUpper, long& rLeftOffset,
199 : : long& rRightOffset ) const;
200 : :
201 : : SwTwips CalcHeightOfFirstContentLine() const;
202 : :
203 : : bool IsInHeadline( const SwFrm& rFrm ) const;
204 : : SwRowFrm* GetFirstNonHeadlineRow() const;
205 : :
206 : : bool IsLayoutSplitAllowed() const;
207 : :
208 : : // #i29550#
209 : : bool IsCollapsingBorders() const;
210 : :
211 : : // used for collapsing border lines:
212 : : sal_uInt16 GetBottomLineSize() const;
213 : : // <-- collapsing
214 : :
215 : : virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
216 : :
217 [ + - ][ + - ]: 348 : DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
218 : : };
219 : :
220 : 48 : inline const SwCntntFrm *SwTabFrm::FindLastCntnt() const
221 : : {
222 : 48 : return ((SwTabFrm*)this)->FindLastCntnt();
223 : : }
224 : :
225 : 16686 : inline const SwTabFrm *SwTabFrm::GetFollow() const
226 : : {
227 [ - + ]: 16686 : return (const SwTabFrm*)SwFlowFrm::GetFollow();
228 : : }
229 : 9458 : inline SwTabFrm *SwTabFrm::GetFollow()
230 : : {
231 [ - + ]: 9458 : return (SwTabFrm*)SwFlowFrm::GetFollow();
232 : : }
233 : :
234 : : #endif // SW_TABFRM_HXX
235 : :
236 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|