1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
23 namespace drawinglayer::attribute
25 class ImpSdrSceneAttribute
28 // 3D scene attribute definitions
31 css::drawing::ProjectionMode maProjectionMode
;
32 css::drawing::ShadeMode maShadeMode
;
34 bool mbTwoSidedLighting
: 1;
40 css::drawing::ProjectionMode aProjectionMode
,
41 css::drawing::ShadeMode aShadeMode
,
42 bool bTwoSidedLighting
)
43 : mfDistance(fDistance
),
44 mfShadowSlant(fShadowSlant
),
45 maProjectionMode(aProjectionMode
),
46 maShadeMode(aShadeMode
),
47 mbTwoSidedLighting(bTwoSidedLighting
)
51 ImpSdrSceneAttribute()
54 maProjectionMode(css::drawing::ProjectionMode_PARALLEL
),
55 maShadeMode(css::drawing::ShadeMode_FLAT
),
56 mbTwoSidedLighting(false)
61 double getShadowSlant() const { return mfShadowSlant
; }
62 css::drawing::ProjectionMode
getProjectionMode() const { return maProjectionMode
; }
63 css::drawing::ShadeMode
getShadeMode() const { return maShadeMode
; }
64 bool getTwoSidedLighting() const { return mbTwoSidedLighting
; }
66 bool operator==(const ImpSdrSceneAttribute
& rCandidate
) const
68 return (mfDistance
== rCandidate
.mfDistance
69 && getShadowSlant() == rCandidate
.getShadowSlant()
70 && getProjectionMode() == rCandidate
.getProjectionMode()
71 && getShadeMode() == rCandidate
.getShadeMode()
72 && getTwoSidedLighting() == rCandidate
.getTwoSidedLighting());
78 SdrSceneAttribute::ImplType
& theGlobalDefault()
80 static SdrSceneAttribute::ImplType SINGLETON
;
85 SdrSceneAttribute::SdrSceneAttribute(
88 css::drawing::ProjectionMode aProjectionMode
,
89 css::drawing::ShadeMode aShadeMode
,
90 bool bTwoSidedLighting
)
91 : mpSdrSceneAttribute(ImpSdrSceneAttribute(
92 fDistance
, fShadowSlant
, aProjectionMode
, aShadeMode
, bTwoSidedLighting
))
96 SdrSceneAttribute::SdrSceneAttribute()
97 : mpSdrSceneAttribute(theGlobalDefault())
101 SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute
&) = default;
103 SdrSceneAttribute::SdrSceneAttribute(SdrSceneAttribute
&&) = default;
105 SdrSceneAttribute::~SdrSceneAttribute() = default;
107 bool SdrSceneAttribute::isDefault() const
109 return mpSdrSceneAttribute
.same_object(theGlobalDefault());
112 SdrSceneAttribute
& SdrSceneAttribute::operator=(const SdrSceneAttribute
&) = default;
114 SdrSceneAttribute
& SdrSceneAttribute::operator=(SdrSceneAttribute
&&) = default;
116 bool SdrSceneAttribute::operator==(const SdrSceneAttribute
& rCandidate
) const
118 // tdf#87509 default attr is always != non-default attr, even with same values
119 if(rCandidate
.isDefault() != isDefault())
122 return rCandidate
.mpSdrSceneAttribute
== mpSdrSceneAttribute
;
125 double SdrSceneAttribute::getShadowSlant() const
127 return mpSdrSceneAttribute
->getShadowSlant();
130 css::drawing::ProjectionMode
SdrSceneAttribute::getProjectionMode() const
132 return mpSdrSceneAttribute
->getProjectionMode();
135 css::drawing::ShadeMode
SdrSceneAttribute::getShadeMode() const
137 return mpSdrSceneAttribute
->getShadeMode();
140 bool SdrSceneAttribute::getTwoSidedLighting() const
142 return mpSdrSceneAttribute
->getTwoSidedLighting();
145 } // end of namespace
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */