Update ooo320-m1
[ooovba.git] / svx / source / engine3d / float3d.cxx
blob02a0cf267b4c9b43348d49a31535c8ca7c5d77c8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: float3d.cxx,v $
10 * $Revision: 1.27.226.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <sfx2/dispatch.hxx>
34 #include <sfx2/module.hxx>
35 #include <sfx2/viewfrm.hxx>
36 #include <svtools/eitem.hxx>
37 #include <svtools/colrdlg.hxx>
38 #include <vcl/msgbox.hxx>
39 #include <sfx2/viewsh.hxx>
40 #include <tools/shl.hxx>
41 #include <svx/xflclit.hxx>
42 #include <svx/svdmodel.hxx>
43 #include <globl3d.hxx>
44 #include <svx/view3d.hxx>
45 #include <svx/obj3d.hxx>
46 #include <svx/sphere3d.hxx>
47 #include <svx/scene3d.hxx>
48 #include <svx/camera3d.hxx>
49 #include <svx/fmmodel.hxx>
50 #include <svx/fmpage.hxx>
51 #include <svx/polysc3d.hxx>
52 #include <svx/eeitem.hxx>
53 #include <svtools/style.hxx>
56 #include <dlgutil.hxx>
57 #include <svx/dialmgr.hxx>
58 #include <svx/viewpt3d.hxx> // ProjectionType
60 #include <svx/svxids.hrc>
61 #include <svx/dialogs.hrc>
63 #include <svx/colritem.hxx>
64 #include <svx/e3ditem.hxx>
66 #include <gallery.hxx>
67 #define GALLERY_THEME "3D"
68 #include <svtools/whiter.hxx>
70 #include <svx/float3d.hxx>
71 #include "float3d.hrc"
73 SFX_IMPL_DOCKINGWINDOW( Svx3DChildWindow, SID_3D_WIN )
75 struct Svx3DWinImpl
77 SfxItemPool* pPool;
78 Image maImgLightOnH;
79 Image maImgLightOffH;
82 #define SETHCIMAGE(btn,res) \
83 { \
84 Bitmap aBmp( SVX_RES( res ) ); \
85 Image aImage( aBmp, COL_LIGHTMAGENTA ); \
86 btn.SetModeImage( aImage, BMP_COLOR_HIGHCONTRAST ); \
89 namespace {
90 /** Get the dispatcher from the current view frame, or, if that is not
91 available, from the given bindings.
92 @param pBindings
93 May be NULL.
94 @returns NULL when both the current view frame is NULL and the given
95 bindings are NULL.
97 SfxDispatcher* LocalGetDispatcher (const SfxBindings* pBindings)
99 SfxDispatcher* pDispatcher = NULL;
101 if (SfxViewFrame::Current() != NULL)
102 pDispatcher = SfxViewFrame::Current()->GetDispatcher();
103 else if (pBindings != NULL)
104 pDispatcher = pBindings->GetDispatcher();
106 return pDispatcher;
111 /*************************************************************************
112 |* Svx3DWin - FloatingWindow
113 \************************************************************************/
114 __EXPORT Svx3DWin::Svx3DWin( SfxBindings* pInBindings,
115 SfxChildWindow *pCW, Window* pParent ) :
116 SfxDockingWindow ( pInBindings, pCW, pParent,
117 SVX_RES( RID_SVXFLOAT_3D ) ),
118 aBtnGeo ( this, SVX_RES( BTN_GEO ) ),
119 aBtnRepresentation ( this, SVX_RES( BTN_REPRESENTATION ) ),
120 aBtnLight ( this, SVX_RES( BTN_LIGHT ) ),
121 aBtnTexture ( this, SVX_RES( BTN_TEXTURE ) ),
122 aBtnMaterial ( this, SVX_RES( BTN_MATERIAL ) ),
123 aBtnUpdate ( this, SVX_RES( BTN_UPDATE ) ),
124 aBtnAssign ( this, SVX_RES( BTN_ASSIGN ) ),
126 // Geometrie
127 aFtPercentDiagonal ( this, SVX_RES( FT_PERCENT_DIAGONAL ) ),
128 aMtrPercentDiagonal ( this, SVX_RES( MTR_PERCENT_DIAGONAL ) ),
129 aFtBackscale ( this, SVX_RES( FT_BACKSCALE ) ),
130 aMtrBackscale ( this, SVX_RES( MTR_BACKSCALE ) ),
131 aFtEndAngle ( this, SVX_RES( FT_END_ANGLE ) ),
132 aMtrEndAngle ( this, SVX_RES( MTR_END_ANGLE ) ),
133 aFtDepth ( this, SVX_RES( FT_DEPTH ) ),
134 aMtrDepth ( this, SVX_RES( MTR_DEPTH ) ),
135 aFLGeometrie ( this, SVX_RES( FL_GEOMETRIE ) ),
137 aFtHorizontal ( this, SVX_RES( FT_HORIZONTAL ) ),
138 aNumHorizontal ( this, SVX_RES( NUM_HORIZONTAL ) ),
139 aFtVertical ( this, SVX_RES( FT_VERTICAL ) ),
140 aNumVertical ( this, SVX_RES( NUM_VERTICAL ) ),
141 aFLSegments ( this, SVX_RES( FL_SEGMENTS ) ),
143 aBtnNormalsObj ( this, SVX_RES( BTN_NORMALS_OBJ ) ),
144 aBtnNormalsFlat ( this, SVX_RES( BTN_NORMALS_FLAT ) ),
145 aBtnNormalsSphere ( this, SVX_RES( BTN_NORMALS_SPHERE ) ),
146 aBtnNormalsInvert ( this, SVX_RES( BTN_NORMALS_INVERT ) ),
147 aBtnTwoSidedLighting( this, SVX_RES( BTN_TWO_SIDED_LIGHTING ) ),
148 aFLNormals ( this, SVX_RES( FL_NORMALS ) ),
150 aBtnDoubleSided ( this, SVX_RES( BTN_DOUBLE_SIDED ) ),
152 // Darstellung
153 aFtShademode ( this, SVX_RES( FT_SHADEMODE ) ),
154 aLbShademode ( this, SVX_RES( LB_SHADEMODE ) ),
155 aBtnShadow3d ( this, SVX_RES( BTN_SHADOW_3D ) ),
156 aFtSlant ( this, SVX_RES( FT_SLANT ) ),
157 aMtrSlant ( this, SVX_RES( MTR_SLANT ) ),
158 aFLShadow ( this, SVX_RES( FL_SHADOW ) ),
159 aFtDistance ( this, SVX_RES( FT_DISTANCE ) ),
160 aMtrDistance ( this, SVX_RES( MTR_DISTANCE ) ),
161 aFtFocalLeng ( this, SVX_RES( FT_FOCAL_LENGTH ) ),
162 aMtrFocalLength ( this, SVX_RES( MTR_FOCAL_LENGTH ) ),
163 aFLCamera ( this, SVX_RES( FL_CAMERA ) ),
164 aFLRepresentation ( this, SVX_RES( FL_REPRESENTATION ) ),
166 // Beleuchtung
167 aBtnLight1 ( this, SVX_RES( BTN_LIGHT_1 ) ),
168 aBtnLight2 ( this, SVX_RES( BTN_LIGHT_2 ) ),
169 aBtnLight3 ( this, SVX_RES( BTN_LIGHT_3 ) ),
170 aBtnLight4 ( this, SVX_RES( BTN_LIGHT_4 ) ),
171 aBtnLight5 ( this, SVX_RES( BTN_LIGHT_5 ) ),
172 aBtnLight6 ( this, SVX_RES( BTN_LIGHT_6 ) ),
173 aBtnLight7 ( this, SVX_RES( BTN_LIGHT_7 ) ),
174 aBtnLight8 ( this, SVX_RES( BTN_LIGHT_8 ) ),
175 aLbLight1 ( this, SVX_RES( LB_LIGHT_1 ) ),
176 aLbLight2 ( this, SVX_RES( LB_LIGHT_2 ) ),
177 aLbLight3 ( this, SVX_RES( LB_LIGHT_3 ) ),
178 aLbLight4 ( this, SVX_RES( LB_LIGHT_4 ) ),
179 aLbLight5 ( this, SVX_RES( LB_LIGHT_5 ) ),
180 aLbLight6 ( this, SVX_RES( LB_LIGHT_6 ) ),
181 aLbLight7 ( this, SVX_RES( LB_LIGHT_7 ) ),
182 aLbLight8 ( this, SVX_RES( LB_LIGHT_8 ) ),
184 aBtnLightColor ( this, SVX_RES( BTN_LIGHT_COLOR ) ),
185 aFTLightsource ( this, SVX_RES( FT_LIGHTSOURCE ) ),
187 // #99694# Keyboard shortcuts activate the next control, so the
188 // order needed to be changed here
189 aFTAmbientlight ( this, SVX_RES( FT_AMBIENTLIGHT ) ), // Text label
190 aLbAmbientlight ( this, SVX_RES( LB_AMBIENTLIGHT ) ), // ListBox
191 aBtnAmbientColor ( this, SVX_RES( BTN_AMBIENT_COLOR ) ), // color button
193 aFLLight ( this, SVX_RES( FL_LIGHT ) ),
195 // Texturen
196 aFtTexKind ( this, SVX_RES( FT_TEX_KIND ) ),
197 aBtnTexLuminance ( this, SVX_RES( BTN_TEX_LUMINANCE ) ),
198 aBtnTexColor ( this, SVX_RES( BTN_TEX_COLOR ) ),
199 aFtTexMode ( this, SVX_RES( FT_TEX_MODE ) ),
200 aBtnTexReplace ( this, SVX_RES( BTN_TEX_REPLACE ) ),
201 aBtnTexModulate ( this, SVX_RES( BTN_TEX_MODULATE ) ),
202 aBtnTexBlend ( this, SVX_RES( BTN_TEX_BLEND ) ),
203 aFtTexProjectionX ( this, SVX_RES( FT_TEX_PROJECTION_X ) ),
204 aBtnTexObjectX ( this, SVX_RES( BTN_TEX_OBJECT_X ) ),
205 aBtnTexParallelX ( this, SVX_RES( BTN_TEX_PARALLEL_X ) ),
206 aBtnTexCircleX ( this, SVX_RES( BTN_TEX_CIRCLE_X ) ),
207 aFtTexProjectionY ( this, SVX_RES( FT_TEX_PROJECTION_Y ) ),
208 aBtnTexObjectY ( this, SVX_RES( BTN_TEX_OBJECT_Y ) ),
209 aBtnTexParallelY ( this, SVX_RES( BTN_TEX_PARALLEL_Y ) ),
210 aBtnTexCircleY ( this, SVX_RES( BTN_TEX_CIRCLE_Y ) ),
211 aFtTexFilter ( this, SVX_RES( FT_TEX_FILTER ) ),
212 aBtnTexFilter ( this, SVX_RES( BTN_TEX_FILTER ) ),
213 aFLTexture ( this, SVX_RES( FL_TEXTURE ) ),
215 // Material
216 aFtMatFavorites ( this, SVX_RES( FT_MAT_FAVORITES ) ),
217 aLbMatFavorites ( this, SVX_RES( LB_MAT_FAVORITES ) ),
218 aFtMatColor ( this, SVX_RES( FT_MAT_COLOR ) ),
219 aLbMatColor ( this, SVX_RES( LB_MAT_COLOR ) ),
220 aBtnMatColor ( this, SVX_RES( BTN_MAT_COLOR ) ),
221 aFtMatEmission ( this, SVX_RES( FT_MAT_EMISSION ) ),
222 aLbMatEmission ( this, SVX_RES( LB_MAT_EMISSION ) ),
223 aBtnEmissionColor ( this, SVX_RES( BTN_EMISSION_COLOR ) ),
224 aFtMatSpecular ( this, SVX_RES( FT_MAT_SPECULAR ) ),
225 aLbMatSpecular ( this, SVX_RES( LB_MAT_SPECULAR ) ),
226 aBtnSpecularColor ( this, SVX_RES( BTN_SPECULAR_COLOR ) ),
227 aFtMatSpecularIntensity( this, SVX_RES( FT_MAT_SPECULAR_INTENSITY ) ),
228 aMtrMatSpecularIntensity( this, SVX_RES( MTR_MAT_SPECULAR_INTENSITY ) ),
229 aFLMatSpecular ( this, SVX_RES( FL_MAT_SPECULAR ) ),
230 aFLMaterial ( this, SVX_RES( FL_MATERIAL ) ),
232 // Unterer Bereich
233 aBtnConvertTo3D ( this, SVX_RES( BTN_CHANGE_TO_3D ) ),
234 aBtnLatheObject ( this, SVX_RES( BTN_LATHE_OBJ ) ),
235 aBtnPerspective ( this, SVX_RES( BTN_PERSPECTIVE ) ),
236 aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
237 aCtlLightPreview ( this, SVX_RES( CTL_LIGHT_PREVIEW ) ),
239 aImgLightOn ( SVX_RES( RID_SVXIMAGE_LIGHT_ON ) ),
240 aImgLightOff ( SVX_RES( RID_SVXIMAGE_LIGHT_OFF ) ),
242 bUpdate ( FALSE ),
243 eViewType ( VIEWTYPE_GEO ),
245 pModel ( NULL ),
246 pFmPage ( NULL ),
247 pVDev ( NULL ),
248 p3DView ( NULL ),
249 pFavorSetList ( NULL ),
250 pMatFavSetList ( NULL ),
252 pBindings ( pInBindings ),
253 pControllerItem(0L),
254 pConvertTo3DItem(0L),
255 pConvertTo3DLatheItem(0L),
256 // pPool ( NULL ),
257 mpImpl ( new Svx3DWinImpl() ),
258 mpRemember2DAttributes(NULL),
259 bOnly3DChanged ( FALSE )
261 SETHCIMAGE( aBtnGeo, BMP_GEO_H );
262 SETHCIMAGE( aBtnRepresentation, BMP_REPRESENTATION_H );
263 SETHCIMAGE( aBtnLight, BMP_3DLIGHT_H );
264 SETHCIMAGE( aBtnTexture, BMP_TEXTURE_H );
265 SETHCIMAGE( aBtnMaterial, BMP_MATERIAL_H );
266 SETHCIMAGE( aBtnUpdate, BMP_UPDATE_H );
267 SETHCIMAGE( aBtnAssign, BMP_ASSIGN_H );
268 SETHCIMAGE( aBtnNormalsObj, BMP_NORMALS_OBJ_H );
269 SETHCIMAGE( aBtnNormalsFlat, BMP_NORMALS_FLAT_H );
270 SETHCIMAGE( aBtnNormalsSphere, BMP_NORMALS_SPHERE_H );
271 SETHCIMAGE( aBtnTwoSidedLighting, BMP_TWO_SIDED_LIGHTING_H );
272 SETHCIMAGE( aBtnNormalsInvert, BMP_NORMALS_INVERT_H );
273 SETHCIMAGE( aBtnDoubleSided, BMP_DOUBLE_SIDED_H );
274 SETHCIMAGE( aBtnShadow3d, BMP_SHADOW_3D_H );
275 SETHCIMAGE( aBtnLight1, BMP_LIGHT_H );
276 SETHCIMAGE( aBtnLight2, BMP_LIGHT_H );
277 SETHCIMAGE( aBtnLight3, BMP_LIGHT_H );
278 SETHCIMAGE( aBtnLight4, BMP_LIGHT_H );
279 SETHCIMAGE( aBtnLight5, BMP_LIGHT_H );
280 SETHCIMAGE( aBtnLight6, BMP_LIGHT_H );
281 SETHCIMAGE( aBtnLight7, BMP_LIGHT_H );
282 SETHCIMAGE( aBtnLight8, BMP_LIGHT_H );
283 SETHCIMAGE( aBtnLightColor, BMP_LIGHT_COLOR_H );
284 SETHCIMAGE( aBtnAmbientColor, BMP_AMBIENT_COLOR_H );
285 SETHCIMAGE( aBtnTexLuminance, BMP_TEX_LUMINANCE_H );
286 SETHCIMAGE( aBtnTexColor, BMP_TEX_COLOR_H );
287 SETHCIMAGE( aBtnTexReplace, BMP_TEX_REPLACE_H );
288 SETHCIMAGE( aBtnTexModulate, BMP_TEX_MODULATE_H );
289 SETHCIMAGE( aBtnTexBlend, BMP_TEX_BLEND_H );
290 SETHCIMAGE( aBtnTexParallelX, BMP_TEX_PARALLEL_H );
291 SETHCIMAGE( aBtnTexCircleX, BMP_TEX_CIRCLE_H );
292 SETHCIMAGE( aBtnTexObjectX, BMP_TEX_OBJECT_H );
293 SETHCIMAGE( aBtnTexParallelY, BMP_TEX_PARALLEL_H );
294 SETHCIMAGE( aBtnTexCircleY, BMP_TEX_CIRCLE_H );
295 SETHCIMAGE( aBtnTexObjectY, BMP_TEX_OBJECT_H );
296 SETHCIMAGE( aBtnTexFilter, BMP_TEX_FILTER_H );
297 SETHCIMAGE( aBtnMatColor, BMP_COLORDLG_H );
298 SETHCIMAGE( aBtnEmissionColor, BMP_COLORDLG_H );
299 SETHCIMAGE( aBtnSpecularColor, BMP_COLORDLG_H );
300 SETHCIMAGE( aBtnPerspective, BMP_PERSPECTIVE_H );
301 SETHCIMAGE( aBtnConvertTo3D, BMP_CHANGE_TO_3D_H );
302 SETHCIMAGE( aBtnLatheObject, BMP_LATHE_OBJ_H );
304 mpImpl->pPool = NULL;
305 mpImpl->maImgLightOnH = Image( SVX_RES( RID_SVXIMAGE_LIGHT_ON_H ) );
306 mpImpl->maImgLightOffH = Image( SVX_RES( RID_SVXIMAGE_LIGHT_OFF_H ) );
307 FreeResource();
309 // Metrik einstellen
310 eFUnit = GetModuleFieldUnit( NULL );
311 aMtrDepth.SetUnit( eFUnit );
312 aMtrDistance.SetUnit( eFUnit );
313 aMtrFocalLength.SetUnit( eFUnit );
315 pControllerItem = new Svx3DCtrlItem(SID_3D_STATE, this, pBindings);
316 pConvertTo3DItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D, pBindings);
317 pConvertTo3DLatheItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST, pBindings);
319 aBtnAssign.SetClickHdl( LINK( this, Svx3DWin, ClickAssignHdl ) );
320 aBtnUpdate.SetClickHdl( LINK( this, Svx3DWin, ClickUpdateHdl ) );
322 Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
323 aBtnGeo.SetClickHdl( aLink );
324 aBtnRepresentation.SetClickHdl( aLink );
325 aBtnLight.SetClickHdl( aLink );
326 aBtnTexture.SetClickHdl( aLink );
327 aBtnMaterial.SetClickHdl( aLink );
329 aLink = LINK( this, Svx3DWin, ClickHdl );
330 aBtnPerspective.SetClickHdl( aLink );
331 aBtnConvertTo3D.SetClickHdl( aLink );
332 aBtnLatheObject.SetClickHdl( aLink );
334 // Geometrie
335 aBtnNormalsObj.SetClickHdl( aLink );
336 aBtnNormalsFlat.SetClickHdl( aLink );
337 aBtnNormalsSphere.SetClickHdl( aLink );
338 aBtnTwoSidedLighting.SetClickHdl( aLink );
339 aBtnNormalsInvert.SetClickHdl( aLink );
340 aBtnDoubleSided.SetClickHdl( aLink );
342 // Darstellung
343 aBtnShadow3d.SetClickHdl( aLink );
345 // Beleuchtung
346 aBtnLight1.SetClickHdl( aLink );
347 aBtnLight2.SetClickHdl( aLink );
348 aBtnLight3.SetClickHdl( aLink );
349 aBtnLight4.SetClickHdl( aLink );
350 aBtnLight5.SetClickHdl( aLink );
351 aBtnLight6.SetClickHdl( aLink );
352 aBtnLight7.SetClickHdl( aLink );
353 aBtnLight8.SetClickHdl( aLink );
355 // Texturen
356 aBtnTexLuminance.SetClickHdl( aLink );
357 aBtnTexColor.SetClickHdl( aLink );
358 aBtnTexReplace.SetClickHdl( aLink );
359 aBtnTexModulate.SetClickHdl( aLink );
360 //aBtnTexBlend.SetClickHdl( aLink );
361 aBtnTexParallelX.SetClickHdl( aLink );
362 aBtnTexCircleX.SetClickHdl( aLink );
363 aBtnTexObjectX.SetClickHdl( aLink );
364 aBtnTexParallelY.SetClickHdl( aLink );
365 aBtnTexCircleY.SetClickHdl( aLink );
366 aBtnTexObjectY.SetClickHdl( aLink );
367 aBtnTexFilter.SetClickHdl( aLink );
369 // Material
370 aLink = LINK( this, Svx3DWin, ClickColorHdl );
371 aBtnLightColor.SetClickHdl( aLink );
372 aBtnAmbientColor.SetClickHdl( aLink );
373 aBtnMatColor.SetClickHdl( aLink );
374 aBtnEmissionColor.SetClickHdl( aLink );
375 aBtnSpecularColor.SetClickHdl( aLink );
378 aLink = LINK( this, Svx3DWin, SelectHdl );
379 aLbMatFavorites.SetSelectHdl( aLink );
380 aLbMatColor.SetSelectHdl( aLink );
381 aLbMatEmission.SetSelectHdl( aLink );
382 aLbMatSpecular.SetSelectHdl( aLink );
383 aLbLight1.SetSelectHdl( aLink );
384 aLbLight2.SetSelectHdl( aLink );
385 aLbLight3.SetSelectHdl( aLink );
386 aLbLight4.SetSelectHdl( aLink );
387 aLbLight5.SetSelectHdl( aLink );
388 aLbLight6.SetSelectHdl( aLink );
389 aLbLight7.SetSelectHdl( aLink );
390 aLbLight8.SetSelectHdl( aLink );
391 aLbAmbientlight.SetSelectHdl( aLink );
392 aLbShademode.SetSelectHdl( aLink );
394 aLink = LINK( this, Svx3DWin, ModifyHdl );
395 aMtrMatSpecularIntensity.SetModifyHdl( aLink );
396 aNumHorizontal.SetModifyHdl( aLink );
397 aNumVertical.SetModifyHdl( aLink );
398 aMtrSlant.SetModifyHdl( aLink );
400 // Preview-Callback
401 aLink = LINK( this, Svx3DWin, ChangeLightCallbackHdl );
402 aCtlLightPreview.SetUserInteractiveChangeCallback(aLink);
403 aLink = LINK( this, Svx3DWin, ChangeSelectionCallbackHdl );
404 aCtlLightPreview.SetUserSelectionChangeCallback(aLink);
406 aSize = GetOutputSizePixel();
407 SetMinOutputSizePixel( aSize );
409 Construct();
411 // Initiierung der Initialisierung der ColorLBs
412 SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
413 if (pDispatcher != NULL)
415 SfxBoolItem aItem( SID_3D_INIT, TRUE );
416 pDispatcher->Execute(
417 SID_3D_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
420 Reset();
423 // -----------------------------------------------------------------------
424 __EXPORT Svx3DWin::~Svx3DWin()
426 //delete pMatFavSetList;
427 delete p3DView;
428 delete pVDev;
429 delete pModel;
431 delete pControllerItem;
432 delete pConvertTo3DItem;
433 delete pConvertTo3DLatheItem;
435 if(mpRemember2DAttributes)
436 delete mpRemember2DAttributes;
438 delete mpImpl;
441 // -----------------------------------------------------------------------
442 void Svx3DWin::Construct()
444 aBtnGeo.Check();
445 Link aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
446 aLink.Call( &aBtnGeo );
447 aCtlLightPreview.Hide();
450 // -----------------------------------------------------------------------
451 void Svx3DWin::Reset()
453 // Diverse Initialisierungen, default ist AllAttributes
454 aLbShademode.SelectEntryPos( 0 );
455 aMtrMatSpecularIntensity.SetValue( 50 );
457 aBtnLight1.Check();
458 ClickUpdateHdl( NULL );
460 // Nichts selektieren, um Fehler beim erstselektieren zu vermeiden
461 aCtlLightPreview.GetSvx3DLightControl().SelectLight(0);
464 bool Svx3DWin::GetUILightState( ImageButton& aBtn ) const
466 return (aBtn.GetModeImage() == aImgLightOn) || (aBtn.GetModeImage() == mpImpl->maImgLightOnH);
469 void Svx3DWin::SetUILightState( ImageButton& aBtn, bool bState )
471 aBtn.SetModeImage( bState ? aImgLightOn : aImgLightOff );
472 aBtn.SetModeImage( bState ? mpImpl->maImgLightOnH : mpImpl->maImgLightOffH, BMP_COLOR_HIGHCONTRAST );
475 // -----------------------------------------------------------------------
476 void Svx3DWin::Update( SfxItemSet& rAttrs )
478 // remember 2d attributes
479 if(mpRemember2DAttributes)
480 mpRemember2DAttributes->ClearItem();
481 else
482 mpRemember2DAttributes = new SfxItemSet(*rAttrs.GetPool(),
483 SDRATTR_START, SDRATTR_SHADOW_LAST,
484 SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
485 0, 0);
487 SfxWhichIter aIter(*mpRemember2DAttributes);
488 sal_uInt16 nWhich(aIter.FirstWhich());
490 while(nWhich)
492 SfxItemState eState = rAttrs.GetItemState(nWhich, FALSE);
493 if(SFX_ITEM_DONTCARE == eState)
494 mpRemember2DAttributes->InvalidateItem(nWhich);
495 else if(SFX_ITEM_SET == eState)
496 mpRemember2DAttributes->Put(rAttrs.Get(nWhich, FALSE));
498 nWhich = aIter.NextWhich();
501 // construct field values
502 const SfxPoolItem* pItem;
503 //BOOL bUpdate = FALSE;
505 // evtl. PoolUnit ermitteln
506 if( !mpImpl->pPool )
508 mpImpl->pPool = rAttrs.GetPool();
509 DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
510 ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
512 eFUnit = GetModuleFieldUnit( &rAttrs );
515 // Segmentanzahl aenderbar ? und andere Stati
516 SfxItemState eState = rAttrs.GetItemState( SID_ATTR_3D_INTERN, FALSE, &pItem );
517 if( SFX_ITEM_SET == eState )
519 UINT32 nState = ( ( const SfxUInt32Item* )pItem )->GetValue();
520 //BOOL bLathe = (BOOL) ( nState & 1 );
521 BOOL bExtrude = (BOOL) ( nState & 2 );
522 BOOL bSphere = (BOOL) ( nState & 4 );
523 BOOL bCube = (BOOL) ( nState & 8 );
525 BOOL bChart = (BOOL) ( nState & 32 ); // Chart
527 if( !bChart )
529 // Bei Cube-Objekten werden keine Segmente eingestellt
530 aFtHorizontal.Enable( !bCube );
531 aNumHorizontal.Enable( !bCube );
532 aFtVertical.Enable( !bCube );
533 aNumVertical.Enable( !bCube );
534 aFLSegments.Enable( !bCube );
536 aFtPercentDiagonal.Enable( !bCube && !bSphere );
537 aMtrPercentDiagonal.Enable( !bCube && !bSphere );
538 aFtBackscale.Enable( !bCube && !bSphere );
539 aMtrBackscale.Enable( !bCube && !bSphere );
540 aFtDepth.Enable( !bCube && !bSphere );
541 aMtrDepth.Enable( !bCube && !bSphere );
542 if( bCube )
544 aNumHorizontal.SetEmptyFieldValue();
545 aNumVertical.SetEmptyFieldValue();
547 if( bCube || bSphere )
549 aMtrPercentDiagonal.SetEmptyFieldValue();
550 aMtrBackscale.SetEmptyFieldValue();
551 aMtrDepth.SetEmptyFieldValue();
554 // Nur bei Lathe-Objekten gibt es einen Endwinkel
555 aFtEndAngle.Enable( !bExtrude && !bCube && !bSphere );
556 aMtrEndAngle.Enable( !bExtrude && !bCube && !bSphere );
557 if( bExtrude || bCube || bSphere )
558 aMtrEndAngle.SetEmptyFieldValue();
560 else
562 // Geometrie
563 aFtHorizontal.Enable( FALSE );
564 aNumHorizontal.Enable( FALSE );
565 aNumHorizontal.SetEmptyFieldValue();
566 aFtVertical.Enable( FALSE );
567 aNumVertical.Enable( FALSE );
568 aNumVertical.SetEmptyFieldValue();
569 aFLSegments.Enable( FALSE );
570 aFtEndAngle.Enable( FALSE );
571 aMtrEndAngle.Enable( FALSE );
572 aMtrEndAngle.SetEmptyFieldValue();
573 aFtDepth.Enable( FALSE );
574 aMtrDepth.Enable( FALSE );
575 aMtrDepth.SetEmptyFieldValue();
577 // Darstellung
578 aBtnShadow3d.Enable( FALSE );
579 aFtSlant.Enable( FALSE );
580 aMtrSlant.Enable( FALSE );
581 aFLShadow.Enable( FALSE );
583 aFtDistance.Enable( FALSE );
584 aMtrDistance.Enable( FALSE );
585 aMtrDistance.SetEmptyFieldValue();
586 aFtFocalLeng.Enable( FALSE );
587 aMtrFocalLength.Enable( FALSE );
588 aMtrFocalLength.SetEmptyFieldValue();
589 aFLCamera.Enable( FALSE );
591 // Unterer Bereich
592 aBtnConvertTo3D.Enable( FALSE );
593 aBtnLatheObject.Enable( FALSE );
596 // Bitmapfuellung ? -> Status
597 BOOL bBitmap(FALSE);
598 eState = rAttrs.GetItemState(XATTR_FILLSTYLE);
599 if(eState != SFX_ITEM_DONTCARE)
601 XFillStyle eXFS = (XFillStyle)((const XFillStyleItem&)rAttrs.Get(XATTR_FILLSTYLE)).GetValue();
602 bBitmap = (eXFS == XFILL_BITMAP || eXFS == XFILL_GRADIENT || eXFS == XFILL_HATCH);
605 aFtTexKind.Enable( bBitmap );
606 aBtnTexLuminance.Enable( bBitmap );
607 aBtnTexColor.Enable( bBitmap );
608 aFtTexMode.Enable( bBitmap );
609 aBtnTexReplace.Enable( bBitmap );
610 aBtnTexModulate.Enable( bBitmap );
611 aBtnTexBlend.Enable( bBitmap );
612 aFtTexProjectionX.Enable( bBitmap );
613 aBtnTexParallelX.Enable( bBitmap );
614 aBtnTexCircleX.Enable( bBitmap );
615 aBtnTexObjectX.Enable( bBitmap );
616 aFtTexProjectionY.Enable( bBitmap );
617 aBtnTexParallelY.Enable( bBitmap );
618 aBtnTexCircleY.Enable( bBitmap );
619 aBtnTexObjectY.Enable( bBitmap );
620 aFtTexFilter.Enable( bBitmap );
621 aBtnTexFilter.Enable( bBitmap );
622 aFLTexture.Enable( bBitmap );
625 // Geometrie
626 // Anzahl Segmente (horizontal)
627 if( aNumHorizontal.IsEnabled() )
629 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_HORZ_SEGS);
630 if(eState != SFX_ITEM_DONTCARE)
632 sal_uInt32 nValue = ((const Svx3DHorizontalSegmentsItem&)rAttrs.Get(SDRATTR_3DOBJ_HORZ_SEGS)).GetValue();
633 if(nValue != (sal_uInt32 )aNumHorizontal.GetValue())
635 aNumHorizontal.SetValue( nValue );
636 // evtl. am Ende...
637 // aCtlLightPreview.GetSvx3DLightControl().SetHorizontalSegments( (UINT16)nValue );
638 bUpdate = TRUE;
640 else if( aNumHorizontal.IsEmptyFieldValue() )
641 aNumHorizontal.SetValue( nValue );
643 else
645 if( !aNumHorizontal.IsEmptyFieldValue() )
647 aNumHorizontal.SetEmptyFieldValue();
648 bUpdate = TRUE;
653 // Anzahl Segmente (vertikal)
654 if( aNumVertical.IsEnabled() )
656 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_VERT_SEGS);
657 if( eState != SFX_ITEM_DONTCARE )
659 UINT32 nValue = ((const Svx3DVerticalSegmentsItem&)rAttrs.Get(SDRATTR_3DOBJ_VERT_SEGS)).GetValue();
660 if( nValue != (UINT32) aNumVertical.GetValue() )
662 aNumVertical.SetValue( nValue );
663 // evtl. am Ende...
664 //aCtlLightPreview.GetSvx3DLightControl().SetVerticalSegments( (UINT16)nValue );
665 bUpdate = TRUE;
667 else if( aNumVertical.IsEmptyFieldValue() )
668 aNumVertical.SetValue( nValue );
670 else
672 if( !aNumVertical.IsEmptyFieldValue() )
674 aNumVertical.SetEmptyFieldValue();
675 bUpdate = TRUE;
680 // Tiefe
681 if( aMtrDepth.IsEnabled() )
683 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DEPTH);
684 if( eState != SFX_ITEM_DONTCARE )
686 UINT32 nValue = ((const Svx3DDepthItem&)rAttrs.Get(SDRATTR_3DOBJ_DEPTH)).GetValue();
687 UINT32 nValue2 = GetCoreValue( aMtrDepth, ePoolUnit );
688 if( nValue != nValue2 )
690 if( eFUnit != aMtrDepth.GetUnit() )
691 SetFieldUnit( aMtrDepth, eFUnit );
693 SetMetricValue( aMtrDepth, nValue, ePoolUnit );
694 bUpdate = TRUE;
696 else if( aMtrDepth.IsEmptyFieldValue() )
697 aMtrDepth.SetValue( aMtrDepth.GetValue() );
699 else
701 if( !aMtrDepth.IsEmptyFieldValue() )
703 aMtrDepth.SetEmptyFieldValue();
704 bUpdate = TRUE;
709 // Doppelwandig/-seitig
710 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DOUBLE_SIDED);
711 if( eState != SFX_ITEM_DONTCARE )
713 BOOL bValue = ((const Svx3DDoubleSidedItem&)rAttrs.Get(SDRATTR_3DOBJ_DOUBLE_SIDED)).GetValue();
714 if( bValue != aBtnDoubleSided.IsChecked() )
716 aBtnDoubleSided.Check( bValue );
717 bUpdate = TRUE;
719 else if( aBtnDoubleSided.GetState() == STATE_DONTKNOW )
720 aBtnDoubleSided.Check( bValue );
722 else
724 if( aBtnDoubleSided.GetState() != STATE_DONTKNOW )
726 aBtnDoubleSided.SetState( STATE_DONTKNOW );
727 bUpdate = TRUE;
731 // Kantenrundung
732 if( aMtrPercentDiagonal.IsEnabled() )
734 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_PERCENT_DIAGONAL);
735 if( eState != SFX_ITEM_DONTCARE )
737 UINT16 nValue = ((const Svx3DPercentDiagonalItem&)rAttrs.Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue();
738 if( nValue != aMtrPercentDiagonal.GetValue() )
740 aMtrPercentDiagonal.SetValue( nValue );
741 bUpdate = TRUE;
743 else if( aMtrPercentDiagonal.IsEmptyFieldValue() )
744 aMtrPercentDiagonal.SetValue( nValue );
746 else
748 if( !aMtrPercentDiagonal.IsEmptyFieldValue() )
750 aMtrPercentDiagonal.SetEmptyFieldValue();
751 bUpdate = TRUE;
756 // Tiefenskalierung
757 if( aMtrBackscale.IsEnabled() )
759 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_BACKSCALE);
760 if( eState != SFX_ITEM_DONTCARE )
762 UINT16 nValue = ((const Svx3DBackscaleItem&)rAttrs.Get(SDRATTR_3DOBJ_BACKSCALE)).GetValue();
763 if( nValue != aMtrBackscale.GetValue() )
765 aMtrBackscale.SetValue( nValue );
766 bUpdate = TRUE;
768 else if( aMtrBackscale.IsEmptyFieldValue() )
769 aMtrBackscale.SetValue( nValue );
771 else
773 if( !aMtrBackscale.IsEmptyFieldValue() )
775 aMtrBackscale.SetEmptyFieldValue();
776 bUpdate = TRUE;
781 // Endwinkel
782 if( aMtrEndAngle.IsEnabled() )
784 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_END_ANGLE);
785 if( eState != SFX_ITEM_DONTCARE )
787 INT32 nValue = ((const Svx3DEndAngleItem&)rAttrs.Get(SDRATTR_3DOBJ_END_ANGLE)).GetValue();
788 if( nValue != aMtrEndAngle.GetValue() )
790 aMtrEndAngle.SetValue( nValue );
791 bUpdate = TRUE;
794 else
796 if( !aMtrEndAngle.IsEmptyFieldValue() )
798 aMtrEndAngle.SetEmptyFieldValue();
799 bUpdate = TRUE;
804 // Normalentyp
805 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_KIND);
806 if( eState != SFX_ITEM_DONTCARE )
808 UINT16 nValue = ((const Svx3DNormalsKindItem&)rAttrs.Get(SDRATTR_3DOBJ_NORMALS_KIND)).GetValue();
810 if( ( !aBtnNormalsObj.IsChecked() && nValue == 0 ) ||
811 ( !aBtnNormalsFlat.IsChecked() && nValue == 1 ) ||
812 ( !aBtnNormalsSphere.IsChecked() && nValue == 2 ) )
814 aBtnNormalsObj.Check( nValue == 0 );
815 aBtnNormalsFlat.Check( nValue == 1 );
816 aBtnNormalsSphere.Check( nValue == 2 );
817 bUpdate = TRUE;
820 else
822 if( aBtnNormalsObj.IsChecked() ||
823 aBtnNormalsFlat.IsChecked() ||
824 aBtnNormalsSphere.IsChecked() )
826 aBtnNormalsObj.Check( FALSE );
827 aBtnNormalsFlat.Check( FALSE );
828 aBtnNormalsSphere.Check( FALSE );
829 bUpdate = TRUE;
833 // Normalen invertieren
834 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_INVERT);
835 if( eState != SFX_ITEM_DONTCARE )
837 BOOL bValue = ((const Svx3DNormalsInvertItem&)rAttrs.Get(SDRATTR_3DOBJ_NORMALS_INVERT)).GetValue();
838 if( bValue != aBtnNormalsInvert.IsChecked() )
840 aBtnNormalsInvert.Check( bValue );
841 bUpdate = TRUE;
843 else if( aBtnNormalsInvert.GetState() == STATE_DONTKNOW )
844 aBtnNormalsInvert.Check( bValue );
846 else
848 if( aBtnNormalsInvert.GetState() != STATE_DONTKNOW )
850 aBtnNormalsInvert.SetState( STATE_DONTKNOW );
851 bUpdate = TRUE;
855 // 2-seitige Beleuchtung
856 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING);
857 if( eState != SFX_ITEM_DONTCARE )
859 BOOL bValue = ((const Svx3DTwoSidedLightingItem&)rAttrs.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue();
860 if( bValue != aBtnTwoSidedLighting.IsChecked() )
862 aBtnTwoSidedLighting.Check( bValue );
863 bUpdate = TRUE;
865 else if( aBtnTwoSidedLighting.GetState() == STATE_DONTKNOW )
866 aBtnTwoSidedLighting.Check( bValue );
868 else
870 if( aBtnTwoSidedLighting.GetState() != STATE_DONTKNOW )
872 aBtnTwoSidedLighting.SetState( STATE_DONTKNOW );
873 bUpdate = TRUE;
877 // Darstellung
878 // Shademode
879 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADE_MODE);
880 if( eState != SFX_ITEM_DONTCARE )
882 UINT16 nValue = ((const Svx3DShadeModeItem&)rAttrs.Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue();
883 if( nValue != aLbShademode.GetSelectEntryPos() )
885 aLbShademode.SelectEntryPos( nValue );
886 bUpdate = TRUE;
889 else
891 if( aLbShademode.GetSelectEntryCount() != 0 )
893 aLbShademode.SetNoSelection();
894 bUpdate = TRUE;
898 // 3D-Shatten
899 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_SHADOW_3D);
900 if( eState != SFX_ITEM_DONTCARE )
902 BOOL bValue = ((const Svx3DShadow3DItem&)rAttrs.Get(SDRATTR_3DOBJ_SHADOW_3D)).GetValue();
903 if( bValue != aBtnShadow3d.IsChecked() )
905 aBtnShadow3d.Check( bValue );
906 aFtSlant.Enable( bValue );
907 aMtrSlant.Enable( bValue );
908 bUpdate = TRUE;
910 else if( aBtnShadow3d.GetState() == STATE_DONTKNOW )
911 aBtnShadow3d.Check( bValue );
913 else
915 if( aBtnShadow3d.GetState() != STATE_DONTKNOW )
917 aBtnShadow3d.SetState( STATE_DONTKNOW );
918 bUpdate = TRUE;
922 // Neigung (Schatten)
923 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADOW_SLANT);
924 if( eState != SFX_ITEM_DONTCARE )
926 UINT16 nValue = ((const Svx3DShadowSlantItem&)rAttrs.Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue();
927 if( nValue != aMtrSlant.GetValue() )
929 aMtrSlant.SetValue( nValue );
930 bUpdate = TRUE;
933 else
935 if( !aMtrSlant.IsEmptyFieldValue() )
937 aMtrSlant.SetEmptyFieldValue();
938 bUpdate = TRUE;
942 // Distanz
943 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_DISTANCE);
944 if( eState != SFX_ITEM_DONTCARE )
946 UINT32 nValue = ((const Svx3DDistanceItem&)rAttrs.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue();
947 UINT32 nValue2 = GetCoreValue( aMtrDistance, ePoolUnit );
948 if( nValue != nValue2 )
950 if( eFUnit != aMtrDistance.GetUnit() )
951 SetFieldUnit( aMtrDistance, eFUnit );
953 SetMetricValue( aMtrDistance, nValue, ePoolUnit );
954 bUpdate = TRUE;
957 else
959 if( !aMtrDepth.IsEmptyFieldValue() )
961 aMtrDepth.SetEmptyFieldValue();
962 bUpdate = TRUE;
966 // Brennweite
967 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_FOCAL_LENGTH);
968 if( eState != SFX_ITEM_DONTCARE )
970 UINT32 nValue = ((const Svx3DFocalLengthItem&)rAttrs.Get(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue();
971 UINT32 nValue2 = GetCoreValue( aMtrFocalLength, ePoolUnit );
972 if( nValue != nValue2 )
974 if( eFUnit != aMtrFocalLength.GetUnit() )
975 SetFieldUnit( aMtrFocalLength, eFUnit );
977 SetMetricValue( aMtrFocalLength, nValue, ePoolUnit );
978 bUpdate = TRUE;
981 else
983 if( !aMtrFocalLength.IsEmptyFieldValue() )
985 aMtrFocalLength.SetEmptyFieldValue();
986 bUpdate = TRUE;
990 // Beleuchtung
991 Color aColor;
992 basegfx::B3DVector aVector;
993 // Licht 1 (Farbe)
994 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_1);
995 if( eState != SFX_ITEM_DONTCARE )
997 aColor = ((const Svx3DLightcolor1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
998 ColorLB* pLb = &aLbLight1;
999 if( aColor != pLb->GetSelectEntryColor() )
1001 LBSelectColor( pLb, aColor );
1002 bUpdate = TRUE;
1005 else
1007 if( aLbLight1.GetSelectEntryCount() != 0 )
1009 aLbLight1.SetNoSelection();
1010 bUpdate = TRUE;
1013 // Licht 1 (an/aus)
1014 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_1);
1015 if( eState != SFX_ITEM_DONTCARE )
1017 bool bOn = ((const Svx3DLightOnOff1Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue() != 0;
1018 if( ( bOn && !GetUILightState( aBtnLight1 )) ||
1019 ( !bOn && GetUILightState( aBtnLight1 )) )
1021 SetUILightState( aBtnLight1, bOn );
1022 bUpdate = TRUE;
1024 if( aBtnLight1.GetState() == STATE_DONTKNOW )
1025 aBtnLight1.Check( aBtnLight1.IsChecked() );
1027 else
1029 if( aBtnLight1.GetState() != STATE_DONTKNOW )
1031 aBtnLight1.SetState( STATE_DONTKNOW );
1032 bUpdate = TRUE;
1035 // Licht 1 (Richtung)
1036 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_1);
1037 if( eState != SFX_ITEM_DONTCARE )
1039 bUpdate = TRUE;
1042 // Licht 2 (Farbe)
1043 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_2);
1044 if( eState != SFX_ITEM_DONTCARE )
1046 aColor = ((const Svx3DLightcolor2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
1047 ColorLB* pLb = &aLbLight2;
1048 if( aColor != pLb->GetSelectEntryColor() )
1050 LBSelectColor( pLb, aColor );
1051 bUpdate = TRUE;
1054 else
1056 if( aLbLight2.GetSelectEntryCount() != 0 )
1058 aLbLight2.SetNoSelection();
1059 bUpdate = TRUE;
1062 // Licht 2 (an/aus)
1063 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_2);
1064 if( eState != SFX_ITEM_DONTCARE )
1066 bool bOn = ((const Svx3DLightOnOff2Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue() != 0;
1067 if( ( bOn && !GetUILightState( aBtnLight2 )) ||
1068 ( !bOn && GetUILightState( aBtnLight2 )) )
1070 SetUILightState( aBtnLight2, bOn );
1071 bUpdate = TRUE;
1073 if( aBtnLight2.GetState() == STATE_DONTKNOW )
1074 aBtnLight2.Check( aBtnLight2.IsChecked() );
1076 else
1078 if( aBtnLight2.GetState() != STATE_DONTKNOW )
1080 aBtnLight2.SetState( STATE_DONTKNOW );
1081 bUpdate = TRUE;
1084 // Licht 2 (Richtung)
1085 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_2);
1086 if( eState != SFX_ITEM_DONTCARE )
1088 bUpdate = TRUE;
1091 // Licht 3 (Farbe)
1092 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_3);
1093 if( eState != SFX_ITEM_DONTCARE )
1095 aColor = ((const Svx3DLightcolor3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
1096 ColorLB* pLb = &aLbLight3;
1097 if( aColor != pLb->GetSelectEntryColor() )
1099 LBSelectColor( pLb, aColor );
1100 bUpdate = TRUE;
1103 else
1105 if( aLbLight3.GetSelectEntryCount() != 0 )
1107 aLbLight3.SetNoSelection();
1108 bUpdate = TRUE;
1111 // Licht 3 (an/aus)
1112 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_3);
1113 if( eState != SFX_ITEM_DONTCARE )
1115 bool bOn = ((const Svx3DLightOnOff3Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue() != 0;
1116 if( ( bOn && !GetUILightState( aBtnLight3)) ||
1117 ( !bOn && GetUILightState( aBtnLight3)) )
1119 SetUILightState( aBtnLight3, bOn );
1120 bUpdate = TRUE;
1122 if( aBtnLight3.GetState() == STATE_DONTKNOW )
1123 aBtnLight3.Check( aBtnLight3.IsChecked() );
1125 else
1127 if( aBtnLight3.GetState() != STATE_DONTKNOW )
1129 aBtnLight3.SetState( STATE_DONTKNOW );
1130 bUpdate = TRUE;
1133 // Licht 3 (Richtung)
1134 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_3);
1135 if( eState != SFX_ITEM_DONTCARE )
1137 bUpdate = TRUE;
1140 // Licht 4 (Farbe)
1141 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_4);
1142 if( eState != SFX_ITEM_DONTCARE )
1144 aColor = ((const Svx3DLightcolor4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
1145 ColorLB* pLb = &aLbLight4;
1146 if( aColor != pLb->GetSelectEntryColor() )
1148 LBSelectColor( pLb, aColor );
1149 bUpdate = TRUE;
1152 else
1154 if( aLbLight4.GetSelectEntryCount() != 0 )
1156 aLbLight4.SetNoSelection();
1157 bUpdate = TRUE;
1160 // Licht 4 (an/aus)
1161 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_4);
1162 if( eState != SFX_ITEM_DONTCARE )
1164 bool bOn = ((const Svx3DLightOnOff4Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue() != 0;
1165 if( ( bOn && !GetUILightState( aBtnLight4 )) ||
1166 ( !bOn && GetUILightState( aBtnLight4 )) )
1168 SetUILightState( aBtnLight4, bOn );
1169 bUpdate = TRUE;
1171 if( aBtnLight4.GetState() == STATE_DONTKNOW )
1172 aBtnLight4.Check( aBtnLight4.IsChecked() );
1174 else
1176 if( aBtnLight4.GetState() != STATE_DONTKNOW )
1178 aBtnLight4.SetState( STATE_DONTKNOW );
1179 bUpdate = TRUE;
1182 // Licht 4 (Richtung)
1183 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_4);
1184 if( eState != SFX_ITEM_DONTCARE )
1186 bUpdate = TRUE;
1189 // Licht 5 (Farbe)
1190 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_5);
1191 if( eState != SFX_ITEM_DONTCARE )
1193 aColor = ((const Svx3DLightcolor5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
1194 ColorLB* pLb = &aLbLight5;
1195 if( aColor != pLb->GetSelectEntryColor() )
1197 LBSelectColor( pLb, aColor );
1198 bUpdate = TRUE;
1201 else
1203 if( aLbLight5.GetSelectEntryCount() != 0 )
1205 aLbLight5.SetNoSelection();
1206 bUpdate = TRUE;
1209 // Licht 5 (an/aus)
1210 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_5);
1211 if( eState != SFX_ITEM_DONTCARE )
1213 bool bOn = ((const Svx3DLightOnOff5Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue() != 0;
1214 if( ( bOn && !GetUILightState( aBtnLight5 )) ||
1215 ( !bOn && GetUILightState( aBtnLight5 )) )
1217 SetUILightState( aBtnLight5, bOn );
1218 bUpdate = TRUE;
1220 if( aBtnLight5.GetState() == STATE_DONTKNOW )
1221 aBtnLight5.Check( aBtnLight5.IsChecked() );
1223 else
1225 if( aBtnLight5.GetState() != STATE_DONTKNOW )
1227 aBtnLight5.SetState( STATE_DONTKNOW );
1228 bUpdate = TRUE;
1231 // Licht 5 (Richtung)
1232 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_5);
1233 if( eState != SFX_ITEM_DONTCARE )
1235 bUpdate = TRUE;
1238 // Licht 6 (Farbe)
1239 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_6);
1240 if( eState != SFX_ITEM_DONTCARE )
1242 aColor = ((const Svx3DLightcolor6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
1243 ColorLB* pLb = &aLbLight6;
1244 if( aColor != pLb->GetSelectEntryColor() )
1246 LBSelectColor( pLb, aColor );
1247 bUpdate = TRUE;
1250 else
1252 if( aLbLight6.GetSelectEntryCount() != 0 )
1254 aLbLight6.SetNoSelection();
1255 bUpdate = TRUE;
1258 // Licht 6 (an/aus)
1259 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_6);
1260 if( eState != SFX_ITEM_DONTCARE )
1262 bool bOn = ((const Svx3DLightOnOff6Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue() != 0;
1263 if( ( bOn && !GetUILightState( aBtnLight6 )) ||
1264 ( !bOn && GetUILightState( aBtnLight6 )) )
1266 SetUILightState( aBtnLight6, bOn );
1267 bUpdate = TRUE;
1269 if( aBtnLight6.GetState() == STATE_DONTKNOW )
1270 aBtnLight6.Check( aBtnLight6.IsChecked() );
1272 else
1274 if( aBtnLight6.GetState() != STATE_DONTKNOW )
1276 aBtnLight6.SetState( STATE_DONTKNOW );
1277 bUpdate = TRUE;
1280 // Licht 6 (Richtung)
1281 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_6);
1282 if( eState != SFX_ITEM_DONTCARE )
1284 bUpdate = TRUE;
1287 // Licht 7 (Farbe)
1288 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_7);
1289 if( eState != SFX_ITEM_DONTCARE )
1291 aColor = ((const Svx3DLightcolor7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
1292 ColorLB* pLb = &aLbLight7;
1293 if( aColor != pLb->GetSelectEntryColor() )
1295 LBSelectColor( pLb, aColor );
1296 bUpdate = TRUE;
1299 else
1301 if( aLbLight7.GetSelectEntryCount() != 0 )
1303 aLbLight7.SetNoSelection();
1304 bUpdate = TRUE;
1307 // Licht 7 (an/aus)
1308 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_7);
1309 if( eState != SFX_ITEM_DONTCARE )
1311 bool bOn = ((const Svx3DLightOnOff7Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue() != 0;
1312 if( ( bOn && !GetUILightState( aBtnLight7 )) ||
1313 ( !bOn && GetUILightState( aBtnLight7 )) )
1315 SetUILightState( aBtnLight7 , bOn );
1316 bUpdate = TRUE;
1318 if( aBtnLight7.GetState() == STATE_DONTKNOW )
1319 aBtnLight7.Check( aBtnLight7.IsChecked() );
1321 else
1323 if( aBtnLight7.GetState() != STATE_DONTKNOW )
1325 aBtnLight7.SetState( STATE_DONTKNOW );
1326 bUpdate = TRUE;
1329 // Licht 7 (Richtung)
1330 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_7);
1331 if( eState != SFX_ITEM_DONTCARE )
1333 bUpdate = TRUE;
1336 // Licht 8 (Farbe)
1337 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_8);
1338 if( eState != SFX_ITEM_DONTCARE )
1340 aColor = ((const Svx3DLightcolor8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
1341 ColorLB* pLb = &aLbLight8;
1342 if( aColor != pLb->GetSelectEntryColor() )
1344 LBSelectColor( pLb, aColor );
1345 bUpdate = TRUE;
1348 else
1350 if( aLbLight8.GetSelectEntryCount() != 0 )
1352 aLbLight8.SetNoSelection();
1353 bUpdate = TRUE;
1356 // Licht 8 (an/aus)
1357 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_8);
1358 if( eState != SFX_ITEM_DONTCARE )
1360 bool bOn = ((const Svx3DLightOnOff8Item&)rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue() != 0;
1361 if( ( bOn && !GetUILightState( aBtnLight8 )) ||
1362 ( !bOn && GetUILightState( aBtnLight8 )) )
1364 SetUILightState( aBtnLight8, bOn );
1365 bUpdate = TRUE;
1367 if( aBtnLight8.GetState() == STATE_DONTKNOW )
1368 aBtnLight8.Check( aBtnLight8.IsChecked() );
1370 else
1372 if( aBtnLight8.GetState() != STATE_DONTKNOW )
1374 aBtnLight8.SetState( STATE_DONTKNOW );
1375 bUpdate = TRUE;
1378 // Licht 8 (Richtung)
1379 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_8);
1380 if( eState != SFX_ITEM_DONTCARE )
1382 bUpdate = TRUE;
1385 // Umgebungslicht
1386 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_AMBIENTCOLOR);
1387 if( eState != SFX_ITEM_DONTCARE )
1389 aColor = ((const Svx3DAmbientcolorItem&)rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue();
1390 ColorLB* pLb = &aLbAmbientlight;
1391 if( aColor != pLb->GetSelectEntryColor() )
1393 LBSelectColor( pLb, aColor );
1394 bUpdate = TRUE;
1397 else
1399 if( aLbAmbientlight.GetSelectEntryCount() != 0 )
1401 aLbAmbientlight.SetNoSelection();
1402 bUpdate = TRUE;
1407 // Texturen
1408 // Art
1409 if( bBitmap )
1411 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_KIND);
1412 if( eState != SFX_ITEM_DONTCARE )
1414 UINT16 nValue = ((const Svx3DTextureKindItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_KIND)).GetValue();
1416 if( ( !aBtnTexLuminance.IsChecked() && nValue == 1 ) ||
1417 ( !aBtnTexColor.IsChecked() && nValue == 3 ) )
1419 aBtnTexLuminance.Check( nValue == 1 );
1420 aBtnTexColor.Check( nValue == 3 );
1421 bUpdate = TRUE;
1424 else
1426 if( aBtnTexLuminance.IsChecked() ||
1427 aBtnTexColor.IsChecked() )
1429 aBtnTexLuminance.Check( FALSE );
1430 aBtnTexColor.Check( FALSE );
1431 bUpdate = TRUE;
1435 // Modus
1436 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_MODE);
1437 if( eState != SFX_ITEM_DONTCARE )
1439 UINT16 nValue = ((const Svx3DTextureModeItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_MODE)).GetValue();
1441 if( ( !aBtnTexReplace.IsChecked() && nValue == 1 ) ||
1442 ( !aBtnTexModulate.IsChecked() && nValue == 2 ) )
1444 aBtnTexReplace.Check( nValue == 1 );
1445 aBtnTexModulate.Check( nValue == 2 );
1446 //aBtnTexBlend.Check( nValue == 2 );
1447 bUpdate = TRUE;
1450 else
1452 if( aBtnTexReplace.IsChecked() ||
1453 aBtnTexModulate.IsChecked() )
1455 aBtnTexReplace.Check( FALSE );
1456 aBtnTexModulate.Check( FALSE );
1457 //aBtnTexBlend.Check( FALSE );
1458 bUpdate = TRUE;
1462 // Projektion X
1463 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
1464 if( eState != SFX_ITEM_DONTCARE )
1466 UINT16 nValue = ((const Svx3DTextureProjectionXItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X)).GetValue();
1468 if( ( !aBtnTexObjectX.IsChecked() && nValue == 0 ) ||
1469 ( !aBtnTexParallelX.IsChecked() && nValue == 1 ) ||
1470 ( !aBtnTexCircleX.IsChecked() && nValue == 2 ) )
1472 aBtnTexObjectX.Check( nValue == 0 );
1473 aBtnTexParallelX.Check( nValue == 1 );
1474 aBtnTexCircleX.Check( nValue == 2 );
1475 bUpdate = TRUE;
1478 else
1480 if( aBtnTexObjectX.IsChecked() ||
1481 aBtnTexParallelX.IsChecked() ||
1482 aBtnTexCircleX.IsChecked() )
1484 aBtnTexObjectX.Check( FALSE );
1485 aBtnTexParallelX.Check( FALSE );
1486 aBtnTexCircleX.Check( FALSE );
1487 bUpdate = TRUE;
1491 // Projektion Y
1492 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
1493 if( eState != SFX_ITEM_DONTCARE )
1495 UINT16 nValue = ((const Svx3DTextureProjectionYItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y)).GetValue();
1497 if( ( !aBtnTexObjectY.IsChecked() && nValue == 0 ) ||
1498 ( !aBtnTexParallelY.IsChecked() && nValue == 1 ) ||
1499 ( !aBtnTexCircleY.IsChecked() && nValue == 2 ) )
1501 aBtnTexObjectY.Check( nValue == 0 );
1502 aBtnTexParallelY.Check( nValue == 1 );
1503 aBtnTexCircleY.Check( nValue == 2 );
1504 bUpdate = TRUE;
1507 else
1509 if( aBtnTexObjectY.IsChecked() ||
1510 aBtnTexParallelY.IsChecked() ||
1511 aBtnTexCircleY.IsChecked() )
1513 aBtnTexObjectY.Check( FALSE );
1514 aBtnTexParallelY.Check( FALSE );
1515 aBtnTexCircleY.Check( FALSE );
1516 bUpdate = TRUE;
1520 // Filter
1521 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_FILTER);
1522 if( eState != SFX_ITEM_DONTCARE )
1524 BOOL bValue = ((const Svx3DTextureFilterItem&)rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_FILTER)).GetValue();
1525 if( bValue != aBtnTexFilter.IsChecked() )
1527 aBtnTexFilter.Check( bValue );
1528 bUpdate = TRUE;
1530 if( aBtnTexFilter.GetState() == STATE_DONTKNOW )
1531 aBtnTexFilter.Check( bValue );
1533 else
1535 if( aBtnTexFilter.GetState() != STATE_DONTKNOW )
1537 aBtnTexFilter.SetState( STATE_DONTKNOW );
1538 bUpdate = TRUE;
1544 // Material Favoriten
1545 aLbMatFavorites.SelectEntryPos( 0 );
1547 // Objektfarbe
1548 eState = rAttrs.GetItemState(XATTR_FILLCOLOR);
1549 if( eState != SFX_ITEM_DONTCARE )
1551 aColor = ((const XFillColorItem&)rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue();
1552 ColorLB* pLb = &aLbMatColor;
1553 if( aColor != pLb->GetSelectEntryColor() )
1555 LBSelectColor( pLb, aColor );
1556 bUpdate = TRUE;
1559 else
1561 if( aLbMatColor.GetSelectEntryCount() != 0 )
1563 aLbMatColor.SetNoSelection();
1564 bUpdate = TRUE;
1568 // Slebstleuchtfarbe
1569 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_EMISSION);
1570 if( eState != SFX_ITEM_DONTCARE )
1572 aColor = ((const Svx3DMaterialEmissionItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue();
1573 ColorLB* pLb = &aLbMatEmission;
1574 if( aColor != pLb->GetSelectEntryColor() )
1576 LBSelectColor( pLb, aColor );
1577 bUpdate = TRUE;
1580 else
1582 if( aLbMatEmission.GetSelectEntryCount() != 0 )
1584 aLbMatEmission.SetNoSelection();
1585 bUpdate = TRUE;
1589 // Glanzpunkt
1590 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR);
1591 if( eState != SFX_ITEM_DONTCARE )
1593 aColor = ((const Svx3DMaterialSpecularItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue();
1594 ColorLB* pLb = &aLbMatSpecular;
1595 if( aColor != pLb->GetSelectEntryColor() )
1597 LBSelectColor( pLb, aColor );
1598 bUpdate = TRUE;
1601 else
1603 if( aLbMatSpecular.GetSelectEntryCount() != 0 )
1605 aLbMatSpecular.SetNoSelection();
1606 bUpdate = TRUE;
1610 // Glanzpunkt Intensitaet
1611 eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY);
1612 if( eState != SFX_ITEM_DONTCARE )
1614 UINT16 nValue = ((const Svx3DMaterialSpecularIntensityItem&)rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY)).GetValue();
1615 if( nValue != aMtrMatSpecularIntensity.GetValue() )
1617 aMtrMatSpecularIntensity.SetValue( nValue );
1618 bUpdate = TRUE;
1621 else
1623 if( !aMtrMatSpecularIntensity.IsEmptyFieldValue() )
1625 aMtrMatSpecularIntensity.SetEmptyFieldValue();
1626 bUpdate = TRUE;
1631 // Sonstige
1632 // Perspektive
1633 eState = rAttrs.GetItemState(SDRATTR_3DSCENE_PERSPECTIVE);
1634 if( eState != SFX_ITEM_DONTCARE )
1636 ProjectionType ePT = (ProjectionType)((const Svx3DPerspectiveItem&)rAttrs.Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue();
1637 if( ( !aBtnPerspective.IsChecked() && ePT == PR_PERSPECTIVE ) ||
1638 ( aBtnPerspective.IsChecked() && ePT == PR_PARALLEL ) )
1640 aBtnPerspective.Check( ePT == PR_PERSPECTIVE );
1641 bUpdate = TRUE;
1643 if( aBtnPerspective.GetState() == STATE_DONTKNOW )
1644 aBtnPerspective.Check( ePT == PR_PERSPECTIVE );
1646 else
1648 if( aBtnPerspective.GetState() != STATE_DONTKNOW )
1650 aBtnPerspective.SetState( STATE_DONTKNOW );
1651 bUpdate = TRUE;
1655 if( !bUpdate && !bOnly3DChanged )
1657 // Eventuell sind aber die 2D-Attribute unterschiedlich. Vergleiche
1658 // diese und entscheide
1661 bUpdate = TRUE;
1664 if( bUpdate || bOnly3DChanged )
1666 // Preview updaten
1667 SfxItemSet aSet(rAttrs);
1669 // set LineStyle hard to XLINE_NONE when it's not set so that
1670 // the default (XLINE_SOLID) is not used for 3d preview
1671 if(SFX_ITEM_SET != aSet.GetItemState(XATTR_LINESTYLE, FALSE))
1672 aSet.Put(XLineStyleItem(XLINE_NONE));
1674 // set FillColor hard to WHITE when it's SFX_ITEM_DONTCARE so that
1675 // the default (Blue7) is not used for 3d preview
1676 if(SFX_ITEM_DONTCARE == aSet.GetItemState(XATTR_FILLCOLOR, FALSE))
1677 aSet.Put(XFillColorItem(String(), Color(COL_WHITE)));
1679 aCtlPreview.Set3DAttributes(aSet);
1680 aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aSet);
1682 // try to select light corresponding to active button
1683 sal_uInt32 nNumber(0xffffffff);
1685 if(aBtnLight1.IsChecked())
1686 nNumber = 0;
1687 else if(aBtnLight2.IsChecked())
1688 nNumber = 1;
1689 else if(aBtnLight3.IsChecked())
1690 nNumber = 2;
1691 else if(aBtnLight4.IsChecked())
1692 nNumber = 3;
1693 else if(aBtnLight5.IsChecked())
1694 nNumber = 4;
1695 else if(aBtnLight6.IsChecked())
1696 nNumber = 5;
1697 else if(aBtnLight7.IsChecked())
1698 nNumber = 6;
1699 else if(aBtnLight8.IsChecked())
1700 nNumber = 7;
1702 if(nNumber != 0xffffffff)
1704 aCtlLightPreview.GetSvx3DLightControl().SelectLight(nNumber);
1708 // handle state of converts possible
1709 aBtnConvertTo3D.Enable(pConvertTo3DItem->GetState());
1710 aBtnLatheObject.Enable(pConvertTo3DLatheItem->GetState());
1713 // -----------------------------------------------------------------------
1714 void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
1716 // get remembered 2d attributes from the dialog
1717 if(mpRemember2DAttributes)
1719 SfxWhichIter aIter(*mpRemember2DAttributes);
1720 sal_uInt16 nWhich(aIter.FirstWhich());
1722 while(nWhich)
1724 SfxItemState eState = mpRemember2DAttributes->GetItemState(nWhich, FALSE);
1725 if(SFX_ITEM_DONTCARE == eState)
1726 rAttrs.InvalidateItem(nWhich);
1727 else if(SFX_ITEM_SET == eState)
1728 rAttrs.Put(mpRemember2DAttributes->Get(nWhich, FALSE));
1730 nWhich = aIter.NextWhich();
1734 // Sonstige, muss vorne stehen da auf allen Seiten
1735 // Perspektive
1736 if( aBtnPerspective.GetState() != STATE_DONTKNOW )
1738 UINT16 nValue;
1739 if( aBtnPerspective.IsChecked() )
1740 nValue = PR_PERSPECTIVE;
1741 else
1742 nValue = PR_PARALLEL;
1743 rAttrs.Put(Svx3DPerspectiveItem(nValue));
1745 else
1746 rAttrs.InvalidateItem(SDRATTR_3DSCENE_PERSPECTIVE);
1748 // Geometrie
1749 // evtl. PoolUnit ermitteln (Falls dies in Update() nicht passiert ist)
1750 if( !mpImpl->pPool )
1752 DBG_ERROR( "Kein Pool in GetAttr()! Evtl. inkompatibel zu drviewsi.cxx ?" );
1753 mpImpl->pPool = rAttrs.GetPool();
1754 DBG_ASSERT( mpImpl->pPool, "Wo ist der Pool?" );
1755 ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
1757 eFUnit = GetModuleFieldUnit( &rAttrs );
1760 // Anzahl Segmente (horizontal)
1761 if( !aNumHorizontal.IsEmptyFieldValue() )
1763 sal_uInt32 nValue = static_cast<sal_uInt32>(aNumHorizontal.GetValue());
1764 rAttrs.Put(Svx3DHorizontalSegmentsItem(nValue));
1766 else
1767 rAttrs.InvalidateItem(SDRATTR_3DOBJ_HORZ_SEGS);
1769 // Anzahl Segmente (vertikal)
1770 if( !aNumVertical.IsEmptyFieldValue() )
1772 UINT32 nValue = static_cast<UINT32>(aNumVertical.GetValue());
1773 rAttrs.Put(Svx3DVerticalSegmentsItem(nValue));
1775 else
1776 rAttrs.InvalidateItem(SDRATTR_3DOBJ_VERT_SEGS);
1778 // Tiefe
1779 if( !aMtrDepth.IsEmptyFieldValue() )
1781 UINT32 nValue = GetCoreValue( aMtrDepth, ePoolUnit );
1782 rAttrs.Put(Svx3DDepthItem(nValue));
1784 else
1785 rAttrs.InvalidateItem(SDRATTR_3DOBJ_DEPTH);
1787 // Doppelseitig
1788 TriState eState = aBtnDoubleSided.GetState();
1789 if( eState != STATE_DONTKNOW )
1791 BOOL bValue = STATE_CHECK == eState;
1792 rAttrs.Put(Svx3DDoubleSidedItem(bValue));
1794 else
1795 rAttrs.InvalidateItem(SDRATTR_3DOBJ_DOUBLE_SIDED);
1797 // Kantenrundung
1798 if( !aMtrPercentDiagonal.IsEmptyFieldValue() )
1800 UINT16 nValue = (UINT16) aMtrPercentDiagonal.GetValue();
1801 rAttrs.Put(Svx3DPercentDiagonalItem(nValue));
1803 else
1804 rAttrs.InvalidateItem(SDRATTR_3DOBJ_PERCENT_DIAGONAL);
1806 // Tiefenskalierung
1807 if( !aMtrBackscale.IsEmptyFieldValue() )
1809 UINT16 nValue = (UINT16)aMtrBackscale.GetValue();
1810 rAttrs.Put(Svx3DBackscaleItem(nValue));
1812 else
1813 rAttrs.InvalidateItem(SDRATTR_3DOBJ_BACKSCALE);
1815 // Endwinkel
1816 if( !aMtrEndAngle.IsEmptyFieldValue() )
1818 UINT16 nValue = (UINT16)aMtrEndAngle.GetValue();
1819 rAttrs.Put(Svx3DEndAngleItem(nValue));
1821 else
1822 rAttrs.InvalidateItem(SDRATTR_3DOBJ_END_ANGLE);
1824 // Normalentyp
1825 UINT16 nValue = 99;
1826 if( aBtnNormalsObj.IsChecked() )
1827 nValue = 0;
1828 else if( aBtnNormalsFlat.IsChecked() )
1829 nValue = 1;
1830 else if( aBtnNormalsSphere.IsChecked() )
1831 nValue = 2;
1833 if( nValue <= 2 )
1834 rAttrs.Put(Svx3DNormalsKindItem(nValue));
1835 else
1836 rAttrs.InvalidateItem(SDRATTR_3DOBJ_NORMALS_KIND);
1838 // Normalen invertieren
1839 eState = aBtnNormalsInvert.GetState();
1840 if( eState != STATE_DONTKNOW )
1842 BOOL bValue = STATE_CHECK == eState;
1843 rAttrs.Put(Svx3DNormalsInvertItem(bValue));
1845 else
1846 rAttrs.InvalidateItem(SDRATTR_3DOBJ_NORMALS_INVERT);
1848 // 2-seitige Beleuchtung
1849 eState = aBtnTwoSidedLighting.GetState();
1850 if( eState != STATE_DONTKNOW )
1852 BOOL bValue = STATE_CHECK == eState;
1853 rAttrs.Put(Svx3DTwoSidedLightingItem(bValue));
1855 else
1856 rAttrs.InvalidateItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING);
1858 // Darstellung
1859 // Shademode
1860 if( aLbShademode.GetSelectEntryCount() )
1862 nValue = aLbShademode.GetSelectEntryPos();
1863 rAttrs.Put(Svx3DShadeModeItem(nValue));
1865 else
1866 rAttrs.InvalidateItem(SDRATTR_3DSCENE_SHADE_MODE);
1868 // 3D-Shatten
1869 eState = aBtnShadow3d.GetState();
1870 if( eState != STATE_DONTKNOW )
1872 BOOL bValue = STATE_CHECK == eState;
1873 rAttrs.Put(Svx3DShadow3DItem(bValue));
1874 rAttrs.Put(SdrShadowItem(bValue));
1876 else
1878 rAttrs.InvalidateItem(SDRATTR_3DOBJ_SHADOW_3D);
1879 rAttrs.InvalidateItem(SDRATTR_SHADOW);
1882 // Neigung (Schatten)
1883 if( !aMtrSlant.IsEmptyFieldValue() )
1885 UINT16 nValue2 = (UINT16) aMtrSlant.GetValue();
1886 rAttrs.Put(Svx3DShadowSlantItem(nValue2));
1888 else
1889 rAttrs.InvalidateItem(SDRATTR_3DSCENE_SHADOW_SLANT);
1891 // Distanz
1892 if( !aMtrDistance.IsEmptyFieldValue() )
1894 UINT32 nValue2 = GetCoreValue( aMtrDistance, ePoolUnit );
1895 rAttrs.Put(Svx3DDistanceItem(nValue2));
1897 else
1898 rAttrs.InvalidateItem(SDRATTR_3DSCENE_DISTANCE);
1900 // Brennweite
1901 if( !aMtrFocalLength.IsEmptyFieldValue() )
1903 UINT32 nValue2 = GetCoreValue( aMtrFocalLength, ePoolUnit );
1904 rAttrs.Put(Svx3DFocalLengthItem(nValue2));
1906 else
1907 rAttrs.InvalidateItem(SDRATTR_3DSCENE_FOCAL_LENGTH);
1909 // Beleuchtung
1910 Image aImg;
1911 basegfx::B3DVector aVector;
1912 Color aColor;
1913 const SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
1915 // Licht 1 Farbe
1916 if( aLbLight1.GetSelectEntryCount() )
1918 aColor = aLbLight1.GetSelectEntryColor();
1919 rAttrs.Put(Svx3DLightcolor1Item(aColor));
1921 else
1922 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_1);
1923 // Licht 1 (an/aus)
1924 eState = aBtnLight1.GetState();
1925 if( eState != STATE_DONTKNOW )
1927 BOOL bValue = GetUILightState( aBtnLight1 );
1928 rAttrs.Put(Svx3DLightOnOff1Item(bValue));
1930 // Licht 1 (Richtung)
1931 if( bValue )
1933 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1));
1936 else
1937 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_1);
1940 // Licht 2 Farbe
1941 if( aLbLight2.GetSelectEntryCount() )
1943 aColor = aLbLight2.GetSelectEntryColor();
1944 rAttrs.Put(Svx3DLightcolor2Item(aColor));
1946 else
1947 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_2);
1948 // Licht 2 (an/aus)
1949 eState = aBtnLight2.GetState();
1950 if( eState != STATE_DONTKNOW )
1952 BOOL bValue = GetUILightState( aBtnLight2 );
1953 rAttrs.Put(Svx3DLightOnOff2Item(bValue));
1955 // Licht 2 (Richtung)
1956 if( bValue )
1958 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2));
1961 else
1962 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2);
1964 // Licht 3 Farbe
1965 if( aLbLight3.GetSelectEntryCount() )
1967 aColor = aLbLight3.GetSelectEntryColor();
1968 rAttrs.Put(Svx3DLightcolor3Item(aColor));
1970 else
1971 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_3);
1972 // Licht 3 (an/aus)
1973 eState = aBtnLight3.GetState();
1974 if( eState != STATE_DONTKNOW )
1976 BOOL bValue = GetUILightState( aBtnLight3 );
1977 rAttrs.Put(Svx3DLightOnOff3Item(bValue));
1979 // Licht 3 (Richtung)
1980 if( bValue )
1982 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3));
1985 else
1986 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3);
1988 // Licht 4 Farbe
1989 if( aLbLight4.GetSelectEntryCount() )
1991 aColor = aLbLight4.GetSelectEntryColor();
1992 rAttrs.Put(Svx3DLightcolor4Item(aColor));
1994 else
1995 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_4);
1996 // Licht 4 (an/aus)
1997 eState = aBtnLight4.GetState();
1998 if( eState != STATE_DONTKNOW )
2000 BOOL bValue = GetUILightState( aBtnLight4 );
2001 rAttrs.Put(Svx3DLightOnOff4Item(bValue));
2003 // Licht 4 (Richtung)
2004 if( bValue )
2006 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4));
2009 else
2010 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4);
2012 // Licht 5 Farbe
2013 if( aLbLight5.GetSelectEntryCount() )
2015 aColor = aLbLight5.GetSelectEntryColor();
2016 rAttrs.Put(Svx3DLightcolor5Item(aColor));
2018 else
2019 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_5);
2020 // Licht 5 (an/aus)
2021 eState = aBtnLight5.GetState();
2022 if( eState != STATE_DONTKNOW )
2024 BOOL bValue = GetUILightState( aBtnLight5 );
2025 rAttrs.Put(Svx3DLightOnOff5Item(bValue));
2027 // Licht 5 (Richtung)
2028 if( bValue )
2030 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5));
2033 else
2034 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5);
2036 // Licht 6 Farbe
2037 if( aLbLight6.GetSelectEntryCount() )
2039 aColor = aLbLight6.GetSelectEntryColor();
2040 rAttrs.Put(Svx3DLightcolor6Item(aColor));
2042 else
2043 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_6);
2044 // Licht 6 (an/aus)
2045 eState = aBtnLight6.GetState();
2046 if( eState != STATE_DONTKNOW )
2048 BOOL bValue = GetUILightState( aBtnLight6 );
2049 rAttrs.Put(Svx3DLightOnOff6Item(bValue));
2051 // Licht 6 (Richtung)
2052 if( bValue )
2054 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6));
2057 else
2058 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6);
2060 // Licht 7 Farbe
2061 if( aLbLight7.GetSelectEntryCount() )
2063 aColor = aLbLight7.GetSelectEntryColor();
2064 rAttrs.Put(Svx3DLightcolor7Item(aColor));
2066 else
2067 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_7);
2068 // Licht 7 (an/aus)
2069 eState = aBtnLight7.GetState();
2070 if( eState != STATE_DONTKNOW )
2072 BOOL bValue = GetUILightState( aBtnLight7 );
2073 rAttrs.Put(Svx3DLightOnOff7Item(bValue));
2075 // Licht 7 (Richtung)
2076 if( bValue )
2078 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7));
2081 else
2082 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7);
2084 // Licht 8 Farbe
2085 if( aLbLight8.GetSelectEntryCount() )
2087 aColor = aLbLight8.GetSelectEntryColor();
2088 rAttrs.Put(Svx3DLightcolor8Item(aColor));
2090 else
2091 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_8);
2092 // Licht 8 (an/aus)
2093 eState = aBtnLight8.GetState();
2094 if( eState != STATE_DONTKNOW )
2096 BOOL bValue = GetUILightState( aBtnLight8 );
2097 rAttrs.Put(Svx3DLightOnOff8Item(bValue));
2099 // Licht 8 (Richtung)
2100 if( bValue )
2102 rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8));
2105 else
2106 rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8);
2108 // Umgebungslicht
2109 if( aLbAmbientlight.GetSelectEntryCount() )
2111 aColor = aLbAmbientlight.GetSelectEntryColor();
2112 rAttrs.Put(Svx3DAmbientcolorItem(aColor));
2114 else
2115 rAttrs.InvalidateItem(SDRATTR_3DSCENE_AMBIENTCOLOR);
2117 // Texturen
2118 // Art
2119 nValue = 3;
2120 if( aBtnTexLuminance.IsChecked() )
2121 nValue = 1;
2122 else if( aBtnTexColor.IsChecked() )
2123 nValue = 3;
2125 if( nValue == 1 || nValue == 3 )
2126 rAttrs.Put(Svx3DTextureKindItem(nValue));
2127 else
2128 rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_KIND);
2131 // Modus
2132 nValue = 99;
2133 if( aBtnTexReplace.IsChecked() )
2134 nValue = 1;
2135 else if( aBtnTexModulate.IsChecked() )
2136 nValue = 2;
2137 //else if( aBtnTexBlend.IsChecked() )
2138 // nValue = 2;
2140 if( nValue == 1 || nValue == 2 )
2141 rAttrs.Put(Svx3DTextureModeItem(nValue));
2142 else
2143 rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_MODE);
2145 // Projektion X
2146 nValue = 99;
2147 if( aBtnTexObjectX.IsChecked() )
2148 nValue = 0;
2149 else if( aBtnTexParallelX.IsChecked() )
2150 nValue = 1;
2151 else if( aBtnTexCircleX.IsChecked() )
2152 nValue = 2;
2154 if( nValue <= 2 )
2155 rAttrs.Put(Svx3DTextureProjectionXItem(nValue));
2156 else
2157 rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
2159 // Projektion Y
2160 nValue = 99;
2161 if( aBtnTexObjectY.IsChecked() )
2162 nValue = 0;
2163 else if( aBtnTexParallelY.IsChecked() )
2164 nValue = 1;
2165 else if( aBtnTexCircleY.IsChecked() )
2166 nValue = 2;
2168 if( nValue <= 2 )
2169 rAttrs.Put(Svx3DTextureProjectionYItem(nValue));
2170 else
2171 rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
2174 // Filter
2175 eState = aBtnTexFilter.GetState();
2176 if( eState != STATE_DONTKNOW )
2178 BOOL bValue = STATE_CHECK == eState;
2179 rAttrs.Put(Svx3DTextureFilterItem(bValue));
2181 else
2182 rAttrs.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_FILTER);
2185 // Material
2186 // Objektfarbe
2187 if( aLbMatColor.GetSelectEntryCount() )
2189 aColor = aLbMatColor.GetSelectEntryColor();
2190 rAttrs.Put( XFillColorItem( String(), aColor) );
2192 else
2194 rAttrs.InvalidateItem( XATTR_FILLCOLOR );
2197 // Slebstleuchtfarbe
2198 if( aLbMatEmission.GetSelectEntryCount() )
2200 aColor = aLbMatEmission.GetSelectEntryColor();
2201 rAttrs.Put(Svx3DMaterialEmissionItem(aColor));
2203 else
2204 rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION);
2206 // Glanzpunkt
2207 if( aLbMatSpecular.GetSelectEntryCount() )
2209 aColor = aLbMatSpecular.GetSelectEntryColor();
2210 rAttrs.Put(Svx3DMaterialSpecularItem(aColor));
2212 else
2213 rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR);
2215 // Glanzpunkt Intensitaet
2216 if( !aMtrMatSpecularIntensity.IsEmptyFieldValue() )
2218 UINT16 nValue2 = (UINT16) aMtrMatSpecularIntensity.GetValue();
2219 rAttrs.Put(Svx3DMaterialSpecularIntensityItem(nValue2));
2221 else
2222 rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY);
2225 // -----------------------------------------------------------------------
2226 void __EXPORT Svx3DWin::Resize()
2228 if ( !IsFloatingMode() ||
2229 !GetFloatingWindow()->IsRollUp() )
2231 Size aWinSize( GetOutputSizePixel() ); // vorher rSize im Resizing()
2233 if( aWinSize.Height() >= GetMinOutputSizePixel().Height() &&
2234 aWinSize.Width() >= GetMinOutputSizePixel().Width() )
2236 Size aDiffSize;
2237 aDiffSize.Width() = aWinSize.Width() - aSize.Width();
2238 aDiffSize.Height() = aWinSize.Height() - aSize.Height();
2240 Point aXPt;
2241 Point aYPt;
2242 aXPt.X() = aDiffSize.Width();
2243 aYPt.Y() = aDiffSize.Height();
2245 Size aObjSize;
2247 // Hide
2248 aBtnUpdate.Hide();
2249 aBtnAssign.Hide();
2251 aBtnConvertTo3D.Hide();
2252 aBtnLatheObject.Hide();
2253 aBtnPerspective.Hide();
2255 aCtlPreview.Hide();
2256 aCtlLightPreview.Hide();
2258 aFLGeometrie.Hide();
2259 aFLRepresentation.Hide();
2260 aFLLight.Hide();
2261 aFLTexture.Hide();
2262 aFLMaterial.Hide();
2264 // Verschieben / Resizen
2265 aBtnUpdate.SetPosPixel( aBtnUpdate.GetPosPixel() + aXPt );
2266 aBtnAssign.SetPosPixel( aBtnAssign.GetPosPixel() + aXPt );
2268 // Preview-Controls
2269 aObjSize = aCtlPreview.GetOutputSizePixel();
2270 aObjSize.Width() += aDiffSize.Width();
2271 aObjSize.Height() += aDiffSize.Height();
2272 aCtlPreview.SetOutputSizePixel( aObjSize );
2273 aCtlLightPreview.SetOutputSizePixel( aObjSize );
2275 // Groups
2276 aObjSize = aFLGeometrie.GetOutputSizePixel();
2277 aObjSize.Width() += aDiffSize.Width();
2278 aFLGeometrie.SetOutputSizePixel( aObjSize );
2279 aFLSegments.SetOutputSizePixel( aObjSize );
2280 aFLShadow.SetOutputSizePixel( aObjSize );
2281 aFLCamera.SetOutputSizePixel( aObjSize );
2282 aFLRepresentation.SetOutputSizePixel( aObjSize );
2283 aFLLight.SetOutputSizePixel( aObjSize );
2284 aFLTexture.SetOutputSizePixel( aObjSize );
2285 aFLMaterial.SetOutputSizePixel( aObjSize );
2287 // Y-Position der unteren Buttons
2288 aBtnConvertTo3D.SetPosPixel( aBtnConvertTo3D.GetPosPixel() + aYPt );
2289 aBtnLatheObject.SetPosPixel( aBtnLatheObject.GetPosPixel() + aYPt );
2290 aBtnPerspective.SetPosPixel( aBtnPerspective.GetPosPixel() + aYPt );
2292 // Show
2293 aBtnUpdate.Show();
2294 aBtnAssign.Show();
2296 aBtnConvertTo3D.Show();
2297 aBtnLatheObject.Show();
2298 aBtnPerspective.Show();
2300 if( aBtnGeo.IsChecked() )
2301 ClickViewTypeHdl( &aBtnGeo );
2302 if( aBtnRepresentation.IsChecked() )
2303 ClickViewTypeHdl( &aBtnRepresentation );
2304 if( aBtnLight.IsChecked() )
2305 ClickViewTypeHdl( &aBtnLight );
2306 if( aBtnTexture.IsChecked() )
2307 ClickViewTypeHdl( &aBtnTexture );
2308 if( aBtnMaterial.IsChecked() )
2309 ClickViewTypeHdl( &aBtnMaterial );
2311 aSize = aWinSize;
2315 SfxDockingWindow::Resize();
2318 // -----------------------------------------------------------------------
2319 IMPL_LINK( Svx3DWin, ClickUpdateHdl, void *, EMPTYARG )
2321 bUpdate = !aBtnUpdate.IsChecked();
2322 aBtnUpdate.Check( bUpdate );
2324 if( bUpdate )
2326 SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2327 if (pDispatcher != NULL)
2329 SfxBoolItem aItem( SID_3D_STATE, TRUE );
2330 pDispatcher->Execute(
2331 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2334 else
2336 // Controls koennen u.U. disabled sein
2339 return( 0L );
2342 // -----------------------------------------------------------------------
2343 IMPL_LINK( Svx3DWin, ClickAssignHdl, void *, EMPTYARG )
2345 SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2346 if (pDispatcher != NULL)
2348 SfxBoolItem aItem( SID_3D_ASSIGN, TRUE );
2349 pDispatcher->Execute(
2350 SID_3D_ASSIGN, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2353 return( 0L );
2356 // -----------------------------------------------------------------------
2358 IMPL_LINK( Svx3DWin, ClickViewTypeHdl, void *, pBtn )
2361 if( pBtn )
2363 // Da das permanente Updaten der Preview zu teuer waere
2364 BOOL bUpdatePreview = aBtnLight.IsChecked();
2366 aBtnGeo.Check( &aBtnGeo == pBtn );
2367 aBtnRepresentation.Check( &aBtnRepresentation == pBtn );
2368 aBtnLight.Check( &aBtnLight == pBtn );
2369 aBtnTexture.Check( &aBtnTexture == pBtn );
2370 aBtnMaterial.Check( &aBtnMaterial == pBtn );
2372 if( aBtnGeo.IsChecked() )
2373 eViewType = VIEWTYPE_GEO;
2374 if( aBtnRepresentation.IsChecked() )
2375 eViewType = VIEWTYPE_REPRESENTATION;
2376 if( aBtnLight.IsChecked() )
2377 eViewType = VIEWTYPE_LIGHT;
2378 if( aBtnTexture.IsChecked() )
2379 eViewType = VIEWTYPE_TEXTURE;
2380 if( aBtnMaterial.IsChecked() )
2381 eViewType = VIEWTYPE_MATERIAL;
2383 // Geometrie
2384 if( eViewType == VIEWTYPE_GEO )
2386 aFtHorizontal.Show();
2387 aNumHorizontal.Show();
2388 aFtVertical.Show();
2389 aNumVertical.Show();
2390 aFLSegments.Show();
2391 aFtPercentDiagonal.Show();
2392 aMtrPercentDiagonal.Show();
2393 aFtBackscale.Show();
2394 aMtrBackscale.Show();
2395 aFtEndAngle.Show();
2396 aMtrEndAngle.Show();
2397 aFtDepth.Show();
2398 aMtrDepth.Show();
2399 aFLGeometrie.Show();
2401 aBtnNormalsObj.Show();
2402 aBtnNormalsFlat.Show();
2403 aBtnNormalsSphere.Show();
2404 aBtnTwoSidedLighting.Show();
2405 aBtnNormalsInvert.Show();
2406 aFLNormals.Show();
2407 aBtnDoubleSided.Show();
2409 else
2411 aFtHorizontal.Hide();
2412 aNumHorizontal.Hide();
2413 aFtVertical.Hide();
2414 aNumVertical.Hide();
2415 aFLSegments.Hide();
2416 aFtPercentDiagonal.Hide();
2417 aMtrPercentDiagonal.Hide();
2418 aFtBackscale.Hide();
2419 aMtrBackscale.Hide();
2420 aFtEndAngle.Hide();
2421 aMtrEndAngle.Hide();
2422 aFtDepth.Hide();
2423 aMtrDepth.Hide();
2424 aFLGeometrie.Hide();
2426 aBtnNormalsObj.Hide();
2427 aBtnNormalsFlat.Hide();
2428 aBtnNormalsSphere.Hide();
2429 aBtnTwoSidedLighting.Hide();
2430 aBtnNormalsInvert.Hide();
2431 aFLNormals.Hide();
2432 aBtnDoubleSided.Hide();
2435 // Darstellung
2436 if( eViewType == VIEWTYPE_REPRESENTATION )
2438 aFtShademode.Show();
2439 aLbShademode.Show();
2440 aBtnShadow3d.Show();
2441 aFtSlant.Show();
2442 aMtrSlant.Show();
2443 aFLShadow.Show();
2444 aFtDistance.Show();
2445 aMtrDistance.Show();
2446 aFtFocalLeng.Show();
2447 aMtrFocalLength.Show();
2448 aFLCamera.Show();
2449 aFLRepresentation.Show();
2451 else
2453 aFtShademode.Hide();
2454 aLbShademode.Hide();
2455 aBtnShadow3d.Hide();
2456 aFtSlant.Hide();
2457 aMtrSlant.Hide();
2458 aFLShadow.Hide();
2459 aFtDistance.Hide();
2460 aMtrDistance.Hide();
2461 aFtFocalLeng.Hide();
2462 aMtrFocalLength.Hide();
2463 aFLCamera.Hide();
2464 aFLRepresentation.Hide();
2467 // Beleuchtung
2468 if( eViewType == VIEWTYPE_LIGHT )
2470 aBtnLight1.Show();
2471 aBtnLight2.Show();
2472 aBtnLight3.Show();
2473 aBtnLight4.Show();
2474 aBtnLight5.Show();
2475 aBtnLight6.Show();
2476 aBtnLight7.Show();
2477 aBtnLight8.Show();
2478 //aLbLight1.Show();
2479 aBtnLightColor.Show();
2480 aFTLightsource.Show();
2481 aLbAmbientlight.Show();
2482 aBtnAmbientColor.Show();
2483 aFTAmbientlight.Show();
2484 aFLLight.Show();
2485 //aFtLightX.Show();
2486 //aFtLightY.Show();
2487 //aFtLightZ.Show();
2488 //aGrpLightInfo.Show();
2490 ColorLB* pLb = GetLbByButton();
2491 if( pLb )
2492 pLb->Show();
2494 aCtlLightPreview.Show();
2495 aCtlPreview.Hide();
2497 else
2499 aBtnLight1.Hide();
2500 aBtnLight2.Hide();
2501 aBtnLight3.Hide();
2502 aBtnLight4.Hide();
2503 aBtnLight5.Hide();
2504 aBtnLight6.Hide();
2505 aBtnLight7.Hide();
2506 aBtnLight8.Hide();
2507 aLbLight1.Hide();
2508 aLbLight2.Hide();
2509 aLbLight3.Hide();
2510 aLbLight4.Hide();
2511 aLbLight5.Hide();
2512 aLbLight6.Hide();
2513 aLbLight7.Hide();
2514 aLbLight8.Hide();
2515 aBtnLightColor.Hide();
2516 aFTLightsource.Hide();
2517 aLbAmbientlight.Hide();
2518 aBtnAmbientColor.Hide();
2519 aFTAmbientlight.Hide();
2520 aFLLight.Hide();
2522 if( !aCtlPreview.IsVisible() )
2524 aCtlPreview.Show();
2525 aCtlLightPreview.Hide();
2529 // Texturen
2530 if( eViewType == VIEWTYPE_TEXTURE )
2532 aFtTexKind.Show();
2533 aBtnTexLuminance.Show();
2534 aBtnTexColor.Show();
2535 aFtTexMode.Show();
2536 aBtnTexReplace.Show();
2537 aBtnTexModulate.Show();
2538 //aBtnTexBlend.Show();
2539 aFtTexProjectionX.Show();
2540 aBtnTexParallelX.Show();
2541 aBtnTexCircleX.Show();
2542 aBtnTexObjectX.Show();
2543 aFtTexProjectionY.Show();
2544 aBtnTexParallelY.Show();
2545 aBtnTexCircleY.Show();
2546 aBtnTexObjectY.Show();
2547 aFtTexFilter.Show();
2548 aBtnTexFilter.Show();
2549 aFLTexture.Show();
2551 else
2553 aFtTexKind.Hide();
2554 aBtnTexLuminance.Hide();
2555 aBtnTexColor.Hide();
2556 aFtTexMode.Hide();
2557 aBtnTexReplace.Hide();
2558 aBtnTexModulate.Hide();
2559 aBtnTexBlend.Hide();
2560 aFtTexProjectionX.Hide();
2561 aBtnTexParallelX.Hide();
2562 aBtnTexCircleX.Hide();
2563 aBtnTexObjectX.Hide();
2564 aFtTexProjectionY.Hide();
2565 aBtnTexParallelY.Hide();
2566 aBtnTexCircleY.Hide();
2567 aBtnTexObjectY.Hide();
2568 aFtTexFilter.Hide();
2569 aBtnTexFilter.Hide();
2570 aFLTexture.Hide();
2573 // Material
2574 if( eViewType == VIEWTYPE_MATERIAL )
2576 aFtMatFavorites.Show();
2577 aLbMatFavorites.Show();
2578 aFtMatColor.Show();
2579 aLbMatColor.Show();
2580 aBtnMatColor.Show();
2581 aFtMatEmission.Show();
2582 aLbMatEmission.Show();
2583 aBtnEmissionColor.Show();
2584 aFtMatSpecular.Show();
2585 aLbMatSpecular.Show();
2586 aBtnSpecularColor.Show();
2587 aFtMatSpecularIntensity.Show();
2588 aMtrMatSpecularIntensity.Show();
2589 aFLMatSpecular.Show();
2590 aFLMaterial.Show();
2592 else
2594 aFtMatFavorites.Hide();
2595 aLbMatFavorites.Hide();
2596 aFtMatColor.Hide();
2597 aLbMatColor.Hide();
2598 aBtnMatColor.Hide();
2599 aFtMatEmission.Hide();
2600 aLbMatEmission.Hide();
2601 aBtnEmissionColor.Hide();
2602 aFtMatSpecular.Hide();
2603 aLbMatSpecular.Hide();
2604 aBtnSpecularColor.Hide();
2605 aFtMatSpecularIntensity.Hide();
2606 aMtrMatSpecularIntensity.Hide();
2607 aFLMatSpecular.Hide();
2608 aFLMaterial.Hide();
2610 if( bUpdatePreview && !aBtnLight.IsChecked() )
2611 UpdatePreview();
2614 else
2616 aBtnGeo.Check( eViewType == VIEWTYPE_GEO );
2617 aBtnRepresentation.Check( eViewType == VIEWTYPE_REPRESENTATION );
2618 aBtnLight.Check( eViewType == VIEWTYPE_LIGHT );
2619 aBtnTexture.Check( eViewType == VIEWTYPE_TEXTURE );
2620 aBtnMaterial.Check( eViewType == VIEWTYPE_MATERIAL );
2622 return( 0L );
2625 // -----------------------------------------------------------------------
2626 IMPL_LINK( Svx3DWin, ClickHdl, PushButton *, pBtn )
2628 BOOL bUpdatePreview = FALSE;
2630 if( pBtn )
2632 USHORT nSId = 0;
2634 if( pBtn == &aBtnConvertTo3D )
2636 nSId = SID_CONVERT_TO_3D;
2638 else if( pBtn == &aBtnLatheObject )
2640 nSId = SID_CONVERT_TO_3D_LATHE_FAST;
2642 // Geometrie
2643 else if( pBtn == &aBtnNormalsObj ||
2644 pBtn == &aBtnNormalsFlat ||
2645 pBtn == &aBtnNormalsSphere )
2647 aBtnNormalsObj.Check( pBtn == &aBtnNormalsObj );
2648 aBtnNormalsFlat.Check( pBtn == &aBtnNormalsFlat );
2649 aBtnNormalsSphere.Check( pBtn == &aBtnNormalsSphere );
2650 bUpdatePreview = TRUE;
2652 else if( pBtn == &aBtnLight1 ||
2653 pBtn == &aBtnLight2 ||
2654 pBtn == &aBtnLight3 ||
2655 pBtn == &aBtnLight4 ||
2656 pBtn == &aBtnLight5 ||
2657 pBtn == &aBtnLight6 ||
2658 pBtn == &aBtnLight7 ||
2659 pBtn == &aBtnLight8 )
2661 // Beleuchtung
2662 ColorLB* pLb = GetLbByButton( pBtn );
2663 pLb->Show();
2665 if( pBtn->IsChecked() )
2667 SetUILightState( *(ImageButton*)pBtn, !GetUILightState( *(ImageButton*)pBtn ) );
2669 else
2671 pBtn->Check();
2673 if( pBtn != &aBtnLight1 && aBtnLight1.IsChecked() )
2675 aBtnLight1.Check( FALSE );
2676 aLbLight1.Hide();
2678 if( pBtn != &aBtnLight2 && aBtnLight2.IsChecked() )
2680 aBtnLight2.Check( FALSE );
2681 aLbLight2.Hide();
2683 if( pBtn != &aBtnLight3 && aBtnLight3.IsChecked() )
2685 aBtnLight3.Check( FALSE );
2686 aLbLight3.Hide();
2688 if( pBtn != &aBtnLight4 && aBtnLight4.IsChecked() )
2690 aBtnLight4.Check( FALSE );
2691 aLbLight4.Hide();
2693 if( pBtn != &aBtnLight5 && aBtnLight5.IsChecked() )
2695 aBtnLight5.Check( FALSE );
2696 aLbLight5.Hide();
2698 if( pBtn != &aBtnLight6 && aBtnLight6.IsChecked() )
2700 aBtnLight6.Check( FALSE );
2701 aLbLight6.Hide();
2703 if( pBtn != &aBtnLight7 && aBtnLight7.IsChecked() )
2705 aBtnLight7.Check( FALSE );
2706 aLbLight7.Hide();
2708 if( pBtn != &aBtnLight8 && aBtnLight8.IsChecked() )
2710 aBtnLight8.Check( FALSE );
2711 aLbLight8.Hide();
2714 BOOL bEnable = GetUILightState( *(ImageButton*)pBtn );
2715 aBtnLightColor.Enable( bEnable );
2716 pLb->Enable( bEnable );
2718 ClickLightHdl( pBtn );
2719 bUpdatePreview = TRUE;
2721 // Texturen
2722 else if( pBtn == &aBtnTexLuminance ||
2723 pBtn == &aBtnTexColor )
2725 aBtnTexLuminance.Check( pBtn == &aBtnTexLuminance );
2726 aBtnTexColor.Check( pBtn == &aBtnTexColor );
2727 bUpdatePreview = TRUE;
2729 else if( pBtn == &aBtnTexReplace ||
2730 pBtn == &aBtnTexModulate )// ||
2731 //pBtn == &aBtnTexBlend )
2733 aBtnTexReplace.Check( pBtn == &aBtnTexReplace );
2734 aBtnTexModulate.Check( pBtn == &aBtnTexModulate );
2735 //aBtnTexBlend.Check( pBtn == &aBtnTexBlend );
2736 bUpdatePreview = TRUE;
2738 else if( pBtn == &aBtnTexParallelX ||
2739 pBtn == &aBtnTexCircleX ||
2740 pBtn == &aBtnTexObjectX )
2742 aBtnTexParallelX.Check( pBtn == &aBtnTexParallelX );
2743 aBtnTexCircleX.Check( pBtn == &aBtnTexCircleX );
2744 aBtnTexObjectX.Check( pBtn == &aBtnTexObjectX );
2745 bUpdatePreview = TRUE;
2747 else if( pBtn == &aBtnTexParallelY ||
2748 pBtn == &aBtnTexCircleY ||
2749 pBtn == &aBtnTexObjectY )
2751 aBtnTexParallelY.Check( pBtn == &aBtnTexParallelY );
2752 aBtnTexCircleY.Check( pBtn == &aBtnTexCircleY );
2753 aBtnTexObjectY.Check( pBtn == &aBtnTexObjectY );
2754 bUpdatePreview = TRUE;
2756 else if( pBtn == &aBtnShadow3d )
2758 pBtn->Check( !pBtn->IsChecked() );
2759 aFtSlant.Enable( pBtn->IsChecked() );
2760 aMtrSlant.Enable( pBtn->IsChecked() );
2761 bUpdatePreview = TRUE;
2763 // Sonstige (keine Gruppen)
2764 else if( pBtn != NULL )
2766 pBtn->Check( !pBtn->IsChecked() );
2767 bUpdatePreview = TRUE;
2770 if( nSId > 0 )
2772 SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2773 if (pDispatcher != NULL)
2775 SfxBoolItem aItem( nSId, TRUE );
2776 pDispatcher->Execute(
2777 nSId, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
2780 else if( bUpdatePreview == TRUE )
2781 UpdatePreview();
2783 return( 0L );
2786 //------------------------------------------------------------------------
2788 IMPL_LINK( Svx3DWin, ClickColorHdl, PushButton *, pBtn )
2790 SvColorDialog aColorDlg( this );
2791 ColorLB* pLb;
2793 if( pBtn == &aBtnLightColor )
2794 pLb = GetLbByButton();
2795 else if( pBtn == &aBtnAmbientColor )
2796 pLb = &aLbAmbientlight;
2797 else if( pBtn == &aBtnMatColor )
2798 pLb = &aLbMatColor;
2799 else if( pBtn == &aBtnEmissionColor )
2800 pLb = &aLbMatEmission;
2801 else // if( pBtn == &aBtnSpecularColor )
2802 pLb = &aLbMatSpecular;
2804 Color aColor = pLb->GetSelectEntryColor();
2806 aColorDlg.SetColor( aColor );
2807 if( aColorDlg.Execute() == RET_OK )
2809 aColor = aColorDlg.GetColor();
2810 if( LBSelectColor( pLb, aColor ) )
2811 SelectHdl( pLb );
2813 return( 0L );
2816 // -----------------------------------------------------------------------
2817 IMPL_LINK( Svx3DWin, SelectHdl, void *, p )
2819 if( p )
2821 Color aColor;
2822 BOOL bUpdatePreview = FALSE;
2824 // Material
2825 if( p == &aLbMatFavorites )
2827 Color aColObj( COL_WHITE );
2828 Color aColEmis( COL_BLACK );
2829 Color aColSpec( COL_WHITE );
2830 USHORT nSpecIntens = 20;
2832 USHORT nPos = aLbMatFavorites.GetSelectEntryPos();
2833 switch( nPos )
2835 case 1: // Metall
2837 aColObj = Color(230,230,255);
2838 aColEmis = Color(10,10,30);
2839 aColSpec = Color(200,200,200);
2840 nSpecIntens = 20;
2842 break;
2844 case 2: // Gold
2846 aColObj = Color(230,255,0);
2847 aColEmis = Color(51,0,0);
2848 aColSpec = Color(255,255,240);
2849 nSpecIntens = 20;
2851 break;
2853 case 3: // Chrom
2855 aColObj = Color(36,117,153);
2856 aColEmis = Color(18,30,51);
2857 aColSpec = Color(230,230,255);
2858 nSpecIntens = 2;
2860 break;
2862 case 4: // Plastik
2864 aColObj = Color(255,48,57);
2865 aColEmis = Color(35,0,0);
2866 aColSpec = Color(179,202,204);
2867 nSpecIntens = 60;
2869 break;
2871 case 5: // Holz
2873 aColObj = Color(153,71,1);
2874 aColEmis = Color(21,22,0);
2875 aColSpec = Color(255,255,153);
2876 nSpecIntens = 75;
2878 break;
2880 LBSelectColor( &aLbMatColor, aColObj );
2881 LBSelectColor( &aLbMatEmission, aColEmis );
2882 LBSelectColor( &aLbMatSpecular, aColSpec );
2883 aMtrMatSpecularIntensity.SetValue( nSpecIntens );
2885 bUpdatePreview = TRUE;
2887 else if( p == &aLbMatColor ||
2888 p == &aLbMatEmission ||
2889 p == &aLbMatSpecular )
2891 aLbMatFavorites.SelectEntryPos( 0 );
2892 bUpdatePreview = TRUE;
2894 // Beleuchtung
2895 else if( p == &aLbAmbientlight )
2897 bUpdatePreview = TRUE;
2899 else if( p == &aLbLight1 ||
2900 p == &aLbLight2 ||
2901 p == &aLbLight3 ||
2902 p == &aLbLight4 ||
2903 p == &aLbLight5 ||
2904 p == &aLbLight6 ||
2905 p == &aLbLight7 ||
2906 p == &aLbLight8 )
2908 bUpdatePreview = TRUE;
2910 else if( p == &aLbShademode )
2911 bUpdatePreview = TRUE;
2913 if( bUpdatePreview == TRUE )
2914 UpdatePreview();
2916 return( 0L );
2919 // -----------------------------------------------------------------------
2920 IMPL_LINK( Svx3DWin, ModifyHdl, void*, pField )
2922 if( pField )
2924 BOOL bUpdatePreview = FALSE;
2926 // Material
2927 if( pField == &aMtrMatSpecularIntensity )
2929 bUpdatePreview = TRUE;
2931 else if( pField == &aNumHorizontal )
2933 bUpdatePreview = TRUE;
2935 else if( pField == &aNumVertical )
2937 bUpdatePreview = TRUE;
2939 else if( pField == &aMtrSlant )
2941 bUpdatePreview = TRUE;
2944 if( bUpdatePreview == TRUE )
2945 UpdatePreview();
2947 return( 0L );
2950 // -----------------------------------------------------------------------
2952 IMPL_LINK( Svx3DWin, ClickLightHdl, PushButton*, pBtn )
2955 if( pBtn )
2957 USHORT nLightSource = GetLightSource( pBtn );
2958 ColorLB* pLb = GetLbByButton( pBtn );
2959 Color aColor( pLb->GetSelectEntryColor() );
2960 SfxItemSet aLightItemSet(aCtlLightPreview.GetSvx3DLightControl().Get3DAttributes());
2961 const bool bOnOff(GetUILightState( *(ImageButton*)pBtn ));
2963 switch(nLightSource)
2965 case 0: aLightItemSet.Put(Svx3DLightcolor1Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff1Item(bOnOff)); break;
2966 case 1: aLightItemSet.Put(Svx3DLightcolor2Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff2Item(bOnOff)); break;
2967 case 2: aLightItemSet.Put(Svx3DLightcolor3Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff3Item(bOnOff)); break;
2968 case 3: aLightItemSet.Put(Svx3DLightcolor4Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff4Item(bOnOff)); break;
2969 case 4: aLightItemSet.Put(Svx3DLightcolor5Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff5Item(bOnOff)); break;
2970 case 5: aLightItemSet.Put(Svx3DLightcolor6Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff6Item(bOnOff)); break;
2971 case 6: aLightItemSet.Put(Svx3DLightcolor7Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff7Item(bOnOff)); break;
2972 default:
2973 case 7: aLightItemSet.Put(Svx3DLightcolor8Item(aColor)); aLightItemSet.Put(Svx3DLightOnOff8Item(bOnOff)); break;
2976 aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes(aLightItemSet);
2977 aCtlLightPreview.GetSvx3DLightControl().SelectLight(nLightSource);
2978 aCtlLightPreview.CheckSelection();
2980 return( 0L );
2984 // -----------------------------------------------------------------------
2985 IMPL_LINK( Svx3DWin, DoubleClickHdl, void*, EMPTYARG )
2987 //USHORT nItemId = aCtlFavorites.GetSelectItemId();
2989 //SfxItemSet* pSet = (SfxItemSet*) pFavorSetList->GetObject( nItemId - 1 );
2990 //Update( *pSet );
2992 // und zuweisen
2993 ClickAssignHdl( NULL );
2995 return( 0L );
2998 // -----------------------------------------------------------------------
3000 IMPL_LINK( Svx3DWin, ChangeLightCallbackHdl, void*, EMPTYARG )
3002 return( 0L );
3006 // -----------------------------------------------------------------------
3008 IMPL_LINK( Svx3DWin, ChangeSelectionCallbackHdl, void*, EMPTYARG )
3010 const sal_uInt32 nLight(aCtlLightPreview.GetSvx3DLightControl().GetSelectedLight());
3011 PushButton* pBtn = 0;
3013 switch( nLight )
3015 case 0: pBtn = &aBtnLight1; break;
3016 case 1: pBtn = &aBtnLight2; break;
3017 case 2: pBtn = &aBtnLight3; break;
3018 case 3: pBtn = &aBtnLight4; break;
3019 case 4: pBtn = &aBtnLight5; break;
3020 case 5: pBtn = &aBtnLight6; break;
3021 case 6: pBtn = &aBtnLight7; break;
3022 case 7: pBtn = &aBtnLight8; break;
3023 default: break;
3026 if( pBtn )
3027 ClickHdl( pBtn );
3028 else
3030 // Zustand: Keine Lampe selektiert
3031 if( aBtnLight1.IsChecked() )
3033 aBtnLight1.Check( FALSE );
3034 aLbLight1.Enable( FALSE );
3036 else if( aBtnLight2.IsChecked() )
3038 aBtnLight2.Check( FALSE );
3039 aLbLight2.Enable( FALSE );
3041 else if( aBtnLight3.IsChecked() )
3043 aBtnLight3.Check( FALSE );
3044 aLbLight3.Enable( FALSE );
3046 else if( aBtnLight4.IsChecked() )
3048 aBtnLight4.Check( FALSE );
3049 aLbLight4.Enable( FALSE );
3051 else if( aBtnLight5.IsChecked() )
3053 aBtnLight5.Check( FALSE );
3054 aLbLight5.Enable( FALSE );
3056 else if( aBtnLight6.IsChecked() )
3058 aBtnLight6.Check( FALSE );
3059 aLbLight6.Enable( FALSE );
3061 else if( aBtnLight7.IsChecked() )
3063 aBtnLight7.Check( FALSE );
3064 aLbLight7.Enable( FALSE );
3066 else if( aBtnLight8.IsChecked() )
3068 aBtnLight8.Check( FALSE );
3069 aLbLight8.Enable( FALSE );
3071 aBtnLightColor.Enable( FALSE );
3074 return( 0L );
3077 // -----------------------------------------------------------------------
3078 // Methode um sicherzustellen, dass die LB auch mit einer Farbe gesetzt ist
3079 // Liefert TRUE zurueck, falls Farbe hinzugefuegt wurde
3080 // -----------------------------------------------------------------------
3081 BOOL Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor )
3083 BOOL bRet = FALSE;
3085 pLb->SetNoSelection();
3086 pLb->SelectEntry( rColor );
3087 if( pLb->GetSelectEntryCount() == 0 )
3089 String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R));
3091 aStr += String::CreateFromInt32((INT32)rColor.GetRed());
3092 aStr += sal_Unicode(' ');
3093 aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G));
3094 aStr += String::CreateFromInt32((INT32)rColor.GetGreen());
3095 aStr += sal_Unicode(' ');
3096 aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B));
3097 aStr += String::CreateFromInt32((INT32)rColor.GetBlue());
3099 USHORT nPos = pLb->InsertEntry( rColor, aStr );
3100 pLb->SelectEntryPos( nPos );
3101 bRet = TRUE;
3103 return( bRet );
3106 // -----------------------------------------------------------------------
3107 void Svx3DWin::UpdatePreview()
3109 if( pModel == NULL )
3110 pModel = new FmFormModel();
3112 if(bOnly3DChanged)
3114 // slot executen
3115 SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
3116 if (pDispatcher != NULL)
3118 SfxBoolItem aItem( SID_3D_STATE, TRUE );
3119 pDispatcher->Execute(
3120 SID_3D_STATE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
3122 // Flag zuruecksetzen
3123 bOnly3DChanged = FALSE;
3126 // ItemSet besorgen
3127 SfxItemSet aSet( pModel->GetItemPool(), SDRATTR_START, SDRATTR_END);
3129 // Attribute holen und im Preview setzen
3130 GetAttr( aSet );
3131 aCtlPreview.Set3DAttributes( aSet );
3132 aCtlLightPreview.GetSvx3DLightControl().Set3DAttributes( aSet );
3135 //////////////////////////////////////////////////////////////////////////////
3136 // document is to be reloaded, destroy remembered ItemSet (#83951#)
3137 void Svx3DWin::DocumentReload()
3139 if(mpRemember2DAttributes)
3140 delete mpRemember2DAttributes;
3141 mpRemember2DAttributes = 0L;
3144 // -----------------------------------------------------------------------
3145 void Svx3DWin::InitColorLB( const SdrModel* pDoc )
3147 aLbLight1.Fill( pDoc->GetColorTable() );
3148 aLbLight2.CopyEntries( aLbLight1 );
3149 aLbLight3.CopyEntries( aLbLight1 );
3150 aLbLight4.CopyEntries( aLbLight1 );
3151 aLbLight5.CopyEntries( aLbLight1 );
3152 aLbLight6.CopyEntries( aLbLight1 );
3153 aLbLight7.CopyEntries( aLbLight1 );
3154 aLbLight8.CopyEntries( aLbLight1 );
3155 aLbAmbientlight.CopyEntries( aLbLight1 );
3156 aLbMatColor.CopyEntries( aLbLight1 );
3157 aLbMatEmission.CopyEntries( aLbLight1 );
3158 aLbMatSpecular.CopyEntries( aLbLight1 );
3160 // Erstmal...
3161 Color aColWhite( COL_WHITE );
3162 Color aColBlack( COL_BLACK );
3163 aLbLight1.SelectEntry( aColWhite );
3164 aLbLight2.SelectEntry( aColWhite );
3165 aLbLight3.SelectEntry( aColWhite );
3166 aLbLight4.SelectEntry( aColWhite );
3167 aLbLight5.SelectEntry( aColWhite );
3168 aLbLight6.SelectEntry( aColWhite );
3169 aLbLight7.SelectEntry( aColWhite );
3170 aLbLight8.SelectEntry( aColWhite );
3171 aLbAmbientlight.SelectEntry( aColBlack );
3172 aLbMatColor.SelectEntry( aColWhite );
3173 aLbMatEmission.SelectEntry( aColBlack );
3174 aLbMatSpecular.SelectEntry( aColWhite );
3177 // -----------------------------------------------------------------------
3178 USHORT Svx3DWin::GetLightSource( const PushButton* pBtn )
3180 USHORT nLight = 8;
3182 if( pBtn == NULL )
3184 if( aBtnLight1.IsChecked() )
3185 nLight = 0;
3186 else if( aBtnLight2.IsChecked() )
3187 nLight = 1;
3188 else if( aBtnLight3.IsChecked() )
3189 nLight = 2;
3190 else if( aBtnLight4.IsChecked() )
3191 nLight = 3;
3192 else if( aBtnLight5.IsChecked() )
3193 nLight = 4;
3194 else if( aBtnLight6.IsChecked() )
3195 nLight = 5;
3196 else if( aBtnLight7.IsChecked() )
3197 nLight = 6;
3198 else if( aBtnLight8.IsChecked() )
3199 nLight = 7;
3201 else
3203 if( pBtn == &aBtnLight1 )
3204 nLight = 0;
3205 else if( pBtn == &aBtnLight2 )
3206 nLight = 1;
3207 else if( pBtn == &aBtnLight3 )
3208 nLight = 2;
3209 else if( pBtn == &aBtnLight4 )
3210 nLight = 3;
3211 else if( pBtn == &aBtnLight5 )
3212 nLight = 4;
3213 else if( pBtn == &aBtnLight6 )
3214 nLight = 5;
3215 else if( pBtn == &aBtnLight7 )
3216 nLight = 6;
3217 else if( pBtn == &aBtnLight8 )
3218 nLight = 7;
3220 return( nLight );
3223 // -----------------------------------------------------------------------
3224 ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn )
3226 ColorLB* pLb = NULL;
3228 if( pBtn == NULL )
3230 if( aBtnLight1.IsChecked() )
3231 pLb = &aLbLight1;
3232 else if( aBtnLight2.IsChecked() )
3233 pLb = &aLbLight2;
3234 else if( aBtnLight3.IsChecked() )
3235 pLb = &aLbLight3;
3236 else if( aBtnLight4.IsChecked() )
3237 pLb = &aLbLight4;
3238 else if( aBtnLight5.IsChecked() )
3239 pLb = &aLbLight5;
3240 else if( aBtnLight6.IsChecked() )
3241 pLb = &aLbLight6;
3242 else if( aBtnLight7.IsChecked() )
3243 pLb = &aLbLight7;
3244 else if( aBtnLight8.IsChecked() )
3245 pLb = &aLbLight8;
3247 else
3249 if( pBtn == &aBtnLight1 )
3250 pLb = &aLbLight1;
3251 else if( pBtn == &aBtnLight2 )
3252 pLb = &aLbLight2;
3253 else if( pBtn == &aBtnLight3 )
3254 pLb = &aLbLight3;
3255 else if( pBtn == &aBtnLight4 )
3256 pLb = &aLbLight4;
3257 else if( pBtn == &aBtnLight5 )
3258 pLb = &aLbLight5;
3259 else if( pBtn == &aBtnLight6 )
3260 pLb = &aLbLight6;
3261 else if( pBtn == &aBtnLight7 )
3262 pLb = &aLbLight7;
3263 else if( pBtn == &aBtnLight8 )
3264 pLb = &aLbLight8;
3266 return( pLb );
3269 /*************************************************************************
3271 |* Ableitung vom SfxChildWindow als "Behaelter" fuer Effekte
3273 \************************************************************************/
3274 __EXPORT Svx3DChildWindow::Svx3DChildWindow( Window* _pParent,
3275 USHORT nId,
3276 SfxBindings* pBindings,
3277 SfxChildWinInfo* pInfo ) :
3278 SfxChildWindow( _pParent, nId )
3280 Svx3DWin* pWin = new Svx3DWin( pBindings, this, _pParent );
3281 pWindow = pWin;
3283 eChildAlignment = SFX_ALIGN_NOALIGNMENT;
3285 pWin->Initialize( pInfo );
3288 /*************************************************************************
3290 |* ControllerItem fuer 3DStatus
3292 \************************************************************************/
3293 Svx3DCtrlItem::Svx3DCtrlItem( USHORT _nId,
3294 Svx3DWin* pWin,
3295 SfxBindings* _pBindings) :
3296 SfxControllerItem( _nId, *_pBindings ),
3297 p3DWin( pWin )
3301 // -----------------------------------------------------------------------
3302 void __EXPORT Svx3DCtrlItem::StateChanged( USHORT /*nSId*/,
3303 SfxItemState /*eState*/, const SfxPoolItem* /*pItem*/ )
3307 /*************************************************************************
3309 |* ControllerItem fuer Status Slot SID_CONVERT_TO_3D
3311 \************************************************************************/
3313 SvxConvertTo3DItem::SvxConvertTo3DItem(UINT16 _nId, SfxBindings* _pBindings)
3314 : SfxControllerItem(_nId, *_pBindings),
3315 bState(FALSE)
3319 void SvxConvertTo3DItem::StateChanged(UINT16 /*_nId*/, SfxItemState eState, const SfxPoolItem* /*pState*/)
3321 BOOL bNewState = (eState != SFX_ITEM_DISABLED);
3322 if(bNewState != bState)
3324 bState = bNewState;
3325 SfxDispatcher* pDispatcher = LocalGetDispatcher(&GetBindings());
3326 if (pDispatcher != NULL)
3328 SfxBoolItem aItem( SID_3D_STATE, TRUE );
3329 pDispatcher->Execute(
3330 SID_3D_STATE, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, &aItem, 0L);