sw/source/core/table/swtable.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 6ba3c85aad33ad3eded935185686dfcaaa7fcaa8 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Tue Mar 15 21:13:01 2022 +0200 Commit: Justin Luth <jl...@mail.com> CommitDate: Thu Mar 17 06:36:18 2022 +0100 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 <jl...@mail.com> diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index ec6487028790..7f2b5aef976c 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 ); }