diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-10-25 12:48:17 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-11-15 15:10:02 +0100 |
commit | 50bd0f5f20db0abfe40ec335ec9b39d0e6a16550 (patch) | |
tree | 15d78366697d6482bd5a1fece44a71414776f94a /sw | |
parent | 45531f9f09bbccd18498aadf40e33a9f59a60aad (diff) |
sw_redlinehide_3: adapt some SwEditShell functions
SwEditShell::IsOutlineCopyable(), IsOutlineMovable(),
IsProtectedOutlinePara(), GetCurrentParaOutlineLevel() all filter.
Change-Id: Ie5fb181e21d4bf606482bec9cb108dbd70f4209e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/ednumber.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 14 |
3 files changed, 29 insertions, 6 deletions
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 7734fd03c563..c795e645b374 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -24,6 +24,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> #include <ndtxt.hxx> +#include <txtfrm.hxx> #include <paratr.hxx> #include <swundo.hxx> #include <numrule.hxx> @@ -411,8 +412,8 @@ int SwEditShell::GetCurrentParaOutlineLevel( ) const int nLevel = 0; SwPaM* pCursor = GetCursor(); - const SwTextNode* pTextNd = pCursor->GetNode().GetTextNode(); - if( pTextNd ) + const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode); + if (pTextNd) nLevel = pTextNd->GetAttrOutlineLevel(); return nLevel; } @@ -570,6 +571,11 @@ bool SwEditShell::IsProtectedOutlinePara() const { SwNodePtr pTmpNd = rOutlNd[ nPos ]; + if (!sw::IsParaPropsNode(*GetLayout(), *pTmpNd->GetTextNode())) + { + continue; + } + int nTmpLvl = pTmpNd->GetTextNode()->GetAttrOutlineLevel(); OSL_ENSURE( nTmpLvl >= 0 && nTmpLvl <= MAXLEVEL, @@ -606,23 +612,25 @@ bool SwEditShell::IsProtectedOutlinePara() const * 2) outline must not be within table * 3) if bCopy is set, outline must not be write protected */ -static bool lcl_IsOutlineMoveAndCopyable( const SwDoc* pDoc, SwOutlineNodes::size_type nIdx, bool bCopy ) +static bool lcl_IsOutlineMoveAndCopyable(SwEditShell const& rShell, + SwOutlineNodes::size_type const nIdx, bool const bCopy) { - const SwNodes& rNds = pDoc->GetNodes(); + const SwNodes& rNds = rShell.GetDoc()->GetNodes(); const SwNode* pNd = rNds.GetOutLineNds()[ nIdx ]; return pNd->GetIndex() >= rNds.GetEndOfExtras().GetIndex() && // 1) body !pNd->FindTableNode() && // 2) table + sw::IsParaPropsNode(*rShell.GetLayout(), *pNd->GetTextNode()) && ( bCopy || !pNd->IsProtect() ); // 3) write } bool SwEditShell::IsOutlineMovable( SwOutlineNodes::size_type nIdx ) const { - return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, false ); + return lcl_IsOutlineMoveAndCopyable( *this, nIdx, false ); } bool SwEditShell::IsOutlineCopyable( SwOutlineNodes::size_type nIdx ) const { - return lcl_IsOutlineMoveAndCopyable( GetDoc(), nIdx, true ); + return lcl_IsOutlineMoveAndCopyable( *this, nIdx, true ); } bool SwEditShell::NumOrNoNum( diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index 831465f8c90b..afdaa6aff8d0 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -101,6 +101,7 @@ std::unique_ptr<sw::MergedPara> CheckParaRedlineMerge(SwTextFrame & rFrame, SwTe bool FrameContainsNode(SwContentFrame const& rFrame, sal_uLong nNodeIndex); bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode); +SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rNode); TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged, bool isRealDelete, diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index cd72ad8ca489..e6142abc24ee 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -324,6 +324,20 @@ namespace sw { return true; } + SwTextNode * + GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos) + { + SwTextNode *const pTextNode(rPos.GetNode().GetTextNode()); + if (pTextNode && !sw::IsParaPropsNode(rLayout, *pTextNode)) + { + return static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(&rLayout))->GetMergedPara()->pParaPropsNode; + } + else + { + return pTextNode; + } + } + } // namespace sw /// Switches width and height of the text frame |