21 #include <com/sun/star/drawing/EnhancedCustomShapeMetalType.hpp>
22 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
23 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
24 #include <com/sun/star/drawing/ShadeMode.hpp>
25 #include <com/sun/star/drawing/Position3D.hpp>
26 #include <com/sun/star/drawing/Direction3D.hpp>
27 #include <com/sun/star/drawing/ProjectionMode.hpp>
28 #include <svx/svxids.hrc>
37 #include <svx/strings.hrc>
43 #include <rtl/math.hxx>
49 using namespace ::
svx;
50 using namespace ::
cppu;
59 { 0, SfxGroupId::NONE, SfxSlotMode::NONE, 0, 0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, 0, SfxDisableFlags::NONE,
nullptr }
66 GetStaticInterface()->RegisterObjectBar(
SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Svx_Extrusion_Bar);
73 DBG_ASSERT( pViewShell,
"svx::ExtrusionBar::ExtrusionBar(), I need a viewshell!" );
88 static const Direction3D aLighting1Defaults[9] =
90 Direction3D( -50000, -50000, 10000 ),
91 Direction3D( 0, -50000, 10000 ),
92 Direction3D( 50000, -50000, 10000 ),
93 Direction3D( -50000, 0, 10000 ),
94 Direction3D( 0, 0, 10000 ),
95 Direction3D( 50000, 0, 10000 ),
96 Direction3D( -50000, 50000, 10000 ),
97 Direction3D( 0, 50000, 10000 ),
98 Direction3D( 50000, 50000, 10000 )
101 static const Direction3D aLighting2Defaults[9] =
103 Direction3D( 50000,0, 10000 ),
104 Direction3D( 0, 50000, 10000 ),
105 Direction3D( -50000, 0, 10000 ),
106 Direction3D( 50000, 0, 10000 ),
107 Direction3D( 0, 0, 10000 ),
108 Direction3D( -50000, 0, 10000 ),
109 Direction3D( 50000, 0, 10000 ),
110 Direction3D( 0, -50000, 10000 ),
111 Direction3D( -50000, 0, 10000 )
114 *pLighting1Defaults = aLighting1Defaults;
115 *pLighting2Defaults = aLighting2Defaults;
120 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
121 static constexpr OUStringLiteral sRotateAngle =
u"RotateAngle";
123 sal_uInt16 nSID = rReq.
GetSlot();
126 case SID_EXTRUSION_TOGGLE:
134 css::beans::PropertyValue aPropValue;
135 aPropValue.Name = sExtrusion;
136 aPropValue.Value <<= bOn;
141 css::beans::PropertyValue aPropValue;
142 aPropValue.Name = sExtrusion;
143 aPropValue.Value <<=
true;
158 css::beans::PropertyValue aPropValue;
159 aPropValue.Name =
u"Diffusion";
160 aPropValue.Value <<= 100.0;
167 case SID_EXTRUSION_TILT_DOWN:
168 case SID_EXTRUSION_TILT_UP:
169 case SID_EXTRUSION_TILT_LEFT:
170 case SID_EXTRUSION_TILT_RIGHT:
172 bool bHorizontal = ( nSID == SID_EXTRUSION_TILT_DOWN ) || ( nSID == SID_EXTRUSION_TILT_UP );
173 sal_Int32 nDiff = ( nSID == SID_EXTRUSION_TILT_LEFT ) || ( nSID == SID_EXTRUSION_TILT_UP ) ? 5 : -5;
174 EnhancedCustomShapeParameterPair aRotateAnglePropPair;
177 aRotateAnglePropPair.First.Value <<= fX;
178 aRotateAnglePropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
179 aRotateAnglePropPair.Second.Value <<= fY;
180 aRotateAnglePropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
182 if( pAny && ( *pAny >>= aRotateAnglePropPair ) )
184 aRotateAnglePropPair.First.Value >>= fX;
185 aRotateAnglePropPair.Second.Value >>= fY;
191 aRotateAnglePropPair.First.Value <<= fX;
192 aRotateAnglePropPair.Second.Value <<= fY;
193 css::beans::PropertyValue aPropValue;
194 aPropValue.Name = sRotateAngle;
195 aPropValue.Value <<= aRotateAnglePropPair;
200 case SID_EXTRUSION_DIRECTION:
206 Position3D aViewPoint( 3472, -3472, 25000 );
207 double fOriginX = 0.50;
208 double fOriginY = -0.50;
209 double fSkewAngle = nSkew;
215 aViewPoint.PositionY = 3472;
219 aViewPoint.PositionX = 0;
220 aViewPoint.PositionY = 3472;
225 aViewPoint.PositionX = -3472;
226 aViewPoint.PositionY = 3472;
231 aViewPoint.PositionY = 0;
235 aViewPoint.PositionX = 0;
236 aViewPoint.PositionY = 0;
242 aViewPoint.PositionX = -3472;
243 aViewPoint.PositionY = 0;
248 aViewPoint.PositionX = 0;
252 aViewPoint.PositionX = -3472;
257 css::beans::PropertyValue aPropValue;
259 aPropValue.Name =
"ViewPoint";
260 aPropValue.Value <<= aViewPoint;
264 EnhancedCustomShapeParameterPair aOriginPropPair;
265 aOriginPropPair.First.Value <<= fOriginX;
266 aOriginPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
267 aOriginPropPair.Second.Value <<= fOriginY;
268 aOriginPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
269 aPropValue.Name =
"Origin";
270 aPropValue.Value <<= aOriginPropPair;
273 EnhancedCustomShapeParameterPair aSkewPropPair;
274 aSkewPropPair.First.Value <<= fSkew;
275 aSkewPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
276 aSkewPropPair.Second.Value <<= fSkewAngle;
277 aSkewPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
278 aPropValue.Name =
"Skew";
279 aPropValue.Value <<= aSkewPropPair;
284 case SID_EXTRUSION_PROJECTION:
289 ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
290 css::beans::PropertyValue aPropValue;
291 aPropValue.Name =
"ProjectionMode";
292 aPropValue.Value <<= eProjectionMode;
297 case SID_EXTRUSION_DEPTH:
302 EnhancedCustomShapeParameterPair aDepthPropPair;
303 aDepthPropPair.First.Value <<= fDepth;
304 aDepthPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
305 aDepthPropPair.Second.Value <<= 0.0;
306 aDepthPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
308 css::beans::PropertyValue aPropValue;
309 aPropValue.Name =
"Depth";
310 aPropValue.Value <<= aDepthPropPair;
315 case SID_EXTRUSION_3D_COLOR:
321 const bool bAuto = aColor ==
COL_AUTO;
323 css::beans::PropertyValue aPropValue;
324 aPropValue.Name =
"Color";
325 aPropValue.Value <<= !bAuto;
340 case SID_EXTRUSION_SURFACE:
347 ShadeMode eOldShadeMode(ShadeMode_FLAT);
350 *pAny >>= eOldShadeMode;
351 ShadeMode eShadeMode(eOldShadeMode);
355 eShadeMode = ShadeMode_DRAFT;
361 if (eOldShadeMode == ShadeMode_DRAFT)
362 eShadeMode = ShadeMode_FLAT;
369 double fOldSpecularity = 0.0;
372 *pAny >>= fOldSpecularity;
373 double fSpecularity = fOldSpecularity;
387 fSpecularity = 80000.0 / 655.36;
395 double fOldDiffusion = 100.0;
398 *pAny >>= fOldDiffusion;
399 double fDiffusion = fOldDiffusion;
402 if (fOldDiffusion == 100.0)
403 fDiffusion = 43712.0 / 655.36;
411 css::beans::PropertyValue aPropValue;
412 aPropValue.Name =
"ShadeMode";
413 aPropValue.Value <<= eShadeMode;
416 aPropValue.Name =
"Metal";
417 aPropValue.Value <<= nSurface == 3 || nSurface == 4;
420 if (nSurface == 3 || nSurface == 4)
422 aPropValue.Name =
"MetalType";
423 aPropValue.Value <<= nSurface == 4
424 ? EnhancedCustomShapeMetalType::MetalMSCompatible
425 : EnhancedCustomShapeMetalType::MetalODF;
431 aPropValue.Name =
"Specularity";
432 aPropValue.Value <<= fSpecularity;
438 aPropValue.Name =
"Diffusion";
439 aPropValue.Value <<= fDiffusion;
445 case SID_EXTRUSION_LIGHTING_INTENSITY:
475 css::beans::PropertyValue aPropValue;
476 aPropValue.Name =
"Brightness";
477 aPropValue.Value <<= fBrightness;
480 aPropValue.Name =
"FirstLightLevel";
481 aPropValue.Value <<= fLevel1;
484 aPropValue.Name =
"SecondLightLevel";
485 aPropValue.Value <<= fLevel2;
490 aPropValue.Name =
"SecondLightHarsh";
491 aPropValue.Value <<= nLevel == 2;
496 case SID_EXTRUSION_LIGHTING_DIRECTION:
502 if((nDirection >= 0) && (nDirection < 9))
504 const Direction3D * pLighting1Defaults;
505 const Direction3D * pLighting2Defaults;
509 css::beans::PropertyValue aPropValue;
510 aPropValue.Name =
"FirstLightDirection";
511 aPropValue.Value <<= pLighting1Defaults[nDirection];
514 aPropValue.Name =
"SecondLightDirection";
515 aPropValue.Value <<= pLighting2Defaults[nDirection];
527 sal_uInt16 nSID = rReq.
GetSlot();
534 case SID_EXTRUSION_TOGGLE:
537 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF;
540 case SID_EXTRUSION_TILT_DOWN:
543 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN;
546 case SID_EXTRUSION_TILT_UP:
549 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP;
552 case SID_EXTRUSION_TILT_LEFT:
555 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT;
558 case SID_EXTRUSION_TILT_RIGHT:
561 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT;
564 case SID_EXTRUSION_DIRECTION:
567 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION;
570 case SID_EXTRUSION_PROJECTION:
573 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION;
576 case SID_EXTRUSION_DEPTH:
579 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH;
582 case SID_EXTRUSION_3D_COLOR:
585 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR;
588 case SID_EXTRUSION_SURFACE:
591 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE;
594 case SID_EXTRUSION_LIGHTING_INTENSITY:
597 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS;
600 case SID_EXTRUSION_LIGHTING_DIRECTION:
603 pStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING;
610 for(
size_t i=0;
i<nCount; ++
i)
613 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
638 case SID_EXTRUSION_DEPTH_DIALOG:
647 sal_uInt16 nRet = aDlg.
run();
650 fDepth = aDlg.getDepth();
654 rBindings.
Execute( SID_EXTRUSION_DEPTH, const_cast<const SfxPoolItem**>(aItems) );
660 if( nSID != SID_EXTRUSION_TOGGLE )
663 static const sal_uInt16
SidArray[] = {
664 SID_EXTRUSION_TILT_DOWN,
665 SID_EXTRUSION_TILT_UP,
666 SID_EXTRUSION_TILT_LEFT,
667 SID_EXTRUSION_TILT_RIGHT,
668 SID_EXTRUSION_DEPTH_FLOATER,
669 SID_EXTRUSION_DIRECTION_FLOATER,
670 SID_EXTRUSION_LIGHTING_FLOATER,
671 SID_EXTRUSION_SURFACE_FLOATER,
672 SID_EXTRUSION_3D_COLOR,
674 SID_EXTRUSION_DIRECTION,
675 SID_EXTRUSION_PROJECTION,
676 SID_EXTRUSION_LIGHTING_DIRECTION,
677 SID_EXTRUSION_LIGHTING_INTENSITY,
678 SID_EXTRUSION_SURFACE,
689 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
691 const css::uno::Any* pAny;
693 double fFinalSkewAngle = -1;
694 bool bHasCustomShape =
false;
696 for(
size_t i=0;
i<nCount; ++
i)
699 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
704 if( !bHasCustomShape )
706 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
708 *pAny_ >>= bHasCustomShape;
710 if( !bHasCustomShape )
714 bool bParallel =
true;
715 Position3D aViewPoint( 3472, -3472, 25000 );
716 double fSkewAngle = -135;
718 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"ProjectionMode" );
719 sal_Int16 nProjectionMode = sal_Int16();
720 if( pAny && ( *pAny >>= nProjectionMode ) )
721 bParallel =
static_cast<ProjectionMode
>(nProjectionMode) == ProjectionMode_PARALLEL;
726 EnhancedCustomShapeParameterPair aSkewPropPair;
727 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"Skew" );
728 if( pAny && ( *pAny >>= aSkewPropPair ) )
730 aSkewPropPair.First.Value >>= fSkew;
731 aSkewPropPair.Second.Value >>= fSkewAngle;
735 else if ( fSkewAngle == 0.0 )
740 double fOriginX = 0.50;
741 double fOriginY = -0.50;
742 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"ViewPoint" );
744 *pAny >>= aViewPoint;
746 EnhancedCustomShapeParameterPair aOriginPropPair;
747 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"Origin" );
748 if( pAny && ( *pAny >>= aOriginPropPair ) )
750 aOriginPropPair.First.Value >>= fOriginX;
751 aOriginPropPair.Second.Value >>= fOriginY;
754 const double e = 0.0001;
755 if( aViewPoint.PositionX > e )
757 if( aViewPoint.PositionY > e )
759 if( (fOriginX > e ) && ( fOriginY > e ) )
762 else if( aViewPoint.PositionY < -e )
764 if( ( fOriginX > e ) && ( fOriginY < -e ) )
769 if( ( fOriginX > e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
773 else if( aViewPoint.PositionX < -e )
775 if( aViewPoint.PositionY < -e )
777 if( ( fOriginX < -e ) && ( fOriginY < -e ) )
780 else if( aViewPoint.PositionY > e )
782 if( ( fOriginX < -e ) && ( fOriginY > e ) )
787 if( ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
793 if( aViewPoint.PositionY < -e )
795 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY < -e ) )
798 else if( aViewPoint.PositionY > e )
800 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > e ) )
805 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
811 if( rtl::math::approxEqual(fFinalSkewAngle, -1.0) )
813 fFinalSkewAngle = fSkewAngle;
815 else if( !rtl::math::approxEqual(fSkewAngle, fFinalSkewAngle) )
817 fFinalSkewAngle = -1.0;
820 if( rtl::math::approxEqual(fFinalSkewAngle, -1.0) )
825 if( bHasCustomShape )
826 rSet.
Put(
SfxInt32Item( SID_EXTRUSION_DIRECTION, static_cast<sal_Int32>(fFinalSkewAngle) ) );
836 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
838 const css::uno::Any* pAny;
840 sal_Int32 nFinalProjection = -1;
841 bool bHasCustomShape =
false;
843 for(
size_t i=0;
i<nCount; ++
i)
846 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
849 if( !bHasCustomShape )
852 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
854 *pAny_ >>= bHasCustomShape;
856 if( !bHasCustomShape )
862 bool bParallel =
true;
864 ProjectionMode eProjectionMode;
865 if( pAny && ( *pAny >>= eProjectionMode ) )
866 bParallel = eProjectionMode == ProjectionMode_PARALLEL;
868 if( nFinalProjection == -1 )
870 nFinalProjection = bParallel ? 1 : 0;
872 else if( nFinalProjection != (bParallel ? 1 : 0) )
874 nFinalProjection = -1;
880 if( bHasCustomShape )
881 rSet.
Put(
SfxInt32Item( SID_EXTRUSION_PROJECTION, nFinalProjection ) );
891 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
893 const css::uno::Any* pAny;
895 sal_Int32 nFinalSurface = -1;
896 bool bHasCustomShape =
false;
898 for(
size_t i=0;
i<nCount; ++
i)
901 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
906 if( !bHasCustomShape )
908 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
910 *pAny_ >>= bHasCustomShape;
912 if( !bHasCustomShape )
916 sal_Int32 nSurface = 0;
918 ShadeMode eShadeMode( ShadeMode_FLAT );
919 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
u"ShadeMode" );
921 *pAny >>= eShadeMode;
923 if (eShadeMode != ShadeMode_DRAFT)
926 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
u"Metal" );
933 sal_Int16 eMetalType = EnhancedCustomShapeMetalType::MetalODF;
934 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
u"MetalType" );
937 *pAny >>= eMetalType;
938 if (eMetalType == EnhancedCustomShapeMetalType::MetalMSCompatible)
944 double fSpecularity = 0;
945 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
u"Specularity" );
947 *pAny >>= fSpecularity;
949 const double e = 0.0001;
950 if( (fSpecularity > -e) && (fSpecularity < e) )
961 if( nFinalSurface == -1 )
963 nFinalSurface = nSurface;
965 else if( nFinalSurface != nSurface )
973 if( bHasCustomShape )
984 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
986 const css::uno::Any* pAny;
988 double fFinalDepth = -1;
989 bool bHasCustomShape =
false;
991 for(
size_t i=0;
i<nCount; ++
i)
994 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
999 if( !bHasCustomShape )
1001 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1003 *pAny_ >>= bHasCustomShape;
1005 if( !bHasCustomShape )
1009 double fDepth = 1270.0;
1010 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"Depth" );
1013 EnhancedCustomShapeParameterPair aDepthPropPair;
1014 if ( *pAny >>= aDepthPropPair )
1015 aDepthPropPair.First.Value >>= fDepth;
1018 if( fFinalDepth == -1 )
1020 fFinalDepth = fDepth;
1022 else if( !rtl::math::approxEqual(fFinalDepth, fDepth) )
1033 rSet.
Put(
SfxUInt16Item( SID_ATTR_METRIC, static_cast<sal_uInt16>(eUnit) ) );
1036 if( bHasCustomShape )
1044 if( ((d1.DirectionX < 0) && (d2.DirectionX < 0)) || ((d1.DirectionX == 0) && (d2.DirectionX == 0)) || ((d1.DirectionX > 0) && (d2.DirectionX > 0)) )
1046 if( ((d1.DirectionY < 0) && (d2.DirectionY < 0)) || ((d1.DirectionY == 0) && (d2.DirectionY == 0)) || ((d1.DirectionY > 0) && (d2.DirectionY > 0)) )
1048 if( ((d1.DirectionZ < 0) && (d2.DirectionZ < 0)) || ((d1.DirectionZ == 0) && (d2.DirectionZ == 0)) || ((d1.DirectionZ > 0) && (d2.DirectionZ > 0)) )
1063 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
1065 const Direction3D * pLighting1Defaults;
1066 const Direction3D * pLighting2Defaults;
1070 const css::uno::Any* pAny;
1072 int nFinalDirection = -1;
1073 bool bHasCustomShape =
false;
1075 for(
size_t i=0;
i<nCount; ++
i)
1078 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
1083 if( !bHasCustomShape )
1085 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1087 *pAny_ >>= bHasCustomShape;
1089 if( !bHasCustomShape )
1093 Direction3D aFirstLightDirection( 50000, 0, 10000 );
1094 Direction3D aSecondLightDirection( -50000, 0, 10000 );
1096 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"FirstLightDirection" );
1098 *pAny >>= aFirstLightDirection;
1100 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"SecondLightDirection" );
1102 *pAny >>= aSecondLightDirection;
1104 int nDirection = -1;
1107 for( j = 0; j < 9; j++ )
1117 if( nFinalDirection == -1 )
1119 nFinalDirection = nDirection;
1121 else if( nDirection != nFinalDirection )
1123 nFinalDirection = -1;
1126 if( nFinalDirection == -1 )
1131 if( bHasCustomShape )
1132 rSet.
Put(
SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, static_cast<sal_Int32>(nFinalDirection) ) );
1134 rSet.
DisableItem( SID_EXTRUSION_LIGHTING_DIRECTION );
1142 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
1144 const css::uno::Any* pAny;
1146 int nFinalLevel = -1;
1147 bool bHasCustomShape =
false;
1149 for(
size_t i=0;
i<nCount; ++
i)
1152 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
1157 if( !bHasCustomShape )
1159 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1161 *pAny_ >>= bHasCustomShape;
1163 if( !bHasCustomShape )
1167 double fBrightness = 22178.0 / 655.36;
1168 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"Brightness" );
1170 *pAny >>= fBrightness;
1173 if( fBrightness >= 30.0 )
1177 else if( fBrightness >= 10.0 )
1186 if( nFinalLevel == -1 )
1188 nFinalLevel = nLevel;
1190 else if( nFinalLevel != nLevel )
1198 if( bHasCustomShape )
1199 rSet.
Put(
SfxInt32Item( SID_EXTRUSION_LIGHTING_INTENSITY, nFinalLevel ) );
1201 rSet.
DisableItem( SID_EXTRUSION_LIGHTING_INTENSITY );
1209 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
1211 const css::uno::Any* pAny;
1214 bool bAmbigius =
false;
1216 bool bHasCustomShape =
false;
1218 for(
size_t i=0;
i<nCount; ++
i)
1221 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
1226 if( !bHasCustomShape )
1228 const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1230 *pAny_ >>= bHasCustomShape;
1232 if( !bHasCustomShape )
1238 bool bUseColor =
false;
1239 pAny = rGeometryItem.GetPropertyValueByName( sExtrusion,
"Color" );
1241 *pAny >>= bUseColor;
1255 aFinalColor = aColor;
1258 else if( aFinalColor != aColor )
1269 if( bHasCustomShape )
1278 static constexpr OUStringLiteral sExtrusion =
u"Extrusion";
1282 bool bFound =
false;
1284 for(
size_t i=0;(
i<nCount) && !bFound ; ++
i)
1287 if( dynamic_cast<const SdrObjCustomShape*>( pObj) !=
nullptr )
1292 const Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1314 if (! bOnlyExtrudedCustomShapes)
1323 rSet.
DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
1324 rSet.
DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
1325 rSet.
DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
static void getExtrusionSurfaceState(SdrView const *pSdrView, SfxItemSet &rSet)
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
size_t GetMarkCount() const
#define SFX_IMPL_INTERFACE(Class, SuperClass)
virtual ~ExtrusionBar() override
bool IsUndoEnabled() const
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
static void getExtrusionProjectionState(SdrView const *pSdrView, SfxItemSet &rSet)
SdrMark * GetMark(size_t nNum) const
static SfxSlot aExtrusionBarSlots_Impl[]
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
const sal_uInt16 SidArray[]
virtual void MarkListHasChanged() override
static void execute(SdrView *pSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
void ClearMergedItem(const sal_uInt16 nWhich=0)
static void getLightingDirectionDefaults(const Direction3D **pLighting1Defaults, const Direction3D **pLighting2Defaults)
static void getState(SdrView const *pSdrView, SfxItemSet &rSet)
static bool compare_direction(const Direction3D &d1, const Direction3D &d2)
OUString SvxResId(TranslateId aId)
static void getExtrusionColorState(SdrView const *pSdrView, SfxItemSet &rSet)
bool checkForSelectedCustomShapes(SdrView const *pSdrView, bool bOnlyExtruded)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
const Color & GetColorValue() const
FieldUnit GetUIUnit() const
SfxItemPool & GetPool() const
SdrObject * GetMarkedSdrObj() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
void SetRepeatTarget(SfxRepeatTarget *pTarget)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
static void getExtrusionDepthState(SdrView const *pSdrView, SfxItemSet &rSet)
static void getExtrusionDirectionState(SdrView const *pSdrView, SfxItemSet &rSet)
constexpr TypedWhichId< XSecondaryFillColorItem > XATTR_SECONDARYFILLCOLOR(XATTR_FILL_FIRST+12)
void BroadcastObjectChange() const
const SdrMarkList & GetMarkedObjectList() const
void SetPool(SfxItemPool *pNewPool)
void SetMergedItem(const SfxPoolItem &rItem)
void SetName(const OUString &rName)
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
static void impl_execute(SfxRequest const &rReq, SdrCustomShapeGeometryItem &rGeometryItem, SdrObject *pObj)
SdrUndoFactory & GetSdrUndoFactory() const
returns the models undo factory.
#define SFX_OBJECTBAR_OBJECT
static void getExtrusionLightingIntensityState(SdrView const *pSdrView, SfxItemSet &rSet)
weld::Window * GetFrameWeld() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
sal_uInt16 GetSlot() const
void DisableItem(sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
static void getExtrusionLightingDirectionState(SdrView const *pSdrView, SfxItemSet &rSet)
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
virtual std::unique_ptr< SdrUndoAction > CreateUndoAttrObject(SdrObject &rObject, bool bStyleSheet1=false, bool bSaveText=false)
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
SdrModel * GetModel() const