From e90db02984daad3ed664d4bd876011f991e59d10 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 7 Nov 2018 15:34:03 +0100 Subject: sw_redlinehide_3: adapt SwChapterField::ChangeExpansion() Add layout parameter to find the correct outline node. Change-Id: I15477dff18c3e5e34b291a92878d938d04497436 --- sw/inc/chpfld.hxx | 3 ++- sw/source/core/fields/chpfld.cxx | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'sw') diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx index eb0b6c0ee17b..1b85246fba11 100644 --- a/sw/inc/chpfld.hxx +++ b/sw/inc/chpfld.hxx @@ -24,6 +24,7 @@ class SwFrame; class SwContentNode; class SwTextNode; +class SwRootFrame; enum SwChapterFormat { @@ -64,7 +65,7 @@ public: void ChangeExpansion( const SwFrame&, const SwContentNode*, bool bSrchNum = false); - void ChangeExpansion(const SwTextNode &rNd, bool bSrchNum); + void ChangeExpansion(const SwTextNode &rNd, bool bSrchNum, SwRootFrame const* pLayout = nullptr); inline sal_uInt8 GetLevel() const; inline void SetLevel(sal_uInt8); diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx index a7b1fd3911c6..0702ca92d379 100644 --- a/sw/source/core/fields/chpfld.cxx +++ b/sw/source/core/fields/chpfld.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -114,11 +115,12 @@ void SwChapterField::ChangeExpansion(const SwFrame & rFrame, if ( pTextNode ) { - ChangeExpansion( *pTextNode, bSrchNum ); + ChangeExpansion( *pTextNode, bSrchNum, rFrame.getRootFrame() ); } } -void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum) +void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum, + SwRootFrame const*const pLayout) { m_sNumber.clear(); m_sTitle.clear(); @@ -126,7 +128,7 @@ void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum) m_sPre.clear(); SwDoc* pDoc = const_cast(rTextNd.GetDoc()); - const SwTextNode *pTextNd = rTextNd.FindOutlineNodeOfLevel( m_nLevel ); + const SwTextNode *pTextNd = rTextNd.FindOutlineNodeOfLevel(m_nLevel, pLayout); if( pTextNd ) { if( bSrchNum ) @@ -152,7 +154,7 @@ void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum) if (!m_nLevel--) break; - pONd = pTextNd->FindOutlineNodeOfLevel( m_nLevel ); + pONd = pTextNd->FindOutlineNodeOfLevel(m_nLevel, pLayout); } else break; @@ -166,7 +168,7 @@ void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum) // correction of refactoring done by cws swnumtree: // retrieve numbering string without prefix and suffix strings // as stated in the above german comment. - m_sNumber = pTextNd->GetNumString( false ); + m_sNumber = pTextNd->GetNumString(false, MAXLEVEL, pLayout); SwNumRule* pRule( pTextNd->GetNumRule() ); if ( pTextNd->IsCountedInList() && pRule ) @@ -187,8 +189,8 @@ void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum) m_sNumber = "??"; } - m_sTitle = removeControlChars(pTextNd->GetExpandText(0, -1, false, false, false)); - + m_sTitle = removeControlChars(sw::GetExpandTextMerged(pLayout, + *pTextNd, false, false, ExpandMode(0))); } } -- cgit v1.2.3