bump product version to 6.4.0.3
[LibreOffice.git] / drawinglayer / source / attribute / sdrsceneattribute3d.cxx
blob494edcb525b66222a3c3faf4dadb42066fe8cc42
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
26 namespace attribute
28 class ImpSdrSceneAttribute
30 public:
31 // 3D scene attribute definitions
32 double mfDistance;
33 double mfShadowSlant;
34 css::drawing::ProjectionMode maProjectionMode;
35 css::drawing::ShadeMode maShadeMode;
37 bool mbTwoSidedLighting : 1;
39 public:
40 ImpSdrSceneAttribute(
41 double fDistance,
42 double fShadowSlant,
43 css::drawing::ProjectionMode aProjectionMode,
44 css::drawing::ShadeMode aShadeMode,
45 bool bTwoSidedLighting)
46 : mfDistance(fDistance),
47 mfShadowSlant(fShadowSlant),
48 maProjectionMode(aProjectionMode),
49 maShadeMode(aShadeMode),
50 mbTwoSidedLighting(bTwoSidedLighting)
54 ImpSdrSceneAttribute()
55 : mfDistance(0.0),
56 mfShadowSlant(0.0),
57 maProjectionMode(css::drawing::ProjectionMode_PARALLEL),
58 maShadeMode(css::drawing::ShadeMode_FLAT),
59 mbTwoSidedLighting(false)
63 // data read access
64 double getShadowSlant() const { return mfShadowSlant; }
65 css::drawing::ProjectionMode getProjectionMode() const { return maProjectionMode; }
66 css::drawing::ShadeMode getShadeMode() const { return maShadeMode; }
67 bool getTwoSidedLighting() const { return mbTwoSidedLighting; }
69 bool operator==(const ImpSdrSceneAttribute& rCandidate) const
71 return (mfDistance == rCandidate.mfDistance
72 && getShadowSlant() == rCandidate.getShadowSlant()
73 && getProjectionMode() == rCandidate.getProjectionMode()
74 && getShadeMode() == rCandidate.getShadeMode()
75 && getTwoSidedLighting() == rCandidate.getTwoSidedLighting());
79 namespace
81 struct theGlobalDefault :
82 public rtl::Static< SdrSceneAttribute::ImplType, theGlobalDefault > {};
85 SdrSceneAttribute::SdrSceneAttribute(
86 double fDistance,
87 double fShadowSlant,
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::get())
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::get());
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())
120 return false;
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 attribute
146 } // end of namespace drawinglayer
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */