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