diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-06 20:25:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-07 12:47:35 +0100 |
commit | ed87f7e96b7f4f9201fa17bc573d4ef8ba9ab4e4 (patch) | |
tree | d906a223d533f92715e228f108ed5fc3a0529980 | |
parent | dbcdc5cd98df5756a96559e467cad95c629343ca (diff) |
weld SwJumpToSpecificBox_Impl
Change-Id: I4c140bccf821b6ee0ce0e734cebae722267f5430
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88140
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sfx2/uiconfig/ui/classificationbox.ui | 2 | ||||
-rw-r--r-- | solenv/sanitizers/ui/modules/swriter.suppr | 1 | ||||
-rw-r--r-- | sw/UIConfig_swriter.mk | 1 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 45 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/jumpposbox.ui | 24 |
5 files changed, 56 insertions, 17 deletions
diff --git a/sfx2/uiconfig/ui/classificationbox.ui b/sfx2/uiconfig/ui/classificationbox.ui index adc04d4d4df4..b94372831e4a 100644 --- a/sfx2/uiconfig/ui/classificationbox.ui +++ b/sfx2/uiconfig/ui/classificationbox.ui @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Generated with glade 3.22.1 --> -<interface domain="svx"> +<interface domain="sfx"> <requires lib="gtk+" version="3.18"/> <object class="GtkBox" id="ClassificationBox"> <property name="visible">True</property> diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr index 1678e515eed9..1034cb94c770 100644 --- a/solenv/sanitizers/ui/modules/swriter.suppr +++ b/solenv/sanitizers/ui/modules/swriter.suppr @@ -110,6 +110,7 @@ sw/uiconfig/swriter/ui/insertscript.ui://GtkLabel[@id='label1'] orphan-label sw/uiconfig/swriter/ui/insertscript.ui://GtkEntry[@id='scripttype'] no-labelled-by sw/uiconfig/swriter/ui/insertscript.ui://GtkEntry[@id='urlentry'] no-labelled-by sw/uiconfig/swriter/ui/insertscript.ui://GtkTextView[@id='textentry'] no-labelled-by +sw/uiconfig/swriter/ui/jumpposbox.ui://GtkEntry[@id='jumppos'] no-labelled-by sw/uiconfig/swriter/ui/labelformatpage.ui://GtkSpinButton[@id='top'] duplicate-mnemonic sw/uiconfig/swriter/ui/labelformatpage.ui://GtkDrawingArea[@id='preview'] no-labelled-by sw/uiconfig/swriter/ui/linenumbering.ui://GtkLabel[@id='format'] orphan-label diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 339c7774d528..6431d1063cb3 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -172,6 +172,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/insertsectiondialog \ sw/uiconfig/swriter/ui/insertscript \ sw/uiconfig/swriter/ui/inserttable \ + sw/uiconfig/swriter/ui/jumpposbox \ sw/uiconfig/swriter/ui/labeldialog \ sw/uiconfig/swriter/ui/labelformatpage \ sw/uiconfig/swriter/ui/labeloptionspage \ diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 87bf21e93725..08d569a01811 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -18,6 +18,7 @@ */ #include <i18nutil/unicode.hxx> +#include <sfx2/InterimItemWindow.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/bindings.hxx> #include <sfx2/viewfrm.hxx> @@ -700,42 +701,54 @@ VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent namespace { -class SwJumpToSpecificBox_Impl : public NumericField +class SwJumpToSpecificBox_Impl final : public InterimItemWindow { + std::unique_ptr<weld::Entry> m_xWidget; + sal_uInt16 const nSlotId; + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(SelectHdl, weld::Entry&, bool); public: SwJumpToSpecificBox_Impl(vcl::Window* pParent, sal_uInt16 nSlot); - -protected: - void Select(); - virtual bool EventNotify( NotifyEvent& rNEvt ) override; + virtual void dispose() override + { + m_xWidget.reset(); + InterimItemWindow::dispose(); + } + virtual ~SwJumpToSpecificBox_Impl() override + { + disposeOnce(); + } }; } +IMPL_LINK(SwJumpToSpecificBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool) +{ + return ChildKeyInput(rKEvt); +} + SwJumpToSpecificBox_Impl::SwJumpToSpecificBox_Impl(vcl::Window* pParent, sal_uInt16 nSlot) - : NumericField(pParent, WB_HIDE | WB_BORDER) + : InterimItemWindow(pParent, "modules/swriter/ui/jumpposbox.ui", "JumpPosBox") + , m_xWidget(m_xBuilder->weld_entry("jumppos")) , nSlotId(nSlot) { - SetSizePixel(LogicToPixel(Size(16, 12), MapMode(MapUnit::MapAppFont))); + m_xWidget->connect_key_press(LINK(this, SwJumpToSpecificBox_Impl, KeyInputHdl)); + m_xWidget->connect_activate(LINK(this, SwJumpToSpecificBox_Impl, SelectHdl)); + + SetSizePixel(m_xWidget->get_preferred_size()); } -void SwJumpToSpecificBox_Impl::Select() +IMPL_LINK_NOARG(SwJumpToSpecificBox_Impl, SelectHdl, weld::Entry&, bool) { - OUString sEntry(GetText()); + OUString sEntry(m_xWidget->get_text()); SfxUInt16Item aPageNum(nSlotId); aPageNum.SetValue(static_cast<sal_uInt16>(sEntry.toInt32())); SfxObjectShell* pCurrentShell = SfxObjectShell::Current(); pCurrentShell->GetDispatcher()->ExecuteList(nSlotId, SfxCallMode::ASYNCHRON, { &aPageNum }); -} - -bool SwJumpToSpecificBox_Impl::EventNotify( NotifyEvent& rNEvt ) -{ - if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - Select(); - return NumericField::EventNotify(rNEvt); + return true; } SFX_IMPL_TOOLBOX_CONTROL( SwJumpToSpecificPageControl, SfxUInt16Item); diff --git a/sw/uiconfig/swriter/ui/jumpposbox.ui b/sw/uiconfig/swriter/ui/jumpposbox.ui new file mode 100644 index 000000000000..bfde35793952 --- /dev/null +++ b/sw/uiconfig/swriter/ui/jumpposbox.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="sw"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkBox" id="JumpPosBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkEntry" id="jumppos"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="width_chars">3</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> +</interface> |