tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / controller / dialogs / tp_3D_SceneIllumination.cxx
blob3d258e8e70f502ed02e86d3832f3b63ce248ef52
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 <CommonConverters.hxx>
22 #include <ControllerLockGuard.hxx>
23 #include <ChartModel.hxx>
25 #include <svx/colorbox.hxx>
26 #include <svx/float3d.hxx>
27 #include <svx/strings.hrc>
28 #include <svx/dialmgr.hxx>
29 #include <svtools/colrdlg.hxx>
30 #include <svx/svx3ditems.hxx>
31 #include <svx/svddef.hxx>
32 #include <utility>
33 #include <vcl/svapp.hxx>
34 #include <comphelper/diagnose_ex.hxx>
36 #include <com/sun/star/beans/XPropertySet.hpp>
38 namespace chart
41 using namespace ::com::sun::star;
42 using namespace ::com::sun::star::chart2;
44 namespace {
46 struct LightSource
48 Color nDiffuseColor;
49 css::drawing::Direction3D aDirection;
50 bool bIsEnabled;
52 LightSource() :
53 nDiffuseColor( 0xcccccc ),
54 aDirection( 1.0, 1.0, -1.0 ),
55 bIsEnabled( false )
61 struct LightSourceInfo
63 LightButton* pButton;
64 LightSource aLightSource;
66 LightSourceInfo();
67 void initButtonFromSource();
70 LightSourceInfo::LightSourceInfo()
71 : pButton(nullptr)
73 aLightSource.nDiffuseColor = Color(0xffffff); // white
74 aLightSource.aDirection = drawing::Direction3D(1,1,1);
75 aLightSource.bIsEnabled = false;
78 void LightSourceInfo::initButtonFromSource()
80 if (!pButton)
81 return;
82 pButton->switchLightOn(aLightSource.bIsEnabled);
85 namespace
87 OUString lcl_makeColorName(const Color& rColor)
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;
100 void lcl_selectColor(ColorListBox& rListBox, const Color& rColor)
102 rListBox.SetNoSelection();
103 rListBox.SelectEntry({rColor, lcl_makeColorName(rColor)});
106 ::chart::LightSource lcl_getLightSourceFromProperties(
107 const uno::Reference< beans::XPropertySet > & xSceneProperties,
108 sal_Int32 nIndex )
110 ::chart::LightSource aResult;
111 if( 0 <= nIndex && nIndex < 8 )
113 OUString aIndex( OUString::number( nIndex + 1 ));
117 xSceneProperties->getPropertyValue( "D3DSceneLightColor" + aIndex ) >>= aResult.nDiffuseColor;
118 xSceneProperties->getPropertyValue( "D3DSceneLightDirection" + aIndex ) >>= aResult.aDirection;
119 xSceneProperties->getPropertyValue( "D3DSceneLightOn" + aIndex ) >>= aResult.bIsEnabled;
121 catch( const uno::Exception & )
123 DBG_UNHANDLED_EXCEPTION("chart2");
126 return aResult;
129 void lcl_setLightSource(
130 const uno::Reference< beans::XPropertySet > & xSceneProperties,
131 const ::chart::LightSource & rLightSource,
132 sal_Int32 nIndex )
134 if( 0 > nIndex || nIndex >= 8 )
135 return;
137 OUString aIndex( OUString::number( nIndex + 1 ));
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 ));
148 catch( const uno::Exception & )
150 DBG_UNHANDLED_EXCEPTION("chart2");
154 Color lcl_getAmbientColor(
155 const uno::Reference< beans::XPropertySet > & xSceneProperties )
157 Color nResult;
160 xSceneProperties->getPropertyValue(u"D3DSceneAmbientColor"_ustr) >>= nResult;
162 catch( const uno::Exception & )
164 DBG_UNHANDLED_EXCEPTION("chart2");
166 return nResult;
169 void lcl_setAmbientColor(
170 const uno::Reference< beans::XPropertySet > & xSceneProperties,
171 const Color & rColor )
175 xSceneProperties->setPropertyValue(u"D3DSceneAmbientColor"_ustr,
176 uno::Any( rColor ));
178 catch( const uno::Exception & )
180 DBG_UNHANDLED_EXCEPTION("chart2");
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))
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;
226 fillControlsFromModel(nullptr);
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 ) );
237 m_xLB_AmbientLight->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
238 m_xLB_LightSource->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
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 ) );
243 m_xCtl_Preview->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
244 m_xCtl_Preview->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
246 ClickLightSourceButtonHdl(*m_aBtn_Light2.get_widget());
248 m_aModelChangeListener.startListening( uno::Reference< util::XModifyBroadcaster >(m_xSceneProperties, uno::UNO_QUERY) );
251 ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
253 // drop page view before the widget it paints to is destroyed
254 m_xPreview->ClearPageView();
257 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void)
259 if( m_bInCommitToModel )//don't read own changes
260 return;
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();
268 lcl_selectColor( *m_xLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
270 updatePreview();
273 void ThreeD_SceneIllumination_TabPage::applyLightSourceToModel( sal_uInt32 nLightNumber )
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;
282 void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
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();
291 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, SvxLightCtl3D*, void)
293 m_aTimerTriggeredControllerLock.startTimer();
295 //update m_pLightSourceInfoList from preview
296 const SfxItemSet a3DLightAttributes(m_xCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
297 LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
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());
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());
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());
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());
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());
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());
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());
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());
338 applyLightSourcesToModel();
341 IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, SvxLightCtl3D*, void)
343 sal_uInt32 nLightNumber = m_xCtl_Preview->GetSvx3DLightControl().GetSelectedLight();
344 if(nLightNumber<8)
346 LightButton* pButton = m_pLightSourceInfoList[nLightNumber].pButton;
347 if(!pButton->get_active())
348 ClickLightSourceButtonHdl(*pButton->get_widget());
350 applyLightSourcesToModel();
354 IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, weld::Button&, rButton, void )
356 bool bIsAmbientLight = (&rButton == m_xBtn_AmbientLight_Color.get());
357 ColorListBox* pListBox = bIsAmbientLight ? m_xLB_AmbientLight.get() : m_xLB_LightSource.get();
359 SvColorDialog aColorDlg;
360 aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
361 if( aColorDlg.Execute(m_pTopLevel) != RET_OK )
362 return;
364 Color aColor( aColorDlg.GetColor());
365 lcl_selectColor( *pListBox, aColor );
366 if( bIsAmbientLight )
368 m_bInCommitToModel = true;
369 lcl_setAmbientColor( m_xSceneProperties, aColor );
370 m_bInCommitToModel = false;
372 else
374 //get active lightsource:
375 LightSourceInfo* pInfo = nullptr;
376 sal_Int32 nL=0;
377 for( nL=0; nL<8; nL++)
379 pInfo = &m_pLightSourceInfoList[nL];
380 if(pInfo->pButton->get_active())
381 break;
382 pInfo = nullptr;
384 if(pInfo)
385 applyLightSourceToModel( nL );
387 SelectColorHdl( *pListBox );
390 IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ColorListBox&, rBox, void )
392 ColorListBox* pListBox = &rBox;
393 if (pListBox == m_xLB_AmbientLight.get())
395 m_bInCommitToModel = true;
396 lcl_setAmbientColor( m_xSceneProperties, pListBox->GetSelectEntryColor());
397 m_bInCommitToModel = false;
399 else if (pListBox == m_xLB_LightSource.get())
401 //get active lightsource:
402 LightSourceInfo* pInfo = nullptr;
403 sal_Int32 nL=0;
404 for( nL=0; nL<8; nL++)
406 pInfo = &m_pLightSourceInfoList[nL];
407 if (pInfo->pButton->get_active())
408 break;
409 pInfo = nullptr;
411 if(pInfo)
413 pInfo->aLightSource.nDiffuseColor = pListBox->GetSelectEntryColor();
414 applyLightSourceToModel( nL );
417 updatePreview();
420 IMPL_LINK(ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, weld::Button&, rBtn, void)
422 LightButton* pButton = nullptr;
423 LightSourceInfo* pInfo = nullptr;
424 sal_Int32 nL=0;
425 for( nL=0; nL<8; nL++)
427 if (m_pLightSourceInfoList[nL].pButton->get_widget() == &rBtn)
429 pButton = m_pLightSourceInfoList[nL].pButton;
430 pInfo = &m_pLightSourceInfoList[nL];
431 break;
435 assert(pInfo);
437 bool bIsChecked = pInfo->pButton->get_prev_active();
439 ControllerLockGuardUNO aGuard( m_xChartModel );
440 for (sal_Int32 i = 0; i < 8; ++i)
442 LightButton* pLightButton = m_pLightSourceInfoList[i].pButton;
443 if (pLightButton == pButton)
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);
450 else
452 pLightButton->set_active(false);
453 m_pLightSourceInfoList[i].pButton->set_prev_active(false);
457 //update light button
458 if (bIsChecked)
460 pButton->switchLightOn(!pButton->isLightOn());
461 pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
462 applyLightSourceToModel( nL );
465 //update color list box
466 lcl_selectColor( *m_xLB_LightSource, pInfo->aLightSource.nDiffuseColor );
467 updatePreview();
470 void ThreeD_SceneIllumination_TabPage::updatePreview()
472 SfxItemSet aItemSet(m_xCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
473 LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
475 // AmbientColor
476 aItemSet.Put(makeSvx3DAmbientcolorItem(m_xLB_AmbientLight->GetSelectEntryColor()));
478 aItemSet.Put(makeSvx3DLightcolor1Item(pInfo->aLightSource.nDiffuseColor));
479 aItemSet.Put(makeSvx3DLightOnOff1Item(pInfo->aLightSource.bIsEnabled));
480 aItemSet.Put(makeSvx3DLightDirection1Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
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)));
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)));
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)));
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)));
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)));
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)));
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)));
517 // set lights and ambient light
518 m_xCtl_Preview->GetSvx3DLightControl().Set3DAttributes(aItemSet);
520 // select light
521 for(sal_uInt32 a(0); a < 8; a++)
523 if (m_pLightSourceInfoList[a].pButton->get_active())
525 m_xCtl_Preview->GetSvx3DLightControl().SelectLight(a);
526 m_xCtl_Preview->CheckSelection();
527 break;
532 } //namespace chart
534 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */