1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 #include <svx/svx3ditems.hxx> 27 #include <com/sun/star/drawing/NormalsKind.hpp> 28 #include <com/sun/star/drawing/TextureProjectionMode.hpp> 29 #include <com/sun/star/drawing/TextureKind.hpp> 30 #include <com/sun/star/drawing/TextureMode.hpp> 31 #include <com/sun/star/drawing/ProjectionMode.hpp> 32 #include <com/sun/star/drawing/ShadeMode.hpp> 33 34 35 ////////////////////////////////////////////////////////////////////////////// 36 37 using namespace ::rtl; 38 using namespace ::com::sun::star; 39 40 ////////////////////////////////////////////////////////////////////////////// 41 Svx3DPercentDiagonalItem::Svx3DPercentDiagonalItem(sal_uInt16 nVal) 42 : SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, nVal) 43 {} 44 45 Svx3DBackscaleItem::Svx3DBackscaleItem(sal_uInt16 nVal) 46 : SfxUInt16Item(SDRATTR_3DOBJ_BACKSCALE, nVal) 47 {} 48 49 Svx3DDepthItem::Svx3DDepthItem(sal_uInt32 nVal) 50 : SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, nVal) 51 {} 52 53 Svx3DHorizontalSegmentsItem::Svx3DHorizontalSegmentsItem(sal_uInt32 nVal) 54 : SfxUInt32Item(SDRATTR_3DOBJ_HORZ_SEGS, nVal) 55 {} 56 57 Svx3DVerticalSegmentsItem::Svx3DVerticalSegmentsItem(sal_uInt32 nVal) 58 : SfxUInt32Item(SDRATTR_3DOBJ_VERT_SEGS, nVal) 59 {} 60 61 Svx3DEndAngleItem::Svx3DEndAngleItem(sal_uInt32 nVal) 62 : SfxUInt32Item(SDRATTR_3DOBJ_END_ANGLE, nVal) 63 {} 64 65 Svx3DDoubleSidedItem::Svx3DDoubleSidedItem(sal_Bool bVal) 66 : SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, bVal) 67 {} 68 69 ////////////////////////////////////////////////////////////////////////////// 70 // #i28528# 71 // Added extra Item (Bool) for chart2 to be able to show reduced line geometry 72 73 Svx3DReducedLineGeometryItem::Svx3DReducedLineGeometryItem(sal_Bool bVal) 74 : SfxBoolItem(SDRATTR_3DOBJ_REDUCED_LINE_GEOMETRY, bVal) 75 {} 76 77 sal_uInt16 Svx3DReducedLineGeometryItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const 78 { 79 return 1; 80 } 81 82 SfxPoolItem* Svx3DReducedLineGeometryItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const 83 { 84 SfxBoolItem* pRetval = new Svx3DReducedLineGeometryItem(); 85 86 if(nItemVersion > 0) 87 { 88 SfxBoolItem aBoolItem(Which(), rIn); 89 pRetval->SetValue(aBoolItem.GetValue()); 90 } 91 92 return pRetval; 93 } 94 95 ////////////////////////////////////////////////////////////////////////////// 96 97 Svx3DNormalsKindItem::Svx3DNormalsKindItem(sal_uInt16 nVal) 98 : SfxUInt16Item(SDRATTR_3DOBJ_NORMALS_KIND, nVal) 99 {} 100 101 Svx3DNormalsInvertItem::Svx3DNormalsInvertItem(sal_Bool bVal) 102 : SfxBoolItem(SDRATTR_3DOBJ_NORMALS_INVERT, bVal) 103 {} 104 105 Svx3DTextureProjectionXItem::Svx3DTextureProjectionXItem(sal_uInt16 nVal) 106 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_X, nVal) 107 {} 108 109 Svx3DTextureProjectionYItem::Svx3DTextureProjectionYItem(sal_uInt16 nVal) 110 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_PROJ_Y, nVal) 111 {} 112 113 Svx3DShadow3DItem::Svx3DShadow3DItem(sal_Bool bVal) 114 : SfxBoolItem(SDRATTR_3DOBJ_SHADOW_3D, bVal) 115 {} 116 117 Svx3DMaterialColorItem::Svx3DMaterialColorItem(const Color& rCol) 118 : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_COLOR) 119 {} 120 121 Svx3DMaterialEmissionItem::Svx3DMaterialEmissionItem(const Color& rCol) 122 : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_EMISSION) 123 {} 124 125 Svx3DMaterialSpecularItem::Svx3DMaterialSpecularItem(const Color& rCol) 126 : SvxColorItem(rCol, SDRATTR_3DOBJ_MAT_SPECULAR) 127 {} 128 129 Svx3DMaterialSpecularIntensityItem::Svx3DMaterialSpecularIntensityItem(sal_uInt16 nVal) 130 : SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, nVal) 131 {} 132 133 Svx3DTextureKindItem::Svx3DTextureKindItem(sal_uInt16 nVal) 134 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_KIND, nVal) 135 {} 136 137 Svx3DTextureModeItem::Svx3DTextureModeItem(sal_uInt16 nVal) 138 : SfxUInt16Item(SDRATTR_3DOBJ_TEXTURE_MODE, nVal) 139 {} 140 141 Svx3DTextureFilterItem::Svx3DTextureFilterItem(sal_Bool bVal) 142 : SfxBoolItem(SDRATTR_3DOBJ_TEXTURE_FILTER, bVal) 143 {} 144 145 Svx3DPerspectiveItem::Svx3DPerspectiveItem(sal_uInt16 nVal) 146 : SfxUInt16Item(SDRATTR_3DSCENE_PERSPECTIVE, nVal) 147 {} 148 149 Svx3DDistanceItem::Svx3DDistanceItem(sal_uInt32 nVal) 150 : SfxUInt32Item(SDRATTR_3DSCENE_DISTANCE, nVal) 151 {} 152 153 Svx3DFocalLengthItem::Svx3DFocalLengthItem(sal_uInt32 nVal) 154 : SfxUInt32Item(SDRATTR_3DSCENE_FOCAL_LENGTH, nVal) 155 {} 156 157 Svx3DTwoSidedLightingItem::Svx3DTwoSidedLightingItem(sal_Bool bVal) 158 : SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, bVal) 159 {} 160 161 Svx3DLightcolor1Item::Svx3DLightcolor1Item(const Color& rCol) 162 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_1) 163 {} 164 165 Svx3DLightcolor2Item::Svx3DLightcolor2Item(const Color& rCol) 166 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_2) 167 {} 168 169 Svx3DLightcolor3Item::Svx3DLightcolor3Item(const Color& rCol) 170 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_3) 171 {} 172 173 Svx3DLightcolor4Item::Svx3DLightcolor4Item(const Color& rCol) 174 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_4) 175 {} 176 177 Svx3DLightcolor5Item::Svx3DLightcolor5Item(const Color& rCol) 178 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_5) 179 {} 180 181 Svx3DLightcolor6Item::Svx3DLightcolor6Item(const Color& rCol) 182 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_6) 183 {} 184 185 Svx3DLightcolor7Item::Svx3DLightcolor7Item(const Color& rCol) 186 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_7) 187 {} 188 189 Svx3DLightcolor8Item::Svx3DLightcolor8Item(const Color& rCol) 190 : SvxColorItem(rCol, SDRATTR_3DSCENE_LIGHTCOLOR_8) 191 {} 192 193 Svx3DAmbientcolorItem::Svx3DAmbientcolorItem(const Color& rCol) 194 : SvxColorItem(rCol, SDRATTR_3DSCENE_AMBIENTCOLOR) 195 {} 196 197 Svx3DLightOnOff1Item::Svx3DLightOnOff1Item(sal_Bool bVal) 198 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, bVal) 199 {} 200 201 Svx3DLightOnOff2Item::Svx3DLightOnOff2Item(sal_Bool bVal) 202 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, bVal) 203 {} 204 205 Svx3DLightOnOff3Item::Svx3DLightOnOff3Item(sal_Bool bVal) 206 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, bVal) 207 {} 208 209 Svx3DLightOnOff4Item::Svx3DLightOnOff4Item(sal_Bool bVal) 210 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_4, bVal) 211 {} 212 213 Svx3DLightOnOff5Item::Svx3DLightOnOff5Item(sal_Bool bVal) 214 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_5, bVal) 215 {} 216 217 Svx3DLightOnOff6Item::Svx3DLightOnOff6Item(sal_Bool bVal) 218 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_6, bVal) 219 {} 220 221 Svx3DLightOnOff7Item::Svx3DLightOnOff7Item(sal_Bool bVal) 222 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_7, bVal) 223 {} 224 225 Svx3DLightOnOff8Item::Svx3DLightOnOff8Item(sal_Bool bVal) 226 : SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_8, bVal) 227 {} 228 229 Svx3DLightDirection1Item::Svx3DLightDirection1Item(const basegfx::B3DVector& rVec) 230 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, rVec) 231 {} 232 233 Svx3DLightDirection2Item::Svx3DLightDirection2Item(const basegfx::B3DVector& rVec) 234 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, rVec) 235 {} 236 237 Svx3DLightDirection3Item::Svx3DLightDirection3Item(const basegfx::B3DVector& rVec) 238 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, rVec) 239 {} 240 241 Svx3DLightDirection4Item::Svx3DLightDirection4Item(const basegfx::B3DVector& rVec) 242 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_4, rVec) 243 {} 244 245 Svx3DLightDirection5Item::Svx3DLightDirection5Item(const basegfx::B3DVector& rVec) 246 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_5, rVec) 247 {} 248 249 Svx3DLightDirection6Item::Svx3DLightDirection6Item(const basegfx::B3DVector& rVec) 250 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_6, rVec) 251 {} 252 253 Svx3DLightDirection7Item::Svx3DLightDirection7Item(const basegfx::B3DVector& rVec) 254 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_7, rVec) 255 {} 256 257 Svx3DLightDirection8Item::Svx3DLightDirection8Item(const basegfx::B3DVector& rVec) 258 : SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_8, rVec) 259 {} 260 261 Svx3DShadowSlantItem::Svx3DShadowSlantItem(sal_uInt16 nVal) 262 : SfxUInt16Item(SDRATTR_3DSCENE_SHADOW_SLANT, nVal) 263 {} 264 265 Svx3DShadeModeItem::Svx3DShadeModeItem(sal_uInt16 nVal) 266 : SfxUInt16Item(SDRATTR_3DSCENE_SHADE_MODE, nVal) 267 {} 268 269 ////////////////////////////////////////////////////////////////////////////// 270 // #107245# 271 272 Svx3DSmoothNormalsItem::Svx3DSmoothNormalsItem(sal_Bool bVal) 273 : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_NORMALS, bVal) 274 {} 275 276 sal_uInt16 Svx3DSmoothNormalsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const 277 { 278 return 1; 279 } 280 281 SfxPoolItem* Svx3DSmoothNormalsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const 282 { 283 SfxBoolItem* pRetval = new Svx3DSmoothNormalsItem(); 284 285 if(nItemVersion > 0) 286 { 287 SfxBoolItem aBoolItem(Which(), rIn); 288 pRetval->SetValue(aBoolItem.GetValue()); 289 } 290 291 return pRetval; 292 } 293 294 ////////////////////////////////////////////////////////////////////////////// 295 // #107245# 296 297 Svx3DSmoothLidsItem::Svx3DSmoothLidsItem(sal_Bool bVal) 298 : SfxBoolItem(SDRATTR_3DOBJ_SMOOTH_LIDS, bVal) 299 {} 300 301 sal_uInt16 Svx3DSmoothLidsItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const 302 { 303 return 1; 304 } 305 306 SfxPoolItem* Svx3DSmoothLidsItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const 307 { 308 SfxBoolItem* pRetval = new Svx3DSmoothLidsItem(); 309 310 if(nItemVersion > 0) 311 { 312 SfxBoolItem aBoolItem(Which(), rIn); 313 pRetval->SetValue(aBoolItem.GetValue()); 314 } 315 316 return pRetval; 317 } 318 319 ////////////////////////////////////////////////////////////////////////////// 320 // #107245# 321 322 Svx3DCharacterModeItem::Svx3DCharacterModeItem(sal_Bool bVal) 323 : SfxBoolItem(SDRATTR_3DOBJ_CHARACTER_MODE, bVal) 324 {} 325 326 sal_uInt16 Svx3DCharacterModeItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const 327 { 328 return 1; 329 } 330 331 SfxPoolItem* Svx3DCharacterModeItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const 332 { 333 SfxBoolItem* pRetval = new Svx3DCharacterModeItem(); 334 335 if(nItemVersion > 0) 336 { 337 SfxBoolItem aBoolItem(Which(), rIn); 338 pRetval->SetValue(aBoolItem.GetValue()); 339 } 340 341 return pRetval; 342 } 343 344 ////////////////////////////////////////////////////////////////////////////// 345 // #107245# 346 347 Svx3DCloseFrontItem::Svx3DCloseFrontItem(sal_Bool bVal) 348 : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_FRONT, bVal) 349 {} 350 351 sal_uInt16 Svx3DCloseFrontItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const 352 { 353 return 1; 354 } 355 356 SfxPoolItem* Svx3DCloseFrontItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const 357 { 358 SfxBoolItem* pRetval = new Svx3DCloseFrontItem(); 359 360 if(nItemVersion > 0) 361 { 362 SfxBoolItem aBoolItem(Which(), rIn); 363 pRetval->SetValue(aBoolItem.GetValue()); 364 } 365 366 return pRetval; 367 } 368 369 ////////////////////////////////////////////////////////////////////////////// 370 // #107245# 371 372 Svx3DCloseBackItem::Svx3DCloseBackItem(sal_Bool bVal) 373 : SfxBoolItem(SDRATTR_3DOBJ_CLOSE_BACK, bVal) 374 {} 375 376 sal_uInt16 Svx3DCloseBackItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const 377 { 378 return 1; 379 } 380 381 SfxPoolItem* Svx3DCloseBackItem::Create(SvStream& rIn, sal_uInt16 nItemVersion) const 382 { 383 SfxBoolItem* pRetval = new Svx3DCloseBackItem(); 384 385 if(nItemVersion > 0) 386 { 387 SfxBoolItem aBoolItem(Which(), rIn); 388 pRetval->SetValue(aBoolItem.GetValue()); 389 } 390 391 return pRetval; 392 } 393 394 ////////////////////////////////////////////////////////////////////////////// 395 396 // Svx3DNormalsKindItem: use drawing::NormalsKind 397 sal_Bool Svx3DNormalsKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 398 { 399 rVal <<= (drawing::NormalsKind)GetValue(); 400 return sal_True; 401 } 402 403 sal_Bool Svx3DNormalsKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 404 { 405 drawing::NormalsKind eVar; 406 if(!(rVal >>= eVar)) 407 return sal_False; 408 SetValue((sal_Int16)eVar); 409 return sal_True; 410 } 411 412 SfxPoolItem* Svx3DNormalsKindItem::Clone(SfxItemPool* /*pPool*/) const 413 { 414 return new Svx3DNormalsKindItem(*this); 415 } 416 417 // Svx3DTextureProjectionXItem: use drawing::TextureProjectionMode 418 sal_Bool Svx3DTextureProjectionXItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 419 { 420 rVal <<= (drawing::TextureProjectionMode)GetValue(); 421 return sal_True; 422 } 423 424 sal_Bool Svx3DTextureProjectionXItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 425 { 426 drawing::TextureProjectionMode eVar; 427 if(!(rVal >>= eVar)) 428 return sal_False; 429 SetValue((sal_Int16)eVar); 430 return sal_True; 431 } 432 433 SfxPoolItem* Svx3DTextureProjectionXItem::Clone(SfxItemPool* /*pPool*/) const 434 { 435 return new Svx3DTextureProjectionXItem(*this); 436 } 437 438 // Svx3DTextureProjectionYItem: use drawing::TextureProjectionMode 439 sal_Bool Svx3DTextureProjectionYItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 440 { 441 rVal <<= (drawing::TextureProjectionMode)GetValue(); 442 return sal_True; 443 } 444 445 sal_Bool Svx3DTextureProjectionYItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 446 { 447 drawing::TextureProjectionMode eVar; 448 if(!(rVal >>= eVar)) 449 return sal_False; 450 SetValue((sal_Int16)eVar); 451 return sal_True; 452 } 453 454 SfxPoolItem* Svx3DTextureProjectionYItem::Clone(SfxItemPool* /*pPool*/) const 455 { 456 return new Svx3DTextureProjectionYItem(*this); 457 } 458 459 // Svx3DTextureKindItem: use drawing::TextureKind 460 sal_Bool Svx3DTextureKindItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 461 { 462 rVal <<= (drawing::TextureKind)GetValue(); 463 return sal_True; 464 } 465 466 sal_Bool Svx3DTextureKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 467 { 468 drawing::TextureKind eVar; 469 if(!(rVal >>= eVar)) 470 return sal_False; 471 SetValue((sal_Int16)eVar); 472 return sal_True; 473 } 474 475 SfxPoolItem* Svx3DTextureKindItem::Clone(SfxItemPool* /*pPool*/) const 476 { 477 return new Svx3DTextureKindItem(*this); 478 } 479 480 // Svx3DTextureModeItem: use drawing:TextureMode 481 sal_Bool Svx3DTextureModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 482 { 483 rVal <<= (drawing::TextureMode)GetValue(); 484 return sal_True; 485 } 486 487 sal_Bool Svx3DTextureModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 488 { 489 drawing::TextureMode eVar; 490 if(!(rVal >>= eVar)) 491 return sal_False; 492 SetValue((sal_Int16)eVar); 493 return sal_True; 494 } 495 496 SfxPoolItem* Svx3DTextureModeItem::Clone(SfxItemPool* /*pPool*/) const 497 { 498 return new Svx3DTextureModeItem(*this); 499 } 500 501 // Svx3DPerspectiveItem: use drawing::ProjectionMode 502 sal_Bool Svx3DPerspectiveItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 503 { 504 rVal <<= (drawing::ProjectionMode)GetValue(); 505 return sal_True; 506 } 507 508 sal_Bool Svx3DPerspectiveItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 509 { 510 drawing::ProjectionMode eVar; 511 if(!(rVal >>= eVar)) 512 return sal_False; 513 SetValue((sal_Int16)eVar); 514 return sal_True; 515 } 516 517 SfxPoolItem* Svx3DPerspectiveItem::Clone(SfxItemPool* /*pPool*/) const 518 { 519 return new Svx3DPerspectiveItem(*this); 520 } 521 522 // Svx3DShadeModeItem: use drawing::ShadeMode 523 sal_Bool Svx3DShadeModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const 524 { 525 rVal <<= (drawing::ShadeMode)GetValue(); 526 return sal_True; 527 } 528 529 sal_Bool Svx3DShadeModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/) 530 { 531 drawing::ShadeMode eVar; 532 if(!(rVal >>= eVar)) 533 return sal_False; 534 SetValue((sal_Int16)eVar); 535 return sal_True; 536 } 537 538 SfxPoolItem* Svx3DShadeModeItem::Clone(SfxItemPool* /*pPool*/) const 539 { 540 return new Svx3DShadeModeItem(*this); 541 } 542 543 // EOF 544