Kaydet (Commit) 8db92932 authored tarafından Noel Grandin's avatar Noel Grandin

handle empty tools::Rectangle in editeng

Change-Id: Ie59a7ee3b95eafe2a2f743a76f8feb993c0c3daa
Reviewed-on: https://gerrit.libreoffice.org/72110
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 142a139b
...@@ -647,9 +647,9 @@ void ImpEditView::SetOutputArea( const tools::Rectangle& rRect ) ...@@ -647,9 +647,9 @@ void ImpEditView::SetOutputArea( const tools::Rectangle& rRect )
tools::Rectangle aNewRect(rOutDev.LogicToPixel(rRect)); tools::Rectangle aNewRect(rOutDev.LogicToPixel(rRect));
aNewRect = rOutDev.PixelToLogic(aNewRect); aNewRect = rOutDev.PixelToLogic(aNewRect);
aOutArea = aNewRect; aOutArea = aNewRect;
if ( aOutArea.Right() < aOutArea.Left() ) if ( !aOutArea.IsWidthEmpty() && aOutArea.Right() < aOutArea.Left() )
aOutArea.SetRight( aOutArea.Left() ); aOutArea.SetRight( aOutArea.Left() );
if ( aOutArea.Bottom() < aOutArea.Top() ) if ( !aOutArea.IsHeightEmpty() && aOutArea.Bottom() < aOutArea.Top() )
aOutArea.SetBottom( aOutArea.Top() ); aOutArea.SetBottom( aOutArea.Top() );
SetScrollDiffX( static_cast<sal_uInt16>(aOutArea.GetWidth()) * 2 / 10 ); SetScrollDiffX( static_cast<sal_uInt16>(aOutArea.GetWidth()) * 2 / 10 );
...@@ -867,6 +867,8 @@ void ImpEditView::CalcAnchorPoint() ...@@ -867,6 +867,8 @@ void ImpEditView::CalcAnchorPoint()
void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
{ {
// No ShowCursor in an empty View ... // No ShowCursor in an empty View ...
if (aOutArea.IsEmpty())
return;
if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) ) if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) )
return; return;
......
...@@ -724,7 +724,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) ...@@ -724,7 +724,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
if ( !nLine ) if ( !nLine )
{ {
aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) ); aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
if ( aBulletArea.Right() > 0 ) if ( !aBulletArea.IsWidthEmpty() && aBulletArea.Right() > 0 )
pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( aBulletArea.Right() )) ); pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( aBulletArea.Right() )) );
else else
pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly
...@@ -1676,7 +1676,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion ) ...@@ -1676,7 +1676,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion )
else else
{ {
aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) ); aBulletArea = GetEditEnginePtr()->GetBulletArea( GetParaPortions().GetPos( pParaPortion ) );
if ( aBulletArea.Right() > 0 ) if ( !aBulletArea.IsEmpty() && aBulletArea.Right() > 0 )
pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( aBulletArea.Right() )) ); pParaPortion->SetBulletX( static_cast<sal_Int32>(GetXValue( aBulletArea.Right() )) );
else else
pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly. pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly.
......
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