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 "precompiled_sc.hxx" 23 24 #include <sfx2/sidebar/propertypanel.hrc> 25 #include <sfx2/sidebar/Theme.hxx> 26 #include <sfx2/sidebar/ControlFactory.hxx> 27 #include <AlignmentPropertyPanel.hxx> 28 #include <AlignmentPropertyPanel.hrc> 29 #include <svx/dialmgr.hxx> 30 #include "sc.hrc" 31 #include "scresid.hxx" 32 #include <sfx2/bindings.hxx> 33 #include <sfx2/dispatch.hxx> 34 #include <svx/algitem.hxx> 35 #include <svx/dlgutil.hxx> 36 #include <vcl/toolbox.hxx> 37 #include <svx/sidebar/SidebarDialControl.hxx> 38 39 using namespace css; 40 using namespace cssu; 41 using ::sfx2::sidebar::ControlFactory; 42 43 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 44 45 ////////////////////////////////////////////////////////////////////////////// 46 // namespace open 47 48 namespace sc { namespace sidebar { 49 50 ////////////////////////////////////////////////////////////////////////////// 51 52 AlignmentPropertyPanel::AlignmentPropertyPanel( 53 Window* pParent, 54 const cssu::Reference<css::frame::XFrame>& rxFrame, 55 SfxBindings* pBindings) 56 : Control( 57 pParent, 58 ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)), 59 mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)), 60 mpTBHorizontal(ControlFactory::CreateToolBox( 61 mpTBHorizontalBackground.get(), 62 ScResId(TBX_HORIZONTAL_ALIGNMENT))), 63 mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)), 64 mpTBVertical(ControlFactory::CreateToolBox( 65 mpTBVerticalBackground.get(), 66 ScResId(TBX_VERTICAL_ALIGN))), 67 mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))), 68 mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))), 69 mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))), 70 mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))), 71 mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))), 72 mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)), 73 mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))), 74 mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))), 75 maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this), 76 maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this), 77 maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this), 78 maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this), 79 maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this), 80 maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this), 81 maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this), 82 maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)), 83 maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)), 84 maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)), 85 maIMGAlignJust(ScResId(IMG_ALIGN_JUST)), 86 maIMGAlignTop(ScResId(IMG_ALIGN_TOP)), 87 maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)), 88 maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)), 89 meHorAlignState(SVX_HOR_JUSTIFY_STANDARD), 90 meVerAlignState(SVX_VER_JUSTIFY_STANDARD), 91 mbMultiDisable(false), 92 mxFrame(rxFrame), 93 maContext(), 94 mpBindings(pBindings) 95 { 96 Initialize(); 97 FreeResource(); 98 99 mpFTLeftIndent->SetBackground(Wallpaper()); 100 mpFtRotate->SetBackground(Wallpaper()); 101 } 102 103 ////////////////////////////////////////////////////////////////////////////// 104 105 AlignmentPropertyPanel::~AlignmentPropertyPanel() 106 { 107 } 108 109 ////////////////////////////////////////////////////////////////////////////// 110 111 void AlignmentPropertyPanel::Initialize() 112 { 113 mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft); 114 mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter); 115 mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight); 116 mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust); 117 Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() ); 118 mpTBHorizontal->SetOutputSizePixel( aTbxSize ); 119 mpTBHorizontal->SetBackground(Wallpaper()); 120 mpTBHorizontal->SetPaintTransparent(true); 121 Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl); 122 mpTBHorizontal->SetSelectHdl ( aLink ); 123 124 mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop); 125 mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV); 126 mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom); 127 Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() ); 128 mpTBVertical->SetOutputSizePixel( aTbxSize2 ); 129 mpTBVertical->SetBackground(Wallpaper()); 130 mpTBVertical->SetPaintTransparent(true); 131 aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl); 132 mpTBVertical->SetSelectHdl ( aLink ); 133 134 mpFTLeftIndent->Disable(); 135 mpMFLeftIndent->Disable(); 136 mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent"))); //wj acc 137 aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl); 138 mpMFLeftIndent->SetModifyHdl ( aLink ); 139 140 aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl); 141 mpCBXMergeCell->SetClickHdl ( aLink ); 142 143 aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl); 144 mpCBXWrapText->SetClickHdl ( aLink ); 145 146 //rotation control 147 mpCtrlDial->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc 148 mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl)); 149 150 //rotation 151 mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc 152 mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl)); 153 mpMtrAngle->EnableAutocomplete( false ); 154 155 //Vertical stacked 156 mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) ); 157 158 mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); 159 mpMtrAngle->InsertValue(45, FUNIT_CUSTOM); 160 mpMtrAngle->InsertValue(90, FUNIT_CUSTOM); 161 mpMtrAngle->InsertValue(135, FUNIT_CUSTOM); 162 mpMtrAngle->InsertValue(180, FUNIT_CUSTOM); 163 mpMtrAngle->InsertValue(225, FUNIT_CUSTOM); 164 mpMtrAngle->InsertValue(270, FUNIT_CUSTOM); 165 mpMtrAngle->InsertValue(315, FUNIT_CUSTOM); 166 mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); 167 168 mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get()); 169 mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get()); 170 mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get()); 171 mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get()); 172 #ifdef HAS_IA2 173 mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get()); 174 #endif 175 } 176 177 ////////////////////////////////////////////////////////////////////////////// 178 179 IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) 180 { 181 String sTmp = mpMtrAngle->GetText(); 182 183 sal_Unicode nChar = sTmp.GetChar( 0 ); 184 if((sTmp.Len()== 1 && nChar == '-') || 185 (nChar != '-' && ((nChar < '0') || (nChar > '9') ) )) ////modify 186 return 0; 187 188 double dTmp = sTmp.ToDouble(); 189 FormatDegrees(dTmp); 190 191 sal_Int64 nTmp = (sal_Int64)dTmp*100; 192 SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); 193 194 GetBindings()->GetDispatcher()->Execute( 195 SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); 196 return 0; 197 } 198 199 ////////////////////////////////////////////////////////////////////////////// 200 201 IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG ) 202 { 203 sal_Int32 nTmp = mpCtrlDial->GetRotation(); 204 SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); 205 206 GetBindings()->GetDispatcher()->Execute( 207 SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); 208 209 return 0; 210 } 211 212 ////////////////////////////////////////////////////////////////////////////// 213 214 IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG ) 215 { 216 bool bVertical = mpCbStacked->IsChecked() ? true : false; 217 SfxBoolItem aStackItem( SID_ATTR_ALIGN_STACKED, bVertical ); 218 GetBindings()->GetDispatcher()->Execute( 219 SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L ); 220 return 0; 221 } 222 223 ////////////////////////////////////////////////////////////////////////////// 224 225 IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox) 226 { 227 sal_uInt16 nId = pToolBox->GetCurItemId(); 228 229 if(nId == ID_SUBSTLEFT) 230 { 231 if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT) 232 meHorAlignState = SVX_HOR_JUSTIFY_LEFT; 233 else 234 meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; 235 } 236 else if( nId == ID_SUBSTCENTER ) 237 { 238 if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER) 239 meHorAlignState = SVX_HOR_JUSTIFY_CENTER; 240 else 241 meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; 242 } 243 else if( nId == ID_SUBSTRIGHT ) 244 { 245 if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT) 246 meHorAlignState = SVX_HOR_JUSTIFY_RIGHT; 247 else 248 meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; 249 } 250 else if( nId == ID_SUBSTJUSTIFY ) 251 { 252 if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK) 253 meHorAlignState = SVX_HOR_JUSTIFY_BLOCK; 254 else 255 meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; 256 } 257 SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL); 258 GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L); 259 UpdateHorAlign(); 260 return 0; 261 } 262 263 ////////////////////////////////////////////////////////////////////////////// 264 265 IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox) 266 { 267 sal_uInt16 nId = pToolBox->GetCurItemId(); 268 269 //Bold 270 if(nId == IID_VERT_TOP) 271 { 272 if(meVerAlignState != SVX_VER_JUSTIFY_TOP) 273 meVerAlignState = SVX_VER_JUSTIFY_TOP; 274 else 275 meVerAlignState = SVX_VER_JUSTIFY_STANDARD; 276 } 277 else if( nId == IID_VERT_CENTER ) 278 { 279 if(meVerAlignState != SVX_VER_JUSTIFY_CENTER) 280 meVerAlignState = SVX_VER_JUSTIFY_CENTER; 281 else 282 meVerAlignState = SVX_VER_JUSTIFY_STANDARD; 283 } 284 else if( nId == IID_VERT_BOTTOM ) 285 { 286 if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM) 287 meVerAlignState = SVX_VER_JUSTIFY_BOTTOM; 288 else 289 meVerAlignState = SVX_VER_JUSTIFY_STANDARD; 290 } 291 SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL); 292 GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L); 293 UpdateVerAlign(); 294 return 0; 295 } 296 297 ////////////////////////////////////////////////////////////////////////////// 298 299 IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG) 300 { 301 mpCBXWrapText->EnableTriState(false); 302 sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue(); 303 SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, (sal_uInt16)CalcToUnit( nVal, SFX_MAPUNIT_TWIP ) ); 304 305 GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L); 306 return( 0L ); 307 } 308 309 ////////////////////////////////////////////////////////////////////////////// 310 311 IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG) 312 { 313 bool bState = mpCBXMergeCell->IsChecked(); 314 315 //Modified 316 //SfxBoolItem aItem( FID_MERGE_TOGGLE , bState); 317 //GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L); 318 if(bState) 319 GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD); 320 else 321 GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD); 322 GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false); 323 //modified end 324 325 return 0; 326 } 327 328 ////////////////////////////////////////////////////////////////////////////// 329 330 IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG) 331 { 332 bool bState = mpCBXWrapText->IsChecked(); 333 SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState); 334 GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L); 335 return 0; 336 } 337 338 ////////////////////////////////////////////////////////////////////////////// 339 340 AlignmentPropertyPanel* AlignmentPropertyPanel::Create ( 341 Window* pParent, 342 const cssu::Reference<css::frame::XFrame>& rxFrame, 343 SfxBindings* pBindings) 344 { 345 if (pParent == NULL) 346 throw lang::IllegalArgumentException(A2S("no parent Window given to AlignmentPropertyPanel::Create"), NULL, 0); 347 if ( ! rxFrame.is()) 348 throw lang::IllegalArgumentException(A2S("no XFrame given to AlignmentPropertyPanel::Create"), NULL, 1); 349 if (pBindings == NULL) 350 throw lang::IllegalArgumentException(A2S("no SfxBindings given to AlignmentPropertyPanel::Create"), NULL, 2); 351 352 return new AlignmentPropertyPanel( 353 pParent, 354 rxFrame, 355 pBindings); 356 } 357 358 ////////////////////////////////////////////////////////////////////////////// 359 360 void AlignmentPropertyPanel::DataChanged( 361 const DataChangedEvent& rEvent) 362 { 363 (void)rEvent; 364 } 365 366 ////////////////////////////////////////////////////////////////////////////// 367 368 void AlignmentPropertyPanel::HandleContextChange( 369 const ::sfx2::sidebar::EnumContext aContext) 370 { 371 if(maContext == aContext) 372 { 373 // Nothing to do. 374 return; 375 } 376 377 maContext = aContext; 378 379 380 381 // todo 382 } 383 384 ////////////////////////////////////////////////////////////////////////////// 385 386 void AlignmentPropertyPanel::NotifyItemUpdate( 387 sal_uInt16 nSID, 388 SfxItemState eState, 389 const SfxPoolItem* pState, 390 const bool bIsEnabled) 391 { 392 (void)bIsEnabled; 393 394 switch(nSID) 395 { 396 case SID_H_ALIGNCELL: 397 if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) ) 398 { 399 const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState; 400 meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); 401 } 402 else 403 { 404 meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; 405 } 406 UpdateHorAlign(); 407 break; 408 case SID_V_ALIGNCELL: 409 if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) ) 410 { 411 const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState; 412 meVerAlignState = (SvxCellVerJustify)pItem->GetValue(); 413 } 414 else 415 { 416 meVerAlignState = SVX_VER_JUSTIFY_STANDARD; 417 } 418 UpdateVerAlign(); 419 break; 420 case SID_ATTR_ALIGN_INDENT: 421 if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) ) 422 { 423 const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState; 424 sal_uInt16 nVal = pItem->GetValue(); 425 mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) ); 426 } 427 else 428 { 429 mpMFLeftIndent->SetValue(0); 430 mpMFLeftIndent->SetText(String()); 431 } 432 break; 433 case FID_MERGE_TOGGLE: 434 if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) 435 { 436 mpCBXMergeCell->Enable(); 437 const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 438 bool bVal = pItem->GetValue(); 439 if(bVal) 440 mpCBXMergeCell->Check(true); 441 else 442 mpCBXMergeCell->Check(false); 443 } 444 else 445 { 446 mpCBXMergeCell->Check(false); 447 mpCBXMergeCell->Disable(); 448 } 449 break; 450 451 case SID_ATTR_ALIGN_LINEBREAK: 452 if(eState == SFX_ITEM_DISABLED) 453 { 454 mpCBXWrapText->EnableTriState(false); 455 mpCBXWrapText->Check(false); 456 mpCBXWrapText->Disable(); 457 } 458 else 459 { 460 mpCBXWrapText->Enable(); 461 if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) 462 { 463 mpCBXWrapText->EnableTriState(false); 464 const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 465 bool bVal = pItem->GetValue(); 466 if(bVal) 467 mpCBXWrapText->Check(true); 468 else 469 mpCBXWrapText->Check(false); 470 } 471 else if(eState == SFX_ITEM_DONTCARE) 472 { 473 mpCBXWrapText->EnableTriState(true); 474 mpCBXWrapText->SetState(STATE_DONTKNOW); 475 } 476 } 477 break; 478 case SID_ATTR_ALIGN_DEGREES: 479 if (eState >= SFX_ITEM_AVAILABLE) 480 { 481 long nTmp = ((const SfxInt32Item*)pState)->GetValue(); 482 mpMtrAngle->SetValue( nTmp / 100); //wj 483 mpCtrlDial->SetRotation( nTmp ); 484 switch(nTmp) 485 { 486 case 0: 487 mpMtrAngle->SelectEntryPos(0); 488 break; 489 case 4500: 490 mpMtrAngle->SelectEntryPos(1); 491 break; 492 case 9000: 493 mpMtrAngle->SelectEntryPos(2); 494 break; 495 case 13500: 496 mpMtrAngle->SelectEntryPos(3); 497 break; 498 case 18000: 499 mpMtrAngle->SelectEntryPos(4); 500 break; 501 case 22500: 502 mpMtrAngle->SelectEntryPos(5); 503 break; 504 case 27000: 505 mpMtrAngle->SelectEntryPos(6); 506 break; 507 case 31500: 508 mpMtrAngle->SelectEntryPos(7); 509 } 510 } 511 else 512 { 513 mpMtrAngle->SetText( String() ); 514 mpCtrlDial->SetRotation( 0 ); 515 } 516 break; 517 case SID_ATTR_ALIGN_STACKED: 518 if (eState >= SFX_ITEM_AVAILABLE) 519 { 520 mpCbStacked->EnableTriState(false); 521 const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState; 522 bool IsChecked = (bool)aStackItem->GetValue(); 523 if(IsChecked) 524 { 525 mpCbStacked->Check(IsChecked); 526 mpFtRotate->Disable(); 527 mpMtrAngle->Disable(); 528 mpCtrlDial->Disable(); 529 mbMultiDisable = true; 530 } 531 else 532 { 533 mpCbStacked->Check(IsChecked); 534 mpFtRotate->Enable(); 535 mpMtrAngle->Enable(); 536 mpCtrlDial->Enable(); 537 mbMultiDisable = false; 538 } 539 } 540 else 541 { 542 mbMultiDisable = true; 543 mpFtRotate->Disable(); 544 mpMtrAngle->Disable(); 545 mpCtrlDial->Disable(); 546 mpCbStacked->EnableTriState(true); 547 mpCbStacked->SetState(STATE_DONTKNOW); 548 } 549 } 550 } 551 552 ////////////////////////////////////////////////////////////////////////////// 553 554 SfxBindings* AlignmentPropertyPanel::GetBindings() 555 { 556 return mpBindings; 557 } 558 559 ////////////////////////////////////////////////////////////////////////////// 560 561 void AlignmentPropertyPanel::FormatDegrees(double& dTmp) 562 { 563 while(dTmp<0) 564 dTmp += 360; 565 while (dTmp > 359) //modify 566 dTmp = 359; 567 } 568 569 ////////////////////////////////////////////////////////////////////////////// 570 571 void AlignmentPropertyPanel::UpdateHorAlign() 572 { 573 mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK); 574 mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK); 575 mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK); 576 mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK); 577 mpFTLeftIndent->Disable(); 578 mpMFLeftIndent->Disable(); 579 if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT) 580 { 581 mpFtRotate->Disable(); 582 mpCtrlDial->Disable(); 583 mpMtrAngle->Disable(); 584 mpCbStacked->Disable(); 585 } 586 else 587 { 588 if(!mbMultiDisable) 589 { 590 mpFtRotate->Enable(); 591 mpCtrlDial->Enable(); 592 mpMtrAngle->Enable(); 593 } 594 else 595 { 596 mpFtRotate->Disable(); 597 mpCtrlDial->Disable(); 598 mpMtrAngle->Disable(); 599 } 600 mpCbStacked->Enable(); 601 } 602 switch(meHorAlignState) 603 { 604 case SVX_HOR_JUSTIFY_LEFT: 605 mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK); 606 mpFTLeftIndent->Enable(); 607 mpMFLeftIndent->Enable(); 608 break; 609 case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break; 610 case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break; 611 case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break; 612 default:; 613 } 614 } 615 616 ////////////////////////////////////////////////////////////////////////////// 617 618 void AlignmentPropertyPanel::UpdateVerAlign() 619 { 620 mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK); 621 mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK); 622 mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK); 623 624 switch(meVerAlignState) 625 { 626 case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break; 627 case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break; 628 case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break; 629 default:; 630 } 631 } 632 633 ////////////////////////////////////////////////////////////////////////////// 634 // namespace close 635 636 }} // end of namespace ::sc::sidebar 637 638 ////////////////////////////////////////////////////////////////////////////// 639 // eof 640