sw/source/uibase/utlui/content.cxx | 43 ++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-)
New commits: commit 7f59313a1bd88dd142ff0b4c9b8cfc7e4beeabc7 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Thu Jan 23 17:55:10 2020 -0900 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Tue Jan 28 21:34:35 2020 +0100 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 <rayk...@gmail.com> 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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits