1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include <hintids.hxx>
29cdf0e10cSrcweir #include <hints.hxx>
30cdf0e10cSrcweir #include <tools/pstm.hxx>
31cdf0e10cSrcweir #include <vcl/outdev.hxx>
32cdf0e10cSrcweir #include <svl/itemiter.hxx>
33cdf0e10cSrcweir #include <editeng/brshitem.hxx>
34cdf0e10cSrcweir #include <editeng/keepitem.hxx>
35cdf0e10cSrcweir #include <editeng/brkitem.hxx>
36cdf0e10cSrcweir #include <fmtornt.hxx>
37cdf0e10cSrcweir #include <pagefrm.hxx>
38cdf0e10cSrcweir #include <section.hxx>
39cdf0e10cSrcweir #include <rootfrm.hxx>
40cdf0e10cSrcweir #include <cntfrm.hxx>
41cdf0e10cSrcweir #include <dcontact.hxx>
42cdf0e10cSrcweir #include <anchoreddrawobject.hxx>
43cdf0e10cSrcweir #include <fmtanchr.hxx>
44cdf0e10cSrcweir #include <viewsh.hxx>
45cdf0e10cSrcweir #include <viewimp.hxx>
46cdf0e10cSrcweir #include "viewopt.hxx"
47cdf0e10cSrcweir #include <doc.hxx>
48cdf0e10cSrcweir #include <fesh.hxx>
49cdf0e10cSrcweir #include <docsh.hxx>
50cdf0e10cSrcweir #include <flyfrm.hxx>
51cdf0e10cSrcweir #include <frmtool.hxx>
52cdf0e10cSrcweir #include <ftninfo.hxx>
53cdf0e10cSrcweir #include <dflyobj.hxx>
54cdf0e10cSrcweir #include <fmtclbl.hxx>
55cdf0e10cSrcweir #include <fmtfordr.hxx>
56cdf0e10cSrcweir #include <fmtfsize.hxx>
57cdf0e10cSrcweir #include <fmtpdsc.hxx>
58cdf0e10cSrcweir #include <txtftn.hxx>
59cdf0e10cSrcweir #include <fmtftn.hxx>
60cdf0e10cSrcweir #include <fmtsrnd.hxx>
61cdf0e10cSrcweir #include <ftnfrm.hxx>
62cdf0e10cSrcweir #include <tabfrm.hxx>
63cdf0e10cSrcweir #include <htmltbl.hxx>
64cdf0e10cSrcweir #include <flyfrms.hxx>
65cdf0e10cSrcweir #include <sectfrm.hxx>
66cdf0e10cSrcweir #include <fmtclds.hxx>
67cdf0e10cSrcweir #include <txtfrm.hxx>
68cdf0e10cSrcweir #include <ndtxt.hxx>
69cdf0e10cSrcweir #include <bodyfrm.hxx>
70cdf0e10cSrcweir #include <cellfrm.hxx>
71cdf0e10cSrcweir #include <dbg_lay.hxx>
72cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
73cdf0e10cSrcweir // OD 2004-05-24 #i28701#
74cdf0e10cSrcweir #include <sortedobjs.hxx>
75cdf0e10cSrcweir
76cdf0e10cSrcweir
77cdf0e10cSrcweir using namespace ::com::sun::star;
78cdf0e10cSrcweir
79cdf0e10cSrcweir
80cdf0e10cSrcweir /*************************************************************************
81cdf0e10cSrcweir |*
82cdf0e10cSrcweir |* SwFrm::SwFrm()
83cdf0e10cSrcweir |*
84cdf0e10cSrcweir |* Ersterstellung AK 12-Feb-1991
85cdf0e10cSrcweir |* Letzte Aenderung MA 05. Apr. 94
86cdf0e10cSrcweir |*
87cdf0e10cSrcweir |*************************************************************************/
88cdf0e10cSrcweir
SwFrm(SwModify * pMod,SwFrm * pSib)89cdf0e10cSrcweir SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) :
90cdf0e10cSrcweir SwClient( pMod ),
91*f686a0e7SPavel Janík //Solution:Add a member to identify if the acc table should dispose
92*f686a0e7SPavel Janík bIfAccTableShouldDisposing( sal_False ),
93cdf0e10cSrcweir // --> OD 2006-05-10 #i65250#
94cdf0e10cSrcweir mnFrmId( SwFrm::mnLastFrmId++ ),
95cdf0e10cSrcweir // <--
96cdf0e10cSrcweir mpRoot( pSib ? pSib->getRootFrm() : 0 ),
97cdf0e10cSrcweir pUpper( 0 ),
98cdf0e10cSrcweir pNext( 0 ),
99cdf0e10cSrcweir pPrev( 0 ),
100cdf0e10cSrcweir pDrawObjs( 0 )
101cdf0e10cSrcweir , bInfBody( sal_False )
102cdf0e10cSrcweir , bInfTab ( sal_False )
103cdf0e10cSrcweir , bInfFly ( sal_False )
104cdf0e10cSrcweir , bInfFtn ( sal_False )
105cdf0e10cSrcweir , bInfSct ( sal_False )
106cdf0e10cSrcweir {
107cdf0e10cSrcweir #ifdef DBG_UTIL
108cdf0e10cSrcweir bFlag01 = bFlag02 = bFlag03 = bFlag04 = bFlag05 = 0;
109cdf0e10cSrcweir #endif
110cdf0e10cSrcweir
111cdf0e10cSrcweir ASSERT( pMod, "Kein Frameformat uebergeben." );
112cdf0e10cSrcweir bInvalidR2L = bInvalidVert = 1;
113cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
114cdf0e10cSrcweir bDerivedR2L = bDerivedVert = bRightToLeft = bVertical = bReverse = bVertLR = 0;
115cdf0e10cSrcweir
116cdf0e10cSrcweir bValidPos = bValidPrtArea = bValidSize = bValidLineNum = bRetouche =
117cdf0e10cSrcweir bFixSize = bColLocked = sal_False;
118cdf0e10cSrcweir bCompletePaint = bInfInvalid = sal_True;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
KnowsFormat(const SwFmt & rFmt) const121cdf0e10cSrcweir bool SwFrm::KnowsFormat( const SwFmt& rFmt ) const
122cdf0e10cSrcweir {
123cdf0e10cSrcweir return GetRegisteredIn() == &rFmt;
124cdf0e10cSrcweir }
125cdf0e10cSrcweir
RegisterToFormat(SwFmt & rFmt)126cdf0e10cSrcweir void SwFrm::RegisterToFormat( SwFmt& rFmt )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir rFmt.Add( this );
129cdf0e10cSrcweir }
130cdf0e10cSrcweir
CheckDir(sal_uInt16 nDir,sal_Bool bVert,sal_Bool bOnlyBiDi,sal_Bool bBrowse)131cdf0e10cSrcweir void SwFrm::CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir if( FRMDIR_ENVIRONMENT == nDir || ( bVert && bOnlyBiDi ) )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir bDerivedVert = 1;
136cdf0e10cSrcweir if( FRMDIR_ENVIRONMENT == nDir )
137cdf0e10cSrcweir bDerivedR2L = 1;
138cdf0e10cSrcweir SetDirFlags( bVert );
139cdf0e10cSrcweir }
140cdf0e10cSrcweir else if( bVert )
141cdf0e10cSrcweir {
142cdf0e10cSrcweir bInvalidVert = 0;
143cdf0e10cSrcweir if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir
144cdf0e10cSrcweir || bBrowse )
145cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
146cdf0e10cSrcweir {
147cdf0e10cSrcweir bVertical = 0;
148cdf0e10cSrcweir bVertLR = 0;
149cdf0e10cSrcweir }
150cdf0e10cSrcweir else
151cdf0e10cSrcweir {
152cdf0e10cSrcweir bVertical = 1;
153cdf0e10cSrcweir if(FRMDIR_VERT_TOP_RIGHT == nDir)
154cdf0e10cSrcweir bVertLR = 0;
155cdf0e10cSrcweir else if(FRMDIR_VERT_TOP_LEFT==nDir)
156cdf0e10cSrcweir bVertLR = 1;
157cdf0e10cSrcweir }
158cdf0e10cSrcweir }
159cdf0e10cSrcweir else
160cdf0e10cSrcweir {
161cdf0e10cSrcweir bInvalidR2L = 0;
162cdf0e10cSrcweir if( FRMDIR_HORI_RIGHT_TOP == nDir )
163cdf0e10cSrcweir bRightToLeft = 1;
164cdf0e10cSrcweir else
165cdf0e10cSrcweir bRightToLeft = 0;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir }
168cdf0e10cSrcweir
CheckDirection(sal_Bool bVert)169cdf0e10cSrcweir void SwFrm::CheckDirection( sal_Bool bVert )
170cdf0e10cSrcweir {
171cdf0e10cSrcweir if( bVert )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir if( !IsHeaderFrm() && !IsFooterFrm() )
174cdf0e10cSrcweir {
175cdf0e10cSrcweir bDerivedVert = 1;
176cdf0e10cSrcweir SetDirFlags( bVert );
177cdf0e10cSrcweir }
178cdf0e10cSrcweir }
179cdf0e10cSrcweir else
180cdf0e10cSrcweir {
181cdf0e10cSrcweir bDerivedR2L = 1;
182cdf0e10cSrcweir SetDirFlags( bVert );
183cdf0e10cSrcweir }
184cdf0e10cSrcweir }
185cdf0e10cSrcweir
CheckDirection(sal_Bool bVert)186cdf0e10cSrcweir void SwSectionFrm::CheckDirection( sal_Bool bVert )
187cdf0e10cSrcweir {
188cdf0e10cSrcweir const SwFrmFmt* pFmt = GetFmt();
189cdf0e10cSrcweir if( pFmt )
190cdf0e10cSrcweir {
191cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
192cdf0e10cSrcweir const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
193cdf0e10cSrcweir CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(),
194cdf0e10cSrcweir bVert, sal_True, bBrowseMode );
195cdf0e10cSrcweir }
196cdf0e10cSrcweir else
197cdf0e10cSrcweir SwFrm::CheckDirection( bVert );
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
CheckDirection(sal_Bool bVert)200cdf0e10cSrcweir void SwFlyFrm::CheckDirection( sal_Bool bVert )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir const SwFrmFmt* pFmt = GetFmt();
203cdf0e10cSrcweir if( pFmt )
204cdf0e10cSrcweir {
205cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
206cdf0e10cSrcweir const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
207cdf0e10cSrcweir CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(),
208cdf0e10cSrcweir bVert, sal_False, bBrowseMode );
209cdf0e10cSrcweir }
210cdf0e10cSrcweir else
211cdf0e10cSrcweir SwFrm::CheckDirection( bVert );
212cdf0e10cSrcweir }
213cdf0e10cSrcweir
CheckDirection(sal_Bool bVert)214cdf0e10cSrcweir void SwTabFrm::CheckDirection( sal_Bool bVert )
215cdf0e10cSrcweir {
216cdf0e10cSrcweir const SwFrmFmt* pFmt = GetFmt();
217cdf0e10cSrcweir if( pFmt )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
220cdf0e10cSrcweir const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
221cdf0e10cSrcweir CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(),
222cdf0e10cSrcweir bVert, sal_True, bBrowseMode );
223cdf0e10cSrcweir }
224cdf0e10cSrcweir else
225cdf0e10cSrcweir SwFrm::CheckDirection( bVert );
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
CheckDirection(sal_Bool bVert)228cdf0e10cSrcweir void SwCellFrm::CheckDirection( sal_Bool bVert )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir const SwFrmFmt* pFmt = GetFmt();
231cdf0e10cSrcweir const SfxPoolItem* pItem;
232cdf0e10cSrcweir // --> FME 2006-03-30 #b6402837# Check if the item is set, before actually
233cdf0e10cSrcweir // using it. Otherwise the dynamic pool default is used, which may be set
234cdf0e10cSrcweir // to LTR in case of OOo 1.0 documents.
235cdf0e10cSrcweir // <--
236cdf0e10cSrcweir if( pFmt && SFX_ITEM_SET == pFmt->GetItemState( RES_FRAMEDIR, sal_True, &pItem ) )
237cdf0e10cSrcweir {
238cdf0e10cSrcweir const SvxFrameDirectionItem* pFrmDirItem = static_cast<const SvxFrameDirectionItem*>(pItem);
239cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
240cdf0e10cSrcweir const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
241cdf0e10cSrcweir CheckDir( pFrmDirItem->GetValue(), bVert, sal_False, bBrowseMode );
242cdf0e10cSrcweir }
243cdf0e10cSrcweir else
244cdf0e10cSrcweir SwFrm::CheckDirection( bVert );
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
CheckDirection(sal_Bool bVert)247cdf0e10cSrcweir void SwTxtFrm::CheckDirection( sal_Bool bVert )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
250cdf0e10cSrcweir const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
251cdf0e10cSrcweir CheckDir( GetTxtNode()->GetSwAttrSet().GetFrmDir().GetValue(), bVert,
252cdf0e10cSrcweir sal_True, bBrowseMode );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir
255cdf0e10cSrcweir /*************************************************************************/
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)256cdf0e10cSrcweir void SwFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
257cdf0e10cSrcweir {
258cdf0e10cSrcweir sal_uInt8 nInvFlags = 0;
259cdf0e10cSrcweir
260cdf0e10cSrcweir if( pNew && RES_ATTRSET_CHG == pNew->Which() )
261cdf0e10cSrcweir {
262cdf0e10cSrcweir SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
263cdf0e10cSrcweir SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
264cdf0e10cSrcweir while( sal_True )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir _UpdateAttrFrm( (SfxPoolItem*)aOIter.GetCurItem(),
267cdf0e10cSrcweir (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags );
268cdf0e10cSrcweir if( aNIter.IsAtEnd() )
269cdf0e10cSrcweir break;
270cdf0e10cSrcweir aNIter.NextItem();
271cdf0e10cSrcweir aOIter.NextItem();
272cdf0e10cSrcweir }
273cdf0e10cSrcweir }
274cdf0e10cSrcweir else
275cdf0e10cSrcweir _UpdateAttrFrm( pOld, pNew, nInvFlags );
276cdf0e10cSrcweir
277cdf0e10cSrcweir if ( nInvFlags != 0 )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
280cdf0e10cSrcweir InvalidatePage( pPage );
281cdf0e10cSrcweir if ( nInvFlags & 0x01 )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir _InvalidatePrt();
284cdf0e10cSrcweir if( !GetPrev() && IsTabFrm() && IsInSct() )
285cdf0e10cSrcweir FindSctFrm()->_InvalidatePrt();
286cdf0e10cSrcweir }
287cdf0e10cSrcweir if ( nInvFlags & 0x02 )
288cdf0e10cSrcweir _InvalidateSize();
289cdf0e10cSrcweir if ( nInvFlags & 0x04 )
290cdf0e10cSrcweir _InvalidatePos();
291cdf0e10cSrcweir if ( nInvFlags & 0x08 )
292cdf0e10cSrcweir SetCompletePaint();
293cdf0e10cSrcweir SwFrm *pNxt;
294cdf0e10cSrcweir if ( nInvFlags & 0x30 && 0 != (pNxt = GetNext()) )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir pNxt->InvalidatePage( pPage );
297cdf0e10cSrcweir if ( nInvFlags & 0x10 )
298cdf0e10cSrcweir pNxt->_InvalidatePos();
299cdf0e10cSrcweir if ( nInvFlags & 0x20 )
300cdf0e10cSrcweir pNxt->SetCompletePaint();
301cdf0e10cSrcweir }
302cdf0e10cSrcweir }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir
_UpdateAttrFrm(const SfxPoolItem * pOld,const SfxPoolItem * pNew,sal_uInt8 & rInvFlags)305cdf0e10cSrcweir void SwFrm::_UpdateAttrFrm( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
306cdf0e10cSrcweir sal_uInt8 &rInvFlags )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
309cdf0e10cSrcweir switch( nWhich )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir case RES_BOX:
312cdf0e10cSrcweir case RES_SHADOW:
313cdf0e10cSrcweir Prepare( PREP_FIXSIZE_CHG );
314cdf0e10cSrcweir // hier kein break !
315cdf0e10cSrcweir case RES_LR_SPACE:
316cdf0e10cSrcweir case RES_UL_SPACE:
317cdf0e10cSrcweir rInvFlags |= 0x0B;
318cdf0e10cSrcweir break;
319cdf0e10cSrcweir
320cdf0e10cSrcweir case RES_HEADER_FOOTER_EAT_SPACING:
321cdf0e10cSrcweir rInvFlags |= 0x03;
322cdf0e10cSrcweir break;
323cdf0e10cSrcweir
324cdf0e10cSrcweir case RES_BACKGROUND:
325cdf0e10cSrcweir rInvFlags |= 0x28;
326cdf0e10cSrcweir break;
327cdf0e10cSrcweir
328cdf0e10cSrcweir case RES_KEEP:
329cdf0e10cSrcweir rInvFlags |= 0x04;
330cdf0e10cSrcweir break;
331cdf0e10cSrcweir
332cdf0e10cSrcweir case RES_FRM_SIZE:
333cdf0e10cSrcweir ReinitializeFrmSizeAttrFlags();
334cdf0e10cSrcweir rInvFlags |= 0x13;
335cdf0e10cSrcweir break;
336cdf0e10cSrcweir
337cdf0e10cSrcweir case RES_FMT_CHG:
338cdf0e10cSrcweir rInvFlags |= 0x0F;
339cdf0e10cSrcweir break;
340cdf0e10cSrcweir
341cdf0e10cSrcweir case RES_ROW_SPLIT:
342cdf0e10cSrcweir {
343cdf0e10cSrcweir if ( IsRowFrm() )
344cdf0e10cSrcweir {
345cdf0e10cSrcweir sal_Bool bInFollowFlowRow = 0 != IsInFollowFlowRow();
346cdf0e10cSrcweir if ( bInFollowFlowRow || 0 != IsInSplitTableRow() )
347cdf0e10cSrcweir {
348cdf0e10cSrcweir SwTabFrm* pTab = FindTabFrm();
349cdf0e10cSrcweir if ( bInFollowFlowRow )
350cdf0e10cSrcweir pTab = pTab->FindMaster();
351cdf0e10cSrcweir pTab->SetRemoveFollowFlowLinePending( sal_True );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir }
354cdf0e10cSrcweir break;
355cdf0e10cSrcweir }
356cdf0e10cSrcweir case RES_COL:
357cdf0e10cSrcweir ASSERT( sal_False, "Spalten fuer neuen FrmTyp?" );
358cdf0e10cSrcweir break;
359cdf0e10cSrcweir
360cdf0e10cSrcweir default:
361cdf0e10cSrcweir /* do Nothing */;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir /*************************************************************************
366cdf0e10cSrcweir |*
367cdf0e10cSrcweir |* SwFrm::Prepare()
368cdf0e10cSrcweir |* Ersterstellung MA 13. Apr. 93
369cdf0e10cSrcweir |* Letzte Aenderung MA 26. Jun. 96
370cdf0e10cSrcweir |*
371cdf0e10cSrcweir |*************************************************************************/
Prepare(const PrepareHint,const void *,sal_Bool)372cdf0e10cSrcweir void SwFrm::Prepare( const PrepareHint, const void *, sal_Bool )
373cdf0e10cSrcweir {
374cdf0e10cSrcweir /* Do nothing */
375cdf0e10cSrcweir }
376cdf0e10cSrcweir
377cdf0e10cSrcweir /*************************************************************************
378cdf0e10cSrcweir |*
379cdf0e10cSrcweir |* SwFrm::InvalidatePage()
380cdf0e10cSrcweir |* Beschreibung: Invalidiert die Seite, in der der Frm gerade steht.
381cdf0e10cSrcweir |* Je nachdem ob es ein Layout, Cntnt oder FlyFrm ist wird die Seite
382cdf0e10cSrcweir |* entsprechend Invalidiert.
383cdf0e10cSrcweir |* Ersterstellung MA 22. Jul. 92
384cdf0e10cSrcweir |* Letzte Aenderung MA 14. Oct. 94
385cdf0e10cSrcweir |*
386cdf0e10cSrcweir |*************************************************************************/
InvalidatePage(const SwPageFrm * pPage) const387cdf0e10cSrcweir void SwFrm::InvalidatePage( const SwPageFrm *pPage ) const
388cdf0e10cSrcweir {
389cdf0e10cSrcweir if ( !pPage )
390cdf0e10cSrcweir {
391cdf0e10cSrcweir pPage = FindPageFrm();
392cdf0e10cSrcweir // --> OD 2004-07-02 #i28701# - for at-character and as-character
393cdf0e10cSrcweir // anchored Writer fly frames additionally invalidate also page frame
394cdf0e10cSrcweir // its 'anchor character' is on.
395cdf0e10cSrcweir if ( pPage && pPage->GetUpper() && IsFlyFrm() )
396cdf0e10cSrcweir {
397cdf0e10cSrcweir const SwFlyFrm* pFlyFrm = static_cast<const SwFlyFrm*>(this);
398cdf0e10cSrcweir if ( pFlyFrm->IsAutoPos() || pFlyFrm->IsFlyInCntFrm() )
399cdf0e10cSrcweir {
400cdf0e10cSrcweir // --> OD 2004-09-23 #i33751#, #i34060# - method <GetPageFrmOfAnchor()>
401cdf0e10cSrcweir // is replaced by method <FindPageFrmOfAnchor()>. It's return value
402cdf0e10cSrcweir // have to be checked.
403cdf0e10cSrcweir SwPageFrm* pPageFrmOfAnchor =
404cdf0e10cSrcweir const_cast<SwFlyFrm*>(pFlyFrm)->FindPageFrmOfAnchor();
405cdf0e10cSrcweir if ( pPageFrmOfAnchor && pPageFrmOfAnchor != pPage )
406cdf0e10cSrcweir // <--
407cdf0e10cSrcweir {
408cdf0e10cSrcweir InvalidatePage( pPageFrmOfAnchor );
409cdf0e10cSrcweir }
410cdf0e10cSrcweir }
411cdf0e10cSrcweir }
412cdf0e10cSrcweir // <--
413cdf0e10cSrcweir }
414cdf0e10cSrcweir
415cdf0e10cSrcweir if ( pPage && pPage->GetUpper() )
416cdf0e10cSrcweir {
417cdf0e10cSrcweir if ( pPage->GetFmt()->GetDoc()->IsInDtor() )
418cdf0e10cSrcweir return;
419cdf0e10cSrcweir
420cdf0e10cSrcweir SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
421cdf0e10cSrcweir const SwFlyFrm *pFly = FindFlyFrm();
422cdf0e10cSrcweir if ( IsCntntFrm() )
423cdf0e10cSrcweir {
424cdf0e10cSrcweir if ( pRoot->IsTurboAllowed() )
425cdf0e10cSrcweir {
426cdf0e10cSrcweir // JP 21.09.95: wenn sich der ContentFrame 2 mal eintragen
427cdf0e10cSrcweir // will, kann es doch eine TurboAction bleiben.
428cdf0e10cSrcweir // ODER????
429cdf0e10cSrcweir if ( !pRoot->GetTurbo() || this == pRoot->GetTurbo() )
430cdf0e10cSrcweir pRoot->SetTurbo( (const SwCntntFrm*)this );
431cdf0e10cSrcweir else
432cdf0e10cSrcweir {
433cdf0e10cSrcweir pRoot->DisallowTurbo();
434cdf0e10cSrcweir //Die Seite des Turbo koennte eine andere als die meinige
435cdf0e10cSrcweir //sein, deshalb muss sie invalidiert werden.
436cdf0e10cSrcweir const SwFrm *pTmp = pRoot->GetTurbo();
437cdf0e10cSrcweir pRoot->ResetTurbo();
438cdf0e10cSrcweir pTmp->InvalidatePage();
439cdf0e10cSrcweir }
440cdf0e10cSrcweir }
441cdf0e10cSrcweir if ( !pRoot->GetTurbo() )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir if ( pFly )
444cdf0e10cSrcweir { if( !pFly->IsLocked() )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() )
447cdf0e10cSrcweir { pPage->InvalidateFlyInCnt();
448cdf0e10cSrcweir ((SwFlyInCntFrm*)pFly)->InvalidateCntnt();
449cdf0e10cSrcweir pFly->GetAnchorFrm()->InvalidatePage();
450cdf0e10cSrcweir }
451cdf0e10cSrcweir else
452cdf0e10cSrcweir pPage->InvalidateFlyCntnt();
453cdf0e10cSrcweir }
454cdf0e10cSrcweir }
455cdf0e10cSrcweir else
456cdf0e10cSrcweir pPage->InvalidateCntnt();
457cdf0e10cSrcweir }
458cdf0e10cSrcweir }
459cdf0e10cSrcweir else
460cdf0e10cSrcweir {
461cdf0e10cSrcweir pRoot->DisallowTurbo();
462cdf0e10cSrcweir if ( pFly )
463cdf0e10cSrcweir {
464cdf0e10cSrcweir if ( !pFly->IsLocked() )
465cdf0e10cSrcweir {
466cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() )
467cdf0e10cSrcweir {
468cdf0e10cSrcweir pPage->InvalidateFlyInCnt();
469cdf0e10cSrcweir ((SwFlyInCntFrm*)pFly)->InvalidateLayout();
470cdf0e10cSrcweir pFly->GetAnchorFrm()->InvalidatePage();
471cdf0e10cSrcweir }
472cdf0e10cSrcweir else
473cdf0e10cSrcweir pPage->InvalidateFlyLayout();
474cdf0e10cSrcweir }
475cdf0e10cSrcweir }
476cdf0e10cSrcweir else
477cdf0e10cSrcweir pPage->InvalidateLayout();
478cdf0e10cSrcweir
479cdf0e10cSrcweir if ( pRoot->GetTurbo() )
480cdf0e10cSrcweir { const SwFrm *pTmp = pRoot->GetTurbo();
481cdf0e10cSrcweir pRoot->ResetTurbo();
482cdf0e10cSrcweir pTmp->InvalidatePage();
483cdf0e10cSrcweir }
484cdf0e10cSrcweir }
485cdf0e10cSrcweir pRoot->SetIdleFlags();
486cdf0e10cSrcweir
487cdf0e10cSrcweir const SwTxtFrm *pTxtFrm = dynamic_cast< const SwTxtFrm * >(this);
488cdf0e10cSrcweir if (pTxtFrm)
489cdf0e10cSrcweir {
490cdf0e10cSrcweir const SwTxtNode *pTxtNode = pTxtFrm->GetTxtNode();
491cdf0e10cSrcweir if (pTxtNode && pTxtNode->IsGrammarCheckDirty())
492cdf0e10cSrcweir pRoot->SetNeedGrammarCheck( sal_True );
493cdf0e10cSrcweir }
494cdf0e10cSrcweir }
495cdf0e10cSrcweir }
496cdf0e10cSrcweir
497cdf0e10cSrcweir /*************************************************************************
498cdf0e10cSrcweir |*
499cdf0e10cSrcweir |* SwFrm::ChgSize()
500cdf0e10cSrcweir |*
501cdf0e10cSrcweir |* Ersterstellung AK 15-Feb-1991
502cdf0e10cSrcweir |* Letzte Aenderung MA 18. Nov. 98
503cdf0e10cSrcweir |*
504cdf0e10cSrcweir |*************************************************************************/
ChgSize(const Size & aNewSize)505cdf0e10cSrcweir Size SwFrm::ChgSize( const Size& aNewSize )
506cdf0e10cSrcweir {
507cdf0e10cSrcweir bFixSize = sal_True;
508cdf0e10cSrcweir const Size aOldSize( Frm().SSize() );
509cdf0e10cSrcweir if ( aNewSize == aOldSize )
510cdf0e10cSrcweir return aOldSize;
511cdf0e10cSrcweir
512cdf0e10cSrcweir if ( GetUpper() )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir SWRECTFN2( this )
515cdf0e10cSrcweir SwRect aNew( Point(0,0), aNewSize );
516cdf0e10cSrcweir (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() );
517cdf0e10cSrcweir long nNew = (aNew.*fnRect->fnGetHeight)();
518cdf0e10cSrcweir long nDiff = nNew - (aFrm.*fnRect->fnGetHeight)();
519cdf0e10cSrcweir if( nDiff )
520cdf0e10cSrcweir {
521cdf0e10cSrcweir if ( GetUpper()->IsFtnBossFrm() && HasFixSize() &&
522cdf0e10cSrcweir NA_GROW_SHRINK !=
523cdf0e10cSrcweir ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this ) )
524cdf0e10cSrcweir {
525cdf0e10cSrcweir (aFrm.*fnRect->fnSetHeight)( nNew );
526cdf0e10cSrcweir SwTwips nReal = ((SwLayoutFrm*)this)->AdjustNeighbourhood(nDiff);
527cdf0e10cSrcweir if ( nReal != nDiff )
528cdf0e10cSrcweir (aFrm.*fnRect->fnSetHeight)( nNew - nDiff + nReal );
529cdf0e10cSrcweir }
530cdf0e10cSrcweir else
531cdf0e10cSrcweir {
532cdf0e10cSrcweir // OD 24.10.2002 #97265# - grow/shrink not for neighbour frames
533cdf0e10cSrcweir // NOTE: neighbour frames are cell and column frames.
534cdf0e10cSrcweir if ( !bNeighb )
535cdf0e10cSrcweir {
536cdf0e10cSrcweir if ( nDiff > 0 )
537cdf0e10cSrcweir Grow( nDiff );
538cdf0e10cSrcweir else
539cdf0e10cSrcweir Shrink( -nDiff );
540cdf0e10cSrcweir
541cdf0e10cSrcweir if ( GetUpper() && (aFrm.*fnRect->fnGetHeight)() != nNew )
542cdf0e10cSrcweir GetUpper()->_InvalidateSize();
543cdf0e10cSrcweir }
544cdf0e10cSrcweir
545cdf0e10cSrcweir // Auch wenn das Grow/Shrink noch nicht die gewuenschte Breite eingestellt hat,
546cdf0e10cSrcweir // wie z.B. beim Aufruf durch ChgColumns, um die Spaltenbreiten einzustellen,
547cdf0e10cSrcweir // wird die Breite jetzt gesetzt.
548cdf0e10cSrcweir (aFrm.*fnRect->fnSetHeight)( nNew );
549cdf0e10cSrcweir }
550cdf0e10cSrcweir }
551cdf0e10cSrcweir }
552cdf0e10cSrcweir else
553cdf0e10cSrcweir aFrm.SSize( aNewSize );
554cdf0e10cSrcweir
555cdf0e10cSrcweir if ( Frm().SSize() != aOldSize )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
558cdf0e10cSrcweir if ( GetNext() )
559cdf0e10cSrcweir {
560cdf0e10cSrcweir GetNext()->_InvalidatePos();
561cdf0e10cSrcweir GetNext()->InvalidatePage( pPage );
562cdf0e10cSrcweir }
563cdf0e10cSrcweir if( IsLayoutFrm() )
564cdf0e10cSrcweir {
565cdf0e10cSrcweir if( IsRightToLeft() )
566cdf0e10cSrcweir _InvalidatePos();
567cdf0e10cSrcweir if( ((SwLayoutFrm*)this)->Lower() )
568cdf0e10cSrcweir ((SwLayoutFrm*)this)->Lower()->_InvalidateSize();
569cdf0e10cSrcweir }
570cdf0e10cSrcweir _InvalidatePrt();
571cdf0e10cSrcweir _InvalidateSize();
572cdf0e10cSrcweir InvalidatePage( pPage );
573cdf0e10cSrcweir }
574cdf0e10cSrcweir
575cdf0e10cSrcweir return aFrm.SSize();
576cdf0e10cSrcweir }
577cdf0e10cSrcweir
578cdf0e10cSrcweir /*************************************************************************
579cdf0e10cSrcweir |*
580cdf0e10cSrcweir |* SwFrm::InsertBefore()
581cdf0e10cSrcweir |*
582cdf0e10cSrcweir |* Beschreibung SwFrm wird in eine bestehende Struktur eingefuegt
583cdf0e10cSrcweir |* Eingefuegt wird unterhalb des Parent und entweder
584cdf0e10cSrcweir |* vor pBehind oder am Ende der Kette wenn pBehind
585cdf0e10cSrcweir |* leer ist.
586cdf0e10cSrcweir |* Letzte Aenderung MA 06. Aug. 99
587cdf0e10cSrcweir |*
588cdf0e10cSrcweir |*************************************************************************/
InsertBefore(SwLayoutFrm * pParent,SwFrm * pBehind)589cdf0e10cSrcweir void SwFrm::InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind )
590cdf0e10cSrcweir {
591cdf0e10cSrcweir ASSERT( pParent, "Kein Parent fuer Insert." );
592cdf0e10cSrcweir ASSERT( (!pBehind || (pBehind && pParent == pBehind->GetUpper())),
593cdf0e10cSrcweir "Framebaum inkonsistent." );
594cdf0e10cSrcweir
595cdf0e10cSrcweir pUpper = pParent;
596cdf0e10cSrcweir pNext = pBehind;
597cdf0e10cSrcweir if( pBehind )
598cdf0e10cSrcweir { //Einfuegen vor pBehind.
599cdf0e10cSrcweir if( 0 != (pPrev = pBehind->pPrev) )
600cdf0e10cSrcweir pPrev->pNext = this;
601cdf0e10cSrcweir else
602cdf0e10cSrcweir pUpper->pLower = this;
603cdf0e10cSrcweir pBehind->pPrev = this;
604cdf0e10cSrcweir }
605cdf0e10cSrcweir else
606cdf0e10cSrcweir { //Einfuegen am Ende, oder als ersten Node im Unterbaum
607cdf0e10cSrcweir pPrev = pUpper->Lower();
608cdf0e10cSrcweir if ( pPrev )
609cdf0e10cSrcweir {
610cdf0e10cSrcweir while( pPrev->pNext )
611cdf0e10cSrcweir pPrev = pPrev->pNext;
612cdf0e10cSrcweir pPrev->pNext = this;
613cdf0e10cSrcweir }
614cdf0e10cSrcweir else
615cdf0e10cSrcweir pUpper->pLower = this;
616cdf0e10cSrcweir }
617cdf0e10cSrcweir }
618cdf0e10cSrcweir
619cdf0e10cSrcweir /*************************************************************************
620cdf0e10cSrcweir |*
621cdf0e10cSrcweir |* SwFrm::InsertBehind()
622cdf0e10cSrcweir |*
623cdf0e10cSrcweir |* Beschreibung SwFrm wird in eine bestehende Struktur eingefuegt
624cdf0e10cSrcweir |* Eingefuegt wird unterhalb des Parent und entweder
625cdf0e10cSrcweir |* hinter pBefore oder am Anfang der Kette wenn pBefore
626cdf0e10cSrcweir |* leer ist.
627cdf0e10cSrcweir |* Letzte Aenderung MA 06. Aug. 99
628cdf0e10cSrcweir |*
629cdf0e10cSrcweir |*************************************************************************/
InsertBehind(SwLayoutFrm * pParent,SwFrm * pBefore)630cdf0e10cSrcweir void SwFrm::InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore )
631cdf0e10cSrcweir {
632cdf0e10cSrcweir ASSERT( pParent, "Kein Parent fuer Insert." );
633cdf0e10cSrcweir ASSERT( (!pBefore || (pBefore && pParent == pBefore->GetUpper())),
634cdf0e10cSrcweir "Framebaum inkonsistent." );
635cdf0e10cSrcweir
636cdf0e10cSrcweir pUpper = pParent;
637cdf0e10cSrcweir pPrev = pBefore;
638cdf0e10cSrcweir if ( pBefore )
639cdf0e10cSrcweir {
640cdf0e10cSrcweir //Einfuegen hinter pBefore
641cdf0e10cSrcweir if ( 0 != (pNext = pBefore->pNext) )
642cdf0e10cSrcweir pNext->pPrev = this;
643cdf0e10cSrcweir pBefore->pNext = this;
644cdf0e10cSrcweir }
645cdf0e10cSrcweir else
646cdf0e10cSrcweir {
647cdf0e10cSrcweir //Einfuegen am Anfang der Kette
648cdf0e10cSrcweir pNext = pParent->Lower();
649cdf0e10cSrcweir if ( pParent->Lower() )
650cdf0e10cSrcweir pParent->Lower()->pPrev = this;
651cdf0e10cSrcweir pParent->pLower = this;
652cdf0e10cSrcweir }
653cdf0e10cSrcweir }
654cdf0e10cSrcweir
655cdf0e10cSrcweir /*************************************************************************
656cdf0e10cSrcweir |*
657cdf0e10cSrcweir |* SwFrm::InsertGroup()
658cdf0e10cSrcweir |*
659cdf0e10cSrcweir |* Beschreibung Eine Kette von SwFrms wird in eine bestehende Struktur
660cdf0e10cSrcweir |* eingefuegt
661cdf0e10cSrcweir |* Letzte Aenderung AMA 9. Dec. 97
662cdf0e10cSrcweir |*
663cdf0e10cSrcweir |* Bisher wird dies genutzt, um einen SectionFrame, der ggf. schon Geschwister
664cdf0e10cSrcweir |* mit sich bringt, in eine bestehende Struktur einzufuegen.
665cdf0e10cSrcweir |*
666cdf0e10cSrcweir |* Wenn man den dritten Parameter als NULL uebergibt, entspricht
667cdf0e10cSrcweir |* diese Methode dem SwFrm::InsertBefore(..), nur eben mit Geschwistern.
668cdf0e10cSrcweir |*
669cdf0e10cSrcweir |* Wenn man einen dritten Parameter uebergibt, passiert folgendes:
670cdf0e10cSrcweir |* this wird pNext von pParent,
671cdf0e10cSrcweir |* pSct wird pNext vom Letzten der this-Kette,
672cdf0e10cSrcweir |* pBehind wird vom pParent an den pSct umgehaengt.
673cdf0e10cSrcweir |* Dies dient dazu: ein SectionFrm (this) wird nicht als
674cdf0e10cSrcweir |* Kind an einen anderen SectionFrm (pParent) gehaengt, sondern pParent
675cdf0e10cSrcweir |* wird in zwei Geschwister aufgespalten (pParent+pSct) und this dazwischen
676cdf0e10cSrcweir |* eingebaut.
677cdf0e10cSrcweir |*
678cdf0e10cSrcweir |*************************************************************************/
InsertGroupBefore(SwFrm * pParent,SwFrm * pBehind,SwFrm * pSct)679cdf0e10cSrcweir void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir ASSERT( pParent, "Kein Parent fuer Insert." );
682cdf0e10cSrcweir ASSERT( (!pBehind || (pBehind && ( pParent == pBehind->GetUpper())
683cdf0e10cSrcweir || ( pParent->IsSctFrm() && pBehind->GetUpper()->IsColBodyFrm() ) ) ),
684cdf0e10cSrcweir "Framebaum inkonsistent." );
685cdf0e10cSrcweir if( pSct )
686cdf0e10cSrcweir {
687cdf0e10cSrcweir pUpper = pParent->GetUpper();
688cdf0e10cSrcweir SwFrm *pLast = this;
689cdf0e10cSrcweir while( pLast->GetNext() )
690cdf0e10cSrcweir {
691cdf0e10cSrcweir pLast = pLast->GetNext();
692cdf0e10cSrcweir pLast->pUpper = GetUpper();
693cdf0e10cSrcweir }
694cdf0e10cSrcweir if( pBehind )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir pLast->pNext = pSct;
697cdf0e10cSrcweir pSct->pPrev = pLast;
698cdf0e10cSrcweir pSct->pNext = pParent->GetNext();
699cdf0e10cSrcweir }
700cdf0e10cSrcweir else
701cdf0e10cSrcweir {
702cdf0e10cSrcweir pLast->pNext = pParent->GetNext();
703cdf0e10cSrcweir if( pLast->GetNext() )
704cdf0e10cSrcweir pLast->GetNext()->pPrev = pLast;
705cdf0e10cSrcweir }
706cdf0e10cSrcweir pParent->pNext = this;
707cdf0e10cSrcweir pPrev = pParent;
708cdf0e10cSrcweir if( pSct->GetNext() )
709cdf0e10cSrcweir pSct->GetNext()->pPrev = pSct;
710cdf0e10cSrcweir while( pLast->GetNext() )
711cdf0e10cSrcweir {
712cdf0e10cSrcweir pLast = pLast->GetNext();
713cdf0e10cSrcweir pLast->pUpper = GetUpper();
714cdf0e10cSrcweir }
715cdf0e10cSrcweir if( pBehind )
716cdf0e10cSrcweir { //Einfuegen vor pBehind.
717cdf0e10cSrcweir if( pBehind->GetPrev() )
718cdf0e10cSrcweir pBehind->GetPrev()->pNext = NULL;
719cdf0e10cSrcweir else
720cdf0e10cSrcweir pBehind->GetUpper()->pLower = NULL;
721cdf0e10cSrcweir pBehind->pPrev = NULL;
722cdf0e10cSrcweir SwLayoutFrm* pTmp = (SwLayoutFrm*)pSct;
723cdf0e10cSrcweir if( pTmp->Lower() )
724cdf0e10cSrcweir {
725cdf0e10cSrcweir ASSERT( pTmp->Lower()->IsColumnFrm(), "InsertGrp: Used SectionFrm" );
726cdf0e10cSrcweir pTmp = (SwLayoutFrm*)((SwLayoutFrm*)pTmp->Lower())->Lower();
727cdf0e10cSrcweir ASSERT( pTmp, "InsertGrp: Missing ColBody" );
728cdf0e10cSrcweir }
729cdf0e10cSrcweir pBehind->pUpper = pTmp;
730cdf0e10cSrcweir pBehind->GetUpper()->pLower = pBehind;
731cdf0e10cSrcweir pLast = pBehind->GetNext();
732cdf0e10cSrcweir while ( pLast )
733cdf0e10cSrcweir {
734cdf0e10cSrcweir pLast->pUpper = pBehind->GetUpper();
735cdf0e10cSrcweir pLast = pLast->GetNext();
736cdf0e10cSrcweir };
737cdf0e10cSrcweir }
738cdf0e10cSrcweir else
739cdf0e10cSrcweir {
740cdf0e10cSrcweir ASSERT( pSct->IsSctFrm(), "InsertGroup: For SectionFrms only" );
741cdf0e10cSrcweir delete ((SwSectionFrm*)pSct);
742cdf0e10cSrcweir }
743cdf0e10cSrcweir }
744cdf0e10cSrcweir else
745cdf0e10cSrcweir {
746cdf0e10cSrcweir pUpper = (SwLayoutFrm*)pParent;
747cdf0e10cSrcweir SwFrm *pLast = this;
748cdf0e10cSrcweir while( pLast->GetNext() )
749cdf0e10cSrcweir {
750cdf0e10cSrcweir pLast = pLast->GetNext();
751cdf0e10cSrcweir pLast->pUpper = GetUpper();
752cdf0e10cSrcweir }
753cdf0e10cSrcweir pLast->pNext = pBehind;
754cdf0e10cSrcweir if( pBehind )
755cdf0e10cSrcweir { //Einfuegen vor pBehind.
756cdf0e10cSrcweir if( 0 != (pPrev = pBehind->pPrev) )
757cdf0e10cSrcweir pPrev->pNext = this;
758cdf0e10cSrcweir else
759cdf0e10cSrcweir pUpper->pLower = this;
760cdf0e10cSrcweir pBehind->pPrev = pLast;
761cdf0e10cSrcweir }
762cdf0e10cSrcweir else
763cdf0e10cSrcweir { //Einfuegen am Ende, oder des ersten Nodes im Unterbaum
764cdf0e10cSrcweir pPrev = pUpper->Lower();
765cdf0e10cSrcweir if ( pPrev )
766cdf0e10cSrcweir {
767cdf0e10cSrcweir while( pPrev->pNext )
768cdf0e10cSrcweir pPrev = pPrev->pNext;
769cdf0e10cSrcweir pPrev->pNext = this;
770cdf0e10cSrcweir }
771cdf0e10cSrcweir else
772cdf0e10cSrcweir pUpper->pLower = this;
773cdf0e10cSrcweir }
774cdf0e10cSrcweir }
775cdf0e10cSrcweir }
776cdf0e10cSrcweir
777cdf0e10cSrcweir /*************************************************************************
778cdf0e10cSrcweir |*
779cdf0e10cSrcweir |* SwFrm::Remove()
780cdf0e10cSrcweir |*
781cdf0e10cSrcweir |* Ersterstellung AK 01-Mar-1991
782cdf0e10cSrcweir |* Letzte Aenderung MA 07. Dec. 95
783cdf0e10cSrcweir |*
784cdf0e10cSrcweir |*************************************************************************/
Remove()785cdf0e10cSrcweir void SwFrm::Remove()
786cdf0e10cSrcweir {
787cdf0e10cSrcweir ASSERT( pUpper, "Removen ohne Upper?" );
788cdf0e10cSrcweir
789cdf0e10cSrcweir if( pPrev )
790cdf0e10cSrcweir // einer aus der Mitte wird removed
791cdf0e10cSrcweir pPrev->pNext = pNext;
792cdf0e10cSrcweir else
793cdf0e10cSrcweir { // der erste in einer Folge wird removed
794cdf0e10cSrcweir ASSERT( pUpper->pLower == this, "Layout inkonsistent." );
795cdf0e10cSrcweir pUpper->pLower = pNext;
796cdf0e10cSrcweir }
797cdf0e10cSrcweir if( pNext )
798cdf0e10cSrcweir pNext->pPrev = pPrev;
799cdf0e10cSrcweir
800cdf0e10cSrcweir // Verbindung kappen.
801cdf0e10cSrcweir pNext = pPrev = 0;
802cdf0e10cSrcweir pUpper = 0;
803cdf0e10cSrcweir }
804cdf0e10cSrcweir /*************************************************************************
805cdf0e10cSrcweir |*
806cdf0e10cSrcweir |* SwCntntFrm::Paste()
807cdf0e10cSrcweir |*
808cdf0e10cSrcweir |* Ersterstellung MA 23. Feb. 94
809cdf0e10cSrcweir |* Letzte Aenderung MA 09. Sep. 98
810cdf0e10cSrcweir |*
811cdf0e10cSrcweir |*************************************************************************/
Paste(SwFrm * pParent,SwFrm * pSibling)812cdf0e10cSrcweir void SwCntntFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
813cdf0e10cSrcweir {
814cdf0e10cSrcweir ASSERT( pParent, "Kein Parent fuer Paste." );
815cdf0e10cSrcweir ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
816cdf0e10cSrcweir ASSERT( pParent != this, "Bin selbst der Parent." );
817cdf0e10cSrcweir ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
818cdf0e10cSrcweir ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
819cdf0e10cSrcweir "Bin noch irgendwo angemeldet." );
820cdf0e10cSrcweir ASSERT( !pSibling || pSibling->IsFlowFrm(),
821cdf0e10cSrcweir "<SwCntntFrm::Paste(..)> - sibling not of expected type." )
822cdf0e10cSrcweir
823cdf0e10cSrcweir //In den Baum einhaengen.
824cdf0e10cSrcweir InsertBefore( (SwLayoutFrm*)pParent, pSibling );
825cdf0e10cSrcweir
826cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
827cdf0e10cSrcweir _InvalidateAll();
828cdf0e10cSrcweir InvalidatePage( pPage );
829cdf0e10cSrcweir
830cdf0e10cSrcweir if( pPage )
831cdf0e10cSrcweir {
832cdf0e10cSrcweir pPage->InvalidateSpelling();
833cdf0e10cSrcweir pPage->InvalidateSmartTags(); // SMARTTAGS
834cdf0e10cSrcweir pPage->InvalidateAutoCompleteWords();
835cdf0e10cSrcweir pPage->InvalidateWordCount();
836cdf0e10cSrcweir }
837cdf0e10cSrcweir
838cdf0e10cSrcweir if ( GetNext() )
839cdf0e10cSrcweir {
840cdf0e10cSrcweir SwFrm* pNxt = GetNext();
841cdf0e10cSrcweir pNxt->_InvalidatePrt();
842cdf0e10cSrcweir pNxt->_InvalidatePos();
843cdf0e10cSrcweir pNxt->InvalidatePage( pPage );
844cdf0e10cSrcweir if( pNxt->IsSctFrm() )
845cdf0e10cSrcweir pNxt = ((SwSectionFrm*)pNxt)->ContainsCntnt();
846cdf0e10cSrcweir if( pNxt && pNxt->IsTxtFrm() && pNxt->IsInFtn() )
847cdf0e10cSrcweir pNxt->Prepare( PREP_FTN, 0, sal_False );
848cdf0e10cSrcweir }
849cdf0e10cSrcweir
850cdf0e10cSrcweir if ( Frm().Height() )
851cdf0e10cSrcweir pParent->Grow( Frm().Height() );
852cdf0e10cSrcweir
853cdf0e10cSrcweir if ( Frm().Width() != pParent->Prt().Width() )
854cdf0e10cSrcweir Prepare( PREP_FIXSIZE_CHG );
855cdf0e10cSrcweir
856cdf0e10cSrcweir if ( GetPrev() )
857cdf0e10cSrcweir {
858cdf0e10cSrcweir if ( IsFollow() )
859cdf0e10cSrcweir //Ich bin jetzt direkter Nachfolger meines Masters geworden
860cdf0e10cSrcweir ((SwCntntFrm*)GetPrev())->Prepare( PREP_FOLLOW_FOLLOWS );
861cdf0e10cSrcweir else
862cdf0e10cSrcweir {
863cdf0e10cSrcweir if ( GetPrev()->Frm().Height() !=
864cdf0e10cSrcweir GetPrev()->Prt().Height() + GetPrev()->Prt().Top() )
865cdf0e10cSrcweir //Umrandung zu beruecksichtigen?
866cdf0e10cSrcweir GetPrev()->_InvalidatePrt();
867cdf0e10cSrcweir // OD 18.02.2003 #104989# - force complete paint of previous frame,
868cdf0e10cSrcweir // if frame is inserted at the end of a section frame, in order to
869cdf0e10cSrcweir // get subsidiary lines repainted for the section.
870cdf0e10cSrcweir if ( pParent->IsSctFrm() && !GetNext() )
871cdf0e10cSrcweir {
872cdf0e10cSrcweir // force complete paint of previous frame, if new inserted frame
873cdf0e10cSrcweir // in the section is the last one.
874cdf0e10cSrcweir GetPrev()->SetCompletePaint();
875cdf0e10cSrcweir }
876cdf0e10cSrcweir GetPrev()->InvalidatePage( pPage );
877cdf0e10cSrcweir }
878cdf0e10cSrcweir }
879cdf0e10cSrcweir if ( IsInFtn() )
880cdf0e10cSrcweir {
881cdf0e10cSrcweir SwFrm* pFrm = GetIndPrev();
882cdf0e10cSrcweir if( pFrm && pFrm->IsSctFrm() )
883cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
884cdf0e10cSrcweir if( pFrm )
885cdf0e10cSrcweir pFrm->Prepare( PREP_QUOVADIS, 0, sal_False );
886cdf0e10cSrcweir if( !GetNext() )
887cdf0e10cSrcweir {
888cdf0e10cSrcweir pFrm = FindFtnFrm()->GetNext();
889cdf0e10cSrcweir if( pFrm && 0 != (pFrm=((SwLayoutFrm*)pFrm)->ContainsAny()) )
890cdf0e10cSrcweir pFrm->_InvalidatePrt();
891cdf0e10cSrcweir }
892cdf0e10cSrcweir }
893cdf0e10cSrcweir
894cdf0e10cSrcweir _InvalidateLineNum();
895cdf0e10cSrcweir SwFrm *pNxt = FindNextCnt();
896cdf0e10cSrcweir if ( pNxt )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir while ( pNxt && pNxt->IsInTab() )
899cdf0e10cSrcweir {
900cdf0e10cSrcweir if( 0 != (pNxt = pNxt->FindTabFrm()) )
901cdf0e10cSrcweir pNxt = pNxt->FindNextCnt();
902cdf0e10cSrcweir }
903cdf0e10cSrcweir if ( pNxt )
904cdf0e10cSrcweir {
905cdf0e10cSrcweir pNxt->_InvalidateLineNum();
906cdf0e10cSrcweir if ( pNxt != GetNext() )
907cdf0e10cSrcweir pNxt->InvalidatePage();
908cdf0e10cSrcweir }
909cdf0e10cSrcweir }
910cdf0e10cSrcweir }
911cdf0e10cSrcweir
912cdf0e10cSrcweir /*************************************************************************
913cdf0e10cSrcweir |*
914cdf0e10cSrcweir |* SwCntntFrm::Cut()
915cdf0e10cSrcweir |*
916cdf0e10cSrcweir |* Ersterstellung AK 14-Feb-1991
917cdf0e10cSrcweir |* Letzte Aenderung MA 09. Sep. 98
918cdf0e10cSrcweir |*
919cdf0e10cSrcweir |*************************************************************************/
Cut()920cdf0e10cSrcweir void SwCntntFrm::Cut()
921cdf0e10cSrcweir {
922cdf0e10cSrcweir ASSERT( GetUpper(), "Cut ohne Upper()." );
923cdf0e10cSrcweir
924cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
925cdf0e10cSrcweir InvalidatePage( pPage );
926cdf0e10cSrcweir SwFrm *pFrm = GetIndPrev();
927cdf0e10cSrcweir if( pFrm )
928cdf0e10cSrcweir {
929cdf0e10cSrcweir if( pFrm->IsSctFrm() )
930cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
931cdf0e10cSrcweir if ( pFrm && pFrm->IsCntntFrm() )
932cdf0e10cSrcweir {
933cdf0e10cSrcweir pFrm->_InvalidatePrt();
934cdf0e10cSrcweir if( IsInFtn() )
935cdf0e10cSrcweir pFrm->Prepare( PREP_QUOVADIS, 0, sal_False );
936cdf0e10cSrcweir }
937cdf0e10cSrcweir // --> OD 2004-07-15 #i26250# - invalidate printing area of previous
938cdf0e10cSrcweir // table frame.
939cdf0e10cSrcweir else if ( pFrm && pFrm->IsTabFrm() )
940cdf0e10cSrcweir {
941cdf0e10cSrcweir pFrm->InvalidatePrt();
942cdf0e10cSrcweir }
943cdf0e10cSrcweir // <--
944cdf0e10cSrcweir }
945cdf0e10cSrcweir
946cdf0e10cSrcweir SwFrm *pNxt = FindNextCnt();
947cdf0e10cSrcweir if ( pNxt )
948cdf0e10cSrcweir {
949cdf0e10cSrcweir while ( pNxt && pNxt->IsInTab() )
950cdf0e10cSrcweir {
951cdf0e10cSrcweir if( 0 != (pNxt = pNxt->FindTabFrm()) )
952cdf0e10cSrcweir pNxt = pNxt->FindNextCnt();
953cdf0e10cSrcweir }
954cdf0e10cSrcweir if ( pNxt )
955cdf0e10cSrcweir {
956cdf0e10cSrcweir pNxt->_InvalidateLineNum();
957cdf0e10cSrcweir if ( pNxt != GetNext() )
958cdf0e10cSrcweir pNxt->InvalidatePage();
959cdf0e10cSrcweir }
960cdf0e10cSrcweir }
961cdf0e10cSrcweir
962cdf0e10cSrcweir if( 0 != (pFrm = GetIndNext()) )
963cdf0e10cSrcweir { //Der alte Nachfolger hat evtl. einen Abstand zum Vorgaenger
964cdf0e10cSrcweir //berechnet, der ist jetzt, wo er der erste wird obsolet bzw. anders.
965cdf0e10cSrcweir pFrm->_InvalidatePrt();
966cdf0e10cSrcweir pFrm->_InvalidatePos();
967cdf0e10cSrcweir pFrm->InvalidatePage( pPage );
968cdf0e10cSrcweir if( pFrm->IsSctFrm() )
969cdf0e10cSrcweir {
970cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
971cdf0e10cSrcweir if( pFrm )
972cdf0e10cSrcweir {
973cdf0e10cSrcweir pFrm->_InvalidatePrt();
974cdf0e10cSrcweir pFrm->_InvalidatePos();
975cdf0e10cSrcweir pFrm->InvalidatePage( pPage );
976cdf0e10cSrcweir }
977cdf0e10cSrcweir }
978cdf0e10cSrcweir if( pFrm && IsInFtn() )
979cdf0e10cSrcweir pFrm->Prepare( PREP_ERGOSUM, 0, sal_False );
980cdf0e10cSrcweir if( IsInSct() && !GetPrev() )
981cdf0e10cSrcweir {
982cdf0e10cSrcweir SwSectionFrm* pSct = FindSctFrm();
983cdf0e10cSrcweir if( !pSct->IsFollow() )
984cdf0e10cSrcweir {
985cdf0e10cSrcweir pSct->_InvalidatePrt();
986cdf0e10cSrcweir pSct->InvalidatePage( pPage );
987cdf0e10cSrcweir }
988cdf0e10cSrcweir }
989cdf0e10cSrcweir }
990cdf0e10cSrcweir else
991cdf0e10cSrcweir {
992cdf0e10cSrcweir InvalidateNextPos();
993cdf0e10cSrcweir //Einer muss die Retusche uebernehmen: Vorgaenger oder Upper
994cdf0e10cSrcweir if ( 0 != (pFrm = GetPrev()) )
995cdf0e10cSrcweir { pFrm->SetRetouche();
996cdf0e10cSrcweir pFrm->Prepare( PREP_WIDOWS_ORPHANS );
997cdf0e10cSrcweir pFrm->_InvalidatePos();
998cdf0e10cSrcweir pFrm->InvalidatePage( pPage );
999cdf0e10cSrcweir }
1000cdf0e10cSrcweir //Wenn ich der einzige CntntFrm in meinem Upper bin (war), so muss
1001cdf0e10cSrcweir //er die Retouche uebernehmen.
1002cdf0e10cSrcweir //Ausserdem kann eine Leerseite entstanden sein.
1003cdf0e10cSrcweir else
1004cdf0e10cSrcweir { SwRootFrm *pRoot = getRootFrm();
1005cdf0e10cSrcweir if ( pRoot )
1006cdf0e10cSrcweir {
1007cdf0e10cSrcweir pRoot->SetSuperfluous();
1008cdf0e10cSrcweir GetUpper()->SetCompletePaint();
1009cdf0e10cSrcweir GetUpper()->InvalidatePage( pPage );
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir if( IsInSct() )
1012cdf0e10cSrcweir {
1013cdf0e10cSrcweir SwSectionFrm* pSct = FindSctFrm();
1014cdf0e10cSrcweir if( !pSct->IsFollow() )
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir pSct->_InvalidatePrt();
1017cdf0e10cSrcweir pSct->InvalidatePage( pPage );
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir }
1020cdf0e10cSrcweir // --> FME 2005-08-03 #i52253# The master table should take care
1021cdf0e10cSrcweir // of removing the follow flow line.
1022cdf0e10cSrcweir if ( IsInTab() )
1023cdf0e10cSrcweir {
1024cdf0e10cSrcweir SwTabFrm* pThisTab = FindTabFrm();
1025cdf0e10cSrcweir SwTabFrm* pMasterTab = pThisTab && pThisTab->IsFollow() ? pThisTab->FindMaster() : 0;
1026cdf0e10cSrcweir if ( pMasterTab )
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir pMasterTab->_InvalidatePos();
1029cdf0e10cSrcweir pMasterTab->SetRemoveFollowFlowLinePending( sal_True );
1030cdf0e10cSrcweir }
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir // <--
1033cdf0e10cSrcweir }
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir //Erst removen, dann Upper Shrinken.
1036cdf0e10cSrcweir SwLayoutFrm *pUp = GetUpper();
1037cdf0e10cSrcweir Remove();
1038cdf0e10cSrcweir if ( pUp )
1039cdf0e10cSrcweir {
1040cdf0e10cSrcweir SwSectionFrm *pSct = 0;
1041cdf0e10cSrcweir if ( !pUp->Lower() &&
1042cdf0e10cSrcweir ( ( pUp->IsFtnFrm() && !pUp->IsColLocked() ) ||
1043cdf0e10cSrcweir ( pUp->IsInSct() &&
1044cdf0e10cSrcweir // --> FME 2004-06-03 #i29438#
1045cdf0e10cSrcweir // We have to consider the case that the section may be "empty"
1046cdf0e10cSrcweir // except from a temporary empty table frame.
1047cdf0e10cSrcweir // This can happen due to the new cell split feature.
1048cdf0e10cSrcweir !pUp->IsCellFrm() &&
1049cdf0e10cSrcweir // <--
1050cdf0e10cSrcweir // --> OD 2006-01-04 #126020# - adjust check for empty section
1051cdf0e10cSrcweir // --> OD 2006-02-01 #130797# - correct fix #126020#
1052cdf0e10cSrcweir !(pSct = pUp->FindSctFrm())->ContainsCntnt() &&
1053cdf0e10cSrcweir !pSct->ContainsAny( true ) ) ) )
1054cdf0e10cSrcweir // <--
1055cdf0e10cSrcweir {
1056cdf0e10cSrcweir if ( pUp->GetUpper() )
1057cdf0e10cSrcweir {
1058cdf0e10cSrcweir // --> OD 2006-09-25 #b6448963#
1059cdf0e10cSrcweir // prevent delete of <ColLocked> footnote frame
1060cdf0e10cSrcweir // if( pUp->IsFtnFrm() )
1061cdf0e10cSrcweir if ( pUp->IsFtnFrm() && !pUp->IsColLocked())
1062cdf0e10cSrcweir // <--
1063cdf0e10cSrcweir {
1064cdf0e10cSrcweir if( pUp->GetNext() && !pUp->GetPrev() )
1065cdf0e10cSrcweir {
1066cdf0e10cSrcweir SwFrm* pTmp = ((SwLayoutFrm*)pUp->GetNext())->ContainsAny();
1067cdf0e10cSrcweir if( pTmp )
1068cdf0e10cSrcweir pTmp->_InvalidatePrt();
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir pUp->Cut();
1071cdf0e10cSrcweir delete pUp;
1072cdf0e10cSrcweir }
1073cdf0e10cSrcweir else
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir // --> OD 2006-09-25 #b6448963#
1076cdf0e10cSrcweir // if ( pSct->IsColLocked() || !pSct->IsInFtn() )
1077cdf0e10cSrcweir if ( pSct->IsColLocked() || !pSct->IsInFtn() ||
1078cdf0e10cSrcweir ( pUp->IsFtnFrm() && pUp->IsColLocked() ) )
1079cdf0e10cSrcweir // <--
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir pSct->DelEmpty( sal_False );
1082cdf0e10cSrcweir // Wenn ein gelockter Bereich nicht geloescht werden darf,
1083cdf0e10cSrcweir // so ist zumindest seine Groesse durch das Entfernen seines
1084cdf0e10cSrcweir // letzten Contents ungueltig geworden.
1085cdf0e10cSrcweir pSct->_InvalidateSize();
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir else
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir pSct->DelEmpty( sal_True );
1090cdf0e10cSrcweir delete pSct;
1091cdf0e10cSrcweir }
1092cdf0e10cSrcweir }
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir }
1095cdf0e10cSrcweir else
1096cdf0e10cSrcweir {
1097cdf0e10cSrcweir SWRECTFN( this )
1098cdf0e10cSrcweir long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
1099cdf0e10cSrcweir if( nFrmHeight )
1100cdf0e10cSrcweir pUp->Shrink( nFrmHeight );
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir }
1103cdf0e10cSrcweir }
1104cdf0e10cSrcweir
1105cdf0e10cSrcweir /*************************************************************************
1106cdf0e10cSrcweir |*
1107cdf0e10cSrcweir |* SwLayoutFrm::Paste()
1108cdf0e10cSrcweir |*
1109cdf0e10cSrcweir |* Ersterstellung MA 23. Feb. 94
1110cdf0e10cSrcweir |* Letzte Aenderung MA 23. Feb. 94
1111cdf0e10cSrcweir |*
1112cdf0e10cSrcweir |*************************************************************************/
Paste(SwFrm * pParent,SwFrm * pSibling)1113cdf0e10cSrcweir void SwLayoutFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
1114cdf0e10cSrcweir {
1115cdf0e10cSrcweir ASSERT( pParent, "Kein Parent fuer Paste." );
1116cdf0e10cSrcweir ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
1117cdf0e10cSrcweir ASSERT( pParent != this, "Bin selbst der Parent." );
1118cdf0e10cSrcweir ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
1119cdf0e10cSrcweir ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
1120cdf0e10cSrcweir "Bin noch irgendwo angemeldet." );
1121cdf0e10cSrcweir
1122cdf0e10cSrcweir //In den Baum einhaengen.
1123cdf0e10cSrcweir InsertBefore( (SwLayoutFrm*)pParent, pSibling );
1124cdf0e10cSrcweir
1125cdf0e10cSrcweir // OD 24.10.2002 #103517# - correct setting of variable <fnRect>
1126cdf0e10cSrcweir // <fnRect> is used for the following:
1127cdf0e10cSrcweir // (1) To invalidate the frame's size, if its size, which has to be the
1128cdf0e10cSrcweir // same as its upper/parent, differs from its upper's/parent's.
1129cdf0e10cSrcweir // (2) To adjust/grow the frame's upper/parent, if it has a dimension in its
1130cdf0e10cSrcweir // size, which is not determined by its upper/parent.
1131cdf0e10cSrcweir // Which size is which depends on the frame type and the layout direction
1132cdf0e10cSrcweir // (vertical or horizontal).
1133cdf0e10cSrcweir // There are the following cases:
1134cdf0e10cSrcweir // (A) Header and footer frames both in vertical and in horizontal layout
1135cdf0e10cSrcweir // have to size the width to the upper/parent. A dimension in the height
1136cdf0e10cSrcweir // has to cause a adjustment/grow of the upper/parent.
1137cdf0e10cSrcweir // --> <fnRect> = fnRectHori
1138cdf0e10cSrcweir // (B) Cell and column frames in vertical layout, the width has to be the
1139cdf0e10cSrcweir // same as upper/parent and a dimension in height causes adjustment/grow
1140cdf0e10cSrcweir // of the upper/parent.
1141cdf0e10cSrcweir // --> <fnRect> = fnRectHori
1142cdf0e10cSrcweir // in horizontal layout the other way around
1143cdf0e10cSrcweir // --> <fnRect> = fnRectVert
1144cdf0e10cSrcweir // (C) Other frames in vertical layout, the height has to be the
1145cdf0e10cSrcweir // same as upper/parent and a dimension in width causes adjustment/grow
1146cdf0e10cSrcweir // of the upper/parent.
1147cdf0e10cSrcweir // --> <fnRect> = fnRectVert
1148cdf0e10cSrcweir // in horizontal layout the other way around
1149cdf0e10cSrcweir // --> <fnRect> = fnRectHori
1150cdf0e10cSrcweir //SwRectFn fnRect = IsVertical() ? fnRectHori : fnRectVert;
1151cdf0e10cSrcweir SwRectFn fnRect;
1152cdf0e10cSrcweir if ( IsHeaderFrm() || IsFooterFrm() )
1153cdf0e10cSrcweir fnRect = fnRectHori;
1154cdf0e10cSrcweir else if ( IsCellFrm() || IsColumnFrm() )
1155cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1156cdf0e10cSrcweir fnRect = GetUpper()->IsVertical() ? fnRectHori : ( GetUpper()->IsVertLR() ? fnRectVertL2R : fnRectVert );
1157cdf0e10cSrcweir else
1158cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1159cdf0e10cSrcweir fnRect = GetUpper()->IsVertical() ? ( GetUpper()->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
1160cdf0e10cSrcweir
1161cdf0e10cSrcweir
1162cdf0e10cSrcweir if( (Frm().*fnRect->fnGetWidth)() != (pParent->Prt().*fnRect->fnGetWidth)())
1163cdf0e10cSrcweir _InvalidateSize();
1164cdf0e10cSrcweir _InvalidatePos();
1165cdf0e10cSrcweir const SwPageFrm *pPage = FindPageFrm();
1166cdf0e10cSrcweir InvalidatePage( pPage );
1167cdf0e10cSrcweir SwFrm *pFrm;
1168cdf0e10cSrcweir if( !IsColumnFrm() )
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir if( 0 != ( pFrm = GetIndNext() ) )
1171cdf0e10cSrcweir {
1172cdf0e10cSrcweir pFrm->_InvalidatePos();
1173cdf0e10cSrcweir if( IsInFtn() )
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir if( pFrm->IsSctFrm() )
1176cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
1177cdf0e10cSrcweir if( pFrm )
1178cdf0e10cSrcweir pFrm->Prepare( PREP_ERGOSUM, 0, sal_False );
1179cdf0e10cSrcweir }
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir if ( IsInFtn() && 0 != ( pFrm = GetIndPrev() ) )
1182cdf0e10cSrcweir {
1183cdf0e10cSrcweir if( pFrm->IsSctFrm() )
1184cdf0e10cSrcweir pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
1185cdf0e10cSrcweir if( pFrm )
1186cdf0e10cSrcweir pFrm->Prepare( PREP_QUOVADIS, 0, sal_False );
1187cdf0e10cSrcweir }
1188cdf0e10cSrcweir }
1189cdf0e10cSrcweir
1190cdf0e10cSrcweir if( (Frm().*fnRect->fnGetHeight)() )
1191cdf0e10cSrcweir {
1192cdf0e10cSrcweir // AdjustNeighbourhood wird jetzt auch in Spalten aufgerufen,
1193cdf0e10cSrcweir // die sich nicht in Rahmen befinden
1194cdf0e10cSrcweir sal_uInt8 nAdjust = GetUpper()->IsFtnBossFrm() ?
1195cdf0e10cSrcweir ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
1196cdf0e10cSrcweir : NA_GROW_SHRINK;
1197cdf0e10cSrcweir SwTwips nGrow = (Frm().*fnRect->fnGetHeight)();
1198cdf0e10cSrcweir if( NA_ONLY_ADJUST == nAdjust )
1199cdf0e10cSrcweir AdjustNeighbourhood( nGrow );
1200cdf0e10cSrcweir else
1201cdf0e10cSrcweir {
1202cdf0e10cSrcweir SwTwips nReal = 0;
1203cdf0e10cSrcweir if( NA_ADJUST_GROW == nAdjust )
1204cdf0e10cSrcweir nReal = AdjustNeighbourhood( nGrow );
1205cdf0e10cSrcweir if( nReal < nGrow )
1206cdf0e10cSrcweir nReal += pParent->Grow( nGrow - nReal );
1207cdf0e10cSrcweir if( NA_GROW_ADJUST == nAdjust && nReal < nGrow )
1208cdf0e10cSrcweir AdjustNeighbourhood( nGrow - nReal );
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir }
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir /*************************************************************************
1214cdf0e10cSrcweir |*
1215cdf0e10cSrcweir |* SwLayoutFrm::Cut()
1216cdf0e10cSrcweir |*
1217cdf0e10cSrcweir |* Ersterstellung MA 23. Feb. 94
1218cdf0e10cSrcweir |* Letzte Aenderung MA 23. Feb. 94
1219cdf0e10cSrcweir |*
1220cdf0e10cSrcweir |*************************************************************************/
Cut()1221cdf0e10cSrcweir void SwLayoutFrm::Cut()
1222cdf0e10cSrcweir {
1223cdf0e10cSrcweir if ( GetNext() )
1224cdf0e10cSrcweir GetNext()->_InvalidatePos();
1225cdf0e10cSrcweir
1226cdf0e10cSrcweir SWRECTFN( this )
1227cdf0e10cSrcweir SwTwips nShrink = (Frm().*fnRect->fnGetHeight)();
1228cdf0e10cSrcweir
1229cdf0e10cSrcweir //Erst removen, dann Upper Shrinken.
1230cdf0e10cSrcweir SwLayoutFrm *pUp = GetUpper();
1231cdf0e10cSrcweir
1232cdf0e10cSrcweir // AdjustNeighbourhood wird jetzt auch in Spalten aufgerufen,
1233cdf0e10cSrcweir // die sich nicht in Rahmen befinden
1234cdf0e10cSrcweir
1235cdf0e10cSrcweir // Remove must not be called before a AdjustNeighbourhood, but it has to
1236cdf0e10cSrcweir // be called before the upper-shrink-call, if the upper-shrink takes care
1237cdf0e10cSrcweir // of his content
1238cdf0e10cSrcweir if ( pUp && nShrink )
1239cdf0e10cSrcweir {
1240cdf0e10cSrcweir if( pUp->IsFtnBossFrm() )
1241cdf0e10cSrcweir {
1242cdf0e10cSrcweir sal_uInt8 nAdjust= ((SwFtnBossFrm*)pUp)->NeighbourhoodAdjustment( this );
1243cdf0e10cSrcweir if( NA_ONLY_ADJUST == nAdjust )
1244cdf0e10cSrcweir AdjustNeighbourhood( -nShrink );
1245cdf0e10cSrcweir else
1246cdf0e10cSrcweir {
1247cdf0e10cSrcweir SwTwips nReal = 0;
1248cdf0e10cSrcweir if( NA_ADJUST_GROW == nAdjust )
1249cdf0e10cSrcweir nReal = -AdjustNeighbourhood( -nShrink );
1250cdf0e10cSrcweir if( nReal < nShrink )
1251cdf0e10cSrcweir {
1252cdf0e10cSrcweir SwTwips nOldHeight = (Frm().*fnRect->fnGetHeight)();
1253cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( 0 );
1254cdf0e10cSrcweir nReal += pUp->Shrink( nShrink - nReal );
1255cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nOldHeight );
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir if( NA_GROW_ADJUST == nAdjust && nReal < nShrink )
1258cdf0e10cSrcweir AdjustNeighbourhood( nReal - nShrink );
1259cdf0e10cSrcweir }
1260cdf0e10cSrcweir Remove();
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir else
1263cdf0e10cSrcweir {
1264cdf0e10cSrcweir Remove();
1265cdf0e10cSrcweir pUp->Shrink( nShrink );
1266cdf0e10cSrcweir }
1267cdf0e10cSrcweir }
1268cdf0e10cSrcweir else
1269cdf0e10cSrcweir Remove();
1270cdf0e10cSrcweir
1271cdf0e10cSrcweir if( pUp && !pUp->Lower() )
1272cdf0e10cSrcweir {
1273cdf0e10cSrcweir pUp->SetCompletePaint();
1274cdf0e10cSrcweir pUp->InvalidatePage();
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir }
1277cdf0e10cSrcweir
1278cdf0e10cSrcweir /*************************************************************************
1279cdf0e10cSrcweir |*
1280cdf0e10cSrcweir |* SwFrm::Grow()
1281cdf0e10cSrcweir |*
1282cdf0e10cSrcweir |* Ersterstellung AK 19-Feb-1991
1283cdf0e10cSrcweir |* Letzte Aenderung MA 05. May. 94
1284cdf0e10cSrcweir |*
1285cdf0e10cSrcweir |*************************************************************************/
Grow(SwTwips nDist,sal_Bool bTst,sal_Bool bInfo)1286cdf0e10cSrcweir SwTwips SwFrm::Grow( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
1287cdf0e10cSrcweir {
1288cdf0e10cSrcweir ASSERT( nDist >= 0, "Negatives Wachstum?" );
1289cdf0e10cSrcweir
1290cdf0e10cSrcweir PROTOCOL_ENTER( this, bTst ? PROT_GROW_TST : PROT_GROW, 0, &nDist )
1291cdf0e10cSrcweir
1292cdf0e10cSrcweir if ( nDist )
1293cdf0e10cSrcweir {
1294cdf0e10cSrcweir SWRECTFN( this )
1295cdf0e10cSrcweir
1296cdf0e10cSrcweir SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
1297cdf0e10cSrcweir if( nPrtHeight > 0 && nDist > (LONG_MAX - nPrtHeight) )
1298cdf0e10cSrcweir nDist = LONG_MAX - nPrtHeight;
1299cdf0e10cSrcweir
1300cdf0e10cSrcweir if ( IsFlyFrm() )
1301cdf0e10cSrcweir return ((SwFlyFrm*)this)->_Grow( nDist, bTst );
1302cdf0e10cSrcweir else if( IsSctFrm() )
1303cdf0e10cSrcweir return ((SwSectionFrm*)this)->_Grow( nDist, bTst );
1304cdf0e10cSrcweir else
1305cdf0e10cSrcweir {
1306cdf0e10cSrcweir const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
1307cdf0e10cSrcweir if ( pThisCell )
1308cdf0e10cSrcweir {
1309cdf0e10cSrcweir const SwTabFrm* pTab = FindTabFrm();
1310cdf0e10cSrcweir
1311cdf0e10cSrcweir // NEW TABLES
1312cdf0e10cSrcweir if ( ( 0 != pTab->IsVertical() ) != ( 0 != IsVertical() ) ||
1313cdf0e10cSrcweir pThisCell->GetLayoutRowSpan() < 1 )
1314cdf0e10cSrcweir return 0;
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir
1317cdf0e10cSrcweir const SwTwips nReal = GrowFrm( nDist, bTst, bInfo );
1318cdf0e10cSrcweir if( !bTst )
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir nPrtHeight = (Prt().*fnRect->fnGetHeight)();
1321cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nPrtHeight +
1322cdf0e10cSrcweir ( IsCntntFrm() ? nDist : nReal ) );
1323cdf0e10cSrcweir }
1324cdf0e10cSrcweir return nReal;
1325cdf0e10cSrcweir }
1326cdf0e10cSrcweir }
1327cdf0e10cSrcweir return 0L;
1328cdf0e10cSrcweir }
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir /*************************************************************************
1331cdf0e10cSrcweir |*
1332cdf0e10cSrcweir |* SwFrm::Shrink()
1333cdf0e10cSrcweir |*
1334cdf0e10cSrcweir |* Ersterstellung AK 14-Feb-1991
1335cdf0e10cSrcweir |* Letzte Aenderung MA 05. May. 94
1336cdf0e10cSrcweir |*
1337cdf0e10cSrcweir |*************************************************************************/
Shrink(SwTwips nDist,sal_Bool bTst,sal_Bool bInfo)1338cdf0e10cSrcweir SwTwips SwFrm::Shrink( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir ASSERT( nDist >= 0, "Negative Verkleinerung?" );
1341cdf0e10cSrcweir
1342cdf0e10cSrcweir PROTOCOL_ENTER( this, bTst ? PROT_SHRINK_TST : PROT_SHRINK, 0, &nDist )
1343cdf0e10cSrcweir
1344cdf0e10cSrcweir if ( nDist )
1345cdf0e10cSrcweir {
1346cdf0e10cSrcweir if ( IsFlyFrm() )
1347cdf0e10cSrcweir return ((SwFlyFrm*)this)->_Shrink( nDist, bTst );
1348cdf0e10cSrcweir else if( IsSctFrm() )
1349cdf0e10cSrcweir return ((SwSectionFrm*)this)->_Shrink( nDist, bTst );
1350cdf0e10cSrcweir else
1351cdf0e10cSrcweir {
1352cdf0e10cSrcweir const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
1353cdf0e10cSrcweir if ( pThisCell )
1354cdf0e10cSrcweir {
1355cdf0e10cSrcweir const SwTabFrm* pTab = FindTabFrm();
1356cdf0e10cSrcweir
1357cdf0e10cSrcweir // NEW TABLES
1358cdf0e10cSrcweir if ( ( 0 != pTab->IsVertical() ) != ( 0 != IsVertical() ) ||
1359cdf0e10cSrcweir pThisCell->GetLayoutRowSpan() < 1 )
1360cdf0e10cSrcweir return 0;
1361cdf0e10cSrcweir }
1362cdf0e10cSrcweir
1363cdf0e10cSrcweir SWRECTFN( this )
1364cdf0e10cSrcweir SwTwips nReal = (Frm().*fnRect->fnGetHeight)();
1365cdf0e10cSrcweir ShrinkFrm( nDist, bTst, bInfo );
1366cdf0e10cSrcweir nReal -= (Frm().*fnRect->fnGetHeight)();
1367cdf0e10cSrcweir if( !bTst )
1368cdf0e10cSrcweir {
1369cdf0e10cSrcweir const SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
1370cdf0e10cSrcweir (Prt().*fnRect->fnSetHeight)( nPrtHeight -
1371cdf0e10cSrcweir ( IsCntntFrm() ? nDist : nReal ) );
1372cdf0e10cSrcweir }
1373cdf0e10cSrcweir return nReal;
1374cdf0e10cSrcweir }
1375cdf0e10cSrcweir }
1376cdf0e10cSrcweir return 0L;
1377cdf0e10cSrcweir }
1378cdf0e10cSrcweir
1379cdf0e10cSrcweir /*************************************************************************
1380cdf0e10cSrcweir |*
1381cdf0e10cSrcweir |* SwFrm::AdjustNeighbourhood()
1382cdf0e10cSrcweir |*
1383cdf0e10cSrcweir |* Beschreibung Wenn sich die Groesse eines Frm's direkt unterhalb
1384cdf0e10cSrcweir |* eines Fussnotenbosses (Seite/Spalte) veraendert hat, so muss dieser
1385cdf0e10cSrcweir |* "Normalisiert" werden.
1386cdf0e10cSrcweir |* Es gibt dort immer einen Frame, der den "maximal moeglichen" Raum
1387cdf0e10cSrcweir |* einnimmt (der Frame, der den Body.Text enhaelt) und keinen oder
1388cdf0e10cSrcweir |* mehrere Frames die den Platz einnehmen den sie halt brauchen
1389cdf0e10cSrcweir |* (Kopf-/Fussbereich, Fussnoten).
1390cdf0e10cSrcweir |* Hat sich einer der Frames veraendert, so muss der Body-Text-Frame
1391cdf0e10cSrcweir |* entsprechen wachsen oder schrumpfen; unabhaegig davon, dass er fix ist.
1392cdf0e10cSrcweir |* !! Ist es moeglich dies allgemeiner zu loesen, also nicht auf die
1393cdf0e10cSrcweir |* Seite beschraenkt und nicht auf einen Speziellen Frame, der den
1394cdf0e10cSrcweir |* maximalen Platz einnimmt (gesteuert ueber Attribut FrmSize)? Probleme:
1395cdf0e10cSrcweir |* Was ist wenn mehrere Frames nebeneinander stehen, die den maximalen
1396cdf0e10cSrcweir |* Platz einnehmen?
1397cdf0e10cSrcweir |* Wie wird der Maximale Platz berechnet?
1398cdf0e10cSrcweir |* Wie klein duerfen diese Frames werden?
1399cdf0e10cSrcweir |*
1400cdf0e10cSrcweir |* Es wird auf jeden Fall nur so viel Platz genehmigt, dass ein
1401cdf0e10cSrcweir |* Minimalwert fuer die Hoehe des Bodys nicht unterschritten wird.
1402cdf0e10cSrcweir |*
1403cdf0e10cSrcweir |* Parameter: nDiff ist der Betrag, um den Platz geschaffen werden muss
1404cdf0e10cSrcweir |*
1405cdf0e10cSrcweir |* Ersterstellung MA 07. May. 92
1406cdf0e10cSrcweir |* Letzte Aenderung AMA 02. Nov. 98
1407cdf0e10cSrcweir |*
1408cdf0e10cSrcweir |*************************************************************************/
AdjustNeighbourhood(SwTwips nDiff,sal_Bool bTst)1409cdf0e10cSrcweir SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst )
1410cdf0e10cSrcweir {
1411cdf0e10cSrcweir PROTOCOL_ENTER( this, PROT_ADJUSTN, 0, &nDiff );
1412cdf0e10cSrcweir
1413cdf0e10cSrcweir if ( !nDiff || !GetUpper()->IsFtnBossFrm() ) // nur innerhalb von Seiten/Spalten
1414cdf0e10cSrcweir return 0L;
1415cdf0e10cSrcweir
1416cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
1417cdf0e10cSrcweir const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
1418cdf0e10cSrcweir
1419cdf0e10cSrcweir //Der (Page)Body veraendert sich nur im BrowseMode, aber nicht wenn er
1420cdf0e10cSrcweir //Spalten enthaelt.
1421cdf0e10cSrcweir if ( IsPageBodyFrm() && (!bBrowse ||
1422cdf0e10cSrcweir (((SwLayoutFrm*)this)->Lower() &&
1423cdf0e10cSrcweir ((SwLayoutFrm*)this)->Lower()->IsColumnFrm())) )
1424cdf0e10cSrcweir return 0L;
1425cdf0e10cSrcweir
1426cdf0e10cSrcweir //In der BrowseView kann der PageFrm selbst ersteinmal einiges von den
1427cdf0e10cSrcweir //Wuenschen abfangen.
1428cdf0e10cSrcweir long nBrowseAdd = 0;
1429cdf0e10cSrcweir if ( bBrowse && GetUpper()->IsPageFrm() ) // nur (Page)BodyFrms
1430cdf0e10cSrcweir {
1431cdf0e10cSrcweir ViewShell *pViewShell = getRootFrm()->GetCurrShell();
1432cdf0e10cSrcweir SwLayoutFrm *pUp = GetUpper();
1433cdf0e10cSrcweir long nChg;
1434cdf0e10cSrcweir const long nUpPrtBottom = pUp->Frm().Height() -
1435cdf0e10cSrcweir pUp->Prt().Height() - pUp->Prt().Top();
1436cdf0e10cSrcweir SwRect aInva( pUp->Frm() );
1437cdf0e10cSrcweir if ( pViewShell )
1438cdf0e10cSrcweir {
1439cdf0e10cSrcweir aInva.Pos().X() = pViewShell->VisArea().Left();
1440cdf0e10cSrcweir aInva.Width( pViewShell->VisArea().Width() );
1441cdf0e10cSrcweir }
1442cdf0e10cSrcweir if ( nDiff > 0 )
1443cdf0e10cSrcweir {
1444cdf0e10cSrcweir nChg = BROWSE_HEIGHT - pUp->Frm().Height();
1445cdf0e10cSrcweir nChg = Min( nDiff, nChg );
1446cdf0e10cSrcweir
1447cdf0e10cSrcweir if ( !IsBodyFrm() )
1448cdf0e10cSrcweir {
1449cdf0e10cSrcweir SetCompletePaint();
1450cdf0e10cSrcweir if ( !pViewShell || pViewShell->VisArea().Height() >= pUp->Frm().Height() )
1451cdf0e10cSrcweir {
1452cdf0e10cSrcweir //Ersteinmal den Body verkleinern. Der waechst dann schon
1453cdf0e10cSrcweir //wieder.
1454cdf0e10cSrcweir SwFrm *pBody = ((SwFtnBossFrm*)pUp)->FindBodyCont();
1455cdf0e10cSrcweir const long nTmp = nChg - pBody->Prt().Height();
1456cdf0e10cSrcweir if ( !bTst )
1457cdf0e10cSrcweir {
1458cdf0e10cSrcweir pBody->Frm().Height(Max( 0L, pBody->Frm().Height() - nChg ));
1459cdf0e10cSrcweir pBody->_InvalidatePrt();
1460cdf0e10cSrcweir pBody->_InvalidateSize();
1461cdf0e10cSrcweir if ( pBody->GetNext() )
1462cdf0e10cSrcweir pBody->GetNext()->_InvalidatePos();
1463cdf0e10cSrcweir if ( !IsHeaderFrm() )
1464cdf0e10cSrcweir pBody->SetCompletePaint();
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir nChg = nTmp <= 0 ? 0 : nTmp;
1467cdf0e10cSrcweir }
1468cdf0e10cSrcweir }
1469cdf0e10cSrcweir
1470cdf0e10cSrcweir const long nTmp = nUpPrtBottom + 20;
1471cdf0e10cSrcweir aInva.Top( aInva.Bottom() - nTmp );
1472cdf0e10cSrcweir aInva.Height( nChg + nTmp );
1473cdf0e10cSrcweir }
1474cdf0e10cSrcweir else
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir //Die Seite kann bis auf 0 schrumpfen. Die erste Seite bleibt
1477cdf0e10cSrcweir //mindestens so gross wie die VisArea.
1478cdf0e10cSrcweir nChg = nDiff;
1479cdf0e10cSrcweir long nInvaAdd = 0;
1480cdf0e10cSrcweir if ( pViewShell && !pUp->GetPrev() &&
1481cdf0e10cSrcweir pUp->Frm().Height() + nDiff < pViewShell->VisArea().Height() )
1482cdf0e10cSrcweir {
1483cdf0e10cSrcweir //Das heisst aber wiederum trotzdem, das wir geeignet invalidieren
1484cdf0e10cSrcweir //muessen.
1485cdf0e10cSrcweir nChg = pViewShell->VisArea().Height() - pUp->Frm().Height();
1486cdf0e10cSrcweir nInvaAdd = -(nDiff - nChg);
1487cdf0e10cSrcweir }
1488cdf0e10cSrcweir
1489cdf0e10cSrcweir //Invalidieren inklusive unterem Rand.
1490cdf0e10cSrcweir long nBorder = nUpPrtBottom + 20;
1491cdf0e10cSrcweir nBorder -= nChg;
1492cdf0e10cSrcweir aInva.Top( aInva.Bottom() - (nBorder+nInvaAdd) );
1493cdf0e10cSrcweir if ( !IsBodyFrm() )
1494cdf0e10cSrcweir {
1495cdf0e10cSrcweir SetCompletePaint();
1496cdf0e10cSrcweir if ( !IsHeaderFrm() )
1497cdf0e10cSrcweir ((SwFtnBossFrm*)pUp)->FindBodyCont()->SetCompletePaint();
1498cdf0e10cSrcweir }
1499cdf0e10cSrcweir //Wegen der Rahmen die Seite invalidieren. Dadurch wird die Seite
1500cdf0e10cSrcweir //wieder entsprechend gross wenn ein Rahmen nicht passt. Das
1501cdf0e10cSrcweir //funktioniert anderfalls nur zufaellig fuer absatzgebundene Rahmen
1502cdf0e10cSrcweir //(NotifyFlys).
1503cdf0e10cSrcweir pUp->InvalidateSize();
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir if ( !bTst )
1506cdf0e10cSrcweir {
1507cdf0e10cSrcweir //Unabhaengig von nChg
1508cdf0e10cSrcweir if ( pViewShell && aInva.HasArea() && pUp->GetUpper() )
1509cdf0e10cSrcweir pViewShell->InvalidateWindows( aInva );
1510cdf0e10cSrcweir }
1511cdf0e10cSrcweir if ( !bTst && nChg )
1512cdf0e10cSrcweir {
1513cdf0e10cSrcweir const SwRect aOldRect( pUp->Frm() );
1514cdf0e10cSrcweir pUp->Frm().SSize().Height() += nChg;
1515cdf0e10cSrcweir pUp->Prt().SSize().Height() += nChg;
1516cdf0e10cSrcweir if ( pViewShell )
1517cdf0e10cSrcweir pViewShell->Imp()->SetFirstVisPageInvalid();
1518cdf0e10cSrcweir
1519cdf0e10cSrcweir if ( GetNext() )
1520cdf0e10cSrcweir GetNext()->_InvalidatePos();
1521cdf0e10cSrcweir
1522cdf0e10cSrcweir //Ggf. noch ein Repaint ausloesen.
1523cdf0e10cSrcweir const SvxGraphicPosition ePos = pUp->GetFmt()->GetBackground().GetGraphicPos();
1524cdf0e10cSrcweir if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
1525cdf0e10cSrcweir pViewShell->InvalidateWindows( pUp->Frm() );
1526cdf0e10cSrcweir
1527cdf0e10cSrcweir if ( pUp->GetUpper() )
1528cdf0e10cSrcweir {
1529cdf0e10cSrcweir if ( pUp->GetNext() )
1530cdf0e10cSrcweir pUp->GetNext()->InvalidatePos();
1531cdf0e10cSrcweir
1532cdf0e10cSrcweir //Mies aber wahr: im Notify am ViewImp wird evtl. ein Calc
1533cdf0e10cSrcweir //auf die Seite und deren Lower gerufen. Die Werte sollten
1534cdf0e10cSrcweir //unverandert bleiben, weil der Aufrufer bereits fuer die
1535cdf0e10cSrcweir //Anpassung von Frm und Prt sorgen wird.
1536cdf0e10cSrcweir const long nOldFrmHeight = Frm().Height();
1537cdf0e10cSrcweir const long nOldPrtHeight = Prt().Height();
1538cdf0e10cSrcweir const sal_Bool bOldComplete = IsCompletePaint();
1539cdf0e10cSrcweir if ( IsBodyFrm() )
1540cdf0e10cSrcweir Prt().SSize().Height() = nOldFrmHeight;
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir // PAGES01
1543cdf0e10cSrcweir if ( pUp->GetUpper() )
1544cdf0e10cSrcweir static_cast<SwRootFrm*>(pUp->GetUpper())->CheckViewLayout( 0, 0 );
1545cdf0e10cSrcweir //((SwPageFrm*)pUp)->AdjustRootSize( CHG_CHGPAGE, &aOldRect );
1546cdf0e10cSrcweir
1547cdf0e10cSrcweir Frm().SSize().Height() = nOldFrmHeight;
1548cdf0e10cSrcweir Prt().SSize().Height() = nOldPrtHeight;
1549cdf0e10cSrcweir bCompletePaint = bOldComplete;
1550cdf0e10cSrcweir }
1551cdf0e10cSrcweir if ( !IsBodyFrm() )
1552cdf0e10cSrcweir pUp->_InvalidateSize();
1553cdf0e10cSrcweir InvalidatePage( (SwPageFrm*)pUp );
1554cdf0e10cSrcweir }
1555cdf0e10cSrcweir nDiff -= nChg;
1556cdf0e10cSrcweir if ( !nDiff )
1557cdf0e10cSrcweir return nChg;
1558cdf0e10cSrcweir else
1559cdf0e10cSrcweir nBrowseAdd = nChg;
1560cdf0e10cSrcweir }
1561cdf0e10cSrcweir
1562cdf0e10cSrcweir const SwFtnBossFrm *pBoss = (SwFtnBossFrm*)GetUpper();
1563cdf0e10cSrcweir
1564cdf0e10cSrcweir SwTwips nReal = 0,
1565cdf0e10cSrcweir nAdd = 0;
1566cdf0e10cSrcweir SwFrm *pFrm = 0;
1567cdf0e10cSrcweir SWRECTFN( this )
1568cdf0e10cSrcweir
1569cdf0e10cSrcweir if( IsBodyFrm() )
1570cdf0e10cSrcweir {
1571cdf0e10cSrcweir if( IsInSct() )
1572cdf0e10cSrcweir {
1573cdf0e10cSrcweir SwSectionFrm *pSect = FindSctFrm();
1574cdf0e10cSrcweir if( nDiff > 0 && pSect->IsEndnAtEnd() && GetNext() &&
1575cdf0e10cSrcweir GetNext()->IsFtnContFrm() )
1576cdf0e10cSrcweir {
1577cdf0e10cSrcweir SwFtnContFrm* pCont = (SwFtnContFrm*)GetNext();
1578cdf0e10cSrcweir SwTwips nMinH = 0;
1579cdf0e10cSrcweir SwFtnFrm* pFtn = (SwFtnFrm*)pCont->Lower();
1580cdf0e10cSrcweir sal_Bool bFtn = sal_False;
1581cdf0e10cSrcweir while( pFtn )
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir if( !pFtn->GetAttr()->GetFtn().IsEndNote() )
1584cdf0e10cSrcweir {
1585cdf0e10cSrcweir nMinH += (pFtn->Frm().*fnRect->fnGetHeight)();
1586cdf0e10cSrcweir bFtn = sal_True;
1587cdf0e10cSrcweir }
1588cdf0e10cSrcweir pFtn = (SwFtnFrm*)pFtn->GetNext();
1589cdf0e10cSrcweir }
1590cdf0e10cSrcweir if( bFtn )
1591cdf0e10cSrcweir nMinH += (pCont->Prt().*fnRect->fnGetTop)();
1592cdf0e10cSrcweir nReal = (pCont->Frm().*fnRect->fnGetHeight)() - nMinH;
1593cdf0e10cSrcweir if( nReal > nDiff )
1594cdf0e10cSrcweir nReal = nDiff;
1595cdf0e10cSrcweir if( nReal > 0 )
1596cdf0e10cSrcweir pFrm = GetNext();
1597cdf0e10cSrcweir else
1598cdf0e10cSrcweir nReal = 0;
1599cdf0e10cSrcweir }
1600cdf0e10cSrcweir if( !bTst && !pSect->IsColLocked() )
1601cdf0e10cSrcweir pSect->InvalidateSize();
1602cdf0e10cSrcweir }
1603cdf0e10cSrcweir if( !pFrm )
1604cdf0e10cSrcweir return nBrowseAdd;
1605cdf0e10cSrcweir }
1606cdf0e10cSrcweir else
1607cdf0e10cSrcweir {
1608cdf0e10cSrcweir const sal_Bool bFtnPage = pBoss->IsPageFrm() && ((SwPageFrm*)pBoss)->IsFtnPage();
1609cdf0e10cSrcweir if ( bFtnPage && !IsFtnContFrm() )
1610cdf0e10cSrcweir pFrm = (SwFrm*)pBoss->FindFtnCont();
1611cdf0e10cSrcweir if ( !pFrm )
1612cdf0e10cSrcweir pFrm = (SwFrm*)pBoss->FindBodyCont();
1613cdf0e10cSrcweir
1614cdf0e10cSrcweir if ( !pFrm )
1615cdf0e10cSrcweir return 0;
1616cdf0e10cSrcweir
1617cdf0e10cSrcweir //Wenn ich keinen finde eruebrigt sich alles weitere.
1618cdf0e10cSrcweir nReal = (pFrm->Frm().*fnRect->fnGetHeight)();
1619cdf0e10cSrcweir if( nReal > nDiff )
1620cdf0e10cSrcweir nReal = nDiff;
1621cdf0e10cSrcweir if( !bFtnPage )
1622cdf0e10cSrcweir {
1623cdf0e10cSrcweir //Minimalgrenze beachten!
1624cdf0e10cSrcweir if( nReal )
1625cdf0e10cSrcweir {
1626cdf0e10cSrcweir const SwTwips nMax = pBoss->GetVarSpace();
1627cdf0e10cSrcweir if ( nReal > nMax )
1628cdf0e10cSrcweir nReal = nMax;
1629cdf0e10cSrcweir }
1630cdf0e10cSrcweir if( !IsFtnContFrm() && nDiff > nReal &&
1631cdf0e10cSrcweir pFrm->GetNext() && pFrm->GetNext()->IsFtnContFrm()
1632cdf0e10cSrcweir && ( pFrm->GetNext()->IsVertical() == IsVertical() )
1633cdf0e10cSrcweir )
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir //Wenn der Body nicht genuegend her gibt, kann ich noch mal
1636cdf0e10cSrcweir //schauen ob es eine Fussnote gibt, falls ja kann dieser
1637cdf0e10cSrcweir //entsprechend viel gemopst werden.
1638cdf0e10cSrcweir const SwTwips nAddMax = (pFrm->GetNext()->Frm().*fnRect->
1639cdf0e10cSrcweir fnGetHeight)();
1640cdf0e10cSrcweir nAdd = nDiff - nReal;
1641cdf0e10cSrcweir if ( nAdd > nAddMax )
1642cdf0e10cSrcweir nAdd = nAddMax;
1643cdf0e10cSrcweir if ( !bTst )
1644cdf0e10cSrcweir {
1645cdf0e10cSrcweir (pFrm->GetNext()->Frm().*fnRect->fnSetHeight)(nAddMax-nAdd);
1646cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1647cdf0e10cSrcweir if( bVert && !bVertL2R && !bRev )
1648cdf0e10cSrcweir pFrm->GetNext()->Frm().Pos().X() += nAdd;
1649cdf0e10cSrcweir pFrm->GetNext()->InvalidatePrt();
1650cdf0e10cSrcweir if ( pFrm->GetNext()->GetNext() )
1651cdf0e10cSrcweir pFrm->GetNext()->GetNext()->_InvalidatePos();
1652cdf0e10cSrcweir }
1653cdf0e10cSrcweir }
1654cdf0e10cSrcweir }
1655cdf0e10cSrcweir }
1656cdf0e10cSrcweir
1657cdf0e10cSrcweir if ( !bTst && nReal )
1658cdf0e10cSrcweir {
1659cdf0e10cSrcweir SwTwips nTmp = (pFrm->Frm().*fnRect->fnGetHeight)();
1660cdf0e10cSrcweir (pFrm->Frm().*fnRect->fnSetHeight)( nTmp - nReal );
1661cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1662cdf0e10cSrcweir if( bVert && !bVertL2R && !bRev )
1663cdf0e10cSrcweir pFrm->Frm().Pos().X() += nReal;
1664cdf0e10cSrcweir pFrm->InvalidatePrt();
1665cdf0e10cSrcweir if ( pFrm->GetNext() )
1666cdf0e10cSrcweir pFrm->GetNext()->_InvalidatePos();
1667cdf0e10cSrcweir if( nReal < 0 && pFrm->IsInSct() )
1668cdf0e10cSrcweir {
1669cdf0e10cSrcweir SwLayoutFrm* pUp = pFrm->GetUpper();
1670cdf0e10cSrcweir if( pUp && 0 != ( pUp = pUp->GetUpper() ) && pUp->IsSctFrm() &&
1671cdf0e10cSrcweir !pUp->IsColLocked() )
1672cdf0e10cSrcweir pUp->InvalidateSize();
1673cdf0e10cSrcweir }
1674cdf0e10cSrcweir if( ( IsHeaderFrm() || IsFooterFrm() ) && pBoss->GetDrawObjs() )
1675cdf0e10cSrcweir {
1676cdf0e10cSrcweir const SwSortedObjs &rObjs = *pBoss->GetDrawObjs();
1677cdf0e10cSrcweir ASSERT( pBoss->IsPageFrm(), "Header/Footer out of page?" );
1678cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
1679cdf0e10cSrcweir {
1680cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = rObjs[i];
1681cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
1682cdf0e10cSrcweir {
1683cdf0e10cSrcweir SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
1684cdf0e10cSrcweir ASSERT( !pFly->IsFlyInCntFrm(), "FlyInCnt at Page?" );
1685cdf0e10cSrcweir const SwFmtVertOrient &rVert =
1686cdf0e10cSrcweir pFly->GetFmt()->GetVertOrient();
1687cdf0e10cSrcweir // Wann muss invalidiert werden?
1688cdf0e10cSrcweir // Wenn ein Rahmen am SeitenTextBereich ausgerichtet ist,
1689cdf0e10cSrcweir // muss bei Aenderung des Headers ein TOP, MIDDLE oder NONE,
1690cdf0e10cSrcweir // bei Aenderung des Footers ein BOTTOM oder MIDDLE
1691cdf0e10cSrcweir // ausgerichteter Rahmen seine Position neu berechnen.
1692cdf0e10cSrcweir if( ( rVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ||
1693cdf0e10cSrcweir rVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA ) &&
1694cdf0e10cSrcweir ((IsHeaderFrm() && rVert.GetVertOrient()!=text::VertOrientation::BOTTOM) ||
1695cdf0e10cSrcweir (IsFooterFrm() && rVert.GetVertOrient()!=text::VertOrientation::NONE &&
1696cdf0e10cSrcweir rVert.GetVertOrient() != text::VertOrientation::TOP)) )
1697cdf0e10cSrcweir {
1698cdf0e10cSrcweir pFly->_InvalidatePos();
1699cdf0e10cSrcweir pFly->_Invalidate();
1700cdf0e10cSrcweir }
1701cdf0e10cSrcweir }
1702cdf0e10cSrcweir }
1703cdf0e10cSrcweir }
1704cdf0e10cSrcweir }
1705cdf0e10cSrcweir return (nBrowseAdd + nReal + nAdd);
1706cdf0e10cSrcweir }
1707cdf0e10cSrcweir
1708cdf0e10cSrcweir /*************************************************************************
1709cdf0e10cSrcweir |*
1710cdf0e10cSrcweir |* SwFrm::ImplInvalidateSize(), ImplInvalidatePrt(), ImplInvalidatePos(),
1711cdf0e10cSrcweir |* ImplInvalidateLineNum()
1712cdf0e10cSrcweir |*
1713cdf0e10cSrcweir |* Ersterstellung MA 15. Oct. 92
1714cdf0e10cSrcweir |* Letzte Aenderung MA 24. Mar. 94
1715cdf0e10cSrcweir |*
1716cdf0e10cSrcweir |*************************************************************************/
1717cdf0e10cSrcweir /** method to perform additional actions on an invalidation
1718cdf0e10cSrcweir
1719cdf0e10cSrcweir OD 2004-05-19 #i28701#
1720cdf0e10cSrcweir
1721cdf0e10cSrcweir @author OD
1722cdf0e10cSrcweir */
_ActionOnInvalidation(const InvalidationType)1723cdf0e10cSrcweir void SwFrm::_ActionOnInvalidation( const InvalidationType )
1724cdf0e10cSrcweir {
1725cdf0e10cSrcweir // default behaviour is to perform no additional action
1726cdf0e10cSrcweir }
1727cdf0e10cSrcweir
1728cdf0e10cSrcweir /** method to determine, if an invalidation is allowed.
1729cdf0e10cSrcweir
1730cdf0e10cSrcweir OD 2004-05-19 #i28701#
1731cdf0e10cSrcweir
1732cdf0e10cSrcweir @author OD
1733cdf0e10cSrcweir */
_InvalidationAllowed(const InvalidationType) const1734cdf0e10cSrcweir bool SwFrm::_InvalidationAllowed( const InvalidationType ) const
1735cdf0e10cSrcweir {
1736cdf0e10cSrcweir // default behaviour is to allow invalidation
1737cdf0e10cSrcweir return true;
1738cdf0e10cSrcweir }
1739cdf0e10cSrcweir
ImplInvalidateSize()1740cdf0e10cSrcweir void SwFrm::ImplInvalidateSize()
1741cdf0e10cSrcweir {
1742cdf0e10cSrcweir if ( _InvalidationAllowed( INVALID_SIZE ) )
1743cdf0e10cSrcweir {
1744cdf0e10cSrcweir bValidSize = sal_False;
1745cdf0e10cSrcweir if ( IsFlyFrm() )
1746cdf0e10cSrcweir ((SwFlyFrm*)this)->_Invalidate();
1747cdf0e10cSrcweir else
1748cdf0e10cSrcweir InvalidatePage();
1749cdf0e10cSrcweir
1750cdf0e10cSrcweir // OD 2004-05-19 #i28701#
1751cdf0e10cSrcweir _ActionOnInvalidation( INVALID_SIZE );
1752cdf0e10cSrcweir }
1753cdf0e10cSrcweir }
1754cdf0e10cSrcweir
ImplInvalidatePrt()1755cdf0e10cSrcweir void SwFrm::ImplInvalidatePrt()
1756cdf0e10cSrcweir {
1757cdf0e10cSrcweir if ( _InvalidationAllowed( INVALID_PRTAREA ) )
1758cdf0e10cSrcweir {
1759cdf0e10cSrcweir bValidPrtArea = sal_False;
1760cdf0e10cSrcweir if ( IsFlyFrm() )
1761cdf0e10cSrcweir ((SwFlyFrm*)this)->_Invalidate();
1762cdf0e10cSrcweir else
1763cdf0e10cSrcweir InvalidatePage();
1764cdf0e10cSrcweir
1765cdf0e10cSrcweir // OD 2004-05-19 #i28701#
1766cdf0e10cSrcweir _ActionOnInvalidation( INVALID_PRTAREA );
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir }
1769cdf0e10cSrcweir
ImplInvalidatePos()1770cdf0e10cSrcweir void SwFrm::ImplInvalidatePos()
1771cdf0e10cSrcweir {
1772cdf0e10cSrcweir if ( _InvalidationAllowed( INVALID_POS ) )
1773cdf0e10cSrcweir {
1774cdf0e10cSrcweir bValidPos = sal_False;
1775cdf0e10cSrcweir if ( IsFlyFrm() )
1776cdf0e10cSrcweir {
1777cdf0e10cSrcweir ((SwFlyFrm*)this)->_Invalidate();
1778cdf0e10cSrcweir }
1779cdf0e10cSrcweir else
1780cdf0e10cSrcweir {
1781cdf0e10cSrcweir InvalidatePage();
1782cdf0e10cSrcweir }
1783cdf0e10cSrcweir
1784cdf0e10cSrcweir // OD 2004-05-19 #i28701#
1785cdf0e10cSrcweir _ActionOnInvalidation( INVALID_POS );
1786cdf0e10cSrcweir }
1787cdf0e10cSrcweir }
1788cdf0e10cSrcweir
ImplInvalidateLineNum()1789cdf0e10cSrcweir void SwFrm::ImplInvalidateLineNum()
1790cdf0e10cSrcweir {
1791cdf0e10cSrcweir if ( _InvalidationAllowed( INVALID_LINENUM ) )
1792cdf0e10cSrcweir {
1793cdf0e10cSrcweir bValidLineNum = sal_False;
1794cdf0e10cSrcweir ASSERT( IsTxtFrm(), "line numbers are implemented for text only" );
1795cdf0e10cSrcweir InvalidatePage();
1796cdf0e10cSrcweir
1797cdf0e10cSrcweir // OD 2004-05-19 #i28701#
1798cdf0e10cSrcweir _ActionOnInvalidation( INVALID_LINENUM );
1799cdf0e10cSrcweir }
1800cdf0e10cSrcweir }
1801cdf0e10cSrcweir
1802cdf0e10cSrcweir /*************************************************************************
1803cdf0e10cSrcweir |*
1804cdf0e10cSrcweir |* SwFrm::ReinitializeFrmSizeAttrFlags
1805cdf0e10cSrcweir |*
1806cdf0e10cSrcweir |* Ersterstellung MA 15. Oct. 96
1807cdf0e10cSrcweir |* Letzte Aenderung MA 15. Oct. 96
1808cdf0e10cSrcweir |*
1809cdf0e10cSrcweir |*************************************************************************/
ReinitializeFrmSizeAttrFlags()1810cdf0e10cSrcweir void SwFrm::ReinitializeFrmSizeAttrFlags()
1811cdf0e10cSrcweir {
1812cdf0e10cSrcweir const SwFmtFrmSize &rFmtSize = GetAttrSet()->GetFrmSize();
1813cdf0e10cSrcweir if ( ATT_VAR_SIZE == rFmtSize.GetHeightSizeType() ||
1814cdf0e10cSrcweir ATT_MIN_SIZE == rFmtSize.GetHeightSizeType())
1815cdf0e10cSrcweir {
1816cdf0e10cSrcweir bFixSize = sal_False;
1817cdf0e10cSrcweir if ( GetType() & (FRM_HEADER | FRM_FOOTER | FRM_ROW) )
1818cdf0e10cSrcweir {
1819cdf0e10cSrcweir SwFrm *pFrm = ((SwLayoutFrm*)this)->Lower();
1820cdf0e10cSrcweir while ( pFrm )
1821cdf0e10cSrcweir { pFrm->_InvalidateSize();
1822cdf0e10cSrcweir pFrm->_InvalidatePrt();
1823cdf0e10cSrcweir pFrm = pFrm->GetNext();
1824cdf0e10cSrcweir }
1825cdf0e10cSrcweir SwCntntFrm *pCnt = ((SwLayoutFrm*)this)->ContainsCntnt();
1826cdf0e10cSrcweir // --> OD 2004-12-20 #i36991# - be save.
1827cdf0e10cSrcweir // E.g., a row can contain *no* content.
1828cdf0e10cSrcweir if ( pCnt )
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir pCnt->InvalidatePage();
1831cdf0e10cSrcweir do
1832cdf0e10cSrcweir {
1833cdf0e10cSrcweir pCnt->Prepare( PREP_ADJUST_FRM );
1834cdf0e10cSrcweir pCnt->_InvalidateSize();
1835cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
1836cdf0e10cSrcweir } while ( ((SwLayoutFrm*)this)->IsAnLower( pCnt ) );
1837cdf0e10cSrcweir }
1838cdf0e10cSrcweir // <--
1839cdf0e10cSrcweir }
1840cdf0e10cSrcweir }
1841cdf0e10cSrcweir else if ( rFmtSize.GetHeightSizeType() == ATT_FIX_SIZE )
1842cdf0e10cSrcweir {
1843cdf0e10cSrcweir if( IsVertical() )
1844cdf0e10cSrcweir ChgSize( Size( rFmtSize.GetWidth(), Frm().Height()));
1845cdf0e10cSrcweir else
1846cdf0e10cSrcweir ChgSize( Size( Frm().Width(), rFmtSize.GetHeight()));
1847cdf0e10cSrcweir }
1848cdf0e10cSrcweir }
1849cdf0e10cSrcweir
1850cdf0e10cSrcweir /*************************************************************************
1851cdf0e10cSrcweir |* SwFrm::ValidateThisAndAllLowers()
1852cdf0e10cSrcweir *
1853cdf0e10cSrcweir * FME 2007-08-30 #i81146# new loop control
1854cdf0e10cSrcweir |*************************************************************************/
ValidateThisAndAllLowers(const sal_uInt16 nStage)1855cdf0e10cSrcweir void SwFrm::ValidateThisAndAllLowers( const sal_uInt16 nStage )
1856cdf0e10cSrcweir {
1857cdf0e10cSrcweir // Stage 0: Only validate frames. Do not process any objects.
1858cdf0e10cSrcweir // Stage 1: Only validate fly frames and all of their contents.
1859cdf0e10cSrcweir // Stage 2: Validate all.
1860cdf0e10cSrcweir
1861cdf0e10cSrcweir const bool bOnlyObject = 1 == nStage;
1862cdf0e10cSrcweir const bool bIncludeObjects = 1 <= nStage;
1863cdf0e10cSrcweir
1864cdf0e10cSrcweir if ( !bOnlyObject || ISA(SwFlyFrm) )
1865cdf0e10cSrcweir {
1866cdf0e10cSrcweir bValidSize = sal_True;
1867cdf0e10cSrcweir bValidPrtArea = sal_True;
1868cdf0e10cSrcweir bValidPos = sal_True;
1869cdf0e10cSrcweir }
1870cdf0e10cSrcweir
1871cdf0e10cSrcweir if ( bIncludeObjects )
1872cdf0e10cSrcweir {
1873cdf0e10cSrcweir const SwSortedObjs* pObjs = GetDrawObjs();
1874cdf0e10cSrcweir if ( pObjs )
1875cdf0e10cSrcweir {
1876cdf0e10cSrcweir const sal_uInt32 nCnt = pObjs->Count();
1877cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < nCnt; ++i )
1878cdf0e10cSrcweir {
1879cdf0e10cSrcweir SwAnchoredObject* pAnchObj = (*pObjs)[i];
1880cdf0e10cSrcweir if ( pAnchObj->ISA(SwFlyFrm) )
1881cdf0e10cSrcweir static_cast<SwFlyFrm*>(pAnchObj)->ValidateThisAndAllLowers( 2 );
1882cdf0e10cSrcweir else if ( pAnchObj->ISA(SwAnchoredDrawObject) )
1883cdf0e10cSrcweir static_cast<SwAnchoredDrawObject*>(pAnchObj)->ValidateThis();
1884cdf0e10cSrcweir }
1885cdf0e10cSrcweir }
1886cdf0e10cSrcweir }
1887cdf0e10cSrcweir
1888cdf0e10cSrcweir if ( IsLayoutFrm() )
1889cdf0e10cSrcweir {
1890cdf0e10cSrcweir SwFrm* pLower = static_cast<SwLayoutFrm*>(this)->Lower();
1891cdf0e10cSrcweir while ( pLower )
1892cdf0e10cSrcweir {
1893cdf0e10cSrcweir pLower->ValidateThisAndAllLowers( nStage );
1894cdf0e10cSrcweir pLower = pLower->GetNext();
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir }
1897cdf0e10cSrcweir }
1898cdf0e10cSrcweir
1899cdf0e10cSrcweir /*************************************************************************
1900cdf0e10cSrcweir |*
1901cdf0e10cSrcweir |* SwCntntFrm::GrowFrm()
1902cdf0e10cSrcweir |*
1903cdf0e10cSrcweir |* Ersterstellung MA 30. Jul. 92
1904cdf0e10cSrcweir |* Letzte Aenderung MA 25. Mar. 99
1905cdf0e10cSrcweir |*
1906cdf0e10cSrcweir |*************************************************************************/
GrowFrm(SwTwips nDist,sal_Bool bTst,sal_Bool bInfo)1907cdf0e10cSrcweir SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
1908cdf0e10cSrcweir {
1909cdf0e10cSrcweir SWRECTFN( this )
1910cdf0e10cSrcweir
1911cdf0e10cSrcweir SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
1912cdf0e10cSrcweir if( nFrmHeight > 0 &&
1913cdf0e10cSrcweir nDist > (LONG_MAX - nFrmHeight ) )
1914cdf0e10cSrcweir nDist = LONG_MAX - nFrmHeight;
1915cdf0e10cSrcweir
1916cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
1917cdf0e10cSrcweir const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
1918cdf0e10cSrcweir const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
1919cdf0e10cSrcweir if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() )
1920cdf0e10cSrcweir {
1921cdf0e10cSrcweir if ( !bTst )
1922cdf0e10cSrcweir {
1923cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nFrmHeight + nDist );
1924cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1925cdf0e10cSrcweir if( IsVertical() && !IsVertLR() && !IsReverse() )
1926cdf0e10cSrcweir Frm().Pos().X() -= nDist;
1927cdf0e10cSrcweir if ( GetNext() )
1928cdf0e10cSrcweir {
1929cdf0e10cSrcweir GetNext()->InvalidatePos();
1930cdf0e10cSrcweir }
1931cdf0e10cSrcweir // --> OD 2004-07-05 #i28701# - Due to the new object positioning the
1932cdf0e10cSrcweir // frame on the next page/column can flow backward (e.g. it was moved forward
1933cdf0e10cSrcweir // due to the positioning of its objects ). Thus, invalivate this next frame,
1934cdf0e10cSrcweir // if document compatibility option 'Consider wrapping style influence on
1935cdf0e10cSrcweir // object positioning' is ON.
1936cdf0e10cSrcweir else if ( GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
1937cdf0e10cSrcweir {
1938cdf0e10cSrcweir InvalidateNextPos();
1939cdf0e10cSrcweir }
1940cdf0e10cSrcweir // <--
1941cdf0e10cSrcweir }
1942cdf0e10cSrcweir return 0;
1943cdf0e10cSrcweir }
1944cdf0e10cSrcweir
1945cdf0e10cSrcweir SwTwips nReal = (GetUpper()->Prt().*fnRect->fnGetHeight)();
1946cdf0e10cSrcweir SwFrm *pFrm = GetUpper()->Lower();
1947cdf0e10cSrcweir while( pFrm && nReal > 0 )
1948cdf0e10cSrcweir { nReal -= (pFrm->Frm().*fnRect->fnGetHeight)();
1949cdf0e10cSrcweir pFrm = pFrm->GetNext();
1950cdf0e10cSrcweir }
1951cdf0e10cSrcweir
1952cdf0e10cSrcweir if ( !bTst )
1953cdf0e10cSrcweir {
1954cdf0e10cSrcweir //Cntnts werden immer auf den gewuenschten Wert gebracht.
1955cdf0e10cSrcweir long nOld = (Frm().*fnRect->fnGetHeight)();
1956cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nOld + nDist );
1957cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1958cdf0e10cSrcweir if( IsVertical()&& !IsVertLR() && !IsReverse() )
1959cdf0e10cSrcweir Frm().Pos().X() -= nDist;
1960cdf0e10cSrcweir if ( nOld && IsInTab() )
1961cdf0e10cSrcweir {
1962cdf0e10cSrcweir SwTabFrm *pTab = FindTabFrm();
1963cdf0e10cSrcweir if ( pTab->GetTable()->GetHTMLTableLayout() &&
1964cdf0e10cSrcweir !pTab->IsJoinLocked() &&
1965cdf0e10cSrcweir !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
1966cdf0e10cSrcweir {
1967cdf0e10cSrcweir pTab->InvalidatePos();
1968cdf0e10cSrcweir pTab->SetResizeHTMLTable();
1969cdf0e10cSrcweir }
1970cdf0e10cSrcweir }
1971cdf0e10cSrcweir }
1972cdf0e10cSrcweir
1973cdf0e10cSrcweir //Upper nur growen wenn notwendig.
1974cdf0e10cSrcweir if ( nReal < nDist )
1975cdf0e10cSrcweir {
1976cdf0e10cSrcweir if( GetUpper() )
1977cdf0e10cSrcweir {
1978cdf0e10cSrcweir if( bTst || !GetUpper()->IsFooterFrm() )
1979cdf0e10cSrcweir nReal = GetUpper()->Grow( nDist - (nReal > 0 ? nReal : 0),
1980cdf0e10cSrcweir bTst, bInfo );
1981cdf0e10cSrcweir else
1982cdf0e10cSrcweir {
1983cdf0e10cSrcweir nReal = 0;
1984cdf0e10cSrcweir GetUpper()->InvalidateSize();
1985cdf0e10cSrcweir }
1986cdf0e10cSrcweir }
1987cdf0e10cSrcweir else
1988cdf0e10cSrcweir nReal = 0;
1989cdf0e10cSrcweir }
1990cdf0e10cSrcweir else
1991cdf0e10cSrcweir nReal = nDist;
1992cdf0e10cSrcweir
1993cdf0e10cSrcweir // --> OD 2004-07-05 #i28701# - Due to the new object positioning the
1994cdf0e10cSrcweir // frame on the next page/column can flow backward (e.g. it was moved forward
1995cdf0e10cSrcweir // due to the positioning of its objects ). Thus, invalivate this next frame,
1996cdf0e10cSrcweir // if document compatibility option 'Consider wrapping style influence on
1997cdf0e10cSrcweir // object positioning' is ON.
1998cdf0e10cSrcweir if ( !bTst )
1999cdf0e10cSrcweir {
2000cdf0e10cSrcweir if ( GetNext() )
2001cdf0e10cSrcweir {
2002cdf0e10cSrcweir GetNext()->InvalidatePos();
2003cdf0e10cSrcweir }
2004cdf0e10cSrcweir else if ( GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
2005cdf0e10cSrcweir {
2006cdf0e10cSrcweir InvalidateNextPos();
2007cdf0e10cSrcweir }
2008cdf0e10cSrcweir }
2009cdf0e10cSrcweir // <--
2010cdf0e10cSrcweir
2011cdf0e10cSrcweir return nReal;
2012cdf0e10cSrcweir }
2013cdf0e10cSrcweir
2014cdf0e10cSrcweir /*************************************************************************
2015cdf0e10cSrcweir |*
2016cdf0e10cSrcweir |* SwCntntFrm::ShrinkFrm()
2017cdf0e10cSrcweir |*
2018cdf0e10cSrcweir |* Ersterstellung MA 30. Jul. 92
2019cdf0e10cSrcweir |* Letzte Aenderung MA 05. May. 94
2020cdf0e10cSrcweir |*
2021cdf0e10cSrcweir |*************************************************************************/
ShrinkFrm(SwTwips nDist,sal_Bool bTst,sal_Bool bInfo)2022cdf0e10cSrcweir SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
2023cdf0e10cSrcweir {
2024cdf0e10cSrcweir SWRECTFN( this )
2025cdf0e10cSrcweir ASSERT( nDist >= 0, "nDist < 0" );
2026cdf0e10cSrcweir ASSERT( nDist <= (Frm().*fnRect->fnGetHeight)(),
2027cdf0e10cSrcweir "nDist > als aktuelle Grosse." );
2028cdf0e10cSrcweir
2029cdf0e10cSrcweir if ( !bTst )
2030cdf0e10cSrcweir {
2031cdf0e10cSrcweir SwTwips nRstHeight;
2032cdf0e10cSrcweir if( GetUpper() )
2033cdf0e10cSrcweir nRstHeight = (Frm().*fnRect->fnBottomDist)
2034cdf0e10cSrcweir ( (GetUpper()->*fnRect->fnGetPrtBottom)() );
2035cdf0e10cSrcweir else
2036cdf0e10cSrcweir nRstHeight = 0;
2037cdf0e10cSrcweir if( nRstHeight < 0 )
2038cdf0e10cSrcweir {
2039cdf0e10cSrcweir SwTwips nNextHeight = 0;
2040cdf0e10cSrcweir if( GetUpper()->IsSctFrm() && nDist > LONG_MAX/2 )
2041cdf0e10cSrcweir {
2042cdf0e10cSrcweir SwFrm *pNxt = GetNext();
2043cdf0e10cSrcweir while( pNxt )
2044cdf0e10cSrcweir {
2045cdf0e10cSrcweir nNextHeight += (pNxt->Frm().*fnRect->fnGetHeight)();
2046cdf0e10cSrcweir pNxt = pNxt->GetNext();
2047cdf0e10cSrcweir }
2048cdf0e10cSrcweir }
2049cdf0e10cSrcweir nRstHeight = nDist + nRstHeight - nNextHeight;
2050cdf0e10cSrcweir }
2051cdf0e10cSrcweir else
2052cdf0e10cSrcweir nRstHeight = nDist;
2053cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)() - nDist );
2054cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
2055cdf0e10cSrcweir if( IsVertical() && !IsVertLR() )
2056cdf0e10cSrcweir Frm().Pos().X() += nDist;
2057cdf0e10cSrcweir nDist = nRstHeight;
2058cdf0e10cSrcweir if ( IsInTab() )
2059cdf0e10cSrcweir {
2060cdf0e10cSrcweir SwTabFrm *pTab = FindTabFrm();
2061cdf0e10cSrcweir if ( pTab->GetTable()->GetHTMLTableLayout() &&
2062cdf0e10cSrcweir !pTab->IsJoinLocked() &&
2063cdf0e10cSrcweir !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
2064cdf0e10cSrcweir {
2065cdf0e10cSrcweir pTab->InvalidatePos();
2066cdf0e10cSrcweir pTab->SetResizeHTMLTable();
2067cdf0e10cSrcweir }
2068cdf0e10cSrcweir }
2069cdf0e10cSrcweir }
2070cdf0e10cSrcweir
2071cdf0e10cSrcweir SwTwips nReal;
2072cdf0e10cSrcweir if( GetUpper() && nDist > 0 )
2073cdf0e10cSrcweir {
2074cdf0e10cSrcweir if( bTst || !GetUpper()->IsFooterFrm() )
2075cdf0e10cSrcweir nReal = GetUpper()->Shrink( nDist, bTst, bInfo );
2076cdf0e10cSrcweir else
2077cdf0e10cSrcweir {
2078cdf0e10cSrcweir nReal = 0;
2079cdf0e10cSrcweir
2080cdf0e10cSrcweir // #108745# Sorry, dear old footer friend, I'm not gonna invalidate you,
2081cdf0e10cSrcweir // if there are any objects anchored inside your content, which
2082cdf0e10cSrcweir // overlap with the shrinking frame.
2083cdf0e10cSrcweir // This may lead to a footer frame that is too big, but this is better
2084cdf0e10cSrcweir // than looping.
2085cdf0e10cSrcweir // #109722# : The fix for #108745# was too strict.
2086cdf0e10cSrcweir
2087cdf0e10cSrcweir bool bInvalidate = true;
2088cdf0e10cSrcweir const SwRect aRect( Frm() );
2089cdf0e10cSrcweir const SwPageFrm* pPage = FindPageFrm();
2090cdf0e10cSrcweir const SwSortedObjs* pSorted = pPage ? pPage->GetSortedObjs() : 0;
2091cdf0e10cSrcweir if( pSorted )
2092cdf0e10cSrcweir {
2093cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pSorted->Count(); ++i )
2094cdf0e10cSrcweir {
2095cdf0e10cSrcweir const SwAnchoredObject* pAnchoredObj = (*pSorted)[i];
2096cdf0e10cSrcweir const SwRect aBound( pAnchoredObj->GetObjRectWithSpaces() );
2097cdf0e10cSrcweir
2098cdf0e10cSrcweir if( aBound.Left() > aRect.Right() )
2099cdf0e10cSrcweir continue;
2100cdf0e10cSrcweir
2101cdf0e10cSrcweir if( aBound.IsOver( aRect ) )
2102cdf0e10cSrcweir {
2103cdf0e10cSrcweir const SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
2104cdf0e10cSrcweir if( SURROUND_THROUGHT != rFmt.GetSurround().GetSurround() )
2105cdf0e10cSrcweir {
2106cdf0e10cSrcweir const SwFrm* pAnchor = pAnchoredObj->GetAnchorFrm();
2107cdf0e10cSrcweir if ( pAnchor && pAnchor->FindFooterOrHeader() == GetUpper() )
2108cdf0e10cSrcweir {
2109cdf0e10cSrcweir bInvalidate = false;
2110cdf0e10cSrcweir break;
2111cdf0e10cSrcweir }
2112cdf0e10cSrcweir }
2113cdf0e10cSrcweir }
2114cdf0e10cSrcweir }
2115cdf0e10cSrcweir }
2116cdf0e10cSrcweir
2117cdf0e10cSrcweir if ( bInvalidate )
2118cdf0e10cSrcweir GetUpper()->InvalidateSize();
2119cdf0e10cSrcweir }
2120cdf0e10cSrcweir }
2121cdf0e10cSrcweir else
2122cdf0e10cSrcweir nReal = 0;
2123cdf0e10cSrcweir
2124cdf0e10cSrcweir if ( !bTst )
2125cdf0e10cSrcweir {
2126cdf0e10cSrcweir //Die Position des naechsten Frm's veraendert sich auf jeden Fall.
2127cdf0e10cSrcweir InvalidateNextPos();
2128cdf0e10cSrcweir
2129cdf0e10cSrcweir //Wenn ich keinen Nachfolger habe, so muss ich mich eben selbst um
2130cdf0e10cSrcweir //die Retusche kuemmern.
2131cdf0e10cSrcweir if ( !GetNext() )
2132cdf0e10cSrcweir SetRetouche();
2133cdf0e10cSrcweir }
2134cdf0e10cSrcweir return nReal;
2135cdf0e10cSrcweir }
2136cdf0e10cSrcweir
2137cdf0e10cSrcweir /*************************************************************************
2138cdf0e10cSrcweir |*
2139cdf0e10cSrcweir |* SwCntntFrm::Modify()
2140cdf0e10cSrcweir |*
2141cdf0e10cSrcweir |* Beschreibung
2142cdf0e10cSrcweir |* Ersterstellung AK 05-Mar-1991
2143cdf0e10cSrcweir |* Letzte Aenderung MA 13. Oct. 95
2144cdf0e10cSrcweir |*
2145cdf0e10cSrcweir |*************************************************************************/
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)2146cdf0e10cSrcweir void SwCntntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
2147cdf0e10cSrcweir {
2148cdf0e10cSrcweir sal_uInt8 nInvFlags = 0;
2149cdf0e10cSrcweir
2150cdf0e10cSrcweir if( pNew && RES_ATTRSET_CHG == pNew->Which() )
2151cdf0e10cSrcweir {
2152cdf0e10cSrcweir SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
2153cdf0e10cSrcweir SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
2154cdf0e10cSrcweir SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
2155cdf0e10cSrcweir SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
2156cdf0e10cSrcweir while( sal_True )
2157cdf0e10cSrcweir {
2158cdf0e10cSrcweir _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
2159cdf0e10cSrcweir (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
2160cdf0e10cSrcweir &aOldSet, &aNewSet );
2161cdf0e10cSrcweir if( aNIter.IsAtEnd() )
2162cdf0e10cSrcweir break;
2163cdf0e10cSrcweir aNIter.NextItem();
2164cdf0e10cSrcweir aOIter.NextItem();
2165cdf0e10cSrcweir }
2166cdf0e10cSrcweir if ( aOldSet.Count() || aNewSet.Count() )
2167cdf0e10cSrcweir SwFrm::Modify( &aOldSet, &aNewSet );
2168cdf0e10cSrcweir }
2169cdf0e10cSrcweir else
2170cdf0e10cSrcweir _UpdateAttr( pOld, pNew, nInvFlags );
2171cdf0e10cSrcweir
2172cdf0e10cSrcweir if ( nInvFlags != 0 )
2173cdf0e10cSrcweir {
2174cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
2175cdf0e10cSrcweir InvalidatePage( pPage );
2176cdf0e10cSrcweir if ( nInvFlags & 0x01 )
2177cdf0e10cSrcweir SetCompletePaint();
2178cdf0e10cSrcweir if ( nInvFlags & 0x02 )
2179cdf0e10cSrcweir _InvalidatePos();
2180cdf0e10cSrcweir if ( nInvFlags & 0x04 )
2181cdf0e10cSrcweir _InvalidateSize();
2182cdf0e10cSrcweir if ( nInvFlags & 0x88 )
2183cdf0e10cSrcweir {
2184cdf0e10cSrcweir if( IsInSct() && !GetPrev() )
2185cdf0e10cSrcweir {
2186cdf0e10cSrcweir SwSectionFrm *pSect = FindSctFrm();
2187cdf0e10cSrcweir if( pSect->ContainsAny() == this )
2188cdf0e10cSrcweir {
2189cdf0e10cSrcweir pSect->_InvalidatePrt();
2190cdf0e10cSrcweir pSect->InvalidatePage( pPage );
2191cdf0e10cSrcweir }
2192cdf0e10cSrcweir }
2193cdf0e10cSrcweir _InvalidatePrt();
2194cdf0e10cSrcweir }
2195cdf0e10cSrcweir SwFrm* pNextFrm = GetIndNext();
2196cdf0e10cSrcweir if ( pNextFrm && nInvFlags & 0x10)
2197cdf0e10cSrcweir {
2198cdf0e10cSrcweir pNextFrm->_InvalidatePrt();
2199cdf0e10cSrcweir pNextFrm->InvalidatePage( pPage );
2200cdf0e10cSrcweir }
2201cdf0e10cSrcweir if ( pNextFrm && nInvFlags & 0x80 )
2202cdf0e10cSrcweir {
2203cdf0e10cSrcweir pNextFrm->SetCompletePaint();
2204cdf0e10cSrcweir }
2205cdf0e10cSrcweir if ( nInvFlags & 0x20 )
2206cdf0e10cSrcweir {
2207cdf0e10cSrcweir SwFrm* pPrevFrm = GetPrev();
2208cdf0e10cSrcweir if ( pPrevFrm )
2209cdf0e10cSrcweir {
2210cdf0e10cSrcweir pPrevFrm->_InvalidatePrt();
2211cdf0e10cSrcweir pPrevFrm->InvalidatePage( pPage );
2212cdf0e10cSrcweir }
2213cdf0e10cSrcweir }
2214cdf0e10cSrcweir if ( nInvFlags & 0x40 )
2215cdf0e10cSrcweir InvalidateNextPos();
2216cdf0e10cSrcweir }
2217cdf0e10cSrcweir }
2218cdf0e10cSrcweir
_UpdateAttr(const SfxPoolItem * pOld,const SfxPoolItem * pNew,sal_uInt8 & rInvFlags,SwAttrSetChg * pOldSet,SwAttrSetChg * pNewSet)2219cdf0e10cSrcweir void SwCntntFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew,
2220cdf0e10cSrcweir sal_uInt8 &rInvFlags,
2221cdf0e10cSrcweir SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
2222cdf0e10cSrcweir {
2223cdf0e10cSrcweir sal_Bool bClear = sal_True;
2224cdf0e10cSrcweir sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
2225cdf0e10cSrcweir switch ( nWhich )
2226cdf0e10cSrcweir {
2227cdf0e10cSrcweir case RES_FMT_CHG:
2228cdf0e10cSrcweir rInvFlags = 0xFF;
2229cdf0e10cSrcweir /* kein break hier */
2230cdf0e10cSrcweir
2231cdf0e10cSrcweir case RES_PAGEDESC: //Attributaenderung (an/aus)
2232cdf0e10cSrcweir if ( IsInDocBody() && !IsInTab() )
2233cdf0e10cSrcweir {
2234cdf0e10cSrcweir rInvFlags |= 0x02;
2235cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
2236cdf0e10cSrcweir if ( !GetPrev() )
2237cdf0e10cSrcweir CheckPageDescs( pPage );
2238cdf0e10cSrcweir if ( pPage && GetAttrSet()->GetPageDesc().GetNumOffset() )
2239cdf0e10cSrcweir ((SwRootFrm*)pPage->GetUpper())->SetVirtPageNum( sal_True );
2240cdf0e10cSrcweir SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
2241cdf0e10cSrcweir pPage->GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
2242cdf0e10cSrcweir }
2243cdf0e10cSrcweir break;
2244cdf0e10cSrcweir
2245cdf0e10cSrcweir case RES_UL_SPACE:
2246cdf0e10cSrcweir {
2247cdf0e10cSrcweir // OD 2004-02-18 #106629# - correction
2248cdf0e10cSrcweir // Invalidation of the printing area of next frame, not only
2249cdf0e10cSrcweir // for footnote content.
2250cdf0e10cSrcweir if ( !GetIndNext() )
2251cdf0e10cSrcweir {
2252cdf0e10cSrcweir SwFrm* pNxt = FindNext();
2253cdf0e10cSrcweir if ( pNxt )
2254cdf0e10cSrcweir {
2255cdf0e10cSrcweir SwPageFrm* pPg = pNxt->FindPageFrm();
2256cdf0e10cSrcweir pNxt->InvalidatePage( pPg );
2257cdf0e10cSrcweir pNxt->_InvalidatePrt();
2258cdf0e10cSrcweir if( pNxt->IsSctFrm() )
2259cdf0e10cSrcweir {
2260cdf0e10cSrcweir SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
2261cdf0e10cSrcweir if( pCnt )
2262cdf0e10cSrcweir {
2263cdf0e10cSrcweir pCnt->_InvalidatePrt();
2264cdf0e10cSrcweir pCnt->InvalidatePage( pPg );
2265cdf0e10cSrcweir }
2266cdf0e10cSrcweir }
2267cdf0e10cSrcweir pNxt->SetCompletePaint();
2268cdf0e10cSrcweir }
2269cdf0e10cSrcweir }
2270cdf0e10cSrcweir // OD 2004-03-17 #i11860#
2271cdf0e10cSrcweir if ( GetIndNext() &&
2272cdf0e10cSrcweir !GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) )
2273cdf0e10cSrcweir {
2274cdf0e10cSrcweir // OD 2004-07-01 #i28701# - use new method <InvalidateObjs(..)>
2275cdf0e10cSrcweir GetIndNext()->InvalidateObjs( true );
2276cdf0e10cSrcweir }
2277cdf0e10cSrcweir Prepare( PREP_UL_SPACE ); //TxtFrm muss Zeilenabst. korrigieren.
2278cdf0e10cSrcweir rInvFlags |= 0x80;
2279cdf0e10cSrcweir /* kein Break hier */
2280cdf0e10cSrcweir }
2281cdf0e10cSrcweir case RES_LR_SPACE:
2282cdf0e10cSrcweir case RES_BOX:
2283cdf0e10cSrcweir case RES_SHADOW:
2284cdf0e10cSrcweir Prepare( PREP_FIXSIZE_CHG );
2285cdf0e10cSrcweir SwFrm::Modify( pOld, pNew );
2286cdf0e10cSrcweir rInvFlags |= 0x30;
2287cdf0e10cSrcweir break;
2288cdf0e10cSrcweir
2289cdf0e10cSrcweir case RES_BREAK:
2290cdf0e10cSrcweir {
2291cdf0e10cSrcweir rInvFlags |= 0x42;
2292cdf0e10cSrcweir const IDocumentSettingAccess* pIDSA = GetUpper()->GetFmt()->getIDocumentSettingAccess();
2293cdf0e10cSrcweir if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) ||
2294cdf0e10cSrcweir pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) )
2295cdf0e10cSrcweir {
2296cdf0e10cSrcweir rInvFlags |= 0x1;
2297cdf0e10cSrcweir SwFrm* pNxt = FindNext();
2298cdf0e10cSrcweir if( pNxt )
2299cdf0e10cSrcweir {
2300cdf0e10cSrcweir SwPageFrm* pPg = pNxt->FindPageFrm();
2301cdf0e10cSrcweir pNxt->InvalidatePage( pPg );
2302cdf0e10cSrcweir pNxt->_InvalidatePrt();
2303cdf0e10cSrcweir if( pNxt->IsSctFrm() )
2304cdf0e10cSrcweir {
2305cdf0e10cSrcweir SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
2306cdf0e10cSrcweir if( pCnt )
2307cdf0e10cSrcweir {
2308cdf0e10cSrcweir pCnt->_InvalidatePrt();
2309cdf0e10cSrcweir pCnt->InvalidatePage( pPg );
2310cdf0e10cSrcweir }
2311cdf0e10cSrcweir }
2312cdf0e10cSrcweir pNxt->SetCompletePaint();
2313cdf0e10cSrcweir }
2314cdf0e10cSrcweir }
2315cdf0e10cSrcweir }
2316cdf0e10cSrcweir break;
2317cdf0e10cSrcweir
2318cdf0e10cSrcweir // OD 2004-02-26 #i25029#
2319cdf0e10cSrcweir case RES_PARATR_CONNECT_BORDER:
2320cdf0e10cSrcweir {
2321cdf0e10cSrcweir rInvFlags |= 0x01;
2322cdf0e10cSrcweir if ( IsTxtFrm() )
2323cdf0e10cSrcweir {
2324cdf0e10cSrcweir InvalidateNextPrtArea();
2325cdf0e10cSrcweir }
2326cdf0e10cSrcweir if ( !GetIndNext() && IsInTab() && IsInSplitTableRow() )
2327cdf0e10cSrcweir {
2328cdf0e10cSrcweir FindTabFrm()->InvalidateSize();
2329cdf0e10cSrcweir }
2330cdf0e10cSrcweir }
2331cdf0e10cSrcweir break;
2332cdf0e10cSrcweir
2333cdf0e10cSrcweir case RES_PARATR_TABSTOP:
2334cdf0e10cSrcweir case RES_CHRATR_PROPORTIONALFONTSIZE:
2335cdf0e10cSrcweir case RES_CHRATR_SHADOWED:
2336cdf0e10cSrcweir case RES_CHRATR_AUTOKERN:
2337cdf0e10cSrcweir case RES_CHRATR_UNDERLINE:
2338cdf0e10cSrcweir case RES_CHRATR_OVERLINE:
2339cdf0e10cSrcweir case RES_CHRATR_KERNING:
2340cdf0e10cSrcweir case RES_CHRATR_FONT:
2341cdf0e10cSrcweir case RES_CHRATR_FONTSIZE:
2342cdf0e10cSrcweir case RES_CHRATR_ESCAPEMENT:
2343cdf0e10cSrcweir case RES_CHRATR_CONTOUR:
2344cdf0e10cSrcweir case RES_PARATR_NUMRULE:
2345cdf0e10cSrcweir rInvFlags |= 0x01;
2346cdf0e10cSrcweir break;
2347cdf0e10cSrcweir
2348cdf0e10cSrcweir
2349cdf0e10cSrcweir case RES_FRM_SIZE:
2350cdf0e10cSrcweir rInvFlags |= 0x01;
2351cdf0e10cSrcweir /* no break here */
2352cdf0e10cSrcweir
2353cdf0e10cSrcweir default:
2354cdf0e10cSrcweir bClear = sal_False;
2355cdf0e10cSrcweir }
2356cdf0e10cSrcweir if ( bClear )
2357cdf0e10cSrcweir {
2358cdf0e10cSrcweir if ( pOldSet || pNewSet )
2359cdf0e10cSrcweir {
2360cdf0e10cSrcweir if ( pOldSet )
2361cdf0e10cSrcweir pOldSet->ClearItem( nWhich );
2362cdf0e10cSrcweir if ( pNewSet )
2363cdf0e10cSrcweir pNewSet->ClearItem( nWhich );
2364cdf0e10cSrcweir }
2365cdf0e10cSrcweir else
2366cdf0e10cSrcweir SwFrm::Modify( pOld, pNew );
2367cdf0e10cSrcweir }
2368cdf0e10cSrcweir }
2369cdf0e10cSrcweir
2370cdf0e10cSrcweir /*************************************************************************
2371cdf0e10cSrcweir |*
2372cdf0e10cSrcweir |* SwLayoutFrm::SwLayoutFrm()
2373cdf0e10cSrcweir |*
2374cdf0e10cSrcweir |* Ersterstellung AK 14-Feb-1991
2375cdf0e10cSrcweir |* Letzte Aenderung MA 12. May. 95
2376cdf0e10cSrcweir |*
2377cdf0e10cSrcweir |*************************************************************************/
SwLayoutFrm(SwFrmFmt * pFmt,SwFrm * pSib)2378cdf0e10cSrcweir SwLayoutFrm::SwLayoutFrm( SwFrmFmt* pFmt, SwFrm* pSib ):
2379cdf0e10cSrcweir SwFrm( pFmt, pSib ),
2380cdf0e10cSrcweir pLower( 0 )
2381cdf0e10cSrcweir {
2382cdf0e10cSrcweir const SwFmtFrmSize &rFmtSize = pFmt->GetFrmSize();
2383cdf0e10cSrcweir if ( rFmtSize.GetHeightSizeType() == ATT_FIX_SIZE )
2384cdf0e10cSrcweir bFixSize = sal_True;
2385cdf0e10cSrcweir }
2386cdf0e10cSrcweir
2387cdf0e10cSrcweir // --> OD 2004-06-29 #i28701#
2388cdf0e10cSrcweir TYPEINIT1(SwLayoutFrm,SwFrm);
2389cdf0e10cSrcweir // <--
2390cdf0e10cSrcweir /*-----------------10.06.99 09:42-------------------
2391cdf0e10cSrcweir * SwLayoutFrm::InnerHeight()
2392cdf0e10cSrcweir * --------------------------------------------------*/
2393cdf0e10cSrcweir
InnerHeight() const2394cdf0e10cSrcweir SwTwips SwLayoutFrm::InnerHeight() const
2395cdf0e10cSrcweir {
2396cdf0e10cSrcweir if( !Lower() )
2397cdf0e10cSrcweir return 0;
2398cdf0e10cSrcweir SwTwips nRet = 0;
2399cdf0e10cSrcweir const SwFrm* pCnt = Lower();
2400cdf0e10cSrcweir SWRECTFN( this )
2401cdf0e10cSrcweir if( pCnt->IsColumnFrm() || pCnt->IsCellFrm() )
2402cdf0e10cSrcweir {
2403cdf0e10cSrcweir do
2404cdf0e10cSrcweir {
2405cdf0e10cSrcweir SwTwips nTmp = ((SwLayoutFrm*)pCnt)->InnerHeight();
2406cdf0e10cSrcweir if( pCnt->GetValidPrtAreaFlag() )
2407cdf0e10cSrcweir nTmp += (pCnt->Frm().*fnRect->fnGetHeight)() -
2408cdf0e10cSrcweir (pCnt->Prt().*fnRect->fnGetHeight)();
2409cdf0e10cSrcweir if( nRet < nTmp )
2410cdf0e10cSrcweir nRet = nTmp;
2411cdf0e10cSrcweir pCnt = pCnt->GetNext();
2412cdf0e10cSrcweir } while ( pCnt );
2413cdf0e10cSrcweir }
2414cdf0e10cSrcweir else
2415cdf0e10cSrcweir {
2416cdf0e10cSrcweir do
2417cdf0e10cSrcweir {
2418cdf0e10cSrcweir nRet += (pCnt->Frm().*fnRect->fnGetHeight)();
2419cdf0e10cSrcweir if( pCnt->IsCntntFrm() && ((SwTxtFrm*)pCnt)->IsUndersized() )
2420cdf0e10cSrcweir nRet += ((SwTxtFrm*)pCnt)->GetParHeight() -
2421cdf0e10cSrcweir (pCnt->Prt().*fnRect->fnGetHeight)();
2422cdf0e10cSrcweir if( pCnt->IsLayoutFrm() && !pCnt->IsTabFrm() )
2423cdf0e10cSrcweir nRet += ((SwLayoutFrm*)pCnt)->InnerHeight() -
2424cdf0e10cSrcweir (pCnt->Prt().*fnRect->fnGetHeight)();
2425cdf0e10cSrcweir pCnt = pCnt->GetNext();
2426cdf0e10cSrcweir } while( pCnt );
2427cdf0e10cSrcweir
2428cdf0e10cSrcweir }
2429cdf0e10cSrcweir return nRet;
2430cdf0e10cSrcweir }
2431cdf0e10cSrcweir
2432cdf0e10cSrcweir /*************************************************************************
2433cdf0e10cSrcweir |*
2434cdf0e10cSrcweir |* SwLayoutFrm::GrowFrm()
2435cdf0e10cSrcweir |*
2436cdf0e10cSrcweir |* Ersterstellung MA 30. Jul. 92
2437cdf0e10cSrcweir |* Letzte Aenderung MA 23. Sep. 96
2438cdf0e10cSrcweir |*
2439cdf0e10cSrcweir |*************************************************************************/
GrowFrm(SwTwips nDist,sal_Bool bTst,sal_Bool bInfo)2440cdf0e10cSrcweir SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
2441cdf0e10cSrcweir {
2442cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
2443cdf0e10cSrcweir const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
2444cdf0e10cSrcweir const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
2445cdf0e10cSrcweir if( !(GetType() & nTmpType) && HasFixSize() )
2446cdf0e10cSrcweir return 0;
2447cdf0e10cSrcweir
2448cdf0e10cSrcweir SWRECTFN( this )
2449cdf0e10cSrcweir const SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
2450cdf0e10cSrcweir const SwTwips nFrmPos = Frm().Pos().X();
2451cdf0e10cSrcweir
2452cdf0e10cSrcweir if ( nFrmHeight > 0 && nDist > (LONG_MAX - nFrmHeight) )
2453cdf0e10cSrcweir nDist = LONG_MAX - nFrmHeight;
2454cdf0e10cSrcweir
2455cdf0e10cSrcweir SwTwips nMin = 0;
2456cdf0e10cSrcweir if ( GetUpper() && !IsCellFrm() )
2457cdf0e10cSrcweir {
2458cdf0e10cSrcweir SwFrm *pFrm = GetUpper()->Lower();
2459cdf0e10cSrcweir while( pFrm )
2460cdf0e10cSrcweir { nMin += (pFrm->Frm().*fnRect->fnGetHeight)();
2461cdf0e10cSrcweir pFrm = pFrm->GetNext();
2462cdf0e10cSrcweir }
2463cdf0e10cSrcweir nMin = (GetUpper()->Prt().*fnRect->fnGetHeight)() - nMin;
2464cdf0e10cSrcweir if ( nMin < 0 )
2465cdf0e10cSrcweir nMin = 0;
2466cdf0e10cSrcweir }
2467cdf0e10cSrcweir
2468cdf0e10cSrcweir SwRect aOldFrm( Frm() );
2469cdf0e10cSrcweir sal_Bool bMoveAccFrm = sal_False;
2470cdf0e10cSrcweir
2471cdf0e10cSrcweir sal_Bool bChgPos = IsVertical() && !IsReverse();
2472cdf0e10cSrcweir if ( !bTst )
2473cdf0e10cSrcweir {
2474cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nFrmHeight + nDist );
2475cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
2476cdf0e10cSrcweir if( bChgPos && !IsVertLR() )
2477cdf0e10cSrcweir Frm().Pos().X() -= nDist;
2478cdf0e10cSrcweir bMoveAccFrm = sal_True;
2479cdf0e10cSrcweir }
2480cdf0e10cSrcweir
2481cdf0e10cSrcweir SwTwips nReal = nDist - nMin;
2482cdf0e10cSrcweir if ( nReal > 0 )
2483cdf0e10cSrcweir {
2484cdf0e10cSrcweir if ( GetUpper() )
2485cdf0e10cSrcweir { // AdjustNeighbourhood jetzt auch in Spalten (aber nicht in Rahmen)
2486cdf0e10cSrcweir sal_uInt8 nAdjust = GetUpper()->IsFtnBossFrm() ?
2487cdf0e10cSrcweir ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
2488cdf0e10cSrcweir : NA_GROW_SHRINK;
2489cdf0e10cSrcweir if( NA_ONLY_ADJUST == nAdjust )
2490cdf0e10cSrcweir nReal = AdjustNeighbourhood( nReal, bTst );
2491cdf0e10cSrcweir else
2492cdf0e10cSrcweir {
2493cdf0e10cSrcweir if( NA_ADJUST_GROW == nAdjust )
2494cdf0e10cSrcweir nReal += AdjustNeighbourhood( nReal, bTst );
2495cdf0e10cSrcweir
2496cdf0e10cSrcweir SwTwips nGrow = 0;
2497cdf0e10cSrcweir if( 0 < nReal )
2498cdf0e10cSrcweir {
2499cdf0e10cSrcweir SwFrm* pToGrow = GetUpper();
2500cdf0e10cSrcweir // NEW TABLES
2501cdf0e10cSrcweir // A cell with a row span of > 1 is allowed to grow the
2502cdf0e10cSrcweir // line containing the end of the row span if it is
2503cdf0e10cSrcweir // located in the same table frame:
2504cdf0e10cSrcweir const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
2505cdf0e10cSrcweir if ( pThisCell && pThisCell->GetLayoutRowSpan() > 1 )
2506cdf0e10cSrcweir {
2507cdf0e10cSrcweir SwCellFrm& rEndCell = const_cast<SwCellFrm&>(pThisCell->FindStartEndOfRowSpanCell( false, true ));
2508cdf0e10cSrcweir if ( -1 == rEndCell.GetTabBox()->getRowSpan() )
2509cdf0e10cSrcweir pToGrow = rEndCell.GetUpper();
2510cdf0e10cSrcweir else
2511cdf0e10cSrcweir pToGrow = 0;
2512cdf0e10cSrcweir }
2513cdf0e10cSrcweir
2514cdf0e10cSrcweir nGrow = pToGrow ? pToGrow->Grow( nReal, bTst, bInfo ) : 0;
2515cdf0e10cSrcweir }
2516cdf0e10cSrcweir
2517cdf0e10cSrcweir if( NA_GROW_ADJUST == nAdjust && nGrow < nReal )
2518cdf0e10cSrcweir nReal += AdjustNeighbourhood( nReal - nGrow, bTst );
2519cdf0e10cSrcweir
2520cdf0e10cSrcweir if ( IsFtnFrm() && (nGrow != nReal) && GetNext() )
2521cdf0e10cSrcweir {
2522cdf0e10cSrcweir //Fussnoten koennen ihre Nachfolger verdraengen.
2523cdf0e10cSrcweir SwTwips nSpace = bTst ? 0 : -nDist;
2524cdf0e10cSrcweir const SwFrm *pFrm = GetUpper()->Lower();
2525cdf0e10cSrcweir do
2526cdf0e10cSrcweir { nSpace += (pFrm->Frm().*fnRect->fnGetHeight)();
2527cdf0e10cSrcweir pFrm = pFrm->GetNext();
2528cdf0e10cSrcweir } while ( pFrm != GetNext() );
2529cdf0e10cSrcweir nSpace = (GetUpper()->Prt().*fnRect->fnGetHeight)() -nSpace;
2530cdf0e10cSrcweir if ( nSpace < 0 )
2531cdf0e10cSrcweir nSpace = 0;
2532cdf0e10cSrcweir nSpace += nGrow;
2533cdf0e10cSrcweir if ( nReal > nSpace )
2534cdf0e10cSrcweir nReal = nSpace;
2535cdf0e10cSrcweir if ( nReal && !bTst )
2536cdf0e10cSrcweir ((SwFtnFrm*)this)->InvalidateNxtFtnCnts( FindPageFrm() );
2537cdf0e10cSrcweir }
2538cdf0e10cSrcweir else
2539cdf0e10cSrcweir nReal = nGrow;
2540cdf0e10cSrcweir }
2541cdf0e10cSrcweir }
2542cdf0e10cSrcweir else
2543cdf0e10cSrcweir nReal = 0;
2544cdf0e10cSrcweir
2545cdf0e10cSrcweir nReal += nMin;
2546cdf0e10cSrcweir }
2547cdf0e10cSrcweir else
2548cdf0e10cSrcweir nReal = nDist;
2549cdf0e10cSrcweir
2550cdf0e10cSrcweir if ( !bTst )
2551cdf0e10cSrcweir {
2552cdf0e10cSrcweir if( nReal != nDist &&
2553cdf0e10cSrcweir // NEW TABLES
2554cdf0e10cSrcweir ( !IsCellFrm() || static_cast<SwCellFrm*>(this)->GetLayoutRowSpan() > 1 ) )
2555cdf0e10cSrcweir {
2556cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nFrmHeight + nReal );
2557cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
2558cdf0e10cSrcweir if( bChgPos && !IsVertLR() )
2559cdf0e10cSrcweir Frm().Pos().X() = nFrmPos - nReal;
2560cdf0e10cSrcweir bMoveAccFrm = sal_True;
2561cdf0e10cSrcweir }
2562cdf0e10cSrcweir
2563cdf0e10cSrcweir if ( nReal )
2564cdf0e10cSrcweir {
2565cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
2566cdf0e10cSrcweir if ( GetNext() )
2567cdf0e10cSrcweir {
2568cdf0e10cSrcweir GetNext()->_InvalidatePos();
2569cdf0e10cSrcweir if ( GetNext()->IsCntntFrm() )
2570cdf0e10cSrcweir GetNext()->InvalidatePage( pPage );
2571cdf0e10cSrcweir }
2572cdf0e10cSrcweir if ( !IsPageBodyFrm() )
2573cdf0e10cSrcweir {
2574cdf0e10cSrcweir _InvalidateAll();
2575cdf0e10cSrcweir InvalidatePage( pPage );
2576cdf0e10cSrcweir }
2577cdf0e10cSrcweir if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
2578cdf0e10cSrcweir NotifyLowerObjs();
2579cdf0e10cSrcweir
2580cdf0e10cSrcweir if( IsCellFrm() )
2581cdf0e10cSrcweir InvaPercentLowers( nReal );
2582cdf0e10cSrcweir
2583cdf0e10cSrcweir const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
2584cdf0e10cSrcweir if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
2585cdf0e10cSrcweir SetCompletePaint();
2586cdf0e10cSrcweir }
2587cdf0e10cSrcweir }
2588cdf0e10cSrcweir
2589cdf0e10cSrcweir if( bMoveAccFrm && IsAccessibleFrm() )
2590cdf0e10cSrcweir {
2591cdf0e10cSrcweir SwRootFrm *pRootFrm = getRootFrm();
2592cdf0e10cSrcweir if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
2593cdf0e10cSrcweir pRootFrm->GetCurrShell() )
2594cdf0e10cSrcweir {
2595cdf0e10cSrcweir pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
2596cdf0e10cSrcweir }
2597cdf0e10cSrcweir }
2598cdf0e10cSrcweir return nReal;
2599cdf0e10cSrcweir }
2600cdf0e10cSrcweir
2601cdf0e10cSrcweir /*************************************************************************
2602cdf0e10cSrcweir |*
2603cdf0e10cSrcweir |* SwLayoutFrm::ShrinkFrm()
2604cdf0e10cSrcweir |*
2605cdf0e10cSrcweir |* Ersterstellung MA 30. Jul. 92
2606cdf0e10cSrcweir |* Letzte Aenderung MA 25. Mar. 99
2607cdf0e10cSrcweir |*
2608cdf0e10cSrcweir |*************************************************************************/
ShrinkFrm(SwTwips nDist,sal_Bool bTst,sal_Bool bInfo)2609cdf0e10cSrcweir SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
2610cdf0e10cSrcweir {
2611cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
2612cdf0e10cSrcweir const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
2613cdf0e10cSrcweir const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
2614cdf0e10cSrcweir if( !(GetType() & nTmpType) && HasFixSize() )
2615cdf0e10cSrcweir return 0;
2616cdf0e10cSrcweir
2617cdf0e10cSrcweir ASSERT( nDist >= 0, "nDist < 0" );
2618cdf0e10cSrcweir SWRECTFN( this )
2619cdf0e10cSrcweir SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
2620cdf0e10cSrcweir if ( nDist > nFrmHeight )
2621cdf0e10cSrcweir nDist = nFrmHeight;
2622cdf0e10cSrcweir
2623cdf0e10cSrcweir SwTwips nMin = 0;
2624cdf0e10cSrcweir sal_Bool bChgPos = IsVertical() && !IsReverse();
2625cdf0e10cSrcweir if ( Lower() )
2626cdf0e10cSrcweir {
2627cdf0e10cSrcweir if( !Lower()->IsNeighbourFrm() )
2628cdf0e10cSrcweir { const SwFrm *pFrm = Lower();
2629cdf0e10cSrcweir const long nTmp = (Prt().*fnRect->fnGetHeight)();
2630cdf0e10cSrcweir while( pFrm && nMin < nTmp )
2631cdf0e10cSrcweir { nMin += (pFrm->Frm().*fnRect->fnGetHeight)();
2632cdf0e10cSrcweir pFrm = pFrm->GetNext();
2633cdf0e10cSrcweir }
2634cdf0e10cSrcweir }
2635cdf0e10cSrcweir }
2636cdf0e10cSrcweir SwTwips nReal = nDist;
2637cdf0e10cSrcweir SwTwips nMinDiff = (Prt().*fnRect->fnGetHeight)() - nMin;
2638cdf0e10cSrcweir if( nReal > nMinDiff )
2639cdf0e10cSrcweir nReal = nMinDiff;
2640cdf0e10cSrcweir if( nReal <= 0 )
2641cdf0e10cSrcweir return nDist;
2642cdf0e10cSrcweir
2643cdf0e10cSrcweir SwRect aOldFrm( Frm() );
2644cdf0e10cSrcweir sal_Bool bMoveAccFrm = sal_False;
2645cdf0e10cSrcweir
2646cdf0e10cSrcweir SwTwips nRealDist = nReal;
2647cdf0e10cSrcweir if ( !bTst )
2648cdf0e10cSrcweir {
2649cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( nFrmHeight - nReal );
2650cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
2651cdf0e10cSrcweir if( bChgPos && !IsVertLR() )
2652cdf0e10cSrcweir Frm().Pos().X() += nReal;
2653cdf0e10cSrcweir bMoveAccFrm = sal_True;
2654cdf0e10cSrcweir }
2655cdf0e10cSrcweir
2656cdf0e10cSrcweir sal_uInt8 nAdjust = GetUpper() && GetUpper()->IsFtnBossFrm() ?
2657cdf0e10cSrcweir ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
2658cdf0e10cSrcweir : NA_GROW_SHRINK;
2659cdf0e10cSrcweir
2660cdf0e10cSrcweir // AdjustNeighbourhood auch in Spalten (aber nicht in Rahmen)
2661cdf0e10cSrcweir if( NA_ONLY_ADJUST == nAdjust )
2662cdf0e10cSrcweir {
2663cdf0e10cSrcweir if ( IsPageBodyFrm() && !bBrowse )
2664cdf0e10cSrcweir nReal = nDist;
2665cdf0e10cSrcweir else
2666cdf0e10cSrcweir { nReal = AdjustNeighbourhood( -nReal, bTst );
2667cdf0e10cSrcweir nReal *= -1;
2668cdf0e10cSrcweir if ( !bTst && IsBodyFrm() && nReal < nRealDist )
2669cdf0e10cSrcweir {
2670cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
2671cdf0e10cSrcweir + nRealDist - nReal );
2672cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
2673cdf0e10cSrcweir if( bChgPos && !IsVertLR() )
2674cdf0e10cSrcweir Frm().Pos().X() += nRealDist - nReal;
2675cdf0e10cSrcweir ASSERT( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" );
2676cdf0e10cSrcweir }
2677cdf0e10cSrcweir }
2678cdf0e10cSrcweir }
2679cdf0e10cSrcweir else if( IsColumnFrm() || IsColBodyFrm() )
2680cdf0e10cSrcweir {
2681cdf0e10cSrcweir SwTwips nTmp = GetUpper()->Shrink( nReal, bTst, bInfo );
2682cdf0e10cSrcweir if ( nTmp != nReal )
2683cdf0e10cSrcweir {
2684cdf0e10cSrcweir (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
2685cdf0e10cSrcweir + nReal - nTmp );
2686cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
2687cdf0e10cSrcweir if( bChgPos && !IsVertLR() )
2688cdf0e10cSrcweir Frm().Pos().X() += nTmp - nReal;
2689cdf0e10cSrcweir ASSERT( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" );
2690cdf0e10cSrcweir nReal = nTmp;
2691cdf0e10cSrcweir }
2692cdf0e10cSrcweir }
2693cdf0e10cSrcweir else
2694cdf0e10cSrcweir {
2695cdf0e10cSrcweir SwTwips nShrink = nReal;
2696cdf0e10cSrcweir SwFrm* pToShrink = GetUpper();
2697cdf0e10cSrcweir const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
2698cdf0e10cSrcweir // NEW TABLES
2699cdf0e10cSrcweir if ( pThisCell && pThisCell->GetLayoutRowSpan() > 1 )
2700cdf0e10cSrcweir {
2701cdf0e10cSrcweir SwCellFrm& rEndCell = const_cast<SwCellFrm&>(pThisCell->FindStartEndOfRowSpanCell( false, true ));
2702cdf0e10cSrcweir pToShrink = rEndCell.GetUpper();
2703cdf0e10cSrcweir }
2704cdf0e10cSrcweir
2705cdf0e10cSrcweir nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0;
2706cdf0e10cSrcweir if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust )
2707cdf0e10cSrcweir && nReal < nShrink )
2708cdf0e10cSrcweir AdjustNeighbourhood( nReal - nShrink );
2709cdf0e10cSrcweir }
2710cdf0e10cSrcweir
2711cdf0e10cSrcweir if( bMoveAccFrm && IsAccessibleFrm() )
2712cdf0e10cSrcweir {
2713cdf0e10cSrcweir SwRootFrm *pRootFrm = getRootFrm();
2714cdf0e10cSrcweir if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
2715cdf0e10cSrcweir pRootFrm->GetCurrShell() )
2716cdf0e10cSrcweir {
2717cdf0e10cSrcweir pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
2718cdf0e10cSrcweir }
2719cdf0e10cSrcweir }
2720cdf0e10cSrcweir if ( !bTst && (IsCellFrm() || IsColumnFrm() ? nReal : nRealDist) )
2721cdf0e10cSrcweir {
2722cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
2723cdf0e10cSrcweir if ( GetNext() )
2724cdf0e10cSrcweir {
2725cdf0e10cSrcweir GetNext()->_InvalidatePos();
2726cdf0e10cSrcweir if ( GetNext()->IsCntntFrm() )
2727cdf0e10cSrcweir GetNext()->InvalidatePage( pPage );
2728cdf0e10cSrcweir if ( IsTabFrm() )
2729cdf0e10cSrcweir ((SwTabFrm*)this)->SetComplete();
2730cdf0e10cSrcweir }
2731cdf0e10cSrcweir else
2732cdf0e10cSrcweir { if ( IsRetoucheFrm() )
2733cdf0e10cSrcweir SetRetouche();
2734cdf0e10cSrcweir if ( IsTabFrm() )
2735cdf0e10cSrcweir {
2736cdf0e10cSrcweir if( IsTabFrm() )
2737cdf0e10cSrcweir ((SwTabFrm*)this)->SetComplete();
2738cdf0e10cSrcweir if ( Lower() ) //Kann auch im Join stehen und leer sein!
2739cdf0e10cSrcweir InvalidateNextPos();
2740cdf0e10cSrcweir }
2741cdf0e10cSrcweir }
2742cdf0e10cSrcweir if ( !IsBodyFrm() )
2743cdf0e10cSrcweir {
2744cdf0e10cSrcweir _InvalidateAll();
2745cdf0e10cSrcweir InvalidatePage( pPage );
2746cdf0e10cSrcweir const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
2747cdf0e10cSrcweir if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
2748cdf0e10cSrcweir SetCompletePaint();
2749cdf0e10cSrcweir }
2750cdf0e10cSrcweir
2751cdf0e10cSrcweir if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
2752cdf0e10cSrcweir NotifyLowerObjs();
2753cdf0e10cSrcweir
2754cdf0e10cSrcweir if( IsCellFrm() )
2755cdf0e10cSrcweir InvaPercentLowers( nReal );
2756cdf0e10cSrcweir
2757cdf0e10cSrcweir SwCntntFrm *pCnt;
2758cdf0e10cSrcweir if( IsFtnFrm() && !((SwFtnFrm*)this)->GetAttr()->GetFtn().IsEndNote() &&
2759cdf0e10cSrcweir ( GetFmt()->GetDoc()->GetFtnInfo().ePos != FTNPOS_CHAPTER ||
2760cdf0e10cSrcweir ( IsInSct() && FindSctFrm()->IsFtnAtEnd() ) ) &&
2761cdf0e10cSrcweir 0 != (pCnt = ((SwFtnFrm*)this)->GetRefFromAttr() ) )
2762cdf0e10cSrcweir {
2763cdf0e10cSrcweir if ( pCnt->IsFollow() )
2764cdf0e10cSrcweir { // Wenn wir sowieso schon in einer anderen Spalte/Seite sitzen
2765cdf0e10cSrcweir // als der Frame mit der Referenz, dann brauchen wir nicht
2766cdf0e10cSrcweir // auch noch seinen Master zu invalidieren.
2767cdf0e10cSrcweir SwFrm *pTmp = pCnt->FindFtnBossFrm(sal_True) == FindFtnBossFrm(sal_True)
2768cdf0e10cSrcweir ? pCnt->FindMaster()->GetFrm() : pCnt;
2769cdf0e10cSrcweir pTmp->Prepare( PREP_ADJUST_FRM );
2770cdf0e10cSrcweir pTmp->InvalidateSize();
2771cdf0e10cSrcweir }
2772cdf0e10cSrcweir else
2773cdf0e10cSrcweir pCnt->InvalidatePos();
2774cdf0e10cSrcweir }
2775cdf0e10cSrcweir }
2776cdf0e10cSrcweir return nReal;
2777cdf0e10cSrcweir }
2778cdf0e10cSrcweir /*************************************************************************
2779cdf0e10cSrcweir |*
2780cdf0e10cSrcweir |* SwLayoutFrm::ChgLowersProp()
2781cdf0e10cSrcweir |*
2782cdf0e10cSrcweir |* Beschreibung Aendert die Grosse der direkt untergeordneten Frm's
2783cdf0e10cSrcweir |* die eine Fixe Groesse haben, proportional zur Groessenaenderung der
2784cdf0e10cSrcweir |* PrtArea des Frm's.
2785cdf0e10cSrcweir |* Die Variablen Frm's werden auch proportional angepasst; sie werden
2786cdf0e10cSrcweir |* sich schon wieder zurechtwachsen/-schrumpfen.
2787cdf0e10cSrcweir |* Ersterstellung MA 11.03.92
2788cdf0e10cSrcweir |* Letzte Aenderung AMA 2. Nov. 98
2789cdf0e10cSrcweir |*
2790cdf0e10cSrcweir |*************************************************************************/
ChgLowersProp(const Size & rOldSize)2791cdf0e10cSrcweir void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
2792cdf0e10cSrcweir {
2793cdf0e10cSrcweir // no change of lower properties for root frame or if no lower exists.
2794cdf0e10cSrcweir if ( IsRootFrm() || !Lower() )
2795cdf0e10cSrcweir return;
2796cdf0e10cSrcweir
2797cdf0e10cSrcweir // declare and init <SwFrm* pLowerFrm> with first lower
2798cdf0e10cSrcweir SwFrm *pLowerFrm = Lower();
2799cdf0e10cSrcweir
2800cdf0e10cSrcweir // declare and init const booleans <bHeightChgd> and <bWidthChg>
2801cdf0e10cSrcweir const bool bHeightChgd = rOldSize.Height() != Prt().Height();
2802cdf0e10cSrcweir const bool bWidthChgd = rOldSize.Width() != Prt().Width();
2803cdf0e10cSrcweir
2804cdf0e10cSrcweir // declare and init variables <bVert>, <bRev> and <fnRect>
2805cdf0e10cSrcweir SWRECTFN( this )
2806cdf0e10cSrcweir
2807cdf0e10cSrcweir // This shortcut basically tries to handle only lower frames that
2808cdf0e10cSrcweir // are affected by the size change. Otherwise much more lower frames
2809cdf0e10cSrcweir // are invalidated.
2810cdf0e10cSrcweir if ( !( bVert ? bHeightChgd : bWidthChgd ) &&
2811cdf0e10cSrcweir ! Lower()->IsColumnFrm() &&
2812cdf0e10cSrcweir ( ( IsBodyFrm() && IsInDocBody() && ( !IsInSct() || !FindSctFrm()->IsColLocked() ) ) ||
2813cdf0e10cSrcweir // --> FME 2004-07-21 #i10826# Section frames without columns should not
2814cdf0e10cSrcweir // invalidate all lowers!
2815cdf0e10cSrcweir IsSctFrm() ) )
2816cdf0e10cSrcweir // <--
2817cdf0e10cSrcweir {
2818cdf0e10cSrcweir // Determine page frame the body frame resp. the section frame belongs to.
2819cdf0e10cSrcweir SwPageFrm *pPage = FindPageFrm();
2820cdf0e10cSrcweir // Determine last lower by traveling through them using <GetNext()>.
2821cdf0e10cSrcweir // During travel check each section frame, if it will be sized to
2822cdf0e10cSrcweir // maximum. If Yes, invalidate size of section frame and set
2823cdf0e10cSrcweir // corresponding flags at the page.
2824cdf0e10cSrcweir do
2825cdf0e10cSrcweir {
2826cdf0e10cSrcweir if( pLowerFrm->IsSctFrm() &&((SwSectionFrm*)pLowerFrm)->_ToMaximize() )
2827cdf0e10cSrcweir {
2828cdf0e10cSrcweir pLowerFrm->_InvalidateSize();
2829cdf0e10cSrcweir pLowerFrm->InvalidatePage( pPage );
2830cdf0e10cSrcweir }
2831cdf0e10cSrcweir if( pLowerFrm->GetNext() )
2832cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetNext();
2833cdf0e10cSrcweir else
2834cdf0e10cSrcweir break;
2835cdf0e10cSrcweir } while( sal_True );
2836cdf0e10cSrcweir // If found last lower is a section frame containing no section
2837cdf0e10cSrcweir // (section frame isn't valid and will be deleted in the future),
2838cdf0e10cSrcweir // travel backwards.
2839cdf0e10cSrcweir while( pLowerFrm->IsSctFrm() && !((SwSectionFrm*)pLowerFrm)->GetSection() &&
2840cdf0e10cSrcweir pLowerFrm->GetPrev() )
2841cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetPrev();
2842cdf0e10cSrcweir // If found last lower is a section frame, set <pLowerFrm> to its last
2843cdf0e10cSrcweir // content, if the section frame is valid and is not sized to maximum.
2844cdf0e10cSrcweir // Otherwise set <pLowerFrm> to NULL - In this case body frame only
2845cdf0e10cSrcweir // contains invalid section frames.
2846cdf0e10cSrcweir if( pLowerFrm->IsSctFrm() )
2847cdf0e10cSrcweir pLowerFrm = ((SwSectionFrm*)pLowerFrm)->GetSection() &&
2848cdf0e10cSrcweir !((SwSectionFrm*)pLowerFrm)->ToMaximize( sal_False ) ?
2849cdf0e10cSrcweir ((SwSectionFrm*)pLowerFrm)->FindLastCntnt() : NULL;
2850cdf0e10cSrcweir
2851cdf0e10cSrcweir // continue with found last lower, probably the last content of a section
2852cdf0e10cSrcweir if ( pLowerFrm )
2853cdf0e10cSrcweir {
2854cdf0e10cSrcweir // If <pLowerFrm> is in a table frame, set <pLowerFrm> to this table
2855cdf0e10cSrcweir // frame and continue.
2856cdf0e10cSrcweir if ( pLowerFrm->IsInTab() )
2857cdf0e10cSrcweir {
2858cdf0e10cSrcweir // OD 28.10.2002 #97265# - safeguard for setting <pLowerFrm> to
2859cdf0e10cSrcweir // its table frame - check, if the table frame is also a lower
2860cdf0e10cSrcweir // of the body frame, in order to assure that <pLowerFrm> is not
2861cdf0e10cSrcweir // set to a frame, which is an *upper* of the body frame.
2862cdf0e10cSrcweir SwFrm* pTableFrm = pLowerFrm->FindTabFrm();
2863cdf0e10cSrcweir if ( IsAnLower( pTableFrm ) )
2864cdf0e10cSrcweir {
2865cdf0e10cSrcweir pLowerFrm = pTableFrm;
2866cdf0e10cSrcweir }
2867cdf0e10cSrcweir }
2868cdf0e10cSrcweir // Check, if variable size of body frame resp. section frame has grown
2869cdf0e10cSrcweir // OD 28.10.2002 #97265# - correct check, if variable size has grown.
2870cdf0e10cSrcweir SwTwips nOldHeight = bVert ? rOldSize.Width() : rOldSize.Height();
2871cdf0e10cSrcweir if( nOldHeight < (Prt().*fnRect->fnGetHeight)() )
2872cdf0e10cSrcweir {
2873cdf0e10cSrcweir // If variable size of body|section frame has grown, only found
2874cdf0e10cSrcweir // last lower and the position of the its next have to be invalidated.
2875cdf0e10cSrcweir pLowerFrm->_InvalidateAll();
2876cdf0e10cSrcweir pLowerFrm->InvalidatePage( pPage );
2877cdf0e10cSrcweir if( !pLowerFrm->IsFlowFrm() ||
2878cdf0e10cSrcweir !SwFlowFrm::CastFlowFrm( pLowerFrm )->HasFollow() )
2879cdf0e10cSrcweir pLowerFrm->InvalidateNextPos( sal_True );
2880cdf0e10cSrcweir if ( pLowerFrm->IsTxtFrm() )
2881cdf0e10cSrcweir ((SwCntntFrm*)pLowerFrm)->Prepare( PREP_ADJUST_FRM );
2882cdf0e10cSrcweir }
2883cdf0e10cSrcweir else
2884cdf0e10cSrcweir {
2885cdf0e10cSrcweir // variable size of body|section frame has shrinked. Thus,
2886cdf0e10cSrcweir // invalidate all lowers not matching the new body|section size
2887cdf0e10cSrcweir // and the dedicated new last lower.
2888cdf0e10cSrcweir if( bVert )
2889cdf0e10cSrcweir {
2890cdf0e10cSrcweir SwTwips nBot = Frm().Left() + Prt().Left();
2891cdf0e10cSrcweir while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Left() < nBot )
2892cdf0e10cSrcweir {
2893cdf0e10cSrcweir pLowerFrm->_InvalidateAll();
2894cdf0e10cSrcweir pLowerFrm->InvalidatePage( pPage );
2895cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetPrev();
2896cdf0e10cSrcweir }
2897cdf0e10cSrcweir }
2898cdf0e10cSrcweir else
2899cdf0e10cSrcweir {
2900cdf0e10cSrcweir SwTwips nBot = Frm().Top() + Prt().Bottom();
2901cdf0e10cSrcweir while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Top() > nBot )
2902cdf0e10cSrcweir {
2903cdf0e10cSrcweir pLowerFrm->_InvalidateAll();
2904cdf0e10cSrcweir pLowerFrm->InvalidatePage( pPage );
2905cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetPrev();
2906cdf0e10cSrcweir }
2907cdf0e10cSrcweir }
2908cdf0e10cSrcweir if ( pLowerFrm )
2909cdf0e10cSrcweir {
2910cdf0e10cSrcweir pLowerFrm->_InvalidateSize();
2911cdf0e10cSrcweir pLowerFrm->InvalidatePage( pPage );
2912cdf0e10cSrcweir if ( pLowerFrm->IsTxtFrm() )
2913cdf0e10cSrcweir ((SwCntntFrm*)pLowerFrm)->Prepare( PREP_ADJUST_FRM );
2914cdf0e10cSrcweir }
2915cdf0e10cSrcweir }
2916cdf0e10cSrcweir // --> OD 2005-01-31 #i41694# - improvement by removing duplicates
2917cdf0e10cSrcweir if ( pLowerFrm )
2918cdf0e10cSrcweir {
2919cdf0e10cSrcweir if ( pLowerFrm->IsInSct() )
2920cdf0e10cSrcweir {
2921cdf0e10cSrcweir // --> OD 2005-01-31 #i41694# - follow-up of issue #i10826#:
2922cdf0e10cSrcweir // No invalidation of section frame, if it's the this.
2923cdf0e10cSrcweir SwFrm* pSectFrm = pLowerFrm->FindSctFrm();
2924cdf0e10cSrcweir if( pSectFrm != this && IsAnLower( pSectFrm ) )
2925cdf0e10cSrcweir {
2926cdf0e10cSrcweir pSectFrm->_InvalidateSize();
2927cdf0e10cSrcweir pSectFrm->InvalidatePage( pPage );
2928cdf0e10cSrcweir }
2929cdf0e10cSrcweir // <--
2930cdf0e10cSrcweir }
2931cdf0e10cSrcweir }
2932cdf0e10cSrcweir // <--
2933cdf0e10cSrcweir }
2934cdf0e10cSrcweir return;
2935cdf0e10cSrcweir } // end of { special case }
2936cdf0e10cSrcweir
2937cdf0e10cSrcweir
2938cdf0e10cSrcweir // Invalidate page for content only once.
2939cdf0e10cSrcweir bool bInvaPageForCntnt = true;
2940cdf0e10cSrcweir
2941cdf0e10cSrcweir // Declare booleans <bFixChgd> and <bVarChgd>, indicating for text frame
2942cdf0e10cSrcweir // adjustment, if fixed/variable size has changed.
2943cdf0e10cSrcweir bool bFixChgd, bVarChgd;
2944cdf0e10cSrcweir if( bVert == pLowerFrm->IsNeighbourFrm() )
2945cdf0e10cSrcweir {
2946cdf0e10cSrcweir bFixChgd = bWidthChgd;
2947cdf0e10cSrcweir bVarChgd = bHeightChgd;
2948cdf0e10cSrcweir }
2949cdf0e10cSrcweir else
2950cdf0e10cSrcweir {
2951cdf0e10cSrcweir bFixChgd = bHeightChgd;
2952cdf0e10cSrcweir bVarChgd = bWidthChgd;
2953cdf0e10cSrcweir }
2954cdf0e10cSrcweir
2955cdf0e10cSrcweir // Declare const unsigned short <nFixWidth> and init it this frame types
2956cdf0e10cSrcweir // which has fixed width in vertical respectively horizontal layout.
2957cdf0e10cSrcweir // In vertical layout these are neighbour frames (cell and column frames),
2958cdf0e10cSrcweir // header frames and footer frames.
2959cdf0e10cSrcweir // In horizontal layout these are all frames, which aren't neighbour frames.
2960cdf0e10cSrcweir const sal_uInt16 nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT)
2961cdf0e10cSrcweir : ~FRM_NEIGHBOUR;
2962cdf0e10cSrcweir
2963cdf0e10cSrcweir // Declare const unsigned short <nFixHeight> and init it this frame types
2964cdf0e10cSrcweir // which has fixed height in vertical respectively horizontal layout.
2965cdf0e10cSrcweir // In vertical layout these are all frames, which aren't neighbour frames,
2966cdf0e10cSrcweir // header frames, footer frames, body frames or foot note container frames.
2967cdf0e10cSrcweir // In horizontal layout these are neighbour frames.
2968cdf0e10cSrcweir const sal_uInt16 nFixHeight= bVert ? ~(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC)
2969cdf0e10cSrcweir : FRM_NEIGHBOUR;
2970cdf0e10cSrcweir
2971cdf0e10cSrcweir // Travel through all lowers using <GetNext()>
2972cdf0e10cSrcweir while ( pLowerFrm )
2973cdf0e10cSrcweir {
2974cdf0e10cSrcweir if ( pLowerFrm->IsTxtFrm() )
2975cdf0e10cSrcweir {
2976cdf0e10cSrcweir // Text frames will only be invalidated - prepare invalidation
2977cdf0e10cSrcweir if ( bFixChgd )
2978cdf0e10cSrcweir static_cast<SwCntntFrm*>(pLowerFrm)->Prepare( PREP_FIXSIZE_CHG );
2979cdf0e10cSrcweir if ( bVarChgd )
2980cdf0e10cSrcweir static_cast<SwCntntFrm*>(pLowerFrm)->Prepare( PREP_ADJUST_FRM );
2981cdf0e10cSrcweir }
2982cdf0e10cSrcweir else
2983cdf0e10cSrcweir {
2984cdf0e10cSrcweir // If lower isn't a table, row, cell or section frame, adjust its
2985cdf0e10cSrcweir // frame size.
2986cdf0e10cSrcweir const sal_uInt16 nLowerType = pLowerFrm->GetType();
2987cdf0e10cSrcweir if ( !(nLowerType & (FRM_TAB|FRM_ROW|FRM_CELL|FRM_SECTION)) )
2988cdf0e10cSrcweir {
2989cdf0e10cSrcweir if ( bWidthChgd )
2990cdf0e10cSrcweir {
2991cdf0e10cSrcweir if( nLowerType & nFixWidth )
2992cdf0e10cSrcweir {
2993cdf0e10cSrcweir // Considering previous conditions:
2994cdf0e10cSrcweir // In vertical layout set width of column, header and
2995cdf0e10cSrcweir // footer frames to its upper width.
2996cdf0e10cSrcweir // In horizontal layout set width of header, footer,
2997cdf0e10cSrcweir // foot note container, foot note, body and no-text
2998cdf0e10cSrcweir // frames to its upper width.
2999cdf0e10cSrcweir pLowerFrm->Frm().Width( Prt().Width() );
3000cdf0e10cSrcweir }
3001cdf0e10cSrcweir else if( rOldSize.Width() && !pLowerFrm->IsFtnFrm() )
3002cdf0e10cSrcweir {
3003cdf0e10cSrcweir // Adjust frame width proportional, if lower isn't a
3004cdf0e10cSrcweir // foot note frame and condition <nLowerType & nFixWidth>
3005cdf0e10cSrcweir // isn't true.
3006cdf0e10cSrcweir // Considering previous conditions:
3007cdf0e10cSrcweir // In vertical layout these are foot note container,
3008cdf0e10cSrcweir // body and no-text frames.
3009cdf0e10cSrcweir // In horizontal layout these are column and no-text frames.
3010cdf0e10cSrcweir // OD 24.10.2002 #97265# - <double> calculation
3011cdf0e10cSrcweir // Perform <double> calculation of new width, if
3012cdf0e10cSrcweir // one of the coefficients is greater than 50000
3013cdf0e10cSrcweir SwTwips nNewWidth;
3014cdf0e10cSrcweir if ( (pLowerFrm->Frm().Width() > 50000) ||
3015cdf0e10cSrcweir (Prt().Width() > 50000) )
3016cdf0e10cSrcweir {
3017cdf0e10cSrcweir double nNewWidthTmp =
3018cdf0e10cSrcweir ( double(pLowerFrm->Frm().Width())
3019cdf0e10cSrcweir * double(Prt().Width()) )
3020cdf0e10cSrcweir / double(rOldSize.Width());
3021cdf0e10cSrcweir nNewWidth = SwTwips(nNewWidthTmp);
3022cdf0e10cSrcweir }
3023cdf0e10cSrcweir else
3024cdf0e10cSrcweir {
3025cdf0e10cSrcweir nNewWidth =
3026cdf0e10cSrcweir (pLowerFrm->Frm().Width() * Prt().Width()) / rOldSize.Width();
3027cdf0e10cSrcweir }
3028cdf0e10cSrcweir pLowerFrm->Frm().Width( nNewWidth );
3029cdf0e10cSrcweir }
3030cdf0e10cSrcweir }
3031cdf0e10cSrcweir if ( bHeightChgd )
3032cdf0e10cSrcweir {
3033cdf0e10cSrcweir if( nLowerType & nFixHeight )
3034cdf0e10cSrcweir {
3035cdf0e10cSrcweir // Considering previous conditions:
3036cdf0e10cSrcweir // In vertical layout set height of foot note and
3037cdf0e10cSrcweir // no-text frames to its upper height.
3038cdf0e10cSrcweir // In horizontal layout set height of column frames
3039cdf0e10cSrcweir // to its upper height.
3040cdf0e10cSrcweir pLowerFrm->Frm().Height( Prt().Height() );
3041cdf0e10cSrcweir }
3042cdf0e10cSrcweir // OD 01.10.2002 #102211#
3043cdf0e10cSrcweir // add conditions <!pLowerFrm->IsHeaderFrm()> and
3044cdf0e10cSrcweir // <!pLowerFrm->IsFooterFrm()> in order to avoid that
3045cdf0e10cSrcweir // the <Grow> of header or footer are overwritten.
3046cdf0e10cSrcweir // NOTE: Height of header/footer frame is determined by contents.
3047cdf0e10cSrcweir else if ( rOldSize.Height() &&
3048cdf0e10cSrcweir !pLowerFrm->IsFtnFrm() &&
3049cdf0e10cSrcweir !pLowerFrm->IsHeaderFrm() &&
3050cdf0e10cSrcweir !pLowerFrm->IsFooterFrm()
3051cdf0e10cSrcweir )
3052cdf0e10cSrcweir {
3053cdf0e10cSrcweir // Adjust frame height proportional, if lower isn't a
3054cdf0e10cSrcweir // foot note, a header or a footer frame and
3055cdf0e10cSrcweir // condition <nLowerType & nFixHeight> isn't true.
3056cdf0e10cSrcweir // Considering previous conditions:
3057cdf0e10cSrcweir // In vertical layout these are column, foot note container,
3058cdf0e10cSrcweir // body and no-text frames.
3059cdf0e10cSrcweir // In horizontal layout these are column, foot note
3060cdf0e10cSrcweir // container, body and no-text frames.
3061cdf0e10cSrcweir
3062cdf0e10cSrcweir // OD 29.10.2002 #97265# - special case for page lowers
3063cdf0e10cSrcweir // The page lowers that have to be adjusted on page height
3064cdf0e10cSrcweir // change are the body frame and the foot note container
3065cdf0e10cSrcweir // frame.
3066cdf0e10cSrcweir // In vertical layout the height of both is directly
3067cdf0e10cSrcweir // adjusted to the page height change.
3068cdf0e10cSrcweir // In horizontal layout the height of the body frame is
3069cdf0e10cSrcweir // directly adjsuted to the page height change and the
3070cdf0e10cSrcweir // foot note frame height isn't touched, because its
3071cdf0e10cSrcweir // determined by its content.
3072cdf0e10cSrcweir // OD 31.03.2003 #108446# - apply special case for page
3073cdf0e10cSrcweir // lowers - see description above - also for section columns.
3074cdf0e10cSrcweir if ( IsPageFrm() ||
3075cdf0e10cSrcweir ( IsColumnFrm() && IsInSct() )
3076cdf0e10cSrcweir )
3077cdf0e10cSrcweir {
3078cdf0e10cSrcweir ASSERT( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm(),
3079cdf0e10cSrcweir "ChgLowersProp - only for body or foot note container" );
3080cdf0e10cSrcweir if ( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm() )
3081cdf0e10cSrcweir {
3082cdf0e10cSrcweir if ( IsVertical() || pLowerFrm->IsBodyFrm() )
3083cdf0e10cSrcweir {
3084cdf0e10cSrcweir SwTwips nNewHeight =
3085cdf0e10cSrcweir pLowerFrm->Frm().Height() +
3086cdf0e10cSrcweir ( Prt().Height() - rOldSize.Height() );
3087cdf0e10cSrcweir if ( nNewHeight < 0)
3088cdf0e10cSrcweir {
3089cdf0e10cSrcweir // OD 01.04.2003 #108446# - adjust assertion condition and text
3090cdf0e10cSrcweir ASSERT( !( IsPageFrm() &&
3091cdf0e10cSrcweir (pLowerFrm->Frm().Height()>0) &&
3092cdf0e10cSrcweir (pLowerFrm->IsValid()) ),
3093cdf0e10cSrcweir "ChgLowersProg - negative height for lower.");
3094cdf0e10cSrcweir nNewHeight = 0;
3095cdf0e10cSrcweir }
3096cdf0e10cSrcweir pLowerFrm->Frm().Height( nNewHeight );
3097cdf0e10cSrcweir }
3098cdf0e10cSrcweir }
3099cdf0e10cSrcweir }
3100cdf0e10cSrcweir else
3101cdf0e10cSrcweir {
3102cdf0e10cSrcweir SwTwips nNewHeight;
3103cdf0e10cSrcweir // OD 24.10.2002 #97265# - <double> calculation
3104cdf0e10cSrcweir // Perform <double> calculation of new height, if
3105cdf0e10cSrcweir // one of the coefficients is greater than 50000
3106cdf0e10cSrcweir if ( (pLowerFrm->Frm().Height() > 50000) ||
3107cdf0e10cSrcweir (Prt().Height() > 50000) )
3108cdf0e10cSrcweir {
3109cdf0e10cSrcweir double nNewHeightTmp =
3110cdf0e10cSrcweir ( double(pLowerFrm->Frm().Height())
3111cdf0e10cSrcweir * double(Prt().Height()) )
3112cdf0e10cSrcweir / double(rOldSize.Height());
3113cdf0e10cSrcweir nNewHeight = SwTwips(nNewHeightTmp);
3114cdf0e10cSrcweir }
3115cdf0e10cSrcweir else
3116cdf0e10cSrcweir {
3117cdf0e10cSrcweir nNewHeight = ( pLowerFrm->Frm().Height()
3118cdf0e10cSrcweir * Prt().Height() ) / rOldSize.Height();
3119cdf0e10cSrcweir }
3120cdf0e10cSrcweir if( !pLowerFrm->GetNext() )
3121cdf0e10cSrcweir {
3122cdf0e10cSrcweir SwTwips nSum = Prt().Height();
3123cdf0e10cSrcweir SwFrm* pTmp = Lower();
3124cdf0e10cSrcweir while( pTmp->GetNext() )
3125cdf0e10cSrcweir {
3126cdf0e10cSrcweir if( !pTmp->IsFtnContFrm() || !pTmp->IsVertical() )
3127cdf0e10cSrcweir nSum -= pTmp->Frm().Height();
3128cdf0e10cSrcweir pTmp = pTmp->GetNext();
3129cdf0e10cSrcweir }
3130cdf0e10cSrcweir if( nSum - nNewHeight == 1 &&
3131cdf0e10cSrcweir nSum == pLowerFrm->Frm().Height() )
3132cdf0e10cSrcweir nNewHeight = nSum;
3133cdf0e10cSrcweir }
3134cdf0e10cSrcweir pLowerFrm->Frm().Height( nNewHeight );
3135cdf0e10cSrcweir }
3136cdf0e10cSrcweir }
3137cdf0e10cSrcweir }
3138cdf0e10cSrcweir }
3139cdf0e10cSrcweir } // end of else { NOT text frame }
3140cdf0e10cSrcweir
3141cdf0e10cSrcweir pLowerFrm->_InvalidateAll();
3142cdf0e10cSrcweir if ( bInvaPageForCntnt && pLowerFrm->IsCntntFrm() )
3143cdf0e10cSrcweir {
3144cdf0e10cSrcweir pLowerFrm->InvalidatePage();
3145cdf0e10cSrcweir bInvaPageForCntnt = false;
3146cdf0e10cSrcweir }
3147cdf0e10cSrcweir
3148cdf0e10cSrcweir if ( !pLowerFrm->GetNext() && pLowerFrm->IsRetoucheFrm() )
3149cdf0e10cSrcweir {
3150cdf0e10cSrcweir //Wenn ein Wachstum stattgefunden hat, und die untergeordneten
3151cdf0e10cSrcweir //zur Retouche faehig sind (derzeit Tab, Section und Cntnt), so
3152cdf0e10cSrcweir //trigger ich sie an.
3153cdf0e10cSrcweir if ( rOldSize.Height() < Prt().SSize().Height() ||
3154cdf0e10cSrcweir rOldSize.Width() < Prt().SSize().Width() )
3155cdf0e10cSrcweir pLowerFrm->SetRetouche();
3156cdf0e10cSrcweir }
3157cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetNext();
3158cdf0e10cSrcweir }
3159cdf0e10cSrcweir
3160cdf0e10cSrcweir // Finally adjust the columns if width is set to auto
3161cdf0e10cSrcweir // Possible optimisation: execute this code earlier in this function and
3162cdf0e10cSrcweir // return???
3163cdf0e10cSrcweir if ( ( (bVert && bHeightChgd) || (! bVert && bWidthChgd) ) &&
3164cdf0e10cSrcweir Lower()->IsColumnFrm() )
3165cdf0e10cSrcweir {
3166cdf0e10cSrcweir // get column attribute
3167cdf0e10cSrcweir const SwFmtCol* pColAttr = NULL;
3168cdf0e10cSrcweir if ( IsPageBodyFrm() )
3169cdf0e10cSrcweir {
3170cdf0e10cSrcweir ASSERT( GetUpper()->IsPageFrm(), "Upper is not page frame" )
3171cdf0e10cSrcweir pColAttr = &GetUpper()->GetFmt()->GetCol();
3172cdf0e10cSrcweir }
3173cdf0e10cSrcweir else
3174cdf0e10cSrcweir {
3175cdf0e10cSrcweir ASSERT( IsFlyFrm() || IsSctFrm(), "Columns not in fly or section" )
3176cdf0e10cSrcweir pColAttr = &GetFmt()->GetCol();
3177cdf0e10cSrcweir }
3178cdf0e10cSrcweir
3179cdf0e10cSrcweir if ( pColAttr->IsOrtho() && pColAttr->GetNumCols() > 1 )
3180cdf0e10cSrcweir AdjustColumns( pColAttr, sal_False );
3181cdf0e10cSrcweir }
3182cdf0e10cSrcweir }
3183cdf0e10cSrcweir
3184cdf0e10cSrcweir /*************************************************************************
3185cdf0e10cSrcweir |*
3186cdf0e10cSrcweir |* SwLayoutFrm::Format()
3187cdf0e10cSrcweir |*
3188cdf0e10cSrcweir |* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
3189cdf0e10cSrcweir |* Die Fixsize wird hier nicht eingestellt.
3190cdf0e10cSrcweir |* Ersterstellung MA 28. Jul. 92
3191cdf0e10cSrcweir |* Letzte Aenderung MA 21. Mar. 95
3192cdf0e10cSrcweir |*
3193cdf0e10cSrcweir |*************************************************************************/
Format(const SwBorderAttrs * pAttrs)3194cdf0e10cSrcweir void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs )
3195cdf0e10cSrcweir {
3196cdf0e10cSrcweir ASSERT( pAttrs, "LayoutFrm::Format, pAttrs ist 0." );
3197cdf0e10cSrcweir
3198cdf0e10cSrcweir if ( bValidPrtArea && bValidSize )
3199cdf0e10cSrcweir return;
3200cdf0e10cSrcweir
3201cdf0e10cSrcweir const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft( this );
3202cdf0e10cSrcweir const sal_uInt16 nUpper = pAttrs->CalcTop();
3203cdf0e10cSrcweir
3204cdf0e10cSrcweir const sal_uInt16 nRight = (sal_uInt16)((SwBorderAttrs*)pAttrs)->CalcRight( this );
3205cdf0e10cSrcweir const sal_uInt16 nLower = pAttrs->CalcBottom();
3206cdf0e10cSrcweir sal_Bool bVert = IsVertical() && !IsPageFrm();
3207cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
3208cdf0e10cSrcweir SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
3209cdf0e10cSrcweir if ( !bValidPrtArea )
3210cdf0e10cSrcweir {
3211cdf0e10cSrcweir bValidPrtArea = sal_True;
3212cdf0e10cSrcweir (this->*fnRect->fnSetXMargins)( nLeft, nRight );
3213cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nUpper, nLower );
3214cdf0e10cSrcweir }
3215cdf0e10cSrcweir
3216cdf0e10cSrcweir if ( !bValidSize )
3217cdf0e10cSrcweir {
3218cdf0e10cSrcweir if ( !HasFixSize() )
3219cdf0e10cSrcweir {
3220cdf0e10cSrcweir const SwTwips nBorder = nUpper + nLower;
3221cdf0e10cSrcweir const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
3222cdf0e10cSrcweir SwTwips nMinHeight = rSz.GetHeightSizeType() == ATT_MIN_SIZE ? rSz.GetHeight() : 0;
3223cdf0e10cSrcweir do
3224cdf0e10cSrcweir { bValidSize = sal_True;
3225cdf0e10cSrcweir
3226cdf0e10cSrcweir //Die Groesse in der VarSize wird durch den Inhalt plus den
3227cdf0e10cSrcweir //Raendern bestimmt.
3228cdf0e10cSrcweir SwTwips nRemaining = 0;
3229cdf0e10cSrcweir SwFrm *pFrm = Lower();
3230cdf0e10cSrcweir while ( pFrm )
3231cdf0e10cSrcweir { nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
3232cdf0e10cSrcweir if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
3233cdf0e10cSrcweir // Dieser TxtFrm waere gern ein bisschen groesser
3234cdf0e10cSrcweir nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
3235cdf0e10cSrcweir - (pFrm->Prt().*fnRect->fnGetHeight)();
3236cdf0e10cSrcweir else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
3237cdf0e10cSrcweir nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
3238cdf0e10cSrcweir pFrm = pFrm->GetNext();
3239cdf0e10cSrcweir }
3240cdf0e10cSrcweir nRemaining += nBorder;
3241cdf0e10cSrcweir nRemaining = Max( nRemaining, nMinHeight );
3242cdf0e10cSrcweir const SwTwips nDiff = nRemaining-(Frm().*fnRect->fnGetHeight)();
3243cdf0e10cSrcweir const long nOldLeft = (Frm().*fnRect->fnGetLeft)();
3244cdf0e10cSrcweir const long nOldTop = (Frm().*fnRect->fnGetTop)();
3245cdf0e10cSrcweir if ( nDiff )
3246cdf0e10cSrcweir {
3247cdf0e10cSrcweir if ( nDiff > 0 )
3248cdf0e10cSrcweir Grow( nDiff );
3249cdf0e10cSrcweir else
3250cdf0e10cSrcweir Shrink( -nDiff );
3251cdf0e10cSrcweir //Schnell auf dem kurzen Dienstweg die Position updaten.
3252cdf0e10cSrcweir MakePos();
3253cdf0e10cSrcweir }
3254cdf0e10cSrcweir //Unterkante des Uppers nicht ueberschreiten.
3255cdf0e10cSrcweir if ( GetUpper() && (Frm().*fnRect->fnGetHeight)() )
3256cdf0e10cSrcweir {
3257cdf0e10cSrcweir const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
3258cdf0e10cSrcweir if( (this->*fnRect->fnSetLimit)( nLimit ) &&
3259cdf0e10cSrcweir nOldLeft == (Frm().*fnRect->fnGetLeft)() &&
3260cdf0e10cSrcweir nOldTop == (Frm().*fnRect->fnGetTop)() )
3261cdf0e10cSrcweir bValidSize = bValidPrtArea = sal_True;
3262cdf0e10cSrcweir }
3263cdf0e10cSrcweir } while ( !bValidSize );
3264cdf0e10cSrcweir }
3265cdf0e10cSrcweir else if ( GetType() & 0x0018 )
3266cdf0e10cSrcweir {
3267cdf0e10cSrcweir do
3268cdf0e10cSrcweir { if ( Frm().Height() != pAttrs->GetSize().Height() )
3269cdf0e10cSrcweir ChgSize( Size( Frm().Width(), pAttrs->GetSize().Height()));
3270cdf0e10cSrcweir bValidSize = sal_True;
3271cdf0e10cSrcweir MakePos();
3272cdf0e10cSrcweir } while ( !bValidSize );
3273cdf0e10cSrcweir }
3274cdf0e10cSrcweir else
3275cdf0e10cSrcweir bValidSize = sal_True;
3276cdf0e10cSrcweir }
3277cdf0e10cSrcweir }
3278cdf0e10cSrcweir
3279cdf0e10cSrcweir /*************************************************************************
3280cdf0e10cSrcweir |*
3281cdf0e10cSrcweir |* SwLayoutFrm::InvalidatePercentLowers()
3282cdf0e10cSrcweir |*
3283cdf0e10cSrcweir |* Ersterstellung MA 13. Jun. 96
3284cdf0e10cSrcweir |* Letzte Aenderung MA 13. Jun. 96
3285cdf0e10cSrcweir |*
3286cdf0e10cSrcweir |*************************************************************************/
InvaPercentFlys(SwFrm * pFrm,SwTwips nDiff)3287cdf0e10cSrcweir static void InvaPercentFlys( SwFrm *pFrm, SwTwips nDiff )
3288cdf0e10cSrcweir {
3289cdf0e10cSrcweir ASSERT( pFrm->GetDrawObjs(), "Can't find any Objects" );
3290cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pFrm->GetDrawObjs()->Count(); ++i )
3291cdf0e10cSrcweir {
3292cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
3293cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
3294cdf0e10cSrcweir {
3295cdf0e10cSrcweir SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
3296cdf0e10cSrcweir const SwFmtFrmSize &rSz = pFly->GetFmt()->GetFrmSize();
3297cdf0e10cSrcweir if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
3298cdf0e10cSrcweir {
3299cdf0e10cSrcweir sal_Bool bNotify = sal_True;
3300cdf0e10cSrcweir // If we've a fly with more than 90% relative height...
3301cdf0e10cSrcweir if( rSz.GetHeightPercent() > 90 && pFly->GetAnchorFrm() &&
3302cdf0e10cSrcweir rSz.GetHeightPercent() != 0xFF && nDiff )
3303cdf0e10cSrcweir {
3304cdf0e10cSrcweir const SwFrm *pRel = pFly->IsFlyLayFrm() ? pFly->GetAnchorFrm():
3305cdf0e10cSrcweir pFly->GetAnchorFrm()->GetUpper();
3306cdf0e10cSrcweir // ... and we have already more than 90% height and we
3307cdf0e10cSrcweir // not allow the text to go through...
3308cdf0e10cSrcweir // then a notifycation could cause an endless loop, e.g.
3309cdf0e10cSrcweir // 100% height and no text wrap inside a cell of a table.
3310cdf0e10cSrcweir if( pFly->Frm().Height()*10 >
3311cdf0e10cSrcweir ( nDiff + pRel->Prt().Height() )*9 &&
3312cdf0e10cSrcweir pFly->GetFmt()->GetSurround().GetSurround() !=
3313cdf0e10cSrcweir SURROUND_THROUGHT )
3314cdf0e10cSrcweir bNotify = sal_False;
3315cdf0e10cSrcweir }
3316cdf0e10cSrcweir if( bNotify )
3317cdf0e10cSrcweir pFly->InvalidateSize();
3318cdf0e10cSrcweir }
3319cdf0e10cSrcweir }
3320cdf0e10cSrcweir }
3321cdf0e10cSrcweir }
3322cdf0e10cSrcweir
InvaPercentLowers(SwTwips nDiff)3323cdf0e10cSrcweir void SwLayoutFrm::InvaPercentLowers( SwTwips nDiff )
3324cdf0e10cSrcweir {
3325cdf0e10cSrcweir if ( GetDrawObjs() )
3326cdf0e10cSrcweir ::InvaPercentFlys( this, nDiff );
3327cdf0e10cSrcweir
3328cdf0e10cSrcweir SwFrm *pFrm = ContainsCntnt();
3329cdf0e10cSrcweir if ( pFrm )
3330cdf0e10cSrcweir do
3331cdf0e10cSrcweir {
3332cdf0e10cSrcweir if ( pFrm->IsInTab() && !IsTabFrm() )
3333cdf0e10cSrcweir {
3334cdf0e10cSrcweir SwFrm *pTmp = pFrm->FindTabFrm();
3335cdf0e10cSrcweir ASSERT( pTmp, "Where's my TabFrm?" );
3336cdf0e10cSrcweir if( IsAnLower( pTmp ) )
3337cdf0e10cSrcweir pFrm = pTmp;
3338cdf0e10cSrcweir }
3339cdf0e10cSrcweir
3340cdf0e10cSrcweir if ( pFrm->IsTabFrm() )
3341cdf0e10cSrcweir {
3342cdf0e10cSrcweir const SwFmtFrmSize &rSz = ((SwLayoutFrm*)pFrm)->GetFmt()->GetFrmSize();
3343cdf0e10cSrcweir if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
3344cdf0e10cSrcweir pFrm->InvalidatePrt();
3345cdf0e10cSrcweir }
3346cdf0e10cSrcweir else if ( pFrm->GetDrawObjs() )
3347cdf0e10cSrcweir ::InvaPercentFlys( pFrm, nDiff );
3348cdf0e10cSrcweir pFrm = pFrm->FindNextCnt();
3349cdf0e10cSrcweir } while ( pFrm && IsAnLower( pFrm ) ) ;
3350cdf0e10cSrcweir }
3351cdf0e10cSrcweir
3352cdf0e10cSrcweir /*************************************************************************
3353cdf0e10cSrcweir |*
3354cdf0e10cSrcweir |* SwLayoutFrm::CalcRel()
3355cdf0e10cSrcweir |*
3356cdf0e10cSrcweir |* Ersterstellung MA 13. Jun. 96
3357cdf0e10cSrcweir |* Letzte Aenderung MA 10. Oct. 96
3358cdf0e10cSrcweir |*
3359cdf0e10cSrcweir |*************************************************************************/
CalcRel(const SwFmtFrmSize & rSz,sal_Bool) const3360cdf0e10cSrcweir long SwLayoutFrm::CalcRel( const SwFmtFrmSize &rSz, sal_Bool ) const
3361cdf0e10cSrcweir {
3362cdf0e10cSrcweir long nRet = rSz.GetWidth(),
3363cdf0e10cSrcweir nPercent = rSz.GetWidthPercent();
3364cdf0e10cSrcweir
3365cdf0e10cSrcweir if ( nPercent )
3366cdf0e10cSrcweir {
3367cdf0e10cSrcweir const SwFrm *pRel = GetUpper();
3368cdf0e10cSrcweir long nRel = LONG_MAX;
3369cdf0e10cSrcweir const ViewShell *pSh = getRootFrm()->GetCurrShell();
3370cdf0e10cSrcweir const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
3371cdf0e10cSrcweir if( pRel->IsPageBodyFrm() && pSh && bBrowseMode && pSh->VisArea().Width() )
3372cdf0e10cSrcweir {
3373cdf0e10cSrcweir nRel = pSh->GetBrowseWidth();
3374cdf0e10cSrcweir long nDiff = nRel - pRel->Prt().Width();
3375cdf0e10cSrcweir if ( nDiff > 0 )
3376cdf0e10cSrcweir nRel -= nDiff;
3377cdf0e10cSrcweir }
3378cdf0e10cSrcweir nRel = Min( nRel, pRel->Prt().Width() );
3379cdf0e10cSrcweir nRet = nRel * nPercent / 100;
3380cdf0e10cSrcweir }
3381cdf0e10cSrcweir return nRet;
3382cdf0e10cSrcweir }
3383cdf0e10cSrcweir
3384cdf0e10cSrcweir /*************************************************************************
3385cdf0e10cSrcweir |* Local helpers for SwLayoutFrm::FormatWidthCols()
3386cdf0e10cSrcweir |*************************************************************************/
lcl_CalcMinColDiff(SwLayoutFrm * pLayFrm)3387cdf0e10cSrcweir long MA_FASTCALL lcl_CalcMinColDiff( SwLayoutFrm *pLayFrm )
3388cdf0e10cSrcweir {
3389cdf0e10cSrcweir long nDiff = 0, nFirstDiff = 0;
3390cdf0e10cSrcweir SwLayoutFrm *pCol = (SwLayoutFrm*)pLayFrm->Lower();
3391cdf0e10cSrcweir ASSERT( pCol, "Where's the columnframe?" );
3392cdf0e10cSrcweir SwFrm *pFrm = pCol->Lower();
3393cdf0e10cSrcweir do
3394cdf0e10cSrcweir {
3395cdf0e10cSrcweir if( pFrm && pFrm->IsBodyFrm() )
3396cdf0e10cSrcweir pFrm = ((SwBodyFrm*)pFrm)->Lower();
3397cdf0e10cSrcweir if ( pFrm && pFrm->IsTxtFrm() )
3398cdf0e10cSrcweir {
3399cdf0e10cSrcweir const long nTmp = ((SwTxtFrm*)pFrm)->FirstLineHeight();
3400cdf0e10cSrcweir if ( nTmp != USHRT_MAX )
3401cdf0e10cSrcweir {
3402cdf0e10cSrcweir if ( pCol == pLayFrm->Lower() )
3403cdf0e10cSrcweir nFirstDiff = nTmp;
3404cdf0e10cSrcweir else
3405cdf0e10cSrcweir nDiff = nDiff ? Min( nDiff, nTmp ) : nTmp;
3406cdf0e10cSrcweir }
3407cdf0e10cSrcweir }
3408cdf0e10cSrcweir //Leere Spalten ueberspringen!
3409cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetNext();
3410cdf0e10cSrcweir while ( pCol && 0 == (pFrm = pCol->Lower()) )
3411cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetNext();
3412cdf0e10cSrcweir
3413cdf0e10cSrcweir } while ( pFrm && pCol );
3414cdf0e10cSrcweir
3415cdf0e10cSrcweir return nDiff ? nDiff : nFirstDiff ? nFirstDiff : 240;
3416cdf0e10cSrcweir }
3417cdf0e10cSrcweir
lcl_IsFlyHeightClipped(SwLayoutFrm * pLay)3418cdf0e10cSrcweir sal_Bool lcl_IsFlyHeightClipped( SwLayoutFrm *pLay )
3419cdf0e10cSrcweir {
3420cdf0e10cSrcweir SwFrm *pFrm = pLay->ContainsCntnt();
3421cdf0e10cSrcweir while ( pFrm )
3422cdf0e10cSrcweir {
3423cdf0e10cSrcweir if ( pFrm->IsInTab() )
3424cdf0e10cSrcweir pFrm = pFrm->FindTabFrm();
3425cdf0e10cSrcweir
3426cdf0e10cSrcweir if ( pFrm->GetDrawObjs() )
3427cdf0e10cSrcweir {
3428cdf0e10cSrcweir sal_uInt32 nCnt = pFrm->GetDrawObjs()->Count();
3429cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nCnt; ++i )
3430cdf0e10cSrcweir {
3431cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
3432cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
3433cdf0e10cSrcweir {
3434cdf0e10cSrcweir SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
3435cdf0e10cSrcweir if ( pFly->IsHeightClipped() &&
3436cdf0e10cSrcweir ( !pFly->IsFlyFreeFrm() || pFly->GetPageFrm() ) )
3437cdf0e10cSrcweir return sal_True;
3438cdf0e10cSrcweir }
3439cdf0e10cSrcweir }
3440cdf0e10cSrcweir }
3441cdf0e10cSrcweir pFrm = pFrm->FindNextCnt();
3442cdf0e10cSrcweir }
3443cdf0e10cSrcweir return sal_False;
3444cdf0e10cSrcweir }
3445cdf0e10cSrcweir
3446cdf0e10cSrcweir /*************************************************************************
3447cdf0e10cSrcweir |* SwLayoutFrm::FormatWidthCols()
3448cdf0e10cSrcweir |*************************************************************************/
FormatWidthCols(const SwBorderAttrs & rAttrs,const SwTwips nBorder,const SwTwips nMinHeight)3449cdf0e10cSrcweir void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs,
3450cdf0e10cSrcweir const SwTwips nBorder, const SwTwips nMinHeight )
3451cdf0e10cSrcweir {
3452cdf0e10cSrcweir //Wenn Spalten im Spiel sind, so wird die Groesse an der
3453cdf0e10cSrcweir //letzten Spalte ausgerichtet.
3454cdf0e10cSrcweir //1. Inhalt formatieren.
3455cdf0e10cSrcweir //2. Hoehe der letzten Spalte ermitteln, wenn diese zu
3456cdf0e10cSrcweir // zu gross ist muss der Fly wachsen.
3457cdf0e10cSrcweir // Der Betrag um den der Fly waechst ist aber nicht etwa
3458cdf0e10cSrcweir // der Betrag des Ueberhangs, denn wir muessen davon
3459cdf0e10cSrcweir // ausgehen, dass etwas Masse zurueckfliesst und so
3460cdf0e10cSrcweir // zusaetzlicher Platz geschaffen wird.
3461cdf0e10cSrcweir // Im Ersten Ansatz ist der Betrag um den gewachsen wird
3462cdf0e10cSrcweir // der Ueberhang geteilt durch die Spaltenanzahl oder
3463cdf0e10cSrcweir // der Ueberhang selbst wenn er kleiner als die Spalten-
3464cdf0e10cSrcweir // anzahl ist.
3465cdf0e10cSrcweir //3. Weiter mit 1. bis zur Stabilitaet.
3466cdf0e10cSrcweir
3467cdf0e10cSrcweir const SwFmtCol &rCol = rAttrs.GetAttrSet().GetCol();
3468cdf0e10cSrcweir const sal_uInt16 nNumCols = rCol.GetNumCols();
3469cdf0e10cSrcweir
3470cdf0e10cSrcweir sal_Bool bEnd = sal_False;
3471cdf0e10cSrcweir sal_Bool bBackLock = sal_False;
3472cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
3473cdf0e10cSrcweir SwViewImp *pImp = pSh ? pSh->Imp() : 0;
3474cdf0e10cSrcweir {
3475cdf0e10cSrcweir // Zugrunde liegender Algorithmus
3476cdf0e10cSrcweir // Es wird versucht, eine optimale Hoehe fuer die Spalten zu finden.
3477cdf0e10cSrcweir // nMinimum beginnt mit der uebergebenen Mindesthoehe und wird dann als
3478cdf0e10cSrcweir // Maximum der Hoehen gepflegt, bei denen noch Spalteninhalt aus einer
3479cdf0e10cSrcweir // Spalte herausragt.
3480cdf0e10cSrcweir // nMaximum beginnt bei LONG_MAX und wird als Minimum der Hoehen gepflegt,
3481cdf0e10cSrcweir // bei denen der Inhalt gepasst hat.
3482cdf0e10cSrcweir // Bei spaltigen Bereichen beginnt nMaximum bei dem maximalen Wert, den
3483cdf0e10cSrcweir // die Umgebung vorgibt, dies kann natuerlich ein Wert sein, bei dem noch
3484cdf0e10cSrcweir // Inhalt heraushaengt.
3485cdf0e10cSrcweir // Es werden die Spalten formatiert, wenn Inhalt heraushaengt, wird nMinimum
3486cdf0e10cSrcweir // ggf. angepasst, dann wird gewachsen, mindestens um nMinDiff, aber nicht ueber
3487cdf0e10cSrcweir // ein groesseres nMaximum hinaus. Wenn kein Inhalt heraushaengt, sondern
3488cdf0e10cSrcweir // noch Luft in einer Spalte ist, schrumpfen wir entsprechend, mindestens um
3489cdf0e10cSrcweir // nMinDiff, aber nicht unter das nMinimum.
3490cdf0e10cSrcweir // Abgebrochen wird, wenn kein Inhalt mehr heraushaengt und das Minimum sich auf
3491cdf0e10cSrcweir // weniger als ein MinDiff dem Maximum angenaehert hat oder das von der
3492cdf0e10cSrcweir // Umgebung vorgegebene Maximum erreicht ist und trotzdem Inhalt heraus-
3493cdf0e10cSrcweir // haengt.
3494cdf0e10cSrcweir
3495cdf0e10cSrcweir // Kritik an der Implementation
3496cdf0e10cSrcweir // 1. Es kann theoretisch Situationen geben, in denen der Inhalt in einer geringeren
3497cdf0e10cSrcweir // Hoehe passt und in einer groesseren Hoehe nicht passt. Damit der Code robust
3498cdf0e10cSrcweir // gegen solche Verhaeltnisse ist, sind ein paar Abfragen bezgl. Minimum und Maximum
3499cdf0e10cSrcweir // drin, die wahrscheinlich niemals zuschlagen koennen.
3500cdf0e10cSrcweir // 2. Es wird fuer das Schrumpfen das gleiche nMinDiff benutzt wie fuer das Wachstum,
3501cdf0e10cSrcweir // das nMinDiff ist allerdings mehr oder weniger die kleinste erste Zeilenhoehe und
3502cdf0e10cSrcweir // als Mindestwert fuer das Schrumpfen nicht unbedingt optimal.
3503cdf0e10cSrcweir
3504cdf0e10cSrcweir long nMinimum = nMinHeight;
3505cdf0e10cSrcweir long nMaximum;
3506cdf0e10cSrcweir sal_Bool bNoBalance = sal_False;
3507cdf0e10cSrcweir SWRECTFN( this )
3508cdf0e10cSrcweir if( IsSctFrm() )
3509cdf0e10cSrcweir {
3510cdf0e10cSrcweir nMaximum = (Frm().*fnRect->fnGetHeight)() - nBorder +
3511cdf0e10cSrcweir (Frm().*fnRect->fnBottomDist)(
3512cdf0e10cSrcweir (GetUpper()->*fnRect->fnGetPrtBottom)() );
3513cdf0e10cSrcweir nMaximum += GetUpper()->Grow( LONG_MAX, sal_True );
3514cdf0e10cSrcweir if( nMaximum < nMinimum )
3515cdf0e10cSrcweir {
3516cdf0e10cSrcweir if( nMaximum < 0 )
3517cdf0e10cSrcweir nMinimum = nMaximum = 0;
3518cdf0e10cSrcweir else
3519cdf0e10cSrcweir nMinimum = nMaximum;
3520cdf0e10cSrcweir }
3521cdf0e10cSrcweir if( nMaximum > BROWSE_HEIGHT )
3522cdf0e10cSrcweir nMaximum = BROWSE_HEIGHT;
3523cdf0e10cSrcweir
3524cdf0e10cSrcweir bNoBalance = ((SwSectionFrm*)this)->GetSection()->GetFmt()->
3525cdf0e10cSrcweir GetBalancedColumns().GetValue();
3526cdf0e10cSrcweir SwFrm* pAny = ContainsAny();
3527cdf0e10cSrcweir if( bNoBalance ||
3528cdf0e10cSrcweir ( !(Frm().*fnRect->fnGetHeight)() && pAny ) )
3529cdf0e10cSrcweir {
3530cdf0e10cSrcweir long nTop = (this->*fnRect->fnGetTopMargin)();
3531cdf0e10cSrcweir // --> OD 2004-11-01 #i23129# - correction: enlarge section
3532cdf0e10cSrcweir // to the calculated maximum height.
3533cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( nMaximum -
3534cdf0e10cSrcweir (Frm().*fnRect->fnGetHeight)() );
3535cdf0e10cSrcweir // <--
3536cdf0e10cSrcweir if( nTop > nMaximum )
3537cdf0e10cSrcweir nTop = nMaximum;
3538cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nTop, 0 );
3539cdf0e10cSrcweir }
3540cdf0e10cSrcweir if( !pAny && !((SwSectionFrm*)this)->IsFtnLock() )
3541cdf0e10cSrcweir {
3542cdf0e10cSrcweir SwFtnContFrm* pFtnCont = ((SwSectionFrm*)this)->ContainsFtnCont();
3543cdf0e10cSrcweir if( pFtnCont )
3544cdf0e10cSrcweir {
3545cdf0e10cSrcweir SwFrm* pFtnAny = pFtnCont->ContainsAny();
3546cdf0e10cSrcweir if( pFtnAny && pFtnAny->IsValid() )
3547cdf0e10cSrcweir {
3548cdf0e10cSrcweir bBackLock = sal_True;
3549cdf0e10cSrcweir ((SwSectionFrm*)this)->SetFtnLock( sal_True );
3550cdf0e10cSrcweir }
3551cdf0e10cSrcweir }
3552cdf0e10cSrcweir }
3553cdf0e10cSrcweir }
3554cdf0e10cSrcweir else
3555cdf0e10cSrcweir nMaximum = LONG_MAX;
3556cdf0e10cSrcweir
3557cdf0e10cSrcweir // --> OD 2004-08-25 #i3317# - reset temporarly consideration
3558cdf0e10cSrcweir // of wrapping style influence
3559cdf0e10cSrcweir SwPageFrm* pPageFrm = FindPageFrm();
3560cdf0e10cSrcweir SwSortedObjs* pObjs = pPageFrm ? pPageFrm->GetSortedObjs() : 0L;
3561cdf0e10cSrcweir if ( pObjs )
3562cdf0e10cSrcweir {
3563cdf0e10cSrcweir sal_uInt32 i = 0;
3564cdf0e10cSrcweir for ( i = 0; i < pObjs->Count(); ++i )
3565cdf0e10cSrcweir {
3566cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
3567cdf0e10cSrcweir
3568cdf0e10cSrcweir if ( IsAnLower( pAnchoredObj->GetAnchorFrm() ) )
3569cdf0e10cSrcweir {
3570cdf0e10cSrcweir pAnchoredObj->SetTmpConsiderWrapInfluence( false );
3571cdf0e10cSrcweir }
3572cdf0e10cSrcweir }
3573cdf0e10cSrcweir }
3574cdf0e10cSrcweir // <--
3575cdf0e10cSrcweir do
3576cdf0e10cSrcweir {
3577cdf0e10cSrcweir //Kann eine Weile dauern, deshalb hier auf Waitcrsr pruefen.
3578cdf0e10cSrcweir if ( pImp )
3579cdf0e10cSrcweir pImp->CheckWaitCrsr();
3580cdf0e10cSrcweir
3581cdf0e10cSrcweir bValidSize = sal_True;
3582cdf0e10cSrcweir //Erstmal die Spalten formatieren, das entlastet den
3583cdf0e10cSrcweir //Stack ein wenig.
3584cdf0e10cSrcweir //Bei der Gelegenheit stellen wir auch gleich mal die
3585cdf0e10cSrcweir //Breiten und Hoehen der Spalten ein (so sie denn falsch sind).
3586cdf0e10cSrcweir SwLayoutFrm *pCol = (SwLayoutFrm*)Lower();
3587cdf0e10cSrcweir
3588cdf0e10cSrcweir // --> FME 2004-07-19 #i27399#
3589cdf0e10cSrcweir // Simply setting the column width based on the values returned by
3590cdf0e10cSrcweir // CalcColWidth does not work for automatic column width.
3591cdf0e10cSrcweir AdjustColumns( &rCol, sal_False );
3592cdf0e10cSrcweir // <--
3593cdf0e10cSrcweir
3594cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < nNumCols; ++i )
3595cdf0e10cSrcweir {
3596cdf0e10cSrcweir pCol->Calc();
3597cdf0e10cSrcweir // ColumnFrms besitzen jetzt einen BodyFrm, der auch kalkuliert werden will
3598cdf0e10cSrcweir pCol->Lower()->Calc();
3599cdf0e10cSrcweir if( pCol->Lower()->GetNext() )
3600cdf0e10cSrcweir pCol->Lower()->GetNext()->Calc(); // SwFtnCont
3601cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetNext();
3602cdf0e10cSrcweir }
3603cdf0e10cSrcweir
3604cdf0e10cSrcweir ::CalcCntnt( this );
3605cdf0e10cSrcweir
3606cdf0e10cSrcweir pCol = (SwLayoutFrm*)Lower();
3607cdf0e10cSrcweir ASSERT( pCol && pCol->GetNext(), ":-( Spalten auf Urlaub?");
3608cdf0e10cSrcweir // bMinDiff wird gesetzt, wenn es keine leere Spalte gibt
3609cdf0e10cSrcweir sal_Bool bMinDiff = sal_True;
3610cdf0e10cSrcweir // OD 28.03.2003 #108446# - check for all column content and all columns
3611cdf0e10cSrcweir while ( bMinDiff && pCol )
3612cdf0e10cSrcweir {
3613cdf0e10cSrcweir bMinDiff = 0 != pCol->ContainsCntnt();
3614cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetNext();
3615cdf0e10cSrcweir }
3616cdf0e10cSrcweir pCol = (SwLayoutFrm*)Lower();
3617cdf0e10cSrcweir // OD 28.03.2003 #108446# - initialize local variable
3618cdf0e10cSrcweir SwFrm *pLow = NULL;
3619cdf0e10cSrcweir SwTwips nDiff = 0;
3620cdf0e10cSrcweir SwTwips nMaxFree = 0;
3621cdf0e10cSrcweir SwTwips nAllFree = LONG_MAX;
3622cdf0e10cSrcweir // bFoundLower wird gesetzt, wenn es mind. eine nichtleere Spalte gibt
3623cdf0e10cSrcweir sal_Bool bFoundLower = sal_False;
3624cdf0e10cSrcweir while( pCol )
3625cdf0e10cSrcweir {
3626cdf0e10cSrcweir SwLayoutFrm* pLay = (SwLayoutFrm*)pCol->Lower();
3627cdf0e10cSrcweir SwTwips nInnerHeight = (pLay->Frm().*fnRect->fnGetHeight)() -
3628cdf0e10cSrcweir (pLay->Prt().*fnRect->fnGetHeight)();
3629cdf0e10cSrcweir if( pLay->Lower() )
3630cdf0e10cSrcweir {
3631cdf0e10cSrcweir bFoundLower = sal_True;
3632cdf0e10cSrcweir nInnerHeight += pLay->InnerHeight();
3633cdf0e10cSrcweir }
3634cdf0e10cSrcweir else if( nInnerHeight < 0 )
3635cdf0e10cSrcweir nInnerHeight = 0;
3636cdf0e10cSrcweir
3637cdf0e10cSrcweir if( pLay->GetNext() )
3638cdf0e10cSrcweir {
3639cdf0e10cSrcweir bFoundLower = sal_True;
3640cdf0e10cSrcweir pLay = (SwLayoutFrm*)pLay->GetNext();
3641cdf0e10cSrcweir ASSERT( pLay->IsFtnContFrm(),"FtnContainer exspected" );
3642cdf0e10cSrcweir nInnerHeight += pLay->InnerHeight();
3643cdf0e10cSrcweir nInnerHeight += (pLay->Frm().*fnRect->fnGetHeight)() -
3644cdf0e10cSrcweir (pLay->Prt().*fnRect->fnGetHeight)();
3645cdf0e10cSrcweir }
3646cdf0e10cSrcweir nInnerHeight -= (pCol->Prt().*fnRect->fnGetHeight)();
3647cdf0e10cSrcweir if( nInnerHeight > nDiff )
3648cdf0e10cSrcweir {
3649cdf0e10cSrcweir nDiff = nInnerHeight;
3650cdf0e10cSrcweir nAllFree = 0;
3651cdf0e10cSrcweir }
3652cdf0e10cSrcweir else
3653cdf0e10cSrcweir {
3654cdf0e10cSrcweir if( nMaxFree < -nInnerHeight )
3655cdf0e10cSrcweir nMaxFree = -nInnerHeight;
3656cdf0e10cSrcweir if( nAllFree > -nInnerHeight )
3657cdf0e10cSrcweir nAllFree = -nInnerHeight;
3658cdf0e10cSrcweir }
3659cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetNext();
3660cdf0e10cSrcweir }
3661cdf0e10cSrcweir
3662cdf0e10cSrcweir if ( bFoundLower || ( IsSctFrm() && ((SwSectionFrm*)this)->HasFollow() ) )
3663cdf0e10cSrcweir {
3664cdf0e10cSrcweir SwTwips nMinDiff = ::lcl_CalcMinColDiff( this );
3665cdf0e10cSrcweir // Hier wird entschieden, ob wir wachsen muessen, naemlich wenn
3666cdf0e10cSrcweir // ein Spalteninhalt (nDiff) oder ein Fly herausragt.
3667cdf0e10cSrcweir // Bei spaltigen Bereichen wird beruecksichtigt, dass mit dem
3668cdf0e10cSrcweir // Besitz eines nichtleeren Follows die Groesse festgelegt ist.
3669cdf0e10cSrcweir if ( nDiff || ::lcl_IsFlyHeightClipped( this ) ||
3670cdf0e10cSrcweir ( IsSctFrm() && ((SwSectionFrm*)this)->CalcMinDiff( nMinDiff ) ) )
3671cdf0e10cSrcweir {
3672cdf0e10cSrcweir long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
3673cdf0e10cSrcweir // Das Minimum darf nicht kleiner sein als unsere PrtHeight,
3674cdf0e10cSrcweir // solange noch etwas herausragt.
3675cdf0e10cSrcweir if( nMinimum < nPrtHeight )
3676cdf0e10cSrcweir nMinimum = nPrtHeight;
3677cdf0e10cSrcweir // Es muss sichergestellt sein, dass das Maximum nicht kleiner
3678cdf0e10cSrcweir // als die PrtHeight ist, wenn noch etwas herausragt
3679cdf0e10cSrcweir if( nMaximum < nPrtHeight )
3680cdf0e10cSrcweir nMaximum = nPrtHeight; // Robust, aber kann das ueberhaupt eintreten?
3681cdf0e10cSrcweir if( !nDiff ) // wenn nur Flys herausragen, wachsen wir um nMinDiff
3682cdf0e10cSrcweir nDiff = nMinDiff;
3683cdf0e10cSrcweir // Wenn wir um mehr als nMinDiff wachsen wollen, wird dies auf die
3684cdf0e10cSrcweir // Spalten verteilt
3685cdf0e10cSrcweir if ( Abs(nDiff - nMinDiff) > nNumCols && nDiff > (long)nNumCols )
3686cdf0e10cSrcweir nDiff /= nNumCols;
3687cdf0e10cSrcweir
3688cdf0e10cSrcweir if ( bMinDiff )
3689cdf0e10cSrcweir { // Wenn es keinen leeren Spalten gibt, wollen wir mind. um nMinDiff
3690cdf0e10cSrcweir // wachsen. Sonderfall: Wenn wir kleiner als die minimale Frmhoehe
3691cdf0e10cSrcweir // sind und die PrtHeight kleiner als nMinDiff ist, wachsen wir so,
3692cdf0e10cSrcweir // dass die PrtHeight hinterher genau nMinDiff ist.
3693cdf0e10cSrcweir long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
3694cdf0e10cSrcweir if ( nFrmHeight > nMinHeight || nPrtHeight >= nMinDiff )
3695cdf0e10cSrcweir nDiff = Max( nDiff, nMinDiff );
3696cdf0e10cSrcweir else if( nDiff < nMinDiff )
3697cdf0e10cSrcweir nDiff = nMinDiff - nPrtHeight + 1;
3698cdf0e10cSrcweir }
3699cdf0e10cSrcweir // nMaximum ist eine Groesse, in der der Inhalt gepasst hat,
3700cdf0e10cSrcweir // oder der von der Umgebung vorgegebene Wert, deshalb
3701cdf0e10cSrcweir // brauchen wir nicht ueber diesen Wrt hinauswachsen.
3702cdf0e10cSrcweir if( nDiff + nPrtHeight > nMaximum )
3703cdf0e10cSrcweir nDiff = nMaximum - nPrtHeight;
3704cdf0e10cSrcweir }
3705cdf0e10cSrcweir else if( nMaximum > nMinimum ) // Wir passen, haben wir auch noch Spielraum?
3706cdf0e10cSrcweir {
3707cdf0e10cSrcweir long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
3708cdf0e10cSrcweir if ( nMaximum < nPrtHeight )
3709cdf0e10cSrcweir nDiff = nMaximum - nPrtHeight; // wir sind ueber eine funktionierende
3710cdf0e10cSrcweir // Hoehe hinausgewachsen und schrumpfen wieder auf diese zurueck,
3711cdf0e10cSrcweir // aber kann das ueberhaupt eintreten?
3712cdf0e10cSrcweir else
3713cdf0e10cSrcweir { // Wir haben ein neues Maximum, eine Groesse, fuer die der Inhalt passt.
3714cdf0e10cSrcweir nMaximum = nPrtHeight;
3715cdf0e10cSrcweir // Wenn der Freiraum in den Spalten groesser ist als nMinDiff und wir
3716cdf0e10cSrcweir // nicht dadurch wieder unter das Minimum rutschen, wollen wir ein wenig
3717cdf0e10cSrcweir // Luft herauslassen.
3718cdf0e10cSrcweir if ( !bNoBalance &&
3719cdf0e10cSrcweir // --> OD 2004-11-04 #i23129# - <nMinDiff> can be
3720cdf0e10cSrcweir // big, because of an object at the beginning of
3721cdf0e10cSrcweir // a column. Thus, decrease optimization here.
3722cdf0e10cSrcweir //nMaxFree >= nMinDiff &&
3723cdf0e10cSrcweir nMaxFree > 0 &&
3724cdf0e10cSrcweir // <--
3725cdf0e10cSrcweir ( !nAllFree ||
3726cdf0e10cSrcweir nMinimum < nPrtHeight - nMinDiff ) )
3727cdf0e10cSrcweir {
3728cdf0e10cSrcweir nMaxFree /= nNumCols; // auf die Spalten verteilen
3729cdf0e10cSrcweir nDiff = nMaxFree < nMinDiff ? -nMinDiff : -nMaxFree; // mind. nMinDiff
3730cdf0e10cSrcweir if( nPrtHeight + nDiff <= nMinimum ) // Unter das Minimum?
3731cdf0e10cSrcweir nDiff = ( nMinimum - nMaximum ) / 2; // dann lieber die Mitte
3732cdf0e10cSrcweir }
3733cdf0e10cSrcweir else if( nAllFree )
3734cdf0e10cSrcweir {
3735cdf0e10cSrcweir nDiff = -nAllFree;
3736cdf0e10cSrcweir if( nPrtHeight + nDiff <= nMinimum ) // Less than minimum?
3737cdf0e10cSrcweir nDiff = ( nMinimum - nMaximum ) / 2; // Take the center
3738cdf0e10cSrcweir }
3739cdf0e10cSrcweir }
3740cdf0e10cSrcweir }
3741cdf0e10cSrcweir if( nDiff ) // jetzt wird geschrumpft oder gewachsen..
3742cdf0e10cSrcweir {
3743cdf0e10cSrcweir Size aOldSz( Prt().SSize() );
3744cdf0e10cSrcweir long nTop = (this->*fnRect->fnGetTopMargin)();
3745cdf0e10cSrcweir nDiff = (Prt().*fnRect->fnGetHeight)() + nDiff + nBorder -
3746cdf0e10cSrcweir (Frm().*fnRect->fnGetHeight)();
3747cdf0e10cSrcweir (Frm().*fnRect->fnAddBottom)( nDiff );
3748cdf0e10cSrcweir // --> OD 2006-08-16 #i68520#
3749cdf0e10cSrcweir if ( dynamic_cast<SwFlyFrm*>(this) )
3750cdf0e10cSrcweir {
3751cdf0e10cSrcweir dynamic_cast<SwFlyFrm*>(this)->InvalidateObjRectWithSpaces();
3752cdf0e10cSrcweir }
3753cdf0e10cSrcweir // <--
3754cdf0e10cSrcweir (this->*fnRect->fnSetYMargins)( nTop, nBorder - nTop );
3755cdf0e10cSrcweir ChgLowersProp( aOldSz );
3756cdf0e10cSrcweir NotifyLowerObjs();
3757cdf0e10cSrcweir
3758cdf0e10cSrcweir // --> OD 2004-08-25 #i3317# - reset temporarly consideration
3759cdf0e10cSrcweir // of wrapping style influence
3760cdf0e10cSrcweir SwPageFrm* pTmpPageFrm = FindPageFrm();
3761cdf0e10cSrcweir SwSortedObjs* pTmpObjs = pTmpPageFrm ? pTmpPageFrm->GetSortedObjs() : 0L;
3762cdf0e10cSrcweir if ( pTmpObjs )
3763cdf0e10cSrcweir {
3764cdf0e10cSrcweir sal_uInt32 i = 0;
3765cdf0e10cSrcweir for ( i = 0; i < pTmpObjs->Count(); ++i )
3766cdf0e10cSrcweir {
3767cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pTmpObjs)[i];
3768cdf0e10cSrcweir
3769cdf0e10cSrcweir if ( IsAnLower( pAnchoredObj->GetAnchorFrm() ) )
3770cdf0e10cSrcweir {
3771cdf0e10cSrcweir pAnchoredObj->SetTmpConsiderWrapInfluence( false );
3772cdf0e10cSrcweir }
3773cdf0e10cSrcweir }
3774cdf0e10cSrcweir }
3775cdf0e10cSrcweir // <--
3776cdf0e10cSrcweir //Es muss geeignet invalidiert werden, damit
3777cdf0e10cSrcweir //sich die Frms huebsch ausbalancieren
3778cdf0e10cSrcweir //- Der jeweils erste ab der zweiten Spalte bekommt
3779cdf0e10cSrcweir // ein InvalidatePos();
3780cdf0e10cSrcweir pCol = (SwLayoutFrm*)Lower()->GetNext();
3781cdf0e10cSrcweir while ( pCol )
3782cdf0e10cSrcweir {
3783cdf0e10cSrcweir pLow = pCol->Lower();
3784cdf0e10cSrcweir if ( pLow )
3785cdf0e10cSrcweir pLow->_InvalidatePos();
3786cdf0e10cSrcweir pCol = (SwLayoutFrm*)pCol->GetNext();
3787cdf0e10cSrcweir }
3788cdf0e10cSrcweir if( IsSctFrm() && ((SwSectionFrm*)this)->HasFollow() )
3789cdf0e10cSrcweir {
3790cdf0e10cSrcweir // Wenn wir einen Follow erzeugt haben, muessen wir
3791cdf0e10cSrcweir // seinem Inhalt die Chance geben, im CalcCntnt
3792cdf0e10cSrcweir // zurueckzufliessen
3793cdf0e10cSrcweir SwCntntFrm* pTmpCntnt =
3794cdf0e10cSrcweir ((SwSectionFrm*)this)->GetFollow()->ContainsCntnt();
3795cdf0e10cSrcweir if( pTmpCntnt )
3796cdf0e10cSrcweir pTmpCntnt->_InvalidatePos();
3797cdf0e10cSrcweir }
3798cdf0e10cSrcweir }
3799cdf0e10cSrcweir else
3800cdf0e10cSrcweir bEnd = sal_True;
3801cdf0e10cSrcweir }
3802cdf0e10cSrcweir else
3803cdf0e10cSrcweir bEnd = sal_True;
3804cdf0e10cSrcweir
3805cdf0e10cSrcweir } while ( !bEnd || !bValidSize );
3806cdf0e10cSrcweir }
3807cdf0e10cSrcweir // OD 01.04.2003 #108446# - Don't collect endnotes for sections. Thus, set
3808cdf0e10cSrcweir // 2nd parameter to <true>.
3809cdf0e10cSrcweir ::CalcCntnt( this, true );
3810cdf0e10cSrcweir if( IsSctFrm() )
3811cdf0e10cSrcweir {
3812cdf0e10cSrcweir // OD 14.03.2003 #i11760# - adjust 2nd parameter - sal_True --> true
3813cdf0e10cSrcweir ::CalcCntnt( this, true );
3814cdf0e10cSrcweir if( bBackLock )
3815cdf0e10cSrcweir ((SwSectionFrm*)this)->SetFtnLock( sal_False );
3816cdf0e10cSrcweir }
3817cdf0e10cSrcweir }
3818cdf0e10cSrcweir
3819cdf0e10cSrcweir
3820cdf0e10cSrcweir /*************************************************************************
3821cdf0e10cSrcweir |*
3822cdf0e10cSrcweir |* SwRootFrm::InvalidateAllCntnt()
3823cdf0e10cSrcweir |*
3824cdf0e10cSrcweir |* Ersterstellung MA 13. Feb. 98
3825cdf0e10cSrcweir |* Letzte Aenderung MA 12. Aug. 00
3826cdf0e10cSrcweir |*
3827cdf0e10cSrcweir |*************************************************************************/
3828cdf0e10cSrcweir
lcl_InvalidateSection(SwFrm * pCnt,sal_uInt8 nInv)3829cdf0e10cSrcweir SwCntntFrm* lcl_InvalidateSection( SwFrm *pCnt, sal_uInt8 nInv )
3830cdf0e10cSrcweir {
3831cdf0e10cSrcweir SwSectionFrm* pSect = pCnt->FindSctFrm();
3832cdf0e10cSrcweir // Wenn unser CntntFrm in einer Tabelle oder Fussnote steht, sind nur
3833cdf0e10cSrcweir // Bereiche gemeint, die ebenfalls innerhalb liegen.
3834cdf0e10cSrcweir // Ausnahme: Wenn direkt eine Tabelle uebergeben wird.
3835cdf0e10cSrcweir if( ( ( pCnt->IsInTab() && !pSect->IsInTab() ) ||
3836cdf0e10cSrcweir ( pCnt->IsInFtn() && !pSect->IsInFtn() ) ) && !pCnt->IsTabFrm() )
3837cdf0e10cSrcweir return NULL;
3838cdf0e10cSrcweir if( nInv & INV_SIZE )
3839cdf0e10cSrcweir pSect->_InvalidateSize();
3840cdf0e10cSrcweir if( nInv & INV_POS )
3841cdf0e10cSrcweir pSect->_InvalidatePos();
3842cdf0e10cSrcweir if( nInv & INV_PRTAREA )
3843cdf0e10cSrcweir pSect->_InvalidatePrt();
3844cdf0e10cSrcweir SwFlowFrm *pFoll = pSect->GetFollow();
3845cdf0e10cSrcweir // Temporary separation from follow
3846cdf0e10cSrcweir pSect->SetFollow( NULL );
3847cdf0e10cSrcweir SwCntntFrm* pRet = pSect->FindLastCntnt();
3848cdf0e10cSrcweir pSect->SetFollow( pFoll );
3849cdf0e10cSrcweir return pRet;
3850cdf0e10cSrcweir }
3851cdf0e10cSrcweir
lcl_InvalidateTable(SwTabFrm * pTable,sal_uInt8 nInv)3852cdf0e10cSrcweir SwCntntFrm* lcl_InvalidateTable( SwTabFrm *pTable, sal_uInt8 nInv )
3853cdf0e10cSrcweir {
3854cdf0e10cSrcweir if( ( nInv & INV_SECTION ) && pTable->IsInSct() )
3855cdf0e10cSrcweir lcl_InvalidateSection( pTable, nInv );
3856cdf0e10cSrcweir if( nInv & INV_SIZE )
3857cdf0e10cSrcweir pTable->_InvalidateSize();
3858cdf0e10cSrcweir if( nInv & INV_POS )
3859cdf0e10cSrcweir pTable->_InvalidatePos();
3860cdf0e10cSrcweir if( nInv & INV_PRTAREA )
3861cdf0e10cSrcweir pTable->_InvalidatePrt();
3862cdf0e10cSrcweir return pTable->FindLastCntnt();
3863cdf0e10cSrcweir }
3864cdf0e10cSrcweir
3865cdf0e10cSrcweir void lcl_InvalidateAllCntnt( SwCntntFrm *pCnt, sal_uInt8 nInv );
3866cdf0e10cSrcweir
lcl_InvalidateCntnt(SwCntntFrm * pCnt,sal_uInt8 nInv)3867cdf0e10cSrcweir void lcl_InvalidateCntnt( SwCntntFrm *pCnt, sal_uInt8 nInv )
3868cdf0e10cSrcweir {
3869cdf0e10cSrcweir SwCntntFrm *pLastTabCnt = NULL;
3870cdf0e10cSrcweir SwCntntFrm *pLastSctCnt = NULL;
3871cdf0e10cSrcweir while ( pCnt )
3872cdf0e10cSrcweir {
3873cdf0e10cSrcweir if( nInv & INV_SECTION )
3874cdf0e10cSrcweir {
3875cdf0e10cSrcweir if( pCnt->IsInSct() )
3876cdf0e10cSrcweir {
3877cdf0e10cSrcweir // Siehe oben bei Tabellen
3878cdf0e10cSrcweir if( !pLastSctCnt )
3879cdf0e10cSrcweir pLastSctCnt = lcl_InvalidateSection( pCnt, nInv );
3880cdf0e10cSrcweir if( pLastSctCnt == pCnt )
3881cdf0e10cSrcweir pLastSctCnt = NULL;
3882cdf0e10cSrcweir }
3883cdf0e10cSrcweir #ifdef DBG_UTIL
3884cdf0e10cSrcweir else
3885cdf0e10cSrcweir ASSERT( !pLastSctCnt, "Where's the last SctCntnt?" );
3886cdf0e10cSrcweir #endif
3887cdf0e10cSrcweir }
3888cdf0e10cSrcweir if( nInv & INV_TABLE )
3889cdf0e10cSrcweir {
3890cdf0e10cSrcweir if( pCnt->IsInTab() )
3891cdf0e10cSrcweir {
3892cdf0e10cSrcweir // Um nicht fuer jeden CntntFrm einer Tabelle das FindTabFrm() zu rufen
3893cdf0e10cSrcweir // und wieder die gleiche Tabelle zu invalidieren, merken wir uns den letzten
3894cdf0e10cSrcweir // CntntFrm der Tabelle und reagieren erst wieder auf IsInTab(), wenn wir
3895cdf0e10cSrcweir // an diesem vorbei sind.
3896cdf0e10cSrcweir // Beim Eintritt in die Tabelle wird der LastSctCnt auf Null gesetzt,
3897cdf0e10cSrcweir // damit Bereiche im Innern der Tabelle richtig invalidiert werden.
3898cdf0e10cSrcweir // Sollte die Tabelle selbst in einem Bereich stehen, so wird an
3899cdf0e10cSrcweir // diesem die Invalidierung bis zu dreimal durchgefuehrt, das ist vertretbar.
3900cdf0e10cSrcweir if( !pLastTabCnt )
3901cdf0e10cSrcweir {
3902cdf0e10cSrcweir pLastTabCnt = lcl_InvalidateTable( pCnt->FindTabFrm(), nInv );
3903cdf0e10cSrcweir pLastSctCnt = NULL;
3904cdf0e10cSrcweir }
3905cdf0e10cSrcweir if( pLastTabCnt == pCnt )
3906cdf0e10cSrcweir {
3907cdf0e10cSrcweir pLastTabCnt = NULL;
3908cdf0e10cSrcweir pLastSctCnt = NULL;
3909cdf0e10cSrcweir }
3910cdf0e10cSrcweir }
3911cdf0e10cSrcweir #ifdef DBG_UTIL
3912cdf0e10cSrcweir else
3913cdf0e10cSrcweir ASSERT( !pLastTabCnt, "Where's the last TabCntnt?" );
3914cdf0e10cSrcweir #endif
3915cdf0e10cSrcweir }
3916cdf0e10cSrcweir
3917cdf0e10cSrcweir if( nInv & INV_SIZE )
3918cdf0e10cSrcweir pCnt->Prepare( PREP_CLEAR, 0, sal_False );
3919cdf0e10cSrcweir if( nInv & INV_POS )
3920cdf0e10cSrcweir pCnt->_InvalidatePos();
3921cdf0e10cSrcweir if( nInv & INV_PRTAREA )
3922cdf0e10cSrcweir pCnt->_InvalidatePrt();
3923cdf0e10cSrcweir if ( nInv & INV_LINENUM )
3924cdf0e10cSrcweir pCnt->InvalidateLineNum();
3925cdf0e10cSrcweir if ( pCnt->GetDrawObjs() )
3926cdf0e10cSrcweir lcl_InvalidateAllCntnt( pCnt, nInv );
3927cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
3928cdf0e10cSrcweir }
3929cdf0e10cSrcweir }
3930cdf0e10cSrcweir
lcl_InvalidateAllCntnt(SwCntntFrm * pCnt,sal_uInt8 nInv)3931cdf0e10cSrcweir void lcl_InvalidateAllCntnt( SwCntntFrm *pCnt, sal_uInt8 nInv )
3932cdf0e10cSrcweir {
3933cdf0e10cSrcweir SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
3934cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
3935cdf0e10cSrcweir {
3936cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = rObjs[i];
3937cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
3938cdf0e10cSrcweir {
3939cdf0e10cSrcweir SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
3940cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() )
3941cdf0e10cSrcweir {
3942cdf0e10cSrcweir ::lcl_InvalidateCntnt( pFly->ContainsCntnt(), nInv );
3943cdf0e10cSrcweir if( nInv & INV_DIRECTION )
3944cdf0e10cSrcweir pFly->CheckDirChange();
3945cdf0e10cSrcweir }
3946cdf0e10cSrcweir }
3947cdf0e10cSrcweir }
3948cdf0e10cSrcweir }
3949cdf0e10cSrcweir
InvalidateAllCntnt(sal_uInt8 nInv)3950cdf0e10cSrcweir void SwRootFrm::InvalidateAllCntnt( sal_uInt8 nInv )
3951cdf0e10cSrcweir {
3952cdf0e10cSrcweir // Erst werden alle Seitengebundenen FlyFrms abgearbeitet.
3953cdf0e10cSrcweir SwPageFrm *pPage = (SwPageFrm*)Lower();
3954cdf0e10cSrcweir while( pPage )
3955cdf0e10cSrcweir {
3956cdf0e10cSrcweir pPage->InvalidateFlyLayout();
3957cdf0e10cSrcweir pPage->InvalidateFlyCntnt();
3958cdf0e10cSrcweir pPage->InvalidateFlyInCnt();
3959cdf0e10cSrcweir pPage->InvalidateLayout();
3960cdf0e10cSrcweir pPage->InvalidateCntnt();
3961cdf0e10cSrcweir pPage->InvalidatePage( pPage ); //Damit ggf. auch der Turbo verschwindet
3962cdf0e10cSrcweir
3963cdf0e10cSrcweir if ( pPage->GetSortedObjs() )
3964cdf0e10cSrcweir {
3965cdf0e10cSrcweir const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
3966cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
3967cdf0e10cSrcweir {
3968cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = rObjs[i];
3969cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
3970cdf0e10cSrcweir {
3971cdf0e10cSrcweir SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
3972cdf0e10cSrcweir ::lcl_InvalidateCntnt( pFly->ContainsCntnt(), nInv );
3973cdf0e10cSrcweir if ( nInv & INV_DIRECTION )
3974cdf0e10cSrcweir pFly->CheckDirChange();
3975cdf0e10cSrcweir }
3976cdf0e10cSrcweir }
3977cdf0e10cSrcweir }
3978cdf0e10cSrcweir if( nInv & INV_DIRECTION )
3979cdf0e10cSrcweir pPage->CheckDirChange();
3980cdf0e10cSrcweir pPage = (SwPageFrm*)(pPage->GetNext());
3981cdf0e10cSrcweir }
3982cdf0e10cSrcweir
3983cdf0e10cSrcweir //Hier den gesamten Dokumentinhalt und die zeichengebundenen Flys.
3984cdf0e10cSrcweir ::lcl_InvalidateCntnt( ContainsCntnt(), nInv );
3985cdf0e10cSrcweir
3986cdf0e10cSrcweir if( nInv & INV_PRTAREA )
3987cdf0e10cSrcweir {
3988cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
3989cdf0e10cSrcweir if( pSh )
3990cdf0e10cSrcweir pSh->InvalidateWindows( Frm() );
3991cdf0e10cSrcweir }
3992cdf0e10cSrcweir }
3993cdf0e10cSrcweir
3994cdf0e10cSrcweir /** method to invalidate/re-calculate the position of all floating
3995cdf0e10cSrcweir screen objects (Writer fly frames and drawing objects), which are
3996cdf0e10cSrcweir anchored to paragraph or to character.
3997cdf0e10cSrcweir
3998cdf0e10cSrcweir OD 2004-03-16 #i11860#
3999cdf0e10cSrcweir
4000cdf0e10cSrcweir @author OD
4001cdf0e10cSrcweir */
InvalidateAllObjPos()4002cdf0e10cSrcweir void SwRootFrm::InvalidateAllObjPos()
4003cdf0e10cSrcweir {
4004cdf0e10cSrcweir const SwPageFrm* pPageFrm = static_cast<const SwPageFrm*>(Lower());
4005cdf0e10cSrcweir while( pPageFrm )
4006cdf0e10cSrcweir {
4007cdf0e10cSrcweir pPageFrm->InvalidateFlyLayout();
4008cdf0e10cSrcweir
4009cdf0e10cSrcweir if ( pPageFrm->GetSortedObjs() )
4010cdf0e10cSrcweir {
4011cdf0e10cSrcweir const SwSortedObjs& rObjs = *(pPageFrm->GetSortedObjs());
4012cdf0e10cSrcweir for ( sal_uInt8 i = 0; i < rObjs.Count(); ++i )
4013cdf0e10cSrcweir {
4014cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = rObjs[i];
4015cdf0e10cSrcweir const SwFmtAnchor& rAnch = pAnchoredObj->GetFrmFmt().GetAnchor();
4016cdf0e10cSrcweir if ((rAnch.GetAnchorId() != FLY_AT_PARA) &&
4017cdf0e10cSrcweir (rAnch.GetAnchorId() != FLY_AT_CHAR))
4018cdf0e10cSrcweir {
4019cdf0e10cSrcweir // only to paragraph and to character anchored objects are considered.
4020cdf0e10cSrcweir continue;
4021cdf0e10cSrcweir }
4022cdf0e10cSrcweir // --> OD 2004-07-07 #i28701# - special invalidation for anchored
4023cdf0e10cSrcweir // objects, whose wrapping style influence has to be considered.
4024cdf0e10cSrcweir if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
4025cdf0e10cSrcweir pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence( true );
4026cdf0e10cSrcweir else
4027cdf0e10cSrcweir pAnchoredObj->InvalidateObjPos();
4028cdf0e10cSrcweir // <--
4029cdf0e10cSrcweir }
4030cdf0e10cSrcweir }
4031cdf0e10cSrcweir
4032cdf0e10cSrcweir pPageFrm = static_cast<const SwPageFrm*>(pPageFrm->GetNext());
4033cdf0e10cSrcweir }
4034cdf0e10cSrcweir }
4035cdf0e10cSrcweir
4036cdf0e10cSrcweir
4037