LibreOffice Module svx (master)  1
dlgctl3d.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 
21 #include <svx/def3d.hxx>
22 #include <svx/dlgctl3d.hxx>
23 #include <svx/strings.hrc>
24 #include <svx/view3d.hxx>
25 #include <svx/fmmodel.hxx>
26 #include <svl/itempool.hxx>
27 #include <svx/fmpage.hxx>
28 #include <svx/sphere3d.hxx>
29 #include <svx/cube3d.hxx>
30 #include <svx/scene3d.hxx>
31 #include <vcl/svapp.hxx>
32 #include <vcl/builderfactory.hxx>
33 #include <svx/helperhittest3d.hxx>
35 #include <svx/polygn3d.hxx>
36 #include <svx/xfillit0.hxx>
37 #include <svx/xflclit.hxx>
38 #include <svx/xlineit0.hxx>
39 #include <svx/xlnclit.hxx>
40 #include <svx/xlnwtit.hxx>
41 #include <helpids.h>
42 #include <svx/dialmgr.hxx>
43 #include <tools/helpers.hxx>
44 #include <vcl/settings.hxx>
45 
46 using namespace com::sun::star;
47 
49 : Control(pParent, nStyle),
50  mpFmPage(nullptr),
51  mpScene(nullptr),
52  mp3DObj(nullptr),
53  mnObjectType(SvxPreviewObjectType::SPHERE)
54 {
55  Construct();
56 
57  // do not paint background self, DrawingLayer paints this buffered and as page
59  SetBackground();
60 }
61 
63 {
64  return LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont));
65 }
66 
68 
70 {
71  disposeOnce();
72 }
73 
75 {
76  mp3DView.reset();
77  mpModel.reset();
79 }
80 
82 {
83  // Do never mirror the preview window. This explicitly includes right
84  // to left writing environments.
85  EnableRTL (false);
86  SetMapMode(MapMode(MapUnit::Map100thMM));
87 
88  // Model
89  mpModel.reset(new FmFormModel());
90  mpModel->GetItemPool().FreezeIdRanges();
91 
92  // Page
93  mpFmPage = new FmFormPage( *mpModel );
94  mpModel->InsertPage( mpFmPage, 0 );
95 
96  // 3D View
97  mp3DView.reset(new E3dView(*mpModel, this ));
98  mp3DView->SetBufferedOutputAllowed(true);
99  mp3DView->SetBufferedOverlayAllowed(true);
100 
101  // 3D Scene
102  mpScene = new E3dScene(*mpModel);
103 
104  // initially create object
106 
107  // camera and perspective
108  Camera3D rCamera = mpScene->GetCamera();
109  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
110  double fW = rVolume.getWidth();
111  double fH = rVolume.getHeight();
112  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
113 
114  rCamera.SetAutoAdjustProjection(false);
115  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
116  basegfx::B3DPoint aLookAt;
117  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
118  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
119  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
120  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
121  rCamera.SetFocalLength(fDefaultCamFocal);
122 
123  mpScene->SetCamera( rCamera );
125 
126  basegfx::B3DHomMatrix aRotation;
127  aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
128  aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
129  mpScene->SetTransform(aRotation * mpScene->GetTransform());
130 
131  // invalidate SnapRects of objects
133 
134  SfxItemSet aSet( mpModel->GetItemPool(),
137  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
138  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
139  aSet.Put( XFillColorItem( "", COL_WHITE ) );
140 
141  mpScene->SetMergedItemSet(aSet);
142 
143  // PageView
144  SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
145  mp3DView->hideMarkHandles();
146 
147  // mark scene
148  mp3DView->MarkObj( mpScene, pPageView );
149 }
150 
152 {
153  // size of page
154  Size aSize( GetSizePixel() );
155  aSize = PixelToLogic( aSize );
156  mpFmPage->SetSize( aSize );
157 
158  // set size
159  Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
160  Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
161  (aSize.Height() - aObjSize.Height()) / 2);
162  tools::Rectangle aRect( aObjPoint, aObjSize);
163  mpScene->SetSnapRect( aRect );
164 }
165 
167 {
168  mp3DView->CompleteRedraw(&rRenderContext, vcl::Region(rRect));
169 }
170 
172 {
174 
175  if( rMEvt.IsShift() && rMEvt.IsMod1() )
176  {
178  {
180  }
181  else
182  {
184  }
185  }
186 }
187 
189 {
190  if( mnObjectType != nType || !mp3DObj)
191  {
193  mnObjectType = nType;
194 
195  if( mp3DObj )
196  {
197  aSet.Put(mp3DObj->GetMergedItemSet());
199  // always use SdrObject::Free(...) for SdrObjects (!)
200  SdrObject* pTemp(mp3DObj);
201  SdrObject::Free(pTemp);
202  }
203 
204  switch( nType )
205  {
207  {
208  mp3DObj = new E3dSphereObj(
209  *mpModel,
210  mp3DView->Get3DDefaultAttributes(),
211  basegfx::B3DPoint( 0, 0, 0 ),
212  basegfx::B3DVector( 5000, 5000, 5000 ));
213  }
214  break;
215 
217  {
218  mp3DObj = new E3dCubeObj(
219  *mpModel,
220  mp3DView->Get3DDefaultAttributes(),
221  basegfx::B3DPoint( -2500, -2500, -2500 ),
222  basegfx::B3DVector( 5000, 5000, 5000 ));
223  }
224  break;
225  }
226 
227  if (mp3DObj)
228  {
230  mp3DObj->SetMergedItemSet(aSet);
231  }
232 
233  Resize();
234  }
235 }
236 
238 {
239  return mp3DObj->GetMergedItemSet();
240 }
241 
243 {
244  mp3DObj->SetMergedItemSet(rAttr, true);
245  Resize();
246 }
247 
249  : mpFmPage(nullptr)
250  , mpScene(nullptr)
251  , mp3DObj(nullptr)
252  , mnObjectType(SvxPreviewObjectType::SPHERE)
253 {
254 }
255 
257 {
258  Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont)));
259  pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
260  CustomWidgetController::SetDrawingArea(pDrawingArea);
261  SetOutputSizePixel(aSize);
262 
263  Construct();
264 }
265 
267 {
268  mp3DView.reset();
269  mpModel.reset();
270 }
271 
273 {
274  // Do never mirror the preview window. This explicitly includes right
275  // to left writing environments.
276  EnableRTL (false);
278  rDevice.SetMapMode(MapMode(MapUnit::Map100thMM));
279 
280  // Model
281  mpModel.reset(new FmFormModel());
282  mpModel->GetItemPool().FreezeIdRanges();
283 
284  // Page
285  mpFmPage = new FmFormPage( *mpModel );
286  mpModel->InsertPage( mpFmPage, 0 );
287 
288  // 3D View
289  mp3DView.reset(new E3dView(*mpModel, &rDevice));
290  mp3DView->SetBufferedOutputAllowed(true);
291  mp3DView->SetBufferedOverlayAllowed(true);
292 
293  // 3D Scene
294  mpScene = new E3dScene(*mpModel);
295 
296  // initially create object
298 
299  // camera and perspective
300  Camera3D rCamera = mpScene->GetCamera();
301  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
302  double fW = rVolume.getWidth();
303  double fH = rVolume.getHeight();
304  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
305 
306  rCamera.SetAutoAdjustProjection(false);
307  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
308  basegfx::B3DPoint aLookAt;
309  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
310  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
311  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
312  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
313  rCamera.SetFocalLength(fDefaultCamFocal);
314 
315  mpScene->SetCamera( rCamera );
317 
318  basegfx::B3DHomMatrix aRotation;
319  aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
320  aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
321  mpScene->SetTransform(aRotation * mpScene->GetTransform());
322 
323  // invalidate SnapRects of objects
325 
326  SfxItemSet aSet( mpModel->GetItemPool(),
329  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
330  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
331  aSet.Put( XFillColorItem( "", COL_WHITE ) );
332 
333  mpScene->SetMergedItemSet(aSet);
334 
335  // PageView
336  SdrPageView* pPageView = mp3DView->ShowSdrPage( mpFmPage );
337  mp3DView->hideMarkHandles();
338 
339  // mark scene
340  mp3DView->MarkObj( mpScene, pPageView );
341 }
342 
344 {
345  // size of page
346  Size aSize(GetOutputSizePixel());
347  aSize = GetDrawingArea()->get_ref_device().PixelToLogic(aSize);
348  mpFmPage->SetSize(aSize);
349 
350  // set size
351  Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
352  Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
353  (aSize.Height() - aObjSize.Height()) / 2);
354  tools::Rectangle aRect( aObjPoint, aObjSize);
355  mpScene->SetSnapRect( aRect );
356 }
357 
359 {
360  mp3DView->CompleteRedraw(&rRenderContext, vcl::Region(rRect));
361 }
362 
364 {
365  if (rMEvt.IsShift() && rMEvt.IsMod1())
366  {
368  {
370  }
371  else
372  {
374  }
375  }
376  return false;
377 }
378 
380 {
381  if( mnObjectType != nType || !mp3DObj)
382  {
384  mnObjectType = nType;
385 
386  if( mp3DObj )
387  {
388  aSet.Put(mp3DObj->GetMergedItemSet());
390  // always use SdrObject::Free(...) for SdrObjects (!)
391  SdrObject* pTemp(mp3DObj);
392  SdrObject::Free(pTemp);
393  }
394 
395  switch( nType )
396  {
398  {
399  mp3DObj = new E3dSphereObj(
400  *mpModel,
401  mp3DView->Get3DDefaultAttributes(),
402  basegfx::B3DPoint( 0, 0, 0 ),
403  basegfx::B3DVector( 5000, 5000, 5000 ));
404  }
405  break;
406 
408  {
409  mp3DObj = new E3dCubeObj(
410  *mpModel,
411  mp3DView->Get3DDefaultAttributes(),
412  basegfx::B3DPoint( -2500, -2500, -2500 ),
413  basegfx::B3DVector( 5000, 5000, 5000 ));
414  }
415  break;
416  }
417 
418  if (mp3DObj)
419  {
421  mp3DObj->SetMergedItemSet(aSet);
422  }
423 
424  Invalidate();
425  }
426 }
427 
429 {
430  return mp3DObj->GetMergedItemSet();
431 }
432 
434 {
435  mp3DObj->SetMergedItemSet(rAttr, true);
436  Resize();
437 }
438 
439 #define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
440 #define RADIUS_LAMP_SMALL (600.0)
441 #define RADIUS_LAMP_BIG (1000.0)
442 #define NO_LIGHT_SELECTED (0xffffffff)
443 #define MAX_NUMBER_LIGHTS (8)
444 
445 static const sal_Int32 g_nInteractionStartDistance = 5 * 5 * 2;
446 
448 : Svx3DPreviewControl(pParent, nStyle),
449  maChangeCallback(),
450  maSelectionChangeCallback(),
451  maSelectedLight(NO_LIGHT_SELECTED),
452  mpExpansionObject(nullptr),
453  mpLampBottomObject(nullptr),
454  mpLampShaftObject(nullptr),
455  maLightObjects(MAX_NUMBER_LIGHTS, nullptr),
456  mfRotateX(-20.0),
457  mfRotateY(45.0),
458  mfRotateZ(0.0),
459  maActionStartPoint(),
460  mfSaveActionStartHor(0.0),
461  mfSaveActionStartVer(0.0),
462  mfSaveActionStartRotZ(0.0),
463  mbMouseMoved(false),
464  mbGeometrySelected(false)
465 {
466  Construct2();
467 }
468 
470 {
471  {
472  // hide all page stuff, use control background (normally gray)
473  const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
474  mp3DView->SetPageVisible(false);
475  mp3DView->SetApplicationBackgroundColor(aDialogColor);
476  mp3DView->SetApplicationDocumentColor(aDialogColor);
477  }
478 
479  {
480  // create invisible expansion object
481  const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
483  *mpModel,
484  mp3DView->Get3DDefaultAttributes(),
485  basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
486  basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
488  SfxItemSet aSet(mpModel->GetItemPool());
489  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
490  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
492  }
493 
494  {
495  // create lamp control object (Yellow lined object)
496  // base circle
499  basegfx::B3DHomMatrix aTransform;
500 
501  aTransform.rotate(F_PI2, 0.0, 0.0);
502  aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
503  a3DCircle.transform(aTransform);
504 
505  // create object for it
507  *mpModel,
508  basegfx::B3DPolyPolygon(a3DCircle));
510 
511  // half circle with stand
512  basegfx::B2DPolygon a2DHalfCircle;
518 
519  // create object for it
521  *mpModel,
522  basegfx::B3DPolyPolygon(a3DHalfCircle));
524 
525  // initially invisible
526  SfxItemSet aSet(mpModel->GetItemPool());
527  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
528  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
529 
532  }
533 
534  {
535  // change camera settings
536  Camera3D rCamera = mpScene->GetCamera();
537  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
538  double fW = rVolume.getWidth();
539  double fH = rVolume.getHeight();
540  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
541 
542  rCamera.SetAutoAdjustProjection(false);
543  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
544  basegfx::B3DPoint aLookAt;
545  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
546  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
547  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
548  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
549  rCamera.SetFocalLength(fDefaultCamFocal);
550 
551  mpScene->SetCamera( rCamera );
552 
553  basegfx::B3DHomMatrix aNeutral;
554  mpScene->SetTransform(aNeutral);
555  }
556 
557  // invalidate SnapRects of objects
559 }
560 
562 {
563  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
564  {
565  // get rid of possible existing light object
566  if(maLightObjects[a])
567  {
568  mpScene->RemoveObject(maLightObjects[a]->GetOrdNum());
569  // always use SdrObject::Free(...) for SdrObjects (!)
570  SdrObject* pTemp(maLightObjects[a]);
571  SdrObject::Free(pTemp);
572  maLightObjects[a] = nullptr;
573  }
574 
575  if(GetLightOnOff(a))
576  {
577  const bool bIsSelectedLight(a == maSelectedLight);
579  aDirection.normalize();
580  aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
581 
582  const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
583  E3dObject* pNewLight = new E3dSphereObj(
584  *mpModel,
585  mp3DView->Get3DDefaultAttributes(),
586  basegfx::B3DPoint( 0, 0, 0 ),
587  basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
588  mpScene->InsertObject(pNewLight);
589 
590  basegfx::B3DHomMatrix aTransform;
591  aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
592  pNewLight->SetTransform(aTransform);
593 
594  SfxItemSet aSet(mpModel->GetItemPool());
595  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
596  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
597  aSet.Put( XFillColorItem(OUString(), GetLightColor(a)));
598  pNewLight->SetMergedItemSet(aSet);
599 
600  maLightObjects[a] = pNewLight;
601  }
602  }
603 }
604 
606 {
608  {
609  // make mpLampBottomObject/mpLampShaftObject invisible
610  SfxItemSet aSet(mpModel->GetItemPool());
611  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
612  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
615  }
616  else
617  {
619  aDirection.normalize();
620 
621  // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
622  SfxItemSet aSet(mpModel->GetItemPool());
623  aSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) );
624  aSet.Put( XLineColorItem(OUString(), COL_YELLOW));
625  aSet.Put( XLineWidthItem(0));
626  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
629 
630  // adapt transformation of mpLampShaftObject
631  basegfx::B3DHomMatrix aTransform;
632  double fRotateY(0.0);
633 
634  if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
635  {
636  fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
637  }
638 
639  aTransform.rotate(0.0, fRotateY, 0.0);
640  mpLampShaftObject->SetTransform(aTransform);
641 
642  // adapt transformation of selected light
643  E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
644 
645  if(pSelectedLight)
646  {
647  aTransform.identity();
648  aTransform.translate(
649  aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
650  aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
651  aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
652  pSelectedLight->SetTransform(aTransform);
653  }
654  }
655 }
656 
658 {
659  if(mpScene)
660  {
661  const Point aPosLogic(PixelToLogic(aPosPixel));
662  const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
663  std::vector< const E3dCompoundObject* > aResult;
664  getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
665 
666  if(!aResult.empty())
667  {
668  // exclude expansion object which will be part of
669  // the hits. It's invisible, but for HitTest, it's included
670  const E3dCompoundObject* pResult = nullptr;
671 
672  for(auto const & b: aResult)
673  {
674  if(b && b != mpExpansionObject)
675  {
676  pResult = b;
677  break;
678  }
679  }
680 
681  if(pResult == mp3DObj)
682  {
683  if(!mbGeometrySelected)
684  {
685  mbGeometrySelected = true;
689  Invalidate();
690 
692  {
694  }
695  }
696  }
697  else
698  {
699  sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
700 
701  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
702  {
703  if(maLightObjects[a] && maLightObjects[a] == pResult)
704  {
705  aNewSelectedLight = a;
706  }
707  }
708 
709  if(aNewSelectedLight != maSelectedLight)
710  {
711  SelectLight(aNewSelectedLight);
712 
714  {
716  }
717  }
718  }
719  }
720  }
721 }
722 
724 {
725  Svx3DPreviewControl::Paint(rRenderContext, rRect);
726 }
727 
729 {
730  bool bCallParent(true);
731 
732  // switch state
733  if(rMEvt.IsLeft())
734  {
736  {
737  mbMouseMoved = false;
738  bCallParent = false;
740  StartTracking();
741  }
742  else
743  {
744  // Single click without moving much trying to do a selection
745  TrySelection(rMEvt.GetPosPixel());
746  bCallParent = false;
747  }
748  }
749 
750  // call parent
751  if(bCallParent)
752  {
754  }
755 }
756 
758 {
759  if(rTEvt.IsTrackingEnded())
760  {
761  if(rTEvt.IsTrackingCanceled())
762  {
763  if(mbMouseMoved)
764  {
765  // interrupt tracking
766  mbMouseMoved = false;
767 
769  {
771  }
772  else
773  {
775  }
776 
777  if(maChangeCallback.IsSet())
778  {
779  maChangeCallback.Call(this);
780  }
781  }
782  }
783  else
784  {
785  const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
786 
787  if(mbMouseMoved)
788  {
789  // was change interactively
790  }
791  else
792  {
793  // simple click without much movement, try selection
794  TrySelection(rMEvt.GetPosPixel());
795  }
796  }
797  }
798  else
799  {
800  const MouseEvent& rMEvt = rTEvt.GetMouseEvent();
801  Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
802 
803  if(!mbMouseMoved)
804  {
805  if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > g_nInteractionStartDistance)
806  {
808  {
810  }
811  else
812  {
813  // interaction start, save values
815  }
816 
817  mbMouseMoved = true;
818  }
819  }
820 
821  if(mbMouseMoved)
822  {
824  {
825  double fNewRotX = mfSaveActionStartVer - basegfx::deg2rad(aDeltaPos.Y());
826  double fNewRotY = mfSaveActionStartHor + basegfx::deg2rad(aDeltaPos.X());
827 
828  // cut horizontal
829  while(fNewRotY < 0.0)
830  {
831  fNewRotY += F_2PI;
832  }
833 
834  while(fNewRotY >= F_2PI)
835  {
836  fNewRotY -= F_2PI;
837  }
838 
839  // cut vertical
840  if(fNewRotX < -F_PI2)
841  {
842  fNewRotX = -F_PI2;
843  }
844 
845  if(fNewRotX > F_PI2)
846  {
847  fNewRotX = F_PI2;
848  }
849 
850  SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
851 
852  if(maChangeCallback.IsSet())
853  {
854  maChangeCallback.Call(this);
855  }
856  }
857  else
858  {
859  // interaction in progress
860  double fNewPosHor = mfSaveActionStartHor + static_cast<double>(aDeltaPos.X());
861  double fNewPosVer = mfSaveActionStartVer - static_cast<double>(aDeltaPos.Y());
862 
863  // cut horizontal
864  fNewPosHor = NormAngle360(fNewPosHor);
865 
866  // cut vertical
867  if(fNewPosVer < -90.0)
868  {
869  fNewPosVer = -90.0;
870  }
871 
872  if(fNewPosVer > 90.0)
873  {
874  fNewPosVer = 90.0;
875  }
876 
877  SetPosition(fNewPosHor, fNewPosVer);
878 
879  if(maChangeCallback.IsSet())
880  {
881  maChangeCallback.Call(this);
882  }
883  }
884  }
885  }
886 }
887 
889 {
890  // set size of page
891  const Size aSize(PixelToLogic(GetSizePixel()));
892  mpFmPage->SetSize(aSize);
893 
894  // set position and size of scene
895  mpScene->SetSnapRect(tools::Rectangle(Point(0, 0), aSize));
896 }
897 
899 {
900  // call parent
902 
903  // apply object rotation
904  if(mp3DObj)
905  {
906  basegfx::B3DHomMatrix aObjectRotation;
907  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
908  mp3DObj->SetTransform(aObjectRotation);
909  }
910 }
911 
913 {
915 }
916 
917 void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
918 {
919  if(IsSelectionValid())
920  {
922  aDirection.normalize();
923  rHor = basegfx::rad2deg(atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI); // 0..360.0
924  rVer = basegfx::rad2deg(atan2(aDirection.getY(), aDirection.getXZLength())); // -90.0..90.0
925  }
926  if(IsGeometrySelected())
927  {
928  rHor = basegfx::rad2deg(mfRotateY); // 0..360.0
929  rVer = basegfx::rad2deg(mfRotateX); // -90.0..90.0
930  }
931 }
932 
933 void Svx3DLightControl::SetPosition(double fHor, double fVer)
934 {
935  if(IsSelectionValid())
936  {
937  // set selected light's direction
938  fHor = basegfx::deg2rad(fHor) - F_PI; // -PI..PI
939  fVer = basegfx::deg2rad(fVer); // -PI2..PI2
940  basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
941  aDirection.normalize();
942 
943  if(!aDirection.equal(GetLightDirection(maSelectedLight)))
944  {
945  // set changed light direction at SdrScene
946  SfxItemSet aSet(mpModel->GetItemPool());
947 
948  switch(maSelectedLight)
949  {
950  case 0: aSet.Put(makeSvx3DLightDirection1Item(aDirection)); break;
951  case 1: aSet.Put(makeSvx3DLightDirection2Item(aDirection)); break;
952  case 2: aSet.Put(makeSvx3DLightDirection3Item(aDirection)); break;
953  case 3: aSet.Put(makeSvx3DLightDirection4Item(aDirection)); break;
954  case 4: aSet.Put(makeSvx3DLightDirection5Item(aDirection)); break;
955  case 5: aSet.Put(makeSvx3DLightDirection6Item(aDirection)); break;
956  case 6: aSet.Put(makeSvx3DLightDirection7Item(aDirection)); break;
957  default:
958  case 7: aSet.Put(makeSvx3DLightDirection8Item(aDirection)); break;
959  }
960 
961  mpScene->SetMergedItemSet(aSet);
962 
963  // correct 3D light's and LampFrame's geometries
965  Invalidate();
966  }
967  }
968  if(IsGeometrySelected())
969  {
970  if(mfRotateX != fVer || mfRotateY != fHor)
971  {
972  mfRotateX = basegfx::deg2rad(fVer);
973  mfRotateY = basegfx::deg2rad(fHor);
974 
975  if(mp3DObj)
976  {
977  basegfx::B3DHomMatrix aObjectRotation;
978  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
979  mp3DObj->SetTransform(aObjectRotation);
980 
981  Invalidate();
982  }
983  }
984  }
985 }
986 
987 void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
988 {
989  if(IsGeometrySelected())
990  {
991  if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
992  {
993  mfRotateX = fRotX;
994  mfRotateY = fRotY;
995  mfRotateZ = fRotZ;
996 
997  if(mp3DObj)
998  {
999  basegfx::B3DHomMatrix aObjectRotation;
1000  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
1001  mp3DObj->SetTransform(aObjectRotation);
1002 
1003  Invalidate();
1004  }
1005  }
1006  }
1007 }
1008 
1009 void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
1010 {
1011  rRotX = mfRotateX;
1012  rRotY = mfRotateY;
1013  rRotZ = mfRotateZ;
1014 }
1015 
1017 {
1018  // call parent
1020 
1022  {
1023  // selected light is no more active, select new one
1025  }
1026 
1027  // local updates
1030  Invalidate();
1031 }
1032 
1033 void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
1034 {
1035  if(nLightNumber > 7)
1036  {
1037  nLightNumber = NO_LIGHT_SELECTED;
1038  }
1039 
1040  if(NO_LIGHT_SELECTED != nLightNumber)
1041  {
1042  if(!GetLightOnOff(nLightNumber))
1043  {
1044  nLightNumber = NO_LIGHT_SELECTED;
1045  }
1046  }
1047 
1048  if(nLightNumber != maSelectedLight)
1049  {
1050  maSelectedLight = nLightNumber;
1051  mbGeometrySelected = false;
1054  Invalidate();
1055  }
1056 }
1057 
1058 bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
1059 {
1060  if(nNum <= 7)
1061  {
1062  const SfxItemSet aLightItemSet(Get3DAttributes());
1063 
1064  switch(nNum)
1065  {
1066  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
1067  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
1068  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
1069  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
1070  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
1071  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
1072  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
1073  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
1074  }
1075  }
1076 
1077  return false;
1078 }
1079 
1081 {
1082  if(nNum <= 7)
1083  {
1084  const SfxItemSet aLightItemSet(Get3DAttributes());
1085 
1086  switch(nNum)
1087  {
1088  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
1089  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
1090  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
1091  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
1092  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
1093  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
1094  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
1095  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
1096  }
1097  }
1098 
1099  return COL_BLACK;
1100 }
1101 
1103 {
1104  if(nNum <= 7)
1105  {
1106  const SfxItemSet aLightItemSet(Get3DAttributes());
1107 
1108  switch(nNum)
1109  {
1110  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1).GetValue();
1111  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2).GetValue();
1112  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3).GetValue();
1113  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4).GetValue();
1114  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5).GetValue();
1115  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6).GetValue();
1116  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7).GetValue();
1117  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8).GetValue();
1118  }
1119  }
1120 
1121  return basegfx::B3DVector();
1122 }
1123 
1125 : maChangeCallback(),
1126  maSelectionChangeCallback(),
1127  maSelectedLight(NO_LIGHT_SELECTED),
1128  mpExpansionObject(nullptr),
1129  mpLampBottomObject(nullptr),
1130  mpLampShaftObject(nullptr),
1131  maLightObjects(MAX_NUMBER_LIGHTS, nullptr),
1132  mfRotateX(-20.0),
1133  mfRotateY(45.0),
1134  mfRotateZ(0.0),
1135  maActionStartPoint(),
1136  mfSaveActionStartHor(0.0),
1137  mfSaveActionStartVer(0.0),
1138  mfSaveActionStartRotZ(0.0),
1139  mbMouseMoved(false),
1140  mbMouseCaptured(false),
1141  mbGeometrySelected(false)
1142 {
1143 }
1144 
1146 {
1147  PreviewControl3D::SetDrawingArea(pDrawingArea);
1148  Construct2();
1149 }
1150 
1152 {
1153  {
1154  // hide all page stuff, use control background (normally gray)
1155  const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
1156  mp3DView->SetPageVisible(false);
1157  mp3DView->SetApplicationBackgroundColor(aDialogColor);
1158  mp3DView->SetApplicationDocumentColor(aDialogColor);
1159  }
1160 
1161  {
1162  // create invisible expansion object
1163  const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
1165  *mpModel,
1166  mp3DView->Get3DDefaultAttributes(),
1167  basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
1168  basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
1170  SfxItemSet aSet(mpModel->GetItemPool());
1171  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
1172  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1174  }
1175 
1176  {
1177  // create lamp control object (Yellow lined object)
1178  // base circle
1181  basegfx::B3DHomMatrix aTransform;
1182 
1183  aTransform.rotate(F_PI2, 0.0, 0.0);
1184  aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
1185  a3DCircle.transform(aTransform);
1186 
1187  // create object for it
1189  *mpModel,
1190  basegfx::B3DPolyPolygon(a3DCircle));
1192 
1193  // half circle with stand
1194  basegfx::B2DPolygon a2DHalfCircle;
1195  a2DHalfCircle.append(basegfx::B2DPoint(RADIUS_LAMP_PREVIEW_SIZE, 0.0));
1200 
1201  // create object for it
1203  *mpModel,
1204  basegfx::B3DPolyPolygon(a3DHalfCircle));
1206 
1207  // initially invisible
1208  SfxItemSet aSet(mpModel->GetItemPool());
1209  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
1210  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1211 
1214  }
1215 
1216  {
1217  // change camera settings
1218  Camera3D rCamera = mpScene->GetCamera();
1219  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
1220  double fW = rVolume.getWidth();
1221  double fH = rVolume.getHeight();
1222  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
1223 
1224  rCamera.SetAutoAdjustProjection(false);
1225  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
1226  basegfx::B3DPoint aLookAt;
1227  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
1228  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
1229  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
1230  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
1231  rCamera.SetFocalLength(fDefaultCamFocal);
1232 
1233  mpScene->SetCamera( rCamera );
1234 
1235  basegfx::B3DHomMatrix aNeutral;
1236  mpScene->SetTransform(aNeutral);
1237  }
1238 
1239  // invalidate SnapRects of objects
1241 }
1242 
1244 {
1245  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
1246  {
1247  // get rid of possible existing light object
1248  if(maLightObjects[a])
1249  {
1250  mpScene->RemoveObject(maLightObjects[a]->GetOrdNum());
1251  // always use SdrObject::Free(...) for SdrObjects (!)
1252  SdrObject* pTemp(maLightObjects[a]);
1253  SdrObject::Free(pTemp);
1254  maLightObjects[a] = nullptr;
1255  }
1256 
1257  if(GetLightOnOff(a))
1258  {
1259  const bool bIsSelectedLight(a == maSelectedLight);
1261  aDirection.normalize();
1262  aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
1263 
1264  const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
1265  E3dObject* pNewLight = new E3dSphereObj(
1266  *mpModel,
1267  mp3DView->Get3DDefaultAttributes(),
1268  basegfx::B3DPoint( 0, 0, 0 ),
1269  basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
1270  mpScene->InsertObject(pNewLight);
1271 
1272  basegfx::B3DHomMatrix aTransform;
1273  aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
1274  pNewLight->SetTransform(aTransform);
1275 
1276  SfxItemSet aSet(mpModel->GetItemPool());
1277  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
1278  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
1279  aSet.Put( XFillColorItem(OUString(), GetLightColor(a)));
1280  pNewLight->SetMergedItemSet(aSet);
1281 
1282  maLightObjects[a] = pNewLight;
1283  }
1284  }
1285 }
1286 
1288 {
1290  {
1291  // make mpLampBottomObject/mpLampShaftObject invisible
1292  SfxItemSet aSet(mpModel->GetItemPool());
1293  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
1294  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1297  }
1298  else
1299  {
1301  aDirection.normalize();
1302 
1303  // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
1304  SfxItemSet aSet(mpModel->GetItemPool());
1305  aSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) );
1306  aSet.Put( XLineColorItem(OUString(), COL_YELLOW));
1307  aSet.Put( XLineWidthItem(0));
1308  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
1311 
1312  // adapt transformation of mpLampShaftObject
1313  basegfx::B3DHomMatrix aTransform;
1314  double fRotateY(0.0);
1315 
1316  if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
1317  {
1318  fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
1319  }
1320 
1321  aTransform.rotate(0.0, fRotateY, 0.0);
1322  mpLampShaftObject->SetTransform(aTransform);
1323 
1324  // adapt transformation of selected light
1325  E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
1326 
1327  if(pSelectedLight)
1328  {
1329  aTransform.identity();
1330  aTransform.translate(
1331  aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
1332  aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
1333  aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
1334  pSelectedLight->SetTransform(aTransform);
1335  }
1336  }
1337 }
1338 
1340 {
1341  if(mpScene)
1342  {
1343  const Point aPosLogic(GetDrawingArea()->get_ref_device().PixelToLogic(aPosPixel));
1344  const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
1345  std::vector< const E3dCompoundObject* > aResult;
1346  getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
1347 
1348  if(!aResult.empty())
1349  {
1350  // exclude expansion object which will be part of
1351  // the hits. It's invisible, but for HitTest, it's included
1352  const E3dCompoundObject* pResult = nullptr;
1353 
1354  for(auto const & b: aResult)
1355  {
1356  if(b && b != mpExpansionObject)
1357  {
1358  pResult = b;
1359  break;
1360  }
1361  }
1362 
1363  if(pResult == mp3DObj)
1364  {
1365  if(!mbGeometrySelected)
1366  {
1367  mbGeometrySelected = true;
1371  Invalidate();
1372 
1374  {
1376  }
1377  }
1378  }
1379  else
1380  {
1381  sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
1382 
1383  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
1384  {
1385  if(maLightObjects[a] && maLightObjects[a] == pResult)
1386  {
1387  aNewSelectedLight = a;
1388  }
1389  }
1390 
1391  if(aNewSelectedLight != maSelectedLight)
1392  {
1393  SelectLight(aNewSelectedLight);
1394 
1396  {
1398  }
1399  }
1400  }
1401  }
1402  }
1403 }
1404 
1405 void LightControl3D::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
1406 {
1407  PreviewControl3D::Paint(rRenderContext, rRect);
1408 }
1409 
1411 {
1412  if (!HasFocus())
1413  return tools::Rectangle();
1414  Size aFocusSize = GetOutputSizePixel();
1415  aFocusSize.AdjustWidth( -4 );
1416  aFocusSize.AdjustHeight( -4 );
1417  return tools::Rectangle(Point(2, 2), aFocusSize);
1418 }
1419 
1421 {
1422  bool bCallParent(true);
1423 
1424  // switch state
1425  if(rMEvt.IsLeft())
1426  {
1428  {
1429  mbMouseMoved = false;
1430  bCallParent = false;
1431  maActionStartPoint = rMEvt.GetPosPixel();
1432  CaptureMouse();
1433  mbMouseCaptured = true;
1434  }
1435  else
1436  {
1437  // Single click without moving much trying to do a selection
1438  TrySelection(rMEvt.GetPosPixel());
1439  bCallParent = false;
1440  }
1441  }
1442 
1443  // call parent
1444  if (bCallParent)
1445  return PreviewControl3D::MouseButtonDown(rMEvt);
1446  return true;
1447 }
1448 
1450 {
1451  if (!mbMouseCaptured)
1452  return false;
1453 
1454  Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
1455 
1456  if(!mbMouseMoved)
1457  {
1458  if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > g_nInteractionStartDistance)
1459  {
1460  if(mbGeometrySelected)
1461  {
1463  }
1464  else
1465  {
1466  // interaction start, save values
1468  }
1469 
1470  mbMouseMoved = true;
1471  }
1472  }
1473 
1474  if(mbMouseMoved)
1475  {
1476  if(mbGeometrySelected)
1477  {
1478  double fNewRotX = mfSaveActionStartVer - basegfx::deg2rad(aDeltaPos.Y());
1479  double fNewRotY = mfSaveActionStartHor + basegfx::deg2rad(aDeltaPos.X());
1480 
1481  // cut horizontal
1482  while(fNewRotY < 0.0)
1483  {
1484  fNewRotY += F_2PI;
1485  }
1486 
1487  while(fNewRotY >= F_2PI)
1488  {
1489  fNewRotY -= F_2PI;
1490  }
1491 
1492  // cut vertical
1493  if(fNewRotX < -F_PI2)
1494  {
1495  fNewRotX = -F_PI2;
1496  }
1497 
1498  if(fNewRotX > F_PI2)
1499  {
1500  fNewRotX = F_PI2;
1501  }
1502 
1503  SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
1504 
1505  if(maChangeCallback.IsSet())
1506  {
1507  maChangeCallback.Call(this);
1508  }
1509  }
1510  else
1511  {
1512  // interaction in progress
1513  double fNewPosHor = mfSaveActionStartHor + static_cast<double>(aDeltaPos.X());
1514  double fNewPosVer = mfSaveActionStartVer - static_cast<double>(aDeltaPos.Y());
1515 
1516  // cut horizontal
1517  fNewPosHor = NormAngle360(fNewPosHor);
1518 
1519  // cut vertical
1520  if(fNewPosVer < -90.0)
1521  {
1522  fNewPosVer = -90.0;
1523  }
1524 
1525  if(fNewPosVer > 90.0)
1526  {
1527  fNewPosVer = 90.0;
1528  }
1529 
1530  SetPosition(fNewPosHor, fNewPosVer);
1531 
1532  if(maChangeCallback.IsSet())
1533  {
1534  maChangeCallback.Call(this);
1535  }
1536  }
1537  }
1538  return true;
1539 }
1540 
1542 {
1543  if (!mbMouseCaptured)
1544  return false;
1545  ReleaseMouse();
1546  mbMouseCaptured = false;
1547 
1548  if (mbMouseMoved)
1549  {
1550  // was change interactively
1551  }
1552  else
1553  {
1554  // simple click without much movement, try selection
1555  TrySelection(rMEvt.GetPosPixel());
1556  }
1557 
1558  return true;
1559 }
1560 
1562 {
1563  // set size of page
1564  const Size aSize(GetDrawingArea()->get_ref_device().PixelToLogic(GetOutputSizePixel()));
1565  mpFmPage->SetSize(aSize);
1566 
1567  // set position and size of scene
1568  mpScene->SetSnapRect(tools::Rectangle(Point(0, 0), aSize));
1569 }
1570 
1572 {
1573  // call parent
1575 
1576  // apply object rotation
1577  if(mp3DObj)
1578  {
1579  basegfx::B3DHomMatrix aObjectRotation;
1580  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
1581  mp3DObj->SetTransform(aObjectRotation);
1582  }
1583 }
1584 
1586 {
1588 }
1589 
1590 void LightControl3D::GetPosition(double& rHor, double& rVer)
1591 {
1592  if(IsSelectionValid())
1593  {
1595  aDirection.normalize();
1596  rHor = basegfx::rad2deg(atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI); // 0..360.0
1597  rVer = basegfx::rad2deg(atan2(aDirection.getY(), aDirection.getXZLength())); // -90.0..90.0
1598  }
1599  if(IsGeometrySelected())
1600  {
1601  rHor = basegfx::rad2deg(mfRotateY); // 0..360.0
1602  rVer = basegfx::rad2deg(mfRotateX); // -90.0..90.0
1603  }
1604 }
1605 
1606 void LightControl3D::SetPosition(double fHor, double fVer)
1607 {
1608  if(IsSelectionValid())
1609  {
1610  // set selected light's direction
1611  fHor = basegfx::deg2rad(fHor) - F_PI; // -PI..PI
1612  fVer = basegfx::deg2rad(fVer); // -PI2..PI2
1613  basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
1614  aDirection.normalize();
1615 
1616  if(!aDirection.equal(GetLightDirection(maSelectedLight)))
1617  {
1618  // set changed light direction at SdrScene
1619  SfxItemSet aSet(mpModel->GetItemPool());
1620 
1621  switch(maSelectedLight)
1622  {
1623  case 0: aSet.Put(makeSvx3DLightDirection1Item(aDirection)); break;
1624  case 1: aSet.Put(makeSvx3DLightDirection2Item(aDirection)); break;
1625  case 2: aSet.Put(makeSvx3DLightDirection3Item(aDirection)); break;
1626  case 3: aSet.Put(makeSvx3DLightDirection4Item(aDirection)); break;
1627  case 4: aSet.Put(makeSvx3DLightDirection5Item(aDirection)); break;
1628  case 5: aSet.Put(makeSvx3DLightDirection6Item(aDirection)); break;
1629  case 6: aSet.Put(makeSvx3DLightDirection7Item(aDirection)); break;
1630  default:
1631  case 7: aSet.Put(makeSvx3DLightDirection8Item(aDirection)); break;
1632  }
1633 
1634  mpScene->SetMergedItemSet(aSet);
1635 
1636  // correct 3D light's and LampFrame's geometries
1638  Invalidate();
1639  }
1640  }
1641  if(IsGeometrySelected())
1642  {
1643  if(mfRotateX != fVer || mfRotateY != fHor)
1644  {
1645  mfRotateX = basegfx::deg2rad(fVer);
1646  mfRotateY = basegfx::deg2rad(fHor);
1647 
1648  if(mp3DObj)
1649  {
1650  basegfx::B3DHomMatrix aObjectRotation;
1651  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
1652  mp3DObj->SetTransform(aObjectRotation);
1653 
1654  Invalidate();
1655  }
1656  }
1657  }
1658 }
1659 
1660 void LightControl3D::SetRotation(double fRotX, double fRotY, double fRotZ)
1661 {
1662  if(IsGeometrySelected())
1663  {
1664  if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
1665  {
1666  mfRotateX = fRotX;
1667  mfRotateY = fRotY;
1668  mfRotateZ = fRotZ;
1669 
1670  if(mp3DObj)
1671  {
1672  basegfx::B3DHomMatrix aObjectRotation;
1673  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
1674  mp3DObj->SetTransform(aObjectRotation);
1675 
1676  Invalidate();
1677  }
1678  }
1679  }
1680 }
1681 
1682 void LightControl3D::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
1683 {
1684  rRotX = mfRotateX;
1685  rRotY = mfRotateY;
1686  rRotZ = mfRotateZ;
1687 }
1688 
1690 {
1691  // call parent
1693 
1695  {
1696  // selected light is no more active, select new one
1698  }
1699 
1700  // local updates
1703  Invalidate();
1704 }
1705 
1706 void LightControl3D::SelectLight(sal_uInt32 nLightNumber)
1707 {
1708  if(nLightNumber > 7)
1709  {
1710  nLightNumber = NO_LIGHT_SELECTED;
1711  }
1712 
1713  if(NO_LIGHT_SELECTED != nLightNumber)
1714  {
1715  if(!GetLightOnOff(nLightNumber))
1716  {
1717  nLightNumber = NO_LIGHT_SELECTED;
1718  }
1719  }
1720 
1721  if(nLightNumber != maSelectedLight)
1722  {
1723  maSelectedLight = nLightNumber;
1724  mbGeometrySelected = false;
1727  Invalidate();
1728  }
1729 }
1730 
1731 bool LightControl3D::GetLightOnOff(sal_uInt32 nNum) const
1732 {
1733  if(nNum <= 7)
1734  {
1735  const SfxItemSet aLightItemSet(Get3DAttributes());
1736 
1737  switch(nNum)
1738  {
1739  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
1740  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
1741  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
1742  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
1743  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
1744  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
1745  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
1746  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
1747  }
1748  }
1749 
1750  return false;
1751 }
1752 
1753 Color LightControl3D::GetLightColor(sal_uInt32 nNum) const
1754 {
1755  if(nNum <= 7)
1756  {
1757  const SfxItemSet aLightItemSet(Get3DAttributes());
1758 
1759  switch(nNum)
1760  {
1761  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
1762  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
1763  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
1764  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
1765  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
1766  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
1767  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
1768  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
1769  }
1770  }
1771 
1772  return COL_BLACK;
1773 }
1774 
1776 {
1777  if(nNum <= 7)
1778  {
1779  const SfxItemSet aLightItemSet(Get3DAttributes());
1780 
1781  switch(nNum)
1782  {
1783  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1).GetValue();
1784  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2).GetValue();
1785  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3).GetValue();
1786  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4).GetValue();
1787  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5).GetValue();
1788  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6).GetValue();
1789  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7).GetValue();
1790  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8).GetValue();
1791  }
1792  }
1793 
1794  return basegfx::B3DVector();
1795 }
1796 
1798 : Control(pParent, WB_BORDER | WB_TABSTOP),
1799  maLightControl(VclPtr<Svx3DLightControl>::Create(this, 0)),
1800  maHorScroller(VclPtr<ScrollBar>::Create(this, WB_HORZ | WB_DRAG)),
1801  maVerScroller(VclPtr<ScrollBar>::Create(this, WB_VERT | WB_DRAG)),
1802  maSwitcher(VclPtr<PushButton>::Create(this, 0))
1803 {
1804  // init members
1805  Init();
1806 }
1807 
1809 {
1810  return LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont));
1811 }
1812 
1814 
1815 void SvxLightCtl3D::Init()
1816 {
1817  // #i58240# set HelpIDs for scrollbars and switcher
1818  maHorScroller->SetHelpId(HID_CTRL3D_HSCROLL);
1819  maVerScroller->SetHelpId(HID_CTRL3D_VSCROLL);
1820  maSwitcher->SetHelpId(HID_CTRL3D_SWITCHER);
1821  maSwitcher->SetAccessibleName(SvxResId(STR_SWITCH));
1822 
1823  // Light preview
1824  maLightControl->Show();
1825  maLightControl->SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
1826  maLightControl->SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
1827 
1828  // Horiz Scrollbar
1829  maHorScroller->Show();
1830  maHorScroller->SetRange(Range(0, 36000));
1831  maHorScroller->SetLineSize(100);
1832  maHorScroller->SetPageSize(1000);
1833  maHorScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
1834 
1835  // Vert Scrollbar
1836  maVerScroller->Show();
1837  maVerScroller->SetRange(Range(0, 18000));
1838  maVerScroller->SetLineSize(100);
1839  maVerScroller->SetPageSize(1000);
1840  maVerScroller->SetScrollHdl( LINK(this, SvxLightCtl3D, ScrollBarMove) );
1841 
1842  // Switch Button
1843  maSwitcher->Show();
1844  maSwitcher->SetClickHdl( LINK(this, SvxLightCtl3D, ButtonPress) );
1845 
1846  // check selection
1847  CheckSelection();
1848 
1849  // new layout
1850  NewLayout();
1851 }
1852 
1854 {
1855  disposeOnce();
1856 }
1857 
1859 {
1864  Control::dispose();
1865 }
1866 
1868 {
1869  // call parent
1870  Control::Resize();
1871 
1872  // new layout
1873  NewLayout();
1874 }
1875 
1877 {
1878  // Layout members
1879  const Size aSize(GetOutputSizePixel());
1880  const sal_Int32 nScrollSize(maHorScroller->GetSizePixel().Height());
1881 
1882  // Preview control
1883  Point aPoint(0, 0);
1884  Size aDestSize(aSize.Width() - nScrollSize, aSize.Height() - nScrollSize);
1885  maLightControl->SetPosSizePixel(aPoint, aDestSize);
1886 
1887  // hor scrollbar
1888  aPoint.setY( aSize.Height() - nScrollSize );
1889  aDestSize.setHeight( nScrollSize );
1890  maHorScroller->SetPosSizePixel(aPoint, aDestSize);
1891 
1892  // vert scrollbar
1893  aPoint.setX( aSize.Width() - nScrollSize );
1894  aPoint.setY( 0 );
1895  aDestSize.setWidth( nScrollSize );
1896  aDestSize.setHeight( aSize.Height() - nScrollSize );
1897  maVerScroller->SetPosSizePixel(aPoint, aDestSize);
1898 
1899  // button
1900  aPoint.setY( aSize.Height() - nScrollSize );
1901  aDestSize.setHeight( nScrollSize );
1902  maSwitcher->SetPosSizePixel(aPoint, aDestSize);
1903 }
1904 
1906 {
1907  const bool bSelectionValid(maLightControl->IsSelectionValid() || maLightControl->IsGeometrySelected());
1908  maHorScroller->Enable(bSelectionValid);
1909  maVerScroller->Enable(bSelectionValid);
1910 
1911  if(bSelectionValid)
1912  {
1913  double fHor(0.0), fVer(0.0);
1914  maLightControl->GetPosition(fHor, fVer);
1915  maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
1916  maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1917  }
1918 }
1919 
1920 void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
1921 {
1922  double fHor(0.0), fVer(0.0);
1923 
1924  maLightControl->GetPosition(fHor, fVer);
1925  fHor += fDeltaHor;
1926  fVer += fDeltaVer;
1927 
1928  if( fVer > 90.0 )
1929  return;
1930 
1931  if ( fVer < -90.0 )
1932  return;
1933 
1934  maLightControl->SetPosition(fHor, fVer);
1935  maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
1936  maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1937 }
1938 
1939 void SvxLightCtl3D::KeyInput( const KeyEvent& rKEvt )
1940 {
1941  const vcl::KeyCode aCode(rKEvt.GetKeyCode());
1942 
1943  if( aCode.GetModifier() )
1944  {
1945  Control::KeyInput( rKEvt );
1946  return;
1947  }
1948 
1949  switch ( aCode.GetCode() )
1950  {
1951  case KEY_SPACE:
1952  {
1953  break;
1954  }
1955  case KEY_LEFT:
1956  {
1957  move( -4.0, 0.0 ); // #i58242# changed move direction in X
1958  break;
1959  }
1960  case KEY_RIGHT:
1961  {
1962  move( 4.0, 0.0 ); // #i58242# changed move direction in X
1963  break;
1964  }
1965  case KEY_UP:
1966  {
1967  move( 0.0, 4.0 );
1968  break;
1969  }
1970  case KEY_DOWN:
1971  {
1972  move( 0.0, -4.0 );
1973  break;
1974  }
1975  case KEY_PAGEUP:
1976  {
1977  sal_Int32 nLight(maLightControl->GetSelectedLight() - 1);
1978 
1979  while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight))
1980  {
1981  nLight--;
1982  }
1983 
1984  if(nLight < 0)
1985  {
1986  nLight = 7;
1987 
1988  while((nLight >= 0) && !maLightControl->GetLightOnOff(nLight))
1989  {
1990  nLight--;
1991  }
1992  }
1993 
1994  if(nLight >= 0)
1995  {
1996  maLightControl->SelectLight(nLight);
1997  CheckSelection();
1998 
2000  {
2002  }
2003  }
2004 
2005  break;
2006  }
2007  case KEY_PAGEDOWN:
2008  {
2009  sal_Int32 nLight(maLightControl->GetSelectedLight() - 1);
2010 
2011  while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight))
2012  {
2013  nLight++;
2014  }
2015 
2016  if(nLight > 7)
2017  {
2018  nLight = 0;
2019 
2020  while(nLight <= 7 && !maLightControl->GetLightOnOff(nLight))
2021  {
2022  nLight++;
2023  }
2024  }
2025 
2026  if(nLight <= 7)
2027  {
2028  maLightControl->SelectLight(nLight);
2029  CheckSelection();
2030 
2032  {
2034  }
2035  }
2036 
2037  break;
2038  }
2039  default:
2040  {
2041  Control::KeyInput( rKEvt );
2042  break;
2043  }
2044  }
2045 }
2046 
2048 {
2050 
2051  if(HasFocus() && IsEnabled())
2052  {
2053  CheckSelection();
2054 
2055  Size aFocusSize = maLightControl->GetOutputSizePixel();
2056 
2057  aFocusSize.AdjustWidth( -4 );
2058  aFocusSize.AdjustHeight( -4 );
2059 
2060  tools::Rectangle aFocusRect( Point( 2, 2 ), aFocusSize );
2061 
2062  aFocusRect = maLightControl->PixelToLogic( aFocusRect );
2063 
2064  maLightControl->ShowFocus( aFocusRect );
2065  }
2066 }
2067 
2069 {
2071 
2073 }
2074 
2075 IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove, ScrollBar*, void)
2076 {
2077  const sal_Int32 nHor(maHorScroller->GetThumbPos());
2078  const sal_Int32 nVer(maVerScroller->GetThumbPos());
2079 
2080  maLightControl->SetPosition(
2081  static_cast<double>(nHor) / 100.0,
2082  static_cast<double>((18000 - nVer) - 9000) / 100.0);
2083 }
2084 
2085 IMPL_LINK_NOARG(SvxLightCtl3D, ButtonPress, Button*, void)
2086 {
2087  if(SvxPreviewObjectType::SPHERE == GetSvx3DLightControl().GetObjectType())
2088  {
2089  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::CUBE);
2090  }
2091  else
2092  {
2093  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
2094  }
2095 }
2096 
2097 IMPL_LINK_NOARG(SvxLightCtl3D, InternalInteractiveChange, Svx3DLightControl*, void)
2098 {
2099  double fHor(0.0), fVer(0.0);
2100 
2101  maLightControl->GetPosition(fHor, fVer);
2102  maHorScroller->SetThumbPos( sal_Int32(fHor * 100.0) );
2103  maVerScroller->SetThumbPos( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
2104 }
2105 
2106 IMPL_LINK_NOARG(SvxLightCtl3D, InternalSelectionChange, Svx3DLightControl*, void)
2107 {
2108  CheckSelection();
2109 
2110  if(maUserSelectionChangeCallback.IsSet())
2111  {
2112  maUserSelectionChangeCallback.Call(this);
2113  }
2114 }
2115 
2117  weld::Scale& rVert, weld::Button& rSwitcher)
2118  : mrLightControl(rLightControl)
2119  , mrHorScroller(rHori)
2120  , mrVerScroller(rVert)
2121  , mrSwitcher(rSwitcher)
2122 {
2123  // init members
2124  Init();
2125 }
2126 
2128 {
2129  Size aSize(mrLightControl.GetDrawingArea()->get_ref_device().LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont)));
2130  mrLightControl.set_size_request(aSize.Width(), aSize.Height());
2131 
2132  // #i58240# set HelpIDs for scrollbars and switcher
2137 
2138  // Light preview
2139  mrLightControl.Show();
2140  mrLightControl.SetChangeCallback( LINK(this, LightCtl3D, InternalInteractiveChange) );
2141  mrLightControl.SetSelectionChangeCallback( LINK(this, LightCtl3D, InternalSelectionChange) );
2142 
2143  // Horiz Scrollbar
2144  mrHorScroller.show();
2145  mrHorScroller.set_range(0, 36000);
2146  mrHorScroller.connect_value_changed( LINK(this, LightCtl3D, ScrollBarMove) );
2147 
2148  // Vert Scrollbar
2149  mrVerScroller.show();
2150  mrVerScroller.set_range(0, 18000);
2151  mrVerScroller.connect_value_changed( LINK(this, LightCtl3D, ScrollBarMove) );
2152 
2153  // Switch Button
2154  mrSwitcher.show();
2155  mrSwitcher.connect_clicked( LINK(this, LightCtl3D, ButtonPress) );
2156 
2158  pArea->connect_key_press(Link<const KeyEvent&, bool>()); //acknowledge we first remove the old one
2159  pArea->connect_key_press(LINK(this, LightCtl3D, KeyInput));
2160 
2161  pArea->connect_focus_in(Link<weld::Widget&, void>()); //acknowledge we first remove the old one
2162  pArea->connect_focus_in(LINK(this, LightCtl3D, FocusIn));
2163 
2164  // check selection
2165  CheckSelection();
2166 }
2167 
2169 {
2170 }
2171 
2173 {
2174  const bool bSelectionValid(mrLightControl.IsSelectionValid() || mrLightControl.IsGeometrySelected());
2175  mrHorScroller.set_sensitive(bSelectionValid);
2176  mrVerScroller.set_sensitive(bSelectionValid);
2177 
2178  if (bSelectionValid)
2179  {
2180  double fHor(0.0), fVer(0.0);
2181  mrLightControl.GetPosition(fHor, fVer);
2182  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
2183  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
2184  }
2185 }
2186 
2187 void LightCtl3D::move( double fDeltaHor, double fDeltaVer )
2188 {
2189  double fHor(0.0), fVer(0.0);
2190 
2191  mrLightControl.GetPosition(fHor, fVer);
2192  fHor += fDeltaHor;
2193  fVer += fDeltaVer;
2194 
2195  if( fVer > 90.0 )
2196  return;
2197 
2198  if ( fVer < -90.0 )
2199  return;
2200 
2201  mrLightControl.SetPosition(fHor, fVer);
2202  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
2203  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
2204 
2206  {
2208  }
2209 }
2210 
2211 IMPL_LINK(LightCtl3D, KeyInput, const KeyEvent&, rKEvt, bool)
2212 {
2213  const vcl::KeyCode aCode(rKEvt.GetKeyCode());
2214 
2215  if (aCode.GetModifier())
2216  return false;
2217 
2218  bool bHandled = true;
2219 
2220  switch ( aCode.GetCode() )
2221  {
2222  case KEY_SPACE:
2223  {
2224  break;
2225  }
2226  case KEY_LEFT:
2227  {
2228  move( -4.0, 0.0 ); // #i58242# changed move direction in X
2229  break;
2230  }
2231  case KEY_RIGHT:
2232  {
2233  move( 4.0, 0.0 ); // #i58242# changed move direction in X
2234  break;
2235  }
2236  case KEY_UP:
2237  {
2238  move( 0.0, 4.0 );
2239  break;
2240  }
2241  case KEY_DOWN:
2242  {
2243  move( 0.0, -4.0 );
2244  break;
2245  }
2246  case KEY_PAGEUP:
2247  {
2248  sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
2249 
2250  while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
2251  {
2252  nLight--;
2253  }
2254 
2255  if(nLight < 0)
2256  {
2257  nLight = 7;
2258 
2259  while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
2260  {
2261  nLight--;
2262  }
2263  }
2264 
2265  if(nLight >= 0)
2266  {
2267  mrLightControl.SelectLight(nLight);
2268  CheckSelection();
2269 
2270  if(maUserSelectionChangeCallback.IsSet())
2271  {
2272  maUserSelectionChangeCallback.Call(this);
2273  }
2274  }
2275 
2276  break;
2277  }
2278  case KEY_PAGEDOWN:
2279  {
2280  sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
2281 
2282  while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
2283  {
2284  nLight++;
2285  }
2286 
2287  if(nLight > 7)
2288  {
2289  nLight = 0;
2290 
2291  while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
2292  {
2293  nLight++;
2294  }
2295  }
2296 
2297  if(nLight <= 7)
2298  {
2299  mrLightControl.SelectLight(nLight);
2300  CheckSelection();
2301 
2302  if(maUserSelectionChangeCallback.IsSet())
2303  {
2304  maUserSelectionChangeCallback.Call(this);
2305  }
2306  }
2307 
2308  break;
2309  }
2310  default:
2311  {
2312  bHandled = false;
2313  break;
2314  }
2315  }
2316  return bHandled;
2317 }
2318 
2320 {
2321  if (mrLightControl.IsEnabled())
2322  {
2323  CheckSelection();
2324  }
2325 }
2326 
2327 IMPL_LINK_NOARG(LightCtl3D, ScrollBarMove, weld::Scale&, void)
2328 {
2329  const sal_Int32 nHor(mrHorScroller.get_value());
2330  const sal_Int32 nVer(mrVerScroller.get_value());
2331 
2332  mrLightControl.SetPosition(
2333  static_cast<double>(nHor) / 100.0,
2334  static_cast<double>((18000 - nVer) - 9000) / 100.0);
2335 
2336  if (maUserInteractiveChangeCallback.IsSet())
2337  {
2338  maUserInteractiveChangeCallback.Call(this);
2339  }
2340 }
2341 
2343 {
2344  if(SvxPreviewObjectType::SPHERE == GetSvx3DLightControl().GetObjectType())
2345  {
2346  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::CUBE);
2347  }
2348  else
2349  {
2350  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
2351  }
2352 }
2353 
2354 IMPL_LINK_NOARG(LightCtl3D, InternalInteractiveChange, LightControl3D*, void)
2355 {
2356  double fHor(0.0), fVer(0.0);
2357 
2358  mrLightControl.GetPosition(fHor, fVer);
2359  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
2360  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
2361 
2362  if(maUserInteractiveChangeCallback.IsSet())
2363  {
2364  maUserInteractiveChangeCallback.Call(this);
2365  }
2366 }
2367 
2368 IMPL_LINK_NOARG(LightCtl3D, InternalSelectionChange, LightControl3D*, void)
2369 {
2370  CheckSelection();
2371 
2372  if(maUserSelectionChangeCallback.IsSet())
2373  {
2374  maUserSelectionChangeCallback.Call(this);
2375  }
2376 }
2377 
2378 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetAutoAdjustProjection(bool bAdjust)
Definition: camera3d.hxx:62
long Width() const
std::unique_ptr< E3dView > mp3DView
Definition: dlgctl3d.hxx:46
virtual SdrObject * RemoveObject(size_t nObjNum) override
Definition: scene3d.cxx:801
virtual void EnableRTL(bool bEnable=true) override
virtual void Set3DAttributes(const SfxItemSet &rAttr) override
Definition: dlgctl3d.cxx:1016
E3dScene * mpScene
Definition: dlgctl3d.hxx:47
void GetPosition(double &rHor, double &rVer)
Definition: dlgctl3d.cxx:1590
virtual void Resize() override
Definition: dlgctl3d.cxx:1867
double mfRotateX
Definition: dlgctl3d.hxx:183
double mfSaveActionStartRotZ
Definition: dlgctl3d.hxx:191
void HideFocus()
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void GetPosition(double &rHor, double &rVer)
Definition: dlgctl3d.cxx:917
void SetSelectionChangeCallback(Link< LightControl3D *, void > aNew)
Definition: dlgctl3d.hxx:217
virtual void SetSize(const Size &aSiz)
Definition: svdpage.cxx:1364
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:1541
SvxLightCtl3D(vcl::Window *pParent)
Definition: dlgctl3d.cxx:1797
void SetChangeCallback(Link< LightControl3D *, void > aNew)
Definition: dlgctl3d.hxx:216
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: fmpage.cxx:83
void Init()
Definition: dlgctl3d.cxx:2127
Point maActionStartPoint
Definition: dlgctl3d.hxx:118
#define KEY_SPACE
E3dScene * mpScene
Definition: dlgctl3d.hxx:75
long AdjustWidth(long n)
virtual void set_value(int value)=0
std::unique_ptr< FmFormModel > mpModel
Definition: dlgctl3d.hxx:72
virtual void Resize() override
Definition: dlgctl3d.cxx:888
sal_uInt32 maSelectedLight
Definition: dlgctl3d.hxx:174
void SetViewWindow(double fX, double fY, double fW, double fH)
Definition: camera3d.cxx:41
virtual void MouseButtonDown(const MouseEvent &rMEvt)
#define KEY_PAGEDOWN
LightControl3D & mrLightControl
Definition: dlgctl3d.hxx:292
Link< LightControl3D *, void > maChangeCallback
Definition: dlgctl3d.hxx:170
SvxPreviewObjectType GetObjectType() const
Definition: dlgctl3d.hxx:91
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctl3d.cxx:256
#define SDRATTR_3DSCENE_LIGHTON_4
Definition: svddef.hxx:374
double mfSaveActionStartVer
Definition: dlgctl3d.hxx:120
long Height() const
#define KEY_PAGEUP
virtual Size GetOptimalSize() const override
Definition: dlgctl3d.cxx:62
weld::Scale & mrHorScroller
Definition: dlgctl3d.hxx:293
bool IsGeometrySelected() const
Definition: dlgctl3d.hxx:147
double mfSaveActionStartHor
Definition: dlgctl3d.hxx:189
B3DVector & normalize()
void SelectLight(sal_uInt32 nLightNumber)
Definition: dlgctl3d.cxx:1706
bool IsGeometrySelected() const
Definition: dlgctl3d.hxx:221
void disposeAndClear()
static const AllSettings & GetSettings()
#define RADIUS_LAMP_SMALL
Definition: dlgctl3d.cxx:440
virtual Size GetSizePixel() const
#define F_PI2
Svx3DPreviewControl(vcl::Window *pParent, WinBits nStyle=0)
Definition: dlgctl3d.cxx:48
bool IsShift() const
#define SDRATTR_3DSCENE_LIGHTON_2
Definition: svddef.hxx:372
double getZ() const
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:728
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: dlgctl3d.cxx:1939
void SetPosition(double fHor, double fVer)
Definition: dlgctl3d.cxx:1606
void SetHelpId(const OString &)
bool GetLightOnOff(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:1731
#define DEG2RAD(fAngle)
Definition: def3d.hxx:28
virtual void Set3DAttributes(const SfxItemSet &rAttr)
Definition: dlgctl3d.cxx:242
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:1102
const basegfx::B3DHomMatrix & GetTransform() const
Definition: obj3d.hxx:111
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:423
constexpr::Color COL_YELLOW(0xFF, 0xFF, 0x00)
sal_uInt32 GetSelectedLight() const
Definition: dlgctl3d.hxx:159
Link< Svx3DLightControl *, void > maSelectionChangeCallback
Definition: dlgctl3d.hxx:101
#define KEY_LEFT
long AdjustHeight(long n)
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
#define SDRATTR_3DSCENE_LIGHTON_8
Definition: svddef.hxx:378
Link< LightControl3D *, void > maSelectionChangeCallback
Definition: dlgctl3d.hxx:171
void SetMapMode()
constexpr double rad2deg(double v)
E3dObject * mp3DObj
Definition: dlgctl3d.hxx:48
#define MAX_NUMBER_LIGHTS
Definition: dlgctl3d.cxx:443
Size const & GetOutputSizePixel() const
virtual void set_range(int min, int max)=0
void ConstructLightObjects()
Definition: dlgctl3d.cxx:1243
virtual void dispose() override
Definition: dlgctl3d.cxx:1858
double getMaxZ() const
double getX() const
void move(double fDeltaHor, double fDeltaVer)
Definition: dlgctl3d.cxx:1920
virtual Size GetOptimalSize() const override
Definition: dlgctl3d.cxx:1808
bool mbMouseCaptured
Link< Svx3DLightControl *, void > maChangeCallback
Definition: dlgctl3d.hxx:100
Point maActionStartPoint
Definition: dlgctl3d.hxx:188
#define RADIUS_LAMP_BIG
Definition: dlgctl3d.cxx:441
double mfSaveActionStartVer
Definition: dlgctl3d.hxx:190
bool IsSelectionValid()
Definition: dlgctl3d.cxx:1585
sal_Int64 WinBits
virtual tools::Rectangle GetFocusRect() override
Definition: dlgctl3d.cxx:1410
void SetBackground()
Svx3DLightControl(vcl::Window *pParent, WinBits nStyle)
Definition: dlgctl3d.cxx:447
weld::Scale & mrVerScroller
Definition: dlgctl3d.hxx:294
E3dObject * mp3DObj
Definition: dlgctl3d.hxx:76
#define SDRATTR_3DSCENE_LIGHTCOLOR_3
Definition: svddef.hxx:364
E3dObject * mpLampBottomObject
Definition: dlgctl3d.hxx:178
virtual void show()=0
void Enable(bool bEnable=true, bool bChild=true)
virtual void Set3DAttributes(const SfxItemSet &rAttr)
Definition: dlgctl3d.cxx:433
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:1775
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
#define HID_CTRL3D_VSCROLL
Definition: helpids.h:26
bool IsSelectionValid()
Definition: dlgctl3d.cxx:912
#define XATTR_FILL_FIRST
Definition: xdef.hxx:106
WinBits const WB_VERT
void SetCamera(const Camera3D &rNewCamera)
Definition: scene3d.cxx:312
virtual void GetFocus() override
Definition: dlgctl3d.cxx:2047
SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:246
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1936
virtual void set_help_id(const OString &rName)=0
#define SDRATTR_3DSCENE_LIGHTCOLOR_6
Definition: svddef.hxx:367
#define NO_LIGHT_SELECTED
Definition: dlgctl3d.cxx:442
virtual OutputDevice & get_ref_device()=0
#define SDRATTR_3DSCENE_LIGHTON_5
Definition: svddef.hxx:375
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:363
void SelectLight(sal_uInt32 nLightNumber)
Definition: dlgctl3d.cxx:1033
T NormAngle360(T angle)
Color GetLightColor(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:1753
#define SDRATTR_3DSCENE_LIGHTON_3
Definition: svddef.hxx:373
E3dObject * mpLampShaftObject
Definition: dlgctl3d.hxx:109
SphereObject with diameter r3DSize.
Definition: sphere3d.hxx:35
#define SDRATTR_3DSCENE_LIGHTDIRECTION_5
Definition: svddef.hxx:383
SvxB3DVectorItem makeSvx3DLightDirection6Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:254
#define SDRATTR_3DSCENE_LIGHTCOLOR_1
Definition: svddef.hxx:362
Link< SvxLightCtl3D *, void > maUserSelectionChangeCallback
Definition: dlgctl3d.hxx:250
double mfRotateZ
Definition: dlgctl3d.hxx:185
VclPtr< Svx3DLightControl > maLightControl
Definition: dlgctl3d.hxx:244
virtual void SetObjectType(SvxPreviewObjectType nType)
Definition: dlgctl3d.cxx:379
void connect_clicked(const Link< Button &, void > &rLink)
B2DPolygon createPolygonFromCircle(const B2DPoint &rCenter, double fRadius)
IMPL_LINK(LightCtl3D, KeyInput, const KeyEvent &, rKEvt, bool)
Definition: dlgctl3d.cxx:2211
#define F_PI
#define HID_CTRL3D_SWITCHER
Definition: helpids.h:25
void move(double fDeltaHor, double fDeltaVer)
Definition: dlgctl3d.cxx:2187
virtual void dispose() override
Definition: dlgctl3d.cxx:74
void GetRotation(double &rRotX, double &rRotY, double &rRotZ)
Definition: dlgctl3d.cxx:1009
double getHeight() const
#define SDRATTR_3DSCENE_LIGHTCOLOR_2
Definition: svddef.hxx:363
uno_Any a
#define SDRATTR_3DSCENE_LIGHTDIRECTION_6
Definition: svddef.hxx:384
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:171
css::drawing::Direction3D aDirection
Link< LightCtl3D *, void > maUserInteractiveChangeCallback
Definition: dlgctl3d.hxx:298
#define SDRATTR_3DSCENE_LIGHTDIRECTION_4
Definition: svddef.hxx:382
void SetControlBackground()
#define SDRATTR_3DSCENE_LIGHTDIRECTION_8
Definition: svddef.hxx:386
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:1405
std::unique_ptr< FmFormModel > mpModel
Definition: dlgctl3d.hxx:44
std::vector< E3dObject * > maLightObjects
Definition: dlgctl3d.hxx:110
#define VCL_BUILDER_FACTORY(typeName)
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual void Set3DAttributes(const SfxItemSet &rAttr) override
Definition: dlgctl3d.cxx:1689
void Create(SvxOrientationItem &rItem, SvStream &rStrm, sal_uInt16)
Definition: legacyitem.cxx:34
IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove, ScrollBar *, void)
Definition: dlgctl3d.cxx:2075
#define F_2PI
double getXZLength() const
E3dObject * mpLampBottomObject
Definition: dlgctl3d.hxx:108
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:358
void SetFocalLength(double fLen)
Definition: camera3d.cxx:172
static bool equalZero(const double &rfVal)
#define SDRATTR_3DSCENE_LIGHTON_1
Definition: svddef.hxx:371
bool mbGeometrySelected
Definition: dlgctl3d.hxx:195
void AdaptToSelectedLight()
Definition: dlgctl3d.cxx:605
void SetRotation(double fRotX, double fRotY, double fRotZ)
Definition: dlgctl3d.cxx:1660
void Construct2()
Definition: dlgctl3d.cxx:1151
static const sal_Int32 g_nInteractionStartDistance
Definition: dlgctl3d.cxx:445
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
Definition: svdobj.cxx:823
E3dObject * mpLampShaftObject
Definition: dlgctl3d.hxx:179
VclPtr< PushButton > maSwitcher
Definition: dlgctl3d.hxx:247
void SetPosition(double fHor, double fVer)
Definition: dlgctl3d.cxx:933
#define XATTR_LINESTYLE
Definition: xdef.hxx:90
void connect_value_changed(const Link< Scale &, void > &rLink)
constexpr double deg2rad(double v)
const basegfx::B3DRange & GetBoundVolume() const
Definition: obj3d.cxx:289
std::vector< E3dObject * > maLightObjects
Definition: dlgctl3d.hxx:180
virtual void dispose() override
virtual void connect_focus_in(const Link< Widget &, void > &rLink)
#define RADIUS_LAMP_PREVIEW_SIZE
Definition: dlgctl3d.cxx:439
Size GetOutputSizePixel() const
LightCtl3D(LightControl3D &rLightControl, weld::Scale &rHori, weld::Scale &rVert, weld::Button &rButton)
Definition: dlgctl3d.cxx:2116
virtual void Resize() override
Definition: dlgctl3d.cxx:151
virtual ~PreviewControl3D() override
Definition: dlgctl3d.cxx:266
sal_uInt32 maSelectedLight
Definition: dlgctl3d.hxx:104
virtual void LoseFocus()
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual void SetObjectType(SvxPreviewObjectType nType) override
Definition: dlgctl3d.cxx:1571
virtual void ShowFocus(const tools::Rectangle &rRect)
void SetOutputSizePixel(const Size &rSize)
SfxItemSet const & Get3DAttributes() const
Definition: dlgctl3d.cxx:237
SvxB3DVectorItem makeSvx3DLightDirection5Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:250
long X() const
virtual void connect_key_press(const Link< const KeyEvent &, bool > &rLink)
bool IsTrackingEnded() const
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
Definition: scene3d.cxx:812
Color GetLightColor(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:1080
void CheckSelection()
Definition: dlgctl3d.cxx:2172
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
#define HID_CTRL3D_HSCROLL
Definition: helpids.h:24
#define SDRATTR_3DSCENE_LIGHTDIRECTION_7
Definition: svddef.hxx:385
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
Definition: camera3d.cxx:69
FmFormPage * mpFmPage
Definition: dlgctl3d.hxx:45
void GetRotation(double &rRotX, double &rRotY, double &rRotZ)
Definition: dlgctl3d.cxx:1682
bool equal(const B3DTuple &rTup) const
void translate(double fX, double fY, double fZ)
#define SDRATTR_3DSCENE_LIGHTCOLOR_4
Definition: svddef.hxx:365
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
virtual ~SvxLightCtl3D() override
Definition: dlgctl3d.cxx:1853
virtual void KeyInput(const KeyEvent &rKEvt)
double getWidth() const
virtual void Resize() override
Definition: dlgctl3d.cxx:343
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
Definition: obj3d.cxx:343
double mfRotateY
Definition: dlgctl3d.hxx:184
void NewLayout()
Definition: dlgctl3d.cxx:1876
void set_size_request(int nWidth, int nHeight)
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix) override
Definition: scene3d.cxx:608
const vcl::KeyCode & GetKeyCode() const
double mfSaveActionStartHor
Definition: dlgctl3d.hxx:119
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
void CheckSelection(struct ESelection &rSel, SvxTextForwarder const *pForwarder)
#define SDRATTR_3DSCENE_LIGHTCOLOR_8
Definition: svddef.hxx:369
Derived class of SdrView to edit 3D objects.
Definition: view3d.hxx:41
weld::DrawingArea * GetDrawingArea() const
void TrySelection(Point aPosPixel)
Definition: dlgctl3d.cxx:657
void TrySelection(Point aPosPixel)
Definition: dlgctl3d.cxx:1339
virtual void Resize() override
#define KEY_DOWN
FmFormPage * mpFmPage
Definition: dlgctl3d.hxx:73
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void SetObjectType(SvxPreviewObjectType nType)
Definition: dlgctl3d.cxx:188
virtual void GetFocus()
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: scene3d.cxx:771
WinBits const WB_BORDER
SvxB3DVectorItem makeSvx3DLightDirection2Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:238
void getAllHit3DObjectsSortedFrontToBack(const basegfx::B2DPoint &rPoint, const E3dScene &rScene,::std::vector< const E3dCompoundObject * > &o_rResult)
support for getting all from a 2d position hit objects in a 3d scene in a depth sorted array ...
SvxB3DVectorItem makeSvx3DLightDirection1Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:234
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1911
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
bool IsLeft() const
SvxB3DVectorItem makeSvx3DLightDirection3Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:242
#define SDRATTR_3DSCENE_LIGHTON_7
Definition: svddef.hxx:377
void AdaptToSelectedLight()
Definition: dlgctl3d.cxx:1287
std::unique_ptr< E3dView > mp3DView
Definition: dlgctl3d.hxx:74
E3dObject * mpExpansionObject
Definition: dlgctl3d.hxx:177
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:1449
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:723
const Point & GetPosPixel() const
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: dlgctl3d.cxx:757
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
bool mbMouseCaptured
Definition: dlgctl3d.hxx:194
void SetRotation(double fRotX, double fRotY, double fRotZ)
Definition: dlgctl3d.cxx:987
bool GetLightOnOff(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:1058
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctl3d.cxx:1145
WinBits const WB_TABSTOP
VclPtr< ScrollBar > maVerScroller
Definition: dlgctl3d.hxx:246
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1649
E3dObject * mpExpansionObject
Definition: dlgctl3d.hxx:107
SvxPreviewObjectType GetObjectType() const
Definition: dlgctl3d.hxx:64
SvxB3DVectorItem makeSvx3DLightDirection8Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:262
#define XATTR_FILLBITMAP
Definition: xdef.hxx:111
void rotate(double fAngleX, double fAngleY, double fAngleZ)
bool IsEnabled() const
SvxPreviewObjectType mnObjectType
Definition: dlgctl3d.hxx:77
weld::Button & mrSwitcher
Definition: dlgctl3d.hxx:295
VclPtr< ScrollBar > maHorScroller
Definition: dlgctl3d.hxx:245
bool IsTrackingCanceled() const
double getY() const
SvxPreviewObjectType mnObjectType
Definition: dlgctl3d.hxx:49
#define SDRATTR_3DSCENE_LIGHTDIRECTION_3
Definition: svddef.hxx:381
SfxItemSet const & Get3DAttributes() const
Definition: dlgctl3d.cxx:428
#define SDRATTR_3DSCENE_LIGHTCOLOR_7
Definition: svddef.hxx:368
virtual void set_accessible_name(const OUString &rName)=0
#define SDRATTR_3DSCENE_LIGHTON_6
Definition: svddef.hxx:376
virtual void Resize() override
Definition: dlgctl3d.cxx:1561
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:1420
double mfSaveActionStartRotZ
Definition: dlgctl3d.hxx:121
#define SDRATTR_3DSCENE_LIGHTDIRECTION_1
Definition: svddef.hxx:379
const MouseEvent & GetMouseEvent() const
void CheckSelection()
Definition: dlgctl3d.cxx:1905
#define SDRATTR_3DSCENE_LIGHTDIRECTION_2
Definition: svddef.hxx:380
void transform(const B3DHomMatrix &rMatrix)
virtual void set_size_request(int nWidth, int nHeight)=0
WinBits const WB_HORZ
bool HasFocus() const
SvxPreviewObjectType
Definition: dlgctl3d.hxx:39
const Camera3D & GetCamera() const
Definition: scene3d.hxx:127
#define SDRATTR_3DSCENE_LIGHTCOLOR_5
Definition: svddef.hxx:366
#define KEY_RIGHT
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:166
void SetThumbPos(long nThumbPos)
long Y() const
virtual void set_sensitive(bool sensitive)=0
virtual void SetObjectType(SvxPreviewObjectType nType) override
Definition: dlgctl3d.cxx:898
void ConstructLightObjects()
Definition: dlgctl3d.cxx:561
virtual void LoseFocus() override
Definition: dlgctl3d.cxx:2068
bool IsMod1() const
void EnableRTL(bool bEnable)
#define KEY_UP
WinBits const WB_DRAG
SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:258