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