svx/source/inc/StylesPreviewWindow.hxx | 3 + svx/source/tbxctrls/StylesPreviewWindow.cxx | 49 +++++++++++++++++++++++----- vcl/source/treelist/svimpbox.cxx | 4 ++ 3 files changed, 47 insertions(+), 9 deletions(-)
New commits: commit b7646a37d9967bb07668f6f5a8a89975b47ef104 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Fri Jan 22 20:38:21 2021 -0900 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Mar 2 11:22:31 2021 +0100 tdf#137121 add popup menu to style items used in styles preview window Change-Id: Ib9bd6584416b24301d3d302165d12c89bcd1e178 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109838 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111659 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx index 26ba93d7be79..ff9a4137b9dc 100644 --- a/svx/source/inc/StylesPreviewWindow.hxx +++ b/svx/source/inc/StylesPreviewWindow.hxx @@ -54,7 +54,8 @@ public: void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; - bool MouseButtonDown(const MouseEvent&) override; + bool MouseButtonDown(const MouseEvent& rMEvt) override; + bool Command(const CommandEvent& rEvent) override; void SetStyle(const std::pair<OUString, OUString>& sStyleName); diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index a200a8f906f9..ec733dbdd8b1 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -52,7 +52,8 @@ #include <com/sun/star/uno/Sequence.hxx> #include <cppuhelper/weak.hxx> -#include <sal/log.hxx> +#include <vcl/event.hxx> +#include <vcl/commandevent.hxx> StyleStatusListener::StyleStatusListener( StylesPreviewWindow_Base* pPreviewControl, @@ -102,15 +103,47 @@ void StyleItemController::Select(bool bSelect) Invalidate(); } -bool StyleItemController::MouseButtonDown(const MouseEvent&) +bool StyleItemController::MouseButtonDown(const MouseEvent& rMEvt) { - css::uno::Sequence<css::beans::PropertyValue> aArgs(2); - aArgs[0].Value <<= m_aStyleName.second; - aArgs[1].Name = "Family"; - aArgs[1].Value <<= sal_Int16(m_eStyleFamily); + if (rMEvt.IsLeft()) + { + css::uno::Sequence<css::beans::PropertyValue> aArgs(2); + aArgs[0].Value <<= m_aStyleName.second; + aArgs[1].Name = "Family"; + aArgs[1].Value <<= sal_Int16(m_eStyleFamily); + + aArgs[0].Name = "Template"; + SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs); + } - aArgs[0].Name = "Template"; - SfxToolBoxControl::Dispatch(m_xDispatchProvider, ".uno:StyleApply", aArgs); + return false; +} + +bool StyleItemController::Command(const CommandEvent& rEvent) +{ + if (rEvent.GetCommand() != CommandEventId::ContextMenu) + return CustomWidgetController::Command(rEvent); + + std::unique_ptr<weld::Builder> xBuilder( + Application::CreateBuilder(GetDrawingArea(), "svx/ui/stylemenu.ui")); + std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu")); + std::string_view rIdent = xMenu->popup_at_rect( + GetDrawingArea(), tools::Rectangle(rEvent.GetMousePosPixel(), Size(1, 1))); + if (rIdent == "update" || rIdent == "edit") + { + css::uno::Sequence<css::beans::PropertyValue> aArgs(2); + aArgs[0].Name = "Param"; + aArgs[0].Value <<= m_aStyleName.second; + aArgs[1].Name = "Family"; + aArgs[1].Value <<= sal_Int16(m_eStyleFamily); + + SfxToolBoxControl::Dispatch(m_xDispatchProvider, + rIdent == "update" ? OUString(".uno:StyleUpdateByExample") + : OUString(".uno:EditStyle"), + aArgs); + + return true; + } return false; } commit 33a0a52ebf5eea84b924498f45e8ca13269e509d Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Feb 3 16:44:35 2021 +0100 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue Mar 2 11:22:20 2021 +0100 Don't skip lines if only one row in the list Mouse wheel emits delta > 1 so if we see only one row but delta is 3 we skip then 2 rows. Change-Id: I136788d38a189c061a55cba12eef05c7a4733820 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110379 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111658 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx index 72d05e61d35c..5456396b9199 100644 --- a/vcl/source/treelist/svimpbox.cxx +++ b/vcl/source/treelist/svimpbox.cxx @@ -312,6 +312,10 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void ) if( !nDelta ) return; + // when only one row don't skip lines + if (pScrollBar->GetPageSize() == 1) + nDelta = nDelta > 0 ? 1 : -1; + m_nFlags &= ~LBoxFlags::Filling; m_bInVScrollHdl = true; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits