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  : mpFmPage(nullptr)
49  , mpScene(nullptr)
50  , mp3DObj(nullptr)
51  , mnObjectType(SvxPreviewObjectType::SPHERE)
52 {
53 }
54 
56 {
57  Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont)));
58  pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
59  CustomWidgetController::SetDrawingArea(pDrawingArea);
60  SetOutputSizePixel(aSize);
61 
62  Construct();
63 }
64 
66 {
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  mpFmPage = new FmFormPage( *mpModel );
85  mpModel->InsertPage( mpFmPage, 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 );
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( mpFmPage );
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  mpFmPage->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  {
183  mnObjectType = nType;
184 
185  if( mp3DObj )
186  {
187  aSet.Put(mp3DObj->GetMergedItemSet());
189  // always use SdrObject::Free(...) for SdrObjects (!)
190  SdrObject* pTemp(mp3DObj);
191  SdrObject::Free(pTemp);
192  }
193 
194  switch( nType )
195  {
197  {
198  mp3DObj = new E3dSphereObj(
199  *mpModel,
200  mp3DView->Get3DDefaultAttributes(),
201  basegfx::B3DPoint( 0, 0, 0 ),
202  basegfx::B3DVector( 5000, 5000, 5000 ));
203  }
204  break;
205 
207  {
208  mp3DObj = new E3dCubeObj(
209  *mpModel,
210  mp3DView->Get3DDefaultAttributes(),
211  basegfx::B3DPoint( -2500, -2500, -2500 ),
212  basegfx::B3DVector( 5000, 5000, 5000 ));
213  }
214  break;
215  }
216 
217  if (mp3DObj)
218  {
220  mp3DObj->SetMergedItemSet(aSet);
221  }
222 
223  Invalidate();
224  }
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 static const sal_Int32 g_nInteractionStartDistance = 5 * 5 * 2;
246 
248 : maChangeCallback(),
249  maSelectionChangeCallback(),
250  maSelectedLight(NO_LIGHT_SELECTED),
251  mpExpansionObject(nullptr),
252  mpLampBottomObject(nullptr),
253  mpLampShaftObject(nullptr),
254  maLightObjects(MAX_NUMBER_LIGHTS, nullptr),
255  mfRotateX(-20.0),
256  mfRotateY(45.0),
257  mfRotateZ(0.0),
258  maActionStartPoint(),
259  mfSaveActionStartHor(0.0),
260  mfSaveActionStartVer(0.0),
261  mfSaveActionStartRotZ(0.0),
262  mbMouseMoved(false),
263  mbMouseCaptured(false),
264  mbGeometrySelected(false)
265 {
266 }
267 
269 {
271  Construct2();
272 }
273 
275 {
276  {
277  // hide all page stuff, use control background (normally gray)
278  const Color aDialogColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
279  mp3DView->SetPageVisible(false);
280  mp3DView->SetApplicationBackgroundColor(aDialogColor);
281  mp3DView->SetApplicationDocumentColor(aDialogColor);
282  }
283 
284  {
285  // create invisible expansion object
286  const double fMaxExpansion(RADIUS_LAMP_BIG + RADIUS_LAMP_PREVIEW_SIZE);
288  *mpModel,
289  mp3DView->Get3DDefaultAttributes(),
290  basegfx::B3DPoint(-fMaxExpansion, -fMaxExpansion, -fMaxExpansion),
291  basegfx::B3DVector(2.0 * fMaxExpansion, 2.0 * fMaxExpansion, 2.0 * fMaxExpansion));
293  SfxItemSet aSet(mpModel->GetItemPool());
294  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
295  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
297  }
298 
299  {
300  // create lamp control object (Yellow lined object)
301  // base circle
304  basegfx::B3DHomMatrix aTransform;
305 
306  aTransform.rotate(F_PI2, 0.0, 0.0);
307  aTransform.translate(0.0, -RADIUS_LAMP_PREVIEW_SIZE, 0.0);
308  a3DCircle.transform(aTransform);
309 
310  // create object for it
311  mpLampBottomObject = new E3dPolygonObj(
312  *mpModel,
313  basegfx::B3DPolyPolygon(a3DCircle));
315 
316  // half circle with stand
317  basegfx::B2DPolygon a2DHalfCircle;
323 
324  // create object for it
325  mpLampShaftObject = new E3dPolygonObj(
326  *mpModel,
327  basegfx::B3DPolyPolygon(a3DHalfCircle));
329 
330  // initially invisible
331  SfxItemSet aSet(mpModel->GetItemPool());
332  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
333  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
334 
337  }
338 
339  {
340  // change camera settings
341  Camera3D rCamera = mpScene->GetCamera();
342  const basegfx::B3DRange& rVolume = mpScene->GetBoundVolume();
343  double fW = rVolume.getWidth();
344  double fH = rVolume.getHeight();
345  double fCamZ = rVolume.getMaxZ() + ((fW + fH) / 2.0);
346 
347  rCamera.SetAutoAdjustProjection(false);
348  rCamera.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
349  basegfx::B3DPoint aLookAt;
350  double fDefaultCamPosZ = mp3DView->GetDefaultCamPosZ();
351  basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
352  rCamera.SetPosAndLookAt(aCamPos, aLookAt);
353  double fDefaultCamFocal = mp3DView->GetDefaultCamFocal();
354  rCamera.SetFocalLength(fDefaultCamFocal);
355 
356  mpScene->SetCamera( rCamera );
357 
358  basegfx::B3DHomMatrix aNeutral;
359  mpScene->SetTransform(aNeutral);
360  }
361 
362  // invalidate SnapRects of objects
364 }
365 
367 {
368  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
369  {
370  // get rid of possible existing light object
371  if(maLightObjects[a])
372  {
373  mpScene->RemoveObject(maLightObjects[a]->GetOrdNum());
374  // always use SdrObject::Free(...) for SdrObjects (!)
375  SdrObject* pTemp(maLightObjects[a]);
376  SdrObject::Free(pTemp);
377  maLightObjects[a] = nullptr;
378  }
379 
380  if(GetLightOnOff(a))
381  {
382  const bool bIsSelectedLight(a == maSelectedLight);
384  aDirection.normalize();
385  aDirection *= RADIUS_LAMP_PREVIEW_SIZE;
386 
387  const double fLampSize(bIsSelectedLight ? RADIUS_LAMP_BIG : RADIUS_LAMP_SMALL);
388  E3dObject* pNewLight = new E3dSphereObj(
389  *mpModel,
390  mp3DView->Get3DDefaultAttributes(),
391  basegfx::B3DPoint( 0, 0, 0 ),
392  basegfx::B3DVector( fLampSize, fLampSize, fLampSize));
393  mpScene->InsertObject(pNewLight);
394 
395  basegfx::B3DHomMatrix aTransform;
396  aTransform.translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
397  pNewLight->SetTransform(aTransform);
398 
399  SfxItemSet aSet(mpModel->GetItemPool());
400  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
401  aSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
402  aSet.Put( XFillColorItem(OUString(), GetLightColor(a)));
403  pNewLight->SetMergedItemSet(aSet);
404 
405  maLightObjects[a] = pNewLight;
406  }
407  }
408 }
409 
411 {
413  {
414  // make mpLampBottomObject/mpLampShaftObject invisible
415  SfxItemSet aSet(mpModel->GetItemPool());
416  aSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
417  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
420  }
421  else
422  {
424  aDirection.normalize();
425 
426  // make mpLampBottomObject/mpLampShaftObject visible (yellow hairline)
427  SfxItemSet aSet(mpModel->GetItemPool());
428  aSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) );
429  aSet.Put( XLineColorItem(OUString(), COL_YELLOW));
430  aSet.Put( XLineWidthItem(0));
431  aSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
434 
435  // adapt transformation of mpLampShaftObject
436  basegfx::B3DHomMatrix aTransform;
437  double fRotateY(0.0);
438 
439  if(!basegfx::fTools::equalZero(aDirection.getZ()) || !basegfx::fTools::equalZero(aDirection.getX()))
440  {
441  fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
442  }
443 
444  aTransform.rotate(0.0, fRotateY, 0.0);
445  mpLampShaftObject->SetTransform(aTransform);
446 
447  // adapt transformation of selected light
448  E3dObject* pSelectedLight = maLightObjects[sal_Int32(maSelectedLight)];
449 
450  if(pSelectedLight)
451  {
452  aTransform.identity();
453  aTransform.translate(
454  aDirection.getX() * RADIUS_LAMP_PREVIEW_SIZE,
455  aDirection.getY() * RADIUS_LAMP_PREVIEW_SIZE,
456  aDirection.getZ() * RADIUS_LAMP_PREVIEW_SIZE);
457  pSelectedLight->SetTransform(aTransform);
458  }
459  }
460 }
461 
462 void Svx3DLightControl::TrySelection(Point aPosPixel)
463 {
464  if(mpScene)
465  {
466  const Point aPosLogic(GetDrawingArea()->get_ref_device().PixelToLogic(aPosPixel));
467  const basegfx::B2DPoint aPoint(aPosLogic.X(), aPosLogic.Y());
468  std::vector< const E3dCompoundObject* > aResult;
469  getAllHit3DObjectsSortedFrontToBack(aPoint, *mpScene, aResult);
470 
471  if(!aResult.empty())
472  {
473  // exclude expansion object which will be part of
474  // the hits. It's invisible, but for HitTest, it's included
475  const E3dCompoundObject* pResult = nullptr;
476 
477  for(auto const & b: aResult)
478  {
479  if(b && b != mpExpansionObject)
480  {
481  pResult = b;
482  break;
483  }
484  }
485 
486  if(pResult == mp3DObj)
487  {
488  if(!mbGeometrySelected)
489  {
490  mbGeometrySelected = true;
494  Invalidate();
495 
497  {
499  }
500  }
501  }
502  else
503  {
504  sal_uInt32 aNewSelectedLight(NO_LIGHT_SELECTED);
505 
506  for(sal_uInt32 a(0); a < MAX_NUMBER_LIGHTS; a++)
507  {
508  if(maLightObjects[a] && maLightObjects[a] == pResult)
509  {
510  aNewSelectedLight = a;
511  }
512  }
513 
514  if(aNewSelectedLight != maSelectedLight)
515  {
516  SelectLight(aNewSelectedLight);
517 
519  {
521  }
522  }
523  }
524  }
525  }
526 }
527 
529 {
530  Svx3DPreviewControl::Paint(rRenderContext, rRect);
531 }
532 
534 {
535  if (!HasFocus())
536  return tools::Rectangle();
537  Size aFocusSize = GetOutputSizePixel();
538  aFocusSize.AdjustWidth( -4 );
539  aFocusSize.AdjustHeight( -4 );
540  return tools::Rectangle(Point(2, 2), aFocusSize);
541 }
542 
544 {
545  bool bCallParent(true);
546 
547  // switch state
548  if(rMEvt.IsLeft())
549  {
551  {
552  mbMouseMoved = false;
553  bCallParent = false;
555  CaptureMouse();
556  mbMouseCaptured = true;
557  }
558  else
559  {
560  // Single click without moving much trying to do a selection
561  TrySelection(rMEvt.GetPosPixel());
562  bCallParent = false;
563  }
564  }
565 
566  // call parent
567  if (bCallParent)
569  return true;
570 }
571 
573 {
574  if (!mbMouseCaptured)
575  return false;
576 
577  Point aDeltaPos = rMEvt.GetPosPixel() - maActionStartPoint;
578 
579  if(!mbMouseMoved)
580  {
581  if(sal_Int32(aDeltaPos.X() * aDeltaPos.X() + aDeltaPos.Y() * aDeltaPos.Y()) > g_nInteractionStartDistance)
582  {
584  {
586  }
587  else
588  {
589  // interaction start, save values
591  }
592 
593  mbMouseMoved = true;
594  }
595  }
596 
597  if(mbMouseMoved)
598  {
600  {
601  double fNewRotX = mfSaveActionStartVer - basegfx::deg2rad(aDeltaPos.Y());
602  double fNewRotY = mfSaveActionStartHor + basegfx::deg2rad(aDeltaPos.X());
603 
604  // cut horizontal
605  while(fNewRotY < 0.0)
606  {
607  fNewRotY += F_2PI;
608  }
609 
610  while(fNewRotY >= F_2PI)
611  {
612  fNewRotY -= F_2PI;
613  }
614 
615  // cut vertical
616  if(fNewRotX < -F_PI2)
617  {
618  fNewRotX = -F_PI2;
619  }
620 
621  if(fNewRotX > F_PI2)
622  {
623  fNewRotX = F_PI2;
624  }
625 
626  SetRotation(fNewRotX, fNewRotY, mfSaveActionStartRotZ);
627 
628  if(maChangeCallback.IsSet())
629  {
630  maChangeCallback.Call(this);
631  }
632  }
633  else
634  {
635  // interaction in progress
636  double fNewPosHor = mfSaveActionStartHor + static_cast<double>(aDeltaPos.X());
637  double fNewPosVer = mfSaveActionStartVer - static_cast<double>(aDeltaPos.Y());
638 
639  // cut horizontal
640  fNewPosHor = NormAngle360(fNewPosHor);
641 
642  // cut vertical
643  if(fNewPosVer < -90.0)
644  {
645  fNewPosVer = -90.0;
646  }
647 
648  if(fNewPosVer > 90.0)
649  {
650  fNewPosVer = 90.0;
651  }
652 
653  SetPosition(fNewPosHor, fNewPosVer);
654 
655  if(maChangeCallback.IsSet())
656  {
657  maChangeCallback.Call(this);
658  }
659  }
660  }
661  return true;
662 }
663 
665 {
666  if (!mbMouseCaptured)
667  return false;
668  ReleaseMouse();
669  mbMouseCaptured = false;
670 
671  if (mbMouseMoved)
672  {
673  // was change interactively
674  }
675  else
676  {
677  // simple click without much movement, try selection
678  TrySelection(rMEvt.GetPosPixel());
679  }
680 
681  return true;
682 }
683 
685 {
686  // set size of page
687  const Size aSize(GetDrawingArea()->get_ref_device().PixelToLogic(GetOutputSizePixel()));
688  mpFmPage->SetSize(aSize);
689 
690  // set position and size of scene
691  mpScene->SetSnapRect(tools::Rectangle(Point(0, 0), aSize));
692 }
693 
695 {
696  // call parent
698 
699  // apply object rotation
700  if(mp3DObj)
701  {
702  basegfx::B3DHomMatrix aObjectRotation;
703  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
704  mp3DObj->SetTransform(aObjectRotation);
705  }
706 }
707 
709 {
711 }
712 
713 void Svx3DLightControl::GetPosition(double& rHor, double& rVer)
714 {
715  if(IsSelectionValid())
716  {
718  aDirection.normalize();
719  rHor = basegfx::rad2deg(atan2(-aDirection.getX(), -aDirection.getZ()) + F_PI); // 0..360.0
720  rVer = basegfx::rad2deg(atan2(aDirection.getY(), aDirection.getXZLength())); // -90.0..90.0
721  }
722  if(IsGeometrySelected())
723  {
724  rHor = basegfx::rad2deg(mfRotateY); // 0..360.0
725  rVer = basegfx::rad2deg(mfRotateX); // -90.0..90.0
726  }
727 }
728 
729 void Svx3DLightControl::SetPosition(double fHor, double fVer)
730 {
731  if(IsSelectionValid())
732  {
733  // set selected light's direction
734  fHor = basegfx::deg2rad(fHor) - F_PI; // -PI..PI
735  fVer = basegfx::deg2rad(fVer); // -PI2..PI2
736  basegfx::B3DVector aDirection(cos(fVer) * -sin(fHor), sin(fVer), cos(fVer) * -cos(fHor));
737  aDirection.normalize();
738 
739  if(!aDirection.equal(GetLightDirection(maSelectedLight)))
740  {
741  // set changed light direction at SdrScene
742  SfxItemSet aSet(mpModel->GetItemPool());
743 
744  switch(maSelectedLight)
745  {
746  case 0: aSet.Put(makeSvx3DLightDirection1Item(aDirection)); break;
747  case 1: aSet.Put(makeSvx3DLightDirection2Item(aDirection)); break;
748  case 2: aSet.Put(makeSvx3DLightDirection3Item(aDirection)); break;
749  case 3: aSet.Put(makeSvx3DLightDirection4Item(aDirection)); break;
750  case 4: aSet.Put(makeSvx3DLightDirection5Item(aDirection)); break;
751  case 5: aSet.Put(makeSvx3DLightDirection6Item(aDirection)); break;
752  case 6: aSet.Put(makeSvx3DLightDirection7Item(aDirection)); break;
753  default:
754  case 7: aSet.Put(makeSvx3DLightDirection8Item(aDirection)); break;
755  }
756 
757  mpScene->SetMergedItemSet(aSet);
758 
759  // correct 3D light's and LampFrame's geometries
761  Invalidate();
762  }
763  }
764  if(IsGeometrySelected())
765  {
766  if(mfRotateX != fVer || mfRotateY != fHor)
767  {
768  mfRotateX = basegfx::deg2rad(fVer);
769  mfRotateY = basegfx::deg2rad(fHor);
770 
771  if(mp3DObj)
772  {
773  basegfx::B3DHomMatrix aObjectRotation;
774  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
775  mp3DObj->SetTransform(aObjectRotation);
776 
777  Invalidate();
778  }
779  }
780  }
781 }
782 
783 void Svx3DLightControl::SetRotation(double fRotX, double fRotY, double fRotZ)
784 {
785  if(IsGeometrySelected())
786  {
787  if(fRotX != mfRotateX || fRotY != mfRotateY || fRotZ != mfRotateZ)
788  {
789  mfRotateX = fRotX;
790  mfRotateY = fRotY;
791  mfRotateZ = fRotZ;
792 
793  if(mp3DObj)
794  {
795  basegfx::B3DHomMatrix aObjectRotation;
796  aObjectRotation.rotate(mfRotateX, mfRotateY, mfRotateZ);
797  mp3DObj->SetTransform(aObjectRotation);
798 
799  Invalidate();
800  }
801  }
802  }
803 }
804 
805 void Svx3DLightControl::GetRotation(double& rRotX, double& rRotY, double& rRotZ)
806 {
807  rRotX = mfRotateX;
808  rRotY = mfRotateY;
809  rRotZ = mfRotateZ;
810 }
811 
813 {
814  // call parent
816 
818  {
819  // selected light is no more active, select new one
821  }
822 
823  // local updates
826  Invalidate();
827 }
828 
829 void Svx3DLightControl::SelectLight(sal_uInt32 nLightNumber)
830 {
831  if(nLightNumber > 7)
832  {
833  nLightNumber = NO_LIGHT_SELECTED;
834  }
835 
836  if(NO_LIGHT_SELECTED != nLightNumber)
837  {
838  if(!GetLightOnOff(nLightNumber))
839  {
840  nLightNumber = NO_LIGHT_SELECTED;
841  }
842  }
843 
844  if(nLightNumber != maSelectedLight)
845  {
846  maSelectedLight = nLightNumber;
847  mbGeometrySelected = false;
850  Invalidate();
851  }
852 }
853 
854 bool Svx3DLightControl::GetLightOnOff(sal_uInt32 nNum) const
855 {
856  if(nNum <= 7)
857  {
858  const SfxItemSet aLightItemSet(Get3DAttributes());
859 
860  switch(nNum)
861  {
862  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue();
863  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue();
864  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue();
865  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue();
866  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue();
867  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue();
868  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue();
869  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue();
870  }
871  }
872 
873  return false;
874 }
875 
877 {
878  if(nNum <= 7)
879  {
880  const SfxItemSet aLightItemSet(Get3DAttributes());
881 
882  switch(nNum)
883  {
884  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
885  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2).GetValue();
886  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3).GetValue();
887  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4).GetValue();
888  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5).GetValue();
889  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6).GetValue();
890  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7).GetValue();
891  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8).GetValue();
892  }
893  }
894 
895  return COL_BLACK;
896 }
897 
899 {
900  if(nNum <= 7)
901  {
902  const SfxItemSet aLightItemSet(Get3DAttributes());
903 
904  switch(nNum)
905  {
906  case 0 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1).GetValue();
907  case 1 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2).GetValue();
908  case 2 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3).GetValue();
909  case 3 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4).GetValue();
910  case 4 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5).GetValue();
911  case 5 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6).GetValue();
912  case 6 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7).GetValue();
913  case 7 : return aLightItemSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8).GetValue();
914  }
915  }
916 
917  return basegfx::B3DVector();
918 }
919 
921  weld::Scale& rVert, weld::Button& rSwitcher)
922  : mrLightControl(rLightControl)
923  , mrHorScroller(rHori)
924  , mrVerScroller(rVert)
925  , mrSwitcher(rSwitcher)
926 {
927  // init members
928  Init();
929 }
930 
932 {
933  Size aSize(mrLightControl.GetDrawingArea()->get_ref_device().LogicToPixel(Size(80, 100), MapMode(MapUnit::MapAppFont)));
934  mrLightControl.set_size_request(aSize.Width(), aSize.Height());
935 
936  // #i58240# set HelpIDs for scrollbars and switcher
941 
942  // Light preview
944  mrLightControl.SetChangeCallback( LINK(this, SvxLightCtl3D, InternalInteractiveChange) );
945  mrLightControl.SetSelectionChangeCallback( LINK(this, SvxLightCtl3D, InternalSelectionChange) );
946 
947  // Horiz Scrollbar
949  mrHorScroller.set_range(0, 36000);
950  mrHorScroller.connect_value_changed( LINK(this, SvxLightCtl3D, ScrollBarMove) );
951 
952  // Vert Scrollbar
954  mrVerScroller.set_range(0, 18000);
955  mrVerScroller.connect_value_changed( LINK(this, SvxLightCtl3D, ScrollBarMove) );
956 
957  // Switch Button
958  mrSwitcher.show();
959  mrSwitcher.connect_clicked( LINK(this, SvxLightCtl3D, ButtonPress) );
960 
962  pArea->connect_key_press(Link<const KeyEvent&, bool>()); //acknowledge we first remove the old one
964 
965  pArea->connect_focus_in(Link<weld::Widget&, void>()); //acknowledge we first remove the old one
966  pArea->connect_focus_in(LINK(this, SvxLightCtl3D, FocusIn));
967 
968  // check selection
969  CheckSelection();
970 }
971 
973 {
974 }
975 
977 {
978  const bool bSelectionValid(mrLightControl.IsSelectionValid() || mrLightControl.IsGeometrySelected());
979  mrHorScroller.set_sensitive(bSelectionValid);
980  mrVerScroller.set_sensitive(bSelectionValid);
981 
982  if (bSelectionValid)
983  {
984  double fHor(0.0), fVer(0.0);
985  mrLightControl.GetPosition(fHor, fVer);
986  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
987  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
988  }
989 }
990 
991 void SvxLightCtl3D::move( double fDeltaHor, double fDeltaVer )
992 {
993  double fHor(0.0), fVer(0.0);
994 
995  mrLightControl.GetPosition(fHor, fVer);
996  fHor += fDeltaHor;
997  fVer += fDeltaVer;
998 
999  if( fVer > 90.0 )
1000  return;
1001 
1002  if ( fVer < -90.0 )
1003  return;
1004 
1005  mrLightControl.SetPosition(fHor, fVer);
1006  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
1007  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1008 
1010  {
1012  }
1013 }
1014 
1015 IMPL_LINK(SvxLightCtl3D, KeyInput, const KeyEvent&, rKEvt, bool)
1016 {
1017  const vcl::KeyCode aCode(rKEvt.GetKeyCode());
1018 
1019  if (aCode.GetModifier())
1020  return false;
1021 
1022  bool bHandled = true;
1023 
1024  switch ( aCode.GetCode() )
1025  {
1026  case KEY_SPACE:
1027  {
1028  break;
1029  }
1030  case KEY_LEFT:
1031  {
1032  move( -4.0, 0.0 ); // #i58242# changed move direction in X
1033  break;
1034  }
1035  case KEY_RIGHT:
1036  {
1037  move( 4.0, 0.0 ); // #i58242# changed move direction in X
1038  break;
1039  }
1040  case KEY_UP:
1041  {
1042  move( 0.0, 4.0 );
1043  break;
1044  }
1045  case KEY_DOWN:
1046  {
1047  move( 0.0, -4.0 );
1048  break;
1049  }
1050  case KEY_PAGEUP:
1051  {
1052  sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1053 
1054  while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1055  {
1056  nLight--;
1057  }
1058 
1059  if(nLight < 0)
1060  {
1061  nLight = 7;
1062 
1063  while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1064  {
1065  nLight--;
1066  }
1067  }
1068 
1069  if(nLight >= 0)
1070  {
1071  mrLightControl.SelectLight(nLight);
1072  CheckSelection();
1073 
1074  if(maUserSelectionChangeCallback.IsSet())
1075  {
1076  maUserSelectionChangeCallback.Call(this);
1077  }
1078  }
1079 
1080  break;
1081  }
1082  case KEY_PAGEDOWN:
1083  {
1084  sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1085 
1086  while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1087  {
1088  nLight++;
1089  }
1090 
1091  if(nLight > 7)
1092  {
1093  nLight = 0;
1094 
1095  while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1096  {
1097  nLight++;
1098  }
1099  }
1100 
1101  if(nLight <= 7)
1102  {
1103  mrLightControl.SelectLight(nLight);
1104  CheckSelection();
1105 
1106  if(maUserSelectionChangeCallback.IsSet())
1107  {
1108  maUserSelectionChangeCallback.Call(this);
1109  }
1110  }
1111 
1112  break;
1113  }
1114  default:
1115  {
1116  bHandled = false;
1117  break;
1118  }
1119  }
1120  return bHandled;
1121 }
1122 
1124 {
1125  if (mrLightControl.IsEnabled())
1126  {
1127  CheckSelection();
1128  }
1129 }
1130 
1132 {
1133  const sal_Int32 nHor(mrHorScroller.get_value());
1134  const sal_Int32 nVer(mrVerScroller.get_value());
1135 
1136  mrLightControl.SetPosition(
1137  static_cast<double>(nHor) / 100.0,
1138  static_cast<double>((18000 - nVer) - 9000) / 100.0);
1139 
1140  if (maUserInteractiveChangeCallback.IsSet())
1141  {
1142  maUserInteractiveChangeCallback.Call(this);
1143  }
1144 }
1145 
1147 {
1148  if(SvxPreviewObjectType::SPHERE == GetSvx3DLightControl().GetObjectType())
1149  {
1150  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::CUBE);
1151  }
1152  else
1153  {
1154  GetSvx3DLightControl().SetObjectType(SvxPreviewObjectType::SPHERE);
1155  }
1156 }
1157 
1158 IMPL_LINK_NOARG(SvxLightCtl3D, InternalInteractiveChange, Svx3DLightControl*, void)
1159 {
1160  double fHor(0.0), fVer(0.0);
1161 
1162  mrLightControl.GetPosition(fHor, fVer);
1163  mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
1164  mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1165 
1166  if(maUserInteractiveChangeCallback.IsSet())
1167  {
1168  maUserInteractiveChangeCallback.Call(this);
1169  }
1170 }
1171 
1172 IMPL_LINK_NOARG(SvxLightCtl3D, InternalSelectionChange, Svx3DLightControl*, void)
1173 {
1174  CheckSelection();
1175 
1176  if(maUserSelectionChangeCallback.IsSet())
1177  {
1178  maUserSelectionChangeCallback.Call(this);
1179  }
1180 }
1181 
1182 /* 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:43
virtual SdrObject * RemoveObject(size_t nObjNum) override
Definition: scene3d.cxx:802
virtual void Set3DAttributes(const SfxItemSet &rAttr) override
Definition: dlgctl3d.cxx:812
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:713
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_5(SDRATTR_3DSCENE_FIRST+25)
virtual void SetSize(const Size &aSiz)
Definition: svdpage.cxx:1351
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
Definition: fmpage.cxx:77
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
long AdjustWidth(long n)
virtual void set_value(int value)=0
virtual void Resize() override
Definition: dlgctl3d.cxx:684
void SetViewWindow(double fX, double fY, double fW, double fH)
Definition: camera3d.cxx:41
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:664
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_5(SDRATTR_3DSCENE_FIRST+8)
double mfSaveActionStartVer
Definition: dlgctl3d.hxx:88
long Height() const
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:28
virtual void Set3DAttributes(const SfxItemSet &rAttr)
Definition: dlgctl3d.cxx:232
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:898
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_7(SDRATTR_3DSCENE_FIRST+19)
const basegfx::B3DHomMatrix & GetTransform() const
Definition: obj3d.hxx:111
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:396
constexpr sal_uInt16 KEY_SPACE
constexpr::Color COL_YELLOW(0xFF, 0xFF, 0x00)
Link< Svx3DLightControl *, void > maSelectionChangeCallback
Definition: dlgctl3d.hxx:69
long AdjustHeight(long n)
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:991
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
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
#define HID_CTRL3D_VSCROLL
Definition: helpids.h:26
bool IsSelectionValid()
Definition: dlgctl3d.cxx:708
void SetCamera(const Camera3D &rNewCamera)
Definition: scene3d.cxx:313
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_7(SDRATTR_3DSCENE_FIRST+27)
virtual tools::Rectangle GetFocusRect() override
Definition: dlgctl3d.cxx:533
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:572
SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:247
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1909
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:829
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)
void connect_clicked(const Link< Button &, void > &rLink)
B2DPolygon createPolygonFromCircle(const B2DPoint &rCenter, double fRadius)
#define F_PI
#define HID_CTRL3D_SWITCHER
Definition: helpids.h:25
void GetRotation(double &rRotX, double &rRotY, double &rRotZ)
Definition: dlgctl3d.cxx:805
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)
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:268
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
static bool equalZero(const double &rfVal)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
void AdaptToSelectedLight()
Definition: dlgctl3d.cxx:410
static 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:796
SvxLightCtl3D(Svx3DLightControl &rLightControl, weld::Scale &rHori, weld::Scale &rVert, weld::Button &rButton)
Definition: dlgctl3d.cxx:920
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_8(SDRATTR_3DSCENE_FIRST+20)
void SetPosition(double fHor, double fVer)
Definition: dlgctl3d.cxx:729
void connect_value_changed(const Link< Scale &, void > &rLink)
constexpr double deg2rad(double v)
const basegfx::B3DRange & GetBoundVolume() const
Definition: obj3d.cxx:290
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:1123
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:312
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)
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
Definition: scene3d.cxx:813
Color GetLightColor(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:876
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
FmFormPage * mpFmPage
Definition: dlgctl3d.hxx:42
void translate(double fX, double fY, double fZ)
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
double getWidth() const
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
Definition: obj3d.cxx:344
void set_size_request(int nWidth, int nHeight)
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix) override
Definition: scene3d.cxx:609
double mfSaveActionStartHor
Definition: dlgctl3d.hxx:87
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
void CheckSelection(struct ESelection &rSel, SvxTextForwarder const *pForwarder)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: dlgctl3d.cxx:543
Derived class of SdrView to edit 3D objects.
Definition: view3d.hxx:41
weld::DrawingArea * GetDrawingArea() const
void TrySelection(Point aPosPixel)
Definition: dlgctl3d.cxx:462
weld::Button & mrSwitcher
Definition: dlgctl3d.hxx:145
virtual ~Svx3DPreviewControl() override
Definition: dlgctl3d.cxx:65
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:772
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 ...
SvxB3DVectorItem makeSvx3DLightDirection1Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:235
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1884
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:243
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_3(SDRATTR_3DSCENE_FIRST+23)
IMPL_LINK(SvxLightCtl3D, KeyInput, const KeyEvent &, rKEvt, bool)
Definition: dlgctl3d.cxx:1015
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: dlgctl3d.cxx:55
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_8(SDRATTR_3DSCENE_FIRST+11)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: dlgctl3d.cxx:528
const Point & GetPosPixel() const
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_6(SDRATTR_3DSCENE_FIRST+9)
void SetRotation(double fRotX, double fRotY, double fRotZ)
Definition: dlgctl3d.cxx:783
bool GetLightOnOff(sal_uInt32 nNum) const
Definition: dlgctl3d.cxx:854
virtual void SetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1622
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:976
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:694
void ConstructLightObjects()
Definition: dlgctl3d.cxx:366
bool IsMod1() const
void EnableRTL(bool bEnable)
SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector &rVec)
Definition: svx3ditems.hxx:259