[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/source

Luboš Luňák l.lunak at centrum.cz
Tue Mar 18 14:56:47 PDT 2014


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

New commits:
commit 71d8e5770a332c8ba26048b69dd172704fb703df
Author: Luboš Luňák <l.lunak at 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 <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at 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();
     }


More information about the Libreoffice-commits mailing list