diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-03-15 21:13:01 +0200 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2022-03-17 06:36:18 +0100 |
commit | 6ba3c85aad33ad3eded935185686dfcaaa7fcaa8 (patch) | |
tree | 367d9d8da75cb0d5b90f03d9ba070daea8c4cab0 /sw | |
parent | 94016b435404f19d84ed636c5b3fd1ab0c02e020 (diff) |
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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/table/swtable.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
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 ); } |