sw/source/core/unocore/unocrsrhelper.cxx |   10 ++++------
 sw/source/core/unocore/unoobj.cxx        |    5 +++--
 2 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit d24ee3af9eeed6da3ba7f226dd93fbb721087a53
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jul 19 17:40:47 2021 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Jul 20 00:39:11 2021 +0200

    Use WhichRangesContainer::MergeRange instead of SfxItemSet::MergeRange
    
    The former is cheaper: it does not need to recreate item array each time.
    
    Change-Id: Iab65929b4f1a1325ebe572b37503b041371998ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119225
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index f50cc69cb5b0..be694be3ce65 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1292,7 +1292,7 @@ void makeRedline( SwPaM const & rPaM,
             SwDoc& rDoc = rPaM.GetDoc();
 
             // Build set of attributes we want to fetch
-            std::vector<std::pair<sal_uInt16, sal_uInt16>> aWhichPairs;
+            WhichRangesContainer aWhichPairs;
             std::vector<SfxItemPropertyMapEntry const*> aEntries;
             std::vector<uno::Any> aValues;
             aEntries.reserve(aRevertProperties.getLength());
@@ -1314,12 +1314,12 @@ void makeRedline( SwPaM const & rPaM,
                 }
                 else if (rPropertyName == "NumberingRules")
                 {
-                    aWhichPairs.emplace_back(RES_PARATR_NUMRULE, 
RES_PARATR_NUMRULE);
+                    aWhichPairs = aWhichPairs.MergeRange(RES_PARATR_NUMRULE, 
RES_PARATR_NUMRULE);
                     nNumId = aEntries.size();
                 }
                 else
                 {
-                    aWhichPairs.emplace_back(pEntry->nWID, pEntry->nWID);
+                    aWhichPairs = aWhichPairs.MergeRange(pEntry->nWID, 
pEntry->nWID);
                     if (rPropertyName == "ParaStyleName")
                         nStyleId = aEntries.size();
                 }
@@ -1331,9 +1331,7 @@ void makeRedline( SwPaM const & rPaM,
             {
                 sal_uInt16 nStylePoolId = USHRT_MAX;
                 OUString sParaStyleName;
-                SfxItemSet aItemSet(rDoc.GetAttrPool(), 
WhichRangesContainer());
-                for (const auto& [nWhich1, nWhich2] : aWhichPairs)
-                    aItemSet.MergeRange(nWhich1, nWhich2);
+                SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs);
 
                 for (size_t i = 0; i < aEntries.size(); ++i)
                 {
diff --git a/sw/source/core/unocore/unoobj.cxx 
b/sw/source/core/unocore/unoobj.cxx
index c841e05021a5..acd5d50f23d0 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1771,7 +1771,7 @@ void SwUnoCursorHelper::SetPropertyValues(
     OUString aUnknownExMsg, aPropertyVetoExMsg;
 
     // Build set of attributes we want to fetch
-    SfxItemSet aItemSet(rDoc.GetAttrPool(), WhichRangesContainer());
+    WhichRangesContainer aRanges;
     std::vector<std::pair<const SfxItemPropertyMapEntry*, const uno::Any&>> 
aEntries;
     aEntries.reserve(rPropertyValues.getLength());
     for (const auto& rPropVal : rPropertyValues)
@@ -1792,13 +1792,14 @@ void SwUnoCursorHelper::SetPropertyValues(
             aPropertyVetoExMsg += "Property is read-only: '" + rPropertyName + 
"' ";
             continue;
         }
-        aItemSet.MergeRange(pEntry->nWID, pEntry->nWID);
+        aRanges = aRanges.MergeRange(pEntry->nWID, pEntry->nWID);
         aEntries.emplace_back(pEntry, rPropVal.Value);
     }
 
     if (!aEntries.empty())
     {
         // Fetch, overwrite, and re-set the attributes from the core
+        SfxItemSet aItemSet(rDoc.GetAttrPool(), aRanges);
 
         bool bPreviousPropertyCausesSideEffectsInNodes = false;
         for (size_t i = 0; i < aEntries.size(); ++i)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to