Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Rewinding... (should have read the wiki on patch submission)

HI

Here is a patch to allow GoUpSel, GoDownSel, GoLeftsel,GoRightSel to receive
"By" property

a test file appended as well. Run Main macro to test patch

I left
SID_CURSORBLKDOWN_SEL
SID_CURSORBLKUP_SEL
SID_CURSORBLKLEFT_SEL
SID_CURSORBLKRIGHT_SEL

untouched because repetitions makes no sense to them  AFAIK (I may have
missed something, otherwise)

License is LGPLV3 + MPL

-- 
Olivier Hallot
Founder and Steering Commitee Member
The Document Foundation

Attachment: teste-cell.ods
Description: application/vnd.oasis.opendocument.spreadsheet

From a3aea98f12d752478713111ccc439deaf0eb0ac9 Mon Sep 17 00:00:00 2001
From: Olivier Hallot <olivier.hallot@documentfoundation.org>
Date: Fri, 29 Jul 2011 06:14:23 -0300
Subject: [PATCH] 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.
---
 sc/source/ui/view/cellsh4.cxx |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index c38a672..cb48842 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -219,8 +219,10 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
 {
     sal_uInt16 nSlotId  = rReq.GetSlot();
     ScTabViewShell* pViewShell = GetViewData()->GetViewShell();
+    const SfxItemSet*   pReqArgs = rReq.GetArgs();
     ScInputHandler* pInputHdl = pViewShell->GetInputHandler();
     pViewShell->HideAllCursors();
+    SCsCOLROW          nRepeat = 1;
     if (pInputHdl && pInputHdl->IsInputMode())
     {
         // the current cell is in edit mode.  Commit the text before moving on.
@@ -232,32 +234,38 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
     if (GetViewData()->GetDocument()->IsLayoutRTL(GetViewData()->GetTabNo()))
         // mirror horizontal movement for right-to-left mode.
         nMovX = -1;
-
+    // get repetition
+      if ( pReqArgs != NULL )
+      {
+          const   SfxPoolItem* pItem;
+          if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
+              nRepeat = static_cast<SCsCOLROW>(((const SfxInt16Item*)pItem)->GetValue());
+      }
     switch (nSlotId)
     {
         case SID_CURSORDOWN_SEL:
-            pViewShell->ExpandBlock(0, 1, SC_FOLLOW_LINE);
+            pViewShell->ExpandBlock(0, nRepeat, SC_FOLLOW_LINE);
         break;
         case SID_CURSORUP_SEL:
-            pViewShell->ExpandBlock(0, -1, SC_FOLLOW_LINE);
+            pViewShell->ExpandBlock(0, -nRepeat, SC_FOLLOW_LINE);
         break;
         case SID_CURSORRIGHT_SEL:
-            pViewShell->ExpandBlock(nMovX, 0, SC_FOLLOW_LINE);
+            pViewShell->ExpandBlock(nMovX * nRepeat, 0, SC_FOLLOW_LINE);
         break;
         case SID_CURSORLEFT_SEL:
-            pViewShell->ExpandBlock(-nMovX, 0, SC_FOLLOW_LINE);
+            pViewShell->ExpandBlock(-nMovX * nRepeat, 0, SC_FOLLOW_LINE);
         break;
         case SID_CURSORPAGEUP_SEL:
-            pViewShell->ExpandBlockPage(0, -1);
+            pViewShell->ExpandBlockPage(0, -nRepeat);
         break;
         case SID_CURSORPAGEDOWN_SEL:
-            pViewShell->ExpandBlockPage(0, 1);
+            pViewShell->ExpandBlockPage(0, nRepeat);
         break;
         case SID_CURSORPAGERIGHT_SEL:
-            pViewShell->ExpandBlockPage(nMovX, 0);
+            pViewShell->ExpandBlockPage(nMovX * nRepeat, 0);
         break;
         case SID_CURSORPAGELEFT_SEL:
-            pViewShell->ExpandBlockPage(-nMovX, 0);
+            pViewShell->ExpandBlockPage(-nMovX * nRepeat, 0);
         break;
         case SID_CURSORBLKDOWN_SEL:
             pViewShell->ExpandBlockArea(0, 1);
@@ -266,7 +274,7 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
             pViewShell->ExpandBlockArea(0, -1);
         break;
         case SID_CURSORBLKRIGHT_SEL:
-            pViewShell->ExpandBlockArea(nMovX, 0);
+            pViewShell->ExpandBlockArea(nMovX , 0);
         break;
         case SID_CURSORBLKLEFT_SEL:
             pViewShell->ExpandBlockArea(-nMovX, 0);
@@ -275,6 +283,8 @@ void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )
             ;
     }
     pViewShell->ShowAllCursors();
+    rReq.AppendItem( SfxInt16Item(FN_PARAM_1,static_cast<sal_Int16>(nRepeat)) );
+    rReq.Done();
 }
 
 void ScCellShell::ExecuteMove( SfxRequest& rReq )
-- 
1.7.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.