[Libreoffice-commits] core.git: sw/source
Armin Le Grand
Armin.Le.Grand at cib.de
Fri Jun 22 23:57:55 UTC 2018
sw/source/uibase/utlui/content.cxx | 60 +++++++++++++++++++++++++++----------
1 file changed, 44 insertions(+), 16 deletions(-)
New commits:
commit f5f6781acb292783033caea0147ff98490c78d89
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 80922f4ef11f..5ed2db49a19d 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -243,6 +243,29 @@ static const char* STR_CONTENT_TYPE_SINGLE_ARY[] =
STR_CONTENT_TYPE_SINGLE_DRAWOBJECT
};
+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),
@@ -323,14 +346,11 @@ void SwContentType::Init(bool* pbInvalidateWindow)
case ContentTypeId::REGION :
{
SwContentArr* pOldMember = nullptr;
- size_t nOldRegionCount = 0;
- bool bInvalidate = false;
if(!pMember)
pMember.reset( new SwContentArr );
else if(!pMember->empty())
{
pOldMember = pMember.release();
- nOldRegionCount = pOldMember->size();
pMember.reset( new SwContentArr );
}
const Point aNullPt;
@@ -362,12 +382,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();
@@ -376,10 +390,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;
@@ -661,12 +684,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