bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / inc / CustomAnimationPreset.hxx
blobeeeeac55ad77d059906a1dc3ee59c53c3bc1ea66
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_INC_CUSTOMANIMATIONPRESET_HXX
21 #define INCLUDED_SD_INC_CUSTOMANIMATIONPRESET_HXX
23 #include <sal/config.h>
25 #include <vector>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include "CustomAnimationEffect.hxx"
31 #include <unordered_map>
33 namespace sd {
35 typedef std::unordered_map< OUString, CustomAnimationEffectPtr > EffectsSubTypeMap;
36 typedef std::unordered_map< OUString, OUString > UStringMap;
38 class CustomAnimationPreset
40 friend class CustomAnimationPresets;
42 public:
43 CustomAnimationPreset( const CustomAnimationEffectPtr& pEffect );
45 void add( const CustomAnimationEffectPtr& pEffect );
47 SD_DLLPUBLIC css::uno::Reference< css::animations::XAnimationNode > create( const OUString& rstrSubType );
49 const OUString& getPresetId() const { return maPresetId; }
50 const OUString& getLabel() const { return maLabel; }
51 double getDuration() const { return mfDuration; }
53 std::vector<OUString> getSubTypes();
54 std::vector<OUString> getProperties() const;
56 bool hasProperty( const OUString& rProperty ) const;
57 bool isTextOnly() const { return mbIsTextOnly; }
59 private:
60 OUString maPresetId;
61 OUString maProperty;
62 OUString maLabel;
63 OUString maDefaultSubTyp;
64 double mfDuration;
65 bool mbIsTextOnly;
67 EffectsSubTypeMap maSubTypes;
70 typedef std::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr;
71 typedef std::unordered_map<OUString, CustomAnimationPresetPtr> EffectDescriptorMap;
72 typedef std::vector< CustomAnimationPresetPtr > EffectDescriptorList;
74 struct PresetCategory
76 OUString const maLabel;
77 EffectDescriptorList maEffects;
79 PresetCategory( const OUString& rLabel, const EffectDescriptorList& rEffects )
80 : maLabel( rLabel ), maEffects( rEffects ) {}
82 typedef std::shared_ptr< PresetCategory > PresetCategoryPtr;
83 typedef std::vector< PresetCategoryPtr > PresetCategoryList;
85 class SD_DLLPUBLIC CustomAnimationPresets final
87 public:
88 SAL_DLLPRIVATE CustomAnimationPresets();
89 SAL_DLLPRIVATE ~CustomAnimationPresets();
91 static const CustomAnimationPresets& getCustomAnimationPresets();
93 SAL_DLLPRIVATE css::uno::Reference< css::animations::XAnimationNode > getRandomPreset( sal_Int16 nPresetClass ) const;
95 CustomAnimationPresetPtr getEffectDescriptor( const OUString& rPresetId ) const;
97 SAL_DLLPRIVATE const OUString& getUINameForPresetId( const OUString& rPresetId ) const;
98 SAL_DLLPRIVATE const OUString& getUINameForProperty( const OUString& rProperty ) const;
100 SAL_DLLPRIVATE const PresetCategoryList& getEntrancePresets() const { return maEntrancePresets; }
101 SAL_DLLPRIVATE const PresetCategoryList& getEmphasisPresets() const { return maEmphasisPresets; }
102 SAL_DLLPRIVATE const PresetCategoryList& getExitPresets() const { return maExitPresets; }
103 SAL_DLLPRIVATE const PresetCategoryList& getMotionPathsPresets() const { return maMotionPathsPresets; }
104 SAL_DLLPRIVATE const PresetCategoryList& getMiscPresets() const { return maMiscPresets; }
106 SAL_DLLPRIVATE void changePresetSubType( const CustomAnimationEffectPtr& pEffect, const OUString& rPresetSubType ) const;
108 private:
109 SAL_DLLPRIVATE void importEffects();
110 SAL_DLLPRIVATE void importResources();
112 SAL_DLLPRIVATE void importPresets( const css::uno::Reference< css::lang::XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, PresetCategoryList& rPresetMap );
114 SAL_DLLPRIVATE static const OUString& translateName( const OUString& rId, const UStringMap& rNameMap );
116 private:
117 css::uno::Reference< css::animations::XAnimationNode > mxRootNode;
118 EffectDescriptorMap maEffectDiscriptorMap;
119 UStringMap maEffectNameMap;
120 UStringMap maPropertyNameMap;
122 PresetCategoryList maEntrancePresets;
123 PresetCategoryList maEmphasisPresets;
124 PresetCategoryList maExitPresets;
125 PresetCategoryList maMotionPathsPresets;
126 PresetCategoryList maMiscPresets;
128 SAL_DLLPRIVATE static CustomAnimationPresets* mpCustomAnimationPresets;
132 css::uno::Reference< css::animations::XAnimationNode > implImportEffects( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceFactory, const OUString& rPath );
134 void implImportLabels( const css::uno::Reference< css::lang::XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, UStringMap& rStringMap );
139 #endif // _SD_CUSTOMANIMATIONEFFECTS_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */