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