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