HI Caolán

I had to add this patch to prevent the table boudaries crash issue that
raised when one use the By property for GoLeftSel and GoRightSel.

The test case is (GoLeftSel)

sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$E$7"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "By"
args2(0).Value = 10

dispatcher.executeDispatch(document, ".uno:GoLeftSel", "", 0, args2())

end sub



2011/7/29 Caolán McNamara <caol...@redhat.com>

> On Fri, 2011-07-29 at 06:30 -0300, Olivier Hallot wrote:
> > Here is a patch to allow GoUpSel, GoDownSel, GoLeftsel,GoRightSel to
> > receive "By" property
>
> Looks good.
>
> > 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 see that the pre-existing ::ExecuteCursor doesn't make a distinction
> for the Block selections, it just repeats them the same as non block. So
> I adjusted your patch to include them as well to be consistent between
> moving, and selecting. (hopefully I haven't cocked this up, Kohei, et.
> al. can double check it for me I guess)
>
> Pushed as calc:2a6f95014f3f8be561b4b67e9274a3cc24e2d08f (to master, so
> not in 3-4 stream), thanks for this.
>
> C.
>
>


-- 
Olivier Hallot
Founder and Steering Commitee Member
The Document Foundation
From 32baedfd2b769a6994768353cbdbbc1de0a262ee Mon Sep 17 00:00:00 2001
From: Olivier Hallot <olivier.hal...@documentfoundation.org>
Date: Wed, 10 Aug 2011 17:54:59 -0300
Subject: [PATCH] Fix boundaries overflow for Go/Up/Down/Left/Right/Sel with "By" property

This patch fixes a crash that occurs in GoLeftSel when the By property
forces a negative column index and GoRightSel forces a column beyond
MAXCOL.

For the sake of consistency I put the same logic on GoDownSel and
GoUpSel, but the crash did no showed up in these cases.
---
 sc/source/ui/view/tabview2.cxx |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index 0ad18a4..00cdaf2 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -93,6 +93,7 @@ void moveCursorByProtRule(
                 if (!isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, bSelectUnlocked))
                     break;
                 ++rCol;
+                if (rCol + 1 > MAXCOL) break;
             }
         }
     }
@@ -106,6 +107,7 @@ void moveCursorByProtRule(
                 if (!isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, bSelectUnlocked))
                     break;
                 --rCol;
+                if (rCol < 1) break;
             }
         }
     }
@@ -119,6 +121,7 @@ void moveCursorByProtRule(
                 if (!isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, bSelectUnlocked))
                     break;
                 ++rRow;
+                if (rRow + 1 > MAXROW) break;
             }
         }
     }
@@ -132,6 +135,7 @@ void moveCursorByProtRule(
                 if (!isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, bSelectUnlocked))
                     break;
                 --rRow;
+                if (rRow < 1) break;
             }
         }
     }
-- 
1.7.3.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to