sd/source/ui/dlg/custsdlg.cxx | 34 ++++++++++++++++++++++++++++++++++ sd/source/ui/inc/custsdlg.hxx | 14 ++++++++++++++ sw/source/uibase/utlui/content.cxx | 22 +++++++++------------- 3 files changed, 57 insertions(+), 13 deletions(-)
New commits: commit e0fa72a714c1992370f023308814acf96763e2c9 Author: Jim Raykowski <[email protected]> AuthorDate: Mon Nov 1 21:43:08 2021 -0800 Commit: Jim Raykowski <[email protected]> CommitDate: Tue Nov 2 17:13:25 2021 +0100 SwNavigator: Make list of open files in Display sub menu consistent with list of open files in open files list box This patch makes the display format used for the list of open files in the content tree context menu 'Display' sub menu consistent with the display format used for the list of open files in the open files list box by adding '(inactive)' after the file name of an inactive file and removing the space after the open parenthesis and before the closing parenthesis surrounding the word 'hidden' for the hidden shell file. Change-Id: I91670377fae576cab6f013ed6f2eb3d0e6a88eaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124580 Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index eca4fd28b4b3..e813826fb154 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1567,18 +1567,14 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) xSubPop2->set_active(OString::number(201 + static_cast<int>(GetParentWindow()->GetRegionDropMode())), true); // Insert the list of the open files + { sal_uInt16 nId = 301; - const SwView* pActiveView = ::GetActiveView(); SwView *pView = SwModule::GetFirstView(); while (pView) { - OUString sInsert = pView->GetDocShell()->GetTitle(); - if (pView == pActiveView) - { - sInsert += "(" + - m_aContextStrings[IDX_STR_ACTIVE] + - ")"; - } + OUString sInsert = pView->GetDocShell()->GetTitle() + " (" + + m_aContextStrings[pView == GetActiveView() ? IDX_STR_ACTIVE : + IDX_STR_INACTIVE] + ")"; xSubPop3->append_radio(OUString::number(nId), sInsert); if (State::CONSTANT == m_eState && m_pActiveShell == &pView->GetWrtShell()) xSubPop3->set_active(OString::number(nId), true); @@ -1586,19 +1582,19 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) nId++; } xSubPop3->append_radio(OUString::number(nId++), m_aContextStrings[IDX_STR_ACTIVE_VIEW]); - if (m_pHiddenShell) + if (m_pHiddenShell) // can have only one hidden shell { OUString sHiddenEntry = m_pHiddenShell->GetView().GetDocShell()->GetTitle() + - " ( " + + " (" + m_aContextStrings[IDX_STR_HIDDEN] + - " )"; + ")"; xSubPop3->append_radio(OUString::number(nId), sHiddenEntry); } - if (State::ACTIVE == m_eState) xSubPop3->set_active(OString::number(--nId), true); else if (State::HIDDEN == m_eState) xSubPop3->set_active(OString::number(nId), true); + } std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator()); if (!m_xTreeView->get_selected(xEntry.get())) @@ -1701,7 +1697,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) } // Edit only if the shown content is coming from the current view. if (State::HIDDEN != m_eState && - (State::ACTIVE == m_eState || m_pActiveShell == pActiveView->GetWrtShellPtr()) + (State::ACTIVE == m_eState || m_pActiveShell == GetActiveView()->GetWrtShellPtr()) && lcl_IsContent(*xEntry, *m_xTreeView)) { const bool bReadonly = m_pActiveShell->GetView().GetDocShell()->IsReadOnly(); commit 2aed402cf922479813ac1ce048c8ed276407401c Author: Caolán McNamara <[email protected]> AuthorDate: Tue Nov 2 11:30:16 2021 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Nov 2 17:13:14 2021 +0100 Resolves: tdf#136945 fix custom slide show dnd to reorder pages Change-Id: Ib28d6779e772fd8ad30899354cde2c281085b328 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124593 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index f776a6a7e2ba..bd629f87bfaa 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -250,6 +250,7 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg(weld::Window* pWindow, SdDrawDocume , m_xBtnAdd(m_xBuilder->weld_button("add")) , m_xBtnRemove(m_xBuilder->weld_button("remove")) , m_xLbCustomPages(m_xBuilder->weld_tree_view("custompages")) + , m_xDropTargetHelper(new CustomPagesDropTarget(*m_xLbCustomPages)) , m_xBtnOK(m_xBuilder->weld_button("ok")) , m_xBtnCancel(m_xBuilder->weld_button("cancel")) , m_xBtnHelp(m_xBuilder->weld_button("help")) @@ -474,4 +475,37 @@ IMPL_LINK_NOARG(SdDefineCustomShowDlg, OKHdl, weld::Button&, void) } } +CustomPagesDropTarget::CustomPagesDropTarget(weld::TreeView& rTreeView) + : DropTargetHelper(rTreeView.get_drop_target()) + , m_rTreeView(rTreeView) +{ +} + +sal_Int8 CustomPagesDropTarget::AcceptDrop(const AcceptDropEvent& rEvt) +{ + // to enable the autoscroll when we're close to the edges + m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, nullptr, true); + return DND_ACTION_MOVE; +} + +sal_Int8 CustomPagesDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt ) +{ + weld::TreeView* pSource = m_rTreeView.get_drag_source(); + // only dragging within the same widget allowed + if (!pSource || pSource != &m_rTreeView) + return DND_ACTION_NONE; + + std::unique_ptr<weld::TreeIter> xSource(m_rTreeView.make_iterator()); + if (!m_rTreeView.get_selected(xSource.get())) + return DND_ACTION_NONE; + + std::unique_ptr<weld::TreeIter> xTarget(m_rTreeView.make_iterator()); + int nTargetPos = -1; + if (m_rTreeView.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get(), true)) + nTargetPos = m_rTreeView.get_iter_index_in_parent(*xTarget); + m_rTreeView.move_subtree(*xSource, nullptr, nTargetPos); + + return DND_ACTION_NONE; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx index 519361aff69e..70df26a065fc 100644 --- a/sd/source/ui/inc/custsdlg.hxx +++ b/sd/source/ui/inc/custsdlg.hxx @@ -19,6 +19,7 @@ #pragma once +#include <vcl/transfer.hxx> #include <vcl/weld.hxx> class SdDrawDocument; @@ -53,6 +54,18 @@ public: bool IsCustomShow() const; }; +class CustomPagesDropTarget : public DropTargetHelper +{ +private: + weld::TreeView& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + CustomPagesDropTarget(weld::TreeView& rTreeView); +}; + class SdDefineCustomShowDlg : public weld::GenericDialogController { private: @@ -66,6 +79,7 @@ private: std::unique_ptr<weld::Button> m_xBtnAdd; std::unique_ptr<weld::Button> m_xBtnRemove; std::unique_ptr<weld::TreeView> m_xLbCustomPages; + std::unique_ptr<CustomPagesDropTarget> m_xDropTargetHelper; std::unique_ptr<weld::Button> m_xBtnOK; std::unique_ptr<weld::Button> m_xBtnCancel; std::unique_ptr<weld::Button> m_xBtnHelp;
