1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10*efeef26fSAndrew Rist *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19*efeef26fSAndrew Rist *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <svl/smplhint.hxx>
28cdf0e10cSrcweir #include <svl/itemiter.hxx>
29cdf0e10cSrcweir #include <hints.hxx>
30cdf0e10cSrcweir #include <txtftn.hxx>
31cdf0e10cSrcweir #include <fmtftn.hxx>
32cdf0e10cSrcweir #include <fmtclbl.hxx>
33cdf0e10cSrcweir #include "sectfrm.hxx"
34cdf0e10cSrcweir #include "section.hxx" // SwSection
35cdf0e10cSrcweir #include "frmtool.hxx" // StackHack
36cdf0e10cSrcweir #include "doc.hxx" // SwDoc
37cdf0e10cSrcweir #include "cntfrm.hxx" // SwCntntFrm
38cdf0e10cSrcweir #include "rootfrm.hxx" // SwRootFrm
39cdf0e10cSrcweir #include "pagefrm.hxx" // SwPageFrm
40cdf0e10cSrcweir #include "fmtpdsc.hxx" // SwFmtPageDesc
41cdf0e10cSrcweir #include "fmtcntnt.hxx" // SwFmtCntnt
42cdf0e10cSrcweir #include "ndindex.hxx" // SwNodeIndex
43cdf0e10cSrcweir #include "ftnidx.hxx"
44cdf0e10cSrcweir #include "txtfrm.hxx" // SwTxtFrm
45cdf0e10cSrcweir #include "fmtclds.hxx" // SwFmtCol
46cdf0e10cSrcweir #include "colfrm.hxx" // SwColumnFrm
47cdf0e10cSrcweir #include "tabfrm.hxx" // SwTabFrm
48cdf0e10cSrcweir #include "flyfrm.hxx" // SwFlyFrm
49cdf0e10cSrcweir #include "ftnfrm.hxx" // SwFtnFrm
50cdf0e10cSrcweir #include "layouter.hxx" // SwLayouter
51cdf0e10cSrcweir #include "dbg_lay.hxx"
52cdf0e10cSrcweir #include "viewsh.hxx"
53cdf0e10cSrcweir #include "viewopt.hxx"
54cdf0e10cSrcweir #include "viewimp.hxx"
55cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
56cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
57cdf0e10cSrcweir #include <editeng/brshitem.hxx>
58cdf0e10cSrcweir #include <fmtftntx.hxx>
59cdf0e10cSrcweir // OD 2004-05-24 #i28701#
60cdf0e10cSrcweir #include <dflyobj.hxx>
61cdf0e10cSrcweir #include <flyfrms.hxx>
62cdf0e10cSrcweir #include <sortedobjs.hxx>
63cdf0e10cSrcweir
SV_IMPL_PTRARR_SORT(SwDestroyList,SwSectionFrmPtr)64cdf0e10cSrcweir SV_IMPL_PTRARR_SORT( SwDestroyList, SwSectionFrmPtr )
65cdf0e10cSrcweir
66cdf0e10cSrcweir /*************************************************************************
67cdf0e10cSrcweir |*
68cdf0e10cSrcweir |* SwSectionFrm::SwSectionFrm(), ~SwSectionFrm()
69cdf0e10cSrcweir |*
70cdf0e10cSrcweir |* Ersterstellung AMA 26. Nov. 97
71cdf0e10cSrcweir |* Letzte Aenderung AMA 26. Nov. 97
72cdf0e10cSrcweir |*
73cdf0e10cSrcweir |*************************************************************************/
74cdf0e10cSrcweir SwSectionFrm::SwSectionFrm( SwSection &rSect, SwFrm* pSib ) :
75cdf0e10cSrcweir SwLayoutFrm( rSect.GetFmt(), pSib ),
76cdf0e10cSrcweir SwFlowFrm( (SwFrm&)*this ),
77cdf0e10cSrcweir pSection( &rSect )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir nType = FRMC_SECTION;
80cdf0e10cSrcweir
81cdf0e10cSrcweir CalcFtnAtEndFlag();
82cdf0e10cSrcweir CalcEndAtEndFlag();
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
SwSectionFrm(SwSectionFrm & rSect,sal_Bool bMaster)85cdf0e10cSrcweir SwSectionFrm::SwSectionFrm( SwSectionFrm &rSect, sal_Bool bMaster ) :
86cdf0e10cSrcweir SwLayoutFrm( rSect.GetFmt(), rSect.getRootFrm() ),
87cdf0e10cSrcweir SwFlowFrm( (SwFrm&)*this ),
88cdf0e10cSrcweir pSection( rSect.GetSection() )
89cdf0e10cSrcweir {
90cdf0e10cSrcweir bFtnAtEnd = rSect.IsFtnAtEnd();
91cdf0e10cSrcweir bEndnAtEnd = rSect.IsEndnAtEnd();
92cdf0e10cSrcweir bLockJoin = sal_False;
93cdf0e10cSrcweir nType = FRMC_SECTION;
94cdf0e10cSrcweir
95cdf0e10cSrcweir PROTOCOL( this, PROT_SECTION, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect )
96cdf0e10cSrcweir
97cdf0e10cSrcweir if( bMaster )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir if( rSect.IsFollow() )
100cdf0e10cSrcweir {
101cdf0e10cSrcweir SwSectionFrm* pMaster = rSect.FindMaster();
102cdf0e10cSrcweir pMaster->SetFollow( this );
103cdf0e10cSrcweir bIsFollow = sal_True;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir else
106cdf0e10cSrcweir rSect.bIsFollow = sal_True;
107cdf0e10cSrcweir SetFollow( &rSect );
108cdf0e10cSrcweir }
109cdf0e10cSrcweir else
110cdf0e10cSrcweir {
111cdf0e10cSrcweir bIsFollow = sal_True;
112cdf0e10cSrcweir SetFollow( rSect.GetFollow() );
113cdf0e10cSrcweir rSect.SetFollow( this );
114cdf0e10cSrcweir if( !GetFollow() )
115cdf0e10cSrcweir rSect.SimpleFormat();
116cdf0e10cSrcweir if( !rSect.IsColLocked() )
117cdf0e10cSrcweir rSect.InvalidateSize();
118cdf0e10cSrcweir }
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
121cdf0e10cSrcweir // NOTE: call <SwSectionFrm::Init()> directly after creation of a new section
122cdf0e10cSrcweir // frame and its insert in the layout.
Init()123cdf0e10cSrcweir void SwSectionFrm::Init()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir ASSERT( GetUpper(), "SwSectionFrm::Init before insertion?!" );
126cdf0e10cSrcweir SWRECTFN( this )
127cdf0e10cSrcweir long nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
128cdf0e10cSrcweir (Frm().*fnRect->fnSetWidth)( nWidth );
129cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( 0 );
130cdf0e10cSrcweir
131cdf0e10cSrcweir // #109700# LRSpace for sections
132cdf0e10cSrcweir const SvxLRSpaceItem& rLRSpace = GetFmt()->GetLRSpace();
133cdf0e10cSrcweir (Prt().*fnRect->fnSetLeft)( rLRSpace.GetLeft() );
134cdf0e10cSrcweir (Prt().*fnRect->fnSetWidth)( nWidth - rLRSpace.GetLeft() -
135cdf0e10cSrcweir rLRSpace.GetRight() );
136cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( 0 );
137cdf0e10cSrcweir
138cdf0e10cSrcweir const SwFmtCol &rCol = GetFmt()->GetCol();
139cdf0e10cSrcweir if( ( rCol.GetNumCols() > 1 || IsAnyNoteAtEnd() ) && !IsInFtn() )
140cdf0e10cSrcweir {
141cdf0e10cSrcweir const SwFmtCol *pOld = Lower() ? &rCol : new SwFmtCol;
142cdf0e10cSrcweir ChgColumns( *pOld, rCol, IsAnyNoteAtEnd() );
143cdf0e10cSrcweir if( pOld != &rCol )
144cdf0e10cSrcweir delete pOld;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir }
147cdf0e10cSrcweir
~SwSectionFrm()148cdf0e10cSrcweir SwSectionFrm::~SwSectionFrm()
149cdf0e10cSrcweir {
150cdf0e10cSrcweir if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir SwRootFrm *pRootFrm = getRootFrm();
153cdf0e10cSrcweir if( pRootFrm )
154cdf0e10cSrcweir pRootFrm->RemoveFromList( this ); //swmod 071108//swmod 071225
155cdf0e10cSrcweir if( IsFollow() )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir SwSectionFrm *pMaster = FindMaster();
158cdf0e10cSrcweir if( pMaster )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir PROTOCOL( this, PROT_SECTION, ACT_DEL_FOLLOW, pMaster )
161cdf0e10cSrcweir pMaster->SetFollow( GetFollow() );
162cdf0e10cSrcweir // Ein Master greift sich immer den Platz bis zur Unterkante seines
163cdf0e10cSrcweir // Uppers. Wenn er keinen Follow mehr hat, kann er diesen ggf. wieder
164cdf0e10cSrcweir // freigeben, deshalb wird die Size des Masters invalidiert.
165cdf0e10cSrcweir if( !GetFollow() )
166cdf0e10cSrcweir pMaster->InvalidateSize();
167cdf0e10cSrcweir }
168cdf0e10cSrcweir }
169cdf0e10cSrcweir else if( HasFollow() )
170cdf0e10cSrcweir {
171cdf0e10cSrcweir PROTOCOL( this, PROT_SECTION, ACT_DEL_MASTER, GetFollow() )
172cdf0e10cSrcweir GetFollow()->bIsFollow = sal_False;
173cdf0e10cSrcweir }
174cdf0e10cSrcweir }
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
177cdf0e10cSrcweir
178cdf0e10cSrcweir /*************************************************************************
179cdf0e10cSrcweir |*
180cdf0e10cSrcweir |* SwSectionFrm::DelEmpty()
181cdf0e10cSrcweir |*
182cdf0e10cSrcweir |* Ersterstellung AMA 17. Dec. 97
183cdf0e10cSrcweir |* Letzte Aenderung AMA 17. Dec. 97
184cdf0e10cSrcweir |*
185cdf0e10cSrcweir |*************************************************************************/
DelEmpty(sal_Bool bRemove)186cdf0e10cSrcweir void SwSectionFrm::DelEmpty( sal_Bool bRemove )
187cdf0e10cSrcweir {
188cdf0e10cSrcweir if( IsColLocked() )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir ASSERT( !bRemove, "Don't delete locked SectionFrms" );
191cdf0e10cSrcweir return;
192cdf0e10cSrcweir }
193cdf0e10cSrcweir SwFrm* pUp = GetUpper();
194cdf0e10cSrcweir if( pUp )
195cdf0e10cSrcweir {
196cdf0e10cSrcweir // --> OD 2005-12-01 #i27138#
197cdf0e10cSrcweir // notify accessibility paragraphs objects about changed
198cdf0e10cSrcweir // CONTENT_FLOWS_FROM/_TO relation.
199cdf0e10cSrcweir // Relation CONTENT_FLOWS_FROM for current next paragraph will change
200cdf0e10cSrcweir // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
201cdf0e10cSrcweir {
202cdf0e10cSrcweir ViewShell* pViewShell( getRootFrm()->GetCurrShell() );
203cdf0e10cSrcweir if ( pViewShell && pViewShell->GetLayout() &&
204cdf0e10cSrcweir pViewShell->GetLayout()->IsAnyShellAccessible() )
205cdf0e10cSrcweir {
206cdf0e10cSrcweir pViewShell->InvalidateAccessibleParaFlowRelation(
207cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(FindNextCnt( true )),
208cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(FindPrevCnt( true )) );
209cdf0e10cSrcweir }
210cdf0e10cSrcweir }
211cdf0e10cSrcweir // <--
212cdf0e10cSrcweir _Cut( bRemove );
213cdf0e10cSrcweir }
214cdf0e10cSrcweir if( IsFollow() )
215cdf0e10cSrcweir {
216cdf0e10cSrcweir SwSectionFrm *pMaster = FindMaster();
217cdf0e10cSrcweir pMaster->SetFollow( GetFollow() );
218cdf0e10cSrcweir // Ein Master greift sich immer den Platz bis zur Unterkante seines
219cdf0e10cSrcweir // Uppers. Wenn er keinen Follow mehr hat, kann er diesen ggf. wieder
220cdf0e10cSrcweir // freigeben, deshalb wird die Size des Masters invalidiert.
221cdf0e10cSrcweir if( !GetFollow() && !pMaster->IsColLocked() )
222cdf0e10cSrcweir pMaster->InvalidateSize();
223cdf0e10cSrcweir bIsFollow = sal_False;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir else if( HasFollow() )
226cdf0e10cSrcweir GetFollow()->bIsFollow = sal_False;
227cdf0e10cSrcweir pFollow = NULL;
228cdf0e10cSrcweir if( pUp )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir Frm().Height( 0 );
231cdf0e10cSrcweir // Wenn wir sowieso sofort zerstoert werden, brauchen/duerfen wir
232cdf0e10cSrcweir // uns gar nicht erst in die Liste eintragen
233cdf0e10cSrcweir if( bRemove )
234cdf0e10cSrcweir { // Wenn wir bereits halbtot waren vor diesem DelEmpty, so
235cdf0e10cSrcweir // stehen wir vermutlich auch in der Liste und muessen uns
236cdf0e10cSrcweir // dort austragen
237cdf0e10cSrcweir if( !pSection && getRootFrm() )
238cdf0e10cSrcweir getRootFrm()->RemoveFromList( this );
239cdf0e10cSrcweir }
240cdf0e10cSrcweir else if( getRootFrm() )
241cdf0e10cSrcweir getRootFrm()->InsertEmptySct( this ); //swmod 071108//swmod 071225
242cdf0e10cSrcweir pSection = NULL; // damit ist allerdings eine Reanimierung quasi ausgeschlossen
243cdf0e10cSrcweir }
244cdf0e10cSrcweir }
245cdf0e10cSrcweir
246cdf0e10cSrcweir /*************************************************************************
247cdf0e10cSrcweir |*
248cdf0e10cSrcweir |* SwSectionFrm::Cut()
249cdf0e10cSrcweir |*
250cdf0e10cSrcweir |* Ersterstellung AMA 02. Dec. 97
251cdf0e10cSrcweir |* Letzte Aenderung AMA 02. Dec. 97
252cdf0e10cSrcweir |*
253cdf0e10cSrcweir |*************************************************************************/
Cut()254cdf0e10cSrcweir void SwSectionFrm::Cut()
255cdf0e10cSrcweir {
256cdf0e10cSrcweir _Cut( sal_True );
257cdf0e10cSrcweir }
258cdf0e10cSrcweir
_Cut(sal_Bool bRemove)259cdf0e10cSrcweir void SwSectionFrm::_Cut( sal_Bool bRemove )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir ASSERT( GetUpper(), "Cut ohne Upper()." );
262cdf0e10cSrcweir
263cdf0e10cSrcweir PROTOCOL( this, PROT_CUT, 0, GetUpper() )
264cdf0e10cSrcweir
265cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
266cdf0e10cSrcweir InvalidatePage( pPage );
267cdf0e10cSrcweir SwFrm *pFrm = GetNext();
268cdf0e10cSrcweir SwFrm* pPrepFrm = NULL;
269cdf0e10cSrcweir while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
270cdf0e10cSrcweir pFrm = pFrm->GetNext();
271cdf0e10cSrcweir if( pFrm )
272cdf0e10cSrcweir { //Der alte Nachfolger hat evtl. einen Abstand zum Vorgaenger
273cdf0e10cSrcweir //berechnet der ist jetzt wo er der erste wird obsolete
274cdf0e10cSrcweir pFrm->_InvalidatePrt();
275cdf0e10cSrcweir pFrm->_InvalidatePos();
276cdf0e10cSrcweir if( pFrm->IsSctFrm() )
277cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
278cdf0e10cSrcweir if ( pFrm && pFrm->IsCntntFrm() )
279cdf0e10cSrcweir {
280cdf0e10cSrcweir pFrm->InvalidatePage( pPage );
281cdf0e10cSrcweir if( IsInFtn() && !GetIndPrev() )
282cdf0e10cSrcweir pPrepFrm = pFrm;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir }
285cdf0e10cSrcweir else
286cdf0e10cSrcweir {
287cdf0e10cSrcweir InvalidateNextPos();
288cdf0e10cSrcweir //Einer muss die Retusche uebernehmen: Vorgaenger oder Upper
289cdf0e10cSrcweir if ( 0 != (pFrm = GetPrev()) )
290cdf0e10cSrcweir { pFrm->SetRetouche();
291cdf0e10cSrcweir pFrm->Prepare( PREP_WIDOWS_ORPHANS );
292cdf0e10cSrcweir if ( pFrm->IsCntntFrm() )
293cdf0e10cSrcweir pFrm->InvalidatePage( pPage );
294cdf0e10cSrcweir }
295cdf0e10cSrcweir //Wenn ich der einzige FlowFrm in meinem Upper bin (war), so muss
296cdf0e10cSrcweir //er die Retouche uebernehmen.
297cdf0e10cSrcweir //Ausserdem kann eine Leerseite entstanden sein.
298cdf0e10cSrcweir else
299cdf0e10cSrcweir { SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
300cdf0e10cSrcweir pRoot->SetSuperfluous();
301cdf0e10cSrcweir GetUpper()->SetCompletePaint();
302cdf0e10cSrcweir }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir //Erst removen, dann Upper Shrinken.
305cdf0e10cSrcweir SwLayoutFrm *pUp = GetUpper();
306cdf0e10cSrcweir if( bRemove )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir Remove();
309cdf0e10cSrcweir if( pUp && !pUp->Lower() && pUp->IsFtnFrm() && !pUp->IsColLocked() &&
310cdf0e10cSrcweir pUp->GetUpper() )
311cdf0e10cSrcweir {
312cdf0e10cSrcweir pUp->Cut();
313cdf0e10cSrcweir delete pUp;
314cdf0e10cSrcweir pUp = NULL;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir }
317cdf0e10cSrcweir if( pPrepFrm )
318cdf0e10cSrcweir pPrepFrm->Prepare( PREP_FTN );
319cdf0e10cSrcweir if ( pUp )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir SWRECTFN( this );
322cdf0e10cSrcweir SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
323cdf0e10cSrcweir if( nFrmHeight > 0 )
324cdf0e10cSrcweir {
325cdf0e10cSrcweir if( !bRemove )
326cdf0e10cSrcweir {
327cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( 0 );
328cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( 0 );
329cdf0e10cSrcweir }
330cdf0e10cSrcweir pUp->Shrink( nFrmHeight );
331cdf0e10cSrcweir }
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir
335cdf0e10cSrcweir /*************************************************************************
336cdf0e10cSrcweir |*
337cdf0e10cSrcweir |* SwSectionFrm::Paste()
338cdf0e10cSrcweir |*
339cdf0e10cSrcweir |* Ersterstellung AMA 04. Dec. 97
340cdf0e10cSrcweir |* Letzte Aenderung AMA 04. Dec. 97
341cdf0e10cSrcweir |*
342cdf0e10cSrcweir |*************************************************************************/
343cdf0e10cSrcweir
Paste(SwFrm * pParent,SwFrm * pSibling)344cdf0e10cSrcweir void SwSectionFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
345cdf0e10cSrcweir {
346cdf0e10cSrcweir ASSERT( pParent, "Kein Parent fuer Paste." );
347cdf0e10cSrcweir ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
348cdf0e10cSrcweir ASSERT( pParent != this, "Bin selbst der Parent." );
349cdf0e10cSrcweir ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
350cdf0e10cSrcweir ASSERT( !GetPrev() && !GetUpper(),
351cdf0e10cSrcweir "Bin noch irgendwo angemeldet." );
352cdf0e10cSrcweir
353cdf0e10cSrcweir PROTOCOL( this, PROT_PASTE, 0, GetUpper() )
354cdf0e10cSrcweir
355cdf0e10cSrcweir //In den Baum einhaengen.
356cdf0e10cSrcweir SwSectionFrm* pSect = pParent->FindSctFrm();
357cdf0e10cSrcweir // --> OD 2008-06-23 #156927#
358cdf0e10cSrcweir // Assure that parent is not inside a table frame, which is inside the found section frame.
359cdf0e10cSrcweir if ( pSect )
360cdf0e10cSrcweir {
361cdf0e10cSrcweir SwTabFrm* pTableFrm = pParent->FindTabFrm();
362cdf0e10cSrcweir if ( pTableFrm &&
363cdf0e10cSrcweir pSect->IsAnLower( pTableFrm ) )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir pSect = 0;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir }
368cdf0e10cSrcweir // <--
369cdf0e10cSrcweir
370cdf0e10cSrcweir SWRECTFN( pParent )
371cdf0e10cSrcweir if( pSect && HasToBreak( pSect ) )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir if( pParent->IsColBodyFrm() ) // handelt es sich um einen spaltigen Bereich
374cdf0e10cSrcweir {
375cdf0e10cSrcweir // Falls wir zufaellig am Ende einer Spalte stehen, muss pSibling
376cdf0e10cSrcweir // auf den ersten Frame der naechsten Spalte zeigen, damit
377cdf0e10cSrcweir // der Inhalt der naechsten Spalte von InsertGroup richtig in den
378cdf0e10cSrcweir // neu angelegten pSect umgehaengt wird.
379cdf0e10cSrcweir SwColumnFrm *pCol = (SwColumnFrm*)pParent->GetUpper();
380cdf0e10cSrcweir while( !pSibling && 0 != ( pCol = (SwColumnFrm*)pCol->GetNext() ) )
381cdf0e10cSrcweir pSibling = ((SwLayoutFrm*)((SwColumnFrm*)pCol)->Lower())->Lower();
382cdf0e10cSrcweir if( pSibling )
383cdf0e10cSrcweir {
384cdf0e10cSrcweir // Schlimmer noch: alle folgenden Spalteninhalte muessen
385cdf0e10cSrcweir // an die pSibling-Kette angehaengt werden, damit sie
386cdf0e10cSrcweir // mitgenommen werden.
387cdf0e10cSrcweir SwFrm *pTmp = pSibling;
388cdf0e10cSrcweir while ( 0 != ( pCol = (SwColumnFrm*)pCol->GetNext() ) )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir while ( pTmp->GetNext() )
391cdf0e10cSrcweir pTmp = pTmp->GetNext();
392cdf0e10cSrcweir SwFrm* pSave = ::SaveCntnt( pCol );
393cdf0e10cSrcweir ::RestoreCntnt( pSave, pSibling->GetUpper(), pTmp, true );
394cdf0e10cSrcweir }
395cdf0e10cSrcweir }
396cdf0e10cSrcweir }
397cdf0e10cSrcweir pParent = pSect;
398cdf0e10cSrcweir pSect = new SwSectionFrm( *((SwSectionFrm*)pParent)->GetSection(), pParent );
399cdf0e10cSrcweir // Wenn pParent in zwei Teile zerlegt wird, so muss sein Follow am
400cdf0e10cSrcweir // neuen, zweiten Teil angebracht werden.
401cdf0e10cSrcweir pSect->SetFollow( ((SwSectionFrm*)pParent)->GetFollow() );
402cdf0e10cSrcweir ((SwSectionFrm*)pParent)->SetFollow( NULL );
403cdf0e10cSrcweir if( pSect->GetFollow() )
404cdf0e10cSrcweir pParent->_InvalidateSize();
405cdf0e10cSrcweir
406cdf0e10cSrcweir InsertGroupBefore( pParent, pSibling, pSect );
407cdf0e10cSrcweir pSect->Init();
408cdf0e10cSrcweir (pSect->*fnRect->fnMakePos)( pSect->GetUpper(), pSect->GetPrev(), sal_True);
409cdf0e10cSrcweir if( !((SwLayoutFrm*)pParent)->Lower() )
410cdf0e10cSrcweir {
411cdf0e10cSrcweir SwSectionFrm::MoveCntntAndDelete( (SwSectionFrm*)pParent, sal_False );
412cdf0e10cSrcweir pParent = this;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir }
415cdf0e10cSrcweir else
416cdf0e10cSrcweir InsertGroupBefore( pParent, pSibling, NULL );
417cdf0e10cSrcweir
418cdf0e10cSrcweir _InvalidateAll();
419cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
420cdf0e10cSrcweir InvalidatePage( pPage );
421cdf0e10cSrcweir
422cdf0e10cSrcweir if ( pSibling )
423cdf0e10cSrcweir {
424cdf0e10cSrcweir pSibling->_InvalidatePos();
425cdf0e10cSrcweir pSibling->_InvalidatePrt();
426cdf0e10cSrcweir if ( pSibling->IsCntntFrm() )
427cdf0e10cSrcweir pSibling->InvalidatePage( pPage );
428cdf0e10cSrcweir }
429cdf0e10cSrcweir
430cdf0e10cSrcweir SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
431cdf0e10cSrcweir if( nFrmHeight )
432cdf0e10cSrcweir pParent->Grow( nFrmHeight );
433cdf0e10cSrcweir
434cdf0e10cSrcweir if ( GetPrev() )
435cdf0e10cSrcweir {
436cdf0e10cSrcweir if ( !IsFollow() )
437cdf0e10cSrcweir {
438cdf0e10cSrcweir GetPrev()->InvalidateSize();
439cdf0e10cSrcweir if ( GetPrev()->IsCntntFrm() )
440cdf0e10cSrcweir GetPrev()->InvalidatePage( pPage );
441cdf0e10cSrcweir }
442cdf0e10cSrcweir }
443cdf0e10cSrcweir }
444cdf0e10cSrcweir
445cdf0e10cSrcweir
446cdf0e10cSrcweir /*************************************************************************
447cdf0e10cSrcweir |*
448cdf0e10cSrcweir |* SwSectionFrm::HasToBreak()
449cdf0e10cSrcweir |*
450cdf0e10cSrcweir |* Hier wird entschieden, ob der this-SectionFrm den uebergebenen
451cdf0e10cSrcweir |* (Section)Frm aufbrechen soll oder nicht.
452cdf0e10cSrcweir |* Zunaechst werden uebergeordnete Bereiche immer aufgebrochen,
453cdf0e10cSrcweir |* spaeter koennte man es einstellbar machen.
454cdf0e10cSrcweir |*
455cdf0e10cSrcweir |* Ersterstellung AMA 12. Dec. 97
456cdf0e10cSrcweir |* Letzte Aenderung AMA 12. Dec. 97
457cdf0e10cSrcweir |*
458cdf0e10cSrcweir |*************************************************************************/
459cdf0e10cSrcweir
HasToBreak(const SwFrm * pFrm) const460cdf0e10cSrcweir sal_Bool SwSectionFrm::HasToBreak( const SwFrm* pFrm ) const
461cdf0e10cSrcweir {
462cdf0e10cSrcweir if( !pFrm->IsSctFrm() )
463cdf0e10cSrcweir return sal_False;
464cdf0e10cSrcweir
465cdf0e10cSrcweir SwSectionFmt *pTmp = (SwSectionFmt*)GetFmt();
466cdf0e10cSrcweir // if( !pTmp->GetSect().GetValue() )
467cdf0e10cSrcweir // return sal_False;
468cdf0e10cSrcweir
469cdf0e10cSrcweir const SwFrmFmt *pOtherFmt = ((SwSectionFrm*)pFrm)->GetFmt();
470cdf0e10cSrcweir do
471cdf0e10cSrcweir {
472cdf0e10cSrcweir pTmp = pTmp->GetParent();
473cdf0e10cSrcweir if( !pTmp )
474cdf0e10cSrcweir return sal_False;
475cdf0e10cSrcweir if( pTmp == pOtherFmt )
476cdf0e10cSrcweir return sal_True;
477cdf0e10cSrcweir } while( sal_True ); // ( pTmp->GetSect().GetValue() );
478cdf0e10cSrcweir }
479cdf0e10cSrcweir
480cdf0e10cSrcweir /*************************************************************************
481cdf0e10cSrcweir |*
482cdf0e10cSrcweir |* SwSectionFrm::MergeNext()
483cdf0e10cSrcweir |*
484cdf0e10cSrcweir |* Ersterstellung AMA 04. Dec. 97
485cdf0e10cSrcweir |* Letzte Aenderung AMA 04. Dec. 97
486cdf0e10cSrcweir |*
487cdf0e10cSrcweir |* Verschmilzt zwei SectionFrms, falls es sich um den
488cdf0e10cSrcweir |* gleichen Bereich handelt.
489cdf0e10cSrcweir |* Notwendig kann dies sein, wenn ein (Unter-)Bereich geloescht wird, der
490cdf0e10cSrcweir |* einen anderen in zwei Teile zerlegt hatte.
491cdf0e10cSrcweir |*
492cdf0e10cSrcweir |*************************************************************************/
493cdf0e10cSrcweir
MergeNext(SwSectionFrm * pNxt)494cdf0e10cSrcweir void SwSectionFrm::MergeNext( SwSectionFrm* pNxt )
495cdf0e10cSrcweir {
496cdf0e10cSrcweir if( !pNxt->IsJoinLocked() && GetSection() == pNxt->GetSection() )
497cdf0e10cSrcweir {
498cdf0e10cSrcweir PROTOCOL( this, PROT_SECTION, ACT_MERGE, pNxt )
499cdf0e10cSrcweir
500cdf0e10cSrcweir SwFrm* pTmp = ::SaveCntnt( pNxt );
501cdf0e10cSrcweir if( pTmp )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir SwFrm* pLast = Lower();
504cdf0e10cSrcweir SwLayoutFrm* pLay = this;
505cdf0e10cSrcweir if( pLast )
506cdf0e10cSrcweir {
507cdf0e10cSrcweir while( pLast->GetNext() )
508cdf0e10cSrcweir pLast = pLast->GetNext();
509cdf0e10cSrcweir if( pLast->IsColumnFrm() )
510cdf0e10cSrcweir { // Spalten jetzt mit BodyFrm
511cdf0e10cSrcweir pLay = (SwLayoutFrm*)((SwLayoutFrm*)pLast)->Lower();
512cdf0e10cSrcweir pLast = pLay->Lower();
513cdf0e10cSrcweir if( pLast )
514cdf0e10cSrcweir while( pLast->GetNext() )
515cdf0e10cSrcweir pLast = pLast->GetNext();
516cdf0e10cSrcweir }
517cdf0e10cSrcweir }
518cdf0e10cSrcweir ::RestoreCntnt( pTmp, pLay, pLast, true );
519cdf0e10cSrcweir }
520cdf0e10cSrcweir SetFollow( pNxt->GetFollow() );
521cdf0e10cSrcweir pNxt->SetFollow( NULL );
522cdf0e10cSrcweir pNxt->bIsFollow = sal_False;
523cdf0e10cSrcweir pNxt->Cut();
524cdf0e10cSrcweir delete pNxt;
525cdf0e10cSrcweir InvalidateSize();
526cdf0e10cSrcweir }
527cdf0e10cSrcweir }
528cdf0e10cSrcweir
529cdf0e10cSrcweir /*************************************************************************
530cdf0e10cSrcweir |*
531cdf0e10cSrcweir |* SwSectionFrm::SplitSect()
532cdf0e10cSrcweir |*
533cdf0e10cSrcweir |* Ersterstellung AMA 29. Apr. 99
534cdf0e10cSrcweir |* Letzte Aenderung AMA 29. Apr. 99
535cdf0e10cSrcweir |*
536cdf0e10cSrcweir |* Zerteilt einen SectionFrm in zwei Teile, der zweite Teil beginnt mit dem
537cdf0e10cSrcweir |* uebergebenen Frame.
538cdf0e10cSrcweir |* Benoetigt wird dies beim Einfuegen eines inneren Bereichs, weil innerhalb
539cdf0e10cSrcweir |* von Rahmen oder Tabellenzellen das MoveFwd nicht den erwuenschten Effekt
540cdf0e10cSrcweir |* haben kann.
541cdf0e10cSrcweir |*
542cdf0e10cSrcweir |*************************************************************************/
543cdf0e10cSrcweir
SplitSect(SwFrm * pFrm,sal_Bool bApres)544cdf0e10cSrcweir sal_Bool SwSectionFrm::SplitSect( SwFrm* pFrm, sal_Bool bApres )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir ASSERT( pFrm, "SplitSect: Why?" );
547cdf0e10cSrcweir SwFrm* pOther = bApres ? pFrm->FindNext() : pFrm->FindPrev();
548cdf0e10cSrcweir if( !pOther )
549cdf0e10cSrcweir return sal_False;
550cdf0e10cSrcweir SwSectionFrm* pSect = pOther->FindSctFrm();
551cdf0e10cSrcweir if( pSect != this )
552cdf0e10cSrcweir return sal_False;
553cdf0e10cSrcweir // Den Inhalt zur Seite stellen
554cdf0e10cSrcweir SwFrm* pSav = ::SaveCntnt( this, bApres ? pOther : pFrm );
555cdf0e10cSrcweir ASSERT( pSav, "SplitSect: What's on?" );
556cdf0e10cSrcweir if( pSav ) // Robust
557cdf0e10cSrcweir { // Einen neuen SctFrm anlegen, nicht als Follow/Master
558cdf0e10cSrcweir SwSectionFrm* pNew = new SwSectionFrm( *pSect->GetSection(), pSect );
559cdf0e10cSrcweir pNew->InsertBehind( pSect->GetUpper(), pSect );
560cdf0e10cSrcweir pNew->Init();
561cdf0e10cSrcweir SWRECTFN( this )
562cdf0e10cSrcweir (pNew->*fnRect->fnMakePos)( NULL, pSect, sal_True );
563cdf0e10cSrcweir // OD 25.03.2003 #108339# - restore content:
564cdf0e10cSrcweir // determine layout frame for restoring content after the initialization
565cdf0e10cSrcweir // of the section frame. In the section initialization the columns are
566cdf0e10cSrcweir // created.
567cdf0e10cSrcweir {
568cdf0e10cSrcweir SwLayoutFrm* pLay = pNew;
569cdf0e10cSrcweir // Search for last layout frame, e.g. for columned sections.
570cdf0e10cSrcweir while( pLay->Lower() && pLay->Lower()->IsLayoutFrm() )
571cdf0e10cSrcweir pLay = (SwLayoutFrm*)pLay->Lower();
572cdf0e10cSrcweir ::RestoreCntnt( pSav, pLay, NULL, true );
573cdf0e10cSrcweir }
574cdf0e10cSrcweir _InvalidateSize();
575cdf0e10cSrcweir if( HasFollow() )
576cdf0e10cSrcweir {
577cdf0e10cSrcweir pNew->SetFollow( GetFollow() );
578cdf0e10cSrcweir SetFollow( NULL );
579cdf0e10cSrcweir }
580cdf0e10cSrcweir return sal_True;
581cdf0e10cSrcweir }
582cdf0e10cSrcweir return sal_False;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir
585cdf0e10cSrcweir /*************************************************************************
586cdf0e10cSrcweir |*
587cdf0e10cSrcweir |* SwSectionFrm::MoveCntntAndDelete()
588cdf0e10cSrcweir |*
589cdf0e10cSrcweir |* Ersterstellung AMA 29. Jan 99
590cdf0e10cSrcweir |* Letzte Aenderung AMA 29. Jan 99
591cdf0e10cSrcweir |*
592cdf0e10cSrcweir |* MoveCntnt wird zur Zerstoerung eines SectionFrms wg. Aufhebung oder
593cdf0e10cSrcweir |* Verstecken des Bereichs gerufen, um den Inhalt umzuhaengen.
594cdf0e10cSrcweir |* Wenn der SectionFrm keinen anderen aufbrach, so wird der Inhalt in
595cdf0e10cSrcweir |* den Upper bewegt. Anderfalls wird der Inhalt in den anderen SectionFrm
596cdf0e10cSrcweir |* umgehaengt, dieser muss ggf. gemergt werden.
597cdf0e10cSrcweir |*
598cdf0e10cSrcweir |*************************************************************************/
599cdf0e10cSrcweir // Wenn ein mehrspaltiger Bereich aufgehoben wird, muessen die ContentFrms
600cdf0e10cSrcweir // invalidiert werden
601cdf0e10cSrcweir
lcl_InvalidateInfFlags(SwFrm * pFrm,sal_Bool bInva)602cdf0e10cSrcweir void lcl_InvalidateInfFlags( SwFrm* pFrm, sal_Bool bInva )
603cdf0e10cSrcweir {
604cdf0e10cSrcweir while ( pFrm )
605cdf0e10cSrcweir {
606cdf0e10cSrcweir pFrm->InvalidateInfFlags();
607cdf0e10cSrcweir if( bInva )
608cdf0e10cSrcweir {
609cdf0e10cSrcweir pFrm->_InvalidatePos();
610cdf0e10cSrcweir pFrm->_InvalidateSize();
611cdf0e10cSrcweir pFrm->_InvalidatePrt();
612cdf0e10cSrcweir }
613cdf0e10cSrcweir if( pFrm->IsLayoutFrm() )
614cdf0e10cSrcweir lcl_InvalidateInfFlags( ((SwLayoutFrm*)pFrm)->GetLower(), sal_False );
615cdf0e10cSrcweir pFrm = pFrm->GetNext();
616cdf0e10cSrcweir }
617cdf0e10cSrcweir }
618cdf0e10cSrcweir
619cdf0e10cSrcweir
620cdf0e10cSrcweir //
621cdf0e10cSrcweir // Works like SwCntntFrm::ImplGetNextCntntFrm, but starts with a LayoutFrm
622cdf0e10cSrcweir //
lcl_GetNextCntntFrm(const SwLayoutFrm * pLay,bool bFwd)623cdf0e10cSrcweir SwCntntFrm* lcl_GetNextCntntFrm( const SwLayoutFrm* pLay, bool bFwd )
624cdf0e10cSrcweir {
625cdf0e10cSrcweir if ( bFwd )
626cdf0e10cSrcweir {
627cdf0e10cSrcweir if ( pLay->GetNext() && pLay->GetNext()->IsCntntFrm() )
628cdf0e10cSrcweir return (SwCntntFrm*)pLay->GetNext();
629cdf0e10cSrcweir }
630cdf0e10cSrcweir else
631cdf0e10cSrcweir {
632cdf0e10cSrcweir if ( pLay->GetPrev() && pLay->GetPrev()->IsCntntFrm() )
633cdf0e10cSrcweir return (SwCntntFrm*)pLay->GetPrev();
634cdf0e10cSrcweir }
635cdf0e10cSrcweir
636cdf0e10cSrcweir // #100926#
637cdf0e10cSrcweir const SwFrm* pFrm = pLay;
638cdf0e10cSrcweir SwCntntFrm *pCntntFrm = 0;
639cdf0e10cSrcweir sal_Bool bGoingUp = sal_True;
640cdf0e10cSrcweir do {
641cdf0e10cSrcweir const SwFrm *p = 0;
642cdf0e10cSrcweir sal_Bool bGoingFwdOrBwd = sal_False, bGoingDown = sal_False;
643cdf0e10cSrcweir
644cdf0e10cSrcweir bGoingDown = !bGoingUp && ( 0 != ( p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0 ) );
645cdf0e10cSrcweir if ( !bGoingDown )
646cdf0e10cSrcweir {
647cdf0e10cSrcweir bGoingFwdOrBwd = ( 0 != ( p = pFrm->IsFlyFrm() ?
648cdf0e10cSrcweir ( bFwd ? ((SwFlyFrm*)pFrm)->GetNextLink() : ((SwFlyFrm*)pFrm)->GetPrevLink() ) :
649cdf0e10cSrcweir ( bFwd ? pFrm->GetNext() :pFrm->GetPrev() ) ) );
650cdf0e10cSrcweir if ( !bGoingFwdOrBwd )
651cdf0e10cSrcweir {
652cdf0e10cSrcweir bGoingUp = (0 != (p = pFrm->GetUpper() ) );
653cdf0e10cSrcweir if ( !bGoingUp )
654cdf0e10cSrcweir return 0;
655cdf0e10cSrcweir }
656cdf0e10cSrcweir }
657cdf0e10cSrcweir
658cdf0e10cSrcweir bGoingUp = !( bGoingFwdOrBwd || bGoingDown );
659cdf0e10cSrcweir
660cdf0e10cSrcweir if( !bFwd && bGoingDown && p )
661cdf0e10cSrcweir while ( p->GetNext() )
662cdf0e10cSrcweir p = p->GetNext();
663cdf0e10cSrcweir
664cdf0e10cSrcweir pFrm = p;
665cdf0e10cSrcweir } while ( 0 == (pCntntFrm = (pFrm->IsCntntFrm() ? (SwCntntFrm*)pFrm:0) ));
666cdf0e10cSrcweir
667cdf0e10cSrcweir return pCntntFrm;
668cdf0e10cSrcweir }
669cdf0e10cSrcweir
670cdf0e10cSrcweir #define FIRSTLEAF( pLayFrm ) ( ( pLayFrm->Lower() && pLayFrm->Lower()->IsColumnFrm() )\
671cdf0e10cSrcweir ? pLayFrm->GetNextLayoutLeaf() \
672cdf0e10cSrcweir : pLayFrm )
673cdf0e10cSrcweir
MoveCntntAndDelete(SwSectionFrm * pDel,sal_Bool bSave)674cdf0e10cSrcweir void SwSectionFrm::MoveCntntAndDelete( SwSectionFrm* pDel, sal_Bool bSave )
675cdf0e10cSrcweir {
676cdf0e10cSrcweir sal_Bool bSize = pDel->Lower() && pDel->Lower()->IsColumnFrm();
677cdf0e10cSrcweir SwFrm* pPrv = pDel->GetPrev();
678cdf0e10cSrcweir SwLayoutFrm* pUp = pDel->GetUpper();
679cdf0e10cSrcweir // OD 27.03.2003 #i12711# - initialize local pointer variables.
680cdf0e10cSrcweir SwSectionFrm* pPrvSct = NULL;
681cdf0e10cSrcweir SwSectionFrm* pNxtSct = NULL;
682cdf0e10cSrcweir SwSectionFmt* pParent = static_cast<SwSectionFmt*>(pDel->GetFmt())->GetParent();
683cdf0e10cSrcweir if( pDel->IsInTab() && pParent )
684cdf0e10cSrcweir {
685cdf0e10cSrcweir SwTabFrm *pTab = pDel->FindTabFrm();
686cdf0e10cSrcweir // Wenn wir innerhalb einer Tabelle liegen, koennen wir nur Bereiche
687cdf0e10cSrcweir // aufgebrochen haben, die ebenfalls innerhalb liegen, nicht etwa
688cdf0e10cSrcweir // einen Bereich, der die gesamte Tabelle umfasst.
689cdf0e10cSrcweir if( pTab->IsInSct() && pParent == pTab->FindSctFrm()->GetFmt() )
690cdf0e10cSrcweir pParent = NULL;
691cdf0e10cSrcweir }
692cdf0e10cSrcweir // Wenn unser Format einen Parent besitzt, so haben wir vermutlich
693cdf0e10cSrcweir // einen anderen SectionFrm aufgebrochen, dies muss geprueft werden,
694cdf0e10cSrcweir // dazu besorgen wir uns zunaechst den vorhergehende und den nach-
695cdf0e10cSrcweir // folgenden CntntFrm, mal sehen, ob diese in SectionFrms liegen.
696cdf0e10cSrcweir // OD 27.03.2003 #i12711# - check, if previous and next section belonging
697cdf0e10cSrcweir // together and can be joined, *not* only if deleted section contains content.
698cdf0e10cSrcweir if ( pParent )
699cdf0e10cSrcweir {
700cdf0e10cSrcweir SwFrm* pPrvCntnt = lcl_GetNextCntntFrm( pDel, false );
701cdf0e10cSrcweir pPrvSct = pPrvCntnt ? pPrvCntnt->FindSctFrm() : NULL;
702cdf0e10cSrcweir SwFrm* pNxtCntnt = lcl_GetNextCntntFrm( pDel, true );
703cdf0e10cSrcweir pNxtSct = pNxtCntnt ? pNxtCntnt->FindSctFrm() : NULL;
704cdf0e10cSrcweir }
705cdf0e10cSrcweir else
706cdf0e10cSrcweir {
707cdf0e10cSrcweir pParent = NULL;
708cdf0e10cSrcweir pPrvSct = pNxtSct = NULL;
709cdf0e10cSrcweir }
710cdf0e10cSrcweir
711cdf0e10cSrcweir // Jetzt wird der Inhalt beseite gestellt und der Frame zerstoert
712cdf0e10cSrcweir SwFrm *pSave = bSave ? ::SaveCntnt( pDel ) : NULL;
713cdf0e10cSrcweir sal_Bool bOldFtn = sal_True;
714cdf0e10cSrcweir if( pSave && pUp->IsFtnFrm() )
715cdf0e10cSrcweir {
716cdf0e10cSrcweir bOldFtn = ((SwFtnFrm*)pUp)->IsColLocked();
717cdf0e10cSrcweir ((SwFtnFrm*)pUp)->ColLock();
718cdf0e10cSrcweir }
719cdf0e10cSrcweir pDel->DelEmpty( sal_True );
720cdf0e10cSrcweir delete pDel;
721cdf0e10cSrcweir if( pParent )
722cdf0e10cSrcweir { // Hier wird die geeignete Einfuegeposition gesucht
723cdf0e10cSrcweir if( pNxtSct && pNxtSct->GetFmt() == pParent )
724cdf0e10cSrcweir { // Hier koennen wir uns am Anfang einfuegen
725cdf0e10cSrcweir pUp = FIRSTLEAF( pNxtSct );
726cdf0e10cSrcweir pPrv = NULL;
727cdf0e10cSrcweir if( pPrvSct && !( pPrvSct->GetFmt() == pParent ) )
728cdf0e10cSrcweir pPrvSct = NULL; // damit nicht gemergt wird
729cdf0e10cSrcweir }
730cdf0e10cSrcweir else if( pPrvSct && pPrvSct->GetFmt() == pParent )
731cdf0e10cSrcweir { // Wunderbar, hier koennen wir uns am Ende einfuegen
732cdf0e10cSrcweir pUp = pPrvSct;
733cdf0e10cSrcweir if( pUp->Lower() && pUp->Lower()->IsColumnFrm() )
734cdf0e10cSrcweir {
735cdf0e10cSrcweir pUp = static_cast<SwLayoutFrm*>(pUp->GetLastLower());
736cdf0e10cSrcweir // Der Body der letzten Spalte
737cdf0e10cSrcweir pUp = static_cast<SwLayoutFrm*>(pUp->Lower());
738cdf0e10cSrcweir }
739cdf0e10cSrcweir // damit hinter dem letzten eingefuegt wird
740cdf0e10cSrcweir pPrv = pUp->GetLastLower();
741cdf0e10cSrcweir pPrvSct = NULL; // damit nicht gemergt wird
742cdf0e10cSrcweir }
743cdf0e10cSrcweir else
744cdf0e10cSrcweir {
745cdf0e10cSrcweir if( pSave )
746cdf0e10cSrcweir { // Folgende Situationen: Vor und hinter dem zu loeschenden Bereich
747cdf0e10cSrcweir // ist entweder die Bereichsgrenze des umfassenden Bereichs oder
748cdf0e10cSrcweir // es schliesst ein anderer (Geschwister-)Bereich direkt an, der
749cdf0e10cSrcweir // vom gleichen Parent abgeleitet ist.
750cdf0e10cSrcweir // Dann gibt es (noch) keinen Teil unseres Parents, der den Inhalt
751cdf0e10cSrcweir // aufnehmen kann,also bauen wir ihn uns.
752cdf0e10cSrcweir pPrvSct = new SwSectionFrm( *pParent->GetSection(), pUp );
753cdf0e10cSrcweir pPrvSct->InsertBehind( pUp, pPrv );
754cdf0e10cSrcweir pPrvSct->Init();
755cdf0e10cSrcweir SWRECTFN( pUp )
756cdf0e10cSrcweir (pPrvSct->*fnRect->fnMakePos)( pUp, pPrv, sal_True );
757cdf0e10cSrcweir pUp = FIRSTLEAF( pPrvSct );
758cdf0e10cSrcweir pPrv = NULL;
759cdf0e10cSrcweir }
760cdf0e10cSrcweir pPrvSct = NULL; // damit nicht gemergt wird
761cdf0e10cSrcweir }
762cdf0e10cSrcweir }
763cdf0e10cSrcweir // Der Inhalt wird eingefuegt..
764cdf0e10cSrcweir if( pSave )
765cdf0e10cSrcweir {
766cdf0e10cSrcweir lcl_InvalidateInfFlags( pSave, bSize );
767cdf0e10cSrcweir ::RestoreCntnt( pSave, pUp, pPrv, true );
768cdf0e10cSrcweir pUp->FindPageFrm()->InvalidateCntnt();
769cdf0e10cSrcweir if( !bOldFtn )
770cdf0e10cSrcweir ((SwFtnFrm*)pUp)->ColUnlock();
771cdf0e10cSrcweir }
772cdf0e10cSrcweir // jetzt koennen eventuell zwei Teile des uebergeordneten Bereich verschmelzen
773cdf0e10cSrcweir if( pPrvSct && !pPrvSct->IsJoinLocked() )
774cdf0e10cSrcweir {
775cdf0e10cSrcweir ASSERT( pNxtSct, "MoveCntnt: No Merge" );
776cdf0e10cSrcweir pPrvSct->MergeNext( pNxtSct );
777cdf0e10cSrcweir }
778cdf0e10cSrcweir }
779cdf0e10cSrcweir
MakeAll()780cdf0e10cSrcweir void SwSectionFrm::MakeAll()
781cdf0e10cSrcweir {
782cdf0e10cSrcweir if ( IsJoinLocked() || IsColLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
783cdf0e10cSrcweir return;
784cdf0e10cSrcweir if( !pSection ) // Durch DelEmpty
785cdf0e10cSrcweir {
786cdf0e10cSrcweir ASSERT( getRootFrm()->IsInDelList( this ), "SectionFrm without Section" );
787cdf0e10cSrcweir if( !bValidPos )
788cdf0e10cSrcweir {
789cdf0e10cSrcweir if( GetUpper() )
790cdf0e10cSrcweir {
791cdf0e10cSrcweir SWRECTFN( GetUpper() )
792cdf0e10cSrcweir (this->*fnRect->fnMakePos)( GetUpper(), GetPrev(), sal_False );
793cdf0e10cSrcweir }
794cdf0e10cSrcweir }
795cdf0e10cSrcweir bValidSize = bValidPos = bValidPrtArea = sal_True;
796cdf0e10cSrcweir return;
797cdf0e10cSrcweir }
798cdf0e10cSrcweir LockJoin(); //Ich lass mich nicht unterwegs vernichten.
799cdf0e10cSrcweir
800cdf0e10cSrcweir while( GetNext() && GetNext() == GetFollow() )
801cdf0e10cSrcweir {
802cdf0e10cSrcweir const SwFrm* pFoll = GetFollow();
803cdf0e10cSrcweir MergeNext( (SwSectionFrm*)GetNext() );
804cdf0e10cSrcweir if( pFoll == GetFollow() )
805cdf0e10cSrcweir break;
806cdf0e10cSrcweir }
807cdf0e10cSrcweir
808cdf0e10cSrcweir // OD 2004-03-15 #116561# - In online layout join the follows, if section
809cdf0e10cSrcweir // can grow.
810cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
811cdf0e10cSrcweir if( pSh && pSh->GetViewOptions()->getBrowseMode() &&
812cdf0e10cSrcweir ( Grow( LONG_MAX, true ) > 0 ) )
813cdf0e10cSrcweir {
814cdf0e10cSrcweir while( GetFollow() )
815cdf0e10cSrcweir {
816cdf0e10cSrcweir const SwFrm* pFoll = GetFollow();
817cdf0e10cSrcweir MergeNext( GetFollow() );
818cdf0e10cSrcweir if( pFoll == GetFollow() )
819cdf0e10cSrcweir break;
820cdf0e10cSrcweir }
821cdf0e10cSrcweir }
822cdf0e10cSrcweir
823cdf0e10cSrcweir // Ein Bereich mit Follow nimmt allen Platz bis zur Unterkante des Uppers
824cdf0e10cSrcweir // in Anspruch. Bewegt er sich, so kann seine Groesse zu- oder abnehmen...
825cdf0e10cSrcweir if( !bValidPos && ToMaximize( sal_False ) )
826cdf0e10cSrcweir bValidSize = sal_False;
827cdf0e10cSrcweir
828cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
829cdf0e10cSrcweir const SwFmtCol &rCol = GetFmt()->GetCol();
830cdf0e10cSrcweir (void)rCol;
831cdf0e10cSrcweir #endif
832cdf0e10cSrcweir SwLayoutFrm::MakeAll();
833cdf0e10cSrcweir UnlockJoin();
834cdf0e10cSrcweir if( pSection && IsSuperfluous() )
835cdf0e10cSrcweir DelEmpty( sal_False );
836cdf0e10cSrcweir }
837cdf0e10cSrcweir
ShouldBwdMoved(SwLayoutFrm *,sal_Bool,sal_Bool &)838cdf0e10cSrcweir sal_Bool SwSectionFrm::ShouldBwdMoved( SwLayoutFrm *, sal_Bool , sal_Bool & )
839cdf0e10cSrcweir {
840cdf0e10cSrcweir ASSERT( sal_False, "Hups, wo ist meine Tarnkappe?" );
841cdf0e10cSrcweir return sal_False;
842cdf0e10cSrcweir }
843cdf0e10cSrcweir
_GetEndSectFmt() const844cdf0e10cSrcweir const SwSectionFmt* SwSectionFrm::_GetEndSectFmt() const
845cdf0e10cSrcweir {
846cdf0e10cSrcweir const SwSectionFmt *pFmt = pSection->GetFmt();
847cdf0e10cSrcweir while( !pFmt->GetEndAtTxtEnd().IsAtEnd() )
848cdf0e10cSrcweir {
849cdf0e10cSrcweir if( pFmt->GetRegisteredIn()->ISA( SwSectionFmt ) )
850cdf0e10cSrcweir pFmt = (SwSectionFmt*)pFmt->GetRegisteredIn();
851cdf0e10cSrcweir else
852cdf0e10cSrcweir return NULL;
853cdf0e10cSrcweir }
854cdf0e10cSrcweir return pFmt;
855cdf0e10cSrcweir }
856cdf0e10cSrcweir
lcl_FindCntntFrm(SwCntntFrm * & rpCntntFrm,SwFtnFrm * & rpFtnFrm,SwFrm * pFrm,sal_Bool & rbChkFtn)857cdf0e10cSrcweir void lcl_FindCntntFrm( SwCntntFrm* &rpCntntFrm, SwFtnFrm* &rpFtnFrm,
858cdf0e10cSrcweir SwFrm* pFrm, sal_Bool &rbChkFtn )
859cdf0e10cSrcweir {
860cdf0e10cSrcweir if( pFrm )
861cdf0e10cSrcweir {
862cdf0e10cSrcweir while( pFrm->GetNext() )
863cdf0e10cSrcweir pFrm = pFrm->GetNext();
864cdf0e10cSrcweir while( !rpCntntFrm && pFrm )
865cdf0e10cSrcweir {
866cdf0e10cSrcweir if( pFrm->IsCntntFrm() )
867cdf0e10cSrcweir rpCntntFrm = (SwCntntFrm*)pFrm;
868cdf0e10cSrcweir else if( pFrm->IsLayoutFrm() )
869cdf0e10cSrcweir {
870cdf0e10cSrcweir if( pFrm->IsFtnFrm() )
871cdf0e10cSrcweir {
872cdf0e10cSrcweir if( rbChkFtn )
873cdf0e10cSrcweir {
874cdf0e10cSrcweir rpFtnFrm = (SwFtnFrm*)pFrm;
875cdf0e10cSrcweir rbChkFtn = rpFtnFrm->GetAttr()->GetFtn().IsEndNote();
876cdf0e10cSrcweir }
877cdf0e10cSrcweir }
878cdf0e10cSrcweir else
879cdf0e10cSrcweir lcl_FindCntntFrm( rpCntntFrm, rpFtnFrm,
880cdf0e10cSrcweir ((SwLayoutFrm*)pFrm)->Lower(), rbChkFtn );
881cdf0e10cSrcweir }
882cdf0e10cSrcweir pFrm = pFrm->GetPrev();
883cdf0e10cSrcweir }
884cdf0e10cSrcweir }
885cdf0e10cSrcweir }
886cdf0e10cSrcweir
FindLastCntnt(sal_uInt8 nMode)887cdf0e10cSrcweir SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode )
888cdf0e10cSrcweir {
889cdf0e10cSrcweir SwCntntFrm *pRet = NULL;
890cdf0e10cSrcweir SwFtnFrm *pFtnFrm = NULL;
891cdf0e10cSrcweir SwSectionFrm *pSect = this;
892cdf0e10cSrcweir if( nMode )
893cdf0e10cSrcweir {
894cdf0e10cSrcweir const SwSectionFmt *pFmt = IsEndnAtEnd() ? GetEndSectFmt() :
895cdf0e10cSrcweir pSection->GetFmt();
896cdf0e10cSrcweir do {
897cdf0e10cSrcweir while( pSect->HasFollow() )
898cdf0e10cSrcweir pSect = pSect->GetFollow();
899cdf0e10cSrcweir SwFrm* pTmp = pSect->FindNext();
900cdf0e10cSrcweir while( pTmp && pTmp->IsSctFrm() &&
901cdf0e10cSrcweir !((SwSectionFrm*)pTmp)->GetSection() )
902cdf0e10cSrcweir pTmp = pTmp->FindNext();
903cdf0e10cSrcweir if( pTmp && pTmp->IsSctFrm() &&
904cdf0e10cSrcweir ((SwSectionFrm*)pTmp)->IsDescendantFrom( pFmt ) )
905cdf0e10cSrcweir pSect = (SwSectionFrm*)pTmp;
906cdf0e10cSrcweir else
907cdf0e10cSrcweir break;
908cdf0e10cSrcweir } while( sal_True );
909cdf0e10cSrcweir }
910cdf0e10cSrcweir sal_Bool bFtnFound = nMode == FINDMODE_ENDNOTE;
911cdf0e10cSrcweir do
912cdf0e10cSrcweir {
913cdf0e10cSrcweir lcl_FindCntntFrm( pRet, pFtnFrm, pSect->Lower(), bFtnFound );
914cdf0e10cSrcweir if( pRet || !pSect->IsFollow() || !nMode ||
915cdf0e10cSrcweir ( FINDMODE_MYLAST == nMode && this == pSect ) )
916cdf0e10cSrcweir break;
917cdf0e10cSrcweir pSect = pSect->FindMaster();
918cdf0e10cSrcweir } while( pSect );
919cdf0e10cSrcweir if( ( nMode == FINDMODE_ENDNOTE ) && pFtnFrm )
920cdf0e10cSrcweir pRet = pFtnFrm->ContainsCntnt();
921cdf0e10cSrcweir return pRet;
922cdf0e10cSrcweir }
923cdf0e10cSrcweir
CalcMinDiff(SwTwips & rMinDiff) const924cdf0e10cSrcweir sal_Bool SwSectionFrm::CalcMinDiff( SwTwips& rMinDiff ) const
925cdf0e10cSrcweir {
926cdf0e10cSrcweir if( ToMaximize( sal_True ) )
927cdf0e10cSrcweir {
928cdf0e10cSrcweir SWRECTFN( this )
929cdf0e10cSrcweir rMinDiff = (GetUpper()->*fnRect->fnGetPrtBottom)();
930cdf0e10cSrcweir rMinDiff = (Frm().*fnRect->fnBottomDist)( rMinDiff );
931cdf0e10cSrcweir return sal_True;
932cdf0e10cSrcweir }
933cdf0e10cSrcweir return sal_False;
934cdf0e10cSrcweir }
935cdf0e10cSrcweir
936cdf0e10cSrcweir /*************************************************************************
937cdf0e10cSrcweir *
938cdf0e10cSrcweir * SwSectionFrm::CollectEndnotes( )
939cdf0e10cSrcweir *
940cdf0e10cSrcweir * Ersterstellung AMA 03. Nov 99
941cdf0e10cSrcweir * Letzte Aenderung AMA 03. Nov 99
942cdf0e10cSrcweir *
943cdf0e10cSrcweir * CollectEndnotes looks for endnotes in the sectionfrm and his follows,
944cdf0e10cSrcweir * the endnotes will cut off the layout and put into the array.
945cdf0e10cSrcweir * If the first endnote is not a master-SwFtnFrm, the whole sectionfrm
946cdf0e10cSrcweir * contains only endnotes and it is not necessary to collect them.
947cdf0e10cSrcweir *
948cdf0e10cSrcweir *************************************************************************/
949cdf0e10cSrcweir
lcl_FindEndnote(SwSectionFrm * & rpSect,sal_Bool & rbEmpty,SwLayouter * pLayouter)950cdf0e10cSrcweir SwFtnFrm* lcl_FindEndnote( SwSectionFrm* &rpSect, sal_Bool &rbEmpty,
951cdf0e10cSrcweir SwLayouter *pLayouter )
952cdf0e10cSrcweir {
953cdf0e10cSrcweir // if rEmpty is set, the rpSect is already searched
954cdf0e10cSrcweir SwSectionFrm* pSect = rbEmpty ? rpSect->GetFollow() : rpSect;
955cdf0e10cSrcweir while( pSect )
956cdf0e10cSrcweir {
957cdf0e10cSrcweir ASSERT( (pSect->Lower() && pSect->Lower()->IsColumnFrm()) || pSect->GetUpper()->IsFtnFrm(),
958cdf0e10cSrcweir "InsertEndnotes: Where's my column?" );
959cdf0e10cSrcweir
960cdf0e10cSrcweir // i73332: Columned section in endnote
961cdf0e10cSrcweir SwColumnFrm* pCol = 0;
962cdf0e10cSrcweir if(pSect->Lower() && pSect->Lower()->IsColumnFrm())
963cdf0e10cSrcweir pCol = (SwColumnFrm*)pSect->Lower();
964cdf0e10cSrcweir
965cdf0e10cSrcweir while( pCol ) // check all columns
966cdf0e10cSrcweir {
967cdf0e10cSrcweir SwFtnContFrm* pFtnCont = pCol->FindFtnCont();
968cdf0e10cSrcweir if( pFtnCont )
969cdf0e10cSrcweir {
970cdf0e10cSrcweir SwFtnFrm* pRet = (SwFtnFrm*)pFtnCont->Lower();
971cdf0e10cSrcweir while( pRet ) // look for endnotes
972cdf0e10cSrcweir {
973cdf0e10cSrcweir if( pRet->GetAttr()->GetFtn().IsEndNote() )
974cdf0e10cSrcweir {
975cdf0e10cSrcweir if( pRet->GetMaster() )
976cdf0e10cSrcweir {
977cdf0e10cSrcweir if( pLayouter )
978cdf0e10cSrcweir pLayouter->CollectEndnote( pRet );
979cdf0e10cSrcweir else
980cdf0e10cSrcweir return 0;
981cdf0e10cSrcweir }
982cdf0e10cSrcweir else
983cdf0e10cSrcweir return pRet; // Found
984cdf0e10cSrcweir }
985cdf0e10cSrcweir pRet = (SwFtnFrm*)pRet->GetNext();
986cdf0e10cSrcweir }
987cdf0e10cSrcweir }
988cdf0e10cSrcweir pCol = (SwColumnFrm*)pCol->GetNext();
989cdf0e10cSrcweir }
990cdf0e10cSrcweir rpSect = pSect;
991cdf0e10cSrcweir pSect = pLayouter ? pSect->GetFollow() : NULL;
992cdf0e10cSrcweir rbEmpty = sal_True;
993cdf0e10cSrcweir }
994cdf0e10cSrcweir return NULL;
995cdf0e10cSrcweir }
996cdf0e10cSrcweir
lcl_ColumnRefresh(SwSectionFrm * pSect,sal_Bool bFollow)997cdf0e10cSrcweir void lcl_ColumnRefresh( SwSectionFrm* pSect, sal_Bool bFollow )
998cdf0e10cSrcweir {
999cdf0e10cSrcweir while( pSect )
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir sal_Bool bOldLock = pSect->IsColLocked();
1002cdf0e10cSrcweir pSect->ColLock();
1003cdf0e10cSrcweir if( pSect->Lower() && pSect->Lower()->IsColumnFrm() )
1004cdf0e10cSrcweir {
1005cdf0e10cSrcweir SwColumnFrm *pCol = (SwColumnFrm*)pSect->Lower();
1006cdf0e10cSrcweir do
1007cdf0e10cSrcweir { pCol->_InvalidateSize();
1008cdf0e10cSrcweir pCol->_InvalidatePos();
1009cdf0e10cSrcweir ((SwLayoutFrm*)pCol)->Lower()->_InvalidateSize();
1010cdf0e10cSrcweir pCol->Calc(); // calculation of column and
1011cdf0e10cSrcweir ((SwLayoutFrm*)pCol)->Lower()->Calc(); // body
1012cdf0e10cSrcweir pCol = (SwColumnFrm*)pCol->GetNext();
1013cdf0e10cSrcweir } while ( pCol );
1014cdf0e10cSrcweir }
1015cdf0e10cSrcweir if( !bOldLock )
1016cdf0e10cSrcweir pSect->ColUnlock();
1017cdf0e10cSrcweir if( bFollow )
1018cdf0e10cSrcweir pSect = pSect->GetFollow();
1019cdf0e10cSrcweir else
1020cdf0e10cSrcweir pSect = NULL;
1021cdf0e10cSrcweir }
1022cdf0e10cSrcweir }
1023cdf0e10cSrcweir
CollectEndnotes(SwLayouter * pLayouter)1024cdf0e10cSrcweir void SwSectionFrm::CollectEndnotes( SwLayouter* pLayouter )
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir ASSERT( IsColLocked(), "CollectEndnotes: You love the risk?" );
1027cdf0e10cSrcweir // i73332: Section in footnode does not have columns!
1028cdf0e10cSrcweir ASSERT( (Lower() && Lower()->IsColumnFrm()) || GetUpper()->IsFtnFrm(), "Where's my column?" );
1029cdf0e10cSrcweir
1030cdf0e10cSrcweir SwSectionFrm* pSect = this;
1031cdf0e10cSrcweir SwFtnFrm* pFtn;
1032cdf0e10cSrcweir sal_Bool bEmpty = sal_False;
1033cdf0e10cSrcweir // pSect is the last sectionfrm without endnotes or the this-pointer
1034cdf0e10cSrcweir // the first sectionfrm with endnotes may be destroyed, when the endnotes
1035cdf0e10cSrcweir // is cutted
1036cdf0e10cSrcweir while( 0 != (pFtn = lcl_FindEndnote( pSect, bEmpty, pLayouter )) )
1037cdf0e10cSrcweir pLayouter->CollectEndnote( pFtn );
1038cdf0e10cSrcweir if( pLayouter->HasEndnotes() )
1039cdf0e10cSrcweir lcl_ColumnRefresh( this, sal_True );
1040cdf0e10cSrcweir }
1041cdf0e10cSrcweir
1042cdf0e10cSrcweir /*************************************************************************
1043cdf0e10cSrcweir |*
1044cdf0e10cSrcweir |* SwSectionFrm::_CheckClipping( sal_Bool bGrow, sal_Bool bMaximize )
1045cdf0e10cSrcweir |*
1046cdf0e10cSrcweir |* Beschreibung: Passt die Groesse an die Umgebung an.
1047cdf0e10cSrcweir |* Wer einen Follow oder Fussnoten besitzt, soll bis zur Unterkante
1048cdf0e10cSrcweir |* des Uppers gehen (bMaximize).
1049cdf0e10cSrcweir |* Niemand darf ueber den Upper hinausgehen, ggf. darf man versuchen (bGrow)
1050cdf0e10cSrcweir |* seinen Upper zu growen.
1051cdf0e10cSrcweir |* Wenn die Groesse veraendert werden musste, wird der Inhalt kalkuliert.
1052cdf0e10cSrcweir |*
1053cdf0e10cSrcweir |*************************************************************************/
1054cdf0e10cSrcweir
1055cdf0e10cSrcweir /// OD 18.09.2002 #100522#
1056cdf0e10cSrcweir /// perform calculation of content, only if height has changed.
_CheckClipping(sal_Bool bGrow,sal_Bool bMaximize)1057cdf0e10cSrcweir void SwSectionFrm::_CheckClipping( sal_Bool bGrow, sal_Bool bMaximize )
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir SWRECTFN( this )
1060cdf0e10cSrcweir long nDiff;
1061cdf0e10cSrcweir SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
1062cdf0e10cSrcweir if( bGrow && ( !IsInFly() || !GetUpper()->IsColBodyFrm() ||
1063cdf0e10cSrcweir !FindFlyFrm()->IsLocked() ) )
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir nDiff = -(Frm().*fnRect->fnBottomDist)( nDeadLine );
1066cdf0e10cSrcweir if( !bMaximize )
1067cdf0e10cSrcweir nDiff += Undersize();
1068cdf0e10cSrcweir if( nDiff > 0 )
1069cdf0e10cSrcweir {
1070cdf0e10cSrcweir long nAdd = GetUpper()->Grow( nDiff );
1071cdf0e10cSrcweir if( bVert && !bRev )
1072cdf0e10cSrcweir nDeadLine -= nAdd;
1073cdf0e10cSrcweir else
1074cdf0e10cSrcweir nDeadLine += nAdd;
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir nDiff = -(Frm().*fnRect->fnBottomDist)( nDeadLine );
1078cdf0e10cSrcweir SetUndersized( !bMaximize && nDiff >= 0 );
1079cdf0e10cSrcweir const bool bCalc = ( IsUndersized() || bMaximize ) &&
1080cdf0e10cSrcweir ( nDiff ||
1081cdf0e10cSrcweir (Prt().*fnRect->fnGetTop)() > (Frm().*fnRect->fnGetHeight)() );
1082cdf0e10cSrcweir // OD 03.11.2003 #i19737# - introduce local variable <bExtraCalc> to indicate
1083cdf0e10cSrcweir // that a calculation has to be done beside the value of <bCalc>.
1084cdf0e10cSrcweir bool bExtraCalc = false;
1085cdf0e10cSrcweir if( !bCalc && !bGrow && IsAnyNoteAtEnd() && !IsInFtn() )
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir SwSectionFrm *pSect = this;
1088cdf0e10cSrcweir sal_Bool bEmpty = sal_False;
1089cdf0e10cSrcweir SwLayoutFrm* pFtn = IsEndnAtEnd() ?
1090cdf0e10cSrcweir lcl_FindEndnote( pSect, bEmpty, NULL ) : NULL;
1091cdf0e10cSrcweir if( pFtn )
1092cdf0e10cSrcweir {
1093cdf0e10cSrcweir pFtn = pFtn->FindFtnBossFrm();
1094cdf0e10cSrcweir SwFrm* pTmp = FindLastCntnt( FINDMODE_LASTCNT );
1095cdf0e10cSrcweir // OD 08.11.2002 #104840# - use <SwLayoutFrm::IsBefore(..)>
1096cdf0e10cSrcweir if ( pTmp && pFtn->IsBefore( pTmp->FindFtnBossFrm() ) )
1097cdf0e10cSrcweir bExtraCalc = true;
1098cdf0e10cSrcweir }
1099cdf0e10cSrcweir else if( GetFollow() && !GetFollow()->ContainsAny() )
1100cdf0e10cSrcweir bExtraCalc = true;
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir if ( bCalc || bExtraCalc )
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir nDiff = (*fnRect->fnYDiff)( nDeadLine, (Frm().*fnRect->fnGetTop)() );
1105cdf0e10cSrcweir if( nDiff < 0 )
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir nDiff = 0;
1108cdf0e10cSrcweir nDeadLine = (Frm().*fnRect->fnGetTop)();
1109cdf0e10cSrcweir }
1110cdf0e10cSrcweir const Size aOldSz( Prt().SSize() );
1111cdf0e10cSrcweir long nTop = (this->*fnRect->fnGetTopMargin)();
1112cdf0e10cSrcweir (Frm().*fnRect->fnSetBottom)( nDeadLine );
1113cdf0e10cSrcweir nDiff = (Frm().*fnRect->fnGetHeight)();
1114cdf0e10cSrcweir if( nTop > nDiff )
1115cdf0e10cSrcweir nTop = nDiff;
1116cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nTop, 0 );
1117cdf0e10cSrcweir
1118cdf0e10cSrcweir // OD 18.09.2002 #100522#
1119cdf0e10cSrcweir // Determine, if height has changed.
1120cdf0e10cSrcweir // Note: In vertical layout the height equals the width value.
1121cdf0e10cSrcweir bool bHeightChanged = bVert ?
1122cdf0e10cSrcweir (aOldSz.Width() != Prt().Width()) :
1123cdf0e10cSrcweir (aOldSz.Height() != Prt().Height());
1124cdf0e10cSrcweir // Wir haben zu guter Letzt noch einmal die Hoehe geaendert,
1125cdf0e10cSrcweir // dann wird das innere Layout (Columns) kalkuliert und
1126cdf0e10cSrcweir // der Inhalt ebenfalls.
1127cdf0e10cSrcweir // OD 18.09.2002 #100522#
1128cdf0e10cSrcweir // calculate content, only if height has changed.
1129cdf0e10cSrcweir // OD 03.11.2003 #i19737# - restriction of content calculation too strong.
1130cdf0e10cSrcweir // If an endnote has an incorrect position or a follow section contains
1131cdf0e10cSrcweir // no content except footnotes/endnotes, the content has also been calculated.
1132cdf0e10cSrcweir if ( ( bHeightChanged || bExtraCalc ) && Lower() )
1133cdf0e10cSrcweir {
1134cdf0e10cSrcweir if( Lower()->IsColumnFrm() )
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir lcl_ColumnRefresh( this, sal_False );
1137cdf0e10cSrcweir ::CalcCntnt( this );
1138cdf0e10cSrcweir }
1139cdf0e10cSrcweir else
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir ChgLowersProp( aOldSz );
1142cdf0e10cSrcweir if( !bMaximize && !IsCntntLocked() )
1143cdf0e10cSrcweir ::CalcCntnt( this );
1144cdf0e10cSrcweir }
1145cdf0e10cSrcweir }
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir }
1148cdf0e10cSrcweir
SimpleFormat()1149cdf0e10cSrcweir void SwSectionFrm::SimpleFormat()
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir if ( IsJoinLocked() || IsColLocked() )
1152cdf0e10cSrcweir return;
1153cdf0e10cSrcweir // ASSERT( pFollow, "SimpleFormat: Follow required" );
1154cdf0e10cSrcweir LockJoin();
1155cdf0e10cSrcweir SWRECTFN( this )
1156cdf0e10cSrcweir if( GetPrev() || GetUpper() )
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir // --> OD 2009-09-28 #b6882166#
1159cdf0e10cSrcweir // assure notifications on position changes.
1160cdf0e10cSrcweir const SwLayNotify aNotify( this );
1161cdf0e10cSrcweir // <--
1162cdf0e10cSrcweir (this->*fnRect->fnMakePos)( GetUpper(), GetPrev(), sal_False );
1163cdf0e10cSrcweir bValidPos = sal_True;
1164cdf0e10cSrcweir }
1165cdf0e10cSrcweir SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
1166cdf0e10cSrcweir // OD 22.10.2002 #97265# - call always method <lcl_ColumnRefresh(..)>, in
1167cdf0e10cSrcweir // order to get calculated lowers, not only if there space left in its upper.
1168cdf0e10cSrcweir if( (Frm().*fnRect->fnBottomDist)( nDeadLine ) >= 0 )
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir (Frm().*fnRect->fnSetBottom)( nDeadLine );
1171cdf0e10cSrcweir long nHeight = (Frm().*fnRect->fnGetHeight)();
1172cdf0e10cSrcweir long nTop = CalcUpperSpace();
1173cdf0e10cSrcweir if( nTop > nHeight )
1174cdf0e10cSrcweir nTop = nHeight;
1175cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nTop, 0 );
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir lcl_ColumnRefresh( this, sal_False );
1178cdf0e10cSrcweir UnlockJoin();
1179cdf0e10cSrcweir }
1180cdf0e10cSrcweir
1181cdf0e10cSrcweir // --> OD 2005-01-11 #i40147# - helper class to perform extra section format
1182cdf0e10cSrcweir // to position anchored objects and to keep the position of whose objects locked.
1183cdf0e10cSrcweir class ExtraFormatToPositionObjs
1184cdf0e10cSrcweir {
1185cdf0e10cSrcweir private:
1186cdf0e10cSrcweir SwSectionFrm* mpSectFrm;
1187cdf0e10cSrcweir bool mbExtraFormatPerformed;
1188cdf0e10cSrcweir
1189cdf0e10cSrcweir public:
ExtraFormatToPositionObjs(SwSectionFrm & _rSectFrm)1190cdf0e10cSrcweir ExtraFormatToPositionObjs( SwSectionFrm& _rSectFrm)
1191cdf0e10cSrcweir : mpSectFrm( &_rSectFrm ),
1192cdf0e10cSrcweir mbExtraFormatPerformed( false )
1193cdf0e10cSrcweir {}
1194cdf0e10cSrcweir
~ExtraFormatToPositionObjs()1195cdf0e10cSrcweir ~ExtraFormatToPositionObjs()
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir if ( mbExtraFormatPerformed )
1198cdf0e10cSrcweir {
1199cdf0e10cSrcweir // release keep locked position of lower floating screen objects
1200cdf0e10cSrcweir SwPageFrm* pPageFrm = mpSectFrm->FindPageFrm();
1201cdf0e10cSrcweir SwSortedObjs* pObjs = pPageFrm ? pPageFrm->GetSortedObjs() : 0L;
1202cdf0e10cSrcweir if ( pObjs )
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir sal_uInt32 i = 0;
1205cdf0e10cSrcweir for ( i = 0; i < pObjs->Count(); ++i )
1206cdf0e10cSrcweir {
1207cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
1208cdf0e10cSrcweir
1209cdf0e10cSrcweir if ( mpSectFrm->IsAnLower( pAnchoredObj->GetAnchorFrm() ) )
1210cdf0e10cSrcweir {
1211cdf0e10cSrcweir pAnchoredObj->SetKeepPosLocked( false );
1212cdf0e10cSrcweir }
1213cdf0e10cSrcweir }
1214cdf0e10cSrcweir }
1215cdf0e10cSrcweir }
1216cdf0e10cSrcweir }
1217cdf0e10cSrcweir
1218cdf0e10cSrcweir // --> OD 2008-06-20 #i81555#
InitObjs(SwFrm & rFrm)1219cdf0e10cSrcweir void InitObjs( SwFrm& rFrm )
1220cdf0e10cSrcweir {
1221cdf0e10cSrcweir SwSortedObjs* pObjs = rFrm.GetDrawObjs();
1222cdf0e10cSrcweir if ( pObjs )
1223cdf0e10cSrcweir {
1224cdf0e10cSrcweir sal_uInt32 i = 0;
1225cdf0e10cSrcweir for ( i = 0; i < pObjs->Count(); ++i )
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
1228cdf0e10cSrcweir
1229cdf0e10cSrcweir pAnchoredObj->UnlockPosition();
1230cdf0e10cSrcweir pAnchoredObj->SetClearedEnvironment( false );
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir }
1233cdf0e10cSrcweir SwLayoutFrm* pLayoutFrm = dynamic_cast<SwLayoutFrm*>(&rFrm);
1234cdf0e10cSrcweir if ( pLayoutFrm != 0 )
1235cdf0e10cSrcweir {
1236cdf0e10cSrcweir SwFrm* pLowerFrm = pLayoutFrm->GetLower();
1237cdf0e10cSrcweir while ( pLowerFrm != 0 )
1238cdf0e10cSrcweir {
1239cdf0e10cSrcweir InitObjs( *pLowerFrm );
1240cdf0e10cSrcweir
1241cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetNext();
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir }
1244cdf0e10cSrcweir }
1245cdf0e10cSrcweir // <--
1246cdf0e10cSrcweir
FormatSectionToPositionObjs()1247cdf0e10cSrcweir void FormatSectionToPositionObjs()
1248cdf0e10cSrcweir {
1249cdf0e10cSrcweir // perform extra format for multi-columned section.
1250cdf0e10cSrcweir if ( mpSectFrm->Lower() && mpSectFrm->Lower()->IsColumnFrm() &&
1251cdf0e10cSrcweir mpSectFrm->Lower()->GetNext() )
1252cdf0e10cSrcweir {
1253cdf0e10cSrcweir // grow section till bottom of printing area of upper frame
1254cdf0e10cSrcweir SWRECTFN( mpSectFrm );
1255cdf0e10cSrcweir SwTwips nTopMargin = (mpSectFrm->*fnRect->fnGetTopMargin)();
1256cdf0e10cSrcweir Size aOldSectPrtSize( mpSectFrm->Prt().SSize() );
1257cdf0e10cSrcweir SwTwips nDiff = (mpSectFrm->Frm().*fnRect->fnBottomDist)(
1258cdf0e10cSrcweir (mpSectFrm->GetUpper()->*fnRect->fnGetPrtBottom)() );
1259cdf0e10cSrcweir (mpSectFrm->Frm().*fnRect->fnAddBottom)( nDiff );
1260cdf0e10cSrcweir (mpSectFrm->*fnRect->fnSetYMargins)( nTopMargin, 0 );
1261cdf0e10cSrcweir // --> OD 2006-05-08 #i59789#
1262cdf0e10cSrcweir // suppress formatting, if printing area of section is too narrow
1263cdf0e10cSrcweir if ( (mpSectFrm->Prt().*fnRect->fnGetHeight)() <= 0 )
1264cdf0e10cSrcweir {
1265cdf0e10cSrcweir return;
1266cdf0e10cSrcweir }
1267cdf0e10cSrcweir // <--
1268cdf0e10cSrcweir mpSectFrm->ChgLowersProp( aOldSectPrtSize );
1269cdf0e10cSrcweir
1270cdf0e10cSrcweir // format column frames and its body and footnote container
1271cdf0e10cSrcweir SwColumnFrm* pColFrm = static_cast<SwColumnFrm*>(mpSectFrm->Lower());
1272cdf0e10cSrcweir while ( pColFrm )
1273cdf0e10cSrcweir {
1274cdf0e10cSrcweir pColFrm->Calc();
1275cdf0e10cSrcweir pColFrm->Lower()->Calc();
1276cdf0e10cSrcweir if ( pColFrm->Lower()->GetNext() )
1277cdf0e10cSrcweir {
1278cdf0e10cSrcweir pColFrm->Lower()->GetNext()->Calc();
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir
1281cdf0e10cSrcweir pColFrm = static_cast<SwColumnFrm*>(pColFrm->GetNext());
1282cdf0e10cSrcweir }
1283cdf0e10cSrcweir
1284cdf0e10cSrcweir // unlock position of lower floating screen objects for the extra format
1285cdf0e10cSrcweir // --> OD 2008-06-20 #i81555#
1286cdf0e10cSrcweir // Section frame can already have changed the page and its content
1287cdf0e10cSrcweir // can still be on the former page.
1288cdf0e10cSrcweir // Thus, initialize objects via lower-relationship
1289cdf0e10cSrcweir InitObjs( *mpSectFrm );
1290cdf0e10cSrcweir // <--
1291cdf0e10cSrcweir
1292cdf0e10cSrcweir // format content - first with collecting its foot-/endnotes before content
1293cdf0e10cSrcweir // format, second without collecting its foot-/endnotes.
1294cdf0e10cSrcweir ::CalcCntnt( mpSectFrm );
1295cdf0e10cSrcweir ::CalcCntnt( mpSectFrm, true );
1296cdf0e10cSrcweir
1297cdf0e10cSrcweir // keep locked position of lower floating screen objects
1298cdf0e10cSrcweir SwPageFrm* pPageFrm = mpSectFrm->FindPageFrm();
1299cdf0e10cSrcweir SwSortedObjs* pObjs = pPageFrm ? pPageFrm->GetSortedObjs() : 0L;
1300cdf0e10cSrcweir if ( pObjs )
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir sal_uInt32 i = 0;
1303cdf0e10cSrcweir for ( i = 0; i < pObjs->Count(); ++i )
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
1306cdf0e10cSrcweir
1307cdf0e10cSrcweir if ( mpSectFrm->IsAnLower( pAnchoredObj->GetAnchorFrm() ) )
1308cdf0e10cSrcweir {
1309cdf0e10cSrcweir pAnchoredObj->SetKeepPosLocked( true );
1310cdf0e10cSrcweir }
1311cdf0e10cSrcweir }
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir
1314cdf0e10cSrcweir mbExtraFormatPerformed = true;
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir }
1317cdf0e10cSrcweir };
1318cdf0e10cSrcweir
1319cdf0e10cSrcweir /*************************************************************************
1320cdf0e10cSrcweir |*
1321cdf0e10cSrcweir |* SwSectionFrm::Format()
1322cdf0e10cSrcweir |*
1323cdf0e10cSrcweir |* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
1324cdf0e10cSrcweir |* Ersterstellung AMA 03. Dec. 97
1325cdf0e10cSrcweir |* Letzte Aenderung MA 09. Oct. 98
1326cdf0e10cSrcweir |*
1327cdf0e10cSrcweir |*************************************************************************/
1328cdf0e10cSrcweir
Format(const SwBorderAttrs * pAttr)1329cdf0e10cSrcweir void SwSectionFrm::Format( const SwBorderAttrs *pAttr )
1330cdf0e10cSrcweir {
1331cdf0e10cSrcweir if( !pSection ) // Durch DelEmpty
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir ASSERT( getRootFrm()->IsInDelList( this ), "SectionFrm without Section" );
1334cdf0e10cSrcweir bValidSize = bValidPos = bValidPrtArea = sal_True;
1335cdf0e10cSrcweir return;
1336cdf0e10cSrcweir }
1337cdf0e10cSrcweir SWRECTFN( this )
1338cdf0e10cSrcweir if ( !bValidPrtArea )
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir PROTOCOL( this, PROT_PRTAREA, 0, 0 )
1341cdf0e10cSrcweir bValidPrtArea = sal_True;
1342cdf0e10cSrcweir SwTwips nUpper = CalcUpperSpace();
1343cdf0e10cSrcweir
1344cdf0e10cSrcweir // #109700# LRSpace for sections
1345cdf0e10cSrcweir const SvxLRSpaceItem& rLRSpace = GetFmt()->GetLRSpace();
1346cdf0e10cSrcweir (this->*fnRect->fnSetXMargins)( rLRSpace.GetLeft(), rLRSpace.GetRight() );
1347cdf0e10cSrcweir
1348cdf0e10cSrcweir if( nUpper != (this->*fnRect->fnGetTopMargin)() )
1349cdf0e10cSrcweir {
1350cdf0e10cSrcweir bValidSize = sal_False;
1351cdf0e10cSrcweir SwFrm* pOwn = ContainsAny();
1352cdf0e10cSrcweir if( pOwn )
1353cdf0e10cSrcweir pOwn->_InvalidatePos();
1354cdf0e10cSrcweir }
1355cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nUpper, 0 );
1356cdf0e10cSrcweir }
1357cdf0e10cSrcweir
1358cdf0e10cSrcweir if ( !bValidSize )
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir PROTOCOL_ENTER( this, PROT_SIZE, 0, 0 )
1361cdf0e10cSrcweir const long nOldHeight = (Frm().*fnRect->fnGetHeight)();
1362cdf0e10cSrcweir sal_Bool bOldLock = IsColLocked();
1363cdf0e10cSrcweir ColLock();
1364cdf0e10cSrcweir
1365cdf0e10cSrcweir bValidSize = sal_True;
1366cdf0e10cSrcweir
1367cdf0e10cSrcweir //die Groesse wird nur dann vom Inhalt bestimmt, wenn der SectFrm
1368cdf0e10cSrcweir //keinen Follow hat. Anderfalls fuellt er immer den Upper bis
1369cdf0e10cSrcweir //zur Unterkante aus. Fuer den Textfluss ist nicht er, sondern sein
1370cdf0e10cSrcweir //Inhalt selbst verantwortlich.
1371cdf0e10cSrcweir sal_Bool bMaximize = ToMaximize( sal_False );
1372cdf0e10cSrcweir
1373cdf0e10cSrcweir // OD 2004-05-17 #i28701# - If the wrapping style has to be considered
1374cdf0e10cSrcweir // on object positioning, an extra formatting has to be performed
1375cdf0e10cSrcweir // to determine the correct positions the floating screen objects.
1376cdf0e10cSrcweir // --> OD 2005-01-11 #i40147#
1377cdf0e10cSrcweir // use new helper class <ExtraFormatToPositionObjs>.
1378cdf0e10cSrcweir // This class additionally keep the locked position of the objects
1379cdf0e10cSrcweir // and releases this position lock keeping on destruction.
1380cdf0e10cSrcweir ExtraFormatToPositionObjs aExtraFormatToPosObjs( *this );
1381cdf0e10cSrcweir if ( !bMaximize &&
1382cdf0e10cSrcweir GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) &&
1383cdf0e10cSrcweir !GetFmt()->GetBalancedColumns().GetValue() )
1384cdf0e10cSrcweir {
1385cdf0e10cSrcweir aExtraFormatToPosObjs.FormatSectionToPositionObjs();
1386cdf0e10cSrcweir }
1387cdf0e10cSrcweir // <--
1388cdf0e10cSrcweir
1389cdf0e10cSrcweir // Column widths have to be adjusted before calling _CheckClipping.
1390cdf0e10cSrcweir // _CheckClipping can cause the formatting of the lower frames
1391cdf0e10cSrcweir // which still have a width of 0.
1392cdf0e10cSrcweir const sal_Bool bHasColumns = Lower() && Lower()->IsColumnFrm();
1393cdf0e10cSrcweir if ( bHasColumns && Lower()->GetNext() )
1394cdf0e10cSrcweir AdjustColumns( 0, sal_False );
1395cdf0e10cSrcweir
1396cdf0e10cSrcweir if( GetUpper() )
1397cdf0e10cSrcweir {
1398cdf0e10cSrcweir long nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
1399cdf0e10cSrcweir (aFrm.*fnRect->fnSetWidth)( nWidth );
1400cdf0e10cSrcweir
1401cdf0e10cSrcweir // #109700# LRSpace for sections
1402cdf0e10cSrcweir const SvxLRSpaceItem& rLRSpace = GetFmt()->GetLRSpace();
1403cdf0e10cSrcweir (aPrt.*fnRect->fnSetWidth)( nWidth - rLRSpace.GetLeft() -
1404cdf0e10cSrcweir rLRSpace.GetRight() );
1405cdf0e10cSrcweir
1406cdf0e10cSrcweir // OD 15.10.2002 #103517# - allow grow in online layout
1407cdf0e10cSrcweir // Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling
1408cdf0e10cSrcweir // method <_CheckClipping(..)>.
1409cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
1410cdf0e10cSrcweir _CheckClipping( pSh && pSh->GetViewOptions()->getBrowseMode(), bMaximize );
1411cdf0e10cSrcweir bMaximize = ToMaximize( sal_False );
1412cdf0e10cSrcweir bValidSize = sal_True;
1413cdf0e10cSrcweir }
1414cdf0e10cSrcweir
1415cdf0e10cSrcweir //Breite der Spalten pruefen und ggf. einstellen.
1416cdf0e10cSrcweir if ( bHasColumns && ! Lower()->GetNext() && bMaximize )
1417cdf0e10cSrcweir ((SwColumnFrm*)Lower())->Lower()->Calc();
1418cdf0e10cSrcweir
1419cdf0e10cSrcweir if ( !bMaximize )
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir SwTwips nRemaining = (this->*fnRect->fnGetTopMargin)();
1422cdf0e10cSrcweir SwFrm *pFrm = pLower;
1423cdf0e10cSrcweir if( pFrm )
1424cdf0e10cSrcweir {
1425cdf0e10cSrcweir if( pFrm->IsColumnFrm() && pFrm->GetNext() )
1426cdf0e10cSrcweir {
1427cdf0e10cSrcweir // --> OD 2006-05-08 #i61435#
1428cdf0e10cSrcweir // suppress formatting, if upper frame has height <= 0
1429cdf0e10cSrcweir if ( (GetUpper()->Frm().*fnRect->fnGetHeight)() > 0 )
1430cdf0e10cSrcweir {
1431cdf0e10cSrcweir FormatWidthCols( *pAttr, nRemaining, MINLAY );
1432cdf0e10cSrcweir }
1433cdf0e10cSrcweir // <--
1434cdf0e10cSrcweir // --> OD 2006-01-04 #126020# - adjust check for empty section
1435cdf0e10cSrcweir // --> OD 2006-02-01 #130797# - correct fix #126020#
1436cdf0e10cSrcweir while( HasFollow() && !GetFollow()->ContainsCntnt() &&
1437cdf0e10cSrcweir !GetFollow()->ContainsAny( true ) )
1438cdf0e10cSrcweir // <--
1439cdf0e10cSrcweir {
1440cdf0e10cSrcweir SwFrm* pOld = GetFollow();
1441cdf0e10cSrcweir GetFollow()->DelEmpty( sal_False );
1442cdf0e10cSrcweir if( pOld == GetFollow() )
1443cdf0e10cSrcweir break;
1444cdf0e10cSrcweir }
1445cdf0e10cSrcweir bMaximize = ToMaximize( sal_False );
1446cdf0e10cSrcweir nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
1447cdf0e10cSrcweir }
1448cdf0e10cSrcweir else
1449cdf0e10cSrcweir {
1450cdf0e10cSrcweir if( pFrm->IsColumnFrm() )
1451cdf0e10cSrcweir {
1452cdf0e10cSrcweir pFrm->Calc();
1453cdf0e10cSrcweir pFrm = ((SwColumnFrm*)pFrm)->Lower();
1454cdf0e10cSrcweir pFrm->Calc();
1455cdf0e10cSrcweir pFrm = ((SwLayoutFrm*)pFrm)->Lower();
1456cdf0e10cSrcweir CalcFtnCntnt();
1457cdf0e10cSrcweir }
1458cdf0e10cSrcweir // Wenn wir in einem spaltigen Rahmen stehen und dieser
1459cdf0e10cSrcweir // gerade im FormatWidthCols ein CalcCntnt ruft, muss
1460cdf0e10cSrcweir // unser Inhalt ggf. kalkuliert werden.
1461cdf0e10cSrcweir if( pFrm && !pFrm->IsValid() && IsInFly() &&
1462cdf0e10cSrcweir FindFlyFrm()->IsColLocked() )
1463cdf0e10cSrcweir ::CalcCntnt( this );
1464cdf0e10cSrcweir nRemaining += InnerHeight();
1465cdf0e10cSrcweir bMaximize = HasFollow();
1466cdf0e10cSrcweir }
1467cdf0e10cSrcweir }
1468cdf0e10cSrcweir
1469cdf0e10cSrcweir SwTwips nDiff = (Frm().*fnRect->fnGetHeight)() - nRemaining;
1470cdf0e10cSrcweir if( nDiff < 0)
1471cdf0e10cSrcweir {
1472cdf0e10cSrcweir SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
1473cdf0e10cSrcweir {
1474cdf0e10cSrcweir long nBottom = (Frm().*fnRect->fnGetBottom)();
1475cdf0e10cSrcweir nBottom = (*fnRect->fnYInc)( nBottom, -nDiff );
1476cdf0e10cSrcweir long nTmpDiff = (*fnRect->fnYDiff)( nBottom, nDeadLine );
1477cdf0e10cSrcweir if( nTmpDiff > 0 )
1478cdf0e10cSrcweir {
1479cdf0e10cSrcweir nTmpDiff = GetUpper()->Grow( nTmpDiff, sal_True );
1480cdf0e10cSrcweir nDeadLine = (*fnRect->fnYInc)( nDeadLine, nTmpDiff );
1481cdf0e10cSrcweir nTmpDiff = (*fnRect->fnYDiff)( nBottom, nDeadLine );
1482cdf0e10cSrcweir if( nTmpDiff > 0 )
1483cdf0e10cSrcweir nDiff += nTmpDiff;
1484cdf0e10cSrcweir if( nDiff > 0 )
1485cdf0e10cSrcweir nDiff = 0;
1486cdf0e10cSrcweir }
1487cdf0e10cSrcweir }
1488cdf0e10cSrcweir }
1489cdf0e10cSrcweir if( nDiff )
1490cdf0e10cSrcweir {
1491cdf0e10cSrcweir long nTmp = nRemaining - (Frm().*fnRect->fnGetHeight)();
1492cdf0e10cSrcweir long nTop = (this->*fnRect->fnGetTopMargin)();
1493cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( nTmp );
1494cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nTop, 0 );
1495cdf0e10cSrcweir InvalidateNextPos();
1496cdf0e10cSrcweir if( pLower && ( !pLower->IsColumnFrm() || !pLower->GetNext() ) )
1497cdf0e10cSrcweir {
1498cdf0e10cSrcweir // Wenn ein einspaltiger Bereich gerade den Platz geschaffen
1499cdf0e10cSrcweir // hat, den sich die "undersized" Absaetze gewuenscht haben,
1500cdf0e10cSrcweir // muessen diese invalidiert und kalkuliert werden, damit
1501cdf0e10cSrcweir // sie diesen ausfuellen.
1502cdf0e10cSrcweir pFrm = pLower;
1503cdf0e10cSrcweir if( pFrm->IsColumnFrm() )
1504cdf0e10cSrcweir {
1505cdf0e10cSrcweir pFrm->_InvalidateSize();
1506cdf0e10cSrcweir pFrm->_InvalidatePos();
1507cdf0e10cSrcweir pFrm->Calc();
1508cdf0e10cSrcweir pFrm = ((SwColumnFrm*)pFrm)->Lower();
1509cdf0e10cSrcweir pFrm->Calc();
1510cdf0e10cSrcweir pFrm = ((SwLayoutFrm*)pFrm)->Lower();
1511cdf0e10cSrcweir CalcFtnCntnt();
1512cdf0e10cSrcweir }
1513cdf0e10cSrcweir sal_Bool bUnderSz = sal_False;
1514cdf0e10cSrcweir while( pFrm )
1515cdf0e10cSrcweir {
1516cdf0e10cSrcweir if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir pFrm->Prepare( PREP_ADJUST_FRM );
1519cdf0e10cSrcweir bUnderSz = sal_True;
1520cdf0e10cSrcweir }
1521cdf0e10cSrcweir pFrm = pFrm->GetNext();
1522cdf0e10cSrcweir }
1523cdf0e10cSrcweir if( bUnderSz && !IsCntntLocked() )
1524cdf0e10cSrcweir ::CalcCntnt( this );
1525cdf0e10cSrcweir }
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir
1529cdf0e10cSrcweir //Unterkante des Uppers nicht ueberschreiten. Fuer Sections mit
1530cdf0e10cSrcweir //Follows die Unterkante auch nicht unterschreiten.
1531cdf0e10cSrcweir if ( GetUpper() )
1532cdf0e10cSrcweir _CheckClipping( sal_True, bMaximize );
1533cdf0e10cSrcweir if( !bOldLock )
1534cdf0e10cSrcweir ColUnlock();
1535cdf0e10cSrcweir long nDiff = nOldHeight - (Frm().*fnRect->fnGetHeight)();
1536cdf0e10cSrcweir if( nDiff > 0 )
1537cdf0e10cSrcweir {
1538cdf0e10cSrcweir if( !GetNext() )
1539cdf0e10cSrcweir SetRetouche(); // Dann muessen wir die Retusche selbst uebernehmen
1540cdf0e10cSrcweir if( GetUpper() && !GetUpper()->IsFooterFrm() )
1541cdf0e10cSrcweir GetUpper()->Shrink( nDiff );
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir if( IsUndersized() )
1544cdf0e10cSrcweir bValidPrtArea = sal_True;
1545cdf0e10cSrcweir }
1546cdf0e10cSrcweir }
1547cdf0e10cSrcweir
1548cdf0e10cSrcweir /*************************************************************************
1549cdf0e10cSrcweir |*
1550cdf0e10cSrcweir |* SwFrm::GetNextSctLeaf()
1551cdf0e10cSrcweir |*
1552cdf0e10cSrcweir |* Beschreibung Liefert das naechste Layoutblatt in das der Frame
1553cdf0e10cSrcweir |* gemoved werden kann.
1554cdf0e10cSrcweir |* Neue Seiten werden nur dann erzeugt, wenn der Parameter sal_True ist.
1555cdf0e10cSrcweir |* Ersterstellung AMA 07. Jan. 98
1556cdf0e10cSrcweir |* Letzte Aenderung AMA 07. Jan. 98
1557cdf0e10cSrcweir |*
1558cdf0e10cSrcweir |*************************************************************************/
1559cdf0e10cSrcweir
1560cdf0e10cSrcweir
GetNextSctLeaf(MakePageType eMakePage)1561cdf0e10cSrcweir SwLayoutFrm *SwFrm::GetNextSctLeaf( MakePageType eMakePage )
1562cdf0e10cSrcweir {
1563cdf0e10cSrcweir //Achtung: Geschachtelte Bereiche werden zur Zeit nicht unterstuetzt.
1564cdf0e10cSrcweir
1565cdf0e10cSrcweir PROTOCOL_ENTER( this, PROT_LEAF, ACT_NEXT_SECT, GetUpper()->FindSctFrm() )
1566cdf0e10cSrcweir
1567cdf0e10cSrcweir // Abkuerzungen fuer spaltige Bereiche, wenn wir noch nicht in der letzten Spalte sind.
1568cdf0e10cSrcweir // Koennen wir in die naechste Spalte des Bereichs rutschen?
1569cdf0e10cSrcweir if( IsColBodyFrm() && GetUpper()->GetNext() )
1570cdf0e10cSrcweir return (SwLayoutFrm*)((SwLayoutFrm*)GetUpper()->GetNext())->Lower();
1571cdf0e10cSrcweir if( GetUpper()->IsColBodyFrm() && GetUpper()->GetUpper()->GetNext() )
1572cdf0e10cSrcweir return (SwLayoutFrm*)((SwLayoutFrm*)GetUpper()->GetUpper()->GetNext())->Lower();
1573cdf0e10cSrcweir // Innerhalb von Bereichen in Tabellen oder Bereichen in Kopf/Fusszeilen kann
1574cdf0e10cSrcweir // nur ein Spaltenwechsel erfolgen, eine der oberen Abkuerzungen haette zuschlagen muessen
1575cdf0e10cSrcweir if( GetUpper()->IsInTab() || FindFooterOrHeader() )
1576cdf0e10cSrcweir return 0;
1577cdf0e10cSrcweir
1578cdf0e10cSrcweir //MA 03. Feb. 99: Warum GetUpper()? Das knallt mit Buch.sgl weil im
1579cdf0e10cSrcweir //FlyAtCnt::MakeFlyPos ein Orient der SectionFrm ist und auf diesen ein
1580cdf0e10cSrcweir //GetLeaf gerufen wird.
1581cdf0e10cSrcweir // SwSectionFrm *pSect = GetUpper()->FindSctFrm();
1582cdf0e10cSrcweir SwSectionFrm *pSect = FindSctFrm();
1583cdf0e10cSrcweir sal_Bool bWrongPage = sal_False;
1584cdf0e10cSrcweir ASSERT( pSect, "GetNextSctLeaf: Missing SectionFrm" );
1585cdf0e10cSrcweir
1586cdf0e10cSrcweir // Hier eine Abkuerzung fuer Bereiche mit Follows,
1587cdf0e10cSrcweir // dieser kann akzeptiert werden, wenn keine Spalten oder Seiten (ausser Dummyseiten)
1588cdf0e10cSrcweir // dazwischen liegen.
1589cdf0e10cSrcweir // Bei verketteten Rahmen und ind Fussnoten wuerde die Abkuerzung noch aufwendiger
1590cdf0e10cSrcweir if( pSect->HasFollow() && pSect->IsInDocBody() )
1591cdf0e10cSrcweir {
1592cdf0e10cSrcweir if( pSect->GetFollow() == pSect->GetNext() )
1593cdf0e10cSrcweir {
1594cdf0e10cSrcweir SwPageFrm *pPg = pSect->GetFollow()->FindPageFrm();
1595cdf0e10cSrcweir if( WrongPageDesc( pPg ) )
1596cdf0e10cSrcweir bWrongPage = sal_True;
1597cdf0e10cSrcweir else
1598cdf0e10cSrcweir return FIRSTLEAF( pSect->GetFollow() );
1599cdf0e10cSrcweir }
1600cdf0e10cSrcweir else
1601cdf0e10cSrcweir {
1602cdf0e10cSrcweir SwFrm* pTmp;
1603cdf0e10cSrcweir if( !pSect->GetUpper()->IsColBodyFrm() ||
1604cdf0e10cSrcweir 0 == ( pTmp = pSect->GetUpper()->GetUpper()->GetNext() ) )
1605cdf0e10cSrcweir pTmp = pSect->FindPageFrm()->GetNext();
1606cdf0e10cSrcweir if( pTmp ) // ist jetzt die naechste Spalte oder Seite
1607cdf0e10cSrcweir {
1608cdf0e10cSrcweir SwFrm* pTmpX = pTmp;
1609cdf0e10cSrcweir if( pTmp->IsPageFrm() && ((SwPageFrm*)pTmp)->IsEmptyPage() )
1610cdf0e10cSrcweir pTmp = pTmp->GetNext(); // Dummyseiten ueberspringen
1611cdf0e10cSrcweir SwFrm *pUp = pSect->GetFollow()->GetUpper();
1612cdf0e10cSrcweir // pUp wird die Spalte, wenn der Follow in einer "nicht ersten" Spalte
1613cdf0e10cSrcweir // liegt, ansonsten die Seite:
1614cdf0e10cSrcweir if( !pUp->IsColBodyFrm() ||
1615cdf0e10cSrcweir !( pUp = pUp->GetUpper() )->GetPrev() )
1616cdf0e10cSrcweir pUp = pUp->FindPageFrm();
1617cdf0e10cSrcweir // Jetzt muessen pUp und pTmp die gleiche Seite/Spalte sein,
1618cdf0e10cSrcweir // sonst liegen Seiten oder Spalten zwischen Master und Follow.
1619cdf0e10cSrcweir if( pUp == pTmp || pUp->GetNext() == pTmpX )
1620cdf0e10cSrcweir {
1621cdf0e10cSrcweir SwPageFrm* pNxtPg = pUp->IsPageFrm() ?
1622cdf0e10cSrcweir (SwPageFrm*)pUp : pUp->FindPageFrm();
1623cdf0e10cSrcweir if( WrongPageDesc( pNxtPg ) )
1624cdf0e10cSrcweir bWrongPage = sal_True;
1625cdf0e10cSrcweir else
1626cdf0e10cSrcweir return FIRSTLEAF( pSect->GetFollow() );
1627cdf0e10cSrcweir }
1628cdf0e10cSrcweir }
1629cdf0e10cSrcweir }
1630cdf0e10cSrcweir }
1631cdf0e10cSrcweir
1632cdf0e10cSrcweir // Immer im gleichen Bereich landen: Body wieder in Body etc.
1633cdf0e10cSrcweir const sal_Bool bBody = IsInDocBody();
1634cdf0e10cSrcweir const sal_Bool bFtnPage = FindPageFrm()->IsFtnPage();
1635cdf0e10cSrcweir
1636cdf0e10cSrcweir SwLayoutFrm *pLayLeaf;
1637cdf0e10cSrcweir // Eine Abkuerzung fuer TabFrms, damit nicht alle Zellen abgehuehnert werden
1638cdf0e10cSrcweir if( bWrongPage )
1639cdf0e10cSrcweir pLayLeaf = 0;
1640cdf0e10cSrcweir else if( IsTabFrm() )
1641cdf0e10cSrcweir {
1642cdf0e10cSrcweir SwCntntFrm* pTmpCnt = ((SwTabFrm*)this)->FindLastCntnt();
1643cdf0e10cSrcweir pLayLeaf = pTmpCnt ? pTmpCnt->GetUpper() : 0;
1644cdf0e10cSrcweir }
1645cdf0e10cSrcweir else
1646cdf0e10cSrcweir {
1647cdf0e10cSrcweir pLayLeaf = GetNextLayoutLeaf();
1648cdf0e10cSrcweir if( IsColumnFrm() )
1649cdf0e10cSrcweir {
1650cdf0e10cSrcweir while( pLayLeaf && ((SwColumnFrm*)this)->IsAnLower( pLayLeaf ) )
1651cdf0e10cSrcweir pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
1652cdf0e10cSrcweir }
1653cdf0e10cSrcweir }
1654cdf0e10cSrcweir
1655cdf0e10cSrcweir SwLayoutFrm *pOldLayLeaf = 0; //Damit bei neu erzeugten Seiten
1656cdf0e10cSrcweir //nicht wieder vom Anfang gesucht
1657cdf0e10cSrcweir //wird.
1658cdf0e10cSrcweir
1659cdf0e10cSrcweir while( sal_True )
1660cdf0e10cSrcweir {
1661cdf0e10cSrcweir if( pLayLeaf )
1662cdf0e10cSrcweir {
1663cdf0e10cSrcweir // Ein Layoutblatt wurde gefunden, mal sehen, ob er mich aufnehmen kann,
1664cdf0e10cSrcweir // ob hier ein weiterer SectionFrm eingefuegt werden kann
1665cdf0e10cSrcweir // oder ob wir weitersuchen muessen.
1666cdf0e10cSrcweir SwPageFrm* pNxtPg = pLayLeaf->FindPageFrm();
1667cdf0e10cSrcweir if ( !bFtnPage && pNxtPg->IsFtnPage() )
1668cdf0e10cSrcweir { //Wenn ich bei den Endnotenseiten angelangt bin hat sichs.
1669cdf0e10cSrcweir pLayLeaf = 0;
1670cdf0e10cSrcweir continue;
1671cdf0e10cSrcweir }
1672cdf0e10cSrcweir // Einmal InBody, immer InBody, nicht in Tabellen hinein
1673cdf0e10cSrcweir // und nicht in fremde Bereiche hinein
1674cdf0e10cSrcweir if ( (bBody && !pLayLeaf->IsInDocBody()) ||
1675cdf0e10cSrcweir (IsInFtn() != pLayLeaf->IsInFtn() ) ||
1676cdf0e10cSrcweir pLayLeaf->IsInTab() ||
1677cdf0e10cSrcweir ( pLayLeaf->IsInSct() && ( !pSect->HasFollow()
1678cdf0e10cSrcweir || pSect->GetFollow() != pLayLeaf->FindSctFrm() ) ) )
1679cdf0e10cSrcweir {
1680cdf0e10cSrcweir //Er will mich nicht; neuer Versuch, neues Glueck
1681cdf0e10cSrcweir pOldLayLeaf = pLayLeaf;
1682cdf0e10cSrcweir pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
1683cdf0e10cSrcweir continue;
1684cdf0e10cSrcweir }
1685cdf0e10cSrcweir if( WrongPageDesc( pNxtPg ) )
1686cdf0e10cSrcweir {
1687cdf0e10cSrcweir if( bWrongPage )
1688cdf0e10cSrcweir break; // there's a column between me and my right page
1689cdf0e10cSrcweir pLayLeaf = 0;
1690cdf0e10cSrcweir bWrongPage = sal_True;
1691cdf0e10cSrcweir pOldLayLeaf = 0;
1692cdf0e10cSrcweir continue;
1693cdf0e10cSrcweir }
1694cdf0e10cSrcweir }
1695cdf0e10cSrcweir //Es gibt keinen passenden weiteren LayoutFrm, also muss eine
1696cdf0e10cSrcweir //neue Seite her, allerdings nuetzen uns innerhalb eines Rahmens
1697cdf0e10cSrcweir //neue Seiten nichts.
1698cdf0e10cSrcweir else if( !pSect->IsInFly() &&
1699cdf0e10cSrcweir ( eMakePage == MAKEPAGE_APPEND || eMakePage == MAKEPAGE_INSERT ) )
1700cdf0e10cSrcweir {
1701cdf0e10cSrcweir InsertPage(pOldLayLeaf ? pOldLayLeaf->FindPageFrm() : FindPageFrm(),
1702cdf0e10cSrcweir sal_False );
1703cdf0e10cSrcweir //und nochmal das ganze
1704cdf0e10cSrcweir pLayLeaf = pOldLayLeaf ? pOldLayLeaf : GetNextLayoutLeaf();
1705cdf0e10cSrcweir continue;
1706cdf0e10cSrcweir }
1707cdf0e10cSrcweir break;
1708cdf0e10cSrcweir }
1709cdf0e10cSrcweir
1710cdf0e10cSrcweir if( pLayLeaf )
1711cdf0e10cSrcweir {
1712cdf0e10cSrcweir // Das passende Layoutblatt haben wir gefunden, wenn es dort bereits einen
1713cdf0e10cSrcweir // Follow unseres Bereichs gibt, nehmen wir dessen erstes Layoutblatt,
1714cdf0e10cSrcweir // andernfalls wird es Zeit, einen Bereichsfollow zu erzeugen
1715cdf0e10cSrcweir SwSectionFrm* pNew;
1716cdf0e10cSrcweir
1717cdf0e10cSrcweir //Dies kann entfallen, wenn bei existierenden Follows bereits abgekuerzt wurde
1718cdf0e10cSrcweir SwFrm* pFirst = pLayLeaf->Lower();
1719cdf0e10cSrcweir // Auch hier muessen zum Loeschen angemeldete SectionFrms ignoriert werden
1720cdf0e10cSrcweir while( pFirst && pFirst->IsSctFrm() && !((SwSectionFrm*)pFirst)->GetSection() )
1721cdf0e10cSrcweir pFirst = pFirst->GetNext();
1722cdf0e10cSrcweir if( pFirst && pFirst->IsSctFrm() && pSect->GetFollow() == pFirst )
1723cdf0e10cSrcweir pNew = pSect->GetFollow();
1724cdf0e10cSrcweir else if( MAKEPAGE_NOSECTION == eMakePage )
1725cdf0e10cSrcweir return pLayLeaf;
1726cdf0e10cSrcweir else
1727cdf0e10cSrcweir {
1728cdf0e10cSrcweir pNew = new SwSectionFrm( *pSect, sal_False );
1729cdf0e10cSrcweir pNew->InsertBefore( pLayLeaf, pLayLeaf->Lower() );
1730cdf0e10cSrcweir pNew->Init();
1731cdf0e10cSrcweir SWRECTFN( pNew )
1732cdf0e10cSrcweir (pNew->*fnRect->fnMakePos)( pLayLeaf, NULL, sal_True );
1733cdf0e10cSrcweir
1734cdf0e10cSrcweir // Wenn unser Bereichsframe einen Nachfolger hat, so muss dieser
1735cdf0e10cSrcweir // umgehaengt werden hinter den neuen Follow der Bereichsframes.
1736cdf0e10cSrcweir SwFrm* pTmp = pSect->GetNext();
1737cdf0e10cSrcweir if( pTmp && pTmp != pSect->GetFollow() )
1738cdf0e10cSrcweir {
1739cdf0e10cSrcweir SwFlowFrm* pNxt;
1740cdf0e10cSrcweir SwCntntFrm* pNxtCntnt = NULL;
1741cdf0e10cSrcweir if( pTmp->IsCntntFrm() )
1742cdf0e10cSrcweir {
1743cdf0e10cSrcweir pNxt = (SwCntntFrm*)pTmp;
1744cdf0e10cSrcweir pNxtCntnt = (SwCntntFrm*)pTmp;
1745cdf0e10cSrcweir }
1746cdf0e10cSrcweir else
1747cdf0e10cSrcweir {
1748cdf0e10cSrcweir pNxtCntnt = ((SwLayoutFrm*)pTmp)->ContainsCntnt();
1749cdf0e10cSrcweir if( pTmp->IsSctFrm() )
1750cdf0e10cSrcweir pNxt = (SwSectionFrm*)pTmp;
1751cdf0e10cSrcweir else
1752cdf0e10cSrcweir {
1753cdf0e10cSrcweir ASSERT( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" );
1754cdf0e10cSrcweir pNxt = (SwTabFrm*)pTmp;
1755cdf0e10cSrcweir }
1756cdf0e10cSrcweir while( !pNxtCntnt && 0 != ( pTmp = pTmp->GetNext() ) )
1757cdf0e10cSrcweir {
1758cdf0e10cSrcweir if( pTmp->IsCntntFrm() )
1759cdf0e10cSrcweir pNxtCntnt = (SwCntntFrm*)pTmp;
1760cdf0e10cSrcweir else
1761cdf0e10cSrcweir pNxtCntnt = ((SwLayoutFrm*)pTmp)->ContainsCntnt();
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir }
1764cdf0e10cSrcweir if( pNxtCntnt )
1765cdf0e10cSrcweir {
1766cdf0e10cSrcweir SwFtnBossFrm* pOldBoss = pSect->FindFtnBossFrm( sal_True );
1767cdf0e10cSrcweir if( pOldBoss == pNxtCntnt->FindFtnBossFrm( sal_True ) )
1768cdf0e10cSrcweir {
1769cdf0e10cSrcweir SwSaveFtnHeight aHeight( pOldBoss,
1770cdf0e10cSrcweir pOldBoss->Frm().Top() + pOldBoss->Frm().Height() );
1771cdf0e10cSrcweir pSect->GetUpper()->MoveLowerFtns( pNxtCntnt, pOldBoss,
1772cdf0e10cSrcweir pLayLeaf->FindFtnBossFrm( sal_True ), sal_False );
1773cdf0e10cSrcweir }
1774cdf0e10cSrcweir }
1775cdf0e10cSrcweir ((SwFlowFrm*)pNxt)->MoveSubTree( pLayLeaf, pNew->GetNext() );
1776cdf0e10cSrcweir }
1777cdf0e10cSrcweir if( pNew->GetFollow() )
1778cdf0e10cSrcweir pNew->SimpleFormat();
1779cdf0e10cSrcweir }
1780cdf0e10cSrcweir // Das gesuchte Layoutblatt ist jetzt das erste des ermittelten SctFrms:
1781cdf0e10cSrcweir pLayLeaf = FIRSTLEAF( pNew );
1782cdf0e10cSrcweir }
1783cdf0e10cSrcweir return pLayLeaf;
1784cdf0e10cSrcweir }
1785cdf0e10cSrcweir
1786cdf0e10cSrcweir /*************************************************************************
1787cdf0e10cSrcweir |*
1788cdf0e10cSrcweir |* SwFrm::GetPrevSctLeaf()
1789cdf0e10cSrcweir |*
1790cdf0e10cSrcweir |* Beschreibung Liefert das vorhergehende LayoutBlatt in das der
1791cdf0e10cSrcweir |* Frame gemoved werden kann.
1792cdf0e10cSrcweir |* Ersterstellung AMA 07. Jan. 98
1793cdf0e10cSrcweir |* Letzte Aenderung AMA 07. Jan. 98
1794cdf0e10cSrcweir |*
1795cdf0e10cSrcweir |*************************************************************************/
1796cdf0e10cSrcweir
1797cdf0e10cSrcweir
GetPrevSctLeaf(MakePageType)1798cdf0e10cSrcweir SwLayoutFrm *SwFrm::GetPrevSctLeaf( MakePageType )
1799cdf0e10cSrcweir {
1800cdf0e10cSrcweir PROTOCOL_ENTER( this, PROT_LEAF, ACT_PREV_SECT, GetUpper()->FindSctFrm() )
1801cdf0e10cSrcweir
1802cdf0e10cSrcweir SwLayoutFrm* pCol;
1803cdf0e10cSrcweir // ColumnFrm beinhalten jetzt stets einen BodyFrm
1804cdf0e10cSrcweir if( IsColBodyFrm() )
1805cdf0e10cSrcweir pCol = GetUpper();
1806cdf0e10cSrcweir else if( GetUpper()->IsColBodyFrm() )
1807cdf0e10cSrcweir pCol = GetUpper()->GetUpper();
1808cdf0e10cSrcweir else
1809cdf0e10cSrcweir pCol = NULL;
1810cdf0e10cSrcweir sal_Bool bJump = sal_False;
1811cdf0e10cSrcweir if( pCol )
1812cdf0e10cSrcweir {
1813cdf0e10cSrcweir if( pCol->GetPrev() )
1814cdf0e10cSrcweir {
1815cdf0e10cSrcweir do
1816cdf0e10cSrcweir {
1817cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetPrev();
1818cdf0e10cSrcweir // Gibt es dort Inhalt?
1819cdf0e10cSrcweir if( ((SwLayoutFrm*)pCol->Lower())->Lower() )
1820cdf0e10cSrcweir {
1821cdf0e10cSrcweir if( bJump ) // Haben wir eine leere Spalte uebersprungen?
1822cdf0e10cSrcweir SwFlowFrm::SetMoveBwdJump( sal_True );
1823cdf0e10cSrcweir return (SwLayoutFrm*)pCol->Lower(); // Der Spaltenbody
1824cdf0e10cSrcweir }
1825cdf0e10cSrcweir bJump = sal_True;
1826cdf0e10cSrcweir } while( pCol->GetPrev() );
1827cdf0e10cSrcweir
1828cdf0e10cSrcweir // Hier landen wir, wenn alle Spalten leer sind,
1829cdf0e10cSrcweir // pCol ist jetzt die erste Spalte, wir brauchen aber den Body:
1830cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->Lower();
1831cdf0e10cSrcweir }
1832cdf0e10cSrcweir else
1833cdf0e10cSrcweir pCol = NULL;
1834cdf0e10cSrcweir }
1835cdf0e10cSrcweir
1836cdf0e10cSrcweir if( bJump ) // Haben wir eine leere Spalte uebersprungen?
1837cdf0e10cSrcweir SwFlowFrm::SetMoveBwdJump( sal_True );
1838cdf0e10cSrcweir
1839cdf0e10cSrcweir // Innerhalb von Bereichen in Tabellen oder Bereichen in Kopf/Fusszeilen kann
1840cdf0e10cSrcweir // nur ein Spaltenwechsel erfolgen, eine der oberen Abkuerzungen haette
1841cdf0e10cSrcweir // zuschlagen muessen, ebenso wenn der Bereich einen pPrev hat.
1842cdf0e10cSrcweir // Jetzt ziehen wir sogar eine leere Spalte in Betracht...
1843cdf0e10cSrcweir ASSERT( FindSctFrm(), "GetNextSctLeaf: Missing SectionFrm" );
1844cdf0e10cSrcweir if( ( IsInTab() && !IsTabFrm() ) || FindFooterOrHeader() )
1845cdf0e10cSrcweir return pCol;
1846cdf0e10cSrcweir
1847cdf0e10cSrcweir // === IMPORTANT ===
1848cdf0e10cSrcweir // Precondition, which needs to be hold, is that the <this> frame can be
1849cdf0e10cSrcweir // inside a table, but then the found section frame <pSect> is also inside
1850cdf0e10cSrcweir // this table.
1851cdf0e10cSrcweir SwSectionFrm *pSect = FindSctFrm();
1852cdf0e10cSrcweir
1853cdf0e10cSrcweir // --> OD 2009-01-16 #i95698#
1854cdf0e10cSrcweir // A table cell containing directly a section does not break - see lcl_FindSectionsInRow(..)
1855cdf0e10cSrcweir // Thus, a table inside a section, which is inside another table can only
1856cdf0e10cSrcweir // flow backward in the columns of its section.
1857cdf0e10cSrcweir // Note: The table cell, which contains the section, can not have a master table cell.
1858cdf0e10cSrcweir if ( IsTabFrm() && pSect->IsInTab() )
1859cdf0e10cSrcweir {
1860cdf0e10cSrcweir return pCol;
1861cdf0e10cSrcweir }
1862cdf0e10cSrcweir // <--
1863cdf0e10cSrcweir
1864cdf0e10cSrcweir {
1865cdf0e10cSrcweir SwFrm *pPrv;
1866cdf0e10cSrcweir if( 0 != ( pPrv = pSect->GetIndPrev() ) )
1867cdf0e10cSrcweir {
1868cdf0e10cSrcweir // Herumlungernde, halbtote SectionFrms sollen uns nicht beirren
1869cdf0e10cSrcweir while( pPrv && pPrv->IsSctFrm() && !((SwSectionFrm*)pPrv)->GetSection() )
1870cdf0e10cSrcweir pPrv = pPrv->GetPrev();
1871cdf0e10cSrcweir if( pPrv )
1872cdf0e10cSrcweir return pCol;
1873cdf0e10cSrcweir }
1874cdf0e10cSrcweir }
1875cdf0e10cSrcweir
1876cdf0e10cSrcweir const sal_Bool bBody = IsInDocBody();
1877cdf0e10cSrcweir const sal_Bool bFly = IsInFly();
1878cdf0e10cSrcweir
1879cdf0e10cSrcweir SwLayoutFrm *pLayLeaf = GetPrevLayoutLeaf();
1880cdf0e10cSrcweir SwLayoutFrm *pPrevLeaf = 0;
1881cdf0e10cSrcweir
1882cdf0e10cSrcweir while ( pLayLeaf )
1883cdf0e10cSrcweir {
1884cdf0e10cSrcweir //In Tabellen oder Bereiche geht's niemals hinein.
1885cdf0e10cSrcweir if ( pLayLeaf->IsInTab() || pLayLeaf->IsInSct() )
1886cdf0e10cSrcweir {
1887cdf0e10cSrcweir pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
1888cdf0e10cSrcweir }
1889cdf0e10cSrcweir else if ( bBody && pLayLeaf->IsInDocBody() )
1890cdf0e10cSrcweir {
1891cdf0e10cSrcweir // If there is a pLayLeaf has a lower pLayLeaf is the frame we are looking for.
1892cdf0e10cSrcweir // Exception: pLayLeaf->Lower() is a zombie section frame
1893cdf0e10cSrcweir const SwFrm* pTmp = pLayLeaf->Lower();
1894cdf0e10cSrcweir // OD 11.04.2003 #108824# - consider, that the zombie section frame
1895cdf0e10cSrcweir // can have frame below it in the found layout leaf.
1896cdf0e10cSrcweir // Thus, skipping zombie section frame, if possible.
1897cdf0e10cSrcweir while ( pTmp && pTmp->IsSctFrm() &&
1898cdf0e10cSrcweir !( static_cast<const SwSectionFrm*>(pTmp)->GetSection() ) &&
1899cdf0e10cSrcweir pTmp->GetNext()
1900cdf0e10cSrcweir )
1901cdf0e10cSrcweir {
1902cdf0e10cSrcweir pTmp = pTmp->GetNext();
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir if ( pTmp &&
1905cdf0e10cSrcweir ( !pTmp->IsSctFrm() ||
1906cdf0e10cSrcweir ( static_cast<const SwSectionFrm*>(pTmp)->GetSection() )
1907cdf0e10cSrcweir )
1908cdf0e10cSrcweir )
1909cdf0e10cSrcweir {
1910cdf0e10cSrcweir break;
1911cdf0e10cSrcweir }
1912cdf0e10cSrcweir pPrevLeaf = pLayLeaf;
1913cdf0e10cSrcweir pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
1914cdf0e10cSrcweir if ( pLayLeaf )
1915cdf0e10cSrcweir SwFlowFrm::SetMoveBwdJump( sal_True );
1916cdf0e10cSrcweir }
1917cdf0e10cSrcweir else if ( bFly )
1918cdf0e10cSrcweir break; //Cntnts in Flys sollte jedes Layout-Blatt recht sein. Warum?
1919cdf0e10cSrcweir else
1920cdf0e10cSrcweir pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
1921cdf0e10cSrcweir }
1922cdf0e10cSrcweir if( !pLayLeaf )
1923cdf0e10cSrcweir {
1924cdf0e10cSrcweir if( !pPrevLeaf )
1925cdf0e10cSrcweir return pCol;
1926cdf0e10cSrcweir pLayLeaf = pPrevLeaf;
1927cdf0e10cSrcweir }
1928cdf0e10cSrcweir
1929cdf0e10cSrcweir SwSectionFrm* pNew = NULL;
1930cdf0e10cSrcweir // Zunaechst einmal an das Ende des Layoutblatts gehen
1931cdf0e10cSrcweir SwFrm *pTmp = pLayLeaf->Lower();
1932cdf0e10cSrcweir if( pTmp )
1933cdf0e10cSrcweir {
1934cdf0e10cSrcweir while( pTmp->GetNext() )
1935cdf0e10cSrcweir pTmp = pTmp->GetNext();
1936cdf0e10cSrcweir if( pTmp->IsSctFrm() )
1937cdf0e10cSrcweir {
1938cdf0e10cSrcweir // Halbtote stoeren hier nur...
1939cdf0e10cSrcweir while( !((SwSectionFrm*)pTmp)->GetSection() && pTmp->GetPrev() &&
1940cdf0e10cSrcweir pTmp->GetPrev()->IsSctFrm() )
1941cdf0e10cSrcweir pTmp = pTmp->GetPrev();
1942cdf0e10cSrcweir if( ((SwSectionFrm*)pTmp)->GetFollow() == pSect )
1943cdf0e10cSrcweir pNew = (SwSectionFrm*)pTmp;
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir }
1946cdf0e10cSrcweir if( !pNew )
1947cdf0e10cSrcweir {
1948cdf0e10cSrcweir pNew = new SwSectionFrm( *pSect, sal_True );
1949cdf0e10cSrcweir pNew->InsertBefore( pLayLeaf, NULL );
1950cdf0e10cSrcweir pNew->Init();
1951cdf0e10cSrcweir SWRECTFN( pNew )
1952cdf0e10cSrcweir (pNew->*fnRect->fnMakePos)( pLayLeaf, pNew->GetPrev(), sal_True );
1953cdf0e10cSrcweir
1954cdf0e10cSrcweir pLayLeaf = FIRSTLEAF( pNew );
1955cdf0e10cSrcweir if( !pNew->Lower() ) // einspaltige Bereiche formatieren
1956cdf0e10cSrcweir {
1957cdf0e10cSrcweir pNew->MakePos();
1958cdf0e10cSrcweir pLayLeaf->Format(); // damit die PrtArea fuers MoveBwd stimmt
1959cdf0e10cSrcweir }
1960cdf0e10cSrcweir else
1961cdf0e10cSrcweir pNew->SimpleFormat();
1962cdf0e10cSrcweir }
1963cdf0e10cSrcweir else
1964cdf0e10cSrcweir {
1965cdf0e10cSrcweir pLayLeaf = FIRSTLEAF( pNew );
1966cdf0e10cSrcweir if( pLayLeaf->IsColBodyFrm() )
1967cdf0e10cSrcweir {
1968cdf0e10cSrcweir // In existent section columns we're looking for the last not empty
1969cdf0e10cSrcweir // column.
1970cdf0e10cSrcweir SwLayoutFrm *pTmpLay = pLayLeaf;
1971cdf0e10cSrcweir while( pLayLeaf->GetUpper()->GetNext() )
1972cdf0e10cSrcweir {
1973cdf0e10cSrcweir pLayLeaf = (SwLayoutFrm*)((SwLayoutFrm*)pLayLeaf->GetUpper()->GetNext())->Lower();
1974cdf0e10cSrcweir if( pLayLeaf->Lower() )
1975cdf0e10cSrcweir pTmpLay = pLayLeaf;
1976cdf0e10cSrcweir }
1977cdf0e10cSrcweir // If we skipped an empty column, we've to set the jump-flag
1978cdf0e10cSrcweir if( pLayLeaf != pTmpLay )
1979cdf0e10cSrcweir {
1980cdf0e10cSrcweir pLayLeaf = pTmpLay;
1981cdf0e10cSrcweir SwFlowFrm::SetMoveBwdJump( sal_True );
1982cdf0e10cSrcweir }
1983cdf0e10cSrcweir }
1984cdf0e10cSrcweir }
1985cdf0e10cSrcweir return pLayLeaf;
1986cdf0e10cSrcweir }
1987cdf0e10cSrcweir
lcl_DeadLine(const SwFrm * pFrm)1988cdf0e10cSrcweir SwTwips lcl_DeadLine( const SwFrm* pFrm )
1989cdf0e10cSrcweir {
1990cdf0e10cSrcweir const SwLayoutFrm* pUp = pFrm->GetUpper();
1991cdf0e10cSrcweir while( pUp && pUp->IsInSct() )
1992cdf0e10cSrcweir {
1993cdf0e10cSrcweir if( pUp->IsSctFrm() )
1994cdf0e10cSrcweir pUp = pUp->GetUpper();
1995cdf0e10cSrcweir // Spalten jetzt mit BodyFrm
1996cdf0e10cSrcweir else if( pUp->IsColBodyFrm() && pUp->GetUpper()->GetUpper()->IsSctFrm() )
1997cdf0e10cSrcweir pUp = pUp->GetUpper()->GetUpper();
1998cdf0e10cSrcweir else
1999cdf0e10cSrcweir break;
2000cdf0e10cSrcweir }
2001cdf0e10cSrcweir SWRECTFN( pFrm )
2002cdf0e10cSrcweir return pUp ? (pUp->*fnRect->fnGetPrtBottom)() :
2003cdf0e10cSrcweir (pFrm->Frm().*fnRect->fnGetBottom)();
2004cdf0e10cSrcweir }
2005cdf0e10cSrcweir
2006cdf0e10cSrcweir // SwSectionFrm::Growable(..) prueft, ob der SectionFrm noch wachsen kann,
2007cdf0e10cSrcweir // ggf. muss die Umgebung gefragt werden
2008cdf0e10cSrcweir
Growable() const2009cdf0e10cSrcweir sal_Bool SwSectionFrm::Growable() const
2010cdf0e10cSrcweir {
2011cdf0e10cSrcweir SWRECTFN( this )
2012cdf0e10cSrcweir if( (*fnRect->fnYDiff)( lcl_DeadLine( this ),
2013cdf0e10cSrcweir (Frm().*fnRect->fnGetBottom)() ) > 0 )
2014cdf0e10cSrcweir return sal_True;
2015cdf0e10cSrcweir
2016cdf0e10cSrcweir return ( GetUpper() && ((SwFrm*)GetUpper())->Grow( LONG_MAX, sal_True ) );
2017cdf0e10cSrcweir }
2018cdf0e10cSrcweir
2019cdf0e10cSrcweir /*************************************************************************
2020cdf0e10cSrcweir |*
2021cdf0e10cSrcweir |* SwSectionFrm::_Grow(), _Shrink()
2022cdf0e10cSrcweir |*
2023cdf0e10cSrcweir |* Ersterstellung AMA 14. Jan. 98
2024cdf0e10cSrcweir |* Letzte Aenderung AMA 14. Jan. 98
2025cdf0e10cSrcweir |*
2026cdf0e10cSrcweir |*************************************************************************/
2027cdf0e10cSrcweir
_Grow(SwTwips nDist,sal_Bool bTst)2028cdf0e10cSrcweir SwTwips SwSectionFrm::_Grow( SwTwips nDist, sal_Bool bTst )
2029cdf0e10cSrcweir {
2030cdf0e10cSrcweir if ( !IsColLocked() && !HasFixSize() )
2031cdf0e10cSrcweir {
2032cdf0e10cSrcweir SWRECTFN( this )
2033cdf0e10cSrcweir long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
2034cdf0e10cSrcweir if( nFrmHeight > 0 && nDist > (LONG_MAX - nFrmHeight) )
2035cdf0e10cSrcweir nDist = LONG_MAX - nFrmHeight;
2036cdf0e10cSrcweir
2037cdf0e10cSrcweir if ( nDist <= 0L )
2038cdf0e10cSrcweir return 0L;
2039cdf0e10cSrcweir
2040cdf0e10cSrcweir sal_Bool bInCalcCntnt = GetUpper() && IsInFly() && FindFlyFrm()->IsLocked();
2041cdf0e10cSrcweir // OD 2004-03-15 #116561# - allow grow in online layout
2042cdf0e10cSrcweir sal_Bool bGrow = !Lower() || !Lower()->IsColumnFrm() || !Lower()->GetNext() ||
2043cdf0e10cSrcweir GetSection()->GetFmt()->GetBalancedColumns().GetValue();
2044cdf0e10cSrcweir if( !bGrow )
2045cdf0e10cSrcweir {
2046cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
2047cdf0e10cSrcweir bGrow = pSh && pSh->GetViewOptions()->getBrowseMode();
2048cdf0e10cSrcweir }
2049cdf0e10cSrcweir if( bGrow )
2050cdf0e10cSrcweir {
2051cdf0e10cSrcweir SwTwips nGrow;
2052cdf0e10cSrcweir if( IsInFtn() )
2053cdf0e10cSrcweir nGrow = 0;
2054cdf0e10cSrcweir else
2055cdf0e10cSrcweir {
2056cdf0e10cSrcweir nGrow = lcl_DeadLine( this );
2057cdf0e10cSrcweir nGrow = (*fnRect->fnYDiff)( nGrow,
2058cdf0e10cSrcweir (Frm().*fnRect->fnGetBottom)() );
2059cdf0e10cSrcweir }
2060cdf0e10cSrcweir SwTwips nSpace = nGrow;
2061cdf0e10cSrcweir if( !bInCalcCntnt && nGrow < nDist && GetUpper() )
2062cdf0e10cSrcweir nGrow += GetUpper()->Grow( LONG_MAX, sal_True );
2063cdf0e10cSrcweir
2064cdf0e10cSrcweir if( nGrow > nDist )
2065cdf0e10cSrcweir nGrow = nDist;
2066cdf0e10cSrcweir if( nGrow <= 0 )
2067cdf0e10cSrcweir {
2068cdf0e10cSrcweir nGrow = 0;
2069cdf0e10cSrcweir if( nDist && !bTst )
2070cdf0e10cSrcweir {
2071cdf0e10cSrcweir if( bInCalcCntnt )
2072cdf0e10cSrcweir _InvalidateSize();
2073cdf0e10cSrcweir else
2074cdf0e10cSrcweir InvalidateSize();
2075cdf0e10cSrcweir }
2076cdf0e10cSrcweir }
2077cdf0e10cSrcweir else if( !bTst )
2078cdf0e10cSrcweir {
2079cdf0e10cSrcweir if( bInCalcCntnt )
2080cdf0e10cSrcweir _InvalidateSize();
2081cdf0e10cSrcweir else if( nSpace < nGrow && nDist != nSpace + GetUpper()->
2082cdf0e10cSrcweir Grow( nGrow - nSpace, sal_False ) )
2083cdf0e10cSrcweir InvalidateSize();
2084cdf0e10cSrcweir else
2085cdf0e10cSrcweir {
2086cdf0e10cSrcweir const SvxGraphicPosition ePos =
2087cdf0e10cSrcweir GetAttrSet()->GetBackground().GetGraphicPos();
2088cdf0e10cSrcweir if ( GPOS_RT < ePos && GPOS_TILED != ePos )
2089cdf0e10cSrcweir {
2090cdf0e10cSrcweir SetCompletePaint();
2091cdf0e10cSrcweir InvalidatePage();
2092cdf0e10cSrcweir }
2093cdf0e10cSrcweir if( GetUpper() && GetUpper()->IsHeaderFrm() )
2094cdf0e10cSrcweir GetUpper()->InvalidateSize();
2095cdf0e10cSrcweir }
2096cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( nGrow );
2097cdf0e10cSrcweir long nPrtHeight = (Prt().*fnRect->fnGetHeight)() + nGrow;
2098cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nPrtHeight );
2099cdf0e10cSrcweir
2100cdf0e10cSrcweir if( Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() )
2101cdf0e10cSrcweir {
2102cdf0e10cSrcweir SwFrm* pTmp = Lower();
2103cdf0e10cSrcweir do
2104cdf0e10cSrcweir {
2105cdf0e10cSrcweir pTmp->_InvalidateSize();
2106cdf0e10cSrcweir pTmp = pTmp->GetNext();
2107cdf0e10cSrcweir } while ( pTmp );
2108cdf0e10cSrcweir _InvalidateSize();
2109cdf0e10cSrcweir }
2110cdf0e10cSrcweir if( GetNext() )
2111cdf0e10cSrcweir {
2112cdf0e10cSrcweir SwFrm *pFrm = GetNext();
2113cdf0e10cSrcweir while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
2114cdf0e10cSrcweir pFrm = pFrm->GetNext();
2115cdf0e10cSrcweir if( pFrm )
2116cdf0e10cSrcweir {
2117cdf0e10cSrcweir if( bInCalcCntnt )
2118cdf0e10cSrcweir pFrm->_InvalidatePos();
2119cdf0e10cSrcweir else
2120cdf0e10cSrcweir pFrm->InvalidatePos();
2121cdf0e10cSrcweir }
2122cdf0e10cSrcweir }
2123cdf0e10cSrcweir // --> OD 2004-07-05 #i28701# - Due to the new object positioning
2124cdf0e10cSrcweir // the frame on the next page/column can flow backward (e.g. it
2125cdf0e10cSrcweir // was moved forward due to the positioning of its objects ).
2126cdf0e10cSrcweir // Thus, invalivate this next frame, if document compatibility
2127cdf0e10cSrcweir // option 'Consider wrapping style influence on object positioning' is ON.
2128cdf0e10cSrcweir else if ( GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
2129cdf0e10cSrcweir {
2130cdf0e10cSrcweir InvalidateNextPos();
2131cdf0e10cSrcweir }
2132cdf0e10cSrcweir // <--
2133cdf0e10cSrcweir }
2134cdf0e10cSrcweir return nGrow;
2135cdf0e10cSrcweir }
2136cdf0e10cSrcweir if ( !bTst )
2137cdf0e10cSrcweir {
2138cdf0e10cSrcweir if( bInCalcCntnt )
2139cdf0e10cSrcweir _InvalidateSize();
2140cdf0e10cSrcweir else
2141cdf0e10cSrcweir InvalidateSize();
2142cdf0e10cSrcweir }
2143cdf0e10cSrcweir }
2144cdf0e10cSrcweir return 0L;
2145cdf0e10cSrcweir }
2146cdf0e10cSrcweir
_Shrink(SwTwips nDist,sal_Bool bTst)2147cdf0e10cSrcweir SwTwips SwSectionFrm::_Shrink( SwTwips nDist, sal_Bool bTst )
2148cdf0e10cSrcweir {
2149cdf0e10cSrcweir if ( Lower() && !IsColLocked() && !HasFixSize() )
2150cdf0e10cSrcweir {
2151cdf0e10cSrcweir if( ToMaximize( sal_False ) )
2152cdf0e10cSrcweir {
2153cdf0e10cSrcweir if( !bTst )
2154cdf0e10cSrcweir InvalidateSize();
2155cdf0e10cSrcweir }
2156cdf0e10cSrcweir else
2157cdf0e10cSrcweir {
2158cdf0e10cSrcweir SWRECTFN( this )
2159cdf0e10cSrcweir long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
2160cdf0e10cSrcweir if ( nDist > nFrmHeight )
2161cdf0e10cSrcweir nDist = nFrmHeight;
2162cdf0e10cSrcweir
2163cdf0e10cSrcweir if ( Lower()->IsColumnFrm() && Lower()->GetNext() && // FtnAtEnd
2164cdf0e10cSrcweir !GetSection()->GetFmt()->GetBalancedColumns().GetValue() )
2165cdf0e10cSrcweir { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
2166cdf0e10cSrcweir //das Wachstum (wg. des Ausgleichs).
2167cdf0e10cSrcweir if ( !bTst )
2168cdf0e10cSrcweir InvalidateSize();
2169cdf0e10cSrcweir return nDist;
2170cdf0e10cSrcweir }
2171cdf0e10cSrcweir else if( !bTst )
2172cdf0e10cSrcweir {
2173cdf0e10cSrcweir const SvxGraphicPosition ePos =
2174cdf0e10cSrcweir GetAttrSet()->GetBackground().GetGraphicPos();
2175cdf0e10cSrcweir if ( GPOS_RT < ePos && GPOS_TILED != ePos )
2176cdf0e10cSrcweir {
2177cdf0e10cSrcweir SetCompletePaint();
2178cdf0e10cSrcweir InvalidatePage();
2179cdf0e10cSrcweir }
2180cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( -nDist );
2181cdf0e10cSrcweir long nPrtHeight = (Prt().*fnRect->fnGetHeight)() - nDist;
2182cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nPrtHeight );
2183cdf0e10cSrcweir
2184cdf0e10cSrcweir SwTwips nReal = 0;
2185cdf0e10cSrcweir // We do not allow a section frame to shrink the its upper
2186cdf0e10cSrcweir // footer frame. This is because in the calculation of a
2187cdf0e10cSrcweir // footer frame, the content of the section frame is _not_
2188cdf0e10cSrcweir // calculated. If there is a fly frame overlapping with the
2189cdf0e10cSrcweir // footer frame, the section frame is not affected by this
2190cdf0e10cSrcweir // during the calculation of the footer frame size.
2191cdf0e10cSrcweir // The footer frame does not grow in its FormatSize function
2192cdf0e10cSrcweir // but during the calculation of the content of the section
2193cdf0e10cSrcweir // frame. The section frame grows until some of its text is
2194cdf0e10cSrcweir // located on top of the fly frame. The next call of CalcCntnt
2195cdf0e10cSrcweir // tries to shrink the section and here it would also shrink
2196cdf0e10cSrcweir // the footer. This may not happen, because shrinking the footer
2197cdf0e10cSrcweir // would cause the top of the section frame to overlap with the
2198cdf0e10cSrcweir // fly frame again, this would result in a perfect loop.
2199cdf0e10cSrcweir if( GetUpper() && !GetUpper()->IsFooterFrm() )
2200cdf0e10cSrcweir nReal = GetUpper()->Shrink( nDist, bTst );
2201cdf0e10cSrcweir
2202cdf0e10cSrcweir if( Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() )
2203cdf0e10cSrcweir {
2204cdf0e10cSrcweir SwFrm* pTmp = Lower();
2205cdf0e10cSrcweir do
2206cdf0e10cSrcweir {
2207cdf0e10cSrcweir pTmp->_InvalidateSize();
2208cdf0e10cSrcweir pTmp = pTmp->GetNext();
2209cdf0e10cSrcweir } while ( pTmp );
2210cdf0e10cSrcweir }
2211cdf0e10cSrcweir if( GetNext() )
2212cdf0e10cSrcweir {
2213cdf0e10cSrcweir SwFrm* pFrm = GetNext();
2214cdf0e10cSrcweir while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
2215cdf0e10cSrcweir pFrm = pFrm->GetNext();
2216cdf0e10cSrcweir if( pFrm )
2217cdf0e10cSrcweir pFrm->InvalidatePos();
2218cdf0e10cSrcweir else
2219cdf0e10cSrcweir SetRetouche();
2220cdf0e10cSrcweir }
2221cdf0e10cSrcweir else
2222cdf0e10cSrcweir SetRetouche();
2223cdf0e10cSrcweir return nDist;
2224cdf0e10cSrcweir }
2225cdf0e10cSrcweir }
2226cdf0e10cSrcweir }
2227cdf0e10cSrcweir return 0L;
2228cdf0e10cSrcweir }
2229cdf0e10cSrcweir
2230cdf0e10cSrcweir /*************************************************************************
2231cdf0e10cSrcweir |*
2232cdf0e10cSrcweir |* SwSectionFrm::MoveAllowed()
2233cdf0e10cSrcweir |*
2234cdf0e10cSrcweir |* Ersterstellung MA 08. Oct. 98
2235cdf0e10cSrcweir |* Letzte Aenderung MA 08. Oct. 98
2236cdf0e10cSrcweir |*
2237cdf0e10cSrcweir |* Wann sind Frms innerhalb eines SectionFrms moveable?
2238cdf0e10cSrcweir |* Wenn sie noch nicht in der letzten Spalte des SectionFrms sind,
2239cdf0e10cSrcweir |* wenn es einen Follow gibt,
2240cdf0e10cSrcweir |* wenn der SectionFrm nicht mehr wachsen kann, wird es komplizierter,
2241cdf0e10cSrcweir |* dann kommt es darauf an, ob der SectionFrm ein naechstes Layoutblatt
2242cdf0e10cSrcweir |* finden kann. In (spaltigen/verketteten) Flys wird dies via GetNextLayout
2243cdf0e10cSrcweir |* geprueft, in Tabellen und in Kopf/Fusszeilen gibt es keins, im DocBody
2244cdf0e10cSrcweir |* und auch im Fussnoten dagegen immer.
2245cdf0e10cSrcweir |*
2246cdf0e10cSrcweir |* Benutzt wird diese Routine im TxtFormatter, um zu entscheiden, ob ein
2247cdf0e10cSrcweir |* (Absatz-)Follow erzeugt werden darf oder ob der Absatz zusammenhalten muss.
2248cdf0e10cSrcweir |*
2249cdf0e10cSrcweir |*************************************************************************/
2250cdf0e10cSrcweir
MoveAllowed(const SwFrm * pFrm) const2251cdf0e10cSrcweir sal_Bool SwSectionFrm::MoveAllowed( const SwFrm* pFrm) const
2252cdf0e10cSrcweir {
2253cdf0e10cSrcweir // Gibt es einen Follow oder ist der Frame nicht in der letzten Spalte?
2254cdf0e10cSrcweir if( HasFollow() || ( pFrm->GetUpper()->IsColBodyFrm() &&
2255cdf0e10cSrcweir pFrm->GetUpper()->GetUpper()->GetNext() ) )
2256cdf0e10cSrcweir return sal_True;
2257cdf0e10cSrcweir if( pFrm->IsInFtn() )
2258cdf0e10cSrcweir {
2259cdf0e10cSrcweir if( IsInFtn() )
2260cdf0e10cSrcweir {
2261cdf0e10cSrcweir if( GetUpper()->IsInSct() )
2262cdf0e10cSrcweir {
2263cdf0e10cSrcweir if( Growable() )
2264cdf0e10cSrcweir return sal_False;
2265cdf0e10cSrcweir return GetUpper()->FindSctFrm()->MoveAllowed( this );
2266cdf0e10cSrcweir }
2267cdf0e10cSrcweir else
2268cdf0e10cSrcweir return sal_True;
2269cdf0e10cSrcweir }
2270cdf0e10cSrcweir // The content of footnote inside a columned sectionfrm is moveable
2271cdf0e10cSrcweir // except in the last column
2272cdf0e10cSrcweir const SwLayoutFrm *pLay = pFrm->FindFtnFrm()->GetUpper()->GetUpper();
2273cdf0e10cSrcweir if( pLay->IsColumnFrm() && pLay->GetNext() )
2274cdf0e10cSrcweir {
2275cdf0e10cSrcweir // The first paragraph in the first footnote in the first column
2276cdf0e10cSrcweir // in the sectionfrm at the top of the page is not moveable,
2277cdf0e10cSrcweir // if the columnbody is empty.
2278cdf0e10cSrcweir sal_Bool bRet = sal_False;
2279cdf0e10cSrcweir if( pLay->GetIndPrev() || pFrm->GetIndPrev() ||
2280cdf0e10cSrcweir pFrm->FindFtnFrm()->GetPrev() )
2281cdf0e10cSrcweir bRet = sal_True;
2282cdf0e10cSrcweir else
2283cdf0e10cSrcweir {
2284cdf0e10cSrcweir SwLayoutFrm* pBody = ((SwColumnFrm*)pLay)->FindBodyCont();
2285cdf0e10cSrcweir if( pBody && pBody->Lower() )
2286cdf0e10cSrcweir bRet = sal_True;
2287cdf0e10cSrcweir }
2288cdf0e10cSrcweir if( bRet && ( IsFtnAtEnd() || !Growable() ) )
2289cdf0e10cSrcweir return sal_True;
2290cdf0e10cSrcweir }
2291cdf0e10cSrcweir }
2292cdf0e10cSrcweir // Oder kann der Bereich noch wachsen?
2293cdf0e10cSrcweir if( !IsColLocked() && Growable() )
2294cdf0e10cSrcweir return sal_False;
2295cdf0e10cSrcweir // Jetzt muss untersucht werden, ob es ein Layoutblatt gibt, in dem
2296cdf0e10cSrcweir // ein Bereichsfollow erzeugt werden kann.
2297cdf0e10cSrcweir if( IsInTab() || ( !IsInDocBody() && FindFooterOrHeader() ) )
2298cdf0e10cSrcweir return sal_False; // In Tabellen/Kopf/Fusszeilen geht es nicht
2299cdf0e10cSrcweir if( IsInFly() ) // Bei spaltigen oder verketteten Rahmen
2300cdf0e10cSrcweir return 0 != ((SwFrm*)GetUpper())->GetNextLeaf( MAKEPAGE_NONE );
2301cdf0e10cSrcweir return sal_True;
2302cdf0e10cSrcweir }
2303cdf0e10cSrcweir
2304cdf0e10cSrcweir /** Called for a frame inside a section with no direct previous frame (or only
2305cdf0e10cSrcweir previous empty section frames) the previous frame of the outer section is
2306cdf0e10cSrcweir returned, if the frame is the first flowing content of this section.
2307cdf0e10cSrcweir
2308cdf0e10cSrcweir Note: For a frame inside a table frame, which is inside a section frame,
2309cdf0e10cSrcweir NULL is returned.
2310cdf0e10cSrcweir */
_GetIndPrev() const2311cdf0e10cSrcweir SwFrm* SwFrm::_GetIndPrev() const
2312cdf0e10cSrcweir {
2313cdf0e10cSrcweir SwFrm *pRet = NULL;
2314cdf0e10cSrcweir // --> OD 2007-09-04 #i79774#, #b659654#
2315cdf0e10cSrcweir // Do not assert, if the frame has a direct previous frame, because it
2316cdf0e10cSrcweir // could be an empty section frame. The caller has to assure, that the
2317cdf0e10cSrcweir // frame has no direct previous frame or only empty section frames as
2318cdf0e10cSrcweir // previous frames.
2319cdf0e10cSrcweir ASSERT( /*!pPrev &&*/ IsInSct(), "Why?" );
2320cdf0e10cSrcweir // <--
2321cdf0e10cSrcweir const SwFrm* pSct = GetUpper();
2322cdf0e10cSrcweir if( !pSct )
2323cdf0e10cSrcweir return NULL;
2324cdf0e10cSrcweir if( pSct->IsSctFrm() )
2325cdf0e10cSrcweir pRet = pSct->GetIndPrev();
2326cdf0e10cSrcweir else if( pSct->IsColBodyFrm() && (pSct = pSct->GetUpper()->GetUpper())->IsSctFrm() )
2327cdf0e10cSrcweir {
2328cdf0e10cSrcweir // Do not return the previous frame of the outer section, if in one
2329cdf0e10cSrcweir // of the previous columns is content.
2330cdf0e10cSrcweir const SwFrm* pCol = GetUpper()->GetUpper()->GetPrev();
2331cdf0e10cSrcweir while( pCol )
2332cdf0e10cSrcweir {
2333cdf0e10cSrcweir ASSERT( pCol->IsColumnFrm(), "GetIndPrev(): ColumnFrm expected" );
2334cdf0e10cSrcweir ASSERT( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(),
2335cdf0e10cSrcweir "GetIndPrev(): Where's the body?");
2336cdf0e10cSrcweir if( ((SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower())->Lower() )
2337cdf0e10cSrcweir return NULL;
2338cdf0e10cSrcweir pCol = pCol->GetPrev();
2339cdf0e10cSrcweir }
2340cdf0e10cSrcweir pRet = pSct->GetIndPrev();
2341cdf0e10cSrcweir }
2342cdf0e10cSrcweir
2343cdf0e10cSrcweir // skip empty section frames
2344cdf0e10cSrcweir while( pRet && pRet->IsSctFrm() && !((SwSectionFrm*)pRet)->GetSection() )
2345cdf0e10cSrcweir pRet = pRet->GetIndPrev();
2346cdf0e10cSrcweir return pRet;
2347cdf0e10cSrcweir }
2348cdf0e10cSrcweir
_GetIndNext()2349cdf0e10cSrcweir SwFrm* SwFrm::_GetIndNext()
2350cdf0e10cSrcweir {
2351cdf0e10cSrcweir ASSERT( !pNext && IsInSct(), "Why?" );
2352cdf0e10cSrcweir SwFrm* pSct = GetUpper();
2353cdf0e10cSrcweir if( !pSct )
2354cdf0e10cSrcweir return NULL;
2355cdf0e10cSrcweir if( pSct->IsSctFrm() )
2356cdf0e10cSrcweir return pSct->GetIndNext();
2357cdf0e10cSrcweir if( pSct->IsColBodyFrm() && (pSct = pSct->GetUpper()->GetUpper())->IsSctFrm() )
2358cdf0e10cSrcweir { // Wir duerfen nur den Nachfolger des SectionFrms zurueckliefern,
2359cdf0e10cSrcweir // wenn in keiner folgenden Spalte mehr Inhalt ist
2360cdf0e10cSrcweir SwFrm* pCol = GetUpper()->GetUpper()->GetNext();
2361cdf0e10cSrcweir while( pCol )
2362cdf0e10cSrcweir {
2363cdf0e10cSrcweir ASSERT( pCol->IsColumnFrm(), "GetIndNext(): ColumnFrm expected" );
2364cdf0e10cSrcweir ASSERT( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(),
2365cdf0e10cSrcweir "GetIndNext(): Where's the body?");
2366cdf0e10cSrcweir if( ((SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower())->Lower() )
2367cdf0e10cSrcweir return NULL;
2368cdf0e10cSrcweir pCol = pCol->GetNext();
2369cdf0e10cSrcweir }
2370cdf0e10cSrcweir return pSct->GetIndNext();
2371cdf0e10cSrcweir }
2372cdf0e10cSrcweir return NULL;
2373cdf0e10cSrcweir }
2374cdf0e10cSrcweir
IsDescendantFrom(const SwSectionFmt * pFmt) const2375cdf0e10cSrcweir sal_Bool SwSectionFrm::IsDescendantFrom( const SwSectionFmt* pFmt ) const
2376cdf0e10cSrcweir {
2377cdf0e10cSrcweir if( !pSection || !pFmt )
2378cdf0e10cSrcweir return sal_False;
2379cdf0e10cSrcweir const SwSectionFmt *pMyFmt = pSection->GetFmt();
2380cdf0e10cSrcweir while( pFmt != pMyFmt )
2381cdf0e10cSrcweir {
2382cdf0e10cSrcweir if( pMyFmt->GetRegisteredIn()->ISA( SwSectionFmt ) )
2383cdf0e10cSrcweir pMyFmt = (SwSectionFmt*)pMyFmt->GetRegisteredIn();
2384cdf0e10cSrcweir else
2385cdf0e10cSrcweir return sal_False;
2386cdf0e10cSrcweir }
2387cdf0e10cSrcweir return sal_True;
2388cdf0e10cSrcweir }
2389cdf0e10cSrcweir
CalcFtnAtEndFlag()2390cdf0e10cSrcweir void SwSectionFrm::CalcFtnAtEndFlag()
2391cdf0e10cSrcweir {
2392cdf0e10cSrcweir SwSectionFmt *pFmt = GetSection()->GetFmt();
2393cdf0e10cSrcweir sal_uInt16 nVal = pFmt->GetFtnAtTxtEnd( sal_False ).GetValue();
2394cdf0e10cSrcweir bFtnAtEnd = FTNEND_ATPGORDOCEND != nVal;
2395cdf0e10cSrcweir bOwnFtnNum = FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
2396cdf0e10cSrcweir FTNEND_ATTXTEND_OWNNUMANDFMT == nVal;
2397cdf0e10cSrcweir while( !bFtnAtEnd && !bOwnFtnNum )
2398cdf0e10cSrcweir {
2399cdf0e10cSrcweir if( pFmt->GetRegisteredIn()->ISA( SwSectionFmt ) )
2400cdf0e10cSrcweir pFmt = (SwSectionFmt*)pFmt->GetRegisteredIn();
2401cdf0e10cSrcweir else
2402cdf0e10cSrcweir break;
2403cdf0e10cSrcweir nVal = pFmt->GetFtnAtTxtEnd( sal_False ).GetValue();
2404cdf0e10cSrcweir if( FTNEND_ATPGORDOCEND != nVal )
2405cdf0e10cSrcweir {
2406cdf0e10cSrcweir bFtnAtEnd = sal_True;
2407cdf0e10cSrcweir bOwnFtnNum = bOwnFtnNum ||FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
2408cdf0e10cSrcweir FTNEND_ATTXTEND_OWNNUMANDFMT == nVal;
2409cdf0e10cSrcweir }
2410cdf0e10cSrcweir }
2411cdf0e10cSrcweir }
2412cdf0e10cSrcweir
IsEndnoteAtMyEnd() const2413cdf0e10cSrcweir sal_Bool SwSectionFrm::IsEndnoteAtMyEnd() const
2414cdf0e10cSrcweir {
2415cdf0e10cSrcweir return pSection->GetFmt()->GetEndAtTxtEnd( sal_False ).IsAtEnd();
2416cdf0e10cSrcweir }
2417cdf0e10cSrcweir
CalcEndAtEndFlag()2418cdf0e10cSrcweir void SwSectionFrm::CalcEndAtEndFlag()
2419cdf0e10cSrcweir {
2420cdf0e10cSrcweir SwSectionFmt *pFmt = GetSection()->GetFmt();
2421cdf0e10cSrcweir bEndnAtEnd = pFmt->GetEndAtTxtEnd( sal_False ).IsAtEnd();
2422cdf0e10cSrcweir while( !bEndnAtEnd )
2423cdf0e10cSrcweir {
2424cdf0e10cSrcweir if( pFmt->GetRegisteredIn()->ISA( SwSectionFmt ) )
2425cdf0e10cSrcweir pFmt = (SwSectionFmt*)pFmt->GetRegisteredIn();
2426cdf0e10cSrcweir else
2427cdf0e10cSrcweir break;
2428cdf0e10cSrcweir bEndnAtEnd = pFmt->GetEndAtTxtEnd( sal_False ).IsAtEnd();
2429cdf0e10cSrcweir }
2430cdf0e10cSrcweir }
2431cdf0e10cSrcweir
2432cdf0e10cSrcweir /*************************************************************************
2433cdf0e10cSrcweir |*
2434cdf0e10cSrcweir |* SwSectionFrm::Modify()
2435cdf0e10cSrcweir |*
2436cdf0e10cSrcweir |* Ersterstellung MA 08. Oct. 98
2437cdf0e10cSrcweir |* Letzte Aenderung MA 08. Oct. 98
2438cdf0e10cSrcweir |*
2439cdf0e10cSrcweir |*************************************************************************/
2440cdf0e10cSrcweir
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)2441cdf0e10cSrcweir void SwSectionFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
2442cdf0e10cSrcweir {
2443cdf0e10cSrcweir sal_uInt8 nInvFlags = 0;
2444cdf0e10cSrcweir
2445cdf0e10cSrcweir if( pNew && RES_ATTRSET_CHG == pNew->Which() )
2446cdf0e10cSrcweir {
2447cdf0e10cSrcweir SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
2448cdf0e10cSrcweir SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
2449cdf0e10cSrcweir SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
2450cdf0e10cSrcweir SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
2451cdf0e10cSrcweir while( sal_True )
2452cdf0e10cSrcweir {
2453cdf0e10cSrcweir _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
2454cdf0e10cSrcweir (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
2455cdf0e10cSrcweir &aOldSet, &aNewSet );
2456cdf0e10cSrcweir if( aNIter.IsAtEnd() )
2457cdf0e10cSrcweir break;
2458cdf0e10cSrcweir aNIter.NextItem();
2459cdf0e10cSrcweir aOIter.NextItem();
2460cdf0e10cSrcweir }
2461cdf0e10cSrcweir if ( aOldSet.Count() || aNewSet.Count() )
2462cdf0e10cSrcweir SwLayoutFrm::Modify( &aOldSet, &aNewSet );
2463cdf0e10cSrcweir }
2464cdf0e10cSrcweir else
2465cdf0e10cSrcweir _UpdateAttr( pOld, pNew, nInvFlags );
2466cdf0e10cSrcweir
2467cdf0e10cSrcweir if ( nInvFlags != 0 )
2468cdf0e10cSrcweir {
2469cdf0e10cSrcweir if ( nInvFlags & 0x01 )
2470cdf0e10cSrcweir InvalidateSize();
2471cdf0e10cSrcweir if ( nInvFlags & 0x10 )
2472cdf0e10cSrcweir SetCompletePaint();
2473cdf0e10cSrcweir }
2474cdf0e10cSrcweir }
2475cdf0e10cSrcweir
SwClientNotify(const SwModify & rMod,const SfxHint & rHint)2476cdf0e10cSrcweir void SwSectionFrm::SwClientNotify( const SwModify& rMod, const SfxHint& rHint )
2477cdf0e10cSrcweir {
2478713b4dcdSMichael Stahl // --> OD #i117863#
2479713b4dcdSMichael Stahl const SwSectionFrmMoveAndDeleteHint* pHint =
2480713b4dcdSMichael Stahl dynamic_cast<const SwSectionFrmMoveAndDeleteHint*>(&rHint);
2481713b4dcdSMichael Stahl if ( pHint && pHint->GetId() == SFX_HINT_DYING && &rMod == GetRegisteredIn() )
2482cdf0e10cSrcweir {
2483713b4dcdSMichael Stahl SwSectionFrm::MoveCntntAndDelete( this, pHint->IsSaveCntnt() );
2484cdf0e10cSrcweir }
2485713b4dcdSMichael Stahl // <--
2486cdf0e10cSrcweir }
2487cdf0e10cSrcweir
_UpdateAttr(const SfxPoolItem * pOld,const SfxPoolItem * pNew,sal_uInt8 & rInvFlags,SwAttrSetChg * pOldSet,SwAttrSetChg * pNewSet)2488cdf0e10cSrcweir void SwSectionFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
2489cdf0e10cSrcweir sal_uInt8 &rInvFlags,
2490cdf0e10cSrcweir SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
2491cdf0e10cSrcweir {
2492cdf0e10cSrcweir sal_Bool bClear = sal_True;
2493cdf0e10cSrcweir const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
2494cdf0e10cSrcweir switch( nWhich )
2495cdf0e10cSrcweir { // Mehrspaltigkeit in Fussnoten unterdruecken...
2496cdf0e10cSrcweir case RES_FMT_CHG:
2497cdf0e10cSrcweir {
2498cdf0e10cSrcweir const SwFmtCol& rNewCol = GetFmt()->GetCol();
2499cdf0e10cSrcweir if( !IsInFtn() )
2500cdf0e10cSrcweir {
2501cdf0e10cSrcweir //Dummer Fall. Bei der Zuweisung einer Vorlage k?nnen wir uns
2502cdf0e10cSrcweir //nicht auf das alte Spaltenattribut verlassen. Da diese
2503cdf0e10cSrcweir //wenigstens anzahlgemass fuer ChgColumns vorliegen muessen,
2504cdf0e10cSrcweir //bleibt uns nur einen temporaeres Attribut zu basteln.
2505cdf0e10cSrcweir SwFmtCol aCol;
2506cdf0e10cSrcweir if ( Lower() && Lower()->IsColumnFrm() )
2507cdf0e10cSrcweir {
2508cdf0e10cSrcweir sal_uInt16 nCol = 0;
2509cdf0e10cSrcweir SwFrm *pTmp = Lower();
2510cdf0e10cSrcweir do
2511cdf0e10cSrcweir { ++nCol;
2512cdf0e10cSrcweir pTmp = pTmp->GetNext();
2513cdf0e10cSrcweir } while ( pTmp );
2514cdf0e10cSrcweir aCol.Init( nCol, 0, 1000 );
2515cdf0e10cSrcweir }
2516cdf0e10cSrcweir sal_Bool bChgFtn = IsFtnAtEnd();
2517cdf0e10cSrcweir sal_Bool bChgEndn = IsEndnAtEnd();
2518cdf0e10cSrcweir sal_Bool bChgMyEndn = IsEndnoteAtMyEnd();
2519cdf0e10cSrcweir CalcFtnAtEndFlag();
2520cdf0e10cSrcweir CalcEndAtEndFlag();
2521cdf0e10cSrcweir bChgFtn = ( bChgFtn != IsFtnAtEnd() ) ||
2522cdf0e10cSrcweir ( bChgEndn != IsEndnAtEnd() ) ||
2523cdf0e10cSrcweir ( bChgMyEndn != IsEndnoteAtMyEnd() );
2524cdf0e10cSrcweir ChgColumns( aCol, rNewCol, bChgFtn );
2525cdf0e10cSrcweir rInvFlags |= 0x10;
2526cdf0e10cSrcweir }
2527cdf0e10cSrcweir rInvFlags |= 0x01;
2528cdf0e10cSrcweir bClear = sal_False;
2529cdf0e10cSrcweir }
2530cdf0e10cSrcweir break;
2531cdf0e10cSrcweir
2532cdf0e10cSrcweir case RES_COL:
2533cdf0e10cSrcweir if( !IsInFtn() )
2534cdf0e10cSrcweir {
2535cdf0e10cSrcweir ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
2536cdf0e10cSrcweir rInvFlags |= 0x11;
2537cdf0e10cSrcweir }
2538cdf0e10cSrcweir break;
2539cdf0e10cSrcweir
2540cdf0e10cSrcweir case RES_FTN_AT_TXTEND:
2541cdf0e10cSrcweir if( !IsInFtn() )
2542cdf0e10cSrcweir {
2543cdf0e10cSrcweir sal_Bool bOld = IsFtnAtEnd();
2544cdf0e10cSrcweir CalcFtnAtEndFlag();
2545cdf0e10cSrcweir if( bOld != IsFtnAtEnd() )
2546cdf0e10cSrcweir {
2547cdf0e10cSrcweir const SwFmtCol& rNewCol = GetFmt()->GetCol();
2548cdf0e10cSrcweir ChgColumns( rNewCol, rNewCol, sal_True );
2549cdf0e10cSrcweir rInvFlags |= 0x01;
2550cdf0e10cSrcweir }
2551cdf0e10cSrcweir }
2552cdf0e10cSrcweir break;
2553cdf0e10cSrcweir
2554cdf0e10cSrcweir case RES_END_AT_TXTEND:
2555cdf0e10cSrcweir if( !IsInFtn() )
2556cdf0e10cSrcweir {
2557cdf0e10cSrcweir sal_Bool bOld = IsEndnAtEnd();
2558cdf0e10cSrcweir sal_Bool bMyOld = IsEndnoteAtMyEnd();
2559cdf0e10cSrcweir CalcEndAtEndFlag();
2560cdf0e10cSrcweir if( bOld != IsEndnAtEnd() || bMyOld != IsEndnoteAtMyEnd())
2561cdf0e10cSrcweir {
2562cdf0e10cSrcweir const SwFmtCol& rNewCol = GetFmt()->GetCol();
2563cdf0e10cSrcweir ChgColumns( rNewCol, rNewCol, sal_True );
2564cdf0e10cSrcweir rInvFlags |= 0x01;
2565cdf0e10cSrcweir }
2566cdf0e10cSrcweir }
2567cdf0e10cSrcweir break;
2568cdf0e10cSrcweir case RES_COLUMNBALANCE:
2569cdf0e10cSrcweir rInvFlags |= 0x01;
2570cdf0e10cSrcweir break;
2571cdf0e10cSrcweir
2572cdf0e10cSrcweir case RES_FRAMEDIR :
2573cdf0e10cSrcweir SetDerivedR2L( sal_False );
2574cdf0e10cSrcweir CheckDirChange();
2575cdf0e10cSrcweir break;
2576cdf0e10cSrcweir
2577cdf0e10cSrcweir case RES_PROTECT:
2578cdf0e10cSrcweir {
2579cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
2580cdf0e10cSrcweir if( pSh && pSh->GetLayout()->IsAnyShellAccessible() )
2581cdf0e10cSrcweir pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this );
2582cdf0e10cSrcweir }
2583cdf0e10cSrcweir break;
2584cdf0e10cSrcweir
2585cdf0e10cSrcweir default:
2586cdf0e10cSrcweir bClear = sal_False;
2587cdf0e10cSrcweir }
2588cdf0e10cSrcweir if ( bClear )
2589cdf0e10cSrcweir {
2590cdf0e10cSrcweir if ( pOldSet || pNewSet )
2591cdf0e10cSrcweir {
2592cdf0e10cSrcweir if ( pOldSet )
2593cdf0e10cSrcweir pOldSet->ClearItem( nWhich );
2594cdf0e10cSrcweir if ( pNewSet )
2595cdf0e10cSrcweir pNewSet->ClearItem( nWhich );
2596cdf0e10cSrcweir }
2597cdf0e10cSrcweir else
2598cdf0e10cSrcweir SwLayoutFrm::Modify( pOld, pNew );
2599cdf0e10cSrcweir }
2600cdf0e10cSrcweir }
2601cdf0e10cSrcweir
2602cdf0e10cSrcweir /*-----------------09.06.99 14:58-------------------
2603cdf0e10cSrcweir * SwSectionFrm::ToMaximize(..): A follow or a ftncontainer at the end of the
2604cdf0e10cSrcweir * page causes a maximal Size of the sectionframe.
2605cdf0e10cSrcweir * --------------------------------------------------*/
2606cdf0e10cSrcweir
ToMaximize(sal_Bool bCheckFollow) const2607cdf0e10cSrcweir sal_Bool SwSectionFrm::ToMaximize( sal_Bool bCheckFollow ) const
2608cdf0e10cSrcweir {
2609cdf0e10cSrcweir if( HasFollow() )
2610cdf0e10cSrcweir {
2611cdf0e10cSrcweir if( !bCheckFollow ) // Don't check superfluous follows
2612cdf0e10cSrcweir return sal_True;
2613cdf0e10cSrcweir const SwSectionFrm* pFoll = GetFollow();
2614cdf0e10cSrcweir while( pFoll && pFoll->IsSuperfluous() )
2615cdf0e10cSrcweir pFoll = pFoll->GetFollow();
2616cdf0e10cSrcweir if( pFoll )
2617cdf0e10cSrcweir return sal_True;
2618cdf0e10cSrcweir }
2619cdf0e10cSrcweir if( IsFtnAtEnd() )
2620cdf0e10cSrcweir return sal_False;
2621cdf0e10cSrcweir const SwFtnContFrm* pCont = ContainsFtnCont();
2622cdf0e10cSrcweir if( !IsEndnAtEnd() )
2623cdf0e10cSrcweir return 0 != pCont;
2624cdf0e10cSrcweir sal_Bool bRet = sal_False;
2625cdf0e10cSrcweir while( pCont && !bRet )
2626cdf0e10cSrcweir {
2627cdf0e10cSrcweir if( pCont->FindFootNote() )
2628cdf0e10cSrcweir bRet = sal_True;
2629cdf0e10cSrcweir else
2630cdf0e10cSrcweir pCont = ContainsFtnCont( pCont );
2631cdf0e10cSrcweir }
2632cdf0e10cSrcweir return bRet;
2633cdf0e10cSrcweir }
2634cdf0e10cSrcweir
2635cdf0e10cSrcweir /*-----------------09.06.99 15:07-------------------
2636cdf0e10cSrcweir * sal_Bool SwSectionFrm::ContainsFtnCont()
2637cdf0e10cSrcweir * checks every Column for FtnContFrms.
2638cdf0e10cSrcweir * --------------------------------------------------*/
2639cdf0e10cSrcweir
ContainsFtnCont(const SwFtnContFrm * pCont) const2640cdf0e10cSrcweir SwFtnContFrm* SwSectionFrm::ContainsFtnCont( const SwFtnContFrm* pCont ) const
2641cdf0e10cSrcweir {
2642cdf0e10cSrcweir SwFtnContFrm* pRet = NULL;
2643cdf0e10cSrcweir const SwLayoutFrm* pLay;
2644cdf0e10cSrcweir if( pCont )
2645cdf0e10cSrcweir {
2646cdf0e10cSrcweir pLay = pCont->FindFtnBossFrm( 0 );
2647cdf0e10cSrcweir ASSERT( IsAnLower( pLay ), "ConatainsFtnCont: Wrong FtnContainer" );
2648cdf0e10cSrcweir pLay = (SwLayoutFrm*)pLay->GetNext();
2649cdf0e10cSrcweir }
2650cdf0e10cSrcweir else if( Lower() && Lower()->IsColumnFrm() )
2651cdf0e10cSrcweir pLay = (SwLayoutFrm*)Lower();
2652cdf0e10cSrcweir else
2653cdf0e10cSrcweir pLay = NULL;
2654cdf0e10cSrcweir while ( !pRet && pLay )
2655cdf0e10cSrcweir {
2656cdf0e10cSrcweir if( pLay->Lower() && pLay->Lower()->GetNext() )
2657cdf0e10cSrcweir {
2658cdf0e10cSrcweir ASSERT( pLay->Lower()->GetNext()->IsFtnContFrm(),
2659cdf0e10cSrcweir "ToMaximize: Unexspected Frame" );
2660cdf0e10cSrcweir pRet = (SwFtnContFrm*)pLay->Lower()->GetNext();
2661cdf0e10cSrcweir }
2662cdf0e10cSrcweir ASSERT( !pLay->GetNext() || pLay->GetNext()->IsLayoutFrm(),
2663cdf0e10cSrcweir "ToMaximize: ColFrm exspected" );
2664cdf0e10cSrcweir pLay = (SwLayoutFrm*)pLay->GetNext();
2665cdf0e10cSrcweir }
2666cdf0e10cSrcweir return pRet;
2667cdf0e10cSrcweir }
2668cdf0e10cSrcweir
InvalidateFtnPos()2669cdf0e10cSrcweir void SwSectionFrm::InvalidateFtnPos()
2670cdf0e10cSrcweir {
2671cdf0e10cSrcweir SwFtnContFrm* pCont = ContainsFtnCont( NULL );
2672cdf0e10cSrcweir if( pCont )
2673cdf0e10cSrcweir {
2674cdf0e10cSrcweir SwFrm *pTmp = pCont->ContainsCntnt();
2675cdf0e10cSrcweir if( pTmp )
2676cdf0e10cSrcweir pTmp->_InvalidatePos();
2677cdf0e10cSrcweir }
2678cdf0e10cSrcweir }
2679cdf0e10cSrcweir
2680cdf0e10cSrcweir /*-----------------18.03.99 10:37-------------------
2681cdf0e10cSrcweir * SwSectionFrm::Undersize() liefert den Betrag, um den der Bereich gern
2682cdf0e10cSrcweir * groesser waere, wenn in ihm Undersized TxtFrms liegen, ansonsten Null.
2683cdf0e10cSrcweir * Das Undersized-Flag wird ggf. korrigiert.
2684cdf0e10cSrcweir * --------------------------------------------------*/
2685cdf0e10cSrcweir
Undersize(sal_Bool bOverSize)2686cdf0e10cSrcweir long SwSectionFrm::Undersize( sal_Bool bOverSize )
2687cdf0e10cSrcweir {
2688cdf0e10cSrcweir bUndersized = sal_False;
2689cdf0e10cSrcweir SWRECTFN( this )
2690cdf0e10cSrcweir long nRet = InnerHeight() - (Prt().*fnRect->fnGetHeight)();
2691cdf0e10cSrcweir if( nRet > 0 )
2692cdf0e10cSrcweir bUndersized = sal_True;
2693cdf0e10cSrcweir else if( !bOverSize )
2694cdf0e10cSrcweir nRet = 0;
2695cdf0e10cSrcweir return nRet;
2696cdf0e10cSrcweir }
2697cdf0e10cSrcweir
2698cdf0e10cSrcweir /// OD 01.04.2003 #108446# - determine next frame for footnote/endnote formatting
2699cdf0e10cSrcweir /// before format of current one, because current one can move backward.
2700cdf0e10cSrcweir /// After moving backward to a previous page method <FindNext()> will return
2701cdf0e10cSrcweir /// the text frame presenting the first page footnote, if it exists. Thus, the
2702cdf0e10cSrcweir /// rest of the footnote/endnote container would not be formatted.
CalcFtnCntnt()2703cdf0e10cSrcweir void SwSectionFrm::CalcFtnCntnt()
2704cdf0e10cSrcweir {
2705cdf0e10cSrcweir SwFtnContFrm* pCont = ContainsFtnCont();
2706cdf0e10cSrcweir if( pCont )
2707cdf0e10cSrcweir {
2708cdf0e10cSrcweir SwFrm* pFrm = pCont->ContainsAny();
2709cdf0e10cSrcweir if( pFrm )
2710cdf0e10cSrcweir pCont->Calc();
2711cdf0e10cSrcweir while( pFrm && IsAnLower( pFrm ) )
2712cdf0e10cSrcweir {
2713cdf0e10cSrcweir SwFtnFrm* pFtn = pFrm->FindFtnFrm();
2714cdf0e10cSrcweir if( pFtn )
2715cdf0e10cSrcweir pFtn->Calc();
2716cdf0e10cSrcweir // OD 01.04.2003 #108446# - determine next frame before format current frame.
2717cdf0e10cSrcweir SwFrm* pNextFrm = 0;
2718cdf0e10cSrcweir {
2719cdf0e10cSrcweir if( pFrm->IsSctFrm() )
2720cdf0e10cSrcweir {
2721cdf0e10cSrcweir pNextFrm = static_cast<SwSectionFrm*>(pFrm)->ContainsAny();
2722cdf0e10cSrcweir }
2723cdf0e10cSrcweir if( !pNextFrm )
2724cdf0e10cSrcweir {
2725cdf0e10cSrcweir pNextFrm = pFrm->FindNext();
2726cdf0e10cSrcweir }
2727cdf0e10cSrcweir }
2728cdf0e10cSrcweir pFrm->Calc();
2729cdf0e10cSrcweir pFrm = pNextFrm;
2730cdf0e10cSrcweir }
2731cdf0e10cSrcweir }
2732cdf0e10cSrcweir }
2733cdf0e10cSrcweir
2734cdf0e10cSrcweir /* -----------------09.02.99 14:26-------------------
2735cdf0e10cSrcweir * Wenn ein SectionFrm leerlaeuft, z.B. weil sein Inhalt die Seite/Spalte wechselt,
2736cdf0e10cSrcweir * so wird er nicht sofort zerstoert (es koennte noch jemand auf dem Stack einen Pointer
2737cdf0e10cSrcweir * auf ihn halten), sondern er traegt sich in eine Liste am RootFrm ein, die spaeter
2738cdf0e10cSrcweir * abgearbeitet wird (in LayAction::Action u.a.). Seine Groesse wird auf Null gesetzt und
2739cdf0e10cSrcweir * sein Zeiger auf seine Section ebenfalls. Solche zum Loeschen vorgesehene SectionFrms
2740cdf0e10cSrcweir * muessen vom Layout/beim Formatieren ignoriert werden.
2741cdf0e10cSrcweir *
2742cdf0e10cSrcweir * Mit InsertEmptySct nimmt der RootFrm einen SectionFrm in die Liste auf,
2743cdf0e10cSrcweir * mit RemoveFromList kann ein SectionFrm wieder aus der Liste entfernt werden (Dtor),
2744cdf0e10cSrcweir * mit DeleteEmptySct wird die Liste abgearbeitet und die SectionFrms zerstoert
2745cdf0e10cSrcweir * --------------------------------------------------*/
2746cdf0e10cSrcweir
InsertEmptySct(SwSectionFrm * pDel)2747cdf0e10cSrcweir void SwRootFrm::InsertEmptySct( SwSectionFrm* pDel )
2748cdf0e10cSrcweir {
2749cdf0e10cSrcweir if( !pDestroy )
2750cdf0e10cSrcweir pDestroy = new SwDestroyList;
2751cdf0e10cSrcweir sal_uInt16 nPos;
2752cdf0e10cSrcweir if( !pDestroy->Seek_Entry( pDel, &nPos ) )
2753cdf0e10cSrcweir pDestroy->Insert( pDel );
2754cdf0e10cSrcweir }
2755cdf0e10cSrcweir
_DeleteEmptySct()2756cdf0e10cSrcweir void SwRootFrm::_DeleteEmptySct()
2757cdf0e10cSrcweir {
2758cdf0e10cSrcweir ASSERT( pDestroy, "Keine Liste, keine Kekse" );
2759cdf0e10cSrcweir while( pDestroy->Count() )
2760cdf0e10cSrcweir {
2761cdf0e10cSrcweir SwSectionFrm* pSect = (*pDestroy)[0];
2762cdf0e10cSrcweir pDestroy->Remove( sal_uInt16(0) );
2763cdf0e10cSrcweir ASSERT( !pSect->IsColLocked() && !pSect->IsJoinLocked(),
2764cdf0e10cSrcweir "DeleteEmptySct: Locked SectionFrm" );
2765cdf0e10cSrcweir if( !pSect->Frm().HasArea() && !pSect->ContainsCntnt() )
2766cdf0e10cSrcweir {
2767cdf0e10cSrcweir SwLayoutFrm* pUp = pSect->GetUpper();
2768cdf0e10cSrcweir pSect->Remove();
2769cdf0e10cSrcweir delete pSect;
2770cdf0e10cSrcweir if( pUp && !pUp->Lower() )
2771cdf0e10cSrcweir {
2772cdf0e10cSrcweir if( pUp->IsPageBodyFrm() )
2773cdf0e10cSrcweir pUp->getRootFrm()->SetSuperfluous();
2774cdf0e10cSrcweir else if( pUp->IsFtnFrm() && !pUp->IsColLocked() &&
2775cdf0e10cSrcweir pUp->GetUpper() )
2776cdf0e10cSrcweir {
2777cdf0e10cSrcweir pUp->Cut();
2778cdf0e10cSrcweir delete pUp;
2779cdf0e10cSrcweir }
2780cdf0e10cSrcweir }
2781cdf0e10cSrcweir }
2782cdf0e10cSrcweir else {
2783cdf0e10cSrcweir ASSERT( pSect->GetSection(), "DeleteEmptySct: Halbtoter SectionFrm?!" );
2784cdf0e10cSrcweir }
2785cdf0e10cSrcweir }
2786cdf0e10cSrcweir }
2787cdf0e10cSrcweir
_RemoveFromList(SwSectionFrm * pSct)2788cdf0e10cSrcweir void SwRootFrm::_RemoveFromList( SwSectionFrm* pSct )
2789cdf0e10cSrcweir {
2790cdf0e10cSrcweir ASSERT( pDestroy, "Where's my list?" );
2791cdf0e10cSrcweir sal_uInt16 nPos;
2792cdf0e10cSrcweir if( pDestroy->Seek_Entry( pSct, &nPos ) )
2793cdf0e10cSrcweir pDestroy->Remove( nPos );
2794cdf0e10cSrcweir }
2795cdf0e10cSrcweir
2796cdf0e10cSrcweir #ifdef DBG_UTIL
2797cdf0e10cSrcweir
IsInDelList(SwSectionFrm * pSct) const2798cdf0e10cSrcweir sal_Bool SwRootFrm::IsInDelList( SwSectionFrm* pSct ) const
2799cdf0e10cSrcweir {
2800cdf0e10cSrcweir sal_uInt16 nPos;
2801cdf0e10cSrcweir return ( pDestroy && pDestroy->Seek_Entry( pSct, &nPos ) );
2802cdf0e10cSrcweir }
2803cdf0e10cSrcweir
2804cdf0e10cSrcweir #endif
2805cdf0e10cSrcweir
IsBalancedSection() const2806cdf0e10cSrcweir bool SwSectionFrm::IsBalancedSection() const
2807cdf0e10cSrcweir {
2808cdf0e10cSrcweir bool bRet = false;
2809cdf0e10cSrcweir if ( GetSection() && Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() )
2810cdf0e10cSrcweir {
2811cdf0e10cSrcweir bRet = !GetSection()->GetFmt()->GetBalancedColumns().GetValue();
2812cdf0e10cSrcweir }
2813cdf0e10cSrcweir return bRet;
2814cdf0e10cSrcweir }
2815cdf0e10cSrcweir
2816