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