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