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