diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-09-28 08:29:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-09-28 11:39:44 +0200 |
commit | f68a27f3592d7f419dfdea24bd35a97910662676 (patch) | |
tree | df0ba5cd893fc8eee933975711920f35ea2c0fcb | |
parent | 7dc918b905dfeffec05868243f0eaee4ccff7a8d (diff) |
cid#1545733 Logically dead code
detectable since:
commit cbaa4d3f27aa458142b0eeca88053d7fac3cce4d
Date: Thu Sep 14 15:17:25 2023 +0200
remove some unnecessary casting in SwXText::createTextCursor
Change-Id: Ib1d9dd53331e4c026cd4bc34b19db9d12e642f65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157351
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 62d0f49280c8..dba767d21dff 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2316,37 +2316,29 @@ SwXText::copyText( SwNodeIndex rNdIndex( *GetStartNode( ), 1 ); SwPosition rPos( rNdIndex ); // tdf#112202 need SwXText because cursor cannot select table at the start - if (pSource) + SwTextNode * pFirstNode; { - SwTextNode * pFirstNode; + SwPaM temp(*pSource->GetStartNode(), *pSource->GetStartNode()->EndOfSectionNode(), SwNodeOffset(+1), SwNodeOffset(-1)); + pFirstNode = temp.GetMark()->GetNode().GetTextNode(); + if (pFirstNode) { - SwPaM temp(*pSource->GetStartNode(), *pSource->GetStartNode()->EndOfSectionNode(), SwNodeOffset(+1), SwNodeOffset(-1)); - pFirstNode = temp.GetMark()->GetNode().GetTextNode(); - if (pFirstNode) - { - temp.GetMark()->AssignStartIndex(*pFirstNode); - } - if (SwTextNode *const pNode = temp.GetPoint()->GetNode().GetTextNode()) - { - temp.GetPoint()->AssignEndIndex(*pNode); - } - // Explicitly request copy text mode, so - // sw::DocumentContentOperationsManager::CopyFlyInFlyImpl() will copy shapes anchored to - // us, even if we have only a single paragraph. - m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(temp, rPos, SwCopyFlags::CheckPosInFly); + temp.GetMark()->AssignStartIndex(*pFirstNode); } - if (!pFirstNode) - { // the node at rPos was split; get rid of the first empty one so - // that the pasted table is first - auto pDelCursor(m_pImpl->m_pDoc->CreateUnoCursor(SwPosition(*GetStartNode(), SwNodeOffset(1)))); - m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(*pDelCursor); + if (SwTextNode *const pNode = temp.GetPoint()->GetNode().GetTextNode()) + { + temp.GetPoint()->AssignEndIndex(*pNode); } + // Explicitly request copy text mode, so + // sw::DocumentContentOperationsManager::CopyFlyInFlyImpl() will copy shapes anchored to + // us, even if we have only a single paragraph. + m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(temp, rPos, SwCopyFlags::CheckPosInFly); } - else - { - m_pImpl->m_pDoc->getIDocumentContentOperations().CopyRange(*xCursor->GetPaM(), rPos, SwCopyFlags::CheckPosInFly); + if (!pFirstNode) + { // the node at rPos was split; get rid of the first empty one so + // that the pasted table is first + auto pDelCursor(m_pImpl->m_pDoc->CreateUnoCursor(SwPosition(*GetStartNode(), SwNodeOffset(1)))); + m_pImpl->m_pDoc->getIDocumentContentOperations().DelFullPara(*pDelCursor); } - } SwXBodyText::SwXBodyText(SwDoc *const pDoc) |