[Libreoffice-commits] core.git: editeng/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 11:31:27 UTC 2019


 editeng/source/editeng/impedit.cxx  |    6 ++++--
 editeng/source/editeng/impedit3.cxx |    4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 8db92932239467a8623b2bd481da7106f73ba25a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 10 11:14:06 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri May 10 13:30:38 2019 +0200

    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 at collabora.co.uk>

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.


More information about the Libreoffice-commits mailing list