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 00c92662a688e04c0dcec0db6c253689d662faeb Author: Samuel Mehrbrodt <[email protected]> AuthorDate: Mon Jun 3 10:59:04 2024 +0200 Commit: Samuel Mehrbrodt <[email protected]> CommitDate: Mon Jun 3 14:32:32 2024 +0200 tdf#161248 Don't duplicate bullets used in document Change-Id: I0ef01a6be8207d4cffc89b95dc9ca3bf1baf38d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168358 Reviewed-by: Samuel Mehrbrodt <[email protected]> Tested-by: Jenkins diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 461f835bc2a5..77944005ec3d 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1102,7 +1102,7 @@ public: const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode = SvxNumberFormat::LABEL_WIDTH_AND_POSITION ); sal_uInt16 FindNumRule( std::u16string_view rName ) const; - std::vector<OUString> GetUsedBullets(); + std::set<OUString> GetUsedBullets(); SW_DLLPUBLIC SwNumRule* FindNumRulePtr( const OUString& rName ) const; // Deletion only possible if Rule is not used! diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 85eb84bca3f5..0de62a1d27de 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 c4afeac7c50f..93f29d72f1fb 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2526,9 +2526,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) @@ -2543,7 +2543,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 d2d2a0749043..6a60cd47dd40 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -876,7 +876,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 fa4de6bd9d0d..4606b6228bbc 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -2855,7 +2855,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()));
