bump product version to 5.0.4.1
[LibreOffice.git] / svx / source / engine3d / svx3ditems.cxx
blob26ea71f7e73de38809b1ce52a00df9dda4f1134b
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 <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>
31 using namespace ::com::sun::star;
33 // #i28528#
34 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
36 Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(bool bVal)
37 : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal)
40 sal_uInt16 Svx3DReducedLineGeometryItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
42 return 1;
45 SfxPoolItem* Svx3DReducedLineGeometryItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
47 SfxBoolItem* pRetval = new Svx3DReducedLineGeometryItem();
49 if(nItemVersion > 0)
51 SfxBoolItem aBoolItem(Which(), rIn);
52 pRetval->SetValue(aBoolItem.GetValue());
55 return pRetval;
58 SfxPoolItem * Svx3DReducedLineGeometryItem::Clone(SfxItemPool *) const
60 return new Svx3DReducedLineGeometryItem(*this);
63 Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal)
64 : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal)
67 Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal)
68 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal)
71 Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal)
72 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal)
75 Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal)
76 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal)
79 Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal)
80 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal)
83 Svx3DPerspectiveItem::Svx3DPerspectiveItem(sal_uInt16 nVal)
84 : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, nVal)
87 Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal)
88 : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal)
92 // #107245#
94 Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(bool bVal)
95 : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal)
98 sal_uInt16 Svx3DSmoothNormalsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
100 return 1;
103 SfxPoolItem* Svx3DSmoothNormalsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
105 SfxBoolItem* pRetval = new Svx3DSmoothNormalsItem();
107 if(nItemVersion > 0)
109 SfxBoolItem aBoolItem(Which(), rIn);
110 pRetval->SetValue(aBoolItem.GetValue());
113 return pRetval;
116 SfxPoolItem * Svx3DSmoothNormalsItem::Clone(SfxItemPool *) const
118 return new Svx3DSmoothNormalsItem(*this);
121 // #107245#
123 Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(bool bVal)
124 : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal)
127 sal_uInt16 Svx3DSmoothLidsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
129 return 1;
132 SfxPoolItem* Svx3DSmoothLidsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
134 SfxBoolItem* pRetval = new Svx3DSmoothLidsItem();
136 if(nItemVersion > 0)
138 SfxBoolItem aBoolItem(Which(), rIn);
139 pRetval->SetValue(aBoolItem.GetValue());
142 return pRetval;
145 SfxPoolItem * Svx3DSmoothLidsItem::Clone(SfxItemPool *) const
147 return new Svx3DSmoothLidsItem(*this);
150 // #107245#
152 Svx3DCharacterModeItem::Svx3DCharacterModeItem(bool bVal)
153 : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal)
156 sal_uInt16 Svx3DCharacterModeItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
158 return 1;
161 SfxPoolItem* Svx3DCharacterModeItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
163 SfxBoolItem* pRetval = new Svx3DCharacterModeItem();
165 if(nItemVersion > 0)
167 SfxBoolItem aBoolItem(Which(), rIn);
168 pRetval->SetValue(aBoolItem.GetValue());
171 return pRetval;
174 SfxPoolItem * Svx3DCharacterModeItem::Clone(SfxItemPool *) const
176 return new Svx3DCharacterModeItem(*this);
179 // #107245#
181 Svx3DCloseFrontItem::Svx3DCloseFrontItem(bool bVal)
182 : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal)
185 sal_uInt16 Svx3DCloseFrontItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
187 return 1;
190 SfxPoolItem* Svx3DCloseFrontItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
192 SfxBoolItem* pRetval = new Svx3DCloseFrontItem();
194 if(nItemVersion > 0)
196 SfxBoolItem aBoolItem(Which(), rIn);
197 pRetval->SetValue(aBoolItem.GetValue());
200 return pRetval;
203 SfxPoolItem * Svx3DCloseFrontItem::Clone(SfxItemPool *) const
205 return new Svx3DCloseFrontItem(*this);
208 // #107245#
210 Svx3DCloseBackItem::Svx3DCloseBackItem(bool bVal)
211 : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal)
214 sal_uInt16 Svx3DCloseBackItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
216 return 1;
219 SfxPoolItem* Svx3DCloseBackItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
221 SfxBoolItem* pRetval = new Svx3DCloseBackItem();
223 if(nItemVersion > 0)
225 SfxBoolItem aBoolItem(Which(), rIn);
226 pRetval->SetValue(aBoolItem.GetValue());
229 return pRetval;
232 SfxPoolItem * Svx3DCloseBackItem::Clone(SfxItemPool *) const
234 return new Svx3DCloseBackItem(*this);
237 // Svx3DNormalsKindItem: use drawing::NormalsKind
238 bool Svx3DNormalsKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
240 rVal <<= (drawing::NormalsKind)GetValue();
241 return true;
244 bool Svx3DNormalsKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
246 drawing::NormalsKind eVar;
247 if(!(rVal >>= eVar))
248 return false;
249 SetValue((sal_Int16)eVar);
250 return true;
253 SfxPoolItem* Svx3DNormalsKindItem::Clone(SfxItemPool* /*pPool*/) const
255 return new Svx3DNormalsKindItem(*this);
258 // Svx3DTextureProjectionXItem: use drawing::TextureProjectionMode
259 bool Svx3DTextureProjectionXItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
261 rVal <<= (drawing::TextureProjectionMode)GetValue();
262 return true;
265 bool Svx3DTextureProjectionXItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
267 drawing::TextureProjectionMode eVar;
268 if(!(rVal >>= eVar))
269 return false;
270 SetValue((sal_Int16)eVar);
271 return true;
274 SfxPoolItem* Svx3DTextureProjectionXItem::Clone(SfxItemPool* /*pPool*/) const
276 return new Svx3DTextureProjectionXItem(*this);
279 // Svx3DTextureProjectionYItem: use drawing::TextureProjectionMode
280 bool Svx3DTextureProjectionYItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
282 rVal <<= (drawing::TextureProjectionMode)GetValue();
283 return true;
286 bool Svx3DTextureProjectionYItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
288 drawing::TextureProjectionMode eVar;
289 if(!(rVal >>= eVar))
290 return false;
291 SetValue((sal_Int16)eVar);
292 return true;
295 SfxPoolItem* Svx3DTextureProjectionYItem::Clone(SfxItemPool* /*pPool*/) const
297 return new Svx3DTextureProjectionYItem(*this);
300 // Svx3DTextureKindItem: use drawing::TextureKind
301 bool Svx3DTextureKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
303 rVal <<= (drawing::TextureKind)GetValue();
304 return true;
307 bool Svx3DTextureKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
309 drawing::TextureKind eVar;
310 if(!(rVal >>= eVar))
311 return false;
312 SetValue((sal_Int16)eVar);
313 return true;
316 SfxPoolItem* Svx3DTextureKindItem::Clone(SfxItemPool* /*pPool*/) const
318 return new Svx3DTextureKindItem(*this);
321 // Svx3DTextureModeItem: use drawing:TextureMode
322 bool Svx3DTextureModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
324 rVal <<= (drawing::TextureMode)GetValue();
325 return true;
328 bool Svx3DTextureModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
330 drawing::TextureMode eVar;
331 if(!(rVal >>= eVar))
332 return false;
333 SetValue((sal_Int16)eVar);
334 return true;
337 SfxPoolItem* Svx3DTextureModeItem::Clone(SfxItemPool* /*pPool*/) const
339 return new Svx3DTextureModeItem(*this);
342 // Svx3DPerspectiveItem: use drawing::ProjectionMode
343 bool Svx3DPerspectiveItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
345 rVal <<= (drawing::ProjectionMode)GetValue();
346 return true;
349 bool Svx3DPerspectiveItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
351 drawing::ProjectionMode eVar;
352 if(!(rVal >>= eVar))
353 return false;
354 SetValue((sal_Int16)eVar);
355 return true;
358 SfxPoolItem* Svx3DPerspectiveItem::Clone(SfxItemPool* /*pPool*/) const
360 return new Svx3DPerspectiveItem(*this);
363 // Svx3DShadeModeItem: use drawing::ShadeMode
364 bool Svx3DShadeModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
366 rVal <<= (drawing::ShadeMode)GetValue();
367 return true;
370 bool Svx3DShadeModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
372 drawing::ShadeMode eVar;
373 if(!(rVal >>= eVar))
374 return false;
375 SetValue((sal_Int16)eVar);
376 return true;
379 SfxPoolItem* Svx3DShadeModeItem::Clone(SfxItemPool* /*pPool*/) const
381 return new Svx3DShadeModeItem(*this);
384 // EOF
386 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */