Kaydet (Commit) 7ef89c96 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Make the code of character border a bit robust

Change-Id: I62a6c932745ee8ff5adeed00df808b62cbb9884f
üst 89093f50
......@@ -639,7 +639,7 @@ void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor
// Draw text next to the left border
Point aFontPos(aPos);
if( !static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithPrev() )
if( m_pFnt->GetLeftBorder() && !static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithPrev() )
{
const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
if ( GetTxtFrm()->IsRightToLeft() )
......@@ -664,6 +664,10 @@ void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor
break;
}
}
if( aFontPos.X() < 0 )
aFontPos.X() = 0;
if( aFontPos.X() < 0 )
aFontPos.X() = 0;
}
if( GetTxtFly()->IsOn() )
......
......@@ -940,12 +940,13 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
{
pCurrPart = pCurrPart->GetFollow();
}
if( pCurrPart && nSumLength != nOfst - aInf.GetIdx() && !pCurrPart->GetJoinBorderWithNext() )
if( pCurrPart && nSumLength != nOfst - aInf.GetIdx() &&
pCurrPart->GetFont().GetRightBorder() && !pCurrPart->GetJoinBorderWithNext() )
{
nX -= pCurrPart->GetFont().GetRightBorderSpace();
}
}
else if( !pPor->GetJoinBorderWithNext())
else if( GetInfo().GetFont()->GetRightBorder() && !pPor->GetJoinBorderWithNext())
{
nX -= GetInfo().GetFont()->GetRightBorderSpace();
}
......@@ -1650,11 +1651,12 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
while( pCurrPart && nSumWidth <= nX - nCurrStart )
{
nSumWidth += pCurrPart->GetWidth();
if( !pCurrPart->GetJoinBorderWithPrev() )
if( pCurrPart->GetFont().GetLeftBorder() && !pCurrPart->GetJoinBorderWithPrev() )
{
nSumBorderWidth += pCurrPart->GetFont().GetLeftBorderSpace();
}
if( nSumWidth <= nX - nCurrStart && !pCurrPart->GetJoinBorderWithNext() )
if( nSumWidth <= nX - nCurrStart && pCurrPart->GetFont().GetRightBorder() &&
!pCurrPart->GetJoinBorderWithNext() )
{
nSumBorderWidth += pCurrPart->GetFont().GetRightBorderSpace();
}
......@@ -1663,7 +1665,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
nX = std::max(0, nX - nSumBorderWidth);
}
// Shift the offset with the left border width
else if( !pPor->GetJoinBorderWithPrev() )
else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
{
nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
}
......
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