summaryrefslogtreecommitdiff
path: root/include/svx/graphctl.hxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-16 15:17:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-17 12:43:13 +0200
commit8a35ae3e6c5c45aa1426cfd81472b309d02a1b48 (patch)
treeb634b7d9ef93599b5139528a2fcd4a99c3372a0d /include/svx/graphctl.hxx
parent4c2034b808fed4f9dfd715d8a4813e788a7e97a4 (diff)
weld SvxIMapDlg
Change-Id: I5418176a015e61ef8eee4c2acd8e84b008f76f82 Reviewed-on: https://gerrit.libreoffice.org/72249 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/svx/graphctl.hxx')
-rw-r--r--include/svx/graphctl.hxx128
1 files changed, 117 insertions, 11 deletions
diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx
index 7a2a7fd16da0..b4044d2b072b 100644
--- a/include/svx/graphctl.hxx
+++ b/include/svx/graphctl.hxx
@@ -42,6 +42,21 @@ public:
virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override;
};
+class SvxGraphCtrl;
+
+class SvxGraphCtrlUserCall : public SdrObjUserCall
+{
+ SvxGraphCtrl& rWin;
+
+public:
+
+ SvxGraphCtrlUserCall(SvxGraphCtrl& rGraphWin)
+ : rWin(rGraphWin)
+ {}
+
+ virtual void Changed(const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& rOldBoundRect) override;
+};
+
class SvxGraphCtrlAccessibleContext;
class SVX_DLLPUBLIC GraphCtrl : public Control
@@ -120,23 +135,91 @@ public:
void QueueIdleUpdate();
void SetSdrMode(bool b);
-
- virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
};
class SVX_DLLPUBLIC SvxGraphCtrl : public weld::CustomWidgetController
{
- MapMode const aMap100;
+ friend class SvxGraphCtrlView;
+ friend class SvxGraphCtrlUserCall;
+
Graphic aGraphic;
+ ScopedVclPtrInstance<VirtualDevice> xVD;
+ Idle aUpdateIdle;
+ Link<SvxGraphCtrl*,void> aMousePosLink;
+ Link<SvxGraphCtrl*,void> aGraphSizeLink;
+ Link<SvxGraphCtrl*,void> aUpdateLink;
+ MapMode const aMap100;
Size aGraphSize;
+ Point aMousePos;
+ std::unique_ptr<SvxGraphCtrlUserCall> pUserCall;
+ SdrObjKind eObjKind;
+ sal_uInt16 nPolyEdit;
+ bool bEditMode;
+ bool mbSdrMode;
+ bool mbInIdleUpdate;
+ weld::Dialog* mpDialog;
+
+ DECL_LINK( UpdateHdl, Timer*, void );
- virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
+ rtl::Reference<SvxGraphCtrlAccessibleContext> mpAccContext;
+
+protected:
+
+ std::unique_ptr<SdrModel> pModel;
+ std::unique_ptr<SdrView> pView;
+
+ virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
+ virtual void Resize() override;
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
+ virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
+ virtual bool MouseMove(const MouseEvent& rMEvt) override;
+
+ virtual void InitSdrModel();
+
+ virtual void SdrObjCreated( const SdrObject& rObj );
+ virtual void SdrObjChanged( const SdrObject& rObj );
+ virtual void MarkListHasChanged();
+
+ void GraphicToVD();
+
+ SdrObjUserCall* GetSdrUserCall() { return pUserCall.get(); }
public:
- SvxGraphCtrl();
+ SvxGraphCtrl(weld::Dialog* pDialog);
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual ~SvxGraphCtrl() override;
- void SetGraphic( const Graphic& rGraphic );
+
+ void SetGraphic( const Graphic& rGraphic, bool bNewModel = true );
+ const Graphic& GetGraphic() const { return aGraphic; }
+ const Size& GetGraphicSize() const { return aGraphSize; }
+
+ const Point& GetMousePos() const { return aMousePos; }
+
+ void SetEditMode( const bool bEditMode );
+
+ void SetPolyEditMode( const sal_uInt16 nPolyEdit );
+ sal_uInt16 GetPolyEditMode() const { return nPolyEdit; }
+
+ void SetObjKind( const SdrObjKind eObjKind );
+
+ SdrModel* GetSdrModel() const { return pModel.get(); }
+ SdrView* GetSdrView() const { return pView.get(); }
+ SdrObject* GetSelectedSdrObject() const;
+ bool IsChanged() const { return mbSdrMode && pModel->IsChanged(); }
+
+ void SetMousePosLink( const Link<SvxGraphCtrl*,void>& rLink ) { aMousePosLink = rLink; }
+
+ void SetGraphSizeLink( const Link<SvxGraphCtrl*,void>& rLink ) { aGraphSizeLink = rLink; }
+
+ void SetUpdateLink( const Link<SvxGraphCtrl*,void>& rLink ) { aUpdateLink = rLink; }
+ void QueueIdleUpdate();
+
+ void SetSdrMode(bool b);
+
+ Point GetPositionInDialog() const;
+ virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
};
class GraphCtrlView : public SdrView
@@ -152,15 +235,38 @@ protected:
}
public:
- GraphCtrlView(
- SdrModel& rSdrModel,
- GraphCtrl* pWindow)
- : SdrView(rSdrModel, pWindow)
- ,rGraphCtrl(*pWindow)
+ GraphCtrlView(SdrModel& rSdrModel, GraphCtrl* pWindow)
+ : SdrView(rSdrModel, pWindow)
+ , rGraphCtrl(*pWindow)
{
}
};
+class SvxGraphCtrlView : public SdrView
+{
+ SvxGraphCtrl& rGraphCtrl;
+
+protected:
+
+ virtual void MarkListHasChanged() override
+ {
+ SdrView::MarkListHasChanged();
+ rGraphCtrl.MarkListHasChanged();
+ }
+
+public:
+ SvxGraphCtrlView(SdrModel& rSdrModel, SvxGraphCtrl* pWindow)
+ : SdrView(rSdrModel, &pWindow->GetDrawingArea()->get_ref_device())
+ , rGraphCtrl(*pWindow)
+ {
+ }
+
+ // override these so we can get the occasions SdrPaintView would call Window::Invalidate on its vcl::Window
+ // if it had one, and route to WidgetController::Invalidate instead
+ virtual rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const override;
+ virtual void InvalidateWindow(const tools::Rectangle& rArea, OutputDevice& rDevice) const override;
+};
+
#endif // INCLUDED_SVX_GRAPHCTL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */