[Libreoffice-commits] .: sc/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jul 29 04:24:15 PDT 2011


 sc/source/ui/view/cellsh4.cxx |   33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 2a6f95014f3f8be561b4b67e9274a3cc24e2d08f
Author: Olivier Hallot <olivier.hallot at documentfoundation.org>
Date:   Fri Jul 29 12:23:26 2011 +0100

    Fix the "By" property in GoDownSel and GoDownBlockSel
    
    The "By" property for cell commands Go[Down,Up,Left,Right]Sel and
    Go[Down,Up,Left,Right]BlockSel was hardcoded to 1 in cellsh4.cxx. This
    patch allows repetition of the commands by the value of the By property.

diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 39a0d65..136b650 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -227,19 +227,32 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
         pViewShell->ExecuteInputDirect();
     }
 
+    SCsCOLROW nRepeat = 1;
+    const SfxItemSet* pReqArgs = rReq.GetArgs();
+    // get repetition
+    if ( pReqArgs != NULL )
+    {
+        const SfxPoolItem* pItem;
+        if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+            nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue());
+    }
+
+    SCsROW nMovY = nRepeat;
     // Horizontal direction depends on whether or not the UI language is RTL.
-    SCsCOL nMovX = 1;
+    SCsCOL nMovX = nRepeat;
     if (GetViewData()->GetDocument()->IsLayoutRTL(GetViewData()->GetTabNo()))
+    {
         // mirror horizontal movement for right-to-left mode.
-        nMovX = -1;
+        nMovX = -nRepeat;
+    }
 
     switch (nSlotId)
     {
         case SID_CURSORDOWN_SEL:
-            pViewShell->ExpandBlock(0, 1, SC_FOLLOW_LINE);
+            pViewShell->ExpandBlock(0, nMovY, SC_FOLLOW_LINE);
         break;
         case SID_CURSORUP_SEL:
-            pViewShell->ExpandBlock(0, -1, SC_FOLLOW_LINE);
+            pViewShell->ExpandBlock(0, -nMovY, SC_FOLLOW_LINE);
         break;
         case SID_CURSORRIGHT_SEL:
             pViewShell->ExpandBlock(nMovX, 0, SC_FOLLOW_LINE);
@@ -248,10 +261,10 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
             pViewShell->ExpandBlock(-nMovX, 0, SC_FOLLOW_LINE);
         break;
         case SID_CURSORPAGEUP_SEL:
-            pViewShell->ExpandBlockPage(0, -1);
+            pViewShell->ExpandBlockPage(0, -nMovY);
         break;
         case SID_CURSORPAGEDOWN_SEL:
-            pViewShell->ExpandBlockPage(0, 1);
+            pViewShell->ExpandBlockPage(0, nMovY);
         break;
         case SID_CURSORPAGERIGHT_SEL:
             pViewShell->ExpandBlockPage(nMovX, 0);
@@ -260,13 +273,13 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
             pViewShell->ExpandBlockPage(-nMovX, 0);
         break;
         case SID_CURSORBLKDOWN_SEL:
-            pViewShell->ExpandBlockArea(0, 1);
+            pViewShell->ExpandBlockArea(0, nMovY);
         break;
         case SID_CURSORBLKUP_SEL:
-            pViewShell->ExpandBlockArea(0, -1);
+            pViewShell->ExpandBlockArea(0, -nMovY);
         break;
         case SID_CURSORBLKRIGHT_SEL:
-            pViewShell->ExpandBlockArea(nMovX, 0);
+            pViewShell->ExpandBlockArea(nMovX , 0);
         break;
         case SID_CURSORBLKLEFT_SEL:
             pViewShell->ExpandBlockArea(-nMovX, 0);
@@ -275,6 +288,8 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
             ;
     }
     pViewShell->ShowAllCursors();
+
+    rReq.AppendItem( SfxInt16Item(FN_PARAM_1,static_cast<sal_Int16>(nRepeat)) );
     rReq.Done();
 }
 


More information about the Libreoffice-commits mailing list