diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-10-26 17:20:17 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-11-15 15:10:03 +0100 |
commit | 4d472b9b80a5c62338b7f080d5654d741c75e532 (patch) | |
tree | 132f88a42c7c9b22b2acedcc7b600bc15d57c8e6 | |
parent | cba617386c0b9b76b5d91564400adea875f1998f (diff) |
sw_redlinehide_3: adapt more SwEditShell Num
ReplaceNumRule(), SetNumRuleStart(), SetNodeNumStart()
Change-Id: I7e58d477b02e0e242ce3c12eca0071856533debf
-rw-r--r-- | sw/source/core/edit/ednumber.cxx | 26 | ||||
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 13 |
3 files changed, 34 insertions, 6 deletions
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 7d0774f58791..5d23d06109e7 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -651,7 +651,8 @@ bool SwEditShell::NumOrNoNum( && ( !bChkStart || IsSttPara() ) ) { StartAllAction(); - bRet = GetDoc()->NumOrNoNum( GetCursor()->GetPoint()->nNode, !bNumOn ); + SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint())); + bRet = GetDoc()->NumOrNoNum(pos.nNode, !bNumOn); EndAllAction(); } return bRet; @@ -805,7 +806,8 @@ void SwEditShell::ChgNumRuleFormats( const SwNumRule& rRule ) void SwEditShell::ReplaceNumRule( const OUString& rOldRule, const OUString& rNewRule ) { StartAllAction(); - GetDoc()->ReplaceNumRule( *GetCursor()->GetPoint(), rOldRule, rNewRule ); + SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint())); + GetDoc()->ReplaceNumRule( pos, rOldRule, rNewRule ); EndAllAction(); } @@ -819,11 +821,17 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM ) SwPamRanges aRangeArr( *pCursor ); SwPaM aPam( *pCursor->GetPoint() ); for( size_t n = 0; n < aRangeArr.Count(); ++n ) - GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag ); + { + SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *aRangeArr.SetPam( n, aPam ).GetPoint())); + GetDoc()->SetNumRuleStart( pos, bFlag ); + } GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr ); } else - GetDoc()->SetNumRuleStart( *pCursor->GetPoint(), bFlag ); + { + SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *GetCursor()->GetPoint())); + GetDoc()->SetNumRuleStart(pos, bFlag); + } EndAllAction(); } @@ -846,11 +854,17 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt ) SwPamRanges aRangeArr( *pCursor ); SwPaM aPam( *pCursor->GetPoint() ); for( size_t n = 0; n < aRangeArr.Count(); ++n ) - GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt ); + { + SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *aRangeArr.SetPam( n, aPam ).GetPoint())); + GetDoc()->SetNodeNumStart( pos, nStt ); + } GetDoc()->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr ); } else - GetDoc()->SetNodeNumStart( *pCursor->GetPoint(), nStt ); + { + SwPosition const pos(sw::GetParaPropsPos(*GetLayout(), *pCursor->GetPoint())); + GetDoc()->SetNodeNumStart( pos, nStt ); + } EndAllAction(); } diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index afdaa6aff8d0..dfea9d4e2490 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -102,6 +102,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); +SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos); TextFrameIndex UpdateMergedParaForDelete(MergedPara & rMerged, bool isRealDelete, diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index e963d28759ce..8e5d64cbf022 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -338,6 +338,19 @@ namespace sw { } } + SwPosition + GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos) + { + SwPosition pos(rPos); + SwTextNode const*const pNode(pos.nNode.GetNode().GetTextNode()); + if (pNode) + { + pos.nNode = *sw::GetParaPropsNode(rLayout, *pNode); + pos.nContent.Assign(pos.nNode.GetNode().GetContentNode(), 0); + } + return pos; + } + } // namespace sw /// Switches width and height of the text frame |