[Libreoffice-commits] core.git: 2 commits - sfx2/uiconfig solenv/sanitizers sw/source sw/uiconfig sw/UIConfig_swriter.mk

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 7 11:48:10 UTC 2020


 sfx2/uiconfig/ui/classificationbox.ui      |    2 -
 solenv/sanitizers/ui/modules/swriter.suppr |    1 
 sw/UIConfig_swriter.mk                     |    1 
 sw/source/uibase/ribbar/workctrl.cxx       |   47 ++++++++++++++++++-----------
 sw/uiconfig/swriter/ui/jumpposbox.ui       |   24 ++++++++++++++
 5 files changed, 57 insertions(+), 18 deletions(-)

New commits:
commit 9b8180dfb71e139d78be487967f741e1f9f46d51
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 6 20:36:03 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 7 12:47:48 2020 +0100

    remove unnecessary include
    
    Change-Id: I205966f40472d187c63717ddf6e8153584c6b284
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88141
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index 08d569a01811..0f16edc98394 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -42,7 +42,7 @@
 #include <rtl/ustring.hxx>
 #include <swabstdlg.hxx>
 #include <sfx2/zoomitem.hxx>
-#include <vcl/field.hxx>
+#include <vcl/combobox.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/strings.hrc>
commit ed87f7e96b7f4f9201fa17bc573d4ef8ba9ab4e4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 6 20:25:12 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 7 12:47:35 2020 +0100

    weld SwJumpToSpecificBox_Impl
    
    Change-Id: I4c140bccf821b6ee0ce0e734cebae722267f5430
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88140
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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>


More information about the Libreoffice-commits mailing list