22 #include <svx/strings.hrc>
57 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();
149 Point aObjPoint( (aSize.
Width() - aObjSize.Width()) / 2,
150 (aSize.
Height() - aObjSize.Height()) / 2);
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)
247 mpExpansionObject(nullptr),
248 mpLampBottomObject(nullptr),
249 mpLampShaftObject(nullptr),
254 mfSaveActionStartHor(0.0),
255 mfSaveActionStartVer(0.0),
256 mfSaveActionStartRotZ(0.0),
259 mbGeometrySelected(
false)
275 mp3DView->SetApplicationBackgroundColor(aDialogColor);
276 mp3DView->SetApplicationDocumentColor(aDialogColor);
301 aTransform.
rotate(M_PI_2, 0.0, 0.0);
340 double fCamZ = rVolume.
getMaxZ() + ((fW + fH) / 2.0);
345 double fDefaultCamPosZ =
mp3DView->GetDefaultCamPosZ();
346 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
348 double fDefaultCamFocal =
mp3DView->GetDefaultCamFocal();
432 double fRotateY(0.0);
436 fRotateY = atan2(-aDirection.
getZ(), aDirection.
getX());
439 aTransform.
rotate(0.0, fRotateY, 0.0);
464 std::vector< const E3dCompoundObject* > aResult;
474 for(
auto const & b: aResult)
507 aNewSelectedLight =
a;
540 bool bCallParent(
true);
600 while(fNewRotY < 0.0)
602 fNewRotY += 2 * M_PI;
605 while(fNewRotY >= 2 * M_PI)
607 fNewRotY -= 2 * M_PI;
611 if(fNewRotX < -M_PI_2)
616 if(fNewRotX > M_PI_2)
638 if(fNewPosVer < -90.0)
643 if(fNewPosVer > 90.0)
917 : mrLightControl(rLightControl)
918 , mrHorScroller(rHori)
919 , mrVerScroller(rVert)
920 , mrSwitcher(rSwitcher)
975 double fHor(0.0), fVer(0.0);
984 double fHor(0.0), fVer(0.0);
1010 if (aCode.GetModifier())
1013 bool bHandled =
true;
1015 switch ( aCode.GetCode() )
1043 sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1045 while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1054 while((nLight >= 0) && !mrLightControl.GetLightOnOff(nLight))
1062 mrLightControl.SelectLight(nLight);
1065 if(maUserSelectionChangeCallback.IsSet())
1067 maUserSelectionChangeCallback.Call(
this);
1075 sal_Int32 nLight(mrLightControl.GetSelectedLight() - 1);
1077 while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1086 while(nLight <= 7 && !mrLightControl.GetLightOnOff(nLight))
1094 mrLightControl.SelectLight(nLight);
1097 if(maUserSelectionChangeCallback.IsSet())
1099 maUserSelectionChangeCallback.Call(
this);
1116 if (mrLightControl.IsEnabled())
1124 const sal_Int32 nHor(mrHorScroller.get_value());
1125 const sal_Int32 nVer(mrVerScroller.get_value());
1127 mrLightControl.SetPosition(
1128 static_cast<double>(nHor) / 100.0,
1129 static_cast<double>((18000 - nVer) - 9000) / 100.0);
1131 if (maUserInteractiveChangeCallback.IsSet())
1133 maUserInteractiveChangeCallback.Call(
this);
1151 double fHor(0.0), fVer(0.0);
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) );
1157 if(maUserInteractiveChangeCallback.IsSet())
1159 maUserInteractiveChangeCallback.Call(
this);
1167 if(maUserSelectionChangeCallback.IsSet())
1169 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)
rtl::Reference< FmFormPage > mxFmPage
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)
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true) override
double mfSaveActionStartVer
constexpr double deg2rad(double v)
bool IsGeometrySelected() const
static const AllSettings & GetSettings()
#define RADIUS_LAMP_SMALL
weld::Scale & mrHorScroller
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr double rad2deg(double v)
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 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)
constexpr tools::Long Width() const
Link< Svx3DLightControl *, void > maChangeCallback
constexpr TypedWhichId< SvxColorItem > SDRATTR_3DSCENE_LIGHTCOLOR_3(SDRATTR_3DSCENE_FIRST+6)
void SetSelectionChangeCallback(Link< Svx3DLightControl *, void > aNew)
void SetCamera(const Camera3D &rNewCamera)
constexpr TypedWhichId< SvxB3DVectorItem > SDRATTR_3DSCENE_LIGHTDIRECTION_7(SDRATTR_3DSCENE_FIRST+27)
virtual tools::Rectangle GetFocusRect() override
OUString SvxResId(TranslateId aId)
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)
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
constexpr OStringLiteral HID_CTRL3D_VSCROLL
constexpr OStringLiteral HID_CTRL3D_SWITCHER
double getXZLength() const
E3dObject * mpLampBottomObject
void SetFocalLength(double fLen)
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
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)
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)
Color GetLightColor(sal_uInt32 nNum) const
Svx3DLightControl & mrLightControl
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
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
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix)
virtual void SetTransform(const basegfx::B3DHomMatrix &rMatrix) override
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
double mfSaveActionStartHor
B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon &rCandidate, double fZCoordinate)
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
constexpr tools::Long Height() const
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)
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)
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
constexpr OStringLiteral HID_CTRL3D_HSCROLL
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()
bool m_bDetectedRangeSegmentation false
SvxB3DVectorItem makeSvx3DLightDirection7Item(const basegfx::B3DVector &rVec)