Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "hintids.hxx"
30 : : #include <svl/itemiter.hxx>
31 : : #include <svtools/imap.hxx>
32 : : #include <vcl/graph.hxx>
33 : : #include <tools/poly.hxx>
34 : : #include <tools/helpers.hxx>
35 : : #include <svx/contdlg.hxx>
36 : : #include <editeng/protitem.hxx>
37 : : #include <editeng/opaqitem.hxx>
38 : : #include <editeng/ulspitem.hxx>
39 : : #include <editeng/lrspitem.hxx>
40 : : #include <editeng/frmdiritem.hxx>
41 : : #include <editeng/keepitem.hxx>
42 : : #include <fmtanchr.hxx>
43 : : #include <fmtfsize.hxx>
44 : : #include <fmtclds.hxx>
45 : : #include <fmtcntnt.hxx>
46 : : #include <fmturl.hxx>
47 : : #include <fmtsrnd.hxx>
48 : : #include <fmtornt.hxx>
49 : : #include <fmtpdsc.hxx>
50 : : #include <fmtcnct.hxx>
51 : : #include <layhelp.hxx>
52 : : #include <ndtxt.hxx>
53 : : #include <svx/svdogrp.hxx>
54 : : #include <ndgrf.hxx>
55 : : #include <tolayoutanchoredobjectposition.hxx>
56 : : #include <fmtfollowtextflow.hxx>
57 : : #include <sortedobjs.hxx>
58 : : #include <objectformatter.hxx>
59 : : #include <anchoredobject.hxx>
60 : : #include <ndole.hxx>
61 : : #include <swtable.hxx>
62 : : #include <svx/svdpage.hxx>
63 : : #include "doc.hxx"
64 : : #include "viewsh.hxx"
65 : : #include "layouter.hxx"
66 : : #include "pagefrm.hxx"
67 : : #include "rootfrm.hxx"
68 : : #include "cntfrm.hxx"
69 : : #include "pam.hxx"
70 : : #include "frmatr.hxx"
71 : : #include "viewimp.hxx"
72 : : #include "viewopt.hxx"
73 : : #include "dcontact.hxx"
74 : : #include "dflyobj.hxx"
75 : : #include "dview.hxx"
76 : : #include "flyfrm.hxx"
77 : : #include "frmtool.hxx"
78 : : #include "frmfmt.hxx"
79 : : #include "hints.hxx"
80 : : #include "swregion.hxx"
81 : : #include "tabfrm.hxx"
82 : : #include "txtfrm.hxx"
83 : : #include "ndnotxt.hxx"
84 : : #include "notxtfrm.hxx" // GetGrfArea
85 : : #include "flyfrms.hxx"
86 : : #include "ndindex.hxx" // GetGrfArea
87 : : #include "sectfrm.hxx"
88 : : #include <vcl/svapp.hxx>
89 : : #include "switerator.hxx"
90 : :
91 : : using namespace ::com::sun::star;
92 : :
93 : :
94 [ + + ][ + + ]: 62843 : TYPEINIT2(SwFlyFrm,SwLayoutFrm,SwAnchoredObject);
[ - + ]
95 : :
96 : : /*************************************************************************
97 : : |*
98 : : |* SwFlyFrm::SwFlyFrm()
99 : : |*
100 : : |*************************************************************************/
101 : :
102 : 611 : SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) :
103 : : SwLayoutFrm( pFmt, pSib ),
104 : : SwAnchoredObject(), // #i26791#
105 : : pPrevLink( 0 ),
106 : : pNextLink( 0 ),
107 : : bInCnt( sal_False ),
108 : : bAtCnt( sal_False ),
109 : : bLayout( sal_False ),
110 : : bAutoPosition( sal_False ),
111 : : bNoShrink( sal_False ),
112 [ + - ]: 611 : bLockDeleteContent( sal_False )
113 : : {
114 : 611 : nType = FRMC_FLY;
115 : :
116 : 611 : bInvalid = bNotifyBack = sal_True;
117 : : bLocked = bMinHeight =
118 : 611 : bHeightClipped = bWidthClipped = bFormatHeightOnly = sal_False;
119 : :
120 : : //Grosseneinstellung, Fixe groesse ist immer die Breite
121 [ + - ]: 611 : const SwFmtFrmSize &rFrmSize = pFmt->GetFrmSize();
122 : : sal_uInt16 nDir =
123 [ + - ]: 611 : ((SvxFrameDirectionItem&)pFmt->GetFmtAttr( RES_FRAMEDIR )).GetValue();
124 [ + - ]: 611 : if( FRMDIR_ENVIRONMENT == nDir )
125 : : {
126 : 611 : bDerivedVert = 1;
127 : 611 : bDerivedR2L = 1;
128 : : }
129 : : else
130 : : {
131 : 0 : bInvalidVert = 0;
132 : 0 : bDerivedVert = 0;
133 : 0 : bDerivedR2L = 0;
134 [ # # ][ # # ]: 0 : if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir )
135 : : {
136 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
137 : 0 : bVertLR = 0;
138 : 0 : bVertical = 0;
139 : : }
140 : : else
141 : : {
142 [ # # ]: 0 : const ViewShell *pSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0;
143 [ # # ][ # # ]: 0 : if( pSh && pSh->GetViewOptions()->getBrowseMode() )
[ # # ]
144 : : {
145 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
146 : 0 : bVertLR = 0;
147 : 0 : bVertical = 0;
148 : : }
149 : : else
150 : : {
151 : 0 : bVertical = 1;
152 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
153 [ # # ]: 0 : if ( FRMDIR_VERT_TOP_LEFT == nDir )
154 : 0 : bVertLR = 1;
155 : : else
156 : 0 : bVertLR = 0;
157 : : }
158 : : }
159 : :
160 : 0 : bInvalidR2L = 0;
161 [ # # ]: 0 : if( FRMDIR_HORI_RIGHT_TOP == nDir )
162 : 0 : bRightToLeft = 1;
163 : : else
164 : 0 : bRightToLeft = 0;
165 : : }
166 : :
167 : 611 : Frm().Width( rFrmSize.GetWidth() );
168 [ + + ]: 611 : Frm().Height( rFrmSize.GetHeightSizeType() == ATT_VAR_SIZE ? MINFLY : rFrmSize.GetHeight() );
169 : :
170 : : // Fixed or variable Height?
171 [ + + ]: 611 : if ( rFrmSize.GetHeightSizeType() == ATT_MIN_SIZE )
172 : 4 : bMinHeight = sal_True;
173 [ + + ]: 607 : else if ( rFrmSize.GetHeightSizeType() == ATT_FIX_SIZE )
174 : 38 : bFixSize = sal_True;
175 : :
176 : : // insert columns, if necessary
177 [ + - ]: 611 : InsertColumns();
178 : :
179 : : //Erst das Init, dann den Inhalt, denn zum Inhalt koennen widerum
180 : : //Objekte/Rahmen gehoeren die dann angemeldet werden.
181 [ + - ]: 611 : InitDrawObj( sal_False );
182 : :
183 [ + - ]: 611 : Chain( pAnch );
184 : :
185 [ + - ]: 611 : InsertCnt();
186 : :
187 : : //Und erstmal in den Wald stellen die Kiste, damit bei neuen Dokument nicht
188 : : //unnoetig viel formatiert wird.
189 : 611 : Frm().Pos().X() = Frm().Pos().Y() = FAR_AWAY;
190 : 611 : }
191 : :
192 : 611 : void SwFlyFrm::Chain( SwFrm* _pAnch )
193 : : {
194 : : // Connect to chain neighboors.
195 : : // No problem, if a neighboor doesn't exist - the construction of the
196 : : // neighboor will make the connection
197 : 611 : const SwFmtChain& rChain = GetFmt()->GetChain();
198 [ - + ][ - + ]: 611 : if ( rChain.GetPrev() || rChain.GetNext() )
[ + - ]
199 : : {
200 [ # # ]: 0 : if ( rChain.GetNext() )
201 : : {
202 : 0 : SwFlyFrm* pFollow = FindChainNeighbour( *rChain.GetNext(), _pAnch );
203 [ # # ]: 0 : if ( pFollow )
204 : : {
205 : : OSL_ENSURE( !pFollow->GetPrevLink(), "wrong chain detected" );
206 [ # # ]: 0 : if ( !pFollow->GetPrevLink() )
207 : 0 : SwFlyFrm::ChainFrames( this, pFollow );
208 : : }
209 : : }
210 [ # # ]: 0 : if ( rChain.GetPrev() )
211 : : {
212 : 0 : SwFlyFrm *pMaster = FindChainNeighbour( *rChain.GetPrev(), _pAnch );
213 [ # # ]: 0 : if ( pMaster )
214 : : {
215 : : OSL_ENSURE( !pMaster->GetNextLink(), "wrong chain detected" );
216 [ # # ]: 0 : if ( !pMaster->GetNextLink() )
217 : 0 : SwFlyFrm::ChainFrames( pMaster, this );
218 : : }
219 : : }
220 : : }
221 : 611 : }
222 : :
223 : 611 : void SwFlyFrm::InsertCnt()
224 : : {
225 [ + - ]: 611 : if ( !GetPrevLink() )
226 : : {
227 : 611 : const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt();
228 : : OSL_ENSURE( rCntnt.GetCntntIdx(), ":-( no content prepared." );
229 : 611 : sal_uLong nIndex = rCntnt.GetCntntIdx()->GetIndex();
230 : : // Lower() bedeutet SwColumnFrm, eingefuegt werden muss der Inhalt dann in den (Column)BodyFrm
231 : 611 : ::_InsertCnt( Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower() : (SwLayoutFrm*)this,
232 [ - + ]: 1222 : GetFmt()->GetDoc(), nIndex );
233 : :
234 : : // NoTxt always have a fixed height.
235 [ + + ][ + + ]: 611 : if ( Lower() && Lower()->IsNoTxtFrm() )
[ + - ]
236 : : {
237 : 487 : bFixSize = sal_True;
238 : 487 : bMinHeight = sal_False;
239 : : }
240 : : }
241 : 611 : }
242 : :
243 : 611 : void SwFlyFrm::InsertColumns()
244 : : {
245 : : // #i97379#
246 : : // Check, if column are allowed.
247 : : // Columns are not allowed for fly frames, which represent graphics or embedded objects.
248 [ + - ][ + - ]: 611 : const SwFmtCntnt& rCntnt = GetFmt()->GetCntnt();
249 : : OSL_ENSURE( rCntnt.GetCntntIdx(), "<SwFlyFrm::InsertColumns()> - no content prepared." );
250 [ + - ]: 611 : SwNodeIndex aFirstCntnt( *(rCntnt.GetCntntIdx()), 1 );
251 [ + + ]: 611 : if ( aFirstCntnt.GetNode().IsNoTxtNode() )
252 : : {
253 : 611 : return;
254 : : }
255 : :
256 [ + - ][ + - ]: 124 : const SwFmtCol &rCol = GetFmt()->GetCol();
257 [ + - ][ - + ]: 124 : if ( rCol.GetNumCols() > 1 )
258 : : {
259 : : //PrtArea ersteinmal so gross wie der Frm, damit die Spalten
260 : : //vernuenftig eingesetzt werden koennen; das schaukelt sich dann
261 : : //schon zurecht.
262 : 0 : Prt().Width( Frm().Width() );
263 : 0 : Prt().Height( Frm().Height() );
264 [ # # ]: 0 : const SwFmtCol aOld; //ChgColumns() verlaesst sich darauf, dass auch ein
265 : : //Old-Wert hereingereicht wird.
266 [ # # ][ # # ]: 124 : ChgColumns( aOld, rCol );
267 [ + - ][ + + ]: 611 : }
268 : : }
269 : :
270 : : /*************************************************************************
271 : : |*
272 : : |* SwFlyFrm::~SwFlyFrm()
273 : : |*
274 : : |*************************************************************************/
275 : :
276 [ + - ]: 521 : SwFlyFrm::~SwFlyFrm()
277 : : {
278 : : // Accessible objects for fly frames will be destroyed in this destructor.
279 : : // For frames bound as char or frames that don't have an anchor we have
280 : : // to do that ourselves. For any other frame the call RemoveFly at the
281 : : // anchor will do that.
282 [ + - ][ + - ]: 521 : if( IsAccessibleFrm() && GetFmt() && (IsFlyInCntFrm() || !GetAnchorFrm()) )
[ + + ][ + - ]
[ - + ][ + + ]
283 : : {
284 : 377 : SwRootFrm *pRootFrm = getRootFrm();
285 [ - + ][ - + ]: 377 : if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
[ + - ]
286 : : {
287 : 0 : ViewShell *pVSh = pRootFrm->GetCurrShell();
288 [ # # ][ # # ]: 0 : if( pVSh && pVSh->Imp() )
[ # # ]
289 : : {
290 : : // Lowers aren't disposed already, so we have to do a recursive
291 : : // dispose
292 [ # # ]: 0 : pVSh->Imp()->DisposeAccessibleFrm( this, sal_True );
293 : : }
294 : : }
295 : : }
296 : :
297 [ + - ][ + - ]: 521 : if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
[ + - ]
298 : : {
299 : : // OD 2004-01-19 #110582#
300 [ + - ]: 521 : Unchain();
301 : :
302 : : // OD 2004-01-19 #110582#
303 [ + - ]: 521 : DeleteCnt();
304 : :
305 : : //Tschuess sagen.
306 [ + - ][ + - ]: 521 : if ( GetAnchorFrm() )
307 [ + - ][ + - ]: 521 : AnchorFrm()->RemoveFly( this );
308 : : }
309 : :
310 [ + - ]: 521 : FinitDrawObj();
311 [ - + ]: 521 : }
312 : :
313 : 0 : const IDocumentDrawModelAccess* SwFlyFrm::getIDocumentDrawModelAccess()
314 : : {
315 : 0 : return GetFmt()->getIDocumentDrawModelAccess();
316 : : }
317 : :
318 : : // OD 2004-01-19 #110582#
319 : 521 : void SwFlyFrm::Unchain()
320 : : {
321 [ - + ]: 521 : if ( GetPrevLink() )
322 : 0 : UnchainFrames( GetPrevLink(), this );
323 [ - + ]: 521 : if ( GetNextLink() )
324 : 0 : UnchainFrames( this, GetNextLink() );
325 : 521 : }
326 : :
327 : : // OD 2004-01-19 #110582#
328 : 521 : void SwFlyFrm::DeleteCnt()
329 : : {
330 : : // #110582#-2
331 [ - + ]: 521 : if ( IsLockDeleteContent() )
332 : 521 : return;
333 : :
334 : 521 : SwFrm* pFrm = pLower;
335 [ + + ]: 1060 : while ( pFrm )
336 : : {
337 [ - + ][ # # ]: 539 : while ( pFrm->GetDrawObjs() && pFrm->GetDrawObjs()->Count() )
[ - + ]
338 : : {
339 : 0 : SwAnchoredObject *pAnchoredObj = (*pFrm->GetDrawObjs())[0];
340 [ # # ]: 0 : if ( pAnchoredObj->ISA(SwFlyFrm) )
341 [ # # ]: 0 : delete pAnchoredObj;
342 [ # # ]: 0 : else if ( pAnchoredObj->ISA(SwAnchoredDrawObject) )
343 : : {
344 : : // OD 23.06.2003 #108784# - consider 'virtual' drawing objects
345 : 0 : SdrObject* pObj = pAnchoredObj->DrawObj();
346 [ # # ]: 0 : if ( pObj->ISA(SwDrawVirtObj) )
347 : : {
348 : 0 : SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
349 : 0 : pDrawVirtObj->RemoveFromWriterLayout();
350 : 0 : pDrawVirtObj->RemoveFromDrawingPage();
351 : : }
352 : : else
353 : : {
354 : : SwDrawContact* pContact =
355 : 0 : static_cast<SwDrawContact*>(::GetUserCall( pObj ));
356 [ # # ]: 0 : if ( pContact )
357 : : {
358 : 0 : pContact->DisconnectFromLayout();
359 : : }
360 : : }
361 : : }
362 : : }
363 : :
364 : 539 : pFrm->Remove();
365 [ + - ]: 539 : delete pFrm;
366 : 539 : pFrm = pLower;
367 : : }
368 : :
369 : 521 : InvalidatePage();
370 : : }
371 : :
372 : : /*************************************************************************
373 : : |*
374 : : |* SwFlyFrm::InitDrawObj()
375 : : |*
376 : : |*************************************************************************/
377 : :
378 : 552 : sal_uInt32 SwFlyFrm::_GetOrdNumForNewRef( const SwFlyDrawContact* pContact )
379 : : {
380 : 552 : sal_uInt32 nOrdNum( 0L );
381 : :
382 : : // search for another Writer fly frame registered at same frame format
383 [ + - ]: 552 : SwIterator<SwFlyFrm,SwFmt> aIter( *pContact->GetFmt() );
384 : 552 : const SwFlyFrm* pFlyFrm( 0L );
385 [ + - ][ + - ]: 1104 : for ( pFlyFrm = aIter.First(); pFlyFrm; pFlyFrm = aIter.Next() )
[ + + ]
386 : : {
387 [ - + ]: 552 : if ( pFlyFrm != this )
388 : : {
389 : 0 : break;
390 : : }
391 : : }
392 : :
393 [ - + ]: 552 : if ( pFlyFrm )
394 : : {
395 : : // another Writer fly frame found. Take its order number
396 [ # # ][ # # ]: 0 : nOrdNum = pFlyFrm->GetVirtDrawObj()->GetOrdNum();
397 : : }
398 : : else
399 : : {
400 : : // no other Writer fly frame found. Take order number of 'master' object
401 : : // #i35748# - use method <GetOrdNumDirect()> instead
402 : : // of method <GetOrdNum()> to avoid a recalculation of the order number,
403 : : // which isn't intended.
404 [ + - ][ + - ]: 552 : nOrdNum = pContact->GetMaster()->GetOrdNumDirect();
405 : : }
406 : :
407 [ + - ]: 552 : return nOrdNum;
408 : : }
409 : :
410 : 611 : SwVirtFlyDrawObj* SwFlyFrm::CreateNewRef( SwFlyDrawContact *pContact )
411 : : {
412 [ + - ]: 611 : SwVirtFlyDrawObj *pDrawObj = new SwVirtFlyDrawObj( *pContact->GetMaster(), this );
413 : 611 : pDrawObj->SetModel( pContact->GetMaster()->GetModel() );
414 : 611 : pDrawObj->SetUserCall( pContact );
415 : :
416 : : //Der Reader erzeugt die Master und setzt diese, um die Z-Order zu
417 : : //transportieren, in die Page ein. Beim erzeugen der ersten Referenz werden
418 : : //die Master aus der Liste entfernt und fuehren von da an ein
419 : : //Schattendasein.
420 : 611 : SdrPage* pPg( 0L );
421 [ + + ]: 611 : if ( 0 != ( pPg = pContact->GetMaster()->GetPage() ) )
422 : : {
423 : 59 : const sal_uInt32 nOrdNum = pContact->GetMaster()->GetOrdNum();
424 : 59 : pPg->ReplaceObject( pDrawObj, nOrdNum );
425 : : }
426 : : // #i27030# - insert new <SwVirtFlyDrawObj> instance
427 : : // into drawing page with correct order number
428 : : else
429 : : {
430 : 552 : pContact->GetFmt()->getIDocumentDrawModelAccess()->GetDrawModel()->GetPage( 0 )->
431 : 552 : InsertObject( pDrawObj, _GetOrdNumForNewRef( pContact ) );
432 : : }
433 : : // #i38889# - assure, that new <SwVirtFlyDrawObj> instance
434 : : // is in a visible layer.
435 : 611 : pContact->MoveObjToVisibleLayer( pDrawObj );
436 : 611 : return pDrawObj;
437 : : }
438 : :
439 : :
440 : :
441 : 611 : void SwFlyFrm::InitDrawObj( sal_Bool bNotify )
442 : : {
443 : : //ContactObject aus dem Format suchen. Wenn bereits eines existiert, so
444 : : //braucht nur eine neue Ref erzeugt werden, anderfalls ist es jetzt an
445 : : //der Zeit das Contact zu erzeugen.
446 : :
447 : 611 : IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
448 : 611 : SwFlyDrawContact *pContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *GetFmt() );
449 [ + + ]: 611 : if ( !pContact )
450 : : {
451 : : // #i52858# - method name changed
452 : 540 : pContact = new SwFlyDrawContact( (SwFlyFrmFmt*)GetFmt(),
453 [ + - ]: 540 : pIDDMA->GetOrCreateDrawModel() );
454 : : }
455 : : OSL_ENSURE( pContact, "InitDrawObj failed" );
456 : : // OD 2004-03-22 #i26791#
457 : 611 : SetDrawObj( *(CreateNewRef( pContact )) );
458 : :
459 : : //Den richtigen Layer setzen.
460 : : // OD 2004-01-19 #110582#
461 : 611 : SdrLayerID nHeavenId = pIDDMA->GetHeavenId();
462 : 611 : SdrLayerID nHellId = pIDDMA->GetHellId();
463 : : // OD 2004-03-22 #i26791#
464 : 611 : GetVirtDrawObj()->SetLayer( GetFmt()->GetOpaque().GetValue()
465 : : ? nHeavenId
466 [ + + ]: 611 : : nHellId );
467 [ - + ]: 611 : if ( bNotify )
468 : 0 : NotifyDrawObj();
469 : 611 : }
470 : :
471 : : /*************************************************************************
472 : : |*
473 : : |* SwFlyFrm::FinitDrawObj()
474 : : |*
475 : : |*************************************************************************/
476 : :
477 : 521 : void SwFlyFrm::FinitDrawObj()
478 : : {
479 [ - + ]: 521 : if ( !GetVirtDrawObj() )
480 : 521 : return;
481 : :
482 : : //Bei den SdrPageViews abmelden falls das Objekt dort noch selektiert ist.
483 [ + - ]: 521 : if ( !GetFmt()->GetDoc()->IsInDtor() )
484 : : {
485 : 521 : ViewShell *p1St = getRootFrm()->GetCurrShell();
486 [ + + ]: 521 : if ( p1St )
487 : : {
488 : 18 : ViewShell *pSh = p1St;
489 [ - + ]: 18 : do
490 : : { //z.Zt. kann das Drawing nur ein Unmark auf alles, weil das
491 : : //Objekt bereits Removed wurde.
492 [ + - ]: 18 : if( pSh->HasDrawView() )
493 : 18 : pSh->Imp()->GetDrawView()->UnmarkAll();
494 : 18 : pSh = (ViewShell*)pSh->GetNext();
495 : :
496 : : } while ( pSh != p1St );
497 : : }
498 : : }
499 : :
500 : : //VirtObject mit in das Grab nehmen. Wenn das letzte VirObject
501 : : //zerstoert wird, mussen das DrawObject und DrawContact ebenfalls
502 : : //zerstoert werden.
503 : 521 : SwFlyDrawContact *pMyContact = 0;
504 [ + - ]: 521 : if ( GetFmt() )
505 : : {
506 : 521 : bool bContinue = true;
507 [ + - ][ + - ]: 521 : SwIterator<SwFrm,SwFmt> aFrmIter( *GetFmt() );
508 [ + - ][ + - ]: 1042 : for ( SwFrm* pFrm = aFrmIter.First(); pFrm; pFrm = aFrmIter.Next() )
[ + + ]
509 [ - + ]: 521 : if ( pFrm != this )
510 : : {
511 : : // don't delete Contact if there is still a Frm
512 : 0 : bContinue = false;
513 : 0 : break;
514 : : }
515 : :
516 [ + - ]: 521 : if ( bContinue )
517 : : // no Frm left, find Contact object to destroy
518 [ + - ][ + - ]: 521 : pMyContact = SwIterator<SwFlyDrawContact,SwFmt>::FirstElement( *GetFmt() );
[ + - ]
519 : : }
520 : :
521 : : // OD, OS 2004-03-31 #116203# - clear user call of Writer fly frame 'master'
522 : : // <SdrObject> to assure, that a <SwXFrame::dispose()> doesn't delete the
523 : : // Writer fly frame again.
524 [ + - ]: 521 : if ( pMyContact )
525 : : {
526 : 521 : pMyContact->GetMaster()->SetUserCall( 0 );
527 : : }
528 : 521 : GetVirtDrawObj()->SetUserCall( 0 ); //Ruft sonst Delete des ContactObj
529 [ + - ]: 521 : delete GetVirtDrawObj(); //Meldet sich selbst beim Master ab.
530 [ + - ]: 521 : delete pMyContact; //zerstoert den Master selbst.
531 : : }
532 : :
533 : : /*************************************************************************
534 : : |*
535 : : |* SwFlyFrm::ChainFrames()
536 : : |*
537 : : |*************************************************************************/
538 : :
539 : 0 : void SwFlyFrm::ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow )
540 : : {
541 : : OSL_ENSURE( pMaster && pFollow, "uncomplete chain" );
542 : : OSL_ENSURE( !pMaster->GetNextLink(), "link can not be changed" );
543 : : OSL_ENSURE( !pFollow->GetPrevLink(), "link can not be changed" );
544 : :
545 : 0 : pMaster->pNextLink = pFollow;
546 : 0 : pFollow->pPrevLink = pMaster;
547 : :
548 [ # # ]: 0 : if ( pMaster->ContainsCntnt() )
549 : : {
550 : : //Damit ggf. ein Textfluss zustande kommt muss invalidiert werden.
551 : 0 : SwFrm *pInva = pMaster->FindLastLower();
552 [ # # ][ # # ]: 0 : SWRECTFN( pMaster )
[ # # ][ # # ]
553 [ # # ]: 0 : const long nBottom = (pMaster->*fnRect->fnGetPrtBottom)();
554 [ # # ]: 0 : while ( pInva )
555 : : {
556 [ # # ][ # # ]: 0 : if( (pInva->Frm().*fnRect->fnBottomDist)( nBottom ) <= 0 )
557 : : {
558 : 0 : pInva->InvalidateSize();
559 : 0 : pInva->Prepare( PREP_CLEAR );
560 : 0 : pInva = pInva->FindPrev();
561 : : }
562 : : else
563 : 0 : pInva = 0;
564 : : }
565 : : }
566 : :
567 [ # # ]: 0 : if ( pFollow->ContainsCntnt() )
568 : : {
569 : : //Es gibt nur noch den Inhalt des Masters, der Inhalt vom Follow
570 : : //hat keine Frames mehr (sollte immer nur genau ein leerer TxtNode sein).
571 : 0 : SwFrm *pFrm = pFollow->ContainsCntnt();
572 : : OSL_ENSURE( !pFrm->IsTabFrm() && !pFrm->FindNext(), "follow in chain contains content" );
573 : 0 : pFrm->Cut();
574 [ # # ]: 0 : delete pFrm;
575 : : }
576 : :
577 : : // invalidate accessible relation set (accessibility wrapper)
578 : 0 : ViewShell* pSh = pMaster->getRootFrm()->GetCurrShell();
579 [ # # ]: 0 : if( pSh )
580 : : {
581 : 0 : SwRootFrm* pLayout = pMaster->getRootFrm();
582 [ # # ][ # # ]: 0 : if( pLayout && pLayout->IsAnyShellAccessible() )
[ # # ]
583 : 0 : pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow );
584 : : }
585 : 0 : }
586 : :
587 : 0 : void SwFlyFrm::UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow )
588 : : {
589 : 0 : pMaster->pNextLink = 0;
590 : 0 : pFollow->pPrevLink = 0;
591 : :
592 [ # # ]: 0 : if ( pFollow->ContainsCntnt() )
593 : : {
594 : : //Der Master saugt den Inhalt vom Follow auf
595 : 0 : SwLayoutFrm *pUpper = pMaster;
596 [ # # ]: 0 : if ( pUpper->Lower()->IsColumnFrm() )
597 : : {
598 : 0 : pUpper = static_cast<SwLayoutFrm*>(pUpper->GetLastLower());
599 : 0 : pUpper = static_cast<SwLayoutFrm*>(pUpper->Lower()); // der (Column)BodyFrm
600 : : OSL_ENSURE( pUpper && pUpper->IsColBodyFrm(), "Missing ColumnBody" );
601 : : }
602 : 0 : SwFlyFrm *pFoll = pFollow;
603 [ # # ]: 0 : while ( pFoll )
604 : : {
605 : 0 : SwFrm *pTmp = ::SaveCntnt( pFoll );
606 [ # # ]: 0 : if ( pTmp )
607 : 0 : ::RestoreCntnt( pTmp, pUpper, pMaster->FindLastLower(), true );
608 : 0 : pFoll->SetCompletePaint();
609 : 0 : pFoll->InvalidateSize();
610 : 0 : pFoll = pFoll->GetNextLink();
611 : : }
612 : : }
613 : :
614 : : //Der Follow muss mit seinem eigenen Inhalt versorgt werden.
615 : 0 : const SwFmtCntnt &rCntnt = pFollow->GetFmt()->GetCntnt();
616 : : OSL_ENSURE( rCntnt.GetCntntIdx(), ":-( Kein Inhalt vorbereitet." );
617 : 0 : sal_uLong nIndex = rCntnt.GetCntntIdx()->GetIndex();
618 : : // Lower() bedeutet SwColumnFrm, dieser beinhaltet wieder einen SwBodyFrm
619 : 0 : ::_InsertCnt( pFollow->Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)pFollow->Lower())->Lower()
620 : : : (SwLayoutFrm*)pFollow,
621 [ # # ]: 0 : pFollow->GetFmt()->GetDoc(), ++nIndex );
622 : :
623 : : // invalidate accessible relation set (accessibility wrapper)
624 : 0 : ViewShell* pSh = pMaster->getRootFrm()->GetCurrShell();
625 [ # # ]: 0 : if( pSh )
626 : : {
627 : 0 : SwRootFrm* pLayout = pMaster->getRootFrm();
628 [ # # ][ # # ]: 0 : if( pLayout && pLayout->IsAnyShellAccessible() )
[ # # ]
629 : 0 : pSh->Imp()->InvalidateAccessibleRelationSet( pMaster, pFollow );
630 : : }
631 : 0 : }
632 : :
633 : : /*************************************************************************
634 : : |*
635 : : |* SwFlyFrm::FindChainNeighbour()
636 : : |*
637 : : |*************************************************************************/
638 : :
639 : 0 : SwFlyFrm *SwFlyFrm::FindChainNeighbour( SwFrmFmt &rChain, SwFrm *pAnch )
640 : : {
641 : : //Wir suchen denjenigen Fly, der in dem selben Bereich steht.
642 : : //Bereiche koennen zunaechst nur Kopf-/Fusszeilen oder Flys sein.
643 : :
644 [ # # ]: 0 : if ( !pAnch ) //Wenn ein Anchor uebergeben Wurde zaehlt dieser: Ctor!
645 [ # # ]: 0 : pAnch = AnchorFrm();
646 : :
647 : : SwLayoutFrm *pLay;
648 [ # # ][ # # ]: 0 : if ( pAnch->IsInFly() )
649 [ # # ]: 0 : pLay = pAnch->FindFlyFrm();
650 : : else
651 : : {
652 : : //FindFooterOrHeader taugt hier nicht, weil evtl. noch keine Verbindung
653 : : //zum Anker besteht.
654 : 0 : pLay = pAnch->GetUpper();
655 [ # # ][ # # ]: 0 : while ( pLay && !(pLay->GetType() & (FRM_HEADER|FRM_FOOTER)) )
[ # # ]
656 : 0 : pLay = pLay->GetUpper();
657 : : }
658 : :
659 [ # # ]: 0 : SwIterator<SwFlyFrm,SwFmt> aIter( rChain );
660 [ # # ]: 0 : SwFlyFrm *pFly = aIter.First();
661 [ # # ]: 0 : if ( pLay )
662 : : {
663 [ # # ]: 0 : while ( pFly )
664 : : {
665 [ # # ][ # # ]: 0 : if ( pFly->GetAnchorFrm() )
666 : : {
667 [ # # ][ # # ]: 0 : if ( pFly->GetAnchorFrm()->IsInFly() )
[ # # ]
668 : : {
669 [ # # ][ # # ]: 0 : if ( pFly->AnchorFrm()->FindFlyFrm() == pLay )
[ # # ]
670 : 0 : break;
671 : : }
672 [ # # ][ # # ]: 0 : else if ( pLay == pFly->FindFooterOrHeader() )
673 : 0 : break;
674 : : }
675 [ # # ]: 0 : pFly = aIter.Next();
676 : : }
677 : : }
678 : : else if ( pFly )
679 : : {
680 : : OSL_ENSURE( !aIter.Next(), "chain with more than one inkarnation" );
681 : : }
682 [ # # ]: 0 : return pFly;
683 : : }
684 : :
685 : :
686 : : /*************************************************************************
687 : : |*
688 : : |* SwFlyFrm::FindLastLower()
689 : : |*
690 : : |*************************************************************************/
691 : :
692 : 0 : SwFrm *SwFlyFrm::FindLastLower()
693 : : {
694 : 0 : SwFrm *pRet = ContainsAny();
695 [ # # ][ # # ]: 0 : if ( pRet && pRet->IsInTab() )
[ # # ]
696 : 0 : pRet = pRet->FindTabFrm();
697 : 0 : SwFrm *pNxt = pRet;
698 [ # # ][ # # ]: 0 : while ( pNxt && IsAnLower( pNxt ) )
[ # # ]
699 : 0 : { pRet = pNxt;
700 : 0 : pNxt = pNxt->FindNext();
701 : : }
702 : 0 : return pRet;
703 : : }
704 : :
705 : :
706 : : /*************************************************************************
707 : : |*
708 : : |* SwFlyFrm::FrmSizeChg()
709 : : |*
710 : : |*************************************************************************/
711 : :
712 : 36 : sal_Bool SwFlyFrm::FrmSizeChg( const SwFmtFrmSize &rFrmSize )
713 : : {
714 : 36 : sal_Bool bRet = sal_False;
715 : 36 : SwTwips nDiffHeight = Frm().Height();
716 [ + + ]: 36 : if ( rFrmSize.GetHeightSizeType() == ATT_VAR_SIZE )
717 : 32 : bFixSize = bMinHeight = sal_False;
718 : : else
719 : : {
720 [ + + ]: 4 : if ( rFrmSize.GetHeightSizeType() == ATT_FIX_SIZE )
721 : : {
722 : 2 : bFixSize = sal_True;
723 : 2 : bMinHeight = sal_False;
724 : : }
725 [ + - ]: 2 : else if ( rFrmSize.GetHeightSizeType() == ATT_MIN_SIZE )
726 : : {
727 : 2 : bFixSize = sal_False;
728 : 2 : bMinHeight = sal_True;
729 : : }
730 : 4 : nDiffHeight -= rFrmSize.GetHeight();
731 : : }
732 : : //Wenn der Fly Spalten enthaehlt muessen der Fly und
733 : : //die Spalten schon einmal auf die Wunschwerte gebracht
734 : : //werden, sonst haben wir ein kleines Problem.
735 [ + - ]: 36 : if ( Lower() )
736 : : {
737 [ - + ]: 36 : if ( Lower()->IsColumnFrm() )
738 : : {
739 [ # # ]: 0 : const SwRect aOld( GetObjRectWithSpaces() );
740 : 0 : const Size aOldSz( Prt().SSize() );
741 : 0 : const SwTwips nDiffWidth = Frm().Width() - rFrmSize.GetWidth();
742 : 0 : aFrm.Height( aFrm.Height() - nDiffHeight );
743 : 0 : aFrm.Width ( aFrm.Width() - nDiffWidth );
744 : : // #i68520#
745 : 0 : InvalidateObjRectWithSpaces();
746 : 0 : aPrt.Height( aPrt.Height() - nDiffHeight );
747 : 0 : aPrt.Width ( aPrt.Width() - nDiffWidth );
748 [ # # ]: 0 : ChgLowersProp( aOldSz );
749 [ # # ][ # # ]: 0 : ::Notify( this, FindPageFrm(), aOld );
750 : 0 : bValidPos = sal_False;
751 : 0 : bRet = sal_True;
752 : : }
753 [ + + ]: 36 : else if ( Lower()->IsNoTxtFrm() )
754 : : {
755 : 22 : bFixSize = sal_True;
756 : 22 : bMinHeight = sal_False;
757 : : }
758 : : }
759 : 36 : return bRet;
760 : : }
761 : :
762 : : /*************************************************************************
763 : : |*
764 : : |* SwFlyFrm::Modify()
765 : : |*
766 : : |*************************************************************************/
767 : :
768 : 150 : void SwFlyFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
769 : : {
770 : 150 : sal_uInt8 nInvFlags = 0;
771 : :
772 [ + - ][ + + ]: 150 : if( pNew && RES_ATTRSET_CHG == pNew->Which() )
[ + + ]
773 : : {
774 [ + - ]: 62 : SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
775 [ + - ]: 62 : SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
776 [ + - ]: 62 : SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
777 [ + - ]: 62 : SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
778 : 0 : while( sal_True )
779 : : {
780 : : _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
781 : : (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
782 [ + - ]: 62 : &aOldSet, &aNewSet );
783 [ + - ]: 62 : if( aNIter.IsAtEnd() )
784 : 62 : break;
785 [ # # ]: 0 : aNIter.NextItem();
786 [ # # ]: 0 : aOIter.NextItem();
787 : : }
788 [ + - ][ - + ]: 62 : if ( aOldSet.Count() || aNewSet.Count() )
[ - + ]
789 [ # # ][ + - ]: 62 : SwLayoutFrm::Modify( &aOldSet, &aNewSet );
[ + - ][ + - ]
[ + - ]
790 : : }
791 : : else
792 [ + - ]: 88 : _UpdateAttr( pOld, pNew, nInvFlags );
793 : :
794 [ + + ]: 150 : if ( nInvFlags != 0 )
795 : : {
796 [ + - ]: 62 : _Invalidate();
797 [ + - ]: 62 : if ( nInvFlags & 0x01 )
798 : : {
799 [ + - ]: 62 : _InvalidatePos();
800 : : // #i68520#
801 : 62 : InvalidateObjRectWithSpaces();
802 : : }
803 [ + + ]: 62 : if ( nInvFlags & 0x02 )
804 : : {
805 [ + - ]: 36 : _InvalidateSize();
806 : : // #i68520#
807 : 36 : InvalidateObjRectWithSpaces();
808 : : }
809 [ + + ]: 62 : if ( nInvFlags & 0x04 )
810 [ + - ]: 36 : _InvalidatePrt();
811 [ + + ]: 62 : if ( nInvFlags & 0x08 )
812 : 56 : SetNotifyBack();
813 [ + + ]: 62 : if ( nInvFlags & 0x10 )
814 : 36 : SetCompletePaint();
815 [ + + ][ + - ]: 62 : if ( ( nInvFlags & 0x40 ) && Lower() && Lower()->IsNoTxtFrm() )
[ + + ][ + + ]
816 [ + - ][ + - ]: 28 : ClrContourCache( GetVirtDrawObj() );
817 : : SwRootFrm *pRoot;
818 [ + + ][ + - ]: 62 : if ( nInvFlags & 0x20 && 0 != (pRoot = getRootFrm()) )
[ + + ]
819 [ + - ]: 36 : pRoot->InvalidateBrowseWidth();
820 : : // #i28701#
821 [ + + ]: 62 : if ( nInvFlags & 0x80 )
822 : : {
823 : : // update sorted object lists, the Writer fly frame is registered at.
824 [ + - ]: 42 : UpdateObjInSortedList();
825 : : }
826 : :
827 : : // #i87645# - reset flags for the layout process (only if something has been invalidated)
828 : 62 : ResetLayoutProcessBools();
829 : : }
830 : 150 : }
831 : :
832 : 150 : void SwFlyFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
833 : : sal_uInt8 &rInvFlags,
834 : : SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
835 : : {
836 : 150 : sal_Bool bClear = sal_True;
837 [ + - ][ # # ]: 150 : const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
838 : 150 : ViewShell *pSh = getRootFrm()->GetCurrShell();
839 [ + - + + : 150 : switch( nWhich )
- + - - +
- + - + ]
840 : : {
841 : : case RES_VERT_ORIENT:
842 : : case RES_HORI_ORIENT:
843 : : // OD 22.09.2003 #i18732# - consider new option 'follow text flow'
844 : : case RES_FOLLOW_TEXT_FLOW:
845 : : {
846 : : //Achtung! _immer_ Aktion in ChgRePos() mitpflegen.
847 : 20 : rInvFlags |= 0x09;
848 : : }
849 : 20 : break;
850 : : // OD 2004-07-01 #i28701# - consider new option 'wrap influence on position'
851 : : case RES_WRAP_INFLUENCE_ON_OBJPOS:
852 : : {
853 : 0 : rInvFlags |= 0x89;
854 : : }
855 : 0 : break;
856 : : case RES_SURROUND:
857 : : {
858 : : // OD 2004-05-13 #i28701# - invalidate position on change of
859 : : // wrapping style.
860 : : //rInvFlags |= 0x40;
861 : 6 : rInvFlags |= 0x41;
862 : : //Der Hintergrund muss benachrichtigt und Invalidiert werden.
863 [ + - ]: 6 : const SwRect aTmp( GetObjRectWithSpaces() );
864 [ + - ][ + - ]: 6 : NotifyBackground( FindPageFrm(), aTmp, PREP_FLY_ATTR_CHG );
865 : :
866 : : // Durch eine Umlaufaenderung von rahmengebundenen Rahmen kann eine
867 : : // vertikale Ausrichtung aktiviert/deaktiviert werden => MakeFlyPos
868 [ + - ][ + - ]: 6 : if( FLY_AT_FLY == GetFmt()->GetAnchor().GetAnchorId() )
[ - + ]
869 : 0 : rInvFlags |= 0x09;
870 : :
871 : : //Ggf. die Kontur am Node loeschen.
872 [ + - ]: 12 : if ( Lower() && Lower()->IsNoTxtFrm() &&
[ + - + + ]
[ + + ]
873 [ + - ][ + - ]: 6 : !GetFmt()->GetSurround().IsContour() )
874 : : {
875 : 2 : SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
876 [ - + ][ + - ]: 2 : if ( pNd->HasContour() )
877 [ # # ]: 0 : pNd->SetContour( 0 );
878 : : }
879 : : // #i28701# - perform reorder of object lists
880 : : // at anchor frame and at page frame.
881 : 6 : rInvFlags |= 0x80;
882 : : }
883 : 6 : break;
884 : :
885 : : case RES_PROTECT:
886 : : {
887 : 2 : const SvxProtectItem *pP = (SvxProtectItem*)pNew;
888 : 2 : GetVirtDrawObj()->SetMoveProtect( pP->IsPosProtected() );
889 : 2 : GetVirtDrawObj()->SetResizeProtect( pP->IsSizeProtected() );
890 [ + - ]: 2 : if( pSh )
891 : : {
892 : 2 : SwRootFrm* pLayout = getRootFrm();
893 [ - + ][ - + ]: 2 : if( pLayout && pLayout->IsAnyShellAccessible() )
[ + - ]
894 : 0 : pSh->Imp()->InvalidateAccessibleEditableState( sal_True, this );
895 : : }
896 : 2 : break;
897 : : }
898 : :
899 : : case RES_COL:
900 : : {
901 : 0 : ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
902 : 0 : const SwFmtFrmSize &rNew = GetFmt()->GetFrmSize();
903 [ # # ]: 0 : if ( FrmSizeChg( rNew ) )
904 : 0 : NotifyDrawObj();
905 : 0 : rInvFlags |= 0x1A;
906 : 0 : break;
907 : : }
908 : :
909 : : case RES_FRM_SIZE:
910 : : case RES_FMT_CHG:
911 : : {
912 [ + - ][ + - ]: 36 : const SwFmtFrmSize &rNew = GetFmt()->GetFrmSize();
913 [ + - ][ - + ]: 36 : if ( FrmSizeChg( rNew ) )
914 [ # # ]: 0 : NotifyDrawObj();
915 : 36 : rInvFlags |= 0x7F;
916 [ + + ]: 36 : if ( RES_FMT_CHG == nWhich )
917 : : {
918 [ + - ]: 6 : SwRect aNew( GetObjRectWithSpaces() );
919 : 6 : SwRect aOld( aFrm );
920 [ + - ]: 6 : const SvxULSpaceItem &rUL = ((SwFmtChg*)pOld)->pChangedFmt->GetULSpace();
921 : 6 : aOld.Top( Max( aOld.Top() - long(rUL.GetUpper()), 0L ) );
922 : 6 : aOld.SSize().Height()+= rUL.GetLower();
923 [ + - ]: 6 : const SvxLRSpaceItem &rLR = ((SwFmtChg*)pOld)->pChangedFmt->GetLRSpace();
924 : 6 : aOld.Left ( Max( aOld.Left() - long(rLR.GetLeft()), 0L ) );
925 : 6 : aOld.SSize().Width() += rLR.GetRight();
926 [ + - ]: 6 : aNew.Union( aOld );
927 [ + - ][ + - ]: 6 : NotifyBackground( FindPageFrm(), aNew, PREP_CLEAR );
928 : :
929 : : //Dummer Fall. Bei der Zusweisung einer Vorlage k?nnen wir uns
930 : : //nicht auf das alte Spaltenattribut verlassen. Da diese
931 : : //wenigstens anzahlgemass fuer ChgColumns vorliegen muessen,
932 : : //bleibt uns nur einen temporaeres Attribut zu basteln.
933 [ + - ]: 6 : SwFmtCol aCol;
934 [ + - ][ - + ]: 6 : if ( Lower() && Lower()->IsColumnFrm() )
[ - + ]
935 : : {
936 : 0 : sal_uInt16 nCol = 0;
937 : 0 : SwFrm *pTmp = Lower();
938 [ # # ]: 0 : do
939 : 0 : { ++nCol;
940 : 0 : pTmp = pTmp->GetNext();
941 : : } while ( pTmp );
942 [ # # ]: 0 : aCol.Init( nCol, 0, 1000 );
943 : : }
944 [ + - ][ + - ]: 6 : ChgColumns( aCol, GetFmt()->GetCol() );
[ + - ][ + - ]
945 : : }
946 : :
947 [ + - ][ + - ]: 36 : SwFmtURL aURL( GetFmt()->GetURL() );
[ + - ]
948 [ + + ]: 36 : if ( aURL.GetMap() )
949 : : {
950 : : const SwFmtFrmSize &rOld = nWhich == RES_FRM_SIZE ?
951 : : *(SwFmtFrmSize*)pNew :
952 [ + - ][ + - ]: 2 : ((SwFmtChg*)pOld)->pChangedFmt->GetFrmSize();
953 : : //#35091# Kann beim Laden von Vorlagen mal 0 sein
954 [ + - ][ + - ]: 2 : if ( rOld.GetWidth() && rOld.GetHeight() )
[ + - ]
955 : : {
956 : :
957 [ + - ]: 2 : Fraction aScaleX( rOld.GetWidth(), rNew.GetWidth() );
958 [ + - ]: 2 : Fraction aScaleY( rOld.GetHeight(), rOld.GetHeight() );
959 [ + - ]: 2 : aURL.GetMap()->Scale( aScaleX, aScaleY );
960 [ + - ]: 2 : SwFrmFmt *pFmt = GetFmt();
961 : 2 : pFmt->LockModify();
962 [ + - ]: 2 : pFmt->SetFmtAttr( aURL );
963 : 2 : pFmt->UnlockModify();
964 : : }
965 : : }
966 [ + - ][ + - ]: 36 : const SvxProtectItem &rP = GetFmt()->GetProtect();
967 [ + - ][ + - ]: 36 : GetVirtDrawObj()->SetMoveProtect( rP.IsPosProtected() );
968 [ + - ][ + - ]: 36 : GetVirtDrawObj()->SetResizeProtect( rP.IsSizeProtected() );
969 : :
970 [ + - ]: 36 : if ( pSh )
971 [ + - ]: 36 : pSh->InvalidateWindows( Frm() );
972 [ + - ][ + - ]: 36 : const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
973 [ + - ][ + - ]: 36 : const sal_uInt8 nId = GetFmt()->GetOpaque().GetValue() ?
974 : 36 : pIDDMA->GetHeavenId() :
975 [ + - ][ # # ]: 36 : pIDDMA->GetHellId();
[ + - ]
976 [ + - ][ + - ]: 36 : GetVirtDrawObj()->SetLayer( nId );
977 : :
978 [ + - ]: 36 : if ( Lower() )
979 : : {
980 : : //Ggf. die Kontur am Node loeschen.
981 [ + + + + ]: 58 : if( Lower()->IsNoTxtFrm() &&
[ + + ]
982 [ + - ][ + - ]: 22 : !GetFmt()->GetSurround().IsContour() )
983 : : {
984 : 20 : SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
985 [ - + ][ + - ]: 20 : if ( pNd->HasContour() )
986 [ # # ]: 0 : pNd->SetContour( 0 );
987 : : }
988 [ + - ]: 16 : else if( !Lower()->IsColumnFrm() )
989 : : {
990 [ + - ]: 16 : SwFrm* pFrm = GetLastLower();
991 [ + + ][ - + ]: 16 : if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
[ - + ]
992 [ # # ]: 0 : pFrm->Prepare( PREP_ADJUST_FRM );
993 : : }
994 : : }
995 : :
996 : : // #i28701# - perform reorder of object lists
997 : : // at anchor frame and at page frame.
998 : 36 : rInvFlags |= 0x80;
999 : :
1000 [ + - ]: 36 : break;
1001 : : }
1002 : : case RES_UL_SPACE:
1003 : : case RES_LR_SPACE:
1004 : : {
1005 : 0 : rInvFlags |= 0x41;
1006 [ # # ][ # # ]: 0 : if( pSh && pSh->GetViewOptions()->getBrowseMode() )
[ # # ]
1007 [ # # ]: 0 : getRootFrm()->InvalidateBrowseWidth();
1008 [ # # ]: 0 : SwRect aNew( GetObjRectWithSpaces() );
1009 : 0 : SwRect aOld( aFrm );
1010 [ # # ]: 0 : if ( RES_UL_SPACE == nWhich )
1011 : : {
1012 : 0 : const SvxULSpaceItem &rUL = *(SvxULSpaceItem*)pNew;
1013 : 0 : aOld.Top( Max( aOld.Top() - long(rUL.GetUpper()), 0L ) );
1014 : 0 : aOld.SSize().Height()+= rUL.GetLower();
1015 : : }
1016 : : else
1017 : : {
1018 : 0 : const SvxLRSpaceItem &rLR = *(SvxLRSpaceItem*)pNew;
1019 : 0 : aOld.Left ( Max( aOld.Left() - long(rLR.GetLeft()), 0L ) );
1020 : 0 : aOld.SSize().Width() += rLR.GetRight();
1021 : : }
1022 [ # # ]: 0 : aNew.Union( aOld );
1023 [ # # ][ # # ]: 0 : NotifyBackground( FindPageFrm(), aNew, PREP_CLEAR );
1024 : : }
1025 : 0 : break;
1026 : :
1027 : : case RES_BOX:
1028 : : case RES_SHADOW:
1029 : 0 : rInvFlags |= 0x17;
1030 : 0 : break;
1031 : :
1032 : : case RES_FRAMEDIR :
1033 : 2 : SetDerivedVert( sal_False );
1034 : 2 : SetDerivedR2L( sal_False );
1035 : 2 : CheckDirChange();
1036 : 2 : break;
1037 : :
1038 : : case RES_OPAQUE:
1039 : : {
1040 [ # # ]: 0 : if ( pSh )
1041 : 0 : pSh->InvalidateWindows( Frm() );
1042 : :
1043 : 0 : const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
1044 : 0 : const sal_uInt8 nId = ((SvxOpaqueItem*)pNew)->GetValue() ?
1045 : 0 : pIDDMA->GetHeavenId() :
1046 [ # # ]: 0 : pIDDMA->GetHellId();
1047 : 0 : GetVirtDrawObj()->SetLayer( nId );
1048 [ # # ]: 0 : if( pSh )
1049 : : {
1050 : 0 : SwRootFrm* pLayout = getRootFrm();
1051 [ # # ][ # # ]: 0 : if( pLayout && pLayout->IsAnyShellAccessible() )
[ # # ]
1052 : : {
1053 : 0 : pSh->Imp()->DisposeAccessibleFrm( this );
1054 : 0 : pSh->Imp()->AddAccessibleFrm( this );
1055 : : }
1056 : : }
1057 : : // #i28701# - perform reorder of object lists
1058 : : // at anchor frame and at page frame.
1059 : 0 : rInvFlags |= 0x80;
1060 : : }
1061 : 0 : break;
1062 : :
1063 : : case RES_URL:
1064 : : //Das Interface arbeitet bei Textrahmen auf der Rahmengroesse,
1065 : : //die Map muss sich aber auf die FrmSize beziehen
1066 [ + - ][ - + : 2 : if ( (!Lower() || !Lower()->IsNoTxtFrm()) &&
# # # # ]
[ - + ]
1067 : 0 : ((SwFmtURL*)pNew)->GetMap() && ((SwFmtURL*)pOld)->GetMap() )
1068 : : {
1069 : 0 : const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
1070 [ # # ]: 0 : if ( rSz.GetHeight() != Frm().Height() ||
[ # # # # ]
1071 : 0 : rSz.GetWidth() != Frm().Width() )
1072 : : {
1073 [ # # ][ # # ]: 0 : SwFmtURL aURL( GetFmt()->GetURL() );
[ # # ]
1074 [ # # ]: 0 : Fraction aScaleX( Frm().Width(), rSz.GetWidth() );
1075 [ # # ]: 0 : Fraction aScaleY( Frm().Height(), rSz.GetHeight() );
1076 [ # # ]: 0 : aURL.GetMap()->Scale( aScaleX, aScaleY );
1077 [ # # ]: 0 : SwFrmFmt *pFmt = GetFmt();
1078 : 0 : pFmt->LockModify();
1079 [ # # ]: 0 : pFmt->SetFmtAttr( aURL );
1080 [ # # ]: 0 : pFmt->UnlockModify();
1081 : : }
1082 : : }
1083 : : /* Keine Invalidierung notwendig */
1084 : 2 : break;
1085 : :
1086 : : case RES_CHAIN:
1087 : : {
1088 : 0 : SwFmtChain *pChain = (SwFmtChain*)pNew;
1089 [ # # ]: 0 : if ( pChain->GetNext() )
1090 : : {
1091 : 0 : SwFlyFrm *pFollow = FindChainNeighbour( *pChain->GetNext() );
1092 [ # # ][ # # ]: 0 : if ( GetNextLink() && pFollow != GetNextLink() )
[ # # ]
1093 : 0 : SwFlyFrm::UnchainFrames( this, GetNextLink());
1094 [ # # ]: 0 : if ( pFollow )
1095 : : {
1096 [ # # # # ]: 0 : if ( pFollow->GetPrevLink() &&
[ # # ]
1097 : 0 : pFollow->GetPrevLink() != this )
1098 : : SwFlyFrm::UnchainFrames( pFollow->GetPrevLink(),
1099 : 0 : pFollow );
1100 [ # # ]: 0 : if ( !GetNextLink() )
1101 : 0 : SwFlyFrm::ChainFrames( this, pFollow );
1102 : : }
1103 : : }
1104 [ # # ]: 0 : else if ( GetNextLink() )
1105 : 0 : SwFlyFrm::UnchainFrames( this, GetNextLink() );
1106 [ # # ]: 0 : if ( pChain->GetPrev() )
1107 : : {
1108 : 0 : SwFlyFrm *pMaster = FindChainNeighbour( *pChain->GetPrev() );
1109 [ # # ][ # # ]: 0 : if ( GetPrevLink() && pMaster != GetPrevLink() )
[ # # ]
1110 : 0 : SwFlyFrm::UnchainFrames( GetPrevLink(), this );
1111 [ # # ]: 0 : if ( pMaster )
1112 : : {
1113 [ # # # # ]: 0 : if ( pMaster->GetNextLink() &&
[ # # ]
1114 : 0 : pMaster->GetNextLink() != this )
1115 : : SwFlyFrm::UnchainFrames( pMaster,
1116 : 0 : pMaster->GetNextLink() );
1117 [ # # ]: 0 : if ( !GetPrevLink() )
1118 : 0 : SwFlyFrm::ChainFrames( pMaster, this );
1119 : : }
1120 : : }
1121 [ # # ]: 0 : else if ( GetPrevLink() )
1122 : 0 : SwFlyFrm::UnchainFrames( GetPrevLink(), this );
1123 : : }
1124 : :
1125 : : default:
1126 : 82 : bClear = sal_False;
1127 : : }
1128 [ + + ]: 150 : if ( bClear )
1129 : : {
1130 [ + + ][ - + ]: 68 : if ( pOldSet || pNewSet )
1131 : : {
1132 [ + - ]: 62 : if ( pOldSet )
1133 : 62 : pOldSet->ClearItem( nWhich );
1134 [ + - ]: 124 : if ( pNewSet )
1135 : 62 : pNewSet->ClearItem( nWhich );
1136 : : }
1137 : : else
1138 : 68 : SwLayoutFrm::Modify( pOld, pNew );
1139 : : }
1140 : 150 : }
1141 : :
1142 : : /*************************************************************************
1143 : : |*
1144 : : |* SwFlyFrm::GetInfo()
1145 : : |*
1146 : : |* Beschreibung erfragt Informationen
1147 : : |*
1148 : : *************************************************************************/
1149 : :
1150 : : // erfrage vom Modify Informationen
1151 : 12 : sal_Bool SwFlyFrm::GetInfo( SfxPoolItem & rInfo ) const
1152 : : {
1153 [ + - ]: 12 : if( RES_AUTOFMT_DOCNODE == rInfo.Which() )
1154 : 12 : return sal_False; // es gibt einen FlyFrm also wird er benutzt
1155 : 12 : return sal_True; // weiter suchen
1156 : : }
1157 : :
1158 : : /*************************************************************************
1159 : : |*
1160 : : |* SwFlyFrm::_Invalidate()
1161 : : |*
1162 : : |*************************************************************************/
1163 : :
1164 : 900 : void SwFlyFrm::_Invalidate( SwPageFrm *pPage )
1165 : : {
1166 : 900 : InvalidatePage( pPage );
1167 : 900 : bNotifyBack = bInvalid = sal_True;
1168 : :
1169 : : SwFlyFrm *pFrm;
1170 [ - + ][ - + ]: 900 : if ( GetAnchorFrm() && 0 != (pFrm = AnchorFrm()->FindFlyFrm()) )
[ + - ]
1171 : : {
1172 : : //Gaanz dumm: Wenn der Fly innerhalb eines Fly gebunden ist, der
1173 : : //Spalten enthaehlt, sollte das Format von diesem ausgehen.
1174 [ # # ][ # # : 0 : if ( !pFrm->IsLocked() && !pFrm->IsColLocked() &&
# # # # ]
[ # # ]
1175 : 0 : pFrm->Lower() && pFrm->Lower()->IsColumnFrm() )
1176 : 0 : pFrm->InvalidateSize();
1177 : : }
1178 : :
1179 : : // #i85216#
1180 : : // if vertical position is oriented at a layout frame inside a ghost section,
1181 : : // assure that the position is invalidated and that the information about
1182 : : // the vertical position oriented frame is cleared
1183 [ + + ][ + - ]: 900 : if ( GetVertPosOrientFrm() && GetVertPosOrientFrm()->IsLayoutFrm() )
[ + + ]
1184 : : {
1185 : 150 : const SwSectionFrm* pSectFrm( GetVertPosOrientFrm()->FindSctFrm() );
1186 [ # # ][ - + ]: 150 : if ( pSectFrm && pSectFrm->GetSection() == 0 )
[ - + ]
1187 : : {
1188 : 0 : InvalidatePos();
1189 : 0 : ClearVertPosOrientFrm();
1190 : : }
1191 : : }
1192 : 900 : }
1193 : :
1194 : : /*************************************************************************
1195 : : |*
1196 : : |* SwFlyFrm::ChgRelPos()
1197 : : |*
1198 : : |* Beschreibung Aenderung der relativen Position, die Position wird
1199 : : |* damit automatisch Fix, das Attribut wird entprechend angepasst.
1200 : : |*
1201 : : |*************************************************************************/
1202 : :
1203 : 0 : void SwFlyFrm::ChgRelPos( const Point &rNewPos )
1204 : : {
1205 [ # # ]: 0 : if ( GetCurrRelPos() != rNewPos )
1206 : : {
1207 [ # # ]: 0 : SwFrmFmt *pFmt = GetFmt();
1208 [ # # ][ # # ]: 0 : const bool bVert = GetAnchorFrm()->IsVertical();
1209 [ # # ]: 0 : const SwTwips nNewY = bVert ? rNewPos.X() : rNewPos.Y();
1210 [ # # ]: 0 : SwTwips nTmpY = nNewY == LONG_MAX ? 0 : nNewY;
1211 [ # # ]: 0 : if( bVert )
1212 : 0 : nTmpY = -nTmpY;
1213 : 0 : SfxItemSet aSet( pFmt->GetDoc()->GetAttrPool(),
1214 [ # # ]: 0 : RES_VERT_ORIENT, RES_HORI_ORIENT);
1215 : :
1216 [ # # ][ # # ]: 0 : SwFmtVertOrient aVert( pFmt->GetVertOrient() );
1217 : 0 : SwTxtFrm *pAutoFrm = NULL;
1218 : : // #i34948# - handle also at-page and at-fly anchored
1219 : : // Writer fly frames
1220 [ # # ][ # # ]: 0 : const RndStdIds eAnchorType = GetFrmFmt().GetAnchor().GetAnchorId();
1221 [ # # ]: 0 : if ( eAnchorType == FLY_AT_PAGE )
1222 : : {
1223 : 0 : aVert.SetVertOrient( text::VertOrientation::NONE );
1224 : 0 : aVert.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
1225 : : }
1226 [ # # ]: 0 : else if ( eAnchorType == FLY_AT_FLY )
1227 : : {
1228 : 0 : aVert.SetVertOrient( text::VertOrientation::NONE );
1229 : 0 : aVert.SetRelationOrient( text::RelOrientation::FRAME );
1230 : : }
1231 [ # # ][ # # ]: 0 : else if ( IsFlyAtCntFrm() || text::VertOrientation::NONE != aVert.GetVertOrient() )
[ # # ]
1232 : : {
1233 [ # # ][ # # ]: 0 : if( text::RelOrientation::CHAR == aVert.GetRelationOrient() && IsAutoPos() )
[ # # ]
1234 : : {
1235 [ # # ]: 0 : if( LONG_MAX != nNewY )
1236 : : {
1237 : 0 : aVert.SetVertOrient( text::VertOrientation::NONE );
1238 : : xub_StrLen nOfs =
1239 [ # # ][ # # ]: 0 : pFmt->GetAnchor().GetCntntAnchor()->nContent.GetIndex();
1240 : : OSL_ENSURE( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected" );
1241 [ # # ]: 0 : pAutoFrm = (SwTxtFrm*)GetAnchorFrm();
1242 [ # # # # ]: 0 : while( pAutoFrm->GetFollow() &&
[ # # ]
1243 : 0 : pAutoFrm->GetFollow()->GetOfst() <= nOfs )
1244 : : {
1245 [ # # ][ # # ]: 0 : if( pAutoFrm == GetAnchorFrm() )
1246 : 0 : nTmpY += pAutoFrm->GetRelPos().Y();
1247 : 0 : nTmpY -= pAutoFrm->GetUpper()->Prt().Height();
1248 : 0 : pAutoFrm = pAutoFrm->GetFollow();
1249 : : }
1250 [ # # ]: 0 : nTmpY = ((SwFlyAtCntFrm*)this)->GetRelCharY(pAutoFrm)-nTmpY;
1251 : : }
1252 : : else
1253 : 0 : aVert.SetVertOrient( text::VertOrientation::CHAR_BOTTOM );
1254 : : }
1255 : : else
1256 : : {
1257 : 0 : aVert.SetVertOrient( text::VertOrientation::NONE );
1258 : 0 : aVert.SetRelationOrient( text::RelOrientation::FRAME );
1259 : : }
1260 : : }
1261 : 0 : aVert.SetPos( nTmpY );
1262 [ # # ]: 0 : aSet.Put( aVert );
1263 : :
1264 : : //Fuer Flys im Cnt ist die horizontale Ausrichtung uninteressant,
1265 : : //den sie ist stets 0.
1266 [ # # ]: 0 : if ( !IsFlyInCntFrm() )
1267 : : {
1268 [ # # ]: 0 : const SwTwips nNewX = bVert ? rNewPos.Y() : rNewPos.X();
1269 [ # # ]: 0 : SwTwips nTmpX = nNewX == LONG_MAX ? 0 : nNewX;
1270 [ # # ][ # # ]: 0 : SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
1271 : : // #i34948# - handle also at-page and at-fly anchored
1272 : : // Writer fly frames
1273 [ # # ]: 0 : if ( eAnchorType == FLY_AT_PAGE )
1274 : : {
1275 : 0 : aHori.SetHoriOrient( text::HoriOrientation::NONE );
1276 : 0 : aHori.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
1277 : 0 : aHori.SetPosToggle( sal_False );
1278 : : }
1279 [ # # ]: 0 : else if ( eAnchorType == FLY_AT_FLY )
1280 : : {
1281 : 0 : aHori.SetHoriOrient( text::HoriOrientation::NONE );
1282 : 0 : aHori.SetRelationOrient( text::RelOrientation::FRAME );
1283 : 0 : aHori.SetPosToggle( sal_False );
1284 : : }
1285 [ # # ][ # # ]: 0 : else if ( IsFlyAtCntFrm() || text::HoriOrientation::NONE != aHori.GetHoriOrient() )
[ # # ]
1286 : : {
1287 : 0 : aHori.SetHoriOrient( text::HoriOrientation::NONE );
1288 [ # # ][ # # ]: 0 : if( text::RelOrientation::CHAR == aHori.GetRelationOrient() && IsAutoPos() )
[ # # ]
1289 : : {
1290 [ # # ]: 0 : if( LONG_MAX != nNewX )
1291 : : {
1292 [ # # ]: 0 : if( !pAutoFrm )
1293 : : {
1294 [ # # ][ # # ]: 0 : xub_StrLen nOfs = pFmt->GetAnchor().GetCntntAnchor()
1295 : 0 : ->nContent.GetIndex();
1296 : : OSL_ENSURE( GetAnchorFrm()->IsTxtFrm(), "TxtFrm expected");
1297 [ # # ]: 0 : pAutoFrm = (SwTxtFrm*)GetAnchorFrm();
1298 [ # # # # ]: 0 : while( pAutoFrm->GetFollow() &&
[ # # ]
1299 : 0 : pAutoFrm->GetFollow()->GetOfst() <= nOfs )
1300 : 0 : pAutoFrm = pAutoFrm->GetFollow();
1301 : : }
1302 [ # # ]: 0 : nTmpX -= ((SwFlyAtCntFrm*)this)->GetRelCharX(pAutoFrm);
1303 : : }
1304 : : }
1305 : : else
1306 : 0 : aHori.SetRelationOrient( text::RelOrientation::FRAME );
1307 : 0 : aHori.SetPosToggle( sal_False );
1308 : : }
1309 : 0 : aHori.SetPos( nTmpX );
1310 [ # # ][ # # ]: 0 : aSet.Put( aHori );
1311 : : }
1312 [ # # ]: 0 : SetCurrRelPos( rNewPos );
1313 [ # # ][ # # ]: 0 : pFmt->GetDoc()->SetAttr( aSet, *pFmt );
[ # # ]
1314 : : }
1315 : 0 : }
1316 : : /*************************************************************************
1317 : : |*
1318 : : |* SwFlyFrm::Format()
1319 : : |*
1320 : : |* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
1321 : : |* Die Fixsize wird hier nicht eingestellt.
1322 : : |*
1323 : : |*************************************************************************/
1324 : :
1325 : 1571 : void SwFlyFrm::Format( const SwBorderAttrs *pAttrs )
1326 : : {
1327 : : OSL_ENSURE( pAttrs, "FlyFrm::Format, pAttrs ist 0." );
1328 : :
1329 : 1571 : ColLock();
1330 : :
1331 [ + - ]: 1571 : if ( !bValidSize )
1332 : : {
1333 [ + + ][ + - ]: 1571 : if ( Frm().Top() == FAR_AWAY && Frm().Left() == FAR_AWAY )
[ + + ]
1334 : : {
1335 : : //Sicherheitsschaltung wegnehmen (siehe SwFrm::CTor)
1336 : 579 : Frm().Pos().X() = Frm().Pos().Y() = 0;
1337 : : // #i68520#
1338 : 579 : InvalidateObjRectWithSpaces();
1339 : : }
1340 : :
1341 : : //Breite der Spalten pruefen und ggf. einstellen.
1342 [ + - ][ - + ]: 1571 : if ( Lower() && Lower()->IsColumnFrm() )
[ - + ]
1343 [ # # ]: 0 : AdjustColumns( 0, sal_False );
1344 : :
1345 : 1571 : bValidSize = sal_True;
1346 : :
1347 [ + - ][ + - ]: 1571 : const SwTwips nUL = pAttrs->CalcTopLine() + pAttrs->CalcBottomLine();
1348 [ + - ][ + - ]: 1571 : const SwTwips nLR = pAttrs->CalcLeftLine() + pAttrs->CalcRightLine();
1349 [ + - ][ + - ]: 1571 : const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize();
1350 [ + - ]: 1571 : Size aRelSize( CalcRel( rFrmSz ) );
1351 : :
1352 : : OSL_ENSURE( pAttrs->GetSize().Height() != 0 || rFrmSz.GetHeightPercent(), "Hoehe des RahmenAttr ist 0." );
1353 : : OSL_ENSURE( pAttrs->GetSize().Width() != 0 || rFrmSz.GetWidthPercent(), "Breite des RahmenAttr ist 0." );
1354 : :
1355 [ + - ][ - + ]: 1571 : SWRECTFN( this )
[ # # ][ # # ]
[ - + ]
1356 [ + + ]: 1571 : if( !HasFixSize() )
1357 : : {
1358 : 509 : SwTwips nRemaining = 0;
1359 : :
1360 : 509 : long nMinHeight = 0;
1361 [ + + ]: 509 : if( IsMinHeight() )
1362 [ - + ]: 8 : nMinHeight = bVert ? aRelSize.Width() : aRelSize.Height();
1363 : :
1364 [ + - ]: 509 : if ( Lower() )
1365 : : {
1366 [ - + ]: 509 : if ( Lower()->IsColumnFrm() )
1367 : : {
1368 [ # # ]: 0 : FormatWidthCols( *pAttrs, nUL, nMinHeight );
1369 [ # # ][ # # ]: 0 : nRemaining = (Lower()->Frm().*fnRect->fnGetHeight)();
1370 : : }
1371 : : else
1372 : : {
1373 : 509 : SwFrm *pFrm = Lower();
1374 [ + + ]: 1113 : while ( pFrm )
1375 : : {
1376 [ + - ][ + - ]: 604 : nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
1377 [ + + ][ + + ]: 604 : if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
[ + + ]
1378 : : // Dieser TxtFrm waere gern ein bisschen groesser
1379 [ + - ]: 24 : nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
1380 [ + - ][ + - ]: 24 : - (pFrm->Prt().*fnRect->fnGetHeight)();
1381 [ - + ][ # # ]: 580 : else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
[ - + ]
1382 [ # # ]: 0 : nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
1383 : 604 : pFrm = pFrm->GetNext();
1384 : : }
1385 : : // #130878#
1386 : : // Do not keep old height, if content has no height.
1387 : : // The old height could be wrong due to wrong layout cache
1388 : : // and isn't corrected in the further formatting, because
1389 : : // the fly frame doesn't become invalid anymore.
1390 : : // if( !nRemaining )
1391 : : // nRemaining = nOldHeight - nUL;
1392 : : }
1393 [ - + ]: 509 : if ( GetDrawObjs() )
1394 : : {
1395 [ # # ]: 0 : sal_uInt32 nCnt = GetDrawObjs()->Count();
1396 [ # # ][ # # ]: 0 : SwTwips nTop = (Frm().*fnRect->fnGetTop)();
1397 [ # # ][ # # ]: 0 : SwTwips nBorder = (Frm().*fnRect->fnGetHeight)() -
1398 [ # # ][ # # ]: 0 : (Prt().*fnRect->fnGetHeight)();
1399 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < nCnt; ++i )
1400 : : {
1401 [ # # ]: 0 : SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
1402 [ # # ][ # # ]: 0 : if ( pAnchoredObj->ISA(SwFlyFrm) )
1403 : : {
1404 [ # # ]: 0 : SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
1405 : : // OD 06.11.2003 #i22305# - consider
1406 : : // only Writer fly frames, which follow the text flow.
1407 [ # # # # : 0 : if ( pFly->IsFlyLayFrm() &&
# # ][ # # ]
1408 : 0 : pFly->Frm().Top() != FAR_AWAY &&
1409 [ # # ][ # # ]: 0 : pFly->GetFmt()->GetFollowTextFlow().GetValue() )
1410 : : {
1411 : 0 : SwTwips nDist = -(pFly->Frm().*fnRect->
1412 [ # # ][ # # ]: 0 : fnBottomDist)( nTop );
1413 [ # # ]: 0 : if( nDist > nBorder + nRemaining )
1414 : 0 : nRemaining = nDist - nBorder;
1415 : : }
1416 : : }
1417 : : }
1418 : : }
1419 : : }
1420 : :
1421 [ + + ][ + + ]: 509 : if( IsMinHeight() && (nRemaining + nUL) < nMinHeight )
[ + + ]
1422 : 6 : nRemaining = nMinHeight - nUL;
1423 : : //Weil das Grow/Shrink der Flys die Groessen nicht direkt
1424 : : //einstellt, sondern indirekt per Invalidate ein Format
1425 : : //ausloesst, muessen die Groessen hier direkt eingestellt
1426 : : //werden. Benachrichtung laeuft bereits mit.
1427 : : //Weil bereits haeufiger 0en per Attribut hereinkamen wehre
1428 : : //ich mich ab sofort dagegen.
1429 [ + + ]: 509 : if ( nRemaining < MINFLY )
1430 : 144 : nRemaining = MINFLY;
1431 [ + - ][ + - ]: 509 : (Prt().*fnRect->fnSetHeight)( nRemaining );
1432 [ + - ][ + - ]: 509 : nRemaining -= (Frm().*fnRect->fnGetHeight)();
1433 [ + - ][ + - ]: 509 : (Frm().*fnRect->fnAddBottom)( nRemaining + nUL );
1434 : : // #i68520#
1435 [ + + ]: 509 : if ( nRemaining + nUL != 0 )
1436 : : {
1437 : 294 : InvalidateObjRectWithSpaces();
1438 : : }
1439 : 509 : bValidSize = sal_True;
1440 : : }
1441 : : else
1442 : : {
1443 : 1062 : bValidSize = sal_True; //Fixe Frms formatieren sich nicht.
1444 : : //Flys stellen ihre Groesse anhand des Attr ein.
1445 [ - + ]: 1062 : SwTwips nNewSize = bVert ? aRelSize.Width() : aRelSize.Height();
1446 : 1062 : nNewSize -= nUL;
1447 [ - + ]: 1062 : if( nNewSize < MINFLY )
1448 : 0 : nNewSize = MINFLY;
1449 [ + - ][ + - ]: 1062 : (Prt().*fnRect->fnSetHeight)( nNewSize );
1450 [ + - ][ + - ]: 1062 : nNewSize += nUL - (Frm().*fnRect->fnGetHeight)();
1451 [ + - ][ + - ]: 1062 : (Frm().*fnRect->fnAddBottom)( nNewSize );
1452 : : // #i68520#
1453 [ + + ]: 1062 : if ( nNewSize != 0 )
1454 : : {
1455 : 485 : InvalidateObjRectWithSpaces();
1456 : : }
1457 : : }
1458 : :
1459 [ + - ]: 1571 : if ( !bFormatHeightOnly )
1460 : : {
1461 : : OSL_ENSURE( aRelSize == CalcRel( rFrmSz ), "SwFlyFrm::Format CalcRel problem" );
1462 [ - + ]: 1571 : SwTwips nNewSize = bVert ? aRelSize.Height() : aRelSize.Width();
1463 : :
1464 [ - + ]: 1571 : if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
1465 : : {
1466 : : // #i9046# Autowidth for fly frames
1467 [ # # ]: 0 : const SwTwips nAutoWidth = CalcAutoWidth();
1468 [ # # ]: 0 : if ( nAutoWidth )
1469 : : {
1470 [ # # ]: 0 : if( ATT_MIN_SIZE == rFrmSz.GetWidthSizeType() )
1471 : 0 : nNewSize = Max( nNewSize - nLR, nAutoWidth );
1472 : : else
1473 : 0 : nNewSize = nAutoWidth;
1474 : : }
1475 : : }
1476 : : else
1477 : 1571 : nNewSize -= nLR;
1478 : :
1479 [ - + ]: 1571 : if( nNewSize < MINFLY )
1480 : 0 : nNewSize = MINFLY;
1481 [ + - ][ + - ]: 1571 : (Prt().*fnRect->fnSetWidth)( nNewSize );
1482 [ + - ][ + - ]: 1571 : nNewSize += nLR - (Frm().*fnRect->fnGetWidth)();
1483 [ + - ][ + - ]: 1571 : (Frm().*fnRect->fnAddRight)( nNewSize );
1484 : : // #i68520#
1485 [ + + ]: 1571 : if ( nNewSize != 0 )
1486 : : {
1487 : 1571 : InvalidateObjRectWithSpaces();
1488 : : }
1489 : : }
1490 : : }
1491 : 1571 : ColUnlock();
1492 : 1571 : }
1493 : :
1494 : : // OD 14.03.2003 #i11760# - change parameter <bNoColl>: type <bool>;
1495 : : // default value = false.
1496 : : // OD 14.03.2003 #i11760# - add new parameter <bNoCalcFollow> with
1497 : : // default value = false.
1498 : : // OD 11.04.2003 #108824# - new parameter <bNoCalcFollow> was used by method
1499 : : // <FormatWidthCols(..)> to avoid follow formatting
1500 : : // for text frames. But, unformatted follows causes
1501 : : // problems in method <SwCntntFrm::_WouldFit(..)>,
1502 : : // which assumes that the follows are formatted.
1503 : : // Thus, <bNoCalcFollow> no longer used by <FormatWidthCols(..)>.
1504 : : //void CalcCntnt( SwLayoutFrm *pLay, sal_Bool bNoColl )
1505 : 108 : void CalcCntnt( SwLayoutFrm *pLay,
1506 : : bool bNoColl,
1507 : : bool bNoCalcFollow )
1508 : : {
1509 : : SwSectionFrm* pSect;
1510 : 108 : sal_Bool bCollect = sal_False;
1511 [ + - ]: 108 : if( pLay->IsSctFrm() )
1512 : : {
1513 : 108 : pSect = (SwSectionFrm*)pLay;
1514 [ - + ][ # # ]: 108 : if( pSect->IsEndnAtEnd() && !bNoColl )
[ - + ]
1515 : : {
1516 : 0 : bCollect = sal_True;
1517 : 0 : SwLayouter::CollectEndnotes( pLay->GetFmt()->GetDoc(), pSect );
1518 : : }
1519 : 108 : pSect->CalcFtnCntnt();
1520 : : }
1521 : : else
1522 : 0 : pSect = NULL;
1523 : 108 : SwFrm *pFrm = pLay->ContainsAny();
1524 [ + + ]: 108 : if ( !pFrm )
1525 : : {
1526 [ + - ]: 32 : if( pSect )
1527 : : {
1528 [ + + ]: 32 : if( pSect->HasFollow() )
1529 : 26 : pFrm = pSect->GetFollow()->ContainsAny();
1530 [ + + ]: 32 : if( !pFrm )
1531 : : {
1532 [ - + ]: 6 : if( pSect->IsEndnAtEnd() )
1533 : : {
1534 [ # # ]: 0 : if( bCollect )
1535 : 0 : pLay->GetFmt()->GetDoc()->GetLayouter()->
1536 : 0 : InsertEndnotes( pSect );
1537 : 0 : sal_Bool bLock = pSect->IsFtnLock();
1538 : 0 : pSect->SetFtnLock( sal_True );
1539 : 0 : pSect->CalcFtnCntnt();
1540 : 0 : pSect->CalcFtnCntnt();
1541 : 0 : pSect->SetFtnLock( bLock );
1542 : : }
1543 : 6 : return;
1544 : : }
1545 : 26 : pFrm->_InvalidatePos();
1546 : : }
1547 : : else
1548 : 0 : return;
1549 : : }
1550 : 102 : pFrm->InvalidatePage();
1551 : :
1552 : 0 : do
1553 : : {
1554 : : // local variables to avoid loops caused by anchored object positioning
1555 : 102 : SwAnchoredObject* pAgainObj1 = 0;
1556 : 102 : SwAnchoredObject* pAgainObj2 = 0;
1557 : :
1558 : : // FME 2007-08-30 #i81146# new loop control
1559 : 102 : sal_uInt16 nLoopControlRuns = 0;
1560 : 102 : const sal_uInt16 nLoopControlMax = 20;
1561 : 102 : const SwFrm* pLoopControlCond = 0;
1562 : :
1563 : : SwFrm* pLast;
1564 [ + + + - ]: 534 : do
[ + - + +
+ - + - -
+ # # + +
- + ][ - + ]
1565 : : {
1566 : 102 : pLast = pFrm;
1567 [ - + ][ + + ]: 204 : if( pFrm->IsVertical() ?
1568 : 0 : ( pFrm->GetUpper()->Prt().Height() != pFrm->Frm().Height() )
1569 : 102 : : ( pFrm->GetUpper()->Prt().Width() != pFrm->Frm().Width() ) )
1570 : : {
1571 : 4 : pFrm->Prepare( PREP_FIXSIZE_CHG );
1572 : 4 : pFrm->_InvalidateSize();
1573 : : }
1574 : :
1575 [ - + ]: 102 : if ( pFrm->IsTabFrm() )
1576 : : {
1577 : 0 : ((SwTabFrm*)pFrm)->bCalcLowers = sal_True;
1578 : : // OD 26.08.2003 #i18103# - lock move backward of follow table,
1579 : : // if no section content is formatted or follow table belongs
1580 : : // to the section, which content is formatted.
1581 [ # # ]: 0 : if ( ((SwTabFrm*)pFrm)->IsFollow() &&
[ # # # # ]
[ # # ]
1582 : 0 : ( !pSect || pSect == pFrm->FindSctFrm() ) )
1583 : : {
1584 : 0 : ((SwTabFrm*)pFrm)->bLockBackMove = sal_True;
1585 : : }
1586 : : }
1587 : :
1588 : : // OD 14.03.2003 #i11760# - forbid format of follow, if requested.
1589 [ - + ][ # # ]: 102 : if ( bNoCalcFollow && pFrm->IsTxtFrm() )
[ - + ]
1590 : 0 : static_cast<SwTxtFrm*>(pFrm)->ForbidFollowFormat();
1591 : :
1592 : 102 : pFrm->Calc();
1593 : :
1594 : : // OD 14.03.2003 #i11760# - reset control flag for follow format.
1595 [ + - ]: 102 : if ( pFrm->IsTxtFrm() )
1596 : : {
1597 : 102 : static_cast<SwTxtFrm*>(pFrm)->AllowFollowFormat();
1598 : : }
1599 : :
1600 : : // #111937# The keep-attribute can cause the position
1601 : : // of the prev to be invalid:
1602 : : // OD 2004-03-15 #116560# - Do not consider invalid previous frame
1603 : : // due to its keep-attribute, if current frame is a follow or is locked.
1604 : : // #i44049# - do not consider invalid previous
1605 : : // frame due to its keep-attribute, if it can't move forward.
1606 : : // #i57765# - do not consider invalid previous
1607 : : // frame, if current frame has a column/page break before attribute.
1608 : 102 : SwFrm* pTmpPrev = pFrm->FindPrev();
1609 [ + - ][ + - ]: 102 : SwFlowFrm* pTmpPrevFlowFrm = pTmpPrev && pTmpPrev->IsFlowFrm() ? SwFlowFrm::CastFlowFrm(pTmpPrev) : 0;
1610 [ + - ]: 102 : SwFlowFrm* pTmpFlowFrm = pFrm->IsFlowFrm() ? SwFlowFrm::CastFlowFrm(pFrm) : 0;
1611 : :
1612 : : bool bPrevInvalid = pTmpPrevFlowFrm && pTmpFlowFrm &&
1613 : 102 : !pTmpFlowFrm->IsFollow() &&
1614 : 102 : !StackHack::IsLocked() && // #i76382#
1615 : 102 : !pTmpFlowFrm->IsJoinLocked() &&
1616 : 102 : !pTmpPrev->GetValidPosFlag() &&
1617 : 0 : pLay->IsAnLower( pTmpPrev ) &&
1618 : 0 : pTmpPrevFlowFrm->IsKeep( *pTmpPrev->GetAttrSet() ) &&
1619 [ + - ][ + - : 510 : pTmpPrevFlowFrm->IsKeepFwdMoveAllowed();
+ - + - +
- - + # #
# # ][ # # ]
1620 : :
1621 : : // format floating screen objects anchored to the frame.
1622 : 102 : bool bRestartLayoutProcess = false;
1623 [ + - ][ - + ]: 102 : if ( !bPrevInvalid && pFrm->GetDrawObjs() && pLay->IsAnLower( pFrm ) )
[ # # ][ - + ]
1624 : : {
1625 : 0 : bool bAgain = false;
1626 : 0 : SwPageFrm* pPageFrm = pFrm->FindPageFrm();
1627 : 0 : sal_uInt32 nCnt = pFrm->GetDrawObjs()->Count();
1628 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < nCnt; ++i )
1629 : : {
1630 : : // #i28701#
1631 : 0 : SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
1632 : : // determine, if anchored object has to be formatted.
1633 [ # # ]: 0 : if ( pAnchoredObj->PositionLocked() )
1634 : : {
1635 : 0 : continue;
1636 : : }
1637 : :
1638 : : // format anchored object
1639 [ # # ]: 0 : if ( pAnchoredObj->IsFormatPossible() )
1640 : : {
1641 : : // #i43737# - no invalidation of
1642 : : // anchored object needed - causes loops for as-character
1643 : : // anchored objects.
1644 : : //pAnchoredObj->InvalidateObjPos();
1645 [ # # ]: 0 : SwRect aRect( pAnchoredObj->GetObjRect() );
1646 [ # # ][ # # ]: 0 : if ( !SwObjectFormatter::FormatObj( *pAnchoredObj, pFrm, pPageFrm ) )
1647 : : {
1648 : 0 : bRestartLayoutProcess = true;
1649 : : break;
1650 : : }
1651 : : // #i3317# - restart layout process,
1652 : : // if the position of the anchored object is locked now.
1653 [ # # ][ # # ]: 0 : if ( pAnchoredObj->PositionLocked() )
1654 : : {
1655 : 0 : bRestartLayoutProcess = true;
1656 : : break;
1657 : : }
1658 : :
1659 [ # # ][ # # ]: 0 : if ( aRect != pAnchoredObj->GetObjRect() )
1660 : : {
1661 : 0 : bAgain = true;
1662 [ # # ]: 0 : if ( pAgainObj2 == pAnchoredObj )
1663 : : {
1664 : : OSL_FAIL( "::CalcCntnt(..) - loop detected, perform attribute changes to avoid the loop" );
1665 : : //Oszillation unterbinden.
1666 [ # # ]: 0 : SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
1667 [ # # ][ # # ]: 0 : SwFmtSurround aAttr( rFmt.GetSurround() );
1668 [ # # ]: 0 : if( SURROUND_THROUGHT != aAttr.GetSurround() )
1669 : : {
1670 : : // Bei autopositionierten hilft manchmal nur
1671 : : // noch, auf Durchlauf zu schalten
1672 [ # # ]: 0 : if ((rFmt.GetAnchor().GetAnchorId() ==
[ # # # # ]
[ # # ]
1673 : : FLY_AT_CHAR) &&
1674 : : (SURROUND_PARALLEL ==
1675 : 0 : aAttr.GetSurround()))
1676 : : {
1677 : 0 : aAttr.SetSurround( SURROUND_THROUGHT );
1678 : : }
1679 : : else
1680 : : {
1681 : 0 : aAttr.SetSurround( SURROUND_PARALLEL );
1682 : : }
1683 : 0 : rFmt.LockModify();
1684 [ # # ]: 0 : rFmt.SetFmtAttr( aAttr );
1685 : 0 : rFmt.UnlockModify();
1686 [ # # ]: 0 : }
1687 : : }
1688 : : else
1689 : : {
1690 [ # # ]: 0 : if ( pAgainObj1 == pAnchoredObj )
1691 : 0 : pAgainObj2 = pAnchoredObj;
1692 : 0 : pAgainObj1 = pAnchoredObj;
1693 : : }
1694 : : }
1695 : :
1696 [ # # ]: 0 : if ( !pFrm->GetDrawObjs() )
1697 : : break;
1698 [ # # ][ # # ]: 0 : if ( pFrm->GetDrawObjs()->Count() < nCnt )
1699 : : {
1700 : 0 : --i;
1701 : 0 : --nCnt;
1702 : : }
1703 : : }
1704 : : }
1705 : :
1706 : : // #i28701# - restart layout process, if
1707 : : // requested by floating screen object formatting
1708 [ # # ]: 0 : if ( bRestartLayoutProcess )
1709 : : {
1710 : 0 : pFrm = pLay->ContainsAny();
1711 : 0 : pAgainObj1 = 0L;
1712 : 0 : pAgainObj2 = 0L;
1713 : 0 : continue;
1714 : : }
1715 : :
1716 : : // OD 2004-05-17 #i28701# - format anchor frame after its objects
1717 : : // are formatted, if the wrapping style influence has to be considered.
1718 [ # # ]: 0 : if ( pLay->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
1719 : : {
1720 : 0 : pFrm->Calc();
1721 : : }
1722 : :
1723 [ # # ]: 0 : if ( bAgain )
1724 : : {
1725 : 0 : pFrm = pLay->ContainsCntnt();
1726 [ # # ][ # # ]: 0 : if ( pFrm && pFrm->IsInTab() )
[ # # ]
1727 : 0 : pFrm = pFrm->FindTabFrm();
1728 [ # # ][ # # ]: 0 : if( pFrm && pFrm->IsInSct() )
[ # # ]
1729 : : {
1730 : 0 : SwSectionFrm* pTmp = pFrm->FindSctFrm();
1731 [ # # ][ # # ]: 0 : if( pTmp != pLay && pLay->IsAnLower( pTmp ) )
[ # # ]
1732 : 0 : pFrm = pTmp;
1733 : : }
1734 : :
1735 [ # # ]: 0 : if ( pFrm == pLoopControlCond )
1736 : 0 : ++nLoopControlRuns;
1737 : : else
1738 : : {
1739 : 0 : nLoopControlRuns = 0;
1740 : 0 : pLoopControlCond = pFrm;
1741 : : }
1742 : :
1743 [ # # ]: 0 : if ( nLoopControlRuns < nLoopControlMax )
1744 : 0 : continue;
1745 : :
1746 : : OSL_FAIL( "LoopControl in CalcCntnt" );
1747 : : }
1748 : : }
1749 [ - + ]: 102 : if ( pFrm->IsTabFrm() )
1750 : : {
1751 [ # # ]: 0 : if ( ((SwTabFrm*)pFrm)->IsFollow() )
1752 : 0 : ((SwTabFrm*)pFrm)->bLockBackMove = sal_False;
1753 : : }
1754 : :
1755 [ - + ]: 102 : pFrm = bPrevInvalid ? pTmpPrev : pFrm->FindNext();
1756 [ + - ][ + - ]: 102 : if( !bPrevInvalid && pFrm && pFrm->IsSctFrm() && pSect )
[ + + ][ + - ]
[ + + ]
1757 : : {
1758 : : // Es koennen hier leere SectionFrms herumspuken
1759 [ + - ][ + + ]: 314 : while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
[ + + ][ + + ]
1760 : 226 : pFrm = pFrm->FindNext();
1761 : : // Wenn FindNext den Follow des urspruenglichen Bereichs liefert,
1762 : : // wollen wir mit dessen Inhalt weitermachen, solange dieser
1763 : : // zurueckfliesst.
1764 [ + - ][ + + ]: 144 : if( pFrm && pFrm->IsSctFrm() && ( pFrm == pSect->GetFollow() ||
[ + - + + ]
[ + + ]
1765 [ + - ]: 56 : ((SwSectionFrm*)pFrm)->IsAnFollow( pSect ) ) )
1766 : : {
1767 : 2 : pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
1768 [ - + ]: 2 : if( pFrm )
1769 : 0 : pFrm->_InvalidatePos();
1770 : : }
1771 : : }
1772 : : // Im pLay bleiben, Ausnahme, bei SectionFrms mit Follow wird der erste
1773 : : // CntntFrm des Follows anformatiert, damit er die Chance erhaelt, in
1774 : : // pLay zu landen. Solange diese Frames in pLay landen, geht's weiter.
1775 : : } while ( pFrm &&
1776 : 100 : ( pLay->IsAnLower( pFrm ) ||
1777 : : ( pSect &&
1778 : 100 : ( ( pSect->HasFollow() &&
1779 : 26 : ( pLay->IsAnLower( pLast ) ||
1780 : 26 : ( pLast->IsInSct() &&
1781 [ + - ]: 26 : pLast->FindSctFrm()->IsAnFollow(pSect) ) ) &&
1782 : 0 : pSect->GetFollow()->IsAnLower( pFrm ) ) ||
1783 : 100 : ( pFrm->IsInSct() &&
1784 [ + - ]: 54 : pFrm->FindSctFrm()->IsAnFollow( pSect ) ) ) ) ) );
1785 [ + - ]: 102 : if( pSect )
1786 : : {
1787 [ - + ]: 102 : if( bCollect )
1788 : : {
1789 : 0 : pLay->GetFmt()->GetDoc()->GetLayouter()->InsertEndnotes(pSect);
1790 : 0 : pSect->CalcFtnCntnt();
1791 : : }
1792 [ + + ]: 102 : if( pSect->HasFollow() )
1793 : : {
1794 : 26 : SwSectionFrm* pNxt = pSect->GetFollow();
1795 [ + - ][ - + ]: 26 : while( pNxt && !pNxt->ContainsCntnt() )
[ - + ]
1796 : 0 : pNxt = pNxt->GetFollow();
1797 [ + - ]: 26 : if( pNxt )
1798 : 26 : pNxt->CalcFtnCntnt();
1799 : : }
1800 [ - + ]: 102 : if( bCollect )
1801 : : {
1802 : 0 : pFrm = pLay->ContainsAny();
1803 : 0 : bCollect = sal_False;
1804 [ # # ]: 0 : if( pFrm )
1805 : 0 : continue;
1806 : : }
1807 : : }
1808 : 108 : break;
1809 : : }
1810 : : while( sal_True );
1811 : : }
1812 : :
1813 : : /*************************************************************************
1814 : : |*
1815 : : |* SwFlyFrm::MakeFlyPos()
1816 : : |*
1817 : : |*************************************************************************/
1818 : : // OD 2004-03-23 #i26791#
1819 : : //void SwFlyFrm::MakeFlyPos()
1820 : 76 : void SwFlyFrm::MakeObjPos()
1821 : : {
1822 [ + - ]: 76 : if ( !bValidPos )
1823 : : {
1824 : 76 : bValidPos = sal_True;
1825 : :
1826 : : // OD 29.10.2003 #113049# - use new class to position object
1827 [ + - ][ + - ]: 76 : GetAnchorFrm()->Calc();
1828 : : objectpositioning::SwToLayoutAnchoredObjectPosition
1829 [ + - ][ + - ]: 76 : aObjPositioning( *GetVirtDrawObj() );
1830 [ + - ]: 76 : aObjPositioning.CalcPosition();
1831 : :
1832 : : // #i58280#
1833 : : // update relative position
1834 [ + - ][ + - ]: 76 : SetCurrRelPos( aObjPositioning.GetRelPos() );
1835 : :
1836 [ + - ][ + - ]: 76 : SWRECTFN( GetAnchorFrm() );
[ + - ][ + - ]
[ - + ][ # # ]
[ # # ][ - + ]
1837 [ + - ]: 76 : aFrm.Pos( aObjPositioning.GetRelPos() );
1838 [ + - ][ + - ]: 76 : aFrm.Pos() += (GetAnchorFrm()->Frm().*fnRect->fnGetPos)();
[ + - ]
1839 : : // #i69335#
1840 [ + - ]: 76 : InvalidateObjRectWithSpaces();
1841 : : }
1842 : 76 : }
1843 : :
1844 : : /*************************************************************************
1845 : : |*
1846 : : |* SwFlyFrm::MakePrtArea()
1847 : : |*
1848 : : |*************************************************************************/
1849 : 1571 : void SwFlyFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
1850 : : {
1851 : :
1852 [ + - ]: 1571 : if ( !bValidPrtArea )
1853 : : {
1854 : 1571 : bValidPrtArea = sal_True;
1855 : :
1856 : : // OD 31.07.2003 #110978# - consider vertical layout
1857 [ - + ][ # # ]: 1571 : SWRECTFN( this )
[ # # ][ - + ]
1858 : 1571 : (this->*fnRect->fnSetXMargins)( rAttrs.CalcLeftLine(),
1859 [ + - ]: 3142 : rAttrs.CalcRightLine() );
1860 : 1571 : (this->*fnRect->fnSetYMargins)( rAttrs.CalcTopLine(),
1861 [ + - ]: 3142 : rAttrs.CalcBottomLine() );
1862 : : }
1863 : 1571 : }
1864 : :
1865 : : /*************************************************************************
1866 : : |*
1867 : : |* SwFlyFrm::_Grow(), _Shrink()
1868 : : |*
1869 : : |*************************************************************************/
1870 : :
1871 : 191 : SwTwips SwFlyFrm::_Grow( SwTwips nDist, sal_Bool bTst )
1872 : : {
1873 [ - + ][ # # ]: 191 : SWRECTFN( this )
[ # # ][ - + ]
1874 [ + - ][ + - ]: 191 : if ( Lower() && !IsColLocked() && !HasFixSize() )
[ + + ][ + + ]
1875 : : {
1876 [ + - ]: 188 : SwTwips nSize = (Frm().*fnRect->fnGetHeight)();
1877 [ - + ][ + - ]: 188 : if( nSize > 0 && nDist > ( LONG_MAX - nSize ) )
1878 : 0 : nDist = LONG_MAX - nSize;
1879 : :
1880 [ - + ]: 188 : if ( nDist <= 0L )
1881 : 0 : return 0L;
1882 : :
1883 [ - + ]: 188 : if ( Lower()->IsColumnFrm() )
1884 : : { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
1885 : : //das Wachstum (wg. des Ausgleichs).
1886 [ # # ]: 0 : if ( !bTst )
1887 : : {
1888 : : // #i28701# - unlock position of Writer fly frame
1889 : 0 : UnlockPosition();
1890 : 0 : _InvalidatePos();
1891 : 0 : InvalidateSize();
1892 : : }
1893 : 0 : return 0L;
1894 : : }
1895 : :
1896 [ + - ]: 188 : if ( !bTst )
1897 : : {
1898 [ + - ]: 188 : const SwRect aOld( GetObjRectWithSpaces() );
1899 [ + - ]: 188 : _InvalidateSize();
1900 : 188 : const sal_Bool bOldLock = bLocked;
1901 : 188 : Unlock();
1902 [ + + ]: 188 : if ( IsFlyFreeFrm() )
1903 : : {
1904 : : // #i37068# - no format of position here
1905 : : // and prevent move in method <CheckClip(..)>.
1906 : : // This is needed to prevent layout loop caused by nested
1907 : : // Writer fly frames - inner Writer fly frames format its
1908 : : // anchor, which grows/shrinks the outer Writer fly frame.
1909 : : // Note: position will be invalidated below.
1910 : 160 : bValidPos = sal_True;
1911 : : // #i55416#
1912 : : // Suppress format of width for autowidth frame, because the
1913 : : // format of the width would call <SwTxtFrm::CalcFitToContent()>
1914 : : // for the lower frame, which initiated this grow.
1915 : 160 : const sal_Bool bOldFormatHeightOnly = bFormatHeightOnly;
1916 [ + - ][ + - ]: 160 : const SwFmtFrmSize& rFrmSz = GetFmt()->GetFrmSize();
1917 [ - + ]: 160 : if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
1918 : : {
1919 : 0 : bFormatHeightOnly = sal_True;
1920 : : }
1921 : 160 : static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( true );
1922 [ + - ]: 160 : ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll();
1923 : 160 : static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( false );
1924 : : // #i55416#
1925 [ - + ]: 160 : if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
1926 : : {
1927 : 0 : bFormatHeightOnly = bOldFormatHeightOnly;
1928 : : }
1929 : : }
1930 : : else
1931 [ + - ]: 28 : MakeAll();
1932 [ + - ]: 188 : _InvalidateSize();
1933 [ + - ]: 188 : InvalidatePos();
1934 [ - + ]: 188 : if ( bOldLock )
1935 : 0 : Lock();
1936 [ + - ]: 188 : const SwRect aNew( GetObjRectWithSpaces() );
1937 [ + + ]: 188 : if ( aOld != aNew )
1938 [ + - ][ + - ]: 158 : ::Notify( this, FindPageFrm(), aOld );
1939 [ + - ][ + - ]: 188 : return (aNew.*fnRect->fnGetHeight)()-(aOld.*fnRect->fnGetHeight)();
[ + - ][ + - ]
1940 : : }
1941 : 0 : return nDist;
1942 : : }
1943 : 191 : return 0L;
1944 : : }
1945 : :
1946 : 18 : SwTwips SwFlyFrm::_Shrink( SwTwips nDist, sal_Bool bTst )
1947 : : {
1948 [ + - ][ + - ]: 18 : if( Lower() && !IsColLocked() && !HasFixSize() && !IsNoShrink() )
[ + + ][ + - ]
[ + + ]
1949 : : {
1950 [ - + ][ # # ]: 10 : SWRECTFN( this )
[ # # ][ - + ]
1951 [ + - ]: 10 : SwTwips nHeight = (Frm().*fnRect->fnGetHeight)();
1952 [ - + ]: 10 : if ( nDist > nHeight )
1953 : 0 : nDist = nHeight;
1954 : :
1955 : 10 : SwTwips nVal = nDist;
1956 [ - + ]: 10 : if ( IsMinHeight() )
1957 : : {
1958 : 0 : const SwFmtFrmSize& rFmtSize = GetFmt()->GetFrmSize();
1959 [ # # ]: 0 : SwTwips nFmtHeight = bVert ? rFmtSize.GetWidth() : rFmtSize.GetHeight();
1960 : :
1961 : 0 : nVal = Min( nDist, nHeight - nFmtHeight );
1962 : : }
1963 : :
1964 [ - + ]: 10 : if ( nVal <= 0L )
1965 : 0 : return 0L;
1966 : :
1967 [ - + ]: 10 : if ( Lower()->IsColumnFrm() )
1968 : : { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
1969 : : //das Wachstum (wg. des Ausgleichs).
1970 [ # # ]: 0 : if ( !bTst )
1971 : : {
1972 [ # # ]: 0 : SwRect aOld( GetObjRectWithSpaces() );
1973 [ # # ][ # # ]: 0 : (Frm().*fnRect->fnSetHeight)( nHeight - nVal );
1974 : : // #i68520#
1975 [ # # ]: 0 : if ( nHeight - nVal != 0 )
1976 : : {
1977 : 0 : InvalidateObjRectWithSpaces();
1978 : : }
1979 [ # # ][ # # ]: 0 : nHeight = (Prt().*fnRect->fnGetHeight)();
1980 [ # # ][ # # ]: 0 : (Prt().*fnRect->fnSetHeight)( nHeight - nVal );
1981 [ # # ]: 0 : _InvalidatePos();
1982 [ # # ]: 0 : InvalidateSize();
1983 [ # # ][ # # ]: 0 : ::Notify( this, FindPageFrm(), aOld );
1984 [ # # ]: 0 : NotifyDrawObj();
1985 [ # # ][ # # ]: 0 : if ( GetAnchorFrm()->IsInFly() )
[ # # ]
1986 [ # # ][ # # ]: 0 : AnchorFrm()->FindFlyFrm()->Shrink( nDist, bTst );
[ # # ]
1987 : : }
1988 : 0 : return 0L;
1989 : : }
1990 : :
1991 [ + - ]: 10 : if ( !bTst )
1992 : : {
1993 [ + - ]: 10 : const SwRect aOld( GetObjRectWithSpaces() );
1994 [ + - ]: 10 : _InvalidateSize();
1995 : 10 : const sal_Bool bOldLocked = bLocked;
1996 : 10 : Unlock();
1997 [ + - ]: 10 : if ( IsFlyFreeFrm() )
1998 : : {
1999 : : // #i37068# - no format of position here
2000 : : // and prevent move in method <CheckClip(..)>.
2001 : : // This is needed to prevent layout loop caused by nested
2002 : : // Writer fly frames - inner Writer fly frames format its
2003 : : // anchor, which grows/shrinks the outer Writer fly frame.
2004 : : // Note: position will be invalidated below.
2005 : 10 : bValidPos = sal_True;
2006 : : // #i55416#
2007 : : // Suppress format of width for autowidth frame, because the
2008 : : // format of the width would call <SwTxtFrm::CalcFitToContent()>
2009 : : // for the lower frame, which initiated this shrink.
2010 : 10 : const sal_Bool bOldFormatHeightOnly = bFormatHeightOnly;
2011 [ + - ][ + - ]: 10 : const SwFmtFrmSize& rFrmSz = GetFmt()->GetFrmSize();
2012 [ - + ]: 10 : if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
2013 : : {
2014 : 0 : bFormatHeightOnly = sal_True;
2015 : : }
2016 : 10 : static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( true );
2017 [ + - ]: 10 : ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll();
2018 : 10 : static_cast<SwFlyFreeFrm*>(this)->SetNoMoveOnCheckClip( false );
2019 : : // #i55416#
2020 [ - + ]: 10 : if ( rFrmSz.GetWidthSizeType() != ATT_FIX_SIZE )
2021 : : {
2022 : 0 : bFormatHeightOnly = bOldFormatHeightOnly;
2023 : : }
2024 : : }
2025 : : else
2026 [ # # ]: 0 : MakeAll();
2027 [ + - ]: 10 : _InvalidateSize();
2028 [ + - ]: 10 : InvalidatePos();
2029 [ - + ]: 10 : if ( bOldLocked )
2030 : 0 : Lock();
2031 [ + - ]: 10 : const SwRect aNew( GetObjRectWithSpaces() );
2032 [ + - ]: 10 : if ( aOld != aNew )
2033 : : {
2034 [ + - ][ + - ]: 10 : ::Notify( this, FindPageFrm(), aOld );
2035 [ + - ][ + - ]: 10 : if ( GetAnchorFrm()->IsInFly() )
[ - + ]
2036 [ # # ][ # # ]: 0 : AnchorFrm()->FindFlyFrm()->Shrink( nDist, bTst );
[ # # ]
2037 : : }
2038 [ + - ][ + - ]: 10 : return (aOld.*fnRect->fnGetHeight)() -
2039 [ + - ][ + - ]: 10 : (aNew.*fnRect->fnGetHeight)();
2040 : : }
2041 : 0 : return nVal;
2042 : : }
2043 : 18 : return 0L;
2044 : : }
2045 : :
2046 : : /*************************************************************************
2047 : : |*
2048 : : |* SwFlyFrm::ChgSize()
2049 : : |*
2050 : : |*************************************************************************/
2051 : :
2052 : 2 : Size SwFlyFrm::ChgSize( const Size& aNewSize )
2053 : : {
2054 : : // #i53298#
2055 : : // If the fly frame anchored at-paragraph or at-character contains an OLE
2056 : : // object, assure that the new size fits into the current clipping area
2057 : : // of the fly frame
2058 : 2 : Size aAdjustedNewSize( aNewSize );
2059 : : {
2060 [ + - ][ + - : 8 : if ( dynamic_cast<SwFlyAtCntFrm*>(this) &&
+ - + - ]
[ + - ]
2061 [ + - ][ + - ]: 6 : Lower() && dynamic_cast<SwNoTxtFrm*>(Lower()) &&
2062 : 2 : static_cast<SwNoTxtFrm*>(Lower())->GetNode()->GetOLENode() )
2063 : : {
2064 : 2 : SwRect aClipRect;
2065 [ + - ][ + - ]: 2 : ::CalcClipRect( GetVirtDrawObj(), aClipRect, sal_False );
2066 [ - + ]: 2 : if ( aAdjustedNewSize.Width() > aClipRect.Width() )
2067 : : {
2068 : 0 : aAdjustedNewSize.setWidth( aClipRect.Width() );
2069 : : }
2070 [ - + ]: 2 : if ( aAdjustedNewSize.Height() > aClipRect.Height() )
2071 : : {
2072 : 2 : aAdjustedNewSize.setWidth( aClipRect.Height() );
2073 : : }
2074 : : }
2075 : : }
2076 [ + - ]: 2 : if ( aAdjustedNewSize != Frm().SSize() )
2077 : : {
2078 [ + - ]: 2 : SwFrmFmt *pFmt = GetFmt();
2079 [ + - ][ + - ]: 2 : SwFmtFrmSize aSz( pFmt->GetFrmSize() );
2080 : 2 : aSz.SetWidth( aAdjustedNewSize.Width() );
2081 : : // #i53298# - no tolerance any more.
2082 : : // If it reveals that the tolerance is still needed, then suppress a
2083 : : // <SetAttr> call, if <aSz> equals the current <SwFmtFrmSize> attribute.
2084 : : // if ( Abs(aAdjustedNewSize.Height() - aSz.GetHeight()) > 1 )
2085 : 2 : aSz.SetHeight( aAdjustedNewSize.Height() );
2086 : : // uebers Doc fuers Undo!
2087 [ + - ]: 2 : pFmt->GetDoc()->SetAttr( aSz, *pFmt );
2088 [ + - ]: 2 : return aSz.GetSize();
2089 : : }
2090 : : else
2091 : 2 : return Frm().SSize();
2092 : : }
2093 : :
2094 : : /*************************************************************************
2095 : : |*
2096 : : |* SwFlyFrm::IsLowerOf()
2097 : : |*
2098 : : |*************************************************************************/
2099 : :
2100 : 809 : sal_Bool SwFlyFrm::IsLowerOf( const SwLayoutFrm* pUpperFrm ) const
2101 : : {
2102 : : OSL_ENSURE( GetAnchorFrm(), "8-( Fly is lost in Space." );
2103 : 809 : const SwFrm* pFrm = GetAnchorFrm();
2104 [ + + ]: 2942 : do
2105 : : {
2106 [ - + ]: 2942 : if ( pFrm == pUpperFrm )
2107 : 0 : return sal_True;
2108 : 2942 : pFrm = pFrm->IsFlyFrm()
2109 : 0 : ? ((const SwFlyFrm*)pFrm)->GetAnchorFrm()
2110 [ - + ]: 2942 : : pFrm->GetUpper();
2111 : : } while ( pFrm );
2112 : 809 : return sal_False;
2113 : : }
2114 : :
2115 : : /*************************************************************************
2116 : : |*
2117 : : |* SwFlyFrm::Cut()
2118 : : |*
2119 : : |*************************************************************************/
2120 : :
2121 : 18 : void SwFlyFrm::Cut()
2122 : : {
2123 : 18 : }
2124 : :
2125 : : /*************************************************************************
2126 : : |*
2127 : : |* SwFrm::AppendFly(), RemoveFly()
2128 : : |*
2129 : : |*************************************************************************/
2130 : :
2131 : 611 : void SwFrm::AppendFly( SwFlyFrm *pNew )
2132 : : {
2133 [ + + ]: 611 : if ( !pDrawObjs )
2134 [ + - ][ + - ]: 459 : pDrawObjs = new SwSortedObjs();
2135 [ + - ]: 611 : pDrawObjs->Insert( *pNew );
2136 [ + - ]: 611 : pNew->ChgAnchorFrm( this );
2137 : :
2138 : : //Bei der Seite anmelden; kann sein, dass noch keine da ist - die
2139 : : //Anmeldung wird dann in SwPageFrm::PreparePage durch gefuehrt.
2140 [ + - ]: 611 : SwPageFrm *pPage = FindPageFrm();
2141 [ + + ]: 611 : if ( pPage )
2142 : : {
2143 [ + + ][ + - ]: 605 : if ( pNew->IsFlyAtCntFrm() && pNew->Frm().Top() == FAR_AWAY )
[ + + ]
2144 : : {
2145 : : //Versuch die Seitenformatierung von neuen Dokumenten etwas
2146 : : //guenstiger zu gestalten.
2147 : : //Wir haengen die Flys erstenmal nach hinten damit sie bei heftigem
2148 : : //Fluss der Anker nicht unoetig oft formatiert werden.
2149 : : //Damit man noch brauchbar an das Ende des Dokumentes springen
2150 : : //kann werden die Flys nicht ganz an das Ende gehaengt.
2151 : 123 : SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
2152 [ + + ][ + - ]: 123 : if( !SwLayHelper::CheckPageFlyCache( pPage, pNew ) )
2153 : : {
2154 : 117 : SwPageFrm *pTmp = pRoot->GetLastPage();
2155 [ - + ]: 117 : if ( pTmp->GetPhyPageNum() > 30 )
2156 : : {
2157 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < 10; ++i )
2158 : : {
2159 : 0 : pTmp = (SwPageFrm*)pTmp->GetPrev();
2160 [ # # ]: 0 : if( pTmp->GetPhyPageNum() <= pPage->GetPhyPageNum() )
2161 : 0 : break; // damit wir nicht vor unserem Anker landen
2162 : : }
2163 [ # # ]: 0 : if ( pTmp->IsEmptyPage() )
2164 : 0 : pTmp = (SwPageFrm*)pTmp->GetPrev();
2165 : 0 : pPage = pTmp;
2166 : : }
2167 : : }
2168 [ + - ]: 123 : pPage->AppendFlyToPage( pNew );
2169 : : }
2170 : : else
2171 [ + - ]: 482 : pPage->AppendFlyToPage( pNew );
2172 : : }
2173 : 611 : }
2174 : :
2175 : 521 : void SwFrm::RemoveFly( SwFlyFrm *pToRemove )
2176 : : {
2177 : : //Bei der Seite Abmelden - kann schon passiert sein weil die Seite
2178 : : //bereits destruiert wurde.
2179 : 521 : SwPageFrm *pPage = pToRemove->FindPageFrm();
2180 [ + - ][ + + ]: 521 : if ( pPage && pPage->GetSortedObjs() )
[ + + ]
2181 : : {
2182 : 32 : pPage->RemoveFlyFromPage( pToRemove );
2183 : : }
2184 : : // #i73201#
2185 : : else
2186 : : {
2187 [ + - + - : 1467 : if ( pToRemove->IsAccessibleFrm() &&
+ + ][ + + ]
2188 : 489 : pToRemove->GetFmt() &&
2189 : 489 : !pToRemove->IsFlyInCntFrm() )
2190 : : {
2191 : 118 : SwRootFrm *pRootFrm = getRootFrm();
2192 [ - + ][ - + ]: 118 : if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
[ + - ]
2193 : : {
2194 : 0 : ViewShell *pVSh = pRootFrm->GetCurrShell();
2195 [ # # ][ # # ]: 0 : if( pVSh && pVSh->Imp() )
[ # # ]
2196 : : {
2197 : 0 : pVSh->Imp()->DisposeAccessibleFrm( pToRemove );
2198 : : }
2199 : : }
2200 : : }
2201 : : }
2202 : :
2203 : 521 : pDrawObjs->Remove( *pToRemove );
2204 [ + + ]: 521 : if ( !pDrawObjs->Count() )
2205 [ + - ]: 366 : DELETEZ( pDrawObjs );
2206 : :
2207 : 521 : pToRemove->ChgAnchorFrm( 0 );
2208 : :
2209 [ + - ][ - + ]: 521 : if ( !pToRemove->IsFlyInCntFrm() && GetUpper() && IsInTab() )//MA_FLY_HEIGHT
[ - + ][ + + ]
2210 : 0 : GetUpper()->InvalidateSize();
2211 : 521 : }
2212 : :
2213 : : /*************************************************************************
2214 : : |*
2215 : : |* SwFrm::AppendDrawObj(), RemoveDrawObj()
2216 : : |*
2217 : : |* --> OD 2004-07-06 #i28701# - new methods
2218 : : |*
2219 : : |*************************************************************************/
2220 : 573 : void SwFrm::AppendDrawObj( SwAnchoredObject& _rNewObj )
2221 : : {
2222 [ - + ]: 573 : if ( !_rNewObj.ISA(SwAnchoredDrawObject) )
2223 : : {
2224 : : OSL_FAIL( "SwFrm::AppendDrawObj(..) - anchored object of unexcepted type -> object not appended" );
2225 : 573 : return;
2226 : : }
2227 : :
2228 [ + - - + : 1146 : if ( !_rNewObj.GetDrawObj()->ISA(SwDrawVirtObj) &&
# # ][ - + ]
2229 : 573 : _rNewObj.GetAnchorFrm() && _rNewObj.GetAnchorFrm() != this )
2230 : : {
2231 : : // perform disconnect from layout, if 'master' drawing object is appended
2232 : : // to a new frame.
2233 : 0 : static_cast<SwDrawContact*>(::GetUserCall( _rNewObj.GetDrawObj() ))->
2234 : 0 : DisconnectFromLayout( false );
2235 : : }
2236 : :
2237 [ + - ]: 573 : if ( _rNewObj.GetAnchorFrm() != this )
2238 : : {
2239 [ + + ]: 573 : if ( !pDrawObjs )
2240 [ + - ]: 319 : pDrawObjs = new SwSortedObjs();
2241 : 573 : pDrawObjs->Insert( _rNewObj );
2242 : 573 : _rNewObj.ChgAnchorFrm( this );
2243 : : }
2244 : :
2245 : : // #i113730#
2246 : : // Assure the control objects and group objects containing controls are on the control layer
2247 [ + + ]: 573 : if ( ::CheckControlLayer( _rNewObj.DrawObj() ) )
2248 : : {
2249 : 470 : const IDocumentDrawModelAccess* pIDDMA = getIDocumentDrawModelAccess();
2250 : 470 : const SdrLayerID aCurrentLayer(_rNewObj.DrawObj()->GetLayer());
2251 : 470 : const SdrLayerID aControlLayerID(pIDDMA->GetControlsId());
2252 : 470 : const SdrLayerID aInvisibleControlLayerID(pIDDMA->GetInvisibleControlsId());
2253 : :
2254 [ - + ][ + - ]: 470 : if(aCurrentLayer != aControlLayerID && aCurrentLayer != aInvisibleControlLayerID)
2255 : : {
2256 [ # # # # ]: 0 : if ( aCurrentLayer == pIDDMA->GetInvisibleHellId() ||
[ # # ]
2257 : 0 : aCurrentLayer == pIDDMA->GetInvisibleHeavenId() )
2258 : : {
2259 : 0 : _rNewObj.DrawObj()->SetLayer(aInvisibleControlLayerID);
2260 : : }
2261 : : else
2262 : : {
2263 : 0 : _rNewObj.DrawObj()->SetLayer(aControlLayerID);
2264 : : }
2265 : : }
2266 : : }
2267 : :
2268 : : // no direct positioning needed, but invalidate the drawing object position
2269 : 573 : _rNewObj.InvalidateObjPos();
2270 : :
2271 : : // register at page frame
2272 : 573 : SwPageFrm* pPage = FindPageFrm();
2273 [ + + ]: 573 : if ( pPage )
2274 : : {
2275 : 570 : pPage->AppendDrawObjToPage( _rNewObj );
2276 : : }
2277 : :
2278 : : // Notify accessible layout.
2279 : 573 : ViewShell* pSh = getRootFrm()->GetCurrShell();
2280 [ + - ]: 573 : if( pSh )
2281 : : {
2282 : 573 : SwRootFrm* pLayout = getRootFrm();
2283 [ - + ][ - + ]: 573 : if( pLayout && pLayout->IsAnyShellAccessible() )
[ + - ]
2284 : 0 : pSh->Imp()->AddAccessibleObj( _rNewObj.GetDrawObj() );
2285 : : }
2286 : : }
2287 : :
2288 : 567 : void SwFrm::RemoveDrawObj( SwAnchoredObject& _rToRemoveObj )
2289 : : {
2290 : : // Notify accessible layout.
2291 : 567 : ViewShell* pSh = getRootFrm()->GetCurrShell();
2292 [ + + ]: 567 : if( pSh )
2293 : : {
2294 : 19 : SwRootFrm* pLayout = getRootFrm();
2295 [ - + ][ - + ]: 19 : if( pLayout && pLayout->IsAnyShellAccessible() )
[ + - ]
2296 : 0 : pSh->Imp()->DisposeAccessibleObj( _rToRemoveObj.GetDrawObj() );
2297 : : }
2298 : :
2299 : : // deregister from page frame
2300 : 567 : SwPageFrm* pPage = _rToRemoveObj.GetPageFrm();
2301 [ + - ][ + + ]: 567 : if ( pPage && pPage->GetSortedObjs() )
[ + + ]
2302 : 17 : pPage->RemoveDrawObjFromPage( _rToRemoveObj );
2303 : :
2304 : 567 : pDrawObjs->Remove( _rToRemoveObj );
2305 [ + + ]: 567 : if ( !pDrawObjs->Count() )
2306 [ + - ]: 316 : DELETEZ( pDrawObjs );
2307 : :
2308 : 567 : _rToRemoveObj.ChgAnchorFrm( 0 );
2309 : 567 : }
2310 : :
2311 : : /*************************************************************************
2312 : : |*
2313 : : |* SwFrm::InvalidateObjs()
2314 : : |*
2315 : : |*************************************************************************/
2316 : : // #i28701# - change purpose of method and adjust its name
2317 : 8175 : void SwFrm::InvalidateObjs( const bool _bInvaPosOnly,
2318 : : const bool _bNoInvaOfAsCharAnchoredObjs )
2319 : : {
2320 [ + + ]: 8175 : if ( GetDrawObjs() )
2321 : : {
2322 : : // #i26945# - determine page the frame is on,
2323 : : // in order to check, if anchored object is registered at the same
2324 : : // page.
2325 : 459 : const SwPageFrm* pPageFrm = FindPageFrm();
2326 : : // #i28701# - re-factoring
2327 : 459 : sal_uInt32 i = 0;
2328 [ + + ]: 1052 : for ( ; i < GetDrawObjs()->Count(); ++i )
2329 : : {
2330 : 593 : SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i];
2331 [ + + ]: 1186 : if ( _bNoInvaOfAsCharAnchoredObjs &&
[ + - + + ]
2332 : 593 : (pAnchoredObj->GetFrmFmt().GetAnchor().GetAnchorId()
2333 : : == FLY_AS_CHAR) )
2334 : : {
2335 : 468 : continue;
2336 : : }
2337 : : // #i26945# - no invalidation, if anchored object
2338 : : // isn't registered at the same page and instead is registered at
2339 : : // the page, where its anchor character text frame is on.
2340 [ + - - + ]: 250 : if ( pAnchoredObj->GetPageFrm() &&
[ - + ]
2341 : 125 : pAnchoredObj->GetPageFrm() != pPageFrm )
2342 : : {
2343 : 0 : SwTxtFrm* pAnchorCharFrm = pAnchoredObj->FindAnchorCharFrm();
2344 [ # # ]: 0 : if ( pAnchorCharFrm &&
[ # # # # ]
2345 : 0 : pAnchoredObj->GetPageFrm() == pAnchorCharFrm->FindPageFrm() )
2346 : : {
2347 : 0 : continue;
2348 : : }
2349 : : // #115759# - unlock its position, if anchored
2350 : : // object isn't registered at the page, where its anchor
2351 : : // character text frame is on, respectively if it has no
2352 : : // anchor character text frame.
2353 : : else
2354 : : {
2355 : 0 : pAnchoredObj->UnlockPosition();
2356 : : }
2357 : : }
2358 : : // #i51474# - reset flag, that anchored object
2359 : : // has cleared environment, and unlock its position, if the anchored
2360 : : // object is registered at the same page as the anchor frame is on.
2361 [ - + # # : 125 : if ( pAnchoredObj->ClearedEnvironment() &&
# # ][ - + ]
2362 : 0 : pAnchoredObj->GetPageFrm() &&
2363 : 0 : pAnchoredObj->GetPageFrm() == pPageFrm )
2364 : : {
2365 : 0 : pAnchoredObj->UnlockPosition();
2366 : 0 : pAnchoredObj->SetClearedEnvironment( false );
2367 : : }
2368 : : // distinguish between writer fly frames and drawing objects
2369 [ + + ]: 125 : if ( pAnchoredObj->ISA(SwFlyFrm) )
2370 : : {
2371 [ + - ]: 65 : SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
2372 : 65 : pFly->_Invalidate();
2373 : 65 : pFly->_InvalidatePos();
2374 [ - + ]: 65 : if ( !_bInvaPosOnly )
2375 : 0 : pFly->_InvalidateSize();
2376 : : }
2377 : : else
2378 : : {
2379 : 60 : pAnchoredObj->InvalidateObjPos();
2380 : : } // end of distinction between writer fly frames and drawing objects
2381 : :
2382 : : } // end of loop on objects, which are connected to the frame
2383 : : }
2384 : 8175 : }
2385 : :
2386 : : /*************************************************************************
2387 : : |*
2388 : : |* SwLayoutFrm::NotifyLowerObjs()
2389 : : |*
2390 : : |*************************************************************************/
2391 : : // #i28701# - change purpose of method and its name
2392 : : // #i26945# - correct check, if anchored object is a lower
2393 : : // of the layout frame. E.g., anchor character text frame can be a follow text
2394 : : // frame.
2395 : : // #i44016# - add parameter <_bUnlockPosOfObjs> to
2396 : : // force an unlockposition call for the lower objects.
2397 : 9209 : void SwLayoutFrm::NotifyLowerObjs( const bool _bUnlockPosOfObjs )
2398 : : {
2399 : : // invalidate lower floating screen objects
2400 : 9209 : SwPageFrm* pPageFrm = FindPageFrm();
2401 [ + + ][ + + ]: 9209 : if ( pPageFrm && pPageFrm->GetSortedObjs() )
[ + - ]
2402 : : {
2403 : 700 : SwSortedObjs& rObjs = *(pPageFrm->GetSortedObjs());
2404 [ + + ]: 1598 : for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i )
2405 : : {
2406 : 898 : SwAnchoredObject* pObj = rObjs[i];
2407 : : // #i26945# - check, if anchored object is a lower
2408 : : // of the layout frame is changed to check, if its anchor frame
2409 : : // is a lower of the layout frame.
2410 : : // determine the anchor frame - usually it's the anchor frame,
2411 : : // for at-character/as-character anchored objects the anchor character
2412 : : // text frame is taken.
2413 : 898 : const SwFrm* pAnchorFrm = pObj->GetAnchorFrmContainingAnchPos();
2414 [ + + ]: 898 : if ( pObj->ISA(SwFlyFrm) )
2415 : : {
2416 [ + - ]: 868 : SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pObj);
2417 : :
2418 [ + + ]: 868 : if ( pFly->Frm().Left() == FAR_AWAY )
2419 : 48 : continue;
2420 : :
2421 [ + + ]: 820 : if ( pFly->IsAnLower( this ) )
2422 : 583 : continue;
2423 : :
2424 : : // #i26945# - use <pAnchorFrm> to check, if
2425 : : // fly frame is lower of layout frame resp. if fly frame is
2426 : : // at a different page registered as its anchor frame is on.
2427 : 237 : const bool bLow = IsAnLower( pAnchorFrm );
2428 [ - + ][ + + ]: 237 : if ( bLow || pAnchorFrm->FindPageFrm() != pPageFrm )
[ + + ]
2429 : : {
2430 : 12 : pFly->_Invalidate( pPageFrm );
2431 [ + - ][ + - ]: 12 : if ( !bLow || pFly->IsFlyAtCntFrm() )
[ + - ]
2432 : : {
2433 : : // #i44016#
2434 [ + + ]: 12 : if ( _bUnlockPosOfObjs )
2435 : : {
2436 : 6 : pFly->UnlockPosition();
2437 : : }
2438 : 12 : pFly->_InvalidatePos();
2439 : : }
2440 : : else
2441 : 0 : pFly->_InvalidatePrt();
2442 : : }
2443 : : }
2444 : : else
2445 : : {
2446 : : OSL_ENSURE( pObj->ISA(SwAnchoredDrawObject),
2447 : : "<SwLayoutFrm::NotifyFlys() - anchored object of unexcepted type" );
2448 : : // #i26945# - use <pAnchorFrm> to check, if
2449 : : // fly frame is lower of layout frame resp. if fly frame is
2450 : : // at a different page registered as its anchor frame is on.
2451 [ + + - + ]: 51 : if ( IsAnLower( pAnchorFrm ) ||
[ + + ]
2452 : 21 : pAnchorFrm->FindPageFrm() != pPageFrm )
2453 : : {
2454 : : // #i44016#
2455 [ + + ]: 9 : if ( _bUnlockPosOfObjs )
2456 : : {
2457 : 3 : pObj->UnlockPosition();
2458 : : }
2459 : 9 : pObj->InvalidateObjPos();
2460 : : }
2461 : : }
2462 : : }
2463 : : }
2464 : 9209 : }
2465 : :
2466 : : /*************************************************************************
2467 : : |*
2468 : : |* SwFlyFrm::NotifyDrawObj()
2469 : : |*
2470 : : |*************************************************************************/
2471 : :
2472 : 1592 : void SwFlyFrm::NotifyDrawObj()
2473 : : {
2474 : 1592 : SwVirtFlyDrawObj* pObj = GetVirtDrawObj();
2475 : 1592 : pObj->SetRect();
2476 : 1592 : pObj->SetRectsDirty();
2477 : 1592 : pObj->SetChanged();
2478 : 1592 : pObj->BroadcastObjectChange();
2479 [ - + ]: 1592 : if ( GetFmt()->GetSurround().IsContour() )
2480 : 0 : ClrContourCache( pObj );
2481 : 1592 : }
2482 : :
2483 : : /*************************************************************************
2484 : : |*
2485 : : |* SwFlyFrm::CalcRel()
2486 : : |*
2487 : : |*************************************************************************/
2488 : :
2489 : 1571 : Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const
2490 : : {
2491 : 1571 : Size aRet( rSz.GetSize() );
2492 : :
2493 [ + + ]: 1571 : const SwFrm *pRel = IsFlyLayFrm() ? GetAnchorFrm() : GetAnchorFrm()->GetUpper();
2494 [ + - ]: 1571 : if( pRel ) // LAYER_IMPL
2495 : : {
2496 : 1571 : long nRelWidth = LONG_MAX, nRelHeight = LONG_MAX;
2497 : 1571 : const ViewShell *pSh = getRootFrm()->GetCurrShell();
2498 [ + + ][ + - : 3118 : if ( ( pRel->IsBodyFrm() || pRel->IsPageFrm() ) &&
- + # # ]
[ - + ][ + + ]
2499 : 1547 : pSh && pSh->GetViewOptions()->getBrowseMode() &&
2500 : 0 : pSh->VisArea().HasArea() )
2501 : : {
2502 [ # # ]: 0 : nRelWidth = pSh->GetBrowseWidth();
2503 : 0 : nRelHeight = pSh->VisArea().Height();
2504 [ # # ][ # # ]: 0 : Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
2505 : 0 : long nDiff = nRelWidth - pRel->Prt().Width();
2506 [ # # ]: 0 : if ( nDiff > 0 )
2507 : 0 : nRelWidth -= nDiff;
2508 : 0 : nRelHeight -= 2*aBorder.Height();
2509 : 0 : nDiff = nRelHeight - pRel->Prt().Height();
2510 [ # # ]: 0 : if ( nDiff > 0 )
2511 : 0 : nRelHeight -= nDiff;
2512 : : }
2513 : 1571 : nRelWidth = Min( nRelWidth, pRel->Prt().Width() );
2514 : 1571 : nRelHeight = Min( nRelHeight, pRel->Prt().Height() );
2515 [ + + ]: 1571 : if( !pRel->IsPageFrm() )
2516 : : {
2517 : 1341 : const SwPageFrm* pPage = FindPageFrm();
2518 [ + - ]: 1341 : if( pPage )
2519 : : {
2520 : 1341 : nRelWidth = Min( nRelWidth, pPage->Prt().Width() );
2521 : 1341 : nRelHeight = Min( nRelHeight, pPage->Prt().Height() );
2522 : : }
2523 : : }
2524 : :
2525 [ + + ][ + - ]: 1571 : if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 0xFF )
[ + + ]
2526 : 9 : aRet.Width() = nRelWidth * rSz.GetWidthPercent() / 100;
2527 [ + + ][ + - ]: 1571 : if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 0xFF )
[ + + ]
2528 : 6 : aRet.Height() = nRelHeight * rSz.GetHeightPercent() / 100;
2529 : :
2530 [ - + ]: 1571 : if ( rSz.GetWidthPercent() == 0xFF )
2531 : : {
2532 : 0 : aRet.Width() *= aRet.Height();
2533 : 0 : aRet.Width() /= rSz.GetHeight();
2534 : : }
2535 [ - + ]: 1571 : else if ( rSz.GetHeightPercent() == 0xFF )
2536 : : {
2537 : 0 : aRet.Height() *= aRet.Width();
2538 : 0 : aRet.Height() /= rSz.GetWidth();
2539 : : }
2540 : : }
2541 : 1571 : return aRet;
2542 : : }
2543 : :
2544 : : /*************************************************************************
2545 : : |*
2546 : : |* SwFlyFrm::CalcAutoWidth()
2547 : : |*
2548 : : |*************************************************************************/
2549 : :
2550 : 0 : SwTwips lcl_CalcAutoWidth( const SwLayoutFrm& rFrm )
2551 : : {
2552 : 0 : SwTwips nRet = 0;
2553 : 0 : SwTwips nMin = 0;
2554 : 0 : const SwFrm* pFrm = rFrm.Lower();
2555 : :
2556 : : // No autowidth defined for columned frames
2557 [ # # ][ # # ]: 0 : if ( !pFrm || pFrm->IsColumnFrm() )
[ # # ]
2558 : 0 : return nRet;
2559 : :
2560 [ # # ]: 0 : while ( pFrm )
2561 : : {
2562 [ # # ]: 0 : if ( pFrm->IsSctFrm() )
2563 : : {
2564 : 0 : nMin = lcl_CalcAutoWidth( *(SwSectionFrm*)pFrm );
2565 : : }
2566 [ # # ]: 0 : if ( pFrm->IsTxtFrm() )
2567 : : {
2568 : 0 : nMin = ((SwTxtFrm*)pFrm)->CalcFitToContent();
2569 : : const SvxLRSpaceItem &rSpace =
2570 : 0 : ((SwTxtFrm*)pFrm)->GetTxtNode()->GetSwAttrSet().GetLRSpace();
2571 : 0 : nMin += rSpace.GetRight() + rSpace.GetTxtLeft() + rSpace.GetTxtFirstLineOfst();
2572 : : }
2573 [ # # ]: 0 : else if ( pFrm->IsTabFrm() )
2574 : : {
2575 : 0 : const SwFmtFrmSize& rTblFmtSz = ((SwTabFrm*)pFrm)->GetTable()->GetFrmFmt()->GetFrmSize();
2576 [ # # ]: 0 : if ( USHRT_MAX == rTblFmtSz.GetSize().Width() ||
[ # # # # ]
2577 : 0 : text::HoriOrientation::NONE == ((SwTabFrm*)pFrm)->GetFmt()->GetHoriOrient().GetHoriOrient() )
2578 : : {
2579 : 0 : const SwPageFrm* pPage = rFrm.FindPageFrm();
2580 : : // auto width table
2581 : 0 : nMin = pFrm->GetUpper()->IsVertical() ?
2582 : 0 : pPage->Prt().Height() :
2583 [ # # ]: 0 : pPage->Prt().Width();
2584 : : }
2585 : : else
2586 : : {
2587 : 0 : nMin = rTblFmtSz.GetSize().Width();
2588 : : }
2589 : : }
2590 : :
2591 [ # # ]: 0 : if ( nMin > nRet )
2592 : 0 : nRet = nMin;
2593 : :
2594 : 0 : pFrm = pFrm->GetNext();
2595 : : }
2596 : :
2597 : 0 : return nRet;
2598 : : }
2599 : :
2600 : 0 : SwTwips SwFlyFrm::CalcAutoWidth() const
2601 : : {
2602 : 0 : return lcl_CalcAutoWidth( *this );
2603 : : }
2604 : :
2605 : : /*************************************************************************
2606 : : |*
2607 : : |* SwFlyFrm::GetContour()
2608 : : |*
2609 : : |*************************************************************************/
2610 : : /// OD 16.04.2003 #i13147# - If called for paint and the <SwNoTxtFrm> contains
2611 : : /// a graphic, load of intrinsic graphic has to be avoided.
2612 : 287 : sal_Bool SwFlyFrm::GetContour( PolyPolygon& rContour,
2613 : : const sal_Bool _bForPaint ) const
2614 : : {
2615 : 287 : sal_Bool bRet = sal_False;
2616 [ + + ]: 319 : if( GetFmt()->GetSurround().IsContour() && Lower() &&
[ + - + - ]
[ + + ]
2617 : 32 : Lower()->IsNoTxtFrm() )
2618 : : {
2619 : 32 : SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
2620 : : // OD 16.04.2003 #i13147# - determine <GraphicObject> instead of <Graphic>
2621 : : // in order to avoid load of graphic, if <SwNoTxtNode> contains a graphic
2622 : : // node and method is called for paint.
2623 : 32 : const GraphicObject* pGrfObj = NULL;
2624 : 32 : sal_Bool bGrfObjCreated = sal_False;
2625 : 32 : const SwGrfNode* pGrfNd = pNd->GetGrfNode();
2626 [ + + ][ + - ]: 32 : if ( pGrfNd && _bForPaint )
2627 : : {
2628 : 16 : pGrfObj = &(pGrfNd->GetGrfObj());
2629 : : }
2630 : : else
2631 : : {
2632 [ + - ][ + - ]: 16 : pGrfObj = new GraphicObject( pNd->GetGraphic() );
2633 : 16 : bGrfObjCreated = sal_True;
2634 : : }
2635 : : OSL_ENSURE( pGrfObj, "SwFlyFrm::GetContour() - No Graphic/GraphicObject found at <SwNoTxtNode>." );
2636 [ + - ][ - + ]: 32 : if ( pGrfObj && pGrfObj->GetType() != GRAPHIC_NONE )
[ - + ]
2637 : : {
2638 [ # # ][ # # ]: 0 : if( !pNd->HasContour() )
2639 : : {
2640 : : // OD 16.04.2003 #i13147# - no <CreateContour> for a graphic
2641 : : // during paint. Thus, return (value of <bRet> should be <sal_False>).
2642 [ # # ][ # # ]: 0 : if ( pGrfNd && _bForPaint )
2643 : : {
2644 : : OSL_FAIL( "SwFlyFrm::GetContour() - No Contour found at <SwNoTxtNode> during paint." );
2645 : 0 : return bRet;
2646 : : }
2647 [ # # ]: 0 : pNd->CreateContour();
2648 : : }
2649 [ # # ]: 0 : pNd->GetContour( rContour );
2650 : : //Der Node haelt das Polygon passend zur Originalgroesse der Grafik
2651 : : //hier muss die Skalierung einkalkuliert werden.
2652 : 0 : SwRect aClip;
2653 : 0 : SwRect aOrig;
2654 [ # # ]: 0 : Lower()->Calc();
2655 [ # # ]: 0 : ((SwNoTxtFrm*)Lower())->GetGrfArea( aClip, &aOrig, sal_False );
2656 : : // OD 16.04.2003 #i13147# - copy method code <SvxContourDlg::ScaleContour(..)>
2657 : : // in order to avoid that graphic has to be loaded for contour scale.
2658 : : //SvxContourDlg::ScaleContour( rContour, aGrf, MAP_TWIP, aOrig.SSize() );
2659 : : {
2660 [ # # ]: 0 : OutputDevice* pOutDev = Application::GetDefaultDevice();
2661 [ # # ]: 0 : const MapMode aDispMap( MAP_TWIP );
2662 [ # # ]: 0 : const MapMode aGrfMap( pGrfObj->GetPrefMapMode() );
2663 : 0 : const Size aGrfSize( pGrfObj->GetPrefSize() );
2664 : 0 : Size aOrgSize;
2665 : 0 : Point aNewPoint;
2666 : 0 : sal_Bool bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
2667 : :
2668 [ # # ]: 0 : if ( bPixelMap )
2669 [ # # ]: 0 : aOrgSize = pOutDev->PixelToLogic( aGrfSize, aDispMap );
2670 : : else
2671 [ # # ]: 0 : aOrgSize = pOutDev->LogicToLogic( aGrfSize, aGrfMap, aDispMap );
2672 : :
2673 [ # # ][ # # ]: 0 : if ( aOrgSize.Width() && aOrgSize.Height() )
[ # # ]
2674 : : {
2675 : 0 : double fScaleX = (double) aOrig.Width() / aOrgSize.Width();
2676 : 0 : double fScaleY = (double) aOrig.Height() / aOrgSize.Height();
2677 : :
2678 [ # # ][ # # ]: 0 : for ( sal_uInt16 j = 0, nPolyCount = rContour.Count(); j < nPolyCount; j++ )
2679 : : {
2680 [ # # ]: 0 : Polygon& rPoly = rContour[ j ];
2681 : :
2682 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
2683 : : {
2684 [ # # ]: 0 : if ( bPixelMap )
2685 [ # # ][ # # ]: 0 : aNewPoint = pOutDev->PixelToLogic( rPoly[ i ], aDispMap );
2686 : : else
2687 [ # # ][ # # ]: 0 : aNewPoint = pOutDev->LogicToLogic( rPoly[ i ], aGrfMap, aDispMap );
2688 : :
2689 [ # # ]: 0 : rPoly[ i ] = Point( FRound( aNewPoint.X() * fScaleX ), FRound( aNewPoint.Y() * fScaleY ) );
2690 : : }
2691 : : }
2692 [ # # ][ # # ]: 0 : }
2693 : : }
2694 : : // OD 17.04.2003 #i13147# - destroy created <GraphicObject>.
2695 [ # # ]: 0 : if ( bGrfObjCreated )
2696 : : {
2697 [ # # ][ # # ]: 0 : delete pGrfObj;
2698 : : }
2699 [ # # ]: 0 : rContour.Move( aOrig.Left(), aOrig.Top() );
2700 [ # # ]: 0 : if( !aClip.Width() )
2701 : 0 : aClip.Width( 1 );
2702 [ # # ]: 0 : if( !aClip.Height() )
2703 : 0 : aClip.Height( 1 );
2704 [ # # ][ # # ]: 0 : rContour.Clip( aClip.SVRect() );
2705 [ # # ]: 0 : rContour.Optimize(POLY_OPTIMIZE_CLOSE);
2706 : 0 : bRet = sal_True;
2707 : : }
2708 : : }
2709 : 287 : return bRet;
2710 : : }
2711 : :
2712 : : // OD 2004-03-25 #i26791#
2713 : 2250 : const SwVirtFlyDrawObj* SwFlyFrm::GetVirtDrawObj() const
2714 : : {
2715 : 2250 : return static_cast<const SwVirtFlyDrawObj*>(GetDrawObj());
2716 : : }
2717 : 12529 : SwVirtFlyDrawObj* SwFlyFrm::GetVirtDrawObj()
2718 : : {
2719 : 12529 : return static_cast<SwVirtFlyDrawObj*>(DrawObj());
2720 : : }
2721 : :
2722 : : // =============================================================================
2723 : : // OD 2004-03-24 #i26791# - implementation of pure virtual method declared in
2724 : : // base class <SwAnchoredObject>
2725 : : // =============================================================================
2726 : 151 : void SwFlyFrm::InvalidateObjPos()
2727 : : {
2728 : 151 : InvalidatePos();
2729 : : // #i68520#
2730 : 151 : InvalidateObjRectWithSpaces();
2731 : 151 : }
2732 : :
2733 : 17078 : SwFrmFmt& SwFlyFrm::GetFrmFmt()
2734 : : {
2735 : : OSL_ENSURE( GetFmt(),
2736 : : "<SwFlyFrm::GetFrmFmt()> - missing frame format -> crash." );
2737 : 17078 : return *GetFmt();
2738 : : }
2739 : 20728 : const SwFrmFmt& SwFlyFrm::GetFrmFmt() const
2740 : : {
2741 : : OSL_ENSURE( GetFmt(),
2742 : : "<SwFlyFrm::GetFrmFmt()> - missing frame format -> crash." );
2743 : 20728 : return *GetFmt();
2744 : : }
2745 : :
2746 : 20967 : const SwRect SwFlyFrm::GetObjRect() const
2747 : : {
2748 : 20967 : return Frm();
2749 : : }
2750 : :
2751 : : // #i70122#
2752 : : // for Writer fly frames the bounding rectangle equals the object rectangles
2753 : 2394 : const SwRect SwFlyFrm::GetObjBoundRect() const
2754 : : {
2755 : 2394 : return GetObjRect();
2756 : : }
2757 : :
2758 : : // #i68520#
2759 : 756 : bool SwFlyFrm::_SetObjTop( const SwTwips _nTop )
2760 : : {
2761 : 756 : const bool bChanged( Frm().Pos().Y() != _nTop );
2762 : :
2763 : 756 : Frm().Pos().Y() = _nTop;
2764 : :
2765 : 756 : return bChanged;
2766 : : }
2767 : 252 : bool SwFlyFrm::_SetObjLeft( const SwTwips _nLeft )
2768 : : {
2769 : 252 : const bool bChanged( Frm().Pos().X() != _nLeft );
2770 : :
2771 : 252 : Frm().Pos().X() = _nLeft;
2772 : :
2773 : 252 : return bChanged;
2774 : : }
2775 : :
2776 : : /** method to assure that anchored object is registered at the correct
2777 : : page frame
2778 : :
2779 : : OD 2004-07-02 #i28701#
2780 : :
2781 : : @author OD
2782 : : */
2783 : 0 : void SwFlyFrm::RegisterAtCorrectPage()
2784 : : {
2785 : : // default behaviour is to do nothing.
2786 : 0 : }
2787 : :
2788 : : /** method to determine, if a <MakeAll()> on the Writer fly frame is possible
2789 : :
2790 : : OD 2004-05-11 #i28701#
2791 : :
2792 : : @author OD
2793 : : */
2794 : 1554 : bool SwFlyFrm::IsFormatPossible() const
2795 : : {
2796 : 1554 : return SwAnchoredObject::IsFormatPossible() &&
2797 [ + - ][ + - ]: 1554 : !IsLocked() && !IsColLocked();
[ + - ]
2798 : : }
2799 : :
2800 : 6 : void SwFlyFrm::GetAnchoredObjects( std::list<SwAnchoredObject*>& aList, const SwFmt& rFmt )
2801 : : {
2802 [ + - ]: 6 : SwIterator<SwFlyFrm,SwFmt> aIter( rFmt );
2803 [ + - ][ + - ]: 12 : for( SwFlyFrm* pFlyFrm = aIter.First(); pFlyFrm; pFlyFrm = aIter.Next() )
[ + + ]
2804 [ + - ][ + - ]: 12 : aList.push_back( pFlyFrm );
[ + - ]
2805 : 6 : }
2806 : :
2807 : 35582 : const SwFlyFrmFmt * SwFlyFrm::GetFmt() const
2808 : : {
2809 : 35582 : return static_cast< const SwFlyFrmFmt * >( GetDep() );
2810 : : }
2811 : :
2812 : 47545 : SwFlyFrmFmt * SwFlyFrm::GetFmt()
2813 : : {
2814 : 47545 : return static_cast< SwFlyFrmFmt * >( GetDep() );
2815 : : }
2816 : :
2817 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|