[Libreoffice-commits] core.git: solenv/sanitizers sw/inc sw/source sw/uiconfig

tobias (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 6 07:47:37 UTC 2021


 solenv/sanitizers/ui/modules/swriter.suppr |    2 --
 sw/inc/gotodlg.hxx                         |    2 +-
 sw/source/uibase/utlui/gotodlg.cxx         |   13 ++++++++-----
 sw/uiconfig/swriter/ui/gotopagedialog.ui   |    8 ++++----
 4 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 72c000a8fd28215e839a731bb00147395f35ba4e
Author:     tobias <tobias.schulz at hotmail.com>
AuthorDate: Sun Sep 5 13:24:18 2021 +0200
Commit:     Heiko Tietze <heiko.tietze at documentfoundation.org>
CommitDate: Mon Sep 6 09:47:04 2021 +0200

    tdf#138255 use GtkSpinButton in SwGotoPageDlg
    
    Use GtkSpinButton instead of GtkEntry in SwGotoPageDlg analogous to
    the widget in SwNavigationPI.
    
    Change-Id: I0ddb4433bea23d8f3d460bd69f30a10b8f7ce984
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121688
    Tested-by: Jenkins
    Tested-by: Heiko Tietze <heiko.tietze at documentfoundation.org>
    Reviewed-by: Heiko Tietze <heiko.tietze at documentfoundation.org>

diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index a3a2bbd9c799..fd275e81c697 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -56,8 +56,6 @@ sw/uiconfig/swriter/ui/footnotepage.ui://GtkLabel[@id='label17'] orphan-label
 sw/uiconfig/swriter/ui/footnotepage.ui://GtkLabel[@id='label18'] orphan-label
 sw/uiconfig/swriter/ui/frmaddpage.ui://GtkLabel[@id='label2'] orphan-label
 sw/uiconfig/swriter/ui/gotopagedialog.ui://GtkLabel[@id='page_count'] orphan-label
-sw/uiconfig/swriter/ui/gotopagedialog.ui://GtkEntry[@id='page'] no-labelled-by
-sw/uiconfig/swriter/ui/gotopagedialog.ui://GtkLabel[@id='page_label'] orphan-label
 sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkMenuItem[@id='edit'] button-no-label
 sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkMenuItem[@id='delete'] button-no-label
 sw/uiconfig/swriter/ui/hfmenubutton.ui://GtkButton[@id='button'] button-no-label
diff --git a/sw/inc/gotodlg.hxx b/sw/inc/gotodlg.hxx
index a7971bec225f..0007bc2788cc 100644
--- a/sw/inc/gotodlg.hxx
+++ b/sw/inc/gotodlg.hxx
@@ -40,7 +40,7 @@ private:
     SfxBindings  *m_rBindings;
     sal_uInt16   mnMaxPageCnt;
 
-    std::unique_ptr<weld::Entry> mxMtrPageCtrl;
+    std::unique_ptr<weld::SpinButton> mxMtrPageCtrl;
     std::unique_ptr<weld::Label> mxPageNumberLbl;
 
     SwView*    GetCreateView() const;
diff --git a/sw/source/uibase/utlui/gotodlg.cxx b/sw/source/uibase/utlui/gotodlg.cxx
index 0c8387ab267d..050f6507bfc8 100644
--- a/sw/source/uibase/utlui/gotodlg.cxx
+++ b/sw/source/uibase/utlui/gotodlg.cxx
@@ -31,7 +31,7 @@ SwGotoPageDlg::SwGotoPageDlg(weld::Window* pParent, SfxBindings* _pBindings)
     , m_pCreateView(nullptr)
     , m_rBindings(_pBindings)
     , mnMaxPageCnt(1)
-    , mxMtrPageCtrl(m_xBuilder->weld_entry("page"))
+    , mxMtrPageCtrl(m_xBuilder->weld_spin_button("page"))
     , mxPageNumberLbl(m_xBuilder->weld_label("page_count"))
 {
     sal_uInt16 nTotalPage = GetPageInfo();
@@ -54,9 +54,11 @@ IMPL_LINK_NOARG(SwGotoPageDlg, PageModifiedHdl, weld::Entry&, void)
         int page_value = mxMtrPageCtrl->get_text().toInt32();
 
         if (page_value <= 0)
-            mxMtrPageCtrl->set_text(OUString::number(1));
+            mxMtrPageCtrl->set_value(1);
         else if (page_value > mnMaxPageCnt)
-            mxMtrPageCtrl->set_text(OUString::number(mnMaxPageCnt));
+            mxMtrPageCtrl->set_value(mnMaxPageCnt);
+        else
+            mxMtrPageCtrl->set_value(page_value);
 
         mxMtrPageCtrl->set_position(-1);
     }
@@ -87,13 +89,14 @@ sal_uInt16 SwGotoPageDlg::GetPageInfo()
 {
     SwView* pView = GetCreateView();
     SwWrtShell* pSh = pView ? &pView->GetWrtShell() : nullptr;
-    mxMtrPageCtrl->set_text(OUString::number(1));
+    mxMtrPageCtrl->set_value(1);
     if (pSh)
     {
         const sal_uInt16 nPageCnt = pSh->GetPageCnt();
         sal_uInt16 nPhyPage, nVirPage;
         pSh->GetPageNum(nPhyPage, nVirPage);
-        mxMtrPageCtrl->set_text(OUString::number(nPhyPage));
+        mxMtrPageCtrl->set_max(nPageCnt);
+        mxMtrPageCtrl->set_value(nPhyPage);
         return nPageCnt;
     }
     return 0;
diff --git a/sw/uiconfig/swriter/ui/gotopagedialog.ui b/sw/uiconfig/swriter/ui/gotopagedialog.ui
index 72692ac963bc..01cfb658e16e 100644
--- a/sw/uiconfig/swriter/ui/gotopagedialog.ui
+++ b/sw/uiconfig/swriter/ui/gotopagedialog.ui
@@ -81,13 +81,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="page">
+              <object class="GtkSpinButton" id="page">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="adjustment">page_value</property>
                 <property name="activates_default">True</property>
                 <property name="width_chars">5</property>
-                <property name="truncate-multiline">True</property>
-                <property name="input_purpose">number</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
@@ -101,6 +100,7 @@
                 <property name="halign">end</property>
                 <property name="label" translatable="yes" context="gotopagedialog|page_label">Page:</property>
                 <property name="use_underline">True</property>
+                <property name="mnemonic_widget">page</property>
                 <property name="xalign">0</property>
               </object>
               <packing>
@@ -127,7 +127,7 @@
   </object>
   <object class="GtkAdjustment" id="page_value">
     <property name="lower">1</property>
-    <property name="upper">75</property>
+    <property name="upper">100000</property>
     <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>


More information about the Libreoffice-commits mailing list