sw/source/core/frmedt/fetab.cxx     |    4 ++--
 sw/source/core/table/swnewtable.cxx |    9 ++++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 8affaf465a2b4c092518406a495796b06a642b1d
Author:     Oliver Specht <[email protected]>
AuthorDate: Wed Jan 24 14:14:20 2024 +0100
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Thu Feb 8 15:31:39 2024 +0100

    tdf#43848 fix selection in table with split/merged cells
    
    extends the selection of table cells to reach a more
    rectangular selection area
    Additionally tdf#155670 is taken care of by not showing the
    row selection cursor if row selection is not supported
    
    Change-Id: If31aa1030c91d81bc889d8aaa668e96c5328f03f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162508
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 79f5eb6b5e58..33b9c9327b6d 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -2116,8 +2116,8 @@ SwTab SwFEShell::WhichMouseTabCol( const Point &rPt ) 
const
     {
         while( pFrame && pFrame->Lower() && pFrame->Lower()->IsRowFrame() )
             pFrame = static_cast<const SwCellFrame*>(static_cast<const 
SwLayoutFrame*>(pFrame->Lower())->Lower());
-        if( pFrame && pFrame->GetTabBox()->GetSttNd() &&
-            pFrame->GetTabBox()->GetSttNd()->IsInProtectSect() )
+        if( pFrame && ((pFrame->GetTabBox()->GetSttNd() &&
+            pFrame->GetTabBox()->GetSttNd()->IsInProtectSect()) || 
(pFrame->GetTabBox()->getRowSpan() < 0)))
             pFrame = nullptr;
     }
 
diff --git a/sw/source/core/table/swnewtable.cxx 
b/sw/source/core/table/swnewtable.cxx
index ac057a7ae938..a8b7e0e0d233 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -1739,7 +1739,11 @@ void SwTable::CreateSelection( const SwNode* pStartNd, 
const SwNode* pEndNd,
                     rBoxes.insert( pBox );
                 if( nFound )
                 {
-                    nBottom = nRow;
+                    //if box is hiding cells bottom needs to be moved
+                    if (pBox->getRowSpan() > 1)
+                        nBottom = std::max(nBottom, size_t(nRow + 
pBox->getRowSpan() - 1));
+                    else
+                        nBottom = std::max(nRow, nBottom);
                     lcl_CheckMinMax( nLowerMin, nLowerMax, *pLine, nCol, true 
);
                     ++nFound;
                     break;
@@ -1747,6 +1751,9 @@ void SwTable::CreateSelection( const SwNode* pStartNd, 
const SwNode* pEndNd,
                 else
                 {
                     nTop = nRow;
+                    //if box is hiding cells bottom needs to be moved
+                    if (pBox->getRowSpan() > 1)
+                        nBottom = nRow + pBox->getRowSpan() - 1;
                     lcl_CheckMinMax( nUpperMin, nUpperMax, *pLine, nCol, true 
);
                     ++nFound;
                      // If start and end node are identical, we're nearly 
done...

Reply via email to