[Libreoffice-commits] core.git: cui/source include/svtools include/svx include/vcl sc/source sd/source solenv/sanitizers svtools/source svx/source svx/uiconfig sw/source vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri May 17 10:44:09 UTC 2019
cui/source/dialogs/cuiimapwnd.cxx | 2
cui/source/factory/dlgfact.cxx | 4
cui/source/factory/dlgfact.hxx | 4
cui/source/inc/cuiimapwnd.hxx | 2
cui/source/inc/macroass.hxx | 2
cui/source/tabpages/macroass.cxx | 2
include/svtools/inettbc.hxx | 44
include/svx/fmview.hxx | 2
include/svx/graphctl.hxx | 128 ++
include/svx/imapdlg.hxx | 81 -
include/svx/svdcrtv.hxx | 2
include/svx/svdedxv.hxx | 6
include/svx/svdmrkv.hxx | 2
include/svx/svdpntv.hxx | 10
include/svx/svdview.hxx | 6
include/svx/svxdlg.hxx | 6
include/vcl/customweld.hxx | 1
include/vcl/weld.hxx | 24
sc/source/ui/pagedlg/tphfedit.cxx | 2
sd/source/ui/dlg/PhotoAlbumDialog.cxx | 1
sd/source/ui/dlg/vectdlg.cxx | 2
solenv/sanitizers/ui/svx.suppr | 3
svtools/source/control/inettbc.cxx | 1
svtools/source/control/valueacc.cxx | 3
svx/source/accessibility/GraphCtlAccessibleContext.cxx | 160 +--
svx/source/dialog/ClassificationEditView.cxx | 2
svx/source/dialog/graphctl.cxx | 771 ++++++++++++++++
svx/source/dialog/imapdlg.cxx | 569 +++++-------
svx/source/dialog/imapwnd.cxx | 108 +-
svx/source/dialog/imapwnd.hxx | 40
svx/source/form/fmview.cxx | 2
svx/source/inc/GraphCtlAccessibleContext.hxx | 29
svx/source/svdraw/sdrpagewindow.cxx | 2
svx/source/svdraw/sdrpaintwindow.cxx | 2
svx/source/svdraw/svdcrtv.cxx | 2
svx/source/svdraw/svdedxv.cxx | 9
svx/source/svdraw/svdmrkv.cxx | 2
svx/source/svdraw/svdview.cxx | 6
svx/uiconfig/ui/imapdialog.ui | 778 +++++++++--------
sw/source/uibase/shells/basesh.cxx | 6
vcl/source/app/salvtables.cxx | 62 +
vcl/source/window/builder.cxx | 2
vcl/unx/gtk3/gtk3gtkinst.cxx | 108 ++
43 files changed, 2007 insertions(+), 993 deletions(-)
New commits:
commit 8a35ae3e6c5c45aa1426cfd81472b309d02a1b48
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 16 15:17:38 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 17 12:43:13 2019 +0200
weld SvxIMapDlg
Change-Id: I5418176a015e61ef8eee4c2acd8e84b008f76f82
Reviewed-on: https://gerrit.libreoffice.org/72249
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 );
- else
- aGraphSize = OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), aGraphic.GetPrefMapMode(), aMap100 );
+void SvxGraphCtrl::MarkListHasChanged()
+{
+ QueueIdleUpdate();
+}
- Invalidate();
+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
+ weld::CustomWidgetController::MouseButtonDown( rMEvt );
+
+ 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 );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list