[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sw/inc sw/source

Michael Stahl mstahl at redhat.com
Thu Mar 3 16:11:22 UTC 2016


 sw/inc/list.hxx                             |    1 +
 sw/source/core/doc/DocumentListsManager.cxx |    7 +++++++
 sw/source/core/doc/list.cxx                 |    6 +++++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit ff202419fc61081d8dff17fbf8a543fc0f47bf48
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Mar 1 22:04:09 2016 +0100

    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 at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/inc/list.hxx b/sw/inc/list.hxx
index 0cb1ba5..2c3daf7 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 dfd9a26..5285c87 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 a35d90e..4d0bac6 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 )
 {


More information about the Libreoffice-commits mailing list