sw/inc/doc.hxx                      |    2 +-
 sw/inc/editsh.hxx                   |    2 +-
 sw/source/core/doc/docnum.cxx       |    6 +++---
 sw/source/core/edit/ednumber.cxx    |    2 +-
 sw/source/uibase/shells/textsh1.cxx |    4 +++-
 5 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit b871938afe6d146a7b86fcbb3db120ac30225a7f
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Jun 3 10:59:04 2024 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Fri Jun 7 22:13:30 2024 +0200

    tdf#161248 Don't duplicate bullets used in document
    
    Change-Id: I0ef01a6be8207d4cffc89b95dc9ca3bf1baf38d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168371
    Tested-by: allotropia jenkins <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 8f530d8646fa..a35954b7f8c8 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1103,7 +1103,7 @@ public:
             SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
     sal_uInt16 FindNumRule( std::u16string_view rName ) const;
     SwNumRule* FindNumRulePtr( const OUString& rName ) const;
-    std::vector<OUString> GetUsedBullets();
+    std::set<OUString> GetUsedBullets();
 
     // Deletion only possible if Rule is not used!
     bool RenameNumRule(const OUString & aOldName, const OUString & aNewName,
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 96433ea89955..f2c548229716 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -578,7 +578,7 @@ public:
      text node belongs, which applies the found list style. */
     const SwNumRule * SearchNumRule(const bool bNum,
                                     OUString& sListId );
-    std::vector<OUString> GetUsedBullets();
+    std::set<OUString> GetUsedBullets();
 
     /** Undo.
      Maintain UndoHistory in Document.
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index afc6e7134b4b..58b58218053d 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2521,9 +2521,9 @@ sal_uInt16 SwDoc::FindNumRule( std::u16string_view rName 
) const
     return USHRT_MAX;
 }
 
-std::vector<OUString> SwDoc::GetUsedBullets()
+std::set<OUString> SwDoc::GetUsedBullets()
 {
-    std::vector<OUString> aUsedBullets;
+    std::set<OUString> aUsedBullets;
     for (size_t nRule = 0; nRule < mpNumRuleTable->size(); ++nRule)
     {
         for (int nLevel=0; nLevel<10; ++nLevel)
@@ -2538,7 +2538,7 @@ std::vector<OUString> SwDoc::GetUsedBullets()
             sal_UCS4 cBullet = rFormat.GetBulletChar();
             OUString sBullet(&cBullet, 1);
             OUString sFontName(aFont.GetFamilyName());
-            aUsedBullets.emplace_back(sBullet + sFontName);
+            aUsedBullets.emplace(sBullet + sFontName);
         }
     }
     return aUsedBullets;
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 7217b7fbd989..7e609ffebec0 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -879,7 +879,7 @@ const SwNumRule * SwEditShell::SearchNumRule( const bool 
bNum,
                                     sListId, GetLayout() );
 }
 
-std::vector<OUString> SwEditShell::GetUsedBullets()
+std::set<OUString> SwEditShell::GetUsedBullets()
 {
     return GetDoc()->GetUsedBullets();
 }
diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index 4f452a8add37..9e7e0d8a9e45 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -2736,7 +2736,9 @@ void SwTextShell::GetState( SfxItemSet &rSet )
             break;
             case FN_BUL_GET_DOC_BULLETS:
             {
-                std::vector<OUString> aBullets = rSh.GetUsedBullets();
+                std::set<OUString> aBulletsSet = rSh.GetUsedBullets();
+                std::vector<OUString> aBullets;
+                std::copy(aBulletsSet.begin(), aBulletsSet.end(), 
std::back_inserter(aBullets));
                 SfxStringListItem aItem(FN_BUL_GET_DOC_BULLETS);
                 uno::Sequence<OUString> aSeq(aBullets.data(),
                                              
static_cast<sal_Int32>(aBullets.size()));

Reply via email to