sc/sdi/scalc.sdi | 4 +-- sc/source/ui/inc/tabview.hxx | 15 ++++++++++++++ sc/source/ui/view/cellsh4.cxx | 31 +++++++++++++++++++++++++++-- sc/source/ui/view/gridwin4.cxx | 11 ++++++++++ sc/source/ui/view/tabview3.cxx | 43 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 100 insertions(+), 4 deletions(-)
New commits: commit 0bd43b8c782135e5eb3018ee345a3bd409419a1b Author: Pranav Kant <pran...@collabora.com> Date: Tue Mar 15 15:35:27 2016 +0530 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 <c...@libreoffice.org> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 60a4bac..99a5313 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 cb6c65b..508af34 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 5fe24c6..aa8442d 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 e36bf90..95b6dfe 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 0dd373c..4b09b0e 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits