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 "tp_3D_SceneIllumination.hxx"
21 #include <bitmaps.hlst>
22 #include <CommonConverters.hxx>
23 #include <ControllerLockGuard.hxx>
25 #include <svx/colorbox.hxx>
26 #include <svx/strings.hrc>
27 #include <svx/dialmgr.hxx>
28 #include <svtools/colrdlg.hxx>
29 #include <svx/svx3ditems.hxx>
30 #include <svx/svddef.hxx>
31 #include <vcl/svapp.hxx>
32 #include <tools/diagnose_ex.h>
34 #include <com/sun/star/beans/XPropertySet.hpp>
39 using namespace ::com::sun::star
;
40 using namespace ::com::sun::star::chart2
;
42 LightButton::LightButton(std::unique_ptr
<weld::ToggleButton
> xButton
)
43 : m_xButton(std::move(xButton
))
46 m_xButton
->set_from_icon_name(RID_SVXBMP_LAMP_OFF
);
49 void LightButton::switchLightOn(bool bOn
)
51 if (m_bLightOn
== bOn
)
55 m_xButton
->set_from_icon_name(RID_SVXBMP_LAMP_ON
);
57 m_xButton
->set_from_icon_name(RID_SVXBMP_LAMP_OFF
);
63 css::drawing::Direction3D aDirection
;
67 nDiffuseColor( 0xcccccc ),
68 aDirection( 1.0, 1.0, -1.0 ),
73 struct LightSourceInfo
77 LightSource aLightSource
;
80 void initButtonFromSource();
83 LightSourceInfo::LightSourceInfo()
85 , bButtonActive(false)
88 aLightSource
.nDiffuseColor
= Color(0xffffff); // white
89 aLightSource
.aDirection
= drawing::Direction3D(1,1,1);
90 aLightSource
.bIsEnabled
= false;
93 void LightSourceInfo::initButtonFromSource()
97 pButton
->switchLightOn(aLightSource
.bIsEnabled
);
102 OUString
lcl_makeColorName(const Color
& rColor
)
104 OUString aStr
= SvxResId(RID_SVXFLOAT3D_FIX_R
) +
105 OUString::number(rColor
.GetRed()) +
107 SvxResId(RID_SVXFLOAT3D_FIX_G
) +
108 OUString::number(rColor
.GetGreen()) +
110 SvxResId(RID_SVXFLOAT3D_FIX_B
) +
111 OUString::number(rColor
.GetBlue());
115 void lcl_selectColor(ColorListBox
& rListBox
, const Color
& rColor
)
117 rListBox
.SetNoSelection();
118 rListBox
.SelectEntry(std::make_pair(rColor
, lcl_makeColorName(rColor
)));
121 ::chart::LightSource
lcl_getLightSourceFromProperties(
122 const uno::Reference
< beans::XPropertySet
> & xSceneProperties
,
125 ::chart::LightSource aResult
;
126 if( 0 <= nIndex
&& nIndex
< 8 )
128 OUString
aIndex( OUString::number( nIndex
+ 1 ));
132 xSceneProperties
->getPropertyValue( "D3DSceneLightColor" + aIndex
) >>= aResult
.nDiffuseColor
;
133 xSceneProperties
->getPropertyValue( "D3DSceneLightDirection" + aIndex
) >>= aResult
.aDirection
;
134 xSceneProperties
->getPropertyValue( "D3DSceneLightOn" + aIndex
) >>= aResult
.bIsEnabled
;
136 catch( const uno::Exception
& )
138 DBG_UNHANDLED_EXCEPTION("chart2");
144 void lcl_setLightSource(
145 const uno::Reference
< beans::XPropertySet
> & xSceneProperties
,
146 const ::chart::LightSource
& rLightSource
,
149 if( 0 <= nIndex
&& nIndex
< 8 )
151 OUString
aIndex( OUString::number( nIndex
+ 1 ));
155 xSceneProperties
->setPropertyValue( "D3DSceneLightColor" + aIndex
,
156 uno::makeAny( rLightSource
.nDiffuseColor
));
157 xSceneProperties
->setPropertyValue( "D3DSceneLightDirection" + aIndex
,
158 uno::Any( rLightSource
.aDirection
));
159 xSceneProperties
->setPropertyValue( "D3DSceneLightOn" + aIndex
,
160 uno::Any( rLightSource
.bIsEnabled
));
162 catch( const uno::Exception
& )
164 DBG_UNHANDLED_EXCEPTION("chart2");
169 Color
lcl_getAmbientColor(
170 const uno::Reference
< beans::XPropertySet
> & xSceneProperties
)
172 sal_Int32 nResult
= 0x000000;
175 xSceneProperties
->getPropertyValue("D3DSceneAmbientColor") >>= nResult
;
177 catch( const uno::Exception
& )
179 DBG_UNHANDLED_EXCEPTION("chart2");
181 return Color( nResult
);
184 void lcl_setAmbientColor(
185 const uno::Reference
< beans::XPropertySet
> & xSceneProperties
,
186 const Color
& rColor
)
190 xSceneProperties
->setPropertyValue("D3DSceneAmbientColor",
191 uno::makeAny( rColor
));
193 catch( const uno::Exception
& )
195 DBG_UNHANDLED_EXCEPTION("chart2");
200 ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Container
* pParent
,
201 weld::Window
* pTopLevel
,
202 const uno::Reference
< beans::XPropertySet
> & xSceneProperties
,
203 const uno::Reference
< frame::XModel
>& xChartModel
)
204 : m_xSceneProperties( xSceneProperties
)
205 , m_aTimerTriggeredControllerLock( xChartModel
)
206 , m_bInCommitToModel( false )
207 , m_xChartModel( xChartModel
)
208 , m_pTopLevel(pTopLevel
)
209 , m_xBuilder(Application::CreateBuilder(pParent
, "modules/schart/ui/tp_3D_SceneIllumination.ui"))
210 , m_xContainer(m_xBuilder
->weld_container("tp_3D_SceneIllumination"))
211 , m_xBtn_Light1(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_1")))
212 , m_xBtn_Light2(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_2")))
213 , m_xBtn_Light3(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_3")))
214 , m_xBtn_Light4(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_4")))
215 , m_xBtn_Light5(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_5")))
216 , m_xBtn_Light6(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_6")))
217 , m_xBtn_Light7(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_7")))
218 , m_xBtn_Light8(new LightButton(m_xBuilder
->weld_toggle_button("BTN_LIGHT_8")))
219 , m_xLB_LightSource(new ColorListBox(m_xBuilder
->weld_menu_button("LB_LIGHTSOURCE"), pTopLevel
))
220 , m_xBtn_LightSource_Color(m_xBuilder
->weld_button("BTN_LIGHTSOURCE_COLOR"))
221 , m_xLB_AmbientLight(new ColorListBox(m_xBuilder
->weld_menu_button("LB_AMBIENTLIGHT"), pTopLevel
))
222 , m_xBtn_AmbientLight_Color(m_xBuilder
->weld_button("BTN_AMBIENT_COLOR"))
223 , m_xHoriScale(m_xBuilder
->weld_scale("hori"))
224 , m_xVertScale(m_xBuilder
->weld_scale("vert"))
225 , m_xBtn_Corner(m_xBuilder
->weld_button("corner"))
226 , m_xPreview(new LightControl3D
)
227 , m_xPreviewWnd(new weld::CustomWeld(*m_xBuilder
, "CTL_LIGHT_PREVIEW", *m_xPreview
))
228 , m_xCtl_Preview(new LightCtl3D(*m_xPreview
, *m_xHoriScale
, *m_xVertScale
, *m_xBtn_Corner
))
230 m_pLightSourceInfoList
.reset(new LightSourceInfo
[8]);
231 m_pLightSourceInfoList
[0].pButton
= m_xBtn_Light1
.get();
232 m_pLightSourceInfoList
[1].pButton
= m_xBtn_Light2
.get();
233 m_pLightSourceInfoList
[2].pButton
= m_xBtn_Light3
.get();
234 m_pLightSourceInfoList
[3].pButton
= m_xBtn_Light4
.get();
235 m_pLightSourceInfoList
[4].pButton
= m_xBtn_Light5
.get();
236 m_pLightSourceInfoList
[5].pButton
= m_xBtn_Light6
.get();
237 m_pLightSourceInfoList
[6].pButton
= m_xBtn_Light7
.get();
238 m_pLightSourceInfoList
[7].pButton
= m_xBtn_Light8
.get();
240 fillControlsFromModel(nullptr);
242 m_xBtn_Light1
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
243 m_xBtn_Light2
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
244 m_xBtn_Light3
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
245 m_xBtn_Light4
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
246 m_xBtn_Light5
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
247 m_xBtn_Light6
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
248 m_xBtn_Light7
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
249 m_xBtn_Light8
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
) );
251 m_xLB_AmbientLight
->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage
, SelectColorHdl
) );
252 m_xLB_LightSource
->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage
, SelectColorHdl
) );
254 m_xBtn_AmbientLight_Color
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ColorDialogHdl
) );
255 m_xBtn_LightSource_Color
->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage
, ColorDialogHdl
) );
257 m_xCtl_Preview
->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage
, PreviewChangeHdl
) );
258 m_xCtl_Preview
->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage
, PreviewSelectHdl
) );
260 ClickLightSourceButtonHdl(*m_xBtn_Light2
->get_widget());
263 ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
267 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage
, fillControlsFromModel
, void*, void)
269 if( m_bInCommitToModel
)//don't read own changes
273 for( nL
=0; nL
<8; nL
++)
274 m_pLightSourceInfoList
[nL
].aLightSource
= lcl_getLightSourceFromProperties( m_xSceneProperties
, nL
);
275 for( nL
=0; nL
<8; nL
++)
276 m_pLightSourceInfoList
[nL
].initButtonFromSource();
278 lcl_selectColor( *m_xLB_AmbientLight
, lcl_getAmbientColor( m_xSceneProperties
));
283 void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber
)
285 ControllerLockGuardUNO
aGuard( m_xChartModel
);
286 m_bInCommitToModel
= true;
287 sal_Int32
nIndex( nLightNumber
);
288 lcl_setLightSource( m_xSceneProperties
, m_pLightSourceInfoList
[nIndex
].aLightSource
, nIndex
);
289 m_bInCommitToModel
= false;
292 void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
294 m_aTimerTriggeredControllerLock
.startTimer();
295 ControllerLockGuardUNO
aGuard( m_xChartModel
);
296 for( sal_Int32 nL
=0; nL
<8; nL
++)
297 applyLightSourceToModel( nL
);
298 m_aTimerTriggeredControllerLock
.startTimer();
301 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage
, PreviewChangeHdl
, LightCtl3D
*, void)
303 m_aTimerTriggeredControllerLock
.startTimer();
305 //update m_pLightSourceInfoList from preview
306 const SfxItemSet
a3DLightAttributes(m_xCtl_Preview
->GetSvx3DLightControl().Get3DAttributes());
307 LightSourceInfo
* pInfo
= &m_pLightSourceInfoList
[0];
309 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1
).GetValue();
310 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_1
).GetValue();
311 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1
).GetValue());
313 pInfo
= &m_pLightSourceInfoList
[1];
314 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2
).GetValue();
315 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_2
).GetValue();
316 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2
).GetValue());
318 pInfo
= &m_pLightSourceInfoList
[2];
319 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3
).GetValue();
320 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_3
).GetValue();
321 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3
).GetValue());
323 pInfo
= &m_pLightSourceInfoList
[3];
324 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4
).GetValue();
325 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_4
).GetValue();
326 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4
).GetValue());
328 pInfo
= &m_pLightSourceInfoList
[4];
329 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5
).GetValue();
330 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_5
).GetValue();
331 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5
).GetValue());
333 pInfo
= &m_pLightSourceInfoList
[5];
334 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6
).GetValue();
335 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_6
).GetValue();
336 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6
).GetValue());
338 pInfo
= &m_pLightSourceInfoList
[6];
339 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7
).GetValue();
340 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_7
).GetValue();
341 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7
).GetValue());
343 pInfo
= &m_pLightSourceInfoList
[7];
344 pInfo
->aLightSource
.nDiffuseColor
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8
).GetValue();
345 pInfo
->aLightSource
.bIsEnabled
= a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTON_8
).GetValue();
346 pInfo
->aLightSource
.aDirection
= B3DVectorToDirection3D(a3DLightAttributes
.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8
).GetValue());
348 applyLightSourcesToModel();
351 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage
, PreviewSelectHdl
, LightCtl3D
*, void)
353 sal_uInt32 nLightNumber
= m_xCtl_Preview
->GetSvx3DLightControl().GetSelectedLight();
356 LightButton
* pButton
= m_pLightSourceInfoList
[nLightNumber
].pButton
;
357 if(!pButton
->get_active())
358 ClickLightSourceButtonHdl(*pButton
->get_widget());
360 applyLightSourcesToModel();
364 IMPL_LINK( ThreeD_SceneIllumination_TabPage
, ColorDialogHdl
, weld::Button
&, rButton
, void )
366 bool bIsAmbientLight
= (&rButton
== m_xBtn_AmbientLight_Color
.get());
367 ColorListBox
* pListBox
= bIsAmbientLight
? m_xLB_AmbientLight
.get() : m_xLB_LightSource
.get();
369 SvColorDialog aColorDlg
;
370 aColorDlg
.SetColor( pListBox
->GetSelectEntryColor() );
371 if( aColorDlg
.Execute(m_pTopLevel
) == RET_OK
)
373 Color
aColor( aColorDlg
.GetColor());
374 lcl_selectColor( *pListBox
, aColor
);
375 if( bIsAmbientLight
)
377 m_bInCommitToModel
= true;
378 lcl_setAmbientColor( m_xSceneProperties
, aColor
);
379 m_bInCommitToModel
= false;
383 //get active lightsource:
384 LightSourceInfo
* pInfo
= nullptr;
386 for( nL
=0; nL
<8; nL
++)
388 pInfo
= &m_pLightSourceInfoList
[nL
];
389 if(pInfo
->pButton
->get_active())
394 applyLightSourceToModel( nL
);
396 SelectColorHdl( *pListBox
);
400 IMPL_LINK( ThreeD_SceneIllumination_TabPage
, SelectColorHdl
, ColorListBox
&, rBox
, void )
402 ColorListBox
* pListBox
= &rBox
;
403 if (pListBox
== m_xLB_AmbientLight
.get())
405 m_bInCommitToModel
= true;
406 lcl_setAmbientColor( m_xSceneProperties
, pListBox
->GetSelectEntryColor());
407 m_bInCommitToModel
= false;
409 else if (pListBox
== m_xLB_LightSource
.get())
411 //get active lightsource:
412 LightSourceInfo
* pInfo
= nullptr;
414 for( nL
=0; nL
<8; nL
++)
416 pInfo
= &m_pLightSourceInfoList
[nL
];
417 if (pInfo
->pButton
->get_active())
423 pInfo
->aLightSource
.nDiffuseColor
= pListBox
->GetSelectEntryColor();
424 applyLightSourceToModel( nL
);
430 IMPL_LINK(ThreeD_SceneIllumination_TabPage
, ClickLightSourceButtonHdl
, weld::Button
&, rBtn
, void)
432 LightButton
* pButton
= nullptr;
433 LightSourceInfo
* pInfo
= nullptr;
435 for( nL
=0; nL
<8; nL
++)
437 if (m_pLightSourceInfoList
[nL
].pButton
->get_widget() == &rBtn
)
439 pButton
= m_pLightSourceInfoList
[nL
].pButton
;
440 pInfo
= &m_pLightSourceInfoList
[nL
];
447 bool bIsChecked
= pInfo
->bButtonActive
;
449 ControllerLockGuardUNO
aGuard( m_xChartModel
);
450 for( nL
=0; nL
<8; nL
++)
452 LightButton
* pLightButton
= m_pLightSourceInfoList
[nL
].pButton
;
453 if (pLightButton
== pButton
)
455 pLightButton
->set_active(true);
456 if (!pLightButton
->get_widget()->has_focus())
457 pLightButton
->get_widget()->grab_focus();
458 m_pLightSourceInfoList
[nL
].bButtonActive
= true;
462 pLightButton
->set_active(false);
463 m_pLightSourceInfoList
[nL
].bButtonActive
= false;
467 //update light button
470 pButton
->switchLightOn(!pButton
->isLightOn());
471 pInfo
->aLightSource
.bIsEnabled
=pButton
->isLightOn();
472 applyLightSourceToModel( nL
);
475 //update color list box
476 lcl_selectColor( *m_xLB_LightSource
, pInfo
->aLightSource
.nDiffuseColor
);
480 void ThreeD_SceneIllumination_TabPage::updatePreview()
482 SfxItemSet
aItemSet(m_xCtl_Preview
->GetSvx3DLightControl().Get3DAttributes());
483 LightSourceInfo
* pInfo
= &m_pLightSourceInfoList
[0];
486 aItemSet
.Put(makeSvx3DAmbientcolorItem(m_xLB_AmbientLight
->GetSelectEntryColor()));
488 aItemSet
.Put(makeSvx3DLightcolor1Item(pInfo
->aLightSource
.nDiffuseColor
));
489 aItemSet
.Put(makeSvx3DLightOnOff1Item(pInfo
->aLightSource
.bIsEnabled
));
490 aItemSet
.Put(makeSvx3DLightDirection1Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
492 pInfo
= &m_pLightSourceInfoList
[1];
493 aItemSet
.Put(makeSvx3DLightcolor2Item(pInfo
->aLightSource
.nDiffuseColor
));
494 aItemSet
.Put(makeSvx3DLightOnOff2Item(pInfo
->aLightSource
.bIsEnabled
));
495 aItemSet
.Put(makeSvx3DLightDirection2Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
497 pInfo
= &m_pLightSourceInfoList
[2];
498 aItemSet
.Put(makeSvx3DLightcolor3Item(pInfo
->aLightSource
.nDiffuseColor
));
499 aItemSet
.Put(makeSvx3DLightOnOff3Item(pInfo
->aLightSource
.bIsEnabled
));
500 aItemSet
.Put(makeSvx3DLightDirection3Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
502 pInfo
= &m_pLightSourceInfoList
[3];
503 aItemSet
.Put(makeSvx3DLightcolor4Item(pInfo
->aLightSource
.nDiffuseColor
));
504 aItemSet
.Put(makeSvx3DLightOnOff4Item(pInfo
->aLightSource
.bIsEnabled
));
505 aItemSet
.Put(makeSvx3DLightDirection4Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
507 pInfo
= &m_pLightSourceInfoList
[4];
508 aItemSet
.Put(makeSvx3DLightcolor5Item(pInfo
->aLightSource
.nDiffuseColor
));
509 aItemSet
.Put(makeSvx3DLightOnOff5Item(pInfo
->aLightSource
.bIsEnabled
));
510 aItemSet
.Put(makeSvx3DLightDirection5Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
512 pInfo
= &m_pLightSourceInfoList
[5];
513 aItemSet
.Put(makeSvx3DLightcolor6Item(pInfo
->aLightSource
.nDiffuseColor
));
514 aItemSet
.Put(makeSvx3DLightOnOff6Item(pInfo
->aLightSource
.bIsEnabled
));
515 aItemSet
.Put(makeSvx3DLightDirection6Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
517 pInfo
= &m_pLightSourceInfoList
[6];
518 aItemSet
.Put(makeSvx3DLightcolor7Item(pInfo
->aLightSource
.nDiffuseColor
));
519 aItemSet
.Put(makeSvx3DLightOnOff7Item(pInfo
->aLightSource
.bIsEnabled
));
520 aItemSet
.Put(makeSvx3DLightDirection7Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
522 pInfo
= &m_pLightSourceInfoList
[7];
523 aItemSet
.Put(makeSvx3DLightcolor8Item(pInfo
->aLightSource
.nDiffuseColor
));
524 aItemSet
.Put(makeSvx3DLightOnOff8Item(pInfo
->aLightSource
.bIsEnabled
));
525 aItemSet
.Put(makeSvx3DLightDirection8Item(Direction3DToB3DVector(pInfo
->aLightSource
.aDirection
)));
527 // set lights and ambient light
528 m_xCtl_Preview
->GetSvx3DLightControl().Set3DAttributes(aItemSet
);
531 for(sal_uInt32
a(0); a
< 8; a
++)
533 if (m_pLightSourceInfoList
[a
].pButton
->get_active())
535 m_xCtl_Preview
->GetSvx3DLightControl().SelectLight(a
);
536 m_xCtl_Preview
->CheckSelection();
544 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */