nss: upgrade to release 3.73
[LibreOffice.git] / drawinglayer / source / attribute / sdrsceneattribute3d.cxx
blob128abf2027cf2011f6f81b6b6c7ee52be75576ca
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 #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
21 #include <rtl/instance.hxx>
24 namespace drawinglayer::attribute
26 class ImpSdrSceneAttribute
28 public:
29 // 3D scene attribute definitions
30 double mfDistance;
31 double mfShadowSlant;
32 css::drawing::ProjectionMode maProjectionMode;
33 css::drawing::ShadeMode maShadeMode;
35 bool mbTwoSidedLighting : 1;
37 public:
38 ImpSdrSceneAttribute(
39 double fDistance,
40 double fShadowSlant,
41 css::drawing::ProjectionMode aProjectionMode,
42 css::drawing::ShadeMode aShadeMode,
43 bool bTwoSidedLighting)
44 : mfDistance(fDistance),
45 mfShadowSlant(fShadowSlant),
46 maProjectionMode(aProjectionMode),
47 maShadeMode(aShadeMode),
48 mbTwoSidedLighting(bTwoSidedLighting)
52 ImpSdrSceneAttribute()
53 : mfDistance(0.0),
54 mfShadowSlant(0.0),
55 maProjectionMode(css::drawing::ProjectionMode_PARALLEL),
56 maShadeMode(css::drawing::ShadeMode_FLAT),
57 mbTwoSidedLighting(false)
61 // data read access
62 double getShadowSlant() const { return mfShadowSlant; }
63 css::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; }
64 css::drawing::ShadeMode getShadeMode() const { return maShadeMode; }
65 bool getTwoSidedLighting() const { return mbTwoSidedLighting; }
67 bool operator==(const ImpSdrSceneAttribute& rCandidate) const
69 return (mfDistance == rCandidate.mfDistance
70 && getShadowSlant() == rCandidate.getShadowSlant()
71 && getProjectionMode() == rCandidate.getProjectionMode()
72 && getShadeMode() == rCandidate.getShadeMode()
73 && getTwoSidedLighting() == rCandidate.getTwoSidedLighting());
77 namespace
79 struct theGlobalDefault :
80 public rtl::Static< SdrSceneAttribute::ImplType, theGlobalDefault > {};
83 SdrSceneAttribute::SdrSceneAttribute(
84 double fDistance,
85 double fShadowSlant,
86 css::drawing::ProjectionMode aProjectionMode,
87 css::drawing::ShadeMode aShadeMode,
88 bool bTwoSidedLighting)
89 : mpSdrSceneAttribute(ImpSdrSceneAttribute(
90 fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting))
94 SdrSceneAttribute::SdrSceneAttribute()
95 : mpSdrSceneAttribute(theGlobalDefault::get())
99 SdrSceneAttribute::SdrSceneAttribute(const SdrSceneAttribute&) = default;
101 SdrSceneAttribute::SdrSceneAttribute(SdrSceneAttribute&&) = default;
103 SdrSceneAttribute::~SdrSceneAttribute() = default;
105 bool SdrSceneAttribute::isDefault() const
107 return mpSdrSceneAttribute.same_object(theGlobalDefault::get());
110 SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute&) = default;
112 SdrSceneAttribute& SdrSceneAttribute::operator=(SdrSceneAttribute&&) = default;
114 bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const
116 // tdf#87509 default attr is always != non-default attr, even with same values
117 if(rCandidate.isDefault() != isDefault())
118 return false;
120 return rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute;
123 double SdrSceneAttribute::getShadowSlant() const
125 return mpSdrSceneAttribute->getShadowSlant();
128 css::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const
130 return mpSdrSceneAttribute->getProjectionMode();
133 css::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const
135 return mpSdrSceneAttribute->getShadeMode();
138 bool SdrSceneAttribute::getTwoSidedLighting() const
140 return mpSdrSceneAttribute->getTwoSidedLighting();
143 } // end of namespace
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */