summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2014-03-18 18:57:05 +0100
committerMichael Stahl <mstahl@redhat.com>2014-03-18 21:56:26 +0000
commit71d8e5770a332c8ba26048b69dd172704fb703df (patch)
tree85d2b2b4fe8d19a616f331d8f53d3a28f9321d81
parent7dca4fda3ede573eef6582e71facc95b3f79be55 (diff)
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@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/core/table/swnewtable.cxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index c41aedfbc288..34b9c38c2c26 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();
}