[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/source

Armin Le Grand Armin.Le.Grand at cib.de
Wed Jun 27 11:57:41 UTC 2018


 sw/source/uibase/utlui/content.cxx |   60 +++++++++++++++++++++++++++----------
 1 file changed, 44 insertions(+), 16 deletions(-)

New commits:
commit c364699b92c859dc0230ffd8e67a97d805750666
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Fri Jun 22 15:16:16 2018 +0200

    tdf#118322 Avoid blinking in Exporer for 'Section' part
    
    When having entries in 'Section' part of the Explorer in
    Writer and there are invisible/hidden ones, the check for
    changes in visibility has to be done after the whole
    list is created since these Lists are sorted-lists. This
    was changed and worked before by directly comparing single
    list entries index-based with the old ones.
    
    Change-Id: I8e647cc9161d0555f84a028afbc6f37c716e8c9f
    Reviewed-on: https://gerrit.libreoffice.org/56296
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 74e047a9f8dd..f51e4de9a8fe 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -216,6 +216,29 @@ SwTOXBaseContent::~SwTOXBaseContent()
 {
 }
 
+namespace
+{
+    bool checkVisibilityChanged(
+        const SwContentArr& rSwContentArrA,
+        const SwContentArr& rSwContentArrB)
+    {
+        if(rSwContentArrA.size() != rSwContentArrB.size())
+        {
+            return true;
+        }
+
+        for(size_t a(0); a < rSwContentArrA.size(); a++)
+        {
+            if(rSwContentArrA[a]->IsInvisible() != rSwContentArrB[a]->IsInvisible())
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+} // end of anonymous namespace
+
 SwContentType::SwContentType(SwWrtShell* pShell, ContentTypeId nType, sal_uInt8 nLevel) :
     SwTypeNumber(CTYPE_CTT),
     pWrtShell(pShell),
@@ -296,14 +319,11 @@ void SwContentType::Init(bool* pbInvalidateWindow)
         case ContentTypeId::REGION :
         {
             SwContentArr*   pOldMember = nullptr;
-            size_t nOldRegionCount = 0;
-            bool bInvalidate = false;
             if(!pMember)
                 pMember = new SwContentArr;
             else if(!pMember->empty())
             {
                 pOldMember = pMember;
-                nOldRegionCount = pOldMember->size();
                 pMember = new SwContentArr;
             }
             const Point aNullPt;
@@ -335,12 +355,6 @@ void SwContentType::Init(bool* pbInvalidateWindow)
                         !aAskItem.pObject )     // not visible
                         pCnt->SetInvisible();
                     pMember->insert(pCnt);
-
-                    const size_t nPos = pMember->size() - 1;
-                    if(nOldRegionCount > nPos &&
-                        ((*pOldMember)[nPos])->IsInvisible()
-                                != pCnt->IsInvisible())
-                            bInvalidate = true;
                 }
             }
             nMemberCount = pMember->size();
@@ -349,10 +363,19 @@ void SwContentType::Init(bool* pbInvalidateWindow)
             bDelete = false;
             if(pOldMember)
             {
+                if(nullptr != pbInvalidateWindow)
+                {
+                    // need to check visibility (and equal entry number) after
+                    // creation due to a sorted liszt being used here (before,
+                    // entries with same index were compared already at creation
+                    // time what worked before a sorted list was used)
+                    *pbInvalidateWindow = checkVisibilityChanged(
+                        *pOldMember,
+                        *pMember);
+                }
+
                 pOldMember->DeleteAndDestroyAll();
                 delete pOldMember;
-                if(pbInvalidateWindow && bInvalidate)
-                    *pbInvalidateWindow = true;
             }
         }
         break;
@@ -637,12 +660,17 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
                         !aAskItem.pObject )     // not visible
                         pCnt->SetInvisible();
                     pMember->insert(pCnt);
+                }
 
-                    const size_t nPos = pMember->size() - 1;
-                    if(nOldMemberCount > nPos &&
-                        (*pOldMember)[nPos]->IsInvisible()
-                                != pCnt->IsInvisible())
-                            *pbLevelOrVisibilityChanged = true;
+                if(nullptr != pbLevelOrVisibilityChanged)
+                {
+                    // need to check visibility (and equal entry number) after
+                    // creation due to a sorted liszt being used here (before,
+                    // entries with same index were compared already at creation
+                    // time what worked before a sorted list was used)
+                    *pbLevelOrVisibilityChanged = checkVisibilityChanged(
+                        *pOldMember,
+                        *pMember);
                 }
             }
             nMemberCount = pMember->size();


More information about the Libreoffice-commits mailing list