sw/source/core/layout/paintfrm.cxx | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
New commits: commit cfc49650d37e2a0eb28111097d7fc8453d9cafee Author: László Németh <nem...@numbertext.org> AuthorDate: Mon Aug 14 16:40:34 2023 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Wed Aug 16 19:41:57 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit f7189c63b297b8756f02be65a7050609599651af) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155704 Tested-by: Jenkins diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 117ac8eb5e61..c9fcc98436b6 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2828,6 +2828,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: @@ -2837,6 +2860,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(); @@ -2898,7 +2924,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);