diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-03-01 22:04:09 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-03-02 15:07:02 +0100 |
commit | 69ff012f1a2d10b3284586474f2add4e88eabcfb (patch) | |
tree | 278d6a8b6c3011b8e012ed3009b938bc4834b54a /sw | |
parent | 38f3b3fd31143495249a67c9526fe2a47dafe861 (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
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 5a90a37cff9d..d2b86ae45154 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 f08d102acf09..4976f07ca99e 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 @@ -232,6 +231,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 ) { |