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