xref: /AOO41X/main/svx/source/toolbars/extrusionbar.cxx (revision f6e50924346d0b8c0b07c91832a97665dd718b0c)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARIR_HPP_
28cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
31cdf0e10cSrcweir #include <com/sun/star/drawing/ShadeMode.hpp>
32cdf0e10cSrcweir #include <com/sun/star/drawing/Position3D.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/Direction3D.hpp>
34cdf0e10cSrcweir #include <com/sun/star/drawing/ProjectionMode.hpp>
35cdf0e10cSrcweir #include <svx/svdundo.hxx>
36cdf0e10cSrcweir #include <sfx2/app.hxx>
37cdf0e10cSrcweir #include <sfx2/request.hxx>
38cdf0e10cSrcweir #include <sfx2/objface.hxx>
39cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
40cdf0e10cSrcweir #include <sfx2/bindings.hxx>
41cdf0e10cSrcweir #include <svx/xsflclit.hxx>
42cdf0e10cSrcweir #include <svx/dialmgr.hxx>
43cdf0e10cSrcweir #include <svx/svdoashp.hxx>
44cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC
45cdf0e10cSrcweir #include <svx/dialogs.hrc>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #include <svx/svdview.hxx>
48cdf0e10cSrcweir #include <editeng/colritem.hxx>
49cdf0e10cSrcweir #include "svx/chrtitem.hxx"
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include <svx/extrusionbar.hxx>
52cdf0e10cSrcweir #include "extrusiondepthdialog.hxx"
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
55cdf0e10cSrcweir using namespace ::svx;
56cdf0e10cSrcweir using namespace ::rtl;
57cdf0e10cSrcweir using namespace ::cppu;
58cdf0e10cSrcweir using namespace ::com::sun::star::beans;
59cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
60cdf0e10cSrcweir using namespace ::com::sun::star::uno;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /*************************************************************************
63cdf0e10cSrcweir |*
64cdf0e10cSrcweir |* Standardinterface deklarieren (Die Slotmap darf nicht leer sein, also
65cdf0e10cSrcweir |* tragen wir etwas ein, was hier (hoffentlich) nie vorkommt).
66cdf0e10cSrcweir |*
67cdf0e10cSrcweir \************************************************************************/
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #define ShellClass ExtrusionBar
70cdf0e10cSrcweir 
SFX_SLOTMAP(ExtrusionBar)71cdf0e10cSrcweir SFX_SLOTMAP(ExtrusionBar)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 			{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
SFX_IMPL_INTERFACE(ExtrusionBar,SfxShell,SVX_RES (RID_SVX_EXTRUSION_BAR))76cdf0e10cSrcweir SFX_IMPL_INTERFACE(ExtrusionBar, SfxShell, SVX_RES(RID_SVX_EXTRUSION_BAR))
77cdf0e10cSrcweir {
78cdf0e10cSrcweir 	SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT, SVX_RES(RID_SVX_EXTRUSION_BAR) );
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir TYPEINIT1( ExtrusionBar, SfxShell );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir /*************************************************************************
85cdf0e10cSrcweir |*
86cdf0e10cSrcweir |* Standard-Konstruktor
87cdf0e10cSrcweir |*
88cdf0e10cSrcweir \************************************************************************/
89cdf0e10cSrcweir 
ExtrusionBar(SfxViewShell * pViewShell)90cdf0e10cSrcweir ExtrusionBar::ExtrusionBar(SfxViewShell* pViewShell )
91cdf0e10cSrcweir : SfxShell(pViewShell)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	DBG_ASSERT( pViewShell, "svx::ExtrusionBar::ExtrusionBar(), I need a viewshell!" );
94cdf0e10cSrcweir 	if( pViewShell )
95cdf0e10cSrcweir 		SetPool(&pViewShell->GetPool());
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	SetHelpId( SVX_INTERFACE_EXTRUSION_BAR );
98cdf0e10cSrcweir 	SetName( String( SVX_RES( RID_SVX_EXTRUSION_BAR )));
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 
102cdf0e10cSrcweir /*************************************************************************
103cdf0e10cSrcweir |*
104cdf0e10cSrcweir |* Destruktor
105cdf0e10cSrcweir |*
106cdf0e10cSrcweir \************************************************************************/
107cdf0e10cSrcweir 
~ExtrusionBar()108cdf0e10cSrcweir ExtrusionBar::~ExtrusionBar()
109cdf0e10cSrcweir {
110cdf0e10cSrcweir 	SetRepeatTarget(NULL);
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
getLightingDirectionDefaults(const Direction3D ** pLighting1Defaults,const Direction3D ** pLighting2Defaults)113cdf0e10cSrcweir void getLightingDirectionDefaults( const Direction3D **pLighting1Defaults, const Direction3D **pLighting2Defaults )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	static const Direction3D aLighting1Defaults[9] =
117cdf0e10cSrcweir 	{
118cdf0e10cSrcweir 		Direction3D( -50000, -50000, 10000 ),
119cdf0e10cSrcweir 		Direction3D( 0, -50000, 10000 ),
120cdf0e10cSrcweir 		Direction3D( 50000, -50000, 10000 ),
121cdf0e10cSrcweir 		Direction3D( -50000, 0, 10000 ),
122cdf0e10cSrcweir 		Direction3D( 0, 0, 10000 ),
123cdf0e10cSrcweir 		Direction3D( 50000, 0, 10000 ),
124cdf0e10cSrcweir 		Direction3D( -50000, 50000, 10000 ),
125cdf0e10cSrcweir 		Direction3D( 0, 50000, 10000 ),
126cdf0e10cSrcweir 		Direction3D( 50000, 50000, 10000 )
127cdf0e10cSrcweir 	};
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	static const Direction3D aLighting2Defaults[9] =
130cdf0e10cSrcweir 	{
131cdf0e10cSrcweir 		Direction3D( 50000,0, 10000 ),
132cdf0e10cSrcweir 		Direction3D( 0, 50000, 10000 ),
133cdf0e10cSrcweir 		Direction3D( -50000, 0, 10000 ),
134cdf0e10cSrcweir 		Direction3D( 50000, 0, 10000 ),
135cdf0e10cSrcweir 		Direction3D( 0, 0, 10000 ),
136cdf0e10cSrcweir 		Direction3D( -50000, 0, 10000 ),
137cdf0e10cSrcweir 		Direction3D( 50000, 0, 10000 ),
138cdf0e10cSrcweir 		Direction3D( 0, -50000, 10000 ),
139cdf0e10cSrcweir 		Direction3D( -50000, 0, 10000 )
140cdf0e10cSrcweir 	};
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	*pLighting1Defaults = (const Direction3D *)aLighting1Defaults;
143cdf0e10cSrcweir 	*pLighting2Defaults = (const Direction3D *)aLighting2Defaults;
144cdf0e10cSrcweir };
145cdf0e10cSrcweir 
impl_execute(SdrView *,SfxRequest & rReq,SdrCustomShapeGeometryItem & rGeometryItem,SdrObject * pObj)146cdf0e10cSrcweir static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
149cdf0e10cSrcweir 	static const rtl::OUString	sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
150cdf0e10cSrcweir 	static const rtl::OUString	sRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "RotateAngle" ) );
151cdf0e10cSrcweir 	static const rtl::OUString	sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
152cdf0e10cSrcweir 	static const rtl::OUString	sOrigin( RTL_CONSTASCII_USTRINGPARAM ( "Origin" ) );
153cdf0e10cSrcweir 	static const rtl::OUString	sSkew( RTL_CONSTASCII_USTRINGPARAM ( "Skew" ) );
154cdf0e10cSrcweir 	static const rtl::OUString  sDepth( RTL_CONSTASCII_USTRINGPARAM ( "Depth" ) );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	sal_uInt16 nSID = rReq.GetSlot();
157cdf0e10cSrcweir 	switch( nSID )
158cdf0e10cSrcweir 	{
159cdf0e10cSrcweir 	case SID_EXTRUSION_TOOGLE:
160cdf0e10cSrcweir 	{
161cdf0e10cSrcweir 		com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 		if( pAny )
164cdf0e10cSrcweir 		{
165cdf0e10cSrcweir 			sal_Bool bOn;
166cdf0e10cSrcweir 			(*pAny) >>= bOn;
167cdf0e10cSrcweir 			bOn = !bOn;
168cdf0e10cSrcweir 			(*pAny) <<= bOn;
169cdf0e10cSrcweir 		}
170cdf0e10cSrcweir 		else
171cdf0e10cSrcweir 		{
172cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
173cdf0e10cSrcweir 			aPropValue.Name = sExtrusion;
174cdf0e10cSrcweir 			aPropValue.Value <<= sal_True;
175cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
176cdf0e10cSrcweir 		}
177cdf0e10cSrcweir 	}
178cdf0e10cSrcweir 	break;
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	case SID_EXTRUSION_TILT_DOWN:
181cdf0e10cSrcweir 	case SID_EXTRUSION_TILT_UP:
182cdf0e10cSrcweir 	case SID_EXTRUSION_TILT_LEFT:
183cdf0e10cSrcweir 	case SID_EXTRUSION_TILT_RIGHT:
184cdf0e10cSrcweir 	{
185cdf0e10cSrcweir 		sal_Bool bHorizontal = ( nSID == SID_EXTRUSION_TILT_DOWN ) || ( nSID == SID_EXTRUSION_TILT_UP );
186cdf0e10cSrcweir 		sal_Int32 nDiff = ( nSID == SID_EXTRUSION_TILT_LEFT ) || ( nSID == SID_EXTRUSION_TILT_UP ) ? 5 : -5;
187cdf0e10cSrcweir 		EnhancedCustomShapeParameterPair aRotateAnglePropPair;
188cdf0e10cSrcweir 		double fX = 0.0;
189cdf0e10cSrcweir 		double fY = 0.0;
190cdf0e10cSrcweir 		aRotateAnglePropPair.First.Value <<= fX;
191cdf0e10cSrcweir 		aRotateAnglePropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
192cdf0e10cSrcweir 		aRotateAnglePropPair.Second.Value <<= fY;
193cdf0e10cSrcweir 		aRotateAnglePropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
194cdf0e10cSrcweir 		com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sRotateAngle );
195cdf0e10cSrcweir 		if( pAny && ( *pAny >>= aRotateAnglePropPair ) )
196cdf0e10cSrcweir 		{
197cdf0e10cSrcweir 			aRotateAnglePropPair.First.Value >>= fX;
198cdf0e10cSrcweir 			aRotateAnglePropPair.Second.Value >>= fY;
199cdf0e10cSrcweir 		}
200cdf0e10cSrcweir 		if ( bHorizontal )
201cdf0e10cSrcweir 			fX += nDiff;
202cdf0e10cSrcweir 		else
203cdf0e10cSrcweir 			fY += nDiff;
204cdf0e10cSrcweir 		aRotateAnglePropPair.First.Value <<= fX;
205cdf0e10cSrcweir 		aRotateAnglePropPair.Second.Value <<= fY;
206cdf0e10cSrcweir 		com::sun::star::beans::PropertyValue aPropValue;
207cdf0e10cSrcweir 		aPropValue.Name = sRotateAngle;
208cdf0e10cSrcweir 		aPropValue.Value <<= aRotateAnglePropPair;
209cdf0e10cSrcweir 		rGeometryItem.SetPropertyValue( sExtrusion,	aPropValue );
210cdf0e10cSrcweir 	}
211cdf0e10cSrcweir 	break;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	case SID_EXTRUSION_DIRECTION:
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DIRECTION ) == SFX_ITEM_SET )
216cdf0e10cSrcweir 		{
217cdf0e10cSrcweir 			sal_Int32 nSkew = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DIRECTION))->GetValue();
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 			Position3D	aViewPoint( 3472, -3472, 25000 );
220cdf0e10cSrcweir 			double		fOriginX = 0.50;
221cdf0e10cSrcweir 			double		fOriginY = -0.50;
222cdf0e10cSrcweir 			double		fSkewAngle = nSkew;
223cdf0e10cSrcweir 			double		fSkew = 50.0;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 			switch( nSkew )
226cdf0e10cSrcweir 			{
227cdf0e10cSrcweir 			case 135:
228cdf0e10cSrcweir 				aViewPoint.PositionY = 3472;
229cdf0e10cSrcweir 				fOriginY = 0.50;
230cdf0e10cSrcweir 				break;
231cdf0e10cSrcweir 			case 90:
232cdf0e10cSrcweir 				aViewPoint.PositionX = 0;
233cdf0e10cSrcweir 				aViewPoint.PositionY = 3472;
234cdf0e10cSrcweir 				fOriginX = 0;
235cdf0e10cSrcweir 				fOriginY = -0.50;
236cdf0e10cSrcweir 				break;
237cdf0e10cSrcweir 			case 45:
238cdf0e10cSrcweir 				aViewPoint.PositionX = -3472;
239cdf0e10cSrcweir 				aViewPoint.PositionY = 3472;
240cdf0e10cSrcweir 				fOriginX = -0.50;
241cdf0e10cSrcweir 				fOriginY = 0.50;
242cdf0e10cSrcweir 				break;
243cdf0e10cSrcweir 			case 180:
244cdf0e10cSrcweir 				aViewPoint.PositionY = 0;
245cdf0e10cSrcweir 				fOriginY = 0;
246cdf0e10cSrcweir 				break;
247cdf0e10cSrcweir 			case 0:
248cdf0e10cSrcweir 				aViewPoint.PositionX = 0;
249cdf0e10cSrcweir 				aViewPoint.PositionY = 0;
250cdf0e10cSrcweir 				fOriginX = 0;
251cdf0e10cSrcweir 				fOriginY = 0;
252cdf0e10cSrcweir 				fSkew = 0.0;
253cdf0e10cSrcweir 				break;
254cdf0e10cSrcweir 			case -360:
255cdf0e10cSrcweir 				aViewPoint.PositionX = -3472;
256cdf0e10cSrcweir 				aViewPoint.PositionY = 0;
257cdf0e10cSrcweir 				fOriginX = -0.50;
258cdf0e10cSrcweir 				fOriginY = 0;
259cdf0e10cSrcweir 				break;
260cdf0e10cSrcweir 			case -90:
261cdf0e10cSrcweir 				aViewPoint.PositionX = 0;
262cdf0e10cSrcweir 				fOriginX = 0;
263cdf0e10cSrcweir 				break;
264cdf0e10cSrcweir 			case -45:
265cdf0e10cSrcweir 				aViewPoint.PositionX = -3472;
266cdf0e10cSrcweir 				fOriginX = -0.50;
267cdf0e10cSrcweir 				break;
268cdf0e10cSrcweir 			}
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 			aPropValue.Name = sViewPoint;
273cdf0e10cSrcweir 			aPropValue.Value <<= aViewPoint;
274cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aOriginPropPair;
278cdf0e10cSrcweir 			aOriginPropPair.First.Value <<= fOriginX;
279cdf0e10cSrcweir 			aOriginPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
280cdf0e10cSrcweir 			aOriginPropPair.Second.Value <<= fOriginY;
281cdf0e10cSrcweir 			aOriginPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
282cdf0e10cSrcweir 			aPropValue.Name = sOrigin;
283cdf0e10cSrcweir 			aPropValue.Value <<= aOriginPropPair;
284cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aSkewPropPair;
287cdf0e10cSrcweir 			aSkewPropPair.First.Value <<= fSkew;
288cdf0e10cSrcweir 			aSkewPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
289cdf0e10cSrcweir 			aSkewPropPair.Second.Value <<= fSkewAngle;
290cdf0e10cSrcweir 			aSkewPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
291cdf0e10cSrcweir 			aPropValue.Name = sSkew;
292cdf0e10cSrcweir 			aPropValue.Value <<= aSkewPropPair;
293cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion, aPropValue );
294cdf0e10cSrcweir 		}
295cdf0e10cSrcweir 	}
296cdf0e10cSrcweir 	break;
297cdf0e10cSrcweir 	case SID_EXTRUSION_PROJECTION:
298cdf0e10cSrcweir 	{
299cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_PROJECTION ) == SFX_ITEM_SET )
300cdf0e10cSrcweir 		{
301cdf0e10cSrcweir 			sal_Int32 nProjection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue();
302cdf0e10cSrcweir 			ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE;
303cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
304cdf0e10cSrcweir 			aPropValue.Name = sProjectionMode;
305cdf0e10cSrcweir 			aPropValue.Value <<= eProjectionMode;
306cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
307cdf0e10cSrcweir 		}
308cdf0e10cSrcweir 	}
309cdf0e10cSrcweir 	break;
310cdf0e10cSrcweir 	case SID_EXTRUSION_DEPTH:
311cdf0e10cSrcweir 	{
312cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SFX_ITEM_SET)
313cdf0e10cSrcweir 		{
314cdf0e10cSrcweir 			double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
315cdf0e10cSrcweir 			double fFraction = 0.0;
316cdf0e10cSrcweir 			EnhancedCustomShapeParameterPair aDepthPropPair;
317cdf0e10cSrcweir 			aDepthPropPair.First.Value <<= fDepth;
318cdf0e10cSrcweir 			aDepthPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL;
319cdf0e10cSrcweir 			aDepthPropPair.Second.Value <<= fFraction;
320cdf0e10cSrcweir 			aDepthPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL;
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
323cdf0e10cSrcweir 			aPropValue.Name = sDepth;
324cdf0e10cSrcweir 			aPropValue.Value <<= aDepthPropPair;
325cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
326cdf0e10cSrcweir 		}
327cdf0e10cSrcweir 	}
328cdf0e10cSrcweir 	break;
329cdf0e10cSrcweir 	case SID_EXTRUSION_3D_COLOR:
330cdf0e10cSrcweir 	{
331cdf0e10cSrcweir 		static const rtl::OUString  sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) );
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_3D_COLOR ) == SFX_ITEM_SET)
334cdf0e10cSrcweir 		{
335cdf0e10cSrcweir 			Color aColor( ((const SvxColorItem&)rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() );
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 			const bool bAuto = aColor == COL_AUTO;
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
340cdf0e10cSrcweir 			aPropValue.Name = sExtrusionColor;
341cdf0e10cSrcweir 			aPropValue.Value <<= bAuto ? sal_False : sal_True;
342cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 			if( bAuto )
345cdf0e10cSrcweir 			{
346cdf0e10cSrcweir 				pObj->ClearMergedItem( XATTR_SECONDARYFILLCOLOR );
347cdf0e10cSrcweir 			}
348cdf0e10cSrcweir 			else
349cdf0e10cSrcweir 			{
350cdf0e10cSrcweir 				pObj->SetMergedItem( XSecondaryFillColorItem( String(), aColor ) );
351cdf0e10cSrcweir 			}
352cdf0e10cSrcweir 			pObj->BroadcastObjectChange();
353cdf0e10cSrcweir 		}
354cdf0e10cSrcweir 	}
355cdf0e10cSrcweir 	break;
356cdf0e10cSrcweir 	case SID_EXTRUSION_SURFACE:
357cdf0e10cSrcweir 	{
358cdf0e10cSrcweir 		static const rtl::OUString sShadeMode( RTL_CONSTASCII_USTRINGPARAM ( "ShadeMode" ) );
359cdf0e10cSrcweir 		static const rtl::OUString sSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) );
360cdf0e10cSrcweir 		static const rtl::OUString sDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) );
361cdf0e10cSrcweir 		static const rtl::OUString sMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) );
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_SURFACE ) == SFX_ITEM_SET)
364cdf0e10cSrcweir 		{
365cdf0e10cSrcweir 			sal_Int32 nSurface = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue();
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 			ShadeMode eShadeMode( ShadeMode_FLAT );
368cdf0e10cSrcweir 			sal_Bool bMetal = sal_False;
369cdf0e10cSrcweir 			double fSpecularity = 0;
370cdf0e10cSrcweir 			double fDiffusion = 0;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 			switch( nSurface )
373cdf0e10cSrcweir 			{
374cdf0e10cSrcweir 			case 0:	// wireframe
375cdf0e10cSrcweir 				eShadeMode = ShadeMode_DRAFT;
376cdf0e10cSrcweir 				break;
377cdf0e10cSrcweir 			case 1: // matte
378cdf0e10cSrcweir 				break;
379cdf0e10cSrcweir 			case 2: // plastic
380cdf0e10cSrcweir 				fSpecularity = 122.0;
381cdf0e10cSrcweir 				break;
382cdf0e10cSrcweir 			case 3: // metal
383cdf0e10cSrcweir 				bMetal = true;
384cdf0e10cSrcweir 				fSpecularity = 122.0;
385cdf0e10cSrcweir 				fDiffusion = 122.0;
386cdf0e10cSrcweir 				break;
387cdf0e10cSrcweir 			}
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
390cdf0e10cSrcweir 			aPropValue.Name = sShadeMode;
391cdf0e10cSrcweir 			aPropValue.Value <<= eShadeMode;
392cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	aPropValue );
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 			aPropValue.Name = sMetal;
395cdf0e10cSrcweir 			aPropValue.Value <<= bMetal;
396cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 			aPropValue.Name = sSpecularity;
399cdf0e10cSrcweir 			aPropValue.Value <<= fSpecularity;
400cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 			aPropValue.Name = sDiffusion;
403cdf0e10cSrcweir 			aPropValue.Value <<= fDiffusion;
404cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
405cdf0e10cSrcweir 		}
406cdf0e10cSrcweir 	}
407cdf0e10cSrcweir 	break;
408cdf0e10cSrcweir 	case SID_EXTRUSION_LIGHTING_INTENSITY:
409cdf0e10cSrcweir 	{
410cdf0e10cSrcweir 		static const rtl::OUString sBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) );
411cdf0e10cSrcweir 		static const rtl::OUString sLightFace( RTL_CONSTASCII_USTRINGPARAM ( "LightFace" ) );
412cdf0e10cSrcweir 		static const rtl::OUString sFirstLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightHarsh" ) );
413cdf0e10cSrcweir 		static const rtl::OUString sSecondLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightHarsh" ) );
414cdf0e10cSrcweir 		static const rtl::OUString sFirstLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightLevel" ) );
415cdf0e10cSrcweir 		static const rtl::OUString sSecondLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightLevel" ) );
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_INTENSITY ) == SFX_ITEM_SET)
418cdf0e10cSrcweir 		{
419cdf0e10cSrcweir 			sal_Int32 nLevel = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue();
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 			double fBrightness;
422cdf0e10cSrcweir 			sal_Bool bHarsh2;
423cdf0e10cSrcweir 			double fLevel1;
424cdf0e10cSrcweir 			double fLevel2;
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 			switch( nLevel )
427cdf0e10cSrcweir 			{
428cdf0e10cSrcweir 			case 0: // bright
429cdf0e10cSrcweir 				fBrightness = 34.0;
430cdf0e10cSrcweir 				bHarsh2 = sal_False;
431cdf0e10cSrcweir 				fLevel1 = 66.0;
432cdf0e10cSrcweir 				fLevel2 = 66.0;
433cdf0e10cSrcweir 				break;
434cdf0e10cSrcweir 			case 1: // normal
435cdf0e10cSrcweir 				fBrightness = 15.0;
436cdf0e10cSrcweir 				bHarsh2 = sal_False;
437cdf0e10cSrcweir 				fLevel1 = 67.0;
438cdf0e10cSrcweir 				fLevel2 = 37.0;
439cdf0e10cSrcweir 				break;
440cdf0e10cSrcweir 			case 2: // dim
441cdf0e10cSrcweir 				fBrightness = 6.0;
442cdf0e10cSrcweir 				bHarsh2 = sal_True;
443cdf0e10cSrcweir 				fLevel1 = 79.0;
444cdf0e10cSrcweir 				fLevel2 = 21.0;
445cdf0e10cSrcweir 				break;
446cdf0e10cSrcweir 			}
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 			com::sun::star::beans::PropertyValue aPropValue;
449cdf0e10cSrcweir 			aPropValue.Name = sBrightness;
450cdf0e10cSrcweir 			aPropValue.Value <<= fBrightness;
451cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
452cdf0e10cSrcweir 
453cdf0e10cSrcweir 			aPropValue.Name = sLightFace;
454cdf0e10cSrcweir 			aPropValue.Value <<= sal_True;
455cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 			aPropValue.Name = sFirstLightHarsh;
458cdf0e10cSrcweir 			aPropValue.Value <<= sal_True;
459cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 			aPropValue.Name = sSecondLightHarsh;
462cdf0e10cSrcweir 			aPropValue.Value <<= bHarsh2;
463cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 			aPropValue.Name = sFirstLightLevel;
466cdf0e10cSrcweir 			aPropValue.Value <<= fLevel1;
467cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 			aPropValue.Name = sSecondLightLevel;
470cdf0e10cSrcweir 			aPropValue.Value <<= fLevel2;
471cdf0e10cSrcweir 			rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
472cdf0e10cSrcweir 		}
473cdf0e10cSrcweir 	}
474cdf0e10cSrcweir 	break;
475cdf0e10cSrcweir 	case SID_EXTRUSION_LIGHTING_DIRECTION:
476cdf0e10cSrcweir 	{
477cdf0e10cSrcweir 		if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_DIRECTION ) == SFX_ITEM_SET)
478cdf0e10cSrcweir 		{
479cdf0e10cSrcweir 			sal_Int32 nDirection = ((const SfxInt32Item*)rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_DIRECTION))->GetValue();
480cdf0e10cSrcweir 
481cdf0e10cSrcweir 			if((nDirection >= 0) && (nDirection < 9))
482cdf0e10cSrcweir 			{
483cdf0e10cSrcweir 				const rtl::OUString	sFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) );
484cdf0e10cSrcweir 				const rtl::OUString	sSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) );
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 				const Direction3D * pLighting1Defaults;
487cdf0e10cSrcweir 				const Direction3D * pLighting2Defaults;
488cdf0e10cSrcweir 
489cdf0e10cSrcweir 				getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 				com::sun::star::beans::PropertyValue aPropValue;
492cdf0e10cSrcweir 				aPropValue.Name = sFirstLightDirection;
493cdf0e10cSrcweir 				aPropValue.Value <<= pLighting1Defaults[nDirection];
494cdf0e10cSrcweir 				rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 				aPropValue.Name = sSecondLightDirection;
497cdf0e10cSrcweir 				aPropValue.Value <<= pLighting2Defaults[nDirection];
498cdf0e10cSrcweir 				rGeometryItem.SetPropertyValue( sExtrusion,	 aPropValue );
499cdf0e10cSrcweir 			}
500cdf0e10cSrcweir 		}
501cdf0e10cSrcweir 	}
502cdf0e10cSrcweir 	break;
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 	}
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
execute(SdrView * pSdrView,SfxRequest & rReq,SfxBindings & rBindings)507cdf0e10cSrcweir void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest& rReq, SfxBindings& rBindings )
508cdf0e10cSrcweir {
509cdf0e10cSrcweir 	sal_uInt16 nSID = rReq.GetSlot();
510cdf0e10cSrcweir 	sal_uInt16 nStrResId = 0;
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 	const bool bUndo = pSdrView && pSdrView->IsUndoEnabled();
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 	switch( nSID )
515cdf0e10cSrcweir 	{
516cdf0e10cSrcweir 		case SID_EXTRUSION_TOOGLE:
517cdf0e10cSrcweir 		{
518cdf0e10cSrcweir 			if ( !nStrResId )
519cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF;
520cdf0e10cSrcweir 		}	// PASSTROUGH
521cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_DOWN:
522cdf0e10cSrcweir 		{
523cdf0e10cSrcweir 			if ( !nStrResId )
524cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_DOWN;
525cdf0e10cSrcweir 		}	// PASSTROUGH
526cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_UP:
527cdf0e10cSrcweir 		{
528cdf0e10cSrcweir 			if ( !nStrResId )
529cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_UP;
530cdf0e10cSrcweir 		}	// PASSTROUGH
531cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_LEFT:
532cdf0e10cSrcweir 		{
533cdf0e10cSrcweir 			if ( !nStrResId )
534cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_LEFT;
535cdf0e10cSrcweir 		}	// PASSTROUGH
536cdf0e10cSrcweir 		case SID_EXTRUSION_TILT_RIGHT:
537cdf0e10cSrcweir 		{
538cdf0e10cSrcweir 			if ( !nStrResId )
539cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ROTATE_RIGHT;
540cdf0e10cSrcweir 		}	// PASSTROUGH
541cdf0e10cSrcweir 		case SID_EXTRUSION_DIRECTION:
542cdf0e10cSrcweir 		{
543cdf0e10cSrcweir 			if ( !nStrResId )
544cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_ORIENTATION;
545cdf0e10cSrcweir 		}	// PASSTROUGH
546cdf0e10cSrcweir 		case SID_EXTRUSION_PROJECTION:
547cdf0e10cSrcweir 		{
548cdf0e10cSrcweir 			if ( !nStrResId )
549cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_PROJECTION;
550cdf0e10cSrcweir 		}	// PASSTROUGH
551cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH:
552cdf0e10cSrcweir 		{
553cdf0e10cSrcweir 			if ( !nStrResId )
554cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_DEPTH;
555cdf0e10cSrcweir 		}	// PASSTROUGH
556cdf0e10cSrcweir 		case SID_EXTRUSION_3D_COLOR:
557cdf0e10cSrcweir 		{
558cdf0e10cSrcweir 			if ( !nStrResId )
559cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_COLOR;
560cdf0e10cSrcweir 		}	// PASSTROUGH
561cdf0e10cSrcweir 		case SID_EXTRUSION_SURFACE:
562cdf0e10cSrcweir 		{
563cdf0e10cSrcweir 			if ( !nStrResId )
564cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_SURFACE;
565cdf0e10cSrcweir 		}	// PASSTROUGH
566cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_INTENSITY:
567cdf0e10cSrcweir 		{
568cdf0e10cSrcweir 			if ( !nStrResId )
569cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_BRIGHTNESS;
570cdf0e10cSrcweir 		}	// PASSTROUGH
571cdf0e10cSrcweir 		case SID_EXTRUSION_LIGHTING_DIRECTION:
572cdf0e10cSrcweir 		{
573cdf0e10cSrcweir 			if ( !nStrResId )
574cdf0e10cSrcweir 				nStrResId = RID_SVXSTR_UNDO_APPLY_EXTRUSION_LIGHTING;
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 			const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
577cdf0e10cSrcweir 			sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 			for(i=0; i<nCount; i++)
580cdf0e10cSrcweir 			{
581cdf0e10cSrcweir 				SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
582cdf0e10cSrcweir 				if( pObj->ISA(SdrObjCustomShape) )
583cdf0e10cSrcweir 				{
584cdf0e10cSrcweir 					if( bUndo )
585cdf0e10cSrcweir 					{
586cdf0e10cSrcweir 						String aStr( SVX_RES( nStrResId ) );
587cdf0e10cSrcweir 						pSdrView->BegUndo( aStr );
588cdf0e10cSrcweir 						pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) );
589cdf0e10cSrcweir 					}
590cdf0e10cSrcweir 					SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
591cdf0e10cSrcweir 					impl_execute( pSdrView, rReq, aGeometryItem, pObj );
592cdf0e10cSrcweir 					pObj->SetMergedItem( aGeometryItem );
593cdf0e10cSrcweir 					pObj->BroadcastObjectChange();
594cdf0e10cSrcweir 					if( bUndo )
595cdf0e10cSrcweir 						pSdrView->EndUndo();
596cdf0e10cSrcweir 
597cdf0e10cSrcweir                     // simulate a context change:
598cdf0e10cSrcweir                     // force SelectionHasChanged() being called
599cdf0e10cSrcweir                     // so that extrusion bar will be visible/hidden
600cdf0e10cSrcweir                     pSdrView->MarkListHasChanged();
601cdf0e10cSrcweir 				}
602cdf0e10cSrcweir 			}
603cdf0e10cSrcweir 		}
604cdf0e10cSrcweir 		break;
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 		case SID_EXTRUSION_DEPTH_DIALOG:
607cdf0e10cSrcweir 			if( rReq.GetArgs() &&
608cdf0e10cSrcweir 				(rReq.GetArgs()->GetItemState( SID_EXTRUSION_DEPTH ) == SFX_ITEM_SET) &&
609cdf0e10cSrcweir 				(rReq.GetArgs()->GetItemState( SID_ATTR_METRIC ) == SFX_ITEM_SET))
610cdf0e10cSrcweir 			{
611cdf0e10cSrcweir 				double fDepth = ((const SvxDoubleItem*)rReq.GetArgs()->GetItem(SID_EXTRUSION_DEPTH))->GetValue();
612cdf0e10cSrcweir 				FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)rReq.GetArgs()->GetItem(SID_ATTR_METRIC))->GetValue();
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 				ExtrusionDepthDialog aDlg( 0L, fDepth, eUnit );
615cdf0e10cSrcweir 				sal_uInt16 nRet = aDlg.Execute();
616cdf0e10cSrcweir 				if( nRet != 0 )
617cdf0e10cSrcweir 				{
618cdf0e10cSrcweir 					fDepth = aDlg.getDepth();
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 					SvxDoubleItem aItem( fDepth, SID_EXTRUSION_DEPTH );
621cdf0e10cSrcweir 					SfxPoolItem* aItems[] = { &aItem, 0 };
622cdf0e10cSrcweir 					rBindings.Execute( SID_EXTRUSION_DEPTH, (const SfxPoolItem**)aItems );
623cdf0e10cSrcweir 				}
624cdf0e10cSrcweir 			}
625cdf0e10cSrcweir 			break;
626cdf0e10cSrcweir 	}
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 	if( nSID == SID_EXTRUSION_TOOGLE )
629cdf0e10cSrcweir 	{
630cdf0e10cSrcweir 			static sal_uInt16 SidArray[] = {
631cdf0e10cSrcweir 				SID_EXTRUSION_TILT_DOWN,
632cdf0e10cSrcweir 				SID_EXTRUSION_TILT_UP,
633cdf0e10cSrcweir 				SID_EXTRUSION_TILT_LEFT,
634cdf0e10cSrcweir 				SID_EXTRUSION_TILT_RIGHT,
635cdf0e10cSrcweir 				SID_EXTRUSION_DEPTH_FLOATER,
636cdf0e10cSrcweir 				SID_EXTRUSION_DIRECTION_FLOATER,
637cdf0e10cSrcweir 				SID_EXTRUSION_LIGHTING_FLOATER,
638cdf0e10cSrcweir 				SID_EXTRUSION_SURFACE_FLOATER,
639cdf0e10cSrcweir 				SID_EXTRUSION_3D_COLOR,
640cdf0e10cSrcweir 				SID_EXTRUSION_DEPTH,
641cdf0e10cSrcweir 				SID_EXTRUSION_DIRECTION,
642cdf0e10cSrcweir 				SID_EXTRUSION_PROJECTION,
643cdf0e10cSrcweir 				SID_EXTRUSION_LIGHTING_DIRECTION,
644cdf0e10cSrcweir 				SID_EXTRUSION_LIGHTING_INTENSITY,
645cdf0e10cSrcweir 				SID_EXTRUSION_SURFACE,
646cdf0e10cSrcweir 				0 };
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 		rBindings.Invalidate( SidArray );
649cdf0e10cSrcweir 	}
650cdf0e10cSrcweir }
651cdf0e10cSrcweir 
getExtrusionDirectionState(SdrView * pSdrView,SfxItemSet & rSet)652cdf0e10cSrcweir void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
653cdf0e10cSrcweir {
654cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
655cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
658cdf0e10cSrcweir 	static const rtl::OUString	sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) );
659cdf0e10cSrcweir 	static const rtl::OUString	sOrigin( RTL_CONSTASCII_USTRINGPARAM ( "Origin" ) );
660cdf0e10cSrcweir 	static const rtl::OUString	sSkew( RTL_CONSTASCII_USTRINGPARAM ( "Skew" ) );
661cdf0e10cSrcweir 	static const rtl::OUString	sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
662cdf0e10cSrcweir 
663cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 	double fFinalSkewAngle = -1;
666cdf0e10cSrcweir 	bool bHasCustomShape = false;
667cdf0e10cSrcweir 
668cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
669cdf0e10cSrcweir 	{
670cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
671cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
672cdf0e10cSrcweir 		{
673cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 			// see if this is an extruded customshape
676cdf0e10cSrcweir 			if( !bHasCustomShape )
677cdf0e10cSrcweir 			{
678cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
679cdf0e10cSrcweir 				if( pAny_ )
680cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 				if( !bHasCustomShape )
683cdf0e10cSrcweir 					continue;
684cdf0e10cSrcweir 			}
685cdf0e10cSrcweir 
686cdf0e10cSrcweir 			sal_Bool	bParallel = sal_True;
687cdf0e10cSrcweir 			Position3D	aViewPoint( 3472, -3472, 25000 );
688cdf0e10cSrcweir 			double		fOriginX = 0.50;
689cdf0e10cSrcweir 			double		fOriginY = -0.50;
690cdf0e10cSrcweir 			double		fSkewAngle = -135;
691cdf0e10cSrcweir 			double		fSkew = 50.0;
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
694cdf0e10cSrcweir 			sal_Int16 nProjectionMode = sal_Int16();
695cdf0e10cSrcweir 			if( pAny && ( *pAny >>= nProjectionMode ) )
696cdf0e10cSrcweir 				bParallel = nProjectionMode == ProjectionMode_PARALLEL;
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 			if( bParallel )
699cdf0e10cSrcweir 			{
700cdf0e10cSrcweir 				EnhancedCustomShapeParameterPair aSkewPropPair;
701cdf0e10cSrcweir 				pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSkew );
702cdf0e10cSrcweir 				if( pAny && ( *pAny >>= aSkewPropPair ) )
703cdf0e10cSrcweir 				{
704cdf0e10cSrcweir 					aSkewPropPair.First.Value >>= fSkew;
705cdf0e10cSrcweir 					aSkewPropPair.Second.Value >>= fSkewAngle;
706cdf0e10cSrcweir 				}
707cdf0e10cSrcweir 				if ( fSkew == 0.0 )
708cdf0e10cSrcweir 					fSkewAngle = 0.0;
709cdf0e10cSrcweir 				else if ( fSkewAngle == 0.0 )
710cdf0e10cSrcweir 					fSkewAngle = -360.0;
711cdf0e10cSrcweir 			}
712cdf0e10cSrcweir 			else
713cdf0e10cSrcweir 			{
714cdf0e10cSrcweir 				pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sViewPoint );
715cdf0e10cSrcweir 				if( pAny )
716cdf0e10cSrcweir 					*pAny >>= aViewPoint;
717cdf0e10cSrcweir 
718cdf0e10cSrcweir 				EnhancedCustomShapeParameterPair aOriginPropPair;
719cdf0e10cSrcweir 				pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sOrigin );
720cdf0e10cSrcweir 				if( pAny && ( *pAny >>= aOriginPropPair ) )
721cdf0e10cSrcweir 				{
722cdf0e10cSrcweir 					aOriginPropPair.First.Value >>= fOriginX;
723cdf0e10cSrcweir 					aOriginPropPair.Second.Value >>= fOriginY;
724cdf0e10cSrcweir 				}
725cdf0e10cSrcweir 				fSkewAngle = -1;
726cdf0e10cSrcweir 				const double e = 0.0001;
727cdf0e10cSrcweir 				if( aViewPoint.PositionX > e )
728cdf0e10cSrcweir 				{
729cdf0e10cSrcweir 					if( aViewPoint.PositionY > e )
730cdf0e10cSrcweir 					{
731cdf0e10cSrcweir 						if( (fOriginX > e ) && ( fOriginY > e ) )
732cdf0e10cSrcweir 							fSkewAngle = 135.0;
733cdf0e10cSrcweir 					}
734cdf0e10cSrcweir 					else if( aViewPoint.PositionY < -e )
735cdf0e10cSrcweir 					{
736cdf0e10cSrcweir 						if( ( fOriginX > e ) && ( fOriginY < -e ) )
737cdf0e10cSrcweir 							fSkewAngle = -135.0;
738cdf0e10cSrcweir 					}
739cdf0e10cSrcweir 					else
740cdf0e10cSrcweir 					{
741cdf0e10cSrcweir 						if( ( fOriginX > e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
742cdf0e10cSrcweir 							fSkewAngle = 180.0;
743cdf0e10cSrcweir 					}
744cdf0e10cSrcweir 				}
745cdf0e10cSrcweir 				else if( aViewPoint.PositionX < -e )
746cdf0e10cSrcweir 				{
747cdf0e10cSrcweir 					if( aViewPoint.PositionY < -e )
748cdf0e10cSrcweir 					{
749cdf0e10cSrcweir 						if( ( fOriginX < -e ) && ( fOriginY < -e ) )
750cdf0e10cSrcweir 							fSkewAngle = -45.0;
751cdf0e10cSrcweir 					}
752cdf0e10cSrcweir 					else if( aViewPoint.PositionY > e )
753cdf0e10cSrcweir 					{
754cdf0e10cSrcweir 						if( ( fOriginX < -e ) && ( fOriginY > e ) )
755cdf0e10cSrcweir 							fSkewAngle = 45.0;
756cdf0e10cSrcweir 					}
757cdf0e10cSrcweir 					else
758cdf0e10cSrcweir 					{
759cdf0e10cSrcweir 						if( ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
760cdf0e10cSrcweir 							fSkewAngle = -360.0;
761cdf0e10cSrcweir 					}
762cdf0e10cSrcweir 				}
763cdf0e10cSrcweir 				else
764cdf0e10cSrcweir 				{
765cdf0e10cSrcweir 					if( aViewPoint.PositionY < -e )
766cdf0e10cSrcweir 					{
767cdf0e10cSrcweir 						if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY < -e ) )
768cdf0e10cSrcweir 							fSkewAngle = -90.0;
769cdf0e10cSrcweir 					}
770cdf0e10cSrcweir 					else if( aViewPoint.PositionY > e )
771cdf0e10cSrcweir 					{
772cdf0e10cSrcweir 						if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > e ) )
773cdf0e10cSrcweir 							fSkewAngle = 90.0;
774cdf0e10cSrcweir 					}
775cdf0e10cSrcweir 					else
776cdf0e10cSrcweir 					{
777cdf0e10cSrcweir 						if( ( fOriginX > -e ) && ( fOriginX < e ) && ( fOriginY > -e ) && ( fOriginY < e ) )
778cdf0e10cSrcweir 							fSkewAngle = 0.0;
779cdf0e10cSrcweir 					}
780cdf0e10cSrcweir 				}
781cdf0e10cSrcweir 			}
782cdf0e10cSrcweir 
783cdf0e10cSrcweir 			if( fFinalSkewAngle == -1.0 )
784cdf0e10cSrcweir 			{
785cdf0e10cSrcweir 				fFinalSkewAngle = fSkewAngle;
786cdf0e10cSrcweir 			}
787cdf0e10cSrcweir 			else if( fSkewAngle != fFinalSkewAngle )
788cdf0e10cSrcweir 			{
789cdf0e10cSrcweir 				fFinalSkewAngle = -1.0;
790cdf0e10cSrcweir 			}
791cdf0e10cSrcweir 
792cdf0e10cSrcweir 			if( fFinalSkewAngle == -1.0 )
793cdf0e10cSrcweir 				break;
794cdf0e10cSrcweir 		}
795cdf0e10cSrcweir 	}
796cdf0e10cSrcweir 
797cdf0e10cSrcweir 	if( bHasCustomShape )
798cdf0e10cSrcweir 		rSet.Put( SfxInt32Item( SID_EXTRUSION_DIRECTION, (sal_Int32)fFinalSkewAngle ) );
799cdf0e10cSrcweir 	else
800cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_DIRECTION );
801cdf0e10cSrcweir }
802cdf0e10cSrcweir 
getExtrusionProjectionState(SdrView * pSdrView,SfxItemSet & rSet)803cdf0e10cSrcweir void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet )
804cdf0e10cSrcweir {
805cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
806cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
807cdf0e10cSrcweir 
808cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
809cdf0e10cSrcweir 	static const rtl::OUString	sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) );
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
812cdf0e10cSrcweir 
813cdf0e10cSrcweir 	sal_Int32 nFinalProjection = -1;
814cdf0e10cSrcweir 	bool bHasCustomShape = false;
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
817cdf0e10cSrcweir 	{
818cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
819cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
820cdf0e10cSrcweir 		{
821cdf0e10cSrcweir 			// see if this is an extruded customshape
822cdf0e10cSrcweir 			if( !bHasCustomShape )
823cdf0e10cSrcweir 			{
824cdf0e10cSrcweir 				SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
825cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
826cdf0e10cSrcweir 				if( pAny_ )
827cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
828cdf0e10cSrcweir 
829cdf0e10cSrcweir 				if( !bHasCustomShape )
830cdf0e10cSrcweir 					continue;
831cdf0e10cSrcweir 			}
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
834cdf0e10cSrcweir 
835cdf0e10cSrcweir 			sal_Bool	bParallel = sal_True;
836cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode );
837cdf0e10cSrcweir 			ProjectionMode eProjectionMode;
838cdf0e10cSrcweir 			if( pAny && ( *pAny >>= eProjectionMode ) )
839cdf0e10cSrcweir 				bParallel = eProjectionMode == ProjectionMode_PARALLEL;
840cdf0e10cSrcweir 
841cdf0e10cSrcweir 			if( nFinalProjection == -1 )
842cdf0e10cSrcweir 			{
843cdf0e10cSrcweir 				nFinalProjection = bParallel;
844cdf0e10cSrcweir 			}
845cdf0e10cSrcweir 			else if( nFinalProjection != bParallel )
846cdf0e10cSrcweir 			{
847cdf0e10cSrcweir 				nFinalProjection = -1;
848cdf0e10cSrcweir 				break;
849cdf0e10cSrcweir 			}
850cdf0e10cSrcweir 		}
851cdf0e10cSrcweir 	}
852cdf0e10cSrcweir 
853cdf0e10cSrcweir 	if( bHasCustomShape )
854cdf0e10cSrcweir 		rSet.Put( SfxInt32Item( SID_EXTRUSION_PROJECTION, nFinalProjection ) );
855cdf0e10cSrcweir 	else
856cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_PROJECTION );
857cdf0e10cSrcweir }
858cdf0e10cSrcweir 
getExtrusionSurfaceState(SdrView * pSdrView,SfxItemSet & rSet)859cdf0e10cSrcweir void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet )
860cdf0e10cSrcweir {
861cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
862cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
863cdf0e10cSrcweir 
864cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
865cdf0e10cSrcweir 	static const rtl::OUString	sShadeMode( RTL_CONSTASCII_USTRINGPARAM ( "ShadeMode" ) );
866cdf0e10cSrcweir 	static const rtl::OUString	sSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) );
867cdf0e10cSrcweir 	static const rtl::OUString	sDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) );
868cdf0e10cSrcweir 	static const rtl::OUString	sMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) );
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
871cdf0e10cSrcweir 
872cdf0e10cSrcweir 	sal_Int32 nFinalSurface = -1;
873cdf0e10cSrcweir 	bool bHasCustomShape = false;
874cdf0e10cSrcweir 
875cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
876cdf0e10cSrcweir 	{
877cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
878cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
879cdf0e10cSrcweir 		{
880cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
881cdf0e10cSrcweir 
882cdf0e10cSrcweir 			// see if this is an extruded customshape
883cdf0e10cSrcweir 			if( !bHasCustomShape )
884cdf0e10cSrcweir 			{
885cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
886cdf0e10cSrcweir 				if( pAny_ )
887cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
888cdf0e10cSrcweir 
889cdf0e10cSrcweir 				if( !bHasCustomShape )
890cdf0e10cSrcweir 					continue;
891cdf0e10cSrcweir 			}
892cdf0e10cSrcweir 
893cdf0e10cSrcweir 			sal_Int32 nSurface = 0; // wire frame
894cdf0e10cSrcweir 
895cdf0e10cSrcweir 			ShadeMode eShadeMode( ShadeMode_FLAT );
896cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sShadeMode );
897cdf0e10cSrcweir 			if( pAny )
898cdf0e10cSrcweir 				*pAny >>= eShadeMode;
899cdf0e10cSrcweir 
900cdf0e10cSrcweir 			if( eShadeMode == ShadeMode_FLAT )
901cdf0e10cSrcweir 			{
902cdf0e10cSrcweir 				sal_Bool bMetal = sal_False;
903cdf0e10cSrcweir 				pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sMetal );
904cdf0e10cSrcweir 				if( pAny )
905cdf0e10cSrcweir 					*pAny >>= bMetal;
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 				if( bMetal )
908cdf0e10cSrcweir 				{
909cdf0e10cSrcweir 					nSurface = 3; // metal
910cdf0e10cSrcweir 				}
911cdf0e10cSrcweir 				else
912cdf0e10cSrcweir 				{
913cdf0e10cSrcweir 					double fSpecularity = 0;
914cdf0e10cSrcweir 					pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSpecularity );
915cdf0e10cSrcweir 					if( pAny )
916cdf0e10cSrcweir 						*pAny >>= fSpecularity;
917cdf0e10cSrcweir 
918cdf0e10cSrcweir 					const double e = 0.0001;
919cdf0e10cSrcweir 					if( (fSpecularity > -e) && (fSpecularity < e) )
920cdf0e10cSrcweir 					{
921cdf0e10cSrcweir 						nSurface = 1; // matte
922cdf0e10cSrcweir 					}
923cdf0e10cSrcweir 					else
924cdf0e10cSrcweir 					{
925cdf0e10cSrcweir 						nSurface = 2; // plastic
926cdf0e10cSrcweir 					}
927cdf0e10cSrcweir 				}
928cdf0e10cSrcweir 			}
929cdf0e10cSrcweir 
930cdf0e10cSrcweir 			if( nFinalSurface == -1 )
931cdf0e10cSrcweir 			{
932cdf0e10cSrcweir 				nFinalSurface = nSurface;
933cdf0e10cSrcweir 			}
934cdf0e10cSrcweir 			else if( nFinalSurface != nSurface )
935cdf0e10cSrcweir 			{
936cdf0e10cSrcweir 				nFinalSurface = -1;
937cdf0e10cSrcweir 				break;
938cdf0e10cSrcweir 			}
939cdf0e10cSrcweir 		}
940cdf0e10cSrcweir 	}
941cdf0e10cSrcweir 
942cdf0e10cSrcweir 	if( bHasCustomShape )
943cdf0e10cSrcweir 		rSet.Put( SfxInt32Item( SID_EXTRUSION_SURFACE, nFinalSurface ) );
944cdf0e10cSrcweir 	else
945cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_SURFACE );
946cdf0e10cSrcweir }
947cdf0e10cSrcweir 
getExtrusionDepthState(SdrView * pSdrView,SfxItemSet & rSet)948cdf0e10cSrcweir void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet )
949cdf0e10cSrcweir {
950cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
951cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
952cdf0e10cSrcweir 
953cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
954cdf0e10cSrcweir 	static const rtl::OUString	sDepth( RTL_CONSTASCII_USTRINGPARAM ( "Depth" ) );
955cdf0e10cSrcweir 
956cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
957cdf0e10cSrcweir 
958cdf0e10cSrcweir 	double fFinalDepth = -1;
959cdf0e10cSrcweir 	bool bHasCustomShape = false;
960cdf0e10cSrcweir 
961cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
962cdf0e10cSrcweir 	{
963cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
964cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
965cdf0e10cSrcweir 		{
966cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
967cdf0e10cSrcweir 
968cdf0e10cSrcweir 			// see if this is an extruded customshape
969cdf0e10cSrcweir 			if( !bHasCustomShape )
970cdf0e10cSrcweir 			{
971cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
972cdf0e10cSrcweir 				if( pAny_ )
973cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
974cdf0e10cSrcweir 
975cdf0e10cSrcweir 				if( !bHasCustomShape )
976cdf0e10cSrcweir 					continue;
977cdf0e10cSrcweir 			}
978cdf0e10cSrcweir 
979cdf0e10cSrcweir 			double fDepth = 1270.0;
980cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sDepth );
981cdf0e10cSrcweir 			if( pAny )
982cdf0e10cSrcweir 			{
983cdf0e10cSrcweir 				EnhancedCustomShapeParameterPair aDepthPropPair;
984cdf0e10cSrcweir 				if ( *pAny >>= aDepthPropPair )
985cdf0e10cSrcweir 					aDepthPropPair.First.Value >>= fDepth;
986cdf0e10cSrcweir 			}
987cdf0e10cSrcweir 
988cdf0e10cSrcweir 			if( fFinalDepth == -1 )
989cdf0e10cSrcweir 			{
990cdf0e10cSrcweir 				fFinalDepth = fDepth;
991cdf0e10cSrcweir 			}
992cdf0e10cSrcweir 			else if( fFinalDepth != fDepth )
993cdf0e10cSrcweir 			{
994cdf0e10cSrcweir 				fFinalDepth = -1;
995cdf0e10cSrcweir 				break;
996cdf0e10cSrcweir 			}
997cdf0e10cSrcweir 		}
998cdf0e10cSrcweir 	}
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir 	if( pSdrView->GetModel() )
1001cdf0e10cSrcweir 	{
1002cdf0e10cSrcweir 		FieldUnit eUnit = pSdrView->GetModel()->GetUIUnit();
1003cdf0e10cSrcweir 		rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)eUnit ) );
1004cdf0e10cSrcweir 	}
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 	if( bHasCustomShape )
1007cdf0e10cSrcweir 		rSet.Put( SvxDoubleItem( fFinalDepth, SID_EXTRUSION_DEPTH ) );
1008cdf0e10cSrcweir 	else
1009cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_DEPTH );
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir 
compare_direction(const Direction3D & d1,const Direction3D & d2)1012cdf0e10cSrcweir static bool compare_direction( const Direction3D& d1, const Direction3D& d2 )
1013cdf0e10cSrcweir {
1014cdf0e10cSrcweir 	if( ((d1.DirectionX < 0) && (d2.DirectionX < 0)) || ((d1.DirectionX == 0) && (d2.DirectionX == 0)) || ((d1.DirectionX > 0) && (d2.DirectionX > 0)) )
1015cdf0e10cSrcweir 	{
1016cdf0e10cSrcweir 		if( ((d1.DirectionY < 0) && (d2.DirectionY < 0)) || ((d1.DirectionY == 0) && (d2.DirectionY == 0)) || ((d1.DirectionY > 0) && (d2.DirectionY > 0)) )
1017cdf0e10cSrcweir 		{
1018cdf0e10cSrcweir 			if( ((d1.DirectionZ < 0) && (d2.DirectionZ < 0)) || ((d1.DirectionZ == 0) && (d2.DirectionZ == 0)) || ((d1.DirectionZ > 0) && (d2.DirectionZ > 0)) )
1019cdf0e10cSrcweir 			{
1020cdf0e10cSrcweir 				return true;
1021cdf0e10cSrcweir 			}
1022cdf0e10cSrcweir 		}
1023cdf0e10cSrcweir 	}
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir 	return false;
1026cdf0e10cSrcweir }
1027cdf0e10cSrcweir 
getExtrusionLightingDirectionState(SdrView * pSdrView,SfxItemSet & rSet)1028cdf0e10cSrcweir void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1031cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
1034cdf0e10cSrcweir 	static const rtl::OUString	sFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) );
1035cdf0e10cSrcweir 	static const rtl::OUString	sSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) );
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir 	const Direction3D * pLighting1Defaults;
1038cdf0e10cSrcweir 	const Direction3D * pLighting2Defaults;
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir 	getLightingDirectionDefaults( &pLighting1Defaults, &pLighting2Defaults );
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir 	int nFinalDirection = -1;
1045cdf0e10cSrcweir 	bool bHasCustomShape = false;
1046cdf0e10cSrcweir 
1047cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
1048cdf0e10cSrcweir 	{
1049cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1050cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
1051cdf0e10cSrcweir 		{
1052cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir 			// see if this is an extruded customshape
1055cdf0e10cSrcweir 			if( !bHasCustomShape )
1056cdf0e10cSrcweir 			{
1057cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1058cdf0e10cSrcweir 				if( pAny_ )
1059cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
1060cdf0e10cSrcweir 
1061cdf0e10cSrcweir 				if( !bHasCustomShape )
1062cdf0e10cSrcweir 					continue;
1063cdf0e10cSrcweir 			}
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir 			Direction3D aFirstLightDirection( 50000, 0, 10000 );
1066cdf0e10cSrcweir 			Direction3D aSecondLightDirection( -50000, 0, 10000 );
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sFirstLightDirection );
1069cdf0e10cSrcweir 			if( pAny )
1070cdf0e10cSrcweir 				*pAny >>= aFirstLightDirection;
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSecondLightDirection );
1073cdf0e10cSrcweir 			if( pAny )
1074cdf0e10cSrcweir 				*pAny >>= aSecondLightDirection;
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir 			int nDirection = -1;
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir 			int j;
1079cdf0e10cSrcweir 			for( j = 0; j < 9; j++ )
1080cdf0e10cSrcweir 			{
1081cdf0e10cSrcweir 				if( compare_direction( aFirstLightDirection, pLighting1Defaults[j] ) &&
1082cdf0e10cSrcweir 					compare_direction( aSecondLightDirection, pLighting2Defaults[j] ))
1083cdf0e10cSrcweir 				{
1084cdf0e10cSrcweir 					nDirection = j;
1085cdf0e10cSrcweir 					break;
1086cdf0e10cSrcweir 				}
1087cdf0e10cSrcweir 			}
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir 			if( nFinalDirection == -1 )
1090cdf0e10cSrcweir 			{
1091cdf0e10cSrcweir 				nFinalDirection = nDirection;
1092cdf0e10cSrcweir 			}
1093cdf0e10cSrcweir 			else if( nDirection != nFinalDirection )
1094cdf0e10cSrcweir 			{
1095cdf0e10cSrcweir 				nFinalDirection = -1;
1096cdf0e10cSrcweir 			}
1097cdf0e10cSrcweir 
1098cdf0e10cSrcweir 			if( nFinalDirection == -1 )
1099cdf0e10cSrcweir 				break;
1100cdf0e10cSrcweir 		}
1101cdf0e10cSrcweir 	}
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir 	if( bHasCustomShape )
1104cdf0e10cSrcweir 		rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, (sal_Int32)nFinalDirection ) );
1105cdf0e10cSrcweir 	else
1106cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_LIGHTING_DIRECTION );
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir 
getExtrusionLightingIntensityState(SdrView * pSdrView,SfxItemSet & rSet)1109cdf0e10cSrcweir void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet )
1110cdf0e10cSrcweir {
1111cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1112cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1113cdf0e10cSrcweir 
1114cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
1115cdf0e10cSrcweir 	static const rtl::OUString	sBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) );
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir 	int nFinalLevel = -1;
1120cdf0e10cSrcweir 	bool bHasCustomShape = false;
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
1123cdf0e10cSrcweir 	{
1124cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1125cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
1126cdf0e10cSrcweir 		{
1127cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1128cdf0e10cSrcweir 
1129cdf0e10cSrcweir 			// see if this is an extruded customshape
1130cdf0e10cSrcweir 			if( !bHasCustomShape )
1131cdf0e10cSrcweir 			{
1132cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1133cdf0e10cSrcweir 				if( pAny_ )
1134cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
1135cdf0e10cSrcweir 
1136cdf0e10cSrcweir 				if( !bHasCustomShape )
1137cdf0e10cSrcweir 					continue;
1138cdf0e10cSrcweir 			}
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir 			double fBrightness = 22178.0 / 655.36;
1141cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sBrightness );
1142cdf0e10cSrcweir 			if( pAny )
1143cdf0e10cSrcweir 				*pAny >>= fBrightness;
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir 			int nLevel;
1146cdf0e10cSrcweir 			if( fBrightness >= 30.0 )
1147cdf0e10cSrcweir 			{
1148cdf0e10cSrcweir 				nLevel = 0; // Bright
1149cdf0e10cSrcweir 			}
1150cdf0e10cSrcweir 			else if( fBrightness >= 10.0 )
1151cdf0e10cSrcweir 			{
1152cdf0e10cSrcweir 				nLevel = 1; // Noraml;
1153cdf0e10cSrcweir 			}
1154cdf0e10cSrcweir 			else
1155cdf0e10cSrcweir 			{
1156cdf0e10cSrcweir 				nLevel = 2; // Dim
1157cdf0e10cSrcweir 			}
1158cdf0e10cSrcweir 
1159cdf0e10cSrcweir 			if( nFinalLevel == -1 )
1160cdf0e10cSrcweir 			{
1161cdf0e10cSrcweir 				nFinalLevel = nLevel;
1162cdf0e10cSrcweir 			}
1163cdf0e10cSrcweir 			else if( nFinalLevel != nLevel )
1164cdf0e10cSrcweir 			{
1165cdf0e10cSrcweir 				nFinalLevel = -1;
1166cdf0e10cSrcweir 				break;
1167cdf0e10cSrcweir 			}
1168cdf0e10cSrcweir 		}
1169cdf0e10cSrcweir 	}
1170cdf0e10cSrcweir 
1171cdf0e10cSrcweir 	if( bHasCustomShape )
1172cdf0e10cSrcweir 		rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_INTENSITY, nFinalLevel ) );
1173cdf0e10cSrcweir 	else
1174cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_LIGHTING_INTENSITY );
1175cdf0e10cSrcweir }
1176cdf0e10cSrcweir 
getExtrusionColorState(SdrView * pSdrView,SfxItemSet & rSet)1177cdf0e10cSrcweir void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet )
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1180cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
1183cdf0e10cSrcweir 	static const rtl::OUString  sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) );
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir 	com::sun::star::uno::Any* pAny;
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir 	bool bInit = false;
1188cdf0e10cSrcweir 	bool bAmbigius = false;
1189cdf0e10cSrcweir 	Color aFinalColor;
1190cdf0e10cSrcweir 	bool bHasCustomShape = false;
1191cdf0e10cSrcweir 
1192cdf0e10cSrcweir 	for(i=0;i<nCount; i++)
1193cdf0e10cSrcweir 	{
1194cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1195cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
1196cdf0e10cSrcweir 		{
1197cdf0e10cSrcweir 			SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1198cdf0e10cSrcweir 
1199cdf0e10cSrcweir 			// see if this is an extruded customshape
1200cdf0e10cSrcweir 			if( !bHasCustomShape )
1201cdf0e10cSrcweir 			{
1202cdf0e10cSrcweir 				Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1203cdf0e10cSrcweir 				if( pAny_ )
1204cdf0e10cSrcweir 					*pAny_ >>= bHasCustomShape;
1205cdf0e10cSrcweir 
1206cdf0e10cSrcweir 				if( !bHasCustomShape )
1207cdf0e10cSrcweir 					continue;
1208cdf0e10cSrcweir 			}
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir 			Color aColor;
1211cdf0e10cSrcweir 
1212cdf0e10cSrcweir 			bool bUseColor = false;
1213cdf0e10cSrcweir 			pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusionColor );
1214cdf0e10cSrcweir 			if( pAny )
1215cdf0e10cSrcweir 				*pAny >>= bUseColor;
1216cdf0e10cSrcweir 
1217cdf0e10cSrcweir 			if( bUseColor )
1218cdf0e10cSrcweir 			{
1219cdf0e10cSrcweir 				const XSecondaryFillColorItem& rItem = *(XSecondaryFillColorItem*)&(pObj->GetMergedItem( XATTR_SECONDARYFILLCOLOR ));
1220cdf0e10cSrcweir 				aColor = rItem.GetColorValue();
1221cdf0e10cSrcweir 			}
1222cdf0e10cSrcweir 			else
1223cdf0e10cSrcweir 			{
1224cdf0e10cSrcweir 				aColor = COL_AUTO;
1225cdf0e10cSrcweir 			}
1226cdf0e10cSrcweir 
1227cdf0e10cSrcweir 			if( !bInit )
1228cdf0e10cSrcweir 			{
1229cdf0e10cSrcweir 				aFinalColor = aColor;
1230cdf0e10cSrcweir 				bInit = true;
1231cdf0e10cSrcweir 			}
1232cdf0e10cSrcweir 			else if( aFinalColor != aColor )
1233cdf0e10cSrcweir 			{
1234cdf0e10cSrcweir 				bAmbigius = true;
1235cdf0e10cSrcweir 				break;
1236cdf0e10cSrcweir 			}
1237cdf0e10cSrcweir 		}
1238cdf0e10cSrcweir 	}
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir 	if( bAmbigius )
1241cdf0e10cSrcweir 		aFinalColor = COL_AUTO;
1242cdf0e10cSrcweir 
1243cdf0e10cSrcweir 	if( bHasCustomShape )
1244cdf0e10cSrcweir 		rSet.Put( SvxColorItem( aFinalColor, SID_EXTRUSION_3D_COLOR ) );
1245cdf0e10cSrcweir 	else
1246cdf0e10cSrcweir 		rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir 
1249cdf0e10cSrcweir namespace svx {
checkForSelectedCustomShapes(SdrView * pSdrView,bool bOnlyExtruded)1250cdf0e10cSrcweir bool checkForSelectedCustomShapes( SdrView* pSdrView, bool bOnlyExtruded )
1251cdf0e10cSrcweir {
1252cdf0e10cSrcweir 	static const rtl::OUString	sExtrusion( RTL_CONSTASCII_USTRINGPARAM ( "Extrusion" ) );
1253cdf0e10cSrcweir 
1254cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
1255cdf0e10cSrcweir 	sal_uIntPtr nCount = rMarkList.GetMarkCount(), i;
1256cdf0e10cSrcweir 	bool bFound = false;
1257cdf0e10cSrcweir 
1258cdf0e10cSrcweir 	for(i=0;(i<nCount) && !bFound ; i++)
1259cdf0e10cSrcweir 	{
1260cdf0e10cSrcweir 		SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1261cdf0e10cSrcweir 		if( pObj->ISA(SdrObjCustomShape) )
1262cdf0e10cSrcweir 		{
1263cdf0e10cSrcweir 			if( bOnlyExtruded )
1264cdf0e10cSrcweir 			{
1265cdf0e10cSrcweir 				SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
1266cdf0e10cSrcweir 				Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
1267cdf0e10cSrcweir 				if( pAny )
1268cdf0e10cSrcweir 					*pAny >>= bFound;
1269cdf0e10cSrcweir 			}
1270cdf0e10cSrcweir 			else
1271cdf0e10cSrcweir 			{
1272cdf0e10cSrcweir 				bFound = true;
1273cdf0e10cSrcweir 			}
1274cdf0e10cSrcweir 		}
1275cdf0e10cSrcweir 	}
1276cdf0e10cSrcweir 
1277cdf0e10cSrcweir 	return bFound;
1278cdf0e10cSrcweir }
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir 
getState(SdrView * pSdrView,SfxItemSet & rSet)1281cdf0e10cSrcweir void ExtrusionBar::getState( SdrView* pSdrView, SfxItemSet& rSet )
1282cdf0e10cSrcweir {
1283cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_DIRECTION) != SFX_ITEM_UNKNOWN)
1284cdf0e10cSrcweir 	{
1285cdf0e10cSrcweir 		getExtrusionDirectionState( pSdrView, rSet );
1286cdf0e10cSrcweir 	}
1287cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_PROJECTION) != SFX_ITEM_UNKNOWN)
1288cdf0e10cSrcweir 	{
1289cdf0e10cSrcweir 		getExtrusionProjectionState( pSdrView, rSet );
1290cdf0e10cSrcweir 	}
1291cdf0e10cSrcweir     const bool bOnlyExtrudedCustomShapes =
1292cdf0e10cSrcweir         checkForSelectedCustomShapes( pSdrView, true );
1293cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SFX_ITEM_UNKNOWN)
1294cdf0e10cSrcweir 	{
1295cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1296cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
1297cdf0e10cSrcweir 	}
1298cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SFX_ITEM_UNKNOWN)
1299cdf0e10cSrcweir 	{
1300cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1301cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
1302cdf0e10cSrcweir 	}
1303cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_TILT_UP) != SFX_ITEM_UNKNOWN)
1304cdf0e10cSrcweir 	{
1305cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1306cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_TILT_UP );
1307cdf0e10cSrcweir 	}
1308cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_TILT_LEFT) != SFX_ITEM_UNKNOWN)
1309cdf0e10cSrcweir 	{
1310cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1311cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_TILT_LEFT );
1312cdf0e10cSrcweir 	}
1313cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_TILT_RIGHT) != SFX_ITEM_UNKNOWN)
1314cdf0e10cSrcweir 	{
1315cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1316cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_TILT_RIGHT );
1317cdf0e10cSrcweir 	}
1318cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SFX_ITEM_UNKNOWN)
1319cdf0e10cSrcweir 	{
1320cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1321cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
1322cdf0e10cSrcweir 	}
1323cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_DEPTH_FLOATER) != SFX_ITEM_UNKNOWN)
1324cdf0e10cSrcweir 	{
1325cdf0e10cSrcweir         if (! bOnlyExtrudedCustomShapes)
1326cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_DEPTH_FLOATER );
1327cdf0e10cSrcweir 	}
1328cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_DIRECTION_FLOATER) != SFX_ITEM_UNKNOWN)
1329cdf0e10cSrcweir 	{
1330cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1331cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
1332cdf0e10cSrcweir 	}
1333cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_FLOATER) != SFX_ITEM_UNKNOWN)
1334cdf0e10cSrcweir 	{
1335cdf0e10cSrcweir 		if (! bOnlyExtrudedCustomShapes)
1336cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
1337cdf0e10cSrcweir 	}
1338cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_SURFACE_FLOATER) != SFX_ITEM_UNKNOWN)
1339cdf0e10cSrcweir 	{
1340cdf0e10cSrcweir 		if(! bOnlyExtrudedCustomShapes)
1341cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
1342cdf0e10cSrcweir 	}
1343cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_TOOGLE) != SFX_ITEM_UNKNOWN)
1344cdf0e10cSrcweir 	{
1345cdf0e10cSrcweir 		if( !checkForSelectedCustomShapes( pSdrView, false ) )
1346cdf0e10cSrcweir 			rSet.DisableItem( SID_EXTRUSION_TOOGLE );
1347cdf0e10cSrcweir 	}
1348cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_DEPTH) != SFX_ITEM_UNKNOWN)
1349cdf0e10cSrcweir 	{
1350cdf0e10cSrcweir 		getExtrusionDepthState( pSdrView, rSet );
1351cdf0e10cSrcweir 	}
1352cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_SURFACE) != SFX_ITEM_UNKNOWN)
1353cdf0e10cSrcweir 	{
1354cdf0e10cSrcweir 		getExtrusionSurfaceState( pSdrView, rSet );
1355cdf0e10cSrcweir 	}
1356cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_INTENSITY) != SFX_ITEM_UNKNOWN)
1357cdf0e10cSrcweir 	{
1358cdf0e10cSrcweir 		getExtrusionLightingIntensityState( pSdrView, rSet );
1359cdf0e10cSrcweir 	}
1360cdf0e10cSrcweir 
1361cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_DIRECTION) != SFX_ITEM_UNKNOWN)
1362cdf0e10cSrcweir 	{
1363cdf0e10cSrcweir 		getExtrusionLightingDirectionState( pSdrView, rSet );
1364cdf0e10cSrcweir 	}
1365cdf0e10cSrcweir 
1366cdf0e10cSrcweir 	if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SFX_ITEM_UNKNOWN)
1367cdf0e10cSrcweir 	{
1368cdf0e10cSrcweir 		getExtrusionColorState( pSdrView, rSet );
1369cdf0e10cSrcweir 	}
1370cdf0e10cSrcweir }
1371