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 | |
parent | 4c2034b808fed4f9dfd715d8a4813e788a7e97a4 (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>
43 files changed, 2006 insertions, 992 deletions
diff --git a/cui/source/dialogs/cuiimapwnd.cxx b/cui/source/dialogs/cuiimapwnd.cxx index c4b41afcad54..1882406f7c77 100644 --- a/cui/source/dialogs/cuiimapwnd.cxx +++ b/cui/source/dialogs/cuiimapwnd.cxx @@ -43,7 +43,7 @@ |* \************************************************************************/ -URLDlg::URLDlg(weld::Window* pWindow, const OUString& rURL, const OUString& rAlternativeText, +URLDlg::URLDlg(weld::Widget* pWindow, const OUString& rURL, const OUString& rAlternativeText, const OUString& rDescription, const OUString& rTarget, const OUString& rName, TargetList& rTargetList) : GenericDialogController(pWindow, "cui/ui/cuiimapdlg.ui", "IMapDialog") diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 31e52bce2bf6..7cb8b4335921 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1103,7 +1103,7 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateGalleryThemeProperti pParent, pData, pItemSet)); } -VclPtr<AbstractURLDlg> AbstractDialogFactory_Impl::CreateURLDialog(weld::Window* pParent, +VclPtr<AbstractURLDlg> AbstractDialogFactory_Impl::CreateURLDialog(weld::Widget* pParent, const OUString& rURL, const OUString& rAltText, const OUString& rDescription, const OUString& rTarget, const OUString& rName, TargetList& rTargetList ) @@ -1292,7 +1292,7 @@ VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld:: return VclPtr<AbstractSvxCharacterMapDialog_Impl>::Create(std::make_unique<SvxCharacterMap>(pParent, &rAttr, rDocumentFrame)); } -VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog(weld::Window* pParent, +VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateEventConfigDialog(weld::Widget* pParent, const SfxItemSet& rAttr, const Reference< XFrame >& rDocumentFrame) { diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 97615f681348..f0e7fc98ec57 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -685,7 +685,7 @@ public: virtual VclPtr<SfxAbstractDialog> CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, const css::uno::Reference< css::frame::XFrame >& rFrame) override; - virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Window* pParent, + virtual VclPtr<SfxAbstractDialog> CreateEventConfigDialog(weld::Widget* pParent, const SfxItemSet& rAttr, const css::uno::Reference< css::frame::XFrame >& rFrame) override; virtual VclPtr<VclAbstractDialog> CreateFrameDialog(vcl::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame, @@ -751,7 +751,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet) override; - 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 ) override; diff --git a/cui/source/inc/cuiimapwnd.hxx b/cui/source/inc/cuiimapwnd.hxx index bc1eb8721035..b8fcf1053f2c 100644 --- a/cui/source/inc/cuiimapwnd.hxx +++ b/cui/source/inc/cuiimapwnd.hxx @@ -32,7 +32,7 @@ class URLDlg : public weld::GenericDialogController public: - URLDlg(weld::Window* pWindow, + URLDlg(weld::Widget* pWindow, const OUString& rURL, const OUString& rAlternativeText, const OUString& rDescription, const OUString& rTarget, const OUString& rName, TargetList& rTargetList); diff --git a/cui/source/inc/macroass.hxx b/cui/source/inc/macroass.hxx index 68221259ba23..0ad8c4816bd2 100644 --- a/cui/source/inc/macroass.hxx +++ b/cui/source/inc/macroass.hxx @@ -80,7 +80,7 @@ public: class SfxMacroAssignDlg : public SfxSingleTabDialogController { public: - SfxMacroAssignDlg(weld::Window* pParent, + SfxMacroAssignDlg(weld::Widget* pParent, const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet); SfxMacroTabPage* GetTabPage() diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index 1fc054c15dc7..364f9479a8ad 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -384,7 +384,7 @@ VclPtr<SfxTabPage> SfxMacroTabPage::Create(TabPageParent pParent, const SfxItemS return CreateSfxMacroTabPage(pParent, *rAttrSet); } -SfxMacroAssignDlg::SfxMacroAssignDlg(weld::Window* pParent, +SfxMacroAssignDlg::SfxMacroAssignDlg(weld::Widget* pParent, const Reference< XFrame >& rxDocumentFrame, const SfxItemSet& rSet) : SfxSingleTabDialogController(pParent, &rSet,"cui/ui/eventassigndialog.ui", "EventAssignDialog") diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index 76858c3b9b1a..0c19a983b2e0 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -104,6 +104,7 @@ class SVT_DLLPUBLIC URLBox bool bHistoryDisabled : 1; Link<weld::ComboBox&, void> aChangeHdl; + Link<weld::Widget&, void> aFocusOutHdl; std::unique_ptr<weld::ComboBox> m_xWidget; @@ -118,26 +119,29 @@ public: URLBox(std::unique_ptr<weld::ComboBox> pWidget); ~URLBox(); - void set_entry_text(const OUString& rStr) { m_xWidget->set_entry_text(rStr); } - void Clear() { m_xWidget->clear(); } - void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); } - void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; } - void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); } - OUString get_active_text() const { return m_xWidget->get_active_text(); } - void grab_focus() { m_xWidget->grab_focus(); } - void EnableAutocomplete() { m_xWidget->set_entry_completion(true); } - - void SetBaseURL( const OUString& rURL ); - void SetSmartProtocol( INetProtocol eProt ); - INetProtocol GetSmartProtocol() const { return eSmartProtocol; } - OUString GetURL(); - void DisableHistory(); - - weld::Widget* getWidget() { return m_xWidget.get(); } - - static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL ); - - void SetFilter(const OUString& _sFilter); + void set_entry_text(const OUString& rStr) { m_xWidget->set_entry_text(rStr); } + void Clear() { m_xWidget->clear(); } + void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); } + void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; } + void connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; } + void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); } + int find_text(const OUString& rStr) const { return m_xWidget->find_text(rStr); } + OUString get_active_text() const { return m_xWidget->get_active_text(); } + void grab_focus() { m_xWidget->grab_focus(); } + void set_sensitive(bool bSensitive) { m_xWidget->set_sensitive(bSensitive); } + void EnableAutocomplete() { m_xWidget->set_entry_completion(true); } + + void SetBaseURL( const OUString& rURL ); + void SetSmartProtocol( INetProtocol eProt ); + INetProtocol GetSmartProtocol() const { return eSmartProtocol; } + OUString GetURL(); + void DisableHistory(); + + weld::Widget* getWidget() { return m_xWidget.get(); } + + static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL ); + + void SetFilter(const OUString& _sFilter); }; #endif 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; diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx index a003d6b4bace..07b09b21bf04 100644 --- a/include/vcl/customweld.hxx +++ b/include/vcl/customweld.hxx @@ -68,6 +68,7 @@ public: void EnableRTL(bool bEnable) { m_pDrawingArea->set_direction(bEnable); } bool IsRTLEnabled() const { return m_pDrawingArea->get_direction(); } void ReleaseMouse() { m_pDrawingArea->grab_remove(); } + void SetPointer(PointerStyle ePointerStyle) { m_pDrawingArea->set_cursor(ePointerStyle); } void SetHelpId(const OString& rHelpId) { m_pDrawingArea->set_help_id(rHelpId); } void SetAccessibleName(const OUString& rName) { m_pDrawingArea->set_accessible_name(rName); } void set_size_request(int nWidth, int nHeight) diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index e6a28cef778b..6f01abf567c2 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -56,6 +56,7 @@ class XGraphic; typedef css::uno::Reference<css::accessibility::XAccessible> a11yref; typedef css::uno::Reference<css::accessibility::XAccessibleRelationSet> a11yrelationset; +enum class PointerStyle; class SvNumberFormatter; class KeyEvent; class MouseEvent; @@ -1615,7 +1616,7 @@ public: virtual void queue_draw_area(int x, int y, int width, int height) = 0; virtual void queue_resize() = 0; - virtual void set_text_cursor() = 0; + virtual void set_cursor(PointerStyle ePointerStyle) = 0; // use return here just to generate matching VirtualDevices virtual OutputDevice& get_ref_device() = 0; @@ -1663,6 +1664,25 @@ public: virtual ~Menu() {} }; +class VCL_DLLPUBLIC Toolbar : virtual public Widget +{ +protected: + Link<const OString&, void> m_aClickHdl; + + void signal_clicked(const OString& rIdent) { m_aClickHdl.Call(rIdent); } + +public: + virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) = 0; + virtual bool get_item_sensitive(const OString& rIdent) const = 0; + virtual void set_item_active(const OString& rIdent, bool bActive) = 0; + virtual bool get_item_active(const OString& rIdent) const = 0; + + virtual void insert_separator(int pos, const OUString& rId) = 0; + void append_separator(const OUString& rId) { insert_separator(-1, rId); } + + void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; } +}; + class VCL_DLLPUBLIC SizeGroup { public: @@ -1755,6 +1775,8 @@ public: const OString& treeviewid, bool bTakeOwnership = false) = 0; virtual std::unique_ptr<Menu> weld_menu(const OString& id, bool bTakeOwnership = true) = 0; + virtual std::unique_ptr<Toolbar> weld_toolbar(const OString& id, bool bTakeOwnership = true) + = 0; virtual std::unique_ptr<SizeGroup> create_size_group() = 0; virtual ~Builder() {} }; diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index dfd7f893b0a8..b515ab70d415 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -110,7 +110,7 @@ void ScEditWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) pEdView->SetBackgroundColor( aBgColor ); pEdEngine->InsertView( pEdView.get() ); - pDrawingArea->set_text_cursor(); + pDrawingArea->set_cursor(PointerStyle::Text); if (pAcc) { diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index 6381c22e663c..cd3918e3c07a 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -42,6 +42,7 @@ namespace sd SdPhotoAlbumDialog::SdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument* pActDoc) : GenericDialogController(pWindow, "modules/simpress/ui/photoalbum.ui", "PhotoAlbumCreatorDialog") , m_pDoc(pActDoc) + , m_aImg(m_xDialog.get()) , m_xCancelBtn(m_xBuilder->weld_button("cancel")) , m_xCreateBtn(m_xBuilder->weld_button("ok")) , m_xAddBtn(m_xBuilder->weld_button("add_btn")) diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index c48b64172f70..6bc0f8dffa7b 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -34,6 +34,8 @@ SdVectorizeDlg::SdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, ::sd:: : GenericDialogController(pParent, "modules/sdraw/ui/vectorize.ui", "VectorizeDialog") , m_pDocSh(pDocShell) , aBmp(rBmp) + , m_aBmpWin(m_xDialog.get()) + , m_aMtfWin(m_xDialog.get()) , m_xNmLayers(m_xBuilder->weld_spin_button("colors")) , m_xMtReduce(m_xBuilder->weld_metric_spin_button("points", FieldUnit::PIXEL)) , m_xFtFillHoles(m_xBuilder->weld_label("tilesft")) diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr index ad14e76deb58..4548b24fa2e5 100644 --- a/solenv/sanitizers/ui/svx.suppr +++ b/solenv/sanitizers/ui/svx.suppr @@ -40,6 +40,9 @@ svx/uiconfig/ui/findreplacedialog.ui://GtkLabel[@id='searchdir'] orphan-label svx/uiconfig/ui/fontworkgallerydialog.ui://GtkLabel[@id='label1'] orphan-label svx/uiconfig/ui/headfootformatpage.ui://GtkLabel[@id='labelHeaderFormat'] orphan-label svx/uiconfig/ui/headfootformatpage.ui://GtkLabel[@id='labelFooterFormat'] orphan-label +svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statusurl'] orphan-label +svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statuspos'] orphan-label +svx/uiconfig/ui/imapdialog.ui://GtkLabel[@id='statussize'] orphan-label svx/uiconfig/ui/mediaplayback.ui://GtkLabel[@id='label1'] orphan-label svx/uiconfig/ui/mediaplayback.ui://GtkLabel[@id='label2'] orphan-label svx/uiconfig/ui/mediaplayback.ui://GtkLabel[@id='label3'] orphan-label diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 6e9142f53c9e..b59dd0fca228 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -2143,6 +2143,7 @@ IMPL_LINK_NOARG(URLBox, FocusOutHdl, weld::Widget&, void) pCtx->join(); pCtx.clear(); } + aFocusOutHdl.Call(*m_xWidget); } OUString URLBox::GetURL() diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 433a7616d21b..b6a74cc43d6a 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -1760,7 +1760,6 @@ awt::Rectangle SAL_CALL SvtValueSetAcc::getBounds() return aRet; } - awt::Point SAL_CALL SvtValueSetAcc::getLocation() { ThrowIfDisposed(); @@ -1773,7 +1772,6 @@ awt::Point SAL_CALL SvtValueSetAcc::getLocation() return aRet; } - awt::Point SAL_CALL SvtValueSetAcc::getLocationOnScreen() { ThrowIfDisposed(); @@ -1798,7 +1796,6 @@ awt::Point SAL_CALL SvtValueSetAcc::getLocationOnScreen() return aScreenLoc; } - awt::Size SAL_CALL SvtValueSetAcc::getSize() { ThrowIfDisposed(); diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 065515de3604..4d048070897c 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -59,11 +59,9 @@ using namespace ::com::sun::star::accessibility; // internal /** initialize this component and set default values */ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext( - const Reference< XAccessible >& rxParent, - GraphCtrl& rRepr ) : + SvxGraphCtrl& rRepr ) : SvxGraphCtrlAccessibleContext_Base( m_aMutex ), - mxParent( rxParent ), mpControl( &rRepr ), mpModel (nullptr), mpPage (nullptr), @@ -96,7 +94,7 @@ SvxGraphCtrlAccessibleContext::SvxGraphCtrlAccessibleContext( } maTreeInfo.SetSdrView( mpView ); - maTreeInfo.SetDevice( mpControl ); + maTreeInfo.SetDevice(&mpControl->GetDrawingArea()->get_ref_device()); maTreeInfo.SetViewForwarder( this ); } @@ -131,7 +129,8 @@ Reference< XAccessible > SvxGraphCtrlAccessibleContext::getAccessible( const Sdr // create a new one and remember in our internal map Reference< XShape > xShape( Reference< XShape >::query( const_cast<SdrObject*>(pObj)->getUnoShape() ) ); - AccessibleShapeInfo aShapeInfo (xShape,mxParent); + css::uno::Reference<css::accessibility::XAccessible> xParent(getAccessibleParent()); + AccessibleShapeInfo aShapeInfo (xShape,xParent); // Create accessible object that corresponds to the descriptor's shape. rtl::Reference<AccessibleShape> pAcc(ShapeTypeHandler::Instance().CreateAccessibleObject( aShapeInfo, maTreeInfo)); @@ -180,7 +179,7 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAt } Point aPnt( rPoint.X, rPoint.Y ); - mpControl->PixelToLogic( aPnt ); + mpControl->GetDrawingArea()->get_ref_device().PixelToLogic( aPnt ); SdrObject* pObj = nullptr; @@ -195,41 +194,82 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAt return xAccessible; } - awt::Rectangle SAL_CALL SvxGraphCtrlAccessibleContext::getBounds() { - // no guard -> done in GetBoundingBox() - tools::Rectangle aCoreBounds( GetBoundingBox() ); - awt::Rectangle aBounds; - aBounds.X = aCoreBounds.getX(); - aBounds.Y = aCoreBounds.getY(); - aBounds.Width = aCoreBounds.getWidth(); - aBounds.Height = aCoreBounds.getHeight(); - return aBounds; -} + const SolarMutexGuard aSolarGuard; + + if (nullptr == mpControl) + throw DisposedException(); + const Point aOutPos; + const Size aOutSize( mpControl->GetOutputSizePixel() ); + awt::Rectangle aRet; + + aRet.X = aOutPos.X(); + aRet.Y = aOutPos.Y(); + aRet.Width = aOutSize.Width(); + aRet.Height = aOutSize.Height(); + + return aRet; +} awt::Point SAL_CALL SvxGraphCtrlAccessibleContext::getLocation() { - // no guard -> done in GetBoundingBox() - tools::Rectangle aRect( GetBoundingBox() ); - return awt::Point( aRect.getX(), aRect.getY() ); -} + const SolarMutexGuard aSolarGuard; + if (nullptr == mpControl) + throw DisposedException(); + + const awt::Rectangle aRect( getBounds() ); + awt::Point aRet; + + aRet.X = aRect.X; + aRet.Y = aRect.Y; + + return aRet; +} awt::Point SAL_CALL SvxGraphCtrlAccessibleContext::getLocationOnScreen() { - // no guard -> done in GetBoundingBoxOnScreen() - tools::Rectangle aRect( GetBoundingBoxOnScreen() ); - return awt::Point( aRect.getX(), aRect.getY() ); -} + const SolarMutexGuard aSolarGuard; + + if (nullptr == mpControl) + throw DisposedException(); + + awt::Point aScreenLoc(0, 0); + + auto xParent(getAccessibleParent()); + if (xParent) + { + css::uno::Reference<css::accessibility::XAccessibleContext> xParentContext(xParent->getAccessibleContext()); + css::uno::Reference<css::accessibility::XAccessibleComponent> xParentComponent(xParentContext, css::uno::UNO_QUERY); + OSL_ENSURE( xParentComponent.is(), "SvtValueSetAcc::getLocationOnScreen: no parent component!" ); + if ( xParentComponent.is() ) + { + awt::Point aParentScreenLoc( xParentComponent->getLocationOnScreen() ); + awt::Point aOwnRelativeLoc( getLocation() ); + aScreenLoc.X = aParentScreenLoc.X + aOwnRelativeLoc.X; + aScreenLoc.Y = aParentScreenLoc.Y + aOwnRelativeLoc.Y; + } + } + return aScreenLoc; +} awt::Size SAL_CALL SvxGraphCtrlAccessibleContext::getSize() { - // no guard -> done in GetBoundingBox() - tools::Rectangle aRect( GetBoundingBox() ); - return awt::Size( aRect.getWidth(), aRect.getHeight() ); + const SolarMutexGuard aSolarGuard; + + if (nullptr == mpControl) + throw DisposedException(); + + const awt::Rectangle aRect( getBounds() ); + awt::Size aRet; + + aRet.Width = aRect.Width; + aRet.Height = aRect.Height; + + return aRet; } // XAccessibleContext @@ -282,12 +322,15 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleCh return getAccessible( getSdrObject( nIndex ) ); } - Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleParent() { - return mxParent; -} + ::SolarMutexGuard aGuard; + + if( nullptr == mpControl ) + throw DisposedException(); + return mpControl->GetDrawingArea()->get_accessible_parent(); +} sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleIndexInParent() { @@ -295,9 +338,10 @@ sal_Int32 SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleIndexInParent() // Use a simple but slow solution for now. Optimize later. // Iterate over all the parent's children and search for this object. - if( mxParent.is() ) + css::uno::Reference<css::accessibility::XAccessible> xParent(getAccessibleParent()); + if (xParent.is()) { - Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); + Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); if( xParentContext.is() ) { sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); @@ -377,9 +421,10 @@ lang::Locale SAL_CALL SvxGraphCtrlAccessibleContext::getLocale() { ::SolarMutexGuard aGuard; - if( mxParent.is() ) + css::uno::Reference<css::accessibility::XAccessible> xParent(getAccessibleParent()); + if (xParent.is()) { - Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); + Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() ); if( xParentContext.is() ) return xParentContext->getLocale(); } @@ -652,46 +697,6 @@ void SAL_CALL SvxGraphCtrlAccessibleContext::disposing() } } - -tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBoxOnScreen() -{ - ::SolarMutexGuard aGuard; - - if( nullptr == mpControl ) - throw DisposedException(); - - return tools::Rectangle( - mpControl->GetAccessibleParentWindow()->OutputToAbsoluteScreenPixel( - mpControl->GetPosPixel() ), - mpControl->GetSizePixel() ); -} - - -/** Calculate the relative coordinates of the bounding box as difference - between the absolute coordinates of the bounding boxes of this control - and its parent in the accessibility tree. -*/ -tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox() -{ - ::SolarMutexGuard aGuard; - - tools::Rectangle aBounds ( 0, 0, 0, 0 ); - - vcl::Window* pWindow = mpControl; - if (pWindow == nullptr) - throw DisposedException(); - - aBounds = pWindow->GetWindowExtentsRelative (nullptr); - vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); - if (pParent != nullptr) - { - tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative (nullptr); - aBounds -= aParentRect.TopLeft(); - } - - return aBounds; -} - void SvxGraphCtrlAccessibleContext::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) @@ -751,13 +756,11 @@ tools::Rectangle SvxGraphCtrlAccessibleContext::GetVisibleArea() const return aVisArea; } - Point SvxGraphCtrlAccessibleContext::LogicToPixel (const Point& rPoint) const { if( mpControl ) { - tools::Rectangle aBBox(mpControl->GetWindowExtentsRelative(nullptr)); - return mpControl->LogicToPixel (rPoint) + aBBox.TopLeft(); + return mpControl->GetDrawingArea()->get_ref_device().LogicToPixel (rPoint) + mpControl->GetPositionInDialog(); } else { @@ -765,11 +768,10 @@ Point SvxGraphCtrlAccessibleContext::LogicToPixel (const Point& rPoint) const } } - Size SvxGraphCtrlAccessibleContext::LogicToPixel (const Size& rSize) const { if( mpControl ) - return mpControl->LogicToPixel (rSize); + return mpControl->GetDrawingArea()->get_ref_device().LogicToPixel(rSize); else return rSize; } diff --git a/svx/source/dialog/ClassificationEditView.cxx b/svx/source/dialog/ClassificationEditView.cxx index 2d53d5d83492..2972f1b227d9 100644 --- a/svx/source/dialog/ClassificationEditView.cxx +++ b/svx/source/dialog/ClassificationEditView.cxx @@ -80,7 +80,7 @@ void ClassificationEditView::SetDrawingArea(weld::DrawingArea* pDrawingArea) pEdView->SetBackgroundColor(aBgColor); pEdEngine->InsertView(pEdView.get()); - pDrawingArea->set_text_cursor(); + pDrawingArea->set_cursor(PointerStyle::Text); } ClassificationEditView::~ClassificationEditView() diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 13b9c6143040..d77a7c6e6069 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -29,6 +29,7 @@ #include <tools/debug.hxx> #include <svx/graphctl.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> #include <GraphCtlAccessibleContext.hxx> #include <svx/xoutbmp.hxx> #include <svx/svxids.hrc> @@ -54,6 +55,25 @@ void GraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, c rWin.QueueIdleUpdate(); } +void SvxGraphCtrlUserCall::Changed( const SdrObject& rObj, SdrUserCallType eType, const tools::Rectangle& /*rOldBoundRect*/ ) +{ + switch( eType ) + { + case SdrUserCallType::MoveOnly: + case SdrUserCallType::Resize: + rWin.SdrObjChanged( rObj ); + break; + + case SdrUserCallType::Inserted: + rWin.SdrObjCreated( rObj ); + break; + + default: + break; + } + rWin.QueueIdleUpdate(); +} + GraphCtrl::GraphCtrl( vcl::Window* pParent, WinBits nStyle ) : Control ( pParent, nStyle ), aUpdateIdle ( "svx GraphCtrl Update" ), @@ -82,7 +102,6 @@ void GraphCtrl::dispose() if( mpAccContext.is() ) { - mpAccContext->disposing(); mpAccContext.clear(); } pView.reset(); @@ -166,6 +185,7 @@ void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel ) aGraphSizeLink.Call( this ); Resize(); + Invalidate(); QueueIdleUpdate(); } @@ -737,47 +757,148 @@ void GraphCtrl::QueueIdleUpdate() aUpdateIdle.Start(); } -css::uno::Reference< css::accessibility::XAccessible > GraphCtrl::CreateAccessible() +SvxGraphCtrl::SvxGraphCtrl(weld::Dialog* pDialog) + : aUpdateIdle("svx GraphCtrl Update") + , aMap100(MapUnit::Map100thMM) + , eObjKind(OBJ_NONE) + , nPolyEdit(0) + , bEditMode(false) + , mbSdrMode(false) + , mbInIdleUpdate(false) + , mpDialog(pDialog) { - if( mpAccContext == nullptr ) - { - vcl::Window* pParent = GetParent(); + pUserCall.reset(new SvxGraphCtrlUserCall( *this )); + aUpdateIdle.SetPriority( TaskPriority::LOWEST ); + aUpdateIdle.SetInvokeHandler( LINK( this, SvxGraphCtrl, UpdateHdl ) ); + aUpdateIdle.Start(); +} - DBG_ASSERT( pParent, "-GraphCtrl::CreateAccessible(): No Parent!" ); +void SvxGraphCtrl::SetDrawingArea(weld::DrawingArea* pDrawingArea) +{ + weld::CustomWidgetController::SetDrawingArea(pDrawingArea); + EnableRTL(false); +} - if( pParent ) - { - css::uno::Reference< css::accessibility::XAccessible > xAccParent( pParent->GetAccessible() ); +SvxGraphCtrl::~SvxGraphCtrl() +{ + aUpdateIdle.Stop(); - // Disable accessibility if no model/view data available - if( pView && - pModel && - xAccParent.is() ) - { - mpAccContext = new SvxGraphCtrlAccessibleContext( xAccParent, *this ); - } - } + if( mpAccContext.is() ) + { + mpAccContext->disposing(); + mpAccContext.clear(); } + pView.reset(); + pModel.reset(); + pUserCall.reset(); +} - return mpAccContext.get(); +void SvxGraphCtrl::SetSdrMode(bool bSdrMode) +{ + mbSdrMode = bSdrMode; + + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + rDevice.SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) ); + xVD->SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) ); + rDevice.SetMapMode( aMap100 ); + xVD->SetMapMode( aMap100 ); + + pView.reset(); + pModel.reset(); + + if ( mbSdrMode ) + InitSdrModel(); + + QueueIdleUpdate(); +} + +void SvxGraphCtrl::InitSdrModel() +{ + SolarMutexGuard aGuard; + + SdrPage* pPage; + + // destroy old junk + pView.reset(); + pModel.reset(); + + // Creating a Model + pModel.reset(new SdrModel(nullptr, nullptr, true)); + pModel->GetItemPool().FreezeIdRanges(); + pModel->SetScaleUnit( aMap100.GetMapUnit() ); + pModel->SetScaleFraction( Fraction( 1, 1 ) ); + pModel->SetDefaultFontHeight( 500 ); + + pPage = new SdrPage( *pModel ); + + pPage->SetSize( aGraphSize ); + pPage->SetBorder( 0, 0, 0, 0 ); + pModel->InsertPage( pPage ); + pModel->SetChanged( false ); + + // Creating a View + pView.reset(new SvxGraphCtrlView(*pModel, this)); + pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) ); + pView->EnableExtendedMouseEventDispatcher( true ); + pView->ShowSdrPage(pView->GetModel()->GetPage(0)); + pView->SetFrameDragSingles(); + pView->SetMarkedPointsSmooth( SdrPathSmoothKind::Symmetric ); + pView->SetEditMode(); + + // #i72889# set needed flags + pView->SetPagePaintingAllowed(false); + pView->SetBufferedOutputAllowed(true); + pView->SetBufferedOverlayAllowed(true); + + // Tell the accessibility object about the changes. + if (mpAccContext.is()) + mpAccContext->setModelAndView (pModel.get(), pView.get()); } -SvxGraphCtrl::SvxGraphCtrl() - : aMap100(MapUnit::Map100thMM) +void SvxGraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel ) { + aGraphic = rGraphic; + xVD->SetOutputSizePixel(Size(0, 0)); //force redraw + + if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel ) + aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 ); + else + aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 ); + + if ( mbSdrMode && bNewModel ) + InitSdrModel(); + + aGraphSizeLink.Call( this ); + + Resize(); + + Invalidate(); + QueueIdleUpdate(); } -void SvxGraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) +void SvxGraphCtrl::GraphicToVD() { - rRenderContext.Erase(); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + xVD->SetOutputSizePixel(GetOutputSizePixel()); + xVD->SetBackground(rDevice.GetBackground()); + xVD->Erase(); const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType()); - // #i73381# in non-SdrMode, paint to local directly - if (bGraphicValid && aGraphSize.Width() && aGraphSize.Height()) + if (bGraphicValid) + aGraphic.Draw(xVD.get(), Point(), aGraphSize); +} + +void SvxGraphCtrl::Resize() +{ + weld::CustomWidgetController::Resize(); + + if (aGraphSize.Width() && aGraphSize.Height()) { MapMode aDisplayMap( aMap100 ); Point aNewPos; Size aNewSize; - const Size aWinSize = Application::GetDefaultDevice()->PixelToLogic(GetOutputSizePixel(), aMap100); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + const Size aWinSize = rDevice.PixelToLogic( GetOutputSizePixel(), aDisplayMap ); const long nWidth = aWinSize.Width(); const long nHeight = aWinSize.Height(); double fGrfWH = static_cast<double>(aGraphSize.Width()) / aGraphSize.Height(); @@ -802,27 +923,605 @@ void SvxGraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan aDisplayMap.SetScaleX( Fraction( aNewSize.Width(), aGraphSize.Width() ) ); aDisplayMap.SetScaleY( Fraction( aNewSize.Height(), aGraphSize.Height() ) ); - aDisplayMap.SetOrigin(OutputDevice::LogicToLogic(aNewPos, aMap100, aDisplayMap)); - rRenderContext.SetMapMode(aDisplayMap); + aDisplayMap.SetOrigin( OutputDevice::LogicToLogic( aNewPos, aMap100, aDisplayMap ) ); + rDevice.SetMapMode( aDisplayMap ); + xVD->SetMapMode( aDisplayMap ); + } + + Invalidate(); +} + +void SvxGraphCtrl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) +{ + // #i72889# used split repaint to be able to paint an own background + // even to the buffered view + const bool bGraphicValid(GraphicType::NONE != aGraphic.GetType()); + + if (GetOutputSizePixel() != xVD->GetOutputSizePixel()) + GraphicToVD(); + + if (mbSdrMode) + { + SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext); + pPaintWindow->SetOutputToWindow(true); + + if (bGraphicValid) + { + vcl::RenderContext& rTarget = pPaintWindow->GetTargetOutputDevice(); + + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + rTarget.SetBackground(rDevice.GetBackground()); + rTarget.Erase(); + + rTarget.DrawOutDev(Point(), xVD->GetOutputSize(), Point(), xVD->GetOutputSize(), *xVD); + } - aGraphic.Draw(&rRenderContext, Point(), aGraphSize); + const vcl::Region aRepaintRegion(rRect); + pView->DoCompleteRedraw(*pPaintWindow, aRepaintRegion); + pView->EndCompleteRedraw(*pPaintWindow, true); + } + else + { + // #i73381# in non-SdrMode, paint to local directly + rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(), + rRect.TopLeft(), rRect.GetSize(), + *xVD); } } -SvxGraphCtrl::~SvxGraphCtrl() +void SvxGraphCtrl::SdrObjChanged( const SdrObject& ) { + QueueIdleUpdate(); } -void SvxGraphCtrl::SetGraphic(const Graphic& rGraphic) +void SvxGraphCtrl::SdrObjCreated( const SdrObject& ) { - aGraphic = rGraphic; + QueueIdleUpdate(); +} - if ( aGraphic.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel ) - aGraphSize = Application::GetDefaultDevice()->PixelToLogic( aGraphic.GetPrefSize(), aMap100 ); +void SvxGraphCtrl::MarkListHasChanged() +{ + QueueIdleUpdate(); +} + +bool SvxGraphCtrl::KeyInput( const KeyEvent& rKEvt ) +{ + vcl::KeyCode aCode( rKEvt.GetKeyCode() ); + bool bProc = false; + + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + + switch ( aCode.GetCode() ) + { + case KEY_DELETE: + case KEY_BACKSPACE: + { + if ( mbSdrMode ) + { + pView->DeleteMarked(); + bProc = true; + } + } + break; + + case KEY_ESCAPE: + { + if ( mbSdrMode ) + { + if ( pView->IsAction() ) + { + pView->BrkAction(); + bProc = true; + } + else if ( pView->AreObjectsMarked() ) + { + pView->UnmarkAllObj(); + bProc = true; + } + } + } + break; + + case KEY_F11: + case KEY_TAB: + { + if( mbSdrMode ) + { + if( !aCode.IsMod1() && !aCode.IsMod2() ) + { + bool bForward = !aCode.IsShift(); + // select next object + if ( ! pView->MarkNextObj( bForward )) + { + // At first or last object. Cycle to the other end + // of the list. + pView->UnmarkAllObj(); + pView->MarkNextObj (bForward); + } + bProc = true; + } + else if(aCode.IsMod1()) + { + // select next handle + const SdrHdlList& rHdlList = pView->GetHdlList(); + bool bForward(!aCode.IsShift()); + + const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward); + + bProc = true; + } + } + } + break; + + case KEY_END: + { + + if ( aCode.IsMod1() ) + { + // mark last object + pView->UnmarkAllObj(); + pView->MarkNextObj(); + + bProc = true; + } + } + break; + + case KEY_HOME: + { + if ( aCode.IsMod1() ) + { + pView->UnmarkAllObj(); + pView->MarkNextObj(true); + + bProc = true; + } + } + break; + + case KEY_UP: + case KEY_DOWN: + case KEY_LEFT: + case KEY_RIGHT: + { + long nX = 0; + long nY = 0; + + if (aCode.GetCode() == KEY_UP) + { + // Scroll up + nX = 0; + nY =-1; + } + else if (aCode.GetCode() == KEY_DOWN) + { + // Scroll down + nX = 0; + nY = 1; + } + else if (aCode.GetCode() == KEY_LEFT) + { + // Scroll left + nX =-1; + nY = 0; + } + else if (aCode.GetCode() == KEY_RIGHT) + { + // Scroll right + nX = 1; + nY = 0; + } + + if (pView->AreObjectsMarked() && !aCode.IsMod1() ) + { + if(aCode.IsMod2()) + { + // move in 1 pixel distance + Size aLogicSizeOnePixel = rDevice.PixelToLogic(Size(1,1)); + nX *= aLogicSizeOnePixel.Width(); + nY *= aLogicSizeOnePixel.Height(); + } + else + { + // old, fixed move distance + nX *= 100; + nY *= 100; + } + + // II + const SdrHdlList& rHdlList = pView->GetHdlList(); + SdrHdl* pHdl = rHdlList.GetFocusHdl(); + + if(nullptr == pHdl) + { + // restrict movement to WorkArea + const tools::Rectangle& rWorkArea = pView->GetWorkArea(); + + if(!rWorkArea.IsEmpty()) + { + tools::Rectangle aMarkRect(pView->GetMarkedObjRect()); + aMarkRect.Move(nX, nY); + + if(!aMarkRect.IsInside(rWorkArea)) + { + if(aMarkRect.Left() < rWorkArea.Left()) + { + nX += rWorkArea.Left() - aMarkRect.Left(); + } + + if(aMarkRect.Right() > rWorkArea.Right()) + { + nX -= aMarkRect.Right() - rWorkArea.Right(); + } + + if(aMarkRect.Top() < rWorkArea.Top()) + { + nY += rWorkArea.Top() - aMarkRect.Top(); + } + + if(aMarkRect.Bottom() > rWorkArea.Bottom()) + { + nY -= aMarkRect.Bottom() - rWorkArea.Bottom(); + } + } + } + + // no handle selected + if(0 != nX || 0 != nY) + { + pView->MoveAllMarked(Size(nX, nY)); + } + } + else + { + // move handle with index nHandleIndex + if (nX || nY) + { + // now move the Handle (nX, nY) + Point aStartPoint(pHdl->GetPos()); + Point aEndPoint(pHdl->GetPos() + Point(nX, nY)); + const SdrDragStat& rDragStat = pView->GetDragStat(); + + // start dragging + pView->BegDragObj(aStartPoint, nullptr, pHdl, 0); + + if(pView->IsDragObj()) + { + bool bWasNoSnap = rDragStat.IsNoSnap(); + bool bWasSnapEnabled = pView->IsSnapEnabled(); + + // switch snapping off + if(!bWasNoSnap) + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(); + if(bWasSnapEnabled) + pView->SetSnapEnabled(false); + + pView->MovAction(aEndPoint); + pView->EndDragObj(); + + // restore snap + if(!bWasNoSnap) + const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap); + if(bWasSnapEnabled) + pView->SetSnapEnabled(bWasSnapEnabled); + } + } + } + + bProc = true; + } + } + break; + + case KEY_SPACE: + { + const SdrHdlList& rHdlList = pView->GetHdlList(); + SdrHdl* pHdl = rHdlList.GetFocusHdl(); + + if(pHdl) + { + if(pHdl->GetKind() == SdrHdlKind::Poly) + { + // rescue ID of point with focus + sal_uInt32 nPol(pHdl->GetPolyNum()); + sal_uInt32 nPnt(pHdl->GetPointNum()); + + if(pView->IsPointMarked(*pHdl)) + { + if(rKEvt.GetKeyCode().IsShift()) + { + pView->UnmarkPoint(*pHdl); + } + } + else + { + if(!rKEvt.GetKeyCode().IsShift()) + { + pView->UnmarkAllPoints(); + } + + pView->MarkPoint(*pHdl); + } + + if(nullptr == rHdlList.GetFocusHdl()) + { + // restore point with focus + SdrHdl* pNewOne = nullptr; + + for(size_t a = 0; !pNewOne && a < rHdlList.GetHdlCount(); ++a) + { + SdrHdl* pAct = rHdlList.GetHdl(a); + + if(pAct + && pAct->GetKind() == SdrHdlKind::Poly + && pAct->GetPolyNum() == nPol + && pAct->GetPointNum() == nPnt) + { + pNewOne = pAct; + } + } + + if(pNewOne) + { + const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne); + } + } + + bProc = true; + } + } + } + break; + + default: + break; + } + + if (bProc) + ReleaseMouse(); + + QueueIdleUpdate(); + + return bProc; +} + +bool SvxGraphCtrl::MouseButtonDown( const MouseEvent& rMEvt ) +{ + if ( mbSdrMode && ( rMEvt.GetClicks() < 2 ) ) + { + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + + const Point aLogPt( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) ); + + if ( !tools::Rectangle( Point(), aGraphSize ).IsInside( aLogPt ) && !pView->IsEditMode() ) + weld::CustomWidgetController::MouseButtonDown( rMEvt ); + else + { + // Get Focus for key inputs + GrabFocus(); + + if ( nPolyEdit ) + { + SdrViewEvent aVEvt; + SdrHitKind eHit = pView->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ); + + if ( nPolyEdit == SID_BEZIER_INSERT && eHit == SdrHitKind::MarkedObject ) + pView->BegInsObjPoint( aLogPt, rMEvt.IsMod1()); + else + pView->MouseButtonDown( rMEvt, &rDevice ); + } + else + pView->MouseButtonDown( rMEvt, &rDevice ); + } + + SdrObject* pCreateObj = pView->GetCreateObj(); + + // We want to realize the insert + if ( pCreateObj && !pCreateObj->GetUserCall() ) + pCreateObj->SetUserCall( pUserCall.get() ); + + SetPointer( pView->GetPreferredPointer( aLogPt, &rDevice ) ); + } else - aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 ); + weld::CustomWidgetController::MouseButtonDown( rMEvt ); - Invalidate(); + QueueIdleUpdate(); + + return false; +} + +bool SvxGraphCtrl::MouseMove(const MouseEvent& rMEvt) +{ + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + const Point aLogPos( rDevice.PixelToLogic( rMEvt.GetPosPixel() ) ); + + if ( mbSdrMode ) + { + pView->MouseMove( rMEvt, &rDevice ); + + if( ( SID_BEZIER_INSERT == nPolyEdit ) && + !pView->PickHandle( aLogPos ) && + !pView->IsInsObjPoint() ) + { + SetPointer( PointerStyle::Cross ); + } + else + SetPointer( pView->GetPreferredPointer( aLogPos, &rDevice ) ); + } + else + weld::CustomWidgetController::MouseButtonUp( rMEvt ); + + if ( aMousePosLink.IsSet() ) + { + if ( tools::Rectangle( Point(), aGraphSize ).IsInside( aLogPos ) ) + aMousePos = aLogPos; + else + aMousePos = Point(); + + aMousePosLink.Call( this ); + } + + QueueIdleUpdate(); + + return false; +} + +bool SvxGraphCtrl::MouseButtonUp(const MouseEvent& rMEvt) +{ + if ( mbSdrMode ) + { + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + + if ( pView->IsInsObjPoint() ) + pView->EndInsObjPoint( SdrCreateCmd::ForceEnd ); + else + pView->MouseButtonUp( rMEvt, &rDevice ); + + ReleaseMouse(); + SetPointer( pView->GetPreferredPointer( rDevice.PixelToLogic( rMEvt.GetPosPixel() ), &rDevice ) ); + } + else + weld::CustomWidgetController::MouseButtonUp( rMEvt ); + + QueueIdleUpdate(); + + return false; +} + +SdrObject* SvxGraphCtrl::GetSelectedSdrObject() const +{ + SdrObject* pSdrObj = nullptr; + + if ( mbSdrMode ) + { + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + + if ( rMarkList.GetMarkCount() == 1 ) + pSdrObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); + } + + return pSdrObj; +} + +void SvxGraphCtrl::SetEditMode( const bool _bEditMode ) +{ + if ( mbSdrMode ) + { + bEditMode = _bEditMode; + pView->SetEditMode( bEditMode ); + eObjKind = OBJ_NONE; + pView->SetCurrentObj( sal::static_int_cast< sal_uInt16 >( eObjKind ) ); + } + else + bEditMode = false; + + QueueIdleUpdate(); +} + +void SvxGraphCtrl::SetPolyEditMode( const sal_uInt16 _nPolyEdit ) +{ + if ( mbSdrMode && ( _nPolyEdit != nPolyEdit ) ) + { + nPolyEdit = _nPolyEdit; + pView->SetFrameDragSingles( nPolyEdit == 0 ); + } + else + nPolyEdit = 0; + + QueueIdleUpdate(); +} + +void SvxGraphCtrl::SetObjKind( const SdrObjKind _eObjKind ) +{ + if ( mbSdrMode ) + { + bEditMode = false; + pView->SetEditMode( bEditMode ); + eObjKind = _eObjKind; + pView->SetCurrentObj( sal::static_int_cast< sal_uInt16 >( eObjKind ) ); + } + else + eObjKind = OBJ_NONE; + + QueueIdleUpdate(); +} + +IMPL_LINK_NOARG(SvxGraphCtrl, UpdateHdl, Timer *, void) +{ + mbInIdleUpdate = true; + aUpdateLink.Call( this ); + mbInIdleUpdate = false; +} + +void SvxGraphCtrl::QueueIdleUpdate() +{ + if (!mbInIdleUpdate) + aUpdateIdle.Start(); +} + +namespace +{ + class WeldOverlayManager final : public sdr::overlay::OverlayManager + { + weld::CustomWidgetController& m_rGraphCtrl; + + public: + WeldOverlayManager(weld::CustomWidgetController& rGraphCtrl, OutputDevice& rDevice) + : OverlayManager(rDevice) + , m_rGraphCtrl(rGraphCtrl) + { + } + + // invalidate the given range at local OutputDevice + virtual void invalidateRange(const basegfx::B2DRange& rRange) override + { + tools::Rectangle aInvalidateRectangle(RangeToInvalidateRectangle(rRange)); + m_rGraphCtrl.Invalidate(aInvalidateRectangle); + } + }; +} + +rtl::Reference<sdr::overlay::OverlayManager> SvxGraphCtrlView::CreateOverlayManager(OutputDevice& rDevice) const +{ + assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device()); + if (rDevice.GetOutDevType() == OUTDEV_VIRDEV) + { + rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager(new WeldOverlayManager(rGraphCtrl, rDevice)); + InitOverlayManager(xOverlayManager); + return xOverlayManager; + } + return SdrView::CreateOverlayManager(rDevice); +} + +void SvxGraphCtrlView::InvalidateWindow(const tools::Rectangle& rArea, OutputDevice& rDevice) const +{ + assert(&rDevice == &rGraphCtrl.GetDrawingArea()->get_ref_device()); + if (rDevice.GetOutDevType() == OUTDEV_VIRDEV) + { + rGraphCtrl.Invalidate(rArea); + return; + } + SdrView::InvalidateWindow(rArea, rDevice); +} + +Point SvxGraphCtrl::GetPositionInDialog() const +{ + int x, y, width, height; + if (GetDrawingArea()->get_extents_relative_to(*mpDialog, x, y, width, height)) + return Point(x, y); + return Point(); +} + +css::uno::Reference< css::accessibility::XAccessible > SvxGraphCtrl::CreateAccessible() +{ + if(mpAccContext == nullptr ) + { + // Disable accessibility if no model/view data available + if (pView && pModel) + mpAccContext = new SvxGraphCtrlAccessibleContext(*this); + } + return mpAccContext.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 82aa9ac843c3..b1dcd35b5071 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -62,7 +62,7 @@ #define IMAP_CERN_TYPE "*.map" #define IMAP_NCSA_TYPE "*.map" -SFX_IMPL_MODELESSDIALOG_WITHID( SvxIMapDlgChildWindow, SID_IMAP ); +SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID( SvxIMapDlgChildWindow, SID_IMAP ); // ControllerItem @@ -87,17 +87,13 @@ void SvxIMapDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, } } -SvxIMapDlgChildWindow::SvxIMapDlgChildWindow( vcl::Window* _pParent, sal_uInt16 nId, - SfxBindings* pBindings, - SfxChildWinInfo const * pInfo ) : - SfxChildWindow( _pParent, nId ) +SvxIMapDlgChildWindow::SvxIMapDlgChildWindow(vcl::Window* _pParent, sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo const * pInfo) + : SfxChildWindow( _pParent, nId ) { - SetWindow(VclPtr<SvxIMapDlg>::Create( pBindings, this, _pParent )); - SvxIMapDlg* pDlg = static_cast<SvxIMapDlg*>(GetWindow()); - - if ( pInfo->nFlags & SfxChildWindowFlags::ZOOMIN ) - pDlg->RollUp(); - + SetController(std::make_shared<SvxIMapDlg>(pBindings, this, _pParent->GetFrameWeld())); + SvxIMapDlg* pDlg = static_cast<SvxIMapDlg*>(GetController().get()); pDlg->Initialize( pInfo ); } @@ -111,136 +107,94 @@ void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageM VCL_BUILDER_FACTORY(StatusBar) -SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window* _pParent) - : SfxModelessDialog(_pBindings, pCW, _pParent, "ImapDialog", "svx/ui/imapdialog.ui") +SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, weld::Window* _pParent) + : SfxModelessDialogController(_pBindings, pCW, _pParent, "svx/ui/imapdialog.ui", "ImapDialog") , pCheckObj(nullptr) , aIMapItem(*this, *_pBindings) + , m_xIMapWnd(new IMapWindow(_pBindings->GetActiveFrame(), m_xDialog.get())) + , m_xTbxIMapDlg1(m_xBuilder->weld_toolbar("toolbar")) + , m_xFtURL(m_xBuilder->weld_label("urlft")) + , m_xURLBox(new URLBox(m_xBuilder->weld_combo_box("url"))) + , m_xFtText(m_xBuilder->weld_label("textft")) + , m_xEdtText(m_xBuilder->weld_entry("text")) + , m_xFtTarget(m_xBuilder->weld_label("targetft")) + , m_xCbbTarget(m_xBuilder->weld_combo_box("target")) + , m_xCancelBtn(m_xBuilder->weld_button("cancel")) + , m_xStbStatus1(m_xBuilder->weld_label("statusurl")) + , m_xStbStatus2(m_xBuilder->weld_label("statuspos")) + , m_xStbStatus3(m_xBuilder->weld_label("statussize")) + , m_xIMapWndWeld(new weld::CustomWeld(*m_xBuilder, "container", *m_xIMapWnd)) + { - get(m_pTbxIMapDlg1, "toolbar"); - m_pTbxIMapDlg1->InsertSeparator(4, 5); - m_pTbxIMapDlg1->InsertSeparator(10, 5); - m_pTbxIMapDlg1->InsertSeparator(15, 5); - m_pTbxIMapDlg1->InsertSeparator(18, 5); - - mnApplyId = m_pTbxIMapDlg1->GetItemId("TBI_APPLY"); - mnOpenId = m_pTbxIMapDlg1->GetItemId("TBI_OPEN"); - mnSaveAsId = m_pTbxIMapDlg1->GetItemId("TBI_SAVEAS"); - mnCloseId = m_pTbxIMapDlg1->GetItemId("TBI_CLOSE"); - mnSelectId = m_pTbxIMapDlg1->GetItemId("TBI_SELECT"); - mnRectId = m_pTbxIMapDlg1->GetItemId("TBI_RECT"); - mnCircleId = m_pTbxIMapDlg1->GetItemId("TBI_CIRCLE"); - mnPolyId = m_pTbxIMapDlg1->GetItemId("TBI_POLY"); - mnFreePolyId = m_pTbxIMapDlg1->GetItemId("TBI_FREEPOLY"); - mnPolyEditId = m_pTbxIMapDlg1->GetItemId("TBI_POLYEDIT"); - mnPolyMoveId = m_pTbxIMapDlg1->GetItemId("TBI_POLYMOVE"); - mnPolyInsertId = m_pTbxIMapDlg1->GetItemId("TBI_POLYINSERT"); - mnPolyDeleteId = m_pTbxIMapDlg1->GetItemId("TBI_POLYDELETE"); - mnUndoId = m_pTbxIMapDlg1->GetItemId("TBI_UNDO"); - mnRedoId = m_pTbxIMapDlg1->GetItemId("TBI_REDO"); - mnActiveId = m_pTbxIMapDlg1->GetItemId("TBI_ACTIVE"); - mnMacroId = m_pTbxIMapDlg1->GetItemId("TBI_MACRO"); - mnPropertyId = m_pTbxIMapDlg1->GetItemId("TBI_PROPERTY"); - - get(m_pFtURL, "urlft"); - get(m_pURLBox, "url"); - get(m_pFtText, "textft"); - get(m_pEdtText, "text"); - get(m_pFtTarget, "targetft"); - get(m_pCbbTarget, "target"); + m_xTbxIMapDlg1->insert_separator(4, "sep1"); + m_xTbxIMapDlg1->insert_separator(10, "sep2"); + m_xTbxIMapDlg1->insert_separator(15, "sep3"); + m_xTbxIMapDlg1->insert_separator(18, "sel4"); //lock this down so it doesn't jump around in size //as entries are added later on TargetList aTmpList; SfxFrame::GetDefaultTargetList(aTmpList); for (const OUString & s : aTmpList) - m_pCbbTarget->InsertEntry(s); - Size aPrefSize(m_pCbbTarget->get_preferred_size()); - m_pCbbTarget->set_width_request(aPrefSize.Width()); - m_pCbbTarget->Clear(); + m_xCbbTarget->append_text(s); + Size aPrefSize(m_xCbbTarget->get_preferred_size()); + m_xCbbTarget->set_size_request(aPrefSize.Width(), -1); + m_xCbbTarget->clear(); - get(m_pStbStatus, "statusbar"); - - VclVBox* _pContainer = get<VclVBox>("container"); - pIMapWnd = VclPtr<IMapWindow>::Create( _pContainer, WB_BORDER, _pBindings->GetActiveFrame() ); - pIMapWnd->set_hexpand(true); - pIMapWnd->set_vexpand(true); - pIMapWnd->Show(); + m_xIMapWnd->Show(); pOwnData.reset(new IMapOwnData); - pIMapWnd->SetInfoLink( LINK( this, SvxIMapDlg, InfoHdl ) ); - pIMapWnd->SetMousePosLink( LINK( this, SvxIMapDlg, MousePosHdl ) ); - pIMapWnd->SetGraphSizeLink( LINK( this, SvxIMapDlg, GraphSizeHdl ) ); - pIMapWnd->SetUpdateLink( LINK( this, SvxIMapDlg, StateHdl ) ); - - m_pURLBox->SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) ); - m_pURLBox->SetSelectHdl( LINK( this, SvxIMapDlg, URLModifyComboBoxHdl ) ); - m_pURLBox->SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) ); - m_pEdtText->SetModifyHdl( LINK( this, SvxIMapDlg, URLModifyHdl ) ); - m_pCbbTarget->SetLoseFocusHdl( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) ); - - SvtMiscOptions aMiscOptions; - aMiscOptions.AddListenerLink( LINK( this, SvxIMapDlg, MiscHdl ) ); - - m_pTbxIMapDlg1->SetSelectHdl( LINK( this, SvxIMapDlg, TbxClickHdl ) ); - m_pTbxIMapDlg1->CheckItem( mnSelectId ); - TbxClickHdl( m_pTbxIMapDlg1 ); - - SetMinOutputSizePixel( GetOutputSizePixel() ); - - m_pStbStatus->InsertItem( 1, 130, StatusBarItemBits::Left | StatusBarItemBits::In | StatusBarItemBits::AutoSize ); - m_pStbStatus->InsertItem( 2, 10 + GetTextWidth( " 9999,99 cm / 9999,99 cm " ) ); - m_pStbStatus->InsertItem( 3, 10 + GetTextWidth( " 9999,99 cm x 9999,99 cm " ) ); - - m_pFtURL->Disable(); - m_pURLBox->Disable(); - m_pFtText->Disable(); - m_pEdtText->Disable(); - m_pFtTarget->Disable(); - m_pCbbTarget->Disable(); + m_xIMapWnd->SetInfoLink( LINK( this, SvxIMapDlg, InfoHdl ) ); + m_xIMapWnd->SetMousePosLink( LINK( this, SvxIMapDlg, MousePosHdl ) ); + m_xIMapWnd->SetGraphSizeLink( LINK( this, SvxIMapDlg, GraphSizeHdl ) ); + m_xIMapWnd->SetUpdateLink( LINK( this, SvxIMapDlg, StateHdl ) ); + + m_xURLBox->connect_changed( LINK( this, SvxIMapDlg, URLModifyHdl ) ); + m_xURLBox->connect_focus_out( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) ); + m_xEdtText->connect_changed( LINK( this, SvxIMapDlg, EntryModifyHdl ) ); + m_xCbbTarget->connect_focus_out( LINK( this, SvxIMapDlg, URLLoseFocusHdl ) ); + + m_xTbxIMapDlg1->connect_clicked( LINK( this, SvxIMapDlg, TbxClickHdl ) ); + OString sSelect("TBI_SELECT"); + m_xTbxIMapDlg1->set_item_active(sSelect, true); + TbxClickHdl(sSelect); + + m_xStbStatus1->set_size_request(120, -1); + const int nWidth = m_xStbStatus1->get_pixel_size(" 9999,99 cm / 9999,99 cm ").Width(); + m_xStbStatus2->set_size_request(nWidth, -1); + m_xStbStatus3->set_size_request(nWidth, -1); + + m_xFtURL->set_sensitive(false); + m_xURLBox->set_sensitive(false); + m_xFtText->set_sensitive(false); + m_xEdtText->set_sensitive(false); + m_xFtTarget->set_sensitive(false); + m_xCbbTarget->set_sensitive(false); pOwnData->bExecState = false; pOwnData->aIdle.SetInvokeHandler( LINK( this, SvxIMapDlg, UpdateHdl ) ); - m_pTbxIMapDlg1->EnableItem( mnActiveId, false ); - m_pTbxIMapDlg1->EnableItem( mnMacroId, false ); - m_pTbxIMapDlg1->EnableItem( mnPropertyId, false ); -} + m_xTbxIMapDlg1->set_item_sensitive("TBI_ACTIVE", false); + m_xTbxIMapDlg1->set_item_sensitive("TBI_MACRO", false ); + m_xTbxIMapDlg1->set_item_sensitive("TBI_PROPERTY", false ); -SvxIMapDlg::~SvxIMapDlg() -{ - disposeOnce(); + m_xCancelBtn->connect_clicked(LINK(this, SvxIMapDlg, CancelHdl)); } -void SvxIMapDlg::dispose() +SvxIMapDlg::~SvxIMapDlg() { - pIMapWnd->SetUpdateLink( Link<GraphCtrl*,void>() ); - - SvtMiscOptions aMiscOptions; - aMiscOptions.RemoveListenerLink( LINK( this, SvxIMapDlg, MiscHdl ) ); - - // Delete URL-List - pIMapWnd.disposeAndClear(); - pOwnData.reset(); - m_pTbxIMapDlg1.clear(); - m_pFtURL.clear(); - m_pURLBox.clear(); - m_pFtText.clear(); - m_pEdtText.clear(); - m_pFtTarget.clear(); - m_pCbbTarget.clear(); - m_pStbStatus.clear(); - SfxModelessDialog::dispose(); - aIMapItem.dispose(); + m_xIMapWnd->SetUpdateLink( Link<SvxGraphCtrl*,void>() ); + m_xIMapWnd.reset(); } -bool SvxIMapDlg::Close() +IMPL_LINK_NOARG(SvxIMapDlg, CancelHdl, weld::Button&, void) { bool bRet = true; - if ( m_pTbxIMapDlg1->IsItemEnabled( mnApplyId ) ) + if ( m_xTbxIMapDlg1->get_item_sensitive("TBI_APPLY") ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querymodifyimagemapchangesdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), "svx/ui/querymodifyimagemapchangesdialog.ui")); std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QueryModifyImageMapChangesDialog")); const long nRet = xQBox->run(); @@ -254,9 +208,9 @@ bool SvxIMapDlg::Close() else if( nRet == RET_CANCEL ) bRet = false; } - else if( pIMapWnd->IsChanged() ) + else if( m_xIMapWnd->IsChanged() ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querysaveimagemapchangesdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), "svx/ui/querysaveimagemapchangesdialog.ui")); std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveImageMapChangesDialog")); const long nRet = xQBox->run(); @@ -266,7 +220,8 @@ bool SvxIMapDlg::Close() bRet = false; } - return bRet && SfxModelessDialog::Close(); + if (bRet) + m_xDialog->response(RET_CANCEL); } // Enabled or disable all Controls @@ -278,19 +233,19 @@ void SvxIMapDlg::SetExecState( bool bEnable ) const ImageMap& SvxIMapDlg::GetImageMap() const { - return pIMapWnd->GetImageMap(); + return m_xIMapWnd->GetImageMap(); } void SvxIMapDlg::SetTargetList( const TargetList& rTargetList ) { TargetList aNewList( rTargetList ); - pIMapWnd->SetTargetList( aNewList ); + m_xIMapWnd->SetTargetList( aNewList ); - m_pCbbTarget->Clear(); + m_xCbbTarget->clear(); for (const OUString & s : aNewList) - m_pCbbTarget->InsertEntry( s ); + m_xCbbTarget->append_text(s); } void SvxIMapDlg::UpdateLink( const Graphic& rGraphic, const ImageMap* pImageMap, @@ -326,121 +281,87 @@ void SvxIMapDlg::UpdateLink( const Graphic& rGraphic, const ImageMap* pImageMap, // Click-handler for ToolBox -IMPL_LINK( SvxIMapDlg, TbxClickHdl, ToolBox*, pTbx, void ) +IMPL_LINK(SvxIMapDlg, TbxClickHdl, const OString&, rNewItemId, void) { - sal_uInt16 nNewItemId = pTbx->GetCurItemId(); - - if(nNewItemId == mnApplyId) + if (rNewItemId == "TBI_APPLY") { - URLLoseFocusHdl( *m_pURLBox ); + URLLoseFocusHdl(*m_xCbbTarget); SfxBoolItem aBoolItem( SID_IMAP_EXEC, true ); GetBindings().GetDispatcher()->ExecuteList(SID_IMAP_EXEC, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aBoolItem }); } - else if(nNewItemId == mnOpenId) + else if (rNewItemId == "TBI_OPEN") DoOpen(); - else if(nNewItemId == mnSaveAsId) - DoSave(); - else if(nNewItemId == mnCloseId) - { - SvxIMapDlg* pDlg = GetIMapDlg(); - pDlg->Close(); - } - else if(nNewItemId == mnSelectId) + else if (rNewItemId == "TBI_SAVEAS") + DoSave(); + else if (rNewItemId == "TBI_CLOSE") + CancelHdl(*m_xCancelBtn); + else if (rNewItemId == "TBI_SELECT") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetEditMode( true ); - if( pTbx->IsKeyEvent() ) - { - if((pTbx->GetKeyModifier() & KEY_MOD1) != 0) - pIMapWnd->SelectFirstObject(); - else - pIMapWnd->GrabFocus(); - } + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetEditMode( true ); } - else if(nNewItemId == mnRectId) + else if (rNewItemId == "TBI_RECT") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetObjKind( OBJ_RECT ); - if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) ) - { - pIMapWnd->CreateDefaultObject(); - pIMapWnd->GrabFocus(); - } + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetObjKind( OBJ_RECT ); } - else if(nNewItemId == mnCircleId) + else if (rNewItemId == "TBI_CIRCLE") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetObjKind( OBJ_CIRC ); - if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) ) - { - pIMapWnd->CreateDefaultObject(); - pIMapWnd->GrabFocus(); - } + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetObjKind( OBJ_CIRC ); } - else if(nNewItemId == mnPolyId) + else if (rNewItemId == "TBI_POLY") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetObjKind( OBJ_POLY ); - if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) ) - { - pIMapWnd->CreateDefaultObject(); - pIMapWnd->GrabFocus(); - } + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetObjKind( OBJ_POLY ); } - else if(nNewItemId == mnFreePolyId) + else if (rNewItemId == "TBI_FREEPOLY") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetObjKind( OBJ_FREEFILL ); - if( pTbx->IsKeyEvent() && ((pTbx->GetKeyModifier() & KEY_MOD1) != 0) ) - { - pIMapWnd->CreateDefaultObject(); - pIMapWnd->GrabFocus(); - } + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetObjKind( OBJ_FREEFILL ); } - else if(nNewItemId == mnActiveId) + else if (rNewItemId == "TBI_ACTIVE") { - URLLoseFocusHdl( *m_pURLBox ); - bool bNewState = !pTbx->IsItemChecked(mnActiveId); - pTbx->CheckItem(mnActiveId, bNewState); - pIMapWnd->SetCurrentObjState( !bNewState ); + URLLoseFocusHdl(*m_xCbbTarget); + bool bNewState = !m_xTbxIMapDlg1->get_item_active(rNewItemId); + m_xTbxIMapDlg1->set_item_active(rNewItemId, bNewState); + m_xIMapWnd->SetCurrentObjState( !bNewState ); } - else if(nNewItemId == mnMacroId) - pIMapWnd->DoMacroAssign(); - else if(nNewItemId == mnPropertyId) - pIMapWnd->DoPropertyDialog(); - else if(nNewItemId == mnPolyEditId) + else if (rNewItemId == "TBI_MACRO") + m_xIMapWnd->DoMacroAssign(); + else if (rNewItemId == "TBI_PROPERTY") + m_xIMapWnd->DoPropertyDialog(); + else if (rNewItemId == "TBI_POLYEDIT") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetPolyEditMode( pTbx->IsItemChecked(mnPolyEditId) ? SID_BEZIER_MOVE : 0 ); - if( pTbx->IsKeyEvent() && pTbx->IsItemChecked(mnPolyEditId) ) - pIMapWnd->StartPolyEdit(); + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetPolyEditMode( m_xTbxIMapDlg1->get_item_active(rNewItemId) ? SID_BEZIER_MOVE : 0 ); } - else if(nNewItemId == mnPolyMoveId) + else if (rNewItemId == "TBI_POLYMOVE") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetPolyEditMode( SID_BEZIER_MOVE ); + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetPolyEditMode( SID_BEZIER_MOVE ); } - else if(nNewItemId == mnPolyInsertId) + else if (rNewItemId == "TBI_POLYINSERT") { - SetActiveTool( nNewItemId ); - pIMapWnd->SetPolyEditMode( SID_BEZIER_INSERT ); + SetActiveTool( rNewItemId ); + m_xIMapWnd->SetPolyEditMode( SID_BEZIER_INSERT ); } - else if(nNewItemId == mnPolyDeleteId) + else if (rNewItemId == "TBI_POLYDELETE") { - SetActiveTool( nNewItemId ); - pIMapWnd->GetSdrView()->DeleteMarkedPoints(); + SetActiveTool( rNewItemId ); + m_xIMapWnd->GetSdrView()->DeleteMarkedPoints(); } - else if(nNewItemId == mnUndoId) + else if (rNewItemId == "TBI_UNDO") { - URLLoseFocusHdl( *m_pURLBox ); - pIMapWnd->GetSdrModel()->Undo(); + URLLoseFocusHdl(*m_xCbbTarget); + m_xIMapWnd->GetSdrModel()->Undo(); } - else if(nNewItemId == mnRedoId) + else if (rNewItemId == "TBI_REDO") { - URLLoseFocusHdl( *m_pURLBox ); - pIMapWnd->GetSdrModel()->Redo(); + URLLoseFocusHdl(*m_xCbbTarget); + m_xIMapWnd->GetSdrModel()->Redo(); } } @@ -448,7 +369,7 @@ void SvxIMapDlg::DoOpen() { ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, m_xDialog.get()); ImageMap aLoadIMap; const OUString aFilter(SvxResId(RID_SVXSTR_IMAP_ALL_FILTER)); @@ -473,14 +394,14 @@ void SvxIMapDlg::DoOpen() if( pIStm->GetError() ) { - SfxErrorContext eEC(ERRCTX_ERROR, GetFrameWeld()); + SfxErrorContext eEC(ERRCTX_ERROR, m_xDialog.get()); ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); } else - pIMapWnd->SetImageMap( aLoadIMap ); + m_xIMapWnd->SetImageMap( aLoadIMap ); } - pIMapWnd->Invalidate(); + m_xIMapWnd->Invalidate(); } } @@ -488,12 +409,12 @@ bool SvxIMapDlg::DoSave() { ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, m_xDialog.get()); const OUString aBinFilter( IMAP_BINARY_FILTER ); const OUString aCERNFilter( IMAP_CERN_FILTER ); const OUString aNCSAFilter( IMAP_NCSA_FILTER ); - SdrModel* pModel = pIMapWnd->GetSdrModel(); + SdrModel* pModel = m_xIMapWnd->GetSdrModel(); const bool bChanged = pModel->IsChanged(); bool bRet = false; @@ -544,7 +465,7 @@ bool SvxIMapDlg::DoSave() std::unique_ptr<SvStream> pOStm(::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE | StreamMode::TRUNC )); if( pOStm ) { - pIMapWnd->GetImageMap().Write( *pOStm, nFormat ); + m_xIMapWnd->GetImageMap().Write( *pOStm, nFormat ); if( pOStm->GetError() ) ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); @@ -559,30 +480,30 @@ bool SvxIMapDlg::DoSave() return bRet; } -void SvxIMapDlg::SetActiveTool( sal_uInt16 nId ) +void SvxIMapDlg::SetActiveTool(const OString& rId) { - m_pTbxIMapDlg1->CheckItem( mnSelectId, mnSelectId == nId ); - m_pTbxIMapDlg1->CheckItem( mnRectId, mnRectId == nId ); - m_pTbxIMapDlg1->CheckItem( mnCircleId, mnCircleId == nId ); - m_pTbxIMapDlg1->CheckItem( mnPolyId, mnPolyId == nId ); - m_pTbxIMapDlg1->CheckItem( mnFreePolyId, mnFreePolyId == nId ); + m_xTbxIMapDlg1->set_item_active("TBI_SELECT", rId == "TBI_SELECT"); + m_xTbxIMapDlg1->set_item_active("TBI_RECT", rId == "TBI_RECT"); + m_xTbxIMapDlg1->set_item_active("TBI_CIRCLE", rId == "TBI_CIRCLE"); + m_xTbxIMapDlg1->set_item_active("TBI_POLY", rId == "TBI_POLY"); + m_xTbxIMapDlg1->set_item_active("TBI_FREEPOLY", rId == "TBI_FREEPOLY"); - m_pTbxIMapDlg1->CheckItem( mnPolyInsertId, mnPolyInsertId == nId ); - m_pTbxIMapDlg1->CheckItem( mnPolyDeleteId, false ); + m_xTbxIMapDlg1->set_item_active("TBI_POLYINSERT", rId == "TBI_POLYINSERT"); + m_xTbxIMapDlg1->set_item_active("TBI_POLYDELETE", false); - bool bMove = mnPolyMoveId == nId - || ( mnPolyEditId == nId - && !m_pTbxIMapDlg1->IsItemChecked(mnPolyInsertId) - && !m_pTbxIMapDlg1->IsItemChecked(mnPolyDeleteId) ); + bool bMove = rId == "TBI_POLYMOVE" + || ( rId == "TBI_POLYEDIT" + && !m_xTbxIMapDlg1->get_item_active("TBI_POLYINSERT") + && !m_xTbxIMapDlg1->get_item_active("TBI_POLYDELETE") ); - m_pTbxIMapDlg1->CheckItem( mnPolyMoveId, bMove ); + m_xTbxIMapDlg1->set_item_active("TBI_POLYMOVE", bMove ); - bool bEditMode = ( mnPolyEditId == nId ) - || ( mnPolyMoveId == nId ) - || ( mnPolyInsertId == nId ) - || ( mnPolyDeleteId == nId ); + bool bEditMode = ( rId == "TBI_POLYEDIT" ) + || ( rId == "TBI_POLYMOVE") + || ( rId == "TBI_POLYINSERT") + || ( rId == "TBI_POLYDELETE" ); - m_pTbxIMapDlg1->CheckItem( mnPolyEditId, bEditMode ); + m_xTbxIMapDlg1->set_item_active("TBI_POLYEDIT", bEditMode); } IMPL_LINK( SvxIMapDlg, InfoHdl, IMapWindow&, rWnd, void ) @@ -591,66 +512,66 @@ IMPL_LINK( SvxIMapDlg, InfoHdl, IMapWindow&, rWnd, void ) if ( rInfo.bNewObj ) { - if( !rInfo.aMarkURL.isEmpty() && ( m_pURLBox->GetEntryPos( rInfo.aMarkURL ) == LISTBOX_ENTRY_NOTFOUND ) ) - m_pURLBox->InsertEntry( rInfo.aMarkURL ); + if (!rInfo.aMarkURL.isEmpty() && ( m_xURLBox->find_text(rInfo.aMarkURL) == -1)) + m_xURLBox->append_text(rInfo.aMarkURL); - m_pURLBox->SetText( rInfo.aMarkURL ); - m_pEdtText->SetText( rInfo.aMarkAltText ); + m_xURLBox->set_entry_text(rInfo.aMarkURL); + m_xEdtText->set_text(rInfo.aMarkAltText); if ( rInfo.aMarkTarget.isEmpty() ) - m_pCbbTarget->SetText( SELF_TARGET ); + m_xCbbTarget->set_entry_text( SELF_TARGET ); else - m_pCbbTarget->SetText( rInfo.aMarkTarget ); + m_xCbbTarget->set_entry_text( rInfo.aMarkTarget ); } if ( !rInfo.bOneMarked ) { - m_pTbxIMapDlg1->CheckItem( mnActiveId, false ); - m_pTbxIMapDlg1->EnableItem( mnActiveId, false ); - m_pTbxIMapDlg1->EnableItem( mnMacroId, false ); - m_pTbxIMapDlg1->EnableItem( mnPropertyId, false ); - m_pStbStatus->SetItemText( 1, OUString() ); - - m_pFtURL->Disable(); - m_pURLBox->Disable(); - m_pFtText->Disable(); - m_pEdtText->Disable(); - m_pFtTarget->Disable(); - m_pCbbTarget->Disable(); - - m_pURLBox->SetText( "" ); - m_pEdtText->SetText( "" ); + m_xTbxIMapDlg1->set_item_active("TBI_ACTIVE", false); + m_xTbxIMapDlg1->set_item_sensitive("TBI_ACTIVE", false); + m_xTbxIMapDlg1->set_item_sensitive("TBI_MACRO", false); + m_xTbxIMapDlg1->set_item_sensitive("TBI_PROPERTY", false); + m_xStbStatus1->set_label(OUString()); + + m_xFtURL->set_sensitive(false); + m_xURLBox->set_sensitive(false); + m_xFtText->set_sensitive(false); + m_xEdtText->set_sensitive(false); + m_xFtTarget->set_sensitive(false); + m_xCbbTarget->set_sensitive(false); + + m_xURLBox->set_entry_text( "" ); + m_xEdtText->set_text( "" ); } else { - m_pTbxIMapDlg1->EnableItem( mnActiveId ); - m_pTbxIMapDlg1->CheckItem( mnActiveId, !rInfo.bActivated ); - m_pTbxIMapDlg1->EnableItem( mnMacroId ); - m_pTbxIMapDlg1->EnableItem( mnPropertyId ); + m_xTbxIMapDlg1->set_item_sensitive("TBI_ACTIVE", true); + m_xTbxIMapDlg1->set_item_active("TBI_ACTIVE", !rInfo.bActivated ); + m_xTbxIMapDlg1->set_item_sensitive("TBI_MACRO", true); + m_xTbxIMapDlg1->set_item_sensitive("TBI_PROPERTY", true); - m_pFtURL->Enable(); - m_pURLBox->Enable(); - m_pFtText->Enable(); - m_pEdtText->Enable(); - m_pFtTarget->Enable(); - m_pCbbTarget->Enable(); + m_xFtURL->set_sensitive(true); + m_xURLBox->set_sensitive(true); + m_xFtText->set_sensitive(true); + m_xEdtText->set_sensitive(true); + m_xFtTarget->set_sensitive(true); + m_xCbbTarget->set_sensitive(true); - m_pStbStatus->SetItemText( 1, rInfo.aMarkURL ); + m_xStbStatus1->set_label(rInfo.aMarkURL); - if ( m_pURLBox->GetText() != rInfo.aMarkURL ) - m_pURLBox->SetText( rInfo.aMarkURL ); + if ( m_xURLBox->get_active_text() != rInfo.aMarkURL ) + m_xURLBox->set_entry_text( rInfo.aMarkURL ); - if ( m_pEdtText->GetText() != rInfo.aMarkAltText ) - m_pEdtText->SetText( rInfo.aMarkAltText ); + if ( m_xEdtText->get_text() != rInfo.aMarkAltText ) + m_xEdtText->set_text( rInfo.aMarkAltText ); if ( rInfo.aMarkTarget.isEmpty() ) - m_pCbbTarget->SetText( SELF_TARGET ); + m_xCbbTarget->set_entry_text( SELF_TARGET ); else - m_pCbbTarget->SetText( rInfo.aMarkTarget ); + m_xCbbTarget->set_entry_text( rInfo.aMarkTarget ); } } -IMPL_LINK( SvxIMapDlg, MousePosHdl, GraphCtrl*, pWnd, void ) +IMPL_LINK( SvxIMapDlg, MousePosHdl, SvxGraphCtrl*, pWnd, void ) { const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit(); const Point& rMousePos = pWnd->GetMousePos(); @@ -660,10 +581,10 @@ IMPL_LINK( SvxIMapDlg, MousePosHdl, GraphCtrl*, pWnd, void ) OUString aStr = GetUnitString( rMousePos.X(), eFieldUnit, cSep ) + " / " + GetUnitString( rMousePos.Y(), eFieldUnit, cSep ); - m_pStbStatus->SetItemText( 2, aStr ); + m_xStbStatus2->set_label(aStr); } -IMPL_LINK( SvxIMapDlg, GraphSizeHdl, GraphCtrl*, pWnd, void ) +IMPL_LINK( SvxIMapDlg, GraphSizeHdl, SvxGraphCtrl*, pWnd, void ) { const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit(); const Size& rSize = pWnd->GetGraphicSize(); @@ -673,30 +594,35 @@ IMPL_LINK( SvxIMapDlg, GraphSizeHdl, GraphCtrl*, pWnd, void ) OUString aStr = GetUnitString( rSize.Width(), eFieldUnit, cSep ) + " x " + GetUnitString( rSize.Height(), eFieldUnit, cSep ); - m_pStbStatus->SetItemText( 3, aStr ); + m_xStbStatus3->set_label(aStr); } - -IMPL_LINK_NOARG(SvxIMapDlg, URLModifyComboBoxHdl, ComboBox&, void) -{ - URLModifyHdl(*m_pURLBox); -} -IMPL_LINK_NOARG(SvxIMapDlg, URLModifyHdl, Edit&, void) +void SvxIMapDlg::URLModify() { NotifyInfo aNewInfo; - aNewInfo.aMarkURL = m_pURLBox->GetText(); - aNewInfo.aMarkAltText = m_pEdtText->GetText(); - aNewInfo.aMarkTarget = m_pCbbTarget->GetText(); + aNewInfo.aMarkURL = m_xURLBox->get_active_text(); + aNewInfo.aMarkAltText = m_xEdtText->get_text(); + aNewInfo.aMarkTarget = m_xCbbTarget->get_active_text(); - pIMapWnd->ReplaceActualIMapInfo( aNewInfo ); + m_xIMapWnd->ReplaceActualIMapInfo( aNewInfo ); } -IMPL_LINK_NOARG(SvxIMapDlg, URLLoseFocusHdl, Control&, void) +IMPL_LINK_NOARG(SvxIMapDlg, URLModifyHdl, weld::ComboBox&, void) +{ + URLModify(); +} + +IMPL_LINK_NOARG(SvxIMapDlg, EntryModifyHdl, weld::Entry&, void) +{ + URLModify(); +} + +IMPL_LINK_NOARG(SvxIMapDlg, URLLoseFocusHdl, weld::Widget&, void) { NotifyInfo aNewInfo; - const OUString aURLText( m_pURLBox->GetText() ); - const OUString aTargetText( m_pCbbTarget->GetText() ); + const OUString aURLText( m_xURLBox->get_active_text() ); + const OUString aTargetText( m_xCbbTarget->get_active_text() ); if ( !aURLText.isEmpty() ) { @@ -708,14 +634,14 @@ IMPL_LINK_NOARG(SvxIMapDlg, URLLoseFocusHdl, Control&, void) else aNewInfo.aMarkURL = aURLText; - aNewInfo.aMarkAltText = m_pEdtText->GetText(); + aNewInfo.aMarkAltText = m_xEdtText->get_text(); if ( aTargetText.isEmpty() ) aNewInfo.aMarkTarget = SELF_TARGET; else aNewInfo.aMarkTarget = aTargetText; - pIMapWnd->ReplaceActualIMapInfo( aNewInfo ); + m_xIMapWnd->ReplaceActualIMapInfo( aNewInfo ); } IMPL_LINK_NOARG(SvxIMapDlg, UpdateHdl, Timer *, void) @@ -724,9 +650,9 @@ IMPL_LINK_NOARG(SvxIMapDlg, UpdateHdl, Timer *, void) if ( pOwnData->pUpdateEditingObject != pCheckObj ) { - if (pIMapWnd->IsChanged()) + if (m_xIMapWnd->IsChanged()) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/querysaveimagemapchangesdialog.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xDialog.get(), "svx/ui/querysaveimagemapchangesdialog.ui")); std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveImageMapChangesDialog")); if (xQBox->run() == RET_YES) { @@ -734,82 +660,73 @@ IMPL_LINK_NOARG(SvxIMapDlg, UpdateHdl, Timer *, void) } } - pIMapWnd->SetGraphic( pOwnData->aUpdateGraphic ); - pIMapWnd->SetImageMap( pOwnData->aUpdateImageMap ); + m_xIMapWnd->SetGraphic( pOwnData->aUpdateGraphic ); + m_xIMapWnd->SetImageMap( pOwnData->aUpdateImageMap ); SetTargetList( pOwnData->aUpdateTargetList ); pCheckObj = pOwnData->pUpdateEditingObject; // After changes => default selection - m_pTbxIMapDlg1->CheckItem( mnSelectId ); - pIMapWnd->SetEditMode( true ); + m_xTbxIMapDlg1->set_item_active("TBI_SELECT", true); + m_xIMapWnd->SetEditMode( true ); } // Delete the copied list again in the Update method pOwnData->aUpdateTargetList.clear(); GetBindings().Invalidate( SID_IMAP_EXEC ); - pIMapWnd->QueueIdleUpdate(); + m_xIMapWnd->QueueIdleUpdate(); } -IMPL_LINK( SvxIMapDlg, StateHdl, GraphCtrl*, pWnd, void ) +IMPL_LINK( SvxIMapDlg, StateHdl, SvxGraphCtrl*, pWnd, void ) { const SdrObject* pObj = pWnd->GetSelectedSdrObject(); const SdrModel* pModel = pWnd->GetSdrModel(); const SdrView* pView = pWnd->GetSdrView(); const bool bPolyEdit = ( pObj != nullptr ) && dynamic_cast<const SdrPathObj*>( pObj) != nullptr; - const bool bDrawEnabled = !( bPolyEdit && m_pTbxIMapDlg1->IsItemChecked( mnPolyEditId ) ); + const bool bDrawEnabled = !( bPolyEdit && m_xTbxIMapDlg1->get_item_active("TBI_POLYEDIT") ); - m_pTbxIMapDlg1->EnableItem( mnApplyId, pOwnData->bExecState && pWnd->IsChanged() ); + m_xTbxIMapDlg1->set_item_sensitive("TBI_APPLY", pOwnData->bExecState && pWnd->IsChanged() ); - m_pTbxIMapDlg1->EnableItem( mnSelectId, bDrawEnabled ); - m_pTbxIMapDlg1->EnableItem( mnRectId, bDrawEnabled ); - m_pTbxIMapDlg1->EnableItem( mnCircleId, bDrawEnabled ); - m_pTbxIMapDlg1->EnableItem( mnPolyId, bDrawEnabled ); - m_pTbxIMapDlg1->EnableItem( mnFreePolyId, bDrawEnabled ); + m_xTbxIMapDlg1->set_item_sensitive("TBI_SELECT", bDrawEnabled); + m_xTbxIMapDlg1->set_item_sensitive("TBI_RECT", bDrawEnabled); + m_xTbxIMapDlg1->set_item_sensitive("TBI_CIRCLE", bDrawEnabled); + m_xTbxIMapDlg1->set_item_sensitive("TBI_POLY", bDrawEnabled); + m_xTbxIMapDlg1->set_item_sensitive("TBI_FREEPOLY", bDrawEnabled); // BezierEditor State - m_pTbxIMapDlg1->EnableItem( mnPolyEditId, bPolyEdit ); - m_pTbxIMapDlg1->EnableItem( mnPolyMoveId, !bDrawEnabled ); - m_pTbxIMapDlg1->EnableItem( mnPolyInsertId, !bDrawEnabled ); - m_pTbxIMapDlg1->EnableItem( mnPolyDeleteId, !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() ); + m_xTbxIMapDlg1->set_item_sensitive( "TBI_POLYEDIT", bPolyEdit ); + m_xTbxIMapDlg1->set_item_sensitive( "TBI_POLYMOVE", !bDrawEnabled ); + m_xTbxIMapDlg1->set_item_sensitive( "TBI_POLYINSERT", !bDrawEnabled ); + m_xTbxIMapDlg1->set_item_sensitive( "TBI_POLYDELETE", !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() ); // Undo/Redo - m_pTbxIMapDlg1->EnableItem( mnUndoId, pModel->HasUndoActions() ); - m_pTbxIMapDlg1->EnableItem( mnRedoId, pModel->HasRedoActions() ); + m_xTbxIMapDlg1->set_item_sensitive( "TBI_UNDO", pModel->HasUndoActions() ); + m_xTbxIMapDlg1->set_item_sensitive( "TBI_REDO", pModel->HasRedoActions() ); if ( bPolyEdit ) { - sal_uInt16 nId = 0; + OString sId; switch( pWnd->GetPolyEditMode() ) { - case SID_BEZIER_MOVE: nId = mnPolyMoveId; break; - case SID_BEZIER_INSERT: nId = mnPolyInsertId; break; + case SID_BEZIER_MOVE: sId = "TBI_POLYMOVE"; break; + case SID_BEZIER_INSERT: sId = "TBI_POLYINSERT"; break; default: break; } - m_pTbxIMapDlg1->CheckItem( nId ); + m_xTbxIMapDlg1->set_item_active(sId, true); } else { - m_pTbxIMapDlg1->CheckItem( mnPolyEditId, false ); - m_pTbxIMapDlg1->CheckItem( mnPolyMoveId ); - m_pTbxIMapDlg1->CheckItem( mnPolyInsertId, false ); + m_xTbxIMapDlg1->set_item_active( "TBI_POLYEDIT", false ); + m_xTbxIMapDlg1->set_item_active( "TBI_POLYMOVE", true); + m_xTbxIMapDlg1->set_item_active( "TBI_POLYINSERT", false ); pWnd->SetPolyEditMode( 0 ); } - pIMapWnd->QueueIdleUpdate(); -} - -IMPL_LINK_NOARG(SvxIMapDlg, MiscHdl, LinkParamNone*, void) -{ - if (m_pTbxIMapDlg1) - { - SvtMiscOptions aMiscOptions; - m_pTbxIMapDlg1->SetOutStyle( aMiscOptions.GetToolboxStyle() ); - } + m_xIMapWnd->QueueIdleUpdate(); } SvxIMapDlg* GetIMapDlg() @@ -817,7 +734,7 @@ SvxIMapDlg* GetIMapDlg() SfxChildWindow* pWnd = nullptr; if (SfxViewFrame::Current() && SfxViewFrame::Current()->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId())) pWnd = SfxViewFrame::Current()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()); - return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetWindow()) : nullptr; + return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetController().get()) : nullptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index f1c19d230ec6..2d0ab179301f 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -55,13 +55,10 @@ using ::com::sun::star::uno::Reference; #define TRANSCOL COL_WHITE -IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XFrame >& rxDocumentFrame ) : - GraphCtrl( pParent, nBits ), - DropTargetHelper( this ), - mxDocumentFrame( rxDocumentFrame ) +IMapWindow::IMapWindow(const Reference< XFrame >& rxDocumentFrame, weld::Dialog* pDialog) + : SvxGraphCtrl(pDialog) + , mxDocumentFrame(rxDocumentFrame) { - SetSdrMode(true); - memset( maItemInfos, 0, sizeof( SfxItemInfo ) ); pIMapPool = new SfxItemPool( "IMapItemPool", SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos ); @@ -70,18 +67,19 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF IMapWindow::~IMapWindow() { - disposeOnce(); -} - -void IMapWindow::dispose() -{ SfxItemPool::Free(pIMapPool); - GraphCtrl::dispose(); } -Size IMapWindow::GetOptimalSize() const +void IMapWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) { - return LogicToPixel(Size(270, 170), MapMode(MapUnit::MapAppFont)); + Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(270, 170), MapMode(MapUnit::MapAppFont))); + pDrawingArea->set_size_request(aSize.Width(), aSize.Height()); + SetOutputSizePixel(aSize); + weld::CustomWidgetController::SetDrawingArea(pDrawingArea); + + SetSdrMode(true); + + mxDropTargetHelper.reset(new IMapDropTargetHelper(*this)); } void IMapWindow::SetImageMap( const ImageMap& rImageMap ) @@ -298,7 +296,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj ) void IMapWindow::InitSdrModel() { - GraphCtrl::InitSdrModel(); + SvxGraphCtrl::InitSdrModel(); SfxItemSet aSet( pModel->GetItemPool() ); @@ -431,22 +429,25 @@ void IMapWindow::SdrObjChanged( const SdrObject& rObj ) } } -void IMapWindow::MouseButtonUp(const MouseEvent& rMEvt) +bool IMapWindow::MouseButtonUp(const MouseEvent& rMEvt) { - GraphCtrl::MouseButtonUp( rMEvt ); + bool bRet = SvxGraphCtrl::MouseButtonUp( rMEvt ); UpdateInfo( true ); + return bRet; } void IMapWindow::MarkListHasChanged() { - GraphCtrl::MarkListHasChanged(); + SvxGraphCtrl::MarkListHasChanged(); UpdateInfo( false ); } SdrObject* IMapWindow::GetHitSdrObj( const Point& rPosPixel ) const { + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + SdrObject* pObj = nullptr; - Point aPt = PixelToLogic( rPosPixel ); + Point aPt = rDevice.PixelToLogic( rPosPixel ); if ( tools::Rectangle( Point(), GetGraphicSize() ).IsInside( aPt ) ) { @@ -486,13 +487,13 @@ IMapObject* IMapWindow::GetIMapObj( const SdrObject* pSdrObj ) return pIMapObj; } -void IMapWindow::Command(const CommandEvent& rCEvt) +bool IMapWindow::ContextMenu(const CommandEvent& rCEvt) { vcl::Region aRegion; if ( rCEvt.GetCommand() == CommandEventId::ContextMenu ) { - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/imapmenu.ui")); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/imapmenu.ui")); mxPopupMenu = xBuilder->weld_menu("menu"); const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); const size_t nMarked = rMarkList.GetMarkCount(); @@ -523,12 +524,30 @@ void IMapWindow::Command(const CommandEvent& rCEvt) mxPopupMenu->set_sensitive("delete", true); } - MenuSelectHdl(mxPopupMenu->popup_at_rect(GetFrameWeld(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); + MenuSelectHdl(mxPopupMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)))); mxPopupMenu.reset(); + + return true; } else - Window::Command(rCEvt); + return CustomWidgetController::ContextMenu(rCEvt); +} + +IMapDropTargetHelper::IMapDropTargetHelper(IMapWindow& rImapWindow) + : DropTargetHelper(rImapWindow.GetDrawingArea()->get_drop_target()) + , m_rImapWindow(rImapWindow) +{ +} + +sal_Int8 IMapDropTargetHelper::AcceptDrop( const AcceptDropEvent& rEvt ) +{ + return m_rImapWindow.AcceptDrop(rEvt); +} + +sal_Int8 IMapDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) +{ + return m_rImapWindow.ExecuteDrop(rEvt); } sal_Int8 IMapWindow::AcceptDrop( const AcceptDropEvent& rEvt ) @@ -540,7 +559,7 @@ sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) { sal_Int8 nRet = DND_ACTION_NONE; - if( IsDropFormatSupported( SotClipboardFormatId::NETSCAPE_BOOKMARK ) ) + if (mxDropTargetHelper->IsDropFormatSupported(SotClipboardFormatId::NETSCAPE_BOOKMARK)) { const OUString aString; INetBookmark aBookMark( aString, aString ); @@ -563,34 +582,27 @@ sal_Int8 IMapWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) return nRet; } -void IMapWindow::RequestHelp( const HelpEvent& rHEvt ) +OUString IMapWindow::RequestHelp(tools::Rectangle& rHelpArea) { - Point aPos = PixelToLogic( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); + OutputDevice& rDevice = GetDrawingArea()->get_ref_device(); + + Point aPos = rDevice.PixelToLogic(rHelpArea.TopLeft()); - if ( Help::IsBalloonHelpEnabled() || Help::IsQuickHelpEnabled() ) + SdrPageView* pPageView = nullptr; + SdrObject* pSdrObj = pView->PickObj(aPos, pView->getHitTolLog(), pPageView); + if (pSdrObj) { - SdrPageView* pPageView = nullptr; - SdrObject* pSdrObj = pView->PickObj(aPos, pView->getHitTolLog(), pPageView); - if (pSdrObj) - { - const IMapObject* pIMapObj = GetIMapObj( pSdrObj ); - OUString aStr; + const IMapObject* pIMapObj = GetIMapObj( pSdrObj ); + OUString aStr; - if ( pIMapObj && !( aStr = pIMapObj->GetURL() ).isEmpty() ) - { - tools::Rectangle aLogicPix( LogicToPixel( tools::Rectangle( Point(), GetGraphicSize() ) ) ); - tools::Rectangle aScreenRect( OutputToScreenPixel( aLogicPix.TopLeft() ), - OutputToScreenPixel( aLogicPix.BottomRight() ) ); - - if ( Help::IsBalloonHelpEnabled() ) - Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), aScreenRect, aStr ); - else if ( Help::IsQuickHelpEnabled() ) - Help::ShowQuickHelp( this, aScreenRect, aStr ); - } + if ( pIMapObj && !( aStr = pIMapObj->GetURL() ).isEmpty() ) + { + rHelpArea = rDevice.LogicToPixel(tools::Rectangle( Point(), GetGraphicSize())); + return aStr; } - else - Window::RequestHelp( rHEvt ); } + + return OUString(); } void IMapWindow::SetCurrentObjState( bool bActive ) @@ -671,7 +683,7 @@ void IMapWindow::DoMacroAssign() aSet.Put( aMacroItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(GetFrameWeld(), aSet, mxDocumentFrame)); + ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog(GetDrawingArea(), aSet, mxDocumentFrame)); if ( pMacroDlg->Execute() == RET_OK ) { @@ -690,7 +702,7 @@ void IMapWindow::DoPropertyDialog() { IMapObject* pIMapObj = GetIMapObj( pSdrObj ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog(GetFrameWeld(), pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(), + ScopedVclPtr<AbstractURLDlg> aDlg(pFact->CreateURLDialog(GetDrawingArea(), pIMapObj->GetURL(), pIMapObj->GetAltText(), pIMapObj->GetDesc(), pIMapObj->GetTarget(), pIMapObj->GetName(), aTargetList)); if ( aDlg->Execute() == RET_OK ) { diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index 049eb88cea39..8c18140dd8c7 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -68,7 +68,20 @@ public: void ReplaceObject( const IMapObjectPtr& pNewIMapObject ) { mpObj = pNewIMapObject; } }; -class IMapWindow final : public GraphCtrl, public DropTargetHelper +class IMapWindow; + +class IMapDropTargetHelper final : public DropTargetHelper +{ + IMapWindow& m_rImapWindow; +public: + IMapDropTargetHelper(IMapWindow& rImapWindow); + + // DropTargetHelper + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; +}; + +class IMapWindow final : public SvxGraphCtrl { NotifyInfo aInfo; ImageMap aIMap; @@ -78,25 +91,21 @@ class IMapWindow final : public GraphCtrl, public DropTargetHelper SfxItemInfo maItemInfos[1]; css::uno::Reference< css::frame::XFrame > mxDocumentFrame; - + std::unique_ptr<IMapDropTargetHelper> mxDropTargetHelper; std::unique_ptr<weld::Menu> mxPopupMenu; void MenuSelectHdl(const OString& rId); - // GraphCtrl - virtual void MouseButtonUp(const MouseEvent& rMEvt) override; - virtual Size GetOptimalSize() const override; - virtual void Command(const CommandEvent& rCEvt) override; - virtual void RequestHelp( const HelpEvent& rHEvt ) override; + // SvxGraphCtrl + virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; + virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + virtual bool ContextMenu(const CommandEvent& rCEvt) override; + virtual OUString RequestHelp(tools::Rectangle& rHelpArea) override; virtual void SdrObjCreated( const SdrObject& rObj ) override; virtual void SdrObjChanged( const SdrObject& rObj ) override; virtual void MarkListHasChanged() override; virtual void InitSdrModel() override; - // DropTargetHelper - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; - void ReplaceImageMap( const ImageMap& rNewImageMap ); SdrObject* CreateObj( const IMapObject* pIMapObj ); @@ -107,9 +116,12 @@ class IMapWindow final : public GraphCtrl, public DropTargetHelper public: - IMapWindow( vcl::Window* pParent, WinBits nBits, const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame ); - virtual ~IMapWindow() override; - virtual void dispose() override; + IMapWindow(const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame, + weld::Dialog* pDialog); + virtual ~IMapWindow() override; + + sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); + sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); void ReplaceActualIMapInfo( const NotifyInfo& rNewInfo ); diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index 256aa005528b..839be000cb1b 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -527,7 +527,7 @@ bool FmFormView::checkUnMarkAll(const Reference< XInterface >& _xSource) } -bool FmFormView::MouseButtonDown( const MouseEvent& _rMEvt, vcl::Window* _pWin ) +bool FmFormView::MouseButtonDown( const MouseEvent& _rMEvt, OutputDevice* _pWin ) { bool bReturn = E3dView::MouseButtonDown( _rMEvt, _pWin ); diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx b/svx/source/inc/GraphCtlAccessibleContext.hxx index 51814d181ac6..ade908906b99 100644 --- a/svx/source/inc/GraphCtlAccessibleContext.hxx +++ b/svx/source/inc/GraphCtlAccessibleContext.hxx @@ -54,7 +54,7 @@ namespace com { namespace sun { namespace star { namespace awt { } } } } namespace tools { class Rectangle; } -class GraphCtrl; +class SvxGraphCtrl; class SdrObject; class SdrModel; class SdrPage; @@ -80,12 +80,10 @@ class SvxGraphCtrlAccessibleContext final : public SfxListener, public ::accessibility::IAccessibleViewForwarder { public: - friend class GraphCtrl; + friend class SvxGraphCtrl; // internal - SvxGraphCtrlAccessibleContext( - const css::uno::Reference< css::accessibility::XAccessible>& rxParent, - GraphCtrl& rRepresentation ); + SvxGraphCtrlAccessibleContext(SvxGraphCtrl& rRepresentation); void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ) override; @@ -158,22 +156,6 @@ private: /// @throws css::lang::IndexOutOfBoundsException void checkChildIndexOnSelection( long nIndexOfChild ); - /** Return the object's current bounding box relative to the desktop, - i.e in absolute pixel coordinates. - @return - The returned rectangle is a bounding box of the object given in - absolute screen coordinates. - @throws DisposedException - When the object is already disposed then a - <type>DisposedException</type> is thrown. - */ - tools::Rectangle GetBoundingBoxOnScreen(); - - /// Return the object's current bounding box relative to the parent object. - /// - /// @throws css::uno::RuntimeException - tools::Rectangle GetBoundingBox(); - virtual void SAL_CALL disposing() final override; /// @throws css::uno::RuntimeException @@ -186,9 +168,6 @@ private: ::accessibility::AccessibleShapeTreeInfo maTreeInfo; - /// Reference to the parent object. - css::uno::Reference<css::accessibility::XAccessible> mxParent; - /** Description of this object. This is not a constant because it can be set from the outside. */ @@ -202,7 +181,7 @@ private: typedef ::std::map< const SdrObject*, rtl::Reference<::accessibility::AccessibleShape> > ShapesMapType; ShapesMapType mxShapes; - VclPtr<GraphCtrl> mpControl; + SvxGraphCtrl* mpControl; SdrModel* mpModel; SdrPage* mpPage; diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index cae3610c839f..126caea8cdf1 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -432,7 +432,7 @@ void SdrPageWindow::InvalidatePageWindow(const basegfx::B2DRange& rRange) const bool bWasMapModeEnabled(rWindow.IsMapModeEnabled()); rWindow.EnableMapMode(false); - SdrPaintView::InvalidateWindow(aVCLDiscreteRectangle, rWindow); + GetPageView().GetView().InvalidateWindow(aVCLDiscreteRectangle, rWindow); rWindow.EnableMapMode(bWasMapModeEnabled); } else if (comphelper::LibreOfficeKit::isActive()) diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index f160ff2341c3..7adda28c0e84 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -225,7 +225,7 @@ rtl::Reference<sdr::overlay::OverlayManager> SdrPaintView::CreateOverlayManager( return xOverlayManager; } -void SdrPaintView::InvalidateWindow(const tools::Rectangle& rArea, OutputDevice& rDevice) +void SdrPaintView::InvalidateWindow(const tools::Rectangle& rArea, OutputDevice& rDevice) const { vcl::Window& rWindow(static_cast<vcl::Window&>(rDevice)); rWindow.Invalidate(rArea, InvalidateFlags::NoErase); diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 235ad5b4234f..14abc87437ad 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -306,7 +306,7 @@ void SdrCreateView::HideConnectMarker() ImpClearConnectMarker(); } -bool SdrCreateView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrCreateView::MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) { if(CheckEdgeMode() && pWin) { diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index c67ae8fffad1..8935d2702804 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1790,7 +1790,7 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) return SdrGlueEditView::KeyInput(rKEvt,pWin); } -bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) { if (pTextEditOutlinerView!=nullptr) { bool bPostIt=pTextEditOutliner->IsInSelectionMode(); @@ -1813,7 +1813,8 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) MouseEvent aMEvt(aPixPos,rMEvt.GetClicks(),rMEvt.GetMode(), rMEvt.GetButtons(),rMEvt.GetModifier()); if (pTextEditOutlinerView->MouseButtonDown(aMEvt)) { - if (pWin!=nullptr && pWin!=pTextEditWin) SetTextEditWin(pWin); + if (pWin!=nullptr && pWin!=pTextEditWin && pWin->GetOutDevType() == OUTDEV_WINDOW) + SetTextEditWin(static_cast<vcl::Window*>(pWin)); #ifdef DBG_UTIL if (mpItemBrowser!=nullptr) mpItemBrowser->SetDirty(); #endif @@ -1825,7 +1826,7 @@ bool SdrObjEditView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) return SdrGlueEditView::MouseButtonDown(rMEvt,pWin); } -bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) { if (pTextEditOutlinerView!=nullptr) { bool bPostIt=pTextEditOutliner->IsInSelectionMode(); @@ -1856,7 +1857,7 @@ bool SdrObjEditView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) return SdrGlueEditView::MouseButtonUp(rMEvt,pWin); } -bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) { if (pTextEditOutlinerView!=nullptr) { bool bSelMode=pTextEditOutliner->IsInSelectionMode(); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 5762ccb8eb77..fa4ea376ae90 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1184,7 +1184,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) } /** handle mouse over effects for handles */ -bool SdrMarkView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrMarkView::MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) { if(maHdlList.GetHdlCount()) { diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index 7c7f8289a053..1966875a863e 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -203,7 +203,7 @@ bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) return bRet; } -bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) { SetActualWin(pWin); if (rMEvt.IsLeft()) maDragStat.SetMouseDown(true); @@ -216,7 +216,7 @@ bool SdrView::MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) return bRet; } -bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) { SetActualWin(pWin); if (rMEvt.IsLeft()) maDragStat.SetMouseDown(false); @@ -230,7 +230,7 @@ bool SdrView::MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) return bRet; } -bool SdrView::MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) +bool SdrView::MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) { SetActualWin(pWin); maDragStat.SetMouseDown(rMEvt.IsLeft()); diff --git a/svx/uiconfig/ui/imapdialog.ui b/svx/uiconfig/ui/imapdialog.ui index 380d40d461ef..d64c38b22336 100644 --- a/svx/uiconfig/ui/imapdialog.ui +++ b/svx/uiconfig/ui/imapdialog.ui @@ -1,395 +1,530 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.22.1 --> <interface domain="svx"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> - <object class="GtkWindow" id="ImapDialog"> + <object class="GtkDialog" id="ImapDialog"> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="border_width">6</property> - <property name="title" translatable="yes" context="imapdialog|ImapDialog">ImageMap Editor</property> + <property name="default_width">0</property> + <property name="default_height">0</property> + <property name="type_hint">dialog</property> <child> - <object class="GtkBox" id="mainbox"> + <placeholder/> + </child> + <child internal-child="vbox"> + <object class="GtkBox"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <child> - <object class="GtkToolbar" id="toolbar"> + <child internal-child="action_area"> + <object class="GtkButtonBox"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> + <property name="layout_style">end</property> <child> - <object class="GtkToolButton" id="TBI_APPLY"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_APPLY</property> - <property name="label" translatable="yes" context="imapdialog|TBI_APPLY">Apply</property> - <property name="icon_name">svx/res/id01.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_OPEN"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_OPEN</property> - <property name="label" translatable="yes" context="imapdialog|TBI_OPEN">Open...</property> - <property name="icon_name">svx/res/id02.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_SAVEAS"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_SAVEAS</property> - <property name="label" translatable="yes" context="imapdialog|TBI_SAVEAS">Save...</property> - <property name="icon_name">svx/res/id03.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_CLOSE"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_CLOSE</property> - <property name="label" translatable="yes" context="imapdialog|TBI_CLOSE">Close</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_SELECT"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_SELECT</property> - <property name="label" translatable="yes" context="imapdialog|TBI_SELECT">Select</property> - <property name="icon_name">svx/res/id04.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_RECT"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_RECT</property> - <property name="label" translatable="yes" context="imapdialog|TBI_RECT">Rectangle</property> - <property name="icon_name">svx/res/id05.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_CIRCLE"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_CIRCLE</property> - <property name="label" translatable="yes" context="imapdialog|TBI_CIRCLE">Ellipse</property> - <property name="icon_name">svx/res/id06.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_POLY"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_POLY</property> - <property name="label" translatable="yes" context="imapdialog|TBI_POLY">Polygon</property> - <property name="icon_name">svx/res/id07.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_FREEPOLY"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_FREEPOLY</property> - <property name="label" translatable="yes" context="imapdialog|TBI_FREEPOLY">Freeform Polygon</property> - <property name="icon_name">svx/res/id08.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_POLYEDIT"> + <object class="GtkStatusbar" id="statusbar"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_POLYEDIT</property> - <property name="label" translatable="yes" context="imapdialog|TBI_POLYEDIT">Edit Points</property> - <property name="icon_name">svx/res/id030.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_POLYMOVE"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_POLYMOVE</property> - <property name="label" translatable="yes" context="imapdialog|TBI_POLYMOVE">Move Points</property> - <property name="icon_name">svx/res/id031.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_POLYINSERT"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_POLYINSERT</property> - <property name="label" translatable="yes" context="imapdialog|TBI_POLYINSERT">Insert Points</property> - <property name="icon_name">svx/res/id032.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_POLYDELETE"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_POLYDELETE</property> - <property name="label" translatable="yes" context="imapdialog|TBI_POLYDELETE">Delete Points</property> - <property name="icon_name">svx/res/id033.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_UNDO"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_UNDO</property> - <property name="label" translatable="yes" context="imapdialog|TBI_UNDO">Undo </property> - <property name="icon_name">svx/res/id040.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_REDO"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_REDO</property> - <property name="label" translatable="yes" context="imapdialog|TBI_REDO">Redo</property> - <property name="icon_name">svx/res/id041.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_ACTIVE"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_ACTIVE</property> - <property name="label" translatable="yes" context="imapdialog|TBI_ACTIVE">Active</property> - <property name="icon_name">svx/res/id016.png</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="TBI_MACRO"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_MACRO</property> - <property name="label" translatable="yes" context="imapdialog|TBI_MACRO">Macro...</property> - <property name="icon_name">svx/res/id018.png</property> + <property name="valign">end</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="statussize"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label">100%</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSeparator" id="separator4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="statuspos"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label">100%</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkSeparator" id="separator5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="statusurl"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label">100%</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">end</property> + <property name="position">4</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkToolButton" id="TBI_PROPERTY"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="valign">start</property> - <property name="action_name">TBI_PROPERTY</property> - <property name="label" translatable="yes" context="imapdialog|TBI_PROPERTY">Properties...</property> - <property name="icon_name">svx/res/id019.png</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> + <property name="pack_type">end</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkGrid" id="grid1"> + <object class="GtkBox" id="mainbox"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="urlft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes" context="imapdialog|urlft">Address:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">url</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> - <object class="svtlo-SvtURLBox" id="url"> + <object class="GtkToolbar" id="toolbar"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="hexpand">True</property> + <property name="toolbar_style">icons</property> + <property name="show_arrow">False</property> + <property name="icon_size">1</property> + <child> + <object class="GtkToolButton" id="TBI_APPLY"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_APPLY">Apply</property> + <property name="icon_name">svx/res/id01.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_OPEN"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_OPEN">Open...</property> + <property name="icon_name">svx/res/id02.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_SAVEAS"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_SAVEAS">Save...</property> + <property name="icon_name">svx/res/id03.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_CLOSE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_CLOSE">Close</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_SELECT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_SELECT">Select</property> + <property name="icon_name">svx/res/id04.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_RECT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_RECT">Rectangle</property> + <property name="icon_name">svx/res/id05.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_CIRCLE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_CIRCLE">Ellipse</property> + <property name="icon_name">svx/res/id06.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_POLY"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_POLY">Polygon</property> + <property name="icon_name">svx/res/id07.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_FREEPOLY"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_FREEPOLY">Freeform Polygon</property> + <property name="icon_name">svx/res/id08.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_POLYEDIT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_POLYEDIT">Edit Points</property> + <property name="icon_name">svx/res/id030.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_POLYMOVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_POLYMOVE">Move Points</property> + <property name="icon_name">svx/res/id031.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_POLYINSERT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_POLYINSERT">Insert Points</property> + <property name="icon_name">svx/res/id032.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_POLYDELETE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_POLYDELETE">Delete Points</property> + <property name="icon_name">svx/res/id033.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_UNDO"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_UNDO">Undo </property> + <property name="icon_name">svx/res/id040.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_REDO"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_REDO">Redo</property> + <property name="icon_name">svx/res/id041.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToggleToolButton" id="TBI_ACTIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_ACTIVE">Active</property> + <property name="icon_name">svx/res/id016.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_MACRO"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_MACRO">Macro...</property> + <property name="icon_name">svx/res/id018.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="TBI_PROPERTY"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="label" translatable="yes" context="imapdialog|TBI_PROPERTY">Properties...</property> + <property name="icon_name">svx/res/id019.png</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">False</property> + </packing> + </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkGrid" id="grid2"> + <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkLabel" id="targetft"> + <object class="GtkLabel" id="urlft"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="label" translatable="yes" context="imapdialog|targetft">Frame:</property> + <property name="label" translatable="yes" context="imapdialog|urlft">Address:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">target</property> + <property name="mnemonic_widget">url</property> </object> <packing> - <property name="left_attach">1</property> + <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkEntry" id="text"> + <object class="GtkGrid" id="grid2"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can_focus">False</property> <property name="hexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="targetft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes" context="imapdialog|targetft">Frame:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">target</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="text"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="activates_default">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="target"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">True</property> + <property name="activates_default">True</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="textft"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label" translatable="yes" context="imapdialog|textft">Text:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">text</property> </object> <packing> <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="top_attach">1</property> </packing> </child> <child> - <object class="GtkComboBox" id="target"> + <object class="GtkComboBoxText" id="url"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="has_entry">True</property> <child internal-child="entry"> - <object class="GtkEntry" id="combobox-entry"> + <object class="GtkEntry"> <property name="can_focus">True</property> + <property name="activates_default">True</property> </object> </child> </object> <packing> - <property name="left_attach">2</property> + <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> <child> - <object class="GtkLabel" id="textft"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="label" translatable="yes" context="imapdialog|textft">Text:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">text</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkDrawingArea" id="container"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + </child> + </object> + </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> @@ -399,37 +534,10 @@ <property name="position">1</property> </packing> </child> - <child> - <object class="GtkBox" id="container:border"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="svxlo-StatusBar" id="statusbar"> - <property name="height_request">25</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> </object> </child> + <action-widgets> + <action-widget response="-6">cancel</action-widget> + </action-widgets> </object> </interface> diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 96e4c0145703..b957769db3b7 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -146,7 +146,7 @@ namespace SvxIMapDlg* GetIMapDlg(SwView const &rView) { SfxChildWindow* pWnd = rView.GetViewFrame()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()); - return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetWindow()) : nullptr; + return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetController().get()) : nullptr; } } @@ -1300,7 +1300,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void) SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ? pVFrame->GetChildWindow(nId) : nullptr; SvxIMapDlg *pDlg = pChildWindow ? - static_cast<SvxIMapDlg*>(pChildWindow->GetWindow()) : nullptr; + static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr; if( pDlg && ( SID_IMAP_EXEC == nSlot || ( SID_IMAP == nSlot && !bProtect)) && @@ -1322,7 +1322,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void) SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ? pVFrame->GetChildWindow(nId) : nullptr; SvxIMapDlg *pDlg = pChildWindow ? - static_cast<SvxIMapDlg*>(pChildWindow->GetWindow()) : nullptr; + static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr; if( pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor() ) lcl_UpdateContourDlg( rSh, SelectionType::Graphic ); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index b55b735f0f8f..9c8ccc804953 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -867,6 +867,58 @@ public: } }; +class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar +{ +private: + VclPtr<ToolBox> m_xToolBox; + + DECL_LINK(ClickHdl, ToolBox*, void); +public: + SalInstanceToolbar(ToolBox* pToolBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceWidget(pToolBox, pBuilder, bTakeOwnership) + , m_xToolBox(pToolBox) + { + m_xToolBox->SetSelectHdl(LINK(this, SalInstanceToolbar, ClickHdl)); + } + + virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override + { + m_xToolBox->EnableItem(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)), bSensitive); + } + + virtual bool get_item_sensitive(const OString& rIdent) const override + { + return m_xToolBox->IsItemEnabled(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent))); + } + + virtual void set_item_active(const OString& rIdent, bool bActive) override + { + m_xToolBox->CheckItem(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent)), bActive); + } + + virtual bool get_item_active(const OString& rIdent) const override + { + return m_xToolBox->IsItemChecked(m_xToolBox->GetItemId(OUString::fromUtf8(rIdent))); + } + + virtual void insert_separator(int pos, const OUString& /*rId*/) override + { + auto nInsertPos = pos == -1 ? ToolBox::APPEND : pos; + m_xToolBox->InsertSeparator(nInsertPos, 5); + } + + virtual ~SalInstanceToolbar() override + { + m_xToolBox->SetSelectHdl(Link<ToolBox*, void>()); + } +}; + +IMPL_LINK_NOARG(SalInstanceToolbar, ClickHdl, ToolBox*, void) +{ + sal_uInt16 nItemId = m_xToolBox->GetCurItemId(); + signal_clicked(m_xToolBox->GetItemCommand(nItemId).toUtf8()); +} + class SalInstanceSizeGroup : public weld::SizeGroup { private: @@ -4261,9 +4313,9 @@ public: weld::Widget::connect_key_release(rLink); } - virtual void set_text_cursor() override + virtual void set_cursor(PointerStyle ePointerStyle) override { - m_xDrawingArea->SetPointer(PointerStyle::Text); + m_xDrawingArea->SetPointer(ePointerStyle); } virtual a11yref get_accessible_parent() override @@ -5108,6 +5160,12 @@ public: return pMenu ? std::make_unique<SalInstanceMenu>(pMenu, bTakeOwnership) : nullptr; } + virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString &id, bool bTakeOwnership) override + { + ToolBox* pToolBox = m_xBuilder->get<ToolBox>(id); + return pToolBox ? std::make_unique<SalInstanceToolbar>(pToolBox, this, bTakeOwnership) : nullptr; + } + virtual std::unique_ptr<weld::SizeGroup> create_size_group() override { return std::make_unique<SalInstanceSizeGroup>(); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index fe67aec4b06b..3e0aabd0a4ca 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2161,6 +2161,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & nItemId = pToolBox->GetItemCount() + 1; //TODO: ImplToolItems::size_type -> sal_uInt16! pToolBox->InsertItem(nItemId, extractLabel(rMap), nBits); + if (aCommand.isEmpty() && !m_bLegacy) + aCommand = OUString::fromUtf8(id); pToolBox->SetItemCommand(nItemId, aCommand); } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 0d60969bff8d..d29fa4f4ef1a 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -5331,6 +5331,100 @@ public: } }; +class GtkInstanceToolbar : public GtkInstanceWidget, public virtual weld::Toolbar +{ +private: + GtkToolbar* m_pToolbar; + + std::map<OString, GtkToolButton*> m_aMap; + + static void collect(GtkWidget* pItem, gpointer widget) + { + GtkToolButton* pToolItem = GTK_TOOL_BUTTON(pItem); + GtkInstanceToolbar* pThis = static_cast<GtkInstanceToolbar*>(widget); + pThis->add_to_map(pToolItem); + } + + void add_to_map(GtkToolButton* pToolItem) + { + const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pToolItem)); + OString id(pStr, pStr ? strlen(pStr) : 0); + m_aMap[id] = pToolItem; + g_signal_connect(pToolItem, "clicked", G_CALLBACK(signalItemClicked), this); + } + + static void signalItemClicked(GtkToolButton* pItem, gpointer widget) + { + GtkInstanceToolbar* pThis = static_cast<GtkInstanceToolbar*>(widget); + SolarMutexGuard aGuard; + pThis->signal_item_clicked(pItem); + } + + void signal_item_clicked(GtkToolButton* pItem) + { + const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pItem)); + signal_clicked(OString(pStr, pStr ? strlen(pStr) : 0)); + } + +public: + GtkInstanceToolbar(GtkToolbar* pToolbar, GtkInstanceBuilder* pBuilder, bool bTakeOwnership) + : GtkInstanceWidget(GTK_WIDGET(pToolbar), pBuilder, bTakeOwnership) + , m_pToolbar(pToolbar) + { + gtk_container_foreach(GTK_CONTAINER(pToolbar), collect, this); + } + + void disable_item_notify_events() + { + for (auto& a : m_aMap) + g_signal_handlers_block_by_func(a.second, reinterpret_cast<void*>(signalItemClicked), this); + } + + void enable_item_notify_events() + { + for (auto& a : m_aMap) + g_signal_handlers_unblock_by_func(a.second, reinterpret_cast<void*>(signalItemClicked), this); + } + + virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override + { + disable_item_notify_events(); + gtk_widget_set_sensitive(GTK_WIDGET(m_aMap[rIdent]), bSensitive); + enable_item_notify_events(); + } + + virtual bool get_item_sensitive(const OString& rIdent) const override + { + return gtk_widget_get_sensitive(GTK_WIDGET(m_aMap.find(rIdent)->second)); + } + + virtual void set_item_active(const OString& rIdent, bool bActive) override + { + disable_item_notify_events(); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(m_aMap[rIdent]), bActive); + enable_item_notify_events(); + } + + virtual bool get_item_active(const OString& rIdent) const override + { + return gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(m_aMap.find(rIdent)->second)); + } + + virtual void insert_separator(int pos, const OUString& rId) override + { + GtkToolItem* pItem = gtk_separator_tool_item_new(); + gtk_buildable_set_name(GTK_BUILDABLE(pItem), OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr()); + gtk_toolbar_insert(m_pToolbar, pItem, pos); + gtk_widget_show(GTK_WIDGET(pItem)); + } + + virtual ~GtkInstanceToolbar() override + { + for (auto& a : m_aMap) + g_signal_handlers_disconnect_by_data(a.second, this); + } +}; + class GtkInstanceLinkButton : public GtkInstanceContainer, public virtual weld::LinkButton { private: @@ -8445,9 +8539,10 @@ public: m_xDevice->EnableRTL(bRTL); } - virtual void set_text_cursor() override + virtual void set_cursor(PointerStyle ePointerStyle) override { - set_cursor(GTK_WIDGET(m_pDrawingArea), "text"); + GdkCursor *pCursor = GtkSalFrame::getDisplay()->getCursor(ePointerStyle); + gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(m_pDrawingArea)), pCursor); } virtual void queue_draw() override @@ -10231,6 +10326,15 @@ public: return std::make_unique<GtkInstanceMenu>(pMenu, bTakeOwnership); } + virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString &id, bool bTakeOwnership) override + { + GtkToolbar* pToolbar = GTK_TOOLBAR(gtk_builder_get_object(m_pBuilder, id.getStr())); + if (!pToolbar) + return nullptr; + auto_add_parentless_widgets_to_container(GTK_WIDGET(pToolbar)); + return std::make_unique<GtkInstanceToolbar>(pToolbar, this, bTakeOwnership); + } + virtual std::unique_ptr<weld::SizeGroup> create_size_group() override { return std::make_unique<GtkInstanceSizeGroup>(); |