cui/source/inc/numpages.hxx                          |    9 ++-
 cui/source/tabpages/numpages.cxx                     |   47 ++++++++++++-------
 cui/uiconfig/ui/pickoutlinepage.ui                   |   36 ++++++++++----
 sw/qa/uitest/writer_tests2/formatBulletsNumbering.py |   11 ++--
 4 files changed, 68 insertions(+), 35 deletions(-)

New commits:
commit 853e7216480625e346559bf461d191a51f16070b
Author:     Parth Raiyani <parth.raiy...@collabora.com>
AuthorDate: Mon Aug 25 20:57:00 2025 +0530
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Sep 12 17:11:20 2025 +0200

    Switch to IconView from ValueSet for pick outline page
    
    - Replaced SvxNumValueSet with weld::IconView in numpages
    - Updated UI in pickoutlinepage.ui to include GtkIconView and GtkTreeStore
    - added tooltip support
    - updated relevant test cases
    
    Change-Id: Ie5ac8af318a075cefbadcc9786199d80d2e0385e
    Signed-off-by: Parth Raiyani <parth.raiy...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189848
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index d80e4bbfe516..66bae32e71d2 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -139,11 +139,12 @@ class SvxNumPickTabPage final : public SfxTabPage
     bool                bModified   : 1;
     bool                bPreset     : 1;
 
-    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:
     SvxNumPickTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rSet);
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index d8694cd31222..b1f1cc894a4c 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -598,14 +598,15 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* 
pPage, weld::DialogControl
     , nNumItemId(SID_ATTR_NUMBERING_RULE)
     , bModified(false)
     , bPreset(false)
-    , 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_outline_iconview"_ustr))
+    , aPreviewSize(150, 200)
 {
     SetExchangeSupport();
 
-    m_xExamplesVS->init(NumberingPageType::OUTLINE);
-    m_xExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, 
NumSelectHdl_Impl));
-    m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, 
DoubleClickHdl_Impl));
+    SvxBmpNumIconView::PopulateIconView(m_xExamplesIV.get(), 
NumberingPageType::OUTLINE, aPreviewSize);
+    m_xExamplesIV->connect_selection_changed(LINK(this, SvxNumPickTabPage, 
NumSelectHdl_Impl));
+    m_xExamplesIV->connect_item_activated(LINK(this, SvxNumPickTabPage, 
DoubleClickHdl_Impl));
+    m_xExamplesIV->connect_query_tooltip(LINK(this, SvxNumPickTabPage, 
QueryTooltipHdl));
 
     Reference<XDefaultNumberingProvider> xDefNum = 
SvxNumOptionsTabPageHelper::GetNumberingProvider();
     if(!xDefNum.is())
@@ -641,13 +642,12 @@ SvxNumPickTabPage::SvxNumPickTabPage(weld::Container* 
pPage, weld::DialogControl
     {
     }
     Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
-    m_xExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, 
rLocale);
+    SvxBmpNumIconView::SetOutlineNumberingSettings(m_xExamplesIV.get(), 
aPreviewSize, aOutlineAccess, xFormat, rLocale);
 }
 
 SvxNumPickTabPage::~SvxNumPickTabPage()
 {
-    m_xExamplesVSWin.reset();
-    m_xExamplesVS.reset();
+    m_xExamplesIV.reset();
 }
 
 std::unique_ptr<SfxTabPage> SvxNumPickTabPage::Create(weld::Container* pPage, 
weld::DialogController* pController,
@@ -686,13 +686,13 @@ void  SvxNumPickTabPage::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;
     }
     bPreset |= bIsPreset;
@@ -729,8 +729,18 @@ void  SvxNumPickTabPage::Reset( const SfxItemSet* rSet )
 
 }
 
+IMPL_LINK(SvxNumPickTabPage, 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::OUTLINE, nIndex);
+}
+
 // all levels are changed here
-IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
+IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, weld::IconView&, void)
 {
     if(!pActNum)
         return;
@@ -740,7 +750,9 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, 
ValueSet*, void)
 
     const FontList*  pList = nullptr;
 
-    SvxNumSettingsArr_Impl& rItemArr = 
aNumSettingsArrays[m_xExamplesVS->GetSelectedItemId() - 1];
+    OUString sId = m_xExamplesIV->get_selected_id();
+    sal_uInt16 nIdx = !sId.isEmpty() ? sId.toInt32() : 0;
+    SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[nIdx];
 
     const vcl::Font& rActBulletFont = 
SvxBmpNumIconView::GetDefaultBulletFont();
     SvxNumSettings_Impl* pLevelSettings = nullptr;
@@ -817,11 +829,16 @@ IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl, 
ValueSet*, void)
     }
 }
 
-IMPL_LINK_NOARG(SvxNumPickTabPage, DoubleClickHdl_Impl, ValueSet*, void)
+IMPL_LINK_NOARG(SvxNumPickTabPage, 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;
 }
 
 void SvxNumPickTabPage::PageCreated(const SfxAllItemSet& aSet)
diff --git a/cui/uiconfig/ui/pickoutlinepage.ui 
b/cui/uiconfig/ui/pickoutlinepage.ui
index 297809d0a919..f3e49467ff9a 100644
--- a/cui/uiconfig/ui/pickoutlinepage.ui
+++ b/cui/uiconfig/ui/pickoutlinepage.ui
@@ -2,32 +2,46 @@
 <!-- Generated with glade 3.40.0 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
-  <object class="GtkScrolledWindow" id="PickOutlinePage">
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name pixbuf -->
+      <column type="GdkPixbuf"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkGrid" id="PickOutlinePage">
     <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_outline_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="pickoutlinepage|extended_tip|valueset">Click the 
outline style that you want to use.</property>
+              <object class="AtkObject" id="pick_outline_iconview-atkobject">
+                <property name="AtkObject::accessible-description" 
translatable="yes" 
context="pickoutlinepage|extended_tip|pick_outline_iconview">Click the outline 
style 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 ac14d0ed80f8..843d35f62483 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -284,13 +284,14 @@ class formatBulletsNumbering(UITestCase):
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "2")
                 xOutlinePage = xDialog.getChild("PickOutlinePage")
-                xselector = xOutlinePage.getChild("valueset")
-                self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], 
"8")
+                xselector = xOutlinePage.getChild("pick_outline_iconview")
                 # Select element num 1
-                xselector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"1"}))
+                element1 = xselector.getChild("0")
+                element1.executeAction("SELECT", mkPropertyValues({}))
+                self.assertEqual(get_state_as_dict(xselector)["VisibleCount"], 
"8")
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0")
-                
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1")
-                self.assertEqual(get_state_as_dict(xselector)["ItemText"], 
"Uppercase Roman, uppercase letters, numeric, lowercase letters, lowercase 
Roman, solid small circular bullet")
+                
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "0")
+                
self.assertEqual(get_state_as_dict(xselector)["SelectEntryText"], "Uppercase 
Roman, uppercase letters, numeric, lowercase letters, lowercase Roman, solid 
small circular bullet")
 
                 # Select the GraphicPage's Selector
                 xTabs = xDialog.getChild("tabcontrol")

Reply via email to