cui/source/tabpages/numpages.cxx                           |   23 +-----
 include/svx/strings.hrc                                    |    9 --
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   35 +++++++++
 svx/source/dialog/svxbmpnumvalueset.cxx                    |   48 ++++---------
 svx/source/sidebar/nbdtmg.cxx                              |   26 ++-----
 sw/qa/uitest/writer_tests2/formatBulletsNumbering.py       |    3 
 6 files changed, 66 insertions(+), 78 deletions(-)

New commits:
commit f944648e0f5d52605a267ed50bba4bfc035aecc6
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Thu Feb 22 11:55:30 2024 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Feb 26 13:26:20 2024 +0100

    tdf#108697 Allow modifying default bullet selection
    
    Allow to change bullets in configuration.
    
    Change-Id: Iab26118dd597417997d6f0a7355f516a4da97ee4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163735
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 36868e3579ab..8bba652c594e 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -55,6 +55,7 @@
 #include <comphelper/lok.hxx>
 #include <svx/svxids.hrc>
 #include <o3tl/string_view.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include <algorithm>
 #include <memory>
@@ -122,19 +123,6 @@ static SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const 
Sequence<PropertyValu
     return pNew;
 }
 
-// the selection of bullets from the OpenSymbol
-const sal_Unicode aBulletTypes[] =
-{
-    0x2022,
-    0x25cf,
-    0xe00c,
-    0xe00a,
-    0x2794,
-    0x27a2,
-    0x2717,
-    0x2714
-};
-
 // Is one of the masked formats set?
 static bool lcl_IsNumFmtSet(SvxNumRule const * pNum, sal_uInt16 nLevelMask)
 {
@@ -149,7 +137,7 @@ static bool lcl_IsNumFmtSet(SvxNumRule const * pNum, 
sal_uInt16 nLevelMask)
     return bRet;
 }
 
-static const vcl::Font& lcl_GetDefaultBulletFont()
+static vcl::Font& lcl_GetDefaultBulletFont()
 {
     static vcl::Font aDefBulletFont = []()
     {
@@ -443,8 +431,11 @@ IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl, 
ValueSet*, void)
 
     bPreset = false;
     bModified = true;
-    sal_Unicode cChar = aBulletTypes[m_xExamplesVS->GetSelectedItemId() - 1];
-    const vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
+    sal_uInt16 nIndex = m_xExamplesVS->GetSelectedItemId() - 1;
+    sal_Unicode cChar = 
officecfg::Office::Common::BulletsNumbering::DefaultBullets::get()[nIndex].toChar();
+    vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
+    rActBulletFont.SetFamilyName(
+        
officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get()[nIndex]);
 
     sal_uInt16 nMask = 1;
     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index eb8e06f0c4c7..3813f9dfceca 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1367,15 +1367,6 @@
 #define RID_SVXSTR_ERR_OLD_PASSWD                           
NC_("RID_SVXSTR_ERR_OLD_PASSWD", "Invalid password")
 #define RID_SVXSTR_ERR_REPEAT_PASSWD                        
NC_("RID_SVXSTR_ERR_REPEAT_PASSWD", "Passwords do not match")
 
-#define RID_SVXSTR_BULLET_DESCRIPTION_0                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_0", "Solid small circular bullets")
-#define RID_SVXSTR_BULLET_DESCRIPTION_1                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_1", "Solid large circular bullets")
-#define RID_SVXSTR_BULLET_DESCRIPTION_2                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_2", "Solid diamond bullets")
-#define RID_SVXSTR_BULLET_DESCRIPTION_3                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_3", "Solid large square bullets")
-#define RID_SVXSTR_BULLET_DESCRIPTION_4                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_4", "Right pointing arrow bullets filled 
out")
-#define RID_SVXSTR_BULLET_DESCRIPTION_5                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_5", "Right pointing arrow bullets")
-#define RID_SVXSTR_BULLET_DESCRIPTION_6                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_6", "Cross mark bullets")
-#define RID_SVXSTR_BULLET_DESCRIPTION_7                     
NC_("RID_SVXSTR_BULLET_DESCRIPTION_7", "Check mark bullets")
-
 // do not translate this; instead describe the nth numbering style 
(LC_NumberingLevel) defined by your locale
 #define RID_SVXSTR_SINGLENUM_DESCRIPTION_0                  
NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_0", "Number 1) 2) 3)")
 #define RID_SVXSTR_SINGLENUM_DESCRIPTION_1                  
NC_("RID_SVXSTR_SINGLENUM_DESCRIPTION_1", "Number 1. 2. 3.")
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index adfa422f01b0..e43a6ac23765 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3327,6 +3327,41 @@
         </value>
       </prop>
     </group>
