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 <samuel.mehrbrodt@allotropia.de>
Tested-by: Jenkins
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 461f835..7794400 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 85eb84b..0de62a1 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 c4afeac..93f29d7 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 d2d2a07..6a60cd4 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 fa4de6b..4606b62 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()));