25#include <osl/diagnose.h>
36 const OUString& sDefaultListStyleName )
38 OUString sListId = rListId;
39 if ( sListId.isEmpty() )
46 OSL_FAIL(
"<DocumentListsManager::createList(..)> - provided list id already used. Serious defect." );
51 if ( !pDefaultNumRuleForNewList )
53 OSL_FAIL(
"<DocumentListsManager::createList(..)> - for provided default list style name no list style is found. Serious defect." );
58 maLists[sListId].reset(pNewList);
67 auto aListIter =
maLists.find( sListId );
68 if ( aListIter !=
maLists.end() )
70 pList = (*aListIter).second.get();
78 if ( sListStyleName.isEmpty() )
80 OSL_FAIL(
"<DocumentListsManager::createListForListStyle(..)> - no list style name provided. Serious defect." );
86 OSL_FAIL(
"<DocumentListsManager::createListForListStyle(..)> - a list for the provided list style name already exists. Serious defect." );
93 OSL_FAIL(
"<DocumentListsManager::createListForListStyle(..)> - for provided list style name no list style is found. Serious defect." );
111 std::unordered_map< OUString, SwList* >::const_iterator
115 pList = (*aListIter).second;
127 "<DocumentListsManager::deleteListForListStyle(..)> - misusage of method: no list found for given list style name" );
133 if ( !sListId.isEmpty() )
142 auto aListIter =
maLists.begin();
143 while ( aListIter !=
maLists.end() )
145 if ( (*aListIter).second->GetDefaultListStyleName() == rListStyleName )
147 aListIter =
maLists.erase(aListIter);
155 const OUString& sNewListStyleName )
159 "<DocumentListsManager::changeOfListStyleName(..)> - misusage of method: no list found for given list style name" );
161 if ( pList !=
nullptr )
168 if (it.second->GetDefaultListStyleName() == sListStyleName)
184 OUString aTmpStr = aSuggestedUniqueListId;
188 aTmpStr = aSuggestedUniqueListId + OUString::number( nHitCount );
196 static bool bHack = (getenv(
"LIBO_ONEWAY_STABLE_ODF_EXPORT") !=
nullptr);
199 static sal_Int64 nIdCounter = SAL_CONST_INT64(7000000000);
200 return MakeListIdUnique( OUString(
"list" + OUString::number(nIdCounter++) ) );
206 std::numeric_limits<unsigned int>::max()));
207 OUString
const aNewListId =
"list" + OUString::number(
n);
SwNumRule * FindNumRulePtr(const OUString &rName) const
const OUString & GetListId() const
void SetDefaultListStyleName(OUString const &)
const OUString & GetDefaultListId() const
void SetDefaultListId(const OUString &sDefaultListId)
std::unordered_map< OUString, SwListPtr > maLists
std::unordered_map< OUString, SwList * > maListStyleLists
SwList * createList(const OUString &rListId, const OUString &rDefaultListStyleName) override
void deleteListsByDefaultListStyle(const OUString &rListStyleName) override
OUString CreateUniqueListId()
OUString MakeListIdUnique(const OUString &aSuggestedUniqueListId)
SwList * getListByName(const OUString &rListId) const override
SwList * getListForListStyle(const OUString &rListStyleName) const override
DocumentListsManager(SwDoc &i_rSwdoc)
virtual ~DocumentListsManager() override
void trackChangeOfListStyleName(const OUString &rListStyleName, const OUString &rNewListStyleName) override
void deleteListForListStyle(const OUString &rListStyleName) override
void createListForListStyle(const OUString &rListStyleName) override
unsigned int uniform_uint_distribution(unsigned int a, unsigned int b)
Dialog to specify the properties of date form field.