1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 #include <com/sun/star/presentation/EffectNodeType.hpp> 31 #include <com/sun/star/animations/Timing.hpp> 32 #include <com/sun/star/animations/Event.hpp> 33 #include <com/sun/star/animations/EventTrigger.hpp> 34 #include <com/sun/star/animations/AnimationFill.hpp> 35 #include <com/sun/star/presentation/TextAnimationType.hpp> 36 #include <com/sun/star/animations/ValuePair.hpp> 37 #include <com/sun/star/awt/FontSlant.hpp> 38 #include <com/sun/star/awt/FontWeight.hpp> 39 #include <com/sun/star/awt/FontUnderline.hpp> 40 #include <com/sun/star/drawing/XDrawPage.hpp> 41 #include <com/sun/star/beans/XPropertySet.hpp> 42 #include <com/sun/star/media/XManager.hpp> 43 #include <com/sun/star/media/XPlayer.hpp> 44 45 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED 46 #include <boost/shared_ptr.hpp> 47 #endif 48 49 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX 50 #include <comphelper/processfactory.hxx> 51 #endif 52 #include <unotools/pathoptions.hxx> 53 #include <vcl/tabctrl.hxx> 54 #include <vcl/tabpage.hxx> 55 #include <vcl/menubtn.hxx> 56 #include <vcl/svapp.hxx> 57 #include <vcl/fixed.hxx> 58 #include <vcl/lstbox.hxx> 59 #include <vcl/field.hxx> 60 #include <vcl/msgbox.hxx> 61 #include <vcl/decoview.hxx> 62 #include <vcl/combobox.hxx> 63 #include <vcl/menu.hxx> 64 #include <svtools/ctrlbox.hxx> 65 #include <svtools/ctrltool.hxx> 66 #include <sfx2/objsh.hxx> 67 68 #ifndef _SVX_SVXIDS_HRC 69 #include <svx/svxids.hrc> 70 #endif 71 #include <svx/dialmgr.hxx> 72 #include <editeng/flstitem.hxx> 73 #include <svx/drawitem.hxx> 74 75 #include <svx/xtable.hxx> 76 #include <svx/gallery.hxx> 77 78 #ifndef _SVX_DIALOGS_HRC 79 #include <svx/dialogs.hrc> 80 #endif 81 #include "sdresid.hxx" 82 83 #include "glob.hrc" 84 #include "CustomAnimationDialog.hxx" 85 #ifndef _SD_CUSTOMANIMATIONDIALOG_HRC 86 #include "CustomAnimationDialog.hrc" 87 #endif 88 #ifndef _SD_CUSTOMANIMATION_HRC 89 #include "CustomAnimation.hrc" 90 #endif 91 #include "STLPropertySet.hxx" 92 93 #include <avmedia/mediawindow.hxx> 94 95 #include "filedlg.hxx" 96 #include "strings.hrc" 97 #include "helpids.h" 98 99 using namespace ::com::sun::star; 100 using namespace ::com::sun::star::animations; 101 using namespace ::com::sun::star::presentation; 102 103 using ::rtl::OUString; 104 using ::com::sun::star::uno::UNO_QUERY; 105 using ::com::sun::star::uno::UNO_QUERY_THROW; 106 using ::com::sun::star::uno::Any; 107 using ::com::sun::star::uno::makeAny; 108 using ::com::sun::star::uno::Sequence; 109 using ::com::sun::star::uno::Reference; 110 using ::com::sun::star::uno::Exception; 111 using ::com::sun::star::drawing::XShape; 112 using ::com::sun::star::drawing::XDrawPage; 113 using ::com::sun::star::beans::XPropertySet; 114 115 namespace sd { 116 117 extern void fillRepeatComboBox( ComboBox* pBox ); 118 extern void fillDurationComboBox( ComboBox* pBox ); 119 extern OUString getShapeDescription( const Reference< XShape >& xShape, bool bWithText = true ); 120 extern OUString getPropertyName( sal_Int32 nPropertyType ); 121 122 // ==================================================================== 123 124 class PresetPropertyBox : public PropertySubControl 125 { 126 public: 127 PresetPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl ); 128 ~PresetPropertyBox(); 129 130 virtual Any getValue(); 131 virtual void setValue( const Any& rValue, const OUString& rPresetId ); 132 virtual Control* getControl(); 133 134 private: 135 std::map< sal_uInt16, rtl::OUString > maPropertyValues; 136 ListBox* mpControl; 137 }; 138 139 // -------------------------------------------------------------------- 140 141 PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const OUString& aPresetId, const Link& rModifyHdl ) 142 : PropertySubControl( nControlType ) 143 { 144 mpControl = new ListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); 145 mpControl->SetDropDownLineCount( 10 ); 146 mpControl->SetSelectHdl( rModifyHdl ); 147 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX ); 148 149 setValue( rValue, aPresetId ); 150 151 } 152 153 void PresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId ) 154 { 155 if( mpControl ) 156 { 157 mpControl->Clear(); 158 159 const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets(); 160 CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId ); 161 if( pDescriptor.get() ) 162 { 163 164 OUString aPropertyValue; 165 rValue >>= aPropertyValue; 166 167 UStringList aSubTypes( pDescriptor->getSubTypes() ); 168 UStringList::iterator aIter( aSubTypes.begin() ); 169 const UStringList::iterator aEnd( aSubTypes.end() ); 170 171 mpControl->Enable( aIter != aEnd ); 172 173 while( aIter != aEnd ) 174 { 175 sal_uInt16 nPos = mpControl->InsertEntry( rPresets.getUINameForProperty( (*aIter) ) ); 176 if( (*aIter) == aPropertyValue ) 177 mpControl->SelectEntryPos( nPos ); 178 maPropertyValues[nPos] = (*aIter++); 179 } 180 } 181 else 182 { 183 mpControl->Enable( sal_False ); 184 } 185 } 186 } 187 188 // -------------------------------------------------------------------- 189 190 PresetPropertyBox::~PresetPropertyBox() 191 { 192 delete mpControl; 193 } 194 195 // -------------------------------------------------------------------- 196 197 Any PresetPropertyBox::getValue() 198 { 199 return makeAny( maPropertyValues[mpControl->GetSelectEntryPos()] ); 200 } 201 202 // -------------------------------------------------------------------- 203 204 Control* PresetPropertyBox::getControl() 205 { 206 return mpControl; 207 } 208 209 // ==================================================================== 210 211 class ColorPropertyBox : public PropertySubControl 212 { 213 public: 214 ColorPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 215 ~ColorPropertyBox(); 216 217 virtual Any getValue(); 218 virtual void setValue( const Any& rValue, const OUString& rPresetId ); 219 virtual Control* getControl(); 220 221 private: 222 ColorListBox* mpControl; 223 }; 224 225 // -------------------------------------------------------------------- 226 227 ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 228 : PropertySubControl( nControlType ) 229 { 230 mpControl = new ColorListBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); 231 mpControl->SetDropDownLineCount( 10 ); 232 mpControl->SetSelectHdl( rModifyHdl ); 233 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX ); 234 235 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 236 DBG_ASSERT( pDocSh, "DocShell not found!" ); 237 XColorTable* pColorTable = NULL; 238 bool bKillTable = false; 239 const SfxPoolItem* pItem = NULL; 240 241 if ( pDocSh && ( ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != 0) ) 242 pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 243 244 if ( !pColorTable ) 245 { 246 pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 247 bKillTable = sal_True; 248 } 249 250 sal_Int32 nColor = 0; 251 rValue >>= nColor; 252 253 for ( long i = 0; i < pColorTable->Count(); i++ ) 254 { 255 XColorEntry* pEntry = pColorTable->GetColor(i); 256 sal_uInt16 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 257 if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor ) 258 mpControl->SelectEntryPos( nPos ); 259 } 260 261 if ( bKillTable ) 262 delete pColorTable; 263 } 264 265 // -------------------------------------------------------------------- 266 267 ColorPropertyBox::~ColorPropertyBox() 268 { 269 delete mpControl; 270 } 271 272 // -------------------------------------------------------------------- 273 274 void ColorPropertyBox::setValue( const Any& rValue, const OUString& ) 275 { 276 if( mpControl ) 277 { 278 sal_Int32 nColor = 0; 279 rValue >>= nColor; 280 281 mpControl->SetNoSelection(); 282 mpControl->SelectEntryPos( mpControl->GetEntryPos( (Color)nColor ) ); 283 } 284 } 285 286 // -------------------------------------------------------------------- 287 288 Any ColorPropertyBox::getValue() 289 { 290 return makeAny( (sal_Int32)mpControl->GetSelectEntryColor().GetRGBColor() ); 291 } 292 293 // -------------------------------------------------------------------- 294 295 Control* ColorPropertyBox::getControl() 296 { 297 return mpControl; 298 } 299 300 // ==================================================================== 301 302 class FontPropertyBox : public PropertySubControl 303 { 304 public: 305 FontPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 306 virtual ~FontPropertyBox(); 307 308 virtual Any getValue(); 309 virtual void setValue( const Any& rValue, const OUString& rPresetId ); 310 311 virtual Control* getControl(); 312 313 private: 314 FontNameBox* mpControl; 315 }; 316 317 // -------------------------------------------------------------------- 318 319 FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 320 : PropertySubControl( nControlType ) 321 { 322 mpControl = new FontNameBox( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN ); 323 mpControl->SetDropDownLineCount( 10 ); 324 mpControl->SetSelectHdl( rModifyHdl ); 325 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX ); 326 327 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 328 const SfxPoolItem* pItem; 329 330 const FontList* pFontList = 0; 331 bool bMustDelete = false; 332 333 if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != 0) ) 334 pFontList = ( (SvxFontListItem*)pItem )->GetFontList(); 335 336 if(!pFontList) 337 { 338 pFontList = new FontList( Application::GetDefaultDevice(), NULL, sal_False ); 339 bMustDelete = true; 340 } 341 342 mpControl->Fill( pFontList ); 343 344 if( bMustDelete ) 345 delete pFontList; 346 347 OUString aPresetId; 348 setValue( rValue, aPresetId ); 349 } 350 351 // -------------------------------------------------------------------- 352 353 void FontPropertyBox::setValue( const Any& rValue, const OUString& ) 354 { 355 if( mpControl ) 356 { 357 OUString aFontName; 358 rValue >>= aFontName; 359 mpControl->SetText( aFontName ); 360 } 361 } 362 363 // -------------------------------------------------------------------- 364 365 FontPropertyBox::~FontPropertyBox() 366 { 367 delete mpControl; 368 } 369 370 // -------------------------------------------------------------------- 371 372 Any FontPropertyBox::getValue() 373 { 374 OUString aFontName( mpControl->GetText() ); 375 return makeAny( aFontName ); 376 } 377 378 // -------------------------------------------------------------------- 379 380 Control* FontPropertyBox::getControl() 381 { 382 return mpControl; 383 } 384 385 // ==================================================================== 386 387 class DropdownMenuBox : public Edit 388 { 389 public: 390 DropdownMenuBox( Window* pParent, Edit* pSubControl, PopupMenu* pMenu ); 391 ~DropdownMenuBox(); 392 393 void Resize(); 394 long PreNotify( NotifyEvent& rNEvt ); 395 396 void SetMenuSelectHdl( const Link& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); } 397 398 private: 399 Edit* mpSubControl; 400 MenuButton* mpDropdownButton; 401 PopupMenu* mpMenu; 402 }; 403 404 // -------------------------------------------------------------------- 405 406 DropdownMenuBox::DropdownMenuBox( Window* pParent, Edit* pSubControl, PopupMenu* pMenu ) 407 : Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ), 408 mpSubControl(pSubControl),mpDropdownButton(0),mpMenu(pMenu) 409 { 410 mpDropdownButton = new MenuButton( this, WB_NOLIGHTBORDER | WB_RECTSTYLE | WB_NOTABSTOP); 411 mpDropdownButton->SetSymbol(SYMBOL_SPIN_DOWN); 412 mpDropdownButton->Show(); 413 mpDropdownButton->SetPopupMenu( pMenu ); 414 415 SetSubEdit( mpSubControl ); 416 mpSubControl->SetParent( this ); 417 mpSubControl->Show(); 418 } 419 420 // -------------------------------------------------------------------- 421 422 DropdownMenuBox::~DropdownMenuBox() 423 { 424 SetSubEdit( 0 ); 425 delete mpSubControl; 426 delete mpDropdownButton; 427 delete mpMenu; 428 } 429 430 // -------------------------------------------------------------------- 431 432 void DropdownMenuBox::Resize() 433 { 434 Size aOutSz = GetOutputSizePixel(); 435 436 long nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); 437 nSBWidth = CalcZoom( nSBWidth ); 438 mpSubControl->SetPosSizePixel( 0, 1, aOutSz.Width() - nSBWidth, aOutSz.Height()-2 ); 439 mpDropdownButton->SetPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() ); 440 } 441 442 // -------------------------------------------------------------------- 443 444 long DropdownMenuBox::PreNotify( NotifyEvent& rNEvt ) 445 { 446 long nResult=sal_True; 447 448 sal_uInt16 nSwitch=rNEvt.GetType(); 449 if (nSwitch==EVENT_KEYINPUT) 450 { 451 const KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode(); 452 sal_uInt16 nKey=aKeyCode.GetCode(); 453 454 if (nKey==KEY_DOWN && aKeyCode.IsMod2()) 455 { 456 mpDropdownButton->KeyInput( *rNEvt.GetKeyEvent() ); 457 } 458 else 459 { 460 nResult=Edit::PreNotify(rNEvt); 461 } 462 } 463 else 464 nResult=Edit::PreNotify(rNEvt); 465 466 return nResult; 467 } 468 469 // -------------------------------------------------------------------- 470 471 class CharHeightPropertyBox : public PropertySubControl 472 { 473 public: 474 CharHeightPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 475 virtual ~CharHeightPropertyBox(); 476 477 virtual Any getValue(); 478 virtual void setValue( const Any& rValue, const OUString& ); 479 480 virtual Control* getControl(); 481 482 DECL_LINK( implMenuSelectHdl, MenuButton* ); 483 484 private: 485 DropdownMenuBox* mpControl; 486 PopupMenu* mpMenu; 487 MetricField* mpMetric; 488 }; 489 490 // -------------------------------------------------------------------- 491 492 CharHeightPropertyBox::CharHeightPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 493 : PropertySubControl( nControlType ) 494 { 495 mpMetric = new MetricField( pParent, WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); 496 mpMetric->SetUnit( FUNIT_PERCENT ); 497 mpMetric->SetMin( 0 ); 498 mpMetric->SetMax( 1000 ); 499 500 mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSIZE_POPUP ) ); 501 mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); 502 mpControl->SetMenuSelectHdl( LINK( this, CharHeightPropertyBox, implMenuSelectHdl )); 503 mpControl->SetModifyHdl( rModifyHdl ); 504 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX ); 505 506 OUString aPresetId; 507 setValue( rValue, aPresetId ); 508 } 509 510 // -------------------------------------------------------------------- 511 512 CharHeightPropertyBox::~CharHeightPropertyBox() 513 { 514 delete mpControl; 515 } 516 517 // -------------------------------------------------------------------- 518 519 IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) 520 { 521 long nValue = 100; 522 switch( pPb->GetCurItemId() ) 523 { 524 case CM_SIZE_25: nValue = 25; break; 525 case CM_SIZE_50: nValue = 50; break; 526 case CM_SIZE_150: nValue = 150; break; 527 case CM_SIZE_400: nValue = 400; break; 528 } 529 mpMetric->SetValue( nValue ); 530 mpMetric->Modify(); 531 return 0; 532 } 533 534 // -------------------------------------------------------------------- 535 536 void CharHeightPropertyBox::setValue( const Any& rValue, const OUString& ) 537 { 538 if( mpMetric ) 539 { 540 double fValue = 0.0; 541 rValue >>= fValue; 542 mpMetric->SetValue( (long)(fValue * 100.0) ); 543 } 544 } 545 546 // -------------------------------------------------------------------- 547 548 Any CharHeightPropertyBox::getValue() 549 { 550 return makeAny( (double)((double)mpMetric->GetValue() / 100.0) ); 551 } 552 553 // -------------------------------------------------------------------- 554 555 Control* CharHeightPropertyBox::getControl() 556 { 557 return mpControl; 558 } 559 560 // ==================================================================== 561 562 class TransparencyPropertyBox : public PropertySubControl 563 { 564 public: 565 TransparencyPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 566 ~TransparencyPropertyBox(); 567 568 virtual Any getValue(); 569 virtual void setValue( const Any& rValue, const OUString& rPresetId ); 570 571 virtual Control* getControl(); 572 573 DECL_LINK( implMenuSelectHdl, MenuButton* ); 574 DECL_LINK( implModifyHdl, Control* ); 575 576 void updateMenu(); 577 578 private: 579 DropdownMenuBox* mpControl; 580 PopupMenu* mpMenu; 581 MetricField* mpMetric; 582 Link maModifyHdl; 583 }; 584 585 // -------------------------------------------------------------------- 586 587 TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 588 : PropertySubControl( nControlType ) 589 , maModifyHdl( rModifyHdl ) 590 { 591 mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); 592 mpMetric->SetUnit( FUNIT_PERCENT ); 593 mpMetric->SetMin( 0 ); 594 mpMetric->SetMax( 100 ); 595 596 mpMenu = new PopupMenu(); 597 for( sal_uInt16 i = 25; i < 101; i += 25 ) 598 { 599 String aStr( String::CreateFromInt32( i ) ); 600 aStr += sal_Unicode('%'); 601 mpMenu->InsertItem( i, aStr ); 602 } 603 604 mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); 605 mpControl->SetMenuSelectHdl( LINK( this, TransparencyPropertyBox, implMenuSelectHdl )); 606 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX ); 607 608 Link aLink( LINK( this, TransparencyPropertyBox, implModifyHdl ) ); 609 mpControl->SetModifyHdl( aLink ); 610 611 OUString aPresetId; 612 setValue( rValue, aPresetId ); 613 } 614 615 // -------------------------------------------------------------------- 616 617 TransparencyPropertyBox::~TransparencyPropertyBox() 618 { 619 delete mpControl; 620 } 621 622 // -------------------------------------------------------------------- 623 624 void TransparencyPropertyBox::updateMenu() 625 { 626 sal_Int64 nValue = mpMetric->GetValue(); 627 for( sal_uInt16 i = 25; i < 101; i += 25 ) 628 mpMenu->CheckItem( i, nValue == i ); 629 } 630 631 // -------------------------------------------------------------------- 632 633 IMPL_LINK( TransparencyPropertyBox, implModifyHdl, Control*, EMPTYARG ) 634 { 635 updateMenu(); 636 maModifyHdl.Call(mpMetric); 637 638 return 0; 639 } 640 641 // -------------------------------------------------------------------- 642 643 IMPL_LINK( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) 644 { 645 if( pPb->GetCurItemId() != mpMetric->GetValue() ) 646 { 647 mpMetric->SetValue( pPb->GetCurItemId() ); 648 mpMetric->Modify(); 649 } 650 651 return 0; 652 } 653 654 // -------------------------------------------------------------------- 655 656 void TransparencyPropertyBox::setValue( const Any& rValue, const OUString& ) 657 { 658 if( mpMetric ) 659 { 660 double fValue = 0.0; 661 rValue >>= fValue; 662 long nValue = (long)(fValue * 100); 663 mpMetric->SetValue( nValue ); 664 updateMenu(); 665 } 666 } 667 668 // -------------------------------------------------------------------- 669 670 Any TransparencyPropertyBox::getValue() 671 { 672 return makeAny( (double)((double)mpMetric->GetValue()) / 100.0 ); 673 } 674 675 // -------------------------------------------------------------------- 676 677 Control* TransparencyPropertyBox::getControl() 678 { 679 return mpControl; 680 } 681 682 // -------------------------------------------------------------------- 683 684 class RotationPropertyBox : public PropertySubControl 685 { 686 public: 687 RotationPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 688 ~RotationPropertyBox(); 689 690 virtual Any getValue(); 691 virtual void setValue( const Any& rValue, const OUString& ); 692 693 virtual Control* getControl(); 694 695 DECL_LINK( implMenuSelectHdl, MenuButton* ); 696 DECL_LINK( implModifyHdl, Control* ); 697 698 void updateMenu(); 699 700 private: 701 DropdownMenuBox* mpControl; 702 PopupMenu* mpMenu; 703 MetricField* mpMetric; 704 Link maModifyHdl; 705 }; 706 707 // -------------------------------------------------------------------- 708 709 RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 710 : PropertySubControl( nControlType ) 711 , maModifyHdl( rModifyHdl ) 712 { 713 mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); 714 mpMetric->SetUnit( FUNIT_CUSTOM ); 715 mpMetric->SetCustomUnitText( OUString( sal_Unicode(0xb0)) ); // degree sign 716 mpMetric->SetMin( -10000 ); 717 mpMetric->SetMax( 10000 ); 718 719 mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_ROTATION_POPUP ) ); 720 mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); 721 mpControl->SetMenuSelectHdl( LINK( this, RotationPropertyBox, implMenuSelectHdl )); 722 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX ); 723 724 Link aLink( LINK( this, RotationPropertyBox, implModifyHdl ) ); 725 mpControl->SetModifyHdl( aLink ); 726 727 OUString aPresetId; 728 setValue( rValue, aPresetId ); 729 } 730 731 // -------------------------------------------------------------------- 732 733 RotationPropertyBox::~RotationPropertyBox() 734 { 735 delete mpControl; 736 } 737 738 // -------------------------------------------------------------------- 739 740 void RotationPropertyBox::updateMenu() 741 { 742 sal_Int64 nValue = mpMetric->GetValue(); 743 bool bDirection = nValue >= 0; 744 nValue = (nValue < 0 ? -nValue : nValue); 745 746 mpMenu->CheckItem( CM_QUARTER_SPIN, nValue == 90 ); 747 mpMenu->CheckItem( CM_HALF_SPIN, nValue == 180 ); 748 mpMenu->CheckItem( CM_FULL_SPIN, nValue == 360 ); 749 mpMenu->CheckItem( CM_TWO_SPINS, nValue == 720 ); 750 751 mpMenu->CheckItem( CM_CLOCKWISE, bDirection ); 752 mpMenu->CheckItem( CM_COUNTERCLOCKWISE, !bDirection ); 753 } 754 755 // -------------------------------------------------------------------- 756 757 IMPL_LINK( RotationPropertyBox, implModifyHdl, Control*, EMPTYARG ) 758 { 759 updateMenu(); 760 maModifyHdl.Call(mpMetric); 761 762 return 0; 763 } 764 765 IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb ) 766 { 767 sal_Int64 nValue = mpMetric->GetValue(); 768 bool bDirection = nValue >= 0; 769 nValue = (nValue < 0 ? -nValue : nValue); 770 771 switch( pPb->GetCurItemId() ) 772 { 773 case CM_QUARTER_SPIN: nValue = 90; break; 774 case CM_HALF_SPIN: nValue = 180; break; 775 case CM_FULL_SPIN: nValue = 360; break; 776 case CM_TWO_SPINS: nValue = 720; break; 777 778 case CM_CLOCKWISE: bDirection = true; break; 779 case CM_COUNTERCLOCKWISE: bDirection = false; break; 780 781 } 782 783 if( !bDirection ) 784 nValue = -nValue; 785 786 if( nValue != mpMetric->GetValue() ) 787 { 788 mpMetric->SetValue( nValue ); 789 mpMetric->Modify(); 790 } 791 792 return 0; 793 } 794 795 // -------------------------------------------------------------------- 796 797 void RotationPropertyBox::setValue( const Any& rValue, const OUString& ) 798 { 799 if( mpMetric ) 800 { 801 double fValue = 0.0; 802 rValue >>= fValue; 803 long nValue = (long)(fValue); 804 mpMetric->SetValue( nValue ); 805 updateMenu(); 806 } 807 } 808 809 // -------------------------------------------------------------------- 810 811 Any RotationPropertyBox::getValue() 812 { 813 return makeAny( (double)((double)mpMetric->GetValue()) ); 814 } 815 816 // -------------------------------------------------------------------- 817 818 Control* RotationPropertyBox::getControl() 819 { 820 return mpControl; 821 } 822 823 // -------------------------------------------------------------------- 824 825 class ScalePropertyBox : public PropertySubControl 826 { 827 public: 828 ScalePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 829 ~ScalePropertyBox(); 830 831 virtual Any getValue(); 832 virtual void setValue( const Any& rValue, const OUString& ); 833 834 virtual Control* getControl(); 835 836 DECL_LINK( implMenuSelectHdl, MenuButton* ); 837 DECL_LINK( implModifyHdl, Control* ); 838 839 void updateMenu(); 840 841 private: 842 DropdownMenuBox* mpControl; 843 PopupMenu* mpMenu; 844 MetricField* mpMetric; 845 Link maModifyHdl; 846 int mnDirection; 847 }; 848 849 // -------------------------------------------------------------------- 850 851 ScalePropertyBox::ScalePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 852 : PropertySubControl( nControlType ) 853 , maModifyHdl( rModifyHdl ) 854 { 855 mpMetric = new MetricField( pParent ,WB_TABSTOP|WB_IGNORETAB| WB_NOBORDER); 856 mpMetric->SetUnit( FUNIT_PERCENT ); 857 mpMetric->SetMin( 0 ); 858 mpMetric->SetMax( 10000 ); 859 860 mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_SCALE_POPUP ) ); 861 mpControl = new DropdownMenuBox( pParent, mpMetric, mpMenu ); 862 mpControl->SetMenuSelectHdl( LINK( this, ScalePropertyBox, implMenuSelectHdl )); 863 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX ); 864 865 Link aLink( LINK( this, ScalePropertyBox, implModifyHdl ) ); 866 mpControl->SetModifyHdl( aLink ); 867 868 OUString aPresetId; 869 setValue( rValue, aPresetId ); 870 } 871 872 // -------------------------------------------------------------------- 873 874 ScalePropertyBox::~ScalePropertyBox() 875 { 876 delete mpControl; 877 } 878 879 // -------------------------------------------------------------------- 880 881 void ScalePropertyBox::updateMenu() 882 { 883 sal_Int64 nValue = mpMetric->GetValue(); 884 885 mpMenu->CheckItem( 25, nValue == 25 ); 886 mpMenu->CheckItem( 50, nValue == 50 ); 887 mpMenu->CheckItem( 150, nValue == 150 ); 888 mpMenu->CheckItem( 400, nValue == 400 ); 889 890 mpMenu->CheckItem( CM_HORIZONTAL, mnDirection == 1 ); 891 mpMenu->CheckItem( CM_VERTICAL, mnDirection == 2 ); 892 mpMenu->CheckItem( CM_BOTH, mnDirection == 3 ); 893 } 894 895 // -------------------------------------------------------------------- 896 897 IMPL_LINK( ScalePropertyBox, implModifyHdl, Control*, EMPTYARG ) 898 { 899 updateMenu(); 900 maModifyHdl.Call(mpMetric); 901 902 return 0; 903 } 904 905 IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb ) 906 { 907 sal_Int64 nValue = mpMetric->GetValue(); 908 909 int nDirection = mnDirection; 910 911 switch( pPb->GetCurItemId() ) 912 { 913 case CM_HORIZONTAL: nDirection = 1; break; 914 case CM_VERTICAL: nDirection = 2; break; 915 case CM_BOTH: nDirection = 3; break; 916 917 default: 918 nValue = pPb->GetCurItemId(); 919 } 920 921 bool bModified = false; 922 923 if( nDirection != mnDirection ) 924 { 925 mnDirection = nDirection; 926 bModified = true; 927 } 928 929 if( nValue != mpMetric->GetValue() ) 930 { 931 mpMetric->SetValue( nValue ); 932 bModified = true; 933 } 934 935 if( bModified ) 936 { 937 mpMetric->Modify(); 938 updateMenu(); 939 } 940 941 return 0; 942 } 943 944 // -------------------------------------------------------------------- 945 946 void ScalePropertyBox::setValue( const Any& rValue, const OUString& ) 947 { 948 if( mpMetric ) 949 { 950 ValuePair aValues; 951 rValue >>= aValues; 952 953 double fValue1 = 0.0; 954 double fValue2 = 0.0; 955 956 aValues.First >>= fValue1; 957 aValues.Second >>= fValue2; 958 959 if( fValue2 == 0.0 ) 960 mnDirection = 1; 961 else if( fValue1 == 0.0 ) 962 mnDirection = 2; 963 else 964 mnDirection = 3; 965 966 long nValue; 967 if( fValue1 ) 968 nValue = (long)(fValue1 * 100.0); 969 else 970 nValue = (long)(fValue2 * 100.0); 971 mpMetric->SetValue( nValue ); 972 updateMenu(); 973 } 974 } 975 976 // -------------------------------------------------------------------- 977 978 Any ScalePropertyBox::getValue() 979 { 980 double fValue1 = (double)((double)mpMetric->GetValue() / 100.0); 981 double fValue2 = fValue1; 982 983 if( mnDirection == 1 ) 984 fValue2 = 0.0; 985 else if( mnDirection == 2 ) 986 fValue1 = 0.0; 987 988 ValuePair aValues; 989 aValues.First <<= fValue1; 990 aValues.Second <<= fValue2; 991 992 return makeAny( aValues ); 993 } 994 995 // -------------------------------------------------------------------- 996 997 Control* ScalePropertyBox::getControl() 998 { 999 return mpControl; 1000 } 1001 1002 // ==================================================================== 1003 1004 class FontStylePropertyBox : public PropertySubControl 1005 { 1006 public: 1007 FontStylePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ); 1008 ~FontStylePropertyBox(); 1009 1010 virtual Any getValue(); 1011 virtual void setValue( const Any& rValue, const OUString& ); 1012 1013 virtual Control* getControl(); 1014 1015 DECL_LINK( implMenuSelectHdl, MenuButton* ); 1016 1017 void update(); 1018 1019 private: 1020 DropdownMenuBox* mpControl; 1021 PopupMenu* mpMenu; 1022 Edit* mpEdit; 1023 Link maModifyHdl; 1024 1025 float mfFontWeight; 1026 awt::FontSlant meFontSlant; 1027 sal_Int16 mnFontUnderline; 1028 }; 1029 1030 // -------------------------------------------------------------------- 1031 1032 FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, Window* pParent, const Any& rValue, const Link& rModifyHdl ) 1033 : PropertySubControl( nControlType ) 1034 , maModifyHdl( rModifyHdl ) 1035 { 1036 mpEdit = new Edit( pParent, WB_TABSTOP|WB_IGNORETAB|WB_NOBORDER|WB_READONLY); 1037 mpEdit->SetText( String( SdResId( STR_CUSTOMANIMATION_SAMPLE ) ) ); 1038 1039 mpMenu = new PopupMenu(SdResId( RID_CUSTOMANIMATION_FONTSTYLE_POPUP ) ); 1040 mpControl = new DropdownMenuBox( pParent, mpEdit, mpMenu ); 1041 mpControl->SetMenuSelectHdl( LINK( this, FontStylePropertyBox, implMenuSelectHdl )); 1042 mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX ); 1043 1044 OUString aPresetId; 1045 setValue( rValue, aPresetId ); 1046 } 1047 1048 // -------------------------------------------------------------------- 1049 1050 FontStylePropertyBox::~FontStylePropertyBox() 1051 { 1052 delete mpControl; 1053 } 1054 1055 // -------------------------------------------------------------------- 1056 1057 void FontStylePropertyBox::update() 1058 { 1059 // update menu 1060 mpMenu->CheckItem( CM_BOLD, mfFontWeight == awt::FontWeight::BOLD ); 1061 mpMenu->CheckItem( CM_ITALIC, meFontSlant == awt::FontSlant_ITALIC); 1062 mpMenu->CheckItem( CM_UNDERLINED, mnFontUnderline != awt::FontUnderline::NONE ); 1063 1064 // update sample edit 1065 Font aFont( mpEdit->GetFont() ); 1066 aFont.SetWeight( mfFontWeight == awt::FontWeight::BOLD ? WEIGHT_BOLD : WEIGHT_NORMAL ); 1067 aFont.SetItalic( meFontSlant == awt::FontSlant_ITALIC ? ITALIC_NORMAL : ITALIC_NONE ); 1068 aFont.SetUnderline( mnFontUnderline == awt::FontUnderline::NONE ? UNDERLINE_NONE : UNDERLINE_SINGLE ); 1069 mpEdit->SetFont( aFont ); 1070 mpEdit->Invalidate(); 1071 } 1072 1073 // -------------------------------------------------------------------- 1074 1075 IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb ) 1076 { 1077 switch( pPb->GetCurItemId() ) 1078 { 1079 case CM_BOLD: 1080 if( mfFontWeight == awt::FontWeight::BOLD ) 1081 mfFontWeight = awt::FontWeight::NORMAL; 1082 else 1083 mfFontWeight = awt::FontWeight::BOLD; 1084 break; 1085 case CM_ITALIC: 1086 if( meFontSlant == awt::FontSlant_ITALIC ) 1087 meFontSlant = awt::FontSlant_NONE; 1088 else 1089 meFontSlant = awt::FontSlant_ITALIC; 1090 break; 1091 case CM_UNDERLINED: 1092 if( mnFontUnderline == awt::FontUnderline::SINGLE ) 1093 mnFontUnderline = awt::FontUnderline::NONE; 1094 else 1095 mnFontUnderline = awt::FontUnderline::SINGLE; 1096 break; 1097 default: 1098 return 0; 1099 } 1100 1101 update(); 1102 maModifyHdl.Call(mpEdit); 1103 1104 return 0; 1105 } 1106 1107 // -------------------------------------------------------------------- 1108 1109 void FontStylePropertyBox::setValue( const Any& rValue, const OUString& ) 1110 { 1111 Sequence<Any> aValues; 1112 rValue >>= aValues; 1113 1114 aValues[0] >>= mfFontWeight; 1115 aValues[1] >>= meFontSlant; 1116 aValues[2] >>= mnFontUnderline; 1117 1118 update(); 1119 } 1120 1121 // -------------------------------------------------------------------- 1122 1123 Any FontStylePropertyBox::getValue() 1124 { 1125 Sequence<Any> aValues(3); 1126 aValues[0] <<= mfFontWeight; 1127 aValues[1] <<= meFontSlant; 1128 aValues[2] <<= mnFontUnderline; 1129 return makeAny( aValues ); 1130 } 1131 1132 // -------------------------------------------------------------------- 1133 1134 Control* FontStylePropertyBox::getControl() 1135 { 1136 return mpControl; 1137 } 1138 1139 // ==================================================================== 1140 1141 class CustomAnimationEffectTabPage : public TabPage 1142 { 1143 public: 1144 CustomAnimationEffectTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet ); 1145 ~CustomAnimationEffectTabPage(); 1146 1147 void update( STLPropertySet* pSet ); 1148 DECL_LINK( implSelectHdl, Control* ); 1149 1150 private: 1151 void updateControlStates(); 1152 void fillSoundListBox(); 1153 void clearSoundListBox(); 1154 sal_Int32 getSoundObject( const String& rStr ); 1155 void openSoundFileDialog(); 1156 void onSoundPreview(); 1157 1158 private: 1159 List maSoundList; 1160 sal_Bool mbHasText; 1161 const STLPropertySet* mpSet; 1162 1163 FixedLine* mpFLSettings; 1164 FixedText* mpFTProperty1; 1165 PropertyControl* mpLBProperty1; 1166 FixedText* mpFTProperty2; 1167 PropertyControl* mpLBProperty2; 1168 CheckBox* mpCBSmoothStart; 1169 CheckBox* mpCBSmoothEnd; 1170 CheckBox* mpCBAutoRestart; 1171 1172 FixedLine* mpFLPlay; 1173 RadioButton* mpRBFromStart; 1174 RadioButton* mpRBFromLast; 1175 RadioButton* mpRBFromTime; 1176 MetricField* mpMFStartTime; 1177 FixedLine* mpFLStop; 1178 RadioButton* mpRBStopOnClick; 1179 RadioButton* mpRBStopOnNextSlide; 1180 RadioButton* mpRBStopAfterSlides; 1181 MetricField* mpMFStopAfterSlides; 1182 1183 FixedLine* mpFLEnhancements; 1184 FixedText* mpFTSound; 1185 ListBox* mpLBSound; 1186 PushButton* mpPBSoundPreview; 1187 FixedText* mpFTAfterEffect; 1188 ListBox* mpLBAfterEffect; 1189 FixedText* mpFTDimColor; 1190 ColorListBox* mpCLBDimColor; 1191 FixedText* mpFTTextAnim; 1192 ListBox* mpLBTextAnim; 1193 MetricField* mpMFTextDelay; 1194 FixedText* mpFTTextDelay; 1195 1196 ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer; 1197 }; 1198 1199 1200 static void move_down( Control* pControl, int nOffsetX, int nOffsetY ) 1201 { 1202 Point aPos( pControl->GetPosPixel() ); 1203 aPos.X() += nOffsetX; 1204 aPos.Y() += nOffsetY; 1205 pControl->SetPosPixel( aPos ); 1206 } 1207 1208 CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet ) 1209 : TabPage( pParent, rResId ), mbHasText( sal_False ), mpSet(pSet ) 1210 { 1211 mpFLSettings = new FixedLine( this, SdResId( FL_SETTINGS ) ); 1212 mpFTProperty1 = new FixedText( this, SdResId( FT_PROPERTY_1 ) ); 1213 mpLBProperty1 = new PropertyControl( this, SdResId( LB_PROPERTY_1 ) ); 1214 mpFTProperty2 = new FixedText( this, SdResId( FT_PROPERTY_2 ) ); 1215 mpLBProperty2 = new PropertyControl( this, SdResId( LB_PROPERTY_2 ) ); 1216 mpCBSmoothStart = new CheckBox( this, SdResId( CB_SMOOTH_START ) ); 1217 mpCBSmoothEnd = new CheckBox( this, SdResId( CB_SMOOTH_END ) ); 1218 mpCBAutoRestart = new CheckBox( this, SdResId( CB_AUTORESTART ) ); 1219 /* 1220 mpFLPlay = new FixedLine( this, SdResId( FL_PLAY ) ); 1221 mpRBFromStart = new RadioButton( this, SdResId( RB_FROM_START ) ); 1222 mpRBFromLast = new RadioButton( this, SdResId( RB_FROM_LAST ) ); 1223 mpRBFromTime = new RadioButton( this, SdResId( RB_FROM_TIME ) ); 1224 mpMFStartTime = new MetricField( this, SdResId( MF_START_TIME ) ); 1225 mpFLStop = new FixedLine( this, SdResId( FL_STOP ) ); 1226 mpRBStopOnClick = new RadioButton( this, SdResId( RB_STOP_ON_CLICK ) ); 1227 mpRBStopOnNextSlide = new RadioButton( this, SdResId( RB_STOP_ON_NEXT_SLIDE ) ); 1228 mpRBStopAfterSlides = new RadioButton( this, SdResId( RB_STOP_AFTER_N_SLIDES ) ); 1229 mpMFStopAfterSlides = new MetricField( this, SdResId( MF_STOP_AFTER_SLIDES ) ); 1230 */ 1231 mpFLEnhancements = new FixedLine( this, SdResId( FL_ENHANCEMENTS ) ); 1232 mpFTSound = new FixedText( this, SdResId( FT_SOUND ) ); 1233 mpLBSound = new ListBox( this, SdResId( LB_SOUND ) ); 1234 mpPBSoundPreview = new PushButton( this, SdResId( PB_SOUND_PREVIEW ) ); 1235 mpFTAfterEffect = new FixedText( this, SdResId( FT_AFTER_EFFECT ) ); 1236 mpLBAfterEffect = new ListBox( this, SdResId( LB_AFTER_EFFECT ) ); 1237 mpFTDimColor = new FixedText( this, SdResId( FT_DIMCOLOR ) ); 1238 mpCLBDimColor = new ColorListBox( this, SdResId( CLB_DIMCOLOR ) ); 1239 mpFTTextAnim = new FixedText( this, SdResId( FT_TEXT_ANIM ) ); 1240 mpLBTextAnim = new ListBox( this, SdResId( LB_TEXT_ANIM ) ); 1241 mpMFTextDelay = new MetricField( this, SdResId( MF_TEXT_DELAY ) ); 1242 mpFTTextDelay = new FixedText( this, SdResId( FT_TEXT_DELAY ) ); 1243 1244 FreeResource(); 1245 1246 // fill the soundbox 1247 fillSoundListBox(); 1248 1249 mpLBSound->SetSelectHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) ); 1250 1251 mpPBSoundPreview->SetClickHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) ); 1252 mpPBSoundPreview->SetSymbol( SYMBOL_PLAY ); 1253 1254 // fill the color box 1255 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 1256 DBG_ASSERT( pDocSh, "DocShell not found!" ); 1257 XColorTable* pColorTable = NULL; 1258 bool bKillTable = false; 1259 const SfxPoolItem* pItem = NULL; 1260 1261 if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != 0 ) ) 1262 pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable(); 1263 1264 if ( !pColorTable ) 1265 { 1266 pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() ); 1267 bKillTable = sal_True; 1268 } 1269 1270 mpCLBDimColor->SetUpdateMode( sal_False ); 1271 1272 for ( long i = 0; i < pColorTable->Count(); i++ ) 1273 { 1274 XColorEntry* pEntry = pColorTable->GetColor(i); 1275 mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); 1276 } 1277 1278 mpCLBDimColor->SetUpdateMode( sal_True ); 1279 1280 if ( bKillTable ) 1281 delete pColorTable; 1282 1283 // 1284 // init settings controls 1285 // 1286 1287 int nOffsetY = 0; 1288 int nOffsetX = 0; 1289 1290 Size aSpace( LogicToPixel( Size( 3, 3 ), MAP_APPFONT ) ); 1291 1292 // only show settings if all selected effects have the same preset-id 1293 if( pSet->getPropertyState( nHandlePresetId ) != STLPropertyState_AMBIGUOUS ) 1294 { 1295 OUString aPresetId; 1296 pSet->getPropertyValue( nHandlePresetId ) >>= aPresetId; 1297 1298 // 1299 // property 1 1300 // 1301 1302 if( pSet->getPropertyState( nHandleProperty1Type ) != STLPropertyState_AMBIGUOUS ) 1303 { 1304 sal_Int32 nType = 0; 1305 pSet->getPropertyValue( nHandleProperty1Type ) >>= nType; 1306 1307 if( nType != nPropertyTypeNone ) 1308 { 1309 // set ui name for property at fixed text 1310 OUString aPropertyName( getPropertyName( nType ) ); 1311 1312 if( aPropertyName.getLength() ) 1313 { 1314 mpFTProperty1->Show(); 1315 mpLBProperty1->Show(); 1316 1317 nOffsetY += mpLBProperty1->GetSizePixel().Height() + aSpace.Height(); 1318 1319 mpFTProperty1->SetText( aPropertyName ); 1320 } 1321 1322 // get property value 1323 const Any aValue( pSet->getPropertyValue( nHandleProperty1Value ) ); 1324 1325 Link aModifyLink; 1326 // create property sub control 1327 mpLBProperty1->setSubControl( PropertySubControl::create( nType, this, aValue, aPresetId, aModifyLink )); 1328 } 1329 } 1330 1331 mpFTProperty1->Enable( mpLBProperty1->IsEnabled() ); 1332 1333 // 1334 // accelerate & deccelerate 1335 // 1336 1337 if( pSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT ) 1338 { 1339 mpCBSmoothStart->Show(); 1340 mpCBSmoothEnd->Show(); 1341 1342 move_down( mpCBSmoothStart, nOffsetX, nOffsetY ); 1343 move_down( mpCBSmoothEnd, nOffsetX, nOffsetY ); 1344 1345 nOffsetY += mpCBSmoothStart->GetSizePixel().Height() + aSpace.Height(); 1346 1347 double fTemp = 0.0; 1348 pSet->getPropertyValue( nHandleAccelerate ) >>= fTemp; 1349 mpCBSmoothStart->Check( fTemp > 0.0 ); 1350 1351 pSet->getPropertyValue( nHandleDecelerate ) >>= fTemp; 1352 mpCBSmoothEnd->Check( fTemp > 0.0 ); 1353 } 1354 1355 // 1356 // auto reverse 1357 // 1358 1359 1360 if( nOffsetY ) 1361 { 1362 nOffsetY += mpFLSettings->GetSizePixel().Height() + aSpace.Height(); 1363 mpFLSettings->Show(); 1364 1365 mpFLEnhancements->Show(); 1366 move_down( mpFLEnhancements, nOffsetX, nOffsetY ); 1367 1368 nOffsetY += mpFLEnhancements->GetSizePixel().Height() + aSpace.Height(); 1369 1370 nOffsetX = 2* aSpace.Width(); 1371 } 1372 } 1373 1374 if( (nOffsetY != 0) || (nOffsetX != 0) ) 1375 { 1376 move_down( mpFTSound, nOffsetX, nOffsetY ); 1377 move_down( mpLBSound, nOffsetX, nOffsetY ); 1378 move_down( mpPBSoundPreview, nOffsetX, nOffsetY ); 1379 move_down( mpFTAfterEffect, nOffsetX, nOffsetY ); 1380 move_down( mpLBAfterEffect, nOffsetX, nOffsetY ); 1381 move_down( mpFTDimColor, nOffsetX, nOffsetY ); 1382 move_down( mpCLBDimColor, nOffsetX, nOffsetY ); 1383 move_down( mpFTTextAnim, nOffsetX, nOffsetY ); 1384 move_down( mpLBTextAnim, nOffsetX, nOffsetY ); 1385 move_down( mpMFTextDelay, nOffsetX, nOffsetY ); 1386 move_down( mpFTTextDelay, nOffsetX, nOffsetY ); 1387 } 1388 1389 // 1390 // init after effect controls 1391 // 1392 1393 mpLBAfterEffect->SetSelectHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) ); 1394 mpLBTextAnim->SetSelectHdl( LINK( this, CustomAnimationEffectTabPage, implSelectHdl ) ); 1395 1396 if( (pSet->getPropertyState( nHandleHasAfterEffect ) != STLPropertyState_AMBIGUOUS) && 1397 (pSet->getPropertyState( nHandleAfterEffectOnNextEffect ) != STLPropertyState_AMBIGUOUS) && 1398 (pSet->getPropertyState( nHandleDimColor ) != STLPropertyState_AMBIGUOUS)) 1399 { 1400 sal_Bool bHasAfterEffect = sal_False; 1401 pSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect; 1402 1403 sal_uInt16 nPos = 0; 1404 if( bHasAfterEffect ) 1405 { 1406 nPos++; 1407 1408 sal_Bool bAfterEffectOnNextClick = sal_False; 1409 pSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextClick; 1410 Any aDimColor( pSet->getPropertyValue( nHandleDimColor ) ); 1411 1412 if( aDimColor.hasValue() ) 1413 { 1414 sal_Int32 nColor = 0; 1415 aDimColor >>= nColor; 1416 Color aColor( nColor ); 1417 sal_uInt16 nColorPos = mpCLBDimColor->GetEntryPos( aColor ); 1418 if ( LISTBOX_ENTRY_NOTFOUND != nColorPos ) 1419 mpCLBDimColor->SelectEntryPos( nColorPos ); 1420 else 1421 mpCLBDimColor->SelectEntryPos( 1422 mpCLBDimColor->InsertEntry( aColor, String( SVX_RES( RID_SVXSTR_COLOR_USER ) ) ) ); 1423 } 1424 else 1425 { 1426 nPos++; 1427 if( bAfterEffectOnNextClick ) 1428 nPos++; 1429 } 1430 } 1431 1432 mpLBAfterEffect->SelectEntryPos( nPos ); 1433 } 1434 1435 if( pSet->getPropertyState( nHandleHasText ) != STLPropertyState_AMBIGUOUS ) 1436 pSet->getPropertyValue( nHandleHasText ) >>= mbHasText; 1437 1438 if( mbHasText ) 1439 { 1440 if( pSet->getPropertyState( nHandleIterateType ) != STLPropertyState_AMBIGUOUS) 1441 { 1442 sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; 1443 1444 sal_Int32 nIterateType = 0; 1445 pSet->getPropertyValue( nHandleIterateType ) >>= nIterateType; 1446 switch( nIterateType ) 1447 { 1448 case TextAnimationType::BY_PARAGRAPH: nPos = 0; break; 1449 case TextAnimationType::BY_WORD: nPos = 1; break; 1450 case TextAnimationType::BY_LETTER: nPos = 2; break; 1451 } 1452 1453 mpLBTextAnim->SelectEntryPos( nPos ); 1454 } 1455 1456 if( pSet->getPropertyState( nHandleIterateInterval ) ) 1457 { 1458 double fIterateInterval = 0.0; 1459 pSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval; 1460 mpMFTextDelay->SetValue( (long)(fIterateInterval*10) ); 1461 } 1462 } 1463 else 1464 { 1465 mpFTTextAnim->Enable( sal_False ); 1466 mpLBTextAnim->Enable( sal_False ); 1467 mpMFTextDelay->Enable( sal_False ); 1468 mpFTTextDelay->Enable( sal_False ); 1469 1470 } 1471 1472 if( pSet->getPropertyState( nHandleSoundURL ) != STLPropertyState_AMBIGUOUS ) 1473 { 1474 sal_uInt16 nPos = 0; 1475 1476 const Any aValue( pSet->getPropertyValue( nHandleSoundURL ) ); 1477 1478 if( aValue.getValueType() == ::getCppuType((const sal_Bool*)0) ) 1479 { 1480 nPos = 1; 1481 } 1482 else 1483 { 1484 OUString aSoundURL; 1485 aValue >>= aSoundURL; 1486 1487 if( aSoundURL.getLength() ) 1488 { 1489 const String aTmp( aSoundURL ); 1490 1491 sal_uLong i; 1492 for( i = 0; i < maSoundList.Count(); i++ ) 1493 { 1494 String* pString = (String*)maSoundList.GetObject( i ); 1495 if( *pString == aTmp ) 1496 { 1497 nPos = (sal_uInt16)i+2; 1498 break; 1499 } 1500 } 1501 1502 if( nPos == 0 ) 1503 { 1504 nPos = (sal_uInt16)maSoundList.Count()+2; 1505 maSoundList.Insert( new String( aTmp ), LIST_APPEND ); 1506 INetURLObject aURL( aTmp ); 1507 nPos = mpLBSound->InsertEntry( aURL.GetBase(), nPos ); 1508 } 1509 } 1510 } 1511 1512 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 1513 mpLBSound->SelectEntryPos( nPos ); 1514 } 1515 1516 updateControlStates(); 1517 1518 Size aSize( GetSizePixel() ); 1519 aSize.Height() += mpMFTextDelay->GetPosPixel().X() + GetSizePixel().Height() + aSpace.Height(); 1520 SetSizePixel( aSize ); 1521 } 1522 1523 CustomAnimationEffectTabPage::~CustomAnimationEffectTabPage() 1524 { 1525 clearSoundListBox(); 1526 1527 delete mpFLSettings; 1528 delete mpFTProperty1; 1529 delete mpLBProperty1; 1530 delete mpFTProperty2; 1531 delete mpLBProperty2; 1532 delete mpCBSmoothStart; 1533 delete mpCBSmoothEnd; 1534 delete mpCBAutoRestart; 1535 1536 delete mpFLEnhancements; 1537 delete mpFTSound; 1538 delete mpLBSound; 1539 delete mpPBSoundPreview; 1540 delete mpFTAfterEffect; 1541 delete mpLBAfterEffect; 1542 delete mpFTDimColor; 1543 delete mpCLBDimColor; 1544 delete mpFTTextAnim; 1545 delete mpLBTextAnim; 1546 delete mpMFTextDelay; 1547 delete mpFTTextDelay; 1548 } 1549 1550 void CustomAnimationEffectTabPage::updateControlStates() 1551 { 1552 sal_uInt16 nPos = mpLBAfterEffect->GetSelectEntryPos(); 1553 mpCLBDimColor->Enable( nPos == 1 ); 1554 mpFTDimColor->Enable( nPos == 1 ); 1555 1556 if( mbHasText ) 1557 { 1558 nPos = mpLBTextAnim->GetSelectEntryPos(); 1559 mpMFTextDelay->Enable( nPos != 0 ); 1560 mpFTTextDelay->Enable( nPos != 0 ); 1561 } 1562 1563 nPos = mpLBSound->GetSelectEntryPos(); 1564 mpPBSoundPreview->Enable( nPos >= 2 ); 1565 } 1566 1567 IMPL_LINK( CustomAnimationEffectTabPage, implSelectHdl, Control*, pControl ) 1568 { 1569 if( pControl == mpLBAfterEffect ) 1570 { 1571 sal_uInt16 nPos = static_cast<ListBox*>( mpLBAfterEffect )->GetSelectEntryPos(); 1572 if( nPos == 1 ) 1573 { 1574 if( mpCLBDimColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) 1575 mpCLBDimColor->SelectEntryPos(0); 1576 } 1577 } 1578 else if( pControl == mpLBTextAnim ) 1579 { 1580 if( mpMFTextDelay->GetValue() == 0 ) 1581 mpMFTextDelay->SetValue( 100 ); 1582 } 1583 else if( pControl == mpLBSound ) 1584 { 1585 sal_uInt16 nPos = mpLBSound->GetSelectEntryPos(); 1586 if( nPos == (mpLBSound->GetEntryCount() - 1) ) 1587 { 1588 openSoundFileDialog(); 1589 } 1590 } 1591 else if( pControl == mpPBSoundPreview ) 1592 { 1593 onSoundPreview(); 1594 } 1595 1596 updateControlStates(); 1597 return 0; 1598 } 1599 1600 void CustomAnimationEffectTabPage::update( STLPropertySet* pSet ) 1601 { 1602 if( mpLBProperty1->getSubControl() ) 1603 { 1604 Any aNewValue( mpLBProperty1->getSubControl()->getValue() ); 1605 Any aOldValue; 1606 if( mpSet->getPropertyState( nHandleProperty1Value ) != STLPropertyState_AMBIGUOUS) 1607 aOldValue = mpSet->getPropertyValue( nHandleProperty1Value ); 1608 1609 if( aOldValue != aNewValue ) 1610 pSet->setPropertyValue( nHandleProperty1Value, aNewValue ); 1611 } 1612 1613 if( mpLBProperty2->getSubControl() ) 1614 { 1615 Any aNewValue( mpLBProperty2->getSubControl()->getValue() ); 1616 Any aOldValue; 1617 if( mpSet->getPropertyState( nHandleProperty2Value ) != STLPropertyState_AMBIGUOUS) 1618 aOldValue = mpSet->getPropertyValue( nHandleProperty2Value ); 1619 1620 if( aOldValue != aNewValue ) 1621 pSet->setPropertyValue( nHandleProperty2Value, aNewValue ); 1622 } 1623 1624 if( mpCBSmoothStart->IsVisible() ) 1625 { 1626 // set selected value for accelerate if different then in original set 1627 1628 double fTemp = mpCBSmoothStart->IsChecked() ? 0.5 : 0.0; 1629 1630 double fOldTemp = 0.0; 1631 if(mpSet->getPropertyState( nHandleAccelerate ) != STLPropertyState_AMBIGUOUS) 1632 mpSet->getPropertyValue( nHandleAccelerate ) >>= fOldTemp; 1633 else 1634 fOldTemp = -2.0; 1635 1636 if( fOldTemp != fTemp ) 1637 pSet->setPropertyValue( nHandleAccelerate, makeAny( fTemp ) ); 1638 1639 // set selected value for decelerate if different then in original set 1640 fTemp = mpCBSmoothEnd->IsChecked() ? 0.5 : 0.0; 1641 1642 if(mpSet->getPropertyState( nHandleDecelerate ) != STLPropertyState_AMBIGUOUS) 1643 mpSet->getPropertyValue( nHandleDecelerate ) >>= fOldTemp; 1644 else 1645 fOldTemp = -2.0; 1646 1647 if( fOldTemp != fTemp ) 1648 pSet->setPropertyValue( nHandleDecelerate, makeAny( fTemp ) ); 1649 } 1650 1651 sal_uInt16 nPos = mpLBAfterEffect->GetSelectEntryPos(); 1652 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 1653 { 1654 sal_Bool bAfterEffect = nPos != 0; 1655 1656 sal_Bool bOldAfterEffect = sal_False; 1657 1658 if(mpSet->getPropertyState( nHandleHasAfterEffect ) != STLPropertyState_AMBIGUOUS) 1659 mpSet->getPropertyValue( nHandleHasAfterEffect ) >>= bOldAfterEffect; 1660 else 1661 bOldAfterEffect = !bAfterEffect; 1662 1663 if( bOldAfterEffect != bAfterEffect ) 1664 pSet->setPropertyValue( nHandleHasAfterEffect, makeAny( bAfterEffect ) ); 1665 1666 Any aDimColor; 1667 if( nPos == 1 ) 1668 { 1669 Color aSelectedColor; 1670 if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) 1671 aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); 1672 1673 aDimColor = makeAny( makeAny( (sal_Int32)aSelectedColor.GetRGBColor() ) ); 1674 } 1675 1676 if( (mpSet->getPropertyState( nHandleDimColor ) == STLPropertyState_AMBIGUOUS) || 1677 (mpSet->getPropertyValue( nHandleDimColor ) != aDimColor) ) 1678 pSet->setPropertyValue( nHandleDimColor, makeAny( aDimColor ) ); 1679 1680 sal_Bool bAfterEffectOnNextEffect = nPos != 2 ? sal_True : sal_False; 1681 sal_Bool bOldAfterEffectOnNextEffect = !bAfterEffectOnNextEffect; 1682 1683 if( mpSet->getPropertyState( nHandleAfterEffectOnNextEffect ) != STLPropertyState_AMBIGUOUS) 1684 mpSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bOldAfterEffectOnNextEffect; 1685 1686 if( bAfterEffectOnNextEffect != bOldAfterEffectOnNextEffect ) 1687 pSet->setPropertyValue( nHandleAfterEffectOnNextEffect, makeAny( bAfterEffectOnNextEffect ) ); 1688 } 1689 1690 // --- 1691 1692 nPos = mpLBTextAnim->GetSelectEntryPos(); 1693 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 1694 { 1695 sal_Int16 nIterateType; 1696 1697 switch( nPos ) 1698 { 1699 case 1: nIterateType = TextAnimationType::BY_WORD; break; 1700 case 2: nIterateType = TextAnimationType::BY_LETTER; break; 1701 default: 1702 nIterateType = TextAnimationType::BY_PARAGRAPH; 1703 } 1704 1705 sal_Int16 nOldIterateType = nIterateType-1; 1706 1707 if(mpSet->getPropertyState( nHandleIterateType ) != STLPropertyState_AMBIGUOUS) 1708 mpSet->getPropertyValue( nHandleIterateType ) >>= nOldIterateType; 1709 1710 if( nIterateType != nOldIterateType ) 1711 pSet->setPropertyValue( nHandleIterateType, makeAny( nIterateType ) ); 1712 } 1713 1714 // --- 1715 1716 { 1717 double fIterateInterval = static_cast< double >( mpMFTextDelay->GetValue() ) / 10; 1718 double fOldIterateInterval = -1.0; 1719 1720 if( mpSet->getPropertyState( nHandleIterateInterval ) != STLPropertyState_AMBIGUOUS ) 1721 mpSet->getPropertyValue( nHandleIterateInterval ) >>= fOldIterateInterval; 1722 1723 if( fIterateInterval != fOldIterateInterval ) 1724 pSet->setPropertyValue( nHandleIterateInterval, makeAny( fIterateInterval ) ); 1725 } 1726 1727 nPos = mpLBSound->GetSelectEntryPos(); 1728 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 1729 { 1730 Any aNewSoundURL, aOldSoundURL( makeAny( (sal_Int32) 0 ) ); 1731 1732 if( nPos == 0 ) 1733 { 1734 // 0 means no sound, so leave any empty 1735 } 1736 else if( nPos == 1 ) 1737 { 1738 // this means stop sound 1739 aNewSoundURL = makeAny( (sal_Bool)sal_True ); 1740 } 1741 else 1742 { 1743 OUString aSoundURL( *(String*)maSoundList.GetObject( nPos-2 ) ); 1744 aNewSoundURL = makeAny( aSoundURL ); 1745 } 1746 1747 if( mpSet->getPropertyState( nHandleSoundURL ) != STLPropertyState_AMBIGUOUS ) 1748 mpSet->getPropertyValue( nHandleSoundURL ) >>= aOldSoundURL; 1749 1750 if( aNewSoundURL != aOldSoundURL ) 1751 pSet->setPropertyValue( nHandleSoundURL, aNewSoundURL ); 1752 } 1753 } 1754 1755 void CustomAnimationEffectTabPage::fillSoundListBox() 1756 { 1757 GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, maSoundList ); 1758 GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, maSoundList ); 1759 1760 mpLBSound->InsertEntry( String( SdResId( STR_CUSTOMANIMATION_NO_SOUND ) ) ); 1761 mpLBSound->InsertEntry( String( SdResId( STR_CUSTOMANIMATION_STOP_PREVIOUS_SOUND ) ) ); 1762 for( sal_uLong i = 0; i < maSoundList.Count(); i++ ) 1763 { 1764 String* pString = (String*)maSoundList.GetObject( i ); 1765 INetURLObject aURL( *pString ); 1766 mpLBSound->InsertEntry( aURL.GetBase() ); 1767 } 1768 mpLBSound->InsertEntry( String( SdResId( STR_CUSTOMANIMATION_BROWSE_SOUND ) ) ); 1769 } 1770 1771 void CustomAnimationEffectTabPage::clearSoundListBox() 1772 { 1773 const sal_uInt32 nCount = maSoundList.Count(); 1774 sal_uInt32 i; 1775 for( i = 0; i < nCount; i++ ) 1776 delete (String*)maSoundList.GetObject( i ); 1777 maSoundList.Clear(); 1778 1779 mpLBSound->Clear(); 1780 } 1781 1782 sal_Int32 CustomAnimationEffectTabPage::getSoundObject( const String& rStr ) 1783 { 1784 String aStrIn( rStr ); 1785 aStrIn.ToLowerAscii(); 1786 1787 sal_uInt32 i; 1788 const sal_uInt32 nCount = maSoundList.Count(); 1789 for( i = 0; i < nCount; i++ ) 1790 { 1791 String aTmpStr( *(String*)maSoundList.GetObject( i ) ); 1792 aTmpStr.ToLowerAscii(); 1793 1794 if( aTmpStr == aStrIn ) 1795 return i+2; 1796 } 1797 1798 return -1; 1799 } 1800 1801 void CustomAnimationEffectTabPage::openSoundFileDialog() 1802 { 1803 SdOpenSoundFileDialog aFileDialog; 1804 1805 String aFile( SvtPathOptions().GetGraphicPath() ); 1806 aFileDialog.SetPath( aFile ); 1807 1808 bool bValidSoundFile = false; 1809 bool bQuitLoop = false; 1810 long nPos = 0; 1811 1812 while( !bQuitLoop && (aFileDialog.Execute() == ERRCODE_NONE) ) 1813 { 1814 aFile = aFileDialog.GetPath(); 1815 nPos = getSoundObject( aFile ); 1816 1817 if( nPos < 0 ) // not in Soundliste 1818 { 1819 // try to insert in Gallery 1820 if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) ) 1821 { 1822 clearSoundListBox(); 1823 fillSoundListBox(); 1824 1825 nPos = getSoundObject( aFile ); 1826 DBG_ASSERT( nPos >= 0, "sd::CustomAnimationEffectTabPage::openSoundFileDialog(), Recently inserted sound not in list!" ); 1827 1828 bValidSoundFile=true; 1829 bQuitLoop=true; 1830 } 1831 else 1832 { 1833 String aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE)); 1834 String aStr; aStr += sal_Unicode('%'); 1835 aStrWarning.SearchAndReplace( aStr , aFile ); 1836 WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning ); 1837 aWarningBox.SetModalInputMode (sal_True); 1838 bQuitLoop = aWarningBox.Execute()==RET_RETRY ? sal_False : sal_True; 1839 1840 bValidSoundFile=false; 1841 } 1842 } 1843 else 1844 { 1845 bValidSoundFile=true; 1846 bQuitLoop=true; 1847 } 1848 } 1849 1850 if( !bValidSoundFile ) 1851 nPos = 0; 1852 1853 mpLBSound->SelectEntryPos( (sal_uInt16) nPos ); 1854 } 1855 1856 void CustomAnimationEffectTabPage::onSoundPreview() 1857 { 1858 const sal_uInt16 nPos = mpLBSound->GetSelectEntryPos(); 1859 1860 if( nPos >= 2 ) try 1861 { 1862 const OUString aSoundURL( *(String*)maSoundList.GetObject( nPos-2 ) ); 1863 mxPlayer.set( avmedia::MediaWindow::createPlayer( aSoundURL ), uno::UNO_QUERY_THROW ); 1864 mxPlayer->start(); 1865 } 1866 catch( uno::Exception& e ) 1867 { 1868 (void)e; 1869 DBG_ERROR("CustomAnimationEffectTabPage::onSoundPreview(), exception caught!" ); 1870 } 1871 } 1872 1873 class CustomAnimationDurationTabPage : public TabPage 1874 { 1875 public: 1876 CustomAnimationDurationTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet ); 1877 ~CustomAnimationDurationTabPage(); 1878 1879 void update( STLPropertySet* pSet ); 1880 1881 DECL_LINK( implControlHdl, Control* ); 1882 1883 private: 1884 const STLPropertySet* mpSet; 1885 1886 boost::shared_ptr< FixedText > mpFTStart; 1887 boost::shared_ptr< ListBox > mpLBStart; 1888 boost::shared_ptr< FixedText > mpFTStartDelay; 1889 boost::shared_ptr< MetricField > mpMFStartDelay; 1890 boost::shared_ptr< FixedText > mpFTDuration; 1891 boost::shared_ptr< ComboBox > mpCBDuration; 1892 boost::shared_ptr< FixedText > mpFTRepeat; 1893 boost::shared_ptr< ComboBox > mpCBRepeat; 1894 boost::shared_ptr< CheckBox > mpCBXRewind; 1895 boost::shared_ptr< FixedLine > mpFLTrigger; 1896 boost::shared_ptr< RadioButton > mpRBClickSequence; 1897 boost::shared_ptr< RadioButton > mpRBInteractive; 1898 boost::shared_ptr< ListBox > mpLBTrigger; 1899 }; 1900 1901 CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(Window* pParent, const ResId& rResId, const STLPropertySet* pSet) 1902 : TabPage( pParent, rResId ), mpSet( pSet ) 1903 { 1904 mpFTStart.reset( new FixedText( this, SdResId( FT_START ) ) ); 1905 mpLBStart.reset( new ListBox( this, SdResId( LB_START ) ) ); 1906 mpFTStartDelay.reset( new FixedText( this, SdResId( FT_START_DELAY ) ) ); 1907 mpMFStartDelay.reset( new MetricField( this, SdResId( MF_START_DELAY ) ) ); 1908 mpFTDuration.reset( new FixedText( this, SdResId( FT_DURATION ) ) ); 1909 mpCBDuration.reset( new ComboBox( this, SdResId( CB_DURATION ) ) ); 1910 mpFTRepeat.reset( new FixedText( this, SdResId( FT_REPEAT ) ) ); 1911 mpCBRepeat.reset( new ComboBox( this, SdResId( CB_REPEAT ) ) ); 1912 mpCBXRewind.reset( new CheckBox( this, SdResId( CBX_REWIND ) ) ); 1913 mpFLTrigger.reset( new FixedLine( this, SdResId( FL_TRIGGER ) ) ); 1914 mpRBClickSequence.reset( new RadioButton( this, SdResId( RB_CLICKSEQUENCE ) ) ); 1915 mpRBInteractive.reset( new RadioButton( this, SdResId( RB_INTERACTIVE ) ) ); 1916 mpLBTrigger.reset( new ListBox( this, SdResId( LB_TRIGGER ) ) ); 1917 1918 fillRepeatComboBox( mpCBRepeat.get() ); 1919 fillDurationComboBox( mpCBDuration.get() ); 1920 1921 FreeResource(); 1922 1923 mpRBClickSequence->SetClickHdl( LINK( this, CustomAnimationDurationTabPage, implControlHdl ) ); 1924 mpRBClickSequence->SetClickHdl( LINK( this, CustomAnimationDurationTabPage, implControlHdl ) ); 1925 mpLBTrigger->SetSelectHdl( LINK( this, CustomAnimationDurationTabPage, implControlHdl ) ); 1926 1927 if( pSet->getPropertyState( nHandleStart ) != STLPropertyState_AMBIGUOUS ) 1928 { 1929 sal_Int16 nStart = 0; 1930 pSet->getPropertyValue( nHandleStart ) >>= nStart; 1931 sal_uInt16 nPos = 0; 1932 switch( nStart ) 1933 { 1934 case EffectNodeType::WITH_PREVIOUS: nPos = 1; break; 1935 case EffectNodeType::AFTER_PREVIOUS: nPos = 2; break; 1936 } 1937 mpLBStart->SelectEntryPos( nPos ); 1938 } 1939 1940 if( pSet->getPropertyState( nHandleBegin ) != STLPropertyState_AMBIGUOUS ) 1941 { 1942 double fBegin = 0.0; 1943 pSet->getPropertyValue( nHandleBegin ) >>= fBegin; 1944 mpMFStartDelay->SetValue( (long)(fBegin*10) ); 1945 } 1946 1947 if( pSet->getPropertyState( nHandleDuration ) != STLPropertyState_AMBIGUOUS ) 1948 { 1949 double fDuration = 0.0; 1950 pSet->getPropertyValue( nHandleDuration ) >>= fDuration; 1951 1952 if( fDuration == 0.001 ) 1953 { 1954 mpFTDuration->Disable(); 1955 mpCBDuration->Disable(); 1956 mpFTRepeat->Disable(); 1957 mpCBRepeat->Disable(); 1958 mpCBXRewind->Disable(); 1959 } 1960 else 1961 { 1962 sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; 1963 1964 if( fDuration == 5.0 ) 1965 nPos = 0; 1966 else if( fDuration == 3.0 ) 1967 nPos = 1; 1968 else if( fDuration == 2.0 ) 1969 nPos = 2; 1970 else if( fDuration == 1.0 ) 1971 nPos = 3; 1972 else if( fDuration == 0.5 ) 1973 nPos = 4; 1974 1975 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 1976 mpCBDuration->SelectEntryPos( nPos ); 1977 else 1978 mpCBDuration->SetText( String::CreateFromDouble( fDuration ) ); 1979 } 1980 } 1981 1982 if( pSet->getPropertyState( nHandleRepeat ) != STLPropertyState_AMBIGUOUS ) 1983 { 1984 Any aRepeatCount( pSet->getPropertyValue( nHandleRepeat ) ); 1985 if( (aRepeatCount.getValueType() == ::getCppuType((const double*)0)) || !aRepeatCount.hasValue() ) 1986 { 1987 double fRepeat = 0.0; 1988 if( aRepeatCount.hasValue() ) 1989 aRepeatCount >>= fRepeat; 1990 1991 sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND; 1992 1993 if( fRepeat == 0 ) 1994 nPos = 0; 1995 else if( fRepeat == 2.0 ) 1996 nPos = 1; 1997 else if( fRepeat == 3.0 ) 1998 nPos = 2; 1999 else if( fRepeat == 4.0 ) 2000 nPos = 3; 2001 else if( fRepeat == 5.0 ) 2002 nPos = 4; 2003 else if( fRepeat == 10.0 ) 2004 nPos = 5; 2005 2006 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 2007 mpCBRepeat->SelectEntryPos( nPos ); 2008 else 2009 mpCBRepeat->SetText( String::CreateFromDouble( fRepeat ) ); 2010 } 2011 else if( aRepeatCount.getValueType() == ::getCppuType((const Timing*)0) ) 2012 { 2013 Any aEnd; 2014 if( pSet->getPropertyState( nHandleEnd ) != STLPropertyState_AMBIGUOUS ) 2015 aEnd = pSet->getPropertyValue( nHandleEnd ); 2016 2017 mpCBRepeat->SelectEntryPos( aEnd.hasValue() ? 6 : 7 ); 2018 } 2019 } 2020 2021 if( pSet->getPropertyState( nHandleRewind ) != STLPropertyState_AMBIGUOUS ) 2022 { 2023 sal_Int16 nFill = 0; 2024 if( pSet->getPropertyValue( nHandleRewind ) >>= nFill ) 2025 { 2026 mpCBXRewind->Check( (nFill == AnimationFill::REMOVE) ? sal_True : sal_False ); 2027 } 2028 else 2029 { 2030 mpCBXRewind->SetState( STATE_DONTKNOW ); 2031 } 2032 } 2033 2034 Reference< XShape > xTrigger; 2035 2036 if( pSet->getPropertyState( nHandleTrigger ) != STLPropertyState_AMBIGUOUS ) 2037 { 2038 pSet->getPropertyValue( nHandleTrigger ) >>= xTrigger; 2039 2040 mpRBInteractive->Check( xTrigger.is() ); 2041 mpRBClickSequence->Check( !xTrigger.is() ); 2042 } 2043 2044 Reference< XDrawPage > xCurrentPage; 2045 pSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage; 2046 if( xCurrentPage.is() ) 2047 { 2048 const OUString aStrIsEmptyPresObj( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) ); 2049 2050 sal_Int32 nShape, nCount = xCurrentPage->getCount(); 2051 for( nShape = 0; nShape < nCount; nShape++ ) 2052 { 2053 Reference< XShape > xShape( xCurrentPage->getByIndex( nShape ), UNO_QUERY ); 2054 2055 if( !xShape.is() ) 2056 continue; 2057 2058 Reference< XPropertySet > xSet( xShape, UNO_QUERY ); 2059 if( xSet.is() && xSet->getPropertySetInfo()->hasPropertyByName( aStrIsEmptyPresObj ) ) 2060 { 2061 sal_Bool bIsEmpty = sal_False; 2062 xSet->getPropertyValue( aStrIsEmptyPresObj ) >>= bIsEmpty; 2063 if( bIsEmpty ) 2064 continue; 2065 } 2066 2067 String aDescription( getShapeDescription( xShape, true ) ); 2068 sal_uInt16 nPos = mpLBTrigger->InsertEntry( aDescription ); 2069 2070 mpLBTrigger->SetEntryData( nPos, (void*)nShape ); 2071 if( xShape == xTrigger ) 2072 mpLBTrigger->SelectEntryPos( nPos ); 2073 } 2074 } 2075 } 2076 2077 CustomAnimationDurationTabPage::~CustomAnimationDurationTabPage() 2078 { 2079 } 2080 2081 IMPL_LINK( CustomAnimationDurationTabPage, implControlHdl, Control*, pControl ) 2082 { 2083 if( pControl == mpLBTrigger.get() ) 2084 { 2085 mpRBClickSequence->Check( sal_False ); 2086 mpRBInteractive->Check( sal_True ); 2087 } 2088 2089 return 0; 2090 } 2091 2092 void CustomAnimationDurationTabPage::update( STLPropertySet* pSet ) 2093 { 2094 sal_uInt16 nPos = mpLBStart->GetSelectEntryPos(); 2095 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 2096 { 2097 sal_Int16 nStart; 2098 sal_Int16 nOldStart = -1; 2099 2100 switch( nPos ) 2101 { 2102 case 1: nStart = EffectNodeType::WITH_PREVIOUS; break; 2103 case 2: nStart = EffectNodeType::AFTER_PREVIOUS; break; 2104 default: 2105 nStart = EffectNodeType::ON_CLICK; break; 2106 } 2107 2108 if(mpSet->getPropertyState( nHandleStart ) != STLPropertyState_AMBIGUOUS) 2109 mpSet->getPropertyValue( nHandleStart ) >>= nOldStart; 2110 2111 if( nStart != nOldStart ) 2112 pSet->setPropertyValue( nHandleStart, makeAny( nStart ) ); 2113 } 2114 2115 // --- 2116 2117 { 2118 double fBegin = static_cast<double>( mpMFStartDelay->GetValue()) / 10.0; 2119 double fOldBegin = -1.0; 2120 2121 if( mpSet->getPropertyState( nHandleBegin ) != STLPropertyState_AMBIGUOUS ) 2122 mpSet->getPropertyValue( nHandleBegin ) >>= fOldBegin; 2123 2124 if( fBegin != fOldBegin ) 2125 pSet->setPropertyValue( nHandleBegin, makeAny( fBegin ) ); 2126 } 2127 2128 // --- 2129 2130 nPos = mpCBRepeat->GetSelectEntryPos(); 2131 if( (nPos != LISTBOX_ENTRY_NOTFOUND) || (mpCBRepeat->GetText().Len() != 0) ) 2132 { 2133 Any aRepeatCount; 2134 Any aEnd; 2135 2136 switch( nPos ) 2137 { 2138 case 0: 2139 break; 2140 case 6: 2141 { 2142 Event aEvent; 2143 aEvent.Trigger = EventTrigger::ON_NEXT; 2144 aEvent.Repeat = 0; 2145 aEnd <<= aEvent; 2146 } 2147 // ATTENTION: FALL THROUGH INTENDED! 2148 case 7: 2149 aRepeatCount <<= Timing_INDEFINITE; 2150 break; 2151 default: 2152 { 2153 String aText( mpCBRepeat->GetText() ); 2154 if( aText.Len() ) 2155 aRepeatCount <<= aText.ToDouble(); 2156 } 2157 } 2158 2159 Any aOldRepeatCount( aRepeatCount ); 2160 if( mpSet->getPropertyState( nHandleRepeat ) != STLPropertyState_AMBIGUOUS ) 2161 aOldRepeatCount = mpSet->getPropertyValue( nHandleRepeat ); 2162 2163 if( aRepeatCount != aOldRepeatCount ) 2164 pSet->setPropertyValue( nHandleRepeat, aRepeatCount ); 2165 2166 Any aOldEnd( aEnd ); 2167 if( mpSet->getPropertyState( nHandleEnd ) != STLPropertyState_AMBIGUOUS ) 2168 aOldEnd = mpSet->getPropertyValue( nHandleEnd ); 2169 2170 if( aEnd != aOldEnd ) 2171 pSet->setPropertyValue( nHandleEnd, aEnd ); 2172 } 2173 2174 // --- 2175 2176 double fDuration = -1.0; 2177 nPos = mpCBDuration->GetSelectEntryPos(); 2178 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 2179 { 2180 fDuration = *static_cast< const double * >( mpCBDuration->GetEntryData(nPos) ); 2181 } 2182 else 2183 { 2184 String aText( mpCBDuration->GetText() ); 2185 if( aText.Len() ) 2186 { 2187 fDuration = aText.ToDouble(); 2188 } 2189 } 2190 2191 if( fDuration != -1.0 ) 2192 { 2193 double fOldDuration = -1; 2194 2195 if( mpSet->getPropertyState( nHandleDuration ) != STLPropertyState_AMBIGUOUS ) 2196 mpSet->getPropertyValue( nHandleDuration ) >>= fOldDuration; 2197 2198 if( fDuration != fOldDuration ) 2199 pSet->setPropertyValue( nHandleDuration, makeAny( fDuration ) ); 2200 } 2201 2202 // --- 2203 2204 if( mpCBXRewind->GetState() != STATE_DONTKNOW ) 2205 { 2206 sal_Int16 nFill = mpCBXRewind->IsChecked() ? AnimationFill::REMOVE : AnimationFill::HOLD; 2207 2208 bool bSet = true; 2209 2210 if( mpSet->getPropertyState( nHandleRewind ) != STLPropertyState_AMBIGUOUS ) 2211 { 2212 sal_Int16 nOldFill = 0; 2213 mpSet->getPropertyValue( nHandleRewind ) >>= nOldFill; 2214 bSet = nFill != nOldFill; 2215 } 2216 2217 if( bSet ) 2218 pSet->setPropertyValue( nHandleRewind, makeAny( nFill ) ); 2219 } 2220 2221 Reference< XShape > xTrigger; 2222 2223 if( mpRBInteractive->IsChecked() ) 2224 { 2225 nPos = mpLBTrigger->GetSelectEntryPos(); 2226 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 2227 { 2228 sal_Int32 nShape = (sal_Int32)(sal_IntPtr)mpLBTrigger->GetEntryData( nPos ); 2229 2230 Reference< XDrawPage > xCurrentPage; 2231 mpSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage; 2232 2233 if( xCurrentPage.is() && (nShape >= 0) && (nShape < xCurrentPage->getCount()) ) 2234 xCurrentPage->getByIndex( nShape ) >>= xTrigger; 2235 } 2236 } 2237 2238 2239 if( xTrigger.is() || mpRBClickSequence->IsChecked() ) 2240 { 2241 Any aNewValue( makeAny( xTrigger ) ); 2242 Any aOldValue; 2243 2244 if( mpSet->getPropertyState( nHandleTrigger ) != STLPropertyState_AMBIGUOUS ) 2245 aOldValue = mpSet->getPropertyValue( nHandleTrigger ); 2246 2247 if( aNewValue != aOldValue ) 2248 pSet->setPropertyValue( nHandleTrigger, aNewValue ); 2249 } 2250 } 2251 2252 class CustomAnimationTextAnimTabPage : public TabPage 2253 { 2254 public: 2255 CustomAnimationTextAnimTabPage( Window* pParent, const ResId& rResId, const STLPropertySet* pSet ); 2256 2257 void update( STLPropertySet* pSet ); 2258 2259 void updateControlStates(); 2260 DECL_LINK( implSelectHdl, Control* ); 2261 2262 private: 2263 FixedText maFTGroupText; 2264 ListBox maLBGroupText; 2265 CheckBox maCBXGroupAuto; 2266 MetricField maMFGroupAuto; 2267 CheckBox maCBXAnimateForm; 2268 CheckBox maCBXReverse; 2269 2270 const STLPropertySet* mpSet; 2271 2272 bool mbHasVisibleShapes; 2273 }; 2274 2275 CustomAnimationTextAnimTabPage::CustomAnimationTextAnimTabPage(Window* pParent, const ResId& rResId, const STLPropertySet* pSet) 2276 : TabPage( pParent, rResId ), 2277 maFTGroupText( this, SdResId( FT_GROUP_TEXT ) ), 2278 maLBGroupText( this, SdResId( LB_GROUP_TEXT ) ), 2279 maCBXGroupAuto( this, SdResId( CBX_GROUP_AUTO ) ), 2280 maMFGroupAuto( this, SdResId( MF_GROUP_AUTO ) ), 2281 maCBXAnimateForm( this, SdResId( CBX_ANIMATE_FORM ) ), 2282 maCBXReverse( this, SdResId( CBX_REVERSE ) ), 2283 mpSet( pSet ), 2284 mbHasVisibleShapes(true) 2285 { 2286 FreeResource(); 2287 2288 maLBGroupText.SetSelectHdl( LINK( this, CustomAnimationTextAnimTabPage, implSelectHdl ) ); 2289 2290 if( pSet->getPropertyState( nHandleTextGrouping ) != STLPropertyState_AMBIGUOUS ) 2291 { 2292 sal_Int32 nTextGrouping = 0; 2293 if( pSet->getPropertyValue( nHandleTextGrouping ) >>= nTextGrouping ) 2294 maLBGroupText.SelectEntryPos( (sal_uInt16)(nTextGrouping + 1) ); 2295 } 2296 2297 if( pSet->getPropertyState( nHandleHasVisibleShape ) != STLPropertyState_AMBIGUOUS ) 2298 pSet->getPropertyValue( nHandleHasVisibleShape ) >>= mbHasVisibleShapes; 2299 2300 if( pSet->getPropertyState( nHandleTextGroupingAuto ) != STLPropertyState_AMBIGUOUS ) 2301 { 2302 double fTextGroupingAuto = 0.0; 2303 if( pSet->getPropertyValue( nHandleTextGroupingAuto ) >>= fTextGroupingAuto ) 2304 { 2305 maCBXGroupAuto.Check( fTextGroupingAuto >= 0.0 ); 2306 if( fTextGroupingAuto >= 0.0 ) 2307 maMFGroupAuto.SetValue( (long)(fTextGroupingAuto*10) ); 2308 } 2309 } 2310 else 2311 { 2312 maCBXGroupAuto.SetState( STATE_DONTKNOW ); 2313 } 2314 2315 maCBXAnimateForm.SetState( STATE_DONTKNOW ); 2316 if( pSet->getPropertyState( nHandleAnimateForm ) != STLPropertyState_AMBIGUOUS ) 2317 { 2318 sal_Bool bAnimateForm = sal_False; 2319 if( pSet->getPropertyValue( nHandleAnimateForm ) >>= bAnimateForm ) 2320 { 2321 maCBXAnimateForm.Check( bAnimateForm ); 2322 } 2323 } 2324 else 2325 { 2326 maCBXAnimateForm.Enable( sal_False ); 2327 } 2328 2329 maCBXReverse.SetState( STATE_DONTKNOW ); 2330 if( pSet->getPropertyState( nHandleTextReverse ) != STLPropertyState_AMBIGUOUS ) 2331 { 2332 sal_Bool bTextReverse = sal_False; 2333 if( pSet->getPropertyValue( nHandleTextReverse ) >>= bTextReverse ) 2334 { 2335 maCBXReverse.Check( bTextReverse ); 2336 } 2337 } 2338 2339 if( pSet->getPropertyState( nHandleMaxParaDepth ) == STLPropertyState_DIRECT ) 2340 { 2341 sal_Int32 nMaxParaDepth = 0; 2342 pSet->getPropertyValue( nHandleMaxParaDepth ) >>= nMaxParaDepth; 2343 nMaxParaDepth += 1; 2344 2345 sal_Int32 nPos = 6; 2346 while( (nPos > 2) && (nPos > nMaxParaDepth) ) 2347 { 2348 maLBGroupText.RemoveEntry( (sal_uInt16)nPos ); 2349 nPos--; 2350 } 2351 } 2352 2353 updateControlStates(); 2354 } 2355 2356 void CustomAnimationTextAnimTabPage::update( STLPropertySet* pSet ) 2357 { 2358 sal_uInt16 nPos = maLBGroupText.GetSelectEntryPos(); 2359 if( nPos != LISTBOX_ENTRY_NOTFOUND ) 2360 { 2361 sal_Int32 nTextGrouping = nPos - 1; 2362 sal_Int32 nOldGrouping = -2; 2363 2364 if(mpSet->getPropertyState( nHandleTextGrouping ) != STLPropertyState_AMBIGUOUS) 2365 mpSet->getPropertyValue( nHandleTextGrouping ) >>= nOldGrouping; 2366 2367 if( nTextGrouping != nOldGrouping ) 2368 pSet->setPropertyValue( nHandleTextGrouping, makeAny( nTextGrouping ) ); 2369 } 2370 2371 if( nPos > 0 ) 2372 { 2373 sal_Bool bTextReverse = maCBXReverse.IsChecked(); 2374 sal_Bool bOldTextReverse = !bTextReverse; 2375 2376 if(mpSet->getPropertyState( nHandleTextReverse ) != STLPropertyState_AMBIGUOUS) 2377 mpSet->getPropertyValue( nHandleTextReverse ) >>= bOldTextReverse; 2378 2379 if( bTextReverse != bOldTextReverse ) 2380 pSet->setPropertyValue( nHandleTextReverse, makeAny( bTextReverse ) ); 2381 2382 if( nPos > 1 ) 2383 { 2384 double fTextGroupingAuto = maCBXGroupAuto.IsChecked() ? maMFGroupAuto.GetValue() / 10.0 : -1.0; 2385 double fOldTextGroupingAuto = -2.0; 2386 2387 if(mpSet->getPropertyState( nHandleTextGroupingAuto ) != STLPropertyState_AMBIGUOUS) 2388 mpSet->getPropertyValue( nHandleTextGroupingAuto ) >>= fOldTextGroupingAuto; 2389 2390 if( fTextGroupingAuto != fOldTextGroupingAuto ) 2391 pSet->setPropertyValue( nHandleTextGroupingAuto, makeAny( fTextGroupingAuto ) ); 2392 } 2393 } 2394 2395 sal_Bool bAnimateForm = maCBXAnimateForm.IsChecked(); 2396 sal_Bool bOldAnimateForm = !bAnimateForm; 2397 2398 if(mpSet->getPropertyState( nHandleAnimateForm ) != STLPropertyState_AMBIGUOUS) 2399 mpSet->getPropertyValue( nHandleAnimateForm ) >>= bOldAnimateForm; 2400 2401 if( bAnimateForm != bOldAnimateForm ) 2402 pSet->setPropertyValue( nHandleAnimateForm, makeAny( bAnimateForm ) ); 2403 } 2404 2405 void CustomAnimationTextAnimTabPage::updateControlStates() 2406 { 2407 sal_uInt16 nPos = maLBGroupText.GetSelectEntryPos(); 2408 2409 maCBXGroupAuto.Enable( nPos > 1 ); 2410 maMFGroupAuto.Enable( nPos > 1 ); 2411 maCBXReverse.Enable( nPos > 0 ); 2412 2413 if( !mbHasVisibleShapes && nPos > 0 ) 2414 { 2415 maCBXAnimateForm.Check(sal_False); 2416 maCBXAnimateForm.Enable(sal_False); 2417 } 2418 else 2419 { 2420 maCBXAnimateForm.Enable(sal_True); 2421 } 2422 } 2423 2424 IMPL_LINK( CustomAnimationTextAnimTabPage, implSelectHdl, Control*, EMPTYARG ) 2425 { 2426 updateControlStates(); 2427 return 0; 2428 } 2429 2430 // -------------------------------------------------------------------- 2431 2432 CustomAnimationDialog::CustomAnimationDialog( Window* pParent, STLPropertySet* pSet, sal_uInt16 nPage /* = 0 */ ) 2433 : TabDialog( pParent, SdResId( DLG_CUSTOMANIMATION ) ), mpSet( pSet ), mpResultSet( 0 ) 2434 { 2435 mpTabControl = new TabControl( this, SdResId( 1 ) ); 2436 mpOKButton = new OKButton(this, SdResId( 1 ) ) ; 2437 mpCancelButton = new CancelButton(this, SdResId( 1 ) ); 2438 mpHelpButton = new HelpButton(this, SdResId( 1 ) ); 2439 2440 FreeResource(); 2441 2442 mpEffectTabPage = new CustomAnimationEffectTabPage( mpTabControl, SdResId( RID_TP_CUSTOMANIMATION_EFFECT ), mpSet ); 2443 mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_EFFECT, mpEffectTabPage ); 2444 mpDurationTabPage = new CustomAnimationDurationTabPage( mpTabControl, SdResId( RID_TP_CUSTOMANIMATION_DURATION ), mpSet ); 2445 mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_DURATION, mpDurationTabPage ); 2446 2447 sal_Bool bHasText = sal_False; 2448 if( pSet->getPropertyState( nHandleHasText ) != STLPropertyState_AMBIGUOUS ) 2449 pSet->getPropertyValue( nHandleHasText ) >>= bHasText; 2450 2451 if( bHasText ) 2452 { 2453 mpTextAnimTabPage = new CustomAnimationTextAnimTabPage( mpTabControl, SdResId( RID_TP_CUSTOMANIMATION_TEXT ), mpSet ); 2454 mpTabControl->SetTabPage( RID_TP_CUSTOMANIMATION_TEXT, mpTextAnimTabPage ); 2455 } 2456 else 2457 { 2458 mpTextAnimTabPage = 0; 2459 mpTabControl->RemovePage( RID_TP_CUSTOMANIMATION_TEXT ); 2460 } 2461 2462 if( nPage ) 2463 mpTabControl->SelectTabPage( nPage ); 2464 } 2465 2466 CustomAnimationDialog::~CustomAnimationDialog() 2467 { 2468 delete mpEffectTabPage; 2469 delete mpDurationTabPage; 2470 delete mpTextAnimTabPage; 2471 2472 delete mpTabControl; 2473 delete mpOKButton; 2474 delete mpCancelButton; 2475 delete mpHelpButton; 2476 2477 delete mpSet; 2478 delete mpResultSet; 2479 } 2480 2481 STLPropertySet* CustomAnimationDialog::getResultSet() 2482 { 2483 if( mpResultSet ) 2484 delete mpResultSet; 2485 2486 mpResultSet = createDefaultSet(); 2487 2488 mpEffectTabPage->update( mpResultSet ); 2489 mpDurationTabPage->update( mpResultSet ); 2490 if( mpTextAnimTabPage ) 2491 mpTextAnimTabPage->update( mpResultSet ); 2492 2493 return mpResultSet; 2494 } 2495 2496 STLPropertySet* CustomAnimationDialog::createDefaultSet() 2497 { 2498 Any aEmpty; 2499 2500 STLPropertySet* pSet = new STLPropertySet(); 2501 pSet->setPropertyDefaultValue( nHandleMaxParaDepth, makeAny( (sal_Int32)-1 ) ); 2502 2503 pSet->setPropertyDefaultValue( nHandleHasAfterEffect, makeAny( (sal_Bool)sal_False ) ); 2504 pSet->setPropertyDefaultValue( nHandleAfterEffectOnNextEffect, makeAny( (sal_Bool)sal_False ) ); 2505 pSet->setPropertyDefaultValue( nHandleDimColor, aEmpty ); 2506 pSet->setPropertyDefaultValue( nHandleIterateType, makeAny( (sal_Int16)0 ) ); 2507 pSet->setPropertyDefaultValue( nHandleIterateInterval, makeAny( (double)0.0 ) ); 2508 2509 pSet->setPropertyDefaultValue( nHandleStart, makeAny( (sal_Int16)EffectNodeType::ON_CLICK ) ); 2510 pSet->setPropertyDefaultValue( nHandleBegin, makeAny( (double)0.0 ) ); 2511 pSet->setPropertyDefaultValue( nHandleDuration, makeAny( (double)2.0 ) ); 2512 pSet->setPropertyDefaultValue( nHandleRepeat, aEmpty ); 2513 pSet->setPropertyDefaultValue( nHandleRewind, makeAny( AnimationFill::HOLD ) ); 2514 2515 pSet->setPropertyDefaultValue( nHandleEnd, aEmpty ); 2516 2517 pSet->setPropertyDefaultValue( nHandlePresetId, aEmpty ); 2518 pSet->setPropertyDefaultValue( nHandleProperty1Type, makeAny( nPropertyTypeNone ) ); 2519 pSet->setPropertyDefaultValue( nHandleProperty1Value, aEmpty ); 2520 pSet->setPropertyDefaultValue( nHandleProperty2Type, makeAny( nPropertyTypeNone ) ); 2521 pSet->setPropertyDefaultValue( nHandleProperty2Value, aEmpty ); 2522 pSet->setPropertyDefaultValue( nHandleAccelerate, aEmpty ); 2523 pSet->setPropertyDefaultValue( nHandleDecelerate, aEmpty ); 2524 pSet->setPropertyDefaultValue( nHandleAutoReverse, aEmpty ); 2525 pSet->setPropertyDefaultValue( nHandleTrigger, aEmpty ); 2526 2527 pSet->setPropertyDefaultValue( nHandleHasText, makeAny( sal_False ) ); 2528 pSet->setPropertyDefaultValue( nHandleHasVisibleShape, makeAny( sal_False ) ); 2529 pSet->setPropertyDefaultValue( nHandleTextGrouping, makeAny( (sal_Int32)-1 ) ); 2530 pSet->setPropertyDefaultValue( nHandleAnimateForm, makeAny( sal_True ) ); 2531 pSet->setPropertyDefaultValue( nHandleTextGroupingAuto, makeAny( (double)-1.0 ) ); 2532 pSet->setPropertyDefaultValue( nHandleTextReverse, makeAny( sal_False ) ); 2533 2534 pSet->setPropertyDefaultValue( nHandleCurrentPage, aEmpty ); 2535 2536 pSet->setPropertyDefaultValue( nHandleSoundURL, aEmpty ); 2537 pSet->setPropertyDefaultValue( nHandleSoundVolumne, makeAny( (double)1.0) ); 2538 pSet->setPropertyDefaultValue( nHandleSoundEndAfterSlide, makeAny( (sal_Int32)0 ) ); 2539 2540 pSet->setPropertyDefaultValue( nHandleCommand, makeAny( (sal_Int16)0 ) ); 2541 return pSet; 2542 } 2543 2544 PropertyControl::PropertyControl( Window* pParent, const ResId& rResId ) 2545 : ListBox( pParent, rResId ), mpSubControl(0) 2546 { 2547 } 2548 2549 PropertyControl::~PropertyControl() 2550 { 2551 if( mpSubControl ) 2552 delete mpSubControl; 2553 } 2554 2555 void PropertyControl::setSubControl( PropertySubControl* pSubControl ) 2556 { 2557 if( mpSubControl && mpSubControl != pSubControl ) 2558 delete mpSubControl; 2559 2560 mpSubControl = pSubControl; 2561 2562 Control* pControl = pSubControl ? pSubControl->getControl() : 0; 2563 2564 if( pControl ) 2565 { 2566 pControl->SetPosSizePixel( GetPosPixel(), GetSizePixel() ); 2567 pControl->SetZOrder( this, WINDOW_ZORDER_BEFOR ); 2568 pControl->Show(); 2569 Hide(); 2570 } 2571 else 2572 { 2573 Show(); 2574 } 2575 } 2576 2577 void PropertyControl::Resize() 2578 { 2579 Control* pControl = mpSubControl ? mpSubControl->getControl() : 0; 2580 if( pControl ) 2581 pControl->SetPosSizePixel( GetPosPixel(), GetSizePixel() ); 2582 ListBox::Resize(); 2583 } 2584 2585 // ==================================================================== 2586 2587 PropertySubControl::~PropertySubControl() 2588 { 2589 } 2590 2591 PropertySubControl* PropertySubControl::create( sal_Int32 nType, Window* pParent, const Any& rValue, const OUString& rPresetId, const Link& rModifyHdl ) 2592 { 2593 PropertySubControl* pSubControl = NULL; 2594 switch( nType ) 2595 { 2596 case nPropertyTypeDirection: 2597 case nPropertyTypeSpokes: 2598 case nPropertyTypeZoom: 2599 pSubControl = new PresetPropertyBox( nType, pParent, rValue, rPresetId, rModifyHdl ); 2600 break; 2601 2602 case nPropertyTypeColor: 2603 case nPropertyTypeFillColor: 2604 case nPropertyTypeFirstColor: 2605 case nPropertyTypeCharColor: 2606 case nPropertyTypeLineColor: 2607 pSubControl = new ColorPropertyBox( nType, pParent, rValue, rModifyHdl ); 2608 break; 2609 2610 case nPropertyTypeFont: 2611 pSubControl = new FontPropertyBox( nType, pParent, rValue, rModifyHdl ); 2612 break; 2613 2614 case nPropertyTypeCharHeight: 2615 pSubControl = new CharHeightPropertyBox( nType, pParent, rValue, rModifyHdl ); 2616 break; 2617 2618 case nPropertyTypeRotate: 2619 pSubControl = new RotationPropertyBox( nType, pParent, rValue, rModifyHdl ); 2620 break; 2621 2622 case nPropertyTypeTransparency: 2623 pSubControl = new TransparencyPropertyBox( nType, pParent, rValue, rModifyHdl ); 2624 break; 2625 2626 case nPropertyTypeScale: 2627 pSubControl = new ScalePropertyBox( nType, pParent, rValue, rModifyHdl ); 2628 break; 2629 2630 case nPropertyTypeCharDecoration: 2631 pSubControl = new FontStylePropertyBox( nType, pParent, rValue, rModifyHdl ); 2632 break; 2633 } 2634 2635 return pSubControl; 2636 } 2637 2638 } 2639