Kaydet (Commit) ec87fa38 authored tarafından Vitaliy Anderson's avatar Vitaliy Anderson Kaydeden (comit) Aron Budea

tdf#104349 remove the difference between MSO and LO highlight chars

Change-Id: I5daadef359260ea74b828567197228633bb972ca
Reviewed-on: https://gerrit.libreoffice.org/31783Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarjan iversen <jani@documentfoundation.org>
Tested-by: 's avatarjan iversen <jani@documentfoundation.org>
(cherry picked from commit 4a410dd1)
üst b8f61b80
...@@ -690,8 +690,8 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPo ...@@ -690,8 +690,8 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, const SwLinePortion &rPo
} }
if( aFontPos.X() < 0 ) if( aFontPos.X() < 0 )
aFontPos.X() = 0; aFontPos.X() = 0;
if( aFontPos.X() < 0 ) if( aFontPos.Y() < 0 )
aFontPos.X() = 0; aFontPos.Y() = 0;
} }
if( GetTextFly().IsOn() ) if( GetTextFly().IsOn() )
...@@ -1184,6 +1184,75 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const ...@@ -1184,6 +1184,75 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
aFillColor = *m_pFnt->GetBackColor(); aFillColor = *m_pFnt->GetBackColor();
} }
// tdf#104349 do not hightlight portions of space chars before end of line
bool draw = false;
bool full = false;
SwLinePortion *pPos = const_cast<SwLinePortion *>(&rPor);
sal_Int32 nIdx = GetIdx();
sal_Int32 nLen;
do
{
nLen = pPos->GetLen();
for ( int i = nIdx; i < (nIdx + nLen); ++i )
{
if ( GetText()[i] == CH_TXTATR_NEWLINE )
{
if ( i >= (GetIdx() + rPor.GetLen()) )
{
goto drawcontinue;
}
}
if ( GetText()[i] != CH_BLANK )
{
draw = true;
if ( i >= (GetIdx() + rPor.GetLen()) )
{
full = true;
goto drawcontinue;
}
}
}
nIdx += nLen;
pPos = pPos->GetPortion();
} while ( pPos );
drawcontinue:
if ( !draw )
return;
if ( !full )
{
pPos = const_cast<SwLinePortion *>(&rPor);
nIdx = GetIdx();
nLen = pPos->GetLen();
for ( int i = (nIdx + nLen - 1); i >= nIdx; --i )
{
if ( GetText()[i] == CH_TXTATR_NEWLINE )
{
continue;
}
if ( GetText()[i] != CH_BLANK )
{
sal_uInt16 nOldWidth = rPor.Width();
sal_uInt16 nNewWidth = GetTextSize( m_pOut, nullptr, GetText(), nIdx, (i + 1 - nIdx) ).Width();
const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
CalcRect( rPor, nullptr, &aIntersect, true );
const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
if ( ! aIntersect.HasArea() )
{
return;
}
break;
}
}
}
pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); pTmpOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
pTmpOut->SetFillColor(aFillColor); pTmpOut->SetFillColor(aFillColor);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment