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 <svx/svx3ditems.hxx>
21 #include <com/sun/star/drawing/NormalsKind.hpp>
22 #include <com/sun/star/drawing/TextureProjectionMode.hpp>
23 #include <com/sun/star/drawing/TextureKind.hpp>
24 #include <com/sun/star/drawing/TextureMode.hpp>
25 #include <com/sun/star/drawing/ProjectionMode.hpp>
26 #include <com/sun/star/drawing/ShadeMode.hpp>
27 
28 using namespace ::com::sun::star;
29 
30 // #i28528#
31 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
32 
Svx3DReducedLineGeometryItem(bool bVal)33 Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(bool bVal)
34     : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal)
35 {
36 }
37 
Clone(SfxItemPool *) const38 Svx3DReducedLineGeometryItem* Svx3DReducedLineGeometryItem::Clone(SfxItemPool*) const
39 {
40     return new Svx3DReducedLineGeometryItem(*this);
41 }
42 
Svx3DNormalsKindItem(sal_uInt16 nVal)43 Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal)
44     : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal)
45 {
46 }
47 
Svx3DTextureProjectionXItem(sal_uInt16 nVal)48 Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal)
49     : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal)
50 {
51 }
52 
Svx3DTextureProjectionYItem(sal_uInt16 nVal)53 Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal)
54     : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal)
55 {
56 }
57 
Svx3DTextureKindItem(sal_uInt16 nVal)58 Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal)
59     : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal)
60 {
61 }
62 
Svx3DTextureModeItem(sal_uInt16 nVal)63 Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal)
64     : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal)
65 {
66 }
67 
Svx3DPerspectiveItem(ProjectionType nVal)68 Svx3DPerspectiveItem::Svx3DPerspectiveItem(ProjectionType nVal)
69     : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, static_cast<sal_uInt16>(nVal))
70 {
71 }
72 
Svx3DShadeModeItem(sal_uInt16 nVal)73 Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal)
74     : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal)
75 {
76 }
77 
Svx3DSmoothNormalsItem(bool bVal)78 Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(bool bVal)
79     : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal)
80 {
81 }
82 
Clone(SfxItemPool *) const83 Svx3DSmoothNormalsItem* Svx3DSmoothNormalsItem::Clone(SfxItemPool*) const
84 {
85     return new Svx3DSmoothNormalsItem(*this);
86 }
87 
Svx3DSmoothLidsItem(bool bVal)88 Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(bool bVal)
89     : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal)
90 {
91 }
92 
Clone(SfxItemPool *) const93 Svx3DSmoothLidsItem* Svx3DSmoothLidsItem::Clone(SfxItemPool*) const
94 {
95     return new Svx3DSmoothLidsItem(*this);
96 }
97 
Svx3DCharacterModeItem(bool bVal)98 Svx3DCharacterModeItem::Svx3DCharacterModeItem(bool bVal)
99     : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal)
100 {
101 }
102 
Clone(SfxItemPool *) const103 Svx3DCharacterModeItem* Svx3DCharacterModeItem::Clone(SfxItemPool*) const
104 {
105     return new Svx3DCharacterModeItem(*this);
106 }
107 
Svx3DCloseFrontItem(bool bVal)108 Svx3DCloseFrontItem::Svx3DCloseFrontItem(bool bVal)
109     : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal)
110 {
111 }
112 
Clone(SfxItemPool *) const113 Svx3DCloseFrontItem* Svx3DCloseFrontItem::Clone(SfxItemPool*) const
114 {
115     return new Svx3DCloseFrontItem(*this);
116 }
117 
Svx3DCloseBackItem(bool bVal)118 Svx3DCloseBackItem::Svx3DCloseBackItem(bool bVal)
119     : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal)
120 {
121 }
122 
Clone(SfxItemPool *) const123 Svx3DCloseBackItem* Svx3DCloseBackItem::Clone(SfxItemPool*) const
124 {
125     return new Svx3DCloseBackItem(*this);
126 }
127 
128 // Svx3DNormalsKindItem: use drawing::NormalsKind
QueryValue(uno::Any & rVal,sal_uInt8) const129 bool Svx3DNormalsKindItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
130 {
131     rVal <<= static_cast<drawing::NormalsKind>(GetValue());
132     return true;
133 }
134 
PutValue(const uno::Any & rVal,sal_uInt8)135 bool Svx3DNormalsKindItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
136 {
137     drawing::NormalsKind eVar;
138     if (!(rVal >>= eVar))
139         return false;
140     SetValue(static_cast<sal_Int16>(eVar));
141     return true;
142 }
143 
Clone(SfxItemPool *) const144 Svx3DNormalsKindItem* Svx3DNormalsKindItem::Clone(SfxItemPool* /*pPool*/) const
145 {
146     return new Svx3DNormalsKindItem(*this);
147 }
148 
149 // Svx3DTextureProjectionXItem: use drawing::TextureProjectionMode
QueryValue(uno::Any & rVal,sal_uInt8) const150 bool Svx3DTextureProjectionXItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
151 {
152     rVal <<= static_cast<drawing::TextureProjectionMode>(GetValue());
153     return true;
154 }
155 
PutValue(const uno::Any & rVal,sal_uInt8)156 bool Svx3DTextureProjectionXItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
157 {
158     drawing::TextureProjectionMode eVar;
159     if (!(rVal >>= eVar))
160         return false;
161     SetValue(static_cast<sal_Int16>(eVar));
162     return true;
163 }
164 
Clone(SfxItemPool *) const165 Svx3DTextureProjectionXItem* Svx3DTextureProjectionXItem::Clone(SfxItemPool* /*pPool*/) const
166 {
167     return new Svx3DTextureProjectionXItem(*this);
168 }
169 
170 // Svx3DTextureProjectionYItem: use drawing::TextureProjectionMode
QueryValue(uno::Any & rVal,sal_uInt8) const171 bool Svx3DTextureProjectionYItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
172 {
173     rVal <<= static_cast<drawing::TextureProjectionMode>(GetValue());
174     return true;
175 }
176 
PutValue(const uno::Any & rVal,sal_uInt8)177 bool Svx3DTextureProjectionYItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
178 {
179     drawing::TextureProjectionMode eVar;
180     if (!(rVal >>= eVar))
181         return false;
182     SetValue(static_cast<sal_Int16>(eVar));
183     return true;
184 }
185 
Clone(SfxItemPool *) const186 Svx3DTextureProjectionYItem* Svx3DTextureProjectionYItem::Clone(SfxItemPool* /*pPool*/) const
187 {
188     return new Svx3DTextureProjectionYItem(*this);
189 }
190 
191 // Svx3DTextureKindItem: use drawing::TextureKind
QueryValue(uno::Any & rVal,sal_uInt8) const192 bool Svx3DTextureKindItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
193 {
194     rVal <<= static_cast<drawing::TextureKind>(GetValue());
195     return true;
196 }
197 
PutValue(const uno::Any & rVal,sal_uInt8)198 bool Svx3DTextureKindItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
199 {
200     drawing::TextureKind eVar;
201     if (!(rVal >>= eVar))
202         return false;
203     SetValue(static_cast<sal_Int16>(eVar));
204     return true;
205 }
206 
Clone(SfxItemPool *) const207 Svx3DTextureKindItem* Svx3DTextureKindItem::Clone(SfxItemPool* /*pPool*/) const
208 {
209     return new Svx3DTextureKindItem(*this);
210 }
211 
212 // Svx3DTextureModeItem: use drawing:TextureMode
QueryValue(uno::Any & rVal,sal_uInt8) const213 bool Svx3DTextureModeItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
214 {
215     rVal <<= static_cast<drawing::TextureMode>(GetValue());
216     return true;
217 }
218 
PutValue(const uno::Any & rVal,sal_uInt8)219 bool Svx3DTextureModeItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
220 {
221     drawing::TextureMode eVar;
222     if (!(rVal >>= eVar))
223         return false;
224     SetValue(static_cast<sal_Int16>(eVar));
225     return true;
226 }
227 
Clone(SfxItemPool *) const228 Svx3DTextureModeItem* Svx3DTextureModeItem::Clone(SfxItemPool* /*pPool*/) const
229 {
230     return new Svx3DTextureModeItem(*this);
231 }
232 
233 // Svx3DPerspectiveItem: use drawing::ProjectionMode
QueryValue(uno::Any & rVal,sal_uInt8) const234 bool Svx3DPerspectiveItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
235 {
236     rVal <<= static_cast<drawing::ProjectionMode>(GetValue());
237     return true;
238 }
239 
PutValue(const uno::Any & rVal,sal_uInt8)240 bool Svx3DPerspectiveItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
241 {
242     drawing::ProjectionMode eVar;
243     if (!(rVal >>= eVar))
244         return false;
245     SetValue(static_cast<sal_Int16>(eVar));
246     return true;
247 }
248 
Clone(SfxItemPool *) const249 Svx3DPerspectiveItem* Svx3DPerspectiveItem::Clone(SfxItemPool* /*pPool*/) const
250 {
251     return new Svx3DPerspectiveItem(*this);
252 }
253 
254 // Svx3DShadeModeItem: use drawing::ShadeMode
QueryValue(uno::Any & rVal,sal_uInt8) const255 bool Svx3DShadeModeItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
256 {
257     rVal <<= static_cast<drawing::ShadeMode>(GetValue());
258     return true;
259 }
260 
PutValue(const uno::Any & rVal,sal_uInt8)261 bool Svx3DShadeModeItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
262 {
263     drawing::ShadeMode eVar;
264     if (!(rVal >>= eVar))
265         return false;
266     SetValue(static_cast<sal_Int16>(eVar));
267     return true;
268 }
269 
Clone(SfxItemPool *) const270 Svx3DShadeModeItem* Svx3DShadeModeItem::Clone(SfxItemPool* /*pPool*/) const
271 {
272     return new Svx3DShadeModeItem(*this);
273 }
274 
275 // EOF
276 
277 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
278