diff options
author | Justin Luth <justin.luth@collabora.com> | 2018-09-05 11:44:34 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-09-06 08:48:06 +0200 |
commit | 62159ea8cc806df327461275563e95dfdff25667 (patch) | |
tree | 99c6d0cba5768a4060560b86c75126c6690dd4dc | |
parent | 3d604d1cd6cc70ef96782ef769f0479b509987a8 (diff) |
tdf#102290 sw ui: give all columns a chance to grow
Previously, if an earlier column wished for the entire table width,
then none of the other columns could adjust their size, even if
they only wanted one more character. This slight change gives
every column a chance to "wish" for an equal portion, and
still gives the earlier columns a chance to maximize.
So, this should implement very similarly to before, thus workflow
should not be impacted.
Change-Id: I11e8b94ce333735aa92b5388af6319f8eb0ccc51
Reviewed-on: https://gerrit.libreoffice.org/60027
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index f5ced41182e4..ff35893cd1e2 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1540,11 +1540,15 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance ) // only afterwards. // The first column's desired width would be discarded as it would cause // the Table's width to exceed the maximum width. + const sal_uInt16 nEqualWidth = (aTabCols.GetRight() - aTabCols.GetLeft()) / (aTabCols.Count() + 1); for ( int k = 0; k < 2; ++k ) { for ( size_t i = 0; i <= aTabCols.Count(); ++i ) { - int nDiff = aWish[i]; + // First pass is primarily a shrink pass. Give all columns a chance + // to grow by requesting the maximum width as "balanced". + // Second pass is a first-come, first-served chance to max out. + int nDiff = k ? aWish[i] : std::min(aWish[i], nEqualWidth); if ( nDiff ) { int nMin = aMins[i]; |