slideshow/source/engine/shapes/drawshapesubsetting.cxx |   23 +++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 328646778fcf7242863f0fe20f33bd99d3386c63
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Sep 3 19:27:57 2018 +0300
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Sep 4 09:59:17 2018 +0200

    tdf#119146: fix populating maCurrentSubsets
    
    Regression from commit 4600b07c1d787f959618d9ecf54161e4ea4ffa61
    
    Before the mentioned commit, creating a subset X, and then adding
    sub-subsets until all the subset is excluded, had left the subset X
    with two *empty* nodes in maCurrentSubsets, 1st of them having both
    mnStartIndex and mnEndIndex equal to maSubset.mnStartIndex, and 2nd
    having both mnStartIndex and mnEndIndex equal to maSubset.mnEndIndex.
    
    The commit above changed that to adding maSubset to maCurrentSubsets
    in the beginning of each exclusion, which finally resulted in a messy
    maCurrentSubsets with multiple duplicating nodes effectively covering
    all maSubset. That resulted in the item as a whole handled *besides*
    the sub-subsets.
    
    This commit (1) avoids adding extra maSubset to maCurrentSubsets, and
    (2) adds the two empty nodes in case all the subset has been excluded
    by its sub-subsets.
    
    Change-Id: I7fc5f2d0b6ecf4f9247351da3a2746032150557b
    Reviewed-on: https://gerrit.libreoffice.org/59948
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit a8aaffa6ea0f0fd8cf1d22883173df64a93e3322)
    Reviewed-on: https://gerrit.libreoffice.org/59952
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx 
b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
index 849df8d9897c..f88a0337aa31 100644
--- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx
+++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
@@ -213,6 +213,25 @@ namespace slideshow
 
             maCurrentSubsets.insert(maCurrentSubsets.end(), 
aNodesToAppend.begin(),
                                     aNodesToAppend.end());
+            // Excluding subsets must not leave an absolutely empty 
maCurrentSubsets, because it
+            // would mean "non-subsetting" mode unconditionally, with whole 
object added to subsets.
+            // So to indicate a subset with all parts excluded, add two empty 
subsets (starting and
+            // ending).
+            if (maCurrentSubsets.empty())
+            {
+                if (maSubset.isEmpty())
+                {
+                    maCurrentSubsets.emplace_back(0, 0);
+                    maCurrentSubsets.emplace_back(maActionClassVector.size(),
+                                                  maActionClassVector.size());
+                }
+                else
+                {
+                    maCurrentSubsets.emplace_back(maSubset.getStartIndex(),
+                                                  maSubset.getStartIndex());
+                    maCurrentSubsets.emplace_back(maSubset.getEndIndex(), 
maSubset.getEndIndex());
+                }
+            }
         }
 
         void DrawShapeSubsetting::updateSubsets()
@@ -275,10 +294,10 @@ namespace slideshow
 
         void DrawShapeSubsetting::initCurrentSubsets()
         {
-            // only add subset to vector, if it's not empty - that's
+            // only add subset to vector, if vector is empty, and subset is 
not empty - that's
             // because the vector's content is later literally used
             // for e.g. painting.
-            if( !maSubset.isEmpty() )
+            if (maCurrentSubsets.empty() && !maSubset.isEmpty())
                 maCurrentSubsets.push_back( maSubset );
         }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to