summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-09-05 11:44:34 +0300
committerAndras Timar <andras.timar@collabora.com>2018-09-12 10:18:49 +0200
commit5506be988d157ba9c9448ab22bfcc2470dadd3b7 (patch)
tree35bcd562d7024a7a578124be26b21831fb429ace
parentd6cbf8aa5457052887767d7a355334bc25dcdf15 (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> (cherry picked from commit 62159ea8cc806df327461275563e95dfdff25667)
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index fbe12fd69018..0a66e7ea77a4 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -1529,11 +1529,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];