LibreOffice Module svx (master)  1
float3d.cxx
Go to the documentation of this file.
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 <sal/config.h>
21 
22 #include <sfx2/dispatch.hxx>
23 #include <sfx2/module.hxx>
24 #include <sfx2/viewfrm.hxx>
25 #include <svl/eitem.hxx>
26 #include <svl/intitem.hxx>
27 #include <svl/itempool.hxx>
28 #include <svtools/colrdlg.hxx>
29 #include <svx/colorbox.hxx>
30 #include <svx/f3dchild.hxx>
31 #include <svx/xfillit0.hxx>
32 #include <svx/xflclit.hxx>
33 #include <svx/xlineit0.hxx>
34 #include <svx/fmmodel.hxx>
35 #include <svx/dlgutil.hxx>
36 #include <svx/sdshitm.hxx>
37 #include <svx/svx3ditems.hxx>
38 
39 #include <svx/dialmgr.hxx>
40 #include <svx/viewpt3d.hxx>
41 
42 #include <svx/svxids.hrc>
43 #include <svx/strings.hrc>
44 
45 #include <editeng/colritem.hxx>
46 #include <osl/diagnose.h>
47 #include <svx/e3ditem.hxx>
48 #include <svl/whiter.hxx>
49 #include <svtools/unitconv.hxx>
50 
51 #include <svx/float3d.hxx>
52 #include <bitmaps.hlst>
53 
54 using namespace com::sun::star;
55 
57 
59 {
61 };
62 
63 namespace {
71  SfxDispatcher* LocalGetDispatcher (const SfxBindings* pBindings)
72  {
73  SfxDispatcher* pDispatcher = nullptr;
74 
75  if (SfxViewFrame::Current() != nullptr)
76  pDispatcher = SfxViewFrame::Current()->GetDispatcher();
77  else if (pBindings != nullptr)
78  pDispatcher = pBindings->GetDispatcher();
79 
80  return pDispatcher;
81  }
82 }
83 
85  : SfxDockingWindow(pInBindings, pCW, pParent,
86  "Docking3DEffects", "svx/ui/docking3deffects.ui")
87 
88  , m_xBtnGeo(m_xBuilder->weld_toggle_button("geometry"))
89  , m_xBtnRepresentation(m_xBuilder->weld_toggle_button("representation"))
90  , m_xBtnLight(m_xBuilder->weld_toggle_button("light"))
91  , m_xBtnTexture(m_xBuilder->weld_toggle_button("texture"))
92  , m_xBtnMaterial(m_xBuilder->weld_toggle_button("material"))
93  , m_xBtnUpdate(m_xBuilder->weld_toggle_button("update"))
94  , m_xBtnAssign(m_xBuilder->weld_button("assign"))
95 
96  , m_xFLGeometrie(m_xBuilder->weld_container("geoframe"))
97  , m_xFtPercentDiagonal(m_xBuilder->weld_label("diagonalft"))
98  , m_xMtrPercentDiagonal(m_xBuilder->weld_metric_spin_button("diagonal", FieldUnit::PERCENT))
99  , m_xFtBackscale(m_xBuilder->weld_label("scaleddepthft"))
100  , m_xMtrBackscale(m_xBuilder->weld_metric_spin_button("scaleddepth", FieldUnit::PERCENT))
101  , m_xFtEndAngle(m_xBuilder->weld_label("angleft"))
102  , m_xMtrEndAngle(m_xBuilder->weld_metric_spin_button("angle", FieldUnit::DEGREE))
103  , m_xFtDepth(m_xBuilder->weld_label("depthft"))
104  , m_xMtrDepth(m_xBuilder->weld_metric_spin_button("depth", FieldUnit::CM))
105 
106  , m_xFLSegments(m_xBuilder->weld_container("segmentsframe"))
107  , m_xNumHorizontal(m_xBuilder->weld_spin_button("hori"))
108  , m_xNumVertical(m_xBuilder->weld_spin_button("veri"))
109 
110  , m_xFLNormals(m_xBuilder->weld_container("normals"))
111  , m_xBtnNormalsObj(m_xBuilder->weld_toggle_button("objspecific"))
112  , m_xBtnNormalsFlat(m_xBuilder->weld_toggle_button("flat"))
113  , m_xBtnNormalsSphere(m_xBuilder->weld_toggle_button("spherical"))
114  , m_xBtnNormalsInvert(m_xBuilder->weld_toggle_button("invertnormals"))
115  , m_xBtnTwoSidedLighting(m_xBuilder->weld_toggle_button("doublesidedillum"))
116  , m_xBtnDoubleSided(m_xBuilder->weld_toggle_button("doublesided"))
117 
118  , m_xFLRepresentation(m_xBuilder->weld_container("shadingframe"))
119  , m_xLbShademode(m_xBuilder->weld_combo_box("mode"))
120 
121  , m_xFLShadow(m_xBuilder->weld_container("shadowframe"))
122  , m_xBtnShadow3d(m_xBuilder->weld_toggle_button("shadow"))
123  , m_xFtSlant(m_xBuilder->weld_label("slantft"))
124  , m_xMtrSlant(m_xBuilder->weld_metric_spin_button("slant", FieldUnit::DEGREE))
125 
126  , m_xFLCamera(m_xBuilder->weld_container("cameraframe"))
127  , m_xMtrDistance(m_xBuilder->weld_metric_spin_button("distance", FieldUnit::CM))
128  , m_xMtrFocalLength(m_xBuilder->weld_metric_spin_button("focal", FieldUnit::CM))
129 
130  , m_xFLLight(m_xBuilder->weld_container("illumframe"))
131  , m_xBtnLight1(new LightButton(m_xBuilder->weld_toggle_button("light1")))
132  , m_xBtnLight2(new LightButton(m_xBuilder->weld_toggle_button("light2")))
133  , m_xBtnLight3(new LightButton(m_xBuilder->weld_toggle_button("light3")))
134  , m_xBtnLight4(new LightButton(m_xBuilder->weld_toggle_button("light4")))
135  , m_xBtnLight5(new LightButton(m_xBuilder->weld_toggle_button("light5")))
136  , m_xBtnLight6(new LightButton(m_xBuilder->weld_toggle_button("light6")))
137  , m_xBtnLight7(new LightButton(m_xBuilder->weld_toggle_button("light7")))
138  , m_xBtnLight8(new LightButton(m_xBuilder->weld_toggle_button("light8")))
139  , m_xLbLight1(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor1"), GetFrameWeld()))
140  , m_xLbLight2(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor2"), GetFrameWeld()))
141  , m_xLbLight3(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor3"), GetFrameWeld()))
142  , m_xLbLight4(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor4"), GetFrameWeld()))
143  , m_xLbLight5(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor5"), GetFrameWeld()))
144  , m_xLbLight6(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor6"), GetFrameWeld()))
145  , m_xLbLight7(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor7"), GetFrameWeld()))
146  , m_xLbLight8(new ColorListBox(m_xBuilder->weld_menu_button("lightcolor8"), GetFrameWeld()))
147  , m_xBtnLightColor(m_xBuilder->weld_button("colorbutton1"))
148  , m_xLbAmbientlight(new ColorListBox(m_xBuilder->weld_menu_button("ambientcolor"), GetFrameWeld()))
149  , m_xBtnAmbientColor(m_xBuilder->weld_button("colorbutton2"))
150 
151  , m_xFLTexture(m_xBuilder->weld_container("textureframe"))
152  , m_xBtnTexLuminance(m_xBuilder->weld_toggle_button("textype"))
153  , m_xBtnTexColor(m_xBuilder->weld_toggle_button("texcolor"))
154  , m_xBtnTexReplace(m_xBuilder->weld_toggle_button("texreplace"))
155  , m_xBtnTexModulate(m_xBuilder->weld_toggle_button("texmodulate"))
156  , m_xBtnTexBlend(m_xBuilder->weld_toggle_button("texblend"))
157  , m_xBtnTexObjectX(m_xBuilder->weld_toggle_button("texobjx"))
158  , m_xBtnTexParallelX(m_xBuilder->weld_toggle_button("texparallelx"))
159  , m_xBtnTexCircleX(m_xBuilder->weld_toggle_button("texcirclex"))
160  , m_xBtnTexObjectY(m_xBuilder->weld_toggle_button("texobjy"))
161  , m_xBtnTexParallelY(m_xBuilder->weld_toggle_button("texparallely"))
162  , m_xBtnTexCircleY(m_xBuilder->weld_toggle_button("texcircley"))
163  , m_xBtnTexFilter(m_xBuilder->weld_toggle_button("texfilter"))
164 
165  , m_xFLMaterial(m_xBuilder->weld_container("materialframe"))
166  , m_xLbMatFavorites(m_xBuilder->weld_combo_box("favorites"))
167  , m_xLbMatColor(new ColorListBox(m_xBuilder->weld_menu_button("objcolor"), GetFrameWeld()))
168  , m_xBtnMatColor(m_xBuilder->weld_button("colorbutton3"))
169  , m_xLbMatEmission(new ColorListBox(m_xBuilder->weld_menu_button("illumcolor"), GetFrameWeld()))
170  , m_xBtnEmissionColor(m_xBuilder->weld_button("colorbutton4"))
171 
172  , m_xFLMatSpecular(m_xBuilder->weld_container("specframe"))
173  , m_xLbMatSpecular(new ColorListBox(m_xBuilder->weld_menu_button("speccolor"), GetFrameWeld()))
174  , m_xBtnSpecularColor(m_xBuilder->weld_button("colorbutton5"))
175  , m_xMtrMatSpecularIntensity(m_xBuilder->weld_metric_spin_button("intensity", FieldUnit::PERCENT))
176 
177  , m_xCtlPreview(new Svx3DPreviewControl)
178  , m_xCtlPreviewWin(new weld::CustomWeld(*m_xBuilder, "preview", *m_xCtlPreview))
179 
180  , m_xLightPreviewGrid(m_xBuilder->weld_container("lightpreviewgrid"))
181  , m_xHoriScale(m_xBuilder->weld_scale("horiscale"))
182  , m_xVertScale(m_xBuilder->weld_scale("vertscale"))
183  , m_xBtn_Corner(m_xBuilder->weld_button("corner"))
184  , m_xLightPreview(new Svx3DLightControl)
185  , m_xCtlLightPreviewWin(new weld::CustomWeld(*m_xBuilder, "lightpreview", *m_xLightPreview))
186  , m_xCtlLightPreview(new SvxLightCtl3D(*m_xLightPreview, *m_xHoriScale, *m_xVertScale, *m_xBtn_Corner)) // TODO might be other body widget as arg 1
187 
188  , m_xBtnConvertTo3D(m_xBuilder->weld_button("to3d"))
189  , m_xBtnLatheObject(m_xBuilder->weld_button("tolathe"))
190  , m_xBtnPerspective(m_xBuilder->weld_toggle_button("perspective"))
191 
192  , bUpdate(false)
193  , eViewType(ViewType3D::Geo)
194  , pBindings(pInBindings)
195  , mpImpl(new Svx3DWinImpl)
196  , ePoolUnit(MapUnit::MapMM)
197 {
198  SetText(SvxResId(RID_SVXDLG_FLOAT3D_STR_TITLE));
199 
200  weld::DrawingArea* pDrawingArea = m_xCtlPreview->GetDrawingArea();
201  Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(83, 76), MapMode(MapUnit::MapAppFont)));
202  pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
203  m_xCtlPreview->SetOutputSizePixel(aSize);
204 
205  m_xLightPreviewGrid->set_size_request(aSize.Width(), aSize.Height());
206  pDrawingArea = m_xLightPreview->GetDrawingArea();
207  pDrawingArea->set_size_request(42, 42); // small to fit to m_xLightPreviewGrid
208 
209  mpImpl->pPool = nullptr;
210 
211  // Set Metric
212  eFUnit = pInBindings->GetDispatcher()->GetModule()->GetFieldUnit();
213 
214  m_xMtrDepth->set_unit( eFUnit );
215  m_xMtrDistance->set_unit( eFUnit );
216  m_xMtrFocalLength->set_unit( eFUnit );
217 
218  pControllerItem.reset( new Svx3DCtrlItem(SID_3D_STATE, pBindings) );
219  pConvertTo3DItem.reset( new SvxConvertTo3DItem(SID_CONVERT_TO_3D, pBindings) );
220  pConvertTo3DLatheItem.reset( new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST, pBindings) );
221 
222  m_xBtnAssign->connect_clicked( LINK( this, Svx3DWin, ClickAssignHdl ) );
223  m_xBtnUpdate->connect_clicked( LINK( this, Svx3DWin, ClickUpdateHdl ) );
224 
225  Link<weld::Button&,void> aLink( LINK( this, Svx3DWin, ClickViewTypeHdl ) );
226  m_xBtnGeo->connect_clicked( aLink );
227  m_xBtnRepresentation->connect_clicked( aLink );
228  m_xBtnLight->connect_clicked( aLink );
229  m_xBtnTexture->connect_clicked( aLink );
230  m_xBtnMaterial->connect_clicked( aLink );
231 
232  aLink = LINK( this, Svx3DWin, ClickHdl );
233  m_xBtnPerspective->connect_clicked( aLink );
234  m_xBtnConvertTo3D->connect_clicked( aLink );
235  m_xBtnLatheObject->connect_clicked( aLink );
236 
237  // Geometry
238  m_xBtnNormalsObj->connect_clicked( aLink );
239  m_xBtnNormalsFlat->connect_clicked( aLink );
240  m_xBtnNormalsSphere->connect_clicked( aLink );
241  m_xBtnTwoSidedLighting->connect_clicked( aLink );
242  m_xBtnNormalsInvert->connect_clicked( aLink );
243  m_xBtnDoubleSided->connect_clicked( aLink );
244 
245  // Representation
246  m_xBtnShadow3d->connect_clicked( aLink );
247 
248  // Lighting
249  m_xBtnLight1->connect_clicked( aLink );
250  m_xBtnLight2->connect_clicked( aLink );
251  m_xBtnLight3->connect_clicked( aLink );
252  m_xBtnLight4->connect_clicked( aLink );
253  m_xBtnLight5->connect_clicked( aLink );
254  m_xBtnLight6->connect_clicked( aLink );
255  m_xBtnLight7->connect_clicked( aLink );
256  m_xBtnLight8->connect_clicked( aLink );
257 
258  // Textures
259  m_xBtnTexLuminance->connect_clicked( aLink );
260  m_xBtnTexColor->connect_clicked( aLink );
261  m_xBtnTexReplace->connect_clicked( aLink );
262  m_xBtnTexModulate->connect_clicked( aLink );
263  m_xBtnTexParallelX->connect_clicked( aLink );
264  m_xBtnTexCircleX->connect_clicked( aLink );
265  m_xBtnTexObjectX->connect_clicked( aLink );
266  m_xBtnTexParallelY->connect_clicked( aLink );
267  m_xBtnTexCircleY->connect_clicked( aLink );
268  m_xBtnTexObjectY->connect_clicked( aLink );
269  m_xBtnTexFilter->connect_clicked( aLink );
270 
271  // Material
272  aLink = LINK( this, Svx3DWin, ClickColorHdl );
273  m_xBtnLightColor->connect_clicked( aLink );
274  m_xBtnAmbientColor->connect_clicked( aLink );
275  m_xBtnMatColor->connect_clicked( aLink );
276  m_xBtnEmissionColor->connect_clicked( aLink );
277  m_xBtnSpecularColor->connect_clicked( aLink );
278 
279 
280  Link<weld::ComboBox&,void> aLink2 = LINK( this, Svx3DWin, SelectHdl );
281  Link<ColorListBox&,void> aLink4 = LINK( this, Svx3DWin, SelectColorHdl );
282  m_xLbMatFavorites->connect_changed( aLink2 );
283  m_xLbMatColor->SetSelectHdl( aLink4 );
284  m_xLbMatEmission->SetSelectHdl( aLink4 );
285  m_xLbMatSpecular->SetSelectHdl( aLink4 );
286  m_xLbLight1->SetSelectHdl( aLink4 );
287  m_xLbLight2->SetSelectHdl( aLink4 );
288  m_xLbLight3->SetSelectHdl( aLink4 );
289  m_xLbLight4->SetSelectHdl( aLink4 );
290  m_xLbLight5->SetSelectHdl( aLink4 );
291  m_xLbLight6->SetSelectHdl( aLink4 );
292  m_xLbLight7->SetSelectHdl( aLink4 );
293  m_xLbLight8->SetSelectHdl( aLink4 );
294  m_xLbAmbientlight->SetSelectHdl( aLink4 );
295  m_xLbShademode->connect_changed( aLink2 );
296 
297  Link<weld::MetricSpinButton&,void> aLink3 = LINK( this, Svx3DWin, ModifyMetricHdl );
298  Link<weld::SpinButton&,void> aLink5 = LINK( this, Svx3DWin, ModifySpinHdl );
299  m_xMtrMatSpecularIntensity->connect_value_changed( aLink3 );
300  m_xNumHorizontal->connect_value_changed( aLink5 );
301  m_xNumVertical->connect_value_changed( aLink5 );
302  m_xMtrSlant->connect_value_changed( aLink3 );
303 
304  // Preview callback
305  m_xCtlLightPreview->SetUserSelectionChangeCallback(LINK( this, Svx3DWin, ChangeSelectionCallbackHdl ));
306 
307  aSize = GetOutputSizePixel();
308  SetMinOutputSizePixel( aSize );
309 
310  Construct();
311 
312  // Initiation of the initialization of the ColorLBs
313  SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
314  if (pDispatcher != nullptr)
315  {
316  SfxBoolItem aItem( SID_3D_INIT, true );
317  pDispatcher->ExecuteList(SID_3D_INIT,
318  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem });
319  }
320 
321  Reset();
322 
323  //lock down the size of the initial largest default mode as the permanent size
324  aSize = get_preferred_size();
325  set_width_request(aSize.Width());
326  set_height_request(aSize.Height());
327 }
328 
330 {
331  disposeOnce();
332 }
333 
335 {
336  pModel.reset();
337 
338  pControllerItem.reset();
339  pConvertTo3DItem.reset();
340  pConvertTo3DLatheItem.reset();
341 
342  mpImpl.reset();
343 
344  m_xBtnGeo.reset();
345  m_xBtnRepresentation.reset();
346  m_xBtnLight.reset();
347  m_xBtnTexture.reset();
348  m_xBtnMaterial.reset();
349  m_xBtnUpdate.reset();
350  m_xBtnAssign.reset();
351  m_xFLGeometrie.reset();
352  m_xFtPercentDiagonal.reset();
353  m_xMtrPercentDiagonal.reset();
354  m_xFtBackscale.reset();
355  m_xMtrBackscale.reset();
356  m_xFtEndAngle.reset();
357  m_xMtrEndAngle.reset();
358  m_xFtDepth.reset();
359  m_xMtrDepth.reset();
360  m_xFLSegments.reset();
361  m_xNumHorizontal.reset();
362  m_xNumVertical.reset();
363  m_xFLNormals.reset();
364  m_xBtnNormalsObj.reset();
365  m_xBtnNormalsFlat.reset();
366  m_xBtnNormalsSphere.reset();
367  m_xBtnNormalsInvert.reset();
368  m_xBtnTwoSidedLighting.reset();
369  m_xBtnDoubleSided.reset();
370  m_xFLRepresentation.reset();
371  m_xLbShademode.reset();
372  m_xFLShadow.reset();
373  m_xBtnShadow3d.reset();
374  m_xFtSlant.reset();
375  m_xMtrSlant.reset();
376  m_xFLCamera.reset();
377  m_xMtrDistance.reset();
378  m_xMtrFocalLength.reset();
379  m_xFLLight.reset();
380  m_xBtnLight1.reset();
381  m_xBtnLight2.reset();
382  m_xBtnLight3.reset();
383  m_xBtnLight4.reset();
384  m_xBtnLight5.reset();
385  m_xBtnLight6.reset();
386  m_xBtnLight7.reset();
387  m_xBtnLight8.reset();
388  m_xLbLight1.reset();
389  m_xLbLight2.reset();
390  m_xLbLight3.reset();
391  m_xLbLight4.reset();
392  m_xLbLight5.reset();
393  m_xLbLight6.reset();
394  m_xLbLight7.reset();
395  m_xLbLight8.reset();
396  m_xBtnLightColor.reset();
397  m_xLbAmbientlight.reset();
398  m_xBtnAmbientColor.reset();
399  m_xFLTexture.reset();
400  m_xBtnTexLuminance.reset();
401  m_xBtnTexColor.reset();
402  m_xBtnTexReplace.reset();
403  m_xBtnTexModulate.reset();
404  m_xBtnTexBlend.reset();
405  m_xBtnTexObjectX.reset();
406  m_xBtnTexParallelX.reset();
407  m_xBtnTexCircleX.reset();
408  m_xBtnTexObjectY.reset();
409  m_xBtnTexParallelY.reset();
410  m_xBtnTexCircleY.reset();
411  m_xBtnTexFilter.reset();
412  m_xFLMaterial.reset();
413  m_xLbMatFavorites.reset();
414  m_xLbMatColor.reset();
415  m_xBtnMatColor.reset();
416  m_xLbMatEmission.reset();
417  m_xBtnEmissionColor.reset();
418  m_xFLMatSpecular.reset();
419  m_xLbMatSpecular.reset();
420  m_xBtnSpecularColor.reset();
422  m_xCtlPreviewWin.reset();
423  m_xCtlPreview.reset();
424 
425  m_xCtlLightPreview.reset();
426  m_xCtlLightPreviewWin.reset();
427  m_xLightPreview.reset();
428  m_xBtn_Corner.reset();
429  m_xVertScale.reset();
430  m_xHoriScale.reset();
431  m_xLightPreviewGrid.reset();
432 
433  m_xBtnConvertTo3D.reset();
434  m_xBtnLatheObject.reset();
435  m_xBtnPerspective.reset();
436 
438 }
439 
441 {
442  m_xBtnGeo->set_active(true);
443  ClickViewTypeHdl(*m_xBtnGeo);
444  m_xLightPreviewGrid->hide();
445 }
446 
448 {
449  // Various initializations, default is AllAttributes
450  m_xLbShademode->set_active( 0 );
451  m_xMtrMatSpecularIntensity->set_value( 50, FieldUnit::PERCENT );
452 
453  m_xBtnLight1->set_active(true);
454  ClickUpdateHdl(*m_xBtnUpdate);
455 
456  // Select nothing, to avoid errors when selecting the first
457  m_xCtlLightPreview->GetSvx3DLightControl().SelectLight(0);
458  m_xCtlLightPreview->CheckSelection();
459 }
460 
461 void Svx3DWin::Update( SfxItemSet const & rAttrs )
462 {
463  // remember 2d attributes
465  mpRemember2DAttributes->ClearItem();
466  else
467  mpRemember2DAttributes = std::make_unique<SfxItemSet>(*rAttrs.GetPool(),
470 
472  sal_uInt16 nWhich(aIter.FirstWhich());
473 
474  while(nWhich)
475  {
476  SfxItemState eState = rAttrs.GetItemState(nWhich, false);
477  if(SfxItemState::DONTCARE == eState)
478  mpRemember2DAttributes->InvalidateItem(nWhich);
479  else if(SfxItemState::SET == eState)
480  mpRemember2DAttributes->Put(rAttrs.Get(nWhich, false));
481 
482  nWhich = aIter.NextWhich();
483  }
484 
485  // construct field values
486  const SfxPoolItem* pItem;
487 
488  // Possible determine PoolUnit
489  if( !mpImpl->pPool )
490  {
491  mpImpl->pPool = rAttrs.GetPool();
492  DBG_ASSERT( mpImpl->pPool, "Where is the Pool? ");
493  ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
494  }
495  eFUnit = GetModuleFieldUnit( rAttrs );
496 
497 
498  // Segment Number Can be changed? and other states
499  SfxItemState eState = rAttrs.GetItemState( SID_ATTR_3D_INTERN, false, &pItem );
500  if( SfxItemState::SET == eState )
501  {
502  sal_uInt32 nState = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
503  bool bExtrude = ( nState & 2 );
504  bool bSphere = ( nState & 4 );
505  bool bCube = ( nState & 8 );
506 
507  bool bChart = ( nState & 32 ); // Chart
508 
509  if( !bChart )
510  {
511  // For cube objects are no segments set
512  m_xFLSegments->set_sensitive(!bCube);
513 
514  m_xFtPercentDiagonal->set_sensitive( !bCube && !bSphere );
515  m_xMtrPercentDiagonal->set_sensitive( !bCube && !bSphere );
516  m_xFtBackscale->set_sensitive( !bCube && !bSphere );
517  m_xMtrBackscale->set_sensitive( !bCube && !bSphere );
518  m_xFtDepth->set_sensitive( !bCube && !bSphere );
519  m_xMtrDepth->set_sensitive( !bCube && !bSphere );
520  if( bCube )
521  {
522  m_xNumHorizontal->set_text("");
523  m_xNumVertical->set_text("");
524  }
525  if( bCube || bSphere )
526  {
527  m_xMtrPercentDiagonal->set_text("");
528  m_xMtrBackscale->set_text("");
529  m_xMtrDepth->set_text("");
530  }
531 
532  // There is a final angle only for Lathe objects.
533  m_xFtEndAngle->set_sensitive( !bExtrude && !bCube && !bSphere );
534  m_xMtrEndAngle->set_sensitive( !bExtrude && !bCube && !bSphere );
535  if( bExtrude || bCube || bSphere )
536  m_xMtrEndAngle->set_text("");
537  }
538  else
539  {
540  // Geometry
541  m_xNumHorizontal->set_text("");
542  m_xNumVertical->set_text("");
543  m_xFLSegments->set_sensitive( false );
544  m_xFtEndAngle->set_sensitive( false );
545  m_xMtrEndAngle->set_sensitive( false );
546  m_xMtrEndAngle->set_text("");
547  m_xFtDepth->set_sensitive( false );
548  m_xMtrDepth->set_sensitive( false );
549  m_xMtrDepth->set_text("");
550 
551  // Representation
552  m_xFLShadow->set_sensitive(false);
553 
554  m_xMtrDistance->set_text("");
555  m_xMtrFocalLength->set_text("");
556  m_xFLCamera->set_sensitive( false );
557 
558  //Lower Range
559  m_xBtnConvertTo3D->set_sensitive( false );
560  m_xBtnLatheObject->set_sensitive( false );
561  }
562  }
563  // Bitmap fill ? -> Status
564  bool bBitmap(false);
565  eState = rAttrs.GetItemState(XATTR_FILLSTYLE);
566  if(eState != SfxItemState::DONTCARE)
567  {
568  drawing::FillStyle eXFS = rAttrs.Get(XATTR_FILLSTYLE).GetValue();
569  bBitmap = (eXFS == drawing::FillStyle_BITMAP || eXFS == drawing::FillStyle_GRADIENT || eXFS == drawing::FillStyle_HATCH);
570  }
571 
572  m_xFLTexture->set_sensitive(bBitmap);
573 
574  // Geometry
575  // Number of segments (horizontal)
576  if( m_xNumHorizontal->get_sensitive() )
577  {
578  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_HORZ_SEGS);
579  if(eState != SfxItemState::DONTCARE)
580  {
581  sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DOBJ_HORZ_SEGS).GetValue();
582  if (nValue != static_cast<sal_uInt32>(m_xNumHorizontal->get_value()))
583  {
584  m_xNumHorizontal->set_value( nValue );
585  bUpdate = true;
586  }
587  else if( m_xNumHorizontal->get_text().isEmpty() )
588  m_xNumHorizontal->set_value( nValue );
589  }
590  else
591  {
592  if( !m_xNumHorizontal->get_text().isEmpty() )
593  {
594  m_xNumHorizontal->set_text("");
595  bUpdate = true;
596  }
597  }
598  }
599 
600  //Number of segments (vertical)
601  if( m_xNumVertical->get_sensitive() )
602  {
603  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_VERT_SEGS);
604  if( eState != SfxItemState::DONTCARE )
605  {
606  sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DOBJ_VERT_SEGS).GetValue();
607  if( nValue != static_cast<sal_uInt32>(m_xNumVertical->get_value()) )
608  {
609  m_xNumVertical->set_value( nValue );
610  bUpdate = true;
611  }
612  else if( m_xNumVertical->get_text().isEmpty() )
613  m_xNumVertical->set_value( nValue );
614  }
615  else
616  {
617  if( !m_xNumVertical->get_text().isEmpty() )
618  {
619  m_xNumVertical->set_text("");
620  bUpdate = true;
621  }
622  }
623  }
624 
625  // Depth
626  if( m_xMtrDepth->get_sensitive() )
627  {
628  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DEPTH);
629  if( eState != SfxItemState::DONTCARE )
630  {
631  sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DOBJ_DEPTH).GetValue();
632  sal_uInt32 nValue2 = GetCoreValue(*m_xMtrDepth, ePoolUnit);
633  if( nValue != nValue2 )
634  {
635  if( eFUnit != m_xMtrDepth->get_unit() )
637 
639  bUpdate = true;
640  }
641  else if( m_xMtrDepth->get_text().isEmpty() )
642  m_xMtrDepth->set_value(m_xMtrDepth->get_value(FieldUnit::NONE), FieldUnit::NONE);
643  }
644  else
645  {
646  if( !m_xMtrDepth->get_text().isEmpty() )
647  {
648  m_xMtrDepth->set_text("");
649  bUpdate = true;
650  }
651  }
652  }
653 
654  // Double walled / Double sided
655  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_DOUBLE_SIDED);
656  if( eState != SfxItemState::DONTCARE )
657  {
658  bool bValue = rAttrs.Get(SDRATTR_3DOBJ_DOUBLE_SIDED).GetValue();
659  if( bValue != m_xBtnDoubleSided->get_active() )
660  {
661  m_xBtnDoubleSided->set_active( bValue );
662  bUpdate = true;
663  }
664  else if( m_xBtnDoubleSided->get_state() == TRISTATE_INDET )
665  m_xBtnDoubleSided->set_active( bValue );
666  }
667  else
668  {
669  if( m_xBtnDoubleSided->get_state() != TRISTATE_INDET )
670  {
671  m_xBtnDoubleSided->set_state( TRISTATE_INDET );
672  bUpdate = true;
673  }
674  }
675 
676  // Edge rounding
677  if( m_xMtrPercentDiagonal->get_sensitive() )
678  {
680  if( eState != SfxItemState::DONTCARE )
681  {
682  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL).GetValue();
683  if( nValue != m_xMtrPercentDiagonal->get_value(FieldUnit::PERCENT) )
684  {
685  m_xMtrPercentDiagonal->set_value(nValue, FieldUnit::PERCENT);
686  bUpdate = true;
687  }
688  else if( m_xMtrPercentDiagonal->get_text().isEmpty() )
689  m_xMtrPercentDiagonal->set_value(nValue, FieldUnit::PERCENT);
690  }
691  else
692  {
693  if( !m_xMtrPercentDiagonal->get_text().isEmpty() )
694  {
695  m_xMtrPercentDiagonal->set_text("");
696  bUpdate = true;
697  }
698  }
699  }
700 
701  // Depth scaling
702  if( m_xMtrBackscale->get_sensitive() )
703  {
704  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_BACKSCALE);
705  if( eState != SfxItemState::DONTCARE )
706  {
707  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_BACKSCALE).GetValue();
708  if( nValue != m_xMtrBackscale->get_value(FieldUnit::PERCENT) )
709  {
710  m_xMtrBackscale->set_value(nValue, FieldUnit::PERCENT);
711  bUpdate = true;
712  }
713  else if( m_xMtrBackscale->get_text().isEmpty() )
714  m_xMtrBackscale->set_value(nValue, FieldUnit::PERCENT);
715  }
716  else
717  {
718  if( !m_xMtrBackscale->get_text().isEmpty() )
719  {
720  m_xMtrBackscale->set_text("");
721  bUpdate = true;
722  }
723  }
724  }
725 
726  // End angle
727  if( m_xMtrEndAngle->get_sensitive() )
728  {
729  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_END_ANGLE);
730  if( eState != SfxItemState::DONTCARE )
731  {
732  sal_Int32 nValue = rAttrs.Get(SDRATTR_3DOBJ_END_ANGLE).GetValue();
733  if( nValue != m_xMtrEndAngle->get_value(FieldUnit::DEGREE) )
734  {
735  m_xMtrEndAngle->set_value(nValue, FieldUnit::DEGREE);
736  bUpdate = true;
737  }
738  }
739  else
740  {
741  if( !m_xMtrEndAngle->get_text().isEmpty() )
742  {
743  m_xMtrEndAngle->set_text("");
744  bUpdate = true;
745  }
746  }
747  }
748 
749  // Normal type
750  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_NORMALS_KIND);
751  if( eState != SfxItemState::DONTCARE )
752  {
753  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_NORMALS_KIND).GetValue();
754 
755  if( ( !m_xBtnNormalsObj->get_active() && nValue == 0 ) ||
756  ( !m_xBtnNormalsFlat->get_active() && nValue == 1 ) ||
757  ( !m_xBtnNormalsSphere->get_active() && nValue == 2 ) )
758  {
759  m_xBtnNormalsObj->set_active( nValue == 0 );
760  m_xBtnNormalsFlat->set_active( nValue == 1 );
761  m_xBtnNormalsSphere->set_active( nValue == 2 );
762  bUpdate = true;
763  }
764  }
765  else
766  {
767  if( m_xBtnNormalsObj->get_active() ||
768  m_xBtnNormalsFlat->get_active() ||
769  m_xBtnNormalsSphere->get_active() )
770  {
771  m_xBtnNormalsObj->set_active( false );
772  m_xBtnNormalsFlat->set_active( false );
773  m_xBtnNormalsSphere->set_active( false );
774  bUpdate = true;
775  }
776  }
777 
778  // Normal inverted
780  if( eState != SfxItemState::DONTCARE )
781  {
782  bool bValue = rAttrs.Get(SDRATTR_3DOBJ_NORMALS_INVERT).GetValue();
783  if( bValue != m_xBtnNormalsInvert->get_active() )
784  {
785  m_xBtnNormalsInvert->set_active( bValue );
786  bUpdate = true;
787  }
788  else if( m_xBtnNormalsInvert->get_state() == TRISTATE_INDET )
789  m_xBtnNormalsInvert->set_active( bValue );
790  }
791  else
792  {
793  if( m_xBtnNormalsInvert->get_state() != TRISTATE_INDET )
794  {
795  m_xBtnNormalsInvert->set_state( TRISTATE_INDET );
796  bUpdate = true;
797  }
798  }
799 
800  // 2-sided lighting
802  if( eState != SfxItemState::DONTCARE )
803  {
804  bool bValue = rAttrs.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING).GetValue();
805  if( bValue != m_xBtnTwoSidedLighting->get_active() )
806  {
807  m_xBtnTwoSidedLighting->set_active( bValue );
808  bUpdate = true;
809  }
810  else if( m_xBtnTwoSidedLighting->get_state() == TRISTATE_INDET )
811  m_xBtnTwoSidedLighting->set_active( bValue );
812  }
813  else
814  {
815  if( m_xBtnTwoSidedLighting->get_state() != TRISTATE_INDET )
816  {
818  bUpdate = true;
819  }
820  }
821 
822  // Representation
823  // Shademode
824  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_SHADE_MODE);
825  if( eState != SfxItemState::DONTCARE )
826  {
827  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DSCENE_SHADE_MODE).GetValue();
828  if( nValue != m_xLbShademode->get_active() )
829  {
830  m_xLbShademode->set_active( nValue );
831  bUpdate = true;
832  }
833  }
834  else
835  {
836  if( m_xLbShademode->get_active() != 0 )
837  {
838  m_xLbShademode->set_active(-1);
839  bUpdate = true;
840  }
841  }
842 
843  // 3D-Shadow
844  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_SHADOW_3D);
845  if( eState != SfxItemState::DONTCARE )
846  {
847  bool bValue = rAttrs.Get(SDRATTR_3DOBJ_SHADOW_3D).GetValue();
848  if( bValue != m_xBtnShadow3d->get_active() )
849  {
850  m_xBtnShadow3d->set_active( bValue );
851  m_xFtSlant->set_sensitive( bValue );
852  m_xMtrSlant->set_sensitive( bValue );
853  bUpdate = true;
854  }
855  else if( m_xBtnShadow3d->get_state() == TRISTATE_INDET )
856  m_xBtnShadow3d->set_active( bValue );
857  }
858  else
859  {
860  if( m_xBtnShadow3d->get_state() != TRISTATE_INDET )
861  {
862  m_xBtnShadow3d->set_state( TRISTATE_INDET );
863  bUpdate = true;
864  }
865  }
866 
867  // Inclination (Shadow)
869  if( eState != SfxItemState::DONTCARE )
870  {
871  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DSCENE_SHADOW_SLANT).GetValue();
872  if( nValue != m_xMtrSlant->get_value(FieldUnit::DEGREE) )
873  {
874  m_xMtrSlant->set_value(nValue, FieldUnit::DEGREE);
875  bUpdate = true;
876  }
877  }
878  else
879  {
880  if( !m_xMtrSlant->get_text().isEmpty() )
881  {
882  m_xMtrSlant->set_text("");
883  bUpdate = true;
884  }
885  }
886 
887  // Distance
888  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_DISTANCE);
889  if( eState != SfxItemState::DONTCARE )
890  {
891  sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DSCENE_DISTANCE).GetValue();
892  sal_uInt32 nValue2 = GetCoreValue(*m_xMtrDistance, ePoolUnit);
893  if( nValue != nValue2 )
894  {
895  if( eFUnit != m_xMtrDistance->get_unit() )
897 
899  bUpdate = true;
900  }
901  }
902  else
903  {
904  if( !m_xMtrDepth->get_text().isEmpty() )
905  {
906  m_xMtrDepth->set_text("");
907  bUpdate = true;
908  }
909  }
910 
911  // Focal length
913  if( eState != SfxItemState::DONTCARE )
914  {
915  sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue();
916  sal_uInt32 nValue2 = GetCoreValue(*m_xMtrFocalLength, ePoolUnit);
917  if( nValue != nValue2 )
918  {
919  if( eFUnit != m_xMtrFocalLength->get_unit() )
921 
923  bUpdate = true;
924  }
925  }
926  else
927  {
928  if( !m_xMtrFocalLength->get_text().isEmpty() )
929  {
930  m_xMtrFocalLength->set_text("");
931  bUpdate = true;
932  }
933  }
934 
935 // Lighting
936  Color aColor;
937  // Light 1 (Color)
939  if( eState != SfxItemState::DONTCARE )
940  {
941  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
942  ColorListBox* pLb = m_xLbLight1.get();
943  if( aColor != pLb->GetSelectEntryColor() )
944  {
945  LBSelectColor( pLb, aColor );
946  bUpdate = true;
947  }
948  }
949  else
950  {
951  if (!m_xLbLight1->IsNoSelection())
952  {
953  m_xLbLight1->SetNoSelection();
954  bUpdate = true;
955  }
956  }
957  // Light 1 (on/off)
958  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_1);
959  if( eState != SfxItemState::DONTCARE )
960  {
961  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
962  if (bOn != m_xBtnLight1->isLightOn())
963  {
964  m_xBtnLight1->switchLightOn(bOn);
965  bUpdate = true;
966  }
967  if( m_xBtnLight1->get_state() == TRISTATE_INDET )
968  m_xBtnLight1->set_active( m_xBtnLight1->get_active() );
969  }
970  else
971  {
972  if( m_xBtnLight1->get_state() != TRISTATE_INDET )
973  {
974  m_xBtnLight1->set_state( TRISTATE_INDET );
975  bUpdate = true;
976  }
977  }
978  // Light 1 (direction)
980  if( eState != SfxItemState::DONTCARE )
981  {
982  bUpdate = true;
983  }
984 
985  //Light 2 (color)
987  if( eState != SfxItemState::DONTCARE )
988  {
989  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
990  ColorListBox* pLb = m_xLbLight2.get();
991  if( aColor != pLb->GetSelectEntryColor() )
992  {
993  LBSelectColor( pLb, aColor );
994  bUpdate = true;
995  }
996  }
997  else
998  {
999  if (!m_xLbLight2->IsNoSelection())
1000  {
1001  m_xLbLight2->SetNoSelection();
1002  bUpdate = true;
1003  }
1004  }
1005  // Light 2 (on/off)
1006  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_2);
1007  if( eState != SfxItemState::DONTCARE )
1008  {
1009  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
1010  if (bOn != m_xBtnLight2->isLightOn())
1011  {
1012  m_xBtnLight2->switchLightOn(bOn);
1013  bUpdate = true;
1014  }
1015  if( m_xBtnLight2->get_state() == TRISTATE_INDET )
1016  m_xBtnLight2->set_active( m_xBtnLight2->get_active() );
1017  }
1018  else
1019  {
1020  if( m_xBtnLight2->get_state() != TRISTATE_INDET )
1021  {
1022  m_xBtnLight2->set_state( TRISTATE_INDET );
1023  bUpdate = true;
1024  }
1025  }
1026  //Light 2 (Direction)
1028  if( eState != SfxItemState::DONTCARE )
1029  {
1030  bUpdate = true;
1031  }
1032 
1033  //Light 3 (color)
1034  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_3);
1035  if( eState != SfxItemState::DONTCARE )
1036  {
1037  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
1038  ColorListBox* pLb = m_xLbLight3.get();
1039  if( aColor != pLb->GetSelectEntryColor() )
1040  {
1041  LBSelectColor( pLb, aColor );
1042  bUpdate = true;
1043  }
1044  }
1045  else
1046  {
1047  if (!m_xLbLight3->IsNoSelection())
1048  {
1049  m_xLbLight3->SetNoSelection();
1050  bUpdate = true;
1051  }
1052  }
1053  // Light 3 (on/off)
1054  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_3);
1055  if( eState != SfxItemState::DONTCARE )
1056  {
1057  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
1058  if (bOn != m_xBtnLight3->isLightOn())
1059  {
1060  m_xBtnLight3->switchLightOn(bOn);
1061  bUpdate = true;
1062  }
1063  if( m_xBtnLight3->get_state() == TRISTATE_INDET )
1064  m_xBtnLight3->set_active( m_xBtnLight3->get_active() );
1065  }
1066  else
1067  {
1068  if( m_xBtnLight3->get_state() != TRISTATE_INDET )
1069  {
1070  m_xBtnLight3->set_state( TRISTATE_INDET );
1071  bUpdate = true;
1072  }
1073  }
1074  // Light 3 (Direction)
1076  if( eState != SfxItemState::DONTCARE )
1077  {
1078  bUpdate = true;
1079  }
1080 
1081  // Light 4 (Color)
1082  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_4);
1083  if( eState != SfxItemState::DONTCARE )
1084  {
1085  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
1086  ColorListBox* pLb = m_xLbLight4.get();
1087  if( aColor != pLb->GetSelectEntryColor() )
1088  {
1089  LBSelectColor( pLb, aColor );
1090  bUpdate = true;
1091  }
1092  }
1093  else
1094  {
1095  if (!m_xLbLight4->IsNoSelection())
1096  {
1097  m_xLbLight4->SetNoSelection();
1098  bUpdate = true;
1099  }
1100  }
1101  // Light 4 (on/off)
1102  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_4);
1103  if( eState != SfxItemState::DONTCARE )
1104  {
1105  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
1106  if (bOn != m_xBtnLight4->isLightOn())
1107  {
1108  m_xBtnLight4->switchLightOn(bOn);
1109  bUpdate = true;
1110  }
1111  if( m_xBtnLight4->get_state() == TRISTATE_INDET )
1112  m_xBtnLight4->set_active( m_xBtnLight4->get_active() );
1113  }
1114  else
1115  {
1116  if( m_xBtnLight4->get_state() != TRISTATE_INDET )
1117  {
1118  m_xBtnLight4->set_state( TRISTATE_INDET );
1119  bUpdate = true;
1120  }
1121  }
1122  // Light 4 (direction)
1124  if( eState != SfxItemState::DONTCARE )
1125  {
1126  bUpdate = true;
1127  }
1128 
1129  // Light 5 (color)
1130  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_5);
1131  if( eState != SfxItemState::DONTCARE )
1132  {
1133  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
1134  ColorListBox* pLb = m_xLbLight5.get();
1135  if( aColor != pLb->GetSelectEntryColor() )
1136  {
1137  LBSelectColor( pLb, aColor );
1138  bUpdate = true;
1139  }
1140  }
1141  else
1142  {
1143  if (!m_xLbLight5->IsNoSelection())
1144  {
1145  m_xLbLight5->SetNoSelection();
1146  bUpdate = true;
1147  }
1148  }
1149  // Light 5 (on/off)
1150  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_5);
1151  if( eState != SfxItemState::DONTCARE )
1152  {
1153  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
1154  if (bOn != m_xBtnLight5->isLightOn())
1155  {
1156  m_xBtnLight5->switchLightOn(bOn);
1157  bUpdate = true;
1158  }
1159  if( m_xBtnLight5->get_state() == TRISTATE_INDET )
1160  m_xBtnLight5->set_active( m_xBtnLight5->get_active() );
1161  }
1162  else
1163  {
1164  if( m_xBtnLight5->get_state() != TRISTATE_INDET )
1165  {
1166  m_xBtnLight5->set_state( TRISTATE_INDET );
1167  bUpdate = true;
1168  }
1169  }
1170  // Light 5 (direction)
1172  if( eState != SfxItemState::DONTCARE )
1173  {
1174  bUpdate = true;
1175  }
1176 
1177  // Light 6 (color)
1178  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_6);
1179  if( eState != SfxItemState::DONTCARE )
1180  {
1181  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
1182  ColorListBox* pLb = m_xLbLight6.get();
1183  if( aColor != pLb->GetSelectEntryColor() )
1184  {
1185  LBSelectColor( pLb, aColor );
1186  bUpdate = true;
1187  }
1188  }
1189  else
1190  {
1191  if (!m_xLbLight6->IsNoSelection())
1192  {
1193  m_xLbLight6->SetNoSelection();
1194  bUpdate = true;
1195  }
1196  }
1197  // Light 6 (on/off)
1198  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_6);
1199  if( eState != SfxItemState::DONTCARE )
1200  {
1201  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
1202  if (bOn != m_xBtnLight6->isLightOn())
1203  {
1204  m_xBtnLight6->switchLightOn(bOn);
1205  bUpdate = true;
1206  }
1207  if( m_xBtnLight6->get_state() == TRISTATE_INDET )
1208  m_xBtnLight6->set_active( m_xBtnLight6->get_active() );
1209  }
1210  else
1211  {
1212  if( m_xBtnLight6->get_state() != TRISTATE_INDET )
1213  {
1214  m_xBtnLight6->set_state( TRISTATE_INDET );
1215  bUpdate = true;
1216  }
1217  }
1218  // Light 6 (direction)
1220  if( eState != SfxItemState::DONTCARE )
1221  {
1222  bUpdate = true;
1223  }
1224 
1225  // Light 7 (color)
1226  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_7);
1227  if( eState != SfxItemState::DONTCARE )
1228  {
1229  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
1230  ColorListBox* pLb = m_xLbLight7.get();
1231  if( aColor != pLb->GetSelectEntryColor() )
1232  {
1233  LBSelectColor( pLb, aColor );
1234  bUpdate = true;
1235  }
1236  }
1237  else
1238  {
1239  if (!m_xLbLight7->IsNoSelection())
1240  {
1241  m_xLbLight7->SetNoSelection();
1242  bUpdate = true;
1243  }
1244  }
1245  // Light 7 (on/off)
1246  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_7);
1247  if( eState != SfxItemState::DONTCARE )
1248  {
1249  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
1250  if (bOn != m_xBtnLight7->isLightOn())
1251  {
1252  m_xBtnLight7->switchLightOn(bOn);
1253  bUpdate = true;
1254  }
1255  if( m_xBtnLight7->get_state() == TRISTATE_INDET )
1256  m_xBtnLight7->set_active( m_xBtnLight7->get_active() );
1257  }
1258  else
1259  {
1260  if( m_xBtnLight7->get_state() != TRISTATE_INDET )
1261  {
1262  m_xBtnLight7->set_state( TRISTATE_INDET );
1263  bUpdate = true;
1264  }
1265  }
1266  // Light 7 (direction)
1268  if( eState != SfxItemState::DONTCARE )
1269  {
1270  bUpdate = true;
1271  }
1272 
1273  // Light 8 (color)
1274  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTCOLOR_8);
1275  if( eState != SfxItemState::DONTCARE )
1276  {
1277  aColor = rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
1278  ColorListBox* pLb = m_xLbLight8.get();
1279  if( aColor != pLb->GetSelectEntryColor() )
1280  {
1281  LBSelectColor( pLb, aColor );
1282  bUpdate = true;
1283  }
1284  }
1285  else
1286  {
1287  if (!m_xLbLight8->IsNoSelection())
1288  {
1289  m_xLbLight8->SetNoSelection();
1290  bUpdate = true;
1291  }
1292  }
1293  // Light 8 (on/off)
1294  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_LIGHTON_8);
1295  if( eState != SfxItemState::DONTCARE )
1296  {
1297  bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
1298  if (bOn != m_xBtnLight8->isLightOn())
1299  {
1300  m_xBtnLight8->switchLightOn(bOn);
1301  bUpdate = true;
1302  }
1303  if( m_xBtnLight8->get_state() == TRISTATE_INDET )
1304  m_xBtnLight8->set_active( m_xBtnLight8->get_active() );
1305  }
1306  else
1307  {
1308  if( m_xBtnLight8->get_state() != TRISTATE_INDET )
1309  {
1310  m_xBtnLight8->set_state( TRISTATE_INDET );
1311  bUpdate = true;
1312  }
1313  }
1314  // Light 8 (direction)
1316  if( eState != SfxItemState::DONTCARE )
1317  {
1318  bUpdate = true;
1319  }
1320 
1321  // Ambient light
1322  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_AMBIENTCOLOR);
1323  if( eState != SfxItemState::DONTCARE )
1324  {
1325  aColor = rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR).GetValue();
1326  ColorListBox* pLb = m_xLbAmbientlight.get();
1327  if( aColor != pLb->GetSelectEntryColor() )
1328  {
1329  LBSelectColor( pLb, aColor );
1330  bUpdate = true;
1331  }
1332  }
1333  else
1334  {
1335  if (!m_xLbAmbientlight->IsNoSelection())
1336  {
1337  m_xLbAmbientlight->SetNoSelection();
1338  bUpdate = true;
1339  }
1340  }
1341 
1342 
1343 // Textures
1344  // Art
1345  if( bBitmap )
1346  {
1347  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_KIND);
1348  if( eState != SfxItemState::DONTCARE )
1349  {
1350  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_KIND).GetValue();
1351 
1352  if( ( !m_xBtnTexLuminance->get_active() && nValue == 1 ) ||
1353  ( !m_xBtnTexColor->get_active() && nValue == 3 ) )
1354  {
1355  m_xBtnTexLuminance->set_active( nValue == 1 );
1356  m_xBtnTexColor->set_active( nValue == 3 );
1357  bUpdate = true;
1358  }
1359  }
1360  else
1361  {
1362  if( m_xBtnTexLuminance->get_active() ||
1363  m_xBtnTexColor->get_active() )
1364  {
1365  m_xBtnTexLuminance->set_active( false );
1366  m_xBtnTexColor->set_active( false );
1367  bUpdate = true;
1368  }
1369  }
1370 
1371  // Mode
1372  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_MODE);
1373  if( eState != SfxItemState::DONTCARE )
1374  {
1375  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_MODE).GetValue();
1376 
1377  if( ( !m_xBtnTexReplace->get_active() && nValue == 1 ) ||
1378  ( !m_xBtnTexModulate->get_active() && nValue == 2 ) )
1379  {
1380  m_xBtnTexReplace->set_active( nValue == 1 );
1381  m_xBtnTexModulate->set_active( nValue == 2 );
1382  bUpdate = true;
1383  }
1384  }
1385  else
1386  {
1387  if( m_xBtnTexReplace->get_active() ||
1388  m_xBtnTexModulate->get_active() )
1389  {
1390  m_xBtnTexReplace->set_active( false );
1391  m_xBtnTexModulate->set_active( false );
1392  bUpdate = true;
1393  }
1394  }
1395 
1396  // Projection X
1397  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_X);
1398  if( eState != SfxItemState::DONTCARE )
1399  {
1400  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_X).GetValue();
1401 
1402  if( ( !m_xBtnTexObjectX->get_active() && nValue == 0 ) ||
1403  ( !m_xBtnTexParallelX->get_active() && nValue == 1 ) ||
1404  ( !m_xBtnTexCircleX->get_active() && nValue == 2 ) )
1405  {
1406  m_xBtnTexObjectX->set_active( nValue == 0 );
1407  m_xBtnTexParallelX->set_active( nValue == 1 );
1408  m_xBtnTexCircleX->set_active( nValue == 2 );
1409  bUpdate = true;
1410  }
1411  }
1412  else
1413  {
1414  if( m_xBtnTexObjectX->get_active() ||
1415  m_xBtnTexParallelX->get_active() ||
1416  m_xBtnTexCircleX->get_active() )
1417  {
1418  m_xBtnTexObjectX->set_active( false );
1419  m_xBtnTexParallelX->set_active( false );
1420  m_xBtnTexCircleX->set_active( false );
1421  bUpdate = true;
1422  }
1423  }
1424 
1425  // Projection Y
1426  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_PROJ_Y);
1427  if( eState != SfxItemState::DONTCARE )
1428  {
1429  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_PROJ_Y).GetValue();
1430 
1431  if( ( !m_xBtnTexObjectY->get_active() && nValue == 0 ) ||
1432  ( !m_xBtnTexParallelY->get_active() && nValue == 1 ) ||
1433  ( !m_xBtnTexCircleY->get_active() && nValue == 2 ) )
1434  {
1435  m_xBtnTexObjectY->set_active( nValue == 0 );
1436  m_xBtnTexParallelY->set_active( nValue == 1 );
1437  m_xBtnTexCircleY->set_active( nValue == 2 );
1438  bUpdate = true;
1439  }
1440  }
1441  else
1442  {
1443  if( m_xBtnTexObjectY->get_active() ||
1444  m_xBtnTexParallelY->get_active() ||
1445  m_xBtnTexCircleY->get_active() )
1446  {
1447  m_xBtnTexObjectY->set_active( false );
1448  m_xBtnTexParallelY->set_active( false );
1449  m_xBtnTexCircleY->set_active( false );
1450  bUpdate = true;
1451  }
1452  }
1453 
1454  // Filter
1455  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_TEXTURE_FILTER);
1456  if( eState != SfxItemState::DONTCARE )
1457  {
1458  bool bValue = rAttrs.Get(SDRATTR_3DOBJ_TEXTURE_FILTER).GetValue();
1459  if( bValue != m_xBtnTexFilter->get_active() )
1460  {
1461  m_xBtnTexFilter->set_active( bValue );
1462  bUpdate = true;
1463  }
1464  if( m_xBtnTexFilter->get_state() == TRISTATE_INDET )
1465  m_xBtnTexFilter->set_active( bValue );
1466  }
1467  else
1468  {
1469  if( m_xBtnTexFilter->get_state() != TRISTATE_INDET )
1470  {
1471  m_xBtnTexFilter->set_state( TRISTATE_INDET );
1472  bUpdate = true;
1473  }
1474  }
1475  }
1476 
1477 
1478  // Material Favorites
1479  m_xLbMatFavorites->set_active( 0 );
1480 
1481  // Object color
1482  eState = rAttrs.GetItemState(XATTR_FILLCOLOR);
1483  if( eState != SfxItemState::DONTCARE )
1484  {
1485  aColor = rAttrs.Get(XATTR_FILLCOLOR).GetColorValue();
1486  ColorListBox* pLb = m_xLbMatColor.get();
1487  if( aColor != pLb->GetSelectEntryColor() )
1488  {
1489  LBSelectColor( pLb, aColor );
1490  bUpdate = true;
1491  }
1492  }
1493  else
1494  {
1495  if (!m_xLbMatColor->IsNoSelection())
1496  {
1497  m_xLbMatColor->SetNoSelection();
1498  bUpdate = true;
1499  }
1500  }
1501 
1502  // Self-luminous color
1503  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_EMISSION);
1504  if( eState != SfxItemState::DONTCARE )
1505  {
1506  aColor = rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION).GetValue();
1507  ColorListBox* pLb = m_xLbMatEmission.get();
1508  if( aColor != pLb->GetSelectEntryColor() )
1509  {
1510  LBSelectColor( pLb, aColor );
1511  bUpdate = true;
1512  }
1513  }
1514  else
1515  {
1516  if (!m_xLbMatEmission->IsNoSelection())
1517  {
1518  m_xLbMatEmission->SetNoSelection();
1519  bUpdate = true;
1520  }
1521  }
1522 
1523  // Specular
1524  eState = rAttrs.GetItemState(SDRATTR_3DOBJ_MAT_SPECULAR);
1525  if( eState != SfxItemState::DONTCARE )
1526  {
1527  aColor = rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR).GetValue();
1528  ColorListBox* pLb = m_xLbMatSpecular.get();
1529  if( aColor != pLb->GetSelectEntryColor() )
1530  {
1531  LBSelectColor( pLb, aColor );
1532  bUpdate = true;
1533  }
1534  }
1535  else
1536  {
1537  if (!m_xLbMatSpecular->IsNoSelection())
1538  {
1539  m_xLbMatSpecular->SetNoSelection();
1540  bUpdate = true;
1541  }
1542  }
1543 
1544  // Specular Intensity
1546  if( eState != SfxItemState::DONTCARE )
1547  {
1548  sal_uInt16 nValue = rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY).GetValue();
1549  if( nValue != m_xMtrMatSpecularIntensity->get_value(FieldUnit::PERCENT) )
1550  {
1551  m_xMtrMatSpecularIntensity->set_value(nValue, FieldUnit::PERCENT);
1552  bUpdate = true;
1553  }
1554  }
1555  else
1556  {
1557  if( !m_xMtrMatSpecularIntensity->get_text().isEmpty() )
1558  {
1559  m_xMtrMatSpecularIntensity->set_text("");
1560  bUpdate = true;
1561  }
1562  }
1563 
1564 
1565 // Other
1566  // Perspective
1567  eState = rAttrs.GetItemState(SDRATTR_3DSCENE_PERSPECTIVE);
1568  if( eState != SfxItemState::DONTCARE )
1569  {
1570  ProjectionType ePT = static_cast<ProjectionType>(rAttrs.Get(SDRATTR_3DSCENE_PERSPECTIVE).GetValue());
1571  if( ( !m_xBtnPerspective->get_active() && ePT == ProjectionType::Perspective ) ||
1572  ( m_xBtnPerspective->get_active() && ePT == ProjectionType::Parallel ) )
1573  {
1574  m_xBtnPerspective->set_active( ePT == ProjectionType::Perspective );
1575  bUpdate = true;
1576  }
1577  if( m_xBtnPerspective->get_state() == TRISTATE_INDET )
1578  m_xBtnPerspective->set_active( ePT == ProjectionType::Perspective );
1579  }
1580  else
1581  {
1582  if( m_xBtnPerspective->get_state() != TRISTATE_INDET )
1583  {
1584  m_xBtnPerspective->set_state( TRISTATE_INDET );
1585  bUpdate = true;
1586  }
1587  }
1588 
1589  if( !bUpdate )
1590  {
1591  // however the 2D attributes may be different. Compare these and decide
1592 
1593  bUpdate = true;
1594  }
1595 
1596  // Update preview
1597  SfxItemSet aSet(rAttrs);
1598 
1599  // set LineStyle hard to drawing::LineStyle_NONE when it's not set so that
1600  // the default (drawing::LineStyle_SOLID) is not used for 3d preview
1601  if(SfxItemState::SET != aSet.GetItemState(XATTR_LINESTYLE, false))
1602  aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
1603 
1604  // set FillColor hard to WHITE when it's SfxItemState::DONTCARE so that
1605  // the default (Blue7) is not used for 3d preview
1606  if(SfxItemState::DONTCARE == aSet.GetItemState(XATTR_FILLCOLOR, false))
1607  aSet.Put(XFillColorItem(OUString(), COL_WHITE));
1608 
1609  m_xCtlPreview->Set3DAttributes(aSet);
1610  m_xCtlLightPreview->GetSvx3DLightControl().Set3DAttributes(aSet);
1611 
1612  // try to select light corresponding to active button
1613  sal_uInt32 nNumber(0xffffffff);
1614 
1615  if(m_xBtnLight1->get_active())
1616  nNumber = 0;
1617  else if(m_xBtnLight2->get_active())
1618  nNumber = 1;
1619  else if(m_xBtnLight3->get_active())
1620  nNumber = 2;
1621  else if(m_xBtnLight4->get_active())
1622  nNumber = 3;
1623  else if(m_xBtnLight5->get_active())
1624  nNumber = 4;
1625  else if(m_xBtnLight6->get_active())
1626  nNumber = 5;
1627  else if(m_xBtnLight7->get_active())
1628  nNumber = 6;
1629  else if(m_xBtnLight8->get_active())
1630  nNumber = 7;
1631 
1632  if(nNumber != 0xffffffff)
1633  {
1634  m_xCtlLightPreview->GetSvx3DLightControl().SelectLight(nNumber);
1635  }
1636 
1637  // handle state of converts possible
1638  m_xBtnConvertTo3D->set_sensitive(pConvertTo3DItem->GetState());
1639  m_xBtnLatheObject->set_sensitive(pConvertTo3DLatheItem->GetState());
1640 }
1641 
1642 
1644 {
1645  // get remembered 2d attributes from the dialog
1647  {
1649  sal_uInt16 nWhich(aIter.FirstWhich());
1650 
1651  while(nWhich)
1652  {
1653  SfxItemState eState = mpRemember2DAttributes->GetItemState(nWhich, false);
1654  if(SfxItemState::DONTCARE == eState)
1655  rAttrs.InvalidateItem(nWhich);
1656  else if(SfxItemState::SET == eState)
1657  rAttrs.Put(mpRemember2DAttributes->Get(nWhich, false));
1658 
1659  nWhich = aIter.NextWhich();
1660  }
1661  }
1662 
1663 //Others must stand as the front on all sides
1664  // Perspective
1665  if( m_xBtnPerspective->get_state() != TRISTATE_INDET )
1666  {
1668  if( m_xBtnPerspective->get_active() )
1669  nValue = ProjectionType::Perspective;
1670  else
1671  nValue = ProjectionType::Parallel;
1672  rAttrs.Put(Svx3DPerspectiveItem(nValue));
1673  }
1674  else
1676 
1677 // Geometry
1678  // Possible determine PoolUnit (in this case this has not happened in Update() )
1679  if( !mpImpl->pPool )
1680  {
1681  OSL_FAIL( "No Pool in GetAttr()! May be incompatible to drviewsi.cxx ?" );
1682  mpImpl->pPool = rAttrs.GetPool();
1683  DBG_ASSERT( mpImpl->pPool, "Where is the Pool?" );
1684  ePoolUnit = mpImpl->pPool->GetMetric( SID_ATTR_LINE_WIDTH );
1685 
1686  eFUnit = GetModuleFieldUnit( rAttrs );
1687  }
1688 
1689  // Number of segments (horizontal)
1690  if( !m_xNumHorizontal->get_text().isEmpty() )
1691  {
1692  sal_uInt32 nValue = static_cast<sal_uInt32>(m_xNumHorizontal->get_value());
1693  rAttrs.Put(makeSvx3DHorizontalSegmentsItem(nValue));
1694  }
1695  else
1697 
1698  // Number of segments (vertical)
1699  if( !m_xNumVertical->get_text().isEmpty() )
1700  {
1701  sal_uInt32 nValue = static_cast<sal_uInt32>(m_xNumVertical->get_value());
1702  rAttrs.Put(makeSvx3DVerticalSegmentsItem(nValue));
1703  }
1704  else
1706 
1707  // Depth
1708  if( !m_xMtrDepth->get_text().isEmpty() )
1709  {
1710  sal_uInt32 nValue = GetCoreValue(*m_xMtrDepth, ePoolUnit);
1711  rAttrs.Put(makeSvx3DDepthItem(nValue));
1712  }
1713  else
1715 
1716  // Double-sided
1717  TriState eState = m_xBtnDoubleSided->get_state();
1718  if( eState != TRISTATE_INDET )
1719  {
1720  bool bValue = TRISTATE_TRUE == eState;
1721  rAttrs.Put(makeSvx3DDoubleSidedItem(bValue));
1722  }
1723  else
1725 
1726  // Edge rounding
1727  if( !m_xMtrPercentDiagonal->get_text().isEmpty() )
1728  {
1729  sal_uInt16 nValue = static_cast<sal_uInt16>(m_xMtrPercentDiagonal->get_value(FieldUnit::PERCENT));
1730  rAttrs.Put(makeSvx3DPercentDiagonalItem(nValue));
1731  }
1732  else
1734 
1735  // Depth scale
1736  if( !m_xMtrBackscale->get_text().isEmpty() )
1737  {
1738  sal_uInt16 nValue = static_cast<sal_uInt16>(m_xMtrBackscale->get_value(FieldUnit::PERCENT));
1739  rAttrs.Put(makeSvx3DBackscaleItem(nValue));
1740  }
1741  else
1743 
1744  // End angle
1745  if( !m_xMtrEndAngle->get_text().isEmpty() )
1746  {
1747  sal_uInt16 nValue = static_cast<sal_uInt16>(m_xMtrEndAngle->get_value(FieldUnit::DEGREE));
1748  rAttrs.Put(makeSvx3DEndAngleItem(nValue));
1749  }
1750  else
1752 
1753  // Normal type
1754  sal_uInt16 nValue = 99;
1755  if( m_xBtnNormalsObj->get_active() )
1756  nValue = 0;
1757  else if( m_xBtnNormalsFlat->get_active() )
1758  nValue = 1;
1759  else if( m_xBtnNormalsSphere->get_active() )
1760  nValue = 2;
1761 
1762  if( nValue <= 2 )
1763  rAttrs.Put(Svx3DNormalsKindItem(nValue));
1764  else
1766 
1767  // Normal inverted
1768  eState = m_xBtnNormalsInvert->get_state();
1769  if( eState != TRISTATE_INDET )
1770  {
1771  bool bValue = TRISTATE_TRUE == eState;
1772  rAttrs.Put(makeSvx3DNormalsInvertItem(bValue));
1773  }
1774  else
1776 
1777  // 2-sided lighting
1778  eState = m_xBtnTwoSidedLighting->get_state();
1779  if( eState != TRISTATE_INDET )
1780  {
1781  bool bValue = TRISTATE_TRUE == eState;
1782  rAttrs.Put(makeSvx3DTwoSidedLightingItem(bValue));
1783  }
1784  else
1786 
1787 // Representation
1788  // Shade mode
1789  if( m_xLbShademode->get_active() )
1790  {
1791  nValue = m_xLbShademode->get_active();
1792  rAttrs.Put(Svx3DShadeModeItem(nValue));
1793  }
1794  else
1796 
1797  // 3D-Shadow
1798  eState = m_xBtnShadow3d->get_state();
1799  if( eState != TRISTATE_INDET )
1800  {
1801  bool bValue = TRISTATE_TRUE == eState;
1802  rAttrs.Put(makeSvx3DShadow3DItem(bValue));
1803  rAttrs.Put(makeSdrShadowItem(bValue));
1804  }
1805  else
1806  {
1809  }
1810 
1811  // Slant (Shadow)
1812  if( !m_xMtrSlant->get_text().isEmpty() )
1813  {
1814  sal_uInt16 nValue2 = static_cast<sal_uInt16>(m_xMtrSlant->get_value(FieldUnit::DEGREE));
1815  rAttrs.Put(makeSvx3DShadowSlantItem(nValue2));
1816  }
1817  else
1819 
1820  // Distance
1821  if( !m_xMtrDistance->get_text().isEmpty() )
1822  {
1823  sal_uInt32 nValue2 = GetCoreValue(*m_xMtrDistance, ePoolUnit);
1824  rAttrs.Put(makeSvx3DDistanceItem(nValue2));
1825  }
1826  else
1828 
1829  // Focal length
1830  if( !m_xMtrFocalLength->get_text().isEmpty() )
1831  {
1832  sal_uInt32 nValue2 = GetCoreValue(*m_xMtrFocalLength, ePoolUnit);
1833  rAttrs.Put(makeSvx3DFocalLengthItem(nValue2));
1834  }
1835  else
1837 
1838  // Lighting
1839  Color aColor;
1840  const SfxItemSet aLightItemSet(m_xCtlLightPreview->GetSvx3DLightControl().Get3DAttributes());
1841 
1842  // Light 1 color
1843  if (!m_xLbLight1->IsNoSelection())
1844  {
1845  aColor = m_xLbLight1->GetSelectEntryColor();
1846  rAttrs.Put(makeSvx3DLightcolor1Item(aColor));
1847  }
1848  else
1850  // Light 1 (on/off)
1851  eState = m_xBtnLight1->get_state();
1852  if( eState != TRISTATE_INDET )
1853  {
1854  bool bValue = m_xBtnLight1->isLightOn();
1855  rAttrs.Put(makeSvx3DLightOnOff1Item(bValue));
1856 
1857  // Light 1 (direction)
1858  if( bValue )
1859  {
1860  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1));
1861  }
1862  }
1863  else
1865 
1866 
1867  // Light 2 color
1868  if (!m_xLbLight2->IsNoSelection())
1869  {
1870  aColor = m_xLbLight2->GetSelectEntryColor();
1871  rAttrs.Put(makeSvx3DLightcolor2Item(aColor));
1872  }
1873  else
1875  // Light 2 (on/off)
1876  eState = m_xBtnLight2->get_state();
1877  if( eState != TRISTATE_INDET )
1878  {
1879  bool bValue = m_xBtnLight2->isLightOn();
1880  rAttrs.Put(makeSvx3DLightOnOff2Item(bValue));
1881 
1882  // Light 2 (direction)
1883  if( bValue )
1884  {
1885  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2));
1886  }
1887  }
1888  else
1890 
1891  // Light 3 color
1892  if (!m_xLbLight3->IsNoSelection())
1893  {
1894  aColor = m_xLbLight3->GetSelectEntryColor();
1895  rAttrs.Put(makeSvx3DLightcolor3Item(aColor));
1896  }
1897  else
1899  // Light 3 (on/off)
1900  eState = m_xBtnLight3->get_state();
1901  if( eState != TRISTATE_INDET )
1902  {
1903  bool bValue = m_xBtnLight3->isLightOn();
1904  rAttrs.Put(makeSvx3DLightOnOff3Item(bValue));
1905 
1906  // Light 3 (direction)
1907  if( bValue )
1908  {
1909  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3));
1910  }
1911  }
1912  else
1914 
1915  // Light 4 color
1916  if (!m_xLbLight4->IsNoSelection())
1917  {
1918  aColor = m_xLbLight4->GetSelectEntryColor();
1919  rAttrs.Put(makeSvx3DLightcolor4Item(aColor));
1920  }
1921  else
1923  // Light 4 (on/off)
1924  eState = m_xBtnLight4->get_state();
1925  if( eState != TRISTATE_INDET )
1926  {
1927  bool bValue = m_xBtnLight4->isLightOn();
1928  rAttrs.Put(makeSvx3DLightOnOff4Item(bValue));
1929 
1930  // Light 4 (direction)
1931  if( bValue )
1932  {
1933  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4));
1934  }
1935  }
1936  else
1938 
1939  // Light 5 color
1940  if (!m_xLbLight5->IsNoSelection())
1941  {
1942  aColor = m_xLbLight5->GetSelectEntryColor();
1943  rAttrs.Put(makeSvx3DLightcolor5Item(aColor));
1944  }
1945  else
1947  // Light 5 (on/off)
1948  eState = m_xBtnLight5->get_state();
1949  if( eState != TRISTATE_INDET )
1950  {
1951  bool bValue = m_xBtnLight5->isLightOn();
1952  rAttrs.Put(makeSvx3DLightOnOff5Item(bValue));
1953 
1954  // Light 5 (direction)
1955  if( bValue )
1956  {
1957  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5));
1958  }
1959  }
1960  else
1962 
1963  // Light 6 color
1964  if (!m_xLbLight6->IsNoSelection())
1965  {
1966  aColor = m_xLbLight6->GetSelectEntryColor();
1967  rAttrs.Put(makeSvx3DLightcolor6Item(aColor));
1968  }
1969  else
1971  // Light 6 (on/off)
1972  eState = m_xBtnLight6->get_state();
1973  if( eState != TRISTATE_INDET )
1974  {
1975  bool bValue = m_xBtnLight6->isLightOn();
1976  rAttrs.Put(makeSvx3DLightOnOff6Item(bValue));
1977 
1978  // Light 6 (direction)
1979  if( bValue )
1980  {
1981  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6));
1982  }
1983  }
1984  else
1986 
1987  // Light 7 color
1988  if (!m_xLbLight7->IsNoSelection())
1989  {
1990  aColor = m_xLbLight7->GetSelectEntryColor();
1991  rAttrs.Put(makeSvx3DLightcolor7Item(aColor));
1992  }
1993  else
1995  // Light 7 (on/off)
1996  eState = m_xBtnLight7->get_state();
1997  if( eState != TRISTATE_INDET )
1998  {
1999  bool bValue = m_xBtnLight7->isLightOn();
2000  rAttrs.Put(makeSvx3DLightOnOff7Item(bValue));
2001 
2002  // Light 7 (direction)
2003  if( bValue )
2004  {
2005  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7));
2006  }
2007  }
2008  else
2010 
2011  // Light 8 color
2012  if (!m_xLbLight8->IsNoSelection())
2013  {
2014  aColor = m_xLbLight8->GetSelectEntryColor();
2015  rAttrs.Put(makeSvx3DLightcolor8Item(aColor));
2016  }
2017  else
2019  // Light 8 (on/off)
2020  eState = m_xBtnLight8->get_state();
2021  if( eState != TRISTATE_INDET )
2022  {
2023  bool bValue = m_xBtnLight8->isLightOn();
2024  rAttrs.Put(makeSvx3DLightOnOff8Item(bValue));
2025 
2026  // Light 8 (direction)
2027  if( bValue )
2028  {
2029  rAttrs.Put(aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8));
2030  }
2031  }
2032  else
2034 
2035  // Ambient light
2036  if (!m_xLbAmbientlight->IsNoSelection())
2037  {
2038  aColor = m_xLbAmbientlight->GetSelectEntryColor();
2039  rAttrs.Put(makeSvx3DAmbientcolorItem(aColor));
2040  }
2041  else
2043 
2044 // Textures
2045  // Art
2046  nValue = 99;
2047  if( m_xBtnTexLuminance->get_active() )
2048  nValue = 1;
2049  else if( m_xBtnTexColor->get_active() )
2050  nValue = 3;
2051 
2052  if( nValue == 1 || nValue == 3 )
2053  rAttrs.Put(Svx3DTextureKindItem(nValue));
2054  else
2056 
2057 
2058  // Mode
2059  nValue = 99;
2060  if( m_xBtnTexReplace->get_active() )
2061  nValue = 1;
2062  else if( m_xBtnTexModulate->get_active() )
2063  nValue = 2;
2064 
2065  if( nValue == 1 || nValue == 2 )
2066  rAttrs.Put(Svx3DTextureModeItem(nValue));
2067  else
2069 
2070  // X projection
2071  nValue = 99;
2072  if( m_xBtnTexObjectX->get_active() )
2073  nValue = 0;
2074  else if( m_xBtnTexParallelX->get_active() )
2075  nValue = 1;
2076  else if( m_xBtnTexCircleX->get_active() )
2077  nValue = 2;
2078 
2079  if( nValue <= 2 )
2080  rAttrs.Put(Svx3DTextureProjectionXItem(nValue));
2081  else
2083 
2084  // Y projection
2085  nValue = 99;
2086  if( m_xBtnTexObjectY->get_active() )
2087  nValue = 0;
2088  else if( m_xBtnTexParallelY->get_active() )
2089  nValue = 1;
2090  else if( m_xBtnTexCircleY->get_active() )
2091  nValue = 2;
2092 
2093  if( nValue <= 2 )
2094  rAttrs.Put(Svx3DTextureProjectionYItem(nValue));
2095  else
2097 
2098 
2099  // Filter
2100  eState = m_xBtnTexFilter->get_state();
2101  if( eState != TRISTATE_INDET )
2102  {
2103  bool bValue = TRISTATE_TRUE == eState;
2104  rAttrs.Put(makeSvx3DTextureFilterItem(bValue));
2105  }
2106  else
2108 
2109 
2110 // Material
2111  // Object color
2112  if (!m_xLbMatColor->IsNoSelection())
2113  {
2114  aColor = m_xLbMatColor->GetSelectEntryColor();
2115  rAttrs.Put( XFillColorItem( "", aColor) );
2116  }
2117  else
2118  {
2119  rAttrs.InvalidateItem( XATTR_FILLCOLOR );
2120  }
2121 
2122  // luminous color
2123  if (!m_xLbMatEmission->IsNoSelection())
2124  {
2125  aColor = m_xLbMatEmission->GetSelectEntryColor();
2126  rAttrs.Put(makeSvx3DMaterialEmissionItem(aColor));
2127  }
2128  else
2130 
2131  // Specular
2132  if (!m_xLbMatSpecular->IsNoSelection())
2133  {
2134  aColor = m_xLbMatSpecular->GetSelectEntryColor();
2135  rAttrs.Put(makeSvx3DMaterialSpecularItem(aColor));
2136  }
2137  else
2139 
2140  // Specular intensity
2141  if( !m_xMtrMatSpecularIntensity->get_text().isEmpty() )
2142  {
2143  sal_uInt16 nValue2 = static_cast<sal_uInt16>(m_xMtrMatSpecularIntensity->get_value(FieldUnit::PERCENT));
2145  }
2146  else
2148 }
2149 
2151 {
2152  if ( !IsFloatingMode() ||
2153  !GetFloatingWindow()->IsRollUp() )
2154  {
2155  Size aWinSize( GetOutputSizePixel() ); // why rSize in Resizing()?
2156 
2157  if( aWinSize.Height() >= GetMinOutputSizePixel().Height() &&
2158  aWinSize.Width() >= GetMinOutputSizePixel().Width() )
2159  {
2160  // Hide
2161  m_xBtnUpdate->hide();
2162  m_xBtnAssign->hide();
2163 
2164  m_xBtnConvertTo3D->hide();
2165  m_xBtnLatheObject->hide();
2166  m_xBtnPerspective->hide();
2167 
2168  m_xCtlPreview->Hide();
2169  m_xLightPreviewGrid->hide();
2170 
2171  m_xFLGeometrie->hide();
2172  m_xFLRepresentation->hide();
2173  m_xFLLight->hide();
2174  m_xFLTexture->hide();
2175  m_xFLMaterial->hide();
2176 
2177  // Show
2178  m_xBtnUpdate->show();
2179  m_xBtnAssign->show();
2180 
2181  m_xBtnConvertTo3D->show();
2182  m_xBtnLatheObject->show();
2183  m_xBtnPerspective->show();
2184 
2185  if( m_xBtnGeo->get_active() )
2186  ClickViewTypeHdl(*m_xBtnGeo);
2187  if( m_xBtnRepresentation->get_active() )
2188  ClickViewTypeHdl(*m_xBtnRepresentation);
2189  if( m_xBtnLight->get_active() )
2190  ClickViewTypeHdl(*m_xBtnLight);
2191  if( m_xBtnTexture->get_active() )
2192  ClickViewTypeHdl(*m_xBtnTexture);
2193  if( m_xBtnMaterial->get_active() )
2194  ClickViewTypeHdl(*m_xBtnMaterial);
2195  }
2196  }
2197 
2199 }
2200 
2201 IMPL_LINK_NOARG(Svx3DWin, ClickUpdateHdl, weld::Button&, void)
2202 {
2203  bUpdate = !m_xBtnUpdate->get_active();
2204 
2205  if( bUpdate )
2206  {
2207  SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2208  if (pDispatcher != nullptr)
2209  {
2210  SfxBoolItem aItem( SID_3D_STATE, true );
2211  pDispatcher->ExecuteList(SID_3D_STATE,
2212  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem });
2213  }
2214  }
2215  else
2216  {
2217  // Controls can be disabled during certain circumstances
2218  }
2219 }
2220 
2221 IMPL_LINK_NOARG(Svx3DWin, ClickAssignHdl, weld::Button&, void)
2222 {
2223  SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2224  if (pDispatcher != nullptr)
2225  {
2226  SfxBoolItem aItem( SID_3D_ASSIGN, true );
2227  pDispatcher->ExecuteList(SID_3D_ASSIGN,
2228  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem });
2229  }
2230 }
2231 
2232 IMPL_LINK( Svx3DWin, ClickViewTypeHdl, weld::Button&, rBtn, void )
2233 {
2234  // Since the permanent updating of the preview would be too expensive
2235  bool bUpdatePreview = m_xBtnLight->get_active();
2236 
2237  m_xBtnGeo->set_active(m_xBtnGeo.get() == &rBtn);
2238  m_xBtnRepresentation->set_active(m_xBtnRepresentation.get() == &rBtn);
2239  m_xBtnLight->set_active(m_xBtnLight.get() == &rBtn);
2240  m_xBtnTexture->set_active(m_xBtnTexture.get() == &rBtn);
2241  m_xBtnMaterial->set_active(m_xBtnMaterial.get() == &rBtn);
2242 
2243  if( m_xBtnGeo->get_active() )
2244  eViewType = ViewType3D::Geo;
2245  if( m_xBtnRepresentation->get_active() )
2246  eViewType = ViewType3D::Representation;
2247  if( m_xBtnLight->get_active() )
2248  eViewType = ViewType3D::Light;
2249  if( m_xBtnTexture->get_active() )
2250  eViewType = ViewType3D::Texture;
2251  if( m_xBtnMaterial->get_active() )
2252  eViewType = ViewType3D::Material;
2253 
2254  // Geometry
2255  if( eViewType == ViewType3D::Geo )
2256  {
2257  m_xFLSegments->show();
2258  m_xFLGeometrie->show();
2259  m_xFLNormals->show();
2260  }
2261  else
2262  {
2263  m_xFLSegments->hide();
2264  m_xFLGeometrie->hide();
2265  m_xFLNormals->hide();
2266  }
2267 
2268  // Representation
2269  if( eViewType == ViewType3D::Representation )
2270  {
2271  m_xFLShadow->show();
2272  m_xFLCamera->show();
2273  m_xFLRepresentation->show();
2274  }
2275  else
2276  {
2277  m_xFLShadow->hide();
2278  m_xFLCamera->hide();
2279  m_xFLRepresentation->hide();
2280  }
2281 
2282  // Lighting
2283  if( eViewType == ViewType3D::Light )
2284  {
2285  m_xFLLight->show();
2286 
2287  ColorListBox* pLb = GetCLbByButton();
2288  if( pLb )
2289  pLb->show();
2290 
2291  m_xLightPreviewGrid->show();
2292  m_xCtlPreview->Hide();
2293  }
2294  else
2295  {
2296  m_xFLLight->hide();
2297 
2298  if( !m_xCtlPreview->IsVisible() )
2299  {
2300  m_xCtlPreview->Show();
2301  m_xLightPreviewGrid->hide();
2302  }
2303  }
2304 
2305  // Textures
2306  if (eViewType == ViewType3D::Texture)
2307  m_xFLTexture->show();
2308  else
2309  m_xFLTexture->hide();
2310 
2311  // Material
2312  if( eViewType == ViewType3D::Material )
2313  {
2314  m_xFLMatSpecular->show();
2315  m_xFLMaterial->show();
2316  }
2317  else
2318  {
2319  m_xFLMatSpecular->hide();
2320  m_xFLMaterial->hide();
2321  }
2322  if( bUpdatePreview && !m_xBtnLight->get_active() )
2323  UpdatePreview();
2324 }
2325 
2326 IMPL_LINK( Svx3DWin, ClickHdl, weld::Button&, rBtn, void )
2327 {
2328  bool bUpdatePreview = false;
2329  sal_uInt16 nSId = 0;
2330 
2331  if( &rBtn == m_xBtnConvertTo3D.get() )
2332  {
2333  nSId = SID_CONVERT_TO_3D;
2334  }
2335  else if( &rBtn == m_xBtnLatheObject.get() )
2336  {
2337  nSId = SID_CONVERT_TO_3D_LATHE_FAST;
2338  }
2339  // Geometry
2340  else if( &rBtn == m_xBtnNormalsObj.get() ||
2341  &rBtn == m_xBtnNormalsFlat.get() ||
2342  &rBtn == m_xBtnNormalsSphere.get() )
2343  {
2344  m_xBtnNormalsObj->set_active( &rBtn == m_xBtnNormalsObj.get() );
2345  m_xBtnNormalsFlat->set_active( &rBtn == m_xBtnNormalsFlat.get() );
2346  m_xBtnNormalsSphere->set_active( &rBtn == m_xBtnNormalsSphere.get() );
2347  bUpdatePreview = true;
2348  }
2349  else if( &rBtn == m_xBtnLight1->get_widget() ||
2350  &rBtn == m_xBtnLight2->get_widget() ||
2351  &rBtn == m_xBtnLight3->get_widget() ||
2352  &rBtn == m_xBtnLight4->get_widget() ||
2353  &rBtn == m_xBtnLight5->get_widget() ||
2354  &rBtn == m_xBtnLight6->get_widget() ||
2355  &rBtn == m_xBtnLight7->get_widget() ||
2356  &rBtn == m_xBtnLight8->get_widget() )
2357  {
2358  // Lighting
2359  LightButton* pToggleBtn = GetLbByButton(&rBtn);
2360 
2361  ColorListBox* pLb = GetCLbByButton(pToggleBtn);
2362  pLb->show();
2363 
2364  bool bIsChecked = pToggleBtn->get_prev_active();
2365 
2366  if (pToggleBtn != m_xBtnLight1.get() && m_xBtnLight1->get_active())
2367  {
2368  m_xBtnLight1->set_active( false );
2369  m_xBtnLight1->set_prev_active(false);
2370  m_xLbLight1->hide();
2371  }
2372  if (pToggleBtn != m_xBtnLight2.get() && m_xBtnLight2->get_active())
2373  {
2374  m_xBtnLight2->set_active( false );
2375  m_xBtnLight2->set_prev_active(false);
2376  m_xLbLight2->hide();
2377  }
2378  if( pToggleBtn != m_xBtnLight3.get() && m_xBtnLight3->get_active() )
2379  {
2380  m_xBtnLight3->set_active( false );
2381  m_xBtnLight3->set_prev_active(false);
2382  m_xLbLight3->hide();
2383  }
2384  if( pToggleBtn != m_xBtnLight4.get() && m_xBtnLight4->get_active() )
2385  {
2386  m_xBtnLight4->set_active( false );
2387  m_xBtnLight4->set_prev_active(false);
2388  m_xLbLight4->hide();
2389  }
2390  if( pToggleBtn != m_xBtnLight5.get() && m_xBtnLight5->get_active() )
2391  {
2392  m_xBtnLight5->set_active( false );
2393  m_xBtnLight5->set_prev_active(false);
2394  m_xLbLight5->hide();
2395  }
2396  if( pToggleBtn != m_xBtnLight6.get() && m_xBtnLight6->get_active() )
2397  {
2398  m_xBtnLight6->set_active( false );
2399  m_xBtnLight6->set_prev_active(false);
2400  m_xLbLight6->hide();
2401  }
2402  if( pToggleBtn != m_xBtnLight7.get() && m_xBtnLight7->get_active() )
2403  {
2404  m_xBtnLight7->set_active( false );
2405  m_xBtnLight7->set_prev_active(false);
2406  m_xLbLight7->hide();
2407  }
2408  if( pToggleBtn != m_xBtnLight8.get() && m_xBtnLight8->get_active() )
2409  {
2410  m_xBtnLight8->set_active( false );
2411  m_xBtnLight8->set_prev_active(false);
2412  m_xLbLight8->hide();
2413  }
2414 
2415  //update light button
2416  pToggleBtn->set_active(true);
2417  pToggleBtn->set_prev_active(true);
2418  if (bIsChecked)
2419  pToggleBtn->switchLightOn(!pToggleBtn->isLightOn());
2420 
2421  bool bEnable = pToggleBtn->isLightOn();
2422  m_xBtnLightColor->set_sensitive( bEnable );
2423  pLb->set_sensitive( bEnable );
2424 
2425  ClickLight(*pToggleBtn);
2426  bUpdatePreview = true;
2427  }
2428  // Textures
2429  else if( &rBtn == m_xBtnTexLuminance.get() ||
2430  &rBtn == m_xBtnTexColor.get() )
2431  {
2432  m_xBtnTexLuminance->set_active( &rBtn == m_xBtnTexLuminance.get() );
2433  m_xBtnTexColor->set_active( &rBtn == m_xBtnTexColor.get() );
2434  bUpdatePreview = true;
2435  }
2436  else if( &rBtn == m_xBtnTexReplace.get() ||
2437  &rBtn == m_xBtnTexModulate.get() )
2438  {
2439  m_xBtnTexReplace->set_active( &rBtn == m_xBtnTexReplace.get() );
2440  m_xBtnTexModulate->set_active( &rBtn == m_xBtnTexModulate.get() );
2441  bUpdatePreview = true;
2442  }
2443  else if( &rBtn == m_xBtnTexParallelX.get() ||
2444  &rBtn == m_xBtnTexCircleX.get() ||
2445  &rBtn == m_xBtnTexObjectX.get() )
2446  {
2447  m_xBtnTexParallelX->set_active( &rBtn == m_xBtnTexParallelX.get() );
2448  m_xBtnTexCircleX->set_active( &rBtn == m_xBtnTexCircleX.get() );
2449  m_xBtnTexObjectX->set_active( &rBtn == m_xBtnTexObjectX.get() );
2450  bUpdatePreview = true;
2451  }
2452  else if( &rBtn == m_xBtnTexParallelY.get() ||
2453  &rBtn == m_xBtnTexCircleY.get() ||
2454  &rBtn == m_xBtnTexObjectY.get() )
2455  {
2456  m_xBtnTexParallelY->set_active( &rBtn == m_xBtnTexParallelY.get() );
2457  m_xBtnTexCircleY->set_active( &rBtn == m_xBtnTexCircleY.get() );
2458  m_xBtnTexObjectY->set_active( &rBtn == m_xBtnTexObjectY.get() );
2459  bUpdatePreview = true;
2460  }
2461  else if (&rBtn == m_xBtnShadow3d.get())
2462  {
2463  m_xFtSlant->set_sensitive( m_xBtnShadow3d->get_active() );
2464  m_xMtrSlant->set_sensitive( m_xBtnShadow3d->get_active() );
2465  bUpdatePreview = true;
2466  }
2467  // Other (no groups)
2468  else
2469  {
2470  bUpdatePreview = true;
2471  }
2472 
2473  if( nSId > 0 )
2474  {
2475  SfxDispatcher* pDispatcher = LocalGetDispatcher(pBindings);
2476  if (pDispatcher != nullptr)
2477  {
2478  SfxBoolItem aItem( nSId, true );
2479  pDispatcher->ExecuteList(nSId,
2480  SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aItem });
2481  }
2482  }
2483  else if( bUpdatePreview )
2484  UpdatePreview();
2485 }
2486 
2487 IMPL_LINK( Svx3DWin, ClickColorHdl, weld::Button&, rBtn, void)
2488 {
2489  SvColorDialog aColorDlg;
2490  ColorListBox* pLb;
2491 
2492  if( &rBtn == m_xBtnLightColor.get() )
2493  pLb = GetCLbByButton();
2494  else if( &rBtn == m_xBtnAmbientColor.get() )
2495  pLb = m_xLbAmbientlight.get();
2496  else if( &rBtn == m_xBtnMatColor.get() )
2497  pLb = m_xLbMatColor.get();
2498  else if( &rBtn == m_xBtnEmissionColor.get() )
2499  pLb = m_xLbMatEmission.get();
2500  else // if( &rBtn == m_xBtnSpecularColor.get() )
2501  pLb = m_xLbMatSpecular.get();
2502 
2503  Color aColor = pLb->GetSelectEntryColor();
2504 
2505  aColorDlg.SetColor( aColor );
2506  if( aColorDlg.Execute(GetFrameWeld()) == RET_OK )
2507  {
2508  aColor = aColorDlg.GetColor();
2509  LBSelectColor(pLb, aColor);
2510  SelectColorHdl(*pLb);
2511  }
2512 }
2513 
2514 IMPL_LINK( Svx3DWin, SelectHdl, weld::ComboBox&, rListBox, void )
2515 {
2516  bool bUpdatePreview = false;
2517 
2518  // Material
2519  if (&rListBox == m_xLbMatFavorites.get())
2520  {
2521  Color aColObj( COL_WHITE );
2522  Color aColEmis( COL_BLACK );
2523  Color aColSpec( COL_WHITE );
2524  sal_uInt16 nSpecIntens = 20;
2525 
2526  switch( m_xLbMatFavorites->get_active() )
2527  {
2528  case 1: // Metall
2529  {
2530  aColObj = Color(230,230,255);
2531  aColEmis = Color(10,10,30);
2532  aColSpec = Color(200,200,200);
2533  nSpecIntens = 20;
2534  }
2535  break;
2536 
2537  case 2: // Gold
2538  {
2539  aColObj = Color(230,255,0);
2540  aColEmis = Color(51,0,0);
2541  aColSpec = Color(255,255,240);
2542  nSpecIntens = 20;
2543  }
2544  break;
2545 
2546  case 3: // Chrome
2547  {
2548  aColObj = Color(36,117,153);
2549  aColEmis = Color(18,30,51);
2550  aColSpec = Color(230,230,255);
2551  nSpecIntens = 2;
2552  }
2553  break;
2554 
2555  case 4: // Plastic
2556  {
2557  aColObj = Color(255,48,57);
2558  aColEmis = Color(35,0,0);
2559  aColSpec = Color(179,202,204);
2560  nSpecIntens = 60;
2561  }
2562  break;
2563 
2564  case 5: // Wood
2565  {
2566  aColObj = Color(153,71,1);
2567  aColEmis = Color(21,22,0);
2568  aColSpec = Color(255,255,153);
2569  nSpecIntens = 75;
2570  }
2571  break;
2572  }
2573  LBSelectColor( m_xLbMatColor.get(), aColObj );
2574  LBSelectColor( m_xLbMatEmission.get(), aColEmis );
2575  LBSelectColor( m_xLbMatSpecular.get(), aColSpec );
2576  m_xMtrMatSpecularIntensity->set_value(nSpecIntens, FieldUnit::PERCENT);
2577 
2578  bUpdatePreview = true;
2579  }
2580  else if (&rListBox == m_xLbShademode.get())
2581  bUpdatePreview = true;
2582 
2583  if( bUpdatePreview )
2584  UpdatePreview();
2585 }
2586 
2587 IMPL_LINK( Svx3DWin, SelectColorHdl, ColorListBox&, rListBox, void )
2588 {
2589  bool bUpdatePreview = false;
2590 
2591  if( &rListBox == m_xLbMatColor.get() ||
2592  &rListBox == m_xLbMatEmission.get() ||
2593  &rListBox == m_xLbMatSpecular.get() )
2594  {
2595  m_xLbMatFavorites->set_active( 0 );
2596  bUpdatePreview = true;
2597  }
2598  // Lighting
2599  else if( &rListBox == m_xLbAmbientlight.get() )
2600  {
2601  bUpdatePreview = true;
2602  }
2603  else if( &rListBox == m_xLbLight1.get() ||
2604  &rListBox == m_xLbLight2.get() ||
2605  &rListBox == m_xLbLight3.get() ||
2606  &rListBox == m_xLbLight4.get() ||
2607  &rListBox == m_xLbLight5.get() ||
2608  &rListBox == m_xLbLight6.get() ||
2609  &rListBox == m_xLbLight7.get() ||
2610  &rListBox == m_xLbLight8.get() )
2611  {
2612  bUpdatePreview = true;
2613  }
2614 
2615  if( bUpdatePreview )
2616  UpdatePreview();
2617 }
2618 
2620 {
2621  UpdatePreview();
2622 }
2623 
2624 IMPL_LINK_NOARG( Svx3DWin, ModifySpinHdl, weld::SpinButton&, void )
2625 {
2626  UpdatePreview();
2627 }
2628 
2630 {
2631  sal_uInt16 nLightSource = GetLightSource( &rBtn );
2632  ColorListBox* pLb = GetCLbByButton( &rBtn );
2633  Color aColor( pLb->GetSelectEntryColor() );
2634  SfxItemSet aLightItemSet(m_xCtlLightPreview->GetSvx3DLightControl().Get3DAttributes());
2635  const bool bOnOff(rBtn.isLightOn());
2636 
2637  switch(nLightSource)
2638  {
2639  case 0: aLightItemSet.Put(makeSvx3DLightcolor1Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff1Item(bOnOff)); break;
2640  case 1: aLightItemSet.Put(makeSvx3DLightcolor2Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff2Item(bOnOff)); break;
2641  case 2: aLightItemSet.Put(makeSvx3DLightcolor3Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff3Item(bOnOff)); break;
2642  case 3: aLightItemSet.Put(makeSvx3DLightcolor4Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff4Item(bOnOff)); break;
2643  case 4: aLightItemSet.Put(makeSvx3DLightcolor5Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff5Item(bOnOff)); break;
2644  case 5: aLightItemSet.Put(makeSvx3DLightcolor6Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff6Item(bOnOff)); break;
2645  case 6: aLightItemSet.Put(makeSvx3DLightcolor7Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff7Item(bOnOff)); break;
2646  default:
2647  case 7: aLightItemSet.Put(makeSvx3DLightcolor8Item(aColor)); aLightItemSet.Put(makeSvx3DLightOnOff8Item(bOnOff)); break;
2648  }
2649 
2650  m_xCtlLightPreview->GetSvx3DLightControl().Set3DAttributes(aLightItemSet);
2651  m_xCtlLightPreview->GetSvx3DLightControl().SelectLight(nLightSource);
2652  m_xCtlLightPreview->CheckSelection();
2653 }
2654 
2655 IMPL_LINK_NOARG(Svx3DWin, ChangeSelectionCallbackHdl, SvxLightCtl3D*, void)
2656 {
2657  const sal_uInt32 nLight(m_xCtlLightPreview->GetSvx3DLightControl().GetSelectedLight());
2658  weld::Button* pBtn = nullptr;
2659 
2660  switch( nLight )
2661  {
2662  case 0: pBtn = m_xBtnLight1->get_widget(); break;
2663  case 1: pBtn = m_xBtnLight2->get_widget(); break;
2664  case 2: pBtn = m_xBtnLight3->get_widget(); break;
2665  case 3: pBtn = m_xBtnLight4->get_widget(); break;
2666  case 4: pBtn = m_xBtnLight5->get_widget(); break;
2667  case 5: pBtn = m_xBtnLight6->get_widget(); break;
2668  case 6: pBtn = m_xBtnLight7->get_widget(); break;
2669  case 7: pBtn = m_xBtnLight8->get_widget(); break;
2670  default: break;
2671  }
2672 
2673  if (pBtn)
2674  ClickHdl(*pBtn);
2675  else
2676  {
2677  // Status: No lamp selected
2678  if( m_xBtnLight1->get_active() )
2679  {
2680  m_xBtnLight1->set_active( false );
2681  m_xLbLight1->set_sensitive( false );
2682  }
2683  else if( m_xBtnLight2->get_active() )
2684  {
2685  m_xBtnLight2->set_active( false );
2686  m_xLbLight2->set_sensitive( false );
2687  }
2688  else if( m_xBtnLight3->get_active() )
2689  {
2690  m_xBtnLight3->set_active( false );
2691  m_xLbLight3->set_sensitive( false );
2692  }
2693  else if( m_xBtnLight4->get_active() )
2694  {
2695  m_xBtnLight4->set_active( false );
2696  m_xLbLight4->set_sensitive( false );
2697  }
2698  else if( m_xBtnLight5->get_active() )
2699  {
2700  m_xBtnLight5->set_active( false );
2701  m_xLbLight5->set_sensitive( false );
2702  }
2703  else if( m_xBtnLight6->get_active() )
2704  {
2705  m_xBtnLight6->set_active( false );
2706  m_xLbLight6->set_sensitive( false );
2707  }
2708  else if( m_xBtnLight7->get_active() )
2709  {
2710  m_xBtnLight7->set_active( false );
2711  m_xLbLight7->set_sensitive( false );
2712  }
2713  else if( m_xBtnLight8->get_active() )
2714  {
2715  m_xBtnLight8->set_active( false );
2716  m_xLbLight8->set_sensitive( false );
2717  }
2718  m_xBtnLightColor->set_sensitive( false );
2719  }
2720 }
2721 
2722 namespace
2723 {
2724  OUString lcl_makeColorName(const Color& rColor)
2725  {
2726  OUString aStr = SvxResId(RID_SVXFLOAT3D_FIX_R) +
2727  OUString::number(rColor.GetRed()) +
2728  " " +
2729  SvxResId(RID_SVXFLOAT3D_FIX_G) +
2730  OUString::number(rColor.GetGreen()) +
2731  " " +
2732  SvxResId(RID_SVXFLOAT3D_FIX_B) +
2733  OUString::number(rColor.GetBlue());
2734  return aStr;
2735  }
2736 }
2737 
2738 // Method to ensure that the LB is also associated with a color
2739 void Svx3DWin::LBSelectColor( ColorListBox* pLb, const Color& rColor )
2740 {
2741  pLb->SetNoSelection();
2742  pLb->SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor)));
2743 }
2744 
2746 {
2747  if(!pModel)
2748  {
2749  pModel.reset(new FmFormModel());
2750  }
2751 
2752  // Get Itemset
2753  SfxItemSet aSet( pModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{});
2754 
2755  // Get Attributes and set the preview
2756  GetAttr( aSet );
2757  m_xCtlPreview->Set3DAttributes( aSet );
2758  m_xCtlLightPreview->GetSvx3DLightControl().Set3DAttributes( aSet );
2759 }
2760 
2761 
2762 // document is to be reloaded, destroy remembered ItemSet
2764 {
2765  mpRemember2DAttributes.reset();
2766 }
2767 
2769 {
2770  // First...
2771  Color aColWhite( COL_WHITE );
2772  Color aColBlack( COL_BLACK );
2773  m_xLbLight1->SelectEntry( aColWhite );
2774  m_xLbLight2->SelectEntry( aColWhite );
2775  m_xLbLight3->SelectEntry( aColWhite );
2776  m_xLbLight4->SelectEntry( aColWhite );
2777  m_xLbLight5->SelectEntry( aColWhite );
2778  m_xLbLight6->SelectEntry( aColWhite );
2779  m_xLbLight7->SelectEntry( aColWhite );
2780  m_xLbLight8->SelectEntry( aColWhite );
2781  m_xLbAmbientlight->SelectEntry( aColBlack );
2782  m_xLbMatColor->SelectEntry( aColWhite );
2783  m_xLbMatEmission->SelectEntry( aColBlack );
2784  m_xLbMatSpecular->SelectEntry( aColWhite );
2785 }
2786 
2787 sal_uInt16 Svx3DWin::GetLightSource( const LightButton* pBtn )
2788 {
2789  sal_uInt16 nLight = 8;
2790 
2791  if (pBtn == m_xBtnLight1.get())
2792  nLight = 0;
2793  else if (pBtn == m_xBtnLight2.get())
2794  nLight = 1;
2795  else if( pBtn == m_xBtnLight3.get() )
2796  nLight = 2;
2797  else if( pBtn == m_xBtnLight4.get() )
2798  nLight = 3;
2799  else if( pBtn == m_xBtnLight5.get() )
2800  nLight = 4;
2801  else if( pBtn == m_xBtnLight6.get() )
2802  nLight = 5;
2803  else if( pBtn == m_xBtnLight7.get() )
2804  nLight = 6;
2805  else if( pBtn == m_xBtnLight8.get() )
2806  nLight = 7;
2807 
2808  return nLight;
2809 };
2810 
2812 {
2813  ColorListBox* pLb = nullptr;
2814 
2815  if( pBtn == nullptr )
2816  {
2817  if( m_xBtnLight1->get_active() )
2818  pLb = m_xLbLight1.get();
2819  else if( m_xBtnLight2->get_active() )
2820  pLb = m_xLbLight2.get();
2821  else if( m_xBtnLight3->get_active() )
2822  pLb = m_xLbLight3.get();
2823  else if( m_xBtnLight4->get_active() )
2824  pLb = m_xLbLight4.get();
2825  else if( m_xBtnLight5->get_active() )
2826  pLb = m_xLbLight5.get();
2827  else if( m_xBtnLight6->get_active() )
2828  pLb = m_xLbLight6.get();
2829  else if( m_xBtnLight7->get_active() )
2830  pLb = m_xLbLight7.get();
2831  else if( m_xBtnLight8->get_active() )
2832  pLb = m_xLbLight8.get();
2833  }
2834  else
2835  {
2836  if( pBtn == m_xBtnLight1.get() )
2837  pLb = m_xLbLight1.get();
2838  else if (pBtn == m_xBtnLight2.get())
2839  pLb = m_xLbLight2.get();
2840  else if( pBtn == m_xBtnLight3.get() )
2841  pLb = m_xLbLight3.get();
2842  else if( pBtn == m_xBtnLight4.get() )
2843  pLb = m_xLbLight4.get();
2844  else if( pBtn == m_xBtnLight5.get() )
2845  pLb = m_xLbLight5.get();
2846  else if( pBtn == m_xBtnLight6.get() )
2847  pLb = m_xLbLight6.get();
2848  else if( pBtn == m_xBtnLight7.get() )
2849  pLb = m_xLbLight7.get();
2850  else if( pBtn == m_xBtnLight8.get() )
2851  pLb = m_xLbLight8.get();
2852  }
2853  return pLb;
2854 };
2855 
2857 {
2858  LightButton* pLb = nullptr;
2859 
2860  if( pBtn == m_xBtnLight1->get_widget() )
2861  pLb = m_xBtnLight1.get();
2862  else if (pBtn == m_xBtnLight2->get_widget() )
2863  pLb = m_xBtnLight2.get();
2864  else if( pBtn == m_xBtnLight3->get_widget() )
2865  pLb = m_xBtnLight3.get();
2866  else if( pBtn == m_xBtnLight4->get_widget() )
2867  pLb = m_xBtnLight4.get();
2868  else if( pBtn == m_xBtnLight5->get_widget() )
2869  pLb = m_xBtnLight5.get();
2870  else if( pBtn == m_xBtnLight6->get_widget() )
2871  pLb = m_xBtnLight6.get();
2872  else if( pBtn == m_xBtnLight7->get_widget() )
2873  pLb = m_xBtnLight7.get();
2874  else if( pBtn == m_xBtnLight8->get_widget() )
2875  pLb = m_xBtnLight8.get();
2876 
2877  return pLb;
2878 };
2879 
2880 // Derivation from SfxChildWindow as "containers" for effects
2882  sal_uInt16 nId,
2883  SfxBindings* pBindings,
2884  SfxChildWinInfo* pInfo ) :
2885  SfxChildWindow( _pParent, nId )
2886 {
2887  VclPtr<Svx3DWin> pWin = VclPtr<Svx3DWin>::Create( pBindings, this, _pParent );
2888  SetWindow(pWin);
2889 
2890  pWin->Initialize( pInfo );
2891 }
2892 
2894  SfxBindings* _pBindings) :
2895  SfxControllerItem( _nId, *_pBindings )
2896 {
2897 }
2898 
2899 
2900 void Svx3DCtrlItem::StateChanged( sal_uInt16 /*nSId*/,
2901  SfxItemState /*eState*/, const SfxPoolItem* /*pItem*/ )
2902 {
2903 }
2904 
2905 // ControllerItem for Status Slot SID_CONVERT_TO_3D
2906 
2908 : SfxControllerItem(_nId, *_pBindings),
2909  bState(false)
2910 {
2911 }
2912 
2913 void SvxConvertTo3DItem::StateChanged(sal_uInt16 /*_nId*/, SfxItemState eState, const SfxPoolItem* /*pState*/)
2914 {
2915  bool bNewState = (eState != SfxItemState::DISABLED);
2916  if(bNewState != bState)
2917  {
2918  bState = bNewState;
2919  SfxDispatcher* pDispatcher = LocalGetDispatcher(&GetBindings());
2920  if (pDispatcher != nullptr)
2921  {
2922  SfxBoolItem aItem( SID_3D_STATE, true );
2923  pDispatcher->ExecuteList(SID_3D_STATE,
2924  SfxCallMode::ASYNCHRON|SfxCallMode::RECORD, { &aItem });
2925  }
2926  }
2927 }
2928 
2929 LightButton::LightButton(std::unique_ptr<weld::ToggleButton> xButton)
2930  : m_xButton(std::move(xButton))
2931  , m_bLightOn(false)
2932  , m_bButtonPrevActive(false)
2933 {
2934  m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_OFF);
2935 }
2936 
2938 {
2939  if (m_bLightOn == bOn)
2940  return;
2941  m_bLightOn = bOn;
2942  if (m_bLightOn)
2943  m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_ON);
2944  else
2945  m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_OFF);
2946 }
2947 
2948 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SfxItemSet > mpRemember2DAttributes
Definition: float3d.hxx:214
long Width() const
SvxColorItem makeSvx3DLightcolor7Item(const Color &rCol)
Definition: svx3ditems.hxx:190
bool m_bLightOn
Definition: float3d.hxx:74
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
std::unique_ptr< weld::ToggleButton > m_xBtnTexModulate
Definition: float3d.hxx:156
std::unique_ptr< weld::Container > m_xFLShadow
Definition: float3d.hxx:120
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
std::unique_ptr< weld::ToggleButton > m_xBtnTexFilter
Definition: float3d.hxx:164
FieldUnit
SfxBoolItem makeSvx3DLightOnOff2Item(bool bVal)
Definition: svx3ditems.hxx:206
SfxBoolItem makeSvx3DDoubleSidedItem(bool bVal)
Definition: svx3ditems.hxx:57
SVX_DLLPRIVATE ColorListBox * GetCLbByButton(const LightButton *pBtn=nullptr)
Definition: float3d.cxx:2811
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
#define SDRATTR_3DOBJ_NORMALS_KIND
Definition: svddef.hxx:330
sal_uInt8 GetRed() const
std::unique_ptr< weld::ToggleButton > m_xBtnUpdate
Definition: float3d.hxx:90
Svx3DWin(SfxBindings *pBindings, SfxChildWindow *pCW, vcl::Window *pParent)
Definition: float3d.cxx:84
void SetMinOutputSizePixel(const Size &rSize)
#define SDRATTR_3DSCENE_TWO_SIDED_LIGHTING
Definition: svddef.hxx:361
#define SDRATTR_3DOBJ_PERCENT_DIAGONAL
Definition: svddef.hxx:323
std::unique_ptr< LightButton > m_xBtnLight6
Definition: float3d.hxx:136
std::unique_ptr< weld::ToggleButton > m_xBtnShadow3d
Definition: float3d.hxx:121
std::unique_ptr< weld::Container > m_xFLNormals
Definition: float3d.hxx:108
virtual void StateChanged(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem *pState) override
Definition: float3d.cxx:2900
std::string GetValue
#define SDRATTR_3DOBJ_VERT_SEGS
Definition: svddef.hxx:327
std::unique_ptr< weld::ToggleButton > m_xBtnNormalsSphere
Definition: float3d.hxx:111
#define SDRATTR_3DSCENE_LIGHTON_4
Definition: svddef.hxx:374
long Height() const
ProjectionType
Definition: viewpt3d.hxx:38
std::unique_ptr< weld::ToggleButton > m_xBtnMaterial
Definition: float3d.hxx:89
std::unique_ptr< weld::Label > m_xFtBackscale
Definition: float3d.hxx:97
#define SDRATTR_3DOBJ_MAT_EMISSION
Definition: svddef.hxx:336
SfxDispatcher * GetDispatcher()
std::unique_ptr< weld::SpinButton > m_xNumVertical
Definition: float3d.hxx:106
#define SDRATTR_3DSCENE_SHADE_MODE
Definition: svddef.hxx:388
virtual void StateChanged(sal_uInt16 nSId, SfxItemState eState, const SfxPoolItem *pState) override
Definition: float3d.cxx:2913
std::unique_ptr< weld::Label > m_xFtEndAngle
Definition: float3d.hxx:99
std::unique_ptr< FmFormModel > pModel
Definition: float3d.hxx:201
void InvalidateItem(sal_uInt16 nWhich)
std::unique_ptr< weld::ToggleButton > m_xBtnTexBlend
Definition: float3d.hxx:157
#define SDRATTR_3DSCENE_LIGHTON_2
Definition: svddef.hxx:372
sal_uInt16 FirstWhich()
std::unique_ptr< weld::ToggleButton > m_xBtnDoubleSided
Definition: float3d.hxx:114
void set_prev_active(bool bPrevActive)
Definition: float3d.hxx:70
std::unique_ptr< ColorListBox > m_xLbAmbientlight
Definition: float3d.hxx:148
#define SDRATTR_3DOBJ_DOUBLE_SIDED
Definition: svddef.hxx:329
void SetWindow(const VclPtr< vcl::Window > &p)
std::unique_ptr< weld::ToggleButton > m_xBtnLight
Definition: float3d.hxx:87
std::unique_ptr< weld::Button > m_xBtn_Corner
Definition: float3d.hxx:186
SVX_DLLPRIVATE void Construct()
Definition: float3d.cxx:440
SvxColorItem makeSvx3DLightcolor2Item(const Color &rCol)
Definition: svx3ditems.hxx:170
SfxUInt32Item makeSvx3DVerticalSegmentsItem(sal_uInt32 nVal)
Definition: svx3ditems.hxx:49
void ClickLight(const LightButton &rBtn)
Definition: float3d.cxx:2629
static SVX_DLLPRIVATE void LBSelectColor(ColorListBox *pLb, const Color &rColor)
Definition: float3d.cxx:2739
std::unique_ptr< ColorListBox > m_xLbMatSpecular
Definition: float3d.hxx:176
void InitColorLB()
Definition: float3d.cxx:2768
SfxUInt16Item makeSvx3DMaterialSpecularIntensityItem(sal_uInt16 nVal)
Definition: svx3ditems.hxx:115
TRISTATE_TRUE
#define SDRATTR_3DSCENE_LIGHTON_8
Definition: svddef.hxx:378
std::unique_ptr< weld::MetricSpinButton > m_xMtrPercentDiagonal
Definition: float3d.hxx:96
#define XATTR_FILLCOLOR
Definition: xdef.hxx:108
sal_uInt16 NextWhich()
Svx3DCtrlItem(sal_uInt16, SfxBindings *)
Definition: float3d.cxx:2893
std::unique_ptr< weld::Button > m_xBtnAssign
Definition: float3d.hxx:91
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
Definition: dlgutil.cxx:31
#define SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY
Definition: svddef.hxx:338
std::unique_ptr< weld::Label > m_xFtDepth
Definition: float3d.hxx:101
SfxBoolItem makeSvx3DLightOnOff7Item(bool bVal)
Definition: svx3ditems.hxx:226
SfxUInt16Item makeSvx3DPercentDiagonalItem(sal_uInt16 nVal)
Definition: svx3ditems.hxx:33
SfxModule * GetModule() const
void SetNoSelection()
Definition: colorbox.hxx:124
#define SDRATTR_3DSCENE_LIGHTCOLOR_3
Definition: svddef.hxx:364
friend class Svx3DCtrlItem
Definition: float3d.hxx:81
std::unique_ptr< weld::MetricSpinButton > m_xMtrDistance
Definition: float3d.hxx:126
std::unique_ptr< weld::ToggleButton > m_xBtnTexCircleY
Definition: float3d.hxx:163
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
#define SDRATTR_SHADOW_LAST
Definition: svddef.hxx:178
short Execute(weld::Window *pParent)
std::unique_ptr< weld::Container > m_xFLSegments
Definition: float3d.hxx:104
SVX_DLLPRIVATE sal_uInt16 GetLightSource(const LightButton *pBtn)
Definition: float3d.cxx:2787
std::unique_ptr< weld::ToggleButton > m_xBtnTwoSidedLighting
Definition: float3d.hxx:113
SfxBoolItem makeSvx3DLightOnOff1Item(bool bVal)
Definition: svx3ditems.hxx:202
std::unique_ptr< Svx3DWinImpl > mpImpl
Definition: float3d.hxx:209
std::unique_ptr< weld::Button > m_xBtnAmbientColor
Definition: float3d.hxx:149
sal_Int16 const nValue
Definition: fmsrccfg.cxx:81
SfxItemPool * pPool
Definition: float3d.cxx:60
bool isLightOn() const
Definition: float3d.hxx:54
#define SDRATTR_3DOBJ_NORMALS_INVERT
Definition: svddef.hxx:331
#define SDRATTR_3DSCENE_LIGHTCOLOR_6
Definition: svddef.hxx:367
std::unique_ptr< weld::ToggleButton > m_xButton
Definition: float3d.hxx:73
Svx3DChildWindow(vcl::Window *, sal_uInt16, SfxBindings *, SfxChildWinInfo *)
Definition: float3d.cxx:2881
std::unique_ptr< weld::Button > m_xBtnConvertTo3D
Definition: float3d.hxx:192
virtual OutputDevice & get_ref_device()=0
#define SDRATTR_3DSCENE_FOCAL_LENGTH
Definition: svddef.hxx:360
#define SDRATTR_3DSCENE_LIGHTON_5
Definition: svddef.hxx:375
std::unique_ptr< weld::ToggleButton > m_xBtnTexObjectY
Definition: float3d.hxx:161
sal_uInt8 GetBlue() const
#define SDRATTR_3DOBJ_END_ANGLE
Definition: svddef.hxx:328
TRISTATE_INDET
bool get_active() const
Definition: float3d.hxx:56
SfxBindings *const pBindings
Definition: float3d.hxx:203
SvxColorItem makeSvx3DMaterialSpecularItem(const Color &rCol)
Definition: svx3ditems.hxx:111
std::unique_ptr< weld::CustomWeld > m_xCtlLightPreviewWin
Definition: float3d.hxx:188
#define SDRATTR_3DSCENE_LIGHTON_3
Definition: svddef.hxx:373
std::unique_ptr< SvxConvertTo3DItem > pConvertTo3DLatheItem
Definition: float3d.hxx:207
#define SDRATTR_3DSCENE_LIGHTDIRECTION_5
Definition: svddef.hxx:383
#define SDRATTR_3D_FIRST
Definition: svddef.hxx:320
void SetColor(const Color &rColor)
std::unique_ptr< weld::ToggleButton > m_xBtnPerspective
Definition: float3d.hxx:194
std::unique_ptr< weld::ToggleButton > m_xBtnTexCircleX
Definition: float3d.hxx:160
std::unique_ptr< ColorListBox > m_xLbLight3
Definition: float3d.hxx:141
SfxBoolItem makeSvx3DNormalsInvertItem(bool bVal)
Definition: svx3ditems.hxx:79
std::unique_ptr< weld::ToggleButton > m_xBtnTexParallelX
Definition: float3d.hxx:159
void SelectEntry(const NamedColor &rColor)
Definition: tbcontrl.cxx:4198
#define SDRATTR_3DSCENE_LIGHTCOLOR_1
Definition: svddef.hxx:362
void set_active(bool bActive)
Definition: float3d.hxx:57
bool bUpdate
Definition: float3d.hxx:197
#define SDRATTR_3DSCENE_PERSPECTIVE
Definition: svddef.hxx:358
std::unique_ptr< ColorListBox > m_xLbMatEmission
Definition: float3d.hxx:172
std::unique_ptr< weld::MetricSpinButton > m_xMtrEndAngle
Definition: float3d.hxx:100
std::unique_ptr< Svx3DCtrlItem > pControllerItem
Definition: float3d.hxx:204
SfxUInt32Item makeSvx3DFocalLengthItem(sal_uInt32 nVal)
Definition: svx3ditems.hxx:158
SvxConvertTo3DItem(sal_uInt16 nId, SfxBindings *pBindings)
Definition: float3d.cxx:2907
FieldUnit GetFieldUnit() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
std::unique_ptr< LightButton > m_xBtnLight8
Definition: float3d.hxx:138
std::unique_ptr< LightButton > m_xBtnLight3
Definition: float3d.hxx:133
#define SDRATTR_3DSCENE_LIGHTCOLOR_2
Definition: svddef.hxx:363
#define SDRATTR_3DSCENE_LIGHTDIRECTION_6
Definition: svddef.hxx:384
std::unique_ptr< weld::Container > m_xFLMatSpecular
Definition: float3d.hxx:175
#define SDRATTR_3DOBJ_TEXTURE_PROJ_Y
Definition: svddef.hxx:333
std::unique_ptr< weld::Container > m_xFLLight
Definition: float3d.hxx:130
#define SDRATTR_3DSCENE_LIGHTDIRECTION_4
Definition: svddef.hxx:382
#define SDRATTR_3DSCENE_LIGHTDIRECTION_8
Definition: svddef.hxx:386
SVX_DLLPRIVATE LightButton * GetLbByButton(const weld::Button *pBtn)
Definition: float3d.cxx:2856
#define SDRATTR_3DOBJ_HORZ_SEGS
Definition: svddef.hxx:326
std::unique_ptr< weld::Label > m_xFtPercentDiagonal
Definition: float3d.hxx:95
std::unique_ptr< LightButton > m_xBtnLight2
Definition: float3d.hxx:132
std::unique_ptr< LightButton > m_xBtnLight4
Definition: float3d.hxx:134
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
#define SDRATTR_3DOBJ_BACKSCALE
Definition: svddef.hxx:324
ViewType3D
Definition: float3d.hxx:32
#define SDRATTR_3DSCENE_LIGHTON_1
Definition: svddef.hxx:371
std::unique_ptr< LightButton > m_xBtnLight1
Definition: float3d.hxx:131
void UpdatePreview()
Definition: float3d.cxx:2745
std::unique_ptr< LightButton > m_xBtnLight7
Definition: float3d.hxx:137
SfxUInt32Item makeSvx3DDistanceItem(sal_uInt32 nVal)
Definition: svx3ditems.hxx:154
#define SDRATTR_SHADOW
Definition: svddef.hxx:171
std::unique_ptr< ColorListBox > m_xLbLight4
Definition: float3d.hxx:142
SfxUInt16Item makeSvx3DBackscaleItem(sal_uInt16 nVal)
Definition: svx3ditems.hxx:37
#define XATTR_LINESTYLE
Definition: xdef.hxx:90
std::unique_ptr< ColorListBox > m_xLbLight5
Definition: float3d.hxx:143
SfxBindings & GetBindings()
#define SDRATTR_3DOBJ_DEPTH
Definition: svddef.hxx:325
std::unique_ptr< weld::ToggleButton > m_xBtnGeo
Definition: float3d.hxx:85
const Size & GetMinOutputSizePixel() const
#define SDRATTR_START
Definition: svddef.hxx:168
SVX_DLLPRIVATE void Reset()
Definition: float3d.cxx:447
std::unique_ptr< weld::ToggleButton > m_xBtnNormalsObj
Definition: float3d.hxx:109
std::unique_ptr< ColorListBox > m_xLbLight8
Definition: float3d.hxx:146
#define XATTR_FILLSTYLE
Definition: xdef.hxx:107
IMPL_LINK(Svx3DWin, ClickViewTypeHdl, weld::Button &, rBtn, void)
Definition: float3d.cxx:2232
virtual void Resize() override
Definition: float3d.cxx:2150
SfxUInt32Item makeSvx3DHorizontalSegmentsItem(sal_uInt32 nVal)
Definition: svx3ditems.hxx:45
std::unique_ptr< weld::MetricSpinButton > m_xMtrMatSpecularIntensity
Definition: float3d.hxx:178
virtual ~Svx3DWin() override
Definition: float3d.cxx:329
std::unique_ptr< ColorListBox > m_xLbLight7
Definition: float3d.hxx:145
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
std::unique_ptr< weld::Container > m_xFLMaterial
Definition: float3d.hxx:168
SfxItemPool * GetPool() const
#define SDRATTR_3DSCENE_DISTANCE
Definition: svddef.hxx:359
SvxColorItem makeSvx3DLightcolor1Item(const Color &rCol)
Definition: svx3ditems.hxx:166
const Color & GetColor() const
std::unique_ptr< weld::MetricSpinButton > m_xMtrSlant
Definition: float3d.hxx:123
std::unique_ptr< weld::ToggleButton > m_xBtnRepresentation
Definition: float3d.hxx:86
#define SDRATTR_3DSCENE_LIGHTDIRECTION_7
Definition: svddef.hxx:385
#define SDRATTR_3DSCENE_LIGHTCOLOR_4
Definition: svddef.hxx:365
std::unique_ptr< ColorListBox > m_xLbMatColor
Definition: float3d.hxx:170
Point LogicToPixel(const Point &rLogicPt) const
std::unique_ptr< weld::ToggleButton > m_xBtnTexLuminance
Definition: float3d.hxx:153
sal_uInt8 GetGreen() const
bool get_prev_active() const
Definition: float3d.hxx:69
SfxUInt32Item makeSvx3DDepthItem(sal_uInt32 nVal)
Definition: svx3ditems.hxx:41
SfxBoolItem makeSvx3DShadow3DItem(bool bVal)
Definition: svx3ditems.hxx:103
SvxColorItem makeSvx3DLightcolor4Item(const Color &rCol)
Definition: svx3ditems.hxx:178
void Update(SfxItemSet const &rSet)
Definition: float3d.cxx:461
SvxColorItem makeSvx3DLightcolor8Item(const Color &rCol)
Definition: svx3ditems.hxx:194
SvxColorItem makeSvx3DMaterialEmissionItem(const Color &rCol)
Definition: svx3ditems.hxx:107
std::unique_ptr< Svx3DPreviewControl > m_xCtlPreview
Definition: float3d.hxx:180
SvxColorItem makeSvx3DAmbientcolorItem(const Color &rCol)
Definition: svx3ditems.hxx:198
void GetAttr(SfxItemSet &rSet)
Definition: float3d.cxx:1643
LightButton(std::unique_ptr< weld::ToggleButton > xButton)
Definition: float3d.cxx:2929
virtual void dispose() override
Definition: float3d.cxx:334
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define SDRATTR_3DOBJ_TEXTURE_MODE
Definition: svddef.hxx:340
std::unique_ptr< weld::MetricSpinButton > m_xMtrBackscale
Definition: float3d.hxx:98
std::unique_ptr< weld::MetricSpinButton > m_xMtrFocalLength
Definition: float3d.hxx:127
void Initialize(SfxChildWinInfo *pInfo)
std::unique_ptr< weld::ToggleButton > m_xBtnTexParallelY
Definition: float3d.hxx:162
std::unique_ptr< weld::Button > m_xBtnMatColor
Definition: float3d.hxx:171
#define SDRATTR_3DSCENE_LIGHTCOLOR_8
Definition: svddef.hxx:369
void show()
Definition: colorbox.hxx:137
static SfxViewFrame * Current()
std::unique_ptr< weld::ComboBox > m_xLbShademode
Definition: float3d.hxx:118
#define SDRATTR_3DOBJ_MAT_SPECULAR
Definition: svddef.hxx:337
Color const & GetSelectEntryColor() const
Definition: colorbox.hxx:118
SfxBoolItem makeSvx3DLightOnOff4Item(bool bVal)
Definition: svx3ditems.hxx:214
SfxItemState
IMPL_LINK_NOARG(Svx3DWin, ClickUpdateHdl, weld::Button &, void)
Definition: float3d.cxx:2201
std::unique_ptr< Svx3DLightControl > m_xLightPreview
Definition: float3d.hxx:187
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
std::unique_ptr< SvxConvertTo3DItem > pConvertTo3DItem
Definition: float3d.hxx:206
void DocumentReload()
Definition: float3d.cxx:2763
std::unique_ptr< weld::Scale > m_xVertScale
Definition: float3d.hxx:185
std::unique_ptr< weld::CustomWeld > m_xCtlPreviewWin
Definition: float3d.hxx:181
std::unique_ptr< weld::Widget > m_xLightPreviewGrid
Definition: float3d.hxx:183
SfxUInt32Item makeSvx3DEndAngleItem(sal_uInt32 nVal)
Definition: svx3ditems.hxx:53
RET_OK
SfxBoolItem makeSvx3DLightOnOff8Item(bool bVal)
Definition: svx3ditems.hxx:230
static VclPtr< reference_type > Create(Arg &&...arg)
#define SDRATTR_3DSCENE_LIGHTON_7
Definition: svddef.hxx:377
std::unique_ptr< weld::Container > m_xFLRepresentation
Definition: float3d.hxx:117
std::unique_ptr< ColorListBox > m_xLbLight1
Definition: float3d.hxx:139
std::unique_ptr< weld::MetricSpinButton > m_xMtrDepth
Definition: float3d.hxx:102
SfxBoolItem makeSvx3DLightOnOff3Item(bool bVal)
Definition: svx3ditems.hxx:210
std::unique_ptr< weld::ToggleButton > m_xBtnTexObjectX
Definition: float3d.hxx:158
const OUString PERCENT("Percent")
#define SDRATTR_3DOBJ_TEXTURE_PROJ_X
Definition: svddef.hxx:332
#define SDRATTR_3DSCENE_SHADOW_SLANT
Definition: svddef.hxx:387
void set_sensitive(bool sensitive)
Definition: colorbox.hxx:135
std::unique_ptr< weld::ToggleButton > m_xBtnTexColor
Definition: float3d.hxx:154
SdrOnOffItem makeSdrShadowItem(bool bShadow)
Definition: sdshitm.hxx:25
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
std::unique_ptr< weld::Label > m_xFtSlant
Definition: float3d.hxx:122
std::unique_ptr< weld::Button > m_xBtnLightColor
Definition: float3d.hxx:147
std::unique_ptr< weld::ToggleButton > m_xBtnNormalsFlat
Definition: float3d.hxx:110
std::unique_ptr< SvxLightCtl3D > m_xCtlLightPreview
Definition: float3d.hxx:189
#define SDRATTR_3DSCENE_AMBIENTCOLOR
Definition: svddef.hxx:370
std::unique_ptr< weld::Container > m_xFLGeometrie
Definition: float3d.hxx:94
std::unique_ptr< weld::ToggleButton > m_xBtnTexture
Definition: float3d.hxx:88
SfxBoolItem makeSvx3DTwoSidedLightingItem(bool bVal)
Definition: svx3ditems.hxx:162
std::unique_ptr< ColorListBox > m_xLbLight2
Definition: float3d.hxx:140
SfxDispatcher * GetDispatcher() const
#define SDRATTR_3DOBJ_TEXTURE_FILTER
Definition: svddef.hxx:341
SvxColorItem makeSvx3DLightcolor3Item(const Color &rCol)
Definition: svx3ditems.hxx:174
MapUnit
SfxBoolItem makeSvx3DLightOnOff5Item(bool bVal)
Definition: svx3ditems.hxx:218
MapUnit ePoolUnit
Definition: float3d.hxx:210
virtual void Resize() override
#define SDRATTR_3DOBJ_SHADOW_3D
Definition: svddef.hxx:334
#define SDRATTR_3DSCENE_LIGHTDIRECTION_3
Definition: svddef.hxx:381
#define SDRATTR_3DSCENE_LIGHTCOLOR_7
Definition: svddef.hxx:368
#define SDRATTR_3DSCENE_LIGHTON_6
Definition: svddef.hxx:376
std::unique_ptr< weld::Button > m_xBtnEmissionColor
Definition: float3d.hxx:173
std::unique_ptr< weld::ToggleButton > m_xBtnTexReplace
Definition: float3d.hxx:155
std::unique_ptr< LightButton > m_xBtnLight5
Definition: float3d.hxx:135
SfxUInt16Item makeSvx3DShadowSlantItem(sal_uInt16 nVal)
Definition: svx3ditems.hxx:266
#define SDRATTR_3DSCENE_LIGHTDIRECTION_1
Definition: svddef.hxx:379
SvxColorItem makeSvx3DLightcolor6Item(const Color &rCol)
Definition: svx3ditems.hxx:186
#define SDRATTR_3DSCENE_LIGHTDIRECTION_2
Definition: svddef.hxx:380
virtual void dispose() override
TriState
virtual void set_size_request(int nWidth, int nHeight)=0
SfxBoolItem makeSvx3DTextureFilterItem(bool bVal)
Definition: svx3ditems.hxx:139
void switchLightOn(bool bOn)
Definition: float3d.cxx:2937
sal_Int32 nState
#define SDRATTR_3DSCENE_LIGHTCOLOR_5
Definition: svddef.hxx:366
std::unique_ptr< weld::SpinButton > m_xNumHorizontal
Definition: float3d.hxx:105
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
std::unique_ptr< weld::Button > m_xBtnLatheObject
Definition: float3d.hxx:193
aStr
#define SDRATTR_3D_LAST
Definition: svddef.hxx:390
SvxColorItem makeSvx3DLightcolor5Item(const Color &rCol)
Definition: svx3ditems.hxx:182
std::unique_ptr< ColorListBox > m_xLbLight6
Definition: float3d.hxx:144
SFX_IMPL_DOCKINGWINDOW_WITHID(SvxFontWorkChildWindow, SID_FONTWORK)
FieldUnit eFUnit
Definition: float3d.hxx:211
std::unique_ptr< weld::Scale > m_xHoriScale
Definition: float3d.hxx:184
SfxBoolItem makeSvx3DLightOnOff6Item(bool bVal)
Definition: svx3ditems.hxx:222
std::unique_ptr< weld::Container > m_xFLTexture
Definition: float3d.hxx:152
std::unique_ptr< weld::ComboBox > m_xLbMatFavorites
Definition: float3d.hxx:169
std::unique_ptr< weld::ToggleButton > m_xBtnNormalsInvert
Definition: float3d.hxx:112
std::unique_ptr< weld::Container > m_xFLCamera
Definition: float3d.hxx:125
std::unique_ptr< weld::Button > m_xBtnSpecularColor
Definition: float3d.hxx:177
#define SDRATTR_3DOBJ_TEXTURE_KIND
Definition: svddef.hxx:339