Kaydet (Commit) 62159ea8 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Justin Luth

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: 's avatarJustin Luth <justin_luth@sil.org>
üst 3d604d1c
...@@ -1540,11 +1540,15 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance ) ...@@ -1540,11 +1540,15 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance )
// only afterwards. // only afterwards.
// The first column's desired width would be discarded as it would cause // The first column's desired width would be discarded as it would cause
// the Table's width to exceed the maximum width. // 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 ( int k = 0; k < 2; ++k )
{ {
for ( size_t i = 0; i <= aTabCols.Count(); ++i ) 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 ) if ( nDiff )
{ {
int nMin = aMins[i]; int nMin = aMins[i];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment