Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
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
 * 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 <drawinglayer/attribute/sdrsceneattribute3d.hxx>
21
#include <com/sun/star/drawing/ProjectionMode.hpp>
22
#include <com/sun/star/drawing/ShadeMode.hpp>
23
24
25
namespace drawinglayer::attribute
26
{
27
        class ImpSdrSceneAttribute
28
        {
29
        public:
30
            // 3D scene attribute definitions
31
            double                         mfDistance;
32
            double                         mfShadowSlant;
33
            css::drawing::ProjectionMode   maProjectionMode;
34
            css::drawing::ShadeMode        maShadeMode;
35
36
            bool                           mbTwoSidedLighting : 1;
37
38
        public:
39
            ImpSdrSceneAttribute(
40
                double fDistance,
41
                double fShadowSlant,
42
                css::drawing::ProjectionMode aProjectionMode,
43
                css::drawing::ShadeMode aShadeMode,
44
                bool bTwoSidedLighting)
45
0
            :   mfDistance(fDistance),
46
0
                mfShadowSlant(fShadowSlant),
47
0
                maProjectionMode(aProjectionMode),
48
0
                maShadeMode(aShadeMode),
49
0
                mbTwoSidedLighting(bTwoSidedLighting)
50
0
            {
51
0
            }
52
53
            ImpSdrSceneAttribute()
54
1
            :   mfDistance(0.0),
55
1
                mfShadowSlant(0.0),
56
1
                maProjectionMode(css::drawing::ProjectionMode_PARALLEL),
57
1
                maShadeMode(css::drawing::ShadeMode_FLAT),
58
1
                mbTwoSidedLighting(false)
59
1
            {
60
1
            }
61
62
            // data read access
63
0
            double getShadowSlant() const { return mfShadowSlant; }
64
0
            css::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; }
65
0
            css::drawing::ShadeMode getShadeMode() const { return maShadeMode; }
66
0
            bool getTwoSidedLighting() const { return mbTwoSidedLighting; }
67
68
            bool operator==(const ImpSdrSceneAttribute& rCandidate) const
69
0
            {
70
0
                return (mfDistance == rCandidate.mfDistance
71
0
                    && getShadowSlant() == rCandidate.getShadowSlant()
72
0
                    && getProjectionMode() == rCandidate.getProjectionMode()
73
0
                    && getShadeMode() == rCandidate.getShadeMode()
74
0
                    && getTwoSidedLighting() == rCandidate.getTwoSidedLighting());
75
0
            }
76
        };
77
78
        namespace
79
        {
80
            SdrSceneAttribute::ImplType& theGlobalDefault()
81
84.7k
            {
82
84.7k
                static SdrSceneAttribute::ImplType SINGLETON;
83
84.7k
                return SINGLETON;
84
84.7k
            }
85
        }
86
87
        SdrSceneAttribute::SdrSceneAttribute(
88
            double fDistance,
89
            double fShadowSlant,
90
            css::drawing::ProjectionMode aProjectionMode,
91
            css::drawing::ShadeMode aShadeMode,
92
            bool bTwoSidedLighting)
93
0
        :   mpSdrSceneAttribute(ImpSdrSceneAttribute(
94
0
                fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting))
95
0
        {
96
0
        }
97
98
        SdrSceneAttribute::SdrSceneAttribute()
99
84.7k
        :   mpSdrSceneAttribute(theGlobalDefault())
100
84.7k
        {
101
84.7k
        }
102
103
0
        SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute&) = default;
104
105
0
        SdrSceneAttribute::SdrSceneAttribute(SdrSceneAttribute&&) = default;
106
107
84.7k
        SdrSceneAttribute::~SdrSceneAttribute() = default;
108
109
        bool SdrSceneAttribute::isDefault() const
110
0
        {
111
0
            return mpSdrSceneAttribute.same_object(theGlobalDefault());
112
0
        }
113
114
0
        SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute&) = default;
115
116
81.9k
        SdrSceneAttribute& SdrSceneAttribute::operator=(SdrSceneAttribute&&)  = default;
117
118
        bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const
119
0
        {
120
            // tdf#87509 default attr is always != non-default attr, even with same values
121
0
            if(rCandidate.isDefault() != isDefault())
122
0
                return false;
123
124
0
            return rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute;
125
0
        }
126
127
        double SdrSceneAttribute::getShadowSlant() const
128
0
        {
129
0
            return mpSdrSceneAttribute->getShadowSlant();
130
0
        }
131
132
        css::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const
133
0
        {
134
0
            return mpSdrSceneAttribute->getProjectionMode();
135
0
        }
136
137
        css::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const
138
0
        {
139
0
            return mpSdrSceneAttribute->getShadeMode();
140
0
        }
141
142
        bool SdrSceneAttribute::getTwoSidedLighting() const
143
0
        {
144
0
            return mpSdrSceneAttribute->getTwoSidedLighting();
145
0
        }
146
147
} // end of namespace
148
149
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */