summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2014-03-18 18:57:05 +0100
committerAndras Timar <andras.timar@collabora.com>2014-03-19 11:37:23 +0100
commite8b686149f2a9f21a7a52bb5710a8a6362cd7a35 (patch)
tree22e8b59aea2ae8e5287931146c129580dc54d503
parent14f6e6353cce7a83e9c125252ec67ad54c4f8aac (diff)
workaround for rounding errors when handling merged cells (fdo#38414)
Change-Id: I4d36e4b86c77a7356a8c221cbfc5735e925392ba Signed-off-by: Andras Timar <andras.timar@collabora.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 23edc85fee3f..fef95fcc8a72 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();
}