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