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 
10 #ifndef INCLUDED_OOX_DRAWINGML_EFFECTPROPERTIES_HXX
11 #define INCLUDED_OOX_DRAWINGML_EFFECTPROPERTIES_HXX
12 
13 #include <oox/drawingml/color.hxx>
14 #include <oox/helper/propertymap.hxx>
15 
16 #include <memory>
17 #include <vector>
18 #include <map>
19 
20 namespace oox::drawingml {
21 
22 struct EffectGlowProperties
23 {
24     OptValue< sal_Int64 > moGlowRad; // size of glow effect
25     Color moGlowColor;
26     // TODO saturation and luminance missing
27 
28     void assignUsed( const EffectGlowProperties& rSourceProps );
29 };
30 
31 struct EffectSoftEdgeProperties
32 {
33     OptValue<sal_Int64> moRad; // size of effect
34 
35     void assignUsed(const EffectSoftEdgeProperties& rSourceProps);
36 };
37 
38 struct EffectShadowProperties
39 {
40     OptValue< sal_Int64 > moShadowDist;
41     OptValue< sal_Int64 > moShadowDir;
42     OptValue< sal_Int64 > moShadowSx;
43     OptValue< sal_Int64 > moShadowSy;
44     Color moShadowColor;
45     OptValue< sal_Int64 > moShadowBlur; // size of blur effect
46 
47     /** Overwrites all members that are explicitly set in rSourceProps. */
48     void                assignUsed( const EffectShadowProperties& rSourceProps );
49 };
50 
51 struct Effect
52 {
53     OUString msName;
54     std::map< OUString, css::uno::Any > maAttribs;
55     Color moColor;
56 
57     css::beans::PropertyValue getEffect();
58 };
59 
60 struct EffectProperties
61 {
62     EffectShadowProperties maShadow;
63     EffectGlowProperties maGlow;
64     EffectSoftEdgeProperties maSoftEdge;
65 
66     /** Stores all effect properties, including those not supported by core yet */
67     std::vector<std::unique_ptr<Effect>> m_Effects;
68 
EffectPropertiesoox::drawingml::EffectProperties69     EffectProperties() {}
EffectPropertiesoox::drawingml::EffectProperties70     EffectProperties(EffectProperties const& rOther)
71     {
72         assignUsed(rOther);
73     }
74 
75     /** Overwrites all members that are explicitly set in rSourceProps. */
76     void                assignUsed( const EffectProperties& rSourceProps );
77 
78     /** Writes the properties to the passed property map. */
79     void                pushToPropMap(
80                             PropertyMap& rPropMap,
81                             const GraphicHelper& rGraphicHelper ) const;
82 };
83 
84 } // namespace oox::drawingml
85 
86 #endif
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
89