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