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>
(cherry picked from commit aacf6f0e6059a3b24451da2782e0a0a420e89679)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163143
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 79f5eb6..33b9c93 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 3cc2e367..785ef79 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...