diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-16 15:17:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-17 12:43:13 +0200 |
commit | 8a35ae3e6c5c45aa1426cfd81472b309d02a1b48 (patch) | |
tree | b634b7d9ef93599b5139528a2fcd4a99c3372a0d /include/svx | |
parent | avoid two lookups in ScDocument::GetLookupCache (diff) | |
download | core-8a35ae3e6c5c45aa1426cfd81472b309d02a1b48.tar.gz core-8a35ae3e6c5c45aa1426cfd81472b309d02a1b48.zip |
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')
-rw-r--r-- | include/svx/fmview.hxx | 2 | ||||
-rw-r--r-- | include/svx/graphctl.hxx | 128 | ||||
-rw-r--r-- | include/svx/imapdlg.hxx | 81 | ||||
-rw-r--r-- | include/svx/svdcrtv.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdedxv.hxx | 6 | ||||
-rw-r--r-- | include/svx/svdmrkv.hxx | 2 | ||||
-rw-r--r-- | include/svx/svdpntv.hxx | 10 | ||||
-rw-r--r-- | include/svx/svdview.hxx | 6 | ||||
-rw-r--r-- | include/svx/svxdlg.hxx | 6 |
9 files changed, 166 insertions, 77 deletions
diff --git a/include/svx/fmview.hxx b/include/svx/fmview.hxx index e23d3a6efbe2..2808ba031fa4 100644 --- a/include/svx/fmview.hxx +++ b/include/svx/fmview.hxx @@ -106,7 +106,7 @@ public: virtual SdrPageView* ShowSdrPage(SdrPage* pPage) override; virtual void HideSdrPage() override; - virtual bool MouseButtonDown( const MouseEvent& _rMEvt, vcl::Window* _pWin ) override; + virtual bool MouseButtonDown( const MouseEvent& _rMEvt, OutputDevice* _pWin ) override; /** grab the focus to the first form control on the view */ 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: */ diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx index 86b5a9ae03be..d2b1cf620bf4 100644 --- a/include/svx/imapdlg.hxx +++ b/include/svx/imapdlg.hxx @@ -24,11 +24,10 @@ #include <sfx2/childwin.hxx> #include <sfx2/ctrlitem.hxx> #include <sfx2/basedlgs.hxx> -#include <vcl/fixed.hxx> -#include <vcl/combobox.hxx> -#include <vcl/edit.hxx> +#include <vcl/customweld.hxx> #include <vcl/toolbox.hxx> #include <vcl/status.hxx> +#include <vcl/weld.hxx> #include <svx/svxdllapi.h> #include <memory> #include <vector> @@ -77,69 +76,53 @@ public: class IMapOwnData; class IMapWindow; -class GraphCtrl; +class SvxGraphCtrl; -class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow +class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialogController { friend class IMapOwnData; friend class IMapWindow; - VclPtr<ToolBox> m_pTbxIMapDlg1; - VclPtr<FixedText> m_pFtURL; - VclPtr<SvtURLBox> m_pURLBox; - VclPtr<FixedText> m_pFtText; - VclPtr<Edit> m_pEdtText; - VclPtr<FixedText> m_pFtTarget; - VclPtr<ComboBox> m_pCbbTarget; - VclPtr<StatusBar> m_pStbStatus; - - sal_uInt16 mnApplyId; - sal_uInt16 mnOpenId; - sal_uInt16 mnSaveAsId; - sal_uInt16 mnSelectId; - sal_uInt16 mnRectId; - sal_uInt16 mnCircleId; - sal_uInt16 mnPolyId; - sal_uInt16 mnFreePolyId; - sal_uInt16 mnPolyEditId; - sal_uInt16 mnPolyMoveId; - sal_uInt16 mnPolyInsertId; - sal_uInt16 mnPolyDeleteId; - sal_uInt16 mnUndoId; - sal_uInt16 mnRedoId; - sal_uInt16 mnActiveId; - sal_uInt16 mnMacroId; - sal_uInt16 mnPropertyId; - sal_uInt16 mnCloseId; - - VclPtr<IMapWindow> pIMapWnd; std::unique_ptr<IMapOwnData> pOwnData; void* pCheckObj; SvxIMapDlgItem aIMapItem; - virtual bool Close() override; - - DECL_LINK( TbxClickHdl, ToolBox*, void ); + std::unique_ptr<IMapWindow> m_xIMapWnd; + std::unique_ptr<weld::Toolbar> m_xTbxIMapDlg1; + std::unique_ptr<weld::Label> m_xFtURL; + std::unique_ptr<URLBox> m_xURLBox; + std::unique_ptr<weld::Label> m_xFtText; + std::unique_ptr<weld::Entry> m_xEdtText; + std::unique_ptr<weld::Label> m_xFtTarget; + std::unique_ptr<weld::ComboBox> m_xCbbTarget; + std::unique_ptr<weld::Button> m_xCancelBtn; + std::unique_ptr<weld::Label> m_xStbStatus1; + std::unique_ptr<weld::Label> m_xStbStatus2; + std::unique_ptr<weld::Label> m_xStbStatus3; + std::unique_ptr<weld::CustomWeld> m_xIMapWndWeld; + + DECL_LINK( TbxClickHdl, const OString&, void ); DECL_LINK( InfoHdl, IMapWindow&, void ); - DECL_LINK( MousePosHdl, GraphCtrl*, void ); - DECL_LINK( GraphSizeHdl, GraphCtrl*, void ); - DECL_LINK( URLModifyHdl, Edit&, void ); - DECL_LINK( URLModifyComboBoxHdl, ComboBox&, void ); - DECL_LINK( URLLoseFocusHdl, Control&, void ); + DECL_LINK( MousePosHdl, SvxGraphCtrl*, void ); + DECL_LINK( GraphSizeHdl, SvxGraphCtrl*, void ); + DECL_LINK( URLModifyHdl, weld::ComboBox&, void ); + DECL_LINK( EntryModifyHdl, weld::Entry&, void ); + DECL_LINK( URLModifyComboBoxHdl, weld::ComboBox&, void ); + DECL_LINK( URLLoseFocusHdl, weld::Widget&, void ); DECL_LINK( UpdateHdl, Timer *, void ); - DECL_LINK( StateHdl, GraphCtrl*, void ); - DECL_LINK( MiscHdl, LinkParamNone*, void ); + DECL_LINK( StateHdl, SvxGraphCtrl*, void ); + DECL_LINK( CancelHdl, weld::Button&, void ); + void URLModify(); void DoOpen(); bool DoSave(); - void SetActiveTool( sal_uInt16 nId ); + void SetActiveTool(const OString& rId); public: - SvxIMapDlg( SfxBindings *pBindings, SfxChildWindow *pCW, - vcl::Window* pParent ); - virtual ~SvxIMapDlg() override; - virtual void dispose() override; + SvxIMapDlg(SfxBindings *pBindings, SfxChildWindow *pCW, + weld::Window* pParent); + virtual ~SvxIMapDlg() override; void SetExecState( bool bEnable ); diff --git a/include/svx/svdcrtv.hxx b/include/svx/svdcrtv.hxx index d66ba7c35f4a..95c7cad02e33 100644 --- a/include/svx/svdcrtv.hxx +++ b/include/svx/svdcrtv.hxx @@ -84,7 +84,7 @@ public: virtual void BrkAction() override; virtual void TakeActionRect(tools::Rectangle& rRect) const override; - virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override; + virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; } diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx index 596e830f8bd3..aab4e216feb9 100644 --- a/include/svx/svdedxv.hxx +++ b/include/svx/svdedxv.hxx @@ -236,9 +236,9 @@ public: OutlinerView* GetTextEditOutlinerView() { return pTextEditOutlinerView; } virtual bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override; - virtual bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) override; - virtual bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) override; - virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override; + virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override; // #97766# make virtual to change implementation e.g. for SdOutlineView diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx index d974cd8779d5..05d7458f5b42 100644 --- a/include/svx/svdmrkv.hxx +++ b/include/svx/svdmrkv.hxx @@ -148,7 +148,7 @@ protected: void SetMarkRects(); // Rects at the PageViews void CheckMarked(); // Scan MarkList after Del and Lock Layer ... void AddDragModeHdl(SdrDragMode eMode); - virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override; + virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; virtual bool RequestHelp(const HelpEvent& rHEvt) override; // add custom handles (used by other apps, e.g. AnchorPos) diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx index bdfa2c705484..7fe1a838b8d3 100644 --- a/include/svx/svdpntv.hxx +++ b/include/svx/svdpntv.hxx @@ -221,7 +221,7 @@ public: bool IsPagePaintingAllowed() const { return mbPagePaintingAllowed;} void SetPagePaintingAllowed(bool bNew); - rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const; + virtual rtl::Reference<sdr::overlay::OverlayManager> CreateOverlayManager(OutputDevice& rDevice) const; protected: svtools::ColorConfig maColorConfig; @@ -238,7 +238,7 @@ public: SdrPaintWindow* GetPaintWindow(sal_uInt32 nIndex) const; // Replacement for GetWin(0), may return 0L (!) OutputDevice* GetFirstOutputDevice() const; - static void InvalidateWindow(const tools::Rectangle& rArea, OutputDevice& rDevice); + virtual void InvalidateWindow(const tools::Rectangle& rArea, OutputDevice& rDevice) const; private: SVX_DLLPRIVATE void ImpClearVars(); @@ -465,9 +465,9 @@ public: void SetSwapAsynchron(bool bJa=true) { mbSwapAsynchron=bJa; } virtual bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin); - virtual bool MouseButtonDown(const MouseEvent& /*rMEvt*/, vcl::Window* /*pWin*/) { return false; } - virtual bool MouseButtonUp(const MouseEvent& /*rMEvt*/, vcl::Window* /*pWin*/) { return false; } - virtual bool MouseMove(const MouseEvent& /*rMEvt*/, vcl::Window* /*pWin*/) { return false; } + virtual bool MouseButtonDown(const MouseEvent& /*rMEvt*/, OutputDevice* /*pWin*/) { return false; } + virtual bool MouseButtonUp(const MouseEvent& /*rMEvt*/, OutputDevice* /*pWin*/) { return false; } + virtual bool MouseMove(const MouseEvent& /*rMEvt*/, OutputDevice* /*pWin*/) { return false; } virtual bool RequestHelp(const HelpEvent& /*rHEvt*/) { return false; } virtual bool Command(const CommandEvent& /*rCEvt*/, vcl::Window* /*pWin*/) { return false; } diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index 176d6e6146b5..4b145931896c 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -183,9 +183,9 @@ public: bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; } bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override; - virtual bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) override; - virtual bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) override; - virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override; + virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override; + virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override; + virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; using SdrCreateView::RequestHelp; virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override; diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 9708710b02f2..266eb4ccffc6 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -351,7 +351,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet ) = 0; - virtual VclPtr<AbstractURLDlg> CreateURLDialog(weld::Window* pParent, + virtual VclPtr<AbstractURLDlg> CreateURLDialog(weld::Widget* pParent, const OUString& rURL, const OUString& rAltText, const OUString& rDescription, const OUString& rTarget, const OUString& rName, TargetList& rTargetList ) = 0; @@ -427,8 +427,8 @@ public: sal_uInt32 nResId )=0; virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, const css::uno::Reference<css::frame::XFrame>& rFrame) = 0; - virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent, const SfxItemSet& rAttr, - const css::uno::Reference< css::frame::XFrame >& _rxFrame) = 0; + virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Widget* pParent, const SfxItemSet& rAttr, + const css::uno::Reference< css::frame::XFrame >& rFrame) = 0; virtual VclPtr<AbstractSvxPostItDialog> CreateSvxPostItDialog(weld::Widget* pParent, const SfxItemSet& rCoreSet, bool bPrevNext = false) = 0; virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) override = 0; |