diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-19 17:04:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-20 17:37:48 +0200 |
commit | 63872b70cb0cc48052f43ee8966ba7c37650f81a (patch) | |
tree | d390bbfbad5784da93b5d9104b22ca819f7341c6 /sw | |
parent | b4e1b145ff9cccd4d91798c5da2e32ffa9b267ec (diff) |
zero width column in manage changes
https://github.com/exaile/exaile/issues/580
the fixed_width request is not handled by the time the
width is queried. Use the requested width if the
width is still 0.
assert when such columns value are stored, and
ignore existing useless ones on read
Change-Id: Ibce74ec6a232edcf36b929f71474418b3e742856
Reviewed-on: https://gerrit.libreoffice.org/74445
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index d00013e8f4fb..7e46cf853bea 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1171,14 +1171,23 @@ void SwRedlineAcceptDlg::Initialize(OUString& rExtraString) aEndPos.push_back(aStr.toInt32()); } + bool bUseless = false; + std::vector<int> aWidths; for (int i = 1; i < nCount; ++i) + { aWidths.push_back(aEndPos[i] - aEndPos[i - 1]); + if (aWidths.back() <= 0) + bUseless = true; + } - // turn column end points back to column widths, ignoring the small - // value used for the expander column - weld::TreeView& rTreeView = m_pTable->GetWidget(); - rTreeView.set_column_fixed_widths(aWidths); + if (!bUseless) + { + // turn column end points back to column widths, ignoring the small + // value used for the expander column + weld::TreeView& rTreeView = m_pTable->GetWidget(); + rTreeView.set_column_fixed_widths(aWidths); + } } } } @@ -1202,7 +1211,11 @@ void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) const // expander column aWidths.push_back(rTreeView.get_checkbox_column_width()); for (int i = 0; i < nTabCount - 1; ++i) - aWidths.push_back(aWidths.back() + rTreeView.get_column_width(i)); + { + int nWidth = rTreeView.get_column_width(i); + assert(nWidth > 0 && "suspicious to get a value like this"); + aWidths.push_back(aWidths.back() + nWidth); + } for (auto a : aWidths) { |