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 // MARKER(update_precomp.py): autogen include statement, do not remove 23 #include "precompiled_cui.hxx" 24 25 // include --------------------------------------------------------------- 26 27 #include <tools/shl.hxx> 28 #include <sfx2/app.hxx> 29 #include <svx/svdview.hxx> 30 #include <svx/svdobj.hxx> 31 #include <svx/svdpagv.hxx> 32 #include <svx/svdotext.hxx> 33 #include <svx/sderitm.hxx> 34 #include <svx/dialogs.hrc> 35 #include <cuires.hrc> 36 #include "transfrm.hrc" 37 #include <editeng/sizeitem.hxx> 38 39 #include "transfrm.hxx" 40 #include <dialmgr.hxx> 41 #include "svx/dlgutil.hxx" 42 #include <editeng/svxenum.hxx> 43 #include "svx/anchorid.hxx" 44 #include <sfx2/module.hxx> 45 #include <svl/rectitem.hxx> 46 #include <svl/aeitem.hxx> 47 #include <swpossizetabpage.hxx> 48 49 // Toleranz fuer WorkingArea 50 #define DIFF 1000 51 52 // static ---------------------------------------------------------------- 53 54 static sal_uInt16 pPosSizeRanges[] = 55 { 56 SID_ATTR_TRANSFORM_POS_X, 57 SID_ATTR_TRANSFORM_POS_Y, 58 SID_ATTR_TRANSFORM_PROTECT_POS, 59 SID_ATTR_TRANSFORM_PROTECT_POS, 60 SID_ATTR_TRANSFORM_INTERN, 61 SID_ATTR_TRANSFORM_INTERN, 62 SID_ATTR_TRANSFORM_ANCHOR, 63 SID_ATTR_TRANSFORM_VERT_ORIENT, 64 SID_ATTR_TRANSFORM_WIDTH, 65 SID_ATTR_TRANSFORM_SIZE_POINT, 66 SID_ATTR_TRANSFORM_PROTECT_POS, 67 SID_ATTR_TRANSFORM_INTERN, 68 SID_ATTR_TRANSFORM_AUTOWIDTH, 69 SID_ATTR_TRANSFORM_AUTOHEIGHT, 70 0 71 }; 72 73 static sal_uInt16 pAngleRanges[] = 74 { 75 SID_ATTR_TRANSFORM_ROT_X, 76 SID_ATTR_TRANSFORM_ANGLE, 77 SID_ATTR_TRANSFORM_INTERN, 78 SID_ATTR_TRANSFORM_INTERN, 79 0 80 }; 81 82 static sal_uInt16 pSlantRanges[] = 83 { 84 SDRATTR_ECKENRADIUS, 85 SDRATTR_ECKENRADIUS, 86 SID_ATTR_TRANSFORM_SHEAR, 87 SID_ATTR_TRANSFORM_SHEAR_VERTICAL, 88 SID_ATTR_TRANSFORM_INTERN, 89 SID_ATTR_TRANSFORM_INTERN, 90 0 91 }; 92 93 void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) 94 { 95 const basegfx::B2DPoint aTopLeft( 96 (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), 97 (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); 98 const basegfx::B2DPoint aBottomRight( 99 (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), 100 (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); 101 102 rRange = basegfx::B2DRange(aTopLeft, aBottomRight); 103 } 104 105 void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale) 106 { 107 const double fFactor(1.0 / double(aUIScale)); 108 rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor); 109 } 110 111 /************************************************************************* 112 |* Konstruktor des Tab-Dialogs: Fügt die Seiten zum Dialog hinzu 113 \************************************************************************/ 114 115 SvxTransformTabDialog::SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, 116 const SdrView* pSdrView, sal_uInt16 nAnchorTypes ) : 117 SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_TRANSFORM ), pAttr ), 118 pView ( pSdrView ), 119 nAnchorCtrls(nAnchorTypes) 120 { 121 DBG_ASSERT(pView, "no valid view (!)"); 122 FreeResource(); 123 124 // different positioning page in Writer 125 if(nAnchorCtrls & 0x00ff) 126 { 127 AddTabPage(RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges); 128 RemoveTabPage(RID_SVXPAGE_POSITION_SIZE); 129 } 130 else 131 { 132 AddTabPage(RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create, SvxPositionSizeTabPage::GetRanges); 133 RemoveTabPage(RID_SVXPAGE_SWPOSSIZE); 134 } 135 136 AddTabPage(RID_SVXPAGE_ANGLE, SvxAngleTabPage::Create, SvxAngleTabPage::GetRanges); 137 AddTabPage(RID_SVXPAGE_SLANT, SvxSlantTabPage::Create, SvxSlantTabPage::GetRanges); 138 } 139 140 // ----------------------------------------------------------------------- 141 142 SvxTransformTabDialog::~SvxTransformTabDialog() 143 { 144 } 145 146 // ----------------------------------------------------------------------- 147 148 void SvxTransformTabDialog::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) 149 { 150 switch(nId) 151 { 152 case RID_SVXPAGE_POSITION_SIZE: 153 { 154 SvxPositionSizeTabPage& rSvxPos = static_cast<SvxPositionSizeTabPage&>(rPage); 155 rSvxPos.SetView(pView); 156 rSvxPos.Construct(); 157 158 if(nAnchorCtrls & SVX_OBJ_NORESIZE) 159 { 160 rSvxPos.DisableResize(); 161 } 162 163 if(nAnchorCtrls & SVX_OBJ_NOPROTECT) 164 { 165 rSvxPos.DisableProtect(); 166 rSvxPos.UpdateControlStates(); 167 } 168 169 break; 170 } 171 case RID_SVXPAGE_SWPOSSIZE : 172 { 173 SvxSwPosSizeTabPage& rSwPos = static_cast<SvxSwPosSizeTabPage&>(rPage); 174 175 rSwPos.EnableAnchorTypes(nAnchorCtrls); 176 rSwPos.SetValidateFramePosLink(aValidateLink); 177 rSwPos.SetView(pView); 178 179 break; 180 } 181 182 case RID_SVXPAGE_ANGLE: 183 { 184 SvxAngleTabPage& rSvxAng = static_cast<SvxAngleTabPage&>(rPage); 185 186 rSvxAng.SetView( pView ); 187 rSvxAng.Construct(); 188 189 break; 190 } 191 192 case RID_SVXPAGE_SLANT: 193 { 194 SvxSlantTabPage& rSvxSlnt = static_cast<SvxSlantTabPage&>(rPage); 195 196 rSvxSlnt.SetView( pView ); 197 rSvxSlnt.Construct(); 198 199 break; 200 } 201 } 202 } 203 204 // ----------------------------------------------------------------------- 205 206 void SvxTransformTabDialog::SetValidateFramePosLink(const Link& rLink) 207 { 208 aValidateLink = rLink; 209 } 210 211 /************************************************************************* 212 |* Dialog zum Ändern der Position des Drehwinkels und des Drehwinkels 213 |* der Grafikobjekte 214 \************************************************************************/ 215 216 SvxAngleTabPage::SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 217 SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_ANGLE ), rInAttrs ), 218 aFlPosition ( this, CUI_RES( FL_POSITION ) ), 219 aFtPosX ( this, CUI_RES( FT_POS_X ) ), 220 aMtrPosX ( this, CUI_RES( MTR_FLD_POS_X ) ), 221 aFtPosY ( this, CUI_RES( FT_POS_Y ) ), 222 aMtrPosY ( this, CUI_RES( MTR_FLD_POS_Y ) ), 223 aFtPosPresets ( this, CUI_RES(FT_POSPRESETS) ), 224 aCtlRect ( this, CUI_RES( CTL_RECT ) ), 225 226 aFlAngle ( this, CUI_RES( FL_ANGLE ) ), 227 aFtAngle ( this, CUI_RES( FT_ANGLE ) ), 228 aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), 229 aFtAnglePresets ( this, CUI_RES(FT_ANGLEPRESETS) ), 230 aCtlAngle ( this, CUI_RES( CTL_ANGLE ), 231 RP_RB, 200, 80, CS_ANGLE ), 232 rOutAttrs ( rInAttrs ) 233 { 234 FreeResource(); 235 236 // calculate PoolUnit 237 SfxItemPool* pPool = rOutAttrs.GetPool(); 238 DBG_ASSERT( pPool, "no pool (!)" ); 239 ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X); 240 241 aMtrAngle.SetModifyHdl(LINK( this, SvxAngleTabPage, ModifiedHdl)); 242 243 aCtlRect.SetAccessibleRelationLabeledBy(&aFtPosPresets); 244 aCtlRect.SetAccessibleRelationMemberOf(&aFlPosition); 245 aCtlAngle.SetAccessibleRelationLabeledBy(&aFtAnglePresets); 246 aCtlAngle.SetAccessibleRelationMemberOf(&aFlAngle); 247 } 248 249 // ----------------------------------------------------------------------- 250 251 void SvxAngleTabPage::Construct() 252 { 253 DBG_ASSERT(pView, "No valid view (!)"); 254 eDlgUnit = GetModuleFieldUnit(GetItemSet()); 255 SetFieldUnit(aMtrPosX, eDlgUnit, sal_True); 256 SetFieldUnit(aMtrPosY, eDlgUnit, sal_True); 257 258 if(FUNIT_MILE == eDlgUnit || FUNIT_KM == eDlgUnit) 259 { 260 aMtrPosX.SetDecimalDigits( 3 ); 261 aMtrPosY.SetDecimalDigits( 3 ); 262 } 263 264 { // #i75273# 265 Rectangle aTempRect(pView->GetAllMarkedRect()); 266 pView->GetSdrPageView()->LogicToPagePos(aTempRect); 267 maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 268 } 269 270 // Take anchor into account (Writer) 271 const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 272 273 if(rMarkList.GetMarkCount()) 274 { 275 const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 276 maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); 277 278 if(!maAnchor.equalZero()) // -> Writer 279 { 280 maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); 281 } 282 } 283 284 // take scale into account 285 const Fraction aUIScale(pView->GetModel()->GetUIScale()); 286 lcl_ScaleRect(maRange, aUIScale); 287 288 // take UI units into account 289 sal_uInt16 nDigits(aMtrPosX.GetDecimalDigits()); 290 lcl_ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit); 291 292 if(!pView->IsRotateAllowed()) 293 { 294 aFlPosition.Disable(); 295 aFtPosX.Disable(); 296 aMtrPosX.Disable(); 297 aFtPosY.Disable(); 298 aMtrPosY.Disable(); 299 aFtPosPresets.Disable(); 300 aCtlRect.Disable(); 301 aFlAngle.Disable(); 302 aFtAngle.Disable(); 303 aMtrAngle.Disable(); 304 aFtAnglePresets.Disable(); 305 aCtlAngle.Disable(); 306 } 307 } 308 309 // ----------------------------------------------------------------------- 310 311 sal_Bool SvxAngleTabPage::FillItemSet(SfxItemSet& rSet) 312 { 313 sal_Bool bModified = sal_False; 314 315 if(aMtrAngle.IsValueModified() || aMtrPosX.IsValueModified() || aMtrPosY.IsValueModified()) 316 { 317 const double fUIScale(double(pView->GetModel()->GetUIScale())); 318 const double fTmpX((GetCoreValue(aMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale); 319 const double fTmpY((GetCoreValue(aMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale); 320 321 rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), static_cast<sal_Int32>(aMtrAngle.GetValue()))); 322 rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX))); 323 rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY))); 324 325 bModified |= sal_True; 326 } 327 328 return bModified; 329 } 330 331 // ----------------------------------------------------------------------- 332 333 void SvxAngleTabPage::Reset(const SfxItemSet& rAttrs) 334 { 335 const double fUIScale(double(pView->GetModel()->GetUIScale())); 336 337 const SfxPoolItem* pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ROT_X ); 338 if(pItem) 339 { 340 const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); 341 SetMetricValue(aMtrPosX, basegfx::fround(fTmp), ePoolUnit); 342 } 343 else 344 { 345 aMtrPosX.SetText( String() ); 346 } 347 348 pItem = GetItem(rAttrs, SID_ATTR_TRANSFORM_ROT_Y); 349 if(pItem) 350 { 351 const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); 352 SetMetricValue(aMtrPosY, basegfx::fround(fTmp), ePoolUnit); 353 } 354 else 355 { 356 aMtrPosX.SetText( String() ); 357 } 358 359 pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ANGLE ); 360 if(pItem) 361 { 362 aMtrAngle.SetValue(((const SfxInt32Item*)pItem)->GetValue()); 363 } 364 else 365 { 366 aMtrAngle.SetText( String() ); 367 } 368 369 aMtrAngle.SaveValue(); 370 ModifiedHdl(this); 371 } 372 373 // ----------------------------------------------------------------------- 374 375 SfxTabPage* SvxAngleTabPage::Create( Window* pWindow, const SfxItemSet& rSet) 376 { 377 return(new SvxAngleTabPage(pWindow, rSet)); 378 } 379 380 //------------------------------------------------------------------------ 381 382 sal_uInt16* SvxAngleTabPage::GetRanges() 383 { 384 return(pAngleRanges); 385 } 386 387 // ----------------------------------------------------------------------- 388 389 void SvxAngleTabPage::ActivatePage(const SfxItemSet& /*rSet*/) 390 { 391 } 392 393 // ----------------------------------------------------------------------- 394 395 int SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet ) 396 { 397 if(_pSet) 398 { 399 FillItemSet(*_pSet); 400 } 401 402 return LEAVE_PAGE; 403 } 404 405 //------------------------------------------------------------------------ 406 407 void SvxAngleTabPage::PointChanged(Window* pWindow, RECT_POINT eRP) 408 { 409 if(pWindow == &aCtlRect) 410 { 411 switch(eRP) 412 { 413 case RP_LT: 414 { 415 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); 416 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); 417 break; 418 } 419 case RP_MT: 420 { 421 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); 422 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); 423 break; 424 } 425 case RP_RT: 426 { 427 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); 428 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); 429 break; 430 } 431 case RP_LM: 432 { 433 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); 434 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); 435 break; 436 } 437 case RP_MM: 438 { 439 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); 440 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); 441 break; 442 } 443 case RP_RM: 444 { 445 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); 446 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); 447 break; 448 } 449 case RP_LB: 450 { 451 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); 452 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); 453 break; 454 } 455 case RP_MB: 456 { 457 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); 458 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); 459 break; 460 } 461 case RP_RB: 462 { 463 aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); 464 aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); 465 break; 466 } 467 } 468 } 469 else if(pWindow == &aCtlAngle) 470 { 471 switch( eRP ) 472 { 473 case RP_LT: aMtrAngle.SetUserValue( 13500, FUNIT_NONE ); break; 474 case RP_MT: aMtrAngle.SetUserValue( 9000, FUNIT_NONE ); break; 475 case RP_RT: aMtrAngle.SetUserValue( 4500, FUNIT_NONE ); break; 476 case RP_LM: aMtrAngle.SetUserValue( 18000, FUNIT_NONE ); break; 477 case RP_RM: aMtrAngle.SetUserValue( 0, FUNIT_NONE ); break; 478 case RP_LB: aMtrAngle.SetUserValue( 22500, FUNIT_NONE ); break; 479 case RP_MB: aMtrAngle.SetUserValue( 27000, FUNIT_NONE ); break; 480 case RP_RB: aMtrAngle.SetUserValue( 31500, FUNIT_NONE ); break; 481 case RP_MM: break; 482 } 483 } 484 } 485 486 //------------------------------------------------------------------------ 487 488 IMPL_LINK( SvxAngleTabPage, ModifiedHdl, void *, EMPTYARG ) 489 { 490 switch(aMtrAngle.GetValue()) 491 { 492 case 13500: aCtlAngle.SetActualRP( RP_LT ); break; 493 case 9000: aCtlAngle.SetActualRP( RP_MT ); break; 494 case 4500: aCtlAngle.SetActualRP( RP_RT ); break; 495 case 18000: aCtlAngle.SetActualRP( RP_LM ); break; 496 case 0: aCtlAngle.SetActualRP( RP_RM ); break; 497 case 22500: aCtlAngle.SetActualRP( RP_LB ); break; 498 case 27000: aCtlAngle.SetActualRP( RP_MB ); break; 499 case 31500: aCtlAngle.SetActualRP( RP_RB ); break; 500 default: aCtlAngle.SetActualRP( RP_MM ); break; 501 } 502 503 return( 0L ); 504 } 505 506 /************************************************************************* 507 |* Dialog zum Ändern des Eckenradius und zum Schrägstellen 508 \************************************************************************/ 509 510 SvxSlantTabPage::SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 511 SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_SLANT ), rInAttrs ), 512 513 aFlRadius ( this, CUI_RES( FL_RADIUS ) ), 514 aFtRadius ( this, CUI_RES( FT_RADIUS ) ), 515 aMtrRadius ( this, CUI_RES( MTR_FLD_RADIUS ) ), 516 aFlAngle ( this, CUI_RES( FL_SLANT ) ), 517 aFtAngle ( this, CUI_RES( FT_ANGLE ) ), 518 aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), 519 rOutAttrs ( rInAttrs ) 520 { 521 FreeResource(); 522 523 // this page needs ExchangeSupport 524 SetExchangeSupport(); 525 526 // evaluate PoolUnit 527 SfxItemPool* pPool = rOutAttrs.GetPool(); 528 DBG_ASSERT( pPool, "no pool (!)" ); 529 ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); 530 } 531 532 // ----------------------------------------------------------------------- 533 534 void SvxSlantTabPage::Construct() 535 { 536 // get the range 537 DBG_ASSERT(pView, "no valid view (!)"); 538 eDlgUnit = GetModuleFieldUnit(GetItemSet()); 539 SetFieldUnit(aMtrRadius, eDlgUnit, sal_True); 540 541 { // #i75273# 542 Rectangle aTempRect(pView->GetAllMarkedRect()); 543 pView->GetSdrPageView()->LogicToPagePos(aTempRect); 544 maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 545 } 546 } 547 548 // ----------------------------------------------------------------------- 549 550 sal_Bool SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs) 551 { 552 sal_Bool bModified = sal_False; 553 sal_Int32 nValue = 0L; 554 String aStr = aMtrRadius.GetText(); 555 556 if( aStr != aMtrRadius.GetSavedValue() ) 557 { 558 Fraction aUIScale = pView->GetModel()->GetUIScale(); 559 long nTmp = GetCoreValue( aMtrRadius, ePoolUnit ); 560 nTmp = Fraction( nTmp ) * aUIScale; 561 562 rAttrs.Put( SdrEckenradiusItem( nTmp ) ); 563 bModified = sal_True; 564 } 565 566 aStr = aMtrAngle.GetText(); 567 568 if( aStr != aMtrAngle.GetSavedValue() ) 569 { 570 nValue = static_cast<sal_Int32>(aMtrAngle.GetValue()); 571 rAttrs.Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) ); 572 bModified = sal_True; 573 } 574 575 if( bModified ) 576 { 577 // Referenzpunkt setzen 578 // #75897# 579 Rectangle aObjectRect(pView->GetAllMarkedRect()); 580 pView->GetSdrPageView()->LogicToPagePos(aObjectRect); 581 Point aPt = aObjectRect.Center(); 582 583 rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X, aPt.X())); 584 rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y, aPt.Y())); 585 rAttrs.Put( SfxBoolItem( SID_ATTR_TRANSFORM_SHEAR_VERTICAL, sal_False ) ); 586 } 587 588 return( bModified ); 589 } 590 591 // ----------------------------------------------------------------------- 592 593 void SvxSlantTabPage::Reset(const SfxItemSet& rAttrs) 594 { 595 // if the view has selected objects, items with SFX_ITEM_DEFAULT need to be disabled 596 const SfxPoolItem* pItem; 597 598 // Eckenradius 599 if(!pView->IsEdgeRadiusAllowed()) 600 { 601 aFlRadius.Disable(); 602 aFtRadius.Disable(); 603 aMtrRadius.Disable(); 604 aMtrRadius.SetText( String() ); 605 } 606 else 607 { 608 pItem = GetItem( rAttrs, SDRATTR_ECKENRADIUS ); 609 610 if( pItem ) 611 { 612 const double fUIScale(double(pView->GetModel()->GetUIScale())); 613 const double fTmp((double)((const SdrEckenradiusItem*)pItem)->GetValue() / fUIScale); 614 SetMetricValue(aMtrRadius, basegfx::fround(fTmp), ePoolUnit); 615 } 616 else 617 { 618 aMtrRadius.SetText( String() ); 619 } 620 } 621 622 aMtrRadius.SaveValue(); 623 624 // Schrägstellen: Winkel 625 if( !pView->IsShearAllowed() ) 626 { 627 aFlAngle.Disable(); 628 aFtAngle.Disable(); 629 aMtrAngle.Disable(); 630 aMtrAngle.SetText( String() ); 631 } 632 else 633 { 634 pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_SHEAR ); 635 636 if( pItem ) 637 { 638 aMtrAngle.SetValue( ( (const SfxInt32Item*)pItem )->GetValue() ); 639 } 640 else 641 { 642 aMtrAngle.SetText( String() ); 643 } 644 } 645 646 aMtrAngle.SaveValue(); 647 } 648 649 // ----------------------------------------------------------------------- 650 651 SfxTabPage* SvxSlantTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) 652 { 653 return( new SvxSlantTabPage( pWindow, rOutAttrs ) ); 654 } 655 656 //------------------------------------------------------------------------ 657 658 sal_uInt16* SvxSlantTabPage::GetRanges() 659 { 660 return( pSlantRanges ); 661 } 662 663 // ----------------------------------------------------------------------- 664 665 void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet ) 666 { 667 SfxRectangleItem* pRectItem = NULL; 668 669 if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , sal_False, (const SfxPoolItem**) &pRectItem ) ) 670 { 671 const Rectangle aTempRect(pRectItem->GetValue()); 672 maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 673 } 674 } 675 676 // ----------------------------------------------------------------------- 677 678 int SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet ) 679 { 680 if(_pSet) 681 { 682 FillItemSet(*_pSet); 683 } 684 685 return LEAVE_PAGE; 686 } 687 688 //------------------------------------------------------------------------ 689 690 void SvxSlantTabPage::PointChanged( Window* , RECT_POINT ) 691 { 692 } 693 694 /************************************************************************* 695 |* Dialog for changing position and size of graphic objects 696 \************************************************************************/ 697 698 SvxPositionSizeTabPage::SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 699 SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_POSITION_SIZE ), rInAttrs ), 700 maFlPosition ( this, CUI_RES( FL_POSITION ) ), 701 maFtPosX ( this, CUI_RES( FT_POS_X ) ), 702 maMtrPosX ( this, CUI_RES( MTR_FLD_POS_X ) ), 703 maFtPosY ( this, CUI_RES( FT_POS_Y ) ), 704 maMtrPosY ( this, CUI_RES( MTR_FLD_POS_Y ) ), 705 maFtPosReference ( this, CUI_RES( FT_POSREFERENCE ) ), 706 maCtlPos ( this, CUI_RES( CTL_POSRECT ), RP_LT ), 707 708 maFlSize ( this, CUI_RES( FL_SIZE ) ), 709 maFtWidth ( this, CUI_RES( FT_WIDTH ) ), 710 maMtrWidth ( this, CUI_RES( MTR_FLD_WIDTH ) ), 711 maFtHeight ( this, CUI_RES( FT_HEIGHT ) ), 712 maMtrHeight ( this, CUI_RES( MTR_FLD_HEIGHT ) ), 713 maCbxScale ( this, CUI_RES( CBX_SCALE ) ), 714 maFtSizeReference ( this, CUI_RES( FT_SIZEREFERENCE) ), 715 maCtlSize ( this, CUI_RES( CTL_SIZERECT ), RP_LT ), 716 717 maFlProtect ( this, CUI_RES( FL_PROTECT) ), 718 maTsbPosProtect ( this, CUI_RES( TSB_POSPROTECT ) ), 719 maTsbSizeProtect ( this, CUI_RES( TSB_SIZEPROTECT ) ), 720 721 722 maFlAdjust ( this, CUI_RES( FL_ADJUST ) ), 723 maTsbAutoGrowWidth ( this, CUI_RES( TSB_AUTOGROW_WIDTH ) ), 724 maTsbAutoGrowHeight ( this, CUI_RES( TSB_AUTOGROW_HEIGHT ) ), 725 726 maFlDivider (this, CUI_RES( FL_DIVIDER ) ), 727 728 mrOutAttrs ( rInAttrs ), 729 mnProtectSizeState( STATE_NOCHECK ), 730 mbPageDisabled ( sal_False ), 731 mbProtectDisabled( false ), 732 mbSizeDisabled( false ), 733 mbAdjustDisabled( true ) 734 { 735 FreeResource(); 736 737 // this page needs ExchangeSupport 738 SetExchangeSupport(); 739 740 // evaluate PoolUnit 741 SfxItemPool* pPool = mrOutAttrs.GetPool(); 742 DBG_ASSERT( pPool, "no pool (!)" ); 743 mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); 744 745 meRP = RP_LT; // s.o. 746 747 maMtrWidth.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeWidthHdl ) ); 748 maMtrHeight.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeHeightHdl ) ); 749 maCbxScale.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickAutoHdl ) ); 750 751 maTsbAutoGrowWidth.Disable(); 752 maTsbAutoGrowHeight.Disable(); 753 maFlAdjust.Disable(); 754 755 // #i2379# disable controls when protected 756 maTsbPosProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangePosProtectHdl ) ); 757 maTsbSizeProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangeSizeProtectHdl ) ); 758 759 maCtlPos.SetAccessibleRelationMemberOf( &maFlPosition ); 760 maCtlSize.SetAccessibleRelationMemberOf( &maFlSize ); 761 maCtlPos.SetAccessibleRelationLabeledBy( &maFtPosReference ); 762 maCtlSize.SetAccessibleRelationLabeledBy( &maFtSizeReference ); 763 } 764 765 // ----------------------------------------------------------------------- 766 767 void SvxPositionSizeTabPage::Construct() 768 { 769 // get range and work area 770 DBG_ASSERT( mpView, "no valid view (!)" ); 771 meDlgUnit = GetModuleFieldUnit( GetItemSet() ); 772 SetFieldUnit( maMtrPosX, meDlgUnit, sal_True ); 773 SetFieldUnit( maMtrPosY, meDlgUnit, sal_True ); 774 SetFieldUnit( maMtrWidth, meDlgUnit, sal_True ); 775 SetFieldUnit( maMtrHeight, meDlgUnit, sal_True ); 776 777 if(FUNIT_MILE == meDlgUnit || FUNIT_KM == meDlgUnit) 778 { 779 maMtrPosX.SetDecimalDigits( 3 ); 780 maMtrPosY.SetDecimalDigits( 3 ); 781 maMtrWidth.SetDecimalDigits( 3 ); 782 maMtrHeight.SetDecimalDigits( 3 ); 783 } 784 785 { // #i75273# 786 Rectangle aTempRect(mpView->GetAllMarkedRect()); 787 mpView->GetSdrPageView()->LogicToPagePos(aTempRect); 788 maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 789 } 790 791 { // #i75273# 792 Rectangle aTempRect(mpView->GetWorkArea()); 793 mpView->GetSdrPageView()->LogicToPagePos(aTempRect); 794 maWorkRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 795 } 796 797 // take anchor into account (Writer) 798 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 799 800 if(rMarkList.GetMarkCount()) 801 { 802 const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 803 maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); 804 805 if(!maAnchor.equalZero()) // -> Writer 806 { 807 for(sal_uInt16 i(1); i < rMarkList.GetMarkCount(); i++) 808 { 809 pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 810 811 if(maAnchor != basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y())) 812 { 813 // different anchor positions 814 maMtrPosX.SetText( String() ); 815 maMtrPosY.SetText( String() ); 816 mbPageDisabled = sal_True; 817 return; 818 } 819 } 820 821 // translate ranges about anchor 822 maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); 823 maWorkRange = basegfx::B2DRange(maWorkRange.getMinimum() - maAnchor, maWorkRange.getMaximum() - maAnchor); 824 } 825 } 826 827 // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE 828 if(1 == rMarkList.GetMarkCount()) 829 { 830 const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 831 const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); 832 833 if((pObj->GetObjInventor() == SdrInventor) && 834 (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && 835 pObj->HasText()) 836 { 837 mbAdjustDisabled = false; 838 maFlAdjust.Enable(); 839 maTsbAutoGrowWidth.Enable(); 840 maTsbAutoGrowHeight.Enable(); 841 maTsbAutoGrowWidth.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); 842 maTsbAutoGrowHeight.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); 843 844 // is used as flag to evaluate if its selectable 845 maTsbAutoGrowWidth.EnableTriState( sal_False ); 846 maTsbAutoGrowHeight.EnableTriState( sal_False ); 847 } 848 } 849 850 // take scale into account 851 const Fraction aUIScale(mpView->GetModel()->GetUIScale()); 852 lcl_ScaleRect( maWorkRange, aUIScale ); 853 lcl_ScaleRect( maRange, aUIScale ); 854 855 // take UI units into account 856 const sal_uInt16 nDigits(maMtrPosX.GetDecimalDigits()); 857 lcl_ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 858 lcl_ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 859 860 SetMinMaxPosition(); 861 } 862 863 // ----------------------------------------------------------------------- 864 865 sal_Bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet& rOutAttrs ) 866 { 867 sal_Bool bModified(sal_False); 868 869 if ( maMtrWidth.HasFocus() ) 870 { 871 ChangeWidthHdl( this ); 872 } 873 874 if ( maMtrHeight.HasFocus() ) 875 { 876 ChangeHeightHdl( this ); 877 } 878 879 if( !mbPageDisabled ) 880 { 881 if ( maMtrPosX.IsValueModified() || maMtrPosY.IsValueModified() ) 882 { 883 const double fUIScale(double(mpView->GetModel()->GetUIScale())); 884 double fX((GetCoreValue( maMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale); 885 double fY((GetCoreValue( maMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale); 886 887 { // #i75273# 888 Rectangle aTempRect(mpView->GetAllMarkedRect()); 889 mpView->GetSdrPageView()->LogicToPagePos(aTempRect); 890 maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 891 } 892 893 // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions 894 GetTopLeftPosition(fX, fY, maRange); 895 896 rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX))); 897 rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY))); 898 899 bModified |= sal_True; 900 } 901 902 if ( maTsbPosProtect.GetState() != maTsbPosProtect.GetSavedValue() ) 903 { 904 if( maTsbPosProtect.GetState() == STATE_DONTKNOW ) 905 { 906 rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); 907 } 908 else 909 { 910 rOutAttrs.Put( 911 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), 912 maTsbPosProtect.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 913 } 914 915 bModified |= sal_True; 916 } 917 } 918 919 if ( maMtrWidth.IsValueModified() || maMtrHeight.IsValueModified() ) 920 { 921 Fraction aUIScale = mpView->GetModel()->GetUIScale(); 922 923 // get Width 924 double nWidth = static_cast<double>(maMtrWidth.GetValue( meDlgUnit )); 925 nWidth = MetricField::ConvertDoubleValue( nWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); 926 long lWidth = long(nWidth * (double)aUIScale); 927 lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); 928 lWidth = static_cast<long>(maMtrWidth.Denormalize( lWidth )); 929 930 // get Height 931 double nHeight = static_cast<double>(maMtrHeight.GetValue( meDlgUnit )); 932 nHeight = MetricField::ConvertDoubleValue( nHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); 933 long lHeight = long(nHeight * (double)aUIScale); 934 lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); 935 lHeight = static_cast<long>(maMtrWidth.Denormalize( lHeight )); 936 937 // put Width & Height to itemset 938 rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), 939 (sal_uInt32) lWidth ) ); 940 rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), 941 (sal_uInt32) lHeight ) ); 942 rOutAttrs.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< sal_uInt16 >( meRP ) ) ); 943 bModified |= sal_True; 944 } 945 946 if ( maTsbSizeProtect.GetState() != maTsbSizeProtect.GetSavedValue() ) 947 { 948 if ( maTsbSizeProtect.GetState() == STATE_DONTKNOW ) 949 rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); 950 else 951 rOutAttrs.Put( 952 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), 953 maTsbSizeProtect.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 954 bModified |= sal_True; 955 } 956 957 if ( maTsbAutoGrowWidth.GetState() != maTsbAutoGrowWidth.GetSavedValue() ) 958 { 959 if ( !maTsbAutoGrowWidth.IsTriStateEnabled() ) 960 { 961 if( maTsbAutoGrowWidth.GetState() == STATE_DONTKNOW ) 962 rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH ); 963 else 964 rOutAttrs.Put( 965 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOWIDTH ), 966 maTsbAutoGrowWidth.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 967 } 968 bModified |= sal_True; 969 } 970 971 if ( maTsbAutoGrowHeight.GetState() != maTsbAutoGrowHeight.GetSavedValue() ) 972 { 973 if ( !maTsbAutoGrowHeight.IsTriStateEnabled() ) 974 { 975 if( maTsbAutoGrowHeight.GetState() == STATE_DONTKNOW ) 976 rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOHEIGHT ); 977 else 978 rOutAttrs.Put( 979 SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOHEIGHT ), 980 maTsbAutoGrowHeight.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 981 } 982 bModified |= sal_True; 983 } 984 985 986 return bModified; 987 } 988 989 // ----------------------------------------------------------------------- 990 991 void SvxPositionSizeTabPage::Reset( const SfxItemSet& ) 992 { 993 const SfxPoolItem* pItem; 994 const double fUIScale(double(mpView->GetModel()->GetUIScale())); 995 996 if ( !mbPageDisabled ) 997 { 998 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X ); 999 if ( pItem ) 1000 { 1001 const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); 1002 SetMetricValue(maMtrPosX, basegfx::fround(fTmp), mePoolUnit); 1003 } 1004 1005 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y ); 1006 if ( pItem ) 1007 { 1008 const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); 1009 SetMetricValue(maMtrPosY, basegfx::fround(fTmp), mePoolUnit); 1010 } 1011 1012 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_POS ); 1013 if ( pItem ) 1014 { 1015 sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); 1016 maTsbPosProtect.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); 1017 maTsbPosProtect.EnableTriState( sal_False ); 1018 } 1019 else 1020 { 1021 maTsbPosProtect.SetState( STATE_DONTKNOW ); 1022 } 1023 1024 maTsbPosProtect.SaveValue(); 1025 maCtlPos.Reset(); 1026 1027 // #i2379# Disable controls for protected objects 1028 ChangePosProtectHdl( this ); 1029 } 1030 1031 { // #i75273# set width 1032 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH ); 1033 mfOldWidth = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); 1034 double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); 1035 1036 if(maMtrWidth.GetDecimalDigits()) 1037 fTmpWidth *= pow(10.0, maMtrWidth.GetDecimalDigits()); 1038 1039 fTmpWidth = MetricField::ConvertDoubleValue(fTmpWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); 1040 maMtrWidth.SetValue(static_cast<sal_Int64>(fTmpWidth), meDlgUnit); 1041 } 1042 1043 { // #i75273# set height 1044 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT ); 1045 mfOldHeight = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); 1046 double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); 1047 1048 if(maMtrHeight.GetDecimalDigits()) 1049 fTmpHeight *= pow(10.0, maMtrHeight.GetDecimalDigits()); 1050 1051 fTmpHeight = MetricField::ConvertDoubleValue(fTmpHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); 1052 maMtrHeight.SetValue(static_cast<sal_Int64>(fTmpHeight), meDlgUnit); 1053 } 1054 1055 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE ); 1056 if ( pItem ) 1057 { 1058 maTsbSizeProtect.SetState( ( (const SfxBoolItem*)pItem )->GetValue() 1059 ? STATE_CHECK : STATE_NOCHECK ); 1060 maTsbSizeProtect.EnableTriState( sal_False ); 1061 } 1062 else 1063 maTsbSizeProtect.SetState( STATE_DONTKNOW ); 1064 1065 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOWIDTH ); 1066 if ( pItem ) 1067 { 1068 maTsbAutoGrowWidth.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() 1069 ? STATE_CHECK : STATE_NOCHECK ); 1070 } 1071 else 1072 maTsbAutoGrowWidth.SetState( STATE_DONTKNOW ); 1073 1074 pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOHEIGHT ); 1075 if ( pItem ) 1076 { 1077 maTsbAutoGrowHeight.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() 1078 ? STATE_CHECK : STATE_NOCHECK ); 1079 } 1080 else 1081 maTsbAutoGrowHeight.SetState( STATE_DONTKNOW ); 1082 1083 // Ist Abgleich gesetzt? 1084 String aStr = GetUserData(); 1085 maCbxScale.Check( (sal_Bool)aStr.ToInt32() ); 1086 1087 maTsbSizeProtect.SaveValue(); 1088 maTsbAutoGrowWidth.SaveValue(); 1089 maTsbAutoGrowHeight.SaveValue(); 1090 ClickSizeProtectHdl( NULL ); 1091 1092 // #i2379# Disable controls for protected objects 1093 ChangeSizeProtectHdl( this ); 1094 } 1095 1096 // ----------------------------------------------------------------------- 1097 1098 SfxTabPage* SvxPositionSizeTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) 1099 { 1100 return( new SvxPositionSizeTabPage( pWindow, rOutAttrs ) ); 1101 } 1102 1103 //------------------------------------------------------------------------ 1104 1105 sal_uInt16* SvxPositionSizeTabPage::GetRanges() 1106 { 1107 return( pPosSizeRanges ); 1108 } 1109 1110 // ----------------------------------------------------------------------- 1111 1112 void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet ) 1113 { 1114 SfxRectangleItem* pRectItem = NULL; 1115 1116 if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , sal_False, (const SfxPoolItem**) &pRectItem ) ) 1117 { 1118 { // #i75273# 1119 const Rectangle aTempRect(pRectItem->GetValue()); 1120 maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 1121 } 1122 1123 SetMinMaxPosition(); 1124 } 1125 } 1126 1127 // ----------------------------------------------------------------------- 1128 1129 int SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) 1130 { 1131 if( _pSet ) 1132 { 1133 double fX((double)maMtrPosX.GetValue()); 1134 double fY((double)maMtrPosY.GetValue()); 1135 1136 GetTopLeftPosition(fX, fY, maRange); 1137 const Rectangle aOutRectangle( 1138 basegfx::fround(fX), basegfx::fround(fY), 1139 basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight())); 1140 _pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle)); 1141 1142 FillItemSet(*_pSet); 1143 } 1144 1145 return LEAVE_PAGE; 1146 } 1147 1148 //------------------------------------------------------------------------ 1149 1150 IMPL_LINK( SvxPositionSizeTabPage, ChangePosProtectHdl, void *, EMPTYARG ) 1151 { 1152 // #106572# Remember user's last choice 1153 maTsbSizeProtect.SetState( maTsbPosProtect.GetState() == STATE_CHECK ? STATE_CHECK : mnProtectSizeState ); 1154 UpdateControlStates(); 1155 return( 0L ); 1156 } 1157 1158 //------------------------------------------------------------------------ 1159 1160 void SvxPositionSizeTabPage::UpdateControlStates() 1161 { 1162 const bool bPosProtect = maTsbPosProtect.GetState() == STATE_CHECK; 1163 const bool bSizeProtect = maTsbSizeProtect.GetState() == STATE_CHECK; 1164 const bool bHeightChecked = !maTsbAutoGrowHeight.IsTriStateEnabled() && (maTsbAutoGrowHeight.GetState() == STATE_CHECK); 1165 const bool bWidthChecked = !maTsbAutoGrowWidth.IsTriStateEnabled() && (maTsbAutoGrowWidth.GetState() == STATE_CHECK); 1166 1167 maFlPosition.Enable( !bPosProtect && !mbPageDisabled ); 1168 maFtPosX.Enable( !bPosProtect && !mbPageDisabled ); 1169 maMtrPosX.Enable( !bPosProtect && !mbPageDisabled ); 1170 maFtPosY.Enable( !bPosProtect && !mbPageDisabled ); 1171 maMtrPosY.Enable( !bPosProtect && !mbPageDisabled ); 1172 maFtPosReference.Enable( !bPosProtect && !mbPageDisabled ); 1173 maCtlPos.Enable( !bPosProtect ); 1174 maTsbPosProtect.Enable( !mbProtectDisabled && !mbPageDisabled ); 1175 1176 maFlSize.Enable( !mbSizeDisabled && !bSizeProtect ); 1177 maCtlSize.Enable( !mbSizeDisabled && !bSizeProtect && (!bHeightChecked || !bWidthChecked) ); 1178 maFtWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); 1179 maMtrWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); 1180 maFtHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); 1181 maMtrHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); 1182 maCbxScale.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked && !bWidthChecked ); 1183 maFtSizeReference.Enable( !mbSizeDisabled && !bSizeProtect ); 1184 maFlProtect.Enable( !mbProtectDisabled ); 1185 maTsbSizeProtect.Enable( !mbProtectDisabled && !bPosProtect ); 1186 1187 maFlAdjust.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); 1188 maTsbAutoGrowWidth.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); 1189 maTsbAutoGrowHeight.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); 1190 1191 maCtlSize.Invalidate(); 1192 maCtlPos.Invalidate(); 1193 1194 } 1195 1196 //------------------------------------------------------------------------ 1197 1198 IMPL_LINK( SvxPositionSizeTabPage, ChangeSizeProtectHdl, void *, EMPTYARG ) 1199 { 1200 if( maTsbSizeProtect.IsEnabled() ) 1201 { 1202 // #106572# Remember user's last choice 1203 1204 // Note: this works only as long as the dialog is open. When 1205 // the user closes the dialog, there is no way to remember 1206 // whether size was enabled or disabled before pos protect was 1207 // clicked. Thus, if pos protect is selected, the dialog is 1208 // closed and reopened again, unchecking pos protect will 1209 // always uncheck size protect, too. That's life. 1210 mnProtectSizeState = maTsbSizeProtect.GetState(); 1211 } 1212 1213 UpdateControlStates(); 1214 1215 return( 0L ); 1216 } 1217 1218 //------------------------------------------------------------------------ 1219 1220 IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) 1221 { 1222 return( 0L ); 1223 } 1224 IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) 1225 1226 //------------------------------------------------------------------------ 1227 1228 IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) 1229 { 1230 return( 0L ); 1231 } 1232 IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) 1233 1234 //------------------------------------------------------------------------ 1235 1236 void SvxPositionSizeTabPage::SetMinMaxPosition() 1237 { 1238 // position 1239 double fLeft(maWorkRange.getMinX()); 1240 double fTop(maWorkRange.getMinY()); 1241 double fRight(maWorkRange.getMaxX()); 1242 double fBottom(maWorkRange.getMaxY()); 1243 1244 switch ( maCtlPos.GetActualRP() ) 1245 { 1246 case RP_LT: 1247 { 1248 fRight -= maRange.getWidth(); 1249 fBottom -= maRange.getHeight(); 1250 break; 1251 } 1252 case RP_MT: 1253 { 1254 fLeft += maRange.getWidth() / 2.0; 1255 fRight -= maRange.getWidth() / 2.0; 1256 fBottom -= maRange.getHeight(); 1257 break; 1258 } 1259 case RP_RT: 1260 { 1261 fLeft += maRange.getWidth(); 1262 fBottom -= maRange.getHeight(); 1263 break; 1264 } 1265 case RP_LM: 1266 { 1267 fRight -= maRange.getWidth(); 1268 fTop += maRange.getHeight() / 2.0; 1269 fBottom -= maRange.getHeight() / 2.0; 1270 break; 1271 } 1272 case RP_MM: 1273 { 1274 fLeft += maRange.getWidth() / 2.0; 1275 fRight -= maRange.getWidth() / 2.0; 1276 fTop += maRange.getHeight() / 2.0; 1277 fBottom -= maRange.getHeight() / 2.0; 1278 break; 1279 } 1280 case RP_RM: 1281 { 1282 fLeft += maRange.getWidth(); 1283 fTop += maRange.getHeight() / 2.0; 1284 fBottom -= maRange.getHeight() / 2.0; 1285 break; 1286 } 1287 case RP_LB: 1288 { 1289 fRight -= maRange.getWidth(); 1290 fTop += maRange.getHeight(); 1291 break; 1292 } 1293 case RP_MB: 1294 { 1295 fLeft += maRange.getWidth() / 2.0; 1296 fRight -= maRange.getWidth() / 2.0; 1297 fTop += maRange.getHeight(); 1298 break; 1299 } 1300 case RP_RB: 1301 { 1302 fLeft += maRange.getWidth(); 1303 fTop += maRange.getHeight(); 1304 break; 1305 } 1306 } 1307 1308 const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MAP_100TH_MM, meDlgUnit ) - 1L)); 1309 fLeft = (fLeft > fMaxLong) ? fMaxLong : (fLeft < -fMaxLong) ? -fMaxLong : fLeft; 1310 fRight = (fRight > fMaxLong) ? fMaxLong : (fRight < -fMaxLong) ? -fMaxLong : fRight; 1311 fTop = (fTop > fMaxLong) ? fMaxLong : (fTop < -fMaxLong) ? -fMaxLong : fTop; 1312 fBottom = (fBottom > fMaxLong) ? fMaxLong : (fBottom < -fMaxLong) ? -fMaxLong : fBottom; 1313 1314 // #i75273# normalizing when setting the min/max values was wrong, removed 1315 maMtrPosX.SetMin(basegfx::fround64(fLeft)); 1316 maMtrPosX.SetFirst(basegfx::fround64(fLeft)); 1317 maMtrPosX.SetMax(basegfx::fround64(fRight)); 1318 maMtrPosX.SetLast(basegfx::fround64(fRight)); 1319 maMtrPosY.SetMin(basegfx::fround64(fTop)); 1320 maMtrPosY.SetFirst(basegfx::fround64(fTop)); 1321 maMtrPosY.SetMax(basegfx::fround64(fBottom)); 1322 maMtrPosY.SetLast(basegfx::fround64(fBottom)); 1323 1324 // size 1325 fLeft = maWorkRange.getMinX(); 1326 fTop = maWorkRange.getMinY(); 1327 fRight = maWorkRange.getMaxX(); 1328 fBottom = maWorkRange.getMaxY(); 1329 double fNewX(0); 1330 double fNewY(0); 1331 1332 switch ( maCtlSize.GetActualRP() ) 1333 { 1334 case RP_LT: 1335 { 1336 fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); 1337 fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); 1338 break; 1339 } 1340 case RP_MT: 1341 { 1342 fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; 1343 fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); 1344 break; 1345 } 1346 case RP_RT: 1347 { 1348 fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); 1349 fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); 1350 break; 1351 } 1352 case RP_LM: 1353 { 1354 fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); 1355 fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; 1356 break; 1357 } 1358 case RP_MM: 1359 { 1360 const double f1(maRange.getCenter().getX() - fLeft); 1361 const double f2(fRight - maRange.getCenter().getX()); 1362 const double f3(std::min(f1, f2)); 1363 const double f4(maRange.getCenter().getY() - fTop); 1364 const double f5(fBottom - maRange.getCenter().getY()); 1365 const double f6(std::min(f4, f5)); 1366 1367 fNewX = f3 * 2.0; 1368 fNewY = f6 * 3.0; 1369 1370 break; 1371 } 1372 case RP_RM: 1373 { 1374 fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); 1375 fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; 1376 break; 1377 } 1378 case RP_LB: 1379 { 1380 fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); 1381 fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); 1382 break; 1383 } 1384 case RP_MB: 1385 { 1386 fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; 1387 fNewY = maWorkRange.getHeight() - ( maRange.getMaxY() - fBottom ); 1388 break; 1389 } 1390 case RP_RB: 1391 { 1392 fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); 1393 fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); 1394 break; 1395 } 1396 } 1397 1398 // #i75273# normalizing when setting the min/max values was wrong, removed 1399 maMtrWidth.SetMax(basegfx::fround64(fNewX)); 1400 maMtrWidth.SetLast(basegfx::fround64(fNewX)); 1401 maMtrHeight.SetMax(basegfx::fround64(fNewY)); 1402 maMtrHeight.SetLast(basegfx::fround64(fNewY)); 1403 } 1404 1405 //------------------------------------------------------------------------ 1406 1407 void SvxPositionSizeTabPage::GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange) 1408 { 1409 switch (maCtlPos.GetActualRP()) 1410 { 1411 case RP_LT: 1412 { 1413 break; 1414 } 1415 case RP_MT: 1416 { 1417 rfX -= rRange.getCenter().getX() - rRange.getMinX(); 1418 break; 1419 } 1420 case RP_RT: 1421 { 1422 rfX -= rRange.getWidth(); 1423 break; 1424 } 1425 case RP_LM: 1426 { 1427 rfY -= rRange.getCenter().getY() - rRange.getMinY(); 1428 break; 1429 } 1430 case RP_MM: 1431 { 1432 rfX -= rRange.getCenter().getX() - rRange.getMinX(); 1433 rfY -= rRange.getCenter().getY() - rRange.getMinY(); 1434 break; 1435 } 1436 case RP_RM: 1437 { 1438 rfX -= rRange.getWidth(); 1439 rfY -= rRange.getCenter().getY() - rRange.getMinY(); 1440 break; 1441 } 1442 case RP_LB: 1443 { 1444 rfY -= rRange.getHeight(); 1445 break; 1446 } 1447 case RP_MB: 1448 { 1449 rfX -= rRange.getCenter().getX() - rRange.getMinX(); 1450 rfY -= rRange.getHeight(); 1451 break; 1452 } 1453 case RP_RB: 1454 { 1455 rfX -= rRange.getWidth(); 1456 rfY -= rRange.getHeight(); 1457 break; 1458 } 1459 } 1460 } 1461 1462 //------------------------------------------------------------------------ 1463 1464 void SvxPositionSizeTabPage::PointChanged( Window* pWindow, RECT_POINT eRP ) 1465 { 1466 if( pWindow == &maCtlPos ) 1467 { 1468 SetMinMaxPosition(); 1469 switch( eRP ) 1470 { 1471 case RP_LT: 1472 { 1473 maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); 1474 maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); 1475 break; 1476 } 1477 case RP_MT: 1478 { 1479 maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); 1480 maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); 1481 break; 1482 } 1483 case RP_RT: 1484 { 1485 maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); 1486 maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); 1487 break; 1488 } 1489 case RP_LM: 1490 { 1491 maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); 1492 maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); 1493 break; 1494 } 1495 case RP_MM: 1496 { 1497 maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); 1498 maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); 1499 break; 1500 } 1501 case RP_RM: 1502 { 1503 maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); 1504 maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); 1505 break; 1506 } 1507 case RP_LB: 1508 { 1509 maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); 1510 maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); 1511 break; 1512 } 1513 case RP_MB: 1514 { 1515 maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); 1516 maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); 1517 break; 1518 } 1519 case RP_RB: 1520 { 1521 maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); 1522 maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); 1523 break; 1524 } 1525 } 1526 } 1527 else 1528 { 1529 meRP = eRP; 1530 1531 Rectangle aTmpRect( GetRect() ); 1532 SetMinMaxPosition(); 1533 } 1534 } 1535 1536 //------------------------------------------------------------------------ 1537 1538 void SvxPositionSizeTabPage::DisableResize() 1539 { 1540 mbSizeDisabled = true; 1541 } 1542 1543 //------------------------------------------------------------------------ 1544 1545 void SvxPositionSizeTabPage::DisableProtect() 1546 { 1547 mbProtectDisabled = true; 1548 } 1549 1550 //------------------------------------------------------------------------ 1551 1552 Rectangle SvxPositionSizeTabPage::GetRect() 1553 { 1554 double fLeft(maRange.getMinX()); 1555 double fTop(maRange.getMinY()); 1556 double fRight(fLeft + (double)maMtrWidth.GetValue()); 1557 double fBottom(fTop + (double)maMtrHeight.GetValue()); 1558 1559 switch ( maCtlSize.GetActualRP() ) 1560 { 1561 case RP_LT: 1562 { 1563 break; 1564 } 1565 case RP_MT: 1566 { 1567 fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; 1568 break; 1569 } 1570 case RP_RT: 1571 { 1572 fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); 1573 break; 1574 } 1575 case RP_LM: 1576 { 1577 fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; 1578 break; 1579 } 1580 case RP_MM: 1581 { 1582 fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; 1583 fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; 1584 break; 1585 } 1586 case RP_RM: 1587 { 1588 fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); 1589 fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; 1590 break; 1591 } 1592 case RP_LB: 1593 { 1594 fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); 1595 break; 1596 } 1597 case RP_MB: 1598 { 1599 fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; 1600 fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); 1601 break; 1602 } 1603 case RP_RB: 1604 { 1605 fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); 1606 fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); 1607 break; 1608 } 1609 } 1610 1611 return Rectangle(basegfx::fround(fLeft), basegfx::fround(fTop), basegfx::fround(fRight), basegfx::fround(fBottom)); 1612 } 1613 1614 //------------------------------------------------------------------------ 1615 1616 IMPL_LINK( SvxPositionSizeTabPage, ChangeWidthHdl, void *, EMPTYARG ) 1617 { 1618 if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) 1619 { 1620 sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)maMtrWidth.GetValue()) / mfOldWidth)); 1621 1622 if(nHeight <= maMtrHeight.GetMax(FUNIT_NONE)) 1623 { 1624 maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); 1625 } 1626 else 1627 { 1628 nHeight = maMtrHeight.GetMax(FUNIT_NONE); 1629 maMtrHeight.SetUserValue(nHeight); 1630 1631 const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)nHeight) / mfOldHeight)); 1632 maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); 1633 } 1634 } 1635 1636 return( 0L ); 1637 } 1638 1639 //------------------------------------------------------------------------ 1640 1641 IMPL_LINK( SvxPositionSizeTabPage, ChangeHeightHdl, void *, EMPTYARG ) 1642 { 1643 if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) 1644 { 1645 sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)maMtrHeight.GetValue()) / mfOldHeight)); 1646 1647 if(nWidth <= maMtrWidth.GetMax(FUNIT_NONE)) 1648 { 1649 maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); 1650 } 1651 else 1652 { 1653 nWidth = maMtrWidth.GetMax(FUNIT_NONE); 1654 maMtrWidth.SetUserValue(nWidth); 1655 1656 const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)nWidth) / mfOldWidth)); 1657 maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); 1658 } 1659 } 1660 1661 return( 0L ); 1662 } 1663 1664 //------------------------------------------------------------------------ 1665 1666 IMPL_LINK( SvxPositionSizeTabPage, ClickSizeProtectHdl, void *, EMPTYARG ) 1667 { 1668 UpdateControlStates(); 1669 return( 0L ); 1670 } 1671 1672 //------------------------------------------------------------------------ 1673 1674 IMPL_LINK( SvxPositionSizeTabPage, ClickAutoHdl, void *, EMPTYARG ) 1675 { 1676 if( maCbxScale.IsChecked() ) 1677 { 1678 mfOldWidth = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 ); 1679 mfOldHeight = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 ); 1680 } 1681 1682 return( 0L ); 1683 } 1684 1685 //------------------------------------------------------------------------ 1686 1687 void SvxPositionSizeTabPage::FillUserData() 1688 { 1689 // Abgleich wird in der Ini-Datei festgehalten 1690 UniString aStr = UniString::CreateFromInt32( (sal_Int32) maCbxScale.IsChecked() ); 1691 SetUserData( aStr ); 1692 } 1693 1694 /* vim: set noet sw=4 ts=4: */ 1695