tdf#119298 sw: keep automatic position on trivial width change
The issue here was that simply moving the border around
(which shouldn't change the table size at all)
triggered a miniscule difference in reported table width.
Well, that is not enough reason to change away from automatic
positioning now is it?
Change-Id: Ib40c50a1069d88fa22f4791366eb0a50b4e9b11d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131633
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index ec64870..7f2b5ae 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -872,7 +872,16 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
else if(!bLeftDist && rNew.GetRight() + nShRight < rNew.GetRightMax())
aOri.SetHoriOrient( text::HoriOrientation::LEFT );
else
aOri.SetHoriOrient( text::HoriOrientation::LEFT_AND_WIDTH );
{
// if an automatic table hasn't (really) changed size, then leave it as auto.
const tools::Long nOldWidth = rOld.GetRight() - rOld.GetLeft();
const tools::Long nNewWidth = rNew.GetRight() - rNew.GetLeft();
if (aOri.GetHoriOrient() != text::HoriOrientation::FULL
|| std::abs(nOldWidth - nNewWidth) > COLFUZZY)
{
aOri.SetHoriOrient(text::HoriOrientation::LEFT_AND_WIDTH);
}
}
}
pFormat->SetFormatAttr( aOri );
}