diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-11-21 12:28:03 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-12-01 08:44:44 +0100 |
commit | 782506335e2b5a1c6d4c0222520165900a91aeb8 (patch) | |
tree | cb5a8472f3d09149cd3590586b248e72472bf762 /sw/source/core/edit/edattr.cxx | |
parent | 025ebb415e7dd2d91e6be7b3a913ef78dca7c9a6 (diff) |
sw_redlinehide_4a: convert SwEditShell::GetScalingOfSelectedText()
Move SwTextNode::GetScalingOfSelectedText() to SwTextFrame & simplify.
Change-Id: I9e9f0059665fb128de6be12a15ca2b4a95ebc5ff
Diffstat (limited to 'sw/source/core/edit/edattr.cxx')
-rw-r--r-- | sw/source/core/edit/edattr.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 678363ccad81..5b61dbe0ed86 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -840,14 +840,15 @@ sal_uInt16 SwEditShell::GetScalingOfSelectedText() const sal_uInt16 nScaleWidth; if( pTNd ) { - const SwPosition* pEnd = pStt == pCursor->GetPoint() - ? pCursor->GetMark() - : pCursor->GetPoint(); - const sal_Int32 nStt = pStt->nContent.GetIndex(); - const sal_Int32 nEnd = pStt->nNode == pEnd->nNode - ? pEnd->nContent.GetIndex() - : pTNd->GetText().getLength(); - nScaleWidth = pTNd->GetScalingOfSelectedText( nStt, nEnd ); + SwTextFrame *const pFrame(static_cast<SwTextFrame *>( + pTNd->getLayoutFrame(GetLayout(), pStt))); + assert(pFrame); // shell cursor must be positioned in node with frame + TextFrameIndex const nStart(pFrame->MapModelToViewPos(*pStt)); + TextFrameIndex const nEnd( + sw::FrameContainsNode(*pFrame, pCursor->End()->nNode.GetIndex()) + ? pFrame->MapModelToViewPos(*pCursor->End()) + : TextFrameIndex(pFrame->GetText().getLength())); + nScaleWidth = pFrame->GetScalingOfSelectedText(nStart, nEnd); } else nScaleWidth = 100; // default are no scaling -> 100% |