Update ooo320-m1
[ooovba.git] / svx / source / engine3d / svx3ditems.cxx
blob75da20585f72765b9610ed4542520180bec35903
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svx3ditems.cxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/svx3ditems.hxx>
34 #include <com/sun/star/drawing/NormalsKind.hpp>
35 #include <com/sun/star/drawing/TextureProjectionMode.hpp>
36 #include <com/sun/star/drawing/TextureKind.hpp>
37 #include <com/sun/star/drawing/TextureMode.hpp>
38 #include <com/sun/star/drawing/ProjectionMode.hpp>
39 #include <com/sun/star/drawing/ShadeMode.hpp>
42 //////////////////////////////////////////////////////////////////////////////
44 using namespace ::rtl;
45 using namespace ::com::sun::star;
47 //////////////////////////////////////////////////////////////////////////////
48 Svx3DPercentDiagonalItem::Svx3DPercentDiagonalItem(sal_uInt16 nVal)
49 : SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nVal)
52 Svx3DBackscaleItem::Svx3DBackscaleItem(sal_uInt16 nVal)
53 : SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nVal)
56 Svx3DDepthItem::Svx3DDepthItem(sal_uInt32 nVal)
57 : SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nVal)
60 Svx3DHorizontalSegmentsItem::Svx3DHorizontalSegmentsItem(sal_uInt32 nVal)
61 : SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nVal)
64 Svx3DVerticalSegmentsItem::Svx3DVerticalSegmentsItem(sal_uInt32 nVal)
65 : SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nVal)
68 Svx3DEndAngleItem::Svx3DEndAngleItem(sal_uInt32 nVal)
69 : SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, nVal)
72 Svx3DDoubleSidedItem::Svx3DDoubleSidedItem(BOOL bVal)
73 : SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bVal)
76 //////////////////////////////////////////////////////////////////////////////
77 // #i28528#
78 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
80 Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(BOOL bVal)
81 : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal)
84 sal_uInt16 Svx3DReducedLineGeometryItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
86 return 1;
89 SfxPoolItem* Svx3DReducedLineGeometryItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
91 SfxBoolItem* pRetval = new Svx3DReducedLineGeometryItem();
93 if(nItemVersion > 0)
95 SfxBoolItem aBoolItem(Which(), rIn);
96 pRetval->SetValue(aBoolItem.GetValue());
99 return pRetval;
102 //////////////////////////////////////////////////////////////////////////////
104 Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal)
105 : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal)
108 Svx3DNormalsInvertItem::Svx3DNormalsInvertItem(BOOL bVal)
109 : SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bVal)
112 Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal)
113 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal)
116 Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal)
117 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal)
120 Svx3DShadow3DItem::Svx3DShadow3DItem(BOOL bVal)
121 : SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bVal)
124 Svx3DMaterialColorItem::Svx3DMaterialColorItem(const Color& rCol)
125 : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_COLOR)
128 Svx3DMaterialEmissionItem::Svx3DMaterialEmissionItem(const Color& rCol)
129 : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_EMISSION)
132 Svx3DMaterialSpecularItem::Svx3DMaterialSpecularItem(const Color& rCol)
133 : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_SPECULAR)
136 Svx3DMaterialSpecularIntensityItem::Svx3DMaterialSpecularIntensityItem(sal_uInt16 nVal)
137 : SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nVal)
140 Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal)
141 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal)
144 Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal)
145 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal)
148 Svx3DTextureFilterItem::Svx3DTextureFilterItem(BOOL bVal)
149 : SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bVal)
152 Svx3DPerspectiveItem::Svx3DPerspectiveItem(sal_uInt16 nVal)
153 : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, nVal)
156 Svx3DDistanceItem::Svx3DDistanceItem(sal_uInt32 nVal)
157 : SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, nVal)
160 Svx3DFocalLengthItem::Svx3DFocalLengthItem(sal_uInt32 nVal)
161 : SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, nVal)
164 Svx3DTwoSidedLightingItem::Svx3DTwoSidedLightingItem(BOOL bVal)
165 : SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bVal)
168 Svx3DLightcolor1Item::Svx3DLightcolor1Item(const Color& rCol)
169 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_1)
172 Svx3DLightcolor2Item::Svx3DLightcolor2Item(const Color& rCol)
173 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_2)
176 Svx3DLightcolor3Item::Svx3DLightcolor3Item(const Color& rCol)
177 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_3)
180 Svx3DLightcolor4Item::Svx3DLightcolor4Item(const Color& rCol)
181 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_4)
184 Svx3DLightcolor5Item::Svx3DLightcolor5Item(const Color& rCol)
185 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_5)
188 Svx3DLightcolor6Item::Svx3DLightcolor6Item(const Color& rCol)
189 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_6)
192 Svx3DLightcolor7Item::Svx3DLightcolor7Item(const Color& rCol)
193 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_7)
196 Svx3DLightcolor8Item::Svx3DLightcolor8Item(const Color& rCol)
197 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_8)
200 Svx3DAmbientcolorItem::Svx3DAmbientcolorItem(const Color& rCol)
201 : SvxColorItem(rCol, SDRATTR_3DSCENE_AMBIENTCOLOR)
204 Svx3DLightOnOff1Item::Svx3DLightOnOff1Item(BOOL bVal)
205 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bVal)
208 Svx3DLightOnOff2Item::Svx3DLightOnOff2Item(BOOL bVal)
209 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bVal)
212 Svx3DLightOnOff3Item::Svx3DLightOnOff3Item(BOOL bVal)
213 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bVal)
216 Svx3DLightOnOff4Item::Svx3DLightOnOff4Item(BOOL bVal)
217 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bVal)
220 Svx3DLightOnOff5Item::Svx3DLightOnOff5Item(BOOL bVal)
221 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bVal)
224 Svx3DLightOnOff6Item::Svx3DLightOnOff6Item(BOOL bVal)
225 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bVal)
228 Svx3DLightOnOff7Item::Svx3DLightOnOff7Item(BOOL bVal)
229 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bVal)
232 Svx3DLightOnOff8Item::Svx3DLightOnOff8Item(BOOL bVal)
233 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bVal)
236 Svx3DLightDirection1Item::Svx3DLightDirection1Item(const basegfx::B3DVector& rVec)
237 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, rVec)
240 Svx3DLightDirection2Item::Svx3DLightDirection2Item(const basegfx::B3DVector& rVec)
241 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, rVec)
244 Svx3DLightDirection3Item::Svx3DLightDirection3Item(const basegfx::B3DVector& rVec)
245 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, rVec)
248 Svx3DLightDirection4Item::Svx3DLightDirection4Item(const basegfx::B3DVector& rVec)
249 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, rVec)
252 Svx3DLightDirection5Item::Svx3DLightDirection5Item(const basegfx::B3DVector& rVec)
253 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, rVec)
256 Svx3DLightDirection6Item::Svx3DLightDirection6Item(const basegfx::B3DVector& rVec)
257 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, rVec)
260 Svx3DLightDirection7Item::Svx3DLightDirection7Item(const basegfx::B3DVector& rVec)
261 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, rVec)
264 Svx3DLightDirection8Item::Svx3DLightDirection8Item(const basegfx::B3DVector& rVec)
265 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, rVec)
268 Svx3DShadowSlantItem::Svx3DShadowSlantItem(sal_uInt16 nVal)
269 : SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nVal)
272 Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal)
273 : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal)
276 //////////////////////////////////////////////////////////////////////////////
277 // #107245#
279 Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(BOOL bVal)
280 : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal)
283 sal_uInt16 Svx3DSmoothNormalsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
285 return 1;
288 SfxPoolItem* Svx3DSmoothNormalsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
290 SfxBoolItem* pRetval = new Svx3DSmoothNormalsItem();
292 if(nItemVersion > 0)
294 SfxBoolItem aBoolItem(Which(), rIn);
295 pRetval->SetValue(aBoolItem.GetValue());
298 return pRetval;
301 //////////////////////////////////////////////////////////////////////////////
302 // #107245#
304 Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(BOOL bVal)
305 : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal)
308 sal_uInt16 Svx3DSmoothLidsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
310 return 1;
313 SfxPoolItem* Svx3DSmoothLidsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
315 SfxBoolItem* pRetval = new Svx3DSmoothLidsItem();
317 if(nItemVersion > 0)
319 SfxBoolItem aBoolItem(Which(), rIn);
320 pRetval->SetValue(aBoolItem.GetValue());
323 return pRetval;
326 //////////////////////////////////////////////////////////////////////////////
327 // #107245#
329 Svx3DCharacterModeItem::Svx3DCharacterModeItem(BOOL bVal)
330 : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal)
333 sal_uInt16 Svx3DCharacterModeItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
335 return 1;
338 SfxPoolItem* Svx3DCharacterModeItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
340 SfxBoolItem* pRetval = new Svx3DCharacterModeItem();
342 if(nItemVersion > 0)
344 SfxBoolItem aBoolItem(Which(), rIn);
345 pRetval->SetValue(aBoolItem.GetValue());
348 return pRetval;
351 //////////////////////////////////////////////////////////////////////////////
352 // #107245#
354 Svx3DCloseFrontItem::Svx3DCloseFrontItem(BOOL bVal)
355 : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal)
358 sal_uInt16 Svx3DCloseFrontItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
360 return 1;
363 SfxPoolItem* Svx3DCloseFrontItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
365 SfxBoolItem* pRetval = new Svx3DCloseFrontItem();
367 if(nItemVersion > 0)
369 SfxBoolItem aBoolItem(Which(), rIn);
370 pRetval->SetValue(aBoolItem.GetValue());
373 return pRetval;
376 //////////////////////////////////////////////////////////////////////////////
377 // #107245#
379 Svx3DCloseBackItem::Svx3DCloseBackItem(BOOL bVal)
380 : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal)
383 sal_uInt16 Svx3DCloseBackItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
385 return 1;
388 SfxPoolItem* Svx3DCloseBackItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const
390 SfxBoolItem* pRetval = new Svx3DCloseBackItem();
392 if(nItemVersion > 0)
394 SfxBoolItem aBoolItem(Which(), rIn);
395 pRetval->SetValue(aBoolItem.GetValue());
398 return pRetval;
401 //////////////////////////////////////////////////////////////////////////////
403 // Svx3DNormalsKindItem: use drawing::NormalsKind
404 sal_Bool Svx3DNormalsKindItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
406 rVal <<= (drawing::NormalsKind)GetValue();
407 return sal_True;
410 sal_Bool Svx3DNormalsKindItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
412 drawing::NormalsKind eVar;
413 if(!(rVal >>= eVar))
414 return sal_False;
415 SetValue((sal_Int16)eVar);
416 return sal_True;
419 SfxPoolItem* Svx3DNormalsKindItem::Clone(SfxItemPool* /*pPool*/) const
421 return new Svx3DNormalsKindItem(*this);
424 // Svx3DTextureProjectionXItem: use drawing::TextureProjectionMode
425 sal_Bool Svx3DTextureProjectionXItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
427 rVal <<= (drawing::TextureProjectionMode)GetValue();
428 return sal_True;
431 sal_Bool Svx3DTextureProjectionXItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
433 drawing::TextureProjectionMode eVar;
434 if(!(rVal >>= eVar))
435 return sal_False;
436 SetValue((sal_Int16)eVar);
437 return sal_True;
440 SfxPoolItem* Svx3DTextureProjectionXItem::Clone(SfxItemPool* /*pPool*/) const
442 return new Svx3DTextureProjectionXItem(*this);
445 // Svx3DTextureProjectionYItem: use drawing::TextureProjectionMode
446 sal_Bool Svx3DTextureProjectionYItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
448 rVal <<= (drawing::TextureProjectionMode)GetValue();
449 return sal_True;
452 sal_Bool Svx3DTextureProjectionYItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
454 drawing::TextureProjectionMode eVar;
455 if(!(rVal >>= eVar))
456 return sal_False;
457 SetValue((sal_Int16)eVar);
458 return sal_True;
461 SfxPoolItem* Svx3DTextureProjectionYItem::Clone(SfxItemPool* /*pPool*/) const
463 return new Svx3DTextureProjectionYItem(*this);
466 // Svx3DTextureKindItem: use drawing::TextureKind
467 sal_Bool Svx3DTextureKindItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
469 rVal <<= (drawing::TextureKind)GetValue();
470 return sal_True;
473 sal_Bool Svx3DTextureKindItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
475 drawing::TextureKind eVar;
476 if(!(rVal >>= eVar))
477 return sal_False;
478 SetValue((sal_Int16)eVar);
479 return sal_True;
482 SfxPoolItem* Svx3DTextureKindItem::Clone(SfxItemPool* /*pPool*/) const
484 return new Svx3DTextureKindItem(*this);
487 // Svx3DTextureModeItem: use drawing:TextureMode
488 sal_Bool Svx3DTextureModeItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
490 rVal <<= (drawing::TextureMode)GetValue();
491 return sal_True;
494 sal_Bool Svx3DTextureModeItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
496 drawing::TextureMode eVar;
497 if(!(rVal >>= eVar))
498 return sal_False;
499 SetValue((sal_Int16)eVar);
500 return sal_True;
503 SfxPoolItem* Svx3DTextureModeItem::Clone(SfxItemPool* /*pPool*/) const
505 return new Svx3DTextureModeItem(*this);
508 // Svx3DPerspectiveItem: use drawing::ProjectionMode
509 sal_Bool Svx3DPerspectiveItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
511 rVal <<= (drawing::ProjectionMode)GetValue();
512 return sal_True;
515 sal_Bool Svx3DPerspectiveItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
517 drawing::ProjectionMode eVar;
518 if(!(rVal >>= eVar))
519 return sal_False;
520 SetValue((sal_Int16)eVar);
521 return sal_True;
524 SfxPoolItem* Svx3DPerspectiveItem::Clone(SfxItemPool* /*pPool*/) const
526 return new Svx3DPerspectiveItem(*this);
529 // Svx3DShadeModeItem: use drawing::ShadeMode
530 sal_Bool Svx3DShadeModeItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/) const
532 rVal <<= (drawing::ShadeMode)GetValue();
533 return sal_True;
536 sal_Bool Svx3DShadeModeItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/)
538 drawing::ShadeMode eVar;
539 if(!(rVal >>= eVar))
540 return sal_False;
541 SetValue((sal_Int16)eVar);
542 return sal_True;
545 SfxPoolItem* Svx3DShadeModeItem::Clone(SfxItemPool* /*pPool*/) const
547 return new Svx3DShadeModeItem(*this);
550 // EOF