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