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