Coverage Report

Created: 2025-07-07 10:01

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