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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 17 05:05:56 UTC 2019


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

New commits:
commit 17eb2f4d403cdbbacb8fa2c14a006b25241815d4
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Aug 16 15:07:12 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Aug 17 07:05:07 2019 +0200

    Use a nice way of merging ranges
    
    ... which will ensure correct sorted order of the ranges.
    
    Change-Id: I6acb068c38af581354f4736f8058cf73d14f5dc2
    Reviewed-on: https://gerrit.libreoffice.org/77585
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 0b1b3c78b083..e47a0b11a904 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1783,7 +1783,8 @@ void SwUnoCursorHelper::SetPropertyValues(
     OUString aUnknownExMsg, aPropertyVetoExMsg;
 
     // Build set of attributes we want to fetch
-    std::vector<sal_uInt16> aWhichPairs;
+    const sal_uInt16 zero = 0;
+    SfxItemSet aItemSet(pDoc->GetAttrPool(), &zero);
     std::vector<std::pair<const SfxItemPropertySimpleEntry*, const uno::Any&>> aEntries;
     aEntries.reserve(rPropertyValues.getLength());
     for (const auto& rPropVal : rPropertyValues)
@@ -1803,19 +1804,13 @@ void SwUnoCursorHelper::SetPropertyValues(
         {
             aPropertyVetoExMsg += "Property is read-only: '" + rPropertyName + "' ";
             continue;
-        } else {
-// FIXME: we should have some nice way of merging ranges surely ?
-            aWhichPairs.push_back(pEntry->nWID);
-            aWhichPairs.push_back(pEntry->nWID);
         }
+        aItemSet.MergeRange(pEntry->nWID, pEntry->nWID);
         aEntries.emplace_back(pEntry, rPropVal.Value);
     }
 
-    if (!aWhichPairs.empty())
+    if (!aEntries.empty())
     {
-        aWhichPairs.push_back(0); // terminate
-        SfxItemSet aItemSet(pDoc->GetAttrPool(), aWhichPairs.data());
-
         // Fetch, overwrite, and re-set the attributes from the core
 
         bool bPreviousPropertyCausesSideEffectsInNodes = false;


More information about the Libreoffice-commits mailing list