cui/source/inc/numpages.hxx                          |   10 +--
 cui/source/tabpages/numpages.cxx                     |   54 ++++++++++++-------
 cui/uiconfig/ui/picknumberingpage.ui                 |   36 ++++++++----
 sw/qa/uitest/writer_tests2/formatBulletsNumbering.py |   19 +++---
 4 files changed, 77 insertions(+), 42 deletions(-)

New commits:
commit 3cc5cabb215be3a6376c2c0ab409312707508870
Author:     Parth Raiyani <[email protected]>
AuthorDate: Mon Aug 25 20:54:24 2025 +0530
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Feb 25 00:10:30 2026 +0100

    Switch to IconView from ValueSet for pick numbering page
    
    - Replaced SvxNumValueSet with weld::IconView in numpages
    - Updated UI in picknumberingpage.ui to include GtkIconView and GtkTreeStore
    - added tooltip support
    - updated relevant test cases
    
    Change-Id: Icd23ad3d7e4abc020f0869f4a90e3ecdbd04d945
    Signed-off-by: Parth Raiyani <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189847
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200211
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index d1b2b80e58d6..86b624b5340a 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -65,11 +65,12 @@ class SvxSingleNumPickTabPage final : public SfxTabPage
     bool                    bPreset     : 1;
     TypedWhichId<SvxNumBulletItem> nNumItemId;
 
-    std::unique_ptr<SvxNumValueSet> m_xExamplesVS;
-    std::unique_ptr<weld::CustomWeld> m_xExamplesVSWin;
+    std::unique_ptr<weld::IconView> m_xExamplesIV;
+    Size aPreviewSize;
 
-    DECL_LINK(NumSelectHdl_Impl, ValueSet*, void);
-    DECL_LINK(DoubleClickHdl_Impl, ValueSet*, void);
+    DECL_LINK(NumSelectHdl_Impl, weld::IconView&, void);
+    DECL_LINK(DoubleClickHdl_Impl, weld::IconView&, bool);
+    DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
 
 public:
     SvxSingleNumPickTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rSet);
@@ -82,7 +83,6 @@ public:
     virtual DeactivateRC   DeactivatePage(SfxItemSet *pSet) override;
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
-    virtual void        PageCreated(const SfxAllItemSet& aSet) override;
 };
 
 class SvxBulletPickTabPage final : public SfxTabPage
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 90837e8b9254..bddca9878295 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -21,6 +21,7 @@
 
 #include <numpages.hxx>
 #include <dialmgr.hxx>
+#include <o3tl/safeint.hxx>
 #include <o3tl/untaint.hxx>
 #include <tools/debug.hxx>
 #include <tools/mapunit.hxx>
@@ -151,13 +152,14 @@ 
SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(weld::Container* pPage, weld::D
     , bModified(false)
     , bPreset(false)
     , nNumItemId(SID_ATTR_NUMBERING_RULE)
-    , m_xExamplesVS(new 
SvxNumValueSet(m_xBuilder->weld_scrolled_window(u"valuesetwin"_ustr, true)))
-    , m_xExamplesVSWin(new weld::CustomWeld(*m_xBuilder, u"valueset"_ustr, 
*m_xExamplesVS))
+    , 
m_xExamplesIV(m_xBuilder->weld_icon_view(u"pick_numbering_iconview"_ustr))
+    , aPreviewSize(150, 200)
 {
     SetExchangeSupport();
-    m_xExamplesVS->init(NumberingPageType::SINGLENUM);
-    m_xExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, 
NumSelectHdl_Impl));
-    m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, 
DoubleClickHdl_Impl));
+    SvxBmpNumIconView::PopulateIconView(m_xExamplesIV.get(), 
NumberingPageType::SINGLENUM, aPreviewSize);
+    m_xExamplesIV->connect_selection_changed(LINK(this, 
SvxSingleNumPickTabPage, NumSelectHdl_Impl));
+    m_xExamplesIV->connect_item_activated(LINK(this, SvxSingleNumPickTabPage, 
DoubleClickHdl_Impl));
+    m_xExamplesIV->connect_query_tooltip(LINK(this, SvxSingleNumPickTabPage, 
QueryTooltipHdl));
 
     Reference<XDefaultNumberingProvider> xDefNum = 
SvxNumOptionsTabPageHelper::GetNumberingProvider();
     if(!xDefNum.is())
