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


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 <caolanm@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.hallot@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


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.