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