@@ -181,13 +183,12 @@ 
SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(weld::Container* pPage, weld::D
     {
     }
     Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
-    m_xExamplesVS->SetNumberingSettings(aNumberings, xFormat, rLocale);
+    SvxBmpNumIconView::SetNumberingSettings(m_xExamplesIV.get(), aPreviewSize, 
aNumberings, xFormat, rLocale);
 }
 
 SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
 {
-    m_xExamplesVSWin.reset();
-    m_xExamplesVS.reset();
+    m_xExamplesIV.reset();
 }
 
 std::unique_ptr<SfxTabPage> SvxSingleNumPickTabPage::Create(weld::Container* 
pPage, weld::DialogController* pController,
@@ -227,13 +228,13 @@ void  SvxSingleNumPickTabPage::ActivatePage(const 
SfxItemSet& rSet)
     if(pActNum && *pSaveNum != *pActNum)
     {
         *pActNum = *pSaveNum;
-        m_xExamplesVS->SetNoSelection();
+        m_xExamplesIV->unselect_all();
     }
 
     if(pActNum && (!lcl_IsNumFmtSet(pActNum.get(), nActNumLvl) || bIsPreset))
     {
-        m_xExamplesVS->SelectItem(1);
-        NumSelectHdl_Impl(m_xExamplesVS.get());
+        m_xExamplesIV->select(0);
+        NumSelectHdl_Impl(*m_xExamplesIV);
         bPreset = true;
     }
     else if (pActNum)
@@ -241,7 +242,11 @@ void  SvxSingleNumPickTabPage::ActivatePage(const 
SfxItemSet& rSet)
         svx::sidebar::NBOTypeMgrBase* pChoices
             = 
svx::sidebar::NBOutlineTypeMgrFact::CreateInstance(svx::sidebar::NBOType::Numbering);
         if (pChoices)
-            
m_xExamplesVS->SelectItem(pChoices->GetNBOIndexForNumRule(*pActNum, 
nActNumLvl));
+        {
+            sal_uInt16 nIndex = pChoices->GetNBOIndexForNumRule(*pActNum, 
nActNumLvl);
+            if (nIndex > 0 && nIndex <= 
o3tl::make_unsigned(m_xExamplesIV->n_children()))
+                m_xExamplesIV->select(nIndex - 1);
+        }
     }
 
     bPreset |= bIsPreset;
@@ -282,17 +287,25 @@ void  SvxSingleNumPickTabPage::Reset( const SfxItemSet* 
rSet )
         *pActNum = *pSaveNum;
 }
 
-void SvxSingleNumPickTabPage::PageCreated(const SfxAllItemSet& /*aSet*/)
-{}
+IMPL_LINK(SvxSingleNumPickTabPage, QueryTooltipHdl, const weld::TreeIter&, 
rIter, OUString)
+{
+    const OUString sId = m_xExamplesIV->get_id(rIter);
+    if (sId.isEmpty())
+        return OUString();
+
+    sal_Int32 nIndex = sId.toInt32();
+    return 
SvxBmpNumIconView::GetNumberingDescription(NumberingPageType::SINGLENUM, 
nIndex);
+}
 
-IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
+IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl, weld::IconView&, 
void)
 {
     if(!pActNum)
         return;
 
     bPreset = false;
     bModified = true;
-    sal_uInt16 nIdx = m_xExamplesVS->GetSelectedItemId() - 1;
+    OUString sId = m_xExamplesIV->get_selected_id();
+    sal_uInt16 nIdx = !sId.isEmpty() ? sId.toInt32() : 0;
     DBG_ASSERT(aNumSettingsArr.size() > nIdx, "wrong index");
     if(aNumSettingsArr.size() <= nIdx)
         return;
@@ -318,11 +331,16 @@ IMPL_LINK_NOARG(SvxSingleNumPickTabPage, 
NumSelectHdl_Impl, ValueSet*, void)
     }
 }
 
-IMPL_LINK_NOARG(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, void)
+IMPL_LINK_NOARG(SvxSingleNumPickTabPage, DoubleClickHdl_Impl, weld::IconView&, 
bool)
 {
-    NumSelectHdl_Impl(m_xExamplesVS.get());
+    if(m_xExamplesIV->get_selected_id().isEmpty())
+        return false;
+
+    NumSelectHdl_Impl(*m_xExamplesIV);
     weld::Button& rOk = GetDialogController()->GetOKButton();
     rOk.clicked();
+
+    return true;
 }
 
 SvxBulletPickTabPage::SvxBulletPickTabPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rSet)
