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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 25 04:00:56 UTC 2021


 sw/source/filter/ww8/ww8par3.cxx |   17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

New commits:
commit cd09753cb04a0649dfa9d3cb73ad7514af2d03bd
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Tue Apr 20 12:06:07 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Fri Jun 25 06:00:18 2021 +0200

    NFC: cleanup unnecessary variables, reduce scope.
    
    This function look a LOT different
    way back at original import,
    and some of the refactoring since then
    left things a bit messy.
    
    The impetus for changing this was to see how m_nListLevel
    was being used, and having it assigned to a temporary
    const variable for no reason was annoying.
    
    Change-Id: Ia25397dbe4bce2fd7bdfbb1b3053bd271c08212a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114404
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 71864ead9beb..80bfebd68a61 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1766,17 +1766,11 @@ void SwWW8ImplReader::RegisterNumFormatOnStyle(sal_uInt16 nStyle)
     rStyleInf.maWordLR.reset(ItemGet<SvxLRSpaceItem>(*rStyleInf.m_pFormat, RES_LR_SPACE).Clone());
 
     // Phase 2: refresh StyleDef after reading all Lists
-    SwNumRule* pNmRule = nullptr;
-    const sal_uInt16 nLFO = rStyleInf.m_nLFOIndex;
-    const sal_uInt8  nLevel = rStyleInf.m_nListLevel;
-    if (
-         (USHRT_MAX > nLFO) &&
-         (WW8ListManager::nMaxLevel > nLevel)
-       )
+    if (rStyleInf.m_nLFOIndex < USHRT_MAX && rStyleInf.m_nListLevel < WW8ListManager::nMaxLevel)
     {
         std::vector<sal_uInt8> aParaSprms;
-        pNmRule = m_xLstManager->GetNumRuleForActivation(nLFO, nLevel,
-            aParaSprms);
+        SwNumRule* pNmRule = m_xLstManager->GetNumRuleForActivation(
+            rStyleInf.m_nLFOIndex, rStyleInf.m_nListLevel, aParaSprms);
 
         if (pNmRule != nullptr)
         {
@@ -1791,11 +1785,10 @@ void SwWW8ImplReader::RegisterNumFormatOnStyle(sal_uInt16 nStyle)
                     SwNumRuleItem(pNmRule->GetName()));
                 rStyleInf.m_bHasStyNumRule = true;
             }
+
+            SetStyleIndent(rStyleInf, pNmRule->Get(rStyleInf.m_nListLevel));
         }
     }
-
-    if (pNmRule)
-        SetStyleIndent(rStyleInf, pNmRule->Get(nLevel));
 }
 
 void SwWW8ImplReader::RegisterNumFormatOnTextNode(sal_uInt16 nCurrentLFO,


More information about the Libreoffice-commits mailing list