sw/source/ui/vba/vbalistformat.cxx |   31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit 23dcd3fe7ae9d8128eb06e380eef023ef16d2702
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Aug 6 12:24:00 2022 +0200
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Aug 12 09:22:32 2022 +0200

    vba: extract the local variable instead of accessing iterator
    
    Change-Id: I2f6dca6fa6f1f23602cbab28ef933725dfc9c3b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138166
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sw/source/ui/vba/vbalistformat.cxx 
b/sw/source/ui/vba/vbalistformat.cxx
index 5778776d2c30..efcbf2dbe874 100644
--- a/sw/source/ui/vba/vbalistformat.cxx
+++ b/sw/source/ui/vba/vbalistformat.cxx
@@ -146,13 +146,14 @@ void SAL_CALL SwVbaListFormat::ConvertNumbersToText(  )
     addParagraphsToList(mxTextRange, aParagraphs);
 
     // in reverse order, to get proper label strings
-    for (auto it = aParagraphs.rbegin(); it != aParagraphs.rend(); ++it)
+    for (auto iter = aParagraphs.rbegin(); iter != aParagraphs.rend(); ++iter)
     {
-        if (bool bNumber; ((*it)->getPropertyValue("NumberingIsNumber") >>= 
bNumber) && bNumber)
+        auto& rPropertySet = *iter;
+        if (bool bNumber; (rPropertySet->getPropertyValue("NumberingIsNumber") 
>>= bNumber) && bNumber)
         {
-            css::uno::Reference<css::text::XTextRange> xRange(*it, 
css::uno::UNO_QUERY_THROW);
+            css::uno::Reference<css::text::XTextRange> xRange(rPropertySet, 
css::uno::UNO_QUERY_THROW);
             OUString sLabelString;
-            (*it)->getPropertyValue("ListLabelString") >>= sLabelString;
+            rPropertySet->getPropertyValue("ListLabelString") >>= sLabelString;
             // sal_Int16 nAdjust = SAL_MAX_INT16; // TODO?
             sal_Int16 nNumberingType = SAL_MAX_INT16; // 
css::style::NumberingType
             sal_Int16 nPositionAndSpaceMode = SAL_MAX_INT16;
@@ -171,9 +172,9 @@ void SAL_CALL SwVbaListFormat::ConvertNumbersToText(  )
 
             {
                 sal_uInt16 nLevel = SAL_MAX_UINT16;
-                (*it)->getPropertyValue("NumberingLevel") >>= nLevel;
+                rPropertySet->getPropertyValue("NumberingLevel") >>= nLevel;
                 css::uno::Reference<css::container::XIndexAccess> 
xNumberingRules;
-                (*it)->getPropertyValue("NumberingRules") >>= xNumberingRules;
+                rPropertySet->getPropertyValue("NumberingRules") >>= 
xNumberingRules;
                 comphelper::SequenceAsHashMap 
aLevelRule(xNumberingRules->getByIndex(nLevel));
 
                 // See offapi/com/sun/star/text/NumberingLevel.idl
@@ -279,19 +280,18 @@ void SAL_CALL SwVbaListFormat::ConvertNumbersToText(  )
                     // TODO: css::style::NumberingType::BITMAP
                 }
 
-                (*it)->setPropertyValue("ParaLeftMargin", 
css::uno::Any(nIndentAt));
-                (*it)->setPropertyValue("ParaFirstLineIndent", 
css::uno::Any(nFirstLineIndent));
+                rPropertySet->setPropertyValue("ParaLeftMargin", 
css::uno::Any(nIndentAt));
+                rPropertySet->setPropertyValue("ParaFirstLineIndent", 
css::uno::Any(nFirstLineIndent));
                 if (nLabelFollowedBy == 
SvxNumberFormat::LabelFollowedBy::LISTTAB)
                 {
                     css::uno::Sequence<css::style::TabStop> stops;
-                    (*it)->getPropertyValue("ParaTabStops") >>= stops;
+                    rPropertySet->getPropertyValue("ParaTabStops") >>= stops;
                     css::style::TabStop tabStop{};
                     tabStop.Position = nListtabStopPosition;
                     tabStop.Alignment = 
com::sun::star::style::TabAlign::TabAlign_LEFT;
                     tabStop.FillChar = ' ';
-                    (*it)->setPropertyValue(
-                        "ParaTabStops",
-                        css::uno::Any(comphelper::combineSequences({ tabStop 
}, stops)));
+                    rPropertySet->setPropertyValue("ParaTabStops",
+                                    
css::uno::Any(comphelper::combineSequences({ tabStop }, stops)));
                     // FIXME: What if added tap stop is greater than already 
defined ones?
                 }
             }
@@ -299,9 +299,12 @@ void SAL_CALL SwVbaListFormat::ConvertNumbersToText(  )
             {
                 continue; // for now, keep such lists as is
             }
+
             // In case of higher outline levels, each assignment of empty 
value just sets level 1
-            while ((*it)->getPropertyValue("NumberingRules") != 
css::uno::Any())
-                (*it)->setPropertyValue("NumberingRules", css::uno::Any());
+            while (rPropertySet->getPropertyValue("NumberingRules") != 
css::uno::Any())
+            {
+                rPropertySet->setPropertyValue("NumberingRules", 
css::uno::Any());
+            }
         }
     }
 }

Reply via email to