xref: /aoo4110/main/sw/source/core/inc/tabfrm.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SW_TABFRM_HXX
24 #define SW_TABFRM_HXX
25 
26 #include <tools/mempool.hxx>
27 #include "layfrm.hxx"
28 #include "flowfrm.hxx"
29 
30 class SwTable;
31 class SwBorderAttrs;
32 class SwAttrSetChg;
33 
34 class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
35 {
36     friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow );
37 
38     //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch.
39     using SwFrm::GetLeaf;
40     SwLayoutFrm *GetLeaf( MakePageType eMakePage, sal_Bool bFwd );
41 
42     SwTable* pTable;
43 
44     sal_Bool bComplete	        :1; //Eintrage als Repaint ohne das CompletePaint
45                                     //der Basisklasse gesetzt werden muss. Damit
46                                     //sollen unertraegliche Tabellen-Repaints
47                                     //vermieden werden.
48     sal_Bool bCalcLowers        :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet
49     //des Inhaltes sorgen.
50     sal_Bool bLowersFormatted   :1;//Kommunikation zwischen MakeAll und Layact
51     sal_Bool bLockBackMove      :1; //BackMove-Test hat der Master erledigt.
52     sal_Bool bResizeHTMLTable   :1; //Resize des HTMLTableLayout rufen im MakeAll
53     //Zur Optimierung, damit dies nicht im
54     //CntntFrm::Grow gerufen werden muss, denn dann
55     //wird es ggf. fuer jede Zelle gerufen #47483#
56     sal_Bool bONECalcLowers     :1; //Primaer fuer die StarONE-SS. Beim MakeAll werden
57     //die Cntnts auf jedenfall per Calc() formatiert.
58     //es finden keine zusaetzlichen Invalidierungen
59     //statt und dieser Weg kann auch kaum garantien
60     //geben.
61 
62     sal_Bool bHasFollowFlowLine :1; // Means that the first line in the follow
63                                 // is indented to contain content from a broken
64                                 // cell
65     sal_Bool bIsRebuildLastLine :1; // Means that currently the last line of the
66                                 // TabFrame is rebuilded. In this case we
67                                 // do not want any notification to the master
68                                 // table
69     sal_Bool bRestrictTableGrowth :1;       // Usually, the table may grow infinite,
70                                         // because the table can be split in
71                                         // SwTabFrm::MakeAll. In MakeAll, this
72                                         // flag is set to indicate that the table
73                                         // may only grow inside its upper. This
74                                         // is necessary, in order to let the text
75                                         // flow into the FollowFlowLine
76     sal_Bool bRemoveFollowFlowLinePending :1;
77     sal_Bool bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects
78                                            // are considered on the calculation
79                                            // for the minimal cell height.
80                                            // For splitting table rows algorithm
81                                            // it's needed not to consider floating
82                                            // screen object for the preparation
83                                            // of the re-calculation of the
84                                            // last table row.
85     sal_Bool bObjsDoesFit :1; // For splitting table rows algorithm, this boolean
86                           // indicates, if the floating screen objects fits
87 
88     bool mbInRecalcLowerRow : 1;
89 
90     //Split() spaltet den Frm an der angegebenen Stelle, es wird ein
91     //Follow erzeugt und aufgebaut und direkt hinter this gepastet.
92     //Join() Holt sich den Inhalt aus dem Follow und vernichtet diesen.
93     bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep );
94     bool Join();
95 
96     void _UpdateAttr(
97         const SfxPoolItem*,
98         const SfxPoolItem*, sal_uInt8 &,
99         SwAttrSetChg *pa = 0,
100         SwAttrSetChg *pb = 0 );
101 
102     virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat );
103 
104 protected:
105 	virtual void MakeAll();
106 	virtual void Format( const SwBorderAttrs *pAttrs = 0 );
107 	virtual	void Modify( const SfxPoolItem*, const SfxPoolItem* );
108 		//Aendert nur die Framesize, nicht die PrtArea-SSize
109     virtual SwTwips GrowFrm  ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
110 
111 public:
112 	SwTabFrm( SwTable &, SwFrm* );	//Immer nach dem erzeugen _und_ pasten das
113 							//Regist Flys rufen!
114 	SwTabFrm( SwTabFrm & );	//_Nur_ zum erzeugen von Follows
115 	~SwTabFrm();
116 
117 	void JoinAndDelFollows();	//Fuer DelFrms des TableNodes!
118 
119 	//Ruft das RegistFlys der Zeilen.
120 	void RegistFlys();
121 
122     inline const SwTabFrm *GetFollow() const;
123 	inline		 SwTabFrm *GetFollow();
124     SwTabFrm* FindMaster( bool bFirstMaster = false ) const;
125 
126 	virtual sal_Bool GetInfo( SfxPoolItem &rHnt ) const;
127     virtual void Paint( SwRect const&,
128                         SwPrintData const*const pPrintData = NULL ) const;
129     virtual void  CheckDirection( sal_Bool bVert );
130 
131 	virtual void Cut();
132 	virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
133 
134 	virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
135 						  const void *pVoid = 0, sal_Bool bNotify = sal_True );
136 
137                  SwCntntFrm *FindLastCntnt();
138 	inline const SwCntntFrm *FindLastCntnt() const;
139 
GetTable() const140 	const SwTable *GetTable() const { return pTable; }
GetTable()141 		  SwTable *GetTable() 		{ return pTable; }
142 
IsComplete()143 	sal_Bool IsComplete()  { return bComplete; }
SetComplete()144 	void SetComplete() { bComplete = sal_True; }
ResetComplete()145 	void ResetComplete() { bComplete = sal_False; }
146 
IsLowersFormatted() const147 	sal_Bool IsLowersFormatted() const 		{ return bLowersFormatted; }
SetLowersFormatted(sal_Bool b)148 	void SetLowersFormatted( sal_Bool b )	{ bLowersFormatted = b;    }
149 
SetCalcLowers()150 	void SetCalcLowers()		{ bCalcLowers = sal_True; 	   } //Sparsam einsetzen!
SetResizeHTMLTable()151 	void SetResizeHTMLTable()   { bResizeHTMLTable = sal_True; } //dito
SetONECalcLowers()152 	void SetONECalcLowers()		{ bONECalcLowers = sal_True;   }
153 
154     //
155     // Start: New stuff for breaking table rows
156     //
HasFollowFlowLine() const157     sal_Bool HasFollowFlowLine() const { return bHasFollowFlowLine; }
SetFollowFlowLine(sal_Bool bNew)158     void SetFollowFlowLine( sal_Bool bNew ) { bHasFollowFlowLine = bNew; }
159 
IsRebuildLastLine() const160     sal_Bool IsRebuildLastLine() const { return bIsRebuildLastLine; }
SetRebuildLastLine(sal_Bool bNew)161     void SetRebuildLastLine( sal_Bool bNew ) { bIsRebuildLastLine = bNew; }
162 
IsRestrictTableGrowth() const163     sal_Bool IsRestrictTableGrowth() const { return bRestrictTableGrowth; }
SetRestrictTableGrowth(sal_Bool bNew)164     void SetRestrictTableGrowth( sal_Bool bNew ) { bRestrictTableGrowth = bNew; }
165 
IsRemoveFollowFlowLinePending() const166     sal_Bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; }
SetRemoveFollowFlowLinePending(sal_Bool bNew)167     void SetRemoveFollowFlowLinePending( sal_Bool bNew ) { bRemoveFollowFlowLinePending = bNew; }
168 
IsInRecalcLowerRow() const169     bool IsInRecalcLowerRow() const
170     {
171         return mbInRecalcLowerRow;
172     }
SetInRecalcLowerRow(bool bNew)173     void SetInRecalcLowerRow( bool bNew )
174     {
175         mbInRecalcLowerRow = bNew;
176     }
177 
IsConsiderObjsForMinCellHeight() const178     sal_Bool IsConsiderObjsForMinCellHeight() const
179     {
180         return bConsiderObjsForMinCellHeight;
181     }
SetConsiderObjsForMinCellHeight(sal_Bool _bNewConsiderObjsForMinCellHeight)182     void SetConsiderObjsForMinCellHeight( sal_Bool _bNewConsiderObjsForMinCellHeight )
183     {
184         bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight;
185     }
186 
DoesObjsFit() const187     sal_Bool DoesObjsFit() const
188     {
189         return bObjsDoesFit;
190     }
SetDoesObjsFit(sal_Bool _bNewObjsDoesFit)191     void SetDoesObjsFit( sal_Bool _bNewObjsDoesFit )
192     {
193         bObjsDoesFit = _bNewObjsDoesFit;
194     }
195 
196     bool RemoveFollowFlowLine();
197     //
198     // End: New stuff for breaking table rows
199     //
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     bool IsCollapsingBorders() const;
214 
215     sal_uInt16 GetBottomLineSize() const;
216 
217     DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
218 };
219 
FindLastCntnt() const220 inline const SwCntntFrm *SwTabFrm::FindLastCntnt() const
221 {
222 	return ((SwTabFrm*)this)->FindLastCntnt();
223 }
224 
GetFollow() const225 inline const SwTabFrm *SwTabFrm::GetFollow() const
226 {
227 	return (const SwTabFrm*)SwFlowFrm::GetFollow();
228 }
GetFollow()229 inline SwTabFrm *SwTabFrm::GetFollow()
230 {
231 	return (SwTabFrm*)SwFlowFrm::GetFollow();
232 }
233 
234 #endif  // SW_TABFRM_HXX
235