diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-10 11:14:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-10 13:30:38 +0200 |
commit | 8db92932239467a8623b2bd481da7106f73ba25a (patch) | |
tree | 2a1d53885ed54f915bdf21e8b6a538db37af5c76 /editeng | |
parent | 142a139b8de7712d6f24dcad558c45c453985f40 (diff) |
handle empty tools::Rectangle in editeng
Change-Id: Ie59a7ee3b95eafe2a2f743a76f8feb993c0c3daa
Reviewed-on: https://gerrit.libreoffice.org/72110
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 87ed64446f39..551a83b4def2 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -647,9 +647,9 @@ void ImpEditView::SetOutputArea( const tools::Rectangle& rRect ) tools::Rectangle aNewRect(rOutDev.LogicToPixel(rRect)); aNewRect = rOutDev.PixelToLogic(aNewRect); aOutArea = aNewRect; - if ( aOutArea.Right() < aOutArea.Left() ) + if ( !aOutArea.IsWidthEmpty() && aOutArea.Right() < aOutArea.Left() ) aOutArea.SetRight( aOutArea.Left() ); - if ( aOutArea.Bottom() < aOutArea.Top() ) + if ( !aOutArea.IsHeightEmpty() && aOutArea.Bottom() < aOutArea.Top() ) aOutArea.SetBottom( aOutArea.Top() ); SetScrollDiffX( static_cast<sal_uInt16>(aOutArea.GetWidth()) * 2 / 10 ); @@ -867,6 +867,8 @@ void ImpEditView::CalcAnchorPoint() void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) { // No ShowCursor in an empty View ... + if (aOutArea.IsEmpty()) + return; if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) ) return; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 815dc8f52b09..ec3e10cf1290 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -724,7 +724,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) if ( !nLine ) { 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() )) ); else pParaPortion->SetBulletX( 0 ); // if Bullet is set incorrectly @@ -1676,7 +1676,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion ) else { 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() )) ); else pParaPortion->SetBulletX( 0 ); // If Bullet set incorrectly. |