From f79a67a3d09db860b7bb783cdf9e28a5dcd39ea4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 3 Apr 2020 12:01:23 +0100 Subject: restore pseudo-level indent for sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit which went missing in... commit 5a2c0ab29719ac914d30d8789c0e386541702cbf Author: Caolán McNamara Date: Fri Feb 28 11:13:12 2020 +0000 weld writer navigator Change-Id: Ia15b282c4621b7e0c35641976ffac18a93ce6a0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91621 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/uibase/inc/content.hxx | 15 +++++++++++++++ sw/source/uibase/utlui/content.cxx | 13 +++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'sw/source') diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx index 4bb37efaa544..414db7068dcb 100644 --- a/sw/source/uibase/inc/content.hxx +++ b/sw/source/uibase/inc/content.hxx @@ -53,6 +53,21 @@ class SwOutlineContent : public SwContent bool IsMoveable() const {return bIsMoveable;}; }; +class SwRegionContent : public SwContent +{ + + sal_uInt8 nRegionLevel; + + public: + SwRegionContent( const SwContentType* pCnt, + const OUString& rName, + sal_uInt8 nLevel, + long nYPos) : + SwContent(pCnt, rName, nYPos), + nRegionLevel(nLevel){} + sal_uInt8 GetRegionLevel() const {return nRegionLevel;} +}; + class SwURLFieldContent : public SwContent { OUString sURL; diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 54f3c6e94caf..db829431569f 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -369,7 +369,8 @@ void SwContentType::Init(bool* pbInvalidateWindow) pParentFormat = pParentFormat->GetParent(); } - std::unique_ptr pCnt(new SwContent(this, rSectionName, + std::unique_ptr pCnt(new SwRegionContent(this, rSectionName, + nLevel, pFormat->FindLayoutRect( false, &aNullPt ).Top())); SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, nullptr ); @@ -674,7 +675,8 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged) pParentFormat = pParentFormat->GetParent(); } - std::unique_ptr pCnt(new SwContent(this, sSectionName, + std::unique_ptr pCnt(new SwRegionContent(this, sSectionName, + nLevel, pFormat->FindLayoutRect( false, &aNullPt ).Top())); if( !pFormat->GetInfo( aAskItem ) && !aAskItem.pObject ) // not visible @@ -1482,6 +1484,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) } else { + bool bRegion = pCntType->GetType() == ContentTypeId::REGION; for(size_t i = 0; i < nCount; ++i) { const SwContent* pCnt = pCntType->GetMember(i); @@ -1493,6 +1496,8 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) OUString sId(OUString::number(reinterpret_cast(pCnt))); insert(&rParent, sEntry, sId, nullptr, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); + if (bRegion) + m_xTreeView->set_extra_row_indent(*xChild, static_cast(pCnt)->GetRegionLevel()); bChild = true; } } @@ -1954,6 +1959,8 @@ void SwContentTree::Display( bool bActive ) if (!bChOnDemand) { + bool bRegion = rpRootContentT->GetType() == ContentTypeId::REGION; + std::unique_ptr xChild = m_xTreeView->make_iterator(); for (size_t i = 0; i < rpRootContentT->GetMemberCount(); ++i) { @@ -1966,6 +1973,8 @@ void SwContentTree::Display( bool bActive ) OUString sSubId(OUString::number(reinterpret_cast(pCnt))); insert(xEntry.get(), sEntry, sSubId, nullptr, false, xChild.get()); m_xTreeView->set_sensitive(*xChild, !pCnt->IsInvisible()); + if (bRegion) + m_xTreeView->set_extra_row_indent(*xChild, static_cast(pCnt)->GetRegionLevel()); } } } -- cgit v1.2.3