cui/source/dialogs/cuicharmap.cxx    |    2 ++
 cui/uiconfig/ui/specialcharacters.ui |    4 +++-
 include/svx/searchcharmap.hxx        |    1 +
 svx/source/dialog/searchcharmap.cxx  |   11 ++++++++---
 4 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 15189c9cefccb1d7ed9026cfd62ca9745427d387
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Mar 10 11:13:17 2023 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sun Mar 12 18:51:40 2023 +0000

    Resolves: tdf#154087 update scrollbar range when search criteria change
    
    Change-Id: Iaf5f20c8952b15f3dcccb65277dadb171a705605
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148616
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/cui/source/dialogs/cuicharmap.cxx 
b/cui/source/dialogs/cuicharmap.cxx
index 457b5238ccdd..c6994000e36d 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -885,6 +885,8 @@ IMPL_LINK_NOARG(SvxCharacterMap, SearchUpdateHdl, 
weld::Entry&, void)
             if(!sName.isEmpty() && 
sName.toAsciiLowerCase().indexOf(aKeyword.toAsciiLowerCase()) >= 0)
                 m_xSearchSet->AppendCharToList(sChar);
         }
+
+        m_xSearchSet->UpdateScrollRange();
     }
     else
     {
diff --git a/cui/uiconfig/ui/specialcharacters.ui 
b/cui/uiconfig/ui/specialcharacters.ui
index 7c04cbcc5b62..ff541b7e0e6b 100644
--- a/cui/uiconfig/ui/specialcharacters.ui
+++ b/cui/uiconfig/ui/specialcharacters.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkDialog" id="SpecialCharactersDialog">
@@ -855,6 +855,8 @@
                     <property name="can-focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
+                    <property name="hscrollbar-policy">never</property>
+                    <property name="vscrollbar-policy">always</property>
                     <property name="shadow-type">in</property>
                     <child>
                       <object class="GtkViewport">
diff --git a/include/svx/searchcharmap.hxx b/include/svx/searchcharmap.hxx
index 33d7432096d8..1af4ce5fe1a6 100644
--- a/include/svx/searchcharmap.hxx
+++ b/include/svx/searchcharmap.hxx
@@ -50,6 +50,7 @@ public:
     virtual void                        SelectIndex( int index, bool bFocus = 
false ) override;
     void                                AppendCharToList(sal_UCS4 cChar);
     void                                ClearPreviousData();
+    void                                UpdateScrollRange();
 
     virtual sal_Int32                   getMaxCharCount() const override;
 
diff --git a/svx/source/dialog/searchcharmap.cxx 
b/svx/source/dialog/searchcharmap.cxx
index 034ebd317a5a..2d8eeaab8967 100644
--- a/svx/source/dialog/searchcharmap.cxx
+++ b/svx/source/dialog/searchcharmap.cxx
@@ -307,9 +307,7 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& 
rRenderContext)
     nX = aSize.Width() / COLUMN_COUNT;
     nY = aSize.Height() / ROW_COUNT;
 
-    //scrollbar settings -- error
-    int nLastRow = (nCount - 1 + COLUMN_COUNT) / COLUMN_COUNT;
-    mxScrollArea->vadjustment_configure(mxScrollArea->vadjustment_get_value(), 
0, nLastRow, 1, ROW_COUNT - 1, ROW_COUNT);
+    UpdateScrollRange();
 
     // rearrange CharSet element in sync with nX- and nY-multiples
     Size aDrawSize(nX * COLUMN_COUNT, nY * ROW_COUNT);
@@ -319,6 +317,13 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& 
rRenderContext)
     mbRecalculateFont = false;
 }
 
+void SvxSearchCharSet::UpdateScrollRange()
+{
+    //scrollbar settings
+    int nLastRow = (nCount - 1 + COLUMN_COUNT) / COLUMN_COUNT;
+    mxScrollArea->vadjustment_configure(mxScrollArea->vadjustment_get_value(), 
0, nLastRow, 1, ROW_COUNT - 1, ROW_COUNT);
+}
+
 void SvxSearchCharSet::SelectIndex(int nNewIndex, bool bFocus)
 {
     if (!mxFontCharMap.is())

Reply via email to