fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / toolbars / extrusionbar.cxx
blobef8fe93b1f187bf142321ce8f046f79ee782fb98
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"
45 using namespace ::svx;
46 using namespace ::rtl;
47 using namespace ::cppu;
48 using namespace ::com::sun::star::beans;
49 using namespace ::com::sun::star::drawing;
50 using namespace ::com::sun::star::uno;
52 /*************************************************************************
54 |* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
55 |* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
57 \************************************************************************/
59 SFX_SLOTMAP(ExtrusionBar)
61 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
64 SFX_IMPL_INTERFACE(ExtrusionBar, SfxShell, SVX_RES(RID_SVX_EXTRUSION_BAR))
66 SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, SVX_RES(RID_SVX_EXTRUSION_BAR) );
69 TYPEINIT1( ExtrusionBar, SfxShell );
72 /*************************************************************************
74 |* Standard-Konstruktor
76 \************************************************************************/
78 ExtrusionBar::ExtrusionBar(SfxViewShell* pViewShell )
79 : SfxShell(pViewShell)
81 DBG_ASSERT( pViewShell, "svx::ExtrusionBar::ExtrusionBar(), I need a viewshell!" );
82 if( pViewShell )
83 SetPool(&pViewShell->GetPool());
85 SetHelpId( SVX_INTERFACE_EXTRUSION_BAR );
86 SetName( String( SVX_RES( RID_SVX_EXTRUSION_BAR )));
90 /*************************************************************************
92 |* Destruktor
94 \************************************************************************/
96 ExtrusionBar::~ExtrusionBar()
98 SetRepeatTarget(NULL);
101 void getLightingDirectionDefaults( const Direction3D **pLighting1Defaults, const Direction3D **pLighting2Defaults )
104 static const Direction3D aLighting1Defaults[9] =
106 Direction3D( -50000, -50000, 10000 ),
107 Direction3D( 0, -50000, 10000 ),
108 Direction3D( 50000, -50000, 10000 ),
109 Direction3D( -50000, 0, 10000 ),
110 Direction3D( 0, 0, 10000 ),
111 Direction3D( 50000, 0, 10000 ),
112 Direction3D( -50000, 50000, 10000 ),
113 Direction3D( 0, 50000, 10000 ),
114 Direction3D( 50000, 50000, 10000 )
117 static const Direction3D aLighting2Defaults[9] =
119 Direction3D( 50000,0, 10000 ),
120 Direction3D( 0, 50000, 10000 ),
121 Direction3D( -50000, 0, 10000 ),
122 Direction3D( 50000, 0, 10000 ),
123 Direction3D( 0, 0, 10000 ),
124 Direction3D( -50000, 0, 10000 ),
125 Direction3D( 50000, 0, 10000 ),
126 Direction3D( 0, -50000, 10000 ),
127 Direction3D( -50000, 0, 10000 )
130 *pLighting1Defaults = (const Direction3D *)aLighting1Defaults;
131 *pLighting2Defaults = (const Direction3D *)aLighting2Defaults;
134 static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
136 static const OUString sExtrusion( "Extrusion" );
137 static const OUString sProjectionMode( "ProjectionMode" );
138 static const OUString sRotateAngle( "RotateAngle" );
139 static const OUString sViewPoint( "ViewPoint" );
140 static const OUString sOrigin( "Origin" );
141 static const OUString sSkew( "Skew" );
142 static const OUString sDepth( "Depth" );
144 sal_uInt16 nSID = rReq.GetSlot();
145 switch( nSID )
147 case SID_EXTRUSION_TOOGLE:
149 com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
151 if( pAny )
153 sal_Bool bOn;
154 (*pAny) >>= bOn;
155 bOn = !bOn;
156 (*pAny) <<= bOn;
158 else
160 com::sun::star::beans::PropertyValue aPropValue;
161 aPropValue.Name = sExtrusion;
162 aPropValue.Value <<= sal_True;
163 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
166 break;
168 case SID_EXTRUSION_TILT_DOWN:
169 case SID_EXTRUSION_TILT_UP:
170 case SID_EXTRUSION_TILT_LEFT:
171 case SID_EXTRUSION_TILT_RIGHT:
173 bool bHorizontal = ( nSID == SID_EXTRUSION_TILT_DOWN ) || ( nSID == SID_EXTRUSION_TILT_UP );
174 sal_Int32 nDiff = ( nSID == SID_EXTRUSION_TILT_LEFT ) || ( nSID == SID_EXTRUSION_TILT_UP ) ? 5 : -5;
175 EnhancedCustomShapeParameterPair aRotateAnglePropPair;
176 double fX = 0.0;
177 double fY = 0.0;
178 aRotateAnglePropPair.First.Value <<= fX;
179 aRotateAnglePropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
180 aRotateAnglePropPair.Second.Value <<= fY;
181 aRotateAnglePropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
182 com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sRotateAngle );
183 if( pAny && ( *pAny >>= aRotateAnglePropPair ) )
185 aRotateAnglePropPair.First.Value >>= fX;
186 aRotateAnglePropPair.Second.Value >>= fY;
188 if ( bHorizontal )
189 fX += nDiff;
190 else
191 fY += nDiff;
192 aRotateAnglePropPair.First.Value <<= fX;
193 aRotateAnglePropPair.Second.Value <<= fY;
194 com::sun::star::beans::PropertyValue aPropValue;
195 aPropValue.Name = sRotateAngle;
196 aPropValue.Value <<= aRotateAnglePropPair;
197 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
199 break;
201 case SID_EXTRUSION_DIRECTION:
203 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DIRECTION ) == SFX_ITEM_SET )
205 sal_Int32 nSkew = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DIRECTION))->GetValue();
207 Position3D aViewPoint( 3472, -3472, 25000 );
208 double fOriginX = 0.50;
209 double fOriginY = -0.50;
210 double fSkewAngle = nSkew;
211 double fSkew = 50.0;
213 switch( nSkew )
215 case 135:
216 aViewPoint.PositionY = 3472;
217 fOriginY = 0.50;
218 break;
219 case 90:
220 aViewPoint.PositionX = 0;
221 aViewPoint.PositionY = 3472;
222 fOriginX = 0;
223 fOriginY = -0.50;
224 break;
225 case 45:
226 aViewPoint.PositionX = -3472;
227 aViewPoint.PositionY = 3472;
228 fOriginX = -0.50;
229 fOriginY = 0.50;
230 break;
231 case 180:
232 aViewPoint.PositionY = 0;
233 fOriginY = 0;
234 break;
235 case 0:
236 aViewPoint.PositionX = 0;
237 aViewPoint.PositionY = 0;
238 fOriginX = 0;
239 fOriginY = 0;
240 fSkew = 0.0;
241 break;
242 case -360:
243 aViewPoint.PositionX = -3472;
244 aViewPoint.PositionY = 0;
245 fOriginX = -0.50;
246 fOriginY = 0;
247 break;
248 case -90:
249 aViewPoint.PositionX = 0;
250 fOriginX = 0;
251 break;
252 case -45:
253 aViewPoint.PositionX = -3472;
254 fOriginX = -0.50;
255 break;
258 com::sun::star::beans::PropertyValue aPropValue;
260 aPropValue.Name = sViewPoint;
261 aPropValue.Value <<= aViewPoint;
262 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
265 EnhancedCustomShapeParameterPair aOriginPropPair;
266 aOriginPropPair.First.Value <<= fOriginX;
267 aOriginPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
268 aOriginPropPair.Second.Value <<= fOriginY;
269 aOriginPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
270 aPropValue.Name = sOrigin;
271 aPropValue.Value <<= aOriginPropPair;
272 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
274 EnhancedCustomShapeParameterPair aSkewPropPair;
275 aSkewPropPair.First.Value <<= fSkew;
276 aSkewPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
277 aSkewPropPair.Second.Value <<= fSkewAngle;
278 aSkewPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
279 aPropValue.Name = sSkew;
280 aPropValue.Value <<= aSkewPropPair;
281 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
284 break;
285 case SID_EXTRUSION_PROJECTION:
287 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_PROJECTION ) == SFX_ITEM_SET )
289 sal_Int32 nProjection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue();
290 ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
291 com::sun::star::beans::PropertyValue aPropValue;
292 aPropValue.Name = sProjectionMode;
293 aPropValue.Value <<= eProjectionMode;
294 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
297 break;
298 case SID_EXTRUSION_DEPTH:
300 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SFX_ITEM_SET)
302 double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
303 double fFraction = 0.0;
304 EnhancedCustomShapeParameterPair aDepthPropPair;
305 aDepthPropPair.First.Value <<= fDepth;
306 aDepthPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
307 aDepthPropPair.Second.Value <<= fFraction;
308 aDepthPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
310 com::sun::star::beans::PropertyValue aPropValue;
311 aPropValue.Name = sDepth;
312 aPropValue.Value <<= aDepthPropPair;
313 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
316 break;
317 case SID_EXTRUSION_3D_COLOR:
319 static const OUString sExtrusionColor( "Color" );
321 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_3D_COLOR ) == SFX_ITEM_SET)
323 Color aColor( ((const SvxColorItem&)rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() );
325 const bool bAuto = aColor == COL_AUTO;
327 com::sun::star::beans::PropertyValue aPropValue;
328 aPropValue.Name = sExtrusionColor;
329 aPropValue.Value <<= bAuto ? sal_False : sal_True;
330 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
332 if( bAuto )
334 pObj->ClearMergedItem( XATTR_SECONDARYFILLCOLOR );
336 else
338 pObj->SetMergedItem( XSecondaryFillColorItem( String(), aColor ) );
340 pObj->BroadcastObjectChange();
343 break;
344 case SID_EXTRUSION_SURFACE:
346 static const OUString sShadeMode( "ShadeMode" );
347 static const OUString sSpecularity( "Specularity" );
348 static const OUString sDiffusion( "Diffusion" );
349 static const OUString sMetal( "Metal" );
351 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_SURFACE ) == SFX_ITEM_SET)
353 sal_Int32 nSurface = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue();
355 ShadeMode eShadeMode( ShadeMode_FLAT );
356 sal_Bool bMetal = sal_False;
357 double fSpecularity = 0;
358 double fDiffusion = 0;
360 switch( nSurface )
362 case 0: // wireframe
363 eShadeMode = ShadeMode_DRAFT;
364 break;
365 case 1: // matte
366 break;
367 case 2: // plastic
368 fSpecularity = 122.0;
369 break;
370 case 3: // metal
371 bMetal = true;
372 fSpecularity = 122.0;
373 fDiffusion = 122.0;
374 break;
377 com::sun::star::beans::PropertyValue aPropValue;
378 aPropValue.Name = sShadeMode;
379 aPropValue.Value <<= eShadeMode;
380 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
382 aPropValue.Name = sMetal;
383 aPropValue.Value <<= bMetal;
384 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
386 aPropValue.Name = sSpecularity;
387 aPropValue.Value <<= fSpecularity;
388 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
390 aPropValue.Name = sDiffusion;
391 aPropValue.Value <<= fDiffusion;
392 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
395 break;
396 case SID_EXTRUSION_LIGHTING_INTENSITY:
398 static const OUString sBrightness( "Brightness" );
399 static const OUString sLightFace( "LightFace" );
400 static const OUString sFirstLightHarsh( "FirstLightHarsh" );
401 static const OUString sSecondLightHarsh( "SecondLightHarsh" );
402 static const OUString sFirstLightLevel( "FirstLightLevel" );
403 static const OUString sSecondLightLevel( "SecondLightLevel" );
405 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_INTENSITY ) == SFX_ITEM_SET)
407 sal_Int32 nLevel = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue();
409 double fBrightness;
410 sal_Bool bHarsh2;
411 double fLevel1;
412 double fLevel2;
414 switch( nLevel )
416 case 0: // bright
417 fBrightness = 34.0;
418 bHarsh2 = sal_False;
419 fLevel1 = 66.0;
420 fLevel2 = 66.0;
421 break;
422 case 1: // normal
423 fBrightness = 15.0;
424 bHarsh2 = sal_False;
425 fLevel1 = 67.0;
426 fLevel2 = 37.0;
427 break;
428 case 2: // dim
429 fBrightness = 6.0;
430 bHarsh2 = sal_True;
431 fLevel1 = 79.0;
432 fLevel2 = 21.0;
433 break;
436 com::sun::star::beans::PropertyValue aPropValue;
437 aPropValue.Name = sBrightness;
438 aPropValue.Value <<= fBrightness;
439 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
441 aPropValue.Name = sLightFace;
442 aPropValue.Value <<= sal_True;
443 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
445 aPropValue.Name = sFirstLightHarsh;
446 aPropValue.Value <<= sal_True;
447 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
449 aPropValue.Name = sSecondLightHarsh;
450 aPropValue.Value <<= bHarsh2;
451 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
453 aPropValue.Name = sFirstLightLevel;
454 aPropValue.Value <<= fLevel1;
455 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
457 aPropValue.Name = sSecondLightLevel;
458 aPropValue.Value <<= fLevel2;
459 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
462 break;
463 case SID_EXTRUSION_LIGHTING_DIRECTION:
465 if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_DIRECTION ) == SFX_ITEM_SET)
467 sal_Int32 nDirection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_DIRECTION))->GetValue();
469 if((nDirection >= 0) && (nDirection < 9))
471 const OUString sFirstLightDirection( "FirstLightDirection" );
472 const OUString sSecondLightDirection( "SecondLightDirection" );
474 const Direction3D * pLighting1Defaults;
475 const Direction3D * pLighting2Defaults;
477 getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
479 com::sun::star::beans::PropertyValue aPropValue;
480 aPropValue.Name = sFirstLightDirection;
481 aPropValue.Value <<= pLighting1Defaults[nDirection];
482 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
484 aPropValue.Name = sSecondLightDirection;
485 aPropValue.Value <<= pLighting2Defaults[nDirection];
486 rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
490 break;
495 void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
497 sal_uInt16 nSID = rReq.GetSlot();
498 sal_uInt16 nStrResId = 0;
500 const bool bUndo = pSdrView && pSdrView->IsUndoEnabled();
502 switch( nSID )
504 case SID_EXTRUSION_TOOGLE:
506 if ( !nStrResId )
507 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF;
508 } // PASSTROUGH
509 case SID_EXTRUSION_TILT_DOWN:
511 if ( !nStrResId )
512 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN;
513 } // PASSTROUGH
514 case SID_EXTRUSION_TILT_UP:
516 if ( !nStrResId )
517 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP;
518 } // PASSTROUGH
519 case SID_EXTRUSION_TILT_LEFT:
521 if ( !nStrResId )
522 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT;
523 } // PASSTROUGH
524 case SID_EXTRUSION_TILT_RIGHT:
526 if ( !nStrResId )
527 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT;
528 } // PASSTROUGH
529 case SID_EXTRUSION_DIRECTION:
531 if ( !nStrResId )
532 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION;
533 } // PASSTROUGH
534 case SID_EXTRUSION_PROJECTION:
536 if ( !nStrResId )
537 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION;
538 } // PASSTROUGH
539 case SID_EXTRUSION_DEPTH:
541 if ( !nStrResId )
542 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH;
543 } // PASSTROUGH
544 case SID_EXTRUSION_3D_COLOR:
546 if ( !nStrResId )
547 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR;
548 } // PASSTROUGH
549 case SID_EXTRUSION_SURFACE:
551 if ( !nStrResId )
552 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE;
553 } // PASSTROUGH
554 case SID_EXTRUSION_LIGHTING_INTENSITY:
556 if ( !nStrResId )
557 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS;
558 } // PASSTROUGH
559 case SID_EXTRUSION_LIGHTING_DIRECTION:
561 if ( !nStrResId )
562 nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING;
564 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
565 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
567 for(i=0; i<nCount; i++)
569 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
570 if( pObj->ISA(SdrObjCustomShape) )
572 if( bUndo )
574 String aStr( SVX_RES( nStrResId ) );
575 pSdrView->BegUndo( aStr );
576 pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
578 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
579 impl_execute( pSdrView, rReq, aGeometryItem, pObj );
580 pObj->SetMergedItem( aGeometryItem );
581 pObj->BroadcastObjectChange();
582 if( bUndo )
583 pSdrView->EndUndo();
585 // simulate a context change:
586 // force SelectionHasChanged() being called
587 // so that extrusion bar will be visible/hidden
588 pSdrView->MarkListHasChanged();
592 break;
594 case SID_EXTRUSION_DEPTH_DIALOG:
595 if( rReq.GetArgs() &&
596 (rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SFX_ITEM_SET) &&
597 (rReq.GetArgs()->GetItemState( SID_ATTR_METRIC ) == SFX_ITEM_SET))
599 double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
600 FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue();
602 ExtrusionDepthDialog aDlg( 0L, fDepth, eUnit );
603 sal_uInt16 nRet = aDlg.Execute();
604 if( nRet != 0 )
606 fDepth = aDlg.getDepth();
608 SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
609 SfxPoolItem* aItems[] = { &aItem, 0 };
610 rBindings.Execute( SID_EXTRUSION_DEPTH, (const SfxPoolItem**)aItems );
613 break;
616 if( nSID == SID_EXTRUSION_TOOGLE )
618 static sal_uInt16 SidArray[] = {
619 SID_EXTRUSION_TILT_DOWN,
620 SID_EXTRUSION_TILT_UP,
621 SID_EXTRUSION_TILT_LEFT,
622 SID_EXTRUSION_TILT_RIGHT,
623 SID_EXTRUSION_DEPTH_FLOATER,
624 SID_EXTRUSION_DIRECTION_FLOATER,
625 SID_EXTRUSION_LIGHTING_FLOATER,
626 SID_EXTRUSION_SURFACE_FLOATER,
627 SID_EXTRUSION_3D_COLOR,
628 SID_EXTRUSION_DEPTH,
629 SID_EXTRUSION_DIRECTION,
630 SID_EXTRUSION_PROJECTION,
631 SID_EXTRUSION_LIGHTING_DIRECTION,
632 SID_EXTRUSION_LIGHTING_INTENSITY,
633 SID_EXTRUSION_SURFACE,
634 0 };
636 rBindings.Invalidate( SidArray );
640 void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
642 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
643 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
645 static const OUString sExtrusion( "Extrusion" );
646 static const OUString sViewPoint( "ViewPoint" );
647 static const OUString sOrigin( "Origin" );
648 static const OUString sSkew( "Skew" );
649 static const OUString sProjectionMode( "ProjectionMode" );
651 com::sun::star::uno::Any* pAny;
653 double fFinalSkewAngle = -1;
654 bool bHasCustomShape = false;
656 for(i=0;i<nCount; i++)
658 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
659 if( pObj->ISA(SdrObjCustomShape) )
661 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
663 // see if this is an extruded customshape
664 if( !bHasCustomShape )
666 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
667 if( pAny_ )
668 *pAny_ >>= bHasCustomShape;
670 if( !bHasCustomShape )
671 continue;
674 bool bParallel = true;
675 Position3D aViewPoint( 3472, -3472, 25000 );
676 double fSkewAngle = -135;
678 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
679 sal_Int16 nProjectionMode = sal_Int16();
680 if( pAny && ( *pAny >>= nProjectionMode ) )
681 bParallel = nProjectionMode == ProjectionMode_PARALLEL;
683 if( bParallel )
685 double fSkew = 50.0;
686 EnhancedCustomShapeParameterPair aSkewPropPair;
687 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSkew );
688 if( pAny && ( *pAny >>= aSkewPropPair ) )
690 aSkewPropPair.First.Value >>= fSkew;
691 aSkewPropPair.Second.Value >>= fSkewAngle;
693 if ( fSkew == 0.0 )
694 fSkewAngle = 0.0;
695 else if ( fSkewAngle == 0.0 )
696 fSkewAngle = -360.0;
698 else
700 double fOriginX = 0.50;
701 double fOriginY = -0.50;
702 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sViewPoint );
703 if( pAny )
704 *pAny >>= aViewPoint;
706 EnhancedCustomShapeParameterPair aOriginPropPair;
707 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sOrigin );
708 if( pAny && ( *pAny >>= aOriginPropPair ) )
710 aOriginPropPair.First.Value >>= fOriginX;
711 aOriginPropPair.Second.Value >>= fOriginY;
713 fSkewAngle = -1;
714 const double e = 0.0001;
715 if( aViewPoint.PositionX > e )
717 if( aViewPoint.PositionY > e )
719 if( (fOriginX > e ) && ( fOriginY > e ) )
720 fSkewAngle = 135.0;
722 else if( aViewPoint.PositionY < -e )
724 if( ( fOriginX > e ) && ( fOriginY < -e ) )
725 fSkewAngle = -135.0;
727 else
729 if( ( fOriginX > e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
730 fSkewAngle = 180.0;
733 else if( aViewPoint.PositionX < -e )
735 if( aViewPoint.PositionY < -e )
737 if( ( fOriginX < -e ) && ( fOriginY < -e ) )
738 fSkewAngle = -45.0;
740 else if( aViewPoint.PositionY > e )
742 if( ( fOriginX < -e ) && ( fOriginY > e ) )
743 fSkewAngle = 45.0;
745 else
747 if( ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
748 fSkewAngle = -360.0;
751 else
753 if( aViewPoint.PositionY < -e )
755 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY < -e ) )
756 fSkewAngle = -90.0;
758 else if( aViewPoint.PositionY > e )
760 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > e ) )
761 fSkewAngle = 90.0;
763 else
765 if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
766 fSkewAngle = 0.0;
771 if( fFinalSkewAngle == -1.0 )
773 fFinalSkewAngle = fSkewAngle;
775 else if( fSkewAngle != fFinalSkewAngle )
777 fFinalSkewAngle = -1.0;
780 if( fFinalSkewAngle == -1.0 )
781 break;
785 if( bHasCustomShape )
786 rSet.Put( SfxInt32Item( SID_EXTRUSION_DIRECTION, (sal_Int32)fFinalSkewAngle ) );
787 else
788 rSet.DisableItem( SID_EXTRUSION_DIRECTION );
791 void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet )
793 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
794 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
796 static const OUString sExtrusion( "Extrusion" );
797 static const OUString sProjectionMode( "ProjectionMode" );
799 com::sun::star::uno::Any* pAny;
801 sal_Int32 nFinalProjection = -1;
802 bool bHasCustomShape = false;
804 for(i=0;i<nCount; i++)
806 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
807 if( pObj->ISA(SdrObjCustomShape) )
809 // see if this is an extruded customshape
810 if( !bHasCustomShape )
812 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
813 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
814 if( pAny_ )
815 *pAny_ >>= bHasCustomShape;
817 if( !bHasCustomShape )
818 continue;
821 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
823 sal_Bool bParallel = sal_True;
824 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
825 ProjectionMode eProjectionMode;
826 if( pAny && ( *pAny >>= eProjectionMode ) )
827 bParallel = eProjectionMode == ProjectionMode_PARALLEL;
829 if( nFinalProjection == -1 )
831 nFinalProjection = bParallel;
833 else if( nFinalProjection != bParallel )
835 nFinalProjection = -1;
836 break;
841 if( bHasCustomShape )
842 rSet.Put( SfxInt32Item( SID_EXTRUSION_PROJECTION, nFinalProjection ) );
843 else
844 rSet.DisableItem( SID_EXTRUSION_PROJECTION );
847 void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet )
849 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
850 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
852 static const OUString sExtrusion( "Extrusion" );
853 static const OUString sShadeMode( "ShadeMode" );
854 static const OUString sSpecularity( "Specularity" );
855 static const OUString sMetal( "Metal" );
857 com::sun::star::uno::Any* pAny;
859 sal_Int32 nFinalSurface = -1;
860 bool bHasCustomShape = false;
862 for(i=0;i<nCount; i++)
864 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
865 if( pObj->ISA(SdrObjCustomShape) )
867 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
869 // see if this is an extruded customshape
870 if( !bHasCustomShape )
872 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
873 if( pAny_ )
874 *pAny_ >>= bHasCustomShape;
876 if( !bHasCustomShape )
877 continue;
880 sal_Int32 nSurface = 0; // wire frame
882 ShadeMode eShadeMode( ShadeMode_FLAT );
883 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sShadeMode );
884 if( pAny )
885 *pAny >>= eShadeMode;
887 if( eShadeMode == ShadeMode_FLAT )
889 sal_Bool bMetal = sal_False;
890 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sMetal );
891 if( pAny )
892 *pAny >>= bMetal;
894 if( bMetal )
896 nSurface = 3; // metal
898 else
900 double fSpecularity = 0;
901 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSpecularity );
902 if( pAny )
903 *pAny >>= fSpecularity;
905 const double e = 0.0001;
906 if( (fSpecularity > -e) && (fSpecularity < e) )
908 nSurface = 1; // matte
910 else
912 nSurface = 2; // plastic
917 if( nFinalSurface == -1 )
919 nFinalSurface = nSurface;
921 else if( nFinalSurface != nSurface )
923 nFinalSurface = -1;
924 break;
929 if( bHasCustomShape )
930 rSet.Put( SfxInt32Item( SID_EXTRUSION_SURFACE, nFinalSurface ) );
931 else
932 rSet.DisableItem( SID_EXTRUSION_SURFACE );
935 void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet )
937 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
938 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
940 static const OUString sExtrusion( "Extrusion" );
941 static const OUString sDepth( "Depth" );
943 com::sun::star::uno::Any* pAny;
945 double fFinalDepth = -1;
946 bool bHasCustomShape = false;
948 for(i=0;i<nCount; i++)
950 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
951 if( pObj->ISA(SdrObjCustomShape) )
953 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
955 // see if this is an extruded customshape
956 if( !bHasCustomShape )
958 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
959 if( pAny_ )
960 *pAny_ >>= bHasCustomShape;
962 if( !bHasCustomShape )
963 continue;
966 double fDepth = 1270.0;
967 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sDepth );
968 if( pAny )
970 EnhancedCustomShapeParameterPair aDepthPropPair;
971 if ( *pAny >>= aDepthPropPair )
972 aDepthPropPair.First.Value >>= fDepth;
975 if( fFinalDepth == -1 )
977 fFinalDepth = fDepth;
979 else if( fFinalDepth != fDepth )
981 fFinalDepth = -1;
982 break;
987 if( pSdrView->GetModel() )
989 FieldUnit eUnit = pSdrView->GetModel()->GetUIUnit();
990 rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)eUnit ) );
993 if( bHasCustomShape )
994 rSet.Put( SvxDoubleItem( fFinalDepth, SID_EXTRUSION_DEPTH ) );
995 else
996 rSet.DisableItem( SID_EXTRUSION_DEPTH );
999 static bool compare_direction( const Direction3D& d1, const Direction3D& d2 )
1001 if( ((d1.DirectionX < 0) && (d2.DirectionX < 0)) || ((d1.DirectionX == 0) && (d2.DirectionX == 0)) || ((d1.DirectionX > 0) && (d2.DirectionX > 0)) )
1003 if( ((d1.DirectionY < 0) && (d2.DirectionY < 0)) || ((d1.DirectionY == 0) && (d2.DirectionY == 0)) || ((d1.DirectionY > 0) && (d2.DirectionY > 0)) )
1005 if( ((d1.DirectionZ < 0) && (d2.DirectionZ < 0)) || ((d1.DirectionZ == 0) && (d2.DirectionZ == 0)) || ((d1.DirectionZ > 0) && (d2.DirectionZ > 0)) )
1007 return true;
1012 return false;
1015 void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
1017 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1018 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1020 static const OUString sExtrusion( "Extrusion" );
1021 static const OUString sFirstLightDirection( "FirstLightDirection" );
1022 static const OUString sSecondLightDirection( "SecondLightDirection" );
1024 const Direction3D * pLighting1Defaults;
1025 const Direction3D * pLighting2Defaults;
1027 getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
1029 com::sun::star::uno::Any* pAny;
1031 int nFinalDirection = -1;
1032 bool bHasCustomShape = false;
1034 for(i=0;i<nCount; i++)
1036 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1037 if( pObj->ISA(SdrObjCustomShape) )
1039 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1041 // see if this is an extruded customshape
1042 if( !bHasCustomShape )
1044 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1045 if( pAny_ )
1046 *pAny_ >>= bHasCustomShape;
1048 if( !bHasCustomShape )
1049 continue;
1052 Direction3D aFirstLightDirection( 50000, 0, 10000 );
1053 Direction3D aSecondLightDirection( -50000, 0, 10000 );
1055 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sFirstLightDirection );
1056 if( pAny )
1057 *pAny >>= aFirstLightDirection;
1059 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSecondLightDirection );
1060 if( pAny )
1061 *pAny >>= aSecondLightDirection;
1063 int nDirection = -1;
1065 int j;
1066 for( j = 0; j < 9; j++ )
1068 if( compare_direction( aFirstLightDirection, pLighting1Defaults[j] ) &&
1069 compare_direction( aSecondLightDirection, pLighting2Defaults[j] ))
1071 nDirection = j;
1072 break;
1076 if( nFinalDirection == -1 )
1078 nFinalDirection = nDirection;
1080 else if( nDirection != nFinalDirection )
1082 nFinalDirection = -1;
1085 if( nFinalDirection == -1 )
1086 break;
1090 if( bHasCustomShape )
1091 rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, (sal_Int32)nFinalDirection ) );
1092 else
1093 rSet.DisableItem( SID_EXTRUSION_LIGHTING_DIRECTION );
1096 void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet )
1098 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1099 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1101 static const OUString sExtrusion( "Extrusion" );
1102 static const OUString sBrightness( "Brightness" );
1104 com::sun::star::uno::Any* pAny;
1106 int nFinalLevel = -1;
1107 bool bHasCustomShape = false;
1109 for(i=0;i<nCount; i++)
1111 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1112 if( pObj->ISA(SdrObjCustomShape) )
1114 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1116 // see if this is an extruded customshape
1117 if( !bHasCustomShape )
1119 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1120 if( pAny_ )
1121 *pAny_ >>= bHasCustomShape;
1123 if( !bHasCustomShape )
1124 continue;
1127 double fBrightness = 22178.0 / 655.36;
1128 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sBrightness );
1129 if( pAny )
1130 *pAny >>= fBrightness;
1132 int nLevel;
1133 if( fBrightness >= 30.0 )
1135 nLevel = 0; // Bright
1137 else if( fBrightness >= 10.0 )
1139 nLevel = 1; // Noraml;
1141 else
1143 nLevel = 2; // Dim
1146 if( nFinalLevel == -1 )
1148 nFinalLevel = nLevel;
1150 else if( nFinalLevel != nLevel )
1152 nFinalLevel = -1;
1153 break;
1158 if( bHasCustomShape )
1159 rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_INTENSITY, nFinalLevel ) );
1160 else
1161 rSet.DisableItem( SID_EXTRUSION_LIGHTING_INTENSITY );
1164 void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet )
1166 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1167 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1169 static const OUString sExtrusion( "Extrusion" );
1170 static const OUString sExtrusionColor( "Color" );
1172 com::sun::star::uno::Any* pAny;
1174 bool bInit = false;
1175 bool bAmbigius = false;
1176 Color aFinalColor;
1177 bool bHasCustomShape = false;
1179 for(i=0;i<nCount; i++)
1181 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1182 if( pObj->ISA(SdrObjCustomShape) )
1184 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1186 // see if this is an extruded customshape
1187 if( !bHasCustomShape )
1189 Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1190 if( pAny_ )
1191 *pAny_ >>= bHasCustomShape;
1193 if( !bHasCustomShape )
1194 continue;
1197 Color aColor;
1199 bool bUseColor = false;
1200 pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusionColor );
1201 if( pAny )
1202 *pAny >>= bUseColor;
1204 if( bUseColor )
1206 const XSecondaryFillColorItem& rItem = *(XSecondaryFillColorItem*)&(pObj->GetMergedItem( XATTR_SECONDARYFILLCOLOR ));
1207 aColor = rItem.GetColorValue();
1209 else
1211 aColor = COL_AUTO;
1214 if( !bInit )
1216 aFinalColor = aColor;
1217 bInit = true;
1219 else if( aFinalColor != aColor )
1221 bAmbigius = true;
1222 break;
1227 if( bAmbigius )
1228 aFinalColor = COL_AUTO;
1230 if( bHasCustomShape )
1231 rSet.Put( SvxColorItem( aFinalColor, SID_EXTRUSION_3D_COLOR ) );
1232 else
1233 rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
1236 namespace svx {
1237 bool checkForSelectedCustomShapes( SdrView* pSdrView, bool bOnlyExtruded )
1239 static const OUString sExtrusion( "Extrusion" );
1241 const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1242 sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1243 bool bFound = false;
1245 for(i=0;(i<nCount) && !bFound ; i++)
1247 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1248 if( pObj->ISA(SdrObjCustomShape) )
1250 if( bOnlyExtruded )
1252 SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1253 Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1254 if( pAny )
1255 *pAny >>= bFound;
1257 else
1259 bFound = true;
1264 return bFound;
1268 void ExtrusionBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
1270 if (rSet.GetItemState(SID_EXTRUSION_DIRECTION) != SFX_ITEM_UNKNOWN)
1272 getExtrusionDirectionState( pSdrView, rSet );
1274 if (rSet.GetItemState(SID_EXTRUSION_PROJECTION) != SFX_ITEM_UNKNOWN)
1276 getExtrusionProjectionState( pSdrView, rSet );
1278 const bool bOnlyExtrudedCustomShapes =
1279 checkForSelectedCustomShapes( pSdrView, true );
1280 if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SFX_ITEM_UNKNOWN)
1282 if (! bOnlyExtrudedCustomShapes)
1283 rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
1285 if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SFX_ITEM_UNKNOWN)
1287 if (! bOnlyExtrudedCustomShapes)
1288 rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
1290 if (rSet.GetItemState(SID_EXTRUSION_TILT_UP) != SFX_ITEM_UNKNOWN)
1292 if (! bOnlyExtrudedCustomShapes)
1293 rSet.DisableItem( SID_EXTRUSION_TILT_UP );
1295 if (rSet.GetItemState(SID_EXTRUSION_TILT_LEFT) != SFX_ITEM_UNKNOWN)
1297 if (! bOnlyExtrudedCustomShapes)
1298 rSet.DisableItem( SID_EXTRUSION_TILT_LEFT );
1300 if (rSet.GetItemState(SID_EXTRUSION_TILT_RIGHT) != SFX_ITEM_UNKNOWN)
1302 if (! bOnlyExtrudedCustomShapes)
1303 rSet.DisableItem( SID_EXTRUSION_TILT_RIGHT );
1305 if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SFX_ITEM_UNKNOWN)
1307 if (! bOnlyExtrudedCustomShapes)
1308 rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
1310 if (rSet.GetItemState(SID_EXTRUSION_DEPTH_FLOATER) != SFX_ITEM_UNKNOWN)
1312 if (! bOnlyExtrudedCustomShapes)
1313 rSet.DisableItem( SID_EXTRUSION_DEPTH_FLOATER );
1315 if (rSet.GetItemState(SID_EXTRUSION_DIRECTION_FLOATER) != SFX_ITEM_UNKNOWN)
1317 if (! bOnlyExtrudedCustomShapes)
1318 rSet.DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
1320 if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_FLOATER) != SFX_ITEM_UNKNOWN)
1322 if (! bOnlyExtrudedCustomShapes)
1323 rSet.DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
1325 if (rSet.GetItemState(SID_EXTRUSION_SURFACE_FLOATER) != SFX_ITEM_UNKNOWN)
1327 if(! bOnlyExtrudedCustomShapes)
1328 rSet.DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
1330 if (rSet.GetItemState(SID_EXTRUSION_TOOGLE) != SFX_ITEM_UNKNOWN)
1332 if( !checkForSelectedCustomShapes( pSdrView, false ) )
1333 rSet.DisableItem( SID_EXTRUSION_TOOGLE );
1335 if (rSet.GetItemState(SID_EXTRUSION_DEPTH) != SFX_ITEM_UNKNOWN)
1337 getExtrusionDepthState( pSdrView, rSet );
1339 if (rSet.GetItemState(SID_EXTRUSION_SURFACE) != SFX_ITEM_UNKNOWN)
1341 getExtrusionSurfaceState( pSdrView, rSet );
1343 if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_INTENSITY) != SFX_ITEM_UNKNOWN)
1345 getExtrusionLightingIntensityState( pSdrView, rSet );
1348 if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_DIRECTION) != SFX_ITEM_UNKNOWN)
1350 getExtrusionLightingDirectionState( pSdrView, rSet );
1353 if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SFX_ITEM_UNKNOWN)
1355 getExtrusionColorState( pSdrView, rSet );
1359 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */