sc/source/core/data/tablestyle.cxx | 79 +++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 11 deletions(-)
New commits: commit 4acf29de3f36ffea8425f9fec54c66fc4ceaf18c Author: Balazs Varga <[email protected]> AuthorDate: Thu Nov 13 16:59:20 2025 +0100 Commit: Balazs Varga <[email protected]> CommitDate: Wed Jan 7 17:15:49 2026 +0100 Table Style: handle the table style borders for cellinfo If we have a Tablepattern with borders we need to apply those border element to the cells on outside. Change-Id: I9ad94cdb22b1227c39053d34ce7fa96f4295258c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193987 Reviewed-by: Andras Timar <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196761 Tested-by: Balazs Varga <[email protected]> Reviewed-by: Balazs Varga <[email protected]> diff --git a/sc/source/core/data/tablestyle.cxx b/sc/source/core/data/tablestyle.cxx index 9d930e888e90..29373b9e81ab 100644 --- a/sc/source/core/data/tablestyle.cxx +++ b/sc/source/core/data/tablestyle.cxx @@ -503,21 +503,78 @@ std::unique_ptr<SvxBoxItem> ScTableStyle::GetBoxItem(const ScDBData& rDBData, SC { sal_Int32 nTotalRowStripPattern = mnFirstRowStripeSize + mnSecondRowStripeSize; bool bFirstRowStripe = (nRowIndex % nTotalRowStripPattern) < mnFirstRowStripeSize; - if (mpSecondRowStripePattern && !bFirstRowStripe) - { - const SvxBoxItem* pPoolItem - = GetItemFromPattern(mpSecondRowStripePattern.get(), ATTR_BORDER); - if (pPoolItem) - return std::make_unique<SvxBoxItem>(*pPoolItem); - } + const SvxBoxItem* pPoolItem = nullptr; if (mpFirstRowStripePattern && bFirstRowStripe) + pPoolItem = GetItemFromPattern(mpFirstRowStripePattern.get(), ATTR_BORDER); + else if (mpSecondRowStripePattern && !bFirstRowStripe) + pPoolItem = GetItemFromPattern(mpSecondRowStripePattern.get(), ATTR_BORDER); + + if (pPoolItem && mpTablePattern) { - const SvxBoxItem* pPoolItem - = GetItemFromPattern(mpFirstRowStripePattern.get(), ATTR_BORDER); - if (pPoolItem) - return std::make_unique<SvxBoxItem>(*pPoolItem); + const SvxBoxItem* pBoxItem = GetItemFromPattern(mpTablePattern.get(), ATTR_BORDER); + const SvxBoxInfoItem* pBoxInfoItem + = GetItemFromPattern(mpTablePattern.get(), ATTR_BORDER_INNER); + if (pBoxItem || pBoxInfoItem) + { + if (pBoxItem && nCol == aRange.aStart.Col()) + { + const ::editeng::SvxBorderLine* pLLine + = pBoxItem->GetLine(SvxBoxItemLine::LEFT); + if (pLLine) + { + std::unique_ptr<SvxBoxItem> pNewBoxItem(pPoolItem ? pPoolItem->Clone() + : nullptr); + if (!pNewBoxItem) + pNewBoxItem = std::make_unique<SvxBoxItem>(ATTR_BORDER); + if (pLLine) + pNewBoxItem->SetLine(pLLine, SvxBoxItemLine::LEFT); + + return pNewBoxItem; + } + } + else if (pBoxItem && nCol == aRange.aEnd.Col()) + { + const ::editeng::SvxBorderLine* pRLine + = pBoxItem->GetLine(SvxBoxItemLine::RIGHT); + if (pRLine) + { + std::unique_ptr<SvxBoxItem> pNewBoxItem(pPoolItem ? pPoolItem->Clone() + : nullptr); + if (!pNewBoxItem) + pNewBoxItem = std::make_unique<SvxBoxItem>(ATTR_BORDER); + if (pRLine) + pNewBoxItem->SetLine(pRLine, SvxBoxItemLine::RIGHT); + + return pNewBoxItem; + } + } + else + { + const ::editeng::SvxBorderLine* pVLine = nullptr; + if (pBoxInfoItem) + pVLine = pBoxInfoItem->GetVert(); + + if (pVLine) + { + std::unique_ptr<SvxBoxItem> pNewBoxItem(pPoolItem ? pPoolItem->Clone() + : nullptr); + if (!pNewBoxItem) + pNewBoxItem = std::make_unique<SvxBoxItem>(ATTR_BORDER); + if (pVLine) + { + pNewBoxItem->SetLine(pVLine, SvxBoxItemLine::LEFT); + pNewBoxItem->SetLine(pVLine, SvxBoxItemLine::RIGHT); + } + + return pNewBoxItem; + } + } + } } + + if (pPoolItem) + return std::make_unique<SvxBoxItem>(*pPoolItem); } if (pParam->mbColumnStripes)
