22#include <svx/strings.hrc>
55 CustomWidgetController::SetDrawingArea(pDrawingArea);
80 mpModel->GetItemPool().FreezeIdRanges();
88 mp3DView->SetBufferedOutputAllowed(
true);
89 mp3DView->SetBufferedOverlayAllowed(
true);
102 double fCamZ = rVolume.
getMaxZ() + ((fW + fH) / 2.0);
107 double fDefaultCamPosZ =
mp3DView->GetDefaultCamPosZ();
108 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
110 double fDefaultCamFocal =
mp3DView->GetDefaultCamFocal();
122 mpScene->SetBoundAndSnapRectsDirty();
130 mpScene->SetMergedItemSet(aSet);
217 mp3DObj->SetMergedItemSet(aSet);
225 return mp3DObj->GetMergedItemSet();
230 mp3DObj->SetMergedItemSet(rAttr,
true);
235#define RADIUS_LAMP_PREVIEW_SIZE (4500.0)
236#define RADIUS_LAMP_SMALL (600.0)
237#define RADIUS_LAMP_BIG (1000.0)
238#define NO_LIGHT_SELECTED (0xffffffff)
239#define MAX_NUMBER_LIGHTS (8)
249 mfSaveActionStartHor(0.0),
250 mfSaveActionStartVer(0.0),
251 mfSaveActionStartRotZ(0.0),
254 mbGeometrySelected(false)
270 mp3DView->SetApplicationBackgroundColor(aDialogColor);
271 mp3DView->SetApplicationDocumentColor(aDialogColor);
296 aTransform.
rotate(M_PI_2, 0.0, 0.0);
335 double fCamZ = rVolume.
getMaxZ() + ((fW + fH) / 2.0);
340 double fDefaultCamPosZ =
mp3DView->GetDefaultCamPosZ();
341 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
343 double fDefaultCamFocal =
mp3DView->GetDefaultCamFocal();
349 mpScene->SetTransform(aNeutral);
353 mpScene->SetBoundAndSnapRectsDirty();
380 mpScene->InsertObject(pNewLight.get());
384 pNewLight->SetTransform(aTransform);
390 pNewLight->SetMergedItemSet(aSet);
424 double fRotateY(0.0);
431 aTransform.
rotate(0.0, fRotateY, 0.0);
456 std::vector< const E3dCompoundObject* > aResult;
466 for(
auto const & b: aResult)
499 aNewSelectedLight =
a;
532 bool bCallParent(
true);
592 while(fNewRotY < 0.0)
594 fNewRotY += 2 * M_PI;
597 while(fNewRotY >= 2 * M_PI)
599 fNewRotY -= 2 * M_PI;
603 if(fNewRotX < -M_PI_2)
608 if(fNewRotX > M_PI_2)
630 if(fNewPosVer < -90.0)
635 if(fNewPosVer > 90.0)
691 mp3DObj->SetTransform(aObjectRotation);
744 mpScene->SetMergedItemSet(aSet);
764 mp3DObj->SetTransform(aObjectRotation);
786 mp3DObj->SetTransform(aObjectRotation);
909 : mrLightControl(rLightControl)
910 , mrHorScroller(rHori)
911 , mrVerScroller(rVert)
912 , mrSwitcher(rSwitcher)
967 double fHor(0.0), fVer(0.0);
976 double fHor(0.0), fVer(0.0);
1005 bool bHandled =
true;
1035 sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1037 while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1046 while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1054 mrLightControl.SelectLight(nLight);
1057 if(maUserSelectionChangeCallback.IsSet())
1059 maUserSelectionChangeCallback.Call(
this);
1067 sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1069 while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1078 while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1086 mrLightControl.SelectLight(nLight);
1089 if(maUserSelectionChangeCallback.IsSet())
1091 maUserSelectionChangeCallback.Call(
this);
1108 if (mrLightControl.IsEnabled())
1116 const sal_Int32 nHor(mrHorScroller.get_value());
1117 const sal_Int32 nVer(mrVerScroller.get_value());
1119 mrLightControl.SetPosition(
1120 static_cast<double>(nHor) / 100.0,
1121 static_cast<double>((18000 - nVer) - 9000) / 100.0);
1123 if (maUserInteractiveChangeCallback.IsSet())
1125 maUserInteractiveChangeCallback.Call(
this);
1143 double fHor(0.0), fVer(0.0);
1145 mrLightControl.GetPosition(fHor, fVer);
1146 mrHorScroller.set_value( sal_Int32(fHor * 100.0) );
1147 mrVerScroller.set_value( 18000 - sal_Int32((fVer + 90.0) * 100.0) );
1149 if(maUserInteractiveChangeCallback.IsSet())
1151 maUserInteractiveChangeCallback.Call(
this);
1159 if(maUserSelectionChangeCallback.IsSet())
1161 maUserSelectionChangeCallback.Call(
this);
static const AllSettings & GetSettings()
void SetAutoAdjustProjection(bool bAdjust)
void SetFocalLength(double fLen)
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
void SetViewWindow(double fX, double fY, double fW, double fH)
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
SphereObject with diameter r3DSize.
Derived class of SdrView to edit 3D objects.
const Point & GetPosPixel() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
sal_uInt32 maSelectedLight
virtual bool MouseMove(const MouseEvent &rMEvt) override
virtual void SetObjectType(SvxPreviewObjectType nType) override
void ConstructLightObjects()
Link< Svx3DLightControl *, void > maChangeCallback
rtl::Reference< E3dObject > mpExpansionObject
void SetChangeCallback(Link< Svx3DLightControl *, void > aNew)
double mfSaveActionStartVer
std::vector< E3dObject * > maLightObjects
void SetPosition(double fHor, double fVer)
void SetSelectionChangeCallback(Link< Svx3DLightControl *, void > aNew)
void AdaptToSelectedLight()
virtual void Resize() override
void GetRotation(double &rRotX, double &rRotY, double &rRotZ)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
double mfSaveActionStartHor
virtual tools::Rectangle GetFocusRect() override
double mfSaveActionStartRotZ
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual void Set3DAttributes(const SfxItemSet &rAttr) override
bool IsGeometrySelected() const
void TrySelection(Point aPosPixel)
rtl::Reference< E3dObject > mpLampBottomObject
bool GetLightOnOff(sal_uInt32 nNum) const
void GetPosition(double &rHor, double &rVer)
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
rtl::Reference< E3dObject > mpLampShaftObject
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Link< Svx3DLightControl *, void > maSelectionChangeCallback
Color GetLightColor(sal_uInt32 nNum) const
void SelectLight(sal_uInt32 nLightNumber)
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const
void SetRotation(double fRotX, double fRotY, double fRotZ)
virtual void Resize() override
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
virtual ~Svx3DPreviewControl() override
SvxPreviewObjectType GetObjectType() const
std::unique_ptr< FmFormModel > mpModel
virtual void SetObjectType(SvxPreviewObjectType nType)
std::unique_ptr< E3dView > mp3DView
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
rtl::Reference< E3dObject > mp3DObj
rtl::Reference< E3dScene > mpScene
rtl::Reference< FmFormPage > mxFmPage
virtual void Set3DAttributes(const SfxItemSet &rAttr)
SfxItemSet const & Get3DAttributes() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
SvxPreviewObjectType mnObjectType
weld::Scale & mrHorScroller
Svx3DLightControl & mrLightControl
Link< SvxLightCtl3D *, void > maUserInteractiveChangeCallback
weld::Button & mrSwitcher
SvxLightCtl3D(Svx3DLightControl &rLightControl, weld::Scale &rHori, weld::Scale &rVert, weld::Button &rButton)
void move(double fDeltaHor, double fDeltaVer)
weld::Scale & mrVerScroller
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void rotate(double fAngleX, double fAngleY, double fAngleZ)
void translate(double fX, double fY, double fZ)
void transform(const B3DHomMatrix &rMatrix)
sal_uInt16 GetCode() const
sal_uInt16 GetModifier() const
virtual OutputDevice & get_ref_device()=0
virtual void set_range(int min, int max)=0
void connect_value_changed(const Link< Scale &, void > &rLink)
virtual void set_value(int value)=0
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_YELLOW(0xFF, 0xFF, 0x00)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
OUString SvxResId(TranslateId aId)
#define RADIUS_LAMP_SMALL
IMPL_LINK_NOARG(SvxLightCtl3D, FocusIn, weld::Widget &, void)
const sal_Int32 g_nInteractionStartDistance
#define NO_LIGHT_SELECTED
#define RADIUS_LAMP_PREVIEW_SIZE
IMPL_LINK(SvxLightCtl3D, KeyInput, const KeyEvent &, rKEvt, bool)
#define MAX_NUMBER_LIGHTS
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
constexpr OUStringLiteral HID_CTRL3D_HSCROLL
constexpr OUStringLiteral HID_CTRL3D_SWITCHER
constexpr OUStringLiteral HID_CTRL3D_VSCROLL
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_SPACE
constexpr sal_uInt16 KEY_PAGEUP
#define LINK(Instance, Class, Member)
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
B2DPolygon createPolygonFromCircle(const B2DPoint &rCenter, double fRadius)
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
constexpr double rad2deg(double v)
constexpr double deg2rad(double v)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_8(SDRATTR_3DSCENE_FIRST+20)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_4(SDRATTR_3DSCENE_FIRST+16)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_1(SDRATTR_3DSCENE_FIRST+21)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_3(SDRATTR_3DSCENE_FIRST+23)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_1(SDRATTR_3DSCENE_FIRST+13)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_2(SDRATTR_3DSCENE_FIRST+22)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_1(SDRATTR_3DSCENE_FIRST+4)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_3(SDRATTR_3DSCENE_FIRST+15)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_5(SDRATTR_3DSCENE_FIRST+8)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_5(SDRATTR_3DSCENE_FIRST+17)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_7(SDRATTR_3DSCENE_FIRST+27)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_6(SDRATTR_3DSCENE_FIRST+26)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_6(SDRATTR_3DSCENE_FIRST+9)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_4(SDRATTR_3DSCENE_FIRST+7)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_7(SDRATTR_3DSCENE_FIRST+10)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_6(SDRATTR_3DSCENE_FIRST+18)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_2(SDRATTR_3DSCENE_FIRST+14)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_8(SDRATTR_3DSCENE_FIRST+11)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_8(SDRATTR_3DSCENE_FIRST+28)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_4(SDRATTR_3DSCENE_FIRST+24)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_5(SDRATTR_3DSCENE_FIRST+25)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_2(SDRATTR_3DSCENE_FIRST+5)
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_3(SDRATTR_3DSCENE_FIRST+6)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_7(SDRATTR_3DSCENE_FIRST+19)
SvxB3DVectorItem makeSvx3DLightDirection6Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection3Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection5Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection8Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection1Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection2Item(const basegfx::B3DVector &rVec)
SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector &rVec)
css::drawing::Direction3D aDirection
void CheckSelection(struct ESelection &rSel, SvxTextForwarder const *pForwarder) noexcept
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)