diff --git a/cui/uiconfig/ui/picknumberingpage.ui 
b/cui/uiconfig/ui/picknumberingpage.ui
index fc19c551afc5..f4a0921ec370 100644
--- a/cui/uiconfig/ui/picknumberingpage.ui
+++ b/cui/uiconfig/ui/picknumberingpage.ui
@@ -2,32 +2,46 @@
 <!-- Generated with glade 3.40.0 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.24"/>
-  <object class="GtkScrolledWindow" id="PickNumberingPage">
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name pixbuf -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkGrid" id="PickNumberingPage">
     <property name="visible">True</property>
-    <property name="can-focus">True</property>
+    <property name="can-focus">False</property>
     <property name="margin-start">6</property>
     <property name="margin-end">6</property>
     <property name="margin-top">6</property>
     <property name="margin-bottom">6</property>
     <property name="hexpand">True</property>
     <property name="vexpand">True</property>
-    <property name="hscrollbar-policy">never</property>
-    <property name="vscrollbar-policy">never</property>
-    <property name="shadow-type">in</property>
     <child>
-      <object class="GtkViewport">
+      <object class="GtkScrolledWindow">
         <property name="visible">True</property>
-        <property name="can-focus">False</property>
+        <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">never</property>
+        <property name="shadow-type">in</property>
         <child>
-          <object class="GtkDrawingArea" id="valueset">
+          <object class="GtkIconView" id="pick_numbering_iconview">
             <property name="visible">True</property>
             <property name="can-focus">True</property>
-            <property name="events">GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | 
GDK_STRUCTURE_MASK</property>
             <property name="hexpand">True</property>
             <property name="vexpand">True</property>
+            <property name="model">liststore1</property>
+            <property name="pixbuf-column">0</property>
+            <property name="columns">4</property>
+            <property name="item-width">80</property>
+            <property name="selection-mode">single</property>
             <child internal-child="accessible">
-              <object class="AtkObject" id="valueset-atkobject">
-                <property name="AtkObject::accessible-description" 
translatable="yes" context="picknumberingpage|extended_tip|valueset">Click the 
numbering scheme that you want to use.</property>
+              <object class="AtkObject" id="pick_numbering_iconview-atkobject">
+                <property name="AtkObject::accessible-description" 
translatable="yes" 
context="picknumberingpage|extended_tip|pick_numbering_iconview">Click the 
numbering scheme that you want to use.</property>
               </object>
             </child>
           </object>
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py 
b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index 22ed41059543..cfff12080f54 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -264,18 +264,21 @@ class formatBulletsNumbering(UITestCase):
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "1")
                 xNumberingPage = xDialog.getChild("PickNumberingPage")
-                xselector = xNumberingPage.getChild("valueset")
-                self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], 
"8")
+                xselector = xNumberingPage.getChild("pick_numbering_iconview")
                 # Select element num 5
-                xselector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"5"}))
+                element5 = xselector.getChild("4")
+                element5.executeAction("SELECT", mkPropertyValues({}))
+                self.assertEqual(get_state_as_dict(xselector)["VisibleCount"], 
"8")
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4")
-                
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5")
-                self.assertEqual(get_state_as_dict(xselector)["ItemText"], 
"Uppercase letter A) B) C)")
+                
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "4")
+                
self.assertEqual(get_state_as_dict(xselector)["SelectEntryText"], "Uppercase 
letter A) B) C)")
                 # Select element num 8
-                xselector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"8"}))
+                element8 = xselector.getChild("7")
+                element8.executeAction("SELECT", mkPropertyValues({}))
+                self.assertEqual(get_state_as_dict(xselector)["VisibleCount"], 
"8")
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7")
-                
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8")
-                self.assertEqual(get_state_as_dict(xselector)["ItemText"], 
"Lowercase Roman number i. ii. iii.")
+                
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7")
+                
self.assertEqual(get_state_as_dict(xselector)["SelectEntryText"], "Lowercase 
Roman number i. ii. iii.")
 
                 # Select the OutlinePage's Selector
                 xTabs = xDialog.getChild("tabcontrol")

Reply via email to