1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/dispatch.hxx>
21 #include <sfx2/module.hxx>
22 #include <sfx2/viewfrm.hxx>
23 #include <svl/eitem.hxx>
24 #include <svtools/colrdlg.hxx>
25 #include <vcl/msgbox.hxx>
26 #include <sfx2/viewsh.hxx>
27 #include <svx/xflclit.hxx>
28 #include <svx/svdmodel.hxx>
29 #include <svx/globl3d.hxx>
30 #include <svx/view3d.hxx>
31 #include <svx/obj3d.hxx>
32 #include <svx/sphere3d.hxx>
33 #include <svx/scene3d.hxx>
34 #include <svx/camera3d.hxx>
35 #include <svx/fmmodel.hxx>
36 #include <svx/fmpage.hxx>
37 #include <svx/polysc3d.hxx>
38 #include <editeng/eeitem.hxx>
39 #include <svl/style.hxx>
40 #include <svx/dlgutil.hxx>
42 #include <svx/dialmgr.hxx>
43 #include <svx/viewpt3d.hxx>
45 #include <svx/svxids.hrc>
46 #include <svx/dialogs.hrc>
48 #include <editeng/colritem.hxx>
49 #include <svx/e3ditem.hxx>
50 #include <svx/gallery.hxx>
51 #include <svl/whiter.hxx>
53 #include <svx/float3d.hxx>
54 #include "float3d.hrc"
56 using namespace com::sun::star
;
58 SFX_IMPL_DOCKINGWINDOW_WITHID( Svx3DChildWindow
, SID_3D_WIN
)
66 /** Get the dispatcher from the current view frame, or, if that is not
67 available, from the given bindings.
70 @returns NULL when both the current view frame is NULL and the given
73 SfxDispatcher
* LocalGetDispatcher (const SfxBindings
* pBindings
)
75 SfxDispatcher
* pDispatcher
= NULL
;
77 if (SfxViewFrame::Current() != NULL
)
78 pDispatcher
= SfxViewFrame::Current()->GetDispatcher();
79 else if (pBindings
!= NULL
)
80 pDispatcher
= pBindings
->GetDispatcher();
86 Svx3DWin::Svx3DWin(SfxBindings
* pInBindings
, SfxChildWindow
*pCW
, vcl::Window
* pParent
)
87 : SfxDockingWindow (pInBindings
, pCW
, pParent
,
88 "Docking3DEffects", "svx/ui/docking3deffects.ui")
89 , aImgLightOn(SVX_RES(RID_SVXIMAGE_LIGHT_ON
))
90 , aImgLightOff(SVX_RES(RID_SVXIMAGE_LIGHT_OFF
))
92 , eViewType(VIEWTYPE_GEO
)
96 , pBindings(pInBindings
)
99 , pConvertTo3DLatheItem(0)
100 , mpImpl(new Svx3DWinImpl())
101 , ePoolUnit(SFX_MAPUNIT_MM
)
102 , mpRemember2DAttributes(NULL
)
103 , bOnly3DChanged(false)
105 get(m_pBtnGeo
, "geometry");
106 get(m_pBtnRepresentation
, "representation");
107 get(m_pBtnLight
, "light");
108 get(m_pBtnTexture
, "texture");
109 get(m_pBtnMaterial
, "material");
110 get(m_pBtnUpdate
, "update");
111 get(m_pBtnAssign
, "assign");
113 get(m_pFLGeometrie
, "geoframe");
114 get(m_pFtPercentDiagonal
, "diagonalft");
115 get(m_pMtrPercentDiagonal
, "diagonal");
116 get(m_pFtBackscale
, "scaleddepthft");
117 get(m_pMtrBackscale
, "scaleddepth");
118 get(m_pFtEndAngle
, "angleft");
119 get(m_pMtrEndAngle
, "angle");
120 get(m_pFtDepth
, "depthft");
121 get(m_pMtrDepth
, "depth");
123 get(m_pFLSegments
, "segmentsframe");
124 get(m_pNumHorizontal
, "hori");
125 get(m_pNumVertical
, "veri");
127 get(m_pFLNormals
, "normals");
128 get(m_pBtnNormalsObj
, "objspecific");
129 get(m_pBtnNormalsFlat
, "flat");
130 get(m_pBtnNormalsSphere
, "spherical");
131 get(m_pBtnNormalsInvert
, "invertnormals");
132 get(m_pBtnTwoSidedLighting
, "doublesidedillum");
133 get(m_pBtnDoubleSided
, "doublesided");
135 get(m_pFLRepresentation
, "shadingframe");
136 get(m_pLbShademode
, "mode");
138 get(m_pFLShadow
, "shadowframe");
139 get(m_pBtnShadow3d
, "shadow");
140 get(m_pFtSlant
, "slantft");
141 get(m_pMtrSlant
, "slant");
143 get(m_pFLCamera
, "cameraframe");
144 get(m_pMtrDistance
, "distance");
145 get(m_pMtrFocalLength
, "focal");
147 get(m_pFLLight
, "illumframe");
148 get(m_pBtnLight1
, "light1");
149 get(m_pBtnLight2
, "light2");
150 get(m_pBtnLight3
, "light3");
151 get(m_pBtnLight4
, "light4");
152 get(m_pBtnLight5
, "light5");
153 get(m_pBtnLight6
, "light6");
154 get(m_pBtnLight7
, "light7");
155 get(m_pBtnLight8
, "light8");
156 get(m_pLbLight1
, "lightcolor1");
157 get(m_pLbLight2
, "lightcolor2");
158 get(m_pLbLight3
, "lightcolor3");
159 get(m_pLbLight4
, "lightcolor4");
160 get(m_pLbLight5
, "lightcolor5");
161 get(m_pLbLight6
, "lightcolor6");
162 get(m_pLbLight7
, "lightcolor7");
163 get(m_pLbLight8
, "lightcolor8");
164 get(m_pBtnLightColor
, "colorbutton1");
165 get(m_pLbAmbientlight
, "ambientcolor");
166 get(m_pBtnAmbientColor
, "colorbutton2");
168 get(m_pFLTexture
, "textureframe");
169 get(m_pBtnTexLuminance
, "textype");
170 get(m_pBtnTexColor
, "texcolor");
171 get(m_pBtnTexReplace
, "texreplace");
172 get(m_pBtnTexModulate
, "texmodulate");
173 get(m_pBtnTexBlend
, "texblend");
174 get(m_pBtnTexObjectX
, "texobjx");
175 get(m_pBtnTexParallelX
, "texparallelx");
176 get(m_pBtnTexCircleX
, "texcirclex");
177 get(m_pBtnTexObjectY
, "texobjy");
178 get(m_pBtnTexParallelY
, "texparallely");
179 get(m_pBtnTexCircleY
, "texcircley");
180 get(m_pBtnTexFilter
, "texfilter");
182 get(m_pFLMaterial
, "materialframe");
183 get(m_pLbMatFavorites
, "favorites");
184 get(m_pLbMatColor
, "objcolor");
185 get(m_pBtnMatColor
, "colorbutton3");
186 get(m_pLbMatEmission
, "illumcolor");
187 get(m_pBtnEmissionColor
, "colorbutton4");
189 get(m_pFLMatSpecular
, "specframe");
190 get(m_pLbMatSpecular
, "speccolor");
191 get(m_pBtnSpecularColor
, "colorbutton5");
192 get(m_pMtrMatSpecularIntensity
, "intensity");
194 get(m_pCtlPreview
, "preview");
195 get(m_pCtlLightPreview
, "lightpreview");
196 Size
aSize(LogicToPixel(Size(83, 76), MAP_APPFONT
));
197 m_pCtlPreview
->set_width_request(aSize
.Width());
198 m_pCtlLightPreview
->set_width_request(aSize
.Width());
199 m_pCtlPreview
->set_height_request(aSize
.Height());
200 m_pCtlLightPreview
->set_height_request(aSize
.Height());
202 get(m_pBtnConvertTo3D
, "to3d");
203 get(m_pBtnLatheObject
, "tolathe");
204 get(m_pBtnPerspective
, "perspective");
206 mpImpl
->pPool
= NULL
;
209 eFUnit
= pInBindings
->GetDispatcher()->GetModule()->GetFieldUnit();
211 m_pMtrDepth
->SetUnit( eFUnit
);
212 m_pMtrDistance
->SetUnit( eFUnit
);
213 m_pMtrFocalLength
->SetUnit( eFUnit
);
215 pControllerItem
= new Svx3DCtrlItem(SID_3D_STATE
, pBindings
);
216 pConvertTo3DItem
= new SvxConvertTo3DItem(SID_CONVERT_TO_3D
, pBindings
);
217 pConvertTo3DLatheItem
= new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST
, pBindings
);
219 m_pBtnAssign
->SetClickHdl( LINK( this, Svx3DWin
, ClickAssignHdl
) );
220 m_pBtnUpdate
->SetClickHdl( LINK( this, Svx3DWin
, ClickUpdateHdl
) );
222 Link
<> aLink( LINK( this, Svx3DWin
, ClickViewTypeHdl
) );
223 m_pBtnGeo
->SetClickHdl( aLink
);
224 m_pBtnRepresentation
->SetClickHdl( aLink
);
225 m_pBtnLight
->SetClickHdl( aLink
);
226 m_pBtnTexture
->SetClickHdl( aLink
);
227 m_pBtnMaterial
->SetClickHdl( aLink
);
229 aLink
= LINK( this, Svx3DWin
, ClickHdl
);
230 m_pBtnPerspective
->SetClickHdl( aLink
);
231 m_pBtnConvertTo3D
->SetClickHdl( aLink
);
232 m_pBtnLatheObject
->SetClickHdl( aLink
);
235 m_pBtnNormalsObj
->SetClickHdl( aLink
);
236 m_pBtnNormalsFlat
->SetClickHdl( aLink
);
237 m_pBtnNormalsSphere
->SetClickHdl( aLink
);
238 m_pBtnTwoSidedLighting
->SetClickHdl( aLink
);
239 m_pBtnNormalsInvert
->SetClickHdl( aLink
);
240 m_pBtnDoubleSided
->SetClickHdl( aLink
);
243 m_pBtnShadow3d
->SetClickHdl( aLink
);
246 m_pBtnLight1
->SetClickHdl( aLink
);
247 m_pBtnLight2
->SetClickHdl( aLink
);
248 m_pBtnLight3
->SetClickHdl( aLink
);
249 m_pBtnLight4
->SetClickHdl( aLink
);
250 m_pBtnLight5
->SetClickHdl( aLink
);
251 m_pBtnLight6
->SetClickHdl( aLink
);
252 m_pBtnLight7
->SetClickHdl( aLink
);
253 m_pBtnLight8
->SetClickHdl( aLink
);
256 m_pBtnTexLuminance
->SetClickHdl( aLink
);
257 m_pBtnTexColor
->SetClickHdl( aLink
);
258 m_pBtnTexReplace
->SetClickHdl( aLink
);
259 m_pBtnTexModulate
->SetClickHdl( aLink
);
260 m_pBtnTexParallelX
->SetClickHdl( aLink
);
261 m_pBtnTexCircleX
->SetClickHdl( aLink
);
262 m_pBtnTexObjectX
->SetClickHdl( aLink
);
263 m_pBtnTexParallelY
->SetClickHdl( aLink
);
264 m_pBtnTexCircleY
->SetClickHdl( aLink
);
265 m_pBtnTexObjectY
->SetClickHdl( aLink
);
266 m_pBtnTexFilter
->SetClickHdl( aLink
);
269 aLink
= LINK( this, Svx3DWin
, ClickColorHdl
);
270 m_pBtnLightColor
->SetClickHdl( aLink
);
271 m_pBtnAmbientColor
->SetClickHdl( aLink
);
272 m_pBtnMatColor
->SetClickHdl( aLink
);
273 m_pBtnEmissionColor
->SetClickHdl( aLink
);
274 m_pBtnSpecularColor
->SetClickHdl( aLink
);
277 aLink
= LINK( this, Svx3DWin
, SelectHdl
);
278 m_pLbMatFavorites
->SetSelectHdl( aLink
);
279 m_pLbMatColor
->SetSelectHdl( aLink
);
280 m_pLbMatEmission
->SetSelectHdl( aLink
);
281 m_pLbMatSpecular
->SetSelectHdl( aLink
);
282 m_pLbLight1
->SetSelectHdl( aLink
);
283 m_pLbLight2
->SetSelectHdl( aLink
);
284 m_pLbLight3
->SetSelectHdl( aLink
);
285 m_pLbLight4
->SetSelectHdl( aLink
);
286 m_pLbLight5
->SetSelectHdl( aLink
);
287 m_pLbLight6
->SetSelectHdl( aLink
);
288 m_pLbLight7
->SetSelectHdl( aLink
);
289 m_pLbLight8
->SetSelectHdl( aLink
);
290 m_pLbAmbientlight
->SetSelectHdl( aLink
);
291 m_pLbShademode
->SetSelectHdl( aLink
);
293 aLink
= LINK( this, Svx3DWin
, ModifyHdl
);
294 m_pMtrMatSpecularIntensity
->SetModifyHdl( aLink
);
295 m_pNumHorizontal
->SetModifyHdl( aLink
);
296 m_pNumVertical
->SetModifyHdl( aLink
);
297 m_pMtrSlant
->SetModifyHdl( aLink
);
300 aLink
= LINK( this, Svx3DWin
, ChangeLightCallbackHdl
);
301 m_pCtlLightPreview
->SetUserInteractiveChangeCallback(aLink
);
302 aLink
= LINK( this, Svx3DWin
, ChangeSelectionCallbackHdl
);
303 m_pCtlLightPreview
->SetUserSelectionChangeCallback(aLink
);
305 aSize
= GetOutputSizePixel();
306 SetMinOutputSizePixel( aSize
);
310 // Initiation of the initialization of the ColorLBs
311 SfxDispatcher
* pDispatcher
= LocalGetDispatcher(pBindings
);
312 if (pDispatcher
!= NULL
)
314 SfxBoolItem
aItem( SID_3D_INIT
, true );
315 pDispatcher
->Execute(
316 SID_3D_INIT
, SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
, &aItem
, 0L );
321 //lock down the size of the initial largest default mode as the permanent size
322 aSize
= get_preferred_size();
323 set_width_request(aSize
.Width());
324 set_height_request(aSize
.Height());
327 Svx3DWin::~Svx3DWin()
332 void Svx3DWin::dispose()
335 pVDev
.disposeAndClear();
338 DELETEZ( pControllerItem
);
339 DELETEZ( pConvertTo3DItem
);
340 DELETEZ( pConvertTo3DLatheItem
);
342 delete mpRemember2DAttributes
;
347 m_pBtnRepresentation
.clear();
349 m_pBtnTexture
.clear();
350 m_pBtnMaterial
.clear();
351 m_pBtnUpdate
.clear();
352 m_pBtnAssign
.clear();
354 SfxDockingWindow::dispose();
358 void Svx3DWin::Construct()
361 Link
<> aLink( LINK( this, Svx3DWin
, ClickViewTypeHdl
) );
362 aLink
.Call(m_pBtnGeo
);
363 m_pCtlLightPreview
->Hide();
367 void Svx3DWin::Reset()
369 // Various initializations, default is AllAttributes
370 m_pLbShademode
->SelectEntryPos( 0 );
371 m_pMtrMatSpecularIntensity
->SetValue( 50 );
373 m_pBtnLight1
->Check();
374 ClickUpdateHdl( NULL
);
376 // Select nothing, to avoid errors when selecting the first
377 m_pCtlLightPreview
->GetSvx3DLightControl().SelectLight(0);
378 m_pCtlLightPreview
->CheckSelection();
381 bool Svx3DWin::GetUILightState(const PushButton
& rBtn
) const
383 return (rBtn
.GetModeImage() == aImgLightOn
);
386 void Svx3DWin::SetUILightState(PushButton
& rBtn
, bool bState
)
388 rBtn
.SetModeImage( bState
? aImgLightOn
: aImgLightOff
);
391 void Svx3DWin::Update( SfxItemSet
& rAttrs
)
393 // remember 2d attributes
394 if(mpRemember2DAttributes
)
395 mpRemember2DAttributes
->ClearItem();
397 mpRemember2DAttributes
= new SfxItemSet(*rAttrs
.GetPool(),
398 SDRATTR_START
, SDRATTR_SHADOW_LAST
,
399 SDRATTR_3D_FIRST
, SDRATTR_3D_LAST
,
402 SfxWhichIter
aIter(*mpRemember2DAttributes
);
403 sal_uInt16
nWhich(aIter
.FirstWhich());
407 SfxItemState eState
= rAttrs
.GetItemState(nWhich
, false);
408 if(SfxItemState::DONTCARE
== eState
)
409 mpRemember2DAttributes
->InvalidateItem(nWhich
);
410 else if(SfxItemState::SET
== eState
)
411 mpRemember2DAttributes
->Put(rAttrs
.Get(nWhich
, false));
413 nWhich
= aIter
.NextWhich();
416 // construct field values
417 const SfxPoolItem
* pItem
;
419 // Possible determine PoolUnit
422 mpImpl
->pPool
= rAttrs
.GetPool();
423 DBG_ASSERT( mpImpl
->pPool
, "Where is the Pool? ");
424 ePoolUnit
= mpImpl
->pPool
->GetMetric( SID_ATTR_LINE_WIDTH
);
426 eFUnit
= GetModuleFieldUnit( rAttrs
);
429 // Segment Number Can be changed? and other states
430 SfxItemState eState
= rAttrs
.GetItemState( SID_ATTR_3D_INTERN
, false, &pItem
);
431 if( SfxItemState::SET
== eState
)
433 sal_uInt32 nState
= static_cast<const SfxUInt32Item
*>(pItem
)->GetValue();
434 bool bExtrude
= ( nState
& 2 );
435 bool bSphere
= ( nState
& 4 );
436 bool bCube
= ( nState
& 8 );
438 bool bChart
= ( nState
& 32 ); // Chart
442 // For cube objects are no segments set
443 m_pFLSegments
->Enable(!bCube
);
445 m_pFtPercentDiagonal
->Enable( !bCube
&& !bSphere
);
446 m_pMtrPercentDiagonal
->Enable( !bCube
&& !bSphere
);
447 m_pFtBackscale
->Enable( !bCube
&& !bSphere
);
448 m_pMtrBackscale
->Enable( !bCube
&& !bSphere
);
449 m_pFtDepth
->Enable( !bCube
&& !bSphere
);
450 m_pMtrDepth
->Enable( !bCube
&& !bSphere
);
453 m_pNumHorizontal
->SetEmptyFieldValue();
454 m_pNumVertical
->SetEmptyFieldValue();
456 if( bCube
|| bSphere
)
458 m_pMtrPercentDiagonal
->SetEmptyFieldValue();
459 m_pMtrBackscale
->SetEmptyFieldValue();
460 m_pMtrDepth
->SetEmptyFieldValue();
463 // There is a final angle only for Lathe objects.
464 m_pFtEndAngle
->Enable( !bExtrude
&& !bCube
&& !bSphere
);
465 m_pMtrEndAngle
->Enable( !bExtrude
&& !bCube
&& !bSphere
);
466 if( bExtrude
|| bCube
|| bSphere
)
467 m_pMtrEndAngle
->SetEmptyFieldValue();
472 m_pNumHorizontal
->SetEmptyFieldValue();
473 m_pNumVertical
->SetEmptyFieldValue();
474 m_pFLSegments
->Enable( false );
475 m_pFtEndAngle
->Enable( false );
476 m_pMtrEndAngle
->Enable( false );
477 m_pMtrEndAngle
->SetEmptyFieldValue();
478 m_pFtDepth
->Enable( false );
479 m_pMtrDepth
->Enable( false );
480 m_pMtrDepth
->SetEmptyFieldValue();
483 m_pFLShadow
->Enable(false);
485 m_pMtrDistance
->SetEmptyFieldValue();
486 m_pMtrFocalLength
->SetEmptyFieldValue();
487 m_pFLCamera
->Enable( false );
490 m_pBtnConvertTo3D
->Enable( false );
491 m_pBtnLatheObject
->Enable( false );
494 // Bitmap fill ? -> Status
496 eState
= rAttrs
.GetItemState(XATTR_FILLSTYLE
);
497 if(eState
!= SfxItemState::DONTCARE
)
499 drawing::FillStyle eXFS
= (drawing::FillStyle
)static_cast<const XFillStyleItem
&>(rAttrs
.Get(XATTR_FILLSTYLE
)).GetValue();
500 bBitmap
= (eXFS
== drawing::FillStyle_BITMAP
|| eXFS
== drawing::FillStyle_GRADIENT
|| eXFS
== drawing::FillStyle_HATCH
);
503 m_pFLTexture
->Enable(bBitmap
);
506 // Number of segments (horizontal)
507 if( m_pNumHorizontal
->IsEnabled() )
509 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_HORZ_SEGS
);
510 if(eState
!= SfxItemState::DONTCARE
)
512 sal_uInt32 nValue
= static_cast<const SfxUInt32Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_HORZ_SEGS
)).GetValue();
513 if(nValue
!= (sal_uInt32
)m_pNumHorizontal
->GetValue())
515 m_pNumHorizontal
->SetValue( nValue
);
518 else if( m_pNumHorizontal
->IsEmptyFieldValue() )
519 m_pNumHorizontal
->SetValue( nValue
);
523 if( !m_pNumHorizontal
->IsEmptyFieldValue() )
525 m_pNumHorizontal
->SetEmptyFieldValue();
531 //Number of segments (vertical)
532 if( m_pNumVertical
->IsEnabled() )
534 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_VERT_SEGS
);
535 if( eState
!= SfxItemState::DONTCARE
)
537 sal_uInt32 nValue
= static_cast<const SfxUInt32Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_VERT_SEGS
)).GetValue();
538 if( nValue
!= (sal_uInt32
) m_pNumVertical
->GetValue() )
540 m_pNumVertical
->SetValue( nValue
);
543 else if( m_pNumVertical
->IsEmptyFieldValue() )
544 m_pNumVertical
->SetValue( nValue
);
548 if( !m_pNumVertical
->IsEmptyFieldValue() )
550 m_pNumVertical
->SetEmptyFieldValue();
557 if( m_pMtrDepth
->IsEnabled() )
559 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_DEPTH
);
560 if( eState
!= SfxItemState::DONTCARE
)
562 sal_uInt32 nValue
= static_cast<const SfxUInt32Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_DEPTH
)).GetValue();
563 sal_uInt32 nValue2
= GetCoreValue(*m_pMtrDepth
, ePoolUnit
);
564 if( nValue
!= nValue2
)
566 if( eFUnit
!= m_pMtrDepth
->GetUnit() )
567 SetFieldUnit(*m_pMtrDepth
, eFUnit
);
569 SetMetricValue(*m_pMtrDepth
, nValue
, ePoolUnit
);
572 else if( m_pMtrDepth
->IsEmptyFieldValue() )
573 m_pMtrDepth
->SetValue( m_pMtrDepth
->GetValue() );
577 if( !m_pMtrDepth
->IsEmptyFieldValue() )
579 m_pMtrDepth
->SetEmptyFieldValue();
585 // Double walled / Double sided
586 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_DOUBLE_SIDED
);
587 if( eState
!= SfxItemState::DONTCARE
)
589 bool bValue
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_DOUBLE_SIDED
)).GetValue();
590 if( bValue
!= m_pBtnDoubleSided
->IsChecked() )
592 m_pBtnDoubleSided
->Check( bValue
);
595 else if( m_pBtnDoubleSided
->GetState() == TRISTATE_INDET
)
596 m_pBtnDoubleSided
->Check( bValue
);
600 if( m_pBtnDoubleSided
->GetState() != TRISTATE_INDET
)
602 m_pBtnDoubleSided
->SetState( TRISTATE_INDET
);
608 if( m_pMtrPercentDiagonal
->IsEnabled() )
610 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_PERCENT_DIAGONAL
);
611 if( eState
!= SfxItemState::DONTCARE
)
613 sal_uInt16 nValue
= static_cast<const SfxUInt16Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL
)).GetValue();
614 if( nValue
!= m_pMtrPercentDiagonal
->GetValue() )
616 m_pMtrPercentDiagonal
->SetValue( nValue
);
619 else if( m_pMtrPercentDiagonal
->IsEmptyFieldValue() )
620 m_pMtrPercentDiagonal
->SetValue( nValue
);
624 if( !m_pMtrPercentDiagonal
->IsEmptyFieldValue() )
626 m_pMtrPercentDiagonal
->SetEmptyFieldValue();
633 if( m_pMtrBackscale
->IsEnabled() )
635 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_BACKSCALE
);
636 if( eState
!= SfxItemState::DONTCARE
)
638 sal_uInt16 nValue
= static_cast<const SfxUInt16Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_BACKSCALE
)).GetValue();
639 if( nValue
!= m_pMtrBackscale
->GetValue() )
641 m_pMtrBackscale
->SetValue( nValue
);
644 else if( m_pMtrBackscale
->IsEmptyFieldValue() )
645 m_pMtrBackscale
->SetValue( nValue
);
649 if( !m_pMtrBackscale
->IsEmptyFieldValue() )
651 m_pMtrBackscale
->SetEmptyFieldValue();
658 if( m_pMtrEndAngle
->IsEnabled() )
660 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_END_ANGLE
);
661 if( eState
!= SfxItemState::DONTCARE
)
663 sal_Int32 nValue
= static_cast<const SfxUInt32Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_END_ANGLE
)).GetValue();
664 if( nValue
!= m_pMtrEndAngle
->GetValue() )
666 m_pMtrEndAngle
->SetValue( nValue
);
672 if( !m_pMtrEndAngle
->IsEmptyFieldValue() )
674 m_pMtrEndAngle
->SetEmptyFieldValue();
681 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_NORMALS_KIND
);
682 if( eState
!= SfxItemState::DONTCARE
)
684 sal_uInt16 nValue
= static_cast<const Svx3DNormalsKindItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_NORMALS_KIND
)).GetValue();
686 if( ( !m_pBtnNormalsObj
->IsChecked() && nValue
== 0 ) ||
687 ( !m_pBtnNormalsFlat
->IsChecked() && nValue
== 1 ) ||
688 ( !m_pBtnNormalsSphere
->IsChecked() && nValue
== 2 ) )
690 m_pBtnNormalsObj
->Check( nValue
== 0 );
691 m_pBtnNormalsFlat
->Check( nValue
== 1 );
692 m_pBtnNormalsSphere
->Check( nValue
== 2 );
698 if( m_pBtnNormalsObj
->IsChecked() ||
699 m_pBtnNormalsFlat
->IsChecked() ||
700 m_pBtnNormalsSphere
->IsChecked() )
702 m_pBtnNormalsObj
->Check( false );
703 m_pBtnNormalsFlat
->Check( false );
704 m_pBtnNormalsSphere
->Check( false );
710 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_NORMALS_INVERT
);
711 if( eState
!= SfxItemState::DONTCARE
)
713 bool bValue
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_NORMALS_INVERT
)).GetValue();
714 if( bValue
!= m_pBtnNormalsInvert
->IsChecked() )
716 m_pBtnNormalsInvert
->Check( bValue
);
719 else if( m_pBtnNormalsInvert
->GetState() == TRISTATE_INDET
)
720 m_pBtnNormalsInvert
->Check( bValue
);
724 if( m_pBtnNormalsInvert
->GetState() != TRISTATE_INDET
)
726 m_pBtnNormalsInvert
->SetState( TRISTATE_INDET
);
732 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING
);
733 if( eState
!= SfxItemState::DONTCARE
)
735 bool bValue
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING
)).GetValue();
736 if( bValue
!= m_pBtnTwoSidedLighting
->IsChecked() )
738 m_pBtnTwoSidedLighting
->Check( bValue
);
741 else if( m_pBtnTwoSidedLighting
->GetState() == TRISTATE_INDET
)
742 m_pBtnTwoSidedLighting
->Check( bValue
);
746 if( m_pBtnTwoSidedLighting
->GetState() != TRISTATE_INDET
)
748 m_pBtnTwoSidedLighting
->SetState( TRISTATE_INDET
);
755 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_SHADE_MODE
);
756 if( eState
!= SfxItemState::DONTCARE
)
758 sal_uInt16 nValue
= static_cast<const Svx3DShadeModeItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_SHADE_MODE
)).GetValue();
759 if( nValue
!= m_pLbShademode
->GetSelectEntryPos() )
761 m_pLbShademode
->SelectEntryPos( nValue
);
767 if( m_pLbShademode
->GetSelectEntryCount() != 0 )
769 m_pLbShademode
->SetNoSelection();
775 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_SHADOW_3D
);
776 if( eState
!= SfxItemState::DONTCARE
)
778 bool bValue
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_SHADOW_3D
)).GetValue();
779 if( bValue
!= m_pBtnShadow3d
->IsChecked() )
781 m_pBtnShadow3d
->Check( bValue
);
782 m_pFtSlant
->Enable( bValue
);
783 m_pMtrSlant
->Enable( bValue
);
786 else if( m_pBtnShadow3d
->GetState() == TRISTATE_INDET
)
787 m_pBtnShadow3d
->Check( bValue
);
791 if( m_pBtnShadow3d
->GetState() != TRISTATE_INDET
)
793 m_pBtnShadow3d
->SetState( TRISTATE_INDET
);
798 // Inclination (Shadow)
799 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_SHADOW_SLANT
);
800 if( eState
!= SfxItemState::DONTCARE
)
802 sal_uInt16 nValue
= static_cast<const SfxUInt16Item
&>(rAttrs
.Get(SDRATTR_3DSCENE_SHADOW_SLANT
)).GetValue();
803 if( nValue
!= m_pMtrSlant
->GetValue() )
805 m_pMtrSlant
->SetValue( nValue
);
811 if( !m_pMtrSlant
->IsEmptyFieldValue() )
813 m_pMtrSlant
->SetEmptyFieldValue();
819 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_DISTANCE
);
820 if( eState
!= SfxItemState::DONTCARE
)
822 sal_uInt32 nValue
= static_cast<const SfxUInt32Item
&>(rAttrs
.Get(SDRATTR_3DSCENE_DISTANCE
)).GetValue();
823 sal_uInt32 nValue2
= GetCoreValue(*m_pMtrDistance
, ePoolUnit
);
824 if( nValue
!= nValue2
)
826 if( eFUnit
!= m_pMtrDistance
->GetUnit() )
827 SetFieldUnit(*m_pMtrDistance
, eFUnit
);
829 SetMetricValue(*m_pMtrDistance
, nValue
, ePoolUnit
);
835 if( !m_pMtrDepth
->IsEmptyFieldValue() )
837 m_pMtrDepth
->SetEmptyFieldValue();
843 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_FOCAL_LENGTH
);
844 if( eState
!= SfxItemState::DONTCARE
)
846 sal_uInt32 nValue
= static_cast<const SfxUInt32Item
&>(rAttrs
.Get(SDRATTR_3DSCENE_FOCAL_LENGTH
)).GetValue();
847 sal_uInt32 nValue2
= GetCoreValue(*m_pMtrFocalLength
, ePoolUnit
);
848 if( nValue
!= nValue2
)
850 if( eFUnit
!= m_pMtrFocalLength
->GetUnit() )
851 SetFieldUnit(*m_pMtrFocalLength
, eFUnit
);
853 SetMetricValue(*m_pMtrFocalLength
, nValue
, ePoolUnit
);
859 if( !m_pMtrFocalLength
->IsEmptyFieldValue() )
861 m_pMtrFocalLength
->SetEmptyFieldValue();
868 basegfx::B3DVector aVector
;
870 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_1
);
871 if( eState
!= SfxItemState::DONTCARE
)
873 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1
)).GetValue();
874 ColorLB
* pLb
= m_pLbLight1
;
875 if( aColor
!= pLb
->GetSelectEntryColor() )
877 LBSelectColor( pLb
, aColor
);
883 if( m_pLbLight1
->GetSelectEntryCount() != 0 )
885 m_pLbLight1
->SetNoSelection();
890 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_1
);
891 if( eState
!= SfxItemState::DONTCARE
)
893 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_1
)).GetValue();
894 if( ( bOn
&& !GetUILightState(*m_pBtnLight1
)) ||
895 ( !bOn
&& GetUILightState(*m_pBtnLight1
)) )
897 SetUILightState(*m_pBtnLight1
, bOn
);
900 if( m_pBtnLight1
->GetState() == TRISTATE_INDET
)
901 m_pBtnLight1
->Check( m_pBtnLight1
->IsChecked() );
905 if( m_pBtnLight1
->GetState() != TRISTATE_INDET
)
907 m_pBtnLight1
->SetState( TRISTATE_INDET
);
911 // Light 1 (direction)
912 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_1
);
913 if( eState
!= SfxItemState::DONTCARE
)
919 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_2
);
920 if( eState
!= SfxItemState::DONTCARE
)
922 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2
)).GetValue();
923 ColorLB
* pLb
= m_pLbLight2
;
924 if( aColor
!= pLb
->GetSelectEntryColor() )
926 LBSelectColor( pLb
, aColor
);
932 if( m_pLbLight2
->GetSelectEntryCount() != 0 )
934 m_pLbLight2
->SetNoSelection();
939 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_2
);
940 if( eState
!= SfxItemState::DONTCARE
)
942 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_2
)).GetValue();
943 if( ( bOn
&& !GetUILightState(*m_pBtnLight2
)) ||
944 ( !bOn
&& GetUILightState(*m_pBtnLight2
)) )
946 SetUILightState(*m_pBtnLight2
, bOn
);
949 if( m_pBtnLight2
->GetState() == TRISTATE_INDET
)
950 m_pBtnLight2
->Check( m_pBtnLight2
->IsChecked() );
954 if( m_pBtnLight2
->GetState() != TRISTATE_INDET
)
956 m_pBtnLight2
->SetState( TRISTATE_INDET
);
960 //Light 2 (Direction)
961 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_2
);
962 if( eState
!= SfxItemState::DONTCARE
)
968 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_3
);
969 if( eState
!= SfxItemState::DONTCARE
)
971 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3
)).GetValue();
972 ColorLB
* pLb
= m_pLbLight3
;
973 if( aColor
!= pLb
->GetSelectEntryColor() )
975 LBSelectColor( pLb
, aColor
);
981 if( m_pLbLight3
->GetSelectEntryCount() != 0 )
983 m_pLbLight3
->SetNoSelection();
988 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_3
);
989 if( eState
!= SfxItemState::DONTCARE
)
991 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_3
)).GetValue();
992 if( ( bOn
&& !GetUILightState(*m_pBtnLight3
)) ||
993 ( !bOn
&& GetUILightState(*m_pBtnLight3
)) )
995 SetUILightState(*m_pBtnLight3
, bOn
);
998 if( m_pBtnLight3
->GetState() == TRISTATE_INDET
)
999 m_pBtnLight3
->Check( m_pBtnLight3
->IsChecked() );
1003 if( m_pBtnLight3
->GetState() != TRISTATE_INDET
)
1005 m_pBtnLight3
->SetState( TRISTATE_INDET
);
1009 // Light 3 (Direction)
1010 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_3
);
1011 if( eState
!= SfxItemState::DONTCARE
)
1017 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_4
);
1018 if( eState
!= SfxItemState::DONTCARE
)
1020 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4
)).GetValue();
1021 ColorLB
* pLb
= m_pLbLight4
;
1022 if( aColor
!= pLb
->GetSelectEntryColor() )
1024 LBSelectColor( pLb
, aColor
);
1030 if( m_pLbLight4
->GetSelectEntryCount() != 0 )
1032 m_pLbLight4
->SetNoSelection();
1037 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_4
);
1038 if( eState
!= SfxItemState::DONTCARE
)
1040 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_4
)).GetValue();
1041 if( ( bOn
&& !GetUILightState(*m_pBtnLight4
)) ||
1042 ( !bOn
&& GetUILightState(*m_pBtnLight4
)) )
1044 SetUILightState(*m_pBtnLight4
, bOn
);
1047 if( m_pBtnLight4
->GetState() == TRISTATE_INDET
)
1048 m_pBtnLight4
->Check( m_pBtnLight4
->IsChecked() );
1052 if( m_pBtnLight4
->GetState() != TRISTATE_INDET
)
1054 m_pBtnLight4
->SetState( TRISTATE_INDET
);
1058 // Light 4 (direction)
1059 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_4
);
1060 if( eState
!= SfxItemState::DONTCARE
)
1066 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_5
);
1067 if( eState
!= SfxItemState::DONTCARE
)
1069 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5
)).GetValue();
1070 ColorLB
* pLb
= m_pLbLight5
;
1071 if( aColor
!= pLb
->GetSelectEntryColor() )
1073 LBSelectColor( pLb
, aColor
);
1079 if( m_pLbLight5
->GetSelectEntryCount() != 0 )
1081 m_pLbLight5
->SetNoSelection();
1086 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_5
);
1087 if( eState
!= SfxItemState::DONTCARE
)
1089 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_5
)).GetValue();
1090 if( ( bOn
&& !GetUILightState(*m_pBtnLight5
)) ||
1091 ( !bOn
&& GetUILightState(*m_pBtnLight5
)) )
1093 SetUILightState(*m_pBtnLight5
, bOn
);
1096 if( m_pBtnLight5
->GetState() == TRISTATE_INDET
)
1097 m_pBtnLight5
->Check( m_pBtnLight5
->IsChecked() );
1101 if( m_pBtnLight5
->GetState() != TRISTATE_INDET
)
1103 m_pBtnLight5
->SetState( TRISTATE_INDET
);
1107 // Light 5 (direction)
1108 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_5
);
1109 if( eState
!= SfxItemState::DONTCARE
)
1115 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_6
);
1116 if( eState
!= SfxItemState::DONTCARE
)
1118 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6
)).GetValue();
1119 ColorLB
* pLb
= m_pLbLight6
;
1120 if( aColor
!= pLb
->GetSelectEntryColor() )
1122 LBSelectColor( pLb
, aColor
);
1128 if( m_pLbLight6
->GetSelectEntryCount() != 0 )
1130 m_pLbLight6
->SetNoSelection();
1135 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_6
);
1136 if( eState
!= SfxItemState::DONTCARE
)
1138 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_6
)).GetValue();
1139 if( ( bOn
&& !GetUILightState(*m_pBtnLight6
)) ||
1140 ( !bOn
&& GetUILightState(*m_pBtnLight6
)) )
1142 SetUILightState(*m_pBtnLight6
, bOn
);
1145 if( m_pBtnLight6
->GetState() == TRISTATE_INDET
)
1146 m_pBtnLight6
->Check( m_pBtnLight6
->IsChecked() );
1150 if( m_pBtnLight6
->GetState() != TRISTATE_INDET
)
1152 m_pBtnLight6
->SetState( TRISTATE_INDET
);
1156 // Light 6 (direction)
1157 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_6
);
1158 if( eState
!= SfxItemState::DONTCARE
)
1164 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_7
);
1165 if( eState
!= SfxItemState::DONTCARE
)
1167 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7
)).GetValue();
1168 ColorLB
* pLb
= m_pLbLight7
;
1169 if( aColor
!= pLb
->GetSelectEntryColor() )
1171 LBSelectColor( pLb
, aColor
);
1177 if( m_pLbLight7
->GetSelectEntryCount() != 0 )
1179 m_pLbLight7
->SetNoSelection();
1184 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_7
);
1185 if( eState
!= SfxItemState::DONTCARE
)
1187 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_7
)).GetValue();
1188 if( ( bOn
&& !GetUILightState(*m_pBtnLight7
)) ||
1189 ( !bOn
&& GetUILightState(*m_pBtnLight7
)) )
1191 SetUILightState(*m_pBtnLight7
, bOn
);
1194 if( m_pBtnLight7
->GetState() == TRISTATE_INDET
)
1195 m_pBtnLight7
->Check( m_pBtnLight7
->IsChecked() );
1199 if( m_pBtnLight7
->GetState() != TRISTATE_INDET
)
1201 m_pBtnLight7
->SetState( TRISTATE_INDET
);
1205 // Light 7 (direction)
1206 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_7
);
1207 if( eState
!= SfxItemState::DONTCARE
)
1213 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_8
);
1214 if( eState
!= SfxItemState::DONTCARE
)
1216 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8
)).GetValue();
1217 ColorLB
* pLb
= m_pLbLight8
;
1218 if( aColor
!= pLb
->GetSelectEntryColor() )
1220 LBSelectColor( pLb
, aColor
);
1226 if( m_pLbLight8
->GetSelectEntryCount() != 0 )
1228 m_pLbLight8
->SetNoSelection();
1233 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTON_8
);
1234 if( eState
!= SfxItemState::DONTCARE
)
1236 bool bOn
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_LIGHTON_8
)).GetValue();
1237 if( ( bOn
&& !GetUILightState(*m_pBtnLight8
)) ||
1238 ( !bOn
&& GetUILightState(*m_pBtnLight8
)) )
1240 SetUILightState(*m_pBtnLight8
, bOn
);
1243 if( m_pBtnLight8
->GetState() == TRISTATE_INDET
)
1244 m_pBtnLight8
->Check( m_pBtnLight8
->IsChecked() );
1248 if( m_pBtnLight8
->GetState() != TRISTATE_INDET
)
1250 m_pBtnLight8
->SetState( TRISTATE_INDET
);
1254 // Light 8 (direction)
1255 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_LIGHTDIRECTION_8
);
1256 if( eState
!= SfxItemState::DONTCARE
)
1262 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_AMBIENTCOLOR
);
1263 if( eState
!= SfxItemState::DONTCARE
)
1265 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_AMBIENTCOLOR
)).GetValue();
1266 ColorLB
* pLb
= m_pLbAmbientlight
;
1267 if( aColor
!= pLb
->GetSelectEntryColor() )
1269 LBSelectColor( pLb
, aColor
);
1275 if( m_pLbAmbientlight
->GetSelectEntryCount() != 0 )
1277 m_pLbAmbientlight
->SetNoSelection();
1287 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_TEXTURE_KIND
);
1288 if( eState
!= SfxItemState::DONTCARE
)
1290 sal_uInt16 nValue
= static_cast<const Svx3DTextureKindItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_TEXTURE_KIND
)).GetValue();
1292 if( ( !m_pBtnTexLuminance
->IsChecked() && nValue
== 1 ) ||
1293 ( !m_pBtnTexColor
->IsChecked() && nValue
== 3 ) )
1295 m_pBtnTexLuminance
->Check( nValue
== 1 );
1296 m_pBtnTexColor
->Check( nValue
== 3 );
1302 if( m_pBtnTexLuminance
->IsChecked() ||
1303 m_pBtnTexColor
->IsChecked() )
1305 m_pBtnTexLuminance
->Check( false );
1306 m_pBtnTexColor
->Check( false );
1312 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_TEXTURE_MODE
);
1313 if( eState
!= SfxItemState::DONTCARE
)
1315 sal_uInt16 nValue
= static_cast<const Svx3DTextureModeItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_TEXTURE_MODE
)).GetValue();
1317 if( ( !m_pBtnTexReplace
->IsChecked() && nValue
== 1 ) ||
1318 ( !m_pBtnTexModulate
->IsChecked() && nValue
== 2 ) )
1320 m_pBtnTexReplace
->Check( nValue
== 1 );
1321 m_pBtnTexModulate
->Check( nValue
== 2 );
1327 if( m_pBtnTexReplace
->IsChecked() ||
1328 m_pBtnTexModulate
->IsChecked() )
1330 m_pBtnTexReplace
->Check( false );
1331 m_pBtnTexModulate
->Check( false );
1337 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_X
);
1338 if( eState
!= SfxItemState::DONTCARE
)
1340 sal_uInt16 nValue
= static_cast<const Svx3DTextureProjectionXItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X
)).GetValue();
1342 if( ( !m_pBtnTexObjectX
->IsChecked() && nValue
== 0 ) ||
1343 ( !m_pBtnTexParallelX
->IsChecked() && nValue
== 1 ) ||
1344 ( !m_pBtnTexCircleX
->IsChecked() && nValue
== 2 ) )
1346 m_pBtnTexObjectX
->Check( nValue
== 0 );
1347 m_pBtnTexParallelX
->Check( nValue
== 1 );
1348 m_pBtnTexCircleX
->Check( nValue
== 2 );
1354 if( m_pBtnTexObjectX
->IsChecked() ||
1355 m_pBtnTexParallelX
->IsChecked() ||
1356 m_pBtnTexCircleX
->IsChecked() )
1358 m_pBtnTexObjectX
->Check( false );
1359 m_pBtnTexParallelX
->Check( false );
1360 m_pBtnTexCircleX
->Check( false );
1366 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_Y
);
1367 if( eState
!= SfxItemState::DONTCARE
)
1369 sal_uInt16 nValue
= static_cast<const Svx3DTextureProjectionYItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y
)).GetValue();
1371 if( ( !m_pBtnTexObjectY
->IsChecked() && nValue
== 0 ) ||
1372 ( !m_pBtnTexParallelY
->IsChecked() && nValue
== 1 ) ||
1373 ( !m_pBtnTexCircleY
->IsChecked() && nValue
== 2 ) )
1375 m_pBtnTexObjectY
->Check( nValue
== 0 );
1376 m_pBtnTexParallelY
->Check( nValue
== 1 );
1377 m_pBtnTexCircleY
->Check( nValue
== 2 );
1383 if( m_pBtnTexObjectY
->IsChecked() ||
1384 m_pBtnTexParallelY
->IsChecked() ||
1385 m_pBtnTexCircleY
->IsChecked() )
1387 m_pBtnTexObjectY
->Check( false );
1388 m_pBtnTexParallelY
->Check( false );
1389 m_pBtnTexCircleY
->Check( false );
1395 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_TEXTURE_FILTER
);
1396 if( eState
!= SfxItemState::DONTCARE
)
1398 bool bValue
= static_cast<const SfxBoolItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_TEXTURE_FILTER
)).GetValue();
1399 if( bValue
!= m_pBtnTexFilter
->IsChecked() )
1401 m_pBtnTexFilter
->Check( bValue
);
1404 if( m_pBtnTexFilter
->GetState() == TRISTATE_INDET
)
1405 m_pBtnTexFilter
->Check( bValue
);
1409 if( m_pBtnTexFilter
->GetState() != TRISTATE_INDET
)
1411 m_pBtnTexFilter
->SetState( TRISTATE_INDET
);
1418 // Material Favorites
1419 m_pLbMatFavorites
->SelectEntryPos( 0 );
1422 eState
= rAttrs
.GetItemState(XATTR_FILLCOLOR
);
1423 if( eState
!= SfxItemState::DONTCARE
)
1425 aColor
= static_cast<const XFillColorItem
&>(rAttrs
.Get(XATTR_FILLCOLOR
)).GetColorValue();
1426 ColorLB
* pLb
= m_pLbMatColor
;
1427 if( aColor
!= pLb
->GetSelectEntryColor() )
1429 LBSelectColor( pLb
, aColor
);
1435 if( m_pLbMatColor
->GetSelectEntryCount() != 0 )
1437 m_pLbMatColor
->SetNoSelection();
1442 // Self-luminous color
1443 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_MAT_EMISSION
);
1444 if( eState
!= SfxItemState::DONTCARE
)
1446 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_MAT_EMISSION
)).GetValue();
1447 ColorLB
* pLb
= m_pLbMatEmission
;
1448 if( aColor
!= pLb
->GetSelectEntryColor() )
1450 LBSelectColor( pLb
, aColor
);
1456 if( m_pLbMatEmission
->GetSelectEntryCount() != 0 )
1458 m_pLbMatEmission
->SetNoSelection();
1464 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR
);
1465 if( eState
!= SfxItemState::DONTCARE
)
1467 aColor
= static_cast<const SvxColorItem
&>(rAttrs
.Get(SDRATTR_3DOBJ_MAT_SPECULAR
)).GetValue();
1468 ColorLB
* pLb
= m_pLbMatSpecular
;
1469 if( aColor
!= pLb
->GetSelectEntryColor() )
1471 LBSelectColor( pLb
, aColor
);
1477 if( m_pLbMatSpecular
->GetSelectEntryCount() != 0 )
1479 m_pLbMatSpecular
->SetNoSelection();
1484 // Specular Intensity
1485 eState
= rAttrs
.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY
);
1486 if( eState
!= SfxItemState::DONTCARE
)
1488 sal_uInt16 nValue
= static_cast<const SfxUInt16Item
&>(rAttrs
.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY
)).GetValue();
1489 if( nValue
!= m_pMtrMatSpecularIntensity
->GetValue() )
1491 m_pMtrMatSpecularIntensity
->SetValue( nValue
);
1497 if( !m_pMtrMatSpecularIntensity
->IsEmptyFieldValue() )
1499 m_pMtrMatSpecularIntensity
->SetEmptyFieldValue();
1507 eState
= rAttrs
.GetItemState(SDRATTR_3DSCENE_PERSPECTIVE
);
1508 if( eState
!= SfxItemState::DONTCARE
)
1510 ProjectionType ePT
= (ProjectionType
)static_cast<const Svx3DPerspectiveItem
&>(rAttrs
.Get(SDRATTR_3DSCENE_PERSPECTIVE
)).GetValue();
1511 if( ( !m_pBtnPerspective
->IsChecked() && ePT
== PR_PERSPECTIVE
) ||
1512 ( m_pBtnPerspective
->IsChecked() && ePT
== PR_PARALLEL
) )
1514 m_pBtnPerspective
->Check( ePT
== PR_PERSPECTIVE
);
1517 if( m_pBtnPerspective
->GetState() == TRISTATE_INDET
)
1518 m_pBtnPerspective
->Check( ePT
== PR_PERSPECTIVE
);
1522 if( m_pBtnPerspective
->GetState() != TRISTATE_INDET
)
1524 m_pBtnPerspective
->SetState( TRISTATE_INDET
);
1529 if( !bUpdate
&& !bOnly3DChanged
)
1531 // however the 2D attributes may be different. Compare these and decide
1536 if( bUpdate
|| bOnly3DChanged
)
1539 SfxItemSet
aSet(rAttrs
);
1541 // set LineStyle hard to drawing::LineStyle_NONE when it's not set so that
1542 // the default (drawing::LineStyle_SOLID) is not used for 3d preview
1543 if(SfxItemState::SET
!= aSet
.GetItemState(XATTR_LINESTYLE
, false))
1544 aSet
.Put(XLineStyleItem(drawing::LineStyle_NONE
));
1546 // set FillColor hard to WHITE when it's SfxItemState::DONTCARE so that
1547 // the default (Blue7) is not used for 3d preview
1548 if(SfxItemState::DONTCARE
== aSet
.GetItemState(XATTR_FILLCOLOR
, false))
1549 aSet
.Put(XFillColorItem(OUString(), Color(COL_WHITE
)));
1551 m_pCtlPreview
->Set3DAttributes(aSet
);
1552 m_pCtlLightPreview
->GetSvx3DLightControl().Set3DAttributes(aSet
);
1554 // try to select light corresponding to active button
1555 sal_uInt32
nNumber(0xffffffff);
1557 if(m_pBtnLight1
->IsChecked())
1559 else if(m_pBtnLight2
->IsChecked())
1561 else if(m_pBtnLight3
->IsChecked())
1563 else if(m_pBtnLight4
->IsChecked())
1565 else if(m_pBtnLight5
->IsChecked())
1567 else if(m_pBtnLight6
->IsChecked())
1569 else if(m_pBtnLight7
->IsChecked())
1571 else if(m_pBtnLight8
->IsChecked())
1574 if(nNumber
!= 0xffffffff)
1576 m_pCtlLightPreview
->GetSvx3DLightControl().SelectLight(nNumber
);
1580 // handle state of converts possible
1581 m_pBtnConvertTo3D
->Enable(pConvertTo3DItem
->GetState());
1582 m_pBtnLatheObject
->Enable(pConvertTo3DLatheItem
->GetState());
1586 void Svx3DWin::GetAttr( SfxItemSet
& rAttrs
)
1588 // get remembered 2d attributes from the dialog
1589 if(mpRemember2DAttributes
)
1591 SfxWhichIter
aIter(*mpRemember2DAttributes
);
1592 sal_uInt16
nWhich(aIter
.FirstWhich());
1596 SfxItemState eState
= mpRemember2DAttributes
->GetItemState(nWhich
, false);
1597 if(SfxItemState::DONTCARE
== eState
)
1598 rAttrs
.InvalidateItem(nWhich
);
1599 else if(SfxItemState::SET
== eState
)
1600 rAttrs
.Put(mpRemember2DAttributes
->Get(nWhich
, false));
1602 nWhich
= aIter
.NextWhich();
1606 //Others must stand as the front on all sides
1608 if( m_pBtnPerspective
->GetState() != TRISTATE_INDET
)
1611 if( m_pBtnPerspective
->IsChecked() )
1612 nValue
= PR_PERSPECTIVE
;
1614 nValue
= PR_PARALLEL
;
1615 rAttrs
.Put(Svx3DPerspectiveItem(nValue
));
1618 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_PERSPECTIVE
);
1621 // Possible determine PoolUnit (in this case this has not happened in Update() )
1622 if( !mpImpl
->pPool
)
1624 OSL_FAIL( "No Pool in GetAttr()! May be incompatible to drviewsi.cxx ?" );
1625 mpImpl
->pPool
= rAttrs
.GetPool();
1626 DBG_ASSERT( mpImpl
->pPool
, "Where is the Pool?" );
1627 ePoolUnit
= mpImpl
->pPool
->GetMetric( SID_ATTR_LINE_WIDTH
);
1629 eFUnit
= GetModuleFieldUnit( rAttrs
);
1632 // Number of segments (horizontal)
1633 if( !m_pNumHorizontal
->IsEmptyFieldValue() )
1635 sal_uInt32 nValue
= static_cast<sal_uInt32
>(m_pNumHorizontal
->GetValue());
1636 rAttrs
.Put(makeSvx3DHorizontalSegmentsItem(nValue
));
1639 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_HORZ_SEGS
);
1641 // Number of segments (vertical)
1642 if( !m_pNumVertical
->IsEmptyFieldValue() )
1644 sal_uInt32 nValue
= static_cast<sal_uInt32
>(m_pNumVertical
->GetValue());
1645 rAttrs
.Put(makeSvx3DVerticalSegmentsItem(nValue
));
1648 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_VERT_SEGS
);
1651 if( !m_pMtrDepth
->IsEmptyFieldValue() )
1653 sal_uInt32 nValue
= GetCoreValue(*m_pMtrDepth
, ePoolUnit
);
1654 rAttrs
.Put(makeSvx3DDepthItem(nValue
));
1657 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_DEPTH
);
1660 TriState eState
= m_pBtnDoubleSided
->GetState();
1661 if( eState
!= TRISTATE_INDET
)
1663 bool bValue
= TRISTATE_TRUE
== eState
;
1664 rAttrs
.Put(makeSvx3DDoubleSidedItem(bValue
));
1667 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_DOUBLE_SIDED
);
1670 if( !m_pMtrPercentDiagonal
->IsEmptyFieldValue() )
1672 sal_uInt16 nValue
= (sal_uInt16
) m_pMtrPercentDiagonal
->GetValue();
1673 rAttrs
.Put(makeSvx3DPercentDiagonalItem(nValue
));
1676 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_PERCENT_DIAGONAL
);
1679 if( !m_pMtrBackscale
->IsEmptyFieldValue() )
1681 sal_uInt16 nValue
= (sal_uInt16
)m_pMtrBackscale
->GetValue();
1682 rAttrs
.Put(makeSvx3DBackscaleItem(nValue
));
1685 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_BACKSCALE
);
1688 if( !m_pMtrEndAngle
->IsEmptyFieldValue() )
1690 sal_uInt16 nValue
= (sal_uInt16
)m_pMtrEndAngle
->GetValue();
1691 rAttrs
.Put(makeSvx3DEndAngleItem(nValue
));
1694 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_END_ANGLE
);
1697 sal_uInt16 nValue
= 99;
1698 if( m_pBtnNormalsObj
->IsChecked() )
1700 else if( m_pBtnNormalsFlat
->IsChecked() )
1702 else if( m_pBtnNormalsSphere
->IsChecked() )
1706 rAttrs
.Put(Svx3DNormalsKindItem(nValue
));
1708 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_NORMALS_KIND
);
1711 eState
= m_pBtnNormalsInvert
->GetState();
1712 if( eState
!= TRISTATE_INDET
)
1714 bool bValue
= TRISTATE_TRUE
== eState
;
1715 rAttrs
.Put(makeSvx3DNormalsInvertItem(bValue
));
1718 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_NORMALS_INVERT
);
1721 eState
= m_pBtnTwoSidedLighting
->GetState();
1722 if( eState
!= TRISTATE_INDET
)
1724 bool bValue
= TRISTATE_TRUE
== eState
;
1725 rAttrs
.Put(makeSvx3DTwoSidedLightingItem(bValue
));
1728 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING
);
1732 if( m_pLbShademode
->GetSelectEntryCount() )
1734 nValue
= m_pLbShademode
->GetSelectEntryPos();
1735 rAttrs
.Put(Svx3DShadeModeItem(nValue
));
1738 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_SHADE_MODE
);
1741 eState
= m_pBtnShadow3d
->GetState();
1742 if( eState
!= TRISTATE_INDET
)
1744 bool bValue
= TRISTATE_TRUE
== eState
;
1745 rAttrs
.Put(makeSvx3DShadow3DItem(bValue
));
1746 rAttrs
.Put(makeSdrShadowItem(bValue
));
1750 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_SHADOW_3D
);
1751 rAttrs
.InvalidateItem(SDRATTR_SHADOW
);
1755 if( !m_pMtrSlant
->IsEmptyFieldValue() )
1757 sal_uInt16 nValue2
= (sal_uInt16
) m_pMtrSlant
->GetValue();
1758 rAttrs
.Put(makeSvx3DShadowSlantItem(nValue2
));
1761 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_SHADOW_SLANT
);
1764 if( !m_pMtrDistance
->IsEmptyFieldValue() )
1766 sal_uInt32 nValue2
= GetCoreValue(*m_pMtrDistance
, ePoolUnit
);
1767 rAttrs
.Put(makeSvx3DDistanceItem(nValue2
));
1770 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_DISTANCE
);
1773 if( !m_pMtrFocalLength
->IsEmptyFieldValue() )
1775 sal_uInt32 nValue2
= GetCoreValue(*m_pMtrFocalLength
, ePoolUnit
);
1776 rAttrs
.Put(makeSvx3DFocalLengthItem(nValue2
));
1779 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_FOCAL_LENGTH
);
1783 basegfx::B3DVector aVector
;
1785 const SfxItemSet
aLightItemSet(m_pCtlLightPreview
->GetSvx3DLightControl().Get3DAttributes());
1788 if( m_pLbLight1
->GetSelectEntryCount() )
1790 aColor
= m_pLbLight1
->GetSelectEntryColor();
1791 rAttrs
.Put(makeSvx3DLightcolor1Item(aColor
));
1794 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_1
);
1796 eState
= m_pBtnLight1
->GetState();
1797 if( eState
!= TRISTATE_INDET
)
1799 bool bValue
= GetUILightState(*m_pBtnLight1
);
1800 rAttrs
.Put(makeSvx3DLightOnOff1Item(bValue
));
1802 // Light 1 (direction)
1805 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1
));
1809 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_1
);
1813 if( m_pLbLight2
->GetSelectEntryCount() )
1815 aColor
= m_pLbLight2
->GetSelectEntryColor();
1816 rAttrs
.Put(makeSvx3DLightcolor2Item(aColor
));
1819 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_2
);
1821 eState
= m_pBtnLight2
->GetState();
1822 if( eState
!= TRISTATE_INDET
)
1824 bool bValue
= GetUILightState(*m_pBtnLight2
);
1825 rAttrs
.Put(makeSvx3DLightOnOff2Item(bValue
));
1827 // Light 2 (direction)
1830 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2
));
1834 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2
);
1837 if( m_pLbLight3
->GetSelectEntryCount() )
1839 aColor
= m_pLbLight3
->GetSelectEntryColor();
1840 rAttrs
.Put(makeSvx3DLightcolor3Item(aColor
));
1843 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_3
);
1845 eState
= m_pBtnLight3
->GetState();
1846 if( eState
!= TRISTATE_INDET
)
1848 bool bValue
= GetUILightState(*m_pBtnLight3
);
1849 rAttrs
.Put(makeSvx3DLightOnOff3Item(bValue
));
1851 // Light 3 (direction)
1854 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3
));
1858 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3
);
1861 if( m_pLbLight4
->GetSelectEntryCount() )
1863 aColor
= m_pLbLight4
->GetSelectEntryColor();
1864 rAttrs
.Put(makeSvx3DLightcolor4Item(aColor
));
1867 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_4
);
1869 eState
= m_pBtnLight4
->GetState();
1870 if( eState
!= TRISTATE_INDET
)
1872 bool bValue
= GetUILightState(*m_pBtnLight4
);
1873 rAttrs
.Put(makeSvx3DLightOnOff4Item(bValue
));
1875 // Light 4 (direction)
1878 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4
));
1882 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4
);
1885 if( m_pLbLight5
->GetSelectEntryCount() )
1887 aColor
= m_pLbLight5
->GetSelectEntryColor();
1888 rAttrs
.Put(makeSvx3DLightcolor5Item(aColor
));
1891 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_5
);
1893 eState
= m_pBtnLight5
->GetState();
1894 if( eState
!= TRISTATE_INDET
)
1896 bool bValue
= GetUILightState(*m_pBtnLight5
);
1897 rAttrs
.Put(makeSvx3DLightOnOff5Item(bValue
));
1899 // Light 5 (direction)
1902 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5
));
1906 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5
);
1909 if( m_pLbLight6
->GetSelectEntryCount() )
1911 aColor
= m_pLbLight6
->GetSelectEntryColor();
1912 rAttrs
.Put(makeSvx3DLightcolor6Item(aColor
));
1915 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_6
);
1917 eState
= m_pBtnLight6
->GetState();
1918 if( eState
!= TRISTATE_INDET
)
1920 bool bValue
= GetUILightState(*m_pBtnLight6
);
1921 rAttrs
.Put(makeSvx3DLightOnOff6Item(bValue
));
1923 // Light 6 (direction)
1926 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6
));
1930 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6
);
1933 if( m_pLbLight7
->GetSelectEntryCount() )
1935 aColor
= m_pLbLight7
->GetSelectEntryColor();
1936 rAttrs
.Put(makeSvx3DLightcolor7Item(aColor
));
1939 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_7
);
1941 eState
= m_pBtnLight7
->GetState();
1942 if( eState
!= TRISTATE_INDET
)
1944 bool bValue
= GetUILightState(*m_pBtnLight7
);
1945 rAttrs
.Put(makeSvx3DLightOnOff7Item(bValue
));
1947 // Light 7 (direction)
1950 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7
));
1954 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7
);
1957 if( m_pLbLight8
->GetSelectEntryCount() )
1959 aColor
= m_pLbLight8
->GetSelectEntryColor();
1960 rAttrs
.Put(makeSvx3DLightcolor8Item(aColor
));
1963 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTCOLOR_8
);
1965 eState
= m_pBtnLight8
->GetState();
1966 if( eState
!= TRISTATE_INDET
)
1968 bool bValue
= GetUILightState(*m_pBtnLight8
);
1969 rAttrs
.Put(makeSvx3DLightOnOff8Item(bValue
));
1971 // Light 8 (direction)
1974 rAttrs
.Put(aLightItemSet
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8
));
1978 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8
);
1981 if( m_pLbAmbientlight
->GetSelectEntryCount() )
1983 aColor
= m_pLbAmbientlight
->GetSelectEntryColor();
1984 rAttrs
.Put(makeSvx3DAmbientcolorItem(aColor
));
1987 rAttrs
.InvalidateItem(SDRATTR_3DSCENE_AMBIENTCOLOR
);
1992 if( m_pBtnTexLuminance
->IsChecked() )
1994 else if( m_pBtnTexColor
->IsChecked() )
1997 if( nValue
== 1 || nValue
== 3 )
1998 rAttrs
.Put(Svx3DTextureKindItem(nValue
));
2000 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_KIND
);
2005 if( m_pBtnTexReplace
->IsChecked() )
2007 else if( m_pBtnTexModulate
->IsChecked() )
2010 if( nValue
== 1 || nValue
== 2 )
2011 rAttrs
.Put(Svx3DTextureModeItem(nValue
));
2013 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_MODE
);
2017 if( m_pBtnTexObjectX
->IsChecked() )
2019 else if( m_pBtnTexParallelX
->IsChecked() )
2021 else if( m_pBtnTexCircleX
->IsChecked() )
2025 rAttrs
.Put(Svx3DTextureProjectionXItem(nValue
));
2027 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_X
);
2031 if( m_pBtnTexObjectY
->IsChecked() )
2033 else if( m_pBtnTexParallelY
->IsChecked() )
2035 else if( m_pBtnTexCircleY
->IsChecked() )
2039 rAttrs
.Put(Svx3DTextureProjectionYItem(nValue
));
2041 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_PROJ_Y
);
2045 eState
= m_pBtnTexFilter
->GetState();
2046 if( eState
!= TRISTATE_INDET
)
2048 bool bValue
= TRISTATE_TRUE
== eState
;
2049 rAttrs
.Put(makeSvx3DTextureFilterItem(bValue
));
2052 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_TEXTURE_FILTER
);
2057 if( m_pLbMatColor
->GetSelectEntryCount() )
2059 aColor
= m_pLbMatColor
->GetSelectEntryColor();
2060 rAttrs
.Put( XFillColorItem( "", aColor
) );
2064 rAttrs
.InvalidateItem( XATTR_FILLCOLOR
);
2068 if( m_pLbMatEmission
->GetSelectEntryCount() )
2070 aColor
= m_pLbMatEmission
->GetSelectEntryColor();
2071 rAttrs
.Put(makeSvx3DMaterialEmissionItem(aColor
));
2074 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION
);
2077 if( m_pLbMatSpecular
->GetSelectEntryCount() )
2079 aColor
= m_pLbMatSpecular
->GetSelectEntryColor();
2080 rAttrs
.Put(makeSvx3DMaterialSpecularItem(aColor
));
2083 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR
);
2085 // Specular intensity
2086 if( !m_pMtrMatSpecularIntensity
->IsEmptyFieldValue() )
2088 sal_uInt16 nValue2
= (sal_uInt16
) m_pMtrMatSpecularIntensity
->GetValue();
2089 rAttrs
.Put(makeSvx3DMaterialSpecularIntensityItem(nValue2
));
2092 rAttrs
.InvalidateItem(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY
);
2095 void Svx3DWin::Resize()
2097 if ( !IsFloatingMode() ||
2098 !GetFloatingWindow()->IsRollUp() )
2100 Size
aWinSize( GetOutputSizePixel() ); // why rSize in Resizing()?
2102 if( aWinSize
.Height() >= GetMinOutputSizePixel().Height() &&
2103 aWinSize
.Width() >= GetMinOutputSizePixel().Width() )
2106 m_pBtnUpdate
->Hide();
2107 m_pBtnAssign
->Hide();
2109 m_pBtnConvertTo3D
->Hide();
2110 m_pBtnLatheObject
->Hide();
2111 m_pBtnPerspective
->Hide();
2113 m_pCtlPreview
->Hide();
2114 m_pCtlLightPreview
->Hide();
2116 m_pFLGeometrie
->Hide();
2117 m_pFLRepresentation
->Hide();
2119 m_pFLTexture
->Hide();
2120 m_pFLMaterial
->Hide();
2123 m_pBtnUpdate
->Show();
2124 m_pBtnAssign
->Show();
2126 m_pBtnConvertTo3D
->Show();
2127 m_pBtnLatheObject
->Show();
2128 m_pBtnPerspective
->Show();
2130 if( m_pBtnGeo
->IsChecked() )
2131 ClickViewTypeHdl(m_pBtnGeo
);
2132 if( m_pBtnRepresentation
->IsChecked() )
2133 ClickViewTypeHdl(m_pBtnRepresentation
);
2134 if( m_pBtnLight
->IsChecked() )
2135 ClickViewTypeHdl(m_pBtnLight
);
2136 if( m_pBtnTexture
->IsChecked() )
2137 ClickViewTypeHdl(m_pBtnTexture
);
2138 if( m_pBtnMaterial
->IsChecked() )
2139 ClickViewTypeHdl(m_pBtnMaterial
);
2143 SfxDockingWindow::Resize();
2146 IMPL_LINK_NOARG(Svx3DWin
, ClickUpdateHdl
)
2148 bUpdate
= !m_pBtnUpdate
->IsChecked();
2149 m_pBtnUpdate
->Check( bUpdate
);
2153 SfxDispatcher
* pDispatcher
= LocalGetDispatcher(pBindings
);
2154 if (pDispatcher
!= NULL
)
2156 SfxBoolItem
aItem( SID_3D_STATE
, true );
2157 pDispatcher
->Execute(
2158 SID_3D_STATE
, SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
, &aItem
, 0L );
2163 // Controls can be disabled during certain circumstances
2170 IMPL_LINK_NOARG(Svx3DWin
, ClickAssignHdl
)
2172 SfxDispatcher
* pDispatcher
= LocalGetDispatcher(pBindings
);
2173 if (pDispatcher
!= NULL
)
2175 SfxBoolItem
aItem( SID_3D_ASSIGN
, true );
2176 pDispatcher
->Execute(
2177 SID_3D_ASSIGN
, SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
, &aItem
, 0L );
2185 IMPL_LINK( Svx3DWin
, ClickViewTypeHdl
, void *, pBtn
)
2190 // Since the permanent updating of the preview would be too expensive
2191 bool bUpdatePreview
= m_pBtnLight
->IsChecked();
2193 m_pBtnGeo
->Check(m_pBtnGeo
== pBtn
);
2194 m_pBtnRepresentation
->Check(m_pBtnRepresentation
== pBtn
);
2195 m_pBtnLight
->Check(m_pBtnLight
== pBtn
);
2196 m_pBtnTexture
->Check(m_pBtnTexture
== pBtn
);
2197 m_pBtnMaterial
->Check(m_pBtnMaterial
== pBtn
);
2199 if( m_pBtnGeo
->IsChecked() )
2200 eViewType
= VIEWTYPE_GEO
;
2201 if( m_pBtnRepresentation
->IsChecked() )
2202 eViewType
= VIEWTYPE_REPRESENTATION
;
2203 if( m_pBtnLight
->IsChecked() )
2204 eViewType
= VIEWTYPE_LIGHT
;
2205 if( m_pBtnTexture
->IsChecked() )
2206 eViewType
= VIEWTYPE_TEXTURE
;
2207 if( m_pBtnMaterial
->IsChecked() )
2208 eViewType
= VIEWTYPE_MATERIAL
;
2211 if( eViewType
== VIEWTYPE_GEO
)
2213 m_pFLSegments
->Show();
2214 m_pFLGeometrie
->Show();
2215 m_pFLNormals
->Show();
2219 m_pFLSegments
->Hide();
2220 m_pFLGeometrie
->Hide();
2221 m_pFLNormals
->Hide();
2225 if( eViewType
== VIEWTYPE_REPRESENTATION
)
2227 m_pFLShadow
->Show();
2228 m_pFLCamera
->Show();
2229 m_pFLRepresentation
->Show();
2233 m_pFLShadow
->Hide();
2234 m_pFLCamera
->Hide();
2235 m_pFLRepresentation
->Hide();
2239 if( eViewType
== VIEWTYPE_LIGHT
)
2243 ColorLB
* pLb
= GetLbByButton();
2247 m_pCtlLightPreview
->Show();
2248 m_pCtlPreview
->Hide();
2254 if( !m_pCtlPreview
->IsVisible() )
2256 m_pCtlPreview
->Show();
2257 m_pCtlLightPreview
->Hide();
2262 if (eViewType
== VIEWTYPE_TEXTURE
)
2263 m_pFLTexture
->Show();
2265 m_pFLTexture
->Hide();
2268 if( eViewType
== VIEWTYPE_MATERIAL
)
2270 m_pFLMatSpecular
->Show();
2271 m_pFLMaterial
->Show();
2275 m_pFLMatSpecular
->Hide();
2276 m_pFLMaterial
->Hide();
2278 if( bUpdatePreview
&& !m_pBtnLight
->IsChecked() )
2284 m_pBtnGeo
->Check( eViewType
== VIEWTYPE_GEO
);
2285 m_pBtnRepresentation
->Check( eViewType
== VIEWTYPE_REPRESENTATION
);
2286 m_pBtnLight
->Check( eViewType
== VIEWTYPE_LIGHT
);
2287 m_pBtnTexture
->Check( eViewType
== VIEWTYPE_TEXTURE
);
2288 m_pBtnMaterial
->Check( eViewType
== VIEWTYPE_MATERIAL
);
2294 IMPL_LINK( Svx3DWin
, ClickHdl
, PushButton
*, pBtn
)
2298 bool bUpdatePreview
= false;
2299 sal_uInt16 nSId
= 0;
2301 if( pBtn
== m_pBtnConvertTo3D
)
2303 nSId
= SID_CONVERT_TO_3D
;
2305 else if( pBtn
== m_pBtnLatheObject
)
2307 nSId
= SID_CONVERT_TO_3D_LATHE_FAST
;
2310 else if( pBtn
== m_pBtnNormalsObj
||
2311 pBtn
== m_pBtnNormalsFlat
||
2312 pBtn
== m_pBtnNormalsSphere
)
2314 m_pBtnNormalsObj
->Check( pBtn
== m_pBtnNormalsObj
);
2315 m_pBtnNormalsFlat
->Check( pBtn
== m_pBtnNormalsFlat
);
2316 m_pBtnNormalsSphere
->Check( pBtn
== m_pBtnNormalsSphere
);
2317 bUpdatePreview
= true;
2319 else if( pBtn
== m_pBtnLight1
||
2320 pBtn
== m_pBtnLight2
||
2321 pBtn
== m_pBtnLight3
||
2322 pBtn
== m_pBtnLight4
||
2323 pBtn
== m_pBtnLight5
||
2324 pBtn
== m_pBtnLight6
||
2325 pBtn
== m_pBtnLight7
||
2326 pBtn
== m_pBtnLight8
)
2329 ColorLB
* pLb
= GetLbByButton( pBtn
);
2332 if( pBtn
->IsChecked() )
2334 SetUILightState( *static_cast<ImageButton
*>(pBtn
), !GetUILightState( *static_cast<ImageButton
*>(pBtn
) ) );
2340 if (pBtn
!= m_pBtnLight1
&& m_pBtnLight1
->IsChecked())
2342 m_pBtnLight1
->Check( false );
2343 m_pLbLight1
->Hide();
2345 if (pBtn
!= m_pBtnLight2
&& m_pBtnLight2
->IsChecked())
2347 m_pBtnLight2
->Check( false );
2348 m_pLbLight2
->Hide();
2350 if( pBtn
!= m_pBtnLight3
&& m_pBtnLight3
->IsChecked() )
2352 m_pBtnLight3
->Check( false );
2353 m_pLbLight3
->Hide();
2355 if( pBtn
!= m_pBtnLight4
&& m_pBtnLight4
->IsChecked() )
2357 m_pBtnLight4
->Check( false );
2358 m_pLbLight4
->Hide();
2360 if( pBtn
!= m_pBtnLight5
&& m_pBtnLight5
->IsChecked() )
2362 m_pBtnLight5
->Check( false );
2363 m_pLbLight5
->Hide();
2365 if( pBtn
!= m_pBtnLight6
&& m_pBtnLight6
->IsChecked() )
2367 m_pBtnLight6
->Check( false );
2368 m_pLbLight6
->Hide();
2370 if( pBtn
!= m_pBtnLight7
&& m_pBtnLight7
->IsChecked() )
2372 m_pBtnLight7
->Check( false );
2373 m_pLbLight7
->Hide();
2375 if( pBtn
!= m_pBtnLight8
&& m_pBtnLight8
->IsChecked() )
2377 m_pBtnLight8
->Check( false );
2378 m_pLbLight8
->Hide();
2381 bool bEnable
= GetUILightState( *static_cast<ImageButton
*>(pBtn
) );
2382 m_pBtnLightColor
->Enable( bEnable
);
2383 pLb
->Enable( bEnable
);
2386 bUpdatePreview
= true;
2389 else if( pBtn
== m_pBtnTexLuminance
||
2390 pBtn
== m_pBtnTexColor
)
2392 m_pBtnTexLuminance
->Check( pBtn
== m_pBtnTexLuminance
);
2393 m_pBtnTexColor
->Check( pBtn
== m_pBtnTexColor
);
2394 bUpdatePreview
= true;
2396 else if( pBtn
== m_pBtnTexReplace
||
2397 pBtn
== m_pBtnTexModulate
)
2399 m_pBtnTexReplace
->Check( pBtn
== m_pBtnTexReplace
);
2400 m_pBtnTexModulate
->Check( pBtn
== m_pBtnTexModulate
);
2401 bUpdatePreview
= true;
2403 else if( pBtn
== m_pBtnTexParallelX
||
2404 pBtn
== m_pBtnTexCircleX
||
2405 pBtn
== m_pBtnTexObjectX
)
2407 m_pBtnTexParallelX
->Check( pBtn
== m_pBtnTexParallelX
);
2408 m_pBtnTexCircleX
->Check( pBtn
== m_pBtnTexCircleX
);
2409 m_pBtnTexObjectX
->Check( pBtn
== m_pBtnTexObjectX
);
2410 bUpdatePreview
= true;
2412 else if( pBtn
== m_pBtnTexParallelY
||
2413 pBtn
== m_pBtnTexCircleY
||
2414 pBtn
== m_pBtnTexObjectY
)
2416 m_pBtnTexParallelY
->Check( pBtn
== m_pBtnTexParallelY
);
2417 m_pBtnTexCircleY
->Check( pBtn
== m_pBtnTexCircleY
);
2418 m_pBtnTexObjectY
->Check( pBtn
== m_pBtnTexObjectY
);
2419 bUpdatePreview
= true;
2421 else if (pBtn
== m_pBtnShadow3d
)
2423 pBtn
->Check( !pBtn
->IsChecked() );
2424 m_pFtSlant
->Enable( pBtn
->IsChecked() );
2425 m_pMtrSlant
->Enable( pBtn
->IsChecked() );
2426 bUpdatePreview
= true;
2428 // Other (no groups)
2429 else if( pBtn
!= NULL
)
2431 pBtn
->Check( !pBtn
->IsChecked() );
2432 bUpdatePreview
= true;
2437 SfxDispatcher
* pDispatcher
= LocalGetDispatcher(pBindings
);
2438 if (pDispatcher
!= NULL
)
2440 SfxBoolItem
aItem( nSId
, true );
2441 pDispatcher
->Execute(
2442 nSId
, SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
, &aItem
, 0L );
2445 else if( bUpdatePreview
)
2453 IMPL_LINK( Svx3DWin
, ClickColorHdl
, PushButton
*, pBtn
)
2455 SvColorDialog
aColorDlg( this );
2458 if( pBtn
== m_pBtnLightColor
)
2459 pLb
= GetLbByButton();
2460 else if( pBtn
== m_pBtnAmbientColor
)
2461 pLb
= m_pLbAmbientlight
;
2462 else if( pBtn
== m_pBtnMatColor
)
2463 pLb
= m_pLbMatColor
;
2464 else if( pBtn
== m_pBtnEmissionColor
)
2465 pLb
= m_pLbMatEmission
;
2466 else // if( pBtn == m_pBtnSpecularColor )
2467 pLb
= m_pLbMatSpecular
;
2469 Color aColor
= pLb
->GetSelectEntryColor();
2471 aColorDlg
.SetColor( aColor
);
2472 if( aColorDlg
.Execute() == RET_OK
)
2474 aColor
= aColorDlg
.GetColor();
2475 if( LBSelectColor( pLb
, aColor
) )
2482 IMPL_LINK( Svx3DWin
, SelectHdl
, void *, p
)
2486 bool bUpdatePreview
= false;
2489 if (p
== m_pLbMatFavorites
)
2491 Color
aColObj( COL_WHITE
);
2492 Color
aColEmis( COL_BLACK
);
2493 Color
aColSpec( COL_WHITE
);
2494 sal_uInt16 nSpecIntens
= 20;
2496 sal_uInt16 nPos
= m_pLbMatFavorites
->GetSelectEntryPos();
2501 aColObj
= Color(230,230,255);
2502 aColEmis
= Color(10,10,30);
2503 aColSpec
= Color(200,200,200);
2510 aColObj
= Color(230,255,0);
2511 aColEmis
= Color(51,0,0);
2512 aColSpec
= Color(255,255,240);
2519 aColObj
= Color(36,117,153);
2520 aColEmis
= Color(18,30,51);
2521 aColSpec
= Color(230,230,255);
2528 aColObj
= Color(255,48,57);
2529 aColEmis
= Color(35,0,0);
2530 aColSpec
= Color(179,202,204);
2537 aColObj
= Color(153,71,1);
2538 aColEmis
= Color(21,22,0);
2539 aColSpec
= Color(255,255,153);
2544 LBSelectColor( m_pLbMatColor
, aColObj
);
2545 LBSelectColor( m_pLbMatEmission
, aColEmis
);
2546 LBSelectColor( m_pLbMatSpecular
, aColSpec
);
2547 m_pMtrMatSpecularIntensity
->SetValue( nSpecIntens
);
2549 bUpdatePreview
= true;
2551 else if( p
== m_pLbMatColor
||
2552 p
== m_pLbMatEmission
||
2553 p
== m_pLbMatSpecular
)
2555 m_pLbMatFavorites
->SelectEntryPos( 0 );
2556 bUpdatePreview
= true;
2559 else if( p
== m_pLbAmbientlight
)
2561 bUpdatePreview
= true;
2563 else if( p
== m_pLbLight1
||
2572 bUpdatePreview
= true;
2574 else if (p
== m_pLbShademode
)
2575 bUpdatePreview
= true;
2577 if( bUpdatePreview
)
2584 IMPL_LINK( Svx3DWin
, ModifyHdl
, void*, pField
)
2588 bool bUpdatePreview
= false;
2591 if( pField
== m_pMtrMatSpecularIntensity
)
2593 bUpdatePreview
= true;
2595 else if (pField
== m_pNumHorizontal
)
2597 bUpdatePreview
= true;
2599 else if (pField
== m_pNumVertical
)
2601 bUpdatePreview
= true;
2603 else if (pField
== m_pMtrSlant
)
2605 bUpdatePreview
= true;
2608 if( bUpdatePreview
)
2616 void Svx3DWin::ClickLight(PushButton
& rBtn
)
2618 sal_uInt16 nLightSource
= GetLightSource( &rBtn
);
2619 ColorLB
* pLb
= GetLbByButton( &rBtn
);
2620 Color
aColor( pLb
->GetSelectEntryColor() );
2621 SfxItemSet
aLightItemSet(m_pCtlLightPreview
->GetSvx3DLightControl().Get3DAttributes());
2622 const bool bOnOff(GetUILightState( static_cast<const ImageButton
&>(rBtn
) ));
2624 switch(nLightSource
)
2626 case 0: aLightItemSet
.Put(makeSvx3DLightcolor1Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff1Item(bOnOff
)); break;
2627 case 1: aLightItemSet
.Put(makeSvx3DLightcolor2Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff2Item(bOnOff
)); break;
2628 case 2: aLightItemSet
.Put(makeSvx3DLightcolor3Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff3Item(bOnOff
)); break;
2629 case 3: aLightItemSet
.Put(makeSvx3DLightcolor4Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff4Item(bOnOff
)); break;
2630 case 4: aLightItemSet
.Put(makeSvx3DLightcolor5Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff5Item(bOnOff
)); break;
2631 case 5: aLightItemSet
.Put(makeSvx3DLightcolor6Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff6Item(bOnOff
)); break;
2632 case 6: aLightItemSet
.Put(makeSvx3DLightcolor7Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff7Item(bOnOff
)); break;
2634 case 7: aLightItemSet
.Put(makeSvx3DLightcolor8Item(aColor
)); aLightItemSet
.Put(makeSvx3DLightOnOff8Item(bOnOff
)); break;
2637 m_pCtlLightPreview
->GetSvx3DLightControl().Set3DAttributes(aLightItemSet
);
2638 m_pCtlLightPreview
->GetSvx3DLightControl().SelectLight(nLightSource
);
2639 m_pCtlLightPreview
->CheckSelection();
2644 IMPL_STATIC_LINK_NOARG(Svx3DWin
, ChangeLightCallbackHdl
)
2652 IMPL_LINK_NOARG(Svx3DWin
, ChangeSelectionCallbackHdl
)
2654 const sal_uInt32
nLight(m_pCtlLightPreview
->GetSvx3DLightControl().GetSelectedLight());
2655 PushButton
* pBtn
= 0;
2659 case 0: pBtn
= m_pBtnLight1
; break;
2660 case 1: pBtn
= m_pBtnLight2
; break;
2661 case 2: pBtn
= m_pBtnLight3
; break;
2662 case 3: pBtn
= m_pBtnLight4
; break;
2663 case 4: pBtn
= m_pBtnLight5
; break;
2664 case 5: pBtn
= m_pBtnLight6
; break;
2665 case 6: pBtn
= m_pBtnLight7
; break;
2666 case 7: pBtn
= m_pBtnLight8
; break;
2674 // Status: No lamp selected
2675 if( m_pBtnLight1
->IsChecked() )
2677 m_pBtnLight1
->Check( false );
2678 m_pLbLight1
->Enable( false );
2680 else if( m_pBtnLight2
->IsChecked() )
2682 m_pBtnLight2
->Check( false );
2683 m_pLbLight2
->Enable( false );
2685 else if( m_pBtnLight3
->IsChecked() )
2687 m_pBtnLight3
->Check( false );
2688 m_pLbLight3
->Enable( false );
2690 else if( m_pBtnLight4
->IsChecked() )
2692 m_pBtnLight4
->Check( false );
2693 m_pLbLight4
->Enable( false );
2695 else if( m_pBtnLight5
->IsChecked() )
2697 m_pBtnLight5
->Check( false );
2698 m_pLbLight5
->Enable( false );
2700 else if( m_pBtnLight6
->IsChecked() )
2702 m_pBtnLight6
->Check( false );
2703 m_pLbLight6
->Enable( false );
2705 else if( m_pBtnLight7
->IsChecked() )
2707 m_pBtnLight7
->Check( false );
2708 m_pLbLight7
->Enable( false );
2710 else if( m_pBtnLight8
->IsChecked() )
2712 m_pBtnLight8
->Check( false );
2713 m_pLbLight8
->Enable( false );
2715 m_pBtnLightColor
->Enable( false );
2722 // Method to ensure that the LB is also associated with a color
2723 // returns true if color was added
2725 bool Svx3DWin::LBSelectColor( ColorLB
* pLb
, const Color
& rColor
)
2729 pLb
->SetNoSelection();
2730 pLb
->SelectEntry( rColor
);
2731 if( pLb
->GetSelectEntryCount() == 0 )
2733 OUString
aStr(SVX_RESSTR(RID_SVXFLOAT3D_FIX_R
));
2735 aStr
+= OUString::number((sal_Int32
)rColor
.GetRed());
2737 aStr
+= SVX_RESSTR(RID_SVXFLOAT3D_FIX_G
);
2738 aStr
+= OUString::number((sal_Int32
)rColor
.GetGreen());
2740 aStr
+= SVX_RESSTR(RID_SVXFLOAT3D_FIX_B
);
2741 aStr
+= OUString::number((sal_Int32
)rColor
.GetBlue());
2743 sal_uInt16 nPos
= pLb
->InsertEntry( rColor
, aStr
);
2744 pLb
->SelectEntryPos( nPos
);
2751 void Svx3DWin::UpdatePreview()
2753 if( pModel
== NULL
)
2754 pModel
= new FmFormModel();
2759 SfxDispatcher
* pDispatcher
= LocalGetDispatcher(pBindings
);
2760 if (pDispatcher
!= NULL
)
2762 SfxBoolItem
aItem( SID_3D_STATE
, true );
2763 pDispatcher
->Execute(
2764 SID_3D_STATE
, SfxCallMode::SYNCHRON
| SfxCallMode::RECORD
, &aItem
, 0L );
2767 bOnly3DChanged
= false;
2771 SfxItemSet
aSet( pModel
->GetItemPool(), SDRATTR_START
, SDRATTR_END
);
2773 // Get Attributes and set the preview
2775 m_pCtlPreview
->Set3DAttributes( aSet
);
2776 m_pCtlLightPreview
->GetSvx3DLightControl().Set3DAttributes( aSet
);
2780 // document is to be reloaded, destroy remembered ItemSet
2781 void Svx3DWin::DocumentReload()
2783 delete mpRemember2DAttributes
;
2784 mpRemember2DAttributes
= 0L;
2788 void Svx3DWin::InitColorLB( const SdrModel
* pDoc
)
2790 m_pLbLight1
->Fill( pDoc
->GetColorList() );
2791 m_pLbLight2
->CopyEntries( *m_pLbLight1
);
2792 m_pLbLight3
->CopyEntries( *m_pLbLight1
);
2793 m_pLbLight4
->CopyEntries( *m_pLbLight1
);
2794 m_pLbLight5
->CopyEntries( *m_pLbLight1
);
2795 m_pLbLight6
->CopyEntries( *m_pLbLight1
);
2796 m_pLbLight7
->CopyEntries( *m_pLbLight1
);
2797 m_pLbLight8
->CopyEntries( *m_pLbLight1
);
2798 m_pLbAmbientlight
->CopyEntries( *m_pLbLight1
);
2799 m_pLbMatColor
->CopyEntries( *m_pLbLight1
);
2800 m_pLbMatEmission
->CopyEntries( *m_pLbLight1
);
2801 m_pLbMatSpecular
->CopyEntries( *m_pLbLight1
);
2804 Color
aColWhite( COL_WHITE
);
2805 Color
aColBlack( COL_BLACK
);
2806 m_pLbLight1
->SelectEntry( aColWhite
);
2807 m_pLbLight2
->SelectEntry( aColWhite
);
2808 m_pLbLight3
->SelectEntry( aColWhite
);
2809 m_pLbLight4
->SelectEntry( aColWhite
);
2810 m_pLbLight5
->SelectEntry( aColWhite
);
2811 m_pLbLight6
->SelectEntry( aColWhite
);
2812 m_pLbLight7
->SelectEntry( aColWhite
);
2813 m_pLbLight8
->SelectEntry( aColWhite
);
2814 m_pLbAmbientlight
->SelectEntry( aColBlack
);
2815 m_pLbMatColor
->SelectEntry( aColWhite
);
2816 m_pLbMatEmission
->SelectEntry( aColBlack
);
2817 m_pLbMatSpecular
->SelectEntry( aColWhite
);
2821 sal_uInt16
Svx3DWin::GetLightSource( const PushButton
* pBtn
)
2823 sal_uInt16 nLight
= 8;
2827 if( m_pBtnLight1
->IsChecked() )
2829 else if( m_pBtnLight2
->IsChecked() )
2831 else if( m_pBtnLight3
->IsChecked() )
2833 else if( m_pBtnLight4
->IsChecked() )
2835 else if( m_pBtnLight5
->IsChecked() )
2837 else if( m_pBtnLight6
->IsChecked() )
2839 else if( m_pBtnLight7
->IsChecked() )
2841 else if( m_pBtnLight8
->IsChecked() )
2846 if (pBtn
== m_pBtnLight1
)
2848 else if (pBtn
== m_pBtnLight2
)
2850 else if( pBtn
== m_pBtnLight3
)
2852 else if( pBtn
== m_pBtnLight4
)
2854 else if( pBtn
== m_pBtnLight5
)
2856 else if( pBtn
== m_pBtnLight6
)
2858 else if( pBtn
== m_pBtnLight7
)
2860 else if( pBtn
== m_pBtnLight8
)
2867 ColorLB
* Svx3DWin::GetLbByButton( const PushButton
* pBtn
)
2869 ColorLB
* pLb
= NULL
;
2873 if( m_pBtnLight1
->IsChecked() )
2875 else if( m_pBtnLight2
->IsChecked() )
2877 else if( m_pBtnLight3
->IsChecked() )
2879 else if( m_pBtnLight4
->IsChecked() )
2881 else if( m_pBtnLight5
->IsChecked() )
2883 else if( m_pBtnLight6
->IsChecked() )
2885 else if( m_pBtnLight7
->IsChecked() )
2887 else if( m_pBtnLight8
->IsChecked() )
2892 if( pBtn
== m_pBtnLight1
)
2894 else if (pBtn
== m_pBtnLight2
)
2896 else if( pBtn
== m_pBtnLight3
)
2898 else if( pBtn
== m_pBtnLight4
)
2900 else if( pBtn
== m_pBtnLight5
)
2902 else if( pBtn
== m_pBtnLight6
)
2904 else if( pBtn
== m_pBtnLight7
)
2906 else if( pBtn
== m_pBtnLight8
)
2912 // Derivation from SfxChildWindow as "containers" for effects
2914 Svx3DChildWindow::Svx3DChildWindow( vcl::Window
* _pParent
,
2916 SfxBindings
* pBindings
,
2917 SfxChildWinInfo
* pInfo
) :
2918 SfxChildWindow( _pParent
, nId
)
2920 VclPtr
<Svx3DWin
> pWin
= VclPtr
<Svx3DWin
>::Create( pBindings
, this, _pParent
);
2923 eChildAlignment
= SfxChildAlignment::NOALIGNMENT
;
2925 pWin
->Initialize( pInfo
);
2928 Svx3DCtrlItem::Svx3DCtrlItem( sal_uInt16 _nId
,
2929 SfxBindings
* _pBindings
) :
2930 SfxControllerItem( _nId
, *_pBindings
)
2935 void Svx3DCtrlItem::StateChanged( sal_uInt16
/*nSId*/,
2936 SfxItemState
/*eState*/, const SfxPoolItem
* /*pItem*/ )
2940 // ControllerItem for Status Slot SID_CONVERT_TO_3D
2942 SvxConvertTo3DItem::SvxConvertTo3DItem(sal_uInt16 _nId
, SfxBindings
* _pBindings
)
2943 : SfxControllerItem(_nId
, *_pBindings
),
2948 void SvxConvertTo3DItem::StateChanged(sal_uInt16
/*_nId*/, SfxItemState eState
, const SfxPoolItem
* /*pState*/)
2950 bool bNewState
= (eState
!= SfxItemState::DISABLED
);
2951 if(bNewState
!= bState
)
2954 SfxDispatcher
* pDispatcher
= LocalGetDispatcher(&GetBindings());
2955 if (pDispatcher
!= NULL
)
2957 SfxBoolItem
aItem( SID_3D_STATE
, true );
2958 pDispatcher
->Execute(
2959 SID_3D_STATE
, SfxCallMode::ASYNCHRON
|SfxCallMode::RECORD
, &aItem
, 0L);
2965 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */