xref: /trunk/main/svx/source/engine3d/float3d.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <sfx2/dispatch.hxx>
31 #include <sfx2/module.hxx>
32 #include <sfx2/viewfrm.hxx>
33 #include <svl/eitem.hxx>
34 #include <svtools/colrdlg.hxx>
35 #include <vcl/msgbox.hxx>
36 #include <sfx2/viewsh.hxx>
37 #include <tools/shl.hxx>
38 #include <svx/xflclit.hxx>
39 #include <svx/svdmodel.hxx>
40 #include <svx/globl3d.hxx>
41 #include <svx/view3d.hxx>
42 #include <svx/obj3d.hxx>
43 #include <svx/sphere3d.hxx>
44 #include <svx/scene3d.hxx>
45 #include <svx/camera3d.hxx>
46 #include <svx/fmmodel.hxx>
47 #include <svx/fmpage.hxx>
48 #include <svx/polysc3d.hxx>
49 #include <editeng/eeitem.hxx>
50 #include <svl/style.hxx>
51 #include <svx/dlgutil.hxx>
52 
53 #include <svx/dlgutil.hxx>
54 #include <svx/dialmgr.hxx>
55 #include <svx/viewpt3d.hxx> // ProjectionType
56 
57 #include <svx/svxids.hrc>
58 #include <svx/dialogs.hrc>
59 
60 #include <editeng/colritem.hxx>
61 #include <svx/e3ditem.hxx>
62 
63 #include <svx/gallery.hxx>
64 #define GALLERY_THEME "3D"
65 #include <svl/whiter.hxx>
66 
67 #include <svx/float3d.hxx>
68 #include "float3d.hrc"
69 
70 SFX_IMPL_DOCKINGWINDOW( Svx3DChildWindow, SID_3D_WIN )
71 
72 struct Svx3DWinImpl
73 {
74 	SfxItemPool*		pPool;
75 	Image				maImgLightOnH;
76 	Image				maImgLightOffH;
77 };
78 
79 #define SETHCIMAGE(btn,res) \
80 { \
81 	Bitmap aBmp( SVX_RES( res ) ); \
82 	Image aImage( aBmp, COL_LIGHTMAGENTA ); \
83 	btn.SetModeImage( aImage, BMP_COLOR_HIGHCONTRAST ); \
84 }
85 
86 namespace {
87     /** Get the dispatcher from the current view frame, or, if that is not
88         available, from the given bindings.
89         @param pBindings
90             May be NULL.
91         @returns NULL when both the current view frame is NULL and the given
92             bindings are NULL.
93     */
94     SfxDispatcher* LocalGetDispatcher (const SfxBindings* pBindings)
95     {
96         SfxDispatcher* pDispatcher = NULL;
97 
98         if (SfxViewFrame::Current() != NULL)
99             pDispatcher = SfxViewFrame::Current()->GetDispatcher();
100         else if (pBindings != NULL)
101             pDispatcher = pBindings->GetDispatcher();
102 
103         return pDispatcher;
104     }
105 }
106 
107 
108 /*************************************************************************
109 |*	Svx3DWin - FloatingWindow
110 \************************************************************************/
111 __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
112 				SfxChildWindow *pCW, Window* pParent ) :
113 		SfxDockingWindow    ( pInBindings, pCW, pParent,
114 									SVX_RES( RID_SVXFLOAT_3D ) ),
115 		aBtnGeo				( this, SVX_RES( BTN_GEO ) ),
116 		aBtnRepresentation	( this, SVX_RES( BTN_REPRESENTATION ) ),
117 		aBtnLight			( this, SVX_RES( BTN_LIGHT ) ),
118 		aBtnTexture			( this, SVX_RES( BTN_TEXTURE ) ),
119 		aBtnMaterial		( this, SVX_RES( BTN_MATERIAL ) ),
120 		aBtnUpdate			( this, SVX_RES( BTN_UPDATE ) ),
121 		aBtnAssign			( this, SVX_RES( BTN_ASSIGN ) ),
122         aFLGeometrie       ( this, SVX_RES( FL_GEOMETRIE ) ),
123 
124 		// Geometrie
125 		aFtPercentDiagonal	( this, SVX_RES( FT_PERCENT_DIAGONAL ) ),
126 		aMtrPercentDiagonal	( this, SVX_RES( MTR_PERCENT_DIAGONAL ) ),
127 		aFtBackscale		( this, SVX_RES( FT_BACKSCALE ) ),
128 		aMtrBackscale		( this, SVX_RES( MTR_BACKSCALE ) ),
129 		aFtEndAngle			( this, SVX_RES( FT_END_ANGLE ) ),
130 		aMtrEndAngle		( this, SVX_RES( MTR_END_ANGLE ) ),
131 		aFtDepth			( this, SVX_RES( FT_DEPTH ) ),
132 		aMtrDepth			( this, SVX_RES( MTR_DEPTH ) ),
133         aFLSegments        ( this, SVX_RES( FL_SEGMENTS ) ),
134 
135 		aFtHorizontal		( this, SVX_RES( FT_HORIZONTAL ) ),
136 		aNumHorizontal		( this, SVX_RES( NUM_HORIZONTAL ) ),
137 		aFtVertical			( this, SVX_RES( FT_VERTICAL ) ),
138 		aNumVertical		( this, SVX_RES( NUM_VERTICAL ) ),
139 
140         aFLNormals         ( this, SVX_RES( FL_NORMALS ) ),
141 		aBtnNormalsObj		( this, SVX_RES( BTN_NORMALS_OBJ ) ),
142 		aBtnNormalsFlat		( this, SVX_RES( BTN_NORMALS_FLAT ) ),
143 		aBtnNormalsSphere	( this, SVX_RES( BTN_NORMALS_SPHERE ) ),
144 		aBtnNormalsInvert	( this, SVX_RES( BTN_NORMALS_INVERT ) ),
145 		aBtnTwoSidedLighting( this, SVX_RES( BTN_TWO_SIDED_LIGHTING ) ),
146 
147 		aBtnDoubleSided   	( this, SVX_RES( BTN_DOUBLE_SIDED ) ),
148 
149 		// Darstellung
150         aFLRepresentation  ( this, SVX_RES( FL_REPRESENTATION ) ),
151 		aFtShademode		( this, SVX_RES( FT_SHADEMODE ) ),
152 		aLbShademode		( this, SVX_RES( LB_SHADEMODE ) ),
153         aFLShadow          ( this, SVX_RES( FL_SHADOW ) ),
154 		aBtnShadow3d 		( this, SVX_RES( BTN_SHADOW_3D ) ),
155 		aFtSlant      		( this, SVX_RES( FT_SLANT ) ),
156 		aMtrSlant     		( this, SVX_RES( MTR_SLANT ) ),
157 		aFtDistance			( this, SVX_RES( FT_DISTANCE ) ),
158 		aMtrDistance		( this, SVX_RES( MTR_DISTANCE ) ),
159 		aFtFocalLeng		( this, SVX_RES( FT_FOCAL_LENGTH ) ),
160 		aMtrFocalLength		( this, SVX_RES( MTR_FOCAL_LENGTH ) ),
161         aFLCamera          ( this, SVX_RES( FL_CAMERA ) ),
162 		aFLLight           ( this, SVX_RES( FL_LIGHT ) ),
163 
164 		// Beleuchtung
165 		aBtnLight1			( this, SVX_RES( BTN_LIGHT_1 ) ),
166 		aBtnLight2			( this, SVX_RES( BTN_LIGHT_2 ) ),
167 		aBtnLight3			( this, SVX_RES( BTN_LIGHT_3 ) ),
168 		aBtnLight4			( this, SVX_RES( BTN_LIGHT_4 ) ),
169 		aBtnLight5			( this, SVX_RES( BTN_LIGHT_5 ) ),
170 		aBtnLight6			( this, SVX_RES( BTN_LIGHT_6 ) ),
171 		aBtnLight7			( this, SVX_RES( BTN_LIGHT_7 ) ),
172 		aBtnLight8			( this, SVX_RES( BTN_LIGHT_8 ) ),
173         aFTLightsource     ( this, SVX_RES( FT_LIGHTSOURCE ) ),
174 		aLbLight1			( this, SVX_RES( LB_LIGHT_1 ) ),
175 		aLbLight2   		( this, SVX_RES( LB_LIGHT_2 ) ),
176 		aLbLight3			( this, SVX_RES( LB_LIGHT_3 ) ),
177 		aLbLight4			( this, SVX_RES( LB_LIGHT_4 ) ),
178 		aLbLight5			( this, SVX_RES( LB_LIGHT_5 ) ),
179 		aLbLight6			( this, SVX_RES( LB_LIGHT_6 ) ),
180 		aLbLight7			( this, SVX_RES( LB_LIGHT_7 ) ),
181 		aLbLight8			( this, SVX_RES( LB_LIGHT_8 ) ),
182 
183 		aBtnLightColor		( this, SVX_RES( BTN_LIGHT_COLOR ) ),
184 
185 		// #99694# Keyboard shortcuts activate the next control, so the
186 		// order needed to be changed here
187         aFTAmbientlight    ( this, SVX_RES( FT_AMBIENTLIGHT ) ),	// Text label
188 		aLbAmbientlight		( this, SVX_RES( LB_AMBIENTLIGHT ) ),	// ListBox
189 		aBtnAmbientColor	( this, SVX_RES( BTN_AMBIENT_COLOR ) ), // color button
190         aFLTexture         ( this, SVX_RES( FL_TEXTURE ) ),
191 
192 		// Texturen
193 		aFtTexKind			( this, SVX_RES( FT_TEX_KIND ) ),
194 		aBtnTexLuminance	( this, SVX_RES( BTN_TEX_LUMINANCE ) ),
195 		aBtnTexColor		( this, SVX_RES( BTN_TEX_COLOR ) ),
196 		aFtTexMode			( this, SVX_RES( FT_TEX_MODE ) ),
197 		aBtnTexReplace		( this, SVX_RES( BTN_TEX_REPLACE ) ),
198 		aBtnTexModulate		( this, SVX_RES( BTN_TEX_MODULATE ) ),
199 		aBtnTexBlend		( this, SVX_RES( BTN_TEX_BLEND ) ),
200 		aFtTexProjectionX	( this, SVX_RES( FT_TEX_PROJECTION_X ) ),
201 		aBtnTexObjectX		( this, SVX_RES( BTN_TEX_OBJECT_X ) ),
202 		aBtnTexParallelX	( this, SVX_RES( BTN_TEX_PARALLEL_X ) ),
203 		aBtnTexCircleX		( this, SVX_RES( BTN_TEX_CIRCLE_X ) ),
204 		aFtTexProjectionY	( this, SVX_RES( FT_TEX_PROJECTION_Y ) ),
205 		aBtnTexObjectY		( this, SVX_RES( BTN_TEX_OBJECT_Y ) ),
206 		aBtnTexParallelY	( this, SVX_RES( BTN_TEX_PARALLEL_Y ) ),
207 		aBtnTexCircleY		( this, SVX_RES( BTN_TEX_CIRCLE_Y ) ),
208 		aFtTexFilter		( this, SVX_RES( FT_TEX_FILTER ) ),
209 		aBtnTexFilter		( this, SVX_RES( BTN_TEX_FILTER ) ),
210         aFLMaterial        ( this, SVX_RES( FL_MATERIAL ) ),
211 
212 		// Material
213 		aFtMatFavorites 	( this, SVX_RES( FT_MAT_FAVORITES ) ),
214 		aLbMatFavorites 	( this, SVX_RES( LB_MAT_FAVORITES ) ),
215 		aFtMatColor			( this, SVX_RES( FT_MAT_COLOR ) ),
216 		aLbMatColor			( this, SVX_RES( LB_MAT_COLOR ) ),
217 		aBtnMatColor		( this, SVX_RES( BTN_MAT_COLOR ) ),
218 		aFtMatEmission		( this, SVX_RES( FT_MAT_EMISSION ) ),
219 		aLbMatEmission		( this, SVX_RES( LB_MAT_EMISSION ) ),
220 		aBtnEmissionColor	( this, SVX_RES( BTN_EMISSION_COLOR ) ),
221         aFLMatSpecular     ( this, SVX_RES( FL_MAT_SPECULAR ) ),
222 		aFtMatSpecular		( this, SVX_RES( FT_MAT_SPECULAR ) ),
223 		aLbMatSpecular		( this, SVX_RES( LB_MAT_SPECULAR ) ),
224 		aBtnSpecularColor	( this, SVX_RES( BTN_SPECULAR_COLOR ) ),
225 		aFtMatSpecularIntensity( this, SVX_RES( FT_MAT_SPECULAR_INTENSITY ) ),
226 		aMtrMatSpecularIntensity( this, SVX_RES( MTR_MAT_SPECULAR_INTENSITY ) ),
227 		aCtlPreview 		( this, SVX_RES( CTL_PREVIEW ) ),
228 		aCtlLightPreview 	( this, SVX_RES( CTL_LIGHT_PREVIEW ) ),
229 
230 		// Unterer Bereich
231 		aBtnConvertTo3D		( this, SVX_RES( BTN_CHANGE_TO_3D ) ),
232 		aBtnLatheObject		( this, SVX_RES( BTN_LATHE_OBJ ) ),
233 		aBtnPerspective		( this, SVX_RES( BTN_PERSPECTIVE ) ),
234 
235 		aImgLightOn			( SVX_RES( RID_SVXIMAGE_LIGHT_ON ) ),
236 		aImgLightOff		( SVX_RES( RID_SVXIMAGE_LIGHT_OFF ) ),
237 
238 		bUpdate				( sal_False ),
239 		eViewType			( VIEWTYPE_GEO ),
240 
241 		pModel				( NULL ),
242 		pFmPage				( NULL ),
243 		pVDev	 			( NULL ),
244 		p3DView				( NULL ),
245 		pFavorSetList		( NULL ),
246 		pMatFavSetList		( NULL ),
247 
248 		pBindings			( pInBindings ),
249 		pControllerItem(0L),
250 		pConvertTo3DItem(0L),
251 		pConvertTo3DLatheItem(0L),
252 //		pPool				( NULL ),
253 		mpImpl				( new Svx3DWinImpl() ),
254 		mpRemember2DAttributes(NULL),
255 		bOnly3DChanged		( sal_False )
256 {
257 	String accname(SVX_RES(STR_COLOR_LIGHT_PRE));
258 	aCtlLightPreview.SetAccessibleName(accname);
259 	aCtlPreview.SetAccessibleName(accname);
260 	aLbAmbientlight.SetAccessibleName(aFTAmbientlight.GetDisplayText());
261 
262 	SETHCIMAGE( aBtnGeo, BMP_GEO_H );
263 	SETHCIMAGE( aBtnRepresentation, BMP_REPRESENTATION_H );
264 	SETHCIMAGE( aBtnLight, BMP_3DLIGHT_H );
265 	SETHCIMAGE( aBtnTexture, BMP_TEXTURE_H );
266 	SETHCIMAGE( aBtnMaterial, BMP_MATERIAL_H );
267 	SETHCIMAGE( aBtnUpdate, BMP_UPDATE_H );
268 	SETHCIMAGE( aBtnAssign, BMP_ASSIGN_H );
269 	SETHCIMAGE( aBtnNormalsObj, BMP_NORMALS_OBJ_H );
270 	SETHCIMAGE( aBtnNormalsFlat, BMP_NORMALS_FLAT_H );
271 	SETHCIMAGE( aBtnNormalsSphere, BMP_NORMALS_SPHERE_H );
272 	SETHCIMAGE( aBtnTwoSidedLighting, BMP_TWO_SIDED_LIGHTING_H );
273 	SETHCIMAGE( aBtnNormalsInvert, BMP_NORMALS_INVERT_H );
274 	SETHCIMAGE( aBtnDoubleSided, BMP_DOUBLE_SIDED_H );
275 	SETHCIMAGE( aBtnShadow3d, BMP_SHADOW_3D_H );
276 	SETHCIMAGE( aBtnLight1, BMP_LIGHT_H );
277 	SETHCIMAGE( aBtnLight2, BMP_LIGHT_H );
278 	SETHCIMAGE( aBtnLight3, BMP_LIGHT_H );
279 	SETHCIMAGE( aBtnLight4, BMP_LIGHT_H );
280 	SETHCIMAGE( aBtnLight5, BMP_LIGHT_H );
281 	SETHCIMAGE( aBtnLight6, BMP_LIGHT_H );
282 	SETHCIMAGE( aBtnLight7, BMP_LIGHT_H );
283 	SETHCIMAGE( aBtnLight8, BMP_LIGHT_H );
284 	SETHCIMAGE( aBtnLightColor, BMP_LIGHT_COLOR_H );
285 	SETHCIMAGE( aBtnAmbientColor, BMP_AMBIENT_COLOR_H );
286 	SETHCIMAGE( aBtnTexLuminance, BMP_TEX_LUMINANCE_H );
287 	SETHCIMAGE( aBtnTexColor, BMP_TEX_COLOR_H );
288 	SETHCIMAGE( aBtnTexReplace, BMP_TEX_REPLACE_H );
289 	SETHCIMAGE( aBtnTexModulate, BMP_TEX_MODULATE_H );
290 	SETHCIMAGE( aBtnTexBlend, BMP_TEX_BLEND_H );
291 	SETHCIMAGE( aBtnTexParallelX, BMP_TEX_PARALLEL_H );
292 	SETHCIMAGE( aBtnTexCircleX, BMP_TEX_CIRCLE_H );
293 	SETHCIMAGE( aBtnTexObjectX, BMP_TEX_OBJECT_H );
294 	SETHCIMAGE( aBtnTexParallelY, BMP_TEX_PARALLEL_H );
295 	SETHCIMAGE( aBtnTexCircleY, BMP_TEX_CIRCLE_H );
296 	SETHCIMAGE( aBtnTexObjectY, BMP_TEX_OBJECT_H );
297 	SETHCIMAGE( aBtnTexFilter, BMP_TEX_FILTER_H );
298 	SETHCIMAGE( aBtnMatColor, BMP_COLORDLG_H );
299 	SETHCIMAGE( aBtnEmissionColor, BMP_COLORDLG_H );
300 	SETHCIMAGE( aBtnSpecularColor, BMP_COLORDLG_H );
301 	SETHCIMAGE( aBtnPerspective, BMP_PERSPECTIVE_H );
302 	SETHCIMAGE( aBtnConvertTo3D, BMP_CHANGE_TO_3D_H );
303 	SETHCIMAGE( aBtnLatheObject, BMP_LATHE_OBJ_H );
304 
305 	mpImpl->pPool = NULL;
306 	mpImpl->maImgLightOnH = Image( SVX_RES( RID_SVXIMAGE_LIGHT_ON_H ) );
307 	mpImpl->maImgLightOffH = Image( SVX_RES( RID_SVXIMAGE_LIGHT_OFF_H ) );
308 	FreeResource();
309 
310 	// Metrik einstellen
311 	eFUnit = pInBindings->GetDispatcher()->GetModule()->GetFieldUnit();
312 
313 	aMtrDepth.SetUnit( eFUnit );
314 	aMtrDistance.SetUnit( eFUnit );
315 	aMtrFocalLength.SetUnit( eFUnit );
316 
317 	pControllerItem = new Svx3DCtrlItem(SID_3D_STATE, this, pBindings);
318 	pConvertTo3DItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D, pBindings);
319 	pConvertTo3DLatheItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST, pBindings);
320 
321 	aBtnAssign.SetClickHdl( LINK( this, Svx3DWin, ClickAssignHdl ) );
322 	aBtnUpdate.SetClickHdl( LINK( this, Svx3DWin, ClickUpdateHdl ) );
323 
324 	Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
325 	aBtnGeo.SetClickHdl( aLink );
326 	aBtnRepresentation.SetClickHdl( aLink );
327 	aBtnLight.SetClickHdl( aLink );
328 	aBtnTexture.SetClickHdl( aLink );
329 	aBtnMaterial.SetClickHdl( aLink );
330 
331 	aLink = LINK( this, Svx3DWin, ClickHdl );
332 	aBtnPerspective.SetClickHdl( aLink );
333 	aBtnConvertTo3D.SetClickHdl( aLink );
334 	aBtnLatheObject.SetClickHdl( aLink );
335 
336 	// Geometrie
337 	aBtnNormalsObj.SetClickHdl( aLink );
338 	aBtnNormalsFlat.SetClickHdl( aLink );
339 	aBtnNormalsSphere.SetClickHdl( aLink );
340 	aBtnTwoSidedLighting.SetClickHdl( aLink );
341 	aBtnNormalsInvert.SetClickHdl( aLink );
342 	aBtnDoubleSided.SetClickHdl( aLink );
343 
344 	// Darstellung
345 	aBtnShadow3d.SetClickHdl( aLink );
346 
347 	// Beleuchtung
348 	aBtnLight1.SetClickHdl( aLink );
349 	aBtnLight2.SetClickHdl( aLink );
350 	aBtnLight3.SetClickHdl( aLink );
351 	aBtnLight4.SetClickHdl( aLink );
352 	aBtnLight5.SetClickHdl( aLink );
353 	aBtnLight6.SetClickHdl( aLink );
354 	aBtnLight7.SetClickHdl( aLink );
355 	aBtnLight8.SetClickHdl( aLink );
356 
357 	// Texturen
358 	aBtnTexLuminance.SetClickHdl( aLink );
359 	aBtnTexColor.SetClickHdl( aLink );
360 	aBtnTexReplace.SetClickHdl( aLink );
361 	aBtnTexModulate.SetClickHdl( aLink );
362 	//aBtnTexBlend.SetClickHdl( aLink );
363 	aBtnTexParallelX.SetClickHdl( aLink );
364 	aBtnTexCircleX.SetClickHdl( aLink );
365 	aBtnTexObjectX.SetClickHdl( aLink );
366 	aBtnTexParallelY.SetClickHdl( aLink );
367 	aBtnTexCircleY.SetClickHdl( aLink );
368 	aBtnTexObjectY.SetClickHdl( aLink );
369 	aBtnTexFilter.SetClickHdl( aLink );
370 
371 	// Material
372 	aLink = LINK( this, Svx3DWin, ClickColorHdl );
373 	aBtnLightColor.SetClickHdl( aLink );
374 	aBtnAmbientColor.SetClickHdl( aLink );
375 	aBtnMatColor.SetClickHdl( aLink );
376 	aBtnEmissionColor.SetClickHdl( aLink );
377 	aBtnSpecularColor.SetClickHdl( aLink );
378 
379 
380 	aLink = LINK( this, Svx3DWin, SelectHdl );
381 	aLbMatFavorites.SetSelectHdl( aLink );
382 	aLbMatColor.SetSelectHdl( aLink );
383 	aLbMatEmission.SetSelectHdl( aLink );
384 	aLbMatSpecular.SetSelectHdl( aLink );
385 	aLbLight1.SetSelectHdl( aLink );
386 	aLbLight2.SetSelectHdl( aLink );
387 	aLbLight3.SetSelectHdl( aLink );
388 	aLbLight4.SetSelectHdl( aLink );
389 	aLbLight5.SetSelectHdl( aLink );
390 	aLbLight6.SetSelectHdl( aLink );
391 	aLbLight7.SetSelectHdl( aLink );
392 	aLbLight8.SetSelectHdl( aLink );
393 	aLbAmbientlight.SetSelectHdl( aLink );
394 	aLbShademode.SetSelectHdl( aLink );
395 
396 	aLink = LINK( this, Svx3DWin, ModifyHdl );
397 	aMtrMatSpecularIntensity.SetModifyHdl( aLink );
398 	aNumHorizontal.SetModifyHdl( aLink );
399 	aNumVertical.SetModifyHdl( aLink );
400 	aMtrSlant.SetModifyHdl( aLink );
401 
402 	// Preview-Callback
403 	aLink = LINK( this, Svx3DWin, ChangeLightCallbackHdl );
404 	aCtlLightPreview.SetUserInteractiveChangeCallback(aLink);
405 	aLink = LINK( this, Svx3DWin, ChangeSelectionCallbackHdl );
406 	aCtlLightPreview.SetUserSelectionChangeCallback(aLink);
407 
408     aSize = GetOutputSizePixel();
409 	SetMinOutputSizePixel( aSize );
410 
411 	Construct();
412 
413 	// Initiierung der Initialisierung der ColorLBs
414     SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
415     if (pDispatcher != NULL)
416     {
417         SfxBoolItem aItem( SID_3D_INIT, sal_True );
418         pDispatcher->Execute(
419             SID_3D_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
420     }
421 
422 	Reset();
423 
424 	aBtnNormalsObj.SetAccessibleRelationMemberOf( &aFLNormals );
425 	aBtnNormalsFlat.SetAccessibleRelationMemberOf( &aFLNormals );
426 	aBtnNormalsSphere.SetAccessibleRelationMemberOf( &aFLNormals );
427 	aBtnNormalsInvert.SetAccessibleRelationMemberOf( &aFLNormals );
428 	aBtnTwoSidedLighting.SetAccessibleRelationMemberOf( &aFLNormals );
429 	aBtnDoubleSided.SetAccessibleRelationMemberOf( &aFLNormals );
430 
431 	aBtnLight1.SetAccessibleRelationMemberOf( &aFLLight );
432 	aBtnLight2.SetAccessibleRelationMemberOf( &aFLLight );
433 	aBtnLight3.SetAccessibleRelationMemberOf( &aFLLight );
434 	aBtnLight4.SetAccessibleRelationMemberOf( &aFLLight );
435 	aBtnLight5.SetAccessibleRelationMemberOf( &aFLLight );
436 	aBtnLight6.SetAccessibleRelationMemberOf( &aFLLight );
437 	aBtnLight7.SetAccessibleRelationMemberOf( &aFLLight );
438 	aBtnLight8.SetAccessibleRelationMemberOf( &aFLLight );
439 
440 	aBtnLight1.SetAccessibleRelationLabeledBy( &aFTLightsource );
441 	aBtnLight2.SetAccessibleRelationLabeledBy( &aFTLightsource );
442 	aBtnLight3.SetAccessibleRelationLabeledBy( &aFTLightsource );
443 	aBtnLight4.SetAccessibleRelationLabeledBy( &aFTLightsource );
444 	aBtnLight5.SetAccessibleRelationLabeledBy( &aFTLightsource );
445 	aBtnLight6.SetAccessibleRelationLabeledBy( &aFTLightsource );
446 	aBtnLight7.SetAccessibleRelationLabeledBy( &aFTLightsource );
447 	aBtnLight8.SetAccessibleRelationLabeledBy( &aFTLightsource );
448 	aBtnLightColor.SetAccessibleRelationMemberOf( &aFLLight );
449 	aBtnLightColor.SetAccessibleRelationLabeledBy( &aFTLightsource );
450 	aBtnAmbientColor.SetAccessibleRelationMemberOf( &aFLLight );
451 	aBtnAmbientColor.SetAccessibleRelationLabeledBy( &aFTAmbientlight );
452 
453 	aBtnSpecularColor.SetAccessibleRelationLabeledBy( &aFtMatSpecular );
454 	aBtnMatColor.SetAccessibleRelationLabeledBy( &aFtMatColor );
455 	aBtnEmissionColor.SetAccessibleRelationLabeledBy( &aFtMatEmission );
456 	aBtnTexLuminance.SetAccessibleRelationLabeledBy( &aFtTexKind );
457 	aBtnTexColor.SetAccessibleRelationLabeledBy( &aFtTexKind );
458 	aBtnTexReplace.SetAccessibleRelationLabeledBy( &aFtTexMode );
459 	aBtnTexModulate.SetAccessibleRelationLabeledBy( &aFtTexMode );
460 	aBtnTexBlend.SetAccessibleRelationLabeledBy( &aFtTexMode );
461 	aBtnTexObjectX.SetAccessibleRelationLabeledBy( &aFtTexProjectionX );
462 	aBtnTexParallelX.SetAccessibleRelationLabeledBy( &aFtTexProjectionX );
463 	aBtnTexCircleX.SetAccessibleRelationLabeledBy( &aFtTexProjectionX );
464 	aBtnTexObjectY.SetAccessibleRelationLabeledBy( &aFtTexProjectionY );
465 	aBtnTexParallelY.SetAccessibleRelationLabeledBy( &aFtTexProjectionY );
466 	aBtnTexCircleY.SetAccessibleRelationLabeledBy( &aFtTexProjectionY );
467 	aBtnTexFilter.SetAccessibleRelationLabeledBy( &aFtTexFilter );
468 	aCtlLightPreview.SetAccessibleRelationLabeledBy( &aCtlLightPreview );
469 	aBtnNormalsObj.SetAccessibleRelationMemberOf(&aFLNormals);
470 	aBtnNormalsFlat.SetAccessibleRelationMemberOf(&aFLNormals);
471 	aBtnNormalsSphere.SetAccessibleRelationMemberOf(&aFLNormals);
472 	aBtnNormalsInvert.SetAccessibleRelationMemberOf(&aFLNormals);
473 	aBtnTwoSidedLighting.SetAccessibleRelationMemberOf(&aFLNormals);
474 
475 	aBtnShadow3d.SetAccessibleRelationMemberOf(&aFLShadow);
476 
477 	aBtnLight1.SetAccessibleRelationMemberOf(&aFLLight);
478 	aBtnLight2.SetAccessibleRelationMemberOf(&aFLLight);
479 	aBtnLight3.SetAccessibleRelationMemberOf(&aFLLight);
480 	aBtnLight4.SetAccessibleRelationMemberOf(&aFLLight);
481 	aBtnLight5.SetAccessibleRelationMemberOf(&aFLLight);
482 	aBtnLight6.SetAccessibleRelationMemberOf(&aFLLight);
483 	aBtnLight7.SetAccessibleRelationMemberOf(&aFLLight);
484 	aBtnLight8.SetAccessibleRelationMemberOf(&aFLLight);
485 
486 	aBtnTexLuminance.SetAccessibleRelationMemberOf(&aFLTexture);
487 	aBtnTexColor.SetAccessibleRelationMemberOf(&aFLTexture);
488 	aBtnTexReplace.SetAccessibleRelationMemberOf(&aFLTexture);
489 	aBtnTexModulate.SetAccessibleRelationMemberOf(&aFLTexture);
490 	aBtnTexBlend.SetAccessibleRelationMemberOf(&aFLTexture);
491 	aBtnTexObjectX.SetAccessibleRelationMemberOf(&aFLTexture);
492 	aBtnTexParallelX.SetAccessibleRelationMemberOf(&aFLTexture);
493 	aBtnTexCircleX.SetAccessibleRelationMemberOf(&aFLTexture);
494 	aBtnTexObjectY.SetAccessibleRelationMemberOf(&aFLTexture);
495 	aBtnTexParallelY.SetAccessibleRelationMemberOf(&aFLTexture);
496 	aBtnTexCircleY.SetAccessibleRelationMemberOf(&aFLTexture);
497 	aBtnTexFilter.SetAccessibleRelationMemberOf(&aFLTexture);
498 
499 	aBtnMatColor.SetAccessibleRelationMemberOf(&aFLMaterial);
500 	aBtnEmissionColor.SetAccessibleRelationMemberOf(&aFLMaterial);
501 
502 	aBtnSpecularColor.SetAccessibleRelationMemberOf(&aFLMatSpecular);
503 }
504 
505 // -----------------------------------------------------------------------
506 __EXPORT Svx3DWin::~Svx3DWin()
507 {
508 	//delete pMatFavSetList;
509 	delete p3DView;
510 	delete pVDev;
511 	delete pModel;
512 
513 	delete pControllerItem;
514 	delete pConvertTo3DItem;
515 	delete pConvertTo3DLatheItem;
516 
517 	if(mpRemember2DAttributes)
518 		delete mpRemember2DAttributes;
519 
520 	delete mpImpl;
521 }
522 
523 // -----------------------------------------------------------------------
524 void Svx3DWin::Construct()
525 {
526 	aBtnGeo.Check();
527 	Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
528 	aLink.Call( &aBtnGeo );
529 	aCtlLightPreview.Hide();
530 }
531 
532 // -----------------------------------------------------------------------
533 void Svx3DWin::Reset()
534 {
535 	// Diverse Initialisierungen, default ist AllAttributes
536 	aLbShademode.SelectEntryPos( 0 );
537 	aMtrMatSpecularIntensity.SetValue( 50 );
538 
539 	aBtnLight1.Check();
540 	ClickUpdateHdl( NULL );
541 
542 	// Nichts selektieren, um Fehler beim erstselektieren zu vermeiden
543 	aCtlLightPreview.GetSvx3DLightControl().SelectLight(0);
544 }
545 
546 bool Svx3DWin::GetUILightState( ImageButton& aBtn ) const
547 {
548 	return (aBtn.GetModeImage() == aImgLightOn) || (aBtn.GetModeImage() == mpImpl->maImgLightOnH);
549 }
550 
551 void Svx3DWin::SetUILightState( ImageButton& aBtn, bool bState )
552 {
553 	aBtn.SetModeImage( bState ? aImgLightOn : aImgLightOff );
554 	aBtn.SetModeImage( bState ? mpImpl->maImgLightOnH : mpImpl->maImgLightOffH, BMP_COLOR_HIGHCONTRAST );
555 }
556 
557 // -----------------------------------------------------------------------
558 void Svx3DWin::Update( SfxItemSet& rAttrs )
559 {
560 	// remember 2d attributes
561 	if(mpRemember2DAttributes)
562 		mpRemember2DAttributes->ClearItem();
563 	else
564 		mpRemember2DAttributes = new SfxItemSet(*rAttrs.GetPool(),
565 			SDRATTR_START, SDRATTR_SHADOW_LAST,
566 			SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
567 			0, 0);
568 
569 	SfxWhichIter aIter(*mpRemember2DAttributes);
570 	sal_uInt16 nWhich(aIter.FirstWhich());
571 
572 	while(nWhich)
573 	{
574 		SfxItemState eState = rAttrs.GetItemState(nWhich, sal_False);
575 		if(SFX_ITEM_DONTCARE == eState)
576 			mpRemember2DAttributes->InvalidateItem(nWhich);
577 		else if(SFX_ITEM_SET == eState)
578 			mpRemember2DAttributes->Put(rAttrs.Get(nWhich, sal_False));
579 
580 		nWhich = aIter.NextWhich();
581 	}
582 
583 	// construct field values
584 	const SfxPoolItem* pItem;
585 	//sal_Bool bUpdate = sal_False;
586 
587 	// evtl. PoolUnit ermitteln
588 	if( !mpImpl->pPool )
589 	{
590 		mpImpl->pPool = rAttrs.GetPool();
591 		DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
592 		ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
593 	}
594 	eFUnit = GetModuleFieldUnit( rAttrs );
595 
596 
597 // Segmentanzahl aenderbar ? und andere Stati
598 	SfxItemState eState = rAttrs.GetItemState( SID_ATTR_3D_INTERN, sal_False, &pItem );
599 	if( SFX_ITEM_SET == eState )
600 	{
601 		sal_uInt32 nState = ( ( const SfxUInt32Item* )pItem )->GetValue();
602 		//sal_Bool bLathe   = (sal_Bool) ( nState & 1 );
603 		sal_Bool bExtrude = (sal_Bool) ( nState & 2 );
604 		sal_Bool bSphere  = (sal_Bool) ( nState & 4 );
605 		sal_Bool bCube    = (sal_Bool) ( nState & 8 );
606 
607 		sal_Bool bChart = (sal_Bool) ( nState & 32 ); // Chart
608 
609 		if( !bChart )
610 		{
611 			// Bei Cube-Objekten werden keine Segmente eingestellt
612 			aFtHorizontal.Enable( !bCube );
613 			aNumHorizontal.Enable( !bCube );
614 			aFtVertical.Enable( !bCube );
615 			aNumVertical.Enable( !bCube );
616             aFLSegments.Enable( !bCube );
617 
618 			aFtPercentDiagonal.Enable( !bCube && !bSphere );
619 			aMtrPercentDiagonal.Enable( !bCube && !bSphere );
620 			aFtBackscale.Enable( !bCube && !bSphere );
621 			aMtrBackscale.Enable( !bCube && !bSphere );
622 			aFtDepth.Enable( !bCube && !bSphere );
623 			aMtrDepth.Enable( !bCube && !bSphere );
624 			if( bCube )
625 			{
626 				aNumHorizontal.SetEmptyFieldValue();
627 				aNumVertical.SetEmptyFieldValue();
628 			}
629 			if( bCube || bSphere )
630 			{
631 				aMtrPercentDiagonal.SetEmptyFieldValue();
632 				aMtrBackscale.SetEmptyFieldValue();
633 				aMtrDepth.SetEmptyFieldValue();
634 			}
635 
636 			// Nur bei Lathe-Objekten gibt es einen Endwinkel
637 			aFtEndAngle.Enable( !bExtrude && !bCube && !bSphere );
638 			aMtrEndAngle.Enable( !bExtrude && !bCube && !bSphere );
639 			if( bExtrude || bCube || bSphere )
640 				aMtrEndAngle.SetEmptyFieldValue();
641 		}
642 		else
643 		{
644 			// Geometrie
645 			aFtHorizontal.Enable( sal_False );
646 			aNumHorizontal.Enable( sal_False );
647 			aNumHorizontal.SetEmptyFieldValue();
648 			aFtVertical.Enable( sal_False );
649 			aNumVertical.Enable( sal_False );
650 			aNumVertical.SetEmptyFieldValue();
651             aFLSegments.Enable( sal_False );
652 			aFtEndAngle.Enable( sal_False );
653 			aMtrEndAngle.Enable( sal_False );
654 			aMtrEndAngle.SetEmptyFieldValue();
655 			aFtDepth.Enable( sal_False );
656 			aMtrDepth.Enable( sal_False );
657 			aMtrDepth.SetEmptyFieldValue();
658 
659 			// Darstellung
660 			aBtnShadow3d.Enable( sal_False );
661 			aFtSlant.Enable( sal_False );
662 			aMtrSlant.Enable( sal_False );
663             aFLShadow.Enable( sal_False );
664 
665 			aFtDistance.Enable( sal_False );
666 			aMtrDistance.Enable( sal_False );
667 			aMtrDistance.SetEmptyFieldValue();
668 			aFtFocalLeng.Enable( sal_False );
669 			aMtrFocalLength.Enable( sal_False );
670 			aMtrFocalLength.SetEmptyFieldValue();
671             aFLCamera.Enable( sal_False );
672 
673 			// Unterer Bereich
674 			aBtnConvertTo3D.Enable( sal_False );
675 			aBtnLatheObject.Enable( sal_False );
676 		}
677 	}
678 // Bitmapfuellung ? -> Status
679 	sal_Bool bBitmap(sal_False);
680 	eState = rAttrs.GetItemState(XATTR_FILLSTYLE);
681 	if(eState != SFX_ITEM_DONTCARE)
682 	{
683 		XFillStyle eXFS = (XFillStyle)((const XFillStyleItem&)rAttrs.Get(XATTR_FILLSTYLE)).GetValue();
684 		bBitmap = (eXFS == XFILL_BITMAP || eXFS == XFILL_GRADIENT || eXFS == XFILL_HATCH);
685 	}
686 
687 	aFtTexKind.Enable( bBitmap );
688 	aBtnTexLuminance.Enable( bBitmap );
689 	aBtnTexColor.Enable( bBitmap );
690 	aFtTexMode.Enable( bBitmap );
691 	aBtnTexReplace.Enable( bBitmap );
692 	aBtnTexModulate.Enable( bBitmap );
693 	aBtnTexBlend.Enable( bBitmap );
694 	aFtTexProjectionX.Enable( bBitmap );
695 	aBtnTexParallelX.Enable( bBitmap );
696 	aBtnTexCircleX.Enable( bBitmap );
697 	aBtnTexObjectX.Enable( bBitmap );
698 	aFtTexProjectionY.Enable( bBitmap );
699 	aBtnTexParallelY.Enable( bBitmap );
700 	aBtnTexCircleY.Enable( bBitmap );
701 	aBtnTexObjectY.Enable( bBitmap );
702 	aFtTexFilter.Enable( bBitmap );
703 	aBtnTexFilter.Enable( bBitmap );
704     aFLTexture.Enable( bBitmap );
705 
706 
707 // Geometrie
708 	// Anzahl Segmente (horizontal)
709 	if( aNumHorizontal.IsEnabled() )
710 	{
711 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_HORZ_SEGS);
712 		if(eState != SFX_ITEM_DONTCARE)
713 		{
714 			sal_uInt32 nValue = ((const Svx3DHorizontalSegmentsItem&)rAttrs.Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue();
715 			if(nValue != (sal_uInt32 )aNumHorizontal.GetValue())
716 			{
717 				aNumHorizontal.SetValue( nValue );
718 				// evtl. am Ende...
719 				// aCtlLightPreview.GetSvx3DLightControl().SetHorizontalSegments( (sal_uInt16)nValue );
720 				bUpdate = sal_True;
721 			}
722 			else if( aNumHorizontal.IsEmptyFieldValue() )
723 				aNumHorizontal.SetValue( nValue );
724 		}
725 		else
726 		{
727 			if( !aNumHorizontal.IsEmptyFieldValue() )
728 			{
729 				aNumHorizontal.SetEmptyFieldValue();
730 				bUpdate = sal_True;
731 			}
732 		}
733 	}
734 
735 	// Anzahl Segmente (vertikal)
736 	if( aNumVertical.IsEnabled() )
737 	{
738 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_VERT_SEGS);
739 		if( eState != SFX_ITEM_DONTCARE )
740 		{
741 			sal_uInt32 nValue = ((const Svx3DVerticalSegmentsItem&)rAttrs.Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue();
742 			if( nValue != (sal_uInt32) aNumVertical.GetValue() )
743 			{
744 				aNumVertical.SetValue( nValue );
745 				// evtl. am Ende...
746 				//aCtlLightPreview.GetSvx3DLightControl().SetVerticalSegments( (sal_uInt16)nValue );
747 				bUpdate = sal_True;
748 			}
749 			else if( aNumVertical.IsEmptyFieldValue() )
750 				aNumVertical.SetValue( nValue );
751 		}
752 		else
753 		{
754 			if( !aNumVertical.IsEmptyFieldValue() )
755 			{
756 				aNumVertical.SetEmptyFieldValue();
757 				bUpdate = sal_True;
758 			}
759 		}
760 	}
761 
762 	// Tiefe
763 	if( aMtrDepth.IsEnabled() )
764 	{
765 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DEPTH);
766 		if( eState != SFX_ITEM_DONTCARE )
767 		{
768 			sal_uInt32 nValue = ((const Svx3DDepthItem&)rAttrs.Get(SDRATTR_3DOBJ_DEPTH)).GetValue();
769 			sal_uInt32 nValue2 = GetCoreValue( aMtrDepth, ePoolUnit );
770 			if( nValue != nValue2 )
771 			{
772 				if( eFUnit != aMtrDepth.GetUnit() )
773 					SetFieldUnit( aMtrDepth, eFUnit );
774 
775 				SetMetricValue( aMtrDepth, nValue, ePoolUnit );
776 				bUpdate = sal_True;
777 			}
778 			else if( aMtrDepth.IsEmptyFieldValue() )
779 				aMtrDepth.SetValue( aMtrDepth.GetValue() );
780 		}
781 		else
782 		{
783 			if( !aMtrDepth.IsEmptyFieldValue() )
784 			{
785 				aMtrDepth.SetEmptyFieldValue();
786 				bUpdate = sal_True;
787 			}
788 		}
789 	}
790 
791 	// Doppelwandig/-seitig
792 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DOUBLE_SIDED);
793 	if( eState != SFX_ITEM_DONTCARE )
794 	{
795 		sal_Bool bValue = ((const Svx3DDoubleSidedItem&)rAttrs.Get(SDRATTR_3DOBJ_DOUBLE_SIDED)).GetValue();
796 		if( bValue != aBtnDoubleSided.IsChecked() )
797 		{
798 			aBtnDoubleSided.Check( bValue );
799 			bUpdate = sal_True;
800 		}
801 		else if( aBtnDoubleSided.GetState() == STATE_DONTKNOW )
802 			aBtnDoubleSided.Check( bValue );
803 	}
804 	else
805 	{
806 		if( aBtnDoubleSided.GetState() != STATE_DONTKNOW )
807 		{
808 			aBtnDoubleSided.SetState( STATE_DONTKNOW );
809 			bUpdate = sal_True;
810 		}
811 	}
812 
813 	// Kantenrundung
814 	if( aMtrPercentDiagonal.IsEnabled() )
815 	{
816 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_PERCENT_DIAGONAL);
817 		if( eState != SFX_ITEM_DONTCARE )
818 		{
819 			sal_uInt16 nValue = ((const Svx3DPercentDiagonalItem&)rAttrs.Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue();
820 			if( nValue != aMtrPercentDiagonal.GetValue() )
821 			{
822 				aMtrPercentDiagonal.SetValue( nValue );
823 				bUpdate = sal_True;
824 			}
825 			else if( aMtrPercentDiagonal.IsEmptyFieldValue() )
826 				aMtrPercentDiagonal.SetValue( nValue );
827 		}
828 		else
829 		{
830 			if( !aMtrPercentDiagonal.IsEmptyFieldValue() )
831 			{
832 				aMtrPercentDiagonal.SetEmptyFieldValue();
833 				bUpdate = sal_True;
834 			}
835 		}
836 	}
837 
838 	// Tiefenskalierung
839 	if( aMtrBackscale.IsEnabled() )
840 	{
841 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_BACKSCALE);
842 		if( eState != SFX_ITEM_DONTCARE )
843 		{
844 			sal_uInt16 nValue = ((const Svx3DBackscaleItem&)rAttrs.Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue();
845 			if( nValue != aMtrBackscale.GetValue() )
846 			{
847 				aMtrBackscale.SetValue( nValue );
848 				bUpdate = sal_True;
849 			}
850 			else if( aMtrBackscale.IsEmptyFieldValue() )
851 				aMtrBackscale.SetValue( nValue );
852 		}
853 		else
854 		{
855 			if( !aMtrBackscale.IsEmptyFieldValue() )
856 			{
857 				aMtrBackscale.SetEmptyFieldValue();
858 				bUpdate = sal_True;
859 			}
860 		}
861 	}
862 
863 	// Endwinkel
864 	if( aMtrEndAngle.IsEnabled() )
865 	{
866 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_END_ANGLE);
867 		if( eState != SFX_ITEM_DONTCARE )
868 		{
869 			sal_Int32 nValue = ((const Svx3DEndAngleItem&)rAttrs.Get(SDRATTR_3DOBJ_END_ANGLE)).GetValue();
870 			if( nValue != aMtrEndAngle.GetValue() )
871 			{
872 				aMtrEndAngle.SetValue( nValue );
873 				bUpdate = sal_True;
874 			}
875 		}
876 		else
877 		{
878 			if( !aMtrEndAngle.IsEmptyFieldValue() )
879 			{
880 				aMtrEndAngle.SetEmptyFieldValue();
881 				bUpdate = sal_True;
882 			}
883 		}
884 	}
885 
886 	// Normalentyp
887 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_KIND);
888 	if( eState != SFX_ITEM_DONTCARE )
889 	{
890 		sal_uInt16 nValue = ((const Svx3DNormalsKindItem&)rAttrs.Get(SDRATTR_3DOBJ_NORMALS_KIND)).GetValue();
891 
892 		if( ( !aBtnNormalsObj.IsChecked() && nValue == 0 ) ||
893 			( !aBtnNormalsFlat.IsChecked() && nValue == 1 ) ||
894 			( !aBtnNormalsSphere.IsChecked() && nValue == 2 ) )
895 		{
896 			aBtnNormalsObj.Check( nValue == 0 );
897 			aBtnNormalsFlat.Check( nValue == 1 );
898 			aBtnNormalsSphere.Check( nValue == 2 );
899 			bUpdate = sal_True;
900 		}
901 	}
902 	else
903 	{
904 		if( aBtnNormalsObj.IsChecked() ||
905 			aBtnNormalsFlat.IsChecked() ||
906 			aBtnNormalsSphere.IsChecked() )
907 		{
908 			aBtnNormalsObj.Check( sal_False );
909 			aBtnNormalsFlat.Check( sal_False );
910 			aBtnNormalsSphere.Check( sal_False );
911 			bUpdate = sal_True;
912 		}
913 	}
914 
915 	// Normalen invertieren
916 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_INVERT);
917 	if( eState != SFX_ITEM_DONTCARE )
918 	{
919 		sal_Bool bValue = ((const Svx3DNormalsInvertItem&)rAttrs.Get(SDRATTR_3DOBJ_NORMALS_INVERT)).GetValue();
920 		if( bValue != aBtnNormalsInvert.IsChecked() )
921 		{
922 			aBtnNormalsInvert.Check( bValue );
923 			bUpdate = sal_True;
924 		}
925 		else if( aBtnNormalsInvert.GetState() == STATE_DONTKNOW )
926 			aBtnNormalsInvert.Check( bValue );
927 	}
928 	else
929 	{
930 		if( aBtnNormalsInvert.GetState() != STATE_DONTKNOW )
931 		{
932 			aBtnNormalsInvert.SetState( STATE_DONTKNOW );
933 			bUpdate = sal_True;
934 		}
935 	}
936 
937 	// 2-seitige Beleuchtung
938 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING);
939 	if( eState != SFX_ITEM_DONTCARE )
940 	{
941 		sal_Bool bValue = ((const Svx3DTwoSidedLightingItem&)rAttrs.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue();
942 		if( bValue != aBtnTwoSidedLighting.IsChecked() )
943 		{
944 			aBtnTwoSidedLighting.Check( bValue );
945 			bUpdate = sal_True;
946 		}
947 		else if( aBtnTwoSidedLighting.GetState() == STATE_DONTKNOW )
948 			aBtnTwoSidedLighting.Check( bValue );
949 	}
950 	else
951 	{
952 		if( aBtnTwoSidedLighting.GetState() != STATE_DONTKNOW )
953 		{
954 			aBtnTwoSidedLighting.SetState( STATE_DONTKNOW );
955 			bUpdate = sal_True;
956 		}
957 	}
958 
959 // Darstellung
960 	// Shademode
961 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADE_MODE);
962 	if( eState != SFX_ITEM_DONTCARE )
963 	{
964 		sal_uInt16 nValue = ((const Svx3DShadeModeItem&)rAttrs.Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue();
965 		if( nValue != aLbShademode.GetSelectEntryPos() )
966 		{
967 			aLbShademode.SelectEntryPos( nValue );
968 			bUpdate = sal_True;
969 		}
970 	}
971 	else
972 	{
973 		if( aLbShademode.GetSelectEntryCount() != 0 )
974 		{
975 			aLbShademode.SetNoSelection();
976 			bUpdate = sal_True;
977 		}
978 	}
979 
980 	// 3D-Shatten
981 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_SHADOW_3D);
982 	if( eState != SFX_ITEM_DONTCARE )
983 	{
984 		sal_Bool bValue = ((const Svx3DShadow3DItem&)rAttrs.Get(SDRATTR_3DOBJ_SHADOW_3D)).GetValue();
985 		if( bValue != aBtnShadow3d.IsChecked() )
986 		{
987 			aBtnShadow3d.Check( bValue );
988 			aFtSlant.Enable( bValue );
989 			aMtrSlant.Enable( bValue );
990 			bUpdate = sal_True;
991 		}
992 		else if( aBtnShadow3d.GetState() == STATE_DONTKNOW )
993 			aBtnShadow3d.Check( bValue );
994 	}
995 	else
996 	{
997 		if( aBtnShadow3d.GetState() != STATE_DONTKNOW )
998 		{
999 			aBtnShadow3d.SetState( STATE_DONTKNOW );
1000 			bUpdate = sal_True;
1001 		}
1002 	}
1003 
1004 	// Neigung (Schatten)
1005 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADOW_SLANT);
1006 	if( eState != SFX_ITEM_DONTCARE )
1007 	{
1008 		sal_uInt16 nValue = ((const Svx3DShadowSlantItem&)rAttrs.Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue();
1009 		if( nValue != aMtrSlant.GetValue() )
1010 		{
1011 			aMtrSlant.SetValue( nValue );
1012 			bUpdate = sal_True;
1013 		}
1014 	}
1015 	else
1016 	{
1017 		if( !aMtrSlant.IsEmptyFieldValue() )
1018 		{
1019 			aMtrSlant.SetEmptyFieldValue();
1020 			bUpdate = sal_True;
1021 		}
1022 	}
1023 
1024 	// Distanz
1025 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_DISTANCE);
1026 	if( eState != SFX_ITEM_DONTCARE )
1027 	{
1028 		sal_uInt32 nValue = ((const Svx3DDistanceItem&)rAttrs.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
1029 		sal_uInt32 nValue2 = GetCoreValue( aMtrDistance, ePoolUnit );
1030 		if( nValue != nValue2 )
1031 		{
1032 			if( eFUnit != aMtrDistance.GetUnit() )
1033 				SetFieldUnit( aMtrDistance, eFUnit );
1034 
1035 			SetMetricValue( aMtrDistance, nValue, ePoolUnit );
1036 			bUpdate = sal_True;
1037 		}
1038 	}
1039 	else
1040 	{
1041 		if( !aMtrDepth.IsEmptyFieldValue() )
1042 		{
1043 			aMtrDepth.SetEmptyFieldValue();
1044 			bUpdate = sal_True;
1045 		}
1046 	}
1047 
1048 	// Brennweite
1049 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_FOCAL_LENGTH);
1050 	if( eState != SFX_ITEM_DONTCARE )
1051 	{
1052 		sal_uInt32 nValue = ((const Svx3DFocalLengthItem&)rAttrs.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
1053 		sal_uInt32 nValue2 = GetCoreValue( aMtrFocalLength, ePoolUnit );
1054 		if( nValue != nValue2 )
1055 		{
1056 			if( eFUnit != aMtrFocalLength.GetUnit() )
1057 				SetFieldUnit( aMtrFocalLength, eFUnit );
1058 
1059 			SetMetricValue( aMtrFocalLength, nValue, ePoolUnit );
1060 			bUpdate = sal_True;
1061 		}
1062 	}
1063 	else
1064 	{
1065 		if( !aMtrFocalLength.IsEmptyFieldValue() )
1066 		{
1067 			aMtrFocalLength.SetEmptyFieldValue();
1068 			bUpdate = sal_True;
1069 		}
1070 	}
1071 
1072 // Beleuchtung
1073 	Color aColor;
1074 	basegfx::B3DVector aVector;
1075 	// Licht 1 (Farbe)
1076 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_1);
1077 	if( eState != SFX_ITEM_DONTCARE )
1078 	{
1079 		aColor = ((const Svx3DLightcolor1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
1080 		ColorLB* pLb = &aLbLight1;
1081 		if( aColor != pLb->GetSelectEntryColor() )
1082 		{
1083 			LBSelectColor( pLb, aColor );
1084 			bUpdate = sal_True;
1085 		}
1086 	}
1087 	else
1088 	{
1089 		if( aLbLight1.GetSelectEntryCount() != 0 )
1090 		{
1091 			aLbLight1.SetNoSelection();
1092 			bUpdate = sal_True;
1093 		}
1094 	}
1095 	// Licht 1 (an/aus)
1096 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_1);
1097 	if( eState != SFX_ITEM_DONTCARE )
1098 	{
1099 		bool bOn = ((const Svx3DLightOnOff1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue() != 0;
1100 		if( ( bOn && !GetUILightState( aBtnLight1 )) ||
1101 			( !bOn && GetUILightState( aBtnLight1 )) )
1102 		{
1103 			SetUILightState( aBtnLight1, bOn );
1104 			bUpdate = sal_True;
1105 		}
1106 		if( aBtnLight1.GetState() == STATE_DONTKNOW )
1107 			aBtnLight1.Check( aBtnLight1.IsChecked() );
1108 	}
1109 	else
1110 	{
1111 		if( aBtnLight1.GetState() != STATE_DONTKNOW )
1112 		{
1113 			aBtnLight1.SetState( STATE_DONTKNOW );
1114 			bUpdate = sal_True;
1115 		}
1116 	}
1117 	// Licht 1 (Richtung)
1118 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_1);
1119 	if( eState != SFX_ITEM_DONTCARE )
1120 	{
1121 		bUpdate = sal_True;
1122 	}
1123 
1124 	// Licht 2 (Farbe)
1125 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_2);
1126 	if( eState != SFX_ITEM_DONTCARE )
1127 	{
1128 		aColor = ((const Svx3DLightcolor2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
1129 		ColorLB* pLb = &aLbLight2;
1130 		if( aColor != pLb->GetSelectEntryColor() )
1131 		{
1132 			LBSelectColor( pLb, aColor );
1133 			bUpdate = sal_True;
1134 		}
1135 	}
1136 	else
1137 	{
1138 		if( aLbLight2.GetSelectEntryCount() != 0 )
1139 		{
1140 			aLbLight2.SetNoSelection();
1141 			bUpdate = sal_True;
1142 		}
1143 	}
1144 	// Licht 2 (an/aus)
1145 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_2);
1146 	if( eState != SFX_ITEM_DONTCARE )
1147 	{
1148 		bool bOn = ((const Svx3DLightOnOff2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue() != 0;
1149 		if( ( bOn && !GetUILightState( aBtnLight2 )) ||
1150 			( !bOn && GetUILightState( aBtnLight2 )) )
1151 		{
1152 			SetUILightState( aBtnLight2, bOn );
1153 			bUpdate = sal_True;
1154 		}
1155 		if( aBtnLight2.GetState() == STATE_DONTKNOW )
1156 			aBtnLight2.Check( aBtnLight2.IsChecked() );
1157 	}
1158 	else
1159 	{
1160 		if( aBtnLight2.GetState() != STATE_DONTKNOW )
1161 		{
1162 			aBtnLight2.SetState( STATE_DONTKNOW );
1163 			bUpdate = sal_True;
1164 		}
1165 	}
1166 	// Licht 2 (Richtung)
1167 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_2);
1168 	if( eState != SFX_ITEM_DONTCARE )
1169 	{
1170 		bUpdate = sal_True;
1171 	}
1172 
1173 	// Licht 3 (Farbe)
1174 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_3);
1175 	if( eState != SFX_ITEM_DONTCARE )
1176 	{
1177 		aColor = ((const Svx3DLightcolor3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
1178 		ColorLB* pLb = &aLbLight3;
1179 		if( aColor != pLb->GetSelectEntryColor() )
1180 		{
1181 			LBSelectColor( pLb, aColor );
1182 			bUpdate = sal_True;
1183 		}
1184 	}
1185 	else
1186 	{
1187 		if( aLbLight3.GetSelectEntryCount() != 0 )
1188 		{
1189 			aLbLight3.SetNoSelection();
1190 			bUpdate = sal_True;
1191 		}
1192 	}
1193 	// Licht 3 (an/aus)
1194 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_3);
1195 	if( eState != SFX_ITEM_DONTCARE )
1196 	{
1197 		bool bOn = ((const Svx3DLightOnOff3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue() != 0;
1198 		if( ( bOn && !GetUILightState( aBtnLight3)) ||
1199 			( !bOn && GetUILightState( aBtnLight3)) )
1200 		{
1201 			SetUILightState( aBtnLight3, bOn );
1202 			bUpdate = sal_True;
1203 		}
1204 		if( aBtnLight3.GetState() == STATE_DONTKNOW )
1205 			aBtnLight3.Check( aBtnLight3.IsChecked() );
1206 	}
1207 	else
1208 	{
1209 		if( aBtnLight3.GetState() != STATE_DONTKNOW )
1210 		{
1211 			aBtnLight3.SetState( STATE_DONTKNOW );
1212 			bUpdate = sal_True;
1213 		}
1214 	}
1215 	// Licht 3 (Richtung)
1216 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_3);
1217 	if( eState != SFX_ITEM_DONTCARE )
1218 	{
1219 		bUpdate = sal_True;
1220 	}
1221 
1222 	// Licht 4 (Farbe)
1223 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_4);
1224 	if( eState != SFX_ITEM_DONTCARE )
1225 	{
1226 		aColor = ((const Svx3DLightcolor4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
1227 		ColorLB* pLb = &aLbLight4;
1228 		if( aColor != pLb->GetSelectEntryColor() )
1229 		{
1230 			LBSelectColor( pLb, aColor );
1231 			bUpdate = sal_True;
1232 		}
1233 	}
1234 	else
1235 	{
1236 		if( aLbLight4.GetSelectEntryCount() != 0 )
1237 		{
1238 			aLbLight4.SetNoSelection();
1239 			bUpdate = sal_True;
1240 		}
1241 	}
1242 	// Licht 4 (an/aus)
1243 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_4);
1244 	if( eState != SFX_ITEM_DONTCARE )
1245 	{
1246 		bool bOn = ((const Svx3DLightOnOff4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue() != 0;
1247 		if( ( bOn && !GetUILightState( aBtnLight4 )) ||
1248 			( !bOn && GetUILightState( aBtnLight4 )) )
1249 		{
1250 			SetUILightState( aBtnLight4, bOn );
1251 			bUpdate = sal_True;
1252 		}
1253 		if( aBtnLight4.GetState() == STATE_DONTKNOW )
1254 			aBtnLight4.Check( aBtnLight4.IsChecked() );
1255 	}
1256 	else
1257 	{
1258 		if( aBtnLight4.GetState() != STATE_DONTKNOW )
1259 		{
1260 			aBtnLight4.SetState( STATE_DONTKNOW );
1261 			bUpdate = sal_True;
1262 		}
1263 	}
1264 	// Licht 4 (Richtung)
1265 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_4);
1266 	if( eState != SFX_ITEM_DONTCARE )
1267 	{
1268 		bUpdate = sal_True;
1269 	}
1270 
1271 	// Licht 5 (Farbe)
1272 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_5);
1273 	if( eState != SFX_ITEM_DONTCARE )
1274 	{
1275 		aColor = ((const Svx3DLightcolor5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
1276 		ColorLB* pLb = &aLbLight5;
1277 		if( aColor != pLb->GetSelectEntryColor() )
1278 		{
1279 			LBSelectColor( pLb, aColor );
1280 			bUpdate = sal_True;
1281 		}
1282 	}
1283 	else
1284 	{
1285 		if( aLbLight5.GetSelectEntryCount() != 0 )
1286 		{
1287 			aLbLight5.SetNoSelection();
1288 			bUpdate = sal_True;
1289 		}
1290 	}
1291 	// Licht 5 (an/aus)
1292 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_5);
1293 	if( eState != SFX_ITEM_DONTCARE )
1294 	{
1295 		bool bOn = ((const Svx3DLightOnOff5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue() != 0;
1296 		if( ( bOn && !GetUILightState( aBtnLight5 )) ||
1297 			( !bOn && GetUILightState( aBtnLight5 )) )
1298 		{
1299 			SetUILightState( aBtnLight5, bOn );
1300 			bUpdate = sal_True;
1301 		}
1302 		if( aBtnLight5.GetState() == STATE_DONTKNOW )
1303 			aBtnLight5.Check( aBtnLight5.IsChecked() );
1304 	}
1305 	else
1306 	{
1307 		if( aBtnLight5.GetState() != STATE_DONTKNOW )
1308 		{
1309 			aBtnLight5.SetState( STATE_DONTKNOW );
1310 			bUpdate = sal_True;
1311 		}
1312 	}
1313 	// Licht 5 (Richtung)
1314 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_5);
1315 	if( eState != SFX_ITEM_DONTCARE )
1316 	{
1317 		bUpdate = sal_True;
1318 	}
1319 
1320 	// Licht 6 (Farbe)
1321 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_6);
1322 	if( eState != SFX_ITEM_DONTCARE )
1323 	{
1324 		aColor = ((const Svx3DLightcolor6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
1325 		ColorLB* pLb = &aLbLight6;
1326 		if( aColor != pLb->GetSelectEntryColor() )
1327 		{
1328 			LBSelectColor( pLb, aColor );
1329 			bUpdate = sal_True;
1330 		}
1331 	}
1332 	else
1333 	{
1334 		if( aLbLight6.GetSelectEntryCount() != 0 )
1335 		{
1336 			aLbLight6.SetNoSelection();
1337 			bUpdate = sal_True;
1338 		}
1339 	}
1340 	// Licht 6 (an/aus)
1341 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_6);
1342 	if( eState != SFX_ITEM_DONTCARE )
1343 	{
1344 		bool bOn = ((const Svx3DLightOnOff6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue() != 0;
1345 		if( ( bOn && !GetUILightState( aBtnLight6 )) ||
1346 			( !bOn && GetUILightState( aBtnLight6 )) )
1347 		{
1348 			SetUILightState( aBtnLight6, bOn );
1349 			bUpdate = sal_True;
1350 		}
1351 		if( aBtnLight6.GetState() == STATE_DONTKNOW )
1352 			aBtnLight6.Check( aBtnLight6.IsChecked() );
1353 	}
1354 	else
1355 	{
1356 		if( aBtnLight6.GetState() != STATE_DONTKNOW )
1357 		{
1358 			aBtnLight6.SetState( STATE_DONTKNOW );
1359 			bUpdate = sal_True;
1360 		}
1361 	}
1362 	// Licht 6 (Richtung)
1363 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_6);
1364 	if( eState != SFX_ITEM_DONTCARE )
1365 	{
1366 		bUpdate = sal_True;
1367 	}
1368 
1369 	// Licht 7 (Farbe)
1370 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_7);
1371 	if( eState != SFX_ITEM_DONTCARE )
1372 	{
1373 		aColor = ((const Svx3DLightcolor7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
1374 		ColorLB* pLb = &aLbLight7;
1375 		if( aColor != pLb->GetSelectEntryColor() )
1376 		{
1377 			LBSelectColor( pLb, aColor );
1378 			bUpdate = sal_True;
1379 		}
1380 	}
1381 	else
1382 	{
1383 		if( aLbLight7.GetSelectEntryCount() != 0 )
1384 		{
1385 			aLbLight7.SetNoSelection();
1386 			bUpdate = sal_True;
1387 		}
1388 	}
1389 	// Licht 7 (an/aus)
1390 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_7);
1391 	if( eState != SFX_ITEM_DONTCARE )
1392 	{
1393 		bool bOn = ((const Svx3DLightOnOff7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue() != 0;
1394 		if( ( bOn && !GetUILightState( aBtnLight7 )) ||
1395 			( !bOn && GetUILightState( aBtnLight7 )) )
1396 		{
1397 			SetUILightState( aBtnLight7	, bOn );
1398 			bUpdate = sal_True;
1399 		}
1400 		if( aBtnLight7.GetState() == STATE_DONTKNOW )
1401 			aBtnLight7.Check( aBtnLight7.IsChecked() );
1402 	}
1403 	else
1404 	{
1405 		if( aBtnLight7.GetState() != STATE_DONTKNOW )
1406 		{
1407 			aBtnLight7.SetState( STATE_DONTKNOW );
1408 			bUpdate = sal_True;
1409 		}
1410 	}
1411 	// Licht 7 (Richtung)
1412 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_7);
1413 	if( eState != SFX_ITEM_DONTCARE )
1414 	{
1415 		bUpdate = sal_True;
1416 	}
1417 
1418 	// Licht 8 (Farbe)
1419 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_8);
1420 	if( eState != SFX_ITEM_DONTCARE )
1421 	{
1422 		aColor = ((const Svx3DLightcolor8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
1423 		ColorLB* pLb = &aLbLight8;
1424 		if( aColor != pLb->GetSelectEntryColor() )
1425 		{
1426 			LBSelectColor( pLb, aColor );
1427 			bUpdate = sal_True;
1428 		}
1429 	}
1430 	else
1431 	{
1432 		if( aLbLight8.GetSelectEntryCount() != 0 )
1433 		{
1434 			aLbLight8.SetNoSelection();
1435 			bUpdate = sal_True;
1436 		}
1437 	}
1438 	// Licht 8 (an/aus)
1439 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_8);
1440 	if( eState != SFX_ITEM_DONTCARE )
1441 	{
1442 		bool bOn = ((const Svx3DLightOnOff8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue() != 0;
1443 		if( ( bOn && !GetUILightState( aBtnLight8 )) ||
1444 			( !bOn && GetUILightState( aBtnLight8 )) )
1445 		{
1446 			SetUILightState( aBtnLight8, bOn );
1447 			bUpdate = sal_True;
1448 		}
1449 		if( aBtnLight8.GetState() == STATE_DONTKNOW )
1450 			aBtnLight8.Check( aBtnLight8.IsChecked() );
1451 	}
1452 	else
1453 	{
1454 		if( aBtnLight8.GetState() != STATE_DONTKNOW )
1455 		{
1456 			aBtnLight8.SetState( STATE_DONTKNOW );
1457 			bUpdate = sal_True;
1458 		}
1459 	}
1460 	// Licht 8 (Richtung)
1461 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_8);
1462 	if( eState != SFX_ITEM_DONTCARE )
1463 	{
1464 		bUpdate = sal_True;
1465 	}
1466 
1467 	// Umgebungslicht
1468 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_AMBIENTCOLOR);
1469 	if( eState != SFX_ITEM_DONTCARE )
1470 	{
1471 		aColor = ((const Svx3DAmbientcolorItem&)rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue();
1472 		ColorLB* pLb = &aLbAmbientlight;
1473 		if( aColor != pLb->GetSelectEntryColor() )
1474 		{
1475 			LBSelectColor( pLb, aColor );
1476 			bUpdate = sal_True;
1477 		}
1478 	}
1479 	else
1480 	{
1481 		if( aLbAmbientlight.GetSelectEntryCount() != 0 )
1482 		{
1483 			aLbAmbientlight.SetNoSelection();
1484 			bUpdate = sal_True;
1485 		}
1486 	}
1487 
1488 
1489 // Texturen
1490 	// Art
1491 	if( bBitmap )
1492 	{
1493 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_KIND);
1494 		if( eState != SFX_ITEM_DONTCARE )
1495 		{
1496 			sal_uInt16 nValue = ((const Svx3DTextureKindItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_KIND)).GetValue();
1497 
1498 			if( ( !aBtnTexLuminance.IsChecked() && nValue == 1 ) ||
1499 				( !aBtnTexColor.IsChecked() && nValue == 3 ) )
1500 			{
1501 				aBtnTexLuminance.Check( nValue == 1 );
1502 				aBtnTexColor.Check( nValue == 3 );
1503 				bUpdate = sal_True;
1504 			}
1505 		}
1506 		else
1507 		{
1508 			if( aBtnTexLuminance.IsChecked() ||
1509 				aBtnTexColor.IsChecked() )
1510 			{
1511 				aBtnTexLuminance.Check( sal_False );
1512 				aBtnTexColor.Check( sal_False );
1513 				bUpdate = sal_True;
1514 			}
1515 		}
1516 
1517 		// Modus
1518 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_MODE);
1519 		if( eState != SFX_ITEM_DONTCARE )
1520 		{
1521 			sal_uInt16 nValue = ((const Svx3DTextureModeItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_MODE)).GetValue();
1522 
1523 			if( ( !aBtnTexReplace.IsChecked() && nValue == 1 ) ||
1524 				( !aBtnTexModulate.IsChecked() && nValue == 2 ) )
1525 			{
1526 				aBtnTexReplace.Check( nValue == 1 );
1527 				aBtnTexModulate.Check( nValue == 2 );
1528 				//aBtnTexBlend.Check( nValue == 2 );
1529 				bUpdate = sal_True;
1530 			}
1531 		}
1532 		else
1533 		{
1534 			if( aBtnTexReplace.IsChecked() ||
1535 				aBtnTexModulate.IsChecked() )
1536 			{
1537 				aBtnTexReplace.Check( sal_False );
1538 				aBtnTexModulate.Check( sal_False );
1539 				//aBtnTexBlend.Check( sal_False );
1540 				bUpdate = sal_True;
1541 			}
1542 		}
1543 
1544 		// Projektion X
1545 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
1546 		if( eState != SFX_ITEM_DONTCARE )
1547 		{
1548 			sal_uInt16 nValue = ((const Svx3DTextureProjectionXItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X)).GetValue();
1549 
1550 			if( ( !aBtnTexObjectX.IsChecked() && nValue == 0 ) ||
1551 				( !aBtnTexParallelX.IsChecked() && nValue == 1 ) ||
1552 				( !aBtnTexCircleX.IsChecked() && nValue == 2 ) )
1553 			{
1554 				aBtnTexObjectX.Check( nValue == 0 );
1555 				aBtnTexParallelX.Check( nValue == 1 );
1556 				aBtnTexCircleX.Check( nValue == 2 );
1557 				bUpdate = sal_True;
1558 			}
1559 		}
1560 		else
1561 		{
1562 			if( aBtnTexObjectX.IsChecked() ||
1563 				aBtnTexParallelX.IsChecked() ||
1564 				aBtnTexCircleX.IsChecked() )
1565 			{
1566 				aBtnTexObjectX.Check( sal_False );
1567 				aBtnTexParallelX.Check( sal_False );
1568 				aBtnTexCircleX.Check( sal_False );
1569 				bUpdate = sal_True;
1570 			}
1571 		}
1572 
1573 		// Projektion Y
1574 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
1575 		if( eState != SFX_ITEM_DONTCARE )
1576 		{
1577 			sal_uInt16 nValue = ((const Svx3DTextureProjectionYItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y)).GetValue();
1578 
1579 			if( ( !aBtnTexObjectY.IsChecked() && nValue == 0 ) ||
1580 				( !aBtnTexParallelY.IsChecked() && nValue == 1 ) ||
1581 				( !aBtnTexCircleY.IsChecked() && nValue == 2 ) )
1582 			{
1583 				aBtnTexObjectY.Check( nValue == 0 );
1584 				aBtnTexParallelY.Check( nValue == 1 );
1585 				aBtnTexCircleY.Check( nValue == 2 );
1586 				bUpdate = sal_True;
1587 			}
1588 		}
1589 		else
1590 		{
1591 			if( aBtnTexObjectY.IsChecked() ||
1592 				aBtnTexParallelY.IsChecked() ||
1593 				aBtnTexCircleY.IsChecked() )
1594 			{
1595 				aBtnTexObjectY.Check( sal_False );
1596 				aBtnTexParallelY.Check( sal_False );
1597 				aBtnTexCircleY.Check( sal_False );
1598 				bUpdate = sal_True;
1599 			}
1600 		}
1601 
1602 		// Filter
1603 		eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_FILTER);
1604 		if( eState != SFX_ITEM_DONTCARE )
1605 		{
1606 			sal_Bool bValue = ((const Svx3DTextureFilterItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_FILTER)).GetValue();
1607 			if( bValue != aBtnTexFilter.IsChecked() )
1608 			{
1609 				aBtnTexFilter.Check( bValue );
1610 				bUpdate = sal_True;
1611 			}
1612 			if( aBtnTexFilter.GetState() == STATE_DONTKNOW )
1613 				aBtnTexFilter.Check( bValue );
1614 		}
1615 		else
1616 		{
1617 			if( aBtnTexFilter.GetState() != STATE_DONTKNOW )
1618 			{
1619 				aBtnTexFilter.SetState( STATE_DONTKNOW );
1620 				bUpdate = sal_True;
1621 			}
1622 		}
1623 	}
1624 
1625 
1626 	// Material Favoriten
1627 	aLbMatFavorites.SelectEntryPos( 0 );
1628 
1629 	// Objektfarbe
1630 	eState = rAttrs.GetItemState(XATTR_FILLCOLOR);
1631 	if( eState != SFX_ITEM_DONTCARE )
1632 	{
1633 		aColor = ((const XFillColorItem&)rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue();
1634 		ColorLB* pLb = &aLbMatColor;
1635 		if( aColor != pLb->GetSelectEntryColor() )
1636 		{
1637 			LBSelectColor( pLb, aColor );
1638 			bUpdate = sal_True;
1639 		}
1640 	}
1641 	else
1642 	{
1643 		if( aLbMatColor.GetSelectEntryCount() != 0 )
1644 		{
1645 			aLbMatColor.SetNoSelection();
1646 			bUpdate = sal_True;
1647 		}
1648 	}
1649 
1650 	// Slebstleuchtfarbe
1651 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_EMISSION);
1652 	if( eState != SFX_ITEM_DONTCARE )
1653 	{
1654 		aColor = ((const Svx3DMaterialEmissionItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue();
1655 		ColorLB* pLb = &aLbMatEmission;
1656 		if( aColor != pLb->GetSelectEntryColor() )
1657 		{
1658 			LBSelectColor( pLb, aColor );
1659 			bUpdate = sal_True;
1660 		}
1661 	}
1662 	else
1663 	{
1664 		if( aLbMatEmission.GetSelectEntryCount() != 0 )
1665 		{
1666 			aLbMatEmission.SetNoSelection();
1667 			bUpdate = sal_True;
1668 		}
1669 	}
1670 
1671 	// Glanzpunkt
1672 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR);
1673 	if( eState != SFX_ITEM_DONTCARE )
1674 	{
1675 		aColor = ((const Svx3DMaterialSpecularItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue();
1676 		ColorLB* pLb = &aLbMatSpecular;
1677 		if( aColor != pLb->GetSelectEntryColor() )
1678 		{
1679 			LBSelectColor( pLb, aColor );
1680 			bUpdate = sal_True;
1681 		}
1682 	}
1683 	else
1684 	{
1685 		if( aLbMatSpecular.GetSelectEntryCount() != 0 )
1686 		{
1687 			aLbMatSpecular.SetNoSelection();
1688 			bUpdate = sal_True;
1689 		}
1690 	}
1691 
1692 	// Glanzpunkt Intensitaet
1693 	eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY);
1694 	if( eState != SFX_ITEM_DONTCARE )
1695 	{
1696 		sal_uInt16 nValue = ((const Svx3DMaterialSpecularIntensityItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue();
1697 		if( nValue != aMtrMatSpecularIntensity.GetValue() )
1698 		{
1699 			aMtrMatSpecularIntensity.SetValue( nValue );
1700 			bUpdate = sal_True;
1701 		}
1702 	}
1703 	else
1704 	{
1705 		if( !aMtrMatSpecularIntensity.IsEmptyFieldValue() )
1706 		{
1707 			aMtrMatSpecularIntensity.SetEmptyFieldValue();
1708 			bUpdate = sal_True;
1709 		}
1710 	}
1711 
1712 
1713 // Sonstige
1714 	// Perspektive
1715 	eState = rAttrs.GetItemState(SDRATTR_3DSCENE_PERSPECTIVE);
1716 	if( eState != SFX_ITEM_DONTCARE )
1717 	{
1718 		ProjectionType ePT = (ProjectionType)((const Svx3DPerspectiveItem&)rAttrs.Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue();
1719 		if( ( !aBtnPerspective.IsChecked() && ePT == PR_PERSPECTIVE ) ||
1720 			( aBtnPerspective.IsChecked() && ePT == PR_PARALLEL ) )
1721 		{
1722 			aBtnPerspective.Check( ePT == PR_PERSPECTIVE );
1723 			bUpdate = sal_True;
1724 		}
1725 		if( aBtnPerspective.GetState() == STATE_DONTKNOW )
1726 			aBtnPerspective.Check( ePT == PR_PERSPECTIVE );
1727 	}
1728 	else
1729 	{
1730 		if( aBtnPerspective.GetState() != STATE_DONTKNOW )
1731 		{
1732 			aBtnPerspective.SetState( STATE_DONTKNOW );
1733 			bUpdate = sal_True;
1734 		}
1735 	}
1736 
1737 	if( !bUpdate && !bOnly3DChanged )
1738 	{
1739 		// Eventuell sind aber die 2D-Attribute unterschiedlich. Vergleiche
1740 		// diese und entscheide
1741 
1742 
1743 		bUpdate = sal_True;
1744 	}
1745 
1746 	if( bUpdate || bOnly3DChanged )
1747 	{
1748 		// Preview updaten
1749 		SfxItemSet aSet(rAttrs);
1750 
1751 		// set LineStyle hard to XLINE_NONE when it's not set so that
1752 		// the default (XLINE_SOLID) is not used for 3d preview
1753 		if(SFX_ITEM_SET != aSet.GetItemState(XATTR_LINESTYLE, sal_False))
1754 			aSet.Put(XLineStyleItem(XLINE_NONE));
1755 
1756 		// set FillColor hard to WHITE when it's SFX_ITEM_DONTCARE so that
1757 		// the default (Blue7) is not used for 3d preview
1758 		if(SFX_ITEM_DONTCARE == aSet.GetItemState(XATTR_FILLCOLOR, sal_False))
1759 			aSet.Put(XFillColorItem(String(), Color(COL_WHITE)));
1760 
1761 		aCtlPreview.Set3DAttributes(aSet);
1762 		aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aSet);
1763 
1764         // try to select light corresponding to active button
1765         sal_uInt32 nNumber(0xffffffff);
1766 
1767         if(aBtnLight1.IsChecked())
1768             nNumber = 0;
1769         else if(aBtnLight2.IsChecked())
1770             nNumber = 1;
1771         else if(aBtnLight3.IsChecked())
1772             nNumber = 2;
1773         else if(aBtnLight4.IsChecked())
1774             nNumber = 3;
1775         else if(aBtnLight5.IsChecked())
1776             nNumber = 4;
1777         else if(aBtnLight6.IsChecked())
1778             nNumber = 5;
1779         else if(aBtnLight7.IsChecked())
1780             nNumber = 6;
1781         else if(aBtnLight8.IsChecked())
1782             nNumber = 7;
1783 
1784         if(nNumber != 0xffffffff)
1785         {
1786     		aCtlLightPreview.GetSvx3DLightControl().SelectLight(nNumber);
1787         }
1788 	}
1789 
1790 	// handle state of converts possible
1791 	aBtnConvertTo3D.Enable(pConvertTo3DItem->GetState());
1792 	aBtnLatheObject.Enable(pConvertTo3DLatheItem->GetState());
1793 }
1794 
1795 // -----------------------------------------------------------------------
1796 void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
1797 {
1798 	// get remembered 2d attributes from the dialog
1799 	if(mpRemember2DAttributes)
1800 	{
1801 		SfxWhichIter aIter(*mpRemember2DAttributes);
1802 		sal_uInt16 nWhich(aIter.FirstWhich());
1803 
1804 		while(nWhich)
1805 		{
1806 			SfxItemState eState = mpRemember2DAttributes->GetItemState(nWhich, sal_False);
1807 			if(SFX_ITEM_DONTCARE == eState)
1808 				rAttrs.InvalidateItem(nWhich);
1809 			else if(SFX_ITEM_SET == eState)
1810 				rAttrs.Put(mpRemember2DAttributes->Get(nWhich, sal_False));
1811 
1812 			nWhich = aIter.NextWhich();
1813 		}
1814 	}
1815 
1816 // Sonstige, muss vorne stehen da auf allen Seiten
1817 	// Perspektive
1818 	if( aBtnPerspective.GetState() != STATE_DONTKNOW )
1819 	{
1820 		sal_uInt16 nValue;
1821 		if( aBtnPerspective.IsChecked() )
1822 			nValue = PR_PERSPECTIVE;
1823 		else
1824 			nValue = PR_PARALLEL;
1825 		rAttrs.Put(Svx3DPerspectiveItem(nValue));
1826 	}
1827 	else
1828 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_PERSPECTIVE);
1829 
1830 // Geometrie
1831 	// evtl. PoolUnit ermitteln (Falls dies in Update() nicht passiert ist)
1832 	if( !mpImpl->pPool )
1833 	{
1834 		DBG_ERROR( "Kein Pool in GetAttr()! Evtl. inkompatibel zu drviewsi.cxx ?" );
1835 		mpImpl->pPool = rAttrs.GetPool();
1836 		DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
1837 		ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
1838 
1839 		eFUnit = GetModuleFieldUnit( rAttrs );
1840 	}
1841 
1842 	// Anzahl Segmente (horizontal)
1843 	if( !aNumHorizontal.IsEmptyFieldValue() )
1844 	{
1845 		sal_uInt32 nValue = static_cast<sal_uInt32>(aNumHorizontal.GetValue());
1846 		rAttrs.Put(Svx3DHorizontalSegmentsItem(nValue));
1847 	}
1848 	else
1849 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_HORZ_SEGS);
1850 
1851 	// Anzahl Segmente (vertikal)
1852 	if( !aNumVertical.IsEmptyFieldValue() )
1853 	{
1854 		sal_uInt32 nValue = static_cast<sal_uInt32>(aNumVertical.GetValue());
1855 		rAttrs.Put(Svx3DVerticalSegmentsItem(nValue));
1856 	}
1857 	else
1858 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_VERT_SEGS);
1859 
1860 	// Tiefe
1861 	if( !aMtrDepth.IsEmptyFieldValue() )
1862 	{
1863 		sal_uInt32 nValue = GetCoreValue( aMtrDepth, ePoolUnit );
1864 		rAttrs.Put(Svx3DDepthItem(nValue));
1865 	}
1866 	else
1867 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_DEPTH);
1868 
1869 	// Doppelseitig
1870 	TriState eState = aBtnDoubleSided.GetState();
1871 	if( eState != STATE_DONTKNOW )
1872 	{
1873 		sal_Bool bValue = STATE_CHECK == eState;
1874 		rAttrs.Put(Svx3DDoubleSidedItem(bValue));
1875 	}
1876 	else
1877 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_DOUBLE_SIDED);
1878 
1879 	// Kantenrundung
1880 	if( !aMtrPercentDiagonal.IsEmptyFieldValue() )
1881 	{
1882 		sal_uInt16 nValue = (sal_uInt16) aMtrPercentDiagonal.GetValue();
1883 		rAttrs.Put(Svx3DPercentDiagonalItem(nValue));
1884 	}
1885 	else
1886 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_PERCENT_DIAGONAL);
1887 
1888 	// Tiefenskalierung
1889 	if( !aMtrBackscale.IsEmptyFieldValue() )
1890 	{
1891 		sal_uInt16 nValue = (sal_uInt16)aMtrBackscale.GetValue();
1892 		rAttrs.Put(Svx3DBackscaleItem(nValue));
1893 	}
1894 	else
1895 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_BACKSCALE);
1896 
1897 	// Endwinkel
1898 	if( !aMtrEndAngle.IsEmptyFieldValue() )
1899 	{
1900 		sal_uInt16 nValue = (sal_uInt16)aMtrEndAngle.GetValue();
1901 		rAttrs.Put(Svx3DEndAngleItem(nValue));
1902 	}
1903 	else
1904 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_END_ANGLE);
1905 
1906 	// Normalentyp
1907 	sal_uInt16 nValue = 99;
1908 	if( aBtnNormalsObj.IsChecked() )
1909 		nValue = 0;
1910 	else if( aBtnNormalsFlat.IsChecked() )
1911 		nValue = 1;
1912 	else if( aBtnNormalsSphere.IsChecked() )
1913 		nValue = 2;
1914 
1915 	if( nValue <= 2 )
1916 		rAttrs.Put(Svx3DNormalsKindItem(nValue));
1917 	else
1918 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_NORMALS_KIND);
1919 
1920 	// Normalen invertieren
1921 	eState = aBtnNormalsInvert.GetState();
1922 	if( eState != STATE_DONTKNOW )
1923 	{
1924 		sal_Bool bValue = STATE_CHECK == eState;
1925 		rAttrs.Put(Svx3DNormalsInvertItem(bValue));
1926 	}
1927 	else
1928 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_NORMALS_INVERT);
1929 
1930 	// 2-seitige Beleuchtung
1931 	eState = aBtnTwoSidedLighting.GetState();
1932 	if( eState != STATE_DONTKNOW )
1933 	{
1934 		sal_Bool bValue = STATE_CHECK == eState;
1935 		rAttrs.Put(Svx3DTwoSidedLightingItem(bValue));
1936 	}
1937 	else
1938 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING);
1939 
1940 // Darstellung
1941 	// Shademode
1942 	if( aLbShademode.GetSelectEntryCount() )
1943 	{
1944 		nValue = aLbShademode.GetSelectEntryPos();
1945 		rAttrs.Put(Svx3DShadeModeItem(nValue));
1946 	}
1947 	else
1948 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_SHADE_MODE);
1949 
1950 	// 3D-Shatten
1951 	eState = aBtnShadow3d.GetState();
1952 	if( eState != STATE_DONTKNOW )
1953 	{
1954 		sal_Bool bValue = STATE_CHECK == eState;
1955 		rAttrs.Put(Svx3DShadow3DItem(bValue));
1956 		rAttrs.Put(SdrShadowItem(bValue));
1957 	}
1958 	else
1959 	{
1960 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_SHADOW_3D);
1961 		rAttrs.InvalidateItem(SDRATTR_SHADOW);
1962 	}
1963 
1964 	// Neigung (Schatten)
1965 	if( !aMtrSlant.IsEmptyFieldValue() )
1966 	{
1967 		sal_uInt16 nValue2 = (sal_uInt16) aMtrSlant.GetValue();
1968 		rAttrs.Put(Svx3DShadowSlantItem(nValue2));
1969 	}
1970 	else
1971 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_SHADOW_SLANT);
1972 
1973 	// Distanz
1974 	if( !aMtrDistance.IsEmptyFieldValue() )
1975 	{
1976 		sal_uInt32 nValue2 = GetCoreValue( aMtrDistance, ePoolUnit );
1977 		rAttrs.Put(Svx3DDistanceItem(nValue2));
1978 	}
1979 	else
1980 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_DISTANCE);
1981 
1982 	// Brennweite
1983 	if( !aMtrFocalLength.IsEmptyFieldValue() )
1984 	{
1985 		sal_uInt32 nValue2 = GetCoreValue( aMtrFocalLength, ePoolUnit );
1986 		rAttrs.Put(Svx3DFocalLengthItem(nValue2));
1987 	}
1988 	else
1989 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
1990 
1991 // Beleuchtung
1992 	Image aImg;
1993 	basegfx::B3DVector aVector;
1994 	Color aColor;
1995     const SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
1996 
1997     // Licht 1 Farbe
1998 	if( aLbLight1.GetSelectEntryCount() )
1999 	{
2000 		aColor = aLbLight1.GetSelectEntryColor();
2001 		rAttrs.Put(Svx3DLightcolor1Item(aColor));
2002 	}
2003 	else
2004 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_1);
2005 	// Licht 1 (an/aus)
2006 	eState = aBtnLight1.GetState();
2007 	if( eState != STATE_DONTKNOW )
2008 	{
2009 		sal_Bool bValue = GetUILightState( aBtnLight1 );
2010 		rAttrs.Put(Svx3DLightOnOff1Item(bValue));
2011 
2012 		// Licht 1 (Richtung)
2013 		if( bValue )
2014 		{
2015             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1));
2016 		}
2017 	}
2018 	else
2019 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_1);
2020 
2021 
2022 	// Licht 2 Farbe
2023 	if( aLbLight2.GetSelectEntryCount() )
2024 	{
2025 		aColor = aLbLight2.GetSelectEntryColor();
2026 		rAttrs.Put(Svx3DLightcolor2Item(aColor));
2027 	}
2028 	else
2029 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_2);
2030 	// Licht 2 (an/aus)
2031 	eState = aBtnLight2.GetState();
2032 	if( eState != STATE_DONTKNOW )
2033 	{
2034 		sal_Bool bValue = GetUILightState( aBtnLight2 );
2035 		rAttrs.Put(Svx3DLightOnOff2Item(bValue));
2036 
2037 		// Licht 2 (Richtung)
2038 		if( bValue )
2039 		{
2040             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2));
2041 		}
2042 	}
2043 	else
2044 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2);
2045 
2046 	// Licht 3 Farbe
2047 	if( aLbLight3.GetSelectEntryCount() )
2048 	{
2049 		aColor = aLbLight3.GetSelectEntryColor();
2050 		rAttrs.Put(Svx3DLightcolor3Item(aColor));
2051 	}
2052 	else
2053 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_3);
2054 	// Licht 3 (an/aus)
2055 	eState = aBtnLight3.GetState();
2056 	if( eState != STATE_DONTKNOW )
2057 	{
2058 		sal_Bool bValue = GetUILightState( aBtnLight3 );
2059 		rAttrs.Put(Svx3DLightOnOff3Item(bValue));
2060 
2061 		// Licht 3 (Richtung)
2062 		if( bValue )
2063 		{
2064             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3));
2065 		}
2066 	}
2067 	else
2068 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3);
2069 
2070 	// Licht 4 Farbe
2071 	if( aLbLight4.GetSelectEntryCount() )
2072 	{
2073 		aColor = aLbLight4.GetSelectEntryColor();
2074 		rAttrs.Put(Svx3DLightcolor4Item(aColor));
2075 	}
2076 	else
2077 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_4);
2078 	// Licht 4 (an/aus)
2079 	eState = aBtnLight4.GetState();
2080 	if( eState != STATE_DONTKNOW )
2081 	{
2082 		sal_Bool bValue = GetUILightState( aBtnLight4 );
2083 		rAttrs.Put(Svx3DLightOnOff4Item(bValue));
2084 
2085 		// Licht 4 (Richtung)
2086 		if( bValue )
2087 		{
2088             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4));
2089 		}
2090 	}
2091 	else
2092 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4);
2093 
2094 	// Licht 5 Farbe
2095 	if( aLbLight5.GetSelectEntryCount() )
2096 	{
2097 		aColor = aLbLight5.GetSelectEntryColor();
2098 		rAttrs.Put(Svx3DLightcolor5Item(aColor));
2099 	}
2100 	else
2101 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_5);
2102 	// Licht 5 (an/aus)
2103 	eState = aBtnLight5.GetState();
2104 	if( eState != STATE_DONTKNOW )
2105 	{
2106 		sal_Bool bValue = GetUILightState( aBtnLight5 );
2107 		rAttrs.Put(Svx3DLightOnOff5Item(bValue));
2108 
2109 		// Licht 5 (Richtung)
2110 		if( bValue )
2111 		{
2112             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5));
2113 		}
2114 	}
2115 	else
2116 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5);
2117 
2118 	// Licht 6 Farbe
2119 	if( aLbLight6.GetSelectEntryCount() )
2120 	{
2121 		aColor = aLbLight6.GetSelectEntryColor();
2122 		rAttrs.Put(Svx3DLightcolor6Item(aColor));
2123 	}
2124 	else
2125 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_6);
2126 	// Licht 6 (an/aus)
2127 	eState = aBtnLight6.GetState();
2128 	if( eState != STATE_DONTKNOW )
2129 	{
2130 		sal_Bool bValue = GetUILightState( aBtnLight6 );
2131 		rAttrs.Put(Svx3DLightOnOff6Item(bValue));
2132 
2133 		// Licht 6 (Richtung)
2134 		if( bValue )
2135 		{
2136             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6));
2137 		}
2138 	}
2139 	else
2140 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6);
2141 
2142 	// Licht 7 Farbe
2143 	if( aLbLight7.GetSelectEntryCount() )
2144 	{
2145 		aColor = aLbLight7.GetSelectEntryColor();
2146 		rAttrs.Put(Svx3DLightcolor7Item(aColor));
2147 	}
2148 	else
2149 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_7);
2150 	// Licht 7 (an/aus)
2151 	eState = aBtnLight7.GetState();
2152 	if( eState != STATE_DONTKNOW )
2153 	{
2154 		sal_Bool bValue = GetUILightState( aBtnLight7 );
2155 		rAttrs.Put(Svx3DLightOnOff7Item(bValue));
2156 
2157 		// Licht 7 (Richtung)
2158 		if( bValue )
2159 		{
2160             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7));
2161 		}
2162 	}
2163 	else
2164 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7);
2165 
2166 	// Licht 8 Farbe
2167 	if( aLbLight8.GetSelectEntryCount() )
2168 	{
2169 		aColor = aLbLight8.GetSelectEntryColor();
2170 		rAttrs.Put(Svx3DLightcolor8Item(aColor));
2171 	}
2172 	else
2173 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_8);
2174 	// Licht 8 (an/aus)
2175 	eState = aBtnLight8.GetState();
2176 	if( eState != STATE_DONTKNOW )
2177 	{
2178 		sal_Bool bValue = GetUILightState( aBtnLight8 );
2179 		rAttrs.Put(Svx3DLightOnOff8Item(bValue));
2180 
2181 		// Licht 8 (Richtung)
2182 		if( bValue )
2183 		{
2184             rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8));
2185 		}
2186 	}
2187 	else
2188 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8);
2189 
2190 	// Umgebungslicht
2191 	if( aLbAmbientlight.GetSelectEntryCount() )
2192 	{
2193 		aColor = aLbAmbientlight.GetSelectEntryColor();
2194 		rAttrs.Put(Svx3DAmbientcolorItem(aColor));
2195 	}
2196 	else
2197 		rAttrs.InvalidateItem(SDRATTR_3DSCENE_AMBIENTCOLOR);
2198 
2199 // Texturen
2200 	// Art
2201 	nValue = 3;
2202 	if( aBtnTexLuminance.IsChecked() )
2203 		nValue = 1;
2204 	else if( aBtnTexColor.IsChecked() )
2205 		nValue = 3;
2206 
2207 	if( nValue == 1 || nValue == 3 )
2208 		rAttrs.Put(Svx3DTextureKindItem(nValue));
2209 	else
2210 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_KIND);
2211 
2212 
2213 	// Modus
2214 	nValue = 99;
2215 	if( aBtnTexReplace.IsChecked() )
2216 		nValue = 1;
2217 	else if( aBtnTexModulate.IsChecked() )
2218 		nValue = 2;
2219 	//else if( aBtnTexBlend.IsChecked() )
2220 	//	nValue = 2;
2221 
2222 	if( nValue == 1 || nValue == 2 )
2223 		rAttrs.Put(Svx3DTextureModeItem(nValue));
2224 	else
2225 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_MODE);
2226 
2227 	// Projektion X
2228 	nValue = 99;
2229 	if( aBtnTexObjectX.IsChecked() )
2230 		nValue = 0;
2231 	else if( aBtnTexParallelX.IsChecked() )
2232 		nValue = 1;
2233 	else if( aBtnTexCircleX.IsChecked() )
2234 		nValue = 2;
2235 
2236 	if( nValue <= 2 )
2237 		rAttrs.Put(Svx3DTextureProjectionXItem(nValue));
2238 	else
2239 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
2240 
2241 	// Projektion Y
2242 	nValue = 99;
2243 	if( aBtnTexObjectY.IsChecked() )
2244 		nValue = 0;
2245 	else if( aBtnTexParallelY.IsChecked() )
2246 		nValue = 1;
2247 	else if( aBtnTexCircleY.IsChecked() )
2248 		nValue = 2;
2249 
2250 	if( nValue <= 2 )
2251 		rAttrs.Put(Svx3DTextureProjectionYItem(nValue));
2252 	else
2253 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
2254 
2255 
2256 	// Filter
2257 	eState = aBtnTexFilter.GetState();
2258 	if( eState != STATE_DONTKNOW )
2259 	{
2260 		sal_Bool bValue = STATE_CHECK == eState;
2261 		rAttrs.Put(Svx3DTextureFilterItem(bValue));
2262 	}
2263 	else
2264 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_FILTER);
2265 
2266 
2267 // Material
2268 	// Objektfarbe
2269 	if( aLbMatColor.GetSelectEntryCount() )
2270 	{
2271 		aColor = aLbMatColor.GetSelectEntryColor();
2272 		rAttrs.Put( XFillColorItem( String(), aColor) );
2273 	}
2274 	else
2275 	{
2276 		rAttrs.InvalidateItem( XATTR_FILLCOLOR );
2277 	}
2278 
2279 	// Slebstleuchtfarbe
2280 	if( aLbMatEmission.GetSelectEntryCount() )
2281 	{
2282 		aColor = aLbMatEmission.GetSelectEntryColor();
2283 		rAttrs.Put(Svx3DMaterialEmissionItem(aColor));
2284 	}
2285 	else
2286 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION);
2287 
2288 	// Glanzpunkt
2289 	if( aLbMatSpecular.GetSelectEntryCount() )
2290 	{
2291 		aColor = aLbMatSpecular.GetSelectEntryColor();
2292 		rAttrs.Put(Svx3DMaterialSpecularItem(aColor));
2293 	}
2294 	else
2295 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR);
2296 
2297 	// Glanzpunkt Intensitaet
2298 	if( !aMtrMatSpecularIntensity.IsEmptyFieldValue() )
2299 	{
2300 		sal_uInt16 nValue2 = (sal_uInt16) aMtrMatSpecularIntensity.GetValue();
2301 		rAttrs.Put(Svx3DMaterialSpecularIntensityItem(nValue2));
2302 	}
2303 	else
2304 		rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY);
2305 }
2306 
2307 // -----------------------------------------------------------------------
2308 void __EXPORT Svx3DWin::Resize()
2309 {
2310 	if ( !IsFloatingMode() ||
2311 		 !GetFloatingWindow()->IsRollUp() )
2312 	{
2313 		Size aWinSize( GetOutputSizePixel() ); // vorher rSize im Resizing()
2314 
2315 		if( aWinSize.Height() >= GetMinOutputSizePixel().Height() &&
2316 			aWinSize.Width() >= GetMinOutputSizePixel().Width() )
2317 		{
2318 			Size aDiffSize;
2319 			aDiffSize.Width() = aWinSize.Width() - aSize.Width();
2320 			aDiffSize.Height() = aWinSize.Height() - aSize.Height();
2321 
2322 			Point aXPt;
2323 			Point aYPt;
2324 			aXPt.X() = aDiffSize.Width();
2325 			aYPt.Y() = aDiffSize.Height();
2326 
2327 			Size aObjSize;
2328 
2329 			// Hide
2330 			aBtnUpdate.Hide();
2331 			aBtnAssign.Hide();
2332 
2333 			aBtnConvertTo3D.Hide();
2334 			aBtnLatheObject.Hide();
2335 			aBtnPerspective.Hide();
2336 
2337 			aCtlPreview.Hide();
2338 			aCtlLightPreview.Hide();
2339 
2340             aFLGeometrie.Hide();
2341             aFLRepresentation.Hide();
2342             aFLLight.Hide();
2343             aFLTexture.Hide();
2344             aFLMaterial.Hide();
2345 
2346 			// Verschieben / Resizen
2347 			aBtnUpdate.SetPosPixel( aBtnUpdate.GetPosPixel() + aXPt );
2348 			aBtnAssign.SetPosPixel( aBtnAssign.GetPosPixel() + aXPt );
2349 
2350 				// Preview-Controls
2351 			aObjSize = aCtlPreview.GetOutputSizePixel();
2352 			aObjSize.Width() += aDiffSize.Width();
2353 			aObjSize.Height() += aDiffSize.Height();
2354 			aCtlPreview.SetOutputSizePixel( aObjSize );
2355 			aCtlLightPreview.SetOutputSizePixel( aObjSize );
2356 
2357             // Groups
2358             aObjSize = aFLGeometrie.GetOutputSizePixel();
2359 			aObjSize.Width() += aDiffSize.Width();
2360             aFLGeometrie.SetOutputSizePixel( aObjSize );
2361             aFLSegments.SetOutputSizePixel( aObjSize );
2362             aFLShadow.SetOutputSizePixel( aObjSize );
2363             aFLCamera.SetOutputSizePixel( aObjSize );
2364             aFLRepresentation.SetOutputSizePixel( aObjSize );
2365             aFLLight.SetOutputSizePixel( aObjSize );
2366             aFLTexture.SetOutputSizePixel( aObjSize );
2367             aFLMaterial.SetOutputSizePixel( aObjSize );
2368 
2369 				// Y-Position der unteren Buttons
2370 			aBtnConvertTo3D.SetPosPixel( aBtnConvertTo3D.GetPosPixel() + aYPt );
2371 			aBtnLatheObject.SetPosPixel( aBtnLatheObject.GetPosPixel() + aYPt );
2372 			aBtnPerspective.SetPosPixel( aBtnPerspective.GetPosPixel() + aYPt );
2373 
2374 			// Show
2375 			aBtnUpdate.Show();
2376 			aBtnAssign.Show();
2377 
2378 			aBtnConvertTo3D.Show();
2379 			aBtnLatheObject.Show();
2380 			aBtnPerspective.Show();
2381 
2382 			if( aBtnGeo.IsChecked() )
2383 				ClickViewTypeHdl( &aBtnGeo );
2384 			if( aBtnRepresentation.IsChecked() )
2385 				ClickViewTypeHdl( &aBtnRepresentation );
2386 			if( aBtnLight.IsChecked() )
2387 				ClickViewTypeHdl( &aBtnLight );
2388 			if( aBtnTexture.IsChecked() )
2389 				ClickViewTypeHdl( &aBtnTexture );
2390 			if( aBtnMaterial.IsChecked() )
2391 				ClickViewTypeHdl( &aBtnMaterial );
2392 
2393 			aSize = aWinSize;
2394 		}
2395 	}
2396 
2397 	SfxDockingWindow::Resize();
2398 }
2399 
2400 // -----------------------------------------------------------------------
2401 IMPL_LINK( Svx3DWin, ClickUpdateHdl, void *, EMPTYARG )
2402 {
2403 	bUpdate = !aBtnUpdate.IsChecked();
2404 	aBtnUpdate.Check( bUpdate );
2405 
2406 	if( bUpdate )
2407 	{
2408         SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2409         if (pDispatcher != NULL)
2410         {
2411             SfxBoolItem aItem( SID_3D_STATE, sal_True );
2412             pDispatcher->Execute(
2413                 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2414         }
2415 	}
2416 	else
2417 	{
2418 		// Controls koennen u.U. disabled sein
2419 	}
2420 
2421 	return( 0L );
2422 }
2423 
2424 // -----------------------------------------------------------------------
2425 IMPL_LINK( Svx3DWin, ClickAssignHdl, void *, EMPTYARG )
2426 {
2427     SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2428     if (pDispatcher != NULL)
2429     {
2430         SfxBoolItem aItem( SID_3D_ASSIGN, sal_True );
2431         pDispatcher->Execute(
2432             SID_3D_ASSIGN, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2433     }
2434 
2435 	return( 0L );
2436 }
2437 
2438 // -----------------------------------------------------------------------
2439 
2440 IMPL_LINK( Svx3DWin, ClickViewTypeHdl, void *, pBtn )
2441 {
2442 
2443 	if( pBtn )
2444 	{
2445 		// Da das permanente Updaten der Preview zu teuer waere
2446 		sal_Bool bUpdatePreview = aBtnLight.IsChecked();
2447 
2448 		aBtnGeo.Check( &aBtnGeo	== pBtn );
2449 		aBtnRepresentation.Check( &aBtnRepresentation == pBtn );
2450 		aBtnLight.Check( &aBtnLight	== pBtn );
2451 		aBtnTexture.Check( &aBtnTexture	== pBtn );
2452 		aBtnMaterial.Check( &aBtnMaterial == pBtn );
2453 
2454 		if( aBtnGeo.IsChecked() )
2455 			eViewType = VIEWTYPE_GEO;
2456 		if( aBtnRepresentation.IsChecked() )
2457 			eViewType = VIEWTYPE_REPRESENTATION;
2458 		if( aBtnLight.IsChecked() )
2459 			eViewType = VIEWTYPE_LIGHT;
2460 		if( aBtnTexture.IsChecked() )
2461 			eViewType = VIEWTYPE_TEXTURE;
2462 		if( aBtnMaterial.IsChecked() )
2463 			eViewType = VIEWTYPE_MATERIAL;
2464 
2465 		// Geometrie
2466 		if( eViewType == VIEWTYPE_GEO )
2467 		{
2468 			aFtHorizontal.Show();
2469 			aNumHorizontal.Show();
2470 			aFtVertical.Show();
2471 			aNumVertical.Show();
2472             aFLSegments.Show();
2473 			aFtPercentDiagonal.Show();
2474 			aMtrPercentDiagonal.Show();
2475 			aFtBackscale.Show();
2476 			aMtrBackscale.Show();
2477 			aFtEndAngle.Show();
2478 			aMtrEndAngle.Show();
2479 			aFtDepth.Show();
2480 			aMtrDepth.Show();
2481             aFLGeometrie.Show();
2482 
2483 			aBtnNormalsObj.Show();
2484 			aBtnNormalsFlat.Show();
2485 			aBtnNormalsSphere.Show();
2486 			aBtnTwoSidedLighting.Show();
2487 			aBtnNormalsInvert.Show();
2488             aFLNormals.Show();
2489 			aBtnDoubleSided.Show();
2490 		}
2491 		else
2492 		{
2493 			aFtHorizontal.Hide();
2494 			aNumHorizontal.Hide();
2495 			aFtVertical.Hide();
2496 			aNumVertical.Hide();
2497             aFLSegments.Hide();
2498 			aFtPercentDiagonal.Hide();
2499 			aMtrPercentDiagonal.Hide();
2500 			aFtBackscale.Hide();
2501 			aMtrBackscale.Hide();
2502 			aFtEndAngle.Hide();
2503 			aMtrEndAngle.Hide();
2504 			aFtDepth.Hide();
2505 			aMtrDepth.Hide();
2506             aFLGeometrie.Hide();
2507 
2508 			aBtnNormalsObj.Hide();
2509 			aBtnNormalsFlat.Hide();
2510 			aBtnNormalsSphere.Hide();
2511 			aBtnTwoSidedLighting.Hide();
2512 			aBtnNormalsInvert.Hide();
2513             aFLNormals.Hide();
2514 			aBtnDoubleSided.Hide();
2515 		}
2516 
2517 		// Darstellung
2518 		if( eViewType == VIEWTYPE_REPRESENTATION )
2519 		{
2520 			aFtShademode.Show();
2521 			aLbShademode.Show();
2522 			aBtnShadow3d.Show();
2523 			aFtSlant.Show();
2524 			aMtrSlant.Show();
2525             aFLShadow.Show();
2526 			aFtDistance.Show();
2527 			aMtrDistance.Show();
2528 			aFtFocalLeng.Show();
2529 			aMtrFocalLength.Show();
2530             aFLCamera.Show();
2531             aFLRepresentation.Show();
2532 		}
2533 		else
2534 		{
2535 			aFtShademode.Hide();
2536 			aLbShademode.Hide();
2537 			aBtnShadow3d.Hide();
2538 			aFtSlant.Hide();
2539 			aMtrSlant.Hide();
2540             aFLShadow.Hide();
2541 			aFtDistance.Hide();
2542 			aMtrDistance.Hide();
2543 			aFtFocalLeng.Hide();
2544 			aMtrFocalLength.Hide();
2545             aFLCamera.Hide();
2546             aFLRepresentation.Hide();
2547 		}
2548 
2549 		// Beleuchtung
2550 		if( eViewType == VIEWTYPE_LIGHT )
2551 		{
2552 			aBtnLight1.Show();
2553 			aBtnLight2.Show();
2554 			aBtnLight3.Show();
2555 			aBtnLight4.Show();
2556 			aBtnLight5.Show();
2557 			aBtnLight6.Show();
2558 			aBtnLight7.Show();
2559 			aBtnLight8.Show();
2560 			//aLbLight1.Show();
2561 			aBtnLightColor.Show();
2562             aFTLightsource.Show();
2563 			aLbAmbientlight.Show();
2564 			aBtnAmbientColor.Show();
2565             aFTAmbientlight.Show();
2566             aFLLight.Show();
2567 			//aFtLightX.Show();
2568 			//aFtLightY.Show();
2569 			//aFtLightZ.Show();
2570 			//aGrpLightInfo.Show();
2571 
2572 			ColorLB* pLb = GetLbByButton();
2573 			if( pLb )
2574 				pLb->Show();
2575 
2576 			aCtlLightPreview.Show();
2577 			aCtlPreview.Hide();
2578 		}
2579 		else
2580 		{
2581 			aBtnLight1.Hide();
2582 			aBtnLight2.Hide();
2583 			aBtnLight3.Hide();
2584 			aBtnLight4.Hide();
2585 			aBtnLight5.Hide();
2586 			aBtnLight6.Hide();
2587 			aBtnLight7.Hide();
2588 			aBtnLight8.Hide();
2589 			aLbLight1.Hide();
2590 			aLbLight2.Hide();
2591 			aLbLight3.Hide();
2592 			aLbLight4.Hide();
2593 			aLbLight5.Hide();
2594 			aLbLight6.Hide();
2595 			aLbLight7.Hide();
2596 			aLbLight8.Hide();
2597 			aBtnLightColor.Hide();
2598             aFTLightsource.Hide();
2599 			aLbAmbientlight.Hide();
2600 			aBtnAmbientColor.Hide();
2601             aFTAmbientlight.Hide();
2602             aFLLight.Hide();
2603 
2604 			if( !aCtlPreview.IsVisible() )
2605 			{
2606 				aCtlPreview.Show();
2607 				aCtlLightPreview.Hide();
2608 			}
2609 		}
2610 
2611 		// Texturen
2612 		if( eViewType == VIEWTYPE_TEXTURE )
2613 		{
2614 			aFtTexKind.Show();
2615 			aBtnTexLuminance.Show();
2616 			aBtnTexColor.Show();
2617 			aFtTexMode.Show();
2618 			aBtnTexReplace.Show();
2619 			aBtnTexModulate.Show();
2620 			//aBtnTexBlend.Show();
2621 			aFtTexProjectionX.Show();
2622 			aBtnTexParallelX.Show();
2623 			aBtnTexCircleX.Show();
2624 			aBtnTexObjectX.Show();
2625 			aFtTexProjectionY.Show();
2626 			aBtnTexParallelY.Show();
2627 			aBtnTexCircleY.Show();
2628 			aBtnTexObjectY.Show();
2629 			aFtTexFilter.Show();
2630 			aBtnTexFilter.Show();
2631             aFLTexture.Show();
2632 		}
2633 		else
2634 		{
2635 			aFtTexKind.Hide();
2636 			aBtnTexLuminance.Hide();
2637 			aBtnTexColor.Hide();
2638 			aFtTexMode.Hide();
2639 			aBtnTexReplace.Hide();
2640 			aBtnTexModulate.Hide();
2641 			aBtnTexBlend.Hide();
2642 			aFtTexProjectionX.Hide();
2643 			aBtnTexParallelX.Hide();
2644 			aBtnTexCircleX.Hide();
2645 			aBtnTexObjectX.Hide();
2646 			aFtTexProjectionY.Hide();
2647 			aBtnTexParallelY.Hide();
2648 			aBtnTexCircleY.Hide();
2649 			aBtnTexObjectY.Hide();
2650 			aFtTexFilter.Hide();
2651 			aBtnTexFilter.Hide();
2652             aFLTexture.Hide();
2653 		}
2654 
2655 		// Material
2656 		if( eViewType == VIEWTYPE_MATERIAL )
2657 		{
2658 			aFtMatFavorites.Show();
2659 			aLbMatFavorites.Show();
2660 			aFtMatColor.Show();
2661 			aLbMatColor.Show();
2662 			aBtnMatColor.Show();
2663 			aFtMatEmission.Show();
2664 			aLbMatEmission.Show();
2665 			aBtnEmissionColor.Show();
2666 			aFtMatSpecular.Show();
2667 			aLbMatSpecular.Show();
2668 			aBtnSpecularColor.Show();
2669 			aFtMatSpecularIntensity.Show();
2670 			aMtrMatSpecularIntensity.Show();
2671             aFLMatSpecular.Show();
2672             aFLMaterial.Show();
2673 		}
2674 		else
2675 		{
2676 			aFtMatFavorites.Hide();
2677 			aLbMatFavorites.Hide();
2678 			aFtMatColor.Hide();
2679 			aLbMatColor.Hide();
2680 			aBtnMatColor.Hide();
2681 			aFtMatEmission.Hide();
2682 			aLbMatEmission.Hide();
2683 			aBtnEmissionColor.Hide();
2684 			aFtMatSpecular.Hide();
2685 			aLbMatSpecular.Hide();
2686 			aBtnSpecularColor.Hide();
2687 			aFtMatSpecularIntensity.Hide();
2688 			aMtrMatSpecularIntensity.Hide();
2689             aFLMatSpecular.Hide();
2690             aFLMaterial.Hide();
2691 		}
2692 		if( bUpdatePreview && !aBtnLight.IsChecked() )
2693 			UpdatePreview();
2694 
2695 	}
2696 	else
2697 	{
2698 		aBtnGeo.Check( eViewType == VIEWTYPE_GEO );
2699 		aBtnRepresentation.Check( eViewType == VIEWTYPE_REPRESENTATION );
2700 		aBtnLight.Check( eViewType == VIEWTYPE_LIGHT );
2701 		aBtnTexture.Check( eViewType == VIEWTYPE_TEXTURE );
2702 		aBtnMaterial.Check( eViewType == VIEWTYPE_MATERIAL );
2703 	}
2704 	return( 0L );
2705 }
2706 
2707 // -----------------------------------------------------------------------
2708 IMPL_LINK( Svx3DWin, ClickHdl, PushButton *, pBtn )
2709 {
2710 	sal_Bool bUpdatePreview = sal_False;
2711 
2712 	if( pBtn )
2713 	{
2714 		sal_uInt16 nSId = 0;
2715 
2716 		if( pBtn == &aBtnConvertTo3D )
2717 		{
2718 			nSId = SID_CONVERT_TO_3D;
2719 		}
2720 		else if( pBtn == &aBtnLatheObject )
2721 		{
2722 			nSId = SID_CONVERT_TO_3D_LATHE_FAST;
2723 		}
2724 		// Geometrie
2725 		else if( pBtn == &aBtnNormalsObj ||
2726 				 pBtn == &aBtnNormalsFlat ||
2727 				 pBtn == &aBtnNormalsSphere )
2728 		{
2729 			aBtnNormalsObj.Check( pBtn == &aBtnNormalsObj );
2730 			aBtnNormalsFlat.Check( pBtn == &aBtnNormalsFlat );
2731 			aBtnNormalsSphere.Check( pBtn == &aBtnNormalsSphere );
2732 			bUpdatePreview = sal_True;
2733 		}
2734 		else if( pBtn == &aBtnLight1 ||
2735 				 pBtn == &aBtnLight2 ||
2736 				 pBtn == &aBtnLight3 ||
2737 				 pBtn == &aBtnLight4 ||
2738 				 pBtn == &aBtnLight5 ||
2739 				 pBtn == &aBtnLight6 ||
2740 				 pBtn == &aBtnLight7 ||
2741 				 pBtn == &aBtnLight8 )
2742 		{
2743 			// Beleuchtung
2744 			ColorLB* pLb = GetLbByButton( pBtn );
2745 			pLb->Show();
2746 
2747 			if( pBtn->IsChecked() )
2748 			{
2749 				SetUILightState( *(ImageButton*)pBtn, !GetUILightState( *(ImageButton*)pBtn ) );
2750 			}
2751 			else
2752 			{
2753 				pBtn->Check();
2754 
2755 				if( pBtn != &aBtnLight1 && aBtnLight1.IsChecked() )
2756 				{
2757 					aBtnLight1.Check( sal_False );
2758 					aLbLight1.Hide();
2759 				}
2760 				if( pBtn != &aBtnLight2 && aBtnLight2.IsChecked() )
2761 				{
2762 					aBtnLight2.Check( sal_False );
2763 					aLbLight2.Hide();
2764 				}
2765 				if( pBtn != &aBtnLight3 && aBtnLight3.IsChecked() )
2766 				{
2767 					aBtnLight3.Check( sal_False );
2768 					aLbLight3.Hide();
2769 				}
2770 				if( pBtn != &aBtnLight4 && aBtnLight4.IsChecked() )
2771 				{
2772 					aBtnLight4.Check( sal_False );
2773 					aLbLight4.Hide();
2774 				}
2775 				if( pBtn != &aBtnLight5 && aBtnLight5.IsChecked() )
2776 				{
2777 					aBtnLight5.Check( sal_False );
2778 					aLbLight5.Hide();
2779 				}
2780 				if( pBtn != &aBtnLight6 && aBtnLight6.IsChecked() )
2781 				{
2782 					aBtnLight6.Check( sal_False );
2783 					aLbLight6.Hide();
2784 				}
2785 				if( pBtn != &aBtnLight7 && aBtnLight7.IsChecked() )
2786 				{
2787 					aBtnLight7.Check( sal_False );
2788 					aLbLight7.Hide();
2789 				}
2790 				if( pBtn != &aBtnLight8 && aBtnLight8.IsChecked() )
2791 				{
2792 					aBtnLight8.Check( sal_False );
2793 					aLbLight8.Hide();
2794 				}
2795 			}
2796 			sal_Bool bEnable = GetUILightState( *(ImageButton*)pBtn );
2797 			aBtnLightColor.Enable( bEnable );
2798 			pLb->Enable( bEnable );
2799 
2800 			ClickLightHdl( pBtn );
2801 			bUpdatePreview = sal_True;
2802 		}
2803 		// Texturen
2804 		else if( pBtn == &aBtnTexLuminance ||
2805 				 pBtn == &aBtnTexColor )
2806 		{
2807 			aBtnTexLuminance.Check( pBtn == &aBtnTexLuminance );
2808 			aBtnTexColor.Check( pBtn == &aBtnTexColor );
2809 			bUpdatePreview = sal_True;
2810 		}
2811 		else if( pBtn == &aBtnTexReplace ||
2812 				 pBtn == &aBtnTexModulate )// ||
2813 				 //pBtn == &aBtnTexBlend )
2814 		{
2815 			aBtnTexReplace.Check( pBtn == &aBtnTexReplace );
2816 			aBtnTexModulate.Check( pBtn == &aBtnTexModulate );
2817 			//aBtnTexBlend.Check( pBtn == &aBtnTexBlend );
2818 			bUpdatePreview = sal_True;
2819 		}
2820 		else if( pBtn == &aBtnTexParallelX ||
2821 				 pBtn == &aBtnTexCircleX ||
2822 				 pBtn == &aBtnTexObjectX )
2823 		{
2824 			aBtnTexParallelX.Check( pBtn == &aBtnTexParallelX );
2825 			aBtnTexCircleX.Check( pBtn == &aBtnTexCircleX );
2826 			aBtnTexObjectX.Check( pBtn == &aBtnTexObjectX );
2827 			bUpdatePreview = sal_True;
2828 		}
2829 		else if( pBtn == &aBtnTexParallelY ||
2830 				 pBtn == &aBtnTexCircleY ||
2831 				 pBtn == &aBtnTexObjectY )
2832 		{
2833 			aBtnTexParallelY.Check( pBtn == &aBtnTexParallelY );
2834 			aBtnTexCircleY.Check( pBtn == &aBtnTexCircleY );
2835 			aBtnTexObjectY.Check( pBtn == &aBtnTexObjectY );
2836 			bUpdatePreview = sal_True;
2837 		}
2838 		else if( pBtn == &aBtnShadow3d  )
2839 		{
2840 			pBtn->Check( !pBtn->IsChecked() );
2841 			aFtSlant.Enable( pBtn->IsChecked() );
2842 			aMtrSlant.Enable( pBtn->IsChecked() );
2843 			bUpdatePreview = sal_True;
2844 		}
2845 		// Sonstige (keine Gruppen)
2846 		else if( pBtn != NULL )
2847 		{
2848 			pBtn->Check( !pBtn->IsChecked() );
2849 			bUpdatePreview = sal_True;
2850 		}
2851 
2852 		if( nSId > 0 )
2853 		{
2854             SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2855             if (pDispatcher != NULL)
2856             {
2857                 SfxBoolItem aItem( nSId, sal_True );
2858                 pDispatcher->Execute(
2859                     nSId, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2860             }
2861 		}
2862 		else if( bUpdatePreview == sal_True )
2863 			UpdatePreview();
2864 	}
2865 	return( 0L );
2866 }
2867 
2868 //------------------------------------------------------------------------
2869 
2870 IMPL_LINK( Svx3DWin, ClickColorHdl, PushButton *, pBtn )
2871 {
2872 	SvColorDialog aColorDlg( this );
2873 	ColorLB* pLb;
2874 
2875 	if( pBtn == &aBtnLightColor )
2876 		pLb = GetLbByButton();
2877 	else if( pBtn == &aBtnAmbientColor )
2878 		pLb = &aLbAmbientlight;
2879 	else if( pBtn == &aBtnMatColor )
2880 		pLb = &aLbMatColor;
2881 	else if( pBtn == &aBtnEmissionColor )
2882 		pLb = &aLbMatEmission;
2883 	else // if( pBtn == &aBtnSpecularColor )
2884 		pLb = &aLbMatSpecular;
2885 
2886 	Color aColor = pLb->GetSelectEntryColor();
2887 
2888 	aColorDlg.SetColor( aColor );
2889 	if( aColorDlg.Execute() == RET_OK )
2890 	{
2891 		aColor = aColorDlg.GetColor();
2892 		if( LBSelectColor( pLb, aColor ) )
2893 			SelectHdl( pLb );
2894 	}
2895 	return( 0L );
2896 }
2897 
2898 // -----------------------------------------------------------------------
2899 IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
2900 {
2901 	if( p )
2902 	{
2903 		Color aColor;
2904 		sal_Bool bUpdatePreview = sal_False;
2905 
2906 		// Material
2907 		if( p == &aLbMatFavorites )
2908 		{
2909 			Color aColObj( COL_WHITE );
2910 			Color aColEmis( COL_BLACK );
2911 			Color aColSpec( COL_WHITE );
2912 			sal_uInt16 nSpecIntens = 20;
2913 
2914 			sal_uInt16 nPos = aLbMatFavorites.GetSelectEntryPos();
2915 			switch( nPos )
2916 			{
2917 				case 1: // Metall
2918 				{
2919 					aColObj = Color(230,230,255);
2920 					aColEmis = Color(10,10,30);
2921 					aColSpec = Color(200,200,200);
2922 					nSpecIntens = 20;
2923 				}
2924 				break;
2925 
2926 				case 2: // Gold
2927 				{
2928 					aColObj = Color(230,255,0);
2929 					aColEmis = Color(51,0,0);
2930 					aColSpec = Color(255,255,240);
2931 					nSpecIntens = 20;
2932 				}
2933 				break;
2934 
2935 				case 3: // Chrom
2936 				{
2937 					aColObj = Color(36,117,153);
2938 					aColEmis = Color(18,30,51);
2939 					aColSpec = Color(230,230,255);
2940 					nSpecIntens = 2;
2941 				}
2942 				break;
2943 
2944 				case 4: // Plastik
2945 				{
2946 					aColObj = Color(255,48,57);
2947 					aColEmis = Color(35,0,0);
2948 					aColSpec = Color(179,202,204);
2949 					nSpecIntens = 60;
2950 				}
2951 				break;
2952 
2953 				case 5: // Holz
2954 				{
2955 					aColObj = Color(153,71,1);
2956 					aColEmis = Color(21,22,0);
2957 					aColSpec = Color(255,255,153);
2958 					nSpecIntens = 75;
2959 				}
2960 				break;
2961 			}
2962 			LBSelectColor( &aLbMatColor, aColObj );
2963 			LBSelectColor( &aLbMatEmission, aColEmis );
2964 			LBSelectColor( &aLbMatSpecular, aColSpec );
2965 			aMtrMatSpecularIntensity.SetValue( nSpecIntens );
2966 
2967 			bUpdatePreview = sal_True;
2968 		}
2969 		else if( p == &aLbMatColor ||
2970 				 p == &aLbMatEmission ||
2971 				 p == &aLbMatSpecular )
2972 		{
2973 			aLbMatFavorites.SelectEntryPos( 0 );
2974 			bUpdatePreview = sal_True;
2975 		}
2976 		// Beleuchtung
2977 		else if( p == &aLbAmbientlight )
2978 		{
2979 			bUpdatePreview = sal_True;
2980 		}
2981 		else if( p == &aLbLight1 ||
2982 				 p == &aLbLight2 ||
2983 				 p == &aLbLight3 ||
2984 				 p == &aLbLight4 ||
2985 				 p == &aLbLight5 ||
2986 				 p == &aLbLight6 ||
2987 				 p == &aLbLight7 ||
2988 				 p == &aLbLight8 )
2989 		{
2990 			bUpdatePreview = sal_True;
2991 		}
2992 		else if( p == &aLbShademode )
2993 			bUpdatePreview = sal_True;
2994 
2995 		if( bUpdatePreview == sal_True )
2996 			UpdatePreview();
2997 	}
2998 	return( 0L );
2999 }
3000 
3001 // -----------------------------------------------------------------------
3002 IMPL_LINK( Svx3DWin, ModifyHdl, void*, pField )
3003 {
3004 	if( pField )
3005 	{
3006 		sal_Bool bUpdatePreview = sal_False;
3007 
3008 		// Material
3009 		if( pField == &aMtrMatSpecularIntensity )
3010 		{
3011 			bUpdatePreview = sal_True;
3012 		}
3013 		else if( pField == &aNumHorizontal )
3014 		{
3015 			bUpdatePreview = sal_True;
3016 		}
3017 		else if( pField == &aNumVertical )
3018 		{
3019 			bUpdatePreview = sal_True;
3020 		}
3021 		else if( pField == &aMtrSlant )
3022 		{
3023 			bUpdatePreview = sal_True;
3024 		}
3025 
3026 		if( bUpdatePreview == sal_True )
3027 			UpdatePreview();
3028 	}
3029 	return( 0L );
3030 }
3031 
3032 // -----------------------------------------------------------------------
3033 
3034 IMPL_LINK( Svx3DWin, ClickLightHdl, PushButton*, pBtn )
3035 {
3036 
3037 	if( pBtn )
3038 	{
3039 		sal_uInt16 nLightSource = GetLightSource( pBtn );
3040 		ColorLB* pLb = GetLbByButton( pBtn );
3041 		Color aColor( pLb->GetSelectEntryColor() );
3042         SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
3043         const bool bOnOff(GetUILightState( *(ImageButton*)pBtn ));
3044 
3045         switch(nLightSource)
3046         {
3047             case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break;
3048             case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break;
3049             case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break;
3050             case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break;
3051             case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break;
3052             case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break;
3053             case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break;
3054             default:
3055             case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break;
3056         }
3057 
3058         aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet);
3059 		aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource);
3060 		aCtlLightPreview.CheckSelection();
3061 	}
3062 	return( 0L );
3063 }
3064 
3065 
3066 // -----------------------------------------------------------------------
3067 IMPL_LINK( Svx3DWin, DoubleClickHdl, void*, EMPTYARG )
3068 {
3069 	//sal_uInt16 nItemId = aCtlFavorites.GetSelectItemId();
3070 
3071 	//SfxItemSet* pSet = (SfxItemSet*) pFavorSetList->GetObject( nItemId - 1 );
3072 	//Update( *pSet );
3073 
3074 	// und zuweisen
3075 	ClickAssignHdl( NULL );
3076 
3077 	return( 0L );
3078 }
3079 
3080 // -----------------------------------------------------------------------
3081 
3082 IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
3083 {
3084 	return( 0L );
3085 }
3086 
3087 
3088 // -----------------------------------------------------------------------
3089 
3090 IMPL_LINK( Svx3DWin, ChangeSelectionCallbackHdl, void*, EMPTYARG )
3091 {
3092 	const sal_uInt32 nLight(aCtlLightPreview.GetSvx3DLightControl().GetSelectedLight());
3093 	PushButton* pBtn = 0;
3094 
3095 	switch( nLight )
3096 	{
3097 		case 0: pBtn = &aBtnLight1; break;
3098 		case 1: pBtn = &aBtnLight2; break;
3099 		case 2: pBtn = &aBtnLight3; break;
3100 		case 3: pBtn = &aBtnLight4; break;
3101 		case 4: pBtn = &aBtnLight5; break;
3102 		case 5: pBtn = &aBtnLight6; break;
3103 		case 6: pBtn = &aBtnLight7; break;
3104 		case 7: pBtn = &aBtnLight8; break;
3105 		default: break;
3106 	}
3107 
3108 	if( pBtn )
3109 		ClickHdl( pBtn );
3110 	else
3111 	{
3112 		// Zustand: Keine Lampe selektiert
3113 		if( aBtnLight1.IsChecked() )
3114 		{
3115 			aBtnLight1.Check( sal_False );
3116 			aLbLight1.Enable( sal_False );
3117 		}
3118 		else if( aBtnLight2.IsChecked() )
3119 		{
3120 			aBtnLight2.Check( sal_False );
3121 			aLbLight2.Enable( sal_False );
3122 		}
3123 		else if( aBtnLight3.IsChecked() )
3124 		{
3125 			aBtnLight3.Check( sal_False );
3126 			aLbLight3.Enable( sal_False );
3127 		}
3128 		else if( aBtnLight4.IsChecked() )
3129 		{
3130 			aBtnLight4.Check( sal_False );
3131 			aLbLight4.Enable( sal_False );
3132 		}
3133 		else if( aBtnLight5.IsChecked() )
3134 		{
3135 			aBtnLight5.Check( sal_False );
3136 			aLbLight5.Enable( sal_False );
3137 		}
3138 		else if( aBtnLight6.IsChecked() )
3139 		{
3140 			aBtnLight6.Check( sal_False );
3141 			aLbLight6.Enable( sal_False );
3142 		}
3143 		else if( aBtnLight7.IsChecked() )
3144 		{
3145 			aBtnLight7.Check( sal_False );
3146 			aLbLight7.Enable( sal_False );
3147 		}
3148 		else if( aBtnLight8.IsChecked() )
3149 		{
3150 			aBtnLight8.Check( sal_False );
3151 			aLbLight8.Enable( sal_False );
3152 		}
3153 		aBtnLightColor.Enable( sal_False );
3154 	}
3155 
3156 	return( 0L );
3157 }
3158 
3159 // -----------------------------------------------------------------------
3160 // Methode um sicherzustellen, dass die LB auch mit einer Farbe gesetzt ist
3161 // Liefert sal_True zurueck, falls Farbe hinzugefuegt wurde
3162 // -----------------------------------------------------------------------
3163 sal_Bool Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor )
3164 {
3165 	sal_Bool bRet = sal_False;
3166 
3167 	pLb->SetNoSelection();
3168 	pLb->SelectEntry( rColor );
3169 	if( pLb->GetSelectEntryCount() == 0 )
3170 	{
3171 		String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R));
3172 
3173 		aStr += String::CreateFromInt32((sal_Int32)rColor.GetRed());
3174 		aStr += sal_Unicode(' ');
3175 		aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G));
3176 		aStr += String::CreateFromInt32((sal_Int32)rColor.GetGreen());
3177 		aStr += sal_Unicode(' ');
3178 		aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B));
3179 		aStr += String::CreateFromInt32((sal_Int32)rColor.GetBlue());
3180 
3181 		sal_uInt16 nPos = pLb->InsertEntry( rColor, aStr );
3182 		pLb->SelectEntryPos( nPos );
3183 		bRet = sal_True;
3184 	}
3185 	return( bRet );
3186 }
3187 
3188 // -----------------------------------------------------------------------
3189 void Svx3DWin::UpdatePreview()
3190 {
3191 	if( pModel == NULL )
3192 		pModel = new FmFormModel();
3193 
3194 	if(bOnly3DChanged)
3195 	{
3196 		// slot executen
3197         SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
3198         if (pDispatcher != NULL)
3199         {
3200             SfxBoolItem aItem( SID_3D_STATE, sal_True );
3201             pDispatcher->Execute(
3202                 SID_3D_STATE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
3203         }
3204 		// Flag zuruecksetzen
3205 		bOnly3DChanged = sal_False;
3206 	}
3207 
3208 	// ItemSet besorgen
3209 	SfxItemSet aSet( pModel->GetItemPool(), SDRATTR_START, SDRATTR_END);
3210 
3211 	// Attribute holen und im Preview setzen
3212 	GetAttr( aSet );
3213 	aCtlPreview.Set3DAttributes( aSet );
3214 	aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes( aSet );
3215 }
3216 
3217 //////////////////////////////////////////////////////////////////////////////
3218 // document is to be reloaded, destroy remembered ItemSet (#83951#)
3219 void Svx3DWin::DocumentReload()
3220 {
3221 	if(mpRemember2DAttributes)
3222 		delete mpRemember2DAttributes;
3223 	mpRemember2DAttributes = 0L;
3224 }
3225 
3226 // -----------------------------------------------------------------------
3227 void Svx3DWin::InitColorLB( const SdrModel* pDoc )
3228 {
3229 	aLbLight1.Fill( pDoc->GetColorTable() );
3230 	aLbLight2.CopyEntries( aLbLight1 );
3231 	aLbLight3.CopyEntries( aLbLight1 );
3232 	aLbLight4.CopyEntries( aLbLight1 );
3233 	aLbLight5.CopyEntries( aLbLight1 );
3234 	aLbLight6.CopyEntries( aLbLight1 );
3235 	aLbLight7.CopyEntries( aLbLight1 );
3236 	aLbLight8.CopyEntries( aLbLight1 );
3237 	aLbAmbientlight.CopyEntries( aLbLight1 );
3238 	aLbMatColor.CopyEntries( aLbLight1 );
3239 	aLbMatEmission.CopyEntries( aLbLight1 );
3240 	aLbMatSpecular.CopyEntries( aLbLight1 );
3241 
3242 	// Erstmal...
3243 	Color aColWhite( COL_WHITE );
3244 	Color aColBlack( COL_BLACK );
3245 	aLbLight1.SelectEntry( aColWhite );
3246 	aLbLight2.SelectEntry( aColWhite );
3247 	aLbLight3.SelectEntry( aColWhite );
3248 	aLbLight4.SelectEntry( aColWhite );
3249 	aLbLight5.SelectEntry( aColWhite );
3250 	aLbLight6.SelectEntry( aColWhite );
3251 	aLbLight7.SelectEntry( aColWhite );
3252 	aLbLight8.SelectEntry( aColWhite );
3253 	aLbAmbientlight.SelectEntry( aColBlack );
3254 	aLbMatColor.SelectEntry( aColWhite );
3255 	aLbMatEmission.SelectEntry( aColBlack );
3256 	aLbMatSpecular.SelectEntry( aColWhite );
3257 }
3258 
3259 // -----------------------------------------------------------------------
3260 sal_uInt16 Svx3DWin::GetLightSource( const PushButton* pBtn )
3261 {
3262 	sal_uInt16 nLight = 8;
3263 
3264 	if( pBtn == NULL )
3265 	{
3266 		if( aBtnLight1.IsChecked() )
3267 			nLight = 0;
3268 		else if( aBtnLight2.IsChecked() )
3269 			nLight = 1;
3270 		else if( aBtnLight3.IsChecked() )
3271 			nLight = 2;
3272 		else if( aBtnLight4.IsChecked() )
3273 			nLight = 3;
3274 		else if( aBtnLight5.IsChecked() )
3275 			nLight = 4;
3276 		else if( aBtnLight6.IsChecked() )
3277 			nLight = 5;
3278 		else if( aBtnLight7.IsChecked() )
3279 			nLight = 6;
3280 		else if( aBtnLight8.IsChecked() )
3281 			nLight = 7;
3282 	}
3283 	else
3284 	{
3285 		if( pBtn == &aBtnLight1 )
3286 			nLight = 0;
3287 		else if( pBtn == &aBtnLight2 )
3288 			nLight = 1;
3289 		else if( pBtn == &aBtnLight3 )
3290 			nLight = 2;
3291 		else if( pBtn == &aBtnLight4 )
3292 			nLight = 3;
3293 		else if( pBtn == &aBtnLight5 )
3294 			nLight = 4;
3295 		else if( pBtn == &aBtnLight6 )
3296 			nLight = 5;
3297 		else if( pBtn == &aBtnLight7 )
3298 			nLight = 6;
3299 		else if( pBtn == &aBtnLight8 )
3300 			nLight = 7;
3301 	}
3302 	return( nLight );
3303 };
3304 
3305 // -----------------------------------------------------------------------
3306 ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn )
3307 {
3308 	ColorLB* pLb = NULL;
3309 
3310 	if( pBtn == NULL )
3311 	{
3312 		if( aBtnLight1.IsChecked() )
3313 			pLb = &aLbLight1;
3314 		else if( aBtnLight2.IsChecked() )
3315 			pLb = &aLbLight2;
3316 		else if( aBtnLight3.IsChecked() )
3317 			pLb = &aLbLight3;
3318 		else if( aBtnLight4.IsChecked() )
3319 			pLb = &aLbLight4;
3320 		else if( aBtnLight5.IsChecked() )
3321 			pLb = &aLbLight5;
3322 		else if( aBtnLight6.IsChecked() )
3323 			pLb = &aLbLight6;
3324 		else if( aBtnLight7.IsChecked() )
3325 			pLb = &aLbLight7;
3326 		else if( aBtnLight8.IsChecked() )
3327 			pLb = &aLbLight8;
3328 	}
3329 	else
3330 	{
3331 		if( pBtn == &aBtnLight1 )
3332 			pLb = &aLbLight1;
3333 		else if( pBtn == &aBtnLight2 )
3334 			pLb = &aLbLight2;
3335 		else if( pBtn == &aBtnLight3 )
3336 			pLb = &aLbLight3;
3337 		else if( pBtn == &aBtnLight4 )
3338 			pLb = &aLbLight4;
3339 		else if( pBtn == &aBtnLight5 )
3340 			pLb = &aLbLight5;
3341 		else if( pBtn == &aBtnLight6 )
3342 			pLb = &aLbLight6;
3343 		else if( pBtn == &aBtnLight7 )
3344 			pLb = &aLbLight7;
3345 		else if( pBtn == &aBtnLight8 )
3346 			pLb = &aLbLight8;
3347 	}
3348 	return( pLb );
3349 };
3350 
3351 /*************************************************************************
3352 |*
3353 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Effekte
3354 |*
3355 \************************************************************************/
3356 __EXPORT Svx3DChildWindow::Svx3DChildWindow( Window* _pParent,
3357 														 sal_uInt16 nId,
3358 														 SfxBindings* pBindings,
3359 														 SfxChildWinInfo* pInfo ) :
3360 	SfxChildWindow( _pParent, nId )
3361 {
3362 	Svx3DWin* pWin = new Svx3DWin( pBindings, this, _pParent );
3363 	pWindow = pWin;
3364 
3365 	eChildAlignment = SFX_ALIGN_NOALIGNMENT;
3366 
3367 	pWin->Initialize( pInfo );
3368 }
3369 
3370 /*************************************************************************
3371 |*
3372 |* ControllerItem fuer 3DStatus
3373 |*
3374 \************************************************************************/
3375 Svx3DCtrlItem::Svx3DCtrlItem( sal_uInt16 _nId,
3376 								Svx3DWin* pWin,
3377 								SfxBindings* _pBindings) :
3378 	SfxControllerItem( _nId, *_pBindings ),
3379 	p3DWin( pWin )
3380 {
3381 }
3382 
3383 // -----------------------------------------------------------------------
3384 void __EXPORT Svx3DCtrlItem::StateChanged( sal_uInt16 /*nSId*/,
3385 						SfxItemState /*eState*/, const SfxPoolItem* /*pItem*/ )
3386 {
3387 }
3388 
3389 /*************************************************************************
3390 |*
3391 |* ControllerItem fuer Status Slot SID_CONVERT_TO_3D
3392 |*
3393 \************************************************************************/
3394 
3395 SvxConvertTo3DItem::SvxConvertTo3DItem(sal_uInt16 _nId, SfxBindings* _pBindings)
3396 :	SfxControllerItem(_nId, *_pBindings),
3397 	bState(sal_False)
3398 {
3399 }
3400 
3401 void SvxConvertTo3DItem::StateChanged(sal_uInt16 /*_nId*/, SfxItemState eState, const SfxPoolItem* /*pState*/)
3402 {
3403 	sal_Bool bNewState = (eState != SFX_ITEM_DISABLED);
3404 	if(bNewState != bState)
3405 	{
3406 		bState = bNewState;
3407         SfxDispatcher* pDispatcher = LocalGetDispatcher(&GetBindings());
3408         if (pDispatcher != NULL)
3409         {
3410             SfxBoolItem aItem( SID_3D_STATE, sal_True );
3411             pDispatcher->Execute(
3412                 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, &aItem, 0L);
3413         }
3414 	}
3415 }
3416 
3417 
3418