Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / dialogs / tp_3D_SceneIllumination.cxx
blobbbe28b0ed0eae8da7e3ce13aa692c37380d02f3a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
24 #include <svx/colorbox.hxx>
25 #include <svx/dialogs.hrc>
26 #include <svx/strings.hrc>
27 #include <svx/dialmgr.hxx>
28 #include <rtl/math.hxx>
29 #include <svtools/colrdlg.hxx>
30 #include <svx/svx3ditems.hxx>
31 #include <svx/svddef.hxx>
32 #include <vcl/builderfactory.hxx>
33 #include <tools/diagnose_ex.h>
35 namespace chart
38 using namespace ::com::sun::star;
39 using namespace ::com::sun::star::chart2;
41 LightButton::LightButton( vcl::Window* pParent)
42 : ImageButton( pParent)
43 , m_bLightOn(false)
45 SetModeImage(Image(BitmapEx(RID_SVXBMP_LAMP_OFF)));
48 VCL_BUILDER_FACTORY(LightButton)
50 void LightButton::switchLightOn(bool bOn)
52 if( m_bLightOn==bOn )
53 return;
54 m_bLightOn = bOn;
55 if(m_bLightOn)
57 SetModeImage(Image(BitmapEx(RID_SVXBMP_LAMP_ON)));
59 else
61 SetModeImage(Image(BitmapEx(RID_SVXBMP_LAMP_OFF)));
65 struct LightSource
67 Color nDiffuseColor;
68 css::drawing::Direction3D aDirection;
69 bool bIsEnabled;
71 LightSource() :
72 nDiffuseColor( 0xcccccc ),
73 aDirection( 1.0, 1.0, -1.0 ),
74 bIsEnabled( false )
78 struct LightSourceInfo
80 VclPtr<LightButton> pButton;
81 LightSource aLightSource;
83 LightSourceInfo();
84 void initButtonFromSource();
87 LightSourceInfo::LightSourceInfo()
88 : pButton(nullptr)
89 , aLightSource()
91 aLightSource.nDiffuseColor = Color(0xffffff); // white
92 aLightSource.aDirection = drawing::Direction3D(1,1,1);
93 aLightSource.bIsEnabled = false;
96 void LightSourceInfo::initButtonFromSource()
98 if(!pButton)
99 return;
100 pButton->SetModeImage(Image(BitmapEx(
101 aLightSource.bIsEnabled ? OUString(RID_SVXBMP_LAMP_ON) : OUString(RID_SVXBMP_LAMP_OFF)
102 ) ) );
105 namespace
107 OUString lcl_makeColorName(const Color& rColor)
109 OUString aStr = SvxResId(RID_SVXFLOAT3D_FIX_R) +
110 OUString::number(rColor.GetRed()) +
111 " " +
112 SvxResId(RID_SVXFLOAT3D_FIX_G) +
113 OUString::number(rColor.GetGreen()) +
114 " " +
115 SvxResId(RID_SVXFLOAT3D_FIX_B) +
116 OUString::number(rColor.GetBlue());
117 return aStr;
120 void lcl_selectColor(SvxColorListBox& rListBox, const Color& rColor)
122 rListBox.SetNoSelection();
123 rListBox.SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor)));
126 ::chart::LightSource lcl_getLightSourceFromProperties(
127 const uno::Reference< beans::XPropertySet > & xSceneProperties,
128 sal_Int32 nIndex )
130 ::chart::LightSource aResult;
131 if( 0 <= nIndex && nIndex < 8 )
133 OUString aIndex( OUString::number( nIndex + 1 ));
137 xSceneProperties->getPropertyValue( "D3DSceneLightColor" + aIndex ) >>= aResult.nDiffuseColor;
138 xSceneProperties->getPropertyValue( "D3DSceneLightDirection" + aIndex ) >>= aResult.aDirection;
139 xSceneProperties->getPropertyValue( "D3DSceneLightOn" + aIndex ) >>= aResult.bIsEnabled;
141 catch( const uno::Exception & )
143 DBG_UNHANDLED_EXCEPTION("chart2");
146 return aResult;
149 void lcl_setLightSource(
150 const uno::Reference< beans::XPropertySet > & xSceneProperties,
151 const ::chart::LightSource & rLightSource,
152 sal_Int32 nIndex )
154 if( 0 <= nIndex && nIndex < 8 )
156 OUString aIndex( OUString::number( nIndex + 1 ));
160 xSceneProperties->setPropertyValue( "D3DSceneLightColor" + aIndex,
161 uno::makeAny( rLightSource.nDiffuseColor ));
162 xSceneProperties->setPropertyValue( "D3DSceneLightDirection" + aIndex,
163 uno::Any( rLightSource.aDirection ));
164 xSceneProperties->setPropertyValue( "D3DSceneLightOn" + aIndex,
165 uno::Any( rLightSource.bIsEnabled ));
167 catch( const uno::Exception & )
169 DBG_UNHANDLED_EXCEPTION("chart2");
174 Color lcl_getAmbientColor(
175 const uno::Reference< beans::XPropertySet > & xSceneProperties )
177 sal_Int32 nResult = 0x000000;
180 xSceneProperties->getPropertyValue("D3DSceneAmbientColor") >>= nResult;
182 catch( const uno::Exception & )
184 DBG_UNHANDLED_EXCEPTION("chart2");
186 return Color( nResult );
189 void lcl_setAmbientColor(
190 const uno::Reference< beans::XPropertySet > & xSceneProperties,
191 const Color & rColor )
195 xSceneProperties->setPropertyValue("D3DSceneAmbientColor",
196 uno::makeAny( rColor ));
198 catch( const uno::Exception & )
200 DBG_UNHANDLED_EXCEPTION("chart2");
205 ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window* pWindow
206 , const uno::Reference< beans::XPropertySet > & xSceneProperties
207 , const uno::Reference< frame::XModel >& xChartModel )
208 : TabPage ( pWindow
209 ,"tp_3D_SceneIllumination"
210 ,"modules/schart/ui/tp_3D_SceneIllumination.ui")
211 , m_pLightSourceInfoList(nullptr)
212 , m_xSceneProperties( xSceneProperties )
213 , m_aTimerTriggeredControllerLock( xChartModel )
214 , m_bInCommitToModel( false )
215 , m_xChartModel( xChartModel )
217 get(m_pBtn_Light1, "BTN_LIGHT_1");
218 get(m_pBtn_Light2, "BTN_LIGHT_2");
219 get(m_pBtn_Light3, "BTN_LIGHT_3");
220 get(m_pBtn_Light4, "BTN_LIGHT_4");
221 get(m_pBtn_Light5, "BTN_LIGHT_5");
222 get(m_pBtn_Light6, "BTN_LIGHT_6");
223 get(m_pBtn_Light7, "BTN_LIGHT_7");
224 get(m_pBtn_Light8, "BTN_LIGHT_8");
226 get(m_pLB_LightSource, "LB_LIGHTSOURCE");
227 get(m_pLB_AmbientLight, "LB_AMBIENTLIGHT");
228 get(m_pBtn_LightSource_Color, "BTN_LIGHTSOURCE_COLOR");
229 get(m_pBtn_AmbientLight_Color, "BTN_AMBIENT_COLOR");
231 get(m_pCtl_Preview, "CTL_LIGHT_PREVIEW");
233 m_pLightSourceInfoList = new LightSourceInfo[8];
234 m_pLightSourceInfoList[0].pButton = m_pBtn_Light1;
235 m_pLightSourceInfoList[1].pButton = m_pBtn_Light2;
236 m_pLightSourceInfoList[2].pButton = m_pBtn_Light3;
237 m_pLightSourceInfoList[3].pButton = m_pBtn_Light4;
238 m_pLightSourceInfoList[4].pButton = m_pBtn_Light5;
239 m_pLightSourceInfoList[5].pButton = m_pBtn_Light6;
240 m_pLightSourceInfoList[6].pButton = m_pBtn_Light7;
241 m_pLightSourceInfoList[7].pButton = m_pBtn_Light8;
243 fillControlsFromModel(nullptr);
245 m_pBtn_Light1->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
246 m_pBtn_Light2->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
247 m_pBtn_Light3->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
248 m_pBtn_Light4->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
249 m_pBtn_Light5->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
250 m_pBtn_Light6->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
251 m_pBtn_Light7->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
252 m_pBtn_Light8->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
254 m_pLB_AmbientLight->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
255 m_pLB_LightSource->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
257 m_pBtn_AmbientLight_Color->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
258 m_pBtn_LightSource_Color->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
260 m_pCtl_Preview->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
261 m_pCtl_Preview->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
263 ClickLightSourceButtonHdl(m_pBtn_Light2);
266 ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
268 disposeOnce();
271 void ThreeD_SceneIllumination_TabPage::dispose()
273 delete[] m_pLightSourceInfoList;
274 m_pLightSourceInfoList = nullptr;
275 m_pBtn_Light1.clear();
276 m_pBtn_Light2.clear();
277 m_pBtn_Light3.clear();
278 m_pBtn_Light4.clear();
279 m_pBtn_Light5.clear();
280 m_pBtn_Light6.clear();
281 m_pBtn_Light7.clear();
282 m_pBtn_Light8.clear();
283 m_pLB_LightSource.clear();
284 m_pBtn_LightSource_Color.clear();
285 m_pLB_AmbientLight.clear();
286 m_pBtn_AmbientLight_Color.clear();
287 m_pCtl_Preview.clear();
288 TabPage::dispose();
291 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void)
293 if( m_bInCommitToModel )//don't read own changes
294 return;
296 sal_Int32 nL=0;
297 for( nL=0; nL<8; nL++)
298 m_pLightSourceInfoList[nL].aLightSource = lcl_getLightSourceFromProperties( m_xSceneProperties, nL );
299 for( nL=0; nL<8; nL++)
300 m_pLightSourceInfoList[nL].initButtonFromSource();
302 lcl_selectColor( *m_pLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
304 updatePreview();
307 void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber )
309 ControllerLockGuardUNO aGuard( m_xChartModel );
310 m_bInCommitToModel = true;
311 sal_Int32 nIndex( nLightNumber );
312 lcl_setLightSource( m_xSceneProperties, m_pLightSourceInfoList[nIndex].aLightSource, nIndex );
313 m_bInCommitToModel = false;
316 void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
318 m_aTimerTriggeredControllerLock.startTimer();
319 ControllerLockGuardUNO aGuard( m_xChartModel );
320 for( sal_Int32 nL=0; nL<8; nL++)
321 applyLightSourceToModel( nL );
322 m_aTimerTriggeredControllerLock.startTimer();
325 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, SvxLightCtl3D*, void)
327 m_aTimerTriggeredControllerLock.startTimer();
329 //update m_pLightSourceInfoList from preview
330 const SfxItemSet a3DLightAttributes(m_pCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
331 LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
333 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
334 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
335 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1).GetValue());
337 pInfo = &m_pLightSourceInfoList[1];
338 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
339 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
340 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2).GetValue());
342 pInfo = &m_pLightSourceInfoList[2];
343 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
344 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
345 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3).GetValue());
347 pInfo = &m_pLightSourceInfoList[3];
348 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
349 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
350 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4).GetValue());
352 pInfo = &m_pLightSourceInfoList[4];
353 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
354 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
355 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5).GetValue());
357 pInfo = &m_pLightSourceInfoList[5];
358 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
359 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
360 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6).GetValue());
362 pInfo = &m_pLightSourceInfoList[6];
363 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
364 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
365 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7).GetValue());
367 pInfo = &m_pLightSourceInfoList[7];
368 pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
369 pInfo->aLightSource.bIsEnabled = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
370 pInfo->aLightSource.aDirection = B3DVectorToDirection3D(a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8).GetValue());
372 applyLightSourcesToModel();
375 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, SvxLightCtl3D*, void)
377 sal_uInt32 nLightNumber = m_pCtl_Preview->GetSvx3DLightControl().GetSelectedLight();
378 if(nLightNumber<8)
380 LightButton* pButton = m_pLightSourceInfoList[nLightNumber].pButton;
381 if(!pButton->IsChecked())
382 ClickLightSourceButtonHdl(pButton);
384 applyLightSourcesToModel();
388 IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, void )
390 bool bIsAmbientLight = (pButton==m_pBtn_AmbientLight_Color);
391 SvxColorListBox* pListBox = bIsAmbientLight ? m_pLB_AmbientLight.get() : m_pLB_LightSource.get();
393 SvColorDialog aColorDlg;
394 aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
395 if( aColorDlg.Execute(GetFrameWeld()) == RET_OK )
397 Color aColor( aColorDlg.GetColor());
398 lcl_selectColor( *pListBox, aColor );
399 if( bIsAmbientLight )
401 m_bInCommitToModel = true;
402 lcl_setAmbientColor( m_xSceneProperties, aColor );
403 m_bInCommitToModel = false;
405 else
407 //get active lightsource:
408 LightSourceInfo* pInfo = nullptr;
409 sal_Int32 nL=0;
410 for( nL=0; nL<8; nL++)
412 pInfo = &m_pLightSourceInfoList[nL];
413 if(pInfo->pButton->IsChecked())
414 break;
415 pInfo = nullptr;
417 if(pInfo)
418 applyLightSourceToModel( nL );
420 SelectColorHdl( *pListBox );
424 IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, SvxColorListBox&, rBox, void )
426 SvxColorListBox* pListBox = &rBox;
427 if(pListBox==m_pLB_AmbientLight)
429 m_bInCommitToModel = true;
430 lcl_setAmbientColor( m_xSceneProperties, pListBox->GetSelectEntryColor());
431 m_bInCommitToModel = false;
433 else if(pListBox==m_pLB_LightSource)
435 //get active lightsource:
436 LightSourceInfo* pInfo = nullptr;
437 sal_Int32 nL=0;
438 for( nL=0; nL<8; nL++)
440 pInfo = &m_pLightSourceInfoList[nL];
441 if(pInfo->pButton->IsChecked())
442 break;
443 pInfo = nullptr;
445 if(pInfo)
447 pInfo->aLightSource.nDiffuseColor = pListBox->GetSelectEntryColor();
448 applyLightSourceToModel( nL );
451 updatePreview();
454 IMPL_LINK( ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, Button*, pBtn, void )
456 LightButton* pButton = static_cast<LightButton*>(pBtn);
457 if( !pButton )
458 return;
460 LightSourceInfo* pInfo = nullptr;
461 sal_Int32 nL=0;
462 for( nL=0; nL<8; nL++)
464 if( m_pLightSourceInfoList[nL].pButton == pButton )
466 pInfo = &m_pLightSourceInfoList[nL];
467 break;
471 //update light button
472 bool bIsChecked = pButton->IsChecked();
473 if(bIsChecked)
475 pButton->switchLightOn(!pButton->isLightOn());
476 if(pInfo)
478 pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
479 applyLightSourceToModel( nL );
482 else
484 ControllerLockGuardUNO aGuard( m_xChartModel );
485 for( nL=0; nL<8; nL++)
487 LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
488 pLightButton->Check( pLightButton == pButton );
492 //update color list box
493 if(pInfo)
495 lcl_selectColor( *m_pLB_LightSource, pInfo->aLightSource.nDiffuseColor );
497 updatePreview();
500 void ThreeD_SceneIllumination_TabPage::updatePreview()
502 SfxItemSet aItemSet(m_pCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
503 LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
505 // AmbientColor
506 aItemSet.Put(makeSvx3DAmbientcolorItem(m_pLB_AmbientLight->GetSelectEntryColor()));
508 aItemSet.Put(makeSvx3DLightcolor1Item(pInfo->aLightSource.nDiffuseColor));
509 aItemSet.Put(makeSvx3DLightOnOff1Item(pInfo->aLightSource.bIsEnabled));
510 aItemSet.Put(makeSvx3DLightDirection1Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
512 pInfo = &m_pLightSourceInfoList[1];
513 aItemSet.Put(makeSvx3DLightcolor2Item(pInfo->aLightSource.nDiffuseColor));
514 aItemSet.Put(makeSvx3DLightOnOff2Item(pInfo->aLightSource.bIsEnabled));
515 aItemSet.Put(makeSvx3DLightDirection2Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
517 pInfo = &m_pLightSourceInfoList[2];
518 aItemSet.Put(makeSvx3DLightcolor3Item(pInfo->aLightSource.nDiffuseColor));
519 aItemSet.Put(makeSvx3DLightOnOff3Item(pInfo->aLightSource.bIsEnabled));
520 aItemSet.Put(makeSvx3DLightDirection3Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
522 pInfo = &m_pLightSourceInfoList[3];
523 aItemSet.Put(makeSvx3DLightcolor4Item(pInfo->aLightSource.nDiffuseColor));
524 aItemSet.Put(makeSvx3DLightOnOff4Item(pInfo->aLightSource.bIsEnabled));
525 aItemSet.Put(makeSvx3DLightDirection4Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
527 pInfo = &m_pLightSourceInfoList[4];
528 aItemSet.Put(makeSvx3DLightcolor5Item(pInfo->aLightSource.nDiffuseColor));
529 aItemSet.Put(makeSvx3DLightOnOff5Item(pInfo->aLightSource.bIsEnabled));
530 aItemSet.Put(makeSvx3DLightDirection5Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
532 pInfo = &m_pLightSourceInfoList[5];
533 aItemSet.Put(makeSvx3DLightcolor6Item(pInfo->aLightSource.nDiffuseColor));
534 aItemSet.Put(makeSvx3DLightOnOff6Item(pInfo->aLightSource.bIsEnabled));
535 aItemSet.Put(makeSvx3DLightDirection6Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
537 pInfo = &m_pLightSourceInfoList[6];
538 aItemSet.Put(makeSvx3DLightcolor7Item(pInfo->aLightSource.nDiffuseColor));
539 aItemSet.Put(makeSvx3DLightOnOff7Item(pInfo->aLightSource.bIsEnabled));
540 aItemSet.Put(makeSvx3DLightDirection7Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
542 pInfo = &m_pLightSourceInfoList[7];
543 aItemSet.Put(makeSvx3DLightcolor8Item(pInfo->aLightSource.nDiffuseColor));
544 aItemSet.Put(makeSvx3DLightOnOff8Item(pInfo->aLightSource.bIsEnabled));
545 aItemSet.Put(makeSvx3DLightDirection8Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
547 // set lights and ambient light
548 m_pCtl_Preview->GetSvx3DLightControl().Set3DAttributes(aItemSet);
550 // select light
551 for(sal_uInt32 a(0); a < 8; a++)
553 if(m_pLightSourceInfoList[a].pButton->IsChecked())
555 m_pCtl_Preview->GetSvx3DLightControl().SelectLight(a);
556 m_pCtl_Preview->CheckSelection();
557 break;
562 } //namespace chart
564 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */