summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-06-28 15:38:32 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-07-29 12:25:20 +0200
commita30e71bc1184d30bc9c95c2e02779660d58e3be9 (patch)
tree5a08f547ac953ed4d542cac86648b950b062b7fd
parentb206dda731e7c4390d6c9fe9c66feb8e903d3786 (diff)
sidebar: unify LineWidthPopup with other WeldToolbarPopups
Change-Id: I9dd0d2b223972683a9066f0069e055175349526f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118023 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119654 Tested-by: Jenkins
-rw-r--r--include/svx/sidebar/LineWidthPopup.hxx8
-rw-r--r--svx/source/sidebar/line/LineWidthPopup.cxx9
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx5
3 files changed, 11 insertions, 11 deletions
diff --git a/include/svx/sidebar/LineWidthPopup.hxx b/include/svx/sidebar/LineWidthPopup.hxx
index d16f49b60389..262f3540941b 100644
--- a/include/svx/sidebar/LineWidthPopup.hxx
+++ b/include/svx/sidebar/LineWidthPopup.hxx
@@ -23,6 +23,7 @@
#include <vcl/customweld.hxx>
#include <vcl/image.hxx>
#include <vcl/weld.hxx>
+#include <svtools/toolbarmenu.hxx>
#include <array>
class ValueSet;
@@ -32,7 +33,7 @@ namespace svx::sidebar
class LinePropertyPanelBase;
class LineWidthValueSet;
-class LineWidthPopup final
+class LineWidthPopup final : public WeldToolbarPopup
{
public:
LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent);
@@ -42,6 +43,8 @@ public:
weld::Container* getTopLevel() const { return m_xTopLevel.get(); }
+ virtual void GrabFocus() override;
+
private:
LinePropertyPanelBase& m_rParent;
std::array<OUString, 9> maStrUnits;
@@ -53,15 +56,12 @@ private:
Image m_aIMGCus;
Image m_aIMGCusGray;
- std::unique_ptr<weld::Builder> m_xBuilder;
- std::unique_ptr<weld::Container> m_xTopLevel;
std::unique_ptr<weld::MetricSpinButton> m_xMFWidth;
std::unique_ptr<LineWidthValueSet> m_xVSWidth;
std::unique_ptr<weld::CustomWeld> m_xVSWidthWin;
DECL_LINK(VSSelectHdl, ValueSet*, void);
DECL_LINK(MFModifyHdl, weld::MetricSpinButton&, void);
- DECL_LINK(FocusHdl, weld::Widget&, void);
};
} // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx
index 6cd19ce7305c..347bb2a3bb8d 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -32,7 +32,8 @@
namespace svx::sidebar
{
LineWidthPopup::LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rParent)
- : m_rParent(rParent)
+ : WeldToolbarPopup(nullptr, pParent, "svx/ui/floatinglineproperty.ui", "FloatingLineProperty")
+ , m_rParent(rParent)
, m_sPt(SvxResId(RID_SVXSTR_PT))
, m_eMapUnit(MapUnit::MapTwip)
, m_bVSFocus(true)
@@ -40,14 +41,10 @@ LineWidthPopup::LineWidthPopup(weld::Widget* pParent, LinePropertyPanelBase& rPa
, m_nCustomWidth(0)
, m_aIMGCus(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM)
, m_aIMGCusGray(StockImage::Yes, RID_SVXBMP_WIDTH_CUSTOM_GRAY)
- , m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/floatinglineproperty.ui"))
- , m_xTopLevel(m_xBuilder->weld_container("FloatingLineProperty"))
, m_xMFWidth(m_xBuilder->weld_metric_spin_button("spin", FieldUnit::POINT))
, m_xVSWidth(new LineWidthValueSet())
, m_xVSWidthWin(new weld::CustomWeld(*m_xBuilder, "lineset", *m_xVSWidth))
{
- m_xTopLevel->connect_focus_in(LINK(this, LineWidthPopup, FocusHdl));
-
m_xVSWidth->SetStyle(m_xVSWidth->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT);
maStrUnits[0] = "0.5";
@@ -213,7 +210,7 @@ void LineWidthPopup::SetWidthSelect(tools::Long lValue, bool bValuable, MapUnit
m_xVSWidth->Invalidate();
}
-IMPL_LINK_NOARG(LineWidthPopup, FocusHdl, weld::Widget&, void)
+void LineWidthPopup::GrabFocus()
{
if (m_bVSFocus)
m_xVSWidth->GrabFocus();
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 879ae9bf9d72..e250dcfe875e 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -223,6 +223,9 @@ JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
if (!pWindow || !m_aNotifierWindow)
return aJsonWriter;
+ if (!pWindow->GetParentWithLOKNotifier())
+ return aJsonWriter;
+
pWindow->DumpAsPropertyTree(*aJsonWriter);
aJsonWriter->put("jsontype", "dialog");
@@ -230,7 +233,7 @@ JSDialogNotifyIdle::generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString s
aJsonWriter->put("cancellable", true);
aJsonWriter->put("popupParent", sParentId);
aJsonWriter->put("clickToClose", sCloseId);
- aJsonWriter->put("id", pWindow->GetLOKWindowId());
+ aJsonWriter->put("id", pWindow->GetParentWithLOKNotifier()->GetLOKWindowId());
return aJsonWriter;
}