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 27 #include "cmdid.h" 28 #include "hintids.hxx" 29 30 #include <svl/stritem.hxx> 31 #include <editeng/protitem.hxx> 32 #include <editeng/boxitem.hxx> 33 #include <editeng/opaqitem.hxx> 34 #include <editeng/lrspitem.hxx> 35 #include <editeng/ulspitem.hxx> 36 #include <editeng/shaditem.hxx> 37 #include <svx/swframevalidation.hxx> 38 #include <fmtclds.hxx> 39 #include "wrtsh.hxx" 40 #include "view.hxx" 41 #include "viewopt.hxx" 42 #include "uitool.hxx" 43 #include "frmmgr.hxx" 44 #include "format.hxx" 45 #include "mdiexp.hxx" 46 #include "poolfmt.hxx" 47 #include <com/sun/star/text/TextContentAnchorType.hpp> 48 #include <com/sun/star/text/HoriOrientation.hpp> 49 #include <com/sun/star/text/VertOrientation.hpp> 50 #include <com/sun/star/text/RelOrientation.hpp> 51 52 using namespace ::com::sun::star; 53 //using namespace text; 54 55 static sal_uInt16 __FAR_DATA aFrmMgrRange[] = { 56 RES_FRMATR_BEGIN, RES_FRMATR_END-1, 57 58 //UUUU FillAttribute support 59 XATTR_FILL_FIRST, XATTR_FILL_LAST, 60 61 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 62 FN_SET_FRM_NAME, FN_SET_FRM_NAME, 63 0}; 64 65 /*-------------------------------------------------------------------- 66 Beschreibung: Rahmen-Attribute ueber Shell ermitteln 67 --------------------------------------------------------------------*/ 68 69 SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, sal_uInt8 nType ) : 70 aSet( (SwAttrPool&)pSh->GetAttrPool(), aFrmMgrRange ), 71 pOwnSh( pSh ), 72 bAbsPos( sal_False ), 73 bNewFrm( bNew ), 74 bIsInVertical( sal_False ), 75 bIsInVerticalL2R( sal_False ) 76 { 77 if ( bNewFrm ) 78 { 79 // Defaults einstellen: 80 sal_uInt16 nId = 0; 81 switch ( nType ) 82 { 83 case FRMMGR_TYPE_TEXT: nId = RES_POOLFRM_FRAME; break; 84 case FRMMGR_TYPE_OLE: nId = RES_POOLFRM_OLE; break; 85 case FRMMGR_TYPE_GRF: nId = RES_POOLFRM_GRAPHIC; break; 86 } 87 aSet.SetParent( &pOwnSh->GetFmtFromPool( nId )->GetAttrSet()); 88 aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT )); 89 if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) ) 90 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) ); 91 } 92 else if ( nType == FRMMGR_TYPE_NONE ) 93 { 94 pOwnSh->GetFlyFrmAttr( aSet ); 95 sal_Bool bRightToLeft; 96 bIsInVertical = pOwnSh->IsFrmVertical(sal_True, bRightToLeft, bIsInVerticalL2R); 97 } 98 ::PrepareBoxInfo( aSet, *pOwnSh ); 99 } 100 101 SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, const SfxItemSet &rSet ) : 102 aSet( rSet ), 103 pOwnSh( pSh ), 104 bAbsPos( sal_False ), 105 bNewFrm( bNew ), 106 bIsInVertical(sal_False), 107 bIsInVerticalL2R(sal_False) 108 { 109 if(!bNew) 110 { 111 sal_Bool bRightToLeft; 112 bIsInVertical = pSh->IsFrmVertical(sal_True, bRightToLeft, bIsInVerticalL2R); 113 } 114 } 115 116 117 /*-------------------------------------------------------------------- 118 Beschreibung: Initialisieren 119 --------------------------------------------------------------------*/ 120 121 void SwFlyFrmAttrMgr::UpdateAttrMgr() 122 { 123 if ( !bNewFrm && pOwnSh->IsFrmSelected() ) 124 pOwnSh->GetFlyFrmAttr( aSet ); 125 ::PrepareBoxInfo( aSet, *pOwnSh ); 126 } 127 128 void SwFlyFrmAttrMgr::_UpdateFlyFrm() 129 { 130 const SfxPoolItem* pItem = 0; 131 132 if (aSet.GetItemState(FN_SET_FRM_NAME, sal_False, &pItem) == SFX_ITEM_SET) 133 pOwnSh->SetFlyName(((SfxStringItem *)pItem)->GetValue()); 134 135 pOwnSh->SetModified(); 136 137 if ( bAbsPos ) 138 { 139 pOwnSh->SetFlyPos( aAbsPos ); 140 bAbsPos = sal_False; 141 } 142 } 143 144 /*-------------------------------------------------------------------- 145 Beschreibung: Bestehenden Fly-Frame aendern 146 --------------------------------------------------------------------*/ 147 148 void SwFlyFrmAttrMgr::UpdateFlyFrm() 149 { 150 ASSERT( pOwnSh->IsFrmSelected(), 151 "Kein Rahmen selektiert oder keine Shell, Update nicht moeglich"); 152 153 if( pOwnSh->IsFrmSelected() ) 154 { 155 //JP 6.8.2001: set never an invalid anchor into the core. 156 const SfxPoolItem *pGItem, *pItem; 157 if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem )) 158 { 159 SfxItemSet aGetSet( *aSet.GetPool(), RES_ANCHOR, RES_ANCHOR ); 160 if( pOwnSh->GetFlyFrmAttr( aGetSet ) && 1 == aGetSet.Count() && 161 SFX_ITEM_SET == aGetSet.GetItemState( RES_ANCHOR, sal_False, &pGItem ) 162 && ((SwFmtAnchor*)pGItem)->GetAnchorId() == 163 ((SwFmtAnchor*)pItem)->GetAnchorId() ) 164 aSet.ClearItem( RES_ANCHOR ); 165 } 166 167 // return wg. BASIC 168 if( aSet.Count() ) 169 { 170 pOwnSh->StartAllAction(); 171 pOwnSh->SetFlyFrmAttr( aSet ); 172 _UpdateFlyFrm(); 173 pOwnSh->EndAllAction(); 174 } 175 } 176 } 177 178 /*-------------------------------------------------------------------- 179 Beschreibung: Rahmen einfuegen 180 --------------------------------------------------------------------*/ 181 182 sal_Bool SwFlyFrmAttrMgr::InsertFlyFrm() 183 { 184 pOwnSh->StartAllAction(); 185 186 sal_Bool bRet = 0 != pOwnSh->NewFlyFrm( aSet ); 187 188 // richtigen Mode an der Shell einschalten, Rahmen wurde aut. selektiert. 189 if ( bRet ) 190 { 191 _UpdateFlyFrm(); 192 pOwnSh->EnterSelFrmMode(); 193 FrameNotify(pOwnSh, FLY_DRAG_START); 194 } 195 pOwnSh->EndAllAction(); 196 return bRet; 197 } 198 199 /*------------------------------------------------------------------------ 200 Beschreibung: Rahmen des Typs eAnchorType einfuegen. Position und 201 Groesse werden explizit angegeben. 202 Nicht erlaubte Werte des Aufzaehlungstypes werden 203 korrigiert. 204 ------------------------------------------------------------------------*/ 205 206 void SwFlyFrmAttrMgr::InsertFlyFrm(RndStdIds eAnchorType, 207 const Point &rPos, 208 const Size &rSize, 209 sal_Bool bAbs ) 210 { 211 ASSERT( eAnchorType == FLY_AT_PAGE || 212 eAnchorType == FLY_AT_PARA || 213 eAnchorType == FLY_AT_CHAR || 214 eAnchorType == FLY_AT_FLY || 215 eAnchorType == FLY_AS_CHAR, "invalid frame type" ); 216 217 if ( bAbs ) 218 SetAbsPos( rPos ); 219 else 220 SetPos( rPos ); 221 222 SetSize( rSize ); 223 SetAnchor( eAnchorType ); 224 InsertFlyFrm(); 225 } 226 227 /*-------------------------------------------------------------------- 228 Beschreibung: Anker setzen 229 --------------------------------------------------------------------*/ 230 231 void SwFlyFrmAttrMgr::SetAnchor( RndStdIds eId ) 232 { 233 sal_uInt16 nPhyPageNum, nVirtPageNum; 234 pOwnSh->GetPageNum( nPhyPageNum, nVirtPageNum ); 235 236 aSet.Put( SwFmtAnchor( eId, nPhyPageNum ) ); 237 if ((FLY_AT_PAGE == eId) || (FLY_AT_PARA == eId) || (FLY_AT_CHAR == eId) 238 || (FLY_AT_FLY == eId)) 239 { 240 SwFmtVertOrient aVertOrient( GetVertOrient() ); 241 SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); 242 aHoriOrient.SetRelationOrient( text::RelOrientation::FRAME ); 243 aVertOrient.SetRelationOrient( text::RelOrientation::FRAME ); 244 aSet.Put( aVertOrient ); 245 aSet.Put( aHoriOrient ); 246 } 247 } 248 249 /*------------------------------------------------------------------------ 250 Beschreibung: Setzen des Attributs fuer Spalten 251 ------------------------------------------------------------------------*/ 252 253 void SwFlyFrmAttrMgr::SetCol( const SwFmtCol &rCol ) 254 { 255 aSet.Put( rCol ); 256 } 257 /*-------------------------------------------------------------------- 258 Beschreibung: Absolute Position setzen 259 --------------------------------------------------------------------*/ 260 261 void SwFlyFrmAttrMgr::SetAbsPos( const Point& rPoint ) 262 { 263 bAbsPos = sal_True; 264 aAbsPos = rPoint; 265 266 SwFmtVertOrient aVertOrient( GetVertOrient() ); 267 SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); 268 aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); 269 aVertOrient.SetVertOrient( text::VertOrientation::NONE ); 270 aSet.Put( aVertOrient ); 271 aSet.Put( aHoriOrient ); 272 } 273 274 /*-------------------------------------------------------------------- 275 Beschreibung: Metriken auf Korrektheit pruefen 276 --------------------------------------------------------------------*/ 277 void SwFlyFrmAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal, 278 const SwPosition* pToCharCntntPos, 279 sal_Bool bOnlyPercentRefValue ) 280 { 281 if (!bOnlyPercentRefValue) 282 { 283 rVal.nMinHeight = MINFLY + CalcTopSpace() + CalcBottomSpace(); 284 rVal.nMinWidth = MINFLY + CalcLeftSpace()+ CalcRightSpace(); 285 } 286 287 SwRect aBoundRect; 288 289 // OD 18.09.2003 #i18732# - adjustment for allowing vertical position 290 // aligned to page for fly frame anchored to paragraph or to character. 291 const RndStdIds eAnchorType = static_cast<RndStdIds >(rVal.nAnchorType); 292 pOwnSh->CalcBoundRect( aBoundRect, eAnchorType, 293 rVal.nHRelOrient, 294 rVal.nVRelOrient, 295 pToCharCntntPos, 296 rVal.bFollowTextFlow, 297 rVal.bMirror, NULL, &rVal.aPercentSize); 298 299 if (bOnlyPercentRefValue) 300 return; 301 302 // --> OD 2009-09-01 #mongolianlayout# 303 if ( bIsInVertical || bIsInVerticalL2R ) 304 // <-- 305 { 306 Point aPos(aBoundRect.Pos()); 307 long nTmp = aPos.X(); 308 aPos.X() = aPos.Y(); 309 aPos.Y() = nTmp; 310 Size aSize(aBoundRect.SSize()); 311 nTmp = aSize.Width(); 312 aSize.Width() = aSize.Height(); 313 aSize.Height() = nTmp; 314 aBoundRect.Chg( aPos, aSize ); 315 //exchange width/height to enable correct values 316 nTmp = rVal.nWidth; 317 rVal.nWidth = rVal.nHeight; 318 rVal.nHeight = nTmp; 319 } 320 if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY)) 321 { 322 // MinimalPosition 323 rVal.nMinHPos = aBoundRect.Left(); 324 rVal.nMinVPos = aBoundRect.Top(); 325 SwTwips nH = rVal.nHPos; 326 SwTwips nV = rVal.nVPos; 327 328 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) 329 { 330 if (rVal.nHoriOrient == text::HoriOrientation::NONE) 331 { 332 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right()); 333 nH = rVal.nHPos; 334 } 335 else 336 rVal.nWidth = aBoundRect.Right() - rVal.nHPos; 337 } 338 339 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) 340 rVal.nWidth = aBoundRect.Right() - rVal.nHPos; 341 342 if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom()) 343 { 344 if (rVal.nVertOrient == text::VertOrientation::NONE) 345 { 346 rVal.nVPos -= ((rVal.nVPos + rVal.nHeight) - aBoundRect.Bottom()); 347 nV = rVal.nVPos; 348 } 349 else 350 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos; 351 } 352 353 if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom()) 354 rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos; 355 356 if ( rVal.nVertOrient != text::VertOrientation::NONE ) 357 nV = aBoundRect.Top(); 358 359 if ( rVal.nHoriOrient != text::HoriOrientation::NONE ) 360 nH = aBoundRect.Left(); 361 362 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth; 363 rVal.nMaxHeight = aBoundRect.Bottom() - nV; 364 365 rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight; 366 rVal.nMaxWidth = aBoundRect.Right() - nH; 367 } 368 // OD 12.11.2003 #i22341# - handle to character anchored objects vertical 369 // aligned at character or top of line in a special case 370 else if ((eAnchorType == FLY_AT_PARA) || 371 ((eAnchorType == FLY_AT_CHAR) && 372 !(rVal.nVRelOrient == text::RelOrientation::CHAR) && 373 !(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) ) 374 { 375 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) 376 { 377 if (rVal.nHoriOrient == text::HoriOrientation::NONE) 378 { 379 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right()); 380 } 381 else 382 rVal.nWidth = aBoundRect.Right() - rVal.nHPos; 383 } 384 385 // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow 386 // and alignment at page areas. 387 const bool bMaxVPosAtBottom = !rVal.bFollowTextFlow || 388 rVal.nVRelOrient == text::RelOrientation::PAGE_FRAME || 389 rVal.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA; 390 { 391 SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom 392 ? aBoundRect.Bottom() 393 : aBoundRect.Height() ) - 394 rVal.nHeight; 395 if ( rVal.nVPos > nTmpMaxVPos ) 396 { 397 if (rVal.nVertOrient == text::VertOrientation::NONE) 398 { 399 rVal.nVPos = nTmpMaxVPos; 400 } 401 else 402 { 403 rVal.nHeight = ( bMaxVPosAtBottom 404 ? aBoundRect.Bottom() 405 : aBoundRect.Height() ) - rVal.nVPos; 406 } 407 } 408 } 409 410 rVal.nMinHPos = aBoundRect.Left(); 411 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth; 412 413 rVal.nMinVPos = aBoundRect.Top(); 414 // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position 415 if ( bMaxVPosAtBottom ) 416 { 417 rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight; 418 } 419 else 420 { 421 rVal.nMaxVPos = aBoundRect.Height() - rVal.nHeight; 422 } 423 424 // Maximale Breite Hoehe 425 const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE ) 426 ? aBoundRect.Left() 427 : rVal.nHPos; 428 const SwTwips nV = ( rVal.nVertOrient != text::VertOrientation::NONE ) 429 ? aBoundRect.Top() 430 : rVal.nVPos; 431 rVal.nMaxHeight = rVal.nMaxVPos + rVal.nHeight - nV; 432 rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH; 433 } 434 // OD 12.11.2003 #i22341# - special case for to character anchored objects 435 // vertical aligned at character or top of line. 436 // Note: (1) positive vertical values are positions above the top of line 437 // (2) negative vertical values are positions below the top of line 438 else if ( (eAnchorType == FLY_AT_CHAR) && 439 ( rVal.nVRelOrient == text::RelOrientation::CHAR || 440 rVal.nVRelOrient == text::RelOrientation::TEXT_LINE ) ) 441 { 442 // determine horizontal values 443 rVal.nMinHPos = aBoundRect.Left(); 444 445 rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth; 446 if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) 447 { 448 if (rVal.nHoriOrient == text::HoriOrientation::NONE) 449 { 450 rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right()); 451 } 452 else 453 rVal.nWidth = aBoundRect.Right() - rVal.nHPos; 454 } 455 456 const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE ) 457 ? aBoundRect.Left() 458 : rVal.nHPos; 459 rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH; 460 461 // determine vertical values 462 rVal.nMinVPos = -( aBoundRect.Bottom() - rVal.nHeight ); 463 if ( rVal.nVPos < rVal.nMinVPos && 464 rVal.nVertOrient == text::VertOrientation::NONE ) 465 { 466 rVal.nVPos = rVal.nMinVPos; 467 } 468 469 rVal.nMaxVPos = -aBoundRect.Top(); 470 if ( rVal.nVPos > rVal.nMaxVPos && 471 rVal.nVertOrient == text::VertOrientation::NONE ) 472 { 473 rVal.nVPos = rVal.nMaxVPos; 474 } 475 476 if ( rVal.nVertOrient == text::VertOrientation::NONE ) 477 { 478 rVal.nMaxHeight = aBoundRect.Bottom() + rVal.nVPos; 479 } 480 else 481 { 482 rVal.nMaxHeight = aBoundRect.Height(); 483 } 484 } 485 else if ( eAnchorType == FLY_AS_CHAR ) 486 { 487 rVal.nMinHPos = 0; 488 rVal.nMaxHPos = 0; 489 490 rVal.nMaxHeight = aBoundRect.Height(); 491 rVal.nMaxWidth = aBoundRect.Width(); 492 493 rVal.nMaxVPos = aBoundRect.Height(); 494 rVal.nMinVPos = -aBoundRect.Height() + rVal.nHeight; 495 if (rVal.nMaxVPos < rVal.nMinVPos) 496 { 497 rVal.nMinVPos = rVal.nMaxVPos; 498 rVal.nMaxVPos = -aBoundRect.Height(); 499 } 500 } 501 // --> OD 2009-09-01 #mongolianlayout# 502 if ( bIsInVertical || bIsInVerticalL2R ) 503 // <-- 504 { 505 //restore width/height exchange 506 long nTmp = rVal.nWidth; 507 rVal.nWidth = rVal.nHeight; 508 rVal.nHeight = nTmp; 509 } 510 511 if (rVal.nMaxWidth < rVal.nWidth) 512 rVal.nWidth = rVal.nMaxWidth; 513 if (rVal.nMaxHeight < rVal.nHeight) 514 rVal.nHeight = rVal.nMaxHeight; 515 } 516 517 /*-------------------------------------------------------------------- 518 Beschreibung: Korrektur fuer Umrandung 519 --------------------------------------------------------------------*/ 520 521 SwTwips SwFlyFrmAttrMgr::CalcTopSpace() 522 { 523 const SvxShadowItem& rShadow = GetShadow(); 524 const SvxBoxItem& rBox = GetBox(); 525 return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(BOX_LINE_TOP); 526 } 527 528 SwTwips SwFlyFrmAttrMgr::CalcBottomSpace() 529 { 530 const SvxShadowItem& rShadow = GetShadow(); 531 const SvxBoxItem& rBox = GetBox(); 532 return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(BOX_LINE_BOTTOM); 533 } 534 535 SwTwips SwFlyFrmAttrMgr::CalcLeftSpace() 536 { 537 const SvxShadowItem& rShadow = GetShadow(); 538 const SvxBoxItem& rBox = GetBox(); 539 return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(BOX_LINE_LEFT); 540 } 541 542 SwTwips SwFlyFrmAttrMgr::CalcRightSpace() 543 { 544 const SvxShadowItem& rShadow = GetShadow(); 545 const SvxBoxItem& rBox = GetBox(); 546 return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(BOX_LINE_RIGHT); 547 } 548 549 550 /*-------------------------------------------------------------------- 551 Beschreibung: Attribut aus dem Set loeschen 552 --------------------------------------------------------------------*/ 553 void SwFlyFrmAttrMgr::DelAttr( sal_uInt16 nId ) 554 { 555 aSet.ClearItem( nId ); 556 } 557 558 void SwFlyFrmAttrMgr::SetLRSpace( long nLeft, long nRight ) 559 { 560 ASSERT( LONG_MAX != nLeft && LONG_MAX != nRight, "Welchen Raend setzen?" ); 561 562 SvxLRSpaceItem aTmp( (SvxLRSpaceItem&)aSet.Get( RES_LR_SPACE ) ); 563 if( LONG_MAX != nLeft ) 564 aTmp.SetLeft( sal_uInt16(nLeft) ); 565 if( LONG_MAX != nRight ) 566 aTmp.SetRight( sal_uInt16(nRight) ); 567 aSet.Put( aTmp ); 568 } 569 570 void SwFlyFrmAttrMgr::SetULSpace( long nTop, long nBottom ) 571 { 572 ASSERT(LONG_MAX != nTop && LONG_MAX != nBottom, "Welchen Raend setzen?" ); 573 574 SvxULSpaceItem aTmp( (SvxULSpaceItem&)aSet.Get( RES_UL_SPACE ) ); 575 if( LONG_MAX != nTop ) 576 aTmp.SetUpper( sal_uInt16(nTop) ); 577 if( LONG_MAX != nBottom ) 578 aTmp.SetLower( sal_uInt16(nBottom) ); 579 aSet.Put( aTmp ); 580 } 581 582 void SwFlyFrmAttrMgr::SetPos( const Point& rPoint ) 583 { 584 SwFmtVertOrient aVertOrient( GetVertOrient() ); 585 SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); 586 587 aHoriOrient.SetPos ( rPoint.X() ); 588 aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); 589 590 aVertOrient.SetPos ( rPoint.Y() ); 591 aVertOrient.SetVertOrient( text::VertOrientation::NONE ); 592 593 aSet.Put( aVertOrient ); 594 aSet.Put( aHoriOrient ); 595 } 596 597 void SwFlyFrmAttrMgr::SetHorzOrientation( sal_Int16 eOrient ) 598 { 599 SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); 600 aHoriOrient.SetHoriOrient( eOrient ); 601 aSet.Put( aHoriOrient ); 602 } 603 604 void SwFlyFrmAttrMgr::SetVertOrientation( sal_Int16 eOrient ) 605 { 606 SwFmtVertOrient aVertOrient( GetVertOrient() ); 607 aVertOrient.SetVertOrient( eOrient ); 608 aSet.Put( aVertOrient ); 609 } 610 611 void SwFlyFrmAttrMgr::SetHeightSizeType( SwFrmSize eType ) 612 { 613 SwFmtFrmSize aSize( GetFrmSize() ); 614 aSize.SetHeightSizeType( eType ); 615 aSet.Put( aSize ); 616 } 617 618 void SwFlyFrmAttrMgr::SetSize( const Size& rSize ) 619 { 620 SwFmtFrmSize aSize( GetFrmSize() ); 621 aSize.SetSize(Size(Max(rSize.Width(), long(MINFLY)), Max(rSize.Height(), long(MINFLY)))); 622 aSet.Put( aSize ); 623 } 624 625 void SwFlyFrmAttrMgr::SetAttrSet(const SfxItemSet& rSet) 626 { 627 aSet.ClearItem(); 628 aSet.Put( rSet ); 629 } 630