summaryrefslogtreecommitdiff
path: root/cui/source/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-15 10:06:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-15 16:51:25 +0100
commitfafd25e4b6c7ee7d6e47791bb37d3a242d7c4a16 (patch)
tree48a1e8e6c4ff2ad8dcc601958edbfd1b890eb251 /cui/source/inc
parentde6b9cd633e41f2a38f437143fb40c6e0a1d337d (diff)
Resolves: tdf#128802 manage dnd ourself
instead of relying on the built-in dnd which is allowing toplevel entries to be dropped on other ones to become children of another entry, which is not what we want here. Change-Id: I8c5528d9b26e994b7eda9d2972af0b3783187f3e Reviewed-on: https://gerrit.libreoffice.org/82770 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source/inc')
-rw-r--r--cui/source/inc/SvxMenuConfigPage.hxx2
-rw-r--r--cui/source/inc/SvxToolbarConfigPage.hxx2
-rw-r--r--cui/source/inc/cfg.hxx18
3 files changed, 20 insertions, 2 deletions
diff --git a/cui/source/inc/SvxMenuConfigPage.hxx b/cui/source/inc/SvxMenuConfigPage.hxx
index 881f805fe097..5ff3aea6b0ba 100644
--- a/cui/source/inc/SvxMenuConfigPage.hxx
+++ b/cui/source/inc/SvxMenuConfigPage.hxx
@@ -45,7 +45,7 @@ private:
DECL_LINK( MenuEntriesSizeAllocHdl, const Size&, void );
- DECL_LINK( ListModifiedHdl, weld::TreeView&, void );
+ virtual void ListModified() override;
void Init() override;
void UpdateButtonStates() override;
diff --git a/cui/source/inc/SvxToolbarConfigPage.hxx b/cui/source/inc/SvxToolbarConfigPage.hxx
index 54204676456c..542eee2006d1 100644
--- a/cui/source/inc/SvxToolbarConfigPage.hxx
+++ b/cui/source/inc/SvxToolbarConfigPage.hxx
@@ -45,7 +45,7 @@ private:
DECL_LINK( ModifyItemHdl, const OString&, void );
DECL_LINK( ResetToolbarHdl, weld::Button&, void );
- DECL_LINK( ListModifiedHdl, weld::TreeView&, void );
+ virtual void ListModified() override;
void UpdateButtonStates() override;
short QueryReset() override;
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 71a36bdbf575..93f4346aa15f 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -19,6 +19,7 @@
#ifndef INCLUDED_CUI_SOURCE_INC_CFG_HXX
#define INCLUDED_CUI_SOURCE_INC_CFG_HXX
+#include <vcl/transfer.hxx>
#include <vcl/weld.hxx>
#include <svtools/valueset.hxx>
@@ -329,6 +330,7 @@ public:
void remove(int nPos) { m_xControl->remove(nPos); }
int n_children() const { return m_xControl->n_children(); }
void set_text(int row, const OUString& rText, int col) { m_xControl->set_text(row, rText, col); }
+ OUString get_text(int row) { return m_xControl->get_text(row); }
void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) { m_xControl->set_image(row, rImage, col); }
void set_dropdown(int row, int col) { m_xControl->set_image(row, *m_xDropDown, col); }
void set_id(int row, const OUString& rId) { m_xControl->set_id(row, rId); }
@@ -350,6 +352,19 @@ public:
void CreateDropDown();
};
+class SvxConfigPageFunctionDropTarget : public DropTargetHelper
+{
+private:
+ SvxConfigPage& m_rPage;
+ weld::TreeView& m_rTreeView;
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+public:
+ SvxConfigPageFunctionDropTarget(SvxConfigPage&rPage, weld::TreeView& rTreeView);
+};
+
class SvxConfigPage : public SfxTabPage
{
private:
@@ -387,6 +402,7 @@ protected:
// Used to add and remove toolbars/menus
std::unique_ptr<weld::MenuButton> m_xGearBtn;
std::unique_ptr<SvxMenuEntriesListBox> m_xContentsListBox;
+ std::unique_ptr<SvxConfigPageFunctionDropTarget> m_xDropTargetHelper;
std::unique_ptr<weld::Button> m_xMoveUpButton;
std::unique_ptr<weld::Button> m_xMoveDownButton;
@@ -462,6 +478,8 @@ public:
virtual void DeleteSelectedContent() = 0;
virtual void DeleteSelectedTopLevel() = 0;
+ virtual void ListModified() {}
+
SvxConfigEntry* GetTopLevelSelection()
{
return reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_active_id().toInt64());