svx/source/dialog/framelinkarray.cxx       |   12 ++++++++++--
 svx/source/table/viewcontactoftableobj.cxx |    4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 586a0f149f332c0b0e53c0bb30568d4bd411b0e3
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Mon Jan 17 10:17:42 2022 +0300
Commit:     Gülşah Köse <gulsah.k...@collabora.com>
CommitDate: Mon Jan 17 13:14:42 2022 +0100

    tdf#135843 tdf#146731 Fix the missing border handling
    
    Reverts fa5ab8aa5d88e7128015127af75980a65f945cbb inside. And fix the
    missing border problem with better way. Reason of the problem is using
    ORIGCELL cell style for bottom and right of merged ranges is wrong.
    
    Eg: We have Row X Col 3X3 table. (0,1) and (0,2) merged. The right side
    of right border style should be same with (0,2). But ORIGCELL points (0,1)
    instead. In case we should use LASTCELL. Same reason is valid for bottom 
case.
    
    Change-Id: I5282083541f0bd02f3765943da4f34cabe05ef13
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128493
    Reviewed-by: Gülşah Köse <gulsah.k...@collabora.com>
    Tested-by: Gülşah Köse <gulsah.k...@collabora.com>

diff --git a/svx/source/dialog/framelinkarray.cxx 
b/svx/source/dialog/framelinkarray.cxx
index 568043c7a8f8..27e227c678ad 100644
--- a/svx/source/dialog/framelinkarray.cxx
+++ b/svx/source/dialog/framelinkarray.cxx
@@ -260,6 +260,7 @@ struct ArrayImpl
     sal_Int32              GetMergedLastRow( sal_Int32 nCol, sal_Int32 nRow ) 
const;
 
     const Cell&         GetMergedOriginCell( sal_Int32 nCol, sal_Int32 nRow ) 
const;
+    const Cell&         GetMergedLastCell( sal_Int32 nCol, sal_Int32 nRow ) 
const;
 
     bool                IsMergedOverlappedLeft( sal_Int32 nCol, sal_Int32 nRow 
) const;
     bool                IsMergedOverlappedRight( sal_Int32 nCol, sal_Int32 
nRow ) const;
@@ -343,6 +344,11 @@ const Cell& ArrayImpl::GetMergedOriginCell( sal_Int32 
nCol, sal_Int32 nRow ) con
     return GetCell( GetMergedFirstCol( nCol, nRow ), GetMergedFirstRow( nCol, 
nRow ) );
 }
 
+const Cell& ArrayImpl::GetMergedLastCell( sal_Int32 nCol, sal_Int32 nRow ) 
const
+{
+    return GetCell( GetMergedLastCol( nCol, nRow ), GetMergedLastRow( nCol, 
nRow ) );
+}
+
 bool ArrayImpl::IsMergedOverlappedLeft( sal_Int32 nCol, sal_Int32 nRow ) const
 {
     const Cell& rCell = GetCell( nCol, nRow );
@@ -486,6 +492,7 @@ MergedCellIterator& MergedCellIterator::operator++()
 #define CELL( col, row )        mxImpl->GetCell( col, row )
 #define CELLACC( col, row )     mxImpl->GetCellAcc( col, row )
 #define ORIGCELL( col, row )    mxImpl->GetMergedOriginCell( col, row )
+#define LASTCELL( col, row )    mxImpl->GetMergedLastCell( col, row )
 
 
 Array::Array()
@@ -653,7 +660,7 @@ const Style& Array::GetCellStyleRight( sal_Int32 nCol, 
sal_Int32 nRow ) const
         return ORIGCELL( nCol + 1, nRow ).GetStyleLeft();
     // right clipping border: always own right style
     if( nCol == mxImpl->mnLastClipCol )
-        return ORIGCELL( nCol, nRow ).GetStyleRight();
+        return LASTCELL( nCol, nRow ).GetStyleRight();
     // outside clipping columns: invisible
     if( !mxImpl->IsColInClipRange( nCol ) )
         return OBJ_STYLE_NONE;
@@ -689,7 +696,7 @@ const Style& Array::GetCellStyleBottom( sal_Int32 nCol, 
sal_Int32 nRow ) const
         return ORIGCELL( nCol, nRow + 1 ).GetStyleTop();
     // bottom clipping border: always own bottom style
     if( nRow == mxImpl->mnLastClipRow )
-        return ORIGCELL( nCol, nRow ).GetStyleBottom();
+        return LASTCELL( nCol, nRow ).GetStyleBottom();
     // outside clipping rows: invisible
     if( !mxImpl->IsRowInClipRange( nRow ) )
         return OBJ_STYLE_NONE;
@@ -1519,6 +1526,7 @@ drawinglayer::primitive2d::Primitive2DContainer 
Array::CreateB2DPrimitiveArray()
 }
 
 #undef ORIGCELL
+#undef LASTCELL
 #undef CELLACC
 #undef CELL
 #undef DBG_FRAME_CHECK_ROW_1
diff --git a/svx/source/table/viewcontactoftableobj.cxx 
b/svx/source/table/viewcontactoftableobj.cxx
index 932844fe98d7..6419c5057dab 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -259,9 +259,9 @@ namespace sdr::contact
                             {
                                 // copy styles for current cell to 
CellBorderArray for primitive creation
                                 aArray.SetCellStyleLeft(aCellPos.mnCol, 
aCellPos.mnRow, impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow, 
false, nColCount, nRowCount, bIsRTL));
-                                aArray.SetCellStyleRight(aCellPos.mnCol, 
aCellPos.mnRow, impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow, 
false, nColCount, nRowCount, bIsRTL));
+                                aArray.SetCellStyleRight(aCellPos.mnCol, 
aCellPos.mnRow, impGetLineStyle(rTableLayouter, aCellPos.mnCol + 1, 
aCellPos.mnRow, false, nColCount, nRowCount, bIsRTL));
                                 aArray.SetCellStyleTop(aCellPos.mnCol, 
aCellPos.mnRow, impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow, 
true, nColCount, nRowCount, bIsRTL));
-                                aArray.SetCellStyleBottom(aCellPos.mnCol, 
aCellPos.mnRow, impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow, 
true, nColCount, nRowCount, bIsRTL));
+                                aArray.SetCellStyleBottom(aCellPos.mnCol, 
aCellPos.mnRow, impGetLineStyle(rTableLayouter, aCellPos.mnCol, aCellPos.mnRow 
+ 1, true, nColCount, nRowCount, bIsRTL));
 
                                 // ignore merged cells (all except the 
top-left of a merged cell)
                                 if(!xCurrentCell->isMerged())

Reply via email to