LibreOffice Module sd (master) 1
CustomAnimationDialog.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <config_features.h>
21
22#include <com/sun/star/presentation/EffectNodeType.hpp>
23#include <com/sun/star/animations/Timing.hpp>
24#include <com/sun/star/animations/Event.hpp>
25#include <com/sun/star/animations/EventTrigger.hpp>
26#include <com/sun/star/animations/AnimationFill.hpp>
27#include <com/sun/star/presentation/TextAnimationType.hpp>
28#include <com/sun/star/animations/ValuePair.hpp>
29#include <com/sun/star/awt/FontSlant.hpp>
30#include <com/sun/star/awt/FontWeight.hpp>
31#include <com/sun/star/awt/FontUnderline.hpp>
32#include <com/sun/star/drawing/XDrawPage.hpp>
33#include <com/sun/star/beans/XPropertySet.hpp>
34#include <com/sun/star/media/XPlayer.hpp>
35
36#include <memory>
37
38#include <comphelper/lok.hxx>
39#include <i18nutil/unicode.hxx>
40#include <vcl/svapp.hxx>
41#include <vcl/stdtext.hxx>
42#include <vcl/weld.hxx>
43#include <vcl/settings.hxx>
44
45#include <svtools/ctrltool.hxx>
46#include <sfx2/objsh.hxx>
47#include <sfx2/viewsh.hxx>
48#include <tools/debug.hxx>
49#include <tools/urlobj.hxx>
51
52#include <editeng/flstitem.hxx>
53
54#include <svx/colorbox.hxx>
55#include <svx/gallery.hxx>
56
57#include <editeng/editids.hrc>
58#include <sdresid.hxx>
59
62#include "STLPropertySet.hxx"
64
66
67#include <filedlg.hxx>
68#include <strings.hrc>
69#include <helpids.h>
70
71using namespace ::com::sun::star;
72using namespace ::com::sun::star::animations;
73using namespace ::com::sun::star::presentation;
74
75using ::com::sun::star::uno::UNO_QUERY;
76using ::com::sun::star::uno::Any;
77using ::com::sun::star::uno::Sequence;
78using ::com::sun::star::uno::Reference;
79using ::com::sun::star::uno::Exception;
80using ::com::sun::star::drawing::XShape;
81using ::com::sun::star::drawing::XDrawPage;
82using ::com::sun::star::beans::XPropertySet;
83
84namespace sd {
85
87 : mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationfragment.ui",
88 false, reinterpret_cast<sal_uInt64>(SfxViewShell::Current())))
89 , mxContainer(mxBuilder->weld_container("EffectFragment"))
90 , mpParent(pParent)
91{
92}
93
95{
96 mpParent->move(mxContainer.get(), nullptr);
97}
98
99namespace {
100
101class SdPresetPropertyBox : public SdPropertySubControl
102{
103public:
104 SdPresetPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const OUString& aPresetId, const Link<LinkParamNone*,void>& rModifyHdl);
105
106 virtual Any getValue() override;
107 virtual void setValue( const Any& rValue, const OUString& rPresetId ) override;
108
109private:
110 std::vector<OUString> maPropertyValues;
111 Link<LinkParamNone*,void> maModifyLink;
112 std::unique_ptr<weld::ComboBox> mxControl;
113
114 DECL_LINK(OnSelect, weld::ComboBox&, void);
115};
116
117}
118
119SdPresetPropertyBox::SdPresetPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const OUString& aPresetId, const Link<LinkParamNone*,void>& rModifyHdl)
120 : SdPropertySubControl(pParent)
121 , maModifyLink(rModifyHdl)
122 , mxControl(mxBuilder->weld_combo_box("combo"))
123{
124 mxControl->connect_changed(LINK(this, SdPresetPropertyBox, OnSelect));
125 mxControl->set_help_id(HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX);
126 mxControl->show();
127 pLabel->set_mnemonic_widget(mxControl.get());
128 setValue(rValue, aPresetId);
129}
130
131IMPL_LINK_NOARG(SdPresetPropertyBox, OnSelect, weld::ComboBox&, void)
132{
133 maModifyLink.Call(nullptr);
134}
135
136void SdPresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId )
137{
138 if (!mxControl)
139 return;
140
141 mxControl->freeze();
142 mxControl->clear();
143 maPropertyValues.clear();
144 int nPos = -1;
145
146 const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
147 CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId );
148 if( pDescriptor )
149 {
150
151 OUString aPropertyValue;
152 rValue >>= aPropertyValue;
153
154 std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() );
155
156 mxControl->set_sensitive(!aSubTypes.empty());
157
158 for( const auto& aSubType : aSubTypes )
159 {
160 mxControl->append_text(rPresets.getUINameForProperty(aSubType));
161 maPropertyValues.push_back(aSubType);
162 if (aSubType == aPropertyValue)
163 nPos = maPropertyValues.size() - 1;
164 }
165 }
166 else
167 {
168 mxControl->set_sensitive(false);
169 }
170 mxControl->thaw();
171 if (nPos != -1)
172 mxControl->set_active(nPos);
173}
174
175Any SdPresetPropertyBox::getValue()
176{
177 const int nIndex = mxControl->get_active();
178 if (nIndex == -1)
179 return Any();
180 return Any(maPropertyValues[nIndex]);
181}
182
183namespace {
184
185class SdColorPropertyBox : public SdPropertySubControl
186{
187public:
188 SdColorPropertyBox(weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
189
190 virtual Any getValue() override;
191 virtual void setValue( const Any& rValue, const OUString& rPresetId ) override;
192
193private:
194 Link<LinkParamNone*,void> maModifyLink;
195 std::unique_ptr<ColorListBox> mxControl;
196
197 DECL_LINK(OnSelect, ColorListBox&, void);
198};
199
200}
201
202SdColorPropertyBox::SdColorPropertyBox(weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
203 : SdPropertySubControl(pParent)
204 , maModifyLink(rModifyHdl)
205 , mxControl(new ColorListBox(mxBuilder->weld_menu_button("color"), [pTopLevel]{ return pTopLevel; }))
206{
207 mxControl->SetSelectHdl(LINK(this, SdColorPropertyBox, OnSelect));
208 mxControl->set_help_id(HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX);
209 pLabel->set_mnemonic_widget(&mxControl->get_widget());
210 mxControl->show();
211
212 Color nColor;
213 rValue >>= nColor;
214 mxControl->SelectEntry(nColor);
215}
216
217IMPL_LINK_NOARG(SdColorPropertyBox, OnSelect, ColorListBox&, void)
218{
219 maModifyLink.Call(nullptr);
220}
221
222void SdColorPropertyBox::setValue( const Any& rValue, const OUString& )
223{
224 if (mxControl)
225 {
226 Color nColor;
227 rValue >>= nColor;
228
229 mxControl->SetNoSelection();
230 mxControl->SelectEntry(nColor);
231 }
232}
233
234Any SdColorPropertyBox::getValue()
235{
236 return Any(sal_Int32(mxControl->GetSelectEntryColor().GetRGBColor()));
237}
238
239namespace {
240
241class SdFontPropertyBox : public SdPropertySubControl
242{
243public:
244 SdFontPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
245
246 virtual Any getValue() override;
247 virtual void setValue(const Any& rValue, const OUString& rPresetId) override;
248
249private:
251 std::unique_ptr<weld::ComboBox> mxControl;
252
253 DECL_LINK(ControlSelectHdl, weld::ComboBox&, void);
254};
255
256}
257
258SdFontPropertyBox::SdFontPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
259 : SdPropertySubControl(pParent)
260 , maModifyHdl(rModifyHdl)
261 , mxControl(mxBuilder->weld_combo_box("fontname"))
262{
263 mxControl->connect_changed(LINK(this, SdFontPropertyBox, ControlSelectHdl));
264 mxControl->set_help_id(HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX);
265 mxControl->show();
266 pLabel->set_mnemonic_widget(mxControl.get());
267
268 const FontList* pFontList = nullptr;
269 bool bMustDelete = false;
270
272 {
273 auto pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
274 if (pItem)
275 pFontList = static_cast<const SvxFontListItem*>(pItem)->GetFontList();
276 }
277
278 if (!pFontList)
279 {
280 pFontList = new FontList(Application::GetDefaultDevice(), nullptr);
281 bMustDelete = true;
282 }
283
284 mxControl->freeze();
285
286 sal_uInt16 nFontCount = pFontList->GetFontNameCount();
287 for (sal_uInt16 i = 0; i < nFontCount; ++i)
288 {
289 const FontMetric& rFontMetric = pFontList->GetFontName(i);
290 mxControl->append_text(rFontMetric.GetFamilyName());
291 }
292
293 mxControl->thaw();
294
295 if( bMustDelete )
296 delete pFontList;
297
298 setValue( rValue, OUString() );
299}
300
301IMPL_LINK_NOARG(SdFontPropertyBox, ControlSelectHdl, weld::ComboBox&, void)
302{
303 maModifyHdl.Call(nullptr);
304}
305
306void SdFontPropertyBox::setValue( const Any& rValue, const OUString& )
307{
308 if (mxControl)
309 {
310 OUString aFontName;
311 rValue >>= aFontName;
312 mxControl->set_entry_text(aFontName);
313 }
314}
315
316Any SdFontPropertyBox::getValue()
317{
318 OUString aFontName(mxControl->get_active_text());
319 return Any(aFontName);
320}
321
322namespace {
323
324class SdCharHeightPropertyBox : public SdPropertySubControl
325{
326public:
327 SdCharHeightPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
328
329 virtual Any getValue() override;
330 virtual void setValue( const Any& rValue, const OUString& ) override;
331
332 DECL_LINK(implMenuSelectHdl, const OUString& rIdent, void);
333
334private:
336 std::unique_ptr<weld::MetricSpinButton> mxMetric;
337 std::unique_ptr<weld::MenuButton> mxControl;
338
339 DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void);
340};
341
342}
343
344SdCharHeightPropertyBox::SdCharHeightPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
345 : SdPropertySubControl(pParent)
346 , maModifyHdl(rModifyHdl)
347 , mxMetric(mxBuilder->weld_metric_spin_button("fontsize", FieldUnit::PERCENT))
348 , mxControl(mxBuilder->weld_menu_button("fontsizemenu"))
349{
350 mxMetric->connect_value_changed(LINK(this, SdCharHeightPropertyBox, EditModifyHdl));
352 mxMetric->show();
353 pLabel->set_mnemonic_widget(&mxMetric->get_widget());
354
355 mxControl->connect_selected(LINK(this, SdCharHeightPropertyBox, implMenuSelectHdl));
357 mxControl->show();
358
359 setValue(rValue, OUString());
360}
361
362IMPL_LINK_NOARG(SdCharHeightPropertyBox, EditModifyHdl, weld::MetricSpinButton&, void)
363{
364 maModifyHdl.Call(nullptr);
365}
366
367IMPL_LINK(SdCharHeightPropertyBox, implMenuSelectHdl, const OUString&, rIdent, void)
368{
369 sal_Int32 nValue = rIdent.toInt32();
370 mxMetric->set_value(nValue, FieldUnit::PERCENT);
371 EditModifyHdl(*mxMetric);
372}
373
374void SdCharHeightPropertyBox::setValue( const Any& rValue, const OUString& )
375{
376 if (mxMetric)
377 {
378 double fValue = 0.0;
379 rValue >>= fValue;
380 mxMetric->set_value(static_cast<::tools::Long>(fValue * 100.0), FieldUnit::PERCENT);
381 }
382}
383
384Any SdCharHeightPropertyBox::getValue()
385{
386 return Any(static_cast<double>(mxMetric->get_value(FieldUnit::PERCENT)) / 100.0);
387}
388
389namespace {
390
391class SdTransparencyPropertyBox : public SdPropertySubControl
392{
393public:
394 SdTransparencyPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
395
396 virtual Any getValue() override;
397 virtual void setValue( const Any& rValue, const OUString& rPresetId ) override;
398
399 DECL_LINK(implMenuSelectHdl, const OUString&, void);
400 DECL_LINK(implModifyHdl, weld::MetricSpinButton&, void);
401
402 void updateMenu();
403
404private:
406
407 std::unique_ptr<weld::MetricSpinButton> mxMetric;
408 std::unique_ptr<weld::MenuButton> mxControl;
409};
410
411}
412
413SdTransparencyPropertyBox::SdTransparencyPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
414 : SdPropertySubControl(pParent)
415 , maModifyHdl(rModifyHdl)
416 , mxMetric(mxBuilder->weld_metric_spin_button("transparent", FieldUnit::PERCENT))
417 , mxControl(mxBuilder->weld_menu_button("transparentmenu"))
418{
419 for (sal_Int32 i = 25; i < 101; i += 25)
420 {
421 OUString aStr(unicode::formatPercent(i,
422 Application::GetSettings().GetUILanguageTag()));
423 mxControl->append_item_check(OUString::number(i), aStr);
424 }
425
426 mxControl->connect_selected(LINK(this, SdTransparencyPropertyBox, implMenuSelectHdl));
428 mxControl->show();
429
430 mxMetric->connect_value_changed(LINK(this, SdTransparencyPropertyBox, implModifyHdl));
432 mxMetric->show();
433 pLabel->set_mnemonic_widget(&mxMetric->get_widget());
434
435 setValue(rValue, OUString());
436}
437
438void SdTransparencyPropertyBox::updateMenu()
439{
440 sal_Int64 nValue = mxMetric->get_value(FieldUnit::PERCENT);
441 for (sal_uInt16 i = 25; i < 101; i += 25)
442 mxControl->set_item_active(OUString::number(i), nValue == i);
443}
444
445IMPL_LINK_NOARG(SdTransparencyPropertyBox, implModifyHdl, weld::MetricSpinButton&, void)
446{
447 updateMenu();
448 maModifyHdl.Call(nullptr);
449}
450
451IMPL_LINK(SdTransparencyPropertyBox, implMenuSelectHdl, const OUString&, rIdent, void)
452{
453 auto nValue = rIdent.toInt32();
454 if (nValue != mxMetric->get_value(FieldUnit::PERCENT))
455 {
456 mxMetric->set_value(nValue, FieldUnit::PERCENT);
457 implModifyHdl(*mxMetric);
458 }
459}
460
461void SdTransparencyPropertyBox::setValue(const Any& rValue, const OUString&)
462{
463 if (mxMetric)
464 {
465 double fValue = 0.0;
466 rValue >>= fValue;
467 ::tools::Long nValue = static_cast<::tools::Long>(fValue * 100);
468 mxMetric->set_value(nValue, FieldUnit::PERCENT);
469 updateMenu();
470 }
471}
472
473Any SdTransparencyPropertyBox::getValue()
474{
475 return Any(static_cast<double>(mxMetric->get_value(FieldUnit::PERCENT)) / 100.0);
476}
477
478namespace {
479
480class SdRotationPropertyBox : public SdPropertySubControl
481{
482public:
483 SdRotationPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
484
485 virtual Any getValue() override;
486 virtual void setValue( const Any& rValue, const OUString& ) override;
487
488 DECL_LINK(implMenuSelectHdl, const OUString&, void);
489 DECL_LINK(implModifyHdl, weld::MetricSpinButton&, void);
490
491 void updateMenu();
492
493private:
495
496 std::unique_ptr<weld::MetricSpinButton> mxMetric;
497 std::unique_ptr<weld::MenuButton> mxControl;
498};
499
500}
501
502SdRotationPropertyBox::SdRotationPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
503 : SdPropertySubControl(pParent)
504 , maModifyHdl(rModifyHdl)
505 , mxMetric(mxBuilder->weld_metric_spin_button("rotate", FieldUnit::DEGREE))
506 , mxControl(mxBuilder->weld_menu_button("rotatemenu"))
507{
508 mxMetric->connect_value_changed(LINK( this, SdRotationPropertyBox, implModifyHdl));
510 mxMetric->show();
511 pLabel->set_mnemonic_widget(&mxMetric->get_widget());
512
513 mxControl->connect_selected(LINK(this, SdRotationPropertyBox, implMenuSelectHdl));
515 mxControl->show();
516
517 setValue(rValue, OUString());
518}
519
520void SdRotationPropertyBox::updateMenu()
521{
522 sal_Int64 nValue = mxMetric->get_value(FieldUnit::DEGREE);
523 bool bDirection = nValue >= 0;
524 nValue = (nValue < 0 ? -nValue : nValue);
525
526 mxControl->set_item_active("90", nValue == 90);
527 mxControl->set_item_active("180", nValue == 180);
528 mxControl->set_item_active("360", nValue == 360);
529 mxControl->set_item_active("720", nValue == 720);
530
531 mxControl->set_item_active("closewise", bDirection);
532 mxControl->set_item_active("counterclock", !bDirection);
533}
534
535IMPL_LINK_NOARG(SdRotationPropertyBox, implModifyHdl, weld::MetricSpinButton&, void)
536{
537 updateMenu();
538 maModifyHdl.Call(nullptr);
539}
540
541IMPL_LINK(SdRotationPropertyBox, implMenuSelectHdl, const OUString&, rIdent, void)
542{
543 auto nValue = mxMetric->get_value(FieldUnit::DEGREE);
544 bool bDirection = nValue >= 0;
545 nValue = (nValue < 0 ? -nValue : nValue);
546
547 if (rIdent == "clockwise")
548 bDirection = true;
549 else if (rIdent == "counterclock")
550 bDirection = false;
551 else
552 nValue = rIdent.toInt32();
553
554 if( !bDirection )
555 nValue = -nValue;
556
557 if (nValue != mxMetric->get_value(FieldUnit::DEGREE))
558 {
559 mxMetric->set_value(nValue, FieldUnit::DEGREE);
560 implModifyHdl(*mxMetric);
561 }
562}
563
564void SdRotationPropertyBox::setValue( const Any& rValue, const OUString& )
565{
566 if (mxMetric)
567 {
568 double fValue = 0.0;
569 rValue >>= fValue;
570 ::tools::Long nValue = static_cast<::tools::Long>(fValue);
571 mxMetric->set_value(nValue, FieldUnit::DEGREE);
572 updateMenu();
573 }
574}
575
576Any SdRotationPropertyBox::getValue()
577{
578 return Any(static_cast<double>(mxMetric->get_value(FieldUnit::DEGREE)));
579}
580
581namespace {
582
583class SdScalePropertyBox : public SdPropertySubControl
584{
585public:
586 SdScalePropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
587
588 virtual Any getValue() override;
589 virtual void setValue( const Any& rValue, const OUString& ) override;
590
591 DECL_LINK(implMenuSelectHdl, const OUString&, void);
592 DECL_LINK(implModifyHdl, weld::MetricSpinButton&, void);
593
594 void updateMenu();
595
596private:
598 int mnDirection;
599
600 std::unique_ptr<weld::MetricSpinButton> mxMetric;
601 std::unique_ptr<weld::MenuButton> mxControl;
602};
603
604}
605
606SdScalePropertyBox::SdScalePropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl)
607 : SdPropertySubControl(pParent)
608 , maModifyHdl( rModifyHdl )
609 , mxMetric(mxBuilder->weld_metric_spin_button("scale", FieldUnit::PERCENT))
610 , mxControl(mxBuilder->weld_menu_button("scalemenu"))
611{
612 mxControl->connect_selected(LINK(this, SdScalePropertyBox, implMenuSelectHdl));
613 mxControl->set_help_id(HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX);
614 mxControl->show();
615
616 mxMetric->connect_value_changed(LINK(this, SdScalePropertyBox, implModifyHdl));
617 mxMetric->set_help_id(HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX);
618 mxMetric->show();
619 pLabel->set_mnemonic_widget(&mxMetric->get_widget());
620
621 setValue(rValue, OUString());
622}
623
624void SdScalePropertyBox::updateMenu()
625{
626 auto nValue = mxMetric->get_value(FieldUnit::PERCENT);
627
628 mxControl->set_item_active("25scale", nValue == 25);
629 mxControl->set_item_active("50scale", nValue == 50);
630 mxControl->set_item_active("150scale", nValue == 150);
631 mxControl->set_item_active("400scale", nValue == 400);
632
633 mxControl->set_item_active("hori", mnDirection == 1);
634 mxControl->set_item_active("vert", mnDirection == 2);
635 mxControl->set_item_active("both", mnDirection == 3);
636}
637
638IMPL_LINK_NOARG(SdScalePropertyBox, implModifyHdl, weld::MetricSpinButton&, void)
639{
640 updateMenu();
641 maModifyHdl.Call(nullptr);
642}
643
644IMPL_LINK(SdScalePropertyBox, implMenuSelectHdl, const OUString&, rIdent, void)
645{
646 auto nValue = mxMetric->get_value(FieldUnit::PERCENT);
647
648 int nDirection = mnDirection;
649
650 if (rIdent == "hori")
651 nDirection = 1;
652 else if (rIdent == "vert")
653 nDirection = 2;
654 else if (rIdent == "both")
655 nDirection = 3;
656 else
657 nValue = rIdent.toInt32(); // Getting here indicates a UI bug and should be handled better
658
659 bool bModified = false;
660
661 if( nDirection != mnDirection )
662 {
663 mnDirection = nDirection;
664 bModified = true;
665 }
666
667 if (nValue != mxMetric->get_value(FieldUnit::PERCENT))
668 {
669 mxMetric->set_value(nValue, FieldUnit::PERCENT);
670 bModified = true;
671 }
672
673 if(bModified)
674 {
675 implModifyHdl(*mxMetric);
676 updateMenu();
677 }
678}
679
680void SdScalePropertyBox::setValue(const Any& rValue, const OUString&)
681{
682 if (!mxMetric)
683 return;
684
685 ValuePair aValues;
686 rValue >>= aValues;
687
688 double fValue1 = 0.0;
689 double fValue2 = 0.0;
690
691 aValues.First >>= fValue1;
692 aValues.Second >>= fValue2;
693
694 // 'Size' drop down menu set by mnDirection when loading Grow and Shrink Animation
695 // Shouldn't compare a float directly to zero... should be fixed with delta epsilon compare
696 // Might be better to just have a flag in the content.xml for this
697 if( (fValue1 == 0.0) && (fValue2 == 0.0) )
698 mnDirection = 3; // assume 'Both' scaling option when both are zero
699 else if( (fValue1 != 0.0) && (fValue2 == 0.0) )
700 mnDirection = 1;
701 else if( (fValue1 == 0.0) && (fValue2 != 0.0) )
702 mnDirection = 2;
703 else
704 mnDirection = 3;
705
706 // Grow and Shrink Animation is a relative change with value stored in content.xml under tag
707 // smil:by=*,*
708 // An offset of 1 must be added to properly translate from content.xml to UI value displayed
709 // e.g. if in content.xml smil:by=0.5,0.5 then 1 + (0.5,0.5) = (1.5,1.5) => grow by 150% of the
710 // size horizontal and vertical
711 // e.g. if in content.xml smil:by=-0.5,-0.5 then 1 + (-0.5,-0.5) = (0.5,0.5) => shrink by 50%
712 // of the size horizontal and vertical
713 fValue1 += 1;
714 fValue2 += 1;
715
716 // Determine value from file for UI 'Size' field based on determined mnDirection
718 if( mnDirection == 1 )
719 nValue = static_cast<::tools::Long>(fValue1 * 100.0);
720 else if( mnDirection == 2 )
721 nValue = static_cast<::tools::Long>(fValue2 * 100.0);
722 else if( mnDirection == 3 ){
723 if (fValue1 >= fValue2)
724 nValue = static_cast<::tools::Long>(fValue1 * 100.0);
725 else
726 nValue = static_cast<::tools::Long>(fValue2 * 100.0);
727 }
728 else
729 nValue = static_cast<::tools::Long>(100.0); // default to 100% in UI if something goes wrong
730
731 mxMetric->set_value(nValue, FieldUnit::PERCENT);
732 updateMenu();
733}
734
735Any SdScalePropertyBox::getValue()
736{
737 double fValue1 = static_cast<double>(mxMetric->get_value(FieldUnit::PERCENT)) / 100.0;
738
739 // Grow and Shrink Animation is a relative change with value stored in content.xml under tag
740 // smil:by=*,*
741 // An offset of 1 must be subtracted to properly translate UI value displayed and save to
742 // content.xml
743 // e.g. if UI value is 150% then 1.5 - 1 = 0.5 and is set to smil:by=0.5,0.5 in content.xml
744 // e.g. if UI value is 50% then 0.5 - 1 = -0.5 and is set to smil:by=-0.5,-0.5 in content.xml
745 fValue1 -= 1;
746
747 double fValue2 = fValue1;
748
749 // mnDirection set by 'Size' drop down menu and used to zero out either horizontal or vertical
750 // scaling depending on what option is selected
751 if( mnDirection == 1 )
752 fValue2 = 0.0;
753 else if( mnDirection == 2 )
754 fValue1 = 0.0;
755
756 ValuePair aValues;
757 aValues.First <<= fValue1;
758 aValues.Second <<= fValue2;
759
760 return Any( aValues );
761}
762
763namespace {
764
765class SdFontStylePropertyBox : public SdPropertySubControl
766{
767public:
768 SdFontStylePropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl);
769
770 virtual Any getValue() override;
771 virtual void setValue( const Any& rValue, const OUString& ) override;
772
773 DECL_LINK(implMenuSelectHdl, const OUString&, void);
774
775 void update();
776
777private:
778 float mfFontWeight;
779 awt::FontSlant meFontSlant;
780 sal_Int16 mnFontUnderline;
782
783 std::unique_ptr<weld::Entry> mxEdit;
784 std::unique_ptr<weld::MenuButton> mxControl;
785};
786
787}
788
789SdFontStylePropertyBox::SdFontStylePropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl )
790 : SdPropertySubControl(pParent)
791 , maModifyHdl( rModifyHdl )
792 , mxEdit(mxBuilder->weld_entry("entry"))
793 , mxControl(mxBuilder->weld_menu_button("entrymenu"))
794{
795 mxEdit->set_text(SdResId(STR_CUSTOMANIMATION_SAMPLE));
797 pLabel->set_mnemonic_widget(mxEdit.get());
798 mxEdit->show();
799
800 mxControl->connect_selected(LINK(this, SdFontStylePropertyBox, implMenuSelectHdl));
802 mxControl->show();
803
804 setValue(rValue, OUString());
805}
806
807void SdFontStylePropertyBox::update()
808{
809 // update menu
810 mxControl->set_item_active("bold", mfFontWeight == awt::FontWeight::BOLD);
811 mxControl->set_item_active("italic", meFontSlant == awt::FontSlant_ITALIC);
812 mxControl->set_item_active("underline", mnFontUnderline != awt::FontUnderline::NONE );
813
814 // update sample edit
815 vcl::Font aFont(mxEdit->get_font());
816 aFont.SetWeight(mfFontWeight == awt::FontWeight::BOLD ? WEIGHT_BOLD : WEIGHT_NORMAL);
817 aFont.SetItalic(meFontSlant == awt::FontSlant_ITALIC ? ITALIC_NORMAL : ITALIC_NONE);
818 aFont.SetUnderline(mnFontUnderline == awt::FontUnderline::NONE ? LINESTYLE_NONE : LINESTYLE_SINGLE);
819 mxEdit->set_font(aFont);
820}
821
822IMPL_LINK(SdFontStylePropertyBox, implMenuSelectHdl, const OUString&, rIdent, void)
823{
824 if (rIdent == "bold")
825 {
826 if( mfFontWeight == awt::FontWeight::BOLD )
827 mfFontWeight = awt::FontWeight::NORMAL;
828 else
829 mfFontWeight = awt::FontWeight::BOLD;
830 }
831 else if (rIdent == "italic")
832 {
833 if( meFontSlant == awt::FontSlant_ITALIC )
834 meFontSlant = awt::FontSlant_NONE;
835 else
836 meFontSlant = awt::FontSlant_ITALIC;
837 }
838 else if (rIdent == "underline")
839 {
840 if( mnFontUnderline == awt::FontUnderline::SINGLE )
841 mnFontUnderline = awt::FontUnderline::NONE;
842 else
843 mnFontUnderline = awt::FontUnderline::SINGLE;
844 }
845
846 update();
847 maModifyHdl.Call(nullptr);
848}
849
850void SdFontStylePropertyBox::setValue( const Any& rValue, const OUString& )
851{
852 Sequence<Any> aValues;
853 rValue >>= aValues;
854
855 aValues[0] >>= mfFontWeight;
856 aValues[1] >>= meFontSlant;
857 aValues[2] >>= mnFontUnderline;
858
859 update();
860}
861
862Any SdFontStylePropertyBox::getValue()
863{
864 Sequence<Any> aValues{ Any(mfFontWeight), Any(meFontSlant), Any(mnFontUnderline) };
865 return Any( aValues );
866}
867
869{
870public:
872
873 void update( STLPropertySet* pSet );
874 DECL_LINK(implSelectHdl, weld::ComboBox&, void);
875 DECL_LINK(implClickHdl, weld::Button&, void);
876 void implHdl(const weld::Widget*);
877
878private:
879 void updateControlStates();
880 void fillSoundListBox();
881 void clearSoundListBox();
882 sal_Int32 getSoundObject( std::u16string_view rStr );
883 void openSoundFileDialog();
884 void onSoundPreview();
885 weld::Window* GetFrameWeld() const { return mpDialog; }
886
887private:
888 ::std::vector< OUString > maSoundList;
891 css::uno::Reference<css::media::XPlayer> mxPlayer;
892
894 std::unique_ptr<weld::Builder> mxBuilder;
895 std::unique_ptr<weld::Container> mxContainer;
896 std::unique_ptr<weld::Widget> mxSettings;
897 std::unique_ptr<weld::Label> mxFTProperty1;
898 std::unique_ptr<weld::Container> mxPlaceholderBox;
899 std::unique_ptr<weld::CheckButton> mxCBSmoothStart;
900 std::unique_ptr<weld::CheckButton> mxCBSmoothEnd;
901 std::unique_ptr<weld::Label> mxFTSound;
902 std::unique_ptr<weld::ComboBox> mxLBSound;
903 std::unique_ptr<weld::Button> mxPBSoundPreview;
904 std::unique_ptr<weld::ComboBox> mxLBAfterEffect;
905 std::unique_ptr<weld::Label> mxFTDimColor;
906 std::unique_ptr<ColorListBox> mxCLBDimColor;
907 std::unique_ptr<weld::Label> mxFTTextAnim;
908 std::unique_ptr<weld::ComboBox> mxLBTextAnim;
909 std::unique_ptr<weld::MetricSpinButton> mxMFTextDelay;
910 std::unique_ptr<weld::Label> mxFTTextDelay;
911 std::unique_ptr<SdPropertySubControl> mxLBSubControl;
912};
913
914CustomAnimationEffectTabPage::CustomAnimationEffectTabPage(weld::Container* pParent, weld::Window* pDialog, const STLPropertySet* pSet)
915 : mbHasText(false)
916 , mpSet(pSet)
917 , mpDialog(pDialog)
918 , mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationeffecttab.ui"))
919 , mxContainer(mxBuilder->weld_container("EffectTab"))
920 , mxSettings(mxBuilder->weld_widget("settings"))
921 , mxFTProperty1(mxBuilder->weld_label("prop_label1"))
922 , mxPlaceholderBox(mxBuilder->weld_container("placeholder"))
923 , mxCBSmoothStart(mxBuilder->weld_check_button("smooth_start"))
924 , mxCBSmoothEnd(mxBuilder->weld_check_button("smooth_end"))
925 , mxFTSound(mxBuilder->weld_label("sound_label"))
926 , mxLBSound(mxBuilder->weld_combo_box("sound_list"))
927 , mxPBSoundPreview(mxBuilder->weld_button("sound_preview"))
928 , mxLBAfterEffect(mxBuilder->weld_combo_box("aeffect_list"))
929 , mxFTDimColor(mxBuilder->weld_label("dim_color_label"))
930 , mxCLBDimColor(new ColorListBox(mxBuilder->weld_menu_button("dim_color_list"), [pDialog]{ return pDialog; }))
931 , mxFTTextAnim(mxBuilder->weld_label("text_animation_label"))
932 , mxLBTextAnim(mxBuilder->weld_combo_box("text_animation_list"))
933 , mxMFTextDelay(mxBuilder->weld_metric_spin_button("text_delay", FieldUnit::PERCENT))
934 , mxFTTextDelay(mxBuilder->weld_label("text_delay_label"))
935{
936 mxCLBDimColor->SelectEntry(COL_BLACK);
937
938 // fill the soundbox
939 fillSoundListBox();
940
941 mxLBSound->connect_changed(LINK(this, CustomAnimationEffectTabPage, implSelectHdl));
942 mxPBSoundPreview->connect_clicked(LINK(this, CustomAnimationEffectTabPage, implClickHdl));
943
944 // only show settings if all selected effects have the same preset-id
945 if( pSet->getPropertyState( nHandlePresetId ) != STLPropertyState::Ambiguous )
946 {
947 OUString aPresetId;
948 pSet->getPropertyValue( nHandlePresetId ) >>= aPresetId;
949
950 // property 1
951
952 if( pSet->getPropertyState( nHandleProperty1Type ) != STLPropertyState::Ambiguous )
953 {
954 sal_Int32 nType = 0;
955 pSet->getPropertyValue( nHandleProperty1Type ) >>= nType;
956
957 if( nType != nPropertyTypeNone )
958 {
959 // set ui name for property at fixed text
960 OUString aPropertyName( getPropertyName( nType ) );
961
962 if( !aPropertyName.isEmpty() )
963 {
964 mxSettings->show();
965 mxFTProperty1->set_label(aPropertyName);
966 }
967
968 // get property value
969 const Any aValue( pSet->getPropertyValue( nHandleProperty1Value ) );
970
971 // create property sub control
972 mxLBSubControl = SdPropertySubControl::create(nType, mxFTProperty1.get(), mxPlaceholderBox.get(), mpDialog, aValue, aPresetId, Link<LinkParamNone*,void>());
973 }
974 }
975
976 mxFTProperty1->set_sensitive(mxPlaceholderBox->get_sensitive());
977
978 // accelerate & decelerate
979
980 if( pSet->getPropertyState( nHandleAccelerate ) == STLPropertyState::Direct )
981 {
982 mxCBSmoothStart->show();
983 mxCBSmoothEnd->show();
984
985 double fTemp = 0.0;
986 pSet->getPropertyValue( nHandleAccelerate ) >>= fTemp;
987 mxCBSmoothStart->set_active( fTemp > 0.0 );
988
989 pSet->getPropertyValue( nHandleDecelerate ) >>= fTemp;
990 mxCBSmoothEnd->set_active( fTemp > 0.0 );
991 }
992 }
993
994 // init after effect controls
995
996 mxLBAfterEffect->connect_changed(LINK(this, CustomAnimationEffectTabPage, implSelectHdl));
997 mxLBTextAnim->connect_changed(LINK(this, CustomAnimationEffectTabPage, implSelectHdl));
998
999 if( (pSet->getPropertyState( nHandleHasAfterEffect ) != STLPropertyState::Ambiguous) &&
1000 (pSet->getPropertyState( nHandleAfterEffectOnNextEffect ) != STLPropertyState::Ambiguous) &&
1001 (pSet->getPropertyState( nHandleDimColor ) != STLPropertyState::Ambiguous))
1002 {
1003 bool bHasAfterEffect = false;
1004 pSet->getPropertyValue( nHandleHasAfterEffect ) >>= bHasAfterEffect;
1005
1006 sal_Int32 nPos = 0;
1007 if( bHasAfterEffect )
1008 {
1009 nPos++;
1010
1011 bool bAfterEffectOnNextClick = false;
1012 pSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextClick;
1013 Any aDimColor( pSet->getPropertyValue( nHandleDimColor ) );
1014
1015 if( aDimColor.hasValue() )
1016 {
1017 Color aColor;
1018 aDimColor >>= aColor;
1019 mxCLBDimColor->SelectEntry(aColor);
1020 }
1021 else
1022 {
1023 nPos++;
1024 if( bAfterEffectOnNextClick )
1025 nPos++;
1026 }
1027 }
1028
1029 mxLBAfterEffect->set_active(nPos);
1030 }
1031
1032 if( pSet->getPropertyState( nHandleHasText ) != STLPropertyState::Ambiguous )
1033 pSet->getPropertyValue( nHandleHasText ) >>= mbHasText;
1034
1035 if( mbHasText )
1036 {
1037 if( pSet->getPropertyState( nHandleIterateType ) != STLPropertyState::Ambiguous)
1038 {
1039 int nPos = -1;
1040
1041 sal_Int32 nIterateType = 0;
1042 pSet->getPropertyValue( nHandleIterateType ) >>= nIterateType;
1043 switch( nIterateType )
1044 {
1045 case TextAnimationType::BY_PARAGRAPH: nPos = 0; break;
1046 case TextAnimationType::BY_WORD: nPos = 1; break;
1047 case TextAnimationType::BY_LETTER: nPos = 2; break;
1048 }
1049
1050 mxLBTextAnim->set_active(nPos);
1051 }
1052
1053 if( pSet->getPropertyState( nHandleIterateInterval ) != STLPropertyState::Default )
1054 {
1055 double fIterateInterval = 0.0;
1056 pSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval;
1057 mxMFTextDelay->set_value(static_cast<::tools::Long>(fIterateInterval*10), FieldUnit::NONE);
1058 }
1059 }
1060 else
1061 {
1062 mxFTTextAnim->set_sensitive(false);
1063 mxLBTextAnim->set_sensitive(false);
1064 mxMFTextDelay->set_sensitive(false);
1065 mxFTTextDelay->set_sensitive(false);
1066
1067 }
1068
1069 if( pSet->getPropertyState( nHandleSoundURL ) != STLPropertyState::Ambiguous )
1070 {
1071 sal_Int32 nPos = 0;
1072
1073 const Any aValue( pSet->getPropertyValue( nHandleSoundURL ) );
1074
1075 if( aValue.getValueType() == ::cppu::UnoType<sal_Bool>::get() )
1076 {
1077 nPos = 1;
1078 }
1079 else
1080 {
1081 OUString aSoundURL;
1082 aValue >>= aSoundURL;
1083
1084 if( !aSoundURL.isEmpty() )
1085 {
1086 sal_uLong i;
1087 for( i = 0; i < maSoundList.size(); i++ )
1088 {
1089 OUString aString = maSoundList[ i ];
1090 if( aString == aSoundURL )
1091 {
1092 nPos = static_cast<sal_Int32>(i)+2;
1093 break;
1094 }
1095 }
1096
1097 if( nPos == 0 )
1098 {
1099 nPos = static_cast<sal_Int32>(maSoundList.size())+2;
1100 maSoundList.push_back( aSoundURL );
1101 INetURLObject aURL( aSoundURL );
1102 mxLBSound->insert_text(nPos, aURL.GetBase());
1103 }
1104 }
1105 }
1106
1107 if( nPos != -1)
1108 mxLBSound->set_active(nPos);
1109 }
1110
1111 updateControlStates();
1112
1113}
1114
1116{
1117 auto nPos = mxLBAfterEffect->get_active();
1118 mxCLBDimColor->set_sensitive( nPos == 1 );
1119 mxFTDimColor->set_sensitive( nPos == 1 );
1120
1121 if( mbHasText )
1122 {
1123 nPos = mxLBTextAnim->get_active();
1124 mxMFTextDelay->set_sensitive( nPos != 0 );
1125 mxFTTextDelay->set_sensitive( nPos != 0 );
1126 }
1127
1129 {
1130 mxFTSound->hide();
1131 mxLBSound->hide();
1132 mxPBSoundPreview->hide();
1133 }
1134 else
1135 {
1136 nPos = mxLBSound->get_active();
1137 mxPBSoundPreview->set_sensitive( nPos >= 2 );
1138 }
1139
1140}
1141
1143{
1144 implHdl(&rBtn);
1145}
1146
1148{
1149 implHdl(&rListBox);
1150}
1151
1153{
1154 if (pControl == mxLBTextAnim.get())
1155 {
1156 if (mxMFTextDelay->get_value(FieldUnit::NONE) == 0)
1157 mxMFTextDelay->set_value(100, FieldUnit::NONE);
1158 }
1159 else if (pControl == mxLBSound.get())
1160 {
1161 auto nPos = mxLBSound->get_active();
1162 if (nPos == (mxLBSound->get_count() - 1))
1163 {
1165 }
1166 }
1167 else if (pControl == mxPBSoundPreview.get())
1168 {
1170 }
1171
1173}
1174
1176{
1177 if (mxLBSubControl)
1178 {
1179 Any aNewValue(mxLBSubControl->getValue());
1180 Any aOldValue;
1183
1184 if( aOldValue != aNewValue )
1185 pSet->setPropertyValue( nHandleProperty1Value, aNewValue );
1186 }
1187
1188 if (mxCBSmoothStart->get_visible())
1189 {
1190 // set selected value for accelerate if different than in original set
1191
1192 double fTemp = mxCBSmoothStart->get_active() ? 0.5 : 0.0;
1193
1194 double fOldTemp = 0.0;
1196 mpSet->getPropertyValue( nHandleAccelerate ) >>= fOldTemp;
1197 else
1198 fOldTemp = -2.0;
1199
1200 if( fOldTemp != fTemp )
1201 pSet->setPropertyValue( nHandleAccelerate, Any( fTemp ) );
1202
1203 // set selected value for decelerate if different than in original set
1204 fTemp = mxCBSmoothEnd->get_active() ? 0.5 : 0.0;
1205
1207 mpSet->getPropertyValue( nHandleDecelerate ) >>= fOldTemp;
1208 else
1209 fOldTemp = -2.0;
1210
1211 if( fOldTemp != fTemp )
1212 pSet->setPropertyValue( nHandleDecelerate, Any( fTemp ) );
1213 }
1214
1215 auto nPos = mxLBAfterEffect->get_active();
1216 if (nPos != -1)
1217 {
1218 bool bAfterEffect = nPos != 0;
1219
1220 bool bOldAfterEffect = false;
1221
1223 mpSet->getPropertyValue( nHandleHasAfterEffect ) >>= bOldAfterEffect;
1224 else
1225 bOldAfterEffect = !bAfterEffect;
1226
1227 if( bOldAfterEffect != bAfterEffect )
1228 pSet->setPropertyValue( nHandleHasAfterEffect, Any( bAfterEffect ) );
1229
1230 Any aDimColor;
1231 if( nPos == 1 )
1232 {
1233 Color aSelectedColor = mxCLBDimColor->GetSelectEntryColor();
1234 aDimColor <<= aSelectedColor.GetRGBColor();
1235 }
1236
1238 (mpSet->getPropertyValue( nHandleDimColor ) != aDimColor) )
1239 pSet->setPropertyValue( nHandleDimColor, aDimColor );
1240
1241 bool bAfterEffectOnNextEffect = nPos != 2;
1242 bool bOldAfterEffectOnNextEffect = !bAfterEffectOnNextEffect;
1243
1245 mpSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bOldAfterEffectOnNextEffect;
1246
1247 if( bAfterEffectOnNextEffect != bOldAfterEffectOnNextEffect )
1248 pSet->setPropertyValue( nHandleAfterEffectOnNextEffect, Any( bAfterEffectOnNextEffect ) );
1249 }
1250
1251 nPos = mxLBTextAnim->get_active();
1252 if (nPos != -1)
1253 {
1254 sal_Int16 nIterateType;
1255
1256 switch( nPos )
1257 {
1258 case 1: nIterateType = TextAnimationType::BY_WORD; break;
1259 case 2: nIterateType = TextAnimationType::BY_LETTER; break;
1260 default:
1261 nIterateType = TextAnimationType::BY_PARAGRAPH;
1262 }
1263
1264 sal_Int16 nOldIterateType = nIterateType-1;
1265
1267 mpSet->getPropertyValue( nHandleIterateType ) >>= nOldIterateType;
1268
1269 if( nIterateType != nOldIterateType )
1270 pSet->setPropertyValue( nHandleIterateType, Any( nIterateType ) );
1271 }
1272
1273 {
1274 double fIterateInterval = static_cast<double>(mxMFTextDelay->get_value(FieldUnit::NONE)) / 10;
1275 double fOldIterateInterval = -1.0;
1276
1278 mpSet->getPropertyValue( nHandleIterateInterval ) >>= fOldIterateInterval;
1279
1280 if( fIterateInterval != fOldIterateInterval )
1281 pSet->setPropertyValue( nHandleIterateInterval, Any( fIterateInterval ) );
1282 }
1283
1284 nPos = mxLBSound->get_active();
1285 if (nPos == -1)
1286 return;
1287
1288 Any aNewSoundURL, aOldSoundURL( Any( sal_Int32(0) ) );
1289
1290 if( nPos == 0 )
1291 {
1292 // 0 means no sound, so leave any empty
1293 }
1294 else if( nPos == 1 )
1295 {
1296 // this means stop sound
1297 aNewSoundURL <<= true;
1298 }
1299 else
1300 {
1301 OUString aSoundURL( maSoundList[ nPos-2 ] );
1302 aNewSoundURL <<= aSoundURL;
1303 }
1304
1306 aOldSoundURL = mpSet->getPropertyValue( nHandleSoundURL );
1307
1308 if( aNewSoundURL != aOldSoundURL )
1309 pSet->setPropertyValue( nHandleSoundURL, aNewSoundURL );
1310}
1311
1313{
1316
1317 mxLBSound->append_text( SdResId(STR_CUSTOMANIMATION_NO_SOUND) );
1318 mxLBSound->append_text( SdResId(STR_CUSTOMANIMATION_STOP_PREVIOUS_SOUND) );
1319 for(const OUString & rString : maSoundList)
1320 {
1321 INetURLObject aURL( rString );
1322 mxLBSound->append_text( aURL.GetBase() );
1323 }
1324 mxLBSound->append_text( SdResId(STR_CUSTOMANIMATION_BROWSE_SOUND) );
1325}
1326
1328{
1329 maSoundList.clear();
1330 mxLBSound->clear();
1331}
1332
1333sal_Int32 CustomAnimationEffectTabPage::getSoundObject( std::u16string_view rStr )
1334{
1335 size_t i;
1336 const size_t nCount = maSoundList.size();
1337 for( i = 0; i < nCount; i++ )
1338 {
1339 if( maSoundList[ i ].equalsIgnoreAsciiCase(rStr) )
1340 return i+2;
1341 }
1342
1343 return -1;
1344}
1345
1347{
1348 SdOpenSoundFileDialog aFileDialog(GetFrameWeld());
1349
1350 bool bValidSoundFile = false;
1351 bool bQuitLoop = false;
1352 ::tools::Long nPos = 0;
1353
1354 while( !bQuitLoop && (aFileDialog.Execute() == ERRCODE_NONE) )
1355 {
1356 OUString aFile = aFileDialog.GetPath();
1357 nPos = getSoundObject( aFile );
1358
1359 if( nPos < 0 ) // not in Soundliste
1360 {
1361 // try to insert in Gallery
1363 {
1366
1367 nPos = getSoundObject( aFile );
1368 DBG_ASSERT( nPos >= 0, "sd::CustomAnimationEffectTabPage::openSoundFileDialog(), Recently inserted sound not in list!" );
1369
1370 bValidSoundFile=true;
1371 bQuitLoop=true;
1372 }
1373 else
1374 {
1375 OUString aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE));
1376 aStrWarning = aStrWarning.replaceFirst("%", aFile);
1377 std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(nullptr,
1378 VclMessageType::Warning, VclButtonsType::NONE,
1379 aStrWarning));
1380 xWarn->add_button(GetStandardText(StandardButtonType::Retry), RET_RETRY);
1381 xWarn->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL);
1382 bQuitLoop = xWarn->run() != RET_RETRY;
1383
1384 bValidSoundFile=false;
1385 }
1386 }
1387 else
1388 {
1389 bValidSoundFile=true;
1390 bQuitLoop=true;
1391 }
1392 }
1393
1394 if( !bValidSoundFile )
1395 nPos = 0;
1396
1397 mxLBSound->set_active(nPos);
1398}
1399
1401{
1402#if HAVE_FEATURE_AVMEDIA
1403 const auto nPos = mxLBSound->get_active();
1404
1405 if( nPos >= 2 ) try
1406 {
1407 const OUString aSoundURL( maSoundList[ nPos-2 ] );
1408 mxPlayer.set( avmedia::MediaWindow::createPlayer( aSoundURL, "" ), uno::UNO_SET_THROW );
1409 mxPlayer->start();
1410 }
1411 catch( uno::Exception& )
1412 {
1413 TOOLS_WARN_EXCEPTION( "sd", "CustomAnimationEffectTabPage::onSoundPreview()" );
1414 }
1415#endif
1416}
1417
1419{
1420public:
1422
1423 void update( STLPropertySet* pSet );
1424
1425 DECL_LINK(implControlHdl, weld::ComboBox&, void);
1426 DECL_LINK(DurationModifiedHdl, weld::MetricSpinButton&, void);
1427
1428private:
1430
1431 std::unique_ptr<weld::Builder> mxBuilder;
1432 std::unique_ptr<weld::Container> mxContainer;
1433 std::unique_ptr<weld::ComboBox> mxLBStart;
1434 std::unique_ptr<weld::MetricSpinButton> mxMFStartDelay;
1435 std::unique_ptr<weld::Label> mxFTDuration;
1436 std::unique_ptr<weld::MetricSpinButton> mxCBXDuration;
1437 std::unique_ptr<weld::Label> mxFTRepeat;
1438 std::unique_ptr<weld::ComboBox> mxCBRepeat;
1439 std::unique_ptr<weld::CheckButton> mxCBXRewind;
1440 std::unique_ptr<weld::RadioButton> mxRBClickSequence;
1441 std::unique_ptr<weld::RadioButton> mxRBInteractive;
1442 std::unique_ptr<weld::ComboBox> mxLBTrigger;
1443};
1444
1446 : mpSet(pSet)
1447 , mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationtimingtab.ui"))
1448 , mxContainer(mxBuilder->weld_container("TimingTab"))
1449 , mxLBStart(mxBuilder->weld_combo_box("start_list"))
1450 , mxMFStartDelay(mxBuilder->weld_metric_spin_button("delay_value", FieldUnit::SECOND))
1451 , mxFTDuration(mxBuilder->weld_label("duration_label"))
1452 , mxCBXDuration(mxBuilder->weld_metric_spin_button("anim_duration", FieldUnit::SECOND))
1453 , mxFTRepeat(mxBuilder->weld_label("repeat_label"))
1454 , mxCBRepeat(mxBuilder->weld_combo_box("repeat_list"))
1455 , mxCBXRewind(mxBuilder->weld_check_button("rewind"))
1456 , mxRBClickSequence(mxBuilder->weld_radio_button("rb_click_sequence"))
1457 , mxRBInteractive(mxBuilder->weld_radio_button("rb_interactive"))
1458 , mxLBTrigger(mxBuilder->weld_combo_box("trigger_list"))
1459{
1460 mxLBTrigger->set_size_request(mxLBTrigger->get_approximate_digit_width() * 20, -1);
1461
1463
1464 mxLBTrigger->connect_changed(LINK(this, CustomAnimationDurationTabPage, implControlHdl));
1465 mxCBXDuration->connect_value_changed(LINK( this, CustomAnimationDurationTabPage, DurationModifiedHdl));
1466
1468 {
1469 sal_Int16 nStart = 0;
1470 pSet->getPropertyValue( nHandleStart ) >>= nStart;
1471 sal_Int32 nPos = 0;
1472 switch( nStart )
1473 {
1474 case EffectNodeType::WITH_PREVIOUS: nPos = 1; break;
1475 case EffectNodeType::AFTER_PREVIOUS: nPos = 2; break;
1476 }
1477 mxLBStart->set_active(nPos);
1478 }
1479
1481 {
1482 double fBegin = 0.0;
1483 pSet->getPropertyValue( nHandleBegin ) >>= fBegin;
1484 mxMFStartDelay->set_value(static_cast<::tools::Long>(fBegin*10), FieldUnit::NONE);
1485 }
1486
1488 {
1489 double fDuration = 0.0;
1490 pSet->getPropertyValue( nHandleDuration ) >>= fDuration;
1491
1492 if( fDuration == 0.001 )
1493 {
1494 mxFTDuration->set_sensitive(false);
1495 mxCBXDuration->set_sensitive(false);
1496 mxFTRepeat->set_sensitive(false);
1497 mxCBRepeat->set_sensitive(false);
1498 mxCBXRewind->set_sensitive(false);
1499 }
1500 else
1501 {
1502 mxCBXDuration->set_value(fDuration * 100.0, FieldUnit::NONE);
1503 }
1504 }
1505
1507 {
1508 Any aRepeatCount( pSet->getPropertyValue( nHandleRepeat ) );
1509 if( (aRepeatCount.getValueType() == ::cppu::UnoType<double>::get()) || !aRepeatCount.hasValue() )
1510 {
1511 double fRepeat = 0.0;
1512 if( aRepeatCount.hasValue() )
1513 aRepeatCount >>= fRepeat;
1514
1515 auto nPos = -1;
1516
1517 if( fRepeat == 0 )
1518 nPos = 0;
1519 else if( fRepeat == 2.0 )
1520 nPos = 1;
1521 else if( fRepeat == 3.0 )
1522 nPos = 2;
1523 else if( fRepeat == 4.0 )
1524 nPos = 3;
1525 else if( fRepeat == 5.0 )
1526 nPos = 4;
1527 else if( fRepeat == 10.0 )
1528 nPos = 5;
1529
1530 if (nPos != -1)
1531 mxCBRepeat->set_active(nPos);
1532 else
1533 mxCBRepeat->set_entry_text(OUString::number(fRepeat));
1534 }
1535 else if( aRepeatCount.getValueType() == ::cppu::UnoType<Timing>::get() )
1536 {
1537 Any aEnd;
1539 aEnd = pSet->getPropertyValue( nHandleEnd );
1540
1541 mxCBRepeat->set_active(aEnd.hasValue() ? 6 : 7);
1542 }
1543 }
1544
1546 {
1547 sal_Int16 nFill = 0;
1548 if( pSet->getPropertyValue( nHandleRewind ) >>= nFill )
1549 {
1550 mxCBXRewind->set_active(nFill == AnimationFill::REMOVE);
1551 }
1552 else
1553 {
1554 mxCBXRewind->set_state(TRISTATE_INDET);
1555 }
1556 }
1557
1558 Reference< XShape > xTrigger;
1559
1561 {
1562 pSet->getPropertyValue( nHandleTrigger ) >>= xTrigger;
1563
1564 mxRBInteractive->set_active(xTrigger.is());
1565 mxRBClickSequence->set_active(!xTrigger.is());
1566 }
1567
1568 Reference< XDrawPage > xCurrentPage;
1569 pSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage;
1570 if( !xCurrentPage.is() )
1571 return;
1572
1573 static constexpr OUStringLiteral aStrIsEmptyPresObj( u"IsEmptyPresentationObject" );
1574
1575 sal_Int32 nShape, nCount = xCurrentPage->getCount();
1576 for( nShape = 0; nShape < nCount; nShape++ )
1577 {
1578 Reference< XShape > xShape( xCurrentPage->getByIndex( nShape ), UNO_QUERY );
1579
1580 if( !xShape.is() )
1581 continue;
1582
1583 Reference< XPropertySet > xSet( xShape, UNO_QUERY );
1584 if( xSet.is() && xSet->getPropertySetInfo()->hasPropertyByName( aStrIsEmptyPresObj ) )
1585 {
1586 bool bIsEmpty = false;
1587 xSet->getPropertyValue( aStrIsEmptyPresObj ) >>= bIsEmpty;
1588 if( bIsEmpty )
1589 continue;
1590 }
1591
1592 OUString aDescription( getShapeDescription( xShape, true ) );
1593 mxLBTrigger->append(OUString::number(nShape), aDescription);
1594 auto nPos = mxLBTrigger->get_count() - 1;
1595 if (xShape == xTrigger)
1596 mxLBTrigger->set_active(nPos);
1597 }
1598}
1599
1601{
1602 mxRBInteractive->set_active(true);
1603 assert(!mxRBClickSequence->get_active());
1604}
1605
1607{
1608 if (!mxCBXDuration->get_text().isEmpty())
1609 {
1610 double duration_value = static_cast<double>(mxCBXDuration->get_value(FieldUnit::NONE));
1611 if(duration_value <= 0.0)
1612 mxCBXDuration->set_value(1, FieldUnit::NONE);
1613 else
1614 mxCBXDuration->set_value(duration_value, FieldUnit::NONE);
1615 }
1616}
1617
1619{
1620 auto nPos = mxLBStart->get_active();
1621 if (nPos != -1)
1622 {
1623 sal_Int16 nStart;
1624 sal_Int16 nOldStart = -1;
1625
1626 switch( nPos )
1627 {
1628 case 1: nStart = EffectNodeType::WITH_PREVIOUS; break;
1629 case 2: nStart = EffectNodeType::AFTER_PREVIOUS; break;
1630 default:
1631 nStart = EffectNodeType::ON_CLICK; break;
1632 }
1633
1635 mpSet->getPropertyValue( nHandleStart ) >>= nOldStart;
1636
1637 if( nStart != nOldStart )
1638 pSet->setPropertyValue( nHandleStart, Any( nStart ) );
1639 }
1640
1641 {
1642 double fBegin = static_cast<double>(mxMFStartDelay->get_value(FieldUnit::NONE)) / 10.0;
1643 double fOldBegin = -1.0;
1644
1646 mpSet->getPropertyValue( nHandleBegin ) >>= fOldBegin;
1647
1648 if( fBegin != fOldBegin )
1649 pSet->setPropertyValue( nHandleBegin, Any( fBegin ) );
1650 }
1651
1652 nPos = mxCBRepeat->get_active();
1653 if (nPos != -1 || !mxCBRepeat->get_active_text().isEmpty())
1654 {
1655 Any aRepeatCount;
1656 Any aEnd;
1657
1658 switch( nPos )
1659 {
1660 case 0:
1661 break;
1662
1663 case 6:
1664 {
1665 Event aEvent;
1666 aEvent.Trigger = EventTrigger::ON_NEXT;
1667 aEvent.Repeat = 0;
1668 aEnd <<= aEvent;
1669 }
1670 [[fallthrough]];
1671 case 7:
1672 aRepeatCount <<= Timing_INDEFINITE;
1673 break;
1674 default:
1675 {
1676 OUString aText(mxCBRepeat->get_text(nPos));
1677 if( !aText.isEmpty() )
1678 aRepeatCount <<= aText.toDouble();
1679 }
1680 }
1681
1682 Any aOldRepeatCount( aRepeatCount );
1684 aOldRepeatCount = mpSet->getPropertyValue( nHandleRepeat );
1685
1686 if( aRepeatCount != aOldRepeatCount )
1687 pSet->setPropertyValue( nHandleRepeat, aRepeatCount );
1688
1689 Any aOldEnd( aEnd );
1691 aOldEnd = mpSet->getPropertyValue( nHandleEnd );
1692
1693 if( aEnd != aOldEnd )
1694 pSet->setPropertyValue( nHandleEnd, aEnd );
1695 }
1696
1697 double fDuration = -1.0;
1698
1699 if (!mxCBXDuration->get_text().isEmpty())
1700 {
1701 double duration_value = static_cast<double>(mxCBXDuration->get_value(FieldUnit::NONE));
1702
1703 if(duration_value > 0)
1704 fDuration = duration_value/100.0;
1705 }
1706
1707 if( fDuration != -1.0 )
1708 {
1709 double fOldDuration = -1;
1710
1712 mpSet->getPropertyValue( nHandleDuration ) >>= fOldDuration;
1713
1714 if( fDuration != fOldDuration )
1715 pSet->setPropertyValue( nHandleDuration, Any( fDuration ) );
1716 }
1717
1718 if (mxCBXRewind->get_state() != TRISTATE_INDET)
1719 {
1720 sal_Int16 nFill = mxCBXRewind->get_active() ? AnimationFill::REMOVE : AnimationFill::HOLD;
1721
1722 bool bSet = true;
1723
1725 {
1726 sal_Int16 nOldFill = 0;
1727 mpSet->getPropertyValue( nHandleRewind ) >>= nOldFill;
1728 bSet = nFill != nOldFill;
1729 }
1730
1731 if( bSet )
1732 pSet->setPropertyValue( nHandleRewind, Any( nFill ) );
1733 }
1734
1735 Reference< XShape > xTrigger;
1736
1737 if (mxRBInteractive->get_active())
1738 {
1739 nPos = mxLBTrigger->get_active();
1740 if (nPos != -1)
1741 {
1742 sal_Int32 nShape = mxLBTrigger->get_id(nPos).toInt32();
1743
1744 Reference< XDrawPage > xCurrentPage;
1745 mpSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage;
1746
1747 if( xCurrentPage.is() && (nShape >= 0) && (nShape < xCurrentPage->getCount()) )
1748 xCurrentPage->getByIndex( nShape ) >>= xTrigger;
1749 }
1750 }
1751
1752 if (xTrigger.is() || mxRBClickSequence->get_active())
1753 {
1754 Any aNewValue( xTrigger );
1755 Any aOldValue;
1756
1758 aOldValue = mpSet->getPropertyValue( nHandleTrigger );
1759
1760 if( aNewValue != aOldValue )
1761 pSet->setPropertyValue( nHandleTrigger, aNewValue );
1762 }
1763}
1764
1766{
1767public:
1769
1770 void update( STLPropertySet* pSet );
1771
1772 void updateControlStates();
1773 DECL_LINK(implSelectHdl, weld::ComboBox&, void);
1774
1775private:
1778
1779 std::unique_ptr<weld::Builder> mxBuilder;
1780 std::unique_ptr<weld::Container> mxContainer;
1781 std::unique_ptr<weld::ComboBox> mxLBGroupText;
1782 std::unique_ptr<weld::CheckButton> mxCBXGroupAuto;
1783 std::unique_ptr<weld::MetricSpinButton> mxMFGroupAuto;
1784 std::unique_ptr<weld::CheckButton> mxCBXAnimateForm;
1785 std::unique_ptr<weld::CheckButton> mxCBXReverse;
1786};
1787
1789 : mpSet(pSet)
1790 , mbHasVisibleShapes(true)
1791 , mxBuilder(Application::CreateBuilder(pParent, "modules/simpress/ui/customanimationtexttab.ui"))
1792 , mxContainer(mxBuilder->weld_container("TextAnimationTab"))
1793 , mxLBGroupText(mxBuilder->weld_combo_box("group_text_list"))
1794 , mxCBXGroupAuto(mxBuilder->weld_check_button("auto_after"))
1795 , mxMFGroupAuto(mxBuilder->weld_metric_spin_button("auto_after_value",FieldUnit::SECOND))
1796 , mxCBXAnimateForm(mxBuilder->weld_check_button("animate_shape"))
1797 , mxCBXReverse(mxBuilder->weld_check_button("reverse_order"))
1798{
1799 mxLBGroupText->connect_changed(LINK(this, CustomAnimationTextAnimTabPage, implSelectHdl));
1800
1802 {
1803 sal_Int32 nTextGrouping = 0;
1804 if( pSet->getPropertyValue( nHandleTextGrouping ) >>= nTextGrouping )
1805 mxLBGroupText->set_active(nTextGrouping + 1);
1806 }
1807
1810
1812 {
1813 double fTextGroupingAuto = 0.0;
1814 if( pSet->getPropertyValue( nHandleTextGroupingAuto ) >>= fTextGroupingAuto )
1815 {
1816 mxCBXGroupAuto->set_active(fTextGroupingAuto >= 0.0);
1817 if( fTextGroupingAuto >= 0.0 )
1818 mxMFGroupAuto->set_value(static_cast<::tools::Long>(fTextGroupingAuto*10), FieldUnit::NONE);
1819 }
1820 }
1821 else
1822 {
1823 mxCBXGroupAuto->set_state( TRISTATE_INDET );
1824 }
1825
1826 mxCBXAnimateForm->set_state( TRISTATE_INDET );
1828 {
1829 bool bAnimateForm = false;
1830 if( pSet->getPropertyValue( nHandleAnimateForm ) >>= bAnimateForm )
1831 {
1832 mxCBXAnimateForm->set_active( bAnimateForm );
1833 }
1834 }
1835 else
1836 {
1837 mxCBXAnimateForm->set_sensitive(false);
1838 }
1839
1840 mxCBXReverse->set_state(TRISTATE_INDET);
1842 {
1843 bool bTextReverse = false;
1844 if( pSet->getPropertyValue( nHandleTextReverse ) >>= bTextReverse )
1845 {
1846 mxCBXReverse->set_active( bTextReverse );
1847 }
1848 }
1849
1851 {
1852 sal_Int32 nMaxParaDepth = 0;
1853 pSet->getPropertyValue( nHandleMaxParaDepth ) >>= nMaxParaDepth;
1854 nMaxParaDepth += 1;
1855
1856 sal_Int32 nPos = 6;
1857 while( (nPos > 2) && (nPos > nMaxParaDepth) )
1858 {
1859 mxLBGroupText->remove(nPos);
1860 nPos--;
1861 }
1862 }
1863
1865}
1866
1868{
1869 auto nPos = mxLBGroupText->get_active();
1870 if (nPos != -1)
1871 {
1872 sal_Int32 nTextGrouping = nPos - 1;
1873 sal_Int32 nOldGrouping = -2;
1874
1876 mpSet->getPropertyValue( nHandleTextGrouping ) >>= nOldGrouping;
1877
1878 if( nTextGrouping != nOldGrouping )
1879 pSet->setPropertyValue( nHandleTextGrouping, Any( nTextGrouping ) );
1880 }
1881
1882 if (nPos != 0)
1883 {
1884 bool bTextReverse = mxCBXReverse->get_active();
1885 bool bOldTextReverse = !bTextReverse;
1886
1888 mpSet->getPropertyValue( nHandleTextReverse ) >>= bOldTextReverse;
1889
1890 if( bTextReverse != bOldTextReverse )
1891 pSet->setPropertyValue( nHandleTextReverse, Any( bTextReverse ) );
1892
1893 if( nPos > 1 )
1894 {
1895 double fTextGroupingAuto = mxCBXGroupAuto->get_active() ? mxMFGroupAuto->get_value(FieldUnit::NONE) / 10.0 : -1.0;
1896 double fOldTextGroupingAuto = -2.0;
1897
1899 mpSet->getPropertyValue( nHandleTextGroupingAuto ) >>= fOldTextGroupingAuto;
1900
1901 if( fTextGroupingAuto != fOldTextGroupingAuto )
1902 pSet->setPropertyValue( nHandleTextGroupingAuto, Any( fTextGroupingAuto ) );
1903 }
1904 }
1905 //#i120049# impress crashes when modifying the "Random effects" animation
1906 //effect's trigger condition to "Start effect on click of".
1907 //If this control is disabled, we should ignore its value
1908 if (mxCBXAnimateForm->get_sensitive())
1909 {
1910 bool bAnimateForm = mxCBXAnimateForm->get_active();
1911 bool bOldAnimateForm = !bAnimateForm;
1912
1914 mpSet->getPropertyValue( nHandleAnimateForm ) >>= bOldAnimateForm;
1915
1916 if( bAnimateForm != bOldAnimateForm )
1917 pSet->setPropertyValue( nHandleAnimateForm, Any( bAnimateForm ) );
1918 }
1919}
1920
1922{
1923 auto nPos = mxLBGroupText->get_active();
1924
1925 mxCBXGroupAuto->set_sensitive( nPos > 1 );
1926 mxMFGroupAuto->set_sensitive( nPos > 1 );
1927 mxCBXReverse->set_sensitive( nPos > 0 );
1928
1929 if( !mbHasVisibleShapes && nPos > 0 )
1930 {
1931 mxCBXAnimateForm->set_active(false);
1932 mxCBXAnimateForm->set_sensitive(false);
1933 }
1934 else
1935 {
1936 mxCBXAnimateForm->set_sensitive(true);
1937 }
1938}
1939
1941{
1942 updateControlStates();
1943}
1944
1945CustomAnimationDialog::CustomAnimationDialog(weld::Window* pParent, std::unique_ptr<STLPropertySet> pSet, const OUString& rPage)
1946 : GenericDialogController(pParent, "modules/simpress/ui/customanimationproperties.ui", "CustomAnimationProperties")
1947 , mxSet(std::move(pSet))
1948 , mxTabControl(m_xBuilder->weld_notebook("tabcontrol"))
1949 , mxDurationTabPage(new CustomAnimationDurationTabPage(mxTabControl->get_page("timing"), mxSet.get()))
1950 , mxEffectTabPage(new CustomAnimationEffectTabPage(mxTabControl->get_page("effect"), m_xDialog.get(), mxSet.get()))
1951{
1952 bool bHasText = false;
1953 if( mxSet->getPropertyState( nHandleHasText ) != STLPropertyState::Ambiguous )
1954 mxSet->getPropertyValue( nHandleHasText ) >>= bHasText;
1955
1956 if( bHasText )
1957 {
1958 mxTextAnimTabPage.reset(new CustomAnimationTextAnimTabPage(mxTabControl->get_page("textanim"), mxSet.get()));
1959 }
1960 else
1961 {
1962 mxTabControl->remove_page("textanim");
1963 }
1964
1965 if (!rPage.isEmpty())
1966 mxTabControl->set_current_page(rPage);
1967}
1968
1970{
1971}
1972
1974{
1976
1977 mxEffectTabPage->update( mxResultSet.get() );
1978 mxDurationTabPage->update( mxResultSet.get() );
1980 mxTextAnimTabPage->update( mxResultSet.get() );
1981
1982 return mxResultSet.get();
1983}
1984
1985std::unique_ptr<STLPropertySet> CustomAnimationDialog::createDefaultSet()
1986{
1987 Any aEmpty;
1988
1989 std::unique_ptr<STLPropertySet> pSet(new STLPropertySet());
1990 pSet->setPropertyDefaultValue( nHandleMaxParaDepth, Any( sal_Int32(-1) ) );
1991
1992 pSet->setPropertyDefaultValue( nHandleHasAfterEffect, Any( false ) );
1993 pSet->setPropertyDefaultValue( nHandleAfterEffectOnNextEffect, Any( false ) );
1994 pSet->setPropertyDefaultValue( nHandleDimColor, aEmpty );
1995 pSet->setPropertyDefaultValue( nHandleIterateType, Any( sal_Int16(0) ) );
1996 pSet->setPropertyDefaultValue( nHandleIterateInterval, Any( 0.0 ) );
1997
1998 pSet->setPropertyDefaultValue( nHandleStart, Any( sal_Int16(EffectNodeType::ON_CLICK) ) );
1999 pSet->setPropertyDefaultValue( nHandleBegin, Any( 0.0 ) );
2000 pSet->setPropertyDefaultValue( nHandleDuration, Any( 2.0 ) );
2001 pSet->setPropertyDefaultValue( nHandleRepeat, aEmpty );
2002 pSet->setPropertyDefaultValue( nHandleRewind, Any( AnimationFill::HOLD ) );
2003
2004 pSet->setPropertyDefaultValue( nHandleEnd, aEmpty );
2005
2006 pSet->setPropertyDefaultValue( nHandlePresetId, aEmpty );
2007 pSet->setPropertyDefaultValue( nHandleProperty1Type, Any( nPropertyTypeNone ) );
2008 pSet->setPropertyDefaultValue( nHandleProperty1Value, aEmpty );
2009 pSet->setPropertyDefaultValue( nHandleProperty2Type, Any( nPropertyTypeNone ) );
2010 pSet->setPropertyDefaultValue( nHandleProperty2Value, aEmpty );
2011 pSet->setPropertyDefaultValue( nHandleAccelerate, aEmpty );
2012 pSet->setPropertyDefaultValue( nHandleDecelerate, aEmpty );
2013 pSet->setPropertyDefaultValue( nHandleAutoReverse, aEmpty );
2014 pSet->setPropertyDefaultValue( nHandleTrigger, aEmpty );
2015
2016 pSet->setPropertyDefaultValue( nHandleHasText, Any( false ) );
2017 pSet->setPropertyDefaultValue( nHandleHasVisibleShape, Any( false ) );
2018 pSet->setPropertyDefaultValue( nHandleTextGrouping, Any( sal_Int32(-1) ) );
2019 pSet->setPropertyDefaultValue( nHandleAnimateForm, Any( true ) );
2020 pSet->setPropertyDefaultValue( nHandleTextGroupingAuto, Any( -1.0 ) );
2021 pSet->setPropertyDefaultValue( nHandleTextReverse, Any( false ) );
2022
2023 pSet->setPropertyDefaultValue( nHandleCurrentPage, aEmpty );
2024
2025 pSet->setPropertyDefaultValue( nHandleSoundURL, aEmpty );
2026 pSet->setPropertyDefaultValue( nHandleSoundVolume, Any( 1.0) );
2027 pSet->setPropertyDefaultValue( nHandleSoundEndAfterSlide, Any( sal_Int32(0) ) );
2028
2029 pSet->setPropertyDefaultValue( nHandleCommand, Any( sal_Int16(0) ) );
2030 return pSet;
2031}
2032
2033std::unique_ptr<SdPropertySubControl> SdPropertySubControl::create(sal_Int32 nType, weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const OUString& rPresetId, const Link<LinkParamNone*,void>& rModifyHdl)
2034{
2035 std::unique_ptr<SdPropertySubControl> pSubControl;
2036 switch( nType )
2037 {
2040 case nPropertyTypeZoom:
2041 pSubControl.reset( new SdPresetPropertyBox( pLabel, pParent, rValue, rPresetId, rModifyHdl ) );
2042 break;
2043
2044 case nPropertyTypeColor:
2049 pSubControl.reset( new SdColorPropertyBox( pLabel, pParent, pTopLevel, rValue, rModifyHdl ) );
2050 break;
2051
2052 case nPropertyTypeFont:
2053 pSubControl.reset( new SdFontPropertyBox( pLabel, pParent, rValue, rModifyHdl ) );
2054 break;
2055
2057 pSubControl.reset( new SdCharHeightPropertyBox( pLabel, pParent, rValue, rModifyHdl ) );
2058 break;
2059
2061 pSubControl.reset( new SdRotationPropertyBox( pLabel, pParent, rValue, rModifyHdl ) );
2062 break;
2063
2065 pSubControl.reset( new SdTransparencyPropertyBox( pLabel, pParent, rValue, rModifyHdl ) );
2066 break;
2067
2068 case nPropertyTypeScale:
2069 pSubControl.reset( new SdScalePropertyBox( pLabel, pParent, rValue, rModifyHdl ) );
2070 break;
2071
2073 pSubControl.reset( new SdFontStylePropertyBox( pLabel, pParent, rValue, rModifyHdl ) );
2074 break;
2075 }
2076
2077 return pSubControl;
2078}
2079
2080}
2081
2082/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< container::XNameAccess > mxContainer
Reference< XExecutableDialog > m_xDialog
AnyEventRef aEvent
static OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
Color GetRGBColor() const
size_t GetFontNameCount() const
const FontMetric & GetFontName(size_t nFont) const
static bool FillObjList(std::u16string_view rThemeName, std::vector< OUString > &rObjList)
static bool InsertURL(std::u16string_view rThemeName, std::u16string_view rURL)
The class SdOpenSoundFileDialog wraps the FileDialogHelper, displaying the FILEOPEN_PLAY dialog templ...
Definition: filedlg.hxx:40
OUString GetPath() const
Definition: filedlg.cxx:247
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
static css::uno::Reference< css::media::XPlayer > createPlayer(const OUString &rURL, const OUString &rReferer, const OUString *pMimeType=nullptr)
std::unique_ptr< STLPropertySet > mxSet
std::unique_ptr< CustomAnimationEffectTabPage > mxEffectTabPage
std::unique_ptr< STLPropertySet > mxResultSet
std::unique_ptr< CustomAnimationTextAnimTabPage > mxTextAnimTabPage
CustomAnimationDialog(weld::Window *pParent, std::unique_ptr< STLPropertySet > pSet, const OUString &Page)
static std::unique_ptr< STLPropertySet > createDefaultSet()
std::unique_ptr< CustomAnimationDurationTabPage > mxDurationTabPage
virtual ~CustomAnimationDialog() override
std::unique_ptr< weld::Notebook > mxTabControl
std::unique_ptr< weld::Builder > mxBuilder
std::unique_ptr< weld::ComboBox > mxLBTrigger
std::unique_ptr< weld::RadioButton > mxRBClickSequence
std::unique_ptr< weld::RadioButton > mxRBInteractive
std::unique_ptr< weld::ComboBox > mxLBStart
std::unique_ptr< weld::Label > mxFTRepeat
DECL_LINK(implControlHdl, weld::ComboBox &, void)
CustomAnimationDurationTabPage(weld::Container *pParent, const STLPropertySet *pSet)
std::unique_ptr< weld::Container > mxContainer
std::unique_ptr< weld::CheckButton > mxCBXRewind
std::unique_ptr< weld::MetricSpinButton > mxMFStartDelay
DECL_LINK(DurationModifiedHdl, weld::MetricSpinButton &, void)
std::unique_ptr< weld::MetricSpinButton > mxCBXDuration
std::unique_ptr< weld::Label > mxFTDuration
std::unique_ptr< weld::ComboBox > mxCBRepeat
std::unique_ptr< ColorListBox > mxCLBDimColor
std::unique_ptr< weld::Container > mxContainer
DECL_LINK(implSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::CheckButton > mxCBSmoothEnd
std::unique_ptr< weld::ComboBox > mxLBTextAnim
std::unique_ptr< weld::Label > mxFTDimColor
std::unique_ptr< SdPropertySubControl > mxLBSubControl
std::unique_ptr< weld::Widget > mxSettings
std::unique_ptr< weld::MetricSpinButton > mxMFTextDelay
std::unique_ptr< weld::Button > mxPBSoundPreview
std::unique_ptr< weld::CheckButton > mxCBSmoothStart
sal_Int32 getSoundObject(std::u16string_view rStr)
std::unique_ptr< weld::Label > mxFTTextAnim
std::unique_ptr< weld::Container > mxPlaceholderBox
std::unique_ptr< weld::ComboBox > mxLBSound
std::unique_ptr< weld::Label > mxFTSound
std::unique_ptr< weld::Label > mxFTTextDelay
css::uno::Reference< css::media::XPlayer > mxPlayer
std::unique_ptr< weld::Label > mxFTProperty1
std::unique_ptr< weld::ComboBox > mxLBAfterEffect
DECL_LINK(implClickHdl, weld::Button &, void)
std::unique_ptr< weld::Builder > mxBuilder
static const CustomAnimationPresets & getCustomAnimationPresets()
This method gets presets instance, which is localized for the current user's locale.
std::unique_ptr< weld::Container > mxContainer
DECL_LINK(implSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::CheckButton > mxCBXAnimateForm
std::unique_ptr< weld::CheckButton > mxCBXReverse
CustomAnimationTextAnimTabPage(weld::Container *pParent, const STLPropertySet *pSet)
std::unique_ptr< weld::MetricSpinButton > mxMFGroupAuto
std::unique_ptr< weld::ComboBox > mxLBGroupText
std::unique_ptr< weld::Builder > mxBuilder
std::unique_ptr< weld::CheckButton > mxCBXGroupAuto
STLPropertyState getPropertyState(sal_Int32 nHandle) const
void setPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue)
css::uno::Any getPropertyValue(sal_Int32 nHandle) const
SdPropertySubControl(weld::Container *pParent)
static std::unique_ptr< SdPropertySubControl > create(sal_Int32 nType, weld::Label *pLabel, weld::Container *pParent, weld::Window *pTopLevel, const css::uno::Any &rValue, const OUString &rPresetId, const Link< LinkParamNone *, void > &rModifyHdl)
std::unique_ptr< weld::Container > mxContainer
virtual void setValue(const css::uno::Any &rValue, const OUString &rPresetId)=0
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
const OUString & GetFamilyName() const
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
virtual void set_mnemonic_widget(Widget *pTarget)=0
Link< ColorFieldControl &, void > maModifyHdl
int nCount
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
RegionData_Impl * mpParent
float u
@ NORMAL
Definition: epptbase.hxx:92
#define ERRCODE_NONE
FieldUnit
sal_Int16 nValue
#define GALLERY_THEME_USERSOUNDS
#define GALLERY_THEME_SOUNDS
TRISTATE_INDET
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_SCALEPROPERTYBOX
Definition: helpids.h:55
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_FONTSTYLEPROPERTYBOX
Definition: helpids.h:56
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_FONTPROPERTYBOX
Definition: helpids.h:51
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_TRANSPARENCYPROPERTYBOX
Definition: helpids.h:54
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_ROTATIONPROPERTYBOX
Definition: helpids.h:53
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_PRESETPROPERTYBOX
Definition: helpids.h:49
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX
Definition: helpids.h:50
constexpr OUStringLiteral HID_SD_CUSTOMANIMATIONPANE_CHARHEIGHTPROPERTYBOX
Definition: helpids.h:52
sal_Int32 nIndex
sal_uInt16 nPos
aStr
int i
css::beans::Optional< css::uno::Any > getValue(std::u16string_view id)
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
const sal_Int32 nHandleEnd
IMPL_LINK(CustomAnimationEffectTabPage, implSelectHdl, weld::ComboBox &, rListBox, void)
const sal_Int32 nPropertyTypeFillColor
const sal_Int32 nHandleTrigger
const sal_Int32 nPropertyTypeDirection
const sal_Int32 nHandleProperty1Type
IMPL_LINK_NOARG(MainSequence, onTimerHdl, Timer *, void)
const sal_Int32 nHandleIterateType
const sal_Int32 nHandleRepeat
const sal_Int32 nPropertyTypeZoom
const sal_Int32 nPropertyTypeScale
void fillRepeatComboBox(weld::ComboBox &rBox)
const sal_Int32 nPropertyTypeFont
const sal_Int32 nHandleCurrentPage
const sal_Int32 nPropertyTypeSpokes
const sal_Int32 nHandleProperty2Value
const sal_Int32 nHandleBegin
const sal_Int32 nHandleDimColor
const sal_Int32 nPropertyTypeLineColor
std::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr
const sal_Int32 nHandleAccelerate
const sal_Int32 nHandleSoundVolume
const sal_Int32 nPropertyTypeColor
const sal_Int32 nHandleAfterEffectOnNextEffect
const sal_Int32 nHandlePresetId
const sal_Int32 nHandleSoundURL
const sal_Int32 nHandleTextGroupingAuto
const sal_Int32 nHandleDecelerate
OUString getShapeDescription(const Reference< XShape > &xShape, bool bWithText)
IMPL_LINK_NOARG(CustomAnimationTextAnimTabPage, implSelectHdl, weld::ComboBox &, void)
const sal_Int32 nHandleTextGrouping
const sal_Int32 nPropertyTypeFirstColor
const sal_Int32 nHandleIterateInterval
const sal_Int32 nHandleStart
const sal_Int32 nHandleHasVisibleShape
OUString getPropertyName(sal_Int32 nPropertyType)
IMPL_LINK(SdCharHeightPropertyBox, implMenuSelectHdl, const OUString &, rIdent, void)
const sal_Int32 nPropertyTypeCharDecoration
const sal_Int32 nHandleHasText
const sal_Int32 nPropertyTypeCharHeight
const sal_Int32 nHandleAutoReverse
const sal_Int32 nHandleRewind
const sal_Int32 nHandleMaxParaDepth
const sal_Int32 nHandleProperty1Value
const sal_Int32 nPropertyTypeRotate
const sal_Int32 nHandleDuration
const sal_Int32 nHandleSoundEndAfterSlide
const sal_Int32 nHandleTextReverse
const sal_Int32 nPropertyTypeCharColor
const sal_Int32 nHandleProperty2Type
const sal_Int32 nHandleAnimateForm
const sal_Int32 nHandleCommand
const sal_Int32 nPropertyTypeNone
const sal_Int32 nHandleHasAfterEffect
const sal_Int32 nPropertyTypeTransparency
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
QPRO_FUNC_TYPE nType
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
sal_uIntPtr sal_uLong
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
bool update()
constexpr OUStringLiteral PERCENT(u"Percent")
RET_CANCEL
RET_RETRY