diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-03-01 22:04:09 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-03 16:11:00 +0000 |
commit | ff202419fc61081d8dff17fbf8a543fc0f47bf48 (patch) | |
tree | b2f209faff93a7dbf6492d2b73bc6e22a0830ae1 /sw | |
parent | 94190e176d7a0384455b79c9cf15b08c032d98c6 (diff) |
sw: tdf#91131 when renaming a SwNumRule, also ...
... update the DocumentListsManager::maLists because without that all
list styles created in the UI will have GetDefaultListStyleName() ==
"Untitled1" and then deleting one of them deletes all these entries from
maList, which makes the DocumentListsManager unhappy.
Change-Id: Ic40e561fc540881ab29566a3f5ecdc8a180c97ef
(cherry picked from commit 69ff012f1a2d10b3284586474f2add4e88eabcfb)
Reviewed-on: https://gerrit.libreoffice.org/22834
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/list.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentListsManager.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/list.cxx | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/sw/inc/list.hxx b/sw/inc/list.hxx index 0cb1ba5c9536..2c3daf7d981a 100644 --- a/sw/inc/list.hxx +++ b/sw/inc/list.hxx @@ -39,6 +39,7 @@ class SwList const OUString GetListId() const; const OUString GetDefaultListStyleName() const; + void SetDefaultListStyleName(OUString const&); void InsertListItem( SwNodeNum& rNodeNum, const int nLevel ); diff --git a/sw/source/core/doc/DocumentListsManager.cxx b/sw/source/core/doc/DocumentListsManager.cxx index dfd9a260f2e1..5285c8768691 100644 --- a/sw/source/core/doc/DocumentListsManager.cxx +++ b/sw/source/core/doc/DocumentListsManager.cxx @@ -182,6 +182,13 @@ void DocumentListsManager::trackChangeOfListStyleName( const OUString& sListStyl maListStyleLists.erase( sListStyleName ); maListStyleLists[sNewListStyleName] = pList; } + for (auto & it : maLists) // tdf#91131 update these references too + { + if (it.second->GetDefaultListStyleName() == sListStyleName) + { + it.second->SetDefaultListStyleName(sNewListStyleName); + } + } } diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx index a35d90e55478..4d0bac68f47b 100644 --- a/sw/source/core/doc/list.cxx +++ b/sw/source/core/doc/list.cxx @@ -51,7 +51,6 @@ class SwListImpl bool IsListLevelMarked( const int nListLevel ) const; - private: // unique identifier of the list const OUString msListId; // default list style for the list items, identified by the list style name @@ -233,6 +232,11 @@ const OUString SwList::GetDefaultListStyleName() const return mpListImpl->GetDefaultListStyleName(); } +void SwList::SetDefaultListStyleName(OUString const& rNew) +{ + mpListImpl->msDefaultListStyleName = rNew; +} + void SwList::InsertListItem( SwNodeNum& rNodeNum, const int nLevel ) { |