summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.com>2016-03-15 15:35:27 +0530
committerJan Holesovsky <kendy@collabora.com>2016-03-17 18:42:37 +0000
commit0bd43b8c782135e5eb3018ee345a3bd409419a1b (patch)
tree72b7fe4881a2bb73aa04ab555aba8b55c4fa82b3 /sc
parent8d754e8609f918c2c08a6c6b91a8e12b99efba52 (diff)
sc lok: Extend uno commands: .uno:SelectRow/Column
Now also accepts a row/column index with modifier key to do various selection/block selection/negative selection operations Change-Id: Idfb56b94ca2eb4553eb9388b786f5d1e89448ec2 Reviewed-on: https://gerrit.libreoffice.org/23256 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/sdi/scalc.sdi4
-rw-r--r--sc/source/ui/inc/tabview.hxx15
-rw-r--r--sc/source/ui/view/cellsh4.cxx31
-rw-r--r--sc/source/ui/view/gridwin4.cxx11
-rw-r--r--sc/source/ui/view/tabview3.cxx43
5 files changed, 100 insertions, 4 deletions
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 60a4baca537d..99a53135ddc5 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -4578,7 +4578,7 @@ SfxVoidItem SelectOLE SID_OLE_SELECT
SfxVoidItem SelectColumn SID_SELECT_COL
-()
+(SfxInt32Item Col FN_PARAM_1,SfxInt16Item Modifier FN_PARAM_2)
[
AutoUpdate = FALSE,
FastCall = FALSE,
@@ -4754,7 +4754,7 @@ SfxObjectItem Selection SID_SC_SELECTION
SfxVoidItem SelectRow SID_SELECT_ROW
-()
+(SfxInt32Item Row FN_PARAM_1,SfxInt16Item Modifier FN_PARAM_2)
[
AutoUpdate = FALSE,
FastCall = FALSE,
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index cb6c65b3932e..508af3434fba 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -474,6 +474,21 @@ public:
void MarkColumns();
void MarkRows();
+
+ /**
+ * @brief Called to select a full column
+ *
+ * @param nCol: Column number to do operation on
+ * @param nModifier:
+ */
+ void MarkColumns(SCCOL nCol, sal_Int16 nModifier);
+ /**
+ * @brief Called to select a full row
+ *
+ * @param nRow: Row number to do operation on
+ * @param nModifier:
+ */
+ void MarkRows(SCROW nRow, sal_Int16 nModifier);
void MarkDataArea( bool bIncludeCursor = true );
void MarkMatrixFormula();
void Unmark();
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 5fe24c6716c3..aa8442dae61e 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -275,6 +275,7 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
sal_uInt16 nSlotId = rReq.GetSlot();
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
if(nSlotId != SID_CURSORTOPOFSCREEN && nSlotId != SID_CURSORENDOFSCREEN)
pTabViewShell->ExecuteInputDirect();
@@ -316,11 +317,37 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq )
break;
case SID_SELECT_COL:
- pTabViewShell->MarkColumns();
+ {
+ const SfxPoolItem* pColItem;
+ const SfxPoolItem* pModifierItem;
+ if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pColItem ) &&
+ pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) )
+ {
+ SCCOL nCol = static_cast<SCCOL>(static_cast<const SfxInt16Item*>(pColItem)->GetValue());;
+ sal_Int16 nModifier = static_cast<sal_Int16>(static_cast<const SfxInt16Item*>(pModifierItem)->GetValue());
+
+ pTabViewShell->MarkColumns( nCol, nModifier );
+ }
+ else
+ pTabViewShell->MarkColumns();
+ }
break;
case SID_SELECT_ROW:
- pTabViewShell->MarkRows();
+ {
+ const SfxPoolItem* pRowItem;
+ const SfxPoolItem* pModifierItem;
+ if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pRowItem ) &&
+ pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) )
+ {
+ SCROW nRow = static_cast<SCROW>(static_cast<const SfxInt32Item*>(pRowItem)->GetValue());;
+ sal_Int16 nModifier = static_cast<sal_Int16>(static_cast<const SfxInt16Item*>(pModifierItem)->GetValue());
+
+ pTabViewShell->MarkRows( nRow, nModifier );
+ }
+ else
+ pTabViewShell->MarkRows();
+ }
break;
case SID_SELECT_NONE:
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e36bf901339f..95b6dfea8b66 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1609,6 +1609,17 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects )
if (nY2 > nYBottom)
nY2 = nYBottom;
}
+ else
+ {
+ SCCOL nMaxTiledCol;
+ SCROW nMaxTiledRow;
+ pDoc->GetTiledRenderingArea( nTab, nMaxTiledCol, nMaxTiledRow );
+
+ if (nX2 > nMaxTiledCol)
+ nX2 = nMaxTiledCol;
+ if (nY2 > nMaxTiledRow)
+ nY2 = nMaxTiledRow;
+ }
double nPPTX = pViewData->GetPPTX();
double nPPTY = pViewData->GetPPTY();
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 0dd373cb3d0f..4b09b0e4da98 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1409,6 +1409,49 @@ void ScTabView::MarkRows()
SelectionChanged();
}
+
+void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
+{
+ SCCOL nStartCol = nCol;
+ SCTAB nTab = aViewData.GetTabNo();
+ bool bTestNeg = true;
+
+ switch( nModifier )
+ {
+ case KEY_SHIFT:
+ case KEY_MOD1 + KEY_SHIFT:
+ nStartCol = aViewData.GetCurX();
+ bTestNeg = false;
+ }
+
+ DoneBlockMode( nModifier != 0 );
+ InitBlockMode( nStartCol, 0, nTab, bTestNeg, true, false );
+ MarkCursor( nCol, MAXROW, nTab );
+ SetCursor( nCol, 0 );
+ SelectionChanged();
+}
+
+void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
+{
+ SCROW nStartRow = nRow;
+ SCTAB nTab = aViewData.GetTabNo();
+ bool bTestNeg = true;
+
+ switch ( nModifier )
+ {
+ case KEY_SHIFT:
+ case KEY_MOD1 + KEY_SHIFT:
+ nStartRow = aViewData.GetCurY();
+ bTestNeg = false;
+ }
+
+ DoneBlockMode( nModifier != 0 );
+ InitBlockMode( 0, nStartRow, nTab, bTestNeg, false, true );
+ MarkCursor( MAXCOL, nRow, nTab );
+ SetCursor( 0, nRow );
+ SelectionChanged();
+}
+
void ScTabView::MarkDataArea( bool bIncludeCursor )
{
ScDocument* pDoc = aViewData.GetDocument();