sw/source/core/table/swnewtable.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 71d8e5770a332c8ba26048b69dd172704fb703df
Author: Luboš Luňák <l.lu...@centrum.cz>
Date:   Tue Mar 18 18:57:05 2014 +0100

    workaround for rounding errors when handling merged cells (fdo#38414)
    
    Change-Id: I4d36e4b86c77a7356a8c221cbfc5735e925392ba
    Reviewed-on: https://gerrit.libreoffice.org/8648
    Reviewed-by: Michael Stahl <mst...@redhat.com>
    Tested-by: Michael Stahl <mst...@redhat.com>

diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index c41aedf..34b9c38 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -200,10 +200,20 @@ static SwTableBox* lcl_LeftBorder2Box( long nLeft, const 
SwTableLine* pLine )
     {
         SwTableBox* pBox = pLine->GetTabBoxes()[nCurrBox];
         OSL_ENSURE( pBox, "Missing table box" );
-        if( nCurrLeft >= nLeft && pBox->GetFrmFmt()->GetFrmSize().GetWidth() )
+        if( pBox->GetFrmFmt()->GetFrmSize().GetWidth() )
         {
-            OSL_ENSURE( nCurrLeft == nLeft, "Wrong box found" );
-            return pBox;
+            if( nCurrLeft == nLeft )
+                return pBox;
+            // HACK: It appears that rounding errors may result in positions 
not matching
+            // exactly, so allow a little tolerance. This happens at least 
with merged cells
+            // in the doc from fdo#38414 .
+            if( abs( nCurrLeft - nLeft ) <= ( nLeft / 1000 ))
+                return pBox;
+            if( nCurrLeft >= nLeft )
+            {
+                SAL_WARN( "sw.core", "Possibly wrong box found" );
+                return pBox;
+            }
         }
         nCurrLeft += pBox->GetFrmFmt()->GetFrmSize().GetWidth();
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to