LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/animations - CustomAnimationDialog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1218 0.1 %
Date: 2013-07-09 Functions: 2 115 1.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10