summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-01-23 17:55:10 -0900
committerJim Raykowski <raykowj@gmail.com>2020-01-28 21:34:35 +0100
commit7f59313a1bd88dd142ff0b4c9b8cfc7e4beeabc7 (patch)
tree455333ed2930d592d98d596451494999fcb43072 /sw
parent7e19348d7e54cf22864f6e14022e28091a576387 (diff)
tdf#130122 Make content navigation view collapse uniform
...for root node of all content types This patch makes content navigation view root collapse to it's immediate child entries. This fixes the current behavior of outline root collapse not collapsing and all other content types collapsing to root. Change-Id: If48b4c9f5f92e7a1843557eec51c516fa42f228f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87316 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/utlui/content.cxx43
1 files changed, 24 insertions, 19 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 10fffd48c902..06de1fb5302c 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1577,32 +1577,37 @@ bool SwContentTree::Expand( SvTreeListEntry* pParent )
bool SwContentTree::Collapse( SvTreeListEntry* pParent )
{
- if (!m_bIsRoot
- || (lcl_IsContentType(pParent) && static_cast<SwContentType*>(pParent->GetUserData())->GetType() == ContentTypeId::OUTLINE)
- || (m_nRootType == ContentTypeId::OUTLINE))
+ if (!pParent->HasChildren() || pParent->HasChildrenOnDemand())
+ return SvTreeListBox::Collapse(pParent);
+
+ if(lcl_IsContentType(pParent))
{
- if(lcl_IsContentType(pParent))
+ if(m_bIsRoot)
{
- if(m_bIsRoot)
- return false;
- SwContentType* pCntType = static_cast<SwContentType*>(pParent->GetUserData());
- const sal_Int32 nAnd = ~(1 << static_cast<int>(pCntType->GetType()));
- if (State::HIDDEN != m_eState)
+ // collapse to children of root node
+ for (SvTreeListEntry* pEntry = FirstChild(pParent); pEntry; pEntry = Next(pEntry))
{
- m_nActiveBlock &= nAnd;
- m_pConfig->SetActiveBlock(m_nActiveBlock);
+ Collapse(pEntry);
}
- else
- m_nHiddenBlock &= nAnd;
+ return true;
}
- else if( lcl_IsContent(pParent) )
+ SwContentType* pCntType = static_cast<SwContentType*>(pParent->GetUserData());
+ const sal_Int32 nAnd = ~(1 << static_cast<int>(pCntType->GetType()));
+ if (State::HIDDEN != m_eState)
{
- SwWrtShell* pShell = GetWrtShell();
- assert(dynamic_cast<SwOutlineContent*>(static_cast<SwTypeNumber*>(pParent->GetUserData())));
- auto const nPos = static_cast<SwOutlineContent*>(pParent->GetUserData())->GetOutlinePos();
- void* key = static_cast<void*>(pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos ));
- mOutLineNodeMap[key] = false;
+ m_nActiveBlock &= nAnd;
+ m_pConfig->SetActiveBlock(m_nActiveBlock);
}
+ else
+ m_nHiddenBlock &= nAnd;
+ }
+ else if( lcl_IsContent(pParent) )
+ {
+ SwWrtShell* pShell = GetWrtShell();
+ assert(dynamic_cast<SwOutlineContent*>(static_cast<SwTypeNumber*>(pParent->GetUserData())));
+ auto const nPos = static_cast<SwOutlineContent*>(pParent->GetUserData())->GetOutlinePos();
+ void* key = static_cast<void*>(pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos ));
+ mOutLineNodeMap[key] = false;
}
return SvTreeListBox::Collapse(pParent);