bump product version to 5.0.4.1
[LibreOffice.git] / svx / source / toolbars / extrusionbar.cxx
blob912b8d8fa357a8457949dbaf4f5ab431b61b7096
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 .
21 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
22 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
23 #include <com/sun/star/drawing/ShadeMode.hpp>
24 #include <com/sun/star/drawing/Position3D.hpp>
25 #include <com/sun/star/drawing/Direction3D.hpp>
26 #include <com/sun/star/drawing/ProjectionMode.hpp>
27 #include <svx/svdundo.hxx>
28 #include <sfx2/app.hxx>
29 #include <sfx2/request.hxx>
30 #include <sfx2/objface.hxx>
31 #include <sfx2/viewsh.hxx>
32 #include <sfx2/bindings.hxx>
33 #include <svx/xsflclit.hxx>
34 #include <svx/dialmgr.hxx>
35 #include <svx/svdoashp.hxx>
36 #include <svx/dialogs.hrc>
37 #include <svx/svdview.hxx>
38 #include <editeng/colritem.hxx>
39 #include "svx/chrtitem.hxx"
41 #include <svx/extrusionbar.hxx>
42 #include "extrusiondepthdialog.hxx"
44 using namespace ::svx;
45 using namespace ::cppu;
46 using namespace ::com::sun::star::beans;
47 using namespace ::com::sun::star::drawing;
48 using namespace ::com::sun::star::uno;
50 // Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
51 // tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
52 static SfxSlot aExtrusionBarSlots_Impl[] =
54 { 0, 0, 0, SfxSlotMode::NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
57 SFX_IMPL_INTERFACE(ExtrusionBar, SfxShell)
59 void ExtrusionBar::InitInterface_Impl()
61 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, RID_SVX_EXTRUSION_BAR);
64 TYPEINIT1( ExtrusionBar, SfxShell );
66 ExtrusionBar::ExtrusionBar(SfxViewShell* pViewShell )
67 : SfxShell(pViewShell)
69 DBG_ASSERT( pViewShell, "svx::ExtrusionBar::ExtrusionBar(), I need a viewshell!" );
70 if( pViewShell )
71 SetPool(&pViewShell->GetPool());
73 SetHelpId( SVX_INTERFACE_EXTRUSION_BAR );
74 SetName(SVX_RESSTR(RID_SVX_EXTRUSION_BAR));
77 ExtrusionBar::~ExtrusionBar()
79 SetRepeatTarget(NULL);
82 void getLightingDirectionDefaults( const Direction3D **pLighting1Defaults, const Direction3D **pLighting2Defaults )
85 static const Direction3D aLighting1Defaults[9] =
87 Direction3D( -50000, -50000, 10000 ),
88 Direction3D( 0, -50000, 10000 ),
89 Direction3D( 50000, -50000, 10000 ),
90 Direction3D( -50000, 0, 10000 ),
91 Direction3D( 0, 0, 10000 ),
92 Direction3D( 50000, 0, 10000 ),
93 Direction3D( -50000, 50000, 10000 ),
94 Direction3D( 0, 50000, 10000 ),
95 Direction3D( 50000, 50000, 10000 )
98 static const Direction3D aLighting2Defaults[9] =
100 Direction3D( 50000,0, 10000 ),
101 Direction3D( 0, 50000, 10000 ),
102 Direction3D( -50000, 0, 10000 ),
103 Direction3D( 50000, 0, 10000 ),
104 Direction3D( 0, 0, 10000 ),
105 Direction3D( -50000, 0, 10000 ),
106 Direction3D( 50000, 0, 10000 ),
107 Direction3D( 0, -50000, 10000 ),
108 Direction3D( -50000, 0, 10000 )
111 *pLighting1Defaults = (const Direction3D *)aLighting1Defaults;
112 *pLighting2Defaults = (const Direction3D *)aLighting2Defaults;
115 static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
117 static const char sExtrusion[] = "Extrusion";
118 static const char sProjectionMode[] = "ProjectionMode";
119 static const char sRotateAngle[] = "RotateAngle";
120 static const char sViewPoint[] = "ViewPoint";
121 static const char sOrigin[] = "Origin";
122 static const char sSkew[] = "Skew";
123 static const char sDepth[] = "Depth";
125 sal_uInt16 nSID = rReq.GetSlot();
126 switch( nSID )
128 case SID_EXTRUSION_TOOGLE:
130 com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
132 if( pAny )
134 bool bOn(false);
135 (*pAny) >>= bOn;
136 bOn = !bOn;
137 (*pAny) <<= bOn;
139 else
141 com::sun::star::beans::PropertyValue aPropValue;
142 aPropValue.Name = sExtrusion;
143 aPropValue.Value <<= sal_True;
144 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
147 break;
149 case SID_EXTRUSION_TILT_DOWN:
150 case SID_EXTRUSION_TILT_UP:
151 case SID_EXTRUSION_TILT_LEFT:
152 case SID_EXTRUSION_TILT_RIGHT:
154 bool bHorizontal = ( nSID == SID_EXTRUSION_TILT_DOWN ) || ( nSID == SID_EXTRUSION_TILT_UP );
155 sal_Int32 nDiff = ( nSID == SID_EXTRUSION_TILT_LEFT ) || ( nSID == SID_EXTRUSION_TILT_UP ) ? 5 : -5;
156 EnhancedCustomShapeParameterPair aRotateAnglePropPair;
157 double fX = 0.0;
158 double fY = 0.0;
159 aRotateAnglePropPair.First.Value <<= fX;
160 aRotateAnglePropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
161 aRotateAnglePropPair.Second.Value <<= fY;
162 aRotateAnglePropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
163 com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sRotateAngle );
164 if( pAny && ( *pAny >>= aRotateAnglePropPair ) )
166 aRotateAnglePropPair.First.Value >>= fX;
167 aRotateAnglePropPair.Second.Value >>= fY;
169 if ( bHorizontal )
170 fX += nDiff;
171 else
172 fY += nDiff;
173 aRotateAnglePropPair.First.Value <<= fX;
174 aRotateAnglePropPair.Second.Value <<= fY;
175 com::sun::star::beans::PropertyValue aPropValue;
176 aPropValue.Name = sRotateAngle;
177 aPropValue.Value <<= aRotateAnglePropPair;
178 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
180 break;
182 case SID_EXTRUSION_DIRECTION:
184 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DIRECTION ) == SfxItemState::SET )
186 sal_Int32 nSkew = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DIRECTION))->GetValue();
188 Position3D aViewPoint( 3472, -3472, 25000 );
189 double fOriginX = 0.50;
190 double fOriginY = -0.50;
191 double fSkewAngle = nSkew;
192 double fSkew = 50.0;
194 switch( nSkew )
196 case 135:
197 aViewPoint.PositionY = 3472;
198 fOriginY = 0.50;
199 break;
200 case 90:
201 aViewPoint.PositionX = 0;
202 aViewPoint.PositionY = 3472;
203 fOriginX = 0;
204 fOriginY = -0.50;
205 break;
206 case 45:
207 aViewPoint.PositionX = -3472;
208 aViewPoint.PositionY = 3472;
209 fOriginX = -0.50;
210 fOriginY = 0.50;
211 break;
212 case 180:
213 aViewPoint.PositionY = 0;
214 fOriginY = 0;
215 break;
216 case 0:
217 aViewPoint.PositionX = 0;
218 aViewPoint.PositionY = 0;
219 fOriginX = 0;
220 fOriginY = 0;
221 fSkew = 0.0;
222 break;
223 case -360:
224 aViewPoint.PositionX = -3472;
225 aViewPoint.PositionY = 0;
226 fOriginX = -0.50;
227 fOriginY = 0;
228 break;
229 case -90:
230 aViewPoint.PositionX = 0;
231 fOriginX = 0;
232 break;
233 case -45:
234 aViewPoint.PositionX = -3472;
235 fOriginX = -0.50;
236 break;
239 com::sun::star::beans::PropertyValue aPropValue;
241 aPropValue.Name = sViewPoint;
242 aPropValue.Value <<= aViewPoint;
243 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
246 EnhancedCustomShapeParameterPair aOriginPropPair;
247 aOriginPropPair.First.Value <<= fOriginX;
248 aOriginPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
249 aOriginPropPair.Second.Value <<= fOriginY;
250 aOriginPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
251 aPropValue.Name = sOrigin;
252 aPropValue.Value <<= aOriginPropPair;
253 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
255 EnhancedCustomShapeParameterPair aSkewPropPair;
256 aSkewPropPair.First.Value <<= fSkew;
257 aSkewPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
258 aSkewPropPair.Second.Value <<= fSkewAngle;
259 aSkewPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
260 aPropValue.Name = sSkew;
261 aPropValue.Value <<= aSkewPropPair;
262 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
265 break;
266 case SID_EXTRUSION_PROJECTION:
268 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_PROJECTION ) == SfxItemState::SET )
270 sal_Int32 nProjection = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue();
271 ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
272 com::sun::star::beans::PropertyValue aPropValue;
273 aPropValue.Name = sProjectionMode;
274 aPropValue.Value <<= eProjectionMode;
275 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
278 break;
279 case SID_EXTRUSION_DEPTH:
281 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SfxItemState::SET)
283 double fDepth = static_cast<const SvxDoubleItem*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
284 double fFraction = 0.0;
285 EnhancedCustomShapeParameterPair aDepthPropPair;
286 aDepthPropPair.First.Value <<= fDepth;
287 aDepthPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
288 aDepthPropPair.Second.Value <<= fFraction;
289 aDepthPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
291 com::sun::star::beans::PropertyValue aPropValue;
292 aPropValue.Name = sDepth;
293 aPropValue.Value <<= aDepthPropPair;
294 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
297 break;
298 case SID_EXTRUSION_3D_COLOR:
300 static const char sExtrusionColor[] = "Color";
302 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_3D_COLOR ) == SfxItemState::SET)
304 Color aColor( static_cast<const SvxColorItem&>(rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() );
306 const bool bAuto = aColor == COL_AUTO;
308 com::sun::star::beans::PropertyValue aPropValue;
309 aPropValue.Name = sExtrusionColor;
310 aPropValue.Value <<= bAuto ? sal_False : sal_True;
311 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
313 if( bAuto )
315 pObj->ClearMergedItem( XATTR_SECONDARYFILLCOLOR );
317 else
319 pObj->SetMergedItem( XSecondaryFillColorItem( "", aColor ) );
321 pObj->BroadcastObjectChange();
324 break;
325 case SID_EXTRUSION_SURFACE:
327 static const char sShadeMode[] = "ShadeMode";
328 static const char sSpecularity[] = "Specularity";
329 static const char sDiffusion[] = "Diffusion";
330 static const char sMetal[] = "Metal";
332 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_SURFACE ) == SfxItemState::SET)
334 sal_Int32 nSurface = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue();
336 ShadeMode eShadeMode( ShadeMode_FLAT );
337 bool bMetal = false;
338 double fSpecularity = 0;
339 double fDiffusion = 0;
341 switch( nSurface )
343 case 0: // wireframe
344 eShadeMode = ShadeMode_DRAFT;
345 break;
346 case 1: // matte
347 break;
348 case 2: // plastic
349 fSpecularity = 122.0;
350 break;
351 case 3: // metal
352 bMetal = true;
353 fSpecularity = 122.0;
354 fDiffusion = 122.0;
355 break;
358 com::sun::star::beans::PropertyValue aPropValue;
359 aPropValue.Name = sShadeMode;
360 aPropValue.Value <<= eShadeMode;
361 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
363 aPropValue.Name = sMetal;
364 aPropValue.Value <<= bMetal;
365 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
367 aPropValue.Name = sSpecularity;
368 aPropValue.Value <<= fSpecularity;
369 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
371 aPropValue.Name = sDiffusion;
372 aPropValue.Value <<= fDiffusion;
373 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
376 break;
377 case SID_EXTRUSION_LIGHTING_INTENSITY:
379 static const char sBrightness[] = "Brightness";
380 static const char sLightFace[] = "LightFace";
381 static const char sFirstLightHarsh[] = "FirstLightHarsh";
382 static const char sSecondLightHarsh[] = "SecondLightHarsh";
383 static const char sFirstLightLevel[] = "FirstLightLevel";
384 static const char sSecondLightLevel[] = "SecondLightLevel";
386 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_INTENSITY ) == SfxItemState::SET)
388 sal_Int32 nLevel = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue();
390 double fBrightness;
391 bool bHarsh2 = false;
392 double fLevel1;
393 double fLevel2;
395 switch( nLevel )
397 case 0: // bright
398 fBrightness = 34.0;
399 bHarsh2 = false;
400 fLevel1 = 66.0;
401 fLevel2 = 66.0;
402 break;
403 case 1: // normal
404 fBrightness = 15.0;
405 bHarsh2 = false;
406 fLevel1 = 67.0;
407 fLevel2 = 37.0;
408 break;
409 case 2: // dim
410 fBrightness = 6.0;
411 bHarsh2 = true;
412 fLevel1 = 79.0;
413 fLevel2 = 21.0;
414 break;
417 com::sun::star::beans::PropertyValue aPropValue;
418 aPropValue.Name = sBrightness;
419 aPropValue.Value <<= fBrightness;
420 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
422 aPropValue.Name = sLightFace;
423 aPropValue.Value <<= sal_True;
424 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
426 aPropValue.Name = sFirstLightHarsh;
427 aPropValue.Value <<= sal_True;
428 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
430 aPropValue.Name = sSecondLightHarsh;
431 aPropValue.Value <<= bHarsh2;
432 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
434 aPropValue.Name = sFirstLightLevel;
435 aPropValue.Value <<= fLevel1;
436 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
438 aPropValue.Name = sSecondLightLevel;
439 aPropValue.Value <<= fLevel2;
440 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
443 break;
444 case SID_EXTRUSION_LIGHTING_DIRECTION:
446 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_DIRECTION ) == SfxItemState::SET)
448 sal_Int32 nDirection = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_DIRECTION))->GetValue();
450 if((nDirection >= 0) && (nDirection < 9))
452 const OUString sFirstLightDirection( "FirstLightDirection" );
453 const OUString sSecondLightDirection( "SecondLightDirection" );
455 const Direction3D * pLighting1Defaults;
456 const Direction3D * pLighting2Defaults;
458 getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
460 com::sun::star::beans::PropertyValue aPropValue;
461 aPropValue.Name = sFirstLightDirection;
462 aPropValue.Value <<= pLighting1Defaults[nDirection];
463 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
465 aPropValue.Name = sSecondLightDirection;
466 aPropValue.Value <<= pLighting2Defaults[nDirection];
467 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
471 break;
476 void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
478 sal_uInt16 nSID = rReq.GetSlot();
479 sal_uInt16 nStrResId = 0;
481 const bool bUndo = pSdrView && pSdrView->IsUndoEnabled();
483 switch( nSID )
485 case SID_EXTRUSION_TOOGLE:
487 if ( !nStrResId )
488 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF;
489 } // PASSTROUGH
490 case SID_EXTRUSION_TILT_DOWN:
492 if ( !nStrResId )
493 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN;
494 } // PASSTROUGH
495 case SID_EXTRUSION_TILT_UP:
497 if ( !nStrResId )
498 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP;
499 } // PASSTROUGH
500 case SID_EXTRUSION_TILT_LEFT:
502 if ( !nStrResId )
503 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT;
504 } // PASSTROUGH
505 case SID_EXTRUSION_TILT_RIGHT:
507 if ( !nStrResId )
508 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT;
509 } // PASSTROUGH
510 case SID_EXTRUSION_DIRECTION:
512 if ( !nStrResId )
513 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION;
514 } // PASSTROUGH
515 case SID_EXTRUSION_PROJECTION:
517 if ( !nStrResId )
518 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION;
519 } // PASSTROUGH
520 case SID_EXTRUSION_DEPTH:
522 if ( !nStrResId )
523 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH;
524 } // PASSTROUGH
525 case SID_EXTRUSION_3D_COLOR:
527 if ( !nStrResId )
528 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR;
529 } // PASSTROUGH
530 case SID_EXTRUSION_SURFACE:
532 if ( !nStrResId )
533 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE;
534 } // PASSTROUGH
535 case SID_EXTRUSION_LIGHTING_INTENSITY:
537 if ( !nStrResId )
538 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS;
539 } // PASSTROUGH
540 case SID_EXTRUSION_LIGHTING_DIRECTION:
542 if ( !nStrResId )
543 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING;
545 if (pSdrView)
547 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
548 const size_t nCount = rMarkList.GetMarkCount();
550 for(size_t i=0; i<nCount; ++i)
552 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
553 if( pObj->ISA(SdrObjCustomShape) )
555 if( bUndo )
557 OUString aStr( SVX_RESSTR( nStrResId ) );
558 pSdrView->BegUndo( aStr );
559 pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
561 SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )));
562 impl_execute( pSdrView, rReq, aGeometryItem, pObj );
563 pObj->SetMergedItem( aGeometryItem );
564 pObj->BroadcastObjectChange();
565 if( bUndo )
566 pSdrView->EndUndo();
568 // simulate a context change:
569 // force SelectionHasChanged() being called
570 // so that extrusion bar will be visible/hidden
571 pSdrView->MarkListHasChanged();
576 break;
578 case SID_EXTRUSION_DEPTH_DIALOG:
579 if( rReq.GetArgs() &&
580 (rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SfxItemState::SET) &&
581 (rReq.GetArgs()->GetItemState( SID_ATTR_METRIC ) == SfxItemState::SET))
583 double fDepth = static_cast<const SvxDoubleItem*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
584 FieldUnit eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue();
586 ScopedVclPtrInstance< ExtrusionDepthDialog > aDlg(nullptr, fDepth, eUnit);
587 sal_uInt16 nRet = aDlg->Execute();
588 if( nRet != 0 )
590 fDepth = aDlg->getDepth();
592 SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
593 SfxPoolItem* aItems[] = { &aItem, 0 };
594 rBindings.Execute( SID_EXTRUSION_DEPTH, (const SfxPoolItem**)aItems );
597 break;
600 if( nSID == SID_EXTRUSION_TOOGLE )
602 static sal_uInt16 SidArray[] = {
603 SID_EXTRUSION_TILT_DOWN,
604 SID_EXTRUSION_TILT_UP,
605 SID_EXTRUSION_TILT_LEFT,
606 SID_EXTRUSION_TILT_RIGHT,
607 SID_EXTRUSION_DEPTH_FLOATER,
608 SID_EXTRUSION_DIRECTION_FLOATER,
609 SID_EXTRUSION_LIGHTING_FLOATER,
610 SID_EXTRUSION_SURFACE_FLOATER,
611 SID_EXTRUSION_3D_COLOR,
612 SID_EXTRUSION_DEPTH,
613 SID_EXTRUSION_DIRECTION,
614 SID_EXTRUSION_PROJECTION,
615 SID_EXTRUSION_LIGHTING_DIRECTION,
616 SID_EXTRUSION_LIGHTING_INTENSITY,
617 SID_EXTRUSION_SURFACE,
618 0 };
620 rBindings.Invalidate( SidArray );
624 void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
626 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
627 const size_t nCount = rMarkList.GetMarkCount();
629 static const char sExtrusion[] = "Extrusion";
630 static const char sViewPoint[] = "ViewPoint";
631 static const char sOrigin[] = "Origin";
632 static const char sSkew[] = "Skew";
633 static const char sProjectionMode[] = "ProjectionMode";
635 const com::sun::star::uno::Any* pAny;
637 double fFinalSkewAngle = -1;
638 bool bHasCustomShape = false;
640 for(size_t i=0; i<nCount; ++i)
642 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
643 if( pObj->ISA(SdrObjCustomShape) )
645 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
647 // see if this is an extruded customshape
648 if( !bHasCustomShape )
650 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
651 if( pAny_ )
652 *pAny_ >>= bHasCustomShape;
654 if( !bHasCustomShape )
655 continue;
658 bool bParallel = true;
659 Position3D aViewPoint( 3472, -3472, 25000 );
660 double fSkewAngle = -135;
662 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
663 sal_Int16 nProjectionMode = sal_Int16();
664 if( pAny && ( *pAny >>= nProjectionMode ) )
665 bParallel = nProjectionMode == ProjectionMode_PARALLEL;
667 if( bParallel )
669 double fSkew = 50.0;
670 EnhancedCustomShapeParameterPair aSkewPropPair;
671 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSkew );
672 if( pAny && ( *pAny >>= aSkewPropPair ) )
674 aSkewPropPair.First.Value >>= fSkew;
675 aSkewPropPair.Second.Value >>= fSkewAngle;
677 if ( fSkew == 0.0 )
678 fSkewAngle = 0.0;
679 else if ( fSkewAngle == 0.0 )
680 fSkewAngle = -360.0;
682 else
684 double fOriginX = 0.50;
685 double fOriginY = -0.50;
686 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sViewPoint );
687 if( pAny )
688 *pAny >>= aViewPoint;
690 EnhancedCustomShapeParameterPair aOriginPropPair;
691 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sOrigin );
692 if( pAny && ( *pAny >>= aOriginPropPair ) )
694 aOriginPropPair.First.Value >>= fOriginX;
695 aOriginPropPair.Second.Value >>= fOriginY;
697 fSkewAngle = -1;
698 const double e = 0.0001;
699 if( aViewPoint.PositionX > e )
701 if( aViewPoint.PositionY > e )
703 if( (fOriginX > e ) && ( fOriginY > e ) )
704 fSkewAngle = 135.0;
706 else if( aViewPoint.PositionY < -e )
708 if( ( fOriginX > e ) && ( fOriginY < -e ) )
709 fSkewAngle = -135.0;
711 else
713 if( ( fOriginX > e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
714 fSkewAngle = 180.0;
717 else if( aViewPoint.PositionX < -e )
719 if( aViewPoint.PositionY < -e )
721 if( ( fOriginX < -e ) && ( fOriginY < -e ) )
722 fSkewAngle = -45.0;
724 else if( aViewPoint.PositionY > e )
726 if( ( fOriginX < -e ) && ( fOriginY > e ) )
727 fSkewAngle = 45.0;
729 else
731 if( ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
732 fSkewAngle = -360.0;
735 else
737 if( aViewPoint.PositionY < -e )
739 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY < -e ) )
740 fSkewAngle = -90.0;
742 else if( aViewPoint.PositionY > e )
744 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > e ) )
745 fSkewAngle = 90.0;
747 else
749 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
750 fSkewAngle = 0.0;
755 if( fFinalSkewAngle == -1.0 )
757 fFinalSkewAngle = fSkewAngle;
759 else if( fSkewAngle != fFinalSkewAngle )
761 fFinalSkewAngle = -1.0;
764 if( fFinalSkewAngle == -1.0 )
765 break;
769 if( bHasCustomShape )
770 rSet.Put( SfxInt32Item( SID_EXTRUSION_DIRECTION, (sal_Int32)fFinalSkewAngle ) );
771 else
772 rSet.DisableItem( SID_EXTRUSION_DIRECTION );
775 void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet )
777 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
778 const size_t nCount = rMarkList.GetMarkCount();
780 static const char sExtrusion[] = "Extrusion";
781 static const char sProjectionMode[] = "ProjectionMode";
783 const com::sun::star::uno::Any* pAny;
785 sal_Int32 nFinalProjection = -1;
786 bool bHasCustomShape = false;
788 for(size_t i=0; i<nCount; ++i)
790 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
791 if( pObj->ISA(SdrObjCustomShape) )
793 // see if this is an extruded customshape
794 if( !bHasCustomShape )
796 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
797 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
798 if( pAny_ )
799 *pAny_ >>= bHasCustomShape;
801 if( !bHasCustomShape )
802 continue;
805 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
807 bool bParallel = true;
808 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
809 ProjectionMode eProjectionMode;
810 if( pAny && ( *pAny >>= eProjectionMode ) )
811 bParallel = eProjectionMode == ProjectionMode_PARALLEL;
813 if( nFinalProjection == -1 )
815 nFinalProjection = bParallel ? 1 : 0;
817 else if( nFinalProjection != (bParallel ? 1 : 0) )
819 nFinalProjection = -1;
820 break;
825 if( bHasCustomShape )
826 rSet.Put( SfxInt32Item( SID_EXTRUSION_PROJECTION, nFinalProjection ) );
827 else
828 rSet.DisableItem( SID_EXTRUSION_PROJECTION );
831 void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet )
833 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
834 const size_t nCount = rMarkList.GetMarkCount();
836 static const char sExtrusion[] = "Extrusion";
837 static const char sShadeMode[] = "ShadeMode";
838 static const char sSpecularity[] = "Specularity";
839 static const char sMetal[] = "Metal";
841 const com::sun::star::uno::Any* pAny;
843 sal_Int32 nFinalSurface = -1;
844 bool bHasCustomShape = false;
846 for(size_t i=0; i<nCount; ++i)
848 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
849 if( pObj->ISA(SdrObjCustomShape) )
851 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
853 // see if this is an extruded customshape
854 if( !bHasCustomShape )
856 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
857 if( pAny_ )
858 *pAny_ >>= bHasCustomShape;
860 if( !bHasCustomShape )
861 continue;
864 sal_Int32 nSurface = 0; // wire frame
866 ShadeMode eShadeMode( ShadeMode_FLAT );
867 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sShadeMode );
868 if( pAny )
869 *pAny >>= eShadeMode;
871 if( eShadeMode == ShadeMode_FLAT )
873 bool bMetal = false;
874 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sMetal );
875 if( pAny )
876 *pAny >>= bMetal;
878 if( bMetal )
880 nSurface = 3; // metal
882 else
884 double fSpecularity = 0;
885 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSpecularity );
886 if( pAny )
887 *pAny >>= fSpecularity;
889 const double e = 0.0001;
890 if( (fSpecularity > -e) && (fSpecularity < e) )
892 nSurface = 1; // matte
894 else
896 nSurface = 2; // plastic
901 if( nFinalSurface == -1 )
903 nFinalSurface = nSurface;
905 else if( nFinalSurface != nSurface )
907 nFinalSurface = -1;
908 break;
913 if( bHasCustomShape )
914 rSet.Put( SfxInt32Item( SID_EXTRUSION_SURFACE, nFinalSurface ) );
915 else
916 rSet.DisableItem( SID_EXTRUSION_SURFACE );
919 void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet )
921 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
922 const size_t nCount = rMarkList.GetMarkCount();
924 static const char sExtrusion[] = "Extrusion";
925 static const char sDepth[] = "Depth";
927 const com::sun::star::uno::Any* pAny;
929 double fFinalDepth = -1;
930 bool bHasCustomShape = false;
932 for(size_t i=0; i<nCount; ++i)
934 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
935 if( pObj->ISA(SdrObjCustomShape) )
937 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
939 // see if this is an extruded customshape
940 if( !bHasCustomShape )
942 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
943 if( pAny_ )
944 *pAny_ >>= bHasCustomShape;
946 if( !bHasCustomShape )
947 continue;
950 double fDepth = 1270.0;
951 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sDepth );
952 if( pAny )
954 EnhancedCustomShapeParameterPair aDepthPropPair;
955 if ( *pAny >>= aDepthPropPair )
956 aDepthPropPair.First.Value >>= fDepth;
959 if( fFinalDepth == -1 )
961 fFinalDepth = fDepth;
963 else if( fFinalDepth != fDepth )
965 fFinalDepth = -1;
966 break;
971 if( pSdrView->GetModel() )
973 FieldUnit eUnit = pSdrView->GetModel()->GetUIUnit();
974 rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)eUnit ) );
977 if( bHasCustomShape )
978 rSet.Put( SvxDoubleItem( fFinalDepth, SID_EXTRUSION_DEPTH ) );
979 else
980 rSet.DisableItem( SID_EXTRUSION_DEPTH );
983 static bool compare_direction( const Direction3D& d1, const Direction3D& d2 )
985 if( ((d1.DirectionX < 0) && (d2.DirectionX < 0)) || ((d1.DirectionX == 0) && (d2.DirectionX == 0)) || ((d1.DirectionX > 0) && (d2.DirectionX > 0)) )
987 if( ((d1.DirectionY < 0) && (d2.DirectionY < 0)) || ((d1.DirectionY == 0) && (d2.DirectionY == 0)) || ((d1.DirectionY > 0) && (d2.DirectionY > 0)) )
989 if( ((d1.DirectionZ < 0) && (d2.DirectionZ < 0)) || ((d1.DirectionZ == 0) && (d2.DirectionZ == 0)) || ((d1.DirectionZ > 0) && (d2.DirectionZ > 0)) )
991 return true;
996 return false;
999 void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
1001 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1002 const size_t nCount = rMarkList.GetMarkCount();
1004 static const char sExtrusion[] = "Extrusion";
1005 static const char sFirstLightDirection[] = "FirstLightDirection";
1006 static const char sSecondLightDirection[] = "SecondLightDirection";
1008 const Direction3D * pLighting1Defaults;
1009 const Direction3D * pLighting2Defaults;
1011 getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
1013 const com::sun::star::uno::Any* pAny;
1015 int nFinalDirection = -1;
1016 bool bHasCustomShape = false;
1018 for(size_t i=0; i<nCount; ++i)
1020 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1021 if( pObj->ISA(SdrObjCustomShape) )
1023 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
1025 // see if this is an extruded customshape
1026 if( !bHasCustomShape )
1028 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1029 if( pAny_ )
1030 *pAny_ >>= bHasCustomShape;
1032 if( !bHasCustomShape )
1033 continue;
1036 Direction3D aFirstLightDirection( 50000, 0, 10000 );
1037 Direction3D aSecondLightDirection( -50000, 0, 10000 );
1039 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sFirstLightDirection );
1040 if( pAny )
1041 *pAny >>= aFirstLightDirection;
1043 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSecondLightDirection );
1044 if( pAny )
1045 *pAny >>= aSecondLightDirection;
1047 int nDirection = -1;
1049 int j;
1050 for( j = 0; j < 9; j++ )
1052 if( compare_direction( aFirstLightDirection, pLighting1Defaults[j] ) &&
1053 compare_direction( aSecondLightDirection, pLighting2Defaults[j] ))
1055 nDirection = j;
1056 break;
1060 if( nFinalDirection == -1 )
1062 nFinalDirection = nDirection;
1064 else if( nDirection != nFinalDirection )
1066 nFinalDirection = -1;
1069 if( nFinalDirection == -1 )
1070 break;
1074 if( bHasCustomShape )
1075 rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, (sal_Int32)nFinalDirection ) );
1076 else
1077 rSet.DisableItem( SID_EXTRUSION_LIGHTING_DIRECTION );
1080 void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet )
1082 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1083 const size_t nCount = rMarkList.GetMarkCount();
1085 static const char sExtrusion[] = "Extrusion";
1086 static const char sBrightness[] = "Brightness";
1088 const com::sun::star::uno::Any* pAny;
1090 int nFinalLevel = -1;
1091 bool bHasCustomShape = false;
1093 for(size_t i=0; i<nCount; ++i)
1095 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1096 if( pObj->ISA(SdrObjCustomShape) )
1098 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
1100 // see if this is an extruded customshape
1101 if( !bHasCustomShape )
1103 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1104 if( pAny_ )
1105 *pAny_ >>= bHasCustomShape;
1107 if( !bHasCustomShape )
1108 continue;
1111 double fBrightness = 22178.0 / 655.36;
1112 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sBrightness );
1113 if( pAny )
1114 *pAny >>= fBrightness;
1116 int nLevel;
1117 if( fBrightness >= 30.0 )
1119 nLevel = 0; // Bright
1121 else if( fBrightness >= 10.0 )
1123 nLevel = 1; // Noraml;
1125 else
1127 nLevel = 2; // Dim
1130 if( nFinalLevel == -1 )
1132 nFinalLevel = nLevel;
1134 else if( nFinalLevel != nLevel )
1136 nFinalLevel = -1;
1137 break;
1142 if( bHasCustomShape )
1143 rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_INTENSITY, nFinalLevel ) );
1144 else
1145 rSet.DisableItem( SID_EXTRUSION_LIGHTING_INTENSITY );
1148 void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet )
1150 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1151 const size_t nCount = rMarkList.GetMarkCount();
1153 static const char sExtrusion[] = "Extrusion";
1154 static const char sExtrusionColor[] = "Color";
1156 const com::sun::star::uno::Any* pAny;
1158 bool bInit = false;
1159 bool bAmbigius = false;
1160 Color aFinalColor;
1161 bool bHasCustomShape = false;
1163 for(size_t i=0; i<nCount; ++i)
1165 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1166 if( pObj->ISA(SdrObjCustomShape) )
1168 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) );
1170 // see if this is an extruded customshape
1171 if( !bHasCustomShape )
1173 const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1174 if( pAny_ )
1175 *pAny_ >>= bHasCustomShape;
1177 if( !bHasCustomShape )
1178 continue;
1181 Color aColor;
1183 bool bUseColor = false;
1184 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusionColor );
1185 if( pAny )
1186 *pAny >>= bUseColor;
1188 if( bUseColor )
1190 const XSecondaryFillColorItem& rItem = *static_cast<const XSecondaryFillColorItem*>(&(pObj->GetMergedItem( XATTR_SECONDARYFILLCOLOR )));
1191 aColor = rItem.GetColorValue();
1193 else
1195 aColor = COL_AUTO;
1198 if( !bInit )
1200 aFinalColor = aColor;
1201 bInit = true;
1203 else if( aFinalColor != aColor )
1205 bAmbigius = true;
1206 break;
1211 if( bAmbigius )
1212 aFinalColor = COL_AUTO;
1214 if( bHasCustomShape )
1215 rSet.Put( SvxColorItem( aFinalColor, SID_EXTRUSION_3D_COLOR ) );
1216 else
1217 rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
1220 namespace svx {
1221 bool checkForSelectedCustomShapes( SdrView* pSdrView, bool bOnlyExtruded )
1223 static const char sExtrusion[] = "Extrusion";
1225 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1226 const size_t nCount = rMarkList.GetMarkCount();
1227 bool bFound = false;
1229 for(size_t i=0;(i<nCount) && !bFound ; ++i)
1231 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1232 if( pObj->ISA(SdrObjCustomShape) )
1234 if( bOnlyExtruded )
1236 const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ));
1237 const Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1238 if( pAny )
1239 *pAny >>= bFound;
1241 else
1243 bFound = true;
1248 return bFound;
1252 void ExtrusionBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
1254 if (rSet.GetItemState(SID_EXTRUSION_DIRECTION) != SfxItemState::UNKNOWN)
1256 getExtrusionDirectionState( pSdrView, rSet );
1258 if (rSet.GetItemState(SID_EXTRUSION_PROJECTION) != SfxItemState::UNKNOWN)
1260 getExtrusionProjectionState( pSdrView, rSet );
1262 const bool bOnlyExtrudedCustomShapes =
1263 checkForSelectedCustomShapes( pSdrView, true );
1264 if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SfxItemState::UNKNOWN)
1266 if (! bOnlyExtrudedCustomShapes)
1267 rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
1269 if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SfxItemState::UNKNOWN)
1271 if (! bOnlyExtrudedCustomShapes)
1272 rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
1274 if (rSet.GetItemState(SID_EXTRUSION_TILT_UP) != SfxItemState::UNKNOWN)
1276 if (! bOnlyExtrudedCustomShapes)
1277 rSet.DisableItem( SID_EXTRUSION_TILT_UP );
1279 if (rSet.GetItemState(SID_EXTRUSION_TILT_LEFT) != SfxItemState::UNKNOWN)
1281 if (! bOnlyExtrudedCustomShapes)
1282 rSet.DisableItem( SID_EXTRUSION_TILT_LEFT );
1284 if (rSet.GetItemState(SID_EXTRUSION_TILT_RIGHT) != SfxItemState::UNKNOWN)
1286 if (! bOnlyExtrudedCustomShapes)
1287 rSet.DisableItem( SID_EXTRUSION_TILT_RIGHT );
1289 if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SfxItemState::UNKNOWN)
1291 if (! bOnlyExtrudedCustomShapes)
1292 rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
1294 if (rSet.GetItemState(SID_EXTRUSION_DEPTH_FLOATER) != SfxItemState::UNKNOWN)
1296 if (! bOnlyExtrudedCustomShapes)
1297 rSet.DisableItem( SID_EXTRUSION_DEPTH_FLOATER );
1299 if (rSet.GetItemState(SID_EXTRUSION_DIRECTION_FLOATER) != SfxItemState::UNKNOWN)
1301 if (! bOnlyExtrudedCustomShapes)
1302 rSet.DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
1304 if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_FLOATER) != SfxItemState::UNKNOWN)
1306 if (! bOnlyExtrudedCustomShapes)
1307 rSet.DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
1309 if (rSet.GetItemState(SID_EXTRUSION_SURFACE_FLOATER) != SfxItemState::UNKNOWN)
1311 if(! bOnlyExtrudedCustomShapes)
1312 rSet.DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
1314 if (rSet.GetItemState(SID_EXTRUSION_TOOGLE) != SfxItemState::UNKNOWN)
1316 if( !checkForSelectedCustomShapes( pSdrView, false ) )
1317 rSet.DisableItem( SID_EXTRUSION_TOOGLE );
1319 if (rSet.GetItemState(SID_EXTRUSION_DEPTH) != SfxItemState::UNKNOWN)
1321 getExtrusionDepthState( pSdrView, rSet );
1323 if (rSet.GetItemState(SID_EXTRUSION_SURFACE) != SfxItemState::UNKNOWN)
1325 getExtrusionSurfaceState( pSdrView, rSet );
1327 if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_INTENSITY) != SfxItemState::UNKNOWN)
1329 getExtrusionLightingIntensityState( pSdrView, rSet );
1332 if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_DIRECTION) != SfxItemState::UNKNOWN)
1334 getExtrusionLightingDirectionState( pSdrView, rSet );
1337 if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SfxItemState::UNKNOWN)
1339 getExtrusionColorState( pSdrView, rSet );
1343 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */