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