23 #include <svx/strings.hrc>
59 CustomWidgetController::SetDrawingArea(pDrawingArea);
81 mpModel->GetItemPool().FreezeIdRanges();
89 mp3DView->SetBufferedOutputAllowed(
true);
90 mp3DView->SetBufferedOverlayAllowed(
true);
103 double fCamZ = rVolume.
getMaxZ() + ((fW + fH) / 2.0);
108 double fDefaultCamPosZ =
mp3DView->GetDefaultCamPosZ();
109 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
111 double fDefaultCamFocal =
mp3DView->GetDefaultCamFocal();
151 Point aObjPoint( (aSize.
Width() - aObjSize.Width()) / 2,
152 (aSize.
Height() - aObjSize.Height()) / 2);
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)
248 : maChangeCallback(),
249 maSelectionChangeCallback(),
251 mpExpansionObject(nullptr),
252 mpLampBottomObject(nullptr),
253 mpLampShaftObject(nullptr),
258 maActionStartPoint(),
259 mfSaveActionStartHor(0.0),
260 mfSaveActionStartVer(0.0),
261 mfSaveActionStartRotZ(0.0),
264 mbGeometrySelected(false)
280 mp3DView->SetApplicationBackgroundColor(aDialogColor);
281 mp3DView->SetApplicationDocumentColor(aDialogColor);
345 double fCamZ = rVolume.
getMaxZ() + ((fW + fH) / 2.0);
350 double fDefaultCamPosZ =
mp3DView->GetDefaultCamPosZ();
351 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
353 double fDefaultCamFocal =
mp3DView->GetDefaultCamFocal();
396 aTransform.
translate(aDirection.getX(), aDirection.getY(), aDirection.getZ());
437 double fRotateY(0.0);
441 fRotateY = atan2(-aDirection.getZ(), aDirection.getX());
444 aTransform.
rotate(0.0, fRotateY, 0.0);
469 std::vector< const E3dCompoundObject* > aResult;
479 for(
auto const & b: aResult)
512 aNewSelectedLight =
a;
545 bool bCallParent(
true);
605 while(fNewRotY < 0.0)
610 while(fNewRotY >=
F_2PI)
616 if(fNewRotX < -
F_PI2)
643 if(fNewPosVer < -90.0)
648 if(fNewPosVer > 90.0)
922 : mrLightControl(rLightControl)
923 , mrHorScroller(rHori)
924 , mrVerScroller(rVert)
925 , mrSwitcher(rSwitcher)
984 double fHor(0.0), fVer(0.0);
993 double fHor(0.0), fVer(0.0);
1019 if (aCode.GetModifier())
1022 bool bHandled =
true;
1024 switch ( aCode.GetCode() )
1052 sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1054 while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1063 while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1071 mrLightControl.SelectLight(nLight);
1074 if(maUserSelectionChangeCallback.IsSet())
1076 maUserSelectionChangeCallback.Call(
this);
1084 sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1086 while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1095 while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1103 mrLightControl.SelectLight(nLight);
1106 if(maUserSelectionChangeCallback.IsSet())
1108 maUserSelectionChangeCallback.Call(
this);
1125 if (mrLightControl.IsEnabled())
1133 const sal_Int32 nHor(mrHorScroller.get_value());
1134 const sal_Int32 nVer(mrVerScroller.get_value());
1136 mrLightControl.SetPosition(
1137 static_cast<double>(nHor) / 100.0,
1138 static_cast<double>((18000 - nVer) - 9000) / 100.0);
1140 if (maUserInteractiveChangeCallback.IsSet())
1142 maUserInteractiveChangeCallback.Call(
this);
1160 double fHor(0.0), fVer(0.0);
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) );
1166 if(maUserInteractiveChangeCallback.IsSet())
1168 maUserInteractiveChangeCallback.Call(
this);
1176 if(maUserSelectionChangeCallback.IsSet())
1178 maUserSelectionChangeCallback.Call(
this);
void SetAutoAdjustProjection(bool bAdjust)
#define LINK(Instance, Class, Member)
std::unique_ptr< E3dView > mp3DView
virtual SdrObject * RemoveObject(size_t nObjNum) override
virtual void Set3DAttributes(const SfxItemSet &rAttr) override
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_4(SDRATTR_3DSCENE_FIRST+16)
weld::Scale & mrVerScroller
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void GetPosition(double &rHor, double &rVer)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_5(SDRATTR_3DSCENE_FIRST+25)
virtual void SetSize(const Size &aSiz)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_2(SDRATTR_3DSCENE_FIRST+22)
Link< SvxLightCtl3D *, void > maUserInteractiveChangeCallback
virtual void set_value(int value)=0
virtual void Resize() override
void SetViewWindow(double fX, double fY, double fW, double fH)
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_5(SDRATTR_3DSCENE_FIRST+8)
double mfSaveActionStartVer
bool IsGeometrySelected() const
static const AllSettings & GetSettings()
#define RADIUS_LAMP_SMALL
weld::Scale & mrHorScroller
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
virtual void Set3DAttributes(const SfxItemSet &rAttr)
basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_7(SDRATTR_3DSCENE_FIRST+19)
const basegfx::B3DHomMatrix & GetTransform() const
static void Free(SdrObject *&_rpObject)
constexpr sal_uInt16 KEY_SPACE
Link< Svx3DLightControl *, void > maSelectionChangeCallback
constexpr double rad2deg(double v)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_2(SDRATTR_3DSCENE_FIRST+14)
constexpr sal_uInt16 KEY_UP
#define MAX_NUMBER_LIGHTS
virtual void set_range(int min, int max)=0
void move(double fDeltaHor, double fDeltaVer)
Link< Svx3DLightControl *, void > maChangeCallback
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_3(SDRATTR_3DSCENE_FIRST+6)
void SetSelectionChangeCallback(Link< Svx3DLightControl *, void > aNew)
OUString SvxResId(const char *pId)
#define HID_CTRL3D_VSCROLL
void SetCamera(const Camera3D &rNewCamera)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_7(SDRATTR_3DSCENE_FIRST+27)
virtual tools::Rectangle GetFocusRect() override
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_6(SDRATTR_3DSCENE_FIRST+26)
constexpr sal_uInt16 KEY_PAGEUP
virtual bool MouseMove(const MouseEvent &rMEvt) override
SvxB3DVectorItem makeSvx3DLightDirection4Item(const basegfx::B3DVector &rVec)
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_6(SDRATTR_3DSCENE_FIRST+18)
#define NO_LIGHT_SELECTED
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)
E3dObject * mpLampShaftObject
SphereObject with diameter r3DSize.
constexpr sal_uInt16 KEY_DOWN
SvxB3DVectorItem makeSvx3DLightDirection6Item(const basegfx::B3DVector &rVec)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_3(SDRATTR_3DSCENE_FIRST+15)
B2DPolygon createPolygonFromCircle(const B2DPoint &rCenter, double fRadius)
#define HID_CTRL3D_SWITCHER
void GetRotation(double &rRotX, double &rRotY, double &rRotZ)
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
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
std::vector< E3dObject * > maLightObjects
double getXZLength() const
E3dObject * mpLampBottomObject
void SetFocalLength(double fLen)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
tools::Long Width() const
void AdaptToSelectedLight()
const sal_Int32 g_nInteractionStartDistance
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...
SvxLightCtl3D(Svx3DLightControl &rLightControl, weld::Scale &rHori, weld::Scale &rVert, weld::Button &rButton)
constexpr TypedWhichId< SfxBoolItem > SDRATTR_3DSCENE_LIGHTON_8(SDRATTR_3DSCENE_FIRST+20)
void SetPosition(double fHor, double fVer)
void connect_value_changed(const Link< Scale &, void > &rLink)
constexpr double deg2rad(double v)
const basegfx::B3DRange & GetBoundVolume() const
#define RADIUS_LAMP_PREVIEW_SIZE
IMPL_LINK_NOARG(SvxLightCtl3D, FocusIn, weld::Widget &, void)
virtual void Resize() override
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_8(SDRATTR_3DSCENE_FIRST+28)
sal_uInt32 maSelectedLight
SfxItemSet const & Get3DAttributes() const
SvxB3DVectorItem makeSvx3DLightDirection5Item(const basegfx::B3DVector &rVec)
virtual void SetRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
Color GetLightColor(sal_uInt32 nNum) const
Svx3DLightControl & mrLightControl
#define HID_CTRL3D_HSCROLL
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
constexpr sal_uInt16 KEY_RIGHT
void translate(double fX, double fY, double fZ)
Point PixelToLogic(const Point &rDevicePt) const
Point LogicToPixel(const Point &rLogicPt) const
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix) override
double mfSaveActionStartHor
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
void CheckSelection(struct ESelection &rSel, SvxTextForwarder const *pForwarder)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Derived class of SdrView to edit 3D objects.
void TrySelection(Point aPosPixel)
weld::Button & mrSwitcher
virtual ~Svx3DPreviewControl() override
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void SetObjectType(SvxPreviewObjectType nType)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
SvxB3DVectorItem makeSvx3DLightDirection2Item(const basegfx::B3DVector &rVec)
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)
const SfxItemSet & GetMergedItemSet() const
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
tools::Long AdjustWidth(tools::Long n)
SvxB3DVectorItem makeSvx3DLightDirection3Item(const basegfx::B3DVector &rVec)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_3(SDRATTR_3DSCENE_FIRST+23)
IMPL_LINK(SvxLightCtl3D, KeyInput, const KeyEvent &, rKEvt, bool)
tools::Long Height() const
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
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
const Point & GetPosPixel() const
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_6(SDRATTR_3DSCENE_FIRST+9)
void SetRotation(double fRotX, double fRotY, double fRotZ)
tools::Long AdjustHeight(tools::Long n)
bool GetLightOnOff(sal_uInt32 nNum) const
virtual void SetSnapRect(const tools::Rectangle &rRect)
E3dObject * mpExpansionObject
SvxPreviewObjectType GetObjectType() const
SvxB3DVectorItem makeSvx3DLightDirection8Item(const basegfx::B3DVector &rVec)
void rotate(double fAngleX, double fAngleY, double fAngleZ)
SvxPreviewObjectType mnObjectType
constexpr sal_uInt16 KEY_LEFT
double mfSaveActionStartRotZ
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_2(SDRATTR_3DSCENE_FIRST+5)
void transform(const B3DHomMatrix &rMatrix)
void SetChangeCallback(Link< Svx3DLightControl *, void > aNew)
const Camera3D & GetCamera() const
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_4(SDRATTR_3DSCENE_FIRST+7)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_4(SDRATTR_3DSCENE_FIRST+24)
virtual void SetObjectType(SvxPreviewObjectType nType) override
void ConstructLightObjects()
SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector &rVec)