+    <group oor:name="BulletsNumbering">
+      <info>
+        <desc>Contains Favorite characters</desc>
+      </info>
+      <prop oor:name="DefaultBullets" oor:type="oor:string-list" 
oor:nillable="false">
+        <info>
+          <desc>List of default bullets</desc>
+        </info>
+        <value>
+          <it>•</it>
+          <it>●</it>
+          <it></it>
+          <it></it>
+          <it>➔</it>
+          <it>➢</it>
+          <it>✗</it>
+          <it>✔</it>
+        </value>
+      </prop>
+      <prop oor:name="DefaultBulletsFonts" oor:type="oor:string-list" 
oor:nillable="false">
+        <info>
+          <desc>List of default bullet fonts. Matching font for 
`DefaultBullets`.</desc>
+        </info>
+        <value>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+          <it>OpenSymbol</it>
+        </value>
+      </prop>
+    </group>
     <group oor:name="Help">
       <info>
         <desc>Contains settings that specify the common help settings.</desc>
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx 
b/svx/source/dialog/svxbmpnumvalueset.cxx
index 29dc2ddcc3df..11ac2c6a2755 100644
--- a/svx/source/dialog/svxbmpnumvalueset.cxx
+++ b/svx/source/dialog/svxbmpnumvalueset.cxx
@@ -25,6 +25,7 @@
 #include <i18nlangtag/mslangid.hxx>
 #include <svtools/valueset.hxx>
 #include <editeng/numitem.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <svx/gallery.hxx>
 #include <vcl/event.hxx>
 #include <vcl/graph.hxx>
@@ -46,20 +47,6 @@ using namespace com::sun::star::text;
 using namespace com::sun::star::container;
 using namespace com::sun::star::style;
 
-
-// The selection of bullets from the star symbol
-const sal_Unicode aBulletTypes[] =
-{
-    0x2022,
-    0x25cf,
-    0xe00c,
-    0xe00a,
-    0x2794,
-    0x27a2,
-    0x2717,
-    0x2714
-};
-
 static vcl::Font& lcl_GetDefaultBulletFont()
 {
     static vcl::Font aDefBulletFont = []()
@@ -95,18 +82,6 @@ static void lcl_PaintLevel(OutputDevice* pVDev, sal_Int16 
nNumberingType,
     }
 }
 
- const TranslateId RID_SVXSTR_BULLET_DESCRIPTIONS[] =
-{
-    RID_SVXSTR_BULLET_DESCRIPTION_0,
-    RID_SVXSTR_BULLET_DESCRIPTION_1,
-    RID_SVXSTR_BULLET_DESCRIPTION_2,
-    RID_SVXSTR_BULLET_DESCRIPTION_3,
-    RID_SVXSTR_BULLET_DESCRIPTION_4,
-    RID_SVXSTR_BULLET_DESCRIPTION_5,
-    RID_SVXSTR_BULLET_DESCRIPTION_6,
-    RID_SVXSTR_BULLET_DESCRIPTION_7
-};
-
 const TranslateId RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] =
 {
     RID_SVXSTR_SINGLENUM_DESCRIPTION_0,
@@ -152,7 +127,8 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
 
     vcl::RenderContext* pDev = rUDEvt.GetRenderContext();
     tools::Rectangle aRect = rUDEvt.GetRect();
-    sal_uInt16 nItemId = rUDEvt.GetItemId();
+    sal_uInt16 nIndex = rUDEvt.GetItemId() - 1;
+
 
     tools::Long nRectWidth = aRect.GetWidth();
     tools::Long nRectHeight = aRect.GetHeight();
@@ -171,8 +147,15 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt 
)
     aRuleFont.SetFontSize(aSize);
     aRuleFont.SetColor(aTextColor);
     aRuleFont.SetFillColor(aBackColor);
+    css::uno::Sequence< OUString > aBulletSymbols;
+
     if(ePageType == NumberingPageType::BULLET)
+    {
+        aBulletSymbols = 
officecfg::Office::Common::BulletsNumbering::DefaultBullets::get();
+        css::uno::Sequence< OUString > 
aBulletFonts(officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get());
+        aRuleFont.SetFamilyName(aBulletFonts[nIndex]);
         aFont = aRuleFont;
+    }
     else if(ePageType == NumberingPageType::OUTLINE)
     {
         aSize.setHeight( nRectHeight/8 );
@@ -225,15 +208,15 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& 
rUDEvt )
             OUString sText;
             if(ePageType == NumberingPageType::BULLET)
             {
-                sText = OUString( aBulletTypes[nItemId - 1] );
+                sText = aBulletSymbols[nIndex];
                 aStart.AdjustY( -(pDev->GetTextHeight()/2) );
                 aStart.setX( aBLPos.X() + 5 );
             }
             else
             {
-                if(xFormatter.is() && aNumSettings.getLength() > nItemId - 1)
+                if(xFormatter.is() && aNumSettings.getLength() > nIndex)
                 {
-                    Sequence<PropertyValue> aLevel = 
aNumSettings.getConstArray()[nItemId - 1];
+                    Sequence<PropertyValue> aLevel = 
aNumSettings.getConstArray()[nIndex];
                     try
                     {
                         aLevel.realloc(aLevel.getLength() + 1);
@@ -264,9 +247,9 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
         tools::Long nStartX = aOrgRect.Left();
         tools::Long nStartY = aOrgRect.Top();
 
-        if(xFormatter.is() && aOutlineSettings.getLength() > nItemId - 1)
+        if(xFormatter.is() && aOutlineSettings.getLength() > nIndex)
         {
-            Reference<XIndexAccess> xLevel = 
aOutlineSettings.getArray()[nItemId - 1];
+            Reference<XIndexAccess> xLevel = 
aOutlineSettings.getArray()[nIndex];
             try
             {
                 OUString sLevelTexts[5];
@@ -419,7 +402,6 @@ void SvxNumValueSet::init(NumberingPageType eType)
         for ( sal_uInt16 i = 0; i < 8; i++ )
         {
             InsertItem( i + 1, i );
-            SetItemText(i + 1, SvxResId(RID_SVXSTR_BULLET_DESCRIPTIONS[i]));
         }
     }
 }
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index b8c8bccfc19c..d86b80fa7f88 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -40,6 +40,7 @@
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/pathoptions.hxx>
 #include <editeng/eeitem.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include <com/sun/star/text/VertOrientation.hpp>
 #include <com/sun/star/style/NumberingType.hpp>
@@ -61,7 +62,7 @@ namespace svx::sidebar {
 
 namespace {
 
-const vcl::Font& lcl_GetDefaultBulletFont()
+vcl::Font& lcl_GetDefaultBulletFont()
 {
     static vcl::Font aDefBulletFont = []()
     {
@@ -76,18 +77,6 @@ const vcl::Font& lcl_GetDefaultBulletFont()
     return aDefBulletFont;
 }
 
-const sal_Unicode aDefaultBulletTypes[] =
-{
-    0x2022,
-    0x25cf,
-    0xe00c,
-    0xe00a,
-    0x2794,
-    0x27a2,
-    0x2717,
-    0x2714
-};
-
 NumSettings_Impl* lcl_CreateNumberingSettingsPtr(const 
Sequence<PropertyValue>& rLevelProps)
 {
     NumSettings_Impl* pNew = new NumSettings_Impl;
@@ -261,17 +250,20 @@ BulletsTypeMgr& BulletsTypeMgr::GetInstance()
 
 void BulletsTypeMgr::Init()
 {
-    const vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
+    css::uno::Sequence< OUString > 
aBulletSymbols(officecfg::Office::Common::BulletsNumbering::DefaultBullets::get());
+    css::uno::Sequence< OUString > 
aBulletSymbolsFonts(officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get());
+
+    vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont();
 
     for (sal_uInt16 i=0;i<DEFAULT_BULLET_TYPES;i++)
     {
         pActualBullets[i] = new BulletsSettings;
-        pActualBullets[i]->cBulletChar = aDefaultBulletTypes[i];
+        pActualBullets[i]->cBulletChar = aBulletSymbols[i].toChar();
+        rActBulletFont.SetFamilyName(aBulletSymbolsFonts[i]);
         pActualBullets[i]->aFont = rActBulletFont;
-        OString id = OString::Concat(RID_SVXSTR_BULLET_DESCRIPTION_0.getId()) 
+ OString::number(i);
-        pActualBullets[i]->sDescription = SvxResId( 
TranslateId(RID_SVXSTR_BULLET_DESCRIPTION_0.mpContext, id.getStr()) );
     }
 }
+
 sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 
mLevel,sal_uInt16 nFromIndex)
 {
     if ( mLevel == sal_uInt16(0xFFFF) || mLevel == 0)
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py 
b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index c01ad8010587..b3c5484964d4 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -207,13 +207,10 @@ class formatBulletsNumbering(UITestCase):
                 xselector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"3"}))
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2")
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3")
-                self.assertEqual(get_state_as_dict(xselector)["ItemText"], 
"Solid diamond bullets")
                 # Select element num 7
                 xselector.executeAction("CHOOSE", mkPropertyValues({"POS": 
"7"}))
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6")
                 
self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7")
-                self.assertEqual(get_state_as_dict(xselector)["ItemText"], 
"Cross mark bullets")
-
 
             # Test other Pages
             with 
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") 
as xDialog:

Reply via email to