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