diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2021-10-27 15:31:29 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2021-10-28 10:47:52 +0200 |
commit | a97227aeb451fe579546427e125c5d8219eeb952 (patch) | |
tree | 2e730dd2ba3d782181e75336296f0891f76c002a | |
parent | 6e18b96188a454bcdd2f2780799c136be75606cd (diff) |
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 <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
-rw-r--r-- | wizards/source/scriptforge/python/scriptforge.py | 3 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Calc.xba | 17 |
2 files changed, 20 insertions, 0 deletions
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 @@ -264,6 +264,14 @@ Property Get XCellRange(Optional ByVal RangeName As Variant) As Variant 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 XSpreadsheet = _PropertyGet("XSpreadsheet", SheetName) @@ -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 |