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 <svx/helperhittest3d.hxx>
34 #include <polygn3d.hxx>
35 #include <svx/xfillit0.hxx>
36 #include <svx/xflclit.hxx>
37 #include <svx/xlineit0.hxx>
38 #include <svx/xlnclit.hxx>
39 #include <svx/xlnwtit.hxx>
40 #include <helpids.h>
41 #include <svx/dialmgr.hxx>
42 #include <tools/helpers.hxx>
43 #include <vcl/settings.hxx>
44 
45 using namespace com::sun::star;
46 
48  : mpScene(nullptr)
49  , mp3DObj(nullptr)
50  , mnObjectType(SvxPreviewObjectType::SPHERE)
51 {
52 }
53 
55 {
56  Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont)));
57  pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
58  CustomWidgetController::SetDrawingArea(pDrawingArea);
59  SetOutputSizePixel(aSize);
60 
61  Construct();
62 }
63 
65 {
66  mxFmPage.clear();
67  mp3DView.reset();
68  mpModel.reset();
69 }
70 
72 {
73  // Do never mirror the preview window. This explicitly includes right
74  // to left writing environments.
75  EnableRTL (false);
77  rDevice.SetMapMode(MapMode(MapUnit::Map100thMM));
78 
79  // Model
80  mpModel.reset(new FmFormModel());
81  mpModel->GetItemPool().FreezeIdRanges();
82 
83  // Page
84  mxFmPage = new FmFormPage( *mpModel );
85  mpModel->InsertPage( mxFmPage.get(), 0 );
86 
87  // 3D View
88  mp3DView.reset(new E3dView(*mpModel, &rDevice));
89  mp3DView->SetBufferedOutputAllowed(true);
90  mp3DView->SetBufferedOverlayAllowed(true);
91 
92  // 3D Scene
93  mpScene = new E3dScene(*mpModel);
94 
95  // initially create object
97 
98  // camera and perspective
99  Camera3D rCamera = mpScene->GetCamera();
100  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
101  double fW = rVolume.getWidth();
102  double fH = rVolume.getHeight();
103  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
104 
105  rCamera.SetAutoAdjustProjection(false);
106  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
107  basegfx::B3DPoint aLookAt;
108  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
109  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
110  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
111  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
112  rCamera.SetFocalLength(fDefaultCamFocal);
113 
114  mpScene->SetCamera( rCamera );
115  mxFmPage->InsertObject( mpScene );
116 
117  basegfx::B3DHomMatrix aRotation;
118  aRotation.rotate(DEG2RAD( 25 ), 0.0, 0.0);
119  aRotation.rotate(0.0, DEG2RAD( 40 ), 0.0);
120  mpScene->SetTransform(aRotation * mpScene->GetTransform());
121 
122  // invalidate SnapRects of objects
124 
125  SfxItemSet aSet( mpModel->GetItemPool(),
128  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
129  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
130  aSet.Put( XFillColorItem( "", COL_WHITE ) );
131 
132  mpScene->SetMergedItemSet(aSet);
133 
134  // PageView
135  SdrPageView* pPageView = mp3DView->ShowSdrPage( mxFmPage.get() );
136  mp3DView->hideMarkHandles();
137 
138  // mark scene
139  mp3DView->MarkObj( mpScene, pPageView );
140 }
141 
143 {
144  // size of page
145  Size aSize(GetOutputSizePixel());
146  aSize = GetDrawingArea()->get_ref_device().PixelToLogic(aSize);
147  mxFmPage->SetSize(aSize);
148 
149  // set size
150  Size aObjSize( aSize.Width()*5/6, aSize.Height()*5/6 );
151  Point aObjPoint( (aSize.Width() - aObjSize.Width()) / 2,
152  (aSize.Height() - aObjSize.Height()) / 2);
153  tools::Rectangle aRect( aObjPoint, aObjSize);
154  mpScene->SetSnapRect( aRect );
155 }
156 
158 {
159  mp3DView->CompleteRedraw(&rRenderContext, vcl::Region(rRect));
160 }
161 
163 {
164  if (rMEvt.IsShift() && rMEvt.IsMod1())
165  {
167  {
169  }
170  else
171  {
173  }
174  }
175  return false;
176 }
177 
179 {
180  if(mnObjectType == nType && mp3DObj)
181  return;
182 
183  SfxItemSet aSet(mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>);
184  mnObjectType = nType;
185 
186  if( mp3DObj )
187  {
188  aSet.Put(mp3DObj->GetMergedItemSet());
190  // always use SdrObject::Free(...) for SdrObjects (!)
191  SdrObject* pTemp(mp3DObj);
192  SdrObject::Free(pTemp);
193  }
194 
195  switch( nType )
196  {
198  {
199  mp3DObj = new E3dSphereObj(
200  *mpModel,
201  mp3DView->Get3DDefaultAttributes(),
202  basegfx::B3DPoint( 0, 0, 0 ),
203  basegfx::B3DVector( 5000, 5000, 5000 ));
204  }
205  break;
206 
208  {
209  mp3DObj = new E3dCubeObj(
210  *mpModel,
211  mp3DView->Get3DDefaultAttributes(),
212  basegfx::B3DPoint( -2500, -2500, -2500 ),
213  basegfx::B3DVector( 5000, 5000, 5000 ));
214  }
215  break;
216  }
217 
218  if (mp3DObj)
219  {
221  mp3DObj->SetMergedItemSet(aSet);
222  }
223 
224  Invalidate();
225 }
226 
228 {
229  return mp3DObj->GetMergedItemSet();
230 }
231 
233 {
234  mp3DObj->SetMergedItemSet(rAttr, true);
235  Resize();
236  Invalidate();
237 }
238 
239 #define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
240 #define RADIUS_LAMP_SMALL (600.0)
241 #define RADIUS_LAMP_BIG (1000.0)
242 #define NO_LIGHT_SELECTED (0xffffffff)
243 #define MAX_NUMBER_LIGHTS (8)
244 
245 const sal_Int32 g_nInteractionStartDistance = 5 * 5 * 2;
246 
248 : maSelectedLight(NO_LIGHT_SELECTED),
249  mpExpansionObject(nullptr),
250  mpLampBottomObject(nullptr),
251  mpLampShaftObject(nullptr),
252  maLightObjects(MAX_NUMBER_LIGHTS, nullptr),
253  mfRotateX(-20.0),
254  mfRotateY(45.0),
255  mfRotateZ(0.0),
256  mfSaveActionStartHor(0.0),
257  mfSaveActionStartVer(0.0),
258  mfSaveActionStartRotZ(0.0),
259  mbMouseMoved(false),
260  mbMouseCaptured(false),
261  mbGeometrySelected(false)
262 {
263 }
264 
266 {
268  Construct2();
269 }
270 
272 {
273  {
274  // hide all page stuff, use control background (normally gray)
275  const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
276  mp3DView->SetPageVisible(false);
277  mp3DView->SetApplicationBackgroundColor(aDialogColor);
278  mp3DView->SetApplicationDocumentColor(aDialogColor);
279  }
280 
281  {
282  // create invisible expansion object
283  const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
285  *mpModel,
286  mp3DView->Get3DDefaultAttributes(),
287  basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
288  basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
290  SfxItemSet aSet(mpModel->GetItemPool());
291  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
292  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
294  }
295 
296  {
297  // create lamp control object (Yellow lined object)
298  // base circle
301  basegfx::B3DHomMatrix aTransform;
302 
303  aTransform.rotate(F_PI2, 0.0, 0.0);
304  aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
305  a3DCircle.transform(aTransform);
306 
307  // create object for it
308  mpLampBottomObject = new E3dPolygonObj(
309  *mpModel,
310  basegfx::B3DPolyPolygon(a3DCircle));
312 
313  // half circle with stand
314  basegfx::B2DPolygon a2DHalfCircle;
320 
321  // create object for it
322  mpLampShaftObject = new E3dPolygonObj(
323  *mpModel,
324  basegfx::B3DPolyPolygon(a3DHalfCircle));
326 
327  // initially invisible
328  SfxItemSet aSet(mpModel->GetItemPool());
329  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
330  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
331 
334  }
335 
336  {
337  // change camera settings
338  Camera3D rCamera = mpScene->GetCamera();
339  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
340  double fW = rVolume.getWidth();
341  double fH = rVolume.getHeight();
342  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
343 
344  rCamera.SetAutoAdjustProjection(false);
345  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
346  basegfx::B3DPoint aLookAt;
347  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
348  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
349  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
350  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
351  rCamera.SetFocalLength(fDefaultCamFocal);
352 
353  mpScene->SetCamera( rCamera );
354 
355  basegfx::B3DHomMatrix aNeutral;
356  mpScene->SetTransform(aNeutral);
357  }
358 
359  // invalidate SnapRects of objects
361 }
362 
364 {
365  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
366  {
367  // get rid of possible existing light object
368  if(maLightObjects[a])
369  {
370  mpScene->RemoveObject(maLightObjects[a]->GetOrdNum());
371  // always use SdrObject::Free(...) for SdrObjects (!)
372  SdrObject* pTemp(maLightObjects[a]);
373  SdrObject::Free(pTemp);
374  maLightObjects[a] = nullptr;
375  }
376 
377  if(GetLightOnOff(a))
378  {
379  const bool bIsSelectedLight(a == maSelectedLight);
381  aDirection.normalize();
382  aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
383 
384  const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
385  E3dObject* pNewLight = new E3dSphereObj(
386  *mpModel,
387  mp3DView->Get3DDefaultAttributes(),
388  basegfx::B3DPoint( 0, 0, 0 ),
389  basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
390  mpScene->InsertObject(pNewLight);
391 
392  basegfx::B3DHomMatrix aTransform;
393  aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
394  pNewLight->SetTransform(aTransform);
395 
396  SfxItemSet aSet(mpModel->GetItemPool());
397  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
398  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
399  aSet.Put( XFillColorItem(OUString(), GetLightColor(a)));
400  pNewLight->SetMergedItemSet(aSet);
401 
402  maLightObjects[a] = pNewLight;
403  }
404  }
405 }
406 
408 {
410  {
411  // make mpLampBottomObject/mpLampShaftObject invisible
412  SfxItemSet aSet(mpModel->GetItemPool());
413  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
414  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
417  }
418  else
419  {
421  aDirection.normalize();
422 
423  // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
424  SfxItemSet aSet(mpModel->GetItemPool());
425  aSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) );
426  aSet.Put( XLineColorItem(OUString(), COL_YELLOW));
427  aSet.Put( XLineWidthItem(0));
428  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
431 
432  // adapt transformation of mpLampShaftObject
433  basegfx::B3DHomMatrix aTransform;
434  double fRotateY(0.0);
435 
436  if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
437  {
438  fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
439  }
440 
441  aTransform.rotate(0.0, fRotateY, 0.0);
442  mpLampShaftObject->SetTransform(aTransform);
443 
444  // adapt transformation of selected light
445  E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
446 
447  if(pSelectedLight)
448  {
449  aTransform.identity();
450  aTransform.translate(
451  aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
452  aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
453  aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
454  pSelectedLight->SetTransform(aTransform);
455  }
456  }
457 }
458 
459 void Svx3DLightControl::TrySelection(Point aPosPixel)
460 {
461  if(!mpScene)
462  return;
463 
464  const Point aPosLogic(GetDrawingArea()->get_ref_device().PixelToLogic(aPosPixel));
465  const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
466  std::vector< const E3dCompoundObject* > aResult;
467  getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
468 
469  if(aResult.empty())
470  return;
471 
472  // exclude expansion object which will be part of
473  // the hits. It's invisible, but for HitTest, it's included
474  const E3dCompoundObject* pResult = nullptr;
475 
476  for(auto const & b: aResult)
477  {
478  if(b && b != mpExpansionObject)
479  {
480  pResult = b;
481  break;
482  }
483  }
484 
485  if(pResult == mp3DObj)
486  {
487  if(!mbGeometrySelected)
488  {
489  mbGeometrySelected = true;
493  Invalidate();
494 
496  {
498  }
499  }
500  }
501  else
502  {
503  sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
504 
505  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
506  {
507  if(maLightObjects[a] && maLightObjects[a] == pResult)
508  {
509  aNewSelectedLight = a;
510  }
511  }
512 
513  if(aNewSelectedLight != maSelectedLight)
514  {
515  SelectLight(aNewSelectedLight);
516 
518  {
520  }
521  }
522  }
523 }
524 
526 {
527  Svx3DPreviewControl::Paint(rRenderContext, rRect);
528 }
529 
531 {
532  if (!HasFocus())
533  return tools::Rectangle();
534  Size aFocusSize = GetOutputSizePixel();
535  aFocusSize.AdjustWidth( -4 );
536  aFocusSize.AdjustHeight( -4 );
537  return tools::Rectangle(Point(2, 2), aFocusSize);
538 }
539 
541 {
542  bool bCallParent(true);
543 
544  // switch state
545  if(rMEvt.IsLeft())
546  {
548  {
549  mbMouseMoved = false;
550  bCallParent = false;
552  CaptureMouse();
553  mbMouseCaptured = true;
554  }
555  else
556  {
557  // Single click without moving much trying to do a selection
558  TrySelection(rMEvt.GetPosPixel());
559  bCallParent = false;
560  }
561  }
562 
563  // call parent
564  if (bCallParent)
566  return true;
567 }
568 
570 {
571  if (!mbMouseCaptured)
572  return false;
573 
574  Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
575 
576  if(!mbMouseMoved)
577  {
578  if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > g_nInteractionStartDistance)
579  {
581  {
583  }
584  else
585  {
586  // interaction start, save values
588  }
589 
590  mbMouseMoved = true;
591  }
592  }
593 
594  if(mbMouseMoved)
595  {
597  {
598  double fNewRotX = mfSaveActionStartVer - basegfx::deg2rad(aDeltaPos.Y());
599  double fNewRotY = mfSaveActionStartHor + basegfx::deg2rad(aDeltaPos.X());
600 
601  // cut horizontal
602  while(fNewRotY < 0.0)
603  {
604  fNewRotY += F_2PI;
605  }
606 
607  while(fNewRotY >= F_2PI)
608  {
609  fNewRotY -= F_2PI;
610  }
611 
612  // cut vertical
613  if(fNewRotX < -F_PI2)
614  {
615  fNewRotX = -F_PI2;
616  }
617 
618  if(fNewRotX > F_PI2)
619  {
620  fNewRotX = F_PI2;
621  }
622 
623  SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
624 
625  if(maChangeCallback.IsSet())
626  {
627  maChangeCallback.Call(this);
628  }
629  }
630  else
631  {
632  // interaction in progress
633  double fNewPosHor = mfSaveActionStartHor + static_cast<double>(aDeltaPos.X());
634  double fNewPosVer = mfSaveActionStartVer - static_cast<double>(aDeltaPos.Y());
635 
636  // cut horizontal
637  fNewPosHor = NormAngle360(fNewPosHor);
638 
639  // cut vertical
640  if(fNewPosVer < -90.0)
641  {
642  fNewPosVer = -90.0;
643  }
644 
645  if(fNewPosVer > 90.0)
646  {
647  fNewPosVer = 90.0;
648  }
649 
650  SetPosition(fNewPosHor, fNewPosVer);
651 
652  if(maChangeCallback.IsSet())
653  {
654  maChangeCallback.Call(this);
655  }
656  }
657  }
658  return true;
659 }
660 
662 {
663  if (!mbMouseCaptured)
664  return false;
665  ReleaseMouse();
666  mbMouseCaptured = false;
667 
668  if (mbMouseMoved)
669  {
670  // was change interactively
671  }
672  else
673  {
674  // simple click without much movement, try selection
675  TrySelection(rMEvt.GetPosPixel());
676  }
677 
678  return true;
679 }
680 
682 {
683  // set size of page
684  const Size aSize(GetDrawingArea()->get_ref_device().PixelToLogic(GetOutputSizePixel()));
685  mxFmPage->SetSize(aSize);
686 
687  // set position and size of scene
688  mpScene->SetSnapRect(tools::Rectangle(Point(0, 0), aSize));
689 }
690 
692 {
693  // call parent
695 
696  // apply object rotation
697  if(mp3DObj)
698  {
699  basegfx::B3DHomMatrix aObjectRotation;
700  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
701  mp3DObj->SetTransform(aObjectRotation);
702  }
703 }
704 
706 {
708 }
709 
710 void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
711 {
712  if(IsSelectionValid())
713  {
715  aDirection.normalize();
716  rHor = basegfx::rad2deg(atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI); // 0..360.0
717  rVer = basegfx::rad2deg(atan2(aDirection.getY(), aDirection.getXZLength())); // -90.0..90.0
718  }
719  if(IsGeometrySelected())
720  {
721  rHor = basegfx::rad2deg(mfRotateY); // 0..360.0
722  rVer = basegfx::rad2deg(mfRotateX); // -90.0..90.0
723  }
724 }
725 
726 void Svx3DLightControl::SetPosition(double fHor, double fVer)
727 {
728  if(IsSelectionValid())
729  {
730  // set selected light's direction
731  fHor = basegfx::deg2rad(fHor) - F_PI; // -PI..PI
732  fVer = basegfx::deg2rad(fVer); // -PI2..PI2
733  basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
734  aDirection.normalize();
735 
736  if(!aDirection.equal(GetLightDirection(maSelectedLight)))
737  {
738  // set changed light direction at SdrScene
739  SfxItemSet aSet(mpModel->GetItemPool());
740 
741  switch(maSelectedLight)
742  {
743  case 0: aSet.Put(makeSvx3DLightDirection1Item(aDirection)); break;
744  case 1: aSet.Put(makeSvx3DLightDirection2Item(aDirection)); break;
745  case 2: aSet.Put(makeSvx3DLightDirection3Item(aDirection)); break;
746  case 3: aSet.Put(makeSvx3DLightDirection4Item(aDirection)); break;
747  case 4: aSet.Put(makeSvx3DLightDirection5Item(aDirection)); break;
748  case 5: aSet.Put(makeSvx3DLightDirection6Item(aDirection)); break;
749  case 6: aSet.Put(makeSvx3DLightDirection7Item(aDirection)); break;
750  default:
751  case 7: aSet.Put(makeSvx3DLightDirection8Item(aDirection)); break;
752  }
753 
754  mpScene->SetMergedItemSet(aSet);
755 
756  // correct 3D light's and LampFrame's geometries
758  Invalidate();
759  }
760  }
761  if(!IsGeometrySelected())
762  return;
763 
764  if(mfRotateX == fVer && mfRotateY == fHor)
765  return;
766 
767  mfRotateX = basegfx::deg2rad(fVer);
768  mfRotateY = basegfx::deg2rad(fHor);
769 
770  if(mp3DObj)
771  {
772  basegfx::B3DHomMatrix aObjectRotation;
773  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
774  mp3DObj->SetTransform(aObjectRotation);
775 
776  Invalidate();
777  }
778 }
779 
780 void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
781 {
782  if(!IsGeometrySelected())
783  return;
784 
785  if(fRotX == mfRotateX && fRotY == mfRotateY && fRotZ == mfRotateZ)
786  return;
787 
788  mfRotateX = fRotX;
789  mfRotateY = fRotY;
790  mfRotateZ = fRotZ;
791 
792  if(mp3DObj)
793  {
794  basegfx::B3DHomMatrix aObjectRotation;
795  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
796  mp3DObj->SetTransform(aObjectRotation);
797 
798  Invalidate();
799  }
800 }
801 
802 void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
803 {
804  rRotX = mfRotateX;
805  rRotY = mfRotateY;
806  rRotZ = mfRotateZ;
807 }
808 
810 {
811  // call parent
813 
815  {
816  // selected light is no more active, select new one
818  }
819 
820  // local updates
823  Invalidate();
824 }
825 
826 void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
827 {
828  if(nLightNumber > 7)
829  {
830  nLightNumber = NO_LIGHT_SELECTED;
831  }
832 
833  if(NO_LIGHT_SELECTED != nLightNumber)
834  {
835  if(!GetLightOnOff(nLightNumber))
836  {
837  nLightNumber = NO_LIGHT_SELECTED;
838  }
839  }
840 
841  if(nLightNumber != maSelectedLight)
842  {
843  maSelectedLight = nLightNumber;
844  mbGeometrySelected = false;
847  Invalidate();
848  }
849 }
850 
851 bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
852 {
853  if(nNum <= 7)
854  {
855  const SfxItemSet aLightItemSet(Get3DAttributes());
856 
857  switch(nNum)
858  {
859  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
860  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
861  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
862  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
863  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
864  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
865  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
866  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
867  }
868  }
869 
870  return false;
871 }
872 
874 {
875  if(nNum <= 7)
876  {
877  const SfxItemSet aLightItemSet(Get3DAttributes());
878 
879  switch(nNum)
880  {
881  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
882  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
883  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
884  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
885  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
886  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
887  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
888  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
889  }
890  }
891 
892  return COL_BLACK;
893 }
894 
896 {
897  if(nNum <= 7)
898  {
899  const SfxItemSet aLightItemSet(Get3DAttributes());
900 
901  switch(nNum)
902  {
903  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1).GetValue();
904  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2).GetValue();
905  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3).GetValue();
906  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4).GetValue();
907  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5).GetValue();
908  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6).GetValue();
909  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7).GetValue();
910  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8).GetValue();
911  }
912  }
913 
914  return basegfx::B3DVector();
915 }
916 
918  weld::Scale& rVert, weld::Button& rSwitcher)
919  : mrLightControl(rLightControl)
920  , mrHorScroller(rHori)
921  , mrVerScroller(rVert)
922  , mrSwitcher(rSwitcher)
923 {
924  // init members
925  Init();
926 }
927 
929 {
930  Size aSize(mrLightControl.GetDrawingArea()->get_ref_device().LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont)));
931  mrLightControl.set_size_request(aSize.Width(), aSize.Height());
932 
933  // #i58240# set HelpIDs for scrollbars and switcher
938 
939  // Light preview
941  mrLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
942  mrLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
943 
944  // Horiz Scrollbar
946  mrHorScroller.set_range(0, 36000);
947  mrHorScroller.connect_value_changed( LINK(this, SvxLightCtl3D, ScrollBarMove) );
948 
949  // Vert Scrollbar
951  mrVerScroller.set_range(0, 18000);
952  mrVerScroller.connect_value_changed( LINK(this, SvxLightCtl3D, ScrollBarMove) );
953 
954  // Switch Button
955  mrSwitcher.show();
956  mrSwitcher.connect_clicked( LINK(this, SvxLightCtl3D, ButtonPress) );
957 
959  pArea->connect_key_press(Link<const KeyEvent&, bool>()); //acknowledge we first remove the old one
961 
962  pArea->connect_focus_in(Link<weld::Widget&, void>()); //acknowledge we first remove the old one
963  pArea->connect_focus_in(LINK(this, SvxLightCtl3D, FocusIn));
964 
965  // check selection
966  CheckSelection();
967 }
968 
970 {
971 }
972 
974 {
975  const bool bSelectionValid(mrLightControl.IsSelectionValid() || mrLightControl.IsGeometrySelected());
976  mrHorScroller.set_sensitive(bSelectionValid);
977  mrVerScroller.set_sensitive(bSelectionValid);
978 
979  if (bSelectionValid)
980  {
981  double fHor(0.0), fVer(0.0);
982  mrLightControl.GetPosition(fHor, fVer);
983  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
984  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
985  }
986 }
987 
988 void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
989 {
990  double fHor(0.0), fVer(0.0);
991 
992  mrLightControl.GetPosition(fHor, fVer);
993  fHor += fDeltaHor;
994  fVer += fDeltaVer;
995 
996  if( fVer > 90.0 )
997  return;
998 
999  if ( fVer < -90.0 )
1000  return;
1001 
1002  mrLightControl.SetPosition(fHor, fVer);
1003  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
1004  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1005 
1007  {
1009  }
1010 }
1011 
1012 IMPL_LINK(SvxLightCtl3D, KeyInput, const KeyEvent&, rKEvt, bool)
1013 {
1014  const vcl::KeyCode aCode(rKEvt.GetKeyCode());
1015 
1016  if (aCode.GetModifier())
1017  return false;
1018 
1019  bool bHandled = true;
1020 
1021  switch ( aCode.GetCode() )
1022  {
1023  case KEY_SPACE:
1024  {
1025  break;
1026  }
1027  case KEY_LEFT:
1028  {
1029  move( -4.0, 0.0 ); // #i58242# changed move direction in X
1030  break;
1031  }
1032  case KEY_RIGHT:
1033  {
1034  move( 4.0, 0.0 ); // #i58242# changed move direction in X
1035  break;
1036  }
1037  case KEY_UP:
1038  {
1039  move( 0.0, 4.0 );
1040  break;
1041  }
1042  case KEY_DOWN:
1043  {
1044  move( 0.0, -4.0 );
1045  break;
1046  }
1047  case KEY_PAGEUP:
1048  {
1049  sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1050 
1051  while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1052  {
1053  nLight--;
1054  }
1055 
1056  if(nLight < 0)
1057  {
1058  nLight = 7;
1059 
1060  while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1061  {
1062  nLight--;
1063  }
1064  }
1065 
1066  if(nLight >= 0)
1067  {
1068  mrLightControl.SelectLight(nLight);
1069  CheckSelection();
1070 
1071  if(maUserSelectionChangeCallback.IsSet())
1072  {
1073  maUserSelectionChangeCallback.Call(this);
1074  }
1075  }
1076 
1077  break;
1078  }
1079  case KEY_PAGEDOWN:
1080  {
1081  sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1082 
1083  while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1084  {
1085  nLight++;
1086  }
1087 
1088  if(nLight > 7)
1089  {
1090  nLight = 0;
1091 
1092  while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1093  {
1094  nLight++;
1095  }
1096  }
1097 
1098  if(nLight <= 7)
1099  {
1100  mrLightControl.SelectLight(nLight);
1101  CheckSelection();
1102 
1103  if(maUserSelectionChangeCallback.IsSet())
1104  {
1105  maUserSelectionChangeCallback.Call(this);
1106  }
1107  }
1108 
1109  break;
1110  }
1111  default:
1112  {
1113  bHandled = false;
1114  break;
1115  }
1116  }
1117  return bHandled;
1118 }
1119 
1121 {
1122  if (mrLightControl.IsEnabled())
1123  {
1124  CheckSelection();
1125  }
1126 }
1127 
1129 {
1130  const sal_Int32 nHor(mrHorScroller.get_value());
1131  const sal_Int32 nVer(mrVerScroller.get_value());
1132 
1133  mrLightControl.SetPosition(
1134  static_cast<double>(nHor) / 100.0,
1135  static_cast<double>((18000 - nVer) - 9000) / 100.0);
1136 
1137  if (maUserInteractiveChangeCallback.IsSet())
1138  {
1139  maUserInteractiveChangeCallback.Call(this);
1140  }
1141 }
1142 
1144 {
1145  if(SvxPreviewObjectType::SPHERE == GetSvx3DLightControl().GetObjectType())
1146  {
1147  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::CUBE);
1148  }
1149  else
1150  {
1151  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
1152  }
1153 }
1154 
1155 IMPL_LINK_NOARG(SvxLightCtl3D, InternalInteractiveChange, Svx3DLightControl*, void)
1156 {
1157  double fHor(0.0), fVer(0.0);
1158 
1159  mrLightControl.GetPosition(fHor, fVer);
1160  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
1161  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1162 
1163  if(maUserInteractiveChangeCallback.IsSet())
1164  {
1165  maUserInteractiveChangeCallback.Call(this);
1166  }
1167 }
1168 
1169 IMPL_LINK_NOARG(SvxLightCtl3D, InternalSelectionChange, Svx3DLightControl*, void)
1170 {
1171  CheckSelection();
1172 
1173  if(maUserSelectionChangeCallback.IsSet())
1174  {
1175  maUserSelectionChangeCallback.Call(this);
1176  }
1177 }
1178 
1179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetAutoAdjustProjection(bool bAdjust)
Definition: camera3d.hxx:62
std::unique_ptr< E3dView > mp3DView
Definition: dlgctl3d.hxx:43
virtual SdrObject * RemoveObject(size_t nObjNum) override
Definition: scene3d.cxx:793
virtual void Set3DAttributes(const SfxItemSet &rAttr) override
Definition: dlgctl3d.cxx:809
E3dScene * mpScene
Definition: dlgctl3d.hxx:44
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_4(SDRATTR_3DSCENE_FIRST+16)
weld::Scale & mrVerScroller
Definition: dlgctl3d.hxx:144
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void GetPosition(double &rHor, double &rVer)
Definition: dlgctl3d.cxx:710
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_5(SDRATTR_3DSCENE_FIRST+25)
rtl::Reference< FmFormPage > mxFmPage
Definition: dlgctl3d.hxx:42
Point maActionStartPoint
Definition: dlgctl3d.hxx:86
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_2(SDRATTR_3DSCENE_FIRST+22)
Link< SvxLightCtl3D *, void > maUserInteractiveChangeCallback
Definition: dlgctl3d.hxx:148
virtual void set_value(int value)=0
virtual void Resize() override
Definition: dlgctl3d.cxx:681
void SetViewWindow(double fX, double fY, double fW, double fH)
Definition: camera3d.cxx:41
static constexpr auto Items
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:661
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_5(SDRATTR_3DSCENE_FIRST+8)
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
Definition: scene3d.cxx:804
bool equalZero(const T &rfVal)
double mfSaveActionStartVer
Definition: dlgctl3d.hxx:88
bool IsGeometrySelected() const
Definition: dlgctl3d.hxx:119
B3DVector & normalize()
static const AllSettings & GetSettings()
#define RADIUS_LAMP_SMALL
Definition: dlgctl3d.cxx:240
#define F_PI2
bool IsShift() const
weld::Scale & mrHorScroller
Definition: dlgctl3d.hxx:143
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
#define DEG2RAD(fAngle)
Definition: def3d.hxx:27
virtual void Set3DAttributes(const SfxItemSet &rAttr)
Definition: dlgctl3d.cxx:232
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:895
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_7(SDRATTR_3DSCENE_FIRST+19)
const basegfx::B3DHomMatrix & GetTransform() const
Definition: obj3d.hxx:112
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:471
constexpr sal_uInt16 KEY_SPACE
Link< Svx3DLightControl *, void > maSelectionChangeCallback
Definition: dlgctl3d.hxx:69
void SetMapMode()
constexpr double rad2deg(double v)
E3dObject * mp3DObj
Definition: dlgctl3d.hxx:45
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_2(SDRATTR_3DSCENE_FIRST+14)
constexpr sal_uInt16 KEY_UP
#define MAX_NUMBER_LIGHTS
Definition: dlgctl3d.cxx:243
Size const & GetOutputSizePixel() const
virtual void set_range(int min, int max)=0
double getMaxZ() const
void move(double fDeltaHor, double fDeltaVer)
Definition: dlgctl3d.cxx:988
constexpr tools::Long Width() const
bool mbMouseCaptured
Link< Svx3DLightControl *, void > maChangeCallback
Definition: dlgctl3d.hxx:68
#define RADIUS_LAMP_BIG
Definition: dlgctl3d.cxx:241
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_3(SDRATTR_3DSCENE_FIRST+6)
virtual void show()=0
void SetSelectionChangeCallback(Link< Svx3DLightControl *, void > aNew)
Definition: dlgctl3d.hxx:115
#define HID_CTRL3D_VSCROLL
Definition: helpids.h:26
bool IsSelectionValid()
Definition: dlgctl3d.cxx:705
void SetCamera(const Camera3D &rNewCamera)
Definition: scene3d.cxx:345
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_7(SDRATTR_3DSCENE_FIRST+27)
virtual tools::Rectangle GetFocusRect() override
Definition: dlgctl3d.cxx:530
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_6(SDRATTR_3DSCENE_FIRST+26)
constexpr sal_uInt16 KEY_PAGEUP
bool mbGeometrySelected
Definition: dlgctl3d.hxx:93
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:569
SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:247
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:2003
virtual void set_help_id(const OString &rName)=0
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_6(SDRATTR_3DSCENE_FIRST+18)
#define NO_LIGHT_SELECTED
Definition: dlgctl3d.cxx:242
virtual OutputDevice & get_ref_device()=0
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_1(SDRATTR_3DSCENE_FIRST+13)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_1(SDRATTR_3DSCENE_FIRST+4)
void SelectLight(sal_uInt32 nLightNumber)
Definition: dlgctl3d.cxx:826
T NormAngle360(T angle)
E3dObject * mpLampShaftObject
Definition: dlgctl3d.hxx:77
SphereObject with diameter r3DSize.
Definition: sphere3d.hxx:35
constexpr sal_uInt16 KEY_DOWN
SvxB3DVectorItem makeSvx3DLightDirection6Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:255
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_3(SDRATTR_3DSCENE_FIRST+15)
double getY() const
void connect_clicked(const Link< Button &, void > &rLink)
B2DPolygon createPolygonFromCircle(const B2DPoint &rCenter, double fRadius)
double getZ() const
#define F_PI
#define HID_CTRL3D_SWITCHER
Definition: helpids.h:25
void GetRotation(double &rRotX, double &rRotY, double &rRotZ)
Definition: dlgctl3d.cxx:802
double getHeight() const
uno_Any a
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_7(SDRATTR_3DSCENE_FIRST+10)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_1(SDRATTR_3DSCENE_FIRST+21)
double getX() const
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
css::drawing::Direction3D aDirection
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_5(SDRATTR_3DSCENE_FIRST+17)
std::unique_ptr< FmFormModel > mpModel
Definition: dlgctl3d.hxx:41
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctl3d.cxx:265
std::vector< E3dObject * > maLightObjects
Definition: dlgctl3d.hxx:78
#define F_2PI
double getXZLength() const
E3dObject * mpLampBottomObject
Definition: dlgctl3d.hxx:76
void SetFocalLength(double fLen)
Definition: camera3d.cxx:172
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
void AdaptToSelectedLight()
Definition: dlgctl3d.cxx:407
const sal_Int32 g_nInteractionStartDistance
Definition: dlgctl3d.cxx:245
constexpr sal_uInt16 KEY_PAGEDOWN
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:900
SvxLightCtl3D(Svx3DLightControl &rLightControl, weld::Scale &rHori, weld::Scale &rVert, weld::Button &rButton)
Definition: dlgctl3d.cxx:917
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_8(SDRATTR_3DSCENE_FIRST+20)
void SetPosition(double fHor, double fVer)
Definition: dlgctl3d.cxx:726
void connect_value_changed(const Link< Scale &, void > &rLink)
constexpr double deg2rad(double v)
const basegfx::B3DRange & GetBoundVolume() const
Definition: obj3d.cxx:311
virtual void connect_focus_in(const Link< Widget &, void > &rLink)
#define RADIUS_LAMP_PREVIEW_SIZE
Definition: dlgctl3d.cxx:239
IMPL_LINK_NOARG(SvxLightCtl3D, FocusIn, weld::Widget &, void)
Definition: dlgctl3d.cxx:1120
virtual void Resize() override
Definition: dlgctl3d.cxx:142
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_8(SDRATTR_3DSCENE_FIRST+28)
sal_uInt32 maSelectedLight
Definition: dlgctl3d.hxx:72
Abstract DrawObject.
Definition: svdobj.hxx:259
void SetOutputSizePixel(const Size &rSize)
SfxItemSet const & Get3DAttributes() const
Definition: dlgctl3d.cxx:227
SvxB3DVectorItem makeSvx3DLightDirection5Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:251
virtual void connect_key_press(const Link< const KeyEvent &, bool > &rLink)
Color GetLightColor(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:873
Svx3DLightControl & mrLightControl
Definition: dlgctl3d.hxx:142
#define HID_CTRL3D_HSCROLL
Definition: helpids.h:24
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
Definition: camera3d.cxx:69
constexpr sal_uInt16 KEY_RIGHT
bool equal(const B3DTuple &rTup) const
void translate(double fX, double fY, double fZ)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
double getWidth() const
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
Definition: obj3d.cxx:365
void set_size_request(int nWidth, int nHeight)
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix) override
Definition: scene3d.cxx:601
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
double mfSaveActionStartHor
Definition: dlgctl3d.hxx:87
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:540
Derived class of SdrView to edit 3D objects.
Definition: view3d.hxx:41
weld::DrawingArea * GetDrawingArea() const
void TrySelection(Point aPosPixel)
Definition: dlgctl3d.cxx:459
weld::Button & mrSwitcher
Definition: dlgctl3d.hxx:145
virtual ~Svx3DPreviewControl() override
Definition: dlgctl3d.cxx:64
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void SetObjectType(SvxPreviewObjectType nType)
Definition: dlgctl3d.cxx:178
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: scene3d.cxx:763
constexpr tools::Long Height() const
SvxB3DVectorItem makeSvx3DLightDirection2Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:239
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 ...
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
SvxB3DVectorItem makeSvx3DLightDirection1Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:235
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1978
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
bool IsLeft() const
tools::Long AdjustWidth(tools::Long n)
SvxB3DVectorItem makeSvx3DLightDirection3Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:243
void CheckSelection(struct ESelection &rSel, SvxTextForwarder const *pForwarder) noexcept
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_3(SDRATTR_3DSCENE_FIRST+23)
IMPL_LINK(SvxLightCtl3D, KeyInput, const KeyEvent &, rKEvt, bool)
Definition: dlgctl3d.cxx:1012
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctl3d.cxx:54
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_8(SDRATTR_3DSCENE_FIRST+11)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_YELLOW
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:525
const Point & GetPosPixel() const
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_6(SDRATTR_3DSCENE_FIRST+9)
void SetRotation(double fRotX, double fRotY, double fRotZ)
Definition: dlgctl3d.cxx:780
tools::Long AdjustHeight(tools::Long n)
bool GetLightOnOff(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:851
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1691
E3dObject * mpExpansionObject
Definition: dlgctl3d.hxx:75
SvxPreviewObjectType GetObjectType() const
Definition: dlgctl3d.hxx:60
SvxB3DVectorItem makeSvx3DLightDirection8Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:263
void rotate(double fAngleX, double fAngleY, double fAngleZ)
SvxPreviewObjectType mnObjectType
Definition: dlgctl3d.hxx:46
constexpr sal_uInt16 KEY_LEFT
virtual void set_accessible_name(const OUString &rName)=0
double mfSaveActionStartRotZ
Definition: dlgctl3d.hxx:89
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_2(SDRATTR_3DSCENE_FIRST+5)
void CheckSelection()
Definition: dlgctl3d.cxx:973
void transform(const B3DHomMatrix &rMatrix)
virtual void set_size_request(int nWidth, int nHeight)=0
void SetChangeCallback(Link< Svx3DLightControl *, void > aNew)
Definition: dlgctl3d.hxx:114
SvxPreviewObjectType
Definition: dlgctl3d.hxx:36
const Camera3D & GetCamera() const
Definition: scene3d.hxx:127
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:162
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_4(SDRATTR_3DSCENE_FIRST+7)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:157
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_4(SDRATTR_3DSCENE_FIRST+24)
virtual void set_sensitive(bool sensitive)=0
virtual void SetObjectType(SvxPreviewObjectType nType) override
Definition: dlgctl3d.cxx:691
void ConstructLightObjects()
Definition: dlgctl3d.cxx:363
bool IsMod1() const
void EnableRTL(bool bEnable)
SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:259