summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorPhilippe Jung <phil.jung@free.fr>2015-05-16 00:04:43 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-05-17 12:39:39 +0000
commitd49242026ed9e342871b437998a40a253e4f26c8 (patch)
tree45746ab04b2b220a2fafc0cc8bcc14429af92e99 /sw/source/uibase
parentdc65b0242544a7d4c22c6fcf473dafb3e2d41121 (diff)
tdf#90883 WRITER: Insert button with multiple rows/columns selected
Compute the number of rows/columns to insert based on selected cells. Change-Id: I489bca715dcf31d191f9a875ac5d59a6140a14d7 Reviewed-on: https://gerrit.libreoffice.org/15741 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/shells/tabsh.cxx25
1 files changed, 24 insertions, 1 deletions
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index ead7b165eb21..586261803f11 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -833,7 +833,30 @@ void SwTableShell::Execute(SfxRequest &rReq)
bAfter = static_cast<const SfxBoolItem* >(pItem)->GetValue();
}
else if( !rReq.IsAPI() )
- ++nCount;
+ {
+ SwSelBoxes aBoxes;
+ ::GetTblSel( rSh, aBoxes );
+ if ( !aBoxes.empty() )
+ {
+ long maxX = 0;
+ long maxY = 0;
+ long minX = std::numeric_limits<long>::max();
+ long minY = std::numeric_limits<long>::max();
+ long nbBoxes = aBoxes.size();
+ for ( int i = 0; i < nbBoxes; i++ )
+ {
+ Point aCoord ( aBoxes[i]->GetCoordinates() );
+ if ( aCoord.X() < minX ) minX = aCoord.X();
+ if ( aCoord.X() > maxX ) maxX = aCoord.X();
+ if ( aCoord.Y() < minY ) minY = aCoord.Y();
+ if ( aCoord.Y() > maxY ) maxY = aCoord.Y();
+ }
+ if (bColumn)
+ nCount = maxX - minX + 1;
+ else
+ nCount = maxY - minY + 1;
+ }
+ }
if( nCount )
{