include/svtools/ctrlbox.hxx | 8 ++++---- svtools/source/control/ctrlbox.cxx | 10 ++++------ vcl/jsdialog/enabled.cxx | 2 ++ 3 files changed, 10 insertions(+), 10 deletions(-)
New commits: commit 4851fe22807494b68c534305722d316b0c8accd8 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Fri Mar 17 19:45:42 2023 +0100 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Sat Mar 18 13:13:44 2023 +0000 Convert SvtLineListBox to WeldToolbarPopup Change-Id: I1849e40508a8754ec567da5913d3454571da5bee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149063 Tested-by: Szymon Kłos <szymon.k...@collabora.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 61dcba9c191c..cb200b4c83da 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -20,6 +20,7 @@ #pragma once #include <svtools/svtdllapi.h> +#include <svtools/toolbarmenu.hxx> #include <editeng/borderline.hxx> #include <vcl/idle.hxx> #include <vcl/metric.hxx> @@ -198,7 +199,7 @@ inline Color sameDistColor( Color /*rMain*/, Color rDefault ) class ValueSet; -class SVT_DLLPUBLIC SvtLineListBox +class SVT_DLLPUBLIC SvtLineListBox final : public WeldToolbarPopup { public: typedef Color (*ColorFunc)(Color); @@ -244,6 +245,8 @@ public: void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } + virtual void GrabFocus() override; + private: SVT_DLLPRIVATE void ImpGetLine( tools::Long nLine1, tools::Long nLine2, tools::Long nDistance, @@ -251,7 +254,6 @@ private: SvxBorderLineStyle nStyle, BitmapEx& rBmp ); DECL_DLLPRIVATE_LINK(ValueSelectHdl, ValueSet*, void); - DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget&, void); DECL_DLLPRIVATE_LINK(ToggleHdl, weld::Toggleable&, void); DECL_DLLPRIVATE_LINK(NoneHdl, weld::Button&, void); @@ -263,8 +265,6 @@ private: SvtLineListBox& operator =( const SvtLineListBox& ) = delete; std::unique_ptr<weld::MenuButton> m_xControl; - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Widget> m_xTopLevel; std::unique_ptr<weld::Button> m_xNoneButton; std::unique_ptr<ValueSet> m_xLineSet; std::unique_ptr<weld::CustomWeld> m_xLineSetWin; diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 147fdd31ee0e..b88b484cc6dd 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1399,9 +1399,8 @@ void SvtLineListBox::ImpGetLine( tools::Long nLine1, tools::Long nLine2, tools:: } SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl) - : m_xControl(std::move(pControl)) - , m_xBuilder(Application::CreateBuilder(m_xControl.get(), "svt/ui/linewindow.ui")) - , m_xTopLevel(m_xBuilder->weld_widget("line_popup_window")) + : WeldToolbarPopup(css::uno::Reference<css::frame::XFrame>(), pControl.get(), "svt/ui/linewindow.ui", "line_popup_window") + , m_xControl(std::move(pControl)) , m_xNoneButton(m_xBuilder->weld_button("none_line_button")) , m_xLineSet(new ValueSet(nullptr)) , m_xLineSetWin(new weld::CustomWeld(*m_xBuilder, "lineset", *m_xLineSet)) @@ -1417,7 +1416,6 @@ SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl) m_xNoneButton->connect_clicked(LINK(this, SvtLineListBox, NoneHdl)); - m_xTopLevel->connect_focus_in(LINK(this, SvtLineListBox, FocusHdl)); m_xControl->set_popover(m_xTopLevel.get()); m_xControl->connect_toggled(LINK(this, SvtLineListBox, ToggleHdl)); @@ -1437,7 +1435,7 @@ SvtLineListBox::SvtLineListBox(std::unique_ptr<weld::MenuButton> pControl) aVirDev->SetMapMode(MapMode(MapUnit::MapTwip)); } -IMPL_LINK_NOARG(SvtLineListBox, FocusHdl, weld::Widget&, void) +void SvtLineListBox::GrabFocus() { if (GetSelectEntryStyle() == SvxBorderLineStyle::NONE) m_xNoneButton->grab_focus(); @@ -1448,7 +1446,7 @@ IMPL_LINK_NOARG(SvtLineListBox, FocusHdl, weld::Widget&, void) IMPL_LINK(SvtLineListBox, ToggleHdl, weld::Toggleable&, rButton, void) { if (rButton.get_active()) - FocusHdl(*m_xTopLevel); + GrabFocus(); } IMPL_LINK_NOARG(SvtLineListBox, NoneHdl, weld::Button&, void) diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d79f26f7fc5e..a219ede196b1 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -207,6 +207,8 @@ bool isBuilderEnabledForPopup(std::u16string_view rUIFile) || rUIFile == u"modules/scalc/ui/filtersubdropdown.ui" || rUIFile == u"modules/scalc/ui/floatingborderstyle.ui" || rUIFile == u"modules/scalc/ui/floatinglinestyle.ui" + // svt + || rUIFile == u"svt/ui/linewindow.ui" // svx || rUIFile == u"svx/ui/colorwindow.ui" || rUIFile == u"svx/ui/currencywindow.ui"