diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-08 08:31:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-08 09:19:32 +0200 |
commit | 2e0a25ce2b87d3a4bbf944025fc3720933fb391d (patch) | |
tree | 57bd8b7c4a4cfe2c0bf5072b25f1d525096d4ff2 /vcl/source/edit | |
parent | b02b3bcf4465c9ccb3edcaa26e090db0581cba9e (diff) |
loplugin:constantparam
Change-Id: Ic87f0cc863490858b7cc7e74a7f90ec31992dd53
Reviewed-on: https://gerrit.libreoffice.org/42089
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/edit')
-rw-r--r-- | vcl/source/edit/texteng.cxx | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index a4e6f1e4fb11..12731dfc3305 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2440,24 +2440,13 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel ) return rInput.GetError() == ERRCODE_NONE; } -bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML ) +bool TextEngine::Write( SvStream& rOutput ) { TextSelection aSel; - if ( pSel ) - aSel = *pSel; - else - { - const sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size()); - TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ]; - aSel.GetStart() = TextPaM( 0, 0 ); - aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().getLength() ); - } - - if ( bHTML ) - { - rOutput.WriteLine( "<HTML>" ); - rOutput.WriteLine( "<BODY>" ); - } + const sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size()); + TextNode* pSelNode = mpDoc->GetNodes()[ nParas - 1 ]; + aSel.GetStart() = TextPaM( 0, 0 ); + aSel.GetEnd() = TextPaM( nParas-1, pSelNode->GetText().getLength() ); for ( sal_uInt32 nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); ++nPara ) { @@ -2469,37 +2458,24 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML ? aSel.GetEnd().GetIndex() : pNode->GetText().getLength(); OUStringBuffer aText; - if ( !bHTML ) + aText = "<P STYLE=\"margin-bottom: 0cm\">"; + + if ( nStartPos == nEndPos ) { - aText = pNode->GetText().copy( nStartPos, nEndPos-nStartPos ); + // Empty lines will be removed by Writer + aText.append( "<BR>" ); } else { - aText = "<P STYLE=\"margin-bottom: 0cm\">"; - - if ( nStartPos == nEndPos ) - { - // Empty lines will be removed by Writer - aText.append( "<BR>" ); - } - else - { - // Text before Attribute - aText.append( pNode->GetText().copy( nStartPos, nEndPos-nStartPos ) ); - } - - aText.append( "</P>" ); + // Text before Attribute + aText.append( pNode->GetText().copy( nStartPos, nEndPos-nStartPos ) ); } + + aText.append( "</P>" ); rOutput.WriteLine(OUStringToOString(aText.makeStringAndClear(), rOutput.GetStreamCharSet())); } - if ( bHTML ) - { - rOutput.WriteLine( "</BODY>" ); - rOutput.WriteLine( "</HTML>" ); - } - return rOutput.GetError() == ERRCODE_NONE; } |