diff options
author | Luboš Luňák <l.lunak@centrum.cz> | 2014-03-18 18:57:05 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@centrum.cz> | 2014-03-18 20:57:01 +0100 |
commit | 9970d5d9878bf8b40361606cfad6b25a2b6cc83d (patch) | |
tree | 73dadc372e31d989359cd49e861c9c0c48640cfb | |
parent | 0e082ac24bfb4e6924539e4814901ce814880737 (diff) |
workaround for rounding errors when handling merged cells (fdo#38414)
Change-Id: I4d36e4b86c77a7356a8c221cbfc5735e925392ba
-rw-r--r-- | sw/source/core/table/swnewtable.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 26a445aa8aba..0186a22448a5 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -198,10 +198,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(); } |