LibreOffice Module drawinglayer (master) 1
sdrsceneattribute3d.cxx
Go to the documentation of this file.
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
21
22
24{
26 {
27 public:
28 // 3D scene attribute definitions
29 double mfDistance;
31 css::drawing::ProjectionMode maProjectionMode;
32 css::drawing::ShadeMode maShadeMode;
33
35
36 public:
38 double fDistance,
39 double fShadowSlant,
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)
48 {
49 }
50
52 : mfDistance(0.0),
53 mfShadowSlant(0.0),
54 maProjectionMode(css::drawing::ProjectionMode_PARALLEL),
55 maShadeMode(css::drawing::ShadeMode_FLAT),
57 {
58 }
59
60 // data read access
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; }
65
66 bool operator==(const ImpSdrSceneAttribute& rCandidate) const
67 {
68 return (mfDistance == rCandidate.mfDistance
69 && getShadowSlant() == rCandidate.getShadowSlant()
70 && getProjectionMode() == rCandidate.getProjectionMode()
71 && getShadeMode() == rCandidate.getShadeMode()
72 && getTwoSidedLighting() == rCandidate.getTwoSidedLighting());
73 }
74 };
75
76 namespace
77 {
78 SdrSceneAttribute::ImplType& theGlobalDefault()
79 {
80 static SdrSceneAttribute::ImplType SINGLETON;
81 return SINGLETON;
82 }
83 }
84
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))
93 {
94 }
95
97 : mpSdrSceneAttribute(theGlobalDefault())
98 {
99 }
100
102
104
106
108 {
109 return mpSdrSceneAttribute.same_object(theGlobalDefault());
110 }
111
113
115
117 {
118 // tdf#87509 default attr is always != non-default attr, even with same values
119 if(rCandidate.isDefault() != isDefault())
120 return false;
121
122 return rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute;
123 }
124
126 {
127 return mpSdrSceneAttribute->getShadowSlant();
128 }
129
130 css::drawing::ProjectionMode SdrSceneAttribute::getProjectionMode() const
131 {
132 return mpSdrSceneAttribute->getProjectionMode();
133 }
134
135 css::drawing::ShadeMode SdrSceneAttribute::getShadeMode() const
136 {
137 return mpSdrSceneAttribute->getShadeMode();
138 }
139
141 {
142 return mpSdrSceneAttribute->getTwoSidedLighting();
143 }
144
145} // end of namespace
146
147/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::drawing::ProjectionMode getProjectionMode() const
bool operator==(const ImpSdrSceneAttribute &rCandidate) const
ImpSdrSceneAttribute(double fDistance, double fShadowSlant, css::drawing::ProjectionMode aProjectionMode, css::drawing::ShadeMode aShadeMode, bool bTwoSidedLighting)
css::drawing::ProjectionMode getProjectionMode() const
bool operator==(const SdrSceneAttribute &rCandidate) const
SdrSceneAttribute & operator=(const SdrSceneAttribute &)
o3tl::cow_wrapper< ImpSdrSceneAttribute > ImplType
css::drawing::ShadeMode getShadeMode() const
bool same_object(const cow_wrapper &rOther) const