[Libreoffice-commits] core.git: sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 16 13:16:09 UTC 2021


 sw/source/core/doc/number.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit e52bbca626e2cbe2f4d13632f65967604abb0abc
Author:     Noel Grandin <noel at peralex.com>
AuthorDate: Tue Jun 15 15:27:40 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jun 16 15:15:32 2021 +0200

    tdf#135316 docx open performance
    
    avoid unnecessary SwNumFormat creation
    
    Change-Id: I62a16fdeb1225606a54f384e5196e5137e8d2139
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117271
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index eb84b1b63a68..00eeed63ec70 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -916,10 +916,15 @@ SvxNumRule SwNumRule::MakeSvxNumRule() const
                      meRuleType == NUM_RULE ? SvxNumRuleType::NUMBERING : SvxNumRuleType::OUTLINE_NUMBERING );
     for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
     {
-        SwNumFormat aNumFormat = Get(n);
-        if(aNumFormat.GetCharFormat())
-            aNumFormat.SetCharFormatName(aNumFormat.GetCharFormat()->GetName());
-        aRule.SetLevel(n, aNumFormat, maFormats[n] != nullptr);
+        const SwNumFormat & rNumFormat = Get(n);
+        if(rNumFormat.GetCharFormat())
+        {
+            SwNumFormat aNewFormat = rNumFormat;
+            aNewFormat.SetCharFormatName(rNumFormat.GetCharFormat()->GetName());
+            aRule.SetLevel(n, aNewFormat, maFormats[n] != nullptr);
+        }
+        else
+            aRule.SetLevel(n, rNumFormat, maFormats[n] != nullptr);
     }
     return aRule;
 }


More information about the Libreoffice-commits mailing list