wizards/source/scriptforge/python/scriptforge.py | 3 +++ wizards/source/sfdocuments/SF_Calc.xba | 17 +++++++++++++++++ 2 files changed, 20 insertions(+)
New commits: commit a97227aeb451fe579546427e125c5d8219eeb952 Author: Jean-Pierre Ledure <j...@ledure.be> AuthorDate: Wed Oct 27 15:31:29 2021 +0200 Commit: Jean-Pierre Ledure <j...@ledure.be> CommitDate: Thu Oct 28 10:47:52 2021 +0200 ScriptForge - (SF_Calc) new XSheetCellCursor property The XSheetCellCursor property requires one mandatory argument, a range as a string. It returns a UNO object of type com.sun.star.sheet.XSheetCellCursor. Such an object is designed to navigate thru the spreadsheet. After the user script has used one or more navigation verbs (gotoNext(), ...) the resulting range can be got back in the script by using the cursor.AbsoluteName UNO property. The new range can be given as input to further ScriptForge methods. XSheetCellCursor is available both from Basic and Python user scripts. Change-Id: I62fb18a6f496d81b01036aef2ca6733f07632d9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124280 Tested-by: Jean-Pierre Ledure <j...@ledure.be> Reviewed-by: Jean-Pierre Ledure <j...@ledure.be> diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index d162c6ed5781..9972660de0d3 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1903,6 +1903,9 @@ class SFDocuments: def XCellRange(self, rangename): return self.ExecMethod(self.vbGet + self.flgUno, 'XCellRange', rangename) + def XSheetCellCursor(self, rangename): + return self.ExecMethod(self.vbGet + self.flgUno, 'XSheetCellCursor', rangename) + def XSpreadsheet(self, sheetname): return self.ExecMethod(self.vbGet + self.flgUno, 'XSpreadsheet', sheetname) diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 7608fd2f8af9..f8a13f927953 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -263,6 +263,14 @@ Property Get XCellRange(Optional ByVal RangeName As Variant) As Variant XCellRange = _PropertyGet("XCellRange", RangeName) End Property ' SFDocuments.SF_Calc.XCellRange +REM ----------------------------------------------------------------------------- +Property Get XSheetCellCursor(Optional ByVal RangeName As Variant) As Variant +''' Returns a UNO object of type com.sun.star.sheet.XSheetCellCursor +'' After having moved the cursor (gotoNext(), ...) the resulting range can be got +''' back as a string with the cursor.AbsoluteName UNO property. + XSheetCellCursor = _PropertyGet("XSheetCellCursor", RangeName) +End Property ' SFDocuments.SF_Calc.XSheetCellCursor + REM ----------------------------------------------------------------------------- Property Get XSpreadsheet(Optional ByVal SheetName As Variant) As Variant ''' Returns a UNO object of type com.sun.star.sheet.XSpreadsheet @@ -1896,6 +1904,7 @@ Public Function Properties() As Variant , "Width" _ , "XCellRange" _ , "XComponent" _ + , "XSheetCellCursor" _ , "XSpreadsheet" _ ) @@ -3181,6 +3190,14 @@ Const cstSubArgs = "" If Not ScriptForge.SF_Utils._Validate(pvArg, "Range", V_STRING) Then GoTo Finally Set _PropertyGet = _ParseAddress(pvArg).XCellRange End If + Case UCase("XSheetCellCursor") + If IsMissing(pvArg) Or IsEmpty(pvArg) Then + Set _PropertyGet = Nothing + Else + If Not ScriptForge.SF_Utils._Validate(pvArg, "Range", V_STRING) Then GoTo Finally + Set oAddress = _ParseAddress(pvArg) + Set _PropertyGet = oAddress.XSpreadsheet.createCursorByRange(oAddress.XCellRange) + End If Case UCase("XSpreadsheet") If IsMissing(pvArg) Or IsEmpty(pvArg) Then Set _PropertyGet = Nothing