[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Sep 6 06:48:29 UTC 2018
sw/source/core/docnode/ndtbl1.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 62159ea8cc806df327461275563e95dfdff25667
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Wed Sep 5 11:44:34 2018 +0300
Commit: Justin Luth <justin_luth at sil.org>
CommitDate: Thu Sep 6 08:48:06 2018 +0200
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 at sil.org>
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];
More information about the Libreoffice-commits
mailing list