Debian Codegraph @

chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20 #include "tp_3D_SceneIllumination.hxx"
21 #include <CommonConverters.hxx>
22 #include <ControllerLockGuard.hxx>
23 #include <ChartModel.hxx>
24
25 #include <svx/colorbox.hxx>
26 #include <svx/float3d.hxx>
27 #include <svx/strings.hrc>
28 #include <svx/dialmgr.hxx>
29 #include <svx/svx3ditems.hxx>
30 #include <svx/svddef.hxx>
31 #include <utility>
32 #include <vcl/ColorDialog.hxx>
33 #include <vcl/svapp.hxx>
34 #include <comphelper/diagnose_ex.hxx>
35
36 #include <com/sun/star/beans/XPropertySet.hpp>
37
38 namespace chart
39 {
40
41 using namespace ::com::sun::star;
42 using namespace ::com::sun::star::chart2;
43
44 namespace {
45
46 struct LightSource
47 {
48 Color nDiffuseColor;
49 css::drawing::Direction3D aDirection;
50 bool bIsEnabled;
51
52 LightSource() :
53 nDiffuseColor( 0xcccccc ),
54 aDirection( 1.0, 1.0, -1.0 ),
55 bIsEnabled( false )
56 {}
57 };
58
59 }
60
61 struct LightSourceInfo
62 {
63 LightButton* pButton;
64 LightSource aLightSource;
65
66 LightSourceInfo();
67 void initButtonFromSource();
68 };
69
70 LightSourceInfo::LightSourceInfo()
71 : pButton(nullptr)
72 {
73 aLightSource.nDiffuseColor = Color(0xffffff); // white
74 aLightSource.aDirection = drawing::Direction3D(1,1,1);
75 aLightSource.bIsEnabled = false;
76 }
77
78 void LightSourceInfo::initButtonFromSource()
79 {
80 if (!pButton)
81 return;
82 pButton->switchLightOn(aLightSource.bIsEnabled);
83 }
84
85 namespace
86 {
87 OUString lcl_makeColorName(const Color& rColor)
88 {
89 OUString aStr = SvxResId(RID_SVXFLOAT3D_FIX_R) +
90 OUString::number(rColor.GetRed()) +
91 " " +
92 SvxResId(RID_SVXFLOAT3D_FIX_G) +
93 OUString::number(rColor.GetGreen()) +
94 " " +
95 SvxResId(RID_SVXFLOAT3D_FIX_B) +
96 OUString::number(rColor.GetBlue());
97 return aStr;
98 }
99
100 void lcl_selectColor(ColorListBox& rListBox, const Color& rColor)
101 {
102 rListBox.SetNoSelection();
103 rListBox.SelectEntry({rColor, lcl_makeColorName(rColor)});
104 }
105
106 ::chart::LightSource lcl_getLightSourceFromProperties(
107 const uno::Reference< beans::XPropertySet > & xSceneProperties,
108 sal_Int32 nIndex )
109 {
110 ::chart::LightSource aResult;
111 if( 0 <= nIndex && nIndex < 8 )
112 {
113 OUString aIndex( OUString::number( nIndex + 1 ));
114
115 try
116 {
117 xSceneProperties->getPropertyValue( "D3DSceneLightColor" + aIndex ) >>= aResult.nDiffuseColor;
118 xSceneProperties->getPropertyValue( "D3DSceneLightDirection" + aIndex ) >>= aResult.aDirection;
119 xSceneProperties->getPropertyValue( "D3DSceneLightOn" + aIndex ) >>= aResult.bIsEnabled;
120 }
121 catch( const uno::Exception & )
122 {
123 DBG_UNHANDLED_EXCEPTION("chart2");
124 }
125 }
126 return aResult;
127 }
128
129 void lcl_setLightSource(
130 const uno::Reference< beans::XPropertySet > & xSceneProperties,
131 const ::chart::LightSource & rLightSource,
132 sal_Int32 nIndex )
133 {
134 if( 0 > nIndex || nIndex >= 8 )
135 return;
136
137 OUString aIndex( OUString::number( nIndex + 1 ));
138
139 try
140 {
141 xSceneProperties->setPropertyValue( "D3DSceneLightColor" + aIndex,
142 uno::Any( rLightSource.nDiffuseColor ));
143 xSceneProperties->setPropertyValue( "D3DSceneLightDirection" + aIndex,
144 uno::Any( rLightSource.aDirection ));
145 xSceneProperties->setPropertyValue( "D3DSceneLightOn" + aIndex,
146 uno::Any( rLightSource.bIsEnabled ));
147 }
148 catch( const uno::Exception & )
149 {
150 DBG_UNHANDLED_EXCEPTION("chart2");
151 }
152 }
153
154 Color lcl_getAmbientColor(
155 const uno::Reference< beans::XPropertySet > & xSceneProperties )
156 {
157 Color nResult;
158 try
159 {
160 xSceneProperties->getPropertyValue(u"D3DSceneAmbientColor"_ustr) >>= nResult;
161 }
162 catch( const uno::Exception & )
163 {
164 DBG_UNHANDLED_EXCEPTION("chart2");
165 }
166 return nResult;
167 }
168
169 void lcl_setAmbientColor(
170 const uno::Reference< beans::XPropertySet > & xSceneProperties,
171 const Color & rColor )
172 {
173 try
174 {
175 xSceneProperties->setPropertyValue(u"D3DSceneAmbientColor"_ustr,
176 uno::Any( rColor ));
177 }
178 catch( const uno::Exception & )
179 {
180 DBG_UNHANDLED_EXCEPTION("chart2");
181 }
182 }
183 }
184
185 ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Container* pParent,
186 weld::Window* pTopLevel,
187 uno::Reference< beans::XPropertySet > xSceneProperties,
188 const rtl::Reference<::chart::ChartModel>& xChartModel)
189 : m_xSceneProperties(std::move( xSceneProperties ))
190 , m_aTimerTriggeredControllerLock( xChartModel )
191 , m_bInCommitToModel( false )
192 , m_aModelChangeListener( LINK( this, ThreeD_SceneIllumination_TabPage, fillControlsFromModel ) )
193 , m_xChartModel( xChartModel )
194 , m_pTopLevel(pTopLevel)
195 , m_xBuilder(Application::CreateBuilder(pParent, u"modules/schart/ui/tp_3D_SceneIllumination.ui"_ustr))
196 , m_xContainer(m_xBuilder->weld_container(u"tp_3D_SceneIllumination"_ustr))
197 , m_aBtn_Light1(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_1"_ustr))
198 , m_aBtn_Light2(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_2"_ustr))
199 , m_aBtn_Light3(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_3"_ustr))
200 , m_aBtn_Light4(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_4"_ustr))
201 , m_aBtn_Light5(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_5"_ustr))
202 , m_aBtn_Light6(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_6"_ustr))
203 , m_aBtn_Light7(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_7"_ustr))
204 , m_aBtn_Light8(m_xBuilder->weld_toggle_button(u"BTN_LIGHT_8"_ustr))
205 , m_xLB_LightSource(new ColorListBox(m_xBuilder->weld_menu_button(u"LB_LIGHTSOURCE"_ustr), [this]{ return m_pTopLevel; }))
206 , m_xBtn_LightSource_Color(m_xBuilder->weld_button(u"BTN_LIGHTSOURCE_COLOR"_ustr))
207 , m_xLB_AmbientLight(new ColorListBox(m_xBuilder->weld_menu_button(u"LB_AMBIENTLIGHT"_ustr), [this]{ return m_pTopLevel; }))
208 , m_xBtn_AmbientLight_Color(m_xBuilder->weld_button(u"BTN_AMBIENT_COLOR"_ustr))
209 , m_xHoriScale(m_xBuilder->weld_scale(u"hori"_ustr))
210 , m_xVertScale(m_xBuilder->weld_scale(u"vert"_ustr))
211 , m_xBtn_Corner(m_xBuilder->weld_button(u"corner"_ustr))
212 , m_xPreview(new Svx3DLightControl)
213 , m_xPreviewWnd(new weld::CustomWeld(*m_xBuilder, u"CTL_LIGHT_PREVIEW"_ustr, *m_xPreview))
214 , m_xCtl_Preview(new SvxLightCtl3D(*m_xPreview, *m_xHoriScale, *m_xVertScale, *m_xBtn_Corner))
215 {
216 m_pLightSourceInfoList.reset(new LightSourceInfo[8]);
217 m_pLightSourceInfoList[0].pButton = &m_aBtn_Light1;
218 m_pLightSourceInfoList[1].pButton = &m_aBtn_Light2;
219 m_pLightSourceInfoList[2].pButton = &m_aBtn_Light3;
220 m_pLightSourceInfoList[3].pButton = &m_aBtn_Light4;
221 m_pLightSourceInfoList[4].pButton = &m_aBtn_Light5;
222 m_pLightSourceInfoList[5].pButton = &m_aBtn_Light6;
223 m_pLightSourceInfoList[6].pButton = &m_aBtn_Light7;
224 m_pLightSourceInfoList[7].pButton = &m_aBtn_Light8;
225
226 fillControlsFromModel(nullptr);
227
228 m_aBtn_Light1.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
229 m_aBtn_Light2.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
230 m_aBtn_Light3.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
231 m_aBtn_Light4.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
232 m_aBtn_Light5.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
233 m_aBtn_Light6.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
234 m_aBtn_Light7.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
235 m_aBtn_Light8.connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
236
237 m_xLB_AmbientLight->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
238 m_xLB_LightSource->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
239
240 m_xBtn_AmbientLight_Color->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
241 m_xBtn_LightSource_Color->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
242
243 m_xCtl_Preview->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
244 m_xCtl_Preview->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
245
246 ClickLightSourceButtonHdl(*m_aBtn_Light2.get_widget());
247
248 m_aModelChangeListener.startListening( uno::Reference< util::XModifyBroadcaster >(m_xSceneProperties, uno::UNO_QUERY) );
249 }
250
251 ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
252 {
253 // drop page view before the widget it paints to is destroyed
254 m_xPreview->ClearPageView();
255 }
256
257 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void)
258 {
259 if( m_bInCommitToModel )//don't read own changes
260 return;
261
262 sal_Int32 nL=0;
263 for( nL=0; nL<8; nL++)
264 m_pLightSourceInfoList[nL].aLightSource = lcl_getLightSourceFromProperties( m_xSceneProperties, nL );
265 for( nL=0; nL<8; nL++)
266 m_pLightSourceInfoList[nL].initButtonFromSource();
267
268 lcl_selectColor( *m_xLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
269
270 updatePreview();
271 }
272
273 void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber )
274 {
275 ControllerLockGuardUNO aGuard( m_xChartModel );
276 m_bInCommitToModel = true;
277 sal_Int32 nIndex( nLightNumber );
278 lcl_setLightSource( m_xSceneProperties, m_pLightSourceInfoList[nIndex].aLightSource, nIndex );
279 m_bInCommitToModel = false;
280 }
281
282 void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
283 {
284 m_aTimerTriggeredControllerLock.startTimer();
285 ControllerLockGuardUNO aGuard( m_xChartModel );
286 for( sal_Int32 nL=0; nL<8; nL++)
287 applyLightSourceToModel( nL );
288 m_aTimerTriggeredControllerLock.startTimer();
289 }
290
291 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, SvxLightCtl3D*, void)
292 {
293 m_aTimerTriggeredControllerLock.startTimer();
294
295 //update m_pLightSourceInfoList from preview
296 const SfxItemSet a3DLightAttributes(m_xCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
297 LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
298
299 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
300 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
301 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1).GetValue());
302
303 pInfo = &m_pLightSourceInfoList[1];
304 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
305 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
306 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2).GetValue());
307
308 pInfo = &m_pLightSourceInfoList[2];
309 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
310 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
311 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3).GetValue());
312
313 pInfo = &m_pLightSourceInfoList[3];
314 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
315 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
316 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4).GetValue());
317
318 pInfo = &m_pLightSourceInfoList[4];
319 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
320 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
321 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5).GetValue());
322
323 pInfo = &m_pLightSourceInfoList[5];
324 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
325 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
326 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6).GetValue());
327
328 pInfo = &m_pLightSourceInfoList[6];
329 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
330 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
331 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7).GetValue());
332
333 pInfo = &m_pLightSourceInfoList[7];
334 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
335 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
336 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8).GetValue());
337
338 applyLightSourcesToModel();
339 }
340
341 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, SvxLightCtl3D*, void)
342 {
343 sal_uInt32 nLightNumber = m_xCtl_Preview->GetSvx3DLightControl().GetSelectedLight();
344 if(nLightNumber<8)
345 {
346 LightButton* pButton = m_pLightSourceInfoList[nLightNumber].pButton;
347 if(!pButton->get_active())
348 ClickLightSourceButtonHdl(*pButton->get_widget());
349
350 applyLightSourcesToModel();
351 }
352 }
353
354 IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, weld::Button&, rButton, void )
355 {
356 bool bIsAmbientLight = (&rButton == m_xBtn_AmbientLight_Color.get());
357 ColorListBox* pListBox = bIsAmbientLight ? m_xLB_AmbientLight.get() : m_xLB_LightSource.get();
358
359 ColorDialog aColorDlg(m_pTopLevel);
360 aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
361 if (aColorDlg.Execute() != RET_OK)
362 return;
363
364 Color aColor( aColorDlg.GetColor());
365 lcl_selectColor( *pListBox, aColor );
366 if( bIsAmbientLight )
367 {
368 m_bInCommitToModel = true;
369 lcl_setAmbientColor( m_xSceneProperties, aColor );
370 m_bInCommitToModel = false;
371 }
372 else
373 {
374 //get active lightsource:
375 LightSourceInfo* pInfo = nullptr;
376 sal_Int32 nL=0;
377 for( nL=0; nL<8; nL++)
378 {
379 pInfo = &m_pLightSourceInfoList[nL];
380 if(pInfo->pButton->get_active())
381 break;
382 pInfo = nullptr;
383 }
384 if(pInfo)
385 applyLightSourceToModel( nL );
386 }
387 SelectColorHdl( *pListBox );
388 }
389
390 IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ColorListBox&, rBox, void )
391 {
392 ColorListBox* pListBox = &rBox;
393 if (pListBox == m_xLB_AmbientLight.get())
394 {
395 m_bInCommitToModel = true;
396 lcl_setAmbientColor( m_xSceneProperties, pListBox->GetSelectEntryColor());
397 m_bInCommitToModel = false;
398 }
399 else if (pListBox == m_xLB_LightSource.get())
400 {
401 //get active lightsource:
402 LightSourceInfo* pInfo = nullptr;
403 sal_Int32 nL=0;
404 for( nL=0; nL<8; nL++)
405 {
406 pInfo = &m_pLightSourceInfoList[nL];
407 if (pInfo->pButton->get_active())
408 break;
409 pInfo = nullptr;
410 }
411 if(pInfo)
412 {
413 pInfo->aLightSource.nDiffuseColor = pListBox->GetSelectEntryColor();
414 applyLightSourceToModel( nL );
415 }
416 }
417 updatePreview();
418 }
419
420 IMPL_LINK(ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, weld::Button&, rBtn, void)
421 {
422 LightButton* pButton = nullptr;
423 LightSourceInfo* pInfo = nullptr;
424 sal_Int32 nL=0;
425 for( nL=0; nL<8; nL++)
426 {
427 if (m_pLightSourceInfoList[nL].pButton->get_widget() == &rBtn)
428 {
429 pButton = m_pLightSourceInfoList[nL].pButton;
430 pInfo = &m_pLightSourceInfoList[nL];
431 break;
432 }
433 }
434
435 assert(pInfo);
436
437 bool bIsChecked = pInfo->pButton->get_prev_active();
438
439 ControllerLockGuardUNO aGuard( m_xChartModel );
440 for (sal_Int32 i = 0; i < 8; ++i)
441 {
442 LightButton* pLightButton = m_pLightSourceInfoList[i].pButton;
443 if (pLightButton == pButton)
444 {
445 pLightButton->set_active(true);
446 if (!pLightButton->get_widget()->has_focus())
447 pLightButton->get_widget()->grab_focus();
448 m_pLightSourceInfoList[i].pButton->set_prev_active(true);
449 }
450 else
451 {
452 pLightButton->set_active(false);
453 m_pLightSourceInfoList[i].pButton->set_prev_active(false);
454 }
455 }
456
457 //update light button
458 if (bIsChecked)
459 {
460 pButton->switchLightOn(!pButton->isLightOn());
461 pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
462 applyLightSourceToModel( nL );
463 }
464
465 //update color list box
466 lcl_selectColor( *m_xLB_LightSource, pInfo->aLightSource.nDiffuseColor );
467 updatePreview();
468 }
469
470 void ThreeD_SceneIllumination_TabPage::updatePreview()
471 {
472 SfxItemSet aItemSet(m_xCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
473 LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
474
475 // AmbientColor
476 aItemSet.Put(makeSvx3DAmbientcolorItem(m_xLB_AmbientLight->GetSelectEntryColor()));
477
478 aItemSet.Put(makeSvx3DLightcolor1Item(pInfo->aLightSource.nDiffuseColor));
479 aItemSet.Put(makeSvx3DLightOnOff1Item(pInfo->aLightSource.bIsEnabled));
480 aItemSet.Put(makeSvx3DLightDirection1Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
481
482 pInfo = &m_pLightSourceInfoList[1];
483 aItemSet.Put(makeSvx3DLightcolor2Item(pInfo->aLightSource.nDiffuseColor));
484 aItemSet.Put(makeSvx3DLightOnOff2Item(pInfo->aLightSource.bIsEnabled));
485 aItemSet.Put(makeSvx3DLightDirection2Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
486
487 pInfo = &m_pLightSourceInfoList[2];
488 aItemSet.Put(makeSvx3DLightcolor3Item(pInfo->aLightSource.nDiffuseColor));
489 aItemSet.Put(makeSvx3DLightOnOff3Item(pInfo->aLightSource.bIsEnabled));
490 aItemSet.Put(makeSvx3DLightDirection3Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
491
492 pInfo = &m_pLightSourceInfoList[3];
493 aItemSet.Put(makeSvx3DLightcolor4Item(pInfo->aLightSource.nDiffuseColor));
494 aItemSet.Put(makeSvx3DLightOnOff4Item(pInfo->aLightSource.bIsEnabled));
495 aItemSet.Put(makeSvx3DLightDirection4Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
496
497 pInfo = &m_pLightSourceInfoList[4];
498 aItemSet.Put(makeSvx3DLightcolor5Item(pInfo->aLightSource.nDiffuseColor));
499 aItemSet.Put(makeSvx3DLightOnOff5Item(pInfo->aLightSource.bIsEnabled));
500 aItemSet.Put(makeSvx3DLightDirection5Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
501
502 pInfo = &m_pLightSourceInfoList[5];
503 aItemSet.Put(makeSvx3DLightcolor6Item(pInfo->aLightSource.nDiffuseColor));
504 aItemSet.Put(makeSvx3DLightOnOff6Item(pInfo->aLightSource.bIsEnabled));
505 aItemSet.Put(makeSvx3DLightDirection6Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
506
507 pInfo = &m_pLightSourceInfoList[6];
508 aItemSet.Put(makeSvx3DLightcolor7Item(pInfo->aLightSource.nDiffuseColor));
509 aItemSet.Put(makeSvx3DLightOnOff7Item(pInfo->aLightSource.bIsEnabled));
510 aItemSet.Put(makeSvx3DLightDirection7Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
511
512 pInfo = &m_pLightSourceInfoList[7];
513 aItemSet.Put(makeSvx3DLightcolor8Item(pInfo->aLightSource.nDiffuseColor));
514 aItemSet.Put(makeSvx3DLightOnOff8Item(pInfo->aLightSource.bIsEnabled));
515 aItemSet.Put(makeSvx3DLightDirection8Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
516
517 // set lights and ambient light
518 m_xCtl_Preview->GetSvx3DLightControl().Set3DAttributes(aItemSet);
519
520 // select light
521 for(sal_uInt32 a(0); a < 8; a++)
522 {
523 if (m_pLightSourceInfoList[a].pButton->get_active())
524 {
525 m_xCtl_Preview->GetSvx3DLightControl().SelectLight(a);
526 m_xCtl_Preview->CheckSelection();
527 break;
528 }
529 }
530 }
531
532 } //namespace chart
533
534 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */