summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/fntcap.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-07-30 10:36:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-31 13:12:45 +0200
commit443d24a27842f39b5bc833dbc03082fa52749a2d (patch)
treea2eb09d8b8e0938c0b504b4a8623b3a4e90250d4 /sw/source/core/txtnode/fntcap.cxx
parent639206f38ef5be7687fe8172298e1374df5576eb (diff)
loplugin:flatten in sw/core/txtnode
Change-Id: I0003a190cbc42845274d71f8f157977e598a3fd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99859 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/txtnode/fntcap.cxx')
-rw-r--r--sw/source/core/txtnode/fntcap.cxx102
1 files changed, 51 insertions, 51 deletions
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 8ab9cf830b98..3a64db9c82e6 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -185,35 +185,35 @@ void SwDoGetCapitalBreak::Init( SwFntObj *, SwFntObj * )
void SwDoGetCapitalBreak::Do()
{
- if ( nTextWidth )
- {
- if ( rInf.GetSize().Width() < nTextWidth )
- nTextWidth -= rInf.GetSize().Width();
- else
- {
- TextFrameIndex nEnd = rInf.GetEnd();
- m_nBreak = TextFrameIndex(GetOut().GetTextBreak(
- rInf.GetText(), nTextWidth, sal_Int32(rInf.GetIdx()),
- sal_Int32(rInf.GetLen()), rInf.GetKern()));
+ if ( !nTextWidth )
+ return;
- if (m_nBreak > nEnd || m_nBreak < TextFrameIndex(0))
- m_nBreak = nEnd;
+ if ( rInf.GetSize().Width() < nTextWidth )
+ nTextWidth -= rInf.GetSize().Width();
+ else
+ {
+ TextFrameIndex nEnd = rInf.GetEnd();
+ m_nBreak = TextFrameIndex(GetOut().GetTextBreak(
+ rInf.GetText(), nTextWidth, sal_Int32(rInf.GetIdx()),
+ sal_Int32(rInf.GetLen()), rInf.GetKern()));
- // m_nBreak may be relative to the display string. It has to be
- // calculated relative to the original string:
- if ( GetCapInf() )
- {
- if ( GetCapInf()->nLen != rInf.GetLen() )
- m_nBreak = sw_CalcCaseMap( *rInf.GetFont(),
- GetCapInf()->rString,
- GetCapInf()->nIdx,
- GetCapInf()->nLen, m_nBreak );
- else
- m_nBreak = m_nBreak + GetCapInf()->nIdx;
- }
+ if (m_nBreak > nEnd || m_nBreak < TextFrameIndex(0))
+ m_nBreak = nEnd;
- nTextWidth = 0;
+ // m_nBreak may be relative to the display string. It has to be
+ // calculated relative to the original string:
+ if ( GetCapInf() )
+ {
+ if ( GetCapInf()->nLen != rInf.GetLen() )
+ m_nBreak = sw_CalcCaseMap( *rInf.GetFont(),
+ GetCapInf()->rString,
+ GetCapInf()->nIdx,
+ GetCapInf()->nLen, m_nBreak );
+ else
+ m_nBreak = m_nBreak + GetCapInf()->nIdx;
}
+
+ nTextWidth = 0;
}
}
@@ -356,38 +356,38 @@ void SwDoCapitalCursorOfst::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont )
void SwDoCapitalCursorOfst::Do()
{
- if ( nOfst )
+ if ( !nOfst )
+ return;
+
+ if ( static_cast<long>(nOfst) > rInf.GetSize().Width() )
+ {
+ nOfst -= rInf.GetSize().Width();
+ nCursor = nCursor + rInf.GetLen();
+ }
+ else
{
- if ( static_cast<long>(nOfst) > rInf.GetSize().Width() )
+ SwDrawTextInfo aDrawInf( rInf.GetShell(), *rInf.GetpOut(),
+ rInf.GetScriptInfo(),
+ rInf.GetText(),
+ rInf.GetIdx(),
+ rInf.GetLen(), 0, false );
+ aDrawInf.SetOffset( nOfst );
+ aDrawInf.SetKern( rInf.GetKern() );
+ aDrawInf.SetKanaComp( rInf.GetKanaComp() );
+ aDrawInf.SetFrame( rInf.GetFrame() );
+ aDrawInf.SetFont( rInf.GetFont() );
+
+ if ( rInf.GetUpper() )
{
- nOfst -= rInf.GetSize().Width();
- nCursor = nCursor + rInf.GetLen();
+ aDrawInf.SetSpace( 0 );
+ nCursor = nCursor + pUpperFnt->GetModelPositionForViewPoint( aDrawInf );
}
else
{
- SwDrawTextInfo aDrawInf( rInf.GetShell(), *rInf.GetpOut(),
- rInf.GetScriptInfo(),
- rInf.GetText(),
- rInf.GetIdx(),
- rInf.GetLen(), 0, false );
- aDrawInf.SetOffset( nOfst );
- aDrawInf.SetKern( rInf.GetKern() );
- aDrawInf.SetKanaComp( rInf.GetKanaComp() );
- aDrawInf.SetFrame( rInf.GetFrame() );
- aDrawInf.SetFont( rInf.GetFont() );
-
- if ( rInf.GetUpper() )
- {
- aDrawInf.SetSpace( 0 );
- nCursor = nCursor + pUpperFnt->GetModelPositionForViewPoint( aDrawInf );
- }
- else
- {
- aDrawInf.SetSpace( rInf.GetSpace() );
- nCursor = nCursor + pLowerFnt->GetModelPositionForViewPoint( aDrawInf );
- }
- nOfst = 0;
+ aDrawInf.SetSpace( rInf.GetSpace() );
+ nCursor = nCursor + pLowerFnt->GetModelPositionForViewPoint( aDrawInf );
}
+ nOfst = 0;
}
}