diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-06 10:37:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-08 16:17:45 +0200 |
commit | d00a8b05c057d9260c5a44408d9a815121ee6cba (patch) | |
tree | 0ad731b379068244d6477c3c4b1f0af97262712a /include/svx | |
parent | 1d137f07cb7cff1f7bcf12b51ceca6f56059b7ef (diff) |
weld View3DDialog
Change-Id: Ifd689c54574c08f026f6760efb39b5f927cb2625
Reviewed-on: https://gerrit.libreoffice.org/73604
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/colorbox.hxx | 1 | ||||
-rw-r--r-- | include/svx/dlgctl3d.hxx | 147 |
2 files changed, 148 insertions, 0 deletions
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx index a9b38b7612ba..ed4241fc3ad7 100644 --- a/include/svx/colorbox.hxx +++ b/include/svx/colorbox.hxx @@ -123,6 +123,7 @@ public: Color const & GetSelectEntryColor() const { return m_aSelectedColor.first; } NamedColor const & GetSelectedEntry() const { return m_aSelectedColor; } + void SelectEntry(const NamedColor& rColor); void SelectEntry(const Color& rColor); void SetNoSelection() { getColorWindow()->SetNoSelection(); } diff --git a/include/svx/dlgctl3d.hxx b/include/svx/dlgctl3d.hxx index 82f544031a55..bc105f18ed89 100644 --- a/include/svx/dlgctl3d.hxx +++ b/include/svx/dlgctl3d.hxx @@ -23,6 +23,8 @@ #include <vcl/ctrl.hxx> #include <vcl/scrbar.hxx> #include <vcl/button.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> #include <svl/itemset.hxx> #include <svx/svxdllapi.h> #include <basegfx/vector/b3dvector.hxx> @@ -64,6 +66,34 @@ public: virtual void Set3DAttributes(const SfxItemSet& rAttr); }; +class SAL_WARN_UNUSED SVX_DLLPUBLIC PreviewControl3D : public weld::CustomWidgetController +{ +protected: + std::unique_ptr<FmFormModel> mpModel; + FmFormPage* mpFmPage; + std::unique_ptr<E3dView> mp3DView; + E3dScene* mpScene; + E3dObject* mp3DObj; + SvxPreviewObjectType mnObjectType; + + void Construct(); + +public: + PreviewControl3D(); + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual ~PreviewControl3D() override; + + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void Resize() override; + + virtual void SetObjectType(SvxPreviewObjectType nType); + SvxPreviewObjectType GetObjectType() const { return mnObjectType; } + SfxItemSet const & Get3DAttributes() const; + virtual void Set3DAttributes(const SfxItemSet& rAttr); +}; + + class SAL_WARN_UNUSED SVX_DLLPUBLIC Svx3DLightControl : public Svx3DPreviewControl { // Callback for interactive changes @@ -134,6 +164,80 @@ public: basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const; }; +class SAL_WARN_UNUSED SVX_DLLPUBLIC LightControl3D : public PreviewControl3D +{ + // Callback for interactive changes + Link<LightControl3D*,void> maChangeCallback; + Link<LightControl3D*,void> maSelectionChangeCallback; + + // lights + sal_uInt32 maSelectedLight; + + // extra objects for light control + E3dObject* mpExpansionObject; + E3dObject* mpLampBottomObject; + E3dObject* mpLampShaftObject; + std::vector< E3dObject* > maLightObjects; + + // 3d rotations of object + double mfRotateX; + double mfRotateY; + double mfRotateZ; + + // interaction parameters + Point maActionStartPoint; + double mfSaveActionStartHor; + double mfSaveActionStartVer; + double mfSaveActionStartRotZ; + + bool mbMouseMoved : 1; + bool mbMouseCaptured : 1; + bool mbGeometrySelected : 1; + + void Construct2(); + void ConstructLightObjects(); + void AdaptToSelectedLight(); + void TrySelection(Point aPosPixel); + +public: + LightControl3D(); + + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual tools::Rectangle GetFocusRect() override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; + virtual bool MouseMove( const MouseEvent& rMEvt ) override; + virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual void Resize() override; + + virtual void SetObjectType(SvxPreviewObjectType nType) override; + + // register user callback + void SetChangeCallback(Link<LightControl3D*,void> aNew) { maChangeCallback = aNew; } + void SetSelectionChangeCallback(Link<LightControl3D*,void> aNew) { maSelectionChangeCallback = aNew; } + + // selection checks + bool IsSelectionValid(); + bool IsGeometrySelected() { return mbGeometrySelected; } + + // get/set position of selected lamp in polar coordinates, Hor:[0..360.0[ and Ver:[-90..90] degrees + void GetPosition(double& rHor, double& rVer); + void SetPosition(double fHor, double fVer); + + // get/set rotation of 3D object + void SetRotation(double fRotX, double fRotY, double fRotZ); + void GetRotation(double& rRotX, double& rRotY, double& rRotZ); + + void SelectLight(sal_uInt32 nLightNumber); + virtual void Set3DAttributes(const SfxItemSet& rAttr) override; + sal_uInt32 GetSelectedLight() { return maSelectedLight; } + + // light data access + bool GetLightOnOff(sal_uInt32 nNum) const; + Color GetLightColor(sal_uInt32 nNum) const; + basegfx::B3DVector GetLightDirection(sal_uInt32 nNum) const; +}; + class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxLightCtl3D final : public Control { // local controls @@ -184,6 +288,49 @@ private: void move( double fDeltaHor, double fDeltaVer ); }; +class SAL_WARN_UNUSED SVX_DLLPUBLIC LightCtl3D +{ + // local controls + LightControl3D& mrLightControl; + weld::Scale& mrHorScroller; + weld::Scale& mrVerScroller; + weld::Button& mrSwitcher; + + // callback for interactive changes + Link<LightCtl3D*,void> maUserInteractiveChangeCallback; + Link<LightCtl3D*,void> maUserSelectionChangeCallback; + +public: + LightCtl3D(LightControl3D& rLightControl, weld::Scale& rHori, + weld::Scale& rVert, weld::Button& rButton); + ~LightCtl3D(); + + // check the selection for validity + void CheckSelection(); + + // bring further settings to the outside world + LightControl3D& GetSvx3DLightControl() { return mrLightControl; } + + // register user callback + void SetUserInteractiveChangeCallback(Link<LightCtl3D*,void> aNew) { maUserInteractiveChangeCallback = aNew; } + void SetUserSelectionChangeCallback(Link<LightCtl3D*,void> aNew) { maUserSelectionChangeCallback = aNew; } + +private: + + DECL_LINK(InternalInteractiveChange, LightControl3D*, void); + DECL_LINK(InternalSelectionChange, LightControl3D*, void); + DECL_LINK(ScrollBarMove, weld::Scale&, void); + DECL_LINK(ButtonPress, weld::Button&, void); + DECL_LINK(KeyInput, const KeyEvent&, bool); + DECL_LINK(FocusIn, weld::Widget&, void); + + // initialize local parameters + void Init(); + + void move( double fDeltaHor, double fDeltaVer ); +}; + + #endif // _SCH_DLGCTL3D_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |