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