sw/source/core/layout/paintfrm.cxx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
New commits: commit a9b3d3ec7fe6fe995b689c1de7e065b68845ea85 Author: László Németh <[email protected]> AuthorDate: Mon Aug 14 16:40:34 2023 +0200 Commit: László Németh <[email protected]> CommitDate: Wed Aug 16 10:58:36 2023 +0200 tdf#156782 sw tracked table column: fix missing right table border Last visible column of a table followed with hidden deleted columns hid also the right border of the table, if the inner vertical column borders drawn only by left-only borders (like in the default table style). See also commit f9898fa64bd2a575be94c309b43373de53c5331b "tdf#150308 sw: fix missing top table border after hidden table rows" Note: layout testing doesn't work, because of the missing calculation with the width of the enabled border of the row frame. Also there is a problem with metafile testing (empty meta file?). Change-Id: I5e98c6751d889f8d5a3f7f2b0b31e44149742e25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155669 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 8b44b33445d5..e1f6e12827fe 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2829,6 +2829,29 @@ static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( && rBoxItem.GetBottom()); } +/** + * Special case: + * last visible cell of a table row followed with a hidden deleted cell, + * and the right border of the visible cell was painted by its left border + */ +static bool lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow( + SwFrame const& rFrame, SvxBoxItem const& rBoxItem) +{ + SwRowFrame const*const pThisRowFrame = + dynamic_cast<const SwRowFrame*>(rFrame.GetUpper()); + const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(&rFrame); + + return pThisRowFrame + // last visible cell + && !rFrame.GetNext() + // it has only left border + && !rBoxItem.GetRight() + && rBoxItem.GetLeft() + // last visible table cell isn't equal to the last cell: + // there are invisible deleted cells in Hide Changes mode + && pThisRowFrame->GetTabLine()->GetTabBoxes().back() != pThisCell->GetTabBox(); +} + void SwTabFramePainter::Insert(const SwFrame& rFrame, const SvxBoxItem& rBoxItem, const SwRect& rPaintArea) { // build 4 line entries for the 4 borders: @@ -2838,6 +2861,9 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, const SvxBoxItem& rBoxItem bool const bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines( mrTabFrame, rFrame, rBoxItem)); + bool const bLeftAsRight(lcl_IsLastVisibleCellBeforeHiddenCellAtTheEndOfRow( + rFrame, rBoxItem)); + bool const bVert = mrTabFrame.IsVertical(); bool const bR2L = mrTabFrame.IsRightToLeft(); @@ -2899,7 +2925,7 @@ void SwTabFramePainter::Insert(const SwFrame& rFrame, const SvxBoxItem& rBoxItem } SwLineEntry aRight (nRight, nTop, nBottom, bRightIsOuter, - bVert ? (bBottomAsTop ? aB : aT) : (bR2L ? aL : aR)); + bVert ? (bBottomAsTop ? aB : aT) : ((bR2L || bLeftAsRight) ? aL : aR)); if (bWordTableCell && rBoxItem.GetRight()) { aRight.LimitVerticalEndPos(rFrame, SwLineEntry::VerticalType::RIGHT);
