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
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
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.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir #include <hintids.hxx>
27cdf0e10cSrcweir #include <tools/bigint.hxx>
28cdf0e10cSrcweir #include <svx/svdmodel.hxx>
29cdf0e10cSrcweir #include <svx/svdpage.hxx>
30cdf0e10cSrcweir #include <editeng/brshitem.hxx>
31cdf0e10cSrcweir #include <editeng/keepitem.hxx>
32cdf0e10cSrcweir #include <editeng/shaditem.hxx>
33cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
34cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
35cdf0e10cSrcweir #include <editeng/boxitem.hxx>
36cdf0e10cSrcweir #include <sfx2/printer.hxx>
37cdf0e10cSrcweir #include <editeng/lspcitem.hxx>
38cdf0e10cSrcweir
39cdf0e10cSrcweir #include <fmtornt.hxx>
40cdf0e10cSrcweir #include <fmtanchr.hxx>
41cdf0e10cSrcweir #include <fmthdft.hxx>
42cdf0e10cSrcweir #include <fmtcntnt.hxx>
43cdf0e10cSrcweir #include <fmtfsize.hxx>
44cdf0e10cSrcweir #include <fmtsrnd.hxx>
45cdf0e10cSrcweir #include <docary.hxx>
46cdf0e10cSrcweir #include <lineinfo.hxx>
47cdf0e10cSrcweir #include <swmodule.hxx>
48cdf0e10cSrcweir #include "pagefrm.hxx"
49cdf0e10cSrcweir #include "colfrm.hxx"
50cdf0e10cSrcweir #include "doc.hxx"
51cdf0e10cSrcweir #include "fesh.hxx"
52cdf0e10cSrcweir #include "viewimp.hxx"
53cdf0e10cSrcweir #include "viewopt.hxx"
54cdf0e10cSrcweir #include "pam.hxx"
55cdf0e10cSrcweir #include "dflyobj.hxx"
56cdf0e10cSrcweir #include "dcontact.hxx"
57cdf0e10cSrcweir #include "frmtool.hxx"
58cdf0e10cSrcweir #include "docsh.hxx"
59cdf0e10cSrcweir #include "tabfrm.hxx"
60cdf0e10cSrcweir #include "rowfrm.hxx"
61cdf0e10cSrcweir #include "ftnfrm.hxx"
62cdf0e10cSrcweir #include "txtfrm.hxx"
63cdf0e10cSrcweir #include "notxtfrm.hxx"
64cdf0e10cSrcweir #include "flyfrms.hxx"
65cdf0e10cSrcweir #include "layact.hxx"
66cdf0e10cSrcweir #include "pagedesc.hxx"
67cdf0e10cSrcweir #include "section.hxx"
68cdf0e10cSrcweir #include "sectfrm.hxx"
69cdf0e10cSrcweir #include "node2lay.hxx"
70cdf0e10cSrcweir #include "ndole.hxx"
71cdf0e10cSrcweir #include "ndtxt.hxx"
72cdf0e10cSrcweir #include "swtable.hxx"
73cdf0e10cSrcweir #include "hints.hxx"
74cdf0e10cSrcweir #include <layhelp.hxx>
75cdf0e10cSrcweir #include <laycache.hxx>
76cdf0e10cSrcweir #include <rootfrm.hxx>
77cdf0e10cSrcweir #include "mdiexp.hxx"
78cdf0e10cSrcweir #include "statstr.hrc"
79cdf0e10cSrcweir #include <paratr.hxx>
80cdf0e10cSrcweir #include <sortedobjs.hxx>
81cdf0e10cSrcweir #include <objectformatter.hxx>
82cdf0e10cSrcweir #include <switerator.hxx>
83cdf0e10cSrcweir
84cdf0e10cSrcweir // ftnfrm.cxx:
85cdf0e10cSrcweir void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes );
86cdf0e10cSrcweir
87cdf0e10cSrcweir using namespace ::com::sun::star;
88cdf0e10cSrcweir
89cdf0e10cSrcweir
90cdf0e10cSrcweir sal_Bool bObjsDirect = sal_True;
91cdf0e10cSrcweir sal_Bool bDontCreateObjects = sal_False;
92cdf0e10cSrcweir sal_Bool bSetCompletePaintOnInvalidate = sal_False;
93cdf0e10cSrcweir
94cdf0e10cSrcweir sal_uInt8 StackHack::nCnt = 0;
95cdf0e10cSrcweir sal_Bool StackHack::bLocked = sal_False;
96cdf0e10cSrcweir
97cdf0e10cSrcweir
98cdf0e10cSrcweir
99cdf0e10cSrcweir /*************************************************************************/
100cdf0e10cSrcweir
SwFrmNotify(SwFrm * pF)101cdf0e10cSrcweir SwFrmNotify::SwFrmNotify( SwFrm *pF ) :
102cdf0e10cSrcweir pFrm( pF ),
103cdf0e10cSrcweir aFrm( pF->Frm() ),
104cdf0e10cSrcweir aPrt( pF->Prt() ),
105cdf0e10cSrcweir bInvaKeep( sal_False ),
106cdf0e10cSrcweir bValidSize( pF->GetValidSizeFlag() ),
107cdf0e10cSrcweir mbFrmDeleted( false ) // #i49383#
108cdf0e10cSrcweir {
109cdf0e10cSrcweir if ( pF->IsTxtFrm() )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir mnFlyAnchorOfst = ((SwTxtFrm*)pF)->GetBaseOfstForFly( sal_True );
112cdf0e10cSrcweir mnFlyAnchorOfstNoWrap = ((SwTxtFrm*)pF)->GetBaseOfstForFly( sal_False );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir else
115cdf0e10cSrcweir {
116cdf0e10cSrcweir mnFlyAnchorOfst = 0;
117cdf0e10cSrcweir mnFlyAnchorOfstNoWrap = 0;
118cdf0e10cSrcweir }
119cdf0e10cSrcweir
120cdf0e10cSrcweir bHadFollow = pF->IsCntntFrm() ?
121cdf0e10cSrcweir (((SwCntntFrm*)pF)->GetFollow() ? sal_True : sal_False) :
122cdf0e10cSrcweir sal_False;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir
125cdf0e10cSrcweir /*************************************************************************/
126cdf0e10cSrcweir
~SwFrmNotify()127cdf0e10cSrcweir SwFrmNotify::~SwFrmNotify()
128cdf0e10cSrcweir {
129cdf0e10cSrcweir // #i49383#
130cdf0e10cSrcweir if ( mbFrmDeleted )
131cdf0e10cSrcweir {
132cdf0e10cSrcweir return;
133cdf0e10cSrcweir }
134cdf0e10cSrcweir
135cdf0e10cSrcweir SWRECTFN( pFrm )
136cdf0e10cSrcweir const sal_Bool bAbsP = POS_DIFF( aFrm, pFrm->Frm() );
137cdf0e10cSrcweir const sal_Bool bChgWidth =
138cdf0e10cSrcweir (aFrm.*fnRect->fnGetWidth)() != (pFrm->Frm().*fnRect->fnGetWidth)();
139cdf0e10cSrcweir const sal_Bool bChgHeight =
140cdf0e10cSrcweir (aFrm.*fnRect->fnGetHeight)()!=(pFrm->Frm().*fnRect->fnGetHeight)();
141cdf0e10cSrcweir const sal_Bool bChgFlyBasePos = pFrm->IsTxtFrm() &&
142cdf0e10cSrcweir ( ( mnFlyAnchorOfst != ((SwTxtFrm*)pFrm)->GetBaseOfstForFly( sal_True ) ) ||
143cdf0e10cSrcweir ( mnFlyAnchorOfstNoWrap != ((SwTxtFrm*)pFrm)->GetBaseOfstForFly( sal_False ) ) );
144cdf0e10cSrcweir
145cdf0e10cSrcweir if ( pFrm->IsFlowFrm() && !pFrm->IsInFtn() )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( pFrm );
148cdf0e10cSrcweir
149cdf0e10cSrcweir if ( !pFlow->IsFollow() )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir if ( !pFrm->GetIndPrev() )
152cdf0e10cSrcweir {
153cdf0e10cSrcweir if ( bInvaKeep )
154cdf0e10cSrcweir {
155cdf0e10cSrcweir SwFrm *pPre = pFrm->FindPrev();
156cdf0e10cSrcweir if ( pPre && pPre->IsFlowFrm() )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir // 1. pPre wants to keep with me:
159cdf0e10cSrcweir bool bInvalidPrePos = SwFlowFrm::CastFlowFrm( pPre )->IsKeep( *pPre->GetAttrSet() ) && pPre->GetIndPrev();
160cdf0e10cSrcweir
161cdf0e10cSrcweir // 2. pPre is a table and the last row wants to keep with me:
162cdf0e10cSrcweir if ( !bInvalidPrePos && pPre->IsTabFrm() )
163cdf0e10cSrcweir {
164cdf0e10cSrcweir SwTabFrm* pPreTab = static_cast<SwTabFrm*>(pPre);
165cdf0e10cSrcweir if ( pPreTab->GetFmt()->GetDoc()->get(IDocumentSettingAccess::TABLE_ROW_KEEP) )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir SwRowFrm* pLastRow = static_cast<SwRowFrm*>(pPreTab->GetLastLower());
168cdf0e10cSrcweir if ( pLastRow && pLastRow->ShouldRowKeepWithNext() )
169cdf0e10cSrcweir bInvalidPrePos = true;
170cdf0e10cSrcweir }
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
173cdf0e10cSrcweir if ( bInvalidPrePos )
174cdf0e10cSrcweir pPre->InvalidatePos();
175cdf0e10cSrcweir }
176cdf0e10cSrcweir }
177cdf0e10cSrcweir }
178cdf0e10cSrcweir else if ( !pFlow->HasFollow() )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir long nOldHeight = (aFrm.*fnRect->fnGetHeight)();
181cdf0e10cSrcweir long nNewHeight = (pFrm->Frm().*fnRect->fnGetHeight)();
182cdf0e10cSrcweir if( (nOldHeight > nNewHeight) || (!nOldHeight && nNewHeight) )
183cdf0e10cSrcweir pFlow->CheckKeep();
184cdf0e10cSrcweir }
185cdf0e10cSrcweir }
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
188cdf0e10cSrcweir if ( bAbsP )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir pFrm->SetCompletePaint();
191cdf0e10cSrcweir
192cdf0e10cSrcweir SwFrm* pNxt = pFrm->GetIndNext();
193cdf0e10cSrcweir // #121888# - skip empty section frames
194cdf0e10cSrcweir while ( pNxt &&
195cdf0e10cSrcweir pNxt->IsSctFrm() && !static_cast<SwSectionFrm*>(pNxt)->GetSection() )
196cdf0e10cSrcweir {
197cdf0e10cSrcweir pNxt = pNxt->GetIndNext();
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir if ( pNxt )
201cdf0e10cSrcweir pNxt->InvalidatePos();
202cdf0e10cSrcweir else
203cdf0e10cSrcweir {
204cdf0e10cSrcweir // #104100# - correct condition for setting retouche
205cdf0e10cSrcweir // flag for vertical layout.
206cdf0e10cSrcweir if( pFrm->IsRetoucheFrm() &&
207cdf0e10cSrcweir (aFrm.*fnRect->fnTopDist)( (pFrm->Frm().*fnRect->fnGetTop)() ) > 0 )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir pFrm->SetRetouche();
210cdf0e10cSrcweir }
211cdf0e10cSrcweir
212cdf0e10cSrcweir // A fresh follow frame does not have to be invalidated, because
213cdf0e10cSrcweir // it is already formatted:
214cdf0e10cSrcweir if ( bHadFollow || !pFrm->IsCntntFrm() || !((SwCntntFrm*)pFrm)->GetFollow() )
215cdf0e10cSrcweir {
216cdf0e10cSrcweir if ( !pFrm->IsTabFrm() || !((SwTabFrm*)pFrm)->GetFollow() )
217cdf0e10cSrcweir pFrm->InvalidateNextPos();
218cdf0e10cSrcweir }
219cdf0e10cSrcweir }
220cdf0e10cSrcweir }
221cdf0e10cSrcweir
222cdf0e10cSrcweir //Fuer Hintergrundgrafiken muss bei Groessenaenderungen ein Repaint her.
223cdf0e10cSrcweir const sal_Bool bPrtWidth =
224cdf0e10cSrcweir (aPrt.*fnRect->fnGetWidth)() != (pFrm->Prt().*fnRect->fnGetWidth)();
225cdf0e10cSrcweir const sal_Bool bPrtHeight =
226cdf0e10cSrcweir (aPrt.*fnRect->fnGetHeight)()!=(pFrm->Prt().*fnRect->fnGetHeight)();
227cdf0e10cSrcweir if ( bPrtWidth || bPrtHeight )
228cdf0e10cSrcweir {
229cdf0e10cSrcweir const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos();
230cdf0e10cSrcweir if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
231cdf0e10cSrcweir pFrm->SetCompletePaint();
232cdf0e10cSrcweir }
233cdf0e10cSrcweir else
234cdf0e10cSrcweir {
235cdf0e10cSrcweir // #97597# - consider case that *only* margins between
236cdf0e10cSrcweir // frame and printing area has changed. Then, frame has to be repainted,
237cdf0e10cSrcweir // in order to force paint of the margin areas.
238cdf0e10cSrcweir if ( !bAbsP && (bChgWidth || bChgHeight) )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir pFrm->SetCompletePaint();
241cdf0e10cSrcweir }
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir const sal_Bool bPrtP = POS_DIFF( aPrt, pFrm->Prt() );
245cdf0e10cSrcweir if ( bAbsP || bPrtP || bChgWidth || bChgHeight ||
246cdf0e10cSrcweir bPrtWidth || bPrtHeight || bChgFlyBasePos )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir if( pFrm->IsAccessibleFrm() )
249cdf0e10cSrcweir {
250cdf0e10cSrcweir SwRootFrm *pRootFrm = pFrm->getRootFrm();
251cdf0e10cSrcweir if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
252cdf0e10cSrcweir pRootFrm->GetCurrShell() )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( pFrm, aFrm );
255cdf0e10cSrcweir }
256cdf0e10cSrcweir }
257cdf0e10cSrcweir
258cdf0e10cSrcweir // Notification of anchored objects
259cdf0e10cSrcweir if ( pFrm->GetDrawObjs() )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir const SwSortedObjs &rObjs = *pFrm->GetDrawObjs();
262cdf0e10cSrcweir SwPageFrm* pPageFrm = 0;
263cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i )
264cdf0e10cSrcweir {
265cdf0e10cSrcweir // OD 2004-03-31 #i26791# - no general distinction between
266cdf0e10cSrcweir // Writer fly frames and drawing objects
267cdf0e10cSrcweir bool bNotify = false;
268cdf0e10cSrcweir bool bNotifySize = false;
269cdf0e10cSrcweir SwAnchoredObject* pObj = rObjs[i];
270cdf0e10cSrcweir SwContact* pContact = ::GetUserCall( pObj->GetDrawObj() );
271cdf0e10cSrcweir // --> OD 2004-12-08 #115759#
272cdf0e10cSrcweir const bool bAnchoredAsChar = pContact->ObjAnchoredAsChar();
273cdf0e10cSrcweir if ( !bAnchoredAsChar )
274cdf0e10cSrcweir // <--
275cdf0e10cSrcweir {
276cdf0e10cSrcweir // Notify object, which aren't anchored as-character:
277cdf0e10cSrcweir
278cdf0e10cSrcweir // always notify objects, if frame position has changed
279cdf0e10cSrcweir // or if the object is to-page|to-fly anchored.
280cdf0e10cSrcweir if ( bAbsP ||
281cdf0e10cSrcweir pContact->ObjAnchoredAtPage() ||
282cdf0e10cSrcweir pContact->ObjAnchoredAtFly() )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir bNotify = true;
285cdf0e10cSrcweir
286cdf0e10cSrcweir // assure that to-fly anchored Writer fly frames are
287cdf0e10cSrcweir // registered at the correct page frame, if frame
288cdf0e10cSrcweir // position has changed.
289cdf0e10cSrcweir if ( bAbsP && pContact->ObjAnchoredAtFly() &&
290cdf0e10cSrcweir pObj->ISA(SwFlyFrm) )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir // determine to-fly anchored Writer fly frame
293cdf0e10cSrcweir SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj);
294cdf0e10cSrcweir // determine page frame of to-fly anchored
295cdf0e10cSrcweir // Writer fly frame
296cdf0e10cSrcweir SwPageFrm* pFlyPageFrm = pFlyFrm->FindPageFrm();
297cdf0e10cSrcweir // determine page frame, if needed.
298cdf0e10cSrcweir if ( !pPageFrm )
299cdf0e10cSrcweir {
300cdf0e10cSrcweir pPageFrm = pFrm->FindPageFrm();
301cdf0e10cSrcweir }
302cdf0e10cSrcweir if ( pPageFrm != pFlyPageFrm )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir ASSERT( pFlyPageFrm, "~SwFrmNotify: Fly from Nowhere" );
305cdf0e10cSrcweir if( pFlyPageFrm )
306cdf0e10cSrcweir pFlyPageFrm->MoveFly( pFlyFrm, pPageFrm );
307cdf0e10cSrcweir else
308cdf0e10cSrcweir pPageFrm->AppendFlyToPage( pFlyFrm );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir }
311cdf0e10cSrcweir }
312cdf0e10cSrcweir // otherwise the objects are notified in dependence to
313cdf0e10cSrcweir // its positioning and alignment
314cdf0e10cSrcweir else
315cdf0e10cSrcweir {
316cdf0e10cSrcweir const SwFmtVertOrient& rVert =
317cdf0e10cSrcweir pContact->GetFmt()->GetVertOrient();
318cdf0e10cSrcweir if ( ( rVert.GetVertOrient() == text::VertOrientation::CENTER ||
319cdf0e10cSrcweir rVert.GetVertOrient() == text::VertOrientation::BOTTOM ||
320cdf0e10cSrcweir rVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ) &&
321cdf0e10cSrcweir ( bChgHeight || bPrtHeight ) )
322cdf0e10cSrcweir {
323cdf0e10cSrcweir bNotify = true;
324cdf0e10cSrcweir }
325cdf0e10cSrcweir if ( !bNotify )
326cdf0e10cSrcweir {
327cdf0e10cSrcweir const SwFmtHoriOrient& rHori =
328cdf0e10cSrcweir pContact->GetFmt()->GetHoriOrient();
329cdf0e10cSrcweir if ( ( rHori.GetHoriOrient() != text::HoriOrientation::NONE ||
330cdf0e10cSrcweir rHori.GetRelationOrient()== text::RelOrientation::PRINT_AREA ||
331cdf0e10cSrcweir rHori.GetRelationOrient()== text::RelOrientation::FRAME ) &&
332cdf0e10cSrcweir ( bChgWidth || bPrtWidth || bChgFlyBasePos ) )
333cdf0e10cSrcweir {
334cdf0e10cSrcweir bNotify = true;
335cdf0e10cSrcweir }
336cdf0e10cSrcweir }
337cdf0e10cSrcweir }
338cdf0e10cSrcweir }
339cdf0e10cSrcweir else if ( bPrtWidth )
340cdf0e10cSrcweir {
341cdf0e10cSrcweir // Notify as-character anchored objects, if printing area
342cdf0e10cSrcweir // width has changed.
343cdf0e10cSrcweir bNotify = true;
344cdf0e10cSrcweir bNotifySize = true;
345cdf0e10cSrcweir }
346cdf0e10cSrcweir
347cdf0e10cSrcweir // perform notification via the corresponding invalidations
348cdf0e10cSrcweir if ( bNotify )
349cdf0e10cSrcweir {
350cdf0e10cSrcweir if ( pObj->ISA(SwFlyFrm) )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj);
353cdf0e10cSrcweir if ( bNotifySize )
354cdf0e10cSrcweir pFlyFrm->_InvalidateSize();
355cdf0e10cSrcweir // --> OD 2004-12-08 #115759# - no invalidation of
356cdf0e10cSrcweir // position for as-character anchored objects.
357cdf0e10cSrcweir if ( !bAnchoredAsChar )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir pFlyFrm->_InvalidatePos();
360cdf0e10cSrcweir }
361cdf0e10cSrcweir // <--
362cdf0e10cSrcweir pFlyFrm->_Invalidate();
363cdf0e10cSrcweir }
364cdf0e10cSrcweir else if ( pObj->ISA(SwAnchoredDrawObject) )
365cdf0e10cSrcweir {
366cdf0e10cSrcweir // --> OD 2004-12-08 #115759# - no invalidation of
367cdf0e10cSrcweir // position for as-character anchored objects.
368cdf0e10cSrcweir if ( !bAnchoredAsChar )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir pObj->InvalidateObjPos();
371cdf0e10cSrcweir }
372cdf0e10cSrcweir // <--
373cdf0e10cSrcweir }
374cdf0e10cSrcweir else
375cdf0e10cSrcweir {
376cdf0e10cSrcweir ASSERT( false,
377cdf0e10cSrcweir "<SwCntntNotify::~SwCntntNotify()> - unknown anchored object type. Please inform OD." );
378cdf0e10cSrcweir }
379cdf0e10cSrcweir }
380cdf0e10cSrcweir }
381cdf0e10cSrcweir }
382cdf0e10cSrcweir }
383cdf0e10cSrcweir else if( pFrm->IsTxtFrm() && bValidSize != pFrm->GetValidSizeFlag() )
384cdf0e10cSrcweir {
385cdf0e10cSrcweir SwRootFrm *pRootFrm = pFrm->getRootFrm();
386cdf0e10cSrcweir if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
387cdf0e10cSrcweir pRootFrm->GetCurrShell() )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir pRootFrm->GetCurrShell()->Imp()->InvalidateAccessibleFrmContent( pFrm );
390cdf0e10cSrcweir }
391cdf0e10cSrcweir }
392cdf0e10cSrcweir
393cdf0e10cSrcweir // #i9046# Automatic frame width
394cdf0e10cSrcweir SwFlyFrm* pFly = 0;
395cdf0e10cSrcweir // --> FME 2004-10-21 #i35879# Do not trust the inf flags. pFrm does not
396cdf0e10cSrcweir // necessarily have to have an upper!
397cdf0e10cSrcweir if ( !pFrm->IsFlyFrm() && 0 != ( pFly = pFrm->ImplFindFlyFrm() ) )
398cdf0e10cSrcweir // <--
399cdf0e10cSrcweir {
400cdf0e10cSrcweir // --> OD 2006-05-08 #i61999#
401cdf0e10cSrcweir // no invalidation of columned Writer fly frames, because automatic
402cdf0e10cSrcweir // width doesn't make sense for such Writer fly frames.
403cdf0e10cSrcweir if ( pFly->Lower() && !pFly->Lower()->IsColumnFrm() )
404cdf0e10cSrcweir {
405cdf0e10cSrcweir const SwFmtFrmSize &rFrmSz = pFly->GetFmt()->GetFrmSize();
406cdf0e10cSrcweir
407cdf0e10cSrcweir // This could be optimized. Basically the fly frame only has to
408cdf0e10cSrcweir // be invalidated, if the first line of pFrm (if pFrm is a content
409cdf0e10cSrcweir // frame, for other frame types its the print area) has changed its
410cdf0e10cSrcweir // size and pFrm was responsible for the current width of pFly. On
411cdf0e10cSrcweir // the other hand, this is only rarely used and re-calculation of
412cdf0e10cSrcweir // the fly frame does not cause too much trouble. So we keep it this
413cdf0e10cSrcweir // way:
414cdf0e10cSrcweir if ( ATT_FIX_SIZE != rFrmSz.GetWidthSizeType() )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir // --> OD 2005-07-29 #i50668#, #i50998# - invalidation of position
417cdf0e10cSrcweir // of as-character anchored fly frames not needed and can cause
418cdf0e10cSrcweir // layout loops
419cdf0e10cSrcweir if ( !pFly->ISA(SwFlyInCntFrm) )
420cdf0e10cSrcweir {
421cdf0e10cSrcweir pFly->InvalidatePos();
422cdf0e10cSrcweir }
423cdf0e10cSrcweir // <--
424cdf0e10cSrcweir pFly->InvalidateSize();
425cdf0e10cSrcweir }
426cdf0e10cSrcweir }
427cdf0e10cSrcweir // <--
428cdf0e10cSrcweir }
429cdf0e10cSrcweir }
430cdf0e10cSrcweir
431cdf0e10cSrcweir /*************************************************************************/
432cdf0e10cSrcweir
SwLayNotify(SwLayoutFrm * pLayFrm)433cdf0e10cSrcweir SwLayNotify::SwLayNotify( SwLayoutFrm *pLayFrm ) :
434cdf0e10cSrcweir SwFrmNotify( pLayFrm ),
435cdf0e10cSrcweir bLowersComplete( sal_False )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir }
438cdf0e10cSrcweir
439cdf0e10cSrcweir /*************************************************************************/
440cdf0e10cSrcweir
441cdf0e10cSrcweir // OD 2004-05-11 #i28701# - local method to invalidate the position of all
442cdf0e10cSrcweir // frames inclusive its floating screen objects, which are lowers of the given
443cdf0e10cSrcweir // layout frame
lcl_InvalidatePosOfLowers(SwLayoutFrm & _rLayoutFrm)444cdf0e10cSrcweir void lcl_InvalidatePosOfLowers( SwLayoutFrm& _rLayoutFrm )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir if( _rLayoutFrm.IsFlyFrm() && _rLayoutFrm.GetDrawObjs() )
447cdf0e10cSrcweir {
448cdf0e10cSrcweir _rLayoutFrm.InvalidateObjs( true, false );
449cdf0e10cSrcweir }
450cdf0e10cSrcweir
451cdf0e10cSrcweir SwFrm* pLowerFrm = _rLayoutFrm.Lower();
452cdf0e10cSrcweir while ( pLowerFrm )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir pLowerFrm->InvalidatePos();
455cdf0e10cSrcweir if ( pLowerFrm->IsTxtFrm() )
456cdf0e10cSrcweir {
457cdf0e10cSrcweir static_cast<SwTxtFrm*>(pLowerFrm)->Prepare( PREP_POS_CHGD );
458cdf0e10cSrcweir }
459cdf0e10cSrcweir else if ( pLowerFrm->IsTabFrm() )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir pLowerFrm->InvalidatePrt();
462cdf0e10cSrcweir }
463cdf0e10cSrcweir
464cdf0e10cSrcweir pLowerFrm->InvalidateObjs( true, false );
465cdf0e10cSrcweir
466cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetNext();
467cdf0e10cSrcweir };
468cdf0e10cSrcweir }
469cdf0e10cSrcweir
~SwLayNotify()470cdf0e10cSrcweir SwLayNotify::~SwLayNotify()
471cdf0e10cSrcweir {
472cdf0e10cSrcweir // --> OD 2005-07-29 #i49383#
473cdf0e10cSrcweir if ( mbFrmDeleted )
474cdf0e10cSrcweir {
475cdf0e10cSrcweir return;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir // <--
478cdf0e10cSrcweir
479cdf0e10cSrcweir SwLayoutFrm *pLay = GetLay();
480cdf0e10cSrcweir SWRECTFN( pLay )
481cdf0e10cSrcweir sal_Bool bNotify = sal_False;
482cdf0e10cSrcweir if ( pLay->Prt().SSize() != aPrt.SSize() )
483cdf0e10cSrcweir {
484cdf0e10cSrcweir if ( !IsLowersComplete() )
485cdf0e10cSrcweir {
486cdf0e10cSrcweir sal_Bool bInvaPercent;
487cdf0e10cSrcweir
488cdf0e10cSrcweir if ( pLay->IsRowFrm() )
489cdf0e10cSrcweir {
490cdf0e10cSrcweir bInvaPercent = sal_True;
491cdf0e10cSrcweir long nNew = (pLay->Prt().*fnRect->fnGetHeight)();
492cdf0e10cSrcweir if( nNew != (aPrt.*fnRect->fnGetHeight)() )
493cdf0e10cSrcweir ((SwRowFrm*)pLay)->AdjustCells( nNew, sal_True);
494cdf0e10cSrcweir if( (pLay->Prt().*fnRect->fnGetWidth)()
495cdf0e10cSrcweir != (aPrt.*fnRect->fnGetWidth)() )
496cdf0e10cSrcweir ((SwRowFrm*)pLay)->AdjustCells( 0, sal_False );
497cdf0e10cSrcweir }
498cdf0e10cSrcweir else
499cdf0e10cSrcweir {
500cdf0e10cSrcweir //Proportionale Anpassung der innenliegenden.
501cdf0e10cSrcweir //1. Wenn der Formatierte kein Fly ist
502cdf0e10cSrcweir //2. Wenn er keine Spalten enthaelt
503cdf0e10cSrcweir //3. Wenn der Fly eine feste Hoehe hat und die Spalten in der
504cdf0e10cSrcweir // Hoehe danebenliegen.
505cdf0e10cSrcweir //4. niemals bei SectionFrms.
506cdf0e10cSrcweir sal_Bool bLow;
507cdf0e10cSrcweir if( pLay->IsFlyFrm() )
508cdf0e10cSrcweir {
509cdf0e10cSrcweir if ( pLay->Lower() )
510cdf0e10cSrcweir {
511cdf0e10cSrcweir bLow = !pLay->Lower()->IsColumnFrm() ||
512cdf0e10cSrcweir (pLay->Lower()->Frm().*fnRect->fnGetHeight)()
513cdf0e10cSrcweir != (pLay->Prt().*fnRect->fnGetHeight)();
514cdf0e10cSrcweir }
515cdf0e10cSrcweir else
516cdf0e10cSrcweir bLow = sal_False;
517cdf0e10cSrcweir }
518cdf0e10cSrcweir else if( pLay->IsSctFrm() )
519cdf0e10cSrcweir {
520cdf0e10cSrcweir if ( pLay->Lower() )
521cdf0e10cSrcweir {
522cdf0e10cSrcweir if( pLay->Lower()->IsColumnFrm() && pLay->Lower()->GetNext() )
523cdf0e10cSrcweir bLow = pLay->Lower()->Frm().Height() != pLay->Prt().Height();
524cdf0e10cSrcweir else
525cdf0e10cSrcweir bLow = pLay->Prt().Width() != aPrt.Width();
526cdf0e10cSrcweir }
527cdf0e10cSrcweir else
528cdf0e10cSrcweir bLow = sal_False;
529cdf0e10cSrcweir }
530cdf0e10cSrcweir else if( pLay->IsFooterFrm() && !pLay->HasFixSize() )
531cdf0e10cSrcweir bLow = pLay->Prt().Width() != aPrt.Width();
532cdf0e10cSrcweir else
533cdf0e10cSrcweir bLow = sal_True;
534cdf0e10cSrcweir bInvaPercent = bLow;
535cdf0e10cSrcweir if ( bLow )
536cdf0e10cSrcweir {
537cdf0e10cSrcweir pLay->ChgLowersProp( aPrt.SSize() );
538cdf0e10cSrcweir }
539cdf0e10cSrcweir //Wenn die PrtArea gewachsen ist, so ist es moeglich, dass die
540cdf0e10cSrcweir //Kette der Untergeordneten einen weiteren Frm aufnehmen kann,
541cdf0e10cSrcweir //mithin muss also der 'moeglicherweise passende' Invalidiert werden.
542cdf0e10cSrcweir //Das invalidieren lohnt nur, wenn es sich beim mir bzw. meinen
543cdf0e10cSrcweir //Uppers um eine Moveable-Section handelt.
544cdf0e10cSrcweir //Die PrtArea ist gewachsen, wenn die Breite oder die Hoehe groesser
545cdf0e10cSrcweir //geworden ist.
546cdf0e10cSrcweir if ( (pLay->Prt().Height() > aPrt.Height() ||
547cdf0e10cSrcweir pLay->Prt().Width() > aPrt.Width()) &&
548cdf0e10cSrcweir (pLay->IsMoveable() || pLay->IsFlyFrm()) )
549cdf0e10cSrcweir {
550cdf0e10cSrcweir SwFrm *pTmpFrm = pLay->Lower();
551cdf0e10cSrcweir if ( pTmpFrm && pTmpFrm->IsFlowFrm() )
552cdf0e10cSrcweir {
553cdf0e10cSrcweir while ( pTmpFrm->GetNext() )
554cdf0e10cSrcweir pTmpFrm = pTmpFrm->GetNext();
555cdf0e10cSrcweir pTmpFrm->InvalidateNextPos();
556cdf0e10cSrcweir }
557cdf0e10cSrcweir }
558cdf0e10cSrcweir }
559cdf0e10cSrcweir bNotify = sal_True;
560cdf0e10cSrcweir //TEUER!! aber wie macht man es geschickter?
561cdf0e10cSrcweir if( bInvaPercent )
562cdf0e10cSrcweir pLay->InvaPercentLowers( pLay->Prt().Height() - aPrt.Height() );
563cdf0e10cSrcweir }
564cdf0e10cSrcweir if ( pLay->IsTabFrm() )
565cdf0e10cSrcweir //Damit _nur_ der Shatten bei Groessenaenderungen gemalt wird.
566cdf0e10cSrcweir ((SwTabFrm*)pLay)->SetComplete();
567cdf0e10cSrcweir else
568cdf0e10cSrcweir {
569cdf0e10cSrcweir const ViewShell *pSh = pLay->getRootFrm()->GetCurrShell();
570cdf0e10cSrcweir if( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) ||
571cdf0e10cSrcweir !(pLay->GetType() & (FRM_BODY | FRM_PAGE)) )
572cdf0e10cSrcweir //Damit die untergeordneten sauber retouchiert werden.
573cdf0e10cSrcweir //Problembsp: Flys an den Henkeln packen und verkleinern.
574cdf0e10cSrcweir //Nicht fuer Body und Page, sonst flackerts beim HTML-Laden.
575cdf0e10cSrcweir pLay->SetCompletePaint();
576cdf0e10cSrcweir }
577cdf0e10cSrcweir }
578cdf0e10cSrcweir //Lower benachrichtigen wenn sich die Position veraendert hat.
579cdf0e10cSrcweir const sal_Bool bPrtPos = POS_DIFF( aPrt, pLay->Prt() );
580cdf0e10cSrcweir const sal_Bool bPos = bPrtPos || POS_DIFF( aFrm, pLay->Frm() );
581cdf0e10cSrcweir const sal_Bool bSize = pLay->Frm().SSize() != aFrm.SSize();
582cdf0e10cSrcweir
583cdf0e10cSrcweir if ( bPos && pLay->Lower() && !IsLowersComplete() )
584cdf0e10cSrcweir pLay->Lower()->InvalidatePos();
585cdf0e10cSrcweir
586cdf0e10cSrcweir if ( bPrtPos )
587cdf0e10cSrcweir pLay->SetCompletePaint();
588cdf0e10cSrcweir
589cdf0e10cSrcweir //Nachfolger benachrichtigen wenn sich die SSize geaendert hat.
590cdf0e10cSrcweir if ( bSize )
591cdf0e10cSrcweir {
592cdf0e10cSrcweir if( pLay->GetNext() )
593cdf0e10cSrcweir {
594cdf0e10cSrcweir if ( pLay->GetNext()->IsLayoutFrm() )
595cdf0e10cSrcweir pLay->GetNext()->_InvalidatePos();
596cdf0e10cSrcweir else
597cdf0e10cSrcweir pLay->GetNext()->InvalidatePos();
598cdf0e10cSrcweir }
599cdf0e10cSrcweir else if( pLay->IsSctFrm() )
600cdf0e10cSrcweir pLay->InvalidateNextPos();
601cdf0e10cSrcweir }
602cdf0e10cSrcweir if ( !IsLowersComplete() &&
603cdf0e10cSrcweir !(pLay->GetType()&(FRM_FLY|FRM_SECTION) &&
604cdf0e10cSrcweir pLay->Lower() && pLay->Lower()->IsColumnFrm()) &&
605cdf0e10cSrcweir (bPos || bNotify) && !(pLay->GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
606cdf0e10cSrcweir {
607cdf0e10cSrcweir // --> OD 2005-03-11 #i44016# - force unlock of position of lower objects.
608cdf0e10cSrcweir // --> OD 2005-03-30 #i43913# - no unlock of position of objects,
609cdf0e10cSrcweir // if <pLay> is a cell frame, and its table frame resp. its parent table
610cdf0e10cSrcweir // frame is locked.
611cdf0e10cSrcweir // --> OD 2005-04-15 #i47458# - force unlock of position of lower objects,
612cdf0e10cSrcweir // only if position of layout frame has changed.
613cdf0e10cSrcweir bool bUnlockPosOfObjs( bPos );
614cdf0e10cSrcweir if ( bUnlockPosOfObjs && pLay->IsCellFrm() )
615cdf0e10cSrcweir {
616cdf0e10cSrcweir SwTabFrm* pTabFrm( pLay->FindTabFrm() );
617cdf0e10cSrcweir if ( pTabFrm &&
618cdf0e10cSrcweir ( pTabFrm->IsJoinLocked() ||
619cdf0e10cSrcweir ( pTabFrm->IsFollow() &&
620cdf0e10cSrcweir pTabFrm->FindMaster()->IsJoinLocked() ) ) )
621cdf0e10cSrcweir {
622cdf0e10cSrcweir bUnlockPosOfObjs = false;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir }
625cdf0e10cSrcweir // --> OD 2005-05-18 #i49383# - check for footnote frame, if unlock
626cdf0e10cSrcweir // of position of lower objects is allowed.
627cdf0e10cSrcweir else if ( bUnlockPosOfObjs && pLay->IsFtnFrm() )
628cdf0e10cSrcweir {
629cdf0e10cSrcweir bUnlockPosOfObjs = static_cast<SwFtnFrm*>(pLay)->IsUnlockPosOfLowerObjs();
630cdf0e10cSrcweir }
631cdf0e10cSrcweir // <--
632cdf0e10cSrcweir // --> OD 2005-07-29 #i51303# - no unlock of object positions for sections
633cdf0e10cSrcweir else if ( bUnlockPosOfObjs && pLay->IsSctFrm() )
634cdf0e10cSrcweir {
635cdf0e10cSrcweir bUnlockPosOfObjs = false;
636cdf0e10cSrcweir }
637cdf0e10cSrcweir // <--
638cdf0e10cSrcweir pLay->NotifyLowerObjs( bUnlockPosOfObjs );
639cdf0e10cSrcweir // <--
640cdf0e10cSrcweir }
641cdf0e10cSrcweir if ( bPos && pLay->IsFtnFrm() && pLay->Lower() )
642cdf0e10cSrcweir {
643cdf0e10cSrcweir // OD 2004-05-11 #i28701#
644cdf0e10cSrcweir ::lcl_InvalidatePosOfLowers( *pLay );
645cdf0e10cSrcweir }
646cdf0e10cSrcweir if( ( bPos || bSize ) && pLay->IsFlyFrm() && ((SwFlyFrm*)pLay)->GetAnchorFrm()
647cdf0e10cSrcweir && ((SwFlyFrm*)pLay)->GetAnchorFrm()->IsFlyFrm() )
648cdf0e10cSrcweir ((SwFlyFrm*)pLay)->AnchorFrm()->InvalidateSize();
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir /*************************************************************************/
652cdf0e10cSrcweir
SwFlyNotify(SwFlyFrm * pFlyFrm)653cdf0e10cSrcweir SwFlyNotify::SwFlyNotify( SwFlyFrm *pFlyFrm ) :
654cdf0e10cSrcweir SwLayNotify( pFlyFrm ),
655cdf0e10cSrcweir // --> OD 2004-11-24 #115759# - keep correct page frame - the page frame
656cdf0e10cSrcweir // the Writer fly frame is currently registered at.
657cdf0e10cSrcweir pOldPage( pFlyFrm->GetPageFrm() ),
658cdf0e10cSrcweir // <--
659cdf0e10cSrcweir aFrmAndSpace( pFlyFrm->GetObjRectWithSpaces() )
660cdf0e10cSrcweir {
661cdf0e10cSrcweir }
662cdf0e10cSrcweir
663cdf0e10cSrcweir /*************************************************************************/
664cdf0e10cSrcweir
~SwFlyNotify()665cdf0e10cSrcweir SwFlyNotify::~SwFlyNotify()
666cdf0e10cSrcweir {
667cdf0e10cSrcweir // --> OD 2005-07-29 #i49383#
668cdf0e10cSrcweir if ( mbFrmDeleted )
669cdf0e10cSrcweir {
670cdf0e10cSrcweir return;
671cdf0e10cSrcweir }
672cdf0e10cSrcweir // <--
673cdf0e10cSrcweir
674cdf0e10cSrcweir SwFlyFrm *pFly = GetFly();
675cdf0e10cSrcweir if ( pFly->IsNotifyBack() )
676cdf0e10cSrcweir {
677cdf0e10cSrcweir ViewShell *pSh = pFly->getRootFrm()->GetCurrShell();
678cdf0e10cSrcweir SwViewImp *pImp = pSh ? pSh->Imp() : 0;
679cdf0e10cSrcweir if ( !pImp || !pImp->IsAction() || !pImp->GetLayAction().IsAgain() )
680cdf0e10cSrcweir {
681cdf0e10cSrcweir //Wenn in der LayAction das IsAgain gesetzt ist kann es sein,
682cdf0e10cSrcweir //dass die alte Seite inzwischen vernichtet wurde!
683cdf0e10cSrcweir ::Notify( pFly, pOldPage, aFrmAndSpace, &aPrt );
684cdf0e10cSrcweir // --> OD 2004-10-20 #i35640# - additional notify anchor text frame,
685cdf0e10cSrcweir // if Writer fly frame has changed its page
686cdf0e10cSrcweir if ( pFly->GetAnchorFrm()->IsTxtFrm() &&
687cdf0e10cSrcweir pFly->GetPageFrm() != pOldPage )
688cdf0e10cSrcweir {
689cdf0e10cSrcweir pFly->AnchorFrm()->Prepare( PREP_FLY_LEAVE );
690cdf0e10cSrcweir }
691cdf0e10cSrcweir // <--
692cdf0e10cSrcweir }
693cdf0e10cSrcweir pFly->ResetNotifyBack();
694cdf0e10cSrcweir }
695cdf0e10cSrcweir
696cdf0e10cSrcweir //Haben sich Groesse oder Position geaendert, so sollte die View
697cdf0e10cSrcweir //das wissen.
698cdf0e10cSrcweir SWRECTFN( pFly )
699cdf0e10cSrcweir const bool bPosChgd = POS_DIFF( aFrm, pFly->Frm() );
700cdf0e10cSrcweir const bool bFrmChgd = pFly->Frm().SSize() != aFrm.SSize();
701cdf0e10cSrcweir const bool bPrtChgd = aPrt != pFly->Prt();
702cdf0e10cSrcweir if ( bPosChgd || bFrmChgd || bPrtChgd )
703cdf0e10cSrcweir {
704cdf0e10cSrcweir pFly->NotifyDrawObj();
705cdf0e10cSrcweir }
706cdf0e10cSrcweir if ( bPosChgd && aFrm.Pos().X() != WEIT_WECH )
707cdf0e10cSrcweir {
708cdf0e10cSrcweir // OD 2004-05-10 #i28701# - no direct move of lower Writer fly frames.
709cdf0e10cSrcweir // reason: New positioning and alignment (e.g. to-paragraph anchored,
710cdf0e10cSrcweir // but aligned at page) are introduced.
711cdf0e10cSrcweir // <SwLayNotify::~SwLayNotify()> takes care of invalidation of lower
712cdf0e10cSrcweir // floating screen objects by calling method <SwLayoutFrm::NotifyLowerObjs()>.
713cdf0e10cSrcweir
714cdf0e10cSrcweir if ( pFly->IsFlyAtCntFrm() )
715cdf0e10cSrcweir {
716cdf0e10cSrcweir SwFrm *pNxt = pFly->AnchorFrm()->FindNext();
717cdf0e10cSrcweir if ( pNxt )
718cdf0e10cSrcweir {
719cdf0e10cSrcweir pNxt->InvalidatePos();
720cdf0e10cSrcweir }
721cdf0e10cSrcweir }
722cdf0e10cSrcweir
723cdf0e10cSrcweir // --> OD 2004-11-05 #i26945# - notify anchor.
724cdf0e10cSrcweir // Needed for negative positioned Writer fly frames
725cdf0e10cSrcweir if ( pFly->GetAnchorFrm()->IsTxtFrm() )
726cdf0e10cSrcweir {
727cdf0e10cSrcweir pFly->AnchorFrm()->Prepare( PREP_FLY_LEAVE );
728cdf0e10cSrcweir }
729cdf0e10cSrcweir // <--
730cdf0e10cSrcweir }
731cdf0e10cSrcweir
732cdf0e10cSrcweir // OD 2004-05-13 #i28701#
733cdf0e10cSrcweir // --> OD 2005-03-21 #i45180# - no adjustment of layout process flags and
734cdf0e10cSrcweir // further notifications/invalidations, if format is called by grow/shrink
735cdf0e10cSrcweir if ( pFly->ConsiderObjWrapInfluenceOnObjPos() &&
736cdf0e10cSrcweir ( !pFly->ISA(SwFlyFreeFrm) ||
737cdf0e10cSrcweir !static_cast<SwFlyFreeFrm*>(pFly)->IsNoMoveOnCheckClip() ) )
738cdf0e10cSrcweir // <--
739cdf0e10cSrcweir {
740cdf0e10cSrcweir // --> OD 2005-09-05 #i54138# - suppress restart of the layout process
741cdf0e10cSrcweir // on changed frame height.
742cdf0e10cSrcweir // Note: It doesn't seem to be necessary and can cause layout loops.
743cdf0e10cSrcweir if ( bPosChgd )
744cdf0e10cSrcweir // <--
745cdf0e10cSrcweir {
746cdf0e10cSrcweir // indicate a restart of the layout process
747cdf0e10cSrcweir pFly->SetRestartLayoutProcess( true );
748cdf0e10cSrcweir }
749cdf0e10cSrcweir else
750cdf0e10cSrcweir {
751cdf0e10cSrcweir // lock position
752cdf0e10cSrcweir pFly->LockPosition();
753cdf0e10cSrcweir
754cdf0e10cSrcweir if ( !pFly->ConsiderForTextWrap() )
755cdf0e10cSrcweir {
756cdf0e10cSrcweir // indicate that object has to be considered for text wrap
757cdf0e10cSrcweir pFly->SetConsiderForTextWrap( true );
758cdf0e10cSrcweir // invalidate 'background' in order to allow its 'background'
759cdf0e10cSrcweir // to wrap around it.
760cdf0e10cSrcweir pFly->NotifyBackground( pFly->GetPageFrm(),
761cdf0e10cSrcweir pFly->GetObjRectWithSpaces(),
762cdf0e10cSrcweir PREP_FLY_ARRIVE );
763cdf0e10cSrcweir // invalidate position of anchor frame in order to force
764cdf0e10cSrcweir // a re-format of the anchor frame, which also causes a
765cdf0e10cSrcweir // re-format of the invalid previous frames of the anchor frame.
766cdf0e10cSrcweir pFly->AnchorFrm()->InvalidatePos();
767cdf0e10cSrcweir }
768cdf0e10cSrcweir }
769cdf0e10cSrcweir }
770cdf0e10cSrcweir }
771cdf0e10cSrcweir
772cdf0e10cSrcweir /*************************************************************************/
773cdf0e10cSrcweir
SwCntntNotify(SwCntntFrm * pCntntFrm)774cdf0e10cSrcweir SwCntntNotify::SwCntntNotify( SwCntntFrm *pCntntFrm ) :
775cdf0e10cSrcweir SwFrmNotify( pCntntFrm ),
776cdf0e10cSrcweir // OD 08.01.2004 #i11859#
777cdf0e10cSrcweir mbChkHeightOfLastLine( false ),
778cdf0e10cSrcweir mnHeightOfLastLine( 0L ),
779cdf0e10cSrcweir // OD 2004-02-26 #i25029#
780cdf0e10cSrcweir mbInvalidatePrevPrtArea( false ),
781cdf0e10cSrcweir mbBordersJoinedWithPrev( false )
782cdf0e10cSrcweir {
783cdf0e10cSrcweir // OD 08.01.2004 #i11859#
784cdf0e10cSrcweir if ( pCntntFrm->IsTxtFrm() )
785cdf0e10cSrcweir {
786cdf0e10cSrcweir SwTxtFrm* pTxtFrm = static_cast<SwTxtFrm*>(pCntntFrm);
787cdf0e10cSrcweir if ( !pTxtFrm->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::OLD_LINE_SPACING) )
788cdf0e10cSrcweir {
789cdf0e10cSrcweir const SwAttrSet* pSet = pTxtFrm->GetAttrSet();
790cdf0e10cSrcweir const SvxLineSpacingItem &rSpace = pSet->GetLineSpacing();
791cdf0e10cSrcweir if ( rSpace.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP )
792cdf0e10cSrcweir {
793cdf0e10cSrcweir mbChkHeightOfLastLine = true;
794cdf0e10cSrcweir mnHeightOfLastLine = pTxtFrm->GetHeightOfLastLine();
795cdf0e10cSrcweir }
796cdf0e10cSrcweir }
797cdf0e10cSrcweir }
798cdf0e10cSrcweir }
799cdf0e10cSrcweir
800cdf0e10cSrcweir /*************************************************************************/
801cdf0e10cSrcweir
~SwCntntNotify()802cdf0e10cSrcweir SwCntntNotify::~SwCntntNotify()
803cdf0e10cSrcweir {
804cdf0e10cSrcweir // --> OD 2005-07-29 #i49383#
805cdf0e10cSrcweir if ( mbFrmDeleted )
806cdf0e10cSrcweir {
807cdf0e10cSrcweir return;
808cdf0e10cSrcweir }
809cdf0e10cSrcweir // <--
810cdf0e10cSrcweir
811cdf0e10cSrcweir SwCntntFrm *pCnt = GetCnt();
812cdf0e10cSrcweir if ( bSetCompletePaintOnInvalidate )
813cdf0e10cSrcweir pCnt->SetCompletePaint();
814cdf0e10cSrcweir
815cdf0e10cSrcweir SWRECTFN( pCnt )
816cdf0e10cSrcweir if ( pCnt->IsInTab() && ( POS_DIFF( pCnt->Frm(), aFrm ) ||
817cdf0e10cSrcweir pCnt->Frm().SSize() != aFrm.SSize()))
818cdf0e10cSrcweir {
819cdf0e10cSrcweir SwLayoutFrm* pCell = pCnt->GetUpper();
820cdf0e10cSrcweir while( !pCell->IsCellFrm() && pCell->GetUpper() )
821cdf0e10cSrcweir pCell = pCell->GetUpper();
822cdf0e10cSrcweir ASSERT( pCell->IsCellFrm(), "Where's my cell?" );
823cdf0e10cSrcweir if ( text::VertOrientation::NONE != pCell->GetFmt()->GetVertOrient().GetVertOrient() )
824cdf0e10cSrcweir pCell->InvalidatePrt(); //fuer vertikale Ausrichtung.
825cdf0e10cSrcweir }
826cdf0e10cSrcweir
827cdf0e10cSrcweir // OD 2004-02-26 #i25029#
828cdf0e10cSrcweir if ( mbInvalidatePrevPrtArea && mbBordersJoinedWithPrev &&
829cdf0e10cSrcweir pCnt->IsTxtFrm() &&
830cdf0e10cSrcweir !pCnt->IsFollow() && !pCnt->GetIndPrev() )
831cdf0e10cSrcweir {
832cdf0e10cSrcweir // determine previous frame
833cdf0e10cSrcweir SwFrm* pPrevFrm = pCnt->FindPrev();
834cdf0e10cSrcweir // skip empty section frames and hidden text frames
835cdf0e10cSrcweir {
836cdf0e10cSrcweir while ( pPrevFrm &&
837cdf0e10cSrcweir ( ( pPrevFrm->IsSctFrm() &&
838cdf0e10cSrcweir !static_cast<SwSectionFrm*>(pPrevFrm)->GetSection() ) ||
839cdf0e10cSrcweir ( pPrevFrm->IsTxtFrm() &&
840cdf0e10cSrcweir static_cast<SwTxtFrm*>(pPrevFrm)->IsHiddenNow() ) ) )
841cdf0e10cSrcweir {
842cdf0e10cSrcweir pPrevFrm = pPrevFrm->FindPrev();
843cdf0e10cSrcweir }
844cdf0e10cSrcweir }
845cdf0e10cSrcweir
846cdf0e10cSrcweir // Invalidate printing area of found previous frame
847cdf0e10cSrcweir if ( pPrevFrm )
848cdf0e10cSrcweir {
849cdf0e10cSrcweir if ( pPrevFrm->IsSctFrm() )
850cdf0e10cSrcweir {
851cdf0e10cSrcweir if ( pCnt->IsInSct() )
852cdf0e10cSrcweir {
853cdf0e10cSrcweir // Note: found previous frame is a section frame and
854cdf0e10cSrcweir // <pCnt> is also inside a section.
855cdf0e10cSrcweir // Thus due to <mbBordersJoinedWithPrev>,
856cdf0e10cSrcweir // <pCnt> had joined its borders/shadow with the
857cdf0e10cSrcweir // last content of the found section.
858cdf0e10cSrcweir // Invalidate printing area of last content in found section.
859cdf0e10cSrcweir SwFrm* pLstCntntOfSctFrm =
860cdf0e10cSrcweir static_cast<SwSectionFrm*>(pPrevFrm)->FindLastCntnt();
861cdf0e10cSrcweir if ( pLstCntntOfSctFrm )
862cdf0e10cSrcweir {
863cdf0e10cSrcweir pLstCntntOfSctFrm->InvalidatePrt();
864cdf0e10cSrcweir }
865cdf0e10cSrcweir }
866cdf0e10cSrcweir }
867cdf0e10cSrcweir else
868cdf0e10cSrcweir {
869cdf0e10cSrcweir pPrevFrm->InvalidatePrt();
870cdf0e10cSrcweir }
871cdf0e10cSrcweir }
872cdf0e10cSrcweir }
873cdf0e10cSrcweir
8746fddd742SOliver-Rainer Wittmann const bool bFirst = (aFrm.*fnRect->fnGetWidth)() == 0;
875cdf0e10cSrcweir
876cdf0e10cSrcweir if ( pCnt->IsNoTxtFrm() )
877cdf0e10cSrcweir {
878cdf0e10cSrcweir //Aktive PlugIn's oder OLE-Objekte sollten etwas von der Veraenderung
879cdf0e10cSrcweir //mitbekommen, damit sie Ihr Window entsprechend verschieben.
880cdf0e10cSrcweir ViewShell *pSh = pCnt->getRootFrm()->GetCurrShell();
881cdf0e10cSrcweir if ( pSh )
882cdf0e10cSrcweir {
883cdf0e10cSrcweir SwOLENode *pNd;
884cdf0e10cSrcweir if ( 0 != (pNd = pCnt->GetNode()->GetOLENode()) &&
885cdf0e10cSrcweir (pNd->GetOLEObj().IsOleRef() ||
886cdf0e10cSrcweir pNd->IsOLESizeInvalid()) )
887cdf0e10cSrcweir {
888b3b0b271SMichael Stahl // --> OD #i117189#
889b3b0b271SMichael Stahl const bool bNoTxtFrmPrtAreaChanged =
890b3b0b271SMichael Stahl ( aPrt.SSize().Width() != 0 &&
891b3b0b271SMichael Stahl aPrt.SSize().Height() != 0 ) &&
892b3b0b271SMichael Stahl aPrt.SSize() != pCnt->Prt().SSize();
893b3b0b271SMichael Stahl // <--
894cdf0e10cSrcweir ASSERT( pCnt->IsInFly(), "OLE not in FlyFrm" );
895cdf0e10cSrcweir SwFlyFrm *pFly = pCnt->FindFlyFrm();
896cdf0e10cSrcweir svt::EmbeddedObjectRef& xObj = pNd->GetOLEObj().GetObject();
897cdf0e10cSrcweir SwFEShell *pFESh = 0;
898cdf0e10cSrcweir ViewShell *pTmp = pSh;
899cdf0e10cSrcweir do
900cdf0e10cSrcweir { if ( pTmp->ISA( SwCrsrShell ) )
901cdf0e10cSrcweir {
902cdf0e10cSrcweir pFESh = (SwFEShell*)pTmp;
903cdf0e10cSrcweir // #108369#: Here used to be the condition if (!bFirst).
904cdf0e10cSrcweir // I think this should mean "do not call CalcAndSetScale"
905cdf0e10cSrcweir // if the frame is formatted for the first time.
906cdf0e10cSrcweir // Unfortunately this is not valid anymore since the
907cdf0e10cSrcweir // SwNoTxtFrm already gets a width during CalcLowerPreps.
908cdf0e10cSrcweir // Nevertheless, the indention of !bFirst seemed to be
909cdf0e10cSrcweir // to assure that the OLE objects have already been notified
910cdf0e10cSrcweir // if necessary before calling CalcAndSetScale.
911cdf0e10cSrcweir // So I replaced !bFirst by !IsOLESizeInvalid. There is
912cdf0e10cSrcweir // one additional problem specific to the word import:
913cdf0e10cSrcweir // The layout is calculated _before_ calling PrtOLENotify,
914cdf0e10cSrcweir // and the OLE objects are not invalidated during import.
915cdf0e10cSrcweir // Therefore I added the condition !IsUpdateExpFld,
916cdf0e10cSrcweir // have a look at the occurence of CalcLayout in
917cdf0e10cSrcweir // uiview/view.cxx.
918cdf0e10cSrcweir if ( !pNd->IsOLESizeInvalid() &&
919cdf0e10cSrcweir !pSh->GetDoc()->IsUpdateExpFld() )
920b3b0b271SMichael Stahl pFESh->CalcAndSetScale( xObj,
921b3b0b271SMichael Stahl &pFly->Prt(), &pFly->Frm(),
922b3b0b271SMichael Stahl bNoTxtFrmPrtAreaChanged );
923cdf0e10cSrcweir }
924cdf0e10cSrcweir pTmp = (ViewShell*)pTmp->GetNext();
925cdf0e10cSrcweir } while ( pTmp != pSh );
926cdf0e10cSrcweir
927cdf0e10cSrcweir if ( pFESh && pNd->IsOLESizeInvalid() )
928cdf0e10cSrcweir {
929cdf0e10cSrcweir pNd->SetOLESizeInvalid( sal_False );
930cdf0e10cSrcweir //TODO/LATER: needs OnDocumentPrinterChanged
931cdf0e10cSrcweir //xObj->OnDocumentPrinterChanged( pNd->GetDoc()->getPrinter( false ) );
932cdf0e10cSrcweir pFESh->CalcAndSetScale( xObj );//Client erzeugen lassen.
933cdf0e10cSrcweir }
934cdf0e10cSrcweir }
935cdf0e10cSrcweir //dito Animierte Grafiken
936cdf0e10cSrcweir if ( Frm().HasArea() && ((SwNoTxtFrm*)pCnt)->HasAnimation() )
937cdf0e10cSrcweir {
938cdf0e10cSrcweir ((SwNoTxtFrm*)pCnt)->StopAnimation();
939cdf0e10cSrcweir pSh->InvalidateWindows( Frm() );
940cdf0e10cSrcweir }
941cdf0e10cSrcweir }
942cdf0e10cSrcweir }
943cdf0e10cSrcweir
944cdf0e10cSrcweir if ( bFirst )
945cdf0e10cSrcweir {
946cdf0e10cSrcweir pCnt->SetRetouche(); //fix(13870)
947cdf0e10cSrcweir
948cdf0e10cSrcweir SwDoc *pDoc = pCnt->GetNode()->GetDoc();
949cdf0e10cSrcweir if ( pDoc->GetSpzFrmFmts()->Count() &&
9506fddd742SOliver-Rainer Wittmann pDoc->DoesContainAtPageObjWithContentAnchor() && !pDoc->IsNewDoc() )
951cdf0e10cSrcweir {
9526fddd742SOliver-Rainer Wittmann // If certain import filters for foreign file format import
9536fddd742SOliver-Rainer Wittmann // AT_PAGE anchored objects, the corresponding page number is
9546fddd742SOliver-Rainer Wittmann // typically not known. In this case the content position is
9556fddd742SOliver-Rainer Wittmann // stored at which the anchored object is found in the
9566fddd742SOliver-Rainer Wittmann // imported document.
9576fddd742SOliver-Rainer Wittmann // When this content is formatted it is the time at which
9586fddd742SOliver-Rainer Wittmann // the page is known. Thus, this data can be corrected now.
9596fddd742SOliver-Rainer Wittmann
9606fddd742SOliver-Rainer Wittmann const SwPageFrm* pPage = 0;
9616fddd742SOliver-Rainer Wittmann SwNodeIndex *pIdx = 0;
9626fddd742SOliver-Rainer Wittmann SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
9636fddd742SOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < pTbl->Count(); ++i )
9646fddd742SOliver-Rainer Wittmann {
9656fddd742SOliver-Rainer Wittmann SwFrmFmt *pFmt = (*pTbl)[i];
9666fddd742SOliver-Rainer Wittmann const SwFmtAnchor &rAnch = pFmt->GetAnchor();
9676fddd742SOliver-Rainer Wittmann if ( FLY_AT_PAGE != rAnch.GetAnchorId() ||
9686fddd742SOliver-Rainer Wittmann rAnch.GetCntntAnchor() == 0 )
969cdf0e10cSrcweir {
9706fddd742SOliver-Rainer Wittmann continue;
971cdf0e10cSrcweir }
972cdf0e10cSrcweir
9736fddd742SOliver-Rainer Wittmann if ( !pIdx )
9746fddd742SOliver-Rainer Wittmann {
9756fddd742SOliver-Rainer Wittmann pIdx = new SwNodeIndex( *pCnt->GetNode() );
9766fddd742SOliver-Rainer Wittmann }
9776fddd742SOliver-Rainer Wittmann if ( rAnch.GetCntntAnchor()->nNode == *pIdx )
9786fddd742SOliver-Rainer Wittmann {
9796fddd742SOliver-Rainer Wittmann ASSERT( false, "<SwCntntNotify::~SwCntntNotify()> - to page anchored object with content position. Please inform OD." );
9806fddd742SOliver-Rainer Wittmann if ( !pPage )
9816fddd742SOliver-Rainer Wittmann {
9826fddd742SOliver-Rainer Wittmann pPage = pCnt->FindPageFrm();
9836fddd742SOliver-Rainer Wittmann }
9846fddd742SOliver-Rainer Wittmann SwFmtAnchor aAnch( rAnch );
9856fddd742SOliver-Rainer Wittmann aAnch.SetAnchor( 0 );
9866fddd742SOliver-Rainer Wittmann aAnch.SetPageNum( pPage->GetPhyPageNum() );
9876fddd742SOliver-Rainer Wittmann pFmt->SetFmtAttr( aAnch );
9886fddd742SOliver-Rainer Wittmann if ( RES_DRAWFRMFMT != pFmt->Which() )
9896fddd742SOliver-Rainer Wittmann {
9906fddd742SOliver-Rainer Wittmann pFmt->MakeFrms();
9916fddd742SOliver-Rainer Wittmann }
9926fddd742SOliver-Rainer Wittmann }
993cdf0e10cSrcweir }
994cdf0e10cSrcweir delete pIdx;
995cdf0e10cSrcweir }
996cdf0e10cSrcweir }
997cdf0e10cSrcweir
998cdf0e10cSrcweir // OD 12.01.2004 #i11859# - invalidate printing area of following frame,
999cdf0e10cSrcweir // if height of last line has changed.
1000cdf0e10cSrcweir if ( pCnt->IsTxtFrm() && mbChkHeightOfLastLine )
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir if ( mnHeightOfLastLine != static_cast<SwTxtFrm*>(pCnt)->GetHeightOfLastLine() )
1003cdf0e10cSrcweir {
1004cdf0e10cSrcweir pCnt->InvalidateNextPrtArea();
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir }
1007cdf0e10cSrcweir
1008cdf0e10cSrcweir // --> OD 2005-03-07 #i44049#
1009cdf0e10cSrcweir if ( pCnt->IsTxtFrm() && POS_DIFF( aFrm, pCnt->Frm() ) )
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir pCnt->InvalidateObjs( true );
1012cdf0e10cSrcweir }
1013cdf0e10cSrcweir // <--
1014cdf0e10cSrcweir
1015cdf0e10cSrcweir // --> OD 2005-04-12 #i43255# - move code to invalidate at-character
1016cdf0e10cSrcweir // anchored objects due to a change of its anchor character from
1017cdf0e10cSrcweir // method <SwTxtFrm::Format(..)>.
1018cdf0e10cSrcweir if ( pCnt->IsTxtFrm() )
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir SwTxtFrm* pMasterFrm = pCnt->IsFollow()
1021cdf0e10cSrcweir ? static_cast<SwTxtFrm*>(pCnt)->FindMaster()
1022cdf0e10cSrcweir : static_cast<SwTxtFrm*>(pCnt);
1023cdf0e10cSrcweir if ( pMasterFrm && !pMasterFrm->IsFlyLock() &&
1024cdf0e10cSrcweir pMasterFrm->GetDrawObjs() )
1025cdf0e10cSrcweir {
1026cdf0e10cSrcweir SwSortedObjs* pObjs = pMasterFrm->GetDrawObjs();
1027cdf0e10cSrcweir for ( sal_uInt32 i = 0; i < pObjs->Count(); ++i )
1028cdf0e10cSrcweir {
1029cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
1030cdf0e10cSrcweir if ( pAnchoredObj->GetFrmFmt().GetAnchor().GetAnchorId()
1031cdf0e10cSrcweir == FLY_AT_CHAR )
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir pAnchoredObj->CheckCharRectAndTopOfLine( !pMasterFrm->IsEmpty() );
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir }
1037cdf0e10cSrcweir }
1038cdf0e10cSrcweir // <--
1039cdf0e10cSrcweir }
1040cdf0e10cSrcweir
1041cdf0e10cSrcweir /*************************************************************************/
1042cdf0e10cSrcweir
AppendObjs(const SwSpzFrmFmts * pTbl,sal_uLong nIndex,SwFrm * pFrm,SwPageFrm * pPage)1043cdf0e10cSrcweir void AppendObjs( const SwSpzFrmFmts *pTbl, sal_uLong nIndex,
1044cdf0e10cSrcweir SwFrm *pFrm, SwPageFrm *pPage )
1045cdf0e10cSrcweir {
1046cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pTbl->Count(); ++i )
1047cdf0e10cSrcweir {
1048cdf0e10cSrcweir SwFrmFmt *pFmt = (SwFrmFmt*)(*pTbl)[i];
1049cdf0e10cSrcweir const SwFmtAnchor &rAnch = pFmt->GetAnchor();
1050cdf0e10cSrcweir if ( rAnch.GetCntntAnchor() &&
1051cdf0e10cSrcweir (rAnch.GetCntntAnchor()->nNode.GetIndex() == nIndex) )
1052cdf0e10cSrcweir {
1053cdf0e10cSrcweir const bool bFlyAtFly = rAnch.GetAnchorId() == FLY_AT_FLY; // LAYER_IMPL
1054cdf0e10cSrcweir //Wird ein Rahmen oder ein SdrObject beschrieben?
1055cdf0e10cSrcweir const bool bSdrObj = RES_DRAWFRMFMT == pFmt->Which();
1056cdf0e10cSrcweir // OD 23.06.2003 #108784# - append also drawing objects anchored
1057cdf0e10cSrcweir // as character.
1058cdf0e10cSrcweir const bool bDrawObjInCntnt = bSdrObj &&
1059cdf0e10cSrcweir (rAnch.GetAnchorId() == FLY_AS_CHAR);
1060cdf0e10cSrcweir
1061cdf0e10cSrcweir if( bFlyAtFly ||
1062cdf0e10cSrcweir (rAnch.GetAnchorId() == FLY_AT_PARA) ||
1063cdf0e10cSrcweir (rAnch.GetAnchorId() == FLY_AT_CHAR) ||
1064cdf0e10cSrcweir bDrawObjInCntnt )
1065cdf0e10cSrcweir {
1066cdf0e10cSrcweir SdrObject* pSdrObj = 0;
1067cdf0e10cSrcweir if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir ASSERT( !bSdrObj, "DrawObject not found." );
1070cdf0e10cSrcweir pFmt->GetDoc()->DelFrmFmt( pFmt );
1071cdf0e10cSrcweir --i;
1072cdf0e10cSrcweir continue;
1073cdf0e10cSrcweir }
1074cdf0e10cSrcweir if ( pSdrObj )
1075cdf0e10cSrcweir {
1076cdf0e10cSrcweir if ( !pSdrObj->GetPage() )
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir pFmt->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage(0)->
1079cdf0e10cSrcweir InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir SwDrawContact* pNew =
1083cdf0e10cSrcweir static_cast<SwDrawContact*>(GetUserCall( pSdrObj ));
1084cdf0e10cSrcweir if ( !pNew->GetAnchorFrm() )
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir pFrm->AppendDrawObj( *(pNew->GetAnchoredObj( 0L )) );
1087cdf0e10cSrcweir }
1088cdf0e10cSrcweir // OD 19.06.2003 #108784# - add 'virtual' drawing object,
1089cdf0e10cSrcweir // if necessary. But control objects have to be excluded.
1090cdf0e10cSrcweir else if ( !::CheckControlLayer( pSdrObj ) &&
1091cdf0e10cSrcweir pNew->GetAnchorFrm() != pFrm &&
1092cdf0e10cSrcweir !pNew->GetDrawObjectByAnchorFrm( *pFrm ) )
1093cdf0e10cSrcweir {
1094cdf0e10cSrcweir SwDrawVirtObj* pDrawVirtObj = pNew->AddVirtObj();
1095cdf0e10cSrcweir pFrm->AppendDrawObj( *(pNew->GetAnchoredObj( pDrawVirtObj )) );
1096cdf0e10cSrcweir
1097cdf0e10cSrcweir // for repaint, use new ActionChanged()
1098cdf0e10cSrcweir // pDrawVirtObj->SendRepaintBroadcast();
1099cdf0e10cSrcweir pDrawVirtObj->ActionChanged();
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir
1102cdf0e10cSrcweir }
1103cdf0e10cSrcweir else
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir SwFlyFrm *pFly;
1106cdf0e10cSrcweir if( bFlyAtFly )
1107cdf0e10cSrcweir pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pFrm, pFrm );
1108cdf0e10cSrcweir else
1109cdf0e10cSrcweir pFly = new SwFlyAtCntFrm( (SwFlyFrmFmt*)pFmt, pFrm, pFrm );
1110cdf0e10cSrcweir pFly->Lock();
1111cdf0e10cSrcweir pFrm->AppendFly( pFly );
1112cdf0e10cSrcweir pFly->Unlock();
1113cdf0e10cSrcweir if ( pPage )
1114cdf0e10cSrcweir ::RegistFlys( pPage, pFly );
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir }
1118cdf0e10cSrcweir }
1119cdf0e10cSrcweir }
1120cdf0e10cSrcweir
lcl_ObjConnected(SwFrmFmt * pFmt,const SwFrm * pSib)1121cdf0e10cSrcweir bool lcl_ObjConnected( SwFrmFmt *pFmt, const SwFrm* pSib )
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir SwIterator<SwFlyFrm,SwFmt> aIter( *pFmt );
1124cdf0e10cSrcweir if ( RES_FLYFRMFMT == pFmt->Which() )
1125cdf0e10cSrcweir {
1126cdf0e10cSrcweir const SwRootFrm* pRoot = pSib ? pSib->getRootFrm() : 0;
1127cdf0e10cSrcweir const SwFlyFrm* pTmpFrm;
1128cdf0e10cSrcweir for( pTmpFrm = aIter.First(); pTmpFrm; pTmpFrm = aIter.Next() )
1129cdf0e10cSrcweir {
1130cdf0e10cSrcweir if(! pRoot || pRoot == pTmpFrm->getRootFrm() )
1131cdf0e10cSrcweir return true;
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir else
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir SwDrawContact *pContact = SwIterator<SwDrawContact,SwFmt>::FirstElement(*pFmt);
1137cdf0e10cSrcweir if ( pContact )
1138cdf0e10cSrcweir return pContact->GetAnchorFrm() != 0;
1139cdf0e10cSrcweir }
1140cdf0e10cSrcweir return false;
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir
1143cdf0e10cSrcweir /** helper method to determine, if a <SwFrmFmt>, which has an object connected,
1144cdf0e10cSrcweir is located in header or footer.
1145cdf0e10cSrcweir
1146cdf0e10cSrcweir OD 23.06.2003 #108784#
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir @author OD
1149cdf0e10cSrcweir */
lcl_InHeaderOrFooter(SwFrmFmt & _rFmt)1150cdf0e10cSrcweir bool lcl_InHeaderOrFooter( SwFrmFmt& _rFmt )
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir bool bRetVal = false;
1153cdf0e10cSrcweir
1154cdf0e10cSrcweir const SwFmtAnchor& rAnch = _rFmt.GetAnchor();
1155cdf0e10cSrcweir
1156cdf0e10cSrcweir if (rAnch.GetAnchorId() != FLY_AT_PAGE)
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir bRetVal = _rFmt.GetDoc()->IsInHeaderFooter( rAnch.GetCntntAnchor()->nNode );
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir
1161cdf0e10cSrcweir return bRetVal;
1162cdf0e10cSrcweir }
1163cdf0e10cSrcweir
AppendAllObjs(const SwSpzFrmFmts * pTbl,const SwFrm * pSib)1164cdf0e10cSrcweir void AppendAllObjs( const SwSpzFrmFmts *pTbl, const SwFrm* pSib )
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir //Verbinden aller Objekte, die in der SpzTbl beschrieben sind mit dem
1167cdf0e10cSrcweir //Layout.
1168cdf0e10cSrcweir //Wenn sich nix mehr tut hoeren wir auf. Dann koennen noch Formate
1169cdf0e10cSrcweir //uebrigbleiben, weil wir weder zeichengebunde Rahmen verbinden noch
1170cdf0e10cSrcweir //Objecte die in zeichengebundenen verankert sind.
1171cdf0e10cSrcweir
1172cdf0e10cSrcweir SwSpzFrmFmts aCpy( 255, 255 );
1173cdf0e10cSrcweir aCpy.Insert( pTbl, 0 );
1174cdf0e10cSrcweir
1175cdf0e10cSrcweir sal_uInt16 nOldCnt = USHRT_MAX;
1176cdf0e10cSrcweir
1177cdf0e10cSrcweir while ( aCpy.Count() && aCpy.Count() != nOldCnt )
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir nOldCnt = aCpy.Count();
1180cdf0e10cSrcweir for ( int i = 0; i < int(aCpy.Count()); ++i )
1181cdf0e10cSrcweir {
1182cdf0e10cSrcweir SwFrmFmt *pFmt = (SwFrmFmt*)aCpy[ sal_uInt16(i) ];
1183cdf0e10cSrcweir const SwFmtAnchor &rAnch = pFmt->GetAnchor();
1184cdf0e10cSrcweir sal_Bool bRemove = sal_False;
1185cdf0e10cSrcweir if ((rAnch.GetAnchorId() == FLY_AT_PAGE) ||
1186cdf0e10cSrcweir (rAnch.GetAnchorId() == FLY_AS_CHAR))
1187cdf0e10cSrcweir {
1188cdf0e10cSrcweir //Seitengebunde sind bereits verankert, zeichengebundene
1189cdf0e10cSrcweir //will ich hier nicht.
1190cdf0e10cSrcweir bRemove = sal_True;
1191cdf0e10cSrcweir }
1192cdf0e10cSrcweir else if ( sal_False == (bRemove = ::lcl_ObjConnected( pFmt, pSib )) ||
1193cdf0e10cSrcweir ::lcl_InHeaderOrFooter( *pFmt ) )
1194cdf0e10cSrcweir {
1195cdf0e10cSrcweir // OD 23.06.2003 #108784# - correction: for objects in header
1196cdf0e10cSrcweir // or footer create frames, in spite of the fact that an connected
1197cdf0e10cSrcweir // objects already exists.
1198cdf0e10cSrcweir //Fuer Flys und DrawObjs nur dann ein MakeFrms rufen wenn noch
1199cdf0e10cSrcweir //keine abhaengigen Existieren, andernfalls, oder wenn das
1200cdf0e10cSrcweir //MakeFrms keine abhaengigen erzeugt, entfernen.
1201cdf0e10cSrcweir pFmt->MakeFrms();
1202cdf0e10cSrcweir bRemove = ::lcl_ObjConnected( pFmt, pSib );
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir if ( bRemove )
1205cdf0e10cSrcweir {
1206cdf0e10cSrcweir aCpy.Remove( sal_uInt16(i) );
1207cdf0e10cSrcweir --i;
1208cdf0e10cSrcweir }
1209cdf0e10cSrcweir }
1210cdf0e10cSrcweir }
1211cdf0e10cSrcweir aCpy.Remove( 0, aCpy.Count() );
1212cdf0e10cSrcweir }
1213cdf0e10cSrcweir
1214cdf0e10cSrcweir /** local method to set 'working' position for newly inserted frames
1215cdf0e10cSrcweir
1216cdf0e10cSrcweir OD 12.08.2003 #i17969#
1217cdf0e10cSrcweir
1218cdf0e10cSrcweir @author OD
1219cdf0e10cSrcweir */
lcl_SetPos(SwFrm & _rNewFrm,const SwLayoutFrm & _rLayFrm)1220cdf0e10cSrcweir void lcl_SetPos( SwFrm& _rNewFrm,
1221cdf0e10cSrcweir const SwLayoutFrm& _rLayFrm )
1222cdf0e10cSrcweir {
1223cdf0e10cSrcweir SWRECTFN( (&_rLayFrm) )
1224cdf0e10cSrcweir (_rNewFrm.Frm().*fnRect->fnSetPos)( (_rLayFrm.Frm().*fnRect->fnGetPos)() );
1225cdf0e10cSrcweir // move position by one SwTwip in text flow direction in order to get
1226cdf0e10cSrcweir // notifications for a new calculated position after its formatting.
1227cdf0e10cSrcweir if ( bVert )
1228cdf0e10cSrcweir _rNewFrm.Frm().Pos().X() -= 1;
1229cdf0e10cSrcweir else
1230cdf0e10cSrcweir _rNewFrm.Frm().Pos().Y() += 1;
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir
_InsertCnt(SwLayoutFrm * pLay,SwDoc * pDoc,sal_uLong nIndex,sal_Bool bPages,sal_uLong nEndIndex,SwFrm * pPrv)1233cdf0e10cSrcweir void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
1234cdf0e10cSrcweir sal_uLong nIndex, sal_Bool bPages, sal_uLong nEndIndex,
1235cdf0e10cSrcweir SwFrm *pPrv )
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir pDoc->BlockIdling();
1238cdf0e10cSrcweir SwRootFrm* pLayout = pLay->getRootFrm();
1239cdf0e10cSrcweir const sal_Bool bOldCallbackActionEnabled = pLayout ? pLayout->IsCallbackActionEnabled() : sal_False;
1240cdf0e10cSrcweir if( bOldCallbackActionEnabled )
1241cdf0e10cSrcweir pLayout->SetCallbackActionEnabled( sal_False );
1242cdf0e10cSrcweir
1243cdf0e10cSrcweir //Bei der Erzeugung des Layouts wird bPages mit sal_True uebergeben. Dann
1244cdf0e10cSrcweir //werden schon mal alle x Absaetze neue Seiten angelegt. Bei umbruechen
1245cdf0e10cSrcweir //und/oder Pagedescriptorwechseln werden gleich die entsprechenden Seiten
1246cdf0e10cSrcweir //angelegt.
1247cdf0e10cSrcweir //Vorteil ist, das einerseits schon eine annaehernd realistische Zahl von
1248cdf0e10cSrcweir //Seiten angelegt wird, vor allem aber gibt es nicht mehr eine schier
1249cdf0e10cSrcweir //lange Kette von Absaetzen teuer verschoben werden muss, bis sie sich auf
1250cdf0e10cSrcweir //ertraegliches mass reduziert hat.
1251cdf0e10cSrcweir //Wir gehen mal davon aus, da? 20 Absaetze auf eine Seite passen
1252cdf0e10cSrcweir //Damit es in extremen Faellen nicht gar so heftig rechenen wir je nach
1253cdf0e10cSrcweir //Node noch etwas drauf.
1254cdf0e10cSrcweir //Wenn in der DocStatistik eine brauchebare Seitenzahl angegeben ist
1255cdf0e10cSrcweir //(wird beim Schreiben gepflegt), so wird von dieser Seitenanzahl
1256cdf0e10cSrcweir //ausgegengen.
1257cdf0e10cSrcweir const sal_Bool bStartPercent = bPages && !nEndIndex;
1258cdf0e10cSrcweir
1259cdf0e10cSrcweir SwPageFrm *pPage = pLay->FindPageFrm();
1260cdf0e10cSrcweir const SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
1261cdf0e10cSrcweir SwFrm *pFrm = 0;
1262cdf0e10cSrcweir sal_Bool bBreakAfter = sal_False;
1263cdf0e10cSrcweir
1264cdf0e10cSrcweir SwActualSection *pActualSection = 0;
1265cdf0e10cSrcweir SwLayHelper *pPageMaker;
1266cdf0e10cSrcweir
1267cdf0e10cSrcweir //Wenn das Layout erzeugt wird (bPages == sal_True) steuern wir den Progress
1268cdf0e10cSrcweir //an. Flys und DrawObjekte werden dann nicht gleich verbunden, dies
1269cdf0e10cSrcweir //passiert erst am Ende der Funktion.
1270cdf0e10cSrcweir if ( bPages )
1271cdf0e10cSrcweir {
1272cdf0e10cSrcweir // Attention: the SwLayHelper class uses references to the content-,
1273cdf0e10cSrcweir // page-, layout-frame etc. and may change them!
1274cdf0e10cSrcweir pPageMaker = new SwLayHelper( pDoc, pFrm, pPrv, pPage, pLay,
1275cdf0e10cSrcweir pActualSection, bBreakAfter, nIndex, 0 == nEndIndex );
1276cdf0e10cSrcweir if( bStartPercent )
1277cdf0e10cSrcweir {
1278cdf0e10cSrcweir const sal_uLong nPageCount = pPageMaker->CalcPageCount();
1279cdf0e10cSrcweir if( nPageCount )
1280cdf0e10cSrcweir bObjsDirect = sal_False;
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir }
1283cdf0e10cSrcweir else
1284cdf0e10cSrcweir pPageMaker = NULL;
1285cdf0e10cSrcweir
1286cdf0e10cSrcweir if( pLay->IsInSct() &&
1287cdf0e10cSrcweir ( pLay->IsSctFrm() || pLay->GetUpper() ) ) // Hierdurch werden Frischlinge
1288cdf0e10cSrcweir // abgefangen, deren Flags noch nicht ermittelt werden koennen,
1289cdf0e10cSrcweir // so z.B. beim Einfuegen einer Tabelle
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir SwSectionFrm* pSct = pLay->FindSctFrm();
1292cdf0e10cSrcweir // Wenn Inhalt in eine Fussnote eingefuegt wird, die in einem spaltigen
1293cdf0e10cSrcweir // Bereich liegt, so darf der spaltige Bereich nicht aufgebrochen werden.
1294cdf0e10cSrcweir // Nur wenn im Innern der Fussnote ein Bereich liegt, ist dies ein
1295cdf0e10cSrcweir // Kandidat fuer pActualSection.
1296cdf0e10cSrcweir // Gleiches gilt fuer Bereiche in Tabellen, wenn innerhalb einer Tabelle
1297cdf0e10cSrcweir // eingefuegt wird, duerfen nur Bereiche, die ebenfalls im Innern liegen,
1298cdf0e10cSrcweir // aufgebrochen werden.
1299cdf0e10cSrcweir if( ( !pLay->IsInFtn() || pSct->IsInFtn() ) &&
1300cdf0e10cSrcweir ( !pLay->IsInTab() || pSct->IsInTab() ) )
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir pActualSection = new SwActualSection( 0, pSct, 0 );
1303cdf0e10cSrcweir ASSERT( !pLay->Lower() || !pLay->Lower()->IsColumnFrm(),
1304cdf0e10cSrcweir "_InsertCnt: Wrong Call" );
1305cdf0e10cSrcweir }
1306cdf0e10cSrcweir }
1307cdf0e10cSrcweir
1308cdf0e10cSrcweir //If a section is "open", the pActualSection points to an SwActualSection.
1309cdf0e10cSrcweir //If the page breaks, for "open" sections a follow will created.
1310cdf0e10cSrcweir //For nested sections (which have, however, not a nested layout),
1311cdf0e10cSrcweir //the SwActualSection class has a member, which points to an upper(section).
1312cdf0e10cSrcweir //When the "inner" section finishs, the upper will used instead.
1313cdf0e10cSrcweir
1314cdf0e10cSrcweir while( sal_True )
1315cdf0e10cSrcweir {
1316cdf0e10cSrcweir SwNode *pNd = pDoc->GetNodes()[nIndex];
1317cdf0e10cSrcweir if ( pNd->IsCntntNode() )
1318cdf0e10cSrcweir {
1319cdf0e10cSrcweir SwCntntNode* pNode = (SwCntntNode*)pNd;
1320cdf0e10cSrcweir pFrm = pNode->IsTxtNode() ? new SwTxtFrm( (SwTxtNode*)pNode, pLay ) :
1321cdf0e10cSrcweir pNode->MakeFrm( pLay );
1322cdf0e10cSrcweir if( pPageMaker )
1323cdf0e10cSrcweir pPageMaker->CheckInsert( nIndex );
1324cdf0e10cSrcweir
1325cdf0e10cSrcweir pFrm->InsertBehind( pLay, pPrv );
1326cdf0e10cSrcweir // --> OD 2005-12-01 #i27138#
1327cdf0e10cSrcweir // notify accessibility paragraphs objects about changed
1328cdf0e10cSrcweir // CONTENT_FLOWS_FROM/_TO relation.
1329cdf0e10cSrcweir // Relation CONTENT_FLOWS_FROM for next paragraph will change
1330cdf0e10cSrcweir // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1331cdf0e10cSrcweir if ( pFrm->IsTxtFrm() )
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
1334cdf0e10cSrcweir // no notification, if <ViewShell> is in construction
1335cdf0e10cSrcweir if ( pViewShell && !pViewShell->IsInConstructor() &&
1336cdf0e10cSrcweir pViewShell->GetLayout() &&
1337cdf0e10cSrcweir pViewShell->GetLayout()->IsAnyShellAccessible() )
1338cdf0e10cSrcweir {
1339cdf0e10cSrcweir pViewShell->InvalidateAccessibleParaFlowRelation(
1340cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )),
1341cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) );
1342cdf0e10cSrcweir // --> OD 2006-08-28 #i68958#
1343cdf0e10cSrcweir // The information flags of the text frame are validated
1344cdf0e10cSrcweir // in methods <FindNextCnt(..)> and <FindPrevCnt(..)>.
1345cdf0e10cSrcweir // The information flags have to be invalidated, because
1346cdf0e10cSrcweir // it is possible, that the one of its upper frames
1347cdf0e10cSrcweir // isn't inserted into the layout.
1348cdf0e10cSrcweir pFrm->InvalidateInfFlags();
1349cdf0e10cSrcweir // <--
1350cdf0e10cSrcweir }
1351cdf0e10cSrcweir }
1352cdf0e10cSrcweir // <--
1353cdf0e10cSrcweir // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1354cdf0e10cSrcweir // for setting position at newly inserted frame
1355cdf0e10cSrcweir lcl_SetPos( *pFrm, *pLay );
1356cdf0e10cSrcweir pPrv = pFrm;
1357cdf0e10cSrcweir
1358cdf0e10cSrcweir if ( pTbl->Count() && bObjsDirect && !bDontCreateObjects )
1359cdf0e10cSrcweir AppendObjs( pTbl, nIndex, pFrm, pPage );
1360cdf0e10cSrcweir }
1361cdf0e10cSrcweir else if ( pNd->IsTableNode() )
1362cdf0e10cSrcweir { //Sollten wir auf eine Tabelle gestossen sein?
1363cdf0e10cSrcweir SwTableNode *pTblNode = (SwTableNode*)pNd;
1364cdf0e10cSrcweir
1365cdf0e10cSrcweir // #108116# loading may produce table structures that GCLines
1366cdf0e10cSrcweir // needs to clean up. To keep table formulas correct, change
1367cdf0e10cSrcweir // all table formulas to internal (BOXPTR) representation.
1368cdf0e10cSrcweir SwTableFmlUpdate aMsgHnt( &pTblNode->GetTable() );
1369cdf0e10cSrcweir aMsgHnt.eFlags = TBL_BOXPTR;
1370cdf0e10cSrcweir pDoc->UpdateTblFlds( &aMsgHnt );
1371cdf0e10cSrcweir pTblNode->GetTable().GCLines();
1372cdf0e10cSrcweir
1373cdf0e10cSrcweir pFrm = pTblNode->MakeFrm( pLay );
1374cdf0e10cSrcweir
1375cdf0e10cSrcweir if( pPageMaker )
1376cdf0e10cSrcweir pPageMaker->CheckInsert( nIndex );
1377cdf0e10cSrcweir
1378cdf0e10cSrcweir pFrm->InsertBehind( pLay, pPrv );
1379cdf0e10cSrcweir // --> OD 2005-12-01 #i27138#
1380cdf0e10cSrcweir // notify accessibility paragraphs objects about changed
1381cdf0e10cSrcweir // CONTENT_FLOWS_FROM/_TO relation.
1382cdf0e10cSrcweir // Relation CONTENT_FLOWS_FROM for next paragraph will change
1383cdf0e10cSrcweir // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1384cdf0e10cSrcweir {
1385cdf0e10cSrcweir ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
1386cdf0e10cSrcweir // no notification, if <ViewShell> is in construction
1387cdf0e10cSrcweir if ( pViewShell && !pViewShell->IsInConstructor() &&
1388cdf0e10cSrcweir pViewShell->GetLayout() &&
1389cdf0e10cSrcweir pViewShell->GetLayout()->IsAnyShellAccessible() )
1390cdf0e10cSrcweir {
1391cdf0e10cSrcweir pViewShell->InvalidateAccessibleParaFlowRelation(
1392cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )),
1393cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) );
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir }
1396cdf0e10cSrcweir // <--
1397cdf0e10cSrcweir if ( bObjsDirect && pTbl->Count() )
1398cdf0e10cSrcweir ((SwTabFrm*)pFrm)->RegistFlys();
1399cdf0e10cSrcweir // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1400cdf0e10cSrcweir // for setting position at newly inserted frame
1401cdf0e10cSrcweir lcl_SetPos( *pFrm, *pLay );
1402cdf0e10cSrcweir
1403cdf0e10cSrcweir pPrv = pFrm;
1404cdf0e10cSrcweir //Index auf den Endnode der Tabellensection setzen.
1405cdf0e10cSrcweir nIndex = pTblNode->EndOfSectionIndex();
1406cdf0e10cSrcweir
1407cdf0e10cSrcweir SwTabFrm* pTmpFrm = (SwTabFrm*)pFrm;
1408cdf0e10cSrcweir while ( pTmpFrm )
1409cdf0e10cSrcweir {
1410cdf0e10cSrcweir pTmpFrm->CheckDirChange();
1411cdf0e10cSrcweir pTmpFrm = pTmpFrm->IsFollow() ? pTmpFrm->FindMaster() : NULL;
1412cdf0e10cSrcweir }
1413cdf0e10cSrcweir
1414cdf0e10cSrcweir }
1415cdf0e10cSrcweir else if ( pNd->IsSectionNode() )
1416cdf0e10cSrcweir {
1417cdf0e10cSrcweir SwSectionNode *pNode = (SwSectionNode*)pNd;
1418cdf0e10cSrcweir if( pNode->GetSection().CalcHiddenFlag() )
1419cdf0e10cSrcweir // ist versteckt, ueberspringe den Bereich
1420cdf0e10cSrcweir nIndex = pNode->EndOfSectionIndex();
1421cdf0e10cSrcweir else
1422cdf0e10cSrcweir {
1423cdf0e10cSrcweir pFrm = pNode->MakeFrm( pLay );
1424cdf0e10cSrcweir pActualSection = new SwActualSection( pActualSection,
1425cdf0e10cSrcweir (SwSectionFrm*)pFrm, pNode );
1426cdf0e10cSrcweir if ( pActualSection->GetUpper() )
1427cdf0e10cSrcweir {
1428cdf0e10cSrcweir //Hinter den Upper einsetzen, beim EndNode wird der "Follow"
1429cdf0e10cSrcweir //des Uppers erzeugt.
1430cdf0e10cSrcweir SwSectionFrm *pTmp = pActualSection->GetUpper()->GetSectionFrm();
1431cdf0e10cSrcweir pFrm->InsertBehind( pTmp->GetUpper(), pTmp );
1432cdf0e10cSrcweir // OD 25.03.2003 #108339# - direct initialization of section
1433cdf0e10cSrcweir // after insertion in the layout
1434cdf0e10cSrcweir static_cast<SwSectionFrm*>(pFrm)->Init();
1435cdf0e10cSrcweir }
1436cdf0e10cSrcweir else
1437cdf0e10cSrcweir {
1438cdf0e10cSrcweir pFrm->InsertBehind( pLay, pPrv );
1439cdf0e10cSrcweir // OD 25.03.2003 #108339# - direct initialization of section
1440cdf0e10cSrcweir // after insertion in the layout
1441cdf0e10cSrcweir static_cast<SwSectionFrm*>(pFrm)->Init();
1442cdf0e10cSrcweir
1443cdf0e10cSrcweir // --> FME 2004-09-08 #i33963#
1444cdf0e10cSrcweir // Do not trust the IsInFtn flag. If we are currently
1445cdf0e10cSrcweir // building up a table, the upper of pPrv may be a cell
1446cdf0e10cSrcweir // frame, but the cell frame does not have an upper yet.
1447cdf0e10cSrcweir if( pPrv && 0 != pPrv->ImplFindFtnFrm() )
1448cdf0e10cSrcweir // <--
1449cdf0e10cSrcweir {
1450cdf0e10cSrcweir if( pPrv->IsSctFrm() )
1451cdf0e10cSrcweir pPrv = ((SwSectionFrm*)pPrv)->ContainsCntnt();
1452cdf0e10cSrcweir if( pPrv && pPrv->IsTxtFrm() )
1453cdf0e10cSrcweir ((SwTxtFrm*)pPrv)->Prepare( PREP_QUOVADIS, 0, sal_False );
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir // --> OD 2005-12-01 #i27138#
1457cdf0e10cSrcweir // notify accessibility paragraphs objects about changed
1458cdf0e10cSrcweir // CONTENT_FLOWS_FROM/_TO relation.
1459cdf0e10cSrcweir // Relation CONTENT_FLOWS_FROM for next paragraph will change
1460cdf0e10cSrcweir // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1461cdf0e10cSrcweir {
1462cdf0e10cSrcweir ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
1463cdf0e10cSrcweir // no notification, if <ViewShell> is in construction
1464cdf0e10cSrcweir if ( pViewShell && !pViewShell->IsInConstructor() &&
1465cdf0e10cSrcweir pViewShell->GetLayout() &&
1466cdf0e10cSrcweir pViewShell->GetLayout()->IsAnyShellAccessible() )
1467cdf0e10cSrcweir {
1468cdf0e10cSrcweir pViewShell->InvalidateAccessibleParaFlowRelation(
1469cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )),
1470cdf0e10cSrcweir dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) );
1471cdf0e10cSrcweir }
1472cdf0e10cSrcweir }
1473cdf0e10cSrcweir // <--
1474cdf0e10cSrcweir pFrm->CheckDirChange();
1475cdf0e10cSrcweir
1476cdf0e10cSrcweir // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1477cdf0e10cSrcweir // for setting position at newly inserted frame
1478cdf0e10cSrcweir lcl_SetPos( *pFrm, *pLay );
1479cdf0e10cSrcweir
1480cdf0e10cSrcweir // OD 20.11.2002 #105405# - no page, no invalidate.
1481cdf0e10cSrcweir if ( pPage )
1482cdf0e10cSrcweir {
1483cdf0e10cSrcweir // OD 18.09.2002 #100522#
1484cdf0e10cSrcweir // invalidate page in order to force format and paint of
1485cdf0e10cSrcweir // inserted section frame
1486cdf0e10cSrcweir pFrm->InvalidatePage( pPage );
1487cdf0e10cSrcweir
1488cdf0e10cSrcweir // FME 10.11.2003 #112243#
1489cdf0e10cSrcweir // Invalidate fly content flag:
1490cdf0e10cSrcweir if ( pFrm->IsInFly() )
1491cdf0e10cSrcweir pPage->InvalidateFlyCntnt();
1492cdf0e10cSrcweir
1493cdf0e10cSrcweir // OD 14.11.2002 #104684# - invalidate page content in order to
1494cdf0e10cSrcweir // force format and paint of section content.
1495cdf0e10cSrcweir pPage->InvalidateCntnt();
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir
1498cdf0e10cSrcweir pLay = (SwLayoutFrm*)pFrm;
1499cdf0e10cSrcweir if ( pLay->Lower() && pLay->Lower()->IsLayoutFrm() )
1500cdf0e10cSrcweir pLay = pLay->GetNextLayoutLeaf();
1501cdf0e10cSrcweir pPrv = 0;
1502cdf0e10cSrcweir }
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir else if ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir ASSERT( pActualSection, "Sectionende ohne Anfang?" );
1507cdf0e10cSrcweir ASSERT( pActualSection->GetSectionNode() == pNd->StartOfSectionNode(),
1508cdf0e10cSrcweir "Sectionende mit falschen Start Node?" );
1509cdf0e10cSrcweir
1510cdf0e10cSrcweir //Section schliessen, ggf. die umgebende Section wieder
1511cdf0e10cSrcweir //aktivieren.
1512cdf0e10cSrcweir SwActualSection *pTmp = pActualSection->GetUpper();
1513cdf0e10cSrcweir delete pActualSection;
1514cdf0e10cSrcweir pLay = pLay->FindSctFrm();
1515cdf0e10cSrcweir if ( 0 != (pActualSection = pTmp) )
1516cdf0e10cSrcweir {
1517cdf0e10cSrcweir //Koennte noch sein, das der letzte SectionFrm leer geblieben
1518cdf0e10cSrcweir //ist. Dann ist es jetzt an der Zeit ihn zu entfernen.
1519cdf0e10cSrcweir if ( !pLay->ContainsCntnt() )
1520cdf0e10cSrcweir {
1521cdf0e10cSrcweir SwFrm *pTmpFrm = pLay;
1522cdf0e10cSrcweir pLay = pTmpFrm->GetUpper();
1523cdf0e10cSrcweir pPrv = pTmpFrm->GetPrev();
1524cdf0e10cSrcweir pTmpFrm->Remove();
1525cdf0e10cSrcweir delete pTmpFrm;
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir else
1528cdf0e10cSrcweir {
1529cdf0e10cSrcweir pPrv = pLay;
1530cdf0e10cSrcweir pLay = pLay->GetUpper();
1531cdf0e10cSrcweir }
1532cdf0e10cSrcweir
1533cdf0e10cSrcweir // new section frame
1534cdf0e10cSrcweir pFrm = pActualSection->GetSectionNode()->MakeFrm( pLay );
1535cdf0e10cSrcweir pFrm->InsertBehind( pLay, pPrv );
1536cdf0e10cSrcweir static_cast<SwSectionFrm*>(pFrm)->Init();
1537cdf0e10cSrcweir
1538cdf0e10cSrcweir // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1539cdf0e10cSrcweir // for setting position at newly inserted frame
1540cdf0e10cSrcweir lcl_SetPos( *pFrm, *pLay );
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir SwSectionFrm* pOuterSectionFrm = pActualSection->GetSectionFrm();
1543cdf0e10cSrcweir
1544cdf0e10cSrcweir // a follow has to be appended to the new section frame
1545cdf0e10cSrcweir SwSectionFrm* pFollow = pOuterSectionFrm->GetFollow();
1546cdf0e10cSrcweir if ( pFollow )
1547cdf0e10cSrcweir {
1548cdf0e10cSrcweir pOuterSectionFrm->SetFollow( NULL );
1549cdf0e10cSrcweir pOuterSectionFrm->InvalidateSize();
1550cdf0e10cSrcweir ((SwSectionFrm*)pFrm)->SetFollow( pFollow );
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir
1553cdf0e10cSrcweir // Wir wollen keine leeren Teile zuruecklassen
1554cdf0e10cSrcweir if( ! pOuterSectionFrm->IsColLocked() &&
1555cdf0e10cSrcweir ! pOuterSectionFrm->ContainsCntnt() )
1556cdf0e10cSrcweir {
1557cdf0e10cSrcweir pOuterSectionFrm->DelEmpty( sal_True );
1558cdf0e10cSrcweir delete pOuterSectionFrm;
1559cdf0e10cSrcweir }
1560cdf0e10cSrcweir pActualSection->SetSectionFrm( (SwSectionFrm*)pFrm );
1561cdf0e10cSrcweir
1562cdf0e10cSrcweir pLay = (SwLayoutFrm*)pFrm;
1563cdf0e10cSrcweir if ( pLay->Lower() && pLay->Lower()->IsLayoutFrm() )
1564cdf0e10cSrcweir pLay = pLay->GetNextLayoutLeaf();
1565cdf0e10cSrcweir pPrv = 0;
1566cdf0e10cSrcweir }
1567cdf0e10cSrcweir else
1568cdf0e10cSrcweir {
1569cdf0e10cSrcweir //Nix mehr mit Sections, es geht direkt hinter dem SectionFrame
1570cdf0e10cSrcweir //weiter.
1571cdf0e10cSrcweir pPrv = pLay;
1572cdf0e10cSrcweir pLay = pLay->GetUpper();
1573cdf0e10cSrcweir }
1574cdf0e10cSrcweir }
1575cdf0e10cSrcweir else if( pNd->IsStartNode() &&
1576cdf0e10cSrcweir SwFlyStartNode == ((SwStartNode*)pNd)->GetStartNodeType() )
1577cdf0e10cSrcweir {
1578cdf0e10cSrcweir if ( pTbl->Count() && bObjsDirect && !bDontCreateObjects )
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir SwFlyFrm* pFly = pLay->FindFlyFrm();
1581cdf0e10cSrcweir if( pFly )
1582cdf0e10cSrcweir AppendObjs( pTbl, nIndex, pFly, pPage );
1583cdf0e10cSrcweir }
1584cdf0e10cSrcweir }
1585cdf0e10cSrcweir else
1586cdf0e10cSrcweir // Weder Cntnt noch Tabelle noch Section,
1587cdf0e10cSrcweir // also muessen wir fertig sein.
1588cdf0e10cSrcweir break;
1589cdf0e10cSrcweir
1590cdf0e10cSrcweir ++nIndex;
1591cdf0e10cSrcweir // Der Endnode wird nicht mehr mitgenommen, es muss vom
1592cdf0e10cSrcweir // Aufrufenden (Section/MakeFrms()) sichergestellt sein, dass das Ende
1593cdf0e10cSrcweir // des Bereichs vor dem EndIndex liegt!
1594cdf0e10cSrcweir if ( nEndIndex && nIndex >= nEndIndex )
1595cdf0e10cSrcweir break;
1596cdf0e10cSrcweir }
1597cdf0e10cSrcweir
1598cdf0e10cSrcweir if ( pActualSection )
1599cdf0e10cSrcweir {
1600cdf0e10cSrcweir //Kann passieren, dass noch eine leere (Follow-)Section uebrig geblieben ist.
1601cdf0e10cSrcweir if ( !(pLay = pActualSection->GetSectionFrm())->ContainsCntnt() )
1602cdf0e10cSrcweir {
1603cdf0e10cSrcweir pLay->Remove();
1604cdf0e10cSrcweir delete pLay;
1605cdf0e10cSrcweir }
1606cdf0e10cSrcweir delete pActualSection;
1607cdf0e10cSrcweir }
1608cdf0e10cSrcweir
1609cdf0e10cSrcweir if ( bPages ) //Jetzt noch die Flys verbinden lassen.
1610cdf0e10cSrcweir {
1611cdf0e10cSrcweir if ( !bDontCreateObjects )
1612cdf0e10cSrcweir AppendAllObjs( pTbl, pLayout );
1613cdf0e10cSrcweir bObjsDirect = sal_True;
1614cdf0e10cSrcweir }
1615cdf0e10cSrcweir
1616cdf0e10cSrcweir if( pPageMaker )
1617cdf0e10cSrcweir {
1618cdf0e10cSrcweir pPageMaker->CheckFlyCache( pPage );
1619cdf0e10cSrcweir delete pPageMaker;
1620cdf0e10cSrcweir if( pDoc->GetLayoutCache() )
1621cdf0e10cSrcweir {
1622cdf0e10cSrcweir #ifdef DBG_UTIL
1623cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1624cdf0e10cSrcweir pDoc->GetLayoutCache()->CompareLayout( *pDoc );
1625cdf0e10cSrcweir #endif
1626cdf0e10cSrcweir #endif
1627cdf0e10cSrcweir pDoc->GetLayoutCache()->ClearImpl();
1628cdf0e10cSrcweir }
1629cdf0e10cSrcweir }
1630cdf0e10cSrcweir
1631cdf0e10cSrcweir pDoc->UnblockIdling();
1632cdf0e10cSrcweir if( bOldCallbackActionEnabled )
1633cdf0e10cSrcweir pLayout->SetCallbackActionEnabled( bOldCallbackActionEnabled );
1634cdf0e10cSrcweir }
1635cdf0e10cSrcweir
1636cdf0e10cSrcweir
MakeFrms(SwDoc * pDoc,const SwNodeIndex & rSttIdx,const SwNodeIndex & rEndIdx)1637cdf0e10cSrcweir void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
1638cdf0e10cSrcweir const SwNodeIndex &rEndIdx )
1639cdf0e10cSrcweir {
1640cdf0e10cSrcweir bObjsDirect = sal_False;
1641cdf0e10cSrcweir
1642cdf0e10cSrcweir SwNodeIndex aTmp( rSttIdx );
1643cdf0e10cSrcweir sal_uLong nEndIdx = rEndIdx.GetIndex();
1644cdf0e10cSrcweir SwNode* pNd = pDoc->GetNodes().FindPrvNxtFrmNode( aTmp,
1645cdf0e10cSrcweir pDoc->GetNodes()[ nEndIdx-1 ]);
1646cdf0e10cSrcweir if ( pNd )
1647cdf0e10cSrcweir {
1648cdf0e10cSrcweir sal_Bool bApres = aTmp < rSttIdx;
1649cdf0e10cSrcweir SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
1650cdf0e10cSrcweir SwFrm* pFrm;
1651cdf0e10cSrcweir while( 0 != (pFrm = aNode2Layout.NextFrm()) )
1652cdf0e10cSrcweir {
1653cdf0e10cSrcweir SwLayoutFrm *pUpper = pFrm->GetUpper();
1654cdf0e10cSrcweir SwFtnFrm* pFtnFrm = pUpper->FindFtnFrm();
1655cdf0e10cSrcweir sal_Bool bOldLock, bOldFtn;
1656cdf0e10cSrcweir if( pFtnFrm )
1657cdf0e10cSrcweir {
1658cdf0e10cSrcweir bOldFtn = pFtnFrm->IsColLocked();
1659cdf0e10cSrcweir pFtnFrm->ColLock();
1660cdf0e10cSrcweir }
1661cdf0e10cSrcweir else
1662cdf0e10cSrcweir bOldFtn = sal_True;
1663cdf0e10cSrcweir SwSectionFrm* pSct = pUpper->FindSctFrm();
1664cdf0e10cSrcweir // Es sind innerhalb von Fussnoten nur die Bereiche interessant,
1665cdf0e10cSrcweir // die in den Fussnoten liegen, nicht etwa die (spaltigen) Bereiche,
1666cdf0e10cSrcweir // in denen die Fussnoten(Container) liegen.
1667cdf0e10cSrcweir // #109767# Table frame is in section, insert section in cell frame.
1668cdf0e10cSrcweir if( pSct && ((pFtnFrm && !pSct->IsInFtn()) || pUpper->IsCellFrm()) )
1669cdf0e10cSrcweir pSct = NULL;
1670cdf0e10cSrcweir if( pSct )
1671cdf0e10cSrcweir { // damit der SectionFrm nicht zerstoert wird durch pTmp->MoveFwd()
1672cdf0e10cSrcweir bOldLock = pSct->IsColLocked();
1673cdf0e10cSrcweir pSct->ColLock();
1674cdf0e10cSrcweir }
1675cdf0e10cSrcweir else
1676cdf0e10cSrcweir bOldLock = sal_True;
1677cdf0e10cSrcweir
1678cdf0e10cSrcweir // Wenn pFrm sich nicht bewegen kann, koennen wir auch niemanden
1679cdf0e10cSrcweir // auf die naechste Seite schieben. Innerhalb eines Rahmens auch
1680cdf0e10cSrcweir // nicht ( in der 1. Spalte eines Rahmens waere pFrm Moveable()! )
1681cdf0e10cSrcweir // Auch in spaltigen Bereichen in Tabellen waere pFrm Moveable.
1682cdf0e10cSrcweir sal_Bool bMoveNext = nEndIdx - rSttIdx.GetIndex() > 120;
1683cdf0e10cSrcweir sal_Bool bAllowMove = !pFrm->IsInFly() && pFrm->IsMoveable() &&
1684cdf0e10cSrcweir (!pFrm->IsInTab() || pFrm->IsTabFrm() );
1685cdf0e10cSrcweir if ( bMoveNext && bAllowMove )
1686cdf0e10cSrcweir {
1687cdf0e10cSrcweir SwFrm *pMove = pFrm;
1688cdf0e10cSrcweir SwFrm *pPrev = pFrm->GetPrev();
1689cdf0e10cSrcweir SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pMove );
1690cdf0e10cSrcweir ASSERT( pTmp, "Missing FlowFrm" );
1691cdf0e10cSrcweir
1692cdf0e10cSrcweir if ( bApres )
1693cdf0e10cSrcweir {
1694cdf0e10cSrcweir // Wir wollen, dass der Rest der Seite leer ist, d.h.
1695cdf0e10cSrcweir // der naechste muss auf die naechste Seite wandern.
1696cdf0e10cSrcweir // Dieser kann auch in der naechsten Spalte stehen!
1697cdf0e10cSrcweir ASSERT( !pTmp->HasFollow(), "Follows forbidden" );
1698cdf0e10cSrcweir pPrev = pFrm;
1699cdf0e10cSrcweir // Wenn unser umgebender SectionFrm einen Next besitzt,
1700cdf0e10cSrcweir // so soll dieser ebenfalls gemoved werden!
1701cdf0e10cSrcweir pMove = pFrm->GetIndNext();
1702cdf0e10cSrcweir SwColumnFrm* pCol = (SwColumnFrm*)pFrm->FindColFrm();
1703cdf0e10cSrcweir if( pCol )
1704cdf0e10cSrcweir pCol = (SwColumnFrm*)pCol->GetNext();
1705cdf0e10cSrcweir do
1706cdf0e10cSrcweir {
1707cdf0e10cSrcweir if( pCol && !pMove )
1708cdf0e10cSrcweir { // Bisher haben wir keinen Nachfolger gefunden
1709cdf0e10cSrcweir // jetzt gucken wir in die naechste Spalte
1710cdf0e10cSrcweir pMove = pCol->ContainsAny();
1711cdf0e10cSrcweir if( pCol->GetNext() )
1712cdf0e10cSrcweir pCol = (SwColumnFrm*)pCol->GetNext();
1713cdf0e10cSrcweir else if( pCol->IsInSct() )
1714cdf0e10cSrcweir { // Wenn es keine naechste Spalte gibt, wir aber
1715cdf0e10cSrcweir // innerhalb eines spaltigen Bereichs sind,
1716cdf0e10cSrcweir // koennte es noch ausserhalb des Bereich
1717cdf0e10cSrcweir // (Seiten-)Spalten geben
1718cdf0e10cSrcweir pCol = (SwColumnFrm*)pCol->FindSctFrm()->FindColFrm();
1719cdf0e10cSrcweir if( pCol )
1720cdf0e10cSrcweir pCol = (SwColumnFrm*)pCol->GetNext();
1721cdf0e10cSrcweir }
1722cdf0e10cSrcweir else
1723cdf0e10cSrcweir pCol = NULL;
1724cdf0e10cSrcweir }
1725cdf0e10cSrcweir // Falls hier verschrottete SectionFrms herumgammeln,
1726cdf0e10cSrcweir // muessen diese uebersprungen werden.
1727cdf0e10cSrcweir while( pMove && pMove->IsSctFrm() &&
1728cdf0e10cSrcweir !((SwSectionFrm*)pMove)->GetSection() )
1729cdf0e10cSrcweir pMove = pMove->GetNext();
1730cdf0e10cSrcweir } while( !pMove && pCol );
1731cdf0e10cSrcweir
1732cdf0e10cSrcweir if( pMove )
1733cdf0e10cSrcweir {
1734cdf0e10cSrcweir if ( pMove->IsCntntFrm() )
1735cdf0e10cSrcweir pTmp = (SwCntntFrm*)pMove;
1736cdf0e10cSrcweir else if ( pMove->IsTabFrm() )
1737cdf0e10cSrcweir pTmp = (SwTabFrm*)pMove;
1738cdf0e10cSrcweir else if ( pMove->IsSctFrm() )
1739cdf0e10cSrcweir {
1740cdf0e10cSrcweir pMove = ((SwSectionFrm*)pMove)->ContainsAny();
1741cdf0e10cSrcweir if( pMove )
1742cdf0e10cSrcweir pTmp = SwFlowFrm::CastFlowFrm( pMove );
1743cdf0e10cSrcweir else
1744cdf0e10cSrcweir pTmp = NULL;
1745cdf0e10cSrcweir }
1746cdf0e10cSrcweir }
1747cdf0e10cSrcweir else
1748cdf0e10cSrcweir pTmp = 0;
1749cdf0e10cSrcweir }
1750cdf0e10cSrcweir else
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir ASSERT( !pTmp->IsFollow(), "Follows really forbidden" );
1753cdf0e10cSrcweir // Bei Bereichen muss natuerlich der Inhalt auf die Reise
1754cdf0e10cSrcweir // geschickt werden.
1755cdf0e10cSrcweir if( pMove->IsSctFrm() )
1756cdf0e10cSrcweir {
1757cdf0e10cSrcweir while( pMove && pMove->IsSctFrm() &&
1758cdf0e10cSrcweir !((SwSectionFrm*)pMove)->GetSection() )
1759cdf0e10cSrcweir pMove = pMove->GetNext();
1760cdf0e10cSrcweir if( pMove && pMove->IsSctFrm() )
1761cdf0e10cSrcweir pMove = ((SwSectionFrm*)pMove)->ContainsAny();
1762cdf0e10cSrcweir if( pMove )
1763cdf0e10cSrcweir pTmp = SwFlowFrm::CastFlowFrm( pMove );
1764cdf0e10cSrcweir else
1765cdf0e10cSrcweir pTmp = NULL;
1766cdf0e10cSrcweir }
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir
1769cdf0e10cSrcweir if( pTmp )
1770cdf0e10cSrcweir {
1771cdf0e10cSrcweir SwFrm* pOldUp = pTmp->GetFrm()->GetUpper();
1772cdf0e10cSrcweir // MoveFwd==sal_True bedeutet, dass wir auf der gleichen
1773cdf0e10cSrcweir // Seite geblieben sind, wir wollen aber die Seite wechseln,
1774cdf0e10cSrcweir // sofern dies moeglich ist
1775cdf0e10cSrcweir sal_Bool bTmpOldLock = pTmp->IsJoinLocked();
1776cdf0e10cSrcweir pTmp->LockJoin();
1777cdf0e10cSrcweir while( pTmp->MoveFwd( sal_True, sal_False, sal_True ) )
1778cdf0e10cSrcweir {
1779cdf0e10cSrcweir if( pOldUp == pTmp->GetFrm()->GetUpper() )
1780cdf0e10cSrcweir break;
1781cdf0e10cSrcweir pOldUp = pTmp->GetFrm()->GetUpper();
1782cdf0e10cSrcweir }
1783cdf0e10cSrcweir if( !bTmpOldLock )
1784cdf0e10cSrcweir pTmp->UnlockJoin();
1785cdf0e10cSrcweir }
1786cdf0e10cSrcweir ::_InsertCnt( pUpper, pDoc, rSttIdx.GetIndex(),
1787cdf0e10cSrcweir pFrm->IsInDocBody(), nEndIdx, pPrev );
1788cdf0e10cSrcweir }
1789cdf0e10cSrcweir else
1790cdf0e10cSrcweir {
1791cdf0e10cSrcweir sal_Bool bSplit;
1792cdf0e10cSrcweir SwFrm* pPrv = bApres ? pFrm : pFrm->GetPrev();
1793cdf0e10cSrcweir // Wenn in einen SectionFrm ein anderer eingefuegt wird,
1794cdf0e10cSrcweir // muss dieser aufgebrochen werden
1795cdf0e10cSrcweir if( pSct && rSttIdx.GetNode().IsSectionNode() )
1796cdf0e10cSrcweir {
1797cdf0e10cSrcweir bSplit = pSct->SplitSect( pFrm, bApres );
1798cdf0e10cSrcweir // Wenn pSct nicht aufgespalten werden konnte
1799cdf0e10cSrcweir if( !bSplit && !bApres )
1800cdf0e10cSrcweir {
1801cdf0e10cSrcweir pUpper = pSct->GetUpper();
1802cdf0e10cSrcweir pPrv = pSct->GetPrev();
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir }
1805cdf0e10cSrcweir else
1806cdf0e10cSrcweir bSplit = sal_False;
1807cdf0e10cSrcweir ::_InsertCnt( pUpper, pDoc, rSttIdx.GetIndex(), sal_False,
1808cdf0e10cSrcweir nEndIdx, pPrv );
1809cdf0e10cSrcweir // OD 23.06.2003 #108784# - correction: append objects doesn't
1810cdf0e10cSrcweir // depend on value of <bAllowMove>
1811cdf0e10cSrcweir if( !bDontCreateObjects )
1812cdf0e10cSrcweir {
1813cdf0e10cSrcweir const SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
1814cdf0e10cSrcweir if( pTbl->Count() )
1815cdf0e10cSrcweir AppendAllObjs( pTbl, pUpper );
1816cdf0e10cSrcweir }
1817cdf0e10cSrcweir
1818cdf0e10cSrcweir // Wenn nichts eingefuegt wurde, z.B. ein ausgeblendeter Bereich,
1819cdf0e10cSrcweir // muss das Splitten rueckgaengig gemacht werden
1820cdf0e10cSrcweir if( bSplit && pSct && pSct->GetNext()
1821cdf0e10cSrcweir && pSct->GetNext()->IsSctFrm() )
1822cdf0e10cSrcweir pSct->MergeNext( (SwSectionFrm*)pSct->GetNext() );
1823cdf0e10cSrcweir if( pFrm->IsInFly() )
1824cdf0e10cSrcweir pFrm->FindFlyFrm()->_Invalidate();
1825cdf0e10cSrcweir if( pFrm->IsInTab() )
1826cdf0e10cSrcweir pFrm->InvalidateSize();
1827cdf0e10cSrcweir }
1828cdf0e10cSrcweir
1829cdf0e10cSrcweir SwPageFrm *pPage = pUpper->FindPageFrm();
1830cdf0e10cSrcweir SwFrm::CheckPageDescs( pPage, sal_False );
1831cdf0e10cSrcweir if( !bOldFtn )
1832cdf0e10cSrcweir pFtnFrm->ColUnlock();
1833cdf0e10cSrcweir if( !bOldLock )
1834cdf0e10cSrcweir {
1835cdf0e10cSrcweir pSct->ColUnlock();
1836cdf0e10cSrcweir // Zum Beispiel beim Einfuegen von gelinkten Bereichen,
1837cdf0e10cSrcweir // die wiederum Bereiche enthalten, kann pSct jetzt leer sein
1838cdf0e10cSrcweir // und damit ruhig zerstoert werden.
1839cdf0e10cSrcweir if( !pSct->ContainsCntnt() )
1840cdf0e10cSrcweir {
1841cdf0e10cSrcweir pSct->DelEmpty( sal_True );
1842cdf0e10cSrcweir pUpper->getRootFrm()->RemoveFromList( pSct );
1843cdf0e10cSrcweir delete pSct;
1844cdf0e10cSrcweir }
1845cdf0e10cSrcweir }
1846cdf0e10cSrcweir }
1847cdf0e10cSrcweir }
1848cdf0e10cSrcweir
1849cdf0e10cSrcweir bObjsDirect = sal_True;
1850cdf0e10cSrcweir }
1851cdf0e10cSrcweir
1852cdf0e10cSrcweir
1853cdf0e10cSrcweir /*************************************************************************/
1854cdf0e10cSrcweir
SwBorderAttrs(const SwModify * pMod,const SwFrm * pConstructor)1855cdf0e10cSrcweir SwBorderAttrs::SwBorderAttrs( const SwModify *pMod, const SwFrm *pConstructor ) :
1856cdf0e10cSrcweir SwCacheObj( pMod ),
1857cdf0e10cSrcweir rAttrSet( pConstructor->IsCntntFrm()
1858cdf0e10cSrcweir ? ((SwCntntFrm*)pConstructor)->GetNode()->GetSwAttrSet()
1859cdf0e10cSrcweir : ((SwLayoutFrm*)pConstructor)->GetFmt()->GetAttrSet() ),
1860cdf0e10cSrcweir rUL ( rAttrSet.GetULSpace() ),
1861cdf0e10cSrcweir // --> OD 2008-12-04 #i96772#
1862cdf0e10cSrcweir // LRSpaceItem is copied due to the possibility that it is adjusted - see below
1863cdf0e10cSrcweir rLR ( rAttrSet.GetLRSpace() ),
1864cdf0e10cSrcweir // <--
1865cdf0e10cSrcweir rBox ( rAttrSet.GetBox() ),
1866cdf0e10cSrcweir rShadow ( rAttrSet.GetShadow() ),
1867cdf0e10cSrcweir aFrmSize( rAttrSet.GetFrmSize().GetSize() )
1868cdf0e10cSrcweir {
1869cdf0e10cSrcweir // --> OD 2008-12-02 #i96772#
1870cdf0e10cSrcweir const SwTxtFrm* pTxtFrm = dynamic_cast<const SwTxtFrm*>(pConstructor);
1871cdf0e10cSrcweir if ( pTxtFrm )
1872cdf0e10cSrcweir {
1873cdf0e10cSrcweir pTxtFrm->GetTxtNode()->ClearLRSpaceItemDueToListLevelIndents( rLR );
1874cdf0e10cSrcweir }
1875cdf0e10cSrcweir
1876cdf0e10cSrcweir //Achtung: Die USHORTs fuer die gecache'ten Werte werden absichtlich
1877cdf0e10cSrcweir //nicht initialisiert!
1878cdf0e10cSrcweir
1879cdf0e10cSrcweir //Muessen alle einmal berechnet werden:
1880cdf0e10cSrcweir bTopLine = bBottomLine = bLeftLine = bRightLine =
1881cdf0e10cSrcweir bTop = bBottom = bLine = sal_True;
1882cdf0e10cSrcweir
1883cdf0e10cSrcweir bCacheGetLine = bCachedGetTopLine = bCachedGetBottomLine = sal_False;
1884cdf0e10cSrcweir // OD 21.05.2003 #108789# - init cache status for values <bJoinedWithPrev>
1885cdf0e10cSrcweir // and <bJoinedWithNext>, which aren't initialized by default.
1886cdf0e10cSrcweir bCachedJoinedWithPrev = sal_False;
1887cdf0e10cSrcweir bCachedJoinedWithNext = sal_False;
1888cdf0e10cSrcweir
1889cdf0e10cSrcweir bBorderDist = 0 != (pConstructor->GetType() & (FRM_CELL));
1890cdf0e10cSrcweir }
1891cdf0e10cSrcweir
~SwBorderAttrs()1892cdf0e10cSrcweir SwBorderAttrs::~SwBorderAttrs()
1893cdf0e10cSrcweir {
1894cdf0e10cSrcweir ((SwModify*)pOwner)->SetInCache( sal_False );
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir
1897cdf0e10cSrcweir /*************************************************************************
1898cdf0e10cSrcweir |*
1899cdf0e10cSrcweir |* SwBorderAttrs::CalcTop(), CalcBottom(), CalcLeft(), CalcRight()
1900cdf0e10cSrcweir |*
1901cdf0e10cSrcweir |* Beschreibung Die Calc-Methoden errechnen zusaetzlich zu den
1902cdf0e10cSrcweir |* von den Attributen vorgegebenen Groessen einen Sicherheitsabstand.
1903cdf0e10cSrcweir |* der Sicherheitsabstand wird nur einkalkuliert, wenn Umrandung und/oder
1904cdf0e10cSrcweir |* Schatten im Spiel sind; er soll vermeiden, dass aufgrund der
1905cdf0e10cSrcweir |* groben physikalischen Gegebenheiten Raender usw. uebermalt werden.
1906cdf0e10cSrcweir |*
1907cdf0e10cSrcweir |*************************************************************************/
1908cdf0e10cSrcweir
_CalcTop()1909cdf0e10cSrcweir void SwBorderAttrs::_CalcTop()
1910cdf0e10cSrcweir {
1911cdf0e10cSrcweir nTop = CalcTopLine() + rUL.GetUpper();
1912cdf0e10cSrcweir bTop = sal_False;
1913cdf0e10cSrcweir }
1914cdf0e10cSrcweir
_CalcBottom()1915cdf0e10cSrcweir void SwBorderAttrs::_CalcBottom()
1916cdf0e10cSrcweir {
1917cdf0e10cSrcweir nBottom = CalcBottomLine() + rUL.GetLower();
1918cdf0e10cSrcweir bBottom = sal_False;
1919cdf0e10cSrcweir }
1920cdf0e10cSrcweir
CalcRight(const SwFrm * pCaller) const1921cdf0e10cSrcweir long SwBorderAttrs::CalcRight( const SwFrm* pCaller ) const
1922cdf0e10cSrcweir {
1923cdf0e10cSrcweir long nRight;
1924cdf0e10cSrcweir
1925cdf0e10cSrcweir // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
1926cdf0e10cSrcweir // and right border are painted on the right respectively left.
1927cdf0e10cSrcweir if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
1928cdf0e10cSrcweir nRight = CalcLeftLine();
1929cdf0e10cSrcweir else
1930cdf0e10cSrcweir nRight = CalcRightLine();
1931cdf0e10cSrcweir
1932cdf0e10cSrcweir // for paragraphs, "left" is "before text" and "right" is "after text"
1933cdf0e10cSrcweir if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
1934cdf0e10cSrcweir nRight += rLR.GetLeft();
1935cdf0e10cSrcweir else
1936cdf0e10cSrcweir nRight += rLR.GetRight();
1937cdf0e10cSrcweir
1938cdf0e10cSrcweir // --> OD 2008-01-21 #newlistlevelattrs#
1939cdf0e10cSrcweir // correction: retrieve left margin for numbering in R2L-layout
1940cdf0e10cSrcweir if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
1941cdf0e10cSrcweir {
1942cdf0e10cSrcweir nRight += ((SwTxtFrm*)pCaller)->GetTxtNode()->GetLeftMarginWithNum();
1943cdf0e10cSrcweir }
1944cdf0e10cSrcweir // <--
1945cdf0e10cSrcweir
1946cdf0e10cSrcweir return nRight;
1947cdf0e10cSrcweir }
1948cdf0e10cSrcweir
CalcLeft(const SwFrm * pCaller) const1949cdf0e10cSrcweir long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const
1950cdf0e10cSrcweir {
1951cdf0e10cSrcweir long nLeft;
1952cdf0e10cSrcweir
1953cdf0e10cSrcweir // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
1954cdf0e10cSrcweir // and right border are painted on the right respectively left.
1955cdf0e10cSrcweir if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
1956cdf0e10cSrcweir nLeft = CalcRightLine();
1957cdf0e10cSrcweir else
1958cdf0e10cSrcweir nLeft = CalcLeftLine();
1959cdf0e10cSrcweir
1960cdf0e10cSrcweir // for paragraphs, "left" is "before text" and "right" is "after text"
1961cdf0e10cSrcweir if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
1962cdf0e10cSrcweir nLeft += rLR.GetRight();
1963cdf0e10cSrcweir else
1964cdf0e10cSrcweir nLeft += rLR.GetLeft();
1965cdf0e10cSrcweir
1966cdf0e10cSrcweir // --> OD 2008-01-21 #newlistlevelattrs#
1967cdf0e10cSrcweir // correction: do not retrieve left margin for numbering in R2L-layout
1968cdf0e10cSrcweir // if ( pCaller->IsTxtFrm() )
1969cdf0e10cSrcweir if ( pCaller->IsTxtFrm() && !pCaller->IsRightToLeft() )
1970cdf0e10cSrcweir // <--
1971cdf0e10cSrcweir {
1972cdf0e10cSrcweir nLeft += ((SwTxtFrm*)pCaller)->GetTxtNode()->GetLeftMarginWithNum();
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir
1975cdf0e10cSrcweir return nLeft;
1976cdf0e10cSrcweir }
1977cdf0e10cSrcweir
1978cdf0e10cSrcweir /*************************************************************************
1979cdf0e10cSrcweir |*
1980cdf0e10cSrcweir |* SwBorderAttrs::CalcTopLine(), CalcBottomLine(),
1981cdf0e10cSrcweir |* CalcLeftLine(), CalcRightLine()
1982cdf0e10cSrcweir |*
1983cdf0e10cSrcweir |* Beschreibung Berechnung der Groessen fuer Umrandung und Schatten.
1984cdf0e10cSrcweir |* Es kann auch ohne Linien ein Abstand erwuenscht sein,
1985cdf0e10cSrcweir |* dieser wird dann nicht vom Attribut sondern hier
1986cdf0e10cSrcweir |* beruecksichtigt (bBorderDist, z.B. fuer Zellen).
1987cdf0e10cSrcweir |*
1988cdf0e10cSrcweir |*************************************************************************/
1989cdf0e10cSrcweir
_CalcTopLine()1990cdf0e10cSrcweir void SwBorderAttrs::_CalcTopLine()
1991cdf0e10cSrcweir {
1992cdf0e10cSrcweir nTopLine = (bBorderDist && !rBox.GetTop())
1993cdf0e10cSrcweir ? rBox.GetDistance (BOX_LINE_TOP)
1994cdf0e10cSrcweir : rBox.CalcLineSpace(BOX_LINE_TOP);
1995cdf0e10cSrcweir nTopLine = nTopLine + rShadow.CalcShadowSpace(SHADOW_TOP);
1996cdf0e10cSrcweir bTopLine = sal_False;
1997cdf0e10cSrcweir }
1998cdf0e10cSrcweir
_CalcBottomLine()1999cdf0e10cSrcweir void SwBorderAttrs::_CalcBottomLine()
2000cdf0e10cSrcweir {
2001cdf0e10cSrcweir nBottomLine = (bBorderDist && !rBox.GetBottom())
2002cdf0e10cSrcweir ? rBox.GetDistance (BOX_LINE_BOTTOM)
2003cdf0e10cSrcweir : rBox.CalcLineSpace(BOX_LINE_BOTTOM);
2004cdf0e10cSrcweir nBottomLine = nBottomLine + rShadow.CalcShadowSpace(SHADOW_BOTTOM);
2005cdf0e10cSrcweir bBottomLine = sal_False;
2006cdf0e10cSrcweir }
2007cdf0e10cSrcweir
_CalcLeftLine()2008cdf0e10cSrcweir void SwBorderAttrs::_CalcLeftLine()
2009cdf0e10cSrcweir {
2010cdf0e10cSrcweir nLeftLine = (bBorderDist && !rBox.GetLeft())
2011cdf0e10cSrcweir ? rBox.GetDistance (BOX_LINE_LEFT)
2012cdf0e10cSrcweir : rBox.CalcLineSpace(BOX_LINE_LEFT);
2013cdf0e10cSrcweir nLeftLine = nLeftLine + rShadow.CalcShadowSpace(SHADOW_LEFT);
2014cdf0e10cSrcweir bLeftLine = sal_False;
2015cdf0e10cSrcweir }
2016cdf0e10cSrcweir
_CalcRightLine()2017cdf0e10cSrcweir void SwBorderAttrs::_CalcRightLine()
2018cdf0e10cSrcweir {
2019cdf0e10cSrcweir nRightLine = (bBorderDist && !rBox.GetRight())
2020cdf0e10cSrcweir ? rBox.GetDistance (BOX_LINE_RIGHT)
2021cdf0e10cSrcweir : rBox.CalcLineSpace(BOX_LINE_RIGHT);
2022cdf0e10cSrcweir nRightLine = nRightLine + rShadow.CalcShadowSpace(SHADOW_RIGHT);
2023cdf0e10cSrcweir bRightLine = sal_False;
2024cdf0e10cSrcweir }
2025cdf0e10cSrcweir
2026cdf0e10cSrcweir /*************************************************************************/
2027cdf0e10cSrcweir
_IsLine()2028cdf0e10cSrcweir void SwBorderAttrs::_IsLine()
2029cdf0e10cSrcweir {
2030cdf0e10cSrcweir bIsLine = rBox.GetTop() || rBox.GetBottom() ||
2031cdf0e10cSrcweir rBox.GetLeft()|| rBox.GetRight();
2032cdf0e10cSrcweir bLine = sal_False;
2033cdf0e10cSrcweir }
2034cdf0e10cSrcweir
2035cdf0e10cSrcweir /*************************************************************************
2036cdf0e10cSrcweir |*
2037cdf0e10cSrcweir |* SwBorderAttrs::CmpLeftRightLine(), IsTopLine(), IsBottomLine()
2038cdf0e10cSrcweir |*
2039cdf0e10cSrcweir |* Die Umrandungen benachbarter Absaetze werden nach folgendem
2040cdf0e10cSrcweir |* Algorithmus zusammengefasst:
2041cdf0e10cSrcweir |*
2042cdf0e10cSrcweir |* 1. Die Umrandung oben faellt weg, wenn der Vorgaenger dieselbe
2043cdf0e10cSrcweir |* Umrandung oben aufweist und 3. Zutrifft.
2044cdf0e10cSrcweir |* Zusaetzlich muss der Absatz mindestens rechts oder links oder
2045cdf0e10cSrcweir |* unten eine Umrandung haben.
2046cdf0e10cSrcweir |* 2. Die Umrandung unten faellt weg, wenn der Nachfolger dieselbe
2047cdf0e10cSrcweir |* Umrandung untern aufweist und 3. Zustrifft.
2048cdf0e10cSrcweir |* Zusaetzlich muss der Absatz mindestens rechts oder links oder
2049cdf0e10cSrcweir |* oben eine Umrandung haben.
2050cdf0e10cSrcweir |* 3. Die Umrandungen links und rechts vor Vorgaenger bzw. Nachfolger
2051cdf0e10cSrcweir |* sind identisch.
2052cdf0e10cSrcweir |*
2053cdf0e10cSrcweir |*************************************************************************/
CmpLines(const SvxBorderLine * pL1,const SvxBorderLine * pL2)2054cdf0e10cSrcweir inline int CmpLines( const SvxBorderLine *pL1, const SvxBorderLine *pL2 )
2055cdf0e10cSrcweir {
2056cdf0e10cSrcweir return ( ((pL1 && pL2) && (*pL1 == *pL2)) || (!pL1 && !pL2) );
2057cdf0e10cSrcweir }
2058cdf0e10cSrcweir
2059cdf0e10cSrcweir // OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs"
2060cdf0e10cSrcweir // OD 21.05.2003 #108789# - compare <CalcRight()> and <rCmpAttrs.CalcRight()>
2061cdf0e10cSrcweir // instead of only the right LR-spacing, because R2L-layout has to be
2062cdf0e10cSrcweir // considered.
CmpLeftRight(const SwBorderAttrs & rCmpAttrs,const SwFrm * pCaller,const SwFrm * pCmp) const2063cdf0e10cSrcweir sal_Bool SwBorderAttrs::CmpLeftRight( const SwBorderAttrs &rCmpAttrs,
2064cdf0e10cSrcweir const SwFrm *pCaller,
2065cdf0e10cSrcweir const SwFrm *pCmp ) const
2066cdf0e10cSrcweir {
2067cdf0e10cSrcweir return ( CmpLines( rCmpAttrs.GetBox().GetLeft(), GetBox().GetLeft() ) &&
2068cdf0e10cSrcweir CmpLines( rCmpAttrs.GetBox().GetRight(),GetBox().GetRight() ) &&
2069cdf0e10cSrcweir CalcLeft( pCaller ) == rCmpAttrs.CalcLeft( pCmp ) &&
2070cdf0e10cSrcweir // OD 21.05.2003 #108789# - compare <CalcRight> with <rCmpAttrs.CalcRight>.
2071cdf0e10cSrcweir CalcRight( pCaller ) == rCmpAttrs.CalcRight( pCmp ) );
2072cdf0e10cSrcweir }
2073cdf0e10cSrcweir
_JoinWithCmp(const SwFrm & _rCallerFrm,const SwFrm & _rCmpFrm) const2074cdf0e10cSrcweir sal_Bool SwBorderAttrs::_JoinWithCmp( const SwFrm& _rCallerFrm,
2075cdf0e10cSrcweir const SwFrm& _rCmpFrm ) const
2076cdf0e10cSrcweir {
2077cdf0e10cSrcweir sal_Bool bReturnVal = sal_False;
2078cdf0e10cSrcweir
2079cdf0e10cSrcweir SwBorderAttrAccess aCmpAccess( SwFrm::GetCache(), &_rCmpFrm );
2080cdf0e10cSrcweir const SwBorderAttrs &rCmpAttrs = *aCmpAccess.Get();
2081cdf0e10cSrcweir if ( rShadow == rCmpAttrs.GetShadow() &&
2082cdf0e10cSrcweir CmpLines( rBox.GetTop(), rCmpAttrs.GetBox().GetTop() ) &&
2083cdf0e10cSrcweir CmpLines( rBox.GetBottom(), rCmpAttrs.GetBox().GetBottom() ) &&
2084cdf0e10cSrcweir CmpLeftRight( rCmpAttrs, &_rCallerFrm, &_rCmpFrm )
2085cdf0e10cSrcweir )
2086cdf0e10cSrcweir {
2087cdf0e10cSrcweir bReturnVal = sal_True;
2088cdf0e10cSrcweir }
2089cdf0e10cSrcweir
2090cdf0e10cSrcweir return bReturnVal;
2091cdf0e10cSrcweir }
2092cdf0e10cSrcweir
2093cdf0e10cSrcweir // OD 21.05.2003 #108789# - method to determine, if borders are joined with
2094cdf0e10cSrcweir // previous frame. Calculated value saved in cached value <bJoinedWithPrev>
2095cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrm>
_CalcJoinedWithPrev(const SwFrm & _rFrm,const SwFrm * _pPrevFrm)2096cdf0e10cSrcweir void SwBorderAttrs::_CalcJoinedWithPrev( const SwFrm& _rFrm,
2097cdf0e10cSrcweir const SwFrm* _pPrevFrm )
2098cdf0e10cSrcweir {
2099cdf0e10cSrcweir // set default
2100cdf0e10cSrcweir bJoinedWithPrev = sal_False;
2101cdf0e10cSrcweir
2102cdf0e10cSrcweir if ( _rFrm.IsTxtFrm() )
2103cdf0e10cSrcweir {
2104cdf0e10cSrcweir // text frame can potentially join with previous text frame, if
2105cdf0e10cSrcweir // corresponding attribute set is set at previous text frame.
2106cdf0e10cSrcweir // OD 2004-02-26 #i25029# - If parameter <_pPrevFrm> is set, take this
2107cdf0e10cSrcweir // one as previous frame.
2108cdf0e10cSrcweir const SwFrm* pPrevFrm = _pPrevFrm ? _pPrevFrm : _rFrm.GetPrev();
2109cdf0e10cSrcweir // OD 2004-02-13 #i25029# - skip hidden text frames.
2110cdf0e10cSrcweir while ( pPrevFrm && pPrevFrm->IsTxtFrm() &&
2111cdf0e10cSrcweir static_cast<const SwTxtFrm*>(pPrevFrm)->IsHiddenNow() )
2112cdf0e10cSrcweir {
2113cdf0e10cSrcweir pPrevFrm = pPrevFrm->GetPrev();
2114cdf0e10cSrcweir }
2115cdf0e10cSrcweir if ( pPrevFrm && pPrevFrm->IsTxtFrm() &&
2116cdf0e10cSrcweir pPrevFrm->GetAttrSet()->GetParaConnectBorder().GetValue()
2117cdf0e10cSrcweir )
2118cdf0e10cSrcweir {
2119cdf0e10cSrcweir bJoinedWithPrev = _JoinWithCmp( _rFrm, *(pPrevFrm) );
2120cdf0e10cSrcweir }
2121cdf0e10cSrcweir }
2122cdf0e10cSrcweir
2123cdf0e10cSrcweir // valid cache status, if demanded
2124cdf0e10cSrcweir // OD 2004-02-26 #i25029# - Do not validate cache, if parameter <_pPrevFrm>
2125cdf0e10cSrcweir // is set.
2126cdf0e10cSrcweir bCachedJoinedWithPrev = bCacheGetLine && !_pPrevFrm;
2127cdf0e10cSrcweir }
2128cdf0e10cSrcweir
2129cdf0e10cSrcweir // OD 21.05.2003 #108789# - method to determine, if borders are joined with
2130cdf0e10cSrcweir // next frame. Calculated value saved in cached value <bJoinedWithNext>
_CalcJoinedWithNext(const SwFrm & _rFrm)2131cdf0e10cSrcweir void SwBorderAttrs::_CalcJoinedWithNext( const SwFrm& _rFrm )
2132cdf0e10cSrcweir {
2133cdf0e10cSrcweir // set default
2134cdf0e10cSrcweir bJoinedWithNext = sal_False;
2135cdf0e10cSrcweir
2136cdf0e10cSrcweir if ( _rFrm.IsTxtFrm() )
2137cdf0e10cSrcweir {
2138cdf0e10cSrcweir // text frame can potentially join with next text frame, if
2139cdf0e10cSrcweir // corresponding attribute set is set at current text frame.
2140cdf0e10cSrcweir // OD 2004-02-13 #i25029# - get next frame, but skip hidden text frames.
2141cdf0e10cSrcweir const SwFrm* pNextFrm = _rFrm.GetNext();
2142cdf0e10cSrcweir while ( pNextFrm && pNextFrm->IsTxtFrm() &&
2143cdf0e10cSrcweir static_cast<const SwTxtFrm*>(pNextFrm)->IsHiddenNow() )
2144cdf0e10cSrcweir {
2145cdf0e10cSrcweir pNextFrm = pNextFrm->GetNext();
2146cdf0e10cSrcweir }
2147cdf0e10cSrcweir if ( pNextFrm && pNextFrm->IsTxtFrm() &&
2148cdf0e10cSrcweir _rFrm.GetAttrSet()->GetParaConnectBorder().GetValue()
2149cdf0e10cSrcweir )
2150cdf0e10cSrcweir {
2151cdf0e10cSrcweir bJoinedWithNext = _JoinWithCmp( _rFrm, *(pNextFrm) );
2152cdf0e10cSrcweir }
2153cdf0e10cSrcweir }
2154cdf0e10cSrcweir
2155cdf0e10cSrcweir // valid cache status, if demanded
2156cdf0e10cSrcweir bCachedJoinedWithNext = bCacheGetLine;
2157cdf0e10cSrcweir }
2158cdf0e10cSrcweir
2159cdf0e10cSrcweir // OD 21.05.2003 #108789# - accessor for cached values <bJoinedWithPrev>
2160cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrm>, which is passed to
2161cdf0e10cSrcweir // method <_CalcJoindWithPrev(..)>.
JoinedWithPrev(const SwFrm & _rFrm,const SwFrm * _pPrevFrm) const2162cdf0e10cSrcweir sal_Bool SwBorderAttrs::JoinedWithPrev( const SwFrm& _rFrm,
2163cdf0e10cSrcweir const SwFrm* _pPrevFrm ) const
2164cdf0e10cSrcweir {
2165cdf0e10cSrcweir if ( !bCachedJoinedWithPrev || _pPrevFrm )
2166cdf0e10cSrcweir {
2167cdf0e10cSrcweir // OD 2004-02-26 #i25029# - pass <_pPrevFrm> as 2nd parameter
2168cdf0e10cSrcweir const_cast<SwBorderAttrs*>(this)->_CalcJoinedWithPrev( _rFrm, _pPrevFrm );
2169cdf0e10cSrcweir }
2170cdf0e10cSrcweir
2171cdf0e10cSrcweir return bJoinedWithPrev;
2172cdf0e10cSrcweir }
2173cdf0e10cSrcweir
JoinedWithNext(const SwFrm & _rFrm) const2174cdf0e10cSrcweir sal_Bool SwBorderAttrs::JoinedWithNext( const SwFrm& _rFrm ) const
2175cdf0e10cSrcweir {
2176cdf0e10cSrcweir if ( !bCachedJoinedWithNext )
2177cdf0e10cSrcweir {
2178cdf0e10cSrcweir const_cast<SwBorderAttrs*>(this)->_CalcJoinedWithNext( _rFrm );
2179cdf0e10cSrcweir }
2180cdf0e10cSrcweir
2181cdf0e10cSrcweir return bJoinedWithNext;
2182cdf0e10cSrcweir }
2183cdf0e10cSrcweir
2184cdf0e10cSrcweir // OD 2004-02-26 #i25029# - added 2nd parameter <_pPrevFrm>, which is passed to
2185cdf0e10cSrcweir // method <JoinedWithPrev>
_GetTopLine(const SwFrm & _rFrm,const SwFrm * _pPrevFrm)2186cdf0e10cSrcweir void SwBorderAttrs::_GetTopLine( const SwFrm& _rFrm,
2187cdf0e10cSrcweir const SwFrm* _pPrevFrm )
2188cdf0e10cSrcweir {
2189cdf0e10cSrcweir sal_uInt16 nRet = CalcTopLine();
2190cdf0e10cSrcweir
2191cdf0e10cSrcweir // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
2192cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add 2nd parameter
2193cdf0e10cSrcweir if ( JoinedWithPrev( _rFrm, _pPrevFrm ) )
2194cdf0e10cSrcweir {
2195cdf0e10cSrcweir nRet = 0;
2196cdf0e10cSrcweir }
2197cdf0e10cSrcweir
2198cdf0e10cSrcweir bCachedGetTopLine = bCacheGetLine;
2199cdf0e10cSrcweir
2200cdf0e10cSrcweir nGetTopLine = nRet;
2201cdf0e10cSrcweir }
2202cdf0e10cSrcweir
_GetBottomLine(const SwFrm & _rFrm)2203cdf0e10cSrcweir void SwBorderAttrs::_GetBottomLine( const SwFrm& _rFrm )
2204cdf0e10cSrcweir {
2205cdf0e10cSrcweir sal_uInt16 nRet = CalcBottomLine();
2206cdf0e10cSrcweir
2207cdf0e10cSrcweir // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
2208cdf0e10cSrcweir if ( JoinedWithNext( _rFrm ) )
2209cdf0e10cSrcweir {
2210cdf0e10cSrcweir nRet = 0;
2211cdf0e10cSrcweir }
2212cdf0e10cSrcweir
2213cdf0e10cSrcweir bCachedGetBottomLine = bCacheGetLine;
2214cdf0e10cSrcweir
2215cdf0e10cSrcweir nGetBottomLine = nRet;
2216cdf0e10cSrcweir }
2217cdf0e10cSrcweir
2218cdf0e10cSrcweir /*************************************************************************/
2219cdf0e10cSrcweir
SwBorderAttrAccess(SwCache & rCach,const SwFrm * pFrm)2220cdf0e10cSrcweir SwBorderAttrAccess::SwBorderAttrAccess( SwCache &rCach, const SwFrm *pFrm ) :
2221cdf0e10cSrcweir SwCacheAccess( rCach, (pFrm->IsCntntFrm() ?
2222cdf0e10cSrcweir (void*)((SwCntntFrm*)pFrm)->GetNode() :
2223cdf0e10cSrcweir (void*)((SwLayoutFrm*)pFrm)->GetFmt()),
2224cdf0e10cSrcweir (sal_Bool)(pFrm->IsCntntFrm() ?
2225cdf0e10cSrcweir ((SwModify*)((SwCntntFrm*)pFrm)->GetNode())->IsInCache() :
2226cdf0e10cSrcweir ((SwModify*)((SwLayoutFrm*)pFrm)->GetFmt())->IsInCache()) ),
2227cdf0e10cSrcweir pConstructor( pFrm )
2228cdf0e10cSrcweir {
2229cdf0e10cSrcweir }
2230cdf0e10cSrcweir
2231cdf0e10cSrcweir /*************************************************************************/
2232cdf0e10cSrcweir
NewObj()2233cdf0e10cSrcweir SwCacheObj *SwBorderAttrAccess::NewObj()
2234cdf0e10cSrcweir {
2235cdf0e10cSrcweir ((SwModify*)pOwner)->SetInCache( sal_True );
2236cdf0e10cSrcweir return new SwBorderAttrs( (SwModify*)pOwner, pConstructor );
2237cdf0e10cSrcweir }
2238cdf0e10cSrcweir
Get()2239cdf0e10cSrcweir SwBorderAttrs *SwBorderAttrAccess::Get()
2240cdf0e10cSrcweir {
2241cdf0e10cSrcweir return (SwBorderAttrs*)SwCacheAccess::Get();
2242cdf0e10cSrcweir }
2243cdf0e10cSrcweir
2244cdf0e10cSrcweir /*************************************************************************/
2245cdf0e10cSrcweir
SwOrderIter(const SwPageFrm * pPg,sal_Bool bFlys)2246cdf0e10cSrcweir SwOrderIter::SwOrderIter( const SwPageFrm *pPg, sal_Bool bFlys ) :
2247cdf0e10cSrcweir pPage( pPg ),
2248cdf0e10cSrcweir pCurrent( 0 ),
2249cdf0e10cSrcweir bFlysOnly( bFlys )
2250cdf0e10cSrcweir {
2251cdf0e10cSrcweir }
2252cdf0e10cSrcweir
2253cdf0e10cSrcweir /*************************************************************************/
2254cdf0e10cSrcweir
Top()2255cdf0e10cSrcweir const SdrObject *SwOrderIter::Top()
2256cdf0e10cSrcweir {
2257cdf0e10cSrcweir pCurrent = 0;
2258cdf0e10cSrcweir if ( pPage->GetSortedObjs() )
2259cdf0e10cSrcweir {
2260cdf0e10cSrcweir sal_uInt32 nTopOrd = 0;
2261cdf0e10cSrcweir const SwSortedObjs *pObjs = pPage->GetSortedObjs();
2262cdf0e10cSrcweir if ( pObjs->Count() )
2263cdf0e10cSrcweir {
2264cdf0e10cSrcweir (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
2265cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
2266cdf0e10cSrcweir {
2267cdf0e10cSrcweir const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
2268cdf0e10cSrcweir if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) )
2269cdf0e10cSrcweir continue;
2270cdf0e10cSrcweir sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2271cdf0e10cSrcweir if ( nTmp >= nTopOrd )
2272cdf0e10cSrcweir {
2273cdf0e10cSrcweir nTopOrd = nTmp;
2274cdf0e10cSrcweir pCurrent = pObj;
2275cdf0e10cSrcweir }
2276cdf0e10cSrcweir }
2277cdf0e10cSrcweir }
2278cdf0e10cSrcweir }
2279cdf0e10cSrcweir return pCurrent;
2280cdf0e10cSrcweir }
2281cdf0e10cSrcweir
2282cdf0e10cSrcweir /*************************************************************************/
2283cdf0e10cSrcweir
Bottom()2284cdf0e10cSrcweir const SdrObject *SwOrderIter::Bottom()
2285cdf0e10cSrcweir {
2286cdf0e10cSrcweir pCurrent = 0;
2287cdf0e10cSrcweir if ( pPage->GetSortedObjs() )
2288cdf0e10cSrcweir {
2289cdf0e10cSrcweir sal_uInt32 nBotOrd = USHRT_MAX;
2290cdf0e10cSrcweir const SwSortedObjs *pObjs = pPage->GetSortedObjs();
2291cdf0e10cSrcweir if ( pObjs->Count() )
2292cdf0e10cSrcweir {
2293cdf0e10cSrcweir (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
2294cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
2295cdf0e10cSrcweir {
2296cdf0e10cSrcweir const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
2297cdf0e10cSrcweir if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) )
2298cdf0e10cSrcweir continue;
2299cdf0e10cSrcweir sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2300cdf0e10cSrcweir if ( nTmp < nBotOrd )
2301cdf0e10cSrcweir {
2302cdf0e10cSrcweir nBotOrd = nTmp;
2303cdf0e10cSrcweir pCurrent = pObj;
2304cdf0e10cSrcweir }
2305cdf0e10cSrcweir }
2306cdf0e10cSrcweir }
2307cdf0e10cSrcweir }
2308cdf0e10cSrcweir return pCurrent;
2309cdf0e10cSrcweir }
2310cdf0e10cSrcweir
2311cdf0e10cSrcweir /*************************************************************************/
2312cdf0e10cSrcweir
Next()2313cdf0e10cSrcweir const SdrObject *SwOrderIter::Next()
2314cdf0e10cSrcweir {
2315cdf0e10cSrcweir const sal_uInt32 nCurOrd = pCurrent ? pCurrent->GetOrdNumDirect() : 0;
2316cdf0e10cSrcweir pCurrent = 0;
2317cdf0e10cSrcweir if ( pPage->GetSortedObjs() )
2318cdf0e10cSrcweir {
2319cdf0e10cSrcweir sal_uInt32 nOrd = USHRT_MAX;
2320cdf0e10cSrcweir const SwSortedObjs *pObjs = pPage->GetSortedObjs();
2321cdf0e10cSrcweir if ( pObjs->Count() )
2322cdf0e10cSrcweir {
2323cdf0e10cSrcweir (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
2324cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
2325cdf0e10cSrcweir {
2326cdf0e10cSrcweir const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
2327cdf0e10cSrcweir if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) )
2328cdf0e10cSrcweir continue;
2329cdf0e10cSrcweir sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2330cdf0e10cSrcweir if ( nTmp > nCurOrd && nTmp < nOrd )
2331cdf0e10cSrcweir {
2332cdf0e10cSrcweir nOrd = nTmp;
2333cdf0e10cSrcweir pCurrent = pObj;
2334cdf0e10cSrcweir }
2335cdf0e10cSrcweir }
2336cdf0e10cSrcweir }
2337cdf0e10cSrcweir }
2338cdf0e10cSrcweir return pCurrent;
2339cdf0e10cSrcweir }
2340cdf0e10cSrcweir
2341cdf0e10cSrcweir /*************************************************************************/
2342cdf0e10cSrcweir
Prev()2343cdf0e10cSrcweir const SdrObject *SwOrderIter::Prev()
2344cdf0e10cSrcweir {
2345cdf0e10cSrcweir const sal_uInt32 nCurOrd = pCurrent ? pCurrent->GetOrdNumDirect() : 0;
2346cdf0e10cSrcweir pCurrent = 0;
2347cdf0e10cSrcweir if ( pPage->GetSortedObjs() )
2348cdf0e10cSrcweir {
2349cdf0e10cSrcweir sal_uInt32 nOrd = 0;
2350cdf0e10cSrcweir const SwSortedObjs *pObjs = pPage->GetSortedObjs();
2351cdf0e10cSrcweir if ( pObjs->Count() )
2352cdf0e10cSrcweir {
2353cdf0e10cSrcweir (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
2354cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
2355cdf0e10cSrcweir {
2356cdf0e10cSrcweir const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
2357cdf0e10cSrcweir if ( bFlysOnly && !pObj->ISA(SwVirtFlyDrawObj) )
2358cdf0e10cSrcweir continue;
2359cdf0e10cSrcweir sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2360cdf0e10cSrcweir if ( nTmp < nCurOrd && nTmp >= nOrd )
2361cdf0e10cSrcweir {
2362cdf0e10cSrcweir nOrd = nTmp;
2363cdf0e10cSrcweir pCurrent = pObj;
2364cdf0e10cSrcweir }
2365cdf0e10cSrcweir }
2366cdf0e10cSrcweir }
2367cdf0e10cSrcweir }
2368cdf0e10cSrcweir return pCurrent;
2369cdf0e10cSrcweir }
2370cdf0e10cSrcweir
2371cdf0e10cSrcweir /*************************************************************************/
2372cdf0e10cSrcweir
2373cdf0e10cSrcweir //Unterstruktur eines LayoutFrms fuer eine Aktion aufheben und wieder
2374cdf0e10cSrcweir //restaurieren.
2375cdf0e10cSrcweir //Neuer Algorithmus: Es ist unuetz jeden Nachbarn einzeln zu betrachten und
2376cdf0e10cSrcweir //die Pointer sauber zu setzen (Upper, Nachbarn, usw.)
2377cdf0e10cSrcweir //Es reicht vollkommen jeweils eine Einzelkette zu loesen, und mit dem
2378cdf0e10cSrcweir //Letzen der Einzelkette nachzuschauen ob noch eine weitere Kette
2379cdf0e10cSrcweir //angeheangt werden muss. Es brauchen nur die Pointer korrigiert werden,
2380cdf0e10cSrcweir //die zur Verkettung notwendig sind. So koennen Beipspielsweise die Pointer
2381cdf0e10cSrcweir //auf die Upper auf den alten Uppern stehenbleiben. Korrigiert werden die
2382cdf0e10cSrcweir //Pointer dann im RestoreCntnt. Zwischenzeitlich ist sowieso jeder Zugriff
2383cdf0e10cSrcweir //verboten.
2384cdf0e10cSrcweir //Unterwegs werden die Flys bei der Seite abgemeldet.
2385cdf0e10cSrcweir
2386cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - 'remove' also drawing object from page and
2387cdf0e10cSrcweir // at-fly anchored objects from page
lcl_RemoveObjsFromPage(SwFrm * _pFrm)2388cdf0e10cSrcweir void MA_FASTCALL lcl_RemoveObjsFromPage( SwFrm* _pFrm )
2389cdf0e10cSrcweir {
2390cdf0e10cSrcweir ASSERT( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." );
2391cdf0e10cSrcweir SwSortedObjs &rObjs = *_pFrm->GetDrawObjs();
2392cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
2393cdf0e10cSrcweir {
2394cdf0e10cSrcweir SwAnchoredObject* pObj = rObjs[i];
2395cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - reset member, at which the anchored
2396cdf0e10cSrcweir // object orients its vertical position
2397cdf0e10cSrcweir pObj->ClearVertPosOrientFrm();
2398cdf0e10cSrcweir // <--
2399cdf0e10cSrcweir // --> OD 2005-03-03 #i43913#
2400cdf0e10cSrcweir pObj->ResetLayoutProcessBools();
2401cdf0e10cSrcweir // <--
2402cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - remove also lower objects of as-character
2403cdf0e10cSrcweir // anchored Writer fly frames from page
2404cdf0e10cSrcweir if ( pObj->ISA(SwFlyFrm) )
2405cdf0e10cSrcweir {
2406cdf0e10cSrcweir SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj);
2407cdf0e10cSrcweir
2408cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - remove also direct lowers of Writer
2409cdf0e10cSrcweir // fly frame from page
2410cdf0e10cSrcweir if ( pFlyFrm->GetDrawObjs() )
2411cdf0e10cSrcweir {
2412cdf0e10cSrcweir ::lcl_RemoveObjsFromPage( pFlyFrm );
2413cdf0e10cSrcweir }
2414cdf0e10cSrcweir // <--
2415cdf0e10cSrcweir
2416cdf0e10cSrcweir SwCntntFrm* pCnt = pFlyFrm->ContainsCntnt();
2417cdf0e10cSrcweir while ( pCnt )
2418cdf0e10cSrcweir {
2419cdf0e10cSrcweir if ( pCnt->GetDrawObjs() )
2420cdf0e10cSrcweir ::lcl_RemoveObjsFromPage( pCnt );
2421cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
2422cdf0e10cSrcweir }
2423cdf0e10cSrcweir if ( pFlyFrm->IsFlyFreeFrm() )
2424cdf0e10cSrcweir {
2425cdf0e10cSrcweir // --> OD 2004-06-30 #i28701# - use new method <GetPageFrm()>
2426cdf0e10cSrcweir pFlyFrm->GetPageFrm()->RemoveFlyFromPage( pFlyFrm );
2427cdf0e10cSrcweir }
2428cdf0e10cSrcweir }
2429cdf0e10cSrcweir // <--
2430cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - remove also drawing objects from page
2431cdf0e10cSrcweir else if ( pObj->ISA(SwAnchoredDrawObject) )
2432cdf0e10cSrcweir {
2433cdf0e10cSrcweir if (pObj->GetFrmFmt().GetAnchor().GetAnchorId() != FLY_AS_CHAR)
2434cdf0e10cSrcweir {
2435cdf0e10cSrcweir pObj->GetPageFrm()->RemoveDrawObjFromPage(
2436cdf0e10cSrcweir *(static_cast<SwAnchoredDrawObject*>(pObj)) );
2437cdf0e10cSrcweir }
2438cdf0e10cSrcweir }
2439cdf0e10cSrcweir // <--
2440cdf0e10cSrcweir }
2441cdf0e10cSrcweir }
2442cdf0e10cSrcweir
SaveCntnt(SwLayoutFrm * pLay,SwFrm * pStart)2443cdf0e10cSrcweir SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
2444cdf0e10cSrcweir {
2445cdf0e10cSrcweir if( pLay->IsSctFrm() && pLay->Lower() && pLay->Lower()->IsColumnFrm() )
2446cdf0e10cSrcweir lcl_RemoveFtns( (SwColumnFrm*)pLay->Lower(), sal_True, sal_True );
2447cdf0e10cSrcweir
2448cdf0e10cSrcweir SwFrm *pSav;
2449cdf0e10cSrcweir if ( 0 == (pSav = pLay->ContainsAny()) )
2450cdf0e10cSrcweir return 0;
2451cdf0e10cSrcweir
2452cdf0e10cSrcweir if( pSav->IsInFtn() && !pLay->IsInFtn() )
2453cdf0e10cSrcweir {
2454cdf0e10cSrcweir do
2455cdf0e10cSrcweir pSav = pSav->FindNext();
2456cdf0e10cSrcweir while( pSav && pSav->IsInFtn() );
2457cdf0e10cSrcweir if( !pSav || !pLay->IsAnLower( pSav ) )
2458cdf0e10cSrcweir return NULL;
2459cdf0e10cSrcweir }
2460cdf0e10cSrcweir
2461cdf0e10cSrcweir // Tables should be saved as a whole, expection:
2462cdf0e10cSrcweir // The contents of a section or a cell inside a table should be saved
2463cdf0e10cSrcweir if ( pSav->IsInTab() && !( ( pLay->IsSctFrm() || pLay->IsCellFrm() ) && pLay->IsInTab() ) )
2464cdf0e10cSrcweir while ( !pSav->IsTabFrm() )
2465cdf0e10cSrcweir pSav = pSav->GetUpper();
2466cdf0e10cSrcweir
2467cdf0e10cSrcweir if( pSav->IsInSct() )
2468cdf0e10cSrcweir { // Jetzt wird der oberste Bereich gesucht, der innerhalb von pLay ist.
2469cdf0e10cSrcweir SwFrm* pSect = pLay->FindSctFrm();
2470cdf0e10cSrcweir SwFrm *pTmp = pSav;
2471cdf0e10cSrcweir do
2472cdf0e10cSrcweir {
2473cdf0e10cSrcweir pSav = pTmp;
2474cdf0e10cSrcweir pTmp = pSav->GetUpper() ? pSav->GetUpper()->FindSctFrm() : NULL;
2475cdf0e10cSrcweir } while ( pTmp != pSect );
2476cdf0e10cSrcweir }
2477cdf0e10cSrcweir
2478cdf0e10cSrcweir SwFrm *pFloat = pSav;
2479cdf0e10cSrcweir if( !pStart )
2480cdf0e10cSrcweir pStart = pSav;
2481cdf0e10cSrcweir sal_Bool bGo = pStart == pSav;
2482cdf0e10cSrcweir do
2483cdf0e10cSrcweir {
2484cdf0e10cSrcweir if( bGo )
2485cdf0e10cSrcweir pFloat->GetUpper()->pLower = 0; //Die Teilkette ausklinken.
2486cdf0e10cSrcweir
2487cdf0e10cSrcweir //Das Ende der Teilkette suchen, unterwegs die Flys abmelden.
2488cdf0e10cSrcweir do
2489cdf0e10cSrcweir {
2490cdf0e10cSrcweir if( bGo )
2491cdf0e10cSrcweir {
2492cdf0e10cSrcweir if ( pFloat->IsCntntFrm() )
2493cdf0e10cSrcweir {
2494cdf0e10cSrcweir if ( pFloat->GetDrawObjs() )
2495cdf0e10cSrcweir ::lcl_RemoveObjsFromPage( (SwCntntFrm*)pFloat );
2496cdf0e10cSrcweir }
2497cdf0e10cSrcweir else if ( pFloat->IsTabFrm() || pFloat->IsSctFrm() )
2498cdf0e10cSrcweir {
2499cdf0e10cSrcweir SwCntntFrm *pCnt = ((SwLayoutFrm*)pFloat)->ContainsCntnt();
2500cdf0e10cSrcweir if( pCnt )
2501cdf0e10cSrcweir {
2502cdf0e10cSrcweir do
2503cdf0e10cSrcweir { if ( pCnt->GetDrawObjs() )
2504cdf0e10cSrcweir ::lcl_RemoveObjsFromPage( pCnt );
2505cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
2506cdf0e10cSrcweir } while ( pCnt && ((SwLayoutFrm*)pFloat)->IsAnLower( pCnt ) );
2507cdf0e10cSrcweir }
2508cdf0e10cSrcweir }
2509cdf0e10cSrcweir else {
2510cdf0e10cSrcweir ASSERT( !pFloat, "Neuer Float-Frame?" );
2511cdf0e10cSrcweir }
2512cdf0e10cSrcweir }
2513cdf0e10cSrcweir if ( pFloat->GetNext() )
2514cdf0e10cSrcweir {
2515cdf0e10cSrcweir if( bGo )
2516cdf0e10cSrcweir pFloat->pUpper = NULL;
2517cdf0e10cSrcweir pFloat = pFloat->GetNext();
2518cdf0e10cSrcweir if( !bGo && pFloat == pStart )
2519cdf0e10cSrcweir {
2520cdf0e10cSrcweir bGo = sal_True;
2521cdf0e10cSrcweir pFloat->pPrev->pNext = NULL;
2522cdf0e10cSrcweir pFloat->pPrev = NULL;
2523cdf0e10cSrcweir }
2524cdf0e10cSrcweir }
2525cdf0e10cSrcweir else
2526cdf0e10cSrcweir break;
2527cdf0e10cSrcweir
2528cdf0e10cSrcweir } while ( pFloat );
2529cdf0e10cSrcweir
2530cdf0e10cSrcweir //Die naechste Teilkette suchen und die Ketten miteinander verbinden.
2531cdf0e10cSrcweir SwFrm *pTmp = pFloat->FindNext();
2532cdf0e10cSrcweir if( bGo )
2533cdf0e10cSrcweir pFloat->pUpper = NULL;
2534cdf0e10cSrcweir
2535cdf0e10cSrcweir if( !pLay->IsInFtn() )
2536cdf0e10cSrcweir while( pTmp && pTmp->IsInFtn() )
2537cdf0e10cSrcweir pTmp = pTmp->FindNext();
2538cdf0e10cSrcweir
2539cdf0e10cSrcweir if ( !pLay->IsAnLower( pTmp ) )
2540cdf0e10cSrcweir pTmp = 0;
2541cdf0e10cSrcweir
2542cdf0e10cSrcweir if ( pTmp && bGo )
2543cdf0e10cSrcweir {
2544cdf0e10cSrcweir pFloat->pNext = pTmp; //Die beiden Ketten verbinden.
2545cdf0e10cSrcweir pFloat->pNext->pPrev = pFloat;
2546cdf0e10cSrcweir }
2547cdf0e10cSrcweir pFloat = pTmp;
2548cdf0e10cSrcweir bGo = bGo || ( pStart == pFloat );
2549cdf0e10cSrcweir } while ( pFloat );
2550cdf0e10cSrcweir
2551cdf0e10cSrcweir return bGo ? pStart : NULL;
2552cdf0e10cSrcweir }
2553cdf0e10cSrcweir
2554cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - add also drawing objects to page and at-fly
2555cdf0e10cSrcweir // anchored objects to page
lcl_AddObjsToPage(SwFrm * _pFrm,SwPageFrm * _pPage)2556cdf0e10cSrcweir void MA_FASTCALL lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage )
2557cdf0e10cSrcweir {
2558cdf0e10cSrcweir ASSERT( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." );
2559cdf0e10cSrcweir SwSortedObjs &rObjs = *_pFrm->GetDrawObjs();
2560cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
2561cdf0e10cSrcweir {
2562cdf0e10cSrcweir SwAnchoredObject* pObj = rObjs[i];
2563cdf0e10cSrcweir
2564cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - unlock position of anchored object
2565cdf0e10cSrcweir // in order to get the object's position calculated.
2566cdf0e10cSrcweir pObj->UnlockPosition();
2567cdf0e10cSrcweir // <--
2568cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - add also lower objects of as-character
2569cdf0e10cSrcweir // anchored Writer fly frames from page
2570cdf0e10cSrcweir if ( pObj->ISA(SwFlyFrm) )
2571cdf0e10cSrcweir {
2572cdf0e10cSrcweir SwFlyFrm* pFlyFrm = static_cast<SwFlyFrm*>(pObj);
2573cdf0e10cSrcweir if ( pObj->ISA(SwFlyFreeFrm) )
2574cdf0e10cSrcweir {
2575cdf0e10cSrcweir _pPage->AppendFlyToPage( pFlyFrm );
2576cdf0e10cSrcweir }
2577cdf0e10cSrcweir pFlyFrm->_InvalidatePos();
2578cdf0e10cSrcweir pFlyFrm->_InvalidateSize();
2579cdf0e10cSrcweir pFlyFrm->InvalidatePage( _pPage );
2580cdf0e10cSrcweir
2581cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - add also at-fly anchored objects
2582cdf0e10cSrcweir // to page
2583cdf0e10cSrcweir if ( pFlyFrm->GetDrawObjs() )
2584cdf0e10cSrcweir {
2585cdf0e10cSrcweir ::lcl_AddObjsToPage( pFlyFrm, _pPage );
2586cdf0e10cSrcweir }
2587cdf0e10cSrcweir // <--
2588cdf0e10cSrcweir
2589cdf0e10cSrcweir SwCntntFrm *pCnt = pFlyFrm->ContainsCntnt();
2590cdf0e10cSrcweir while ( pCnt )
2591cdf0e10cSrcweir {
2592cdf0e10cSrcweir if ( pCnt->GetDrawObjs() )
2593cdf0e10cSrcweir ::lcl_AddObjsToPage( pCnt, _pPage );
2594cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
2595cdf0e10cSrcweir }
2596cdf0e10cSrcweir }
2597cdf0e10cSrcweir // <--
2598cdf0e10cSrcweir // --> OD 2004-11-29 #115759# - remove also drawing objects from page
2599cdf0e10cSrcweir else if ( pObj->ISA(SwAnchoredDrawObject) )
2600cdf0e10cSrcweir {
2601cdf0e10cSrcweir if (pObj->GetFrmFmt().GetAnchor().GetAnchorId() != FLY_AS_CHAR)
2602cdf0e10cSrcweir {
2603cdf0e10cSrcweir pObj->InvalidateObjPos();
2604cdf0e10cSrcweir _pPage->AppendDrawObjToPage(
2605cdf0e10cSrcweir *(static_cast<SwAnchoredDrawObject*>(pObj)) );
2606cdf0e10cSrcweir }
2607cdf0e10cSrcweir }
2608cdf0e10cSrcweir // <--
2609cdf0e10cSrcweir }
2610cdf0e10cSrcweir }
2611cdf0e10cSrcweir
RestoreCntnt(SwFrm * pSav,SwLayoutFrm * pParent,SwFrm * pSibling,bool bGrow)2612cdf0e10cSrcweir void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow )
2613cdf0e10cSrcweir {
2614cdf0e10cSrcweir ASSERT( pSav && pParent, "Kein Save oder Parent fuer Restore." );
2615cdf0e10cSrcweir SWRECTFN( pParent )
2616cdf0e10cSrcweir
2617cdf0e10cSrcweir //Wenn es bereits FlowFrms unterhalb des neuen Parent gibt, so wird die
2618cdf0e10cSrcweir //Kette, beginnend mit pSav, hinter dem letzten angehaengt.
2619cdf0e10cSrcweir //Die Teile werden kurzerhand insertet und geeignet invalidiert.
2620cdf0e10cSrcweir //Unterwegs werden die Flys der CntntFrms bei der Seite angemeldet.
2621cdf0e10cSrcweir
2622cdf0e10cSrcweir SwPageFrm *pPage = pParent->FindPageFrm();
2623cdf0e10cSrcweir
2624cdf0e10cSrcweir if ( pPage )
2625cdf0e10cSrcweir pPage->InvalidatePage( pPage ); //Invalides Layout anmelden.
2626cdf0e10cSrcweir
2627cdf0e10cSrcweir //Vorgaenger festellen und die Verbindung herstellen bzw. initialisieren.
2628cdf0e10cSrcweir pSav->pPrev = pSibling;
2629cdf0e10cSrcweir SwFrm* pNxt;
2630cdf0e10cSrcweir if ( pSibling )
2631cdf0e10cSrcweir {
2632cdf0e10cSrcweir pNxt = pSibling->pNext;
2633cdf0e10cSrcweir pSibling->pNext = pSav;
2634cdf0e10cSrcweir pSibling->_InvalidatePrt();
2635cdf0e10cSrcweir ((SwCntntFrm*)pSibling)->InvalidatePage( pPage );//Invaliden Cntnt anmelden.
2636cdf0e10cSrcweir if ( ((SwCntntFrm*)pSibling)->GetFollow() )
2637cdf0e10cSrcweir pSibling->Prepare( PREP_CLEAR, 0, sal_False );
2638cdf0e10cSrcweir }
2639cdf0e10cSrcweir else
2640cdf0e10cSrcweir { pNxt = pParent->pLower;
2641cdf0e10cSrcweir pParent->pLower = pSav;
2642cdf0e10cSrcweir pSav->pUpper = pParent; //Schon mal setzen, sonst ist fuer das
2643cdf0e10cSrcweir //invalidate der Parent (z.B. ein Fly) nicht klar.
2644cdf0e10cSrcweir //Invaliden Cntnt anmelden.
2645cdf0e10cSrcweir if ( pSav->IsCntntFrm() )
2646cdf0e10cSrcweir ((SwCntntFrm*)pSav)->InvalidatePage( pPage );
2647cdf0e10cSrcweir else
2648cdf0e10cSrcweir { // pSav koennte auch ein leerer SectFrm sein
2649cdf0e10cSrcweir SwCntntFrm* pCnt = pParent->ContainsCntnt();
2650cdf0e10cSrcweir if( pCnt )
2651cdf0e10cSrcweir pCnt->InvalidatePage( pPage );
2652cdf0e10cSrcweir }
2653cdf0e10cSrcweir }
2654cdf0e10cSrcweir
2655cdf0e10cSrcweir //Der Parent muss entsprechend gegrow'ed werden.
2656cdf0e10cSrcweir SwTwips nGrowVal = 0;
2657cdf0e10cSrcweir SwFrm* pLast;
2658cdf0e10cSrcweir do
2659cdf0e10cSrcweir { pSav->pUpper = pParent;
2660cdf0e10cSrcweir nGrowVal += (pSav->Frm().*fnRect->fnGetHeight)();
2661cdf0e10cSrcweir pSav->_InvalidateAll();
2662cdf0e10cSrcweir
2663cdf0e10cSrcweir //Jetzt die Flys anmelden, fuer TxtFrms gleich geeignet invalidieren.
2664cdf0e10cSrcweir if ( pSav->IsCntntFrm() )
2665cdf0e10cSrcweir {
2666cdf0e10cSrcweir if ( pSav->IsTxtFrm() &&
2667cdf0e10cSrcweir ((SwTxtFrm*)pSav)->GetCacheIdx() != USHRT_MAX )
2668cdf0e10cSrcweir ((SwTxtFrm*)pSav)->Init(); //Ich bin sein Freund.
2669cdf0e10cSrcweir
2670cdf0e10cSrcweir if ( pPage && pSav->GetDrawObjs() )
2671cdf0e10cSrcweir ::lcl_AddObjsToPage( (SwCntntFrm*)pSav, pPage );
2672cdf0e10cSrcweir }
2673cdf0e10cSrcweir else
2674cdf0e10cSrcweir { SwCntntFrm *pBlub = ((SwLayoutFrm*)pSav)->ContainsCntnt();
2675cdf0e10cSrcweir if( pBlub )
2676cdf0e10cSrcweir {
2677cdf0e10cSrcweir do
2678cdf0e10cSrcweir { if ( pPage && pBlub->GetDrawObjs() )
2679cdf0e10cSrcweir ::lcl_AddObjsToPage( pBlub, pPage );
2680cdf0e10cSrcweir if( pBlub->IsTxtFrm() && ((SwTxtFrm*)pBlub)->HasFtn() &&
2681cdf0e10cSrcweir ((SwTxtFrm*)pBlub)->GetCacheIdx() != USHRT_MAX )
2682cdf0e10cSrcweir ((SwTxtFrm*)pBlub)->Init(); //Ich bin sein Freund.
2683cdf0e10cSrcweir pBlub = pBlub->GetNextCntntFrm();
2684cdf0e10cSrcweir } while ( pBlub && ((SwLayoutFrm*)pSav)->IsAnLower( pBlub ));
2685cdf0e10cSrcweir }
2686cdf0e10cSrcweir }
2687cdf0e10cSrcweir pLast = pSav;
2688cdf0e10cSrcweir pSav = pSav->GetNext();
2689cdf0e10cSrcweir
2690cdf0e10cSrcweir } while ( pSav );
2691cdf0e10cSrcweir
2692cdf0e10cSrcweir if( pNxt )
2693cdf0e10cSrcweir {
2694cdf0e10cSrcweir pLast->pNext = pNxt;
2695cdf0e10cSrcweir pNxt->pPrev = pLast;
2696cdf0e10cSrcweir }
2697cdf0e10cSrcweir
2698cdf0e10cSrcweir if ( bGrow )
2699cdf0e10cSrcweir pParent->Grow( nGrowVal );
2700cdf0e10cSrcweir }
2701cdf0e10cSrcweir
2702cdf0e10cSrcweir /*************************************************************************
2703cdf0e10cSrcweir |*
2704cdf0e10cSrcweir |* SqRt() Berechnung der Quadratwurzel, damit die math.lib
2705cdf0e10cSrcweir |* nicht auch noch dazugelinkt werden muss.
2706cdf0e10cSrcweir |*
2707cdf0e10cSrcweir |*************************************************************************/
2708cdf0e10cSrcweir
SqRt(BigInt nX)2709cdf0e10cSrcweir sal_uLong MA_FASTCALL SqRt( BigInt nX )
2710cdf0e10cSrcweir {
2711cdf0e10cSrcweir BigInt nErg = 1;
2712cdf0e10cSrcweir
2713cdf0e10cSrcweir if ( !nX.IsNeg() )
2714cdf0e10cSrcweir {
2715cdf0e10cSrcweir BigInt nOldErg = 1;
2716cdf0e10cSrcweir for ( int i = 0; i <= 5; i++ )
2717cdf0e10cSrcweir {
2718cdf0e10cSrcweir nErg = (nOldErg + (nX / nOldErg)) / BigInt(2);
2719cdf0e10cSrcweir nOldErg = nErg;
2720cdf0e10cSrcweir }
2721cdf0e10cSrcweir }
2722cdf0e10cSrcweir return nErg >= BigInt(SAL_MAX_UINT32) ? ULONG_MAX : (sal_uLong)nErg;
2723cdf0e10cSrcweir }
2724cdf0e10cSrcweir
2725cdf0e10cSrcweir /*************************************************************************/
2726cdf0e10cSrcweir
InsertNewPage(SwPageDesc & rDesc,SwFrm * pUpper,sal_Bool bOdd,sal_Bool bInsertEmpty,sal_Bool bFtn,SwFrm * pSibling)2727cdf0e10cSrcweir SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
2728cdf0e10cSrcweir sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn,
2729cdf0e10cSrcweir SwFrm *pSibling )
2730cdf0e10cSrcweir {
2731cdf0e10cSrcweir SwPageFrm *pRet;
2732cdf0e10cSrcweir SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc();
2733cdf0e10cSrcweir SwFrmFmt *pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
2734cdf0e10cSrcweir //Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben
2735cdf0e10cSrcweir //eine Leerseite einfuegen.
2736cdf0e10cSrcweir if ( !pFmt )
2737cdf0e10cSrcweir {
2738cdf0e10cSrcweir pFmt = bOdd ? rDesc.GetLeftFmt() : rDesc.GetRightFmt();
2739cdf0e10cSrcweir ASSERT( pFmt, "Descriptor without any format?!" );
2740cdf0e10cSrcweir bInsertEmpty = !bInsertEmpty;
2741cdf0e10cSrcweir }
2742cdf0e10cSrcweir if( bInsertEmpty )
2743cdf0e10cSrcweir {
2744cdf0e10cSrcweir SwPageDesc *pTmpDesc = pSibling && pSibling->GetPrev() ?
2745cdf0e10cSrcweir ((SwPageFrm*)pSibling->GetPrev())->GetPageDesc() : &rDesc;
2746cdf0e10cSrcweir pRet = new SwPageFrm( pDoc->GetEmptyPageFmt(), pUpper, pTmpDesc );
2747cdf0e10cSrcweir pRet->Paste( pUpper, pSibling );
2748cdf0e10cSrcweir pRet->PreparePage( bFtn );
2749cdf0e10cSrcweir }
2750cdf0e10cSrcweir pRet = new SwPageFrm( pFmt, pUpper, &rDesc );
2751cdf0e10cSrcweir pRet->Paste( pUpper, pSibling );
2752cdf0e10cSrcweir pRet->PreparePage( bFtn );
2753cdf0e10cSrcweir if ( pRet->GetNext() )
2754cdf0e10cSrcweir ((SwRootFrm*)pRet->GetUpper())->AssertPageFlys( pRet );
2755cdf0e10cSrcweir return pRet;
2756cdf0e10cSrcweir }
2757cdf0e10cSrcweir
2758cdf0e10cSrcweir
2759cdf0e10cSrcweir /*************************************************************************
2760cdf0e10cSrcweir |*
2761cdf0e10cSrcweir |* RegistFlys(), Regist() Die beiden folgenden Methoden durchsuchen rekursiv
2762cdf0e10cSrcweir |* eine Layoutstruktur und melden alle FlyFrms, die einen beliebigen Frm
2763cdf0e10cSrcweir |* innerhalb der Struktur als Anker haben bei der Seite an.
2764cdf0e10cSrcweir |*
2765cdf0e10cSrcweir |*************************************************************************/
2766cdf0e10cSrcweir
lcl_Regist(SwPageFrm * pPage,const SwFrm * pAnch)2767cdf0e10cSrcweir void MA_FASTCALL lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch )
2768cdf0e10cSrcweir {
2769cdf0e10cSrcweir SwSortedObjs *pObjs = (SwSortedObjs*)pAnch->GetDrawObjs();
2770cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
2771cdf0e10cSrcweir {
2772cdf0e10cSrcweir SwAnchoredObject* pObj = (*pObjs)[i];
2773cdf0e10cSrcweir if ( pObj->ISA(SwFlyFrm) )
2774cdf0e10cSrcweir {
2775cdf0e10cSrcweir SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj);
2776cdf0e10cSrcweir //Ggf. ummelden, nicht anmelden wenn bereits bekannt.
2777cdf0e10cSrcweir // --> OD 2004-06-30 #i28701# - use new method <GetPageFrm()>
2778cdf0e10cSrcweir SwPageFrm *pPg = pFly->IsFlyFreeFrm()
2779cdf0e10cSrcweir ? pFly->GetPageFrm() : pFly->FindPageFrm();
2780cdf0e10cSrcweir if ( pPg != pPage )
2781cdf0e10cSrcweir {
2782cdf0e10cSrcweir if ( pPg )
2783cdf0e10cSrcweir pPg->RemoveFlyFromPage( pFly );
2784cdf0e10cSrcweir pPage->AppendFlyToPage( pFly );
2785cdf0e10cSrcweir }
2786cdf0e10cSrcweir ::RegistFlys( pPage, pFly );
2787cdf0e10cSrcweir }
2788cdf0e10cSrcweir else
2789cdf0e10cSrcweir {
2790cdf0e10cSrcweir // --> OD 2008-04-22 #i87493#
2791cdf0e10cSrcweir if ( pPage != pObj->GetPageFrm() )
2792cdf0e10cSrcweir {
2793cdf0e10cSrcweir // --> OD 2004-07-02 #i28701#
2794cdf0e10cSrcweir if ( pObj->GetPageFrm() )
2795cdf0e10cSrcweir pObj->GetPageFrm()->RemoveDrawObjFromPage( *pObj );
2796cdf0e10cSrcweir pPage->AppendDrawObjToPage( *pObj );
2797cdf0e10cSrcweir // <--
2798cdf0e10cSrcweir }
2799cdf0e10cSrcweir // <--
2800cdf0e10cSrcweir }
2801cdf0e10cSrcweir
2802cdf0e10cSrcweir const SwFlyFrm* pFly = pAnch->FindFlyFrm();
2803cdf0e10cSrcweir if ( pFly &&
2804cdf0e10cSrcweir pObj->GetDrawObj()->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() &&
2805cdf0e10cSrcweir pObj->GetDrawObj()->GetPage() )
2806cdf0e10cSrcweir {
2807*43e393b3SOliver-Rainer Wittmann //#i119945# set pFly's OrdNum to pObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
2808*43e393b3SOliver-Rainer Wittmann pObj->DrawObj()->GetPage()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(),
2809*43e393b3SOliver-Rainer Wittmann pObj->GetDrawObj()->GetOrdNumDirect() );
2810cdf0e10cSrcweir }
2811cdf0e10cSrcweir }
2812cdf0e10cSrcweir }
2813cdf0e10cSrcweir
RegistFlys(SwPageFrm * pPage,const SwLayoutFrm * pLay)2814cdf0e10cSrcweir void RegistFlys( SwPageFrm *pPage, const SwLayoutFrm *pLay )
2815cdf0e10cSrcweir {
2816cdf0e10cSrcweir if ( pLay->GetDrawObjs() )
2817cdf0e10cSrcweir ::lcl_Regist( pPage, pLay );
2818cdf0e10cSrcweir const SwFrm *pFrm = pLay->Lower();
2819cdf0e10cSrcweir while ( pFrm )
2820cdf0e10cSrcweir {
2821cdf0e10cSrcweir if ( pFrm->IsLayoutFrm() )
2822cdf0e10cSrcweir ::RegistFlys( pPage, (const SwLayoutFrm*)pFrm );
2823cdf0e10cSrcweir else if ( pFrm->GetDrawObjs() )
2824cdf0e10cSrcweir ::lcl_Regist( pPage, pFrm );
2825cdf0e10cSrcweir pFrm = pFrm->GetNext();
2826cdf0e10cSrcweir }
2827cdf0e10cSrcweir }
2828cdf0e10cSrcweir
2829cdf0e10cSrcweir /*************************************************************************
2830cdf0e10cSrcweir |*
2831cdf0e10cSrcweir |* void Notify()
2832cdf0e10cSrcweir |*
2833cdf0e10cSrcweir |* Beschreibung Benachrichtigt den Hintergrund je nach der
2834cdf0e10cSrcweir |* Veraenderung zwischen altem und neuem Rechteckt.
2835cdf0e10cSrcweir |*
2836cdf0e10cSrcweir |*************************************************************************/
2837cdf0e10cSrcweir
Notify(SwFlyFrm * pFly,SwPageFrm * pOld,const SwRect & rOld,const SwRect * pOldPrt)2838cdf0e10cSrcweir void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld,
2839cdf0e10cSrcweir const SwRect* pOldPrt )
2840cdf0e10cSrcweir {
2841cdf0e10cSrcweir const SwRect aFrm( pFly->GetObjRectWithSpaces() );
2842cdf0e10cSrcweir if ( rOld.Pos() != aFrm.Pos() )
2843cdf0e10cSrcweir { //Positionsaenderung, alten und neuen Bereich invalidieren
2844cdf0e10cSrcweir if ( rOld.HasArea() &&
2845cdf0e10cSrcweir rOld.Left()+pFly->GetFmt()->GetLRSpace().GetLeft() < WEIT_WECH )
2846cdf0e10cSrcweir {
2847cdf0e10cSrcweir pFly->NotifyBackground( pOld, rOld, PREP_FLY_LEAVE );
2848cdf0e10cSrcweir }
2849cdf0e10cSrcweir pFly->NotifyBackground( pFly->FindPageFrm(), aFrm, PREP_FLY_ARRIVE );
2850cdf0e10cSrcweir }
2851cdf0e10cSrcweir else if ( rOld.SSize() != aFrm.SSize() )
2852cdf0e10cSrcweir { //Groessenaenderung, den Bereich der Verlassen wurde bzw. jetzt
2853cdf0e10cSrcweir //ueberdeckt wird invalidieren.
2854cdf0e10cSrcweir //Der Einfachheit halber wird hier bewusst jeweils ein Twip
2855cdf0e10cSrcweir //unnoetig invalidiert.
2856cdf0e10cSrcweir
2857cdf0e10cSrcweir ViewShell *pSh = pFly->getRootFrm()->GetCurrShell();
2858cdf0e10cSrcweir if( pSh && rOld.HasArea() )
2859cdf0e10cSrcweir pSh->InvalidateWindows( rOld );
2860cdf0e10cSrcweir
2861cdf0e10cSrcweir // --> OD 2005-08-19 #i51941# - consider case that fly frame isn't
2862cdf0e10cSrcweir // registered at the old page <pOld>
2863cdf0e10cSrcweir SwPageFrm* pPageFrm = pFly->FindPageFrm();
2864cdf0e10cSrcweir if ( pOld != pPageFrm )
2865cdf0e10cSrcweir {
2866cdf0e10cSrcweir pFly->NotifyBackground( pPageFrm, aFrm, PREP_FLY_ARRIVE );
2867cdf0e10cSrcweir }
2868cdf0e10cSrcweir // <--
2869cdf0e10cSrcweir
2870cdf0e10cSrcweir if ( rOld.Left() != aFrm.Left() )
2871cdf0e10cSrcweir {
2872cdf0e10cSrcweir SwRect aTmp( rOld );
2873cdf0e10cSrcweir aTmp.Union( aFrm );
2874cdf0e10cSrcweir aTmp.Left( Min(aFrm.Left(), rOld.Left()) );
2875cdf0e10cSrcweir aTmp.Right( Max(aFrm.Left(), rOld.Left()) );
2876cdf0e10cSrcweir pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
2877cdf0e10cSrcweir }
2878cdf0e10cSrcweir SwTwips nOld = rOld.Right();
2879cdf0e10cSrcweir SwTwips nNew = aFrm.Right();
2880cdf0e10cSrcweir if ( nOld != nNew )
2881cdf0e10cSrcweir {
2882cdf0e10cSrcweir SwRect aTmp( rOld );
2883cdf0e10cSrcweir aTmp.Union( aFrm );
2884cdf0e10cSrcweir aTmp.Left( Min(nNew, nOld) );
2885cdf0e10cSrcweir aTmp.Right( Max(nNew, nOld) );
2886cdf0e10cSrcweir pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
2887cdf0e10cSrcweir }
2888cdf0e10cSrcweir if ( rOld.Top() != aFrm.Top() )
2889cdf0e10cSrcweir {
2890cdf0e10cSrcweir SwRect aTmp( rOld );
2891cdf0e10cSrcweir aTmp.Union( aFrm );
2892cdf0e10cSrcweir aTmp.Top( Min(aFrm.Top(), rOld.Top()) );
2893cdf0e10cSrcweir aTmp.Bottom( Max(aFrm.Top(), rOld.Top()) );
2894cdf0e10cSrcweir pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
2895cdf0e10cSrcweir }
2896cdf0e10cSrcweir nOld = rOld.Bottom();
2897cdf0e10cSrcweir nNew = aFrm.Bottom();
2898cdf0e10cSrcweir if ( nOld != nNew )
2899cdf0e10cSrcweir {
2900cdf0e10cSrcweir SwRect aTmp( rOld );
2901cdf0e10cSrcweir aTmp.Union( aFrm );
2902cdf0e10cSrcweir aTmp.Top( Min(nNew, nOld) );
2903cdf0e10cSrcweir aTmp.Bottom( Max(nNew, nOld) );
2904cdf0e10cSrcweir pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
2905cdf0e10cSrcweir }
2906cdf0e10cSrcweir }
2907cdf0e10cSrcweir else if ( pOldPrt && *pOldPrt != pFly->Prt() &&
2908cdf0e10cSrcweir pFly->GetFmt()->GetSurround().IsContour() )
2909cdf0e10cSrcweir {
2910cdf0e10cSrcweir // #i24097#
2911cdf0e10cSrcweir pFly->NotifyBackground( pFly->FindPageFrm(), aFrm, PREP_FLY_ARRIVE );
2912cdf0e10cSrcweir }
2913cdf0e10cSrcweir }
2914cdf0e10cSrcweir
2915cdf0e10cSrcweir /*************************************************************************/
2916cdf0e10cSrcweir
lcl_CheckFlowBack(SwFrm * pFrm,const SwRect & rRect)2917cdf0e10cSrcweir void lcl_CheckFlowBack( SwFrm* pFrm, const SwRect &rRect )
2918cdf0e10cSrcweir {
2919cdf0e10cSrcweir SwTwips nBottom = rRect.Bottom();
2920cdf0e10cSrcweir while( pFrm )
2921cdf0e10cSrcweir {
2922cdf0e10cSrcweir if( pFrm->IsLayoutFrm() )
2923cdf0e10cSrcweir {
2924cdf0e10cSrcweir if( rRect.IsOver( pFrm->Frm() ) )
2925cdf0e10cSrcweir lcl_CheckFlowBack( ((SwLayoutFrm*)pFrm)->Lower(), rRect );
2926cdf0e10cSrcweir }
2927cdf0e10cSrcweir else if( !pFrm->GetNext() && nBottom > pFrm->Frm().Bottom() )
2928cdf0e10cSrcweir {
2929cdf0e10cSrcweir if( pFrm->IsCntntFrm() && ((SwCntntFrm*)pFrm)->HasFollow() )
2930cdf0e10cSrcweir pFrm->InvalidateSize();
2931cdf0e10cSrcweir else
2932cdf0e10cSrcweir pFrm->InvalidateNextPos();
2933cdf0e10cSrcweir }
2934cdf0e10cSrcweir pFrm = pFrm->GetNext();
2935cdf0e10cSrcweir }
2936cdf0e10cSrcweir }
2937cdf0e10cSrcweir
lcl_NotifyCntnt(const SdrObject * pThis,SwCntntFrm * pCnt,const SwRect & rRect,const PrepareHint eHint)2938cdf0e10cSrcweir void MA_FASTCALL lcl_NotifyCntnt( const SdrObject *pThis, SwCntntFrm *pCnt,
2939cdf0e10cSrcweir const SwRect &rRect, const PrepareHint eHint )
2940cdf0e10cSrcweir {
2941cdf0e10cSrcweir if ( pCnt->IsTxtFrm() )
2942cdf0e10cSrcweir {
2943cdf0e10cSrcweir SwRect aCntPrt( pCnt->Prt() );
2944cdf0e10cSrcweir aCntPrt.Pos() += pCnt->Frm().Pos();
2945cdf0e10cSrcweir if ( eHint == PREP_FLY_ATTR_CHG )
2946cdf0e10cSrcweir {
2947cdf0e10cSrcweir // --> OD 2004-10-20 #i35640# - use given rectangle <rRect> instead
2948cdf0e10cSrcweir // of current bound rectangle
2949cdf0e10cSrcweir if ( aCntPrt.IsOver( rRect ) )
2950cdf0e10cSrcweir // <--
2951cdf0e10cSrcweir pCnt->Prepare( PREP_FLY_ATTR_CHG );
2952cdf0e10cSrcweir }
2953cdf0e10cSrcweir // --> OD 2004-11-01 #i23129# - only invalidate, if the text frame
2954cdf0e10cSrcweir // printing area overlaps with the given rectangle.
2955cdf0e10cSrcweir else if ( aCntPrt.IsOver( rRect ) )
2956cdf0e10cSrcweir // <--
2957cdf0e10cSrcweir pCnt->Prepare( eHint, (void*)&aCntPrt._Intersection( rRect ) );
2958cdf0e10cSrcweir if ( pCnt->GetDrawObjs() )
2959cdf0e10cSrcweir {
2960cdf0e10cSrcweir const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
2961cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
2962cdf0e10cSrcweir {
2963cdf0e10cSrcweir SwAnchoredObject* pObj = rObjs[i];
2964cdf0e10cSrcweir if ( pObj->ISA(SwFlyFrm) )
2965cdf0e10cSrcweir {
2966cdf0e10cSrcweir SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj);
2967cdf0e10cSrcweir if ( pFly->IsFlyInCntFrm() )
2968cdf0e10cSrcweir {
2969cdf0e10cSrcweir SwCntntFrm *pCntnt = pFly->ContainsCntnt();
2970cdf0e10cSrcweir while ( pCntnt )
2971cdf0e10cSrcweir {
2972cdf0e10cSrcweir ::lcl_NotifyCntnt( pThis, pCntnt, rRect, eHint );
2973cdf0e10cSrcweir pCntnt = pCntnt->GetNextCntntFrm();
2974cdf0e10cSrcweir }
2975cdf0e10cSrcweir }
2976cdf0e10cSrcweir }
2977cdf0e10cSrcweir }
2978cdf0e10cSrcweir }
2979cdf0e10cSrcweir }
2980cdf0e10cSrcweir }
2981cdf0e10cSrcweir
Notify_Background(const SdrObject * pObj,SwPageFrm * pPage,const SwRect & rRect,const PrepareHint eHint,const sal_Bool bInva)2982cdf0e10cSrcweir void Notify_Background( const SdrObject* pObj,
2983cdf0e10cSrcweir SwPageFrm* pPage,
2984cdf0e10cSrcweir const SwRect& rRect,
2985cdf0e10cSrcweir const PrepareHint eHint,
2986cdf0e10cSrcweir const sal_Bool bInva )
2987cdf0e10cSrcweir {
2988cdf0e10cSrcweir
2989cdf0e10cSrcweir //Wenn der Frm gerade erstmalig sinnvoll positioniert wurde, braucht der
2990cdf0e10cSrcweir //alte Bereich nicht benachrichtigt werden.
2991cdf0e10cSrcweir if ( eHint == PREP_FLY_LEAVE && rRect.Top() == WEIT_WECH )
2992cdf0e10cSrcweir return;
2993cdf0e10cSrcweir
2994cdf0e10cSrcweir SwLayoutFrm* pArea;
2995cdf0e10cSrcweir SwFlyFrm *pFlyFrm = 0;
2996cdf0e10cSrcweir SwFrm* pAnchor;
2997cdf0e10cSrcweir if( pObj->ISA(SwVirtFlyDrawObj) )
2998cdf0e10cSrcweir {
2999cdf0e10cSrcweir pFlyFrm = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
3000cdf0e10cSrcweir pAnchor = pFlyFrm->AnchorFrm();
3001cdf0e10cSrcweir }
3002cdf0e10cSrcweir else
3003cdf0e10cSrcweir {
3004cdf0e10cSrcweir pFlyFrm = NULL;
3005cdf0e10cSrcweir pAnchor = const_cast<SwFrm*>(
3006cdf0e10cSrcweir GetUserCall(pObj)->GetAnchoredObj( pObj )->GetAnchorFrm() );
3007cdf0e10cSrcweir }
3008cdf0e10cSrcweir if( PREP_FLY_LEAVE != eHint && pAnchor->IsInFly() )
3009cdf0e10cSrcweir pArea = pAnchor->FindFlyFrm();
3010cdf0e10cSrcweir else
3011cdf0e10cSrcweir pArea = pPage;
3012cdf0e10cSrcweir SwCntntFrm *pCnt = 0;
3013cdf0e10cSrcweir if ( pArea )
3014cdf0e10cSrcweir {
3015cdf0e10cSrcweir if( PREP_FLY_ARRIVE != eHint )
3016cdf0e10cSrcweir lcl_CheckFlowBack( pArea, rRect );
3017cdf0e10cSrcweir
3018cdf0e10cSrcweir //Es reagieren sowieso nur die auf den Anker folgenden auf den Fly, also
3019cdf0e10cSrcweir //brauchen diese nicht abgeklappert werden.
3020cdf0e10cSrcweir //Ausnahme sind ist natuerlich das LEAVE, denn der Fly koennte ja von
3021cdf0e10cSrcweir //"oben" kommen.
3022cdf0e10cSrcweir // Wenn der Anker auf der vorhergehenden Seite liegt, muss ebenfalls
3023cdf0e10cSrcweir // die gesamte Seite abgearbeitet werden. (47722)
3024cdf0e10cSrcweir // OD 2004-05-13 #i28701# - If the wrapping style has to be considered
3025cdf0e10cSrcweir // on the object positioning, the complete area has to be processed,
3026cdf0e10cSrcweir // because content frames before the anchor frame also have to consider
3027cdf0e10cSrcweir // the object for the text wrapping.
3028cdf0e10cSrcweir // --> OD 2004-08-25 #i3317# - The complete area has always been
3029cdf0e10cSrcweir // processed.
3030cdf0e10cSrcweir {
3031cdf0e10cSrcweir pCnt = pArea->ContainsCntnt();
3032cdf0e10cSrcweir }
3033cdf0e10cSrcweir // <--
3034cdf0e10cSrcweir }
3035cdf0e10cSrcweir SwFrm *pLastTab = 0;
3036cdf0e10cSrcweir
3037cdf0e10cSrcweir while ( pCnt && pArea && pArea->IsAnLower( pCnt ) )
3038cdf0e10cSrcweir {
3039cdf0e10cSrcweir ::lcl_NotifyCntnt( pObj, pCnt, rRect, eHint );
3040cdf0e10cSrcweir if ( pCnt->IsInTab() )
3041cdf0e10cSrcweir {
3042cdf0e10cSrcweir SwLayoutFrm* pCell = pCnt->GetUpper();
3043cdf0e10cSrcweir // --> OD 2005-01-14 #i40606# - use <GetLastBoundRect()>
3044cdf0e10cSrcweir // instead of <GetCurrentBoundRect()>, because a recalculation
3045cdf0e10cSrcweir // of the bounding rectangle isn't intended here.
3046cdf0e10cSrcweir if ( pCell->IsCellFrm() &&
3047cdf0e10cSrcweir ( pCell->Frm().IsOver( pObj->GetLastBoundRect() ) ||
3048cdf0e10cSrcweir pCell->Frm().IsOver( rRect ) ) )
3049cdf0e10cSrcweir // <--
3050cdf0e10cSrcweir {
3051cdf0e10cSrcweir const SwFmtVertOrient &rOri = pCell->GetFmt()->GetVertOrient();
3052cdf0e10cSrcweir if ( text::VertOrientation::NONE != rOri.GetVertOrient() )
3053cdf0e10cSrcweir pCell->InvalidatePrt();
3054cdf0e10cSrcweir }
3055cdf0e10cSrcweir SwTabFrm *pTab = pCnt->FindTabFrm();
3056cdf0e10cSrcweir if ( pTab != pLastTab )
3057cdf0e10cSrcweir {
3058cdf0e10cSrcweir pLastTab = pTab;
3059cdf0e10cSrcweir // --> OD 2005-01-14 #i40606# - use <GetLastBoundRect()>
3060cdf0e10cSrcweir // instead of <GetCurrentBoundRect()>, because a recalculation
3061cdf0e10cSrcweir // of the bounding rectangle isn't intended here.
3062cdf0e10cSrcweir if ( pTab->Frm().IsOver( pObj->GetLastBoundRect() ) ||
3063cdf0e10cSrcweir pTab->Frm().IsOver( rRect ) )
3064cdf0e10cSrcweir // <--
3065cdf0e10cSrcweir {
3066cdf0e10cSrcweir if ( !pFlyFrm || !pFlyFrm->IsLowerOf( pTab ) )
3067cdf0e10cSrcweir pTab->InvalidatePrt();
3068cdf0e10cSrcweir }
3069cdf0e10cSrcweir }
3070cdf0e10cSrcweir }
3071cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
3072cdf0e10cSrcweir }
3073cdf0e10cSrcweir // #108745# Sorry, but this causes nothing but trouble. I remove these lines
3074cdf0e10cSrcweir // taking the risk that the footer frame will have a wrong height
3075cdf0e10cSrcweir // if( pPage->Lower() )
3076cdf0e10cSrcweir // {
3077cdf0e10cSrcweir // SwFrm* pFrm = pPage->Lower();
3078cdf0e10cSrcweir // while( pFrm->GetNext() )
3079cdf0e10cSrcweir // pFrm = pFrm->GetNext();
3080cdf0e10cSrcweir // if( pFrm->IsFooterFrm() &&
3081cdf0e10cSrcweir // ( ( pFrm->Frm().IsOver( pObj->GetBoundRect() ) ||
3082cdf0e10cSrcweir // pFrm->Frm().IsOver( rRect ) ) ) )
3083cdf0e10cSrcweir // pFrm->InvalidateSize();
3084cdf0e10cSrcweir // }
3085cdf0e10cSrcweir // --> OD 2007-07-24 #128702# - make code robust
3086cdf0e10cSrcweir if ( pPage && pPage->GetSortedObjs() )
3087cdf0e10cSrcweir // <--
3088cdf0e10cSrcweir {
3089cdf0e10cSrcweir pObj->GetOrdNum();
3090cdf0e10cSrcweir const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
3091cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
3092cdf0e10cSrcweir {
3093cdf0e10cSrcweir SwAnchoredObject* pAnchoredObj = rObjs[i];
3094cdf0e10cSrcweir if ( pAnchoredObj->ISA(SwFlyFrm) )
3095cdf0e10cSrcweir {
3096cdf0e10cSrcweir if( pAnchoredObj->GetDrawObj() == pObj )
3097cdf0e10cSrcweir continue;
3098cdf0e10cSrcweir SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
3099cdf0e10cSrcweir if ( pFly->Frm().Top() == WEIT_WECH )
3100cdf0e10cSrcweir continue;
3101cdf0e10cSrcweir
3102cdf0e10cSrcweir if ( !pFlyFrm ||
3103cdf0e10cSrcweir (!pFly->IsLowerOf( pFlyFrm ) &&
3104cdf0e10cSrcweir pFly->GetVirtDrawObj()->GetOrdNumDirect() < pObj->GetOrdNumDirect()))
3105cdf0e10cSrcweir {
3106cdf0e10cSrcweir pCnt = pFly->ContainsCntnt();
3107cdf0e10cSrcweir while ( pCnt )
3108cdf0e10cSrcweir {
3109cdf0e10cSrcweir ::lcl_NotifyCntnt( pObj, pCnt, rRect, eHint );
3110cdf0e10cSrcweir pCnt = pCnt->GetNextCntntFrm();
3111cdf0e10cSrcweir }
3112cdf0e10cSrcweir }
3113cdf0e10cSrcweir if( pFly->IsFlyLayFrm() )
3114cdf0e10cSrcweir {
3115cdf0e10cSrcweir if( pFly->Lower() && pFly->Lower()->IsColumnFrm() &&
3116cdf0e10cSrcweir pFly->Frm().Bottom() >= rRect.Top() &&
3117cdf0e10cSrcweir pFly->Frm().Top() <= rRect.Bottom() &&
3118cdf0e10cSrcweir pFly->Frm().Right() >= rRect.Left() &&
3119cdf0e10cSrcweir pFly->Frm().Left() <= rRect.Right() )
3120cdf0e10cSrcweir {
3121cdf0e10cSrcweir pFly->InvalidateSize();
3122cdf0e10cSrcweir }
3123cdf0e10cSrcweir }
3124cdf0e10cSrcweir //Flys, die ueber mir liegen muessen/mussten evtl.
3125cdf0e10cSrcweir //ausweichen, wenn sie eine automatische Ausrichtung haben.
3126cdf0e10cSrcweir //das ist unabhaengig von meinem Attribut, weil dies sich
3127cdf0e10cSrcweir //gerade geaendert haben kann und eben deshalb
3128cdf0e10cSrcweir //umformatiert wurde.
3129cdf0e10cSrcweir else if ( pFly->IsFlyAtCntFrm() &&
3130cdf0e10cSrcweir pObj->GetOrdNumDirect() <
3131cdf0e10cSrcweir pFly->GetVirtDrawObj()->GetOrdNumDirect() &&
3132cdf0e10cSrcweir pFlyFrm && !pFly->IsLowerOf( pFlyFrm ) )
3133cdf0e10cSrcweir {
3134cdf0e10cSrcweir const SwFmtHoriOrient &rH = pFly->GetFmt()->GetHoriOrient();
3135cdf0e10cSrcweir if ( text::HoriOrientation::NONE != rH.GetHoriOrient() &&
3136cdf0e10cSrcweir text::HoriOrientation::CENTER != rH.GetHoriOrient() &&
3137cdf0e10cSrcweir ( !pFly->IsAutoPos() || text::RelOrientation::CHAR != rH.GetRelationOrient() ) &&
3138cdf0e10cSrcweir (pFly->Frm().Bottom() >= rRect.Top() &&
3139cdf0e10cSrcweir pFly->Frm().Top() <= rRect.Bottom()) )
3140cdf0e10cSrcweir pFly->InvalidatePos();
3141cdf0e10cSrcweir }
3142cdf0e10cSrcweir }
3143cdf0e10cSrcweir }
3144cdf0e10cSrcweir }
3145cdf0e10cSrcweir if ( pFlyFrm && pAnchor->GetUpper() && pAnchor->IsInTab() )//MA_FLY_HEIGHT
3146cdf0e10cSrcweir pAnchor->GetUpper()->InvalidateSize();
3147cdf0e10cSrcweir
3148cdf0e10cSrcweir // --> OD 2008-01-30 #i82258# - make code robust
3149cdf0e10cSrcweir ViewShell* pSh = 0;
3150cdf0e10cSrcweir if ( bInva && pPage &&
3151cdf0e10cSrcweir 0 != (pSh = pPage->getRootFrm()->GetCurrShell()) )
3152cdf0e10cSrcweir {
3153cdf0e10cSrcweir pSh->InvalidateWindows( rRect );
3154cdf0e10cSrcweir }
3155cdf0e10cSrcweir // <--
3156cdf0e10cSrcweir }
3157cdf0e10cSrcweir
3158cdf0e10cSrcweir /*************************************************************************
3159cdf0e10cSrcweir |*
3160cdf0e10cSrcweir |* GetVirtualUpper() liefert bei absatzgebundenen Objekten den Upper
3161cdf0e10cSrcweir |* des Ankers. Falls es sich dabei um verkettete Rahmen oder
3162cdf0e10cSrcweir |* Fussnoten handelt, wird ggf. der "virtuelle" Upper ermittelt.
3163cdf0e10cSrcweir |*
3164cdf0e10cSrcweir |*************************************************************************/
3165cdf0e10cSrcweir
GetVirtualUpper(const SwFrm * pFrm,const Point & rPos)3166cdf0e10cSrcweir const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos )
3167cdf0e10cSrcweir {
3168cdf0e10cSrcweir if( pFrm->IsTxtFrm() )
3169cdf0e10cSrcweir {
3170cdf0e10cSrcweir pFrm = pFrm->GetUpper();
3171cdf0e10cSrcweir if( !pFrm->Frm().IsInside( rPos ) )
3172cdf0e10cSrcweir {
3173cdf0e10cSrcweir if( pFrm->IsFtnFrm() )
3174cdf0e10cSrcweir {
3175cdf0e10cSrcweir const SwFtnFrm* pTmp = ((SwFtnFrm*)pFrm)->GetFollow();
3176cdf0e10cSrcweir while( pTmp )
3177cdf0e10cSrcweir {
3178cdf0e10cSrcweir if( pTmp->Frm().IsInside( rPos ) )
3179cdf0e10cSrcweir return pTmp;
3180cdf0e10cSrcweir pTmp = pTmp->GetFollow();
3181cdf0e10cSrcweir }
3182cdf0e10cSrcweir }
3183cdf0e10cSrcweir else
3184cdf0e10cSrcweir {
3185cdf0e10cSrcweir SwFlyFrm* pTmp = (SwFlyFrm*)pFrm->FindFlyFrm();
3186cdf0e10cSrcweir while( pTmp )
3187cdf0e10cSrcweir {
3188cdf0e10cSrcweir if( pTmp->Frm().IsInside( rPos ) )
3189cdf0e10cSrcweir return pTmp;
3190cdf0e10cSrcweir pTmp = pTmp->GetNextLink();
3191cdf0e10cSrcweir }
3192cdf0e10cSrcweir }
3193cdf0e10cSrcweir }
3194cdf0e10cSrcweir }
3195cdf0e10cSrcweir return pFrm;
3196cdf0e10cSrcweir }
3197cdf0e10cSrcweir
3198cdf0e10cSrcweir /*************************************************************************/
3199cdf0e10cSrcweir
Is_Lower_Of(const SwFrm * pCurrFrm,const SdrObject * pObj)3200cdf0e10cSrcweir sal_Bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj )
3201cdf0e10cSrcweir {
3202cdf0e10cSrcweir Point aPos;
3203cdf0e10cSrcweir const SwFrm* pFrm;
3204cdf0e10cSrcweir if( pObj->ISA(SwVirtFlyDrawObj) )
3205cdf0e10cSrcweir {
3206cdf0e10cSrcweir const SwFlyFrm* pFly = ( (SwVirtFlyDrawObj*)pObj )->GetFlyFrm();
3207cdf0e10cSrcweir pFrm = pFly->GetAnchorFrm();
3208cdf0e10cSrcweir aPos = pFly->Frm().Pos();
3209cdf0e10cSrcweir }
3210cdf0e10cSrcweir else
3211cdf0e10cSrcweir {
3212cdf0e10cSrcweir pFrm = ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchorFrm(pObj);
3213cdf0e10cSrcweir aPos = pObj->GetCurrentBoundRect().TopLeft();
3214cdf0e10cSrcweir }
3215cdf0e10cSrcweir ASSERT( pFrm, "8-( Fly is lost in Space." );
3216cdf0e10cSrcweir pFrm = GetVirtualUpper( pFrm, aPos );
3217cdf0e10cSrcweir do
3218cdf0e10cSrcweir { if ( pFrm == pCurrFrm )
3219cdf0e10cSrcweir return sal_True;
3220cdf0e10cSrcweir if( pFrm->IsFlyFrm() )
3221cdf0e10cSrcweir {
3222cdf0e10cSrcweir aPos = pFrm->Frm().Pos();
3223cdf0e10cSrcweir pFrm = GetVirtualUpper( ((const SwFlyFrm*)pFrm)->GetAnchorFrm(), aPos );
3224cdf0e10cSrcweir }
3225cdf0e10cSrcweir else
3226cdf0e10cSrcweir pFrm = pFrm->GetUpper();
3227cdf0e10cSrcweir } while ( pFrm );
3228cdf0e10cSrcweir return sal_False;
3229cdf0e10cSrcweir }
3230cdf0e10cSrcweir
FindKontext(const SwFrm * pFrm,sal_uInt16 nAdditionalKontextTyp)3231cdf0e10cSrcweir const SwFrm *FindKontext( const SwFrm *pFrm, sal_uInt16 nAdditionalKontextTyp )
3232cdf0e10cSrcweir {
3233cdf0e10cSrcweir //Liefert die Umgebung des Frm in die kein Fly aus einer anderen
3234cdf0e10cSrcweir //Umgebung hineinragen kann.
3235cdf0e10cSrcweir const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT |
3236cdf0e10cSrcweir FRM_FTN | FRM_FLY |
3237cdf0e10cSrcweir FRM_TAB | FRM_ROW | FRM_CELL |
3238cdf0e10cSrcweir nAdditionalKontextTyp;
3239cdf0e10cSrcweir do
3240cdf0e10cSrcweir { if ( pFrm->GetType() & nTyp )
3241cdf0e10cSrcweir break;
3242cdf0e10cSrcweir pFrm = pFrm->GetUpper();
3243cdf0e10cSrcweir } while( pFrm );
3244cdf0e10cSrcweir return pFrm;
3245cdf0e10cSrcweir }
3246cdf0e10cSrcweir
IsFrmInSameKontext(const SwFrm * pInnerFrm,const SwFrm * pFrm)3247cdf0e10cSrcweir sal_Bool IsFrmInSameKontext( const SwFrm *pInnerFrm, const SwFrm *pFrm )
3248cdf0e10cSrcweir {
3249cdf0e10cSrcweir const SwFrm *pKontext = FindKontext( pInnerFrm, 0 );
3250cdf0e10cSrcweir
3251cdf0e10cSrcweir const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT |
3252cdf0e10cSrcweir FRM_FTN | FRM_FLY |
3253cdf0e10cSrcweir FRM_TAB | FRM_ROW | FRM_CELL;
3254cdf0e10cSrcweir do
3255cdf0e10cSrcweir { if ( pFrm->GetType() & nTyp )
3256cdf0e10cSrcweir {
3257cdf0e10cSrcweir if( pFrm == pKontext )
3258cdf0e10cSrcweir return sal_True;
3259cdf0e10cSrcweir if( pFrm->IsCellFrm() )
3260cdf0e10cSrcweir return sal_False;
3261cdf0e10cSrcweir }
3262cdf0e10cSrcweir if( pFrm->IsFlyFrm() )
3263cdf0e10cSrcweir {
3264cdf0e10cSrcweir Point aPos( pFrm->Frm().Pos() );
3265cdf0e10cSrcweir pFrm = GetVirtualUpper( ((const SwFlyFrm*)pFrm)->GetAnchorFrm(), aPos );
3266cdf0e10cSrcweir }
3267cdf0e10cSrcweir else
3268cdf0e10cSrcweir pFrm = pFrm->GetUpper();
3269cdf0e10cSrcweir } while( pFrm );
3270cdf0e10cSrcweir
3271cdf0e10cSrcweir return sal_False;
3272cdf0e10cSrcweir }
3273cdf0e10cSrcweir
3274cdf0e10cSrcweir
3275cdf0e10cSrcweir //---------------------------------
3276cdf0e10cSrcweir
lcl_CalcCellRstHeight(SwLayoutFrm * pCell)3277cdf0e10cSrcweir SwTwips MA_FASTCALL lcl_CalcCellRstHeight( SwLayoutFrm *pCell )
3278cdf0e10cSrcweir {
3279cdf0e10cSrcweir if ( pCell->Lower()->IsCntntFrm() || pCell->Lower()->IsSctFrm() )
3280cdf0e10cSrcweir {
3281cdf0e10cSrcweir SwFrm *pLow = pCell->Lower();
3282cdf0e10cSrcweir long nHeight = 0, nFlyAdd = 0;
3283cdf0e10cSrcweir do
3284cdf0e10cSrcweir {
3285cdf0e10cSrcweir long nLow = pLow->Frm().Height();
3286cdf0e10cSrcweir if( pLow->IsTxtFrm() && ((SwTxtFrm*)pLow)->IsUndersized() )
3287cdf0e10cSrcweir nLow += ((SwTxtFrm*)pLow)->GetParHeight()-pLow->Prt().Height();
3288cdf0e10cSrcweir else if( pLow->IsSctFrm() && ((SwSectionFrm*)pLow)->IsUndersized() )
3289cdf0e10cSrcweir nLow += ((SwSectionFrm*)pLow)->Undersize();
3290cdf0e10cSrcweir nFlyAdd = Max( 0L, nFlyAdd - nLow );
3291cdf0e10cSrcweir nFlyAdd = Max( nFlyAdd, ::CalcHeightWidthFlys( pLow ) );
3292cdf0e10cSrcweir nHeight += nLow;
3293cdf0e10cSrcweir pLow = pLow->GetNext();
3294cdf0e10cSrcweir } while ( pLow );
3295cdf0e10cSrcweir if ( nFlyAdd )
3296cdf0e10cSrcweir nHeight += nFlyAdd;
3297cdf0e10cSrcweir
3298cdf0e10cSrcweir //Der Border will natuerlich auch mitspielen, er kann leider nicht
3299cdf0e10cSrcweir //aus PrtArea und Frm errechnet werden, da diese in beliebiger
3300cdf0e10cSrcweir //Kombination ungueltig sein koennen.
3301cdf0e10cSrcweir SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCell );
3302cdf0e10cSrcweir const SwBorderAttrs &rAttrs = *aAccess.Get();
3303cdf0e10cSrcweir nHeight += rAttrs.CalcTop() + rAttrs.CalcBottom();
3304cdf0e10cSrcweir
3305cdf0e10cSrcweir return pCell->Frm().Height() - nHeight;
3306cdf0e10cSrcweir }
3307cdf0e10cSrcweir else
3308cdf0e10cSrcweir {
3309cdf0e10cSrcweir long nRstHeight = 0;
3310cdf0e10cSrcweir SwFrm *pLow = pCell->Lower();
3311cdf0e10cSrcweir do
3312cdf0e10cSrcweir { nRstHeight += ::CalcRowRstHeight( (SwLayoutFrm*)pLow );
3313cdf0e10cSrcweir pLow = pLow->GetNext();
3314cdf0e10cSrcweir
3315cdf0e10cSrcweir } while ( pLow );
3316cdf0e10cSrcweir
3317cdf0e10cSrcweir return nRstHeight;
3318cdf0e10cSrcweir }
3319cdf0e10cSrcweir }
3320cdf0e10cSrcweir
CalcRowRstHeight(SwLayoutFrm * pRow)3321cdf0e10cSrcweir SwTwips MA_FASTCALL CalcRowRstHeight( SwLayoutFrm *pRow )
3322cdf0e10cSrcweir {
3323cdf0e10cSrcweir SwTwips nRstHeight = LONG_MAX;
3324cdf0e10cSrcweir SwLayoutFrm *pLow = (SwLayoutFrm*)pRow->Lower();
3325cdf0e10cSrcweir while ( pLow )
3326cdf0e10cSrcweir {
3327cdf0e10cSrcweir nRstHeight = Min( nRstHeight, ::lcl_CalcCellRstHeight( pLow ) );
3328cdf0e10cSrcweir pLow = (SwLayoutFrm*)pLow->GetNext();
3329cdf0e10cSrcweir }
3330cdf0e10cSrcweir return nRstHeight;
3331cdf0e10cSrcweir }
3332cdf0e10cSrcweir
FindPage(const SwRect & rRect,const SwFrm * pPage)3333cdf0e10cSrcweir const SwFrm* MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage )
3334cdf0e10cSrcweir {
3335cdf0e10cSrcweir if ( !rRect.IsOver( pPage->Frm() ) )
3336cdf0e10cSrcweir {
3337cdf0e10cSrcweir const SwRootFrm* pRootFrm = static_cast<const SwRootFrm*>(pPage->GetUpper());
3338cdf0e10cSrcweir const SwFrm* pTmpPage = pRootFrm ? pRootFrm->GetPageAtPos( rRect.TopLeft(), &rRect.SSize(), true ) : 0;
3339cdf0e10cSrcweir if ( pTmpPage )
3340cdf0e10cSrcweir pPage = pTmpPage;
3341cdf0e10cSrcweir }
3342cdf0e10cSrcweir
3343cdf0e10cSrcweir return pPage;
3344cdf0e10cSrcweir }
3345cdf0e10cSrcweir
3346cdf0e10cSrcweir #include <svl/smplhint.hxx>
3347cdf0e10cSrcweir class SwFrmHolder : private SfxListener
3348cdf0e10cSrcweir {
3349cdf0e10cSrcweir SwFrm* pFrm;
3350cdf0e10cSrcweir bool bSet;
3351cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
3352cdf0e10cSrcweir public:
SwFrmHolder()3353cdf0e10cSrcweir SwFrmHolder() : pFrm(0), bSet(false) {}
3354cdf0e10cSrcweir void SetFrm( SwFrm* pHold );
GetFrm()3355cdf0e10cSrcweir SwFrm* GetFrm() { return pFrm; }
3356cdf0e10cSrcweir void Reset();
IsSet()3357cdf0e10cSrcweir bool IsSet() { return bSet; }
3358cdf0e10cSrcweir };
3359cdf0e10cSrcweir
SetFrm(SwFrm * pHold)3360cdf0e10cSrcweir void SwFrmHolder::SetFrm( SwFrm* pHold )
3361cdf0e10cSrcweir {
3362cdf0e10cSrcweir bSet = true;
3363cdf0e10cSrcweir pFrm = pHold;
3364cdf0e10cSrcweir StartListening(*pHold);
3365cdf0e10cSrcweir }
3366cdf0e10cSrcweir
Reset()3367cdf0e10cSrcweir void SwFrmHolder::Reset()
3368cdf0e10cSrcweir {
3369cdf0e10cSrcweir if (pFrm)
3370cdf0e10cSrcweir EndListening(*pFrm);
3371cdf0e10cSrcweir bSet = false;
3372cdf0e10cSrcweir pFrm = 0;
3373cdf0e10cSrcweir }
3374cdf0e10cSrcweir
Notify(SfxBroadcaster & rBC,const SfxHint & rHint)3375cdf0e10cSrcweir void SwFrmHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
3376cdf0e10cSrcweir {
3377cdf0e10cSrcweir if ( rHint.IsA(TYPE(SfxSimpleHint)) )
3378cdf0e10cSrcweir {
3379cdf0e10cSrcweir if ( ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DYING && &rBC == pFrm )
3380cdf0e10cSrcweir pFrm = 0;
3381cdf0e10cSrcweir }
3382cdf0e10cSrcweir }
3383cdf0e10cSrcweir
GetFrmOfModify(const SwRootFrm * pLayout,SwModify const & rMod,sal_uInt16 const nFrmType,const Point * pPoint,const SwPosition * pPos,const sal_Bool bCalcFrm)3384cdf0e10cSrcweir SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const& rMod, sal_uInt16 const nFrmType,
3385cdf0e10cSrcweir const Point* pPoint, const SwPosition *pPos, const sal_Bool bCalcFrm )
3386cdf0e10cSrcweir {
3387cdf0e10cSrcweir SwFrm *pMinFrm = 0, *pTmpFrm;
3388cdf0e10cSrcweir SwFrmHolder aHolder;
3389cdf0e10cSrcweir SwRect aCalcRect;
3390cdf0e10cSrcweir bool bClientIterChanged = false;
3391cdf0e10cSrcweir
3392cdf0e10cSrcweir SwIterator<SwFrm,SwModify> aIter( rMod );
3393cdf0e10cSrcweir do {
3394cdf0e10cSrcweir pMinFrm = 0;
3395cdf0e10cSrcweir aHolder.Reset();
3396cdf0e10cSrcweir sal_uInt64 nMinDist = 0;
3397cdf0e10cSrcweir bClientIterChanged = false;
3398cdf0e10cSrcweir
3399cdf0e10cSrcweir for( pTmpFrm = aIter.First(); pTmpFrm; pTmpFrm = aIter.Next() )
3400cdf0e10cSrcweir {
3401cdf0e10cSrcweir if( pTmpFrm->GetType() & nFrmType &&
3402cdf0e10cSrcweir ( !pLayout || pLayout == pTmpFrm->getRootFrm() ) &&
3403cdf0e10cSrcweir (!pTmpFrm->IsFlowFrm() ||
3404cdf0e10cSrcweir !SwFlowFrm::CastFlowFrm( pTmpFrm )->IsFollow() ))
3405cdf0e10cSrcweir {
3406cdf0e10cSrcweir if( pPoint )
3407cdf0e10cSrcweir {
3408cdf0e10cSrcweir // watch for Frm being deleted
3409cdf0e10cSrcweir if ( pMinFrm )
3410cdf0e10cSrcweir aHolder.SetFrm( pMinFrm );
3411cdf0e10cSrcweir else
3412cdf0e10cSrcweir aHolder.Reset();
3413cdf0e10cSrcweir
3414cdf0e10cSrcweir if( bCalcFrm )
3415cdf0e10cSrcweir {
3416cdf0e10cSrcweir // --> OD 2005-03-04 #b6234250# - format parent Writer
3417cdf0e10cSrcweir // fly frame, if it isn't been formatted yet.
3418cdf0e10cSrcweir // Note: The Writer fly frame could be the frame itself.
3419cdf0e10cSrcweir SwFlyFrm* pFlyFrm( pTmpFrm->FindFlyFrm() );
3420cdf0e10cSrcweir if ( pFlyFrm &&
3421cdf0e10cSrcweir pFlyFrm->Frm().Pos().X() == WEIT_WECH &&
3422cdf0e10cSrcweir pFlyFrm->Frm().Pos().Y() == WEIT_WECH )
3423cdf0e10cSrcweir {
3424cdf0e10cSrcweir SwObjectFormatter::FormatObj( *pFlyFrm );
3425cdf0e10cSrcweir }
3426cdf0e10cSrcweir // <--
3427cdf0e10cSrcweir pTmpFrm->Calc();
3428cdf0e10cSrcweir }
3429cdf0e10cSrcweir
3430cdf0e10cSrcweir // #127369#
3431cdf0e10cSrcweir // aIter.IsChanged checks if the current pTmpFrm has been deleted while
3432cdf0e10cSrcweir // it is the current iterator
3433cdf0e10cSrcweir // FrmHolder watches for deletion of the current pMinFrm
3434cdf0e10cSrcweir if( aIter.IsChanged() || ( aHolder.IsSet() && !aHolder.GetFrm() ) )
3435cdf0e10cSrcweir {
3436cdf0e10cSrcweir // restart iteration
3437cdf0e10cSrcweir bClientIterChanged = true;
3438cdf0e10cSrcweir break;
3439cdf0e10cSrcweir }
3440cdf0e10cSrcweir
3441cdf0e10cSrcweir // bei Flys ggfs. ueber den Parent gehen wenn sie selbst
3442cdf0e10cSrcweir // nocht nicht "formatiert" sind
3443cdf0e10cSrcweir if( !bCalcFrm && nFrmType & FRM_FLY &&
3444cdf0e10cSrcweir ((SwFlyFrm*)pTmpFrm)->GetAnchorFrm() &&
3445cdf0e10cSrcweir WEIT_WECH == pTmpFrm->Frm().Pos().X() &&
3446cdf0e10cSrcweir WEIT_WECH == pTmpFrm->Frm().Pos().Y() )
3447cdf0e10cSrcweir aCalcRect = ((SwFlyFrm*)pTmpFrm)->GetAnchorFrm()->Frm();
3448cdf0e10cSrcweir else
3449cdf0e10cSrcweir aCalcRect = pTmpFrm->Frm();
3450cdf0e10cSrcweir
3451cdf0e10cSrcweir if ( aCalcRect.IsInside( *pPoint ) )
3452cdf0e10cSrcweir {
3453cdf0e10cSrcweir pMinFrm = pTmpFrm;
3454cdf0e10cSrcweir break;
3455cdf0e10cSrcweir }
3456cdf0e10cSrcweir
3457cdf0e10cSrcweir // Point not in rectangle. Compare distances:
3458cdf0e10cSrcweir const Point aCalcRectCenter = aCalcRect.Center();
3459cdf0e10cSrcweir const Point aDiff = aCalcRectCenter - *pPoint;
3460cdf0e10cSrcweir const sal_uInt64 nCurrentDist = aDiff.X() * aDiff.X() + aDiff.Y() * aDiff.Y(); // opt: no sqrt
3461cdf0e10cSrcweir if ( !pMinFrm || nCurrentDist < nMinDist )
3462cdf0e10cSrcweir {
3463cdf0e10cSrcweir pMinFrm = pTmpFrm;
3464cdf0e10cSrcweir nMinDist = nCurrentDist;
3465cdf0e10cSrcweir }
3466cdf0e10cSrcweir }
3467cdf0e10cSrcweir else
3468cdf0e10cSrcweir {
3469cdf0e10cSrcweir // Wenn kein pPoint angegeben ist, dann reichen
3470cdf0e10cSrcweir // wir irgendeinen raus: den ersten!
3471cdf0e10cSrcweir pMinFrm = pTmpFrm;
3472cdf0e10cSrcweir break;
3473cdf0e10cSrcweir }
3474cdf0e10cSrcweir }
3475cdf0e10cSrcweir }
3476cdf0e10cSrcweir } while( bClientIterChanged );
3477cdf0e10cSrcweir
3478cdf0e10cSrcweir if( pPos && pMinFrm && pMinFrm->IsTxtFrm() )
3479cdf0e10cSrcweir return ((SwTxtFrm*)pMinFrm)->GetFrmAtPos( *pPos );
3480cdf0e10cSrcweir
3481cdf0e10cSrcweir return pMinFrm;
3482cdf0e10cSrcweir }
3483cdf0e10cSrcweir
IsExtraData(const SwDoc * pDoc)3484cdf0e10cSrcweir sal_Bool IsExtraData( const SwDoc *pDoc )
3485cdf0e10cSrcweir {
3486cdf0e10cSrcweir const SwLineNumberInfo &rInf = pDoc->GetLineNumberInfo();
3487cdf0e10cSrcweir return rInf.IsPaintLineNumbers() ||
3488cdf0e10cSrcweir rInf.IsCountInFlys() ||
3489cdf0e10cSrcweir ((sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE &&
3490cdf0e10cSrcweir pDoc->GetRedlineTbl().Count());
3491cdf0e10cSrcweir }
3492cdf0e10cSrcweir
3493cdf0e10cSrcweir // OD 22.09.2003 #110978#
PrtWithoutHeaderAndFooter() const3494cdf0e10cSrcweir const SwRect SwPageFrm::PrtWithoutHeaderAndFooter() const
3495cdf0e10cSrcweir {
3496cdf0e10cSrcweir SwRect aPrtWithoutHeaderFooter( Prt() );
3497cdf0e10cSrcweir aPrtWithoutHeaderFooter.Pos() += Frm().Pos();
3498cdf0e10cSrcweir
3499cdf0e10cSrcweir const SwFrm* pLowerFrm = Lower();
3500cdf0e10cSrcweir while ( pLowerFrm )
3501cdf0e10cSrcweir {
3502cdf0e10cSrcweir // Note: independent on text direction page header and page footer are
3503cdf0e10cSrcweir // always at top respectively at bottom of the page frame.
3504cdf0e10cSrcweir if ( pLowerFrm->IsHeaderFrm() )
3505cdf0e10cSrcweir {
3506cdf0e10cSrcweir aPrtWithoutHeaderFooter.Top( aPrtWithoutHeaderFooter.Top() +
3507cdf0e10cSrcweir pLowerFrm->Frm().Height() );
3508cdf0e10cSrcweir }
3509cdf0e10cSrcweir if ( pLowerFrm->IsFooterFrm() )
3510cdf0e10cSrcweir {
3511cdf0e10cSrcweir aPrtWithoutHeaderFooter.Bottom( aPrtWithoutHeaderFooter.Bottom() -
3512cdf0e10cSrcweir pLowerFrm->Frm().Height() );
3513cdf0e10cSrcweir }
3514cdf0e10cSrcweir
3515cdf0e10cSrcweir pLowerFrm = pLowerFrm->GetNext();
3516cdf0e10cSrcweir }
3517cdf0e10cSrcweir
3518cdf0e10cSrcweir return aPrtWithoutHeaderFooter;
3519cdf0e10cSrcweir }
3520cdf0e10cSrcweir
3521cdf0e10cSrcweir /** method to determine the spacing values of a frame
3522cdf0e10cSrcweir
3523cdf0e10cSrcweir OD 2004-03-10 #i28701#
3524cdf0e10cSrcweir OD 2009-08-28 #i102458#
3525cdf0e10cSrcweir Add output parameter <obIsLineSpacingProportional>
3526cdf0e10cSrcweir
3527cdf0e10cSrcweir @author OD
3528cdf0e10cSrcweir */
GetSpacingValuesOfFrm(const SwFrm & rFrm,SwTwips & onLowerSpacing,SwTwips & onLineSpacing,bool & obIsLineSpacingProportional)3529cdf0e10cSrcweir void GetSpacingValuesOfFrm( const SwFrm& rFrm,
3530cdf0e10cSrcweir SwTwips& onLowerSpacing,
3531cdf0e10cSrcweir SwTwips& onLineSpacing,
3532cdf0e10cSrcweir bool& obIsLineSpacingProportional )
3533cdf0e10cSrcweir {
3534cdf0e10cSrcweir if ( !rFrm.IsFlowFrm() )
3535cdf0e10cSrcweir {
3536cdf0e10cSrcweir onLowerSpacing = 0;
3537cdf0e10cSrcweir onLineSpacing = 0;
3538cdf0e10cSrcweir }
3539cdf0e10cSrcweir else
3540cdf0e10cSrcweir {
3541cdf0e10cSrcweir const SvxULSpaceItem& rULSpace = rFrm.GetAttrSet()->GetULSpace();
3542cdf0e10cSrcweir onLowerSpacing = rULSpace.GetLower();
3543cdf0e10cSrcweir
3544cdf0e10cSrcweir onLineSpacing = 0;
3545cdf0e10cSrcweir obIsLineSpacingProportional = false;
3546cdf0e10cSrcweir if ( rFrm.IsTxtFrm() )
3547cdf0e10cSrcweir {
3548cdf0e10cSrcweir onLineSpacing = static_cast<const SwTxtFrm&>(rFrm).GetLineSpace();
3549cdf0e10cSrcweir obIsLineSpacingProportional =
3550cdf0e10cSrcweir onLineSpacing != 0 &&
3551cdf0e10cSrcweir static_cast<const SwTxtFrm&>(rFrm).GetLineSpace( true ) == 0;
3552cdf0e10cSrcweir }
3553cdf0e10cSrcweir
3554cdf0e10cSrcweir ASSERT( onLowerSpacing >= 0 && onLineSpacing >= 0,
3555cdf0e10cSrcweir "<GetSpacingValuesOfFrm(..)> - spacing values aren't positive!" );
3556cdf0e10cSrcweir }
3557cdf0e10cSrcweir }
3558cdf0e10cSrcweir
3559cdf0e10cSrcweir /** method to get the content of the table cell, skipping content from nested tables
3560cdf0e10cSrcweir */
GetCellCntnt(const SwLayoutFrm & rCell)3561cdf0e10cSrcweir const SwCntntFrm* GetCellCntnt( const SwLayoutFrm& rCell )
3562cdf0e10cSrcweir {
3563cdf0e10cSrcweir const SwCntntFrm* pCntnt = rCell.ContainsCntnt();
3564cdf0e10cSrcweir const SwTabFrm* pTab = rCell.FindTabFrm();
3565cdf0e10cSrcweir
3566cdf0e10cSrcweir while ( pCntnt && rCell.IsAnLower( pCntnt ) )
3567cdf0e10cSrcweir {
3568cdf0e10cSrcweir const SwTabFrm* pTmpTab = pCntnt->FindTabFrm();
3569cdf0e10cSrcweir if ( pTmpTab != pTab )
3570cdf0e10cSrcweir {
3571cdf0e10cSrcweir pCntnt = pTmpTab->FindLastCntnt();
3572cdf0e10cSrcweir if ( pCntnt )
3573cdf0e10cSrcweir
3574cdf0e10cSrcweir pCntnt = pCntnt->FindNextCnt();
3575cdf0e10cSrcweir
3576cdf0e10cSrcweir }
3577cdf0e10cSrcweir else
3578cdf0e10cSrcweir break;
3579cdf0e10cSrcweir }
3580cdf0e10cSrcweir return pCntnt;
3581cdf0e10cSrcweir }
3582cdf0e10cSrcweir
3583cdf0e10cSrcweir /** Can be used to check if a frame has been deleted
3584cdf0e10cSrcweir */
HasBeenDeleted()3585cdf0e10cSrcweir bool SwDeletionChecker::HasBeenDeleted()
3586cdf0e10cSrcweir {
3587cdf0e10cSrcweir if ( !mpFrm || !mpRegIn )
3588cdf0e10cSrcweir return false;
3589cdf0e10cSrcweir
3590cdf0e10cSrcweir SwIterator<SwFrm,SwModify> aIter(*mpRegIn);
3591cdf0e10cSrcweir SwFrm* pLast = aIter.First();
3592cdf0e10cSrcweir while ( pLast )
3593cdf0e10cSrcweir {
3594cdf0e10cSrcweir if ( pLast == mpFrm )
3595cdf0e10cSrcweir return false;
3596cdf0e10cSrcweir pLast = aIter.Next();
3597cdf0e10cSrcweir }
3598cdf0e10cSrcweir
3599cdf0e10cSrcweir return true;
3600cdf0e10cSrcweir }
3601cdf0e10cSrcweir
3602cdf0e10cSrcweir
3603