summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-27 11:16:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-27 12:48:23 +0200
commitec50b9e5eaec7c94df35617676077ef0d65cecc7 (patch)
tree0f5e2d9682b0743296fe1931c321a38d16eb40ca /sw/source/core
parent1b82b81cd1f3377591068dea7b9a648b04370bbf (diff)
no need to allocate Sw2LinesPos separately on heap
Change-Id: I39dec50f491a313ac188bb2f73073ecc32ebfc21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116240 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/layout/trvlfrm.cxx6
-rw-r--r--sw/source/core/text/frmcrsr.cxx12
-rw-r--r--sw/source/core/text/itrcrsr.cxx30
3 files changed, 24 insertions, 24 deletions
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a7506ca9a13a..2ce4542351bd 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2124,11 +2124,11 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
//ContentRects to Start- and EndFrames.
SwRect aStRect, aEndRect;
pStartFrame->GetCharRect( aStRect, *pStartPos, &aTmpState );
- std::unique_ptr<Sw2LinesPos> pSt2Pos = std::move(aTmpState.m_p2Lines);
+ std::optional<Sw2LinesPos> pSt2Pos = std::move(aTmpState.m_x2Lines);
aTmpState.m_nCursorBidiLevel = pEndFrame->IsRightToLeft() ? 1 : 0;
pEndFrame->GetCharRect( aEndRect, *pEndPos, &aTmpState );
- std::unique_ptr<Sw2LinesPos> pEnd2Pos = std::move(aTmpState.m_p2Lines);
+ std::optional<Sw2LinesPos> pEnd2Pos = std::move(aTmpState.m_x2Lines);
SwRect aStFrame ( pStartFrame->UnionFrame( true ) );
aStFrame.Intersection( pStartFrame->GetPaintArea() );
@@ -2145,7 +2145,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
// If there's no doubleline portion involved or start and end are both
// in the same doubleline portion, all works fine, but otherwise
// we need the following...
- if( pSt2Pos != pEnd2Pos && ( !pSt2Pos || !pEnd2Pos ||
+ if( (pSt2Pos || pEnd2Pos) && ( !pSt2Pos || !pEnd2Pos ||
pSt2Pos->aPortion != pEnd2Pos->aPortion ) )
{
// If we have a start(end) position inside a doubleline portion
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 5f3045f0504b..9ea484912cff 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -307,10 +307,10 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
{
if ( pFrame->IsRightToLeft() )
{
- if( pCMS->m_b2Lines && pCMS->m_p2Lines)
+ if( pCMS->m_b2Lines && pCMS->m_x2Lines)
{
- pFrame->SwitchLTRtoRTL( pCMS->m_p2Lines->aLine );
- pFrame->SwitchLTRtoRTL( pCMS->m_p2Lines->aPortion );
+ pFrame->SwitchLTRtoRTL( pCMS->m_x2Lines->aLine );
+ pFrame->SwitchLTRtoRTL( pCMS->m_x2Lines->aPortion );
}
}
@@ -327,10 +327,10 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
pCMS->m_aRealHeight.Y() );
}
}
- if( pCMS->m_b2Lines && pCMS->m_p2Lines)
+ if( pCMS->m_b2Lines && pCMS->m_x2Lines)
{
- pFrame->SwitchHorizontalToVertical( pCMS->m_p2Lines->aLine );
- pFrame->SwitchHorizontalToVertical( pCMS->m_p2Lines->aPortion );
+ pFrame->SwitchHorizontalToVertical( pCMS->m_x2Lines->aLine );
+ pFrame->SwitchHorizontalToVertical( pCMS->m_x2Lines->aPortion );
}
}
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index f42a84237643..933de96b9acd 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -676,26 +676,26 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
if( pCMS && pCMS->m_b2Lines )
{
- const bool bRecursion (pCMS->m_p2Lines);
+ const bool bRecursion (pCMS->m_x2Lines);
if ( !bRecursion )
{
- pCMS->m_p2Lines.reset(new Sw2LinesPos);
- pCMS->m_p2Lines->aLine = SwRect(aCharPos, aCharSize);
+ pCMS->m_x2Lines = Sw2LinesPos();
+ pCMS->m_x2Lines->aLine = SwRect(aCharPos, aCharSize);
}
if( static_cast<SwMultiPortion*>(pPor)->HasRotation() )
{
if( static_cast<SwMultiPortion*>(pPor)->IsRevers() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_270;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::ROT_270;
else
- pCMS->m_p2Lines->nMultiType = MultiPortionType::ROT_90;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::ROT_90;
}
else if( static_cast<SwMultiPortion*>(pPor)->IsDouble() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::TWOLINE;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::TWOLINE;
else if( static_cast<SwMultiPortion*>(pPor)->IsBidi() )
- pCMS->m_p2Lines->nMultiType = MultiPortionType::BIDI;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::BIDI;
else
- pCMS->m_p2Lines->nMultiType = MultiPortionType::RUBY;
+ pCMS->m_x2Lines->nMultiType = MultiPortionType::RUBY;
SwTwips nTmpWidth = pPor->Width();
if( nSpaceAdd )
@@ -705,9 +705,9 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
Size( nTmpWidth, pPor->Height() ) );
if ( ! bRecursion )
- pCMS->m_p2Lines->aPortion = aRect;
+ pCMS->m_x2Lines->aPortion = aRect;
else
- pCMS->m_p2Lines->aPortion2 = aRect;
+ pCMS->m_x2Lines->aPortion2 = aRect;
}
// In a multi-portion we use GetCharRect()-function
@@ -1215,12 +1215,12 @@ void SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
pOrig->Pos().AdjustX(aCharPos.X() );
pOrig->Pos().AdjustY(aCharPos.Y() );
- if( pCMS && pCMS->m_b2Lines && pCMS->m_p2Lines )
+ if( pCMS && pCMS->m_b2Lines && pCMS->m_x2Lines )
{
- pCMS->m_p2Lines->aLine.Pos().AdjustX(aCharPos.X() );
- pCMS->m_p2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
- pCMS->m_p2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
- pCMS->m_p2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
+ pCMS->m_x2Lines->aLine.Pos().AdjustX(aCharPos.X() );
+ pCMS->m_x2Lines->aLine.Pos().AdjustY(aCharPos.Y() );
+ pCMS->m_x2Lines->aPortion.Pos().AdjustX(aCharPos.X() );
+ pCMS->m_x2Lines->aPortion.Pos().AdjustY(aCharPos.Y() );
}
const bool bTabOverMargin = GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN);