summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-01-24 14:14:20 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-02-08 15:31:39 +0100
commit8affaf465a2b4c092518406a495796b06a642b1d (patch)
tree2b32471a41360afe0dd830ffb01380b3aa10a32d
parent6eda6afc90eda8f0a424a5e91a2b00f06bbbb3c5 (diff)
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 <thorsten.behrens@allotropia.de>
-rw-r--r--sw/source/core/frmedt/fetab.cxx4
-rw-r--r--sw/source/core/table/swnewtable.cxx9
2 files changed, 10 insertions, 3 deletions
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...