wizards/source/sfdocuments/SF_Calc.xba |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ec18e2545c752c2d33e16f23de6b2dfd6a04e0e7
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Sat Nov 27 12:45:34 2021 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Sat Nov 27 14:52:43 2021 +0100

    ScriptForge - (SF_Calc) fix ShiftXXX() methods with negative offset
    
    Example:
       oCalc.ShiftDown("A10:D15", , -1)
    gives an "Objectvariable not set" Basic runtime error.
    
    Fixed by replacing 4x '= 0' by '<= 0' test in If statements checking
    the argument value.
    
    Change-Id: I272112a1addd303b7b38d3d9eb2ef73034e28727
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125939
    Tested-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>

diff --git a/wizards/source/sfdocuments/SF_Calc.xba 
b/wizards/source/sfdocuments/SF_Calc.xba
index 0eca75aa25f3..e5b35e4afa12 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -2548,7 +2548,7 @@ Try:
                &apos;  Manage the height of the area to shift
                &apos;  The insertCells() method inserts a number of rows equal 
to the height of the cell range to shift
                lHeight = .Height
-               If Rows = 0 Then Rows = lHeight
+               If Rows &lt;= 0 Then Rows = lHeight
                If _LastCell(.XSpreadsheet)(1) + Rows &gt; MAXROWS Then GoTo 
Catch
                If Rows &lt;&gt; lHeight Then
                        Set oShiftAddress = _Offset(oSourceAddress, 0, 0, Rows, 
0).XCellRange.RangeAddress
@@ -2630,7 +2630,7 @@ Try:
                &apos;  Manage the width of the area to delete
                &apos;  The removeRange() method erases a number of columns 
equal to the width of the cell range to delete
                lWidth = .Width
-               If Columns = 0 Then Columns = lWidth
+               If Columns &lt;= 0 Then Columns = lWidth
                If Columns &lt; lWidth Then
                        Set oShiftAddress = _Offset(oSourceAddress, 0, 0, 0, 
Columns).XCellRange.RangeAddress
                Else                                            &apos;  Columns 
is capped at the range width
@@ -2710,7 +2710,7 @@ Try:
                &apos;  Manage the width of the area to Shift
                &apos;  The insertCells() method inserts a number of columns 
equal to the width of the cell range to Shift
                lWidth = .Width
-               If Columns = 0 Then Columns = lWidth
+               If Columns &lt;= 0 Then Columns = lWidth
                If _LastCell(.XSpreadsheet)(0) + Columns &gt; MAXCOLS Then GoTo 
Catch
                If Columns &lt;&gt; lWidth Then
                        Set oShiftAddress = _Offset(oSourceAddress, 0, 0, 0, 
Columns).XCellRange.RangeAddress
@@ -2792,7 +2792,7 @@ Try:
                &apos;  Manage the height of the area to delete
                &apos;  The removeRange() method erases a number of rows equal 
to the height of the cell range to delete
                lHeight = .Height
-               If Rows = 0 Then Rows = lHeight
+               If Rows &lt;= 0 Then Rows = lHeight
                If Rows &lt; lHeight Then
                        Set oShiftAddress = _Offset(oSourceAddress, 0, 0, Rows, 
0).XCellRange.RangeAddress
                Else                                            &apos;  Rows is 
capped at the range height

Reply via email to