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 #include <sfx2/sidebar/propertypanel.hrc> 23 #include <sfx2/sidebar/Theme.hxx> 24 #include <sfx2/sidebar/ControlFactory.hxx> 25 #include "PosSizePropertyPanel.hxx" 26 #include "PosSizePropertyPanel.hrc" 27 #include "SidebarDialControl.hxx" 28 #include <svx/dialogs.hrc> 29 #include <svx/dialmgr.hxx> 30 #include <sfx2/dispatch.hxx> 31 #include <sfx2/bindings.hxx> 32 #include <sfx2/viewsh.hxx> 33 #include <sfx2/objsh.hxx> 34 #include <svx/dlgutil.hxx> 35 #include <unotools/viewoptions.hxx> 36 #include <vcl/virdev.hxx> 37 #include <vcl/svapp.hxx> 38 #include <vcl/field.hxx> 39 #include <vcl/fixed.hxx> 40 #include <vcl/toolbox.hxx> 41 #include <svx/svdview.hxx> 42 #include <svl/aeitem.hxx> 43 44 using namespace css; 45 using namespace cssu; 46 using ::sfx2::sidebar::Theme; 47 48 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 49 #define USERITEM_NAME rtl::OUString::createFromAscii("FitItem") 50 #define NO_SELECT (65535) 51 52 53 54 namespace svx { namespace sidebar { 55 56 57 58 PosSizePropertyPanel::PosSizePropertyPanel( 59 Window* pParent, 60 const cssu::Reference<css::frame::XFrame>& rxFrame, 61 SfxBindings* pBindings) 62 : Control( 63 pParent, 64 SVX_RES(RID_SIDEBAR_POSSIZE_PANEL)), 65 mpFtPosX(new FixedText(this, SVX_RES(FT_SBSHAPE_HORIZONTAL))), 66 mpMtrPosX(new MetricField(this, SVX_RES(MF_SBSHAPE_HORIZONTAL))), 67 mpFtPosY(new FixedText(this, SVX_RES(FT_SBSHAPE_VERTICAL))), 68 mpMtrPosY(new MetricField(this, SVX_RES(MF_SBSHAPE_VERTICAL))), 69 mpFtWidth(new FixedText(this, SVX_RES(FT_WIDTH))), 70 mpMtrWidth(new MetricField(this, SVX_RES(MTR_FLD_WIDTH))), 71 mpFtHeight(new FixedText(this, SVX_RES(FT_HEIGHT))), 72 mpMtrHeight(new MetricField(this, SVX_RES(MTR_FLD_HEIGHT))), 73 mpCbxScale(new CheckBox(this, SVX_RES(CBX_SCALE))), 74 mpFtAngle(new FixedText(this, SVX_RES(FT_ANGLE))), 75 mpMtrAngle(new MetricBox(this, SVX_RES(MTR_FLD_ANGLE))), 76 mpDial(new SidebarDialControl(this, SVX_RES(DIAL_CONTROL))), 77 mpFtFlip(new FixedText(this, SVX_RES(FT_FLIP))), 78 mpFlipTbxBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 79 mpFlipTbx(sfx2::sidebar::ControlFactory::CreateToolBox(mpFlipTbxBackground.get(), SVX_RES(TBX_FLIP))), 80 maRect(), 81 mpView(0), 82 mlOldWidth(1), 83 mlOldHeight(1), 84 meRP(RP_LT), 85 maAnchorPos(), 86 mlRotX(0), 87 mlRotY(0), 88 maUIScale(), 89 mePoolUnit(), 90 meDlgUnit(), 91 maTransfPosXControl(SID_ATTR_TRANSFORM_POS_X, *pBindings, *this), 92 maTransfPosYControl(SID_ATTR_TRANSFORM_POS_Y, *pBindings, *this), 93 maTransfWidthControl(SID_ATTR_TRANSFORM_WIDTH, *pBindings, *this), 94 maTransfHeightControl(SID_ATTR_TRANSFORM_HEIGHT, *pBindings, *this), 95 maSvxAngleControl( SID_ATTR_TRANSFORM_ANGLE, *pBindings, *this), 96 maRotXControl(SID_ATTR_TRANSFORM_ROT_X, *pBindings, *this), 97 maRotYControl(SID_ATTR_TRANSFORM_ROT_Y, *pBindings, *this), 98 maProPosControl(SID_ATTR_TRANSFORM_PROTECT_POS, *pBindings, *this), 99 maProSizeControl(SID_ATTR_TRANSFORM_PROTECT_SIZE, *pBindings, *this), 100 maAutoWidthControl(SID_ATTR_TRANSFORM_AUTOWIDTH, *pBindings, *this), 101 maAutoHeightControl(SID_ATTR_TRANSFORM_AUTOHEIGHT, *pBindings, *this), 102 m_aMetricCtl(SID_ATTR_METRIC, *pBindings, *this), 103 maImgFlipHori(SVX_RES(IMG_HORI_FLIP)), 104 maImgFlipVert(SVX_RES(IMG_VERT_FLIP)), 105 mxFrame(rxFrame), 106 maContext(), 107 mpBindings(pBindings), 108 mbMtrPosXMirror(false), 109 mbSizeProtected(false), 110 mbPositionProtected(false), 111 mbAutoWidth(false), 112 mbAutoHeight(false), 113 mbAdjustEnabled(false), 114 mbIsFlip(false), 115 mbInDestructor(false) 116 { 117 Initialize(); 118 FreeResource(); 119 } 120 121 122 123 PosSizePropertyPanel::~PosSizePropertyPanel() 124 { 125 mbInDestructor = true; 126 127 // Destroy the background windows of the toolboxes. 128 mpFlipTbx.reset(); 129 mpFlipTbxBackground.reset(); 130 } 131 132 133 134 void PosSizePropertyPanel::ShowMenu (void) 135 { 136 if (mpBindings != NULL) 137 { 138 SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); 139 if (pDispatcher != NULL) 140 pDispatcher->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_ASYNCHRON); 141 } 142 } 143 144 145 146 void PosSizePropertyPanel::Initialize() 147 { 148 //Position : Horizontal / Vertical 149 mpMtrPosX->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) ); 150 mpMtrPosY->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) ); 151 mpMtrPosX->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Horizontal"))); //wj acc 152 mpMtrPosY->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Vertical"))); //wj acc 153 154 //Size : Width / Height 155 mpMtrWidth->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) ); 156 mpMtrHeight->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) ); 157 mpMtrWidth->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width"))); //wj acc 158 mpMtrHeight->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height"))); //wj acc 159 160 //Size : Keep ratio 161 mpCbxScale->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) ); 162 163 //rotation: 164 mpMtrAngle->SetModifyHdl(LINK( this, PosSizePropertyPanel, AngleModifiedHdl)); 165 mpMtrAngle->EnableAutocomplete( false ); 166 mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rotation"))); //wj acc 167 168 //rotation control 169 mpDial->SetModifyHdl(LINK( this, PosSizePropertyPanel, RotationHdl)); 170 171 //flip: 172 mpFlipTbx->SetSelectHdl( LINK( this, PosSizePropertyPanel, FlipHdl) ); 173 mpFlipTbx->SetItemImage(FLIP_HORIZONTAL,maImgFlipHori); 174 mpFlipTbx->SetItemImage(FLIP_VERTICAL,maImgFlipVert); 175 mpFlipTbx->SetQuickHelpText(FLIP_HORIZONTAL,String(SVX_RES(STR_QH_HORI_FLIP))); //Add 176 mpFlipTbx->SetQuickHelpText(FLIP_VERTICAL,String(SVX_RES(STR_QH_VERT_FLIP))); //Add 177 178 mpMtrPosX->SetAccessibleRelationLabeledBy(mpFtPosX.get()); 179 mpMtrPosY->SetAccessibleRelationLabeledBy(mpFtPosY.get()); 180 mpMtrWidth->SetAccessibleRelationLabeledBy(mpFtWidth.get()); 181 mpMtrHeight->SetAccessibleRelationLabeledBy(mpFtHeight.get()); 182 mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtAngle.get()); 183 //mpMtrAngle->SetMpSubEditAccLableBy(mpFtAngle.get()); 184 mpFlipTbx->SetAccessibleRelationLabeledBy(mpFtFlip.get()); 185 186 mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); 187 mpMtrAngle->InsertValue(4500, FUNIT_CUSTOM); 188 mpMtrAngle->InsertValue(9000, FUNIT_CUSTOM); 189 mpMtrAngle->InsertValue(13500, FUNIT_CUSTOM); 190 mpMtrAngle->InsertValue(18000, FUNIT_CUSTOM); 191 mpMtrAngle->InsertValue(22500, FUNIT_CUSTOM); 192 mpMtrAngle->InsertValue(27000, FUNIT_CUSTOM); 193 mpMtrAngle->InsertValue(31500, FUNIT_CUSTOM); 194 mpMtrAngle->SetDropDownLineCount(8); 195 196 SfxViewShell* pCurSh = SfxViewShell::Current(); 197 if ( pCurSh ) 198 mpView = pCurSh->GetDrawView(); 199 else 200 mpView = NULL; 201 202 if ( mpView != NULL ) 203 { 204 maUIScale = mpView->GetModel()->GetUIScale(); 205 206 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 207 if(1 == rMarkList.GetMarkCount()) 208 { 209 const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 210 const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); 211 212 if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) 213 { 214 mbAdjustEnabled = true; 215 } 216 } 217 } 218 219 mePoolUnit = maTransfWidthControl.GetCoreMetric(); 220 meDlgUnit = GetModuleFieldUnit(); 221 SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); 222 SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); 223 SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); 224 SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); 225 } 226 227 228 229 void PosSizePropertyPanel::SetupIcons(void) 230 { 231 if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 232 { 233 // todo 234 } 235 else 236 { 237 // todo 238 } 239 } 240 241 242 243 PosSizePropertyPanel* PosSizePropertyPanel::Create ( 244 Window* pParent, 245 const cssu::Reference<css::frame::XFrame>& rxFrame, 246 SfxBindings* pBindings) 247 { 248 if (pParent == NULL) 249 throw lang::IllegalArgumentException(A2S("no parent Window given to PosSizePropertyPanel::Create"), NULL, 0); 250 if ( ! rxFrame.is()) 251 throw lang::IllegalArgumentException(A2S("no XFrame given to PosSizePropertyPanel::Create"), NULL, 1); 252 if (pBindings == NULL) 253 throw lang::IllegalArgumentException(A2S("no SfxBindings given to PosSizePropertyPanel::Create"), NULL, 2); 254 255 return new PosSizePropertyPanel( 256 pParent, 257 rxFrame, 258 pBindings); 259 } 260 261 262 263 void PosSizePropertyPanel::DataChanged( 264 const DataChangedEvent& rEvent) 265 { 266 (void)rEvent; 267 268 SetupIcons(); 269 } 270 271 272 273 void PosSizePropertyPanel::HandleContextChange( 274 const ::sfx2::sidebar::EnumContext aContext) 275 { 276 if(maContext == aContext) 277 { 278 // Nothing to do. 279 return; 280 } 281 282 maContext = aContext; 283 284 sal_Int32 nLayoutMode (0); 285 switch (maContext.GetCombinedContext_DI()) 286 { 287 case CombinedEnumContext(Application_Writer, Context_Draw): 288 nLayoutMode = 0; 289 break; 290 291 case CombinedEnumContext(Application_Writer, Context_Graphic): 292 case CombinedEnumContext(Application_Writer, Context_Media): 293 case CombinedEnumContext(Application_Writer, Context_Frame): 294 case CombinedEnumContext(Application_Writer, Context_OLE): 295 case CombinedEnumContext(Application_Writer, Context_Form): 296 nLayoutMode = 1; 297 break; 298 299 case CombinedEnumContext(Application_Calc, Context_Draw): 300 case CombinedEnumContext(Application_Calc, Context_Graphic): 301 case CombinedEnumContext(Application_DrawImpress, Context_Draw): 302 case CombinedEnumContext(Application_DrawImpress, Context_TextObject): 303 case CombinedEnumContext(Application_DrawImpress, Context_Graphic): 304 nLayoutMode = 2; 305 break; 306 307 case CombinedEnumContext(Application_Calc, Context_Chart): 308 case CombinedEnumContext(Application_Calc, Context_Form): 309 case CombinedEnumContext(Application_Calc, Context_Media): 310 case CombinedEnumContext(Application_Calc, Context_OLE): 311 case CombinedEnumContext(Application_Calc, Context_MultiObject): 312 case CombinedEnumContext(Application_DrawImpress, Context_Media): 313 case CombinedEnumContext(Application_DrawImpress, Context_Form): 314 case CombinedEnumContext(Application_DrawImpress, Context_OLE): 315 case CombinedEnumContext(Application_DrawImpress, Context_3DObject): 316 case CombinedEnumContext(Application_DrawImpress, Context_MultiObject): 317 nLayoutMode = 3; 318 break; 319 } 320 switch (nLayoutMode) 321 { 322 case 0: 323 { 324 mpMtrWidth->SetMin( 2 ); 325 mpMtrHeight->SetMin( 2 ); 326 mpFtPosX->Hide(); 327 mpMtrPosX->Hide(); 328 mpFtPosY->Hide(); 329 mpMtrPosY->Hide(); 330 331 //rotation 332 mpFtAngle->Show(); 333 mpMtrAngle->Show(); 334 mpDial->Show(); 335 336 //flip 337 mpFtFlip->Show(); 338 mpFlipTbx->Show(); 339 Size aTbxSize = mpFlipTbx->CalcWindowSizePixel(); 340 mpFlipTbx->SetOutputSizePixel( aTbxSize ); 341 mbIsFlip = true; 342 343 mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT))); 344 mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT))); 345 mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT))); 346 mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT))); 347 mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT))); 348 349 mpFtAngle->SetPosPixel(Point(LogicToPixel(Point(FT_ANGLE_X,FT_ANGLE_Y), MAP_APPFONT))); 350 mpMtrAngle->SetPosPixel(Point(LogicToPixel(Point(MF_ANGLE_X2,MF_ANGLE_Y2), MAP_APPFONT))); 351 mpFlipTbx->SetPosPixel(Point(LogicToPixel(Point(FLIP_HORI_X2,FLIP_HORI_Y2), MAP_APPFONT))); 352 mpDial->SetPosPixel(Point(LogicToPixel(Point(ROTATE_CONTROL_X2,ROTATE_CONTROL_Y2), MAP_APPFONT))); 353 mpFtFlip->SetPosPixel(Point(LogicToPixel(Point(FT_FLIP_X2,FT_FLIP_Y2), MAP_APPFONT))); 354 355 Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT2); 356 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 357 SetSizePixel(aSize); 358 } 359 break; 360 361 case 1: 362 { 363 mpMtrWidth->SetMin( 2 ); 364 mpMtrHeight->SetMin( 2 ); 365 mpFtPosX->Hide(); 366 mpMtrPosX->Hide(); 367 mpFtPosY->Hide(); 368 mpMtrPosY->Hide(); 369 370 //rotation 371 mpFtAngle->Hide(); 372 mpMtrAngle->Hide(); 373 mpDial->Hide(); 374 375 //flip 376 mpFlipTbx->Hide(); 377 mpFtFlip->Hide(); 378 mbIsFlip = false; 379 380 mpFtWidth->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_X_X,FT_POSITION_X_Y), MAP_APPFONT))); 381 mpMtrWidth->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_X_X,MF_POSITION_X_Y), MAP_APPFONT))); 382 mpFtHeight->SetPosPixel(Point(LogicToPixel(Point(FT_POSITION_Y_X,FT_POSITION_Y_Y), MAP_APPFONT))); 383 mpMtrHeight->SetPosPixel(Point(LogicToPixel(Point(MF_POSITION_Y_X,MF_POSITION_Y_Y), MAP_APPFONT))); 384 mpCbxScale->SetPosPixel(Point(LogicToPixel(Point(FT_WIDTH_X,FT_WIDTH_Y), MAP_APPFONT))); 385 386 Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT3); 387 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 388 SetSizePixel(aSize); 389 } 390 break; 391 392 case 2: 393 { 394 mpMtrWidth->SetMin( 1 ); 395 mpMtrHeight->SetMin( 1 ); 396 mpFtPosX->Show(); 397 mpMtrPosX->Show(); 398 mpFtPosY->Show(); 399 mpMtrPosY->Show(); 400 401 //rotation 402 mpFtAngle->Show(); 403 mpMtrAngle->Show(); 404 mpDial->Show(); 405 406 //flip 407 mpFlipTbx->Show(); 408 mpFtFlip->Show(); 409 Size aTbxSize = mpFlipTbx->CalcWindowSizePixel(); 410 mpFlipTbx->SetOutputSizePixel( aTbxSize ); 411 mbIsFlip = true; 412 413 Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT); 414 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 415 SetSizePixel(aSize); 416 } 417 break; 418 419 case 3: 420 { 421 mpMtrWidth->SetMin( 1 ); 422 mpMtrHeight->SetMin( 1 ); 423 mpFtPosX->Show(); 424 mpMtrPosX->Show(); 425 mpFtPosY->Show(); 426 mpMtrPosY->Show(); 427 428 //rotation 429 mpFtAngle->Hide(); 430 mpMtrAngle->Hide(); 431 mpDial->Hide(); 432 433 //flip 434 mpFlipTbx->Hide(); 435 mpFtFlip->Hide(); 436 mbIsFlip = false; 437 438 Size aSize(GetOutputSizePixel().Width(),PS_SECTIONPAGE_HEIGHT4); 439 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 440 SetSizePixel(aSize); 441 } 442 break; 443 } 444 445 //Added for windows classic theme 446 mpFlipTbx->SetBackground(Wallpaper()); 447 mpFlipTbx->SetPaintTransparent(true); 448 } 449 450 451 452 IMPL_LINK( PosSizePropertyPanel, ChangeWidthHdl, void*, pBox ) 453 { 454 if( mpCbxScale->IsChecked() && 455 mpCbxScale->IsEnabled() ) 456 { 457 long nHeight = (long) ( ((double) mlOldHeight * (double) mpMtrWidth->GetValue()) / (double) mlOldWidth ); 458 if( nHeight <= mpMtrHeight->GetMax( FUNIT_NONE ) ) 459 { 460 mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); 461 } 462 else 463 { 464 nHeight = (long)mpMtrHeight->GetMax( FUNIT_NONE ); 465 mpMtrHeight->SetUserValue( nHeight ); 466 const long nWidth = (long) ( ((double) mlOldWidth * (double) nHeight) / (double) mlOldHeight ); 467 mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); 468 } 469 } 470 executeSize(); 471 return 0; 472 } 473 474 475 476 IMPL_LINK( PosSizePropertyPanel, ChangeHeightHdl, void *, EMPTYARG ) 477 { 478 if( mpCbxScale->IsChecked() && 479 mpCbxScale->IsEnabled() ) 480 { 481 long nWidth = (long) ( ((double)mlOldWidth * (double)mpMtrHeight->GetValue()) / (double)mlOldHeight ); 482 if( nWidth <= mpMtrWidth->GetMax( FUNIT_NONE ) ) 483 { 484 mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); 485 } 486 else 487 { 488 nWidth = (long)mpMtrWidth->GetMax( FUNIT_NONE ); 489 mpMtrWidth->SetUserValue( nWidth ); 490 const long nHeight = (long) ( ((double)mlOldHeight * (double)nWidth) / (double)mlOldWidth ); 491 mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); 492 } 493 } 494 executeSize(); 495 return 0; 496 } 497 498 499 500 IMPL_LINK( PosSizePropertyPanel, ChangePosXHdl, void *, EMPTYARG ) 501 { 502 executePosX(); 503 return 0; 504 } 505 506 507 508 IMPL_LINK( PosSizePropertyPanel, ChangePosYHdl, void *, EMPTYARG ) 509 { 510 executePosY(); 511 return 0; 512 } 513 514 515 516 IMPL_LINK( PosSizePropertyPanel, ClickAutoHdl, void *, EMPTYARG ) 517 { 518 if ( mpCbxScale->IsChecked() ) 519 { 520 mlOldWidth = Max( GetCoreValue( *mpMtrWidth, mePoolUnit ), 1L ); 521 mlOldHeight = Max( GetCoreValue( *mpMtrHeight, mePoolUnit ), 1L ); 522 } 523 524 // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog 525 SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( RID_SVXPAGE_POSITION_SIZE ) ); 526 aPageOpt.SetUserItem( USERITEM_NAME, ::com::sun::star::uno::makeAny( ::rtl::OUString( String::CreateFromInt32( mpCbxScale->IsChecked() ) ) ) ); 527 528 return 0; 529 } 530 531 532 533 IMPL_LINK( PosSizePropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) 534 { 535 String sTmp = mpMtrAngle->GetText(); 536 bool bNegative = 0; 537 sal_Unicode nChar = sTmp.GetChar( 0 ); 538 539 if( nChar == '-' ) 540 { 541 bNegative = 1; 542 nChar = sTmp.GetChar( 1 ); 543 } 544 545 if( (nChar < '0') || (nChar > '9') ) 546 return 0; 547 double dTmp = sTmp.ToDouble(); 548 if(bNegative) 549 { 550 while(dTmp<0) 551 dTmp += 360; 552 } 553 sal_Int64 nTmp = dTmp*100; 554 555 SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); 556 SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX); 557 SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY); 558 559 GetBindings()->GetDispatcher()->Execute( 560 SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L ); 561 562 return 0; 563 } 564 565 566 567 IMPL_LINK( PosSizePropertyPanel, RotationHdl, void *, EMPTYARG ) 568 { 569 sal_Int32 nTmp = mpDial->GetRotation(); 570 571 SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); 572 SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X,(sal_uInt32) mlRotX); 573 SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y,(sal_uInt32) mlRotY); 574 575 GetBindings()->GetDispatcher()->Execute( 576 SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aAngleItem, &aRotXItem, &aRotYItem, 0L ); 577 578 return 0; 579 } 580 581 582 583 IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox ) 584 { 585 switch (pBox->GetCurItemId()) 586 { 587 case FLIP_HORIZONTAL: 588 { 589 SfxVoidItem aHoriItem (SID_FLIP_HORIZONTAL); 590 GetBindings()->GetDispatcher()->Execute( 591 SID_FLIP_HORIZONTAL, SFX_CALLMODE_RECORD, &aHoriItem, 0L ); 592 } 593 break; 594 case FLIP_VERTICAL: 595 { 596 SfxVoidItem aVertItem (SID_FLIP_VERTICAL ); 597 GetBindings()->GetDispatcher()->Execute( 598 SID_FLIP_VERTICAL, SFX_CALLMODE_RECORD, &aVertItem, 0L ); 599 } 600 break; 601 } 602 return 0; 603 } 604 605 606 607 void PosSizePropertyPanel::NotifyItemUpdate( 608 sal_uInt16 nSID, 609 SfxItemState eState, 610 const SfxPoolItem* pState) 611 { 612 mpFtAngle->Enable(); 613 mpMtrAngle->Enable(); 614 mpDial->Enable(); 615 mpFtFlip->Enable(); 616 mpFlipTbx->Enable(); 617 618 const SfxUInt32Item* pWidthItem; 619 const SfxUInt32Item* pHeightItem; 620 621 SfxViewShell* pCurSh = SfxViewShell::Current(); 622 if ( pCurSh ) 623 mpView = pCurSh->GetDrawView(); 624 else 625 mpView = NULL; 626 627 if ( mpView == NULL ) 628 return; 629 630 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 631 632 if(1 == rMarkList.GetMarkCount()) 633 { 634 const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 635 const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); 636 637 if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) 638 mbAdjustEnabled = true; 639 else 640 mbAdjustEnabled = false; 641 } 642 else 643 mbAdjustEnabled = false; 644 645 switch (nSID) 646 { 647 case SID_ATTR_TRANSFORM_WIDTH: 648 if ( SFX_ITEM_AVAILABLE == eState ) 649 { 650 pWidthItem = dynamic_cast< const SfxUInt32Item* >(pState); 651 652 if (pWidthItem) 653 { 654 long mlOldWidth1 = pWidthItem->GetValue(); 655 656 mlOldWidth1 = Fraction( mlOldWidth1 ) / maUIScale; 657 SetMetricValue( *mpMtrWidth, mlOldWidth1, mePoolUnit ); 658 mlOldWidth = mlOldWidth1; 659 } 660 } 661 else 662 { 663 mpMtrWidth->SetText( String()); 664 } 665 break; 666 667 case SID_ATTR_TRANSFORM_HEIGHT: 668 if ( SFX_ITEM_AVAILABLE == eState ) 669 { 670 pHeightItem = dynamic_cast< const SfxUInt32Item* >(pState); 671 672 if(pHeightItem) 673 { 674 long mlOldHeight1 = pHeightItem->GetValue(); 675 676 mlOldHeight1 = Fraction( mlOldHeight1 ) / maUIScale; 677 SetMetricValue( *mpMtrHeight, mlOldHeight1, mePoolUnit ); 678 mlOldHeight = mlOldHeight1; 679 } 680 } 681 else 682 { 683 mpMtrHeight->SetText( String()); 684 } 685 break; 686 687 case SID_ATTR_TRANSFORM_POS_X: 688 { 689 const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); 690 691 if (SFX_ITEM_AVAILABLE == eState && pItem) 692 { 693 long nTmp = pItem->GetValue(); 694 nTmp = Fraction( nTmp ) / maUIScale; 695 SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit ); 696 } 697 else 698 { 699 mpMtrPosX->SetText( String()); 700 } 701 break; 702 } 703 704 case SID_ATTR_TRANSFORM_POS_Y: 705 { 706 const SfxInt32Item* pItem = dynamic_cast< const SfxInt32Item* >(pState); 707 708 if (SFX_ITEM_AVAILABLE == eState && pItem) 709 { 710 long nTmp = pItem->GetValue(); 711 nTmp = Fraction( nTmp ) / maUIScale; 712 SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit ); 713 } 714 else 715 { 716 mpMtrPosY->SetText( String()); 717 } 718 break; 719 } 720 721 case SID_ATTR_TRANSFORM_ROT_X: 722 if (SFX_ITEM_AVAILABLE == eState) 723 { 724 mlRotX = ((const SfxInt32Item*)pState)->GetValue(); 725 mlRotX = Fraction( mlRotX ) / maUIScale; 726 } 727 break; 728 729 case SID_ATTR_TRANSFORM_ROT_Y: 730 if (SFX_ITEM_AVAILABLE == eState) 731 { 732 mlRotY = ((const SfxInt32Item*)pState)->GetValue(); 733 mlRotY = Fraction( mlRotY ) / maUIScale; 734 } 735 break; 736 737 case SID_ATTR_TRANSFORM_PROTECT_POS: 738 { 739 const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); 740 741 if (SFX_ITEM_AVAILABLE == eState && pItem) 742 { 743 // record the state of position protect 744 mbPositionProtected = pItem->GetValue(); 745 } 746 else 747 { 748 mbPositionProtected = false; 749 } 750 break; 751 } 752 753 case SID_ATTR_TRANSFORM_PROTECT_SIZE: 754 { 755 const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); 756 757 if (SFX_ITEM_AVAILABLE == eState && pItem) 758 { 759 // record the state of size protect 760 mbSizeProtected = pItem->GetValue(); 761 } 762 else 763 { 764 mbSizeProtected = false; 765 } 766 break; 767 } 768 769 case SID_ATTR_TRANSFORM_AUTOWIDTH: 770 { 771 const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); 772 773 if (SFX_ITEM_AVAILABLE == eState && pItem) 774 { 775 mbAutoWidth = pItem->GetValue(); 776 } 777 break; 778 } 779 780 case SID_ATTR_TRANSFORM_AUTOHEIGHT: 781 { 782 const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); 783 784 if (SFX_ITEM_AVAILABLE == eState && pItem) 785 { 786 mbAutoHeight = pItem->GetValue(); 787 } 788 break; 789 } 790 791 case SID_ATTR_TRANSFORM_ANGLE: 792 if (eState >= SFX_ITEM_AVAILABLE) 793 { 794 long nTmp = ((const SfxInt32Item*)pState)->GetValue(); 795 mpMtrAngle->SetValue( nTmp ); 796 mpDial->SetRotation( nTmp ); 797 switch(nTmp) 798 { 799 case 0: 800 mpMtrAngle->SelectEntryPos(0); 801 break; 802 case 4500: 803 mpMtrAngle->SelectEntryPos(1); 804 break; 805 case 9000: 806 mpMtrAngle->SelectEntryPos(2); 807 break; 808 case 13500: 809 mpMtrAngle->SelectEntryPos(3); 810 break; 811 case 18000: 812 mpMtrAngle->SelectEntryPos(4); 813 break; 814 case 22500: 815 mpMtrAngle->SelectEntryPos(5); 816 break; 817 case 27000: 818 mpMtrAngle->SelectEntryPos(6); 819 break; 820 case 315000: 821 mpMtrAngle->SelectEntryPos(7); 822 } 823 } 824 else 825 { 826 mpMtrAngle->SetText( String() ); 827 mpDial->SetRotation( 0 ); 828 } 829 break; 830 831 case SID_ATTR_METRIC: 832 MetricState( eState, pState ); 833 break; 834 835 default: 836 break; 837 } 838 839 const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI()); 840 841 switch (rMarkList.GetMarkCount()) 842 { 843 case 0: 844 break; 845 846 case 1: 847 { 848 const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 849 const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); 850 851 if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) 852 || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject) 853 ) && OBJ_EDGE == eKind) 854 || OBJ_CAPTION == eKind) 855 { 856 mpFtAngle->Disable(); 857 mpMtrAngle->Disable(); 858 mpDial->Disable(); 859 mpFlipTbx->Disable(); 860 mpFtFlip->Disable(); 861 } 862 break; 863 } 864 865 default: 866 { 867 sal_uInt16 nMarkObj = 0; 868 bool isNoEdge = true; 869 while(rMarkList.GetMark(nMarkObj)) 870 { 871 const SdrObject* pObj = rMarkList.GetMark(nMarkObj)->GetMarkedSdrObj(); 872 const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); 873 874 if(((nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_Draw) 875 || nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject) 876 ) && OBJ_EDGE == eKind) 877 || OBJ_CAPTION == eKind) 878 { 879 isNoEdge = false; 880 break; 881 } 882 nMarkObj++; 883 } 884 if(!isNoEdge) 885 { 886 mpFtAngle->Disable(); 887 mpMtrAngle->Disable(); 888 mpDial->Disable(); 889 mpFlipTbx->Disable(); 890 mpFtFlip->Disable(); 891 } 892 break; 893 } 894 } 895 896 if(nCombinedContext == CombinedEnumContext(Application_DrawImpress, Context_TextObject)) 897 { 898 mpFlipTbx->Disable(); 899 mpFtFlip->Disable(); 900 } 901 902 DisableControls(); 903 904 // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog 905 SvtViewOptions aPageOpt( E_TABPAGE, String::CreateFromInt32( RID_SVXPAGE_POSITION_SIZE ) ); 906 String sUserData; 907 ::com::sun::star::uno::Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); 908 ::rtl::OUString aTemp; 909 if ( aUserItem >>= aTemp ) 910 sUserData = String( aTemp ); 911 mpCbxScale->Check( (bool)sUserData.ToInt32() ); 912 } 913 914 915 916 SfxBindings* PosSizePropertyPanel::GetBindings() 917 { 918 return mpBindings; 919 } 920 921 922 923 void PosSizePropertyPanel::executeSize() 924 { 925 if ( mpMtrWidth->IsValueModified() || mpMtrHeight->IsValueModified()) 926 { 927 Fraction aUIScale = mpView->GetModel()->GetUIScale(); 928 929 // get Width 930 double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit ); 931 nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); 932 long lWidth = (long)(nWidth * (double)aUIScale); 933 lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); 934 lWidth = (long)mpMtrWidth->Denormalize( lWidth ); 935 936 // get Height 937 double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit ); 938 nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); 939 long lHeight = (long)(nHeight * (double)aUIScale); 940 lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); 941 lHeight = (long)mpMtrWidth->Denormalize( lHeight ); 942 943 // put Width & Height to itemset 944 SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth); 945 SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight); 946 SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)meRP); 947 const sal_Int32 nCombinedContext(maContext.GetCombinedContext()); 948 949 if( nCombinedContext == CombinedEnumContext(Application_Writer, Context_Graphic) // mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC 950 || nCombinedContext == CombinedEnumContext(Application_Writer, Context_OLE) //mnContextId == PROPERTY_CONTEXT_SW_OLE 951 ) 952 // if( mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC || mnContextId == PROPERTY_CONTEXT_SW_OLE ) 953 { 954 GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L ); 955 } 956 else 957 { 958 if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified())) 959 GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L ); 960 else if( mpMtrWidth->IsValueModified()) 961 GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aPointItem, 0L ); 962 else if ( mpMtrHeight->IsValueModified()) 963 GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aHeightItem, &aPointItem, 0L ); 964 } 965 } 966 } 967 968 969 970 void PosSizePropertyPanel::executePosX() 971 { 972 if ( mpMtrPosX->IsValueModified()) 973 { 974 long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); 975 if( mbMtrPosXMirror ) 976 lX = -lX; 977 long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); 978 979 Size aPageSize; 980 Rectangle aRect; 981 maRect = mpView->GetAllMarkedRect(); 982 aRect = mpView->GetAllMarkedRect(); 983 984 Fraction aUIScale = mpView->GetModel()->GetUIScale(); 985 lX += maAnchorPos.X(); 986 lX = Fraction( lX ) * aUIScale; 987 lY += maAnchorPos.Y(); 988 lY = Fraction( lY ) * aUIScale; 989 990 SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); 991 SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); 992 993 GetBindings()->GetDispatcher()->Execute( 994 SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosXItem, 0L ); 995 } 996 } 997 998 999 1000 void PosSizePropertyPanel::executePosY() 1001 { 1002 if ( mpMtrPosY->IsValueModified() ) 1003 { 1004 long lX = GetCoreValue( *mpMtrPosX, mePoolUnit ); 1005 long lY = GetCoreValue( *mpMtrPosY, mePoolUnit ); 1006 1007 Size aPageSize; 1008 Rectangle aRect; 1009 maRect = mpView->GetAllMarkedRect(); 1010 aRect = mpView->GetAllMarkedRect(); 1011 1012 Fraction aUIScale = mpView->GetModel()->GetUIScale(); 1013 lX += maAnchorPos.X(); 1014 lX = Fraction( lX ) * aUIScale; 1015 lY += maAnchorPos.Y(); 1016 lY = Fraction( lY ) * aUIScale; 1017 1018 SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); 1019 SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); 1020 1021 GetBindings()->GetDispatcher()->Execute( 1022 SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aPosYItem, 0L ); 1023 } 1024 } 1025 1026 1027 1028 void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState ) 1029 { 1030 bool bPosXBlank = false; 1031 bool bPosYBlank = false; 1032 bool bWidthBlank = false; 1033 bool bHeightBlank = false; 1034 String sNull = String::CreateFromAscii(""); 1035 meDlgUnit = GetCurrentUnit(eState,pState); 1036 1037 if( mpMtrPosX->GetText() == sNull ) 1038 bPosXBlank = true; 1039 SetFieldUnit( *mpMtrPosX, meDlgUnit, true ); 1040 if(bPosXBlank) 1041 mpMtrPosX->SetText(String()); 1042 1043 if( mpMtrPosY->GetText() == sNull ) 1044 bPosYBlank = true; 1045 SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); 1046 if(bPosYBlank) 1047 mpMtrPosY->SetText(String()); 1048 1049 if( mpMtrWidth->GetText() == sNull ) 1050 bWidthBlank = true; 1051 SetFieldUnit( *mpMtrWidth, meDlgUnit, true ); 1052 if(bWidthBlank) 1053 mpMtrWidth->SetText(String()); 1054 1055 if( mpMtrHeight->GetText() == sNull ) 1056 bHeightBlank = true; 1057 SetFieldUnit( *mpMtrHeight, meDlgUnit, true ); 1058 if(bHeightBlank) 1059 mpMtrHeight->SetText(String()); 1060 } 1061 1062 1063 1064 FieldUnit PosSizePropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) 1065 { 1066 FieldUnit eUnit = FUNIT_NONE; 1067 1068 if ( pState && eState >= SFX_ITEM_DEFAULT ) 1069 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); 1070 else 1071 { 1072 SfxViewFrame* pFrame = SfxViewFrame::Current(); 1073 SfxObjectShell* pSh = NULL; 1074 if ( pFrame ) 1075 pSh = pFrame->GetObjectShell(); 1076 if ( pSh ) 1077 { 1078 SfxModule* pModule = pSh->GetModule(); 1079 if ( pModule ) 1080 { 1081 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); 1082 if ( pItem ) 1083 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); 1084 } 1085 else 1086 { 1087 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); 1088 } 1089 } 1090 } 1091 1092 return eUnit; 1093 } 1094 1095 1096 1097 void PosSizePropertyPanel::DisableControls() 1098 { 1099 if( mbPositionProtected ) 1100 { 1101 // the position is protected("Position protect" option in modal dialog is checked), 1102 // disable all the Position controls in sidebar 1103 mpFtPosX->Disable(); 1104 mpMtrPosX->Disable(); 1105 mpFtPosY->Disable(); 1106 mpMtrPosY->Disable(); 1107 mpFtAngle->Disable(); 1108 mpMtrAngle->Disable(); 1109 mpDial->Disable(); 1110 mpFtFlip->Disable(); 1111 mpFlipTbx->Disable(); 1112 1113 mpFtWidth->Disable(); 1114 mpMtrWidth->Disable(); 1115 mpFtHeight->Disable(); 1116 mpMtrHeight->Disable(); 1117 mpCbxScale->Disable(); 1118 } 1119 else 1120 { 1121 mpFtPosX->Enable(); 1122 mpMtrPosX->Enable(); 1123 mpFtPosY->Enable(); 1124 mpMtrPosY->Enable(); 1125 1126 //mpFtAngle->Enable(); 1127 //mpMtrAngle->Enable(); 1128 //mpDial->Enable(); 1129 //mpFtFlip->Enable(); 1130 //mpFlipTbx->Enable(); 1131 1132 if( mbSizeProtected ) 1133 { 1134 mpFtWidth->Disable(); 1135 mpMtrWidth->Disable(); 1136 mpFtHeight->Disable(); 1137 mpMtrHeight->Disable(); 1138 mpCbxScale->Disable(); 1139 } 1140 else 1141 { 1142 if( mbAdjustEnabled ) 1143 { 1144 if( mbAutoWidth ) 1145 { 1146 mpFtWidth->Disable(); 1147 mpMtrWidth->Disable(); 1148 mpCbxScale->Disable(); 1149 } 1150 else 1151 { 1152 mpFtWidth->Enable(); 1153 mpMtrWidth->Enable(); 1154 } 1155 if( mbAutoHeight ) 1156 { 1157 mpFtHeight->Disable(); 1158 mpMtrHeight->Disable(); 1159 mpCbxScale->Disable(); 1160 } 1161 else 1162 { 1163 mpFtHeight->Enable(); 1164 mpMtrHeight->Enable(); 1165 } 1166 if( !mbAutoWidth && !mbAutoHeight ) 1167 mpCbxScale->Enable(); 1168 } 1169 else 1170 { 1171 mpFtWidth->Enable(); 1172 mpMtrWidth->Enable(); 1173 mpFtHeight->Enable(); 1174 mpMtrHeight->Enable(); 1175 mpCbxScale->Enable(); 1176 } 1177 } 1178 } 1179 } 1180 1181 1182 } } // end of namespace svx::sidebar 1183