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 #ifndef INCLUDED_SVX_SVX3DITEMS_HXX
20 #define INCLUDED_SVX_SVX3DITEMS_HXX
21 
22 #include <svl/intitem.hxx>
23 #include <svl/eitem.hxx>
24 
25 
26 #include <editeng/colritem.hxx>
27 #include <svx/e3ditem.hxx>
28 #include <svx/viewpt3d.hxx>
29 #include <svx/svddef.hxx>
30 #include <svx/svxdllapi.h>
31 
32 // Svx3D _3DOBJ_ Items
makeSvx3DPercentDiagonalItem(sal_uInt16 nVal)33 inline SfxUInt16Item makeSvx3DPercentDiagonalItem(sal_uInt16 nVal) {
34     return SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nVal);
35 }
36 
makeSvx3DBackscaleItem(sal_uInt16 nVal)37 inline SfxUInt16Item makeSvx3DBackscaleItem(sal_uInt16 nVal) {
38     return SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nVal);
39 }
40 
makeSvx3DDepthItem(sal_uInt32 nVal)41 inline SfxUInt32Item makeSvx3DDepthItem(sal_uInt32 nVal) {
42     return SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nVal);
43 }
44 
makeSvx3DHorizontalSegmentsItem(sal_uInt32 nVal)45 inline SfxUInt32Item makeSvx3DHorizontalSegmentsItem(sal_uInt32 nVal) {
46     return SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nVal);
47 }
48 
makeSvx3DVerticalSegmentsItem(sal_uInt32 nVal)49 inline SfxUInt32Item makeSvx3DVerticalSegmentsItem(sal_uInt32 nVal) {
50     return SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nVal);
51 }
52 
makeSvx3DEndAngleItem(sal_uInt32 nVal)53 inline SfxUInt32Item makeSvx3DEndAngleItem(sal_uInt32 nVal) {
54     return SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, nVal);
55 }
56 
makeSvx3DDoubleSidedItem(bool bVal)57 inline SfxBoolItem makeSvx3DDoubleSidedItem(bool bVal) {
58     return SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bVal);
59 }
60 
61 // #i28528#
62 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry
63 class Svx3DReducedLineGeometryItem : public SfxBoolItem {
64 public:
65     Svx3DReducedLineGeometryItem(bool bVal = false);
66     SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
67 };
68 
69 class SVX_DLLPUBLIC Svx3DNormalsKindItem : public SfxUInt16Item {
70 public:
71     Svx3DNormalsKindItem(sal_uInt16 nVal = 0);
72 
73     // use drawing::NormalsKind
74     SVX_DLLPRIVATE virtual  bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
75     SVX_DLLPRIVATE virtual  bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
76     SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
77 };
78 
makeSvx3DNormalsInvertItem(bool bVal)79 inline SfxBoolItem makeSvx3DNormalsInvertItem(bool bVal) {
80     return SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bVal);
81 }
82 
83 class SVX_DLLPUBLIC Svx3DTextureProjectionXItem : public SfxUInt16Item {
84 public:
85     Svx3DTextureProjectionXItem(sal_uInt16 nVal = 0);
86 
87     // use drawing::TextureProjectionMode
88     SVX_DLLPRIVATE virtual  bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
89     SVX_DLLPRIVATE virtual  bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
90     SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
91 };
92 
93 class SVX_DLLPUBLIC Svx3DTextureProjectionYItem : public SfxUInt16Item {
94 public:
95     Svx3DTextureProjectionYItem(sal_uInt16 nVal = 0);
96 
97     // use drawing::TextureProjectionMode
98     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
99     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
100     virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
101 };
102 
makeSvx3DShadow3DItem(bool bVal)103 inline SfxBoolItem makeSvx3DShadow3DItem(bool bVal) {
104     return SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bVal);
105 }
106 
makeSvx3DMaterialEmissionItem(const Color & rCol)107 inline SvxColorItem makeSvx3DMaterialEmissionItem(const Color& rCol) {
108     return SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_EMISSION);
109 }
110 
makeSvx3DMaterialSpecularItem(const Color & rCol)111 inline SvxColorItem makeSvx3DMaterialSpecularItem(const Color& rCol) {
112     return SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_SPECULAR);
113 }
114 
makeSvx3DMaterialSpecularIntensityItem(sal_uInt16 nVal)115 inline SfxUInt16Item makeSvx3DMaterialSpecularIntensityItem(sal_uInt16 nVal) {
116     return SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nVal);
117 }
118 
119 class SVX_DLLPUBLIC Svx3DTextureKindItem final : public SfxUInt16Item {
120 public:
121     Svx3DTextureKindItem(sal_uInt16 nVal = 3);
122 
123     // use drawing::TextureKind
124     SVX_DLLPRIVATE virtual  bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
125     SVX_DLLPRIVATE virtual  bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
126     SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
127 };
128 
129 class SVX_DLLPUBLIC Svx3DTextureModeItem final : public SfxUInt16Item {
130 public:
131     Svx3DTextureModeItem(sal_uInt16 nVal = 2);
132 
133     // use drawing:TextureMode
134     SVX_DLLPRIVATE virtual  bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
135     SVX_DLLPRIVATE virtual  bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
136     SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
137 };
138 
makeSvx3DTextureFilterItem(bool bVal)139 inline SfxBoolItem makeSvx3DTextureFilterItem(bool bVal) {
140     return SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bVal);
141 }
142 
143 // Svx3D _3DSCENE_ Items
144 class SVX_DLLPUBLIC Svx3DPerspectiveItem : public SfxUInt16Item {
145 public:
146     Svx3DPerspectiveItem(ProjectionType nVal = ProjectionType::Perspective);
147 
148     // use drawing::ProjectionMode
149     SVX_DLLPRIVATE virtual  bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
150     SVX_DLLPRIVATE virtual  bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
151     SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
152 };
153 
makeSvx3DDistanceItem(sal_uInt32 nVal)154 inline SfxUInt32Item makeSvx3DDistanceItem(sal_uInt32 nVal) {
155     return SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, nVal);
156 }
157 
makeSvx3DFocalLengthItem(sal_uInt32 nVal)158 inline SfxUInt32Item makeSvx3DFocalLengthItem(sal_uInt32 nVal) {
159     return SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, nVal);
160 }
161 
makeSvx3DTwoSidedLightingItem(bool bVal)162 inline SfxBoolItem makeSvx3DTwoSidedLightingItem(bool bVal) {
163     return SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bVal);
164 }
165 
makeSvx3DLightcolor1Item(const Color & rCol)166 inline SvxColorItem makeSvx3DLightcolor1Item(const Color& rCol) {
167     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_1);
168 }
169 
makeSvx3DLightcolor2Item(const Color & rCol)170 inline SvxColorItem makeSvx3DLightcolor2Item(const Color& rCol) {
171     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_2);
172 }
173 
makeSvx3DLightcolor3Item(const Color & rCol)174 inline SvxColorItem makeSvx3DLightcolor3Item(const Color& rCol) {
175     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_3);
176 }
177 
makeSvx3DLightcolor4Item(const Color & rCol)178 inline SvxColorItem makeSvx3DLightcolor4Item(const Color& rCol) {
179     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_4);
180 }
181 
makeSvx3DLightcolor5Item(const Color & rCol)182 inline SvxColorItem makeSvx3DLightcolor5Item(const Color& rCol) {
183     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_5);
184 }
185 
makeSvx3DLightcolor6Item(const Color & rCol)186 inline SvxColorItem makeSvx3DLightcolor6Item(const Color& rCol) {
187     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_6);
188 }
189 
makeSvx3DLightcolor7Item(const Color & rCol)190 inline SvxColorItem makeSvx3DLightcolor7Item(const Color& rCol) {
191     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_7);
192 }
193 
makeSvx3DLightcolor8Item(const Color & rCol)194 inline SvxColorItem makeSvx3DLightcolor8Item(const Color& rCol) {
195     return SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_8);
196 }
197 
makeSvx3DAmbientcolorItem(const Color & rCol)198 inline SvxColorItem makeSvx3DAmbientcolorItem(const Color& rCol) {
199     return SvxColorItem(rCol, SDRATTR_3DSCENE_AMBIENTCOLOR);
200 }
201 
makeSvx3DLightOnOff1Item(bool bVal)202 inline SfxBoolItem makeSvx3DLightOnOff1Item(bool bVal) {
203     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bVal);
204 }
205 
makeSvx3DLightOnOff2Item(bool bVal)206 inline SfxBoolItem makeSvx3DLightOnOff2Item(bool bVal) {
207     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bVal);
208 }
209 
makeSvx3DLightOnOff3Item(bool bVal)210 inline SfxBoolItem makeSvx3DLightOnOff3Item(bool bVal) {
211     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bVal);
212 }
213 
makeSvx3DLightOnOff4Item(bool bVal)214 inline SfxBoolItem makeSvx3DLightOnOff4Item(bool bVal) {
215     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bVal);
216 }
217 
makeSvx3DLightOnOff5Item(bool bVal)218 inline SfxBoolItem makeSvx3DLightOnOff5Item(bool bVal) {
219     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bVal);
220 }
221 
makeSvx3DLightOnOff6Item(bool bVal)222 inline SfxBoolItem makeSvx3DLightOnOff6Item(bool bVal) {
223     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bVal);
224 }
225 
makeSvx3DLightOnOff7Item(bool bVal)226 inline SfxBoolItem makeSvx3DLightOnOff7Item(bool bVal) {
227     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bVal);
228 }
229 
makeSvx3DLightOnOff8Item(bool bVal)230 inline SfxBoolItem makeSvx3DLightOnOff8Item(bool bVal) {
231     return SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bVal);
232 }
233 
makeSvx3DLightDirection1Item(const basegfx::B3DVector & rVec)234 inline SvxB3DVectorItem makeSvx3DLightDirection1Item(const basegfx::B3DVector& rVec) {
235     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, rVec);
236 }
237 
makeSvx3DLightDirection2Item(const basegfx::B3DVector & rVec)238 inline SvxB3DVectorItem makeSvx3DLightDirection2Item(const basegfx::B3DVector& rVec) {
239     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, rVec);
240 }
241 
makeSvx3DLightDirection3Item(const basegfx::B3DVector & rVec)242 inline SvxB3DVectorItem makeSvx3DLightDirection3Item(const basegfx::B3DVector& rVec) {
243     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, rVec);
244 }
245 
makeSvx3DLightDirection4Item(const basegfx::B3DVector & rVec)246 inline SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector& rVec) {
247     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, rVec);
248 }
249 
makeSvx3DLightDirection5Item(const basegfx::B3DVector & rVec)250 inline SvxB3DVectorItem makeSvx3DLightDirection5Item(const basegfx::B3DVector& rVec) {
251     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, rVec);
252 }
253 
makeSvx3DLightDirection6Item(const basegfx::B3DVector & rVec)254 inline SvxB3DVectorItem makeSvx3DLightDirection6Item(const basegfx::B3DVector& rVec) {
255     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, rVec);
256 }
257 
makeSvx3DLightDirection7Item(const basegfx::B3DVector & rVec)258 inline SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector& rVec) {
259     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, rVec);
260 }
261 
makeSvx3DLightDirection8Item(const basegfx::B3DVector & rVec)262 inline SvxB3DVectorItem makeSvx3DLightDirection8Item(const basegfx::B3DVector& rVec) {
263     return SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, rVec);
264 }
265 
makeSvx3DShadowSlantItem(sal_uInt16 nVal)266 inline SfxUInt16Item makeSvx3DShadowSlantItem(sal_uInt16 nVal) {
267     return SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nVal);
268 }
269 
270 class SVX_DLLPUBLIC Svx3DShadeModeItem : public SfxUInt16Item {
271 public:
272     Svx3DShadeModeItem(sal_uInt16 nVal = 2);
273 
274     // use drawing::ShadeMode
275     SVX_DLLPRIVATE virtual  bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
276     SVX_DLLPRIVATE virtual  bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
277     SVX_DLLPRIVATE virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
278 };
279 
280 
281 // #107245# Item to replace bExtrudeSmoothed and bLatheSmoothed
282 class Svx3DSmoothNormalsItem : public SfxBoolItem {
283 public:
284     Svx3DSmoothNormalsItem(bool bVal = true);
285     SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
286 };
287 
288 // #107245# Item to replace bExtrudeSmoothFrontBack and bLatheSmoothFrontBack
289 class Svx3DSmoothLidsItem : public SfxBoolItem {
290 public:
291     Svx3DSmoothLidsItem(bool bVal = false);
292     SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
293 };
294 
295 // #107245# Item to replace bExtrudeCharacterMode and bLatheCharacterMode
296 class Svx3DCharacterModeItem : public SfxBoolItem {
297 public:
298     Svx3DCharacterModeItem(bool bVal = false);
299     SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
300 };
301 
302 // #107245# Item to replace bExtrudeCloseFront and bLatheCloseFront
303 class SVX_DLLPUBLIC Svx3DCloseFrontItem : public SfxBoolItem {
304 public:
305     Svx3DCloseFrontItem(bool bVal = true);
306     SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
307 };
308 
309 // #107245# Item to replace bExtrudeCloseBack and bLatheCloseBack
310 class SVX_DLLPUBLIC Svx3DCloseBackItem : public SfxBoolItem {
311 public:
312     Svx3DCloseBackItem(bool bVal = true);
313     SfxPoolItem * Clone(SfxItemPool * = nullptr) const override;
314 };
315 
316 #endif // INCLUDED_SVX_SVX3DITEMS_HXX
317 
318 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
319