summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2021-10-27 15:31:29 +0200
committerJean-Pierre Ledure <jp@ledure.be>2021-10-28 10:47:52 +0200
commita97227aeb451fe579546427e125c5d8219eeb952 (patch)
tree2e730dd2ba3d782181e75336296f0891f76c002a /wizards
parent6e18b96188a454bcdd2f2780799c136be75606cd (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>
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py3
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba17
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 &apos; SFDocuments.SF_Calc.XCellRange
REM -----------------------------------------------------------------------------
+Property Get XSheetCellCursor(Optional ByVal RangeName As Variant) As Variant
+&apos;&apos;&apos; Returns a UNO object of type com.sun.star.sheet.XSheetCellCursor
+&apos;&apos; After having moved the cursor (gotoNext(), ...) the resulting range can be got
+&apos;&apos;&apos; back as a string with the cursor.AbsoluteName UNO property.
+ XSheetCellCursor = _PropertyGet(&quot;XSheetCellCursor&quot;, RangeName)
+End Property &apos; SFDocuments.SF_Calc.XSheetCellCursor
+
+REM -----------------------------------------------------------------------------
Property Get XSpreadsheet(Optional ByVal SheetName As Variant) As Variant
&apos;&apos;&apos; Returns a UNO object of type com.sun.star.sheet.XSpreadsheet
XSpreadsheet = _PropertyGet(&quot;XSpreadsheet&quot;, SheetName)
@@ -1896,6 +1904,7 @@ Public Function Properties() As Variant
, &quot;Width&quot; _
, &quot;XCellRange&quot; _
, &quot;XComponent&quot; _
+ , &quot;XSheetCellCursor&quot; _
, &quot;XSpreadsheet&quot; _
)
@@ -3181,6 +3190,14 @@ Const cstSubArgs = &quot;&quot;
If Not ScriptForge.SF_Utils._Validate(pvArg, &quot;Range&quot;, V_STRING) Then GoTo Finally
Set _PropertyGet = _ParseAddress(pvArg).XCellRange
End If
+ Case UCase(&quot;XSheetCellCursor&quot;)
+ If IsMissing(pvArg) Or IsEmpty(pvArg) Then
+ Set _PropertyGet = Nothing
+ Else
+ If Not ScriptForge.SF_Utils._Validate(pvArg, &quot;Range&quot;, V_STRING) Then GoTo Finally
+ Set oAddress = _ParseAddress(pvArg)
+ Set _PropertyGet = oAddress.XSpreadsheet.createCursorByRange(oAddress.XCellRange)
+ End If
Case UCase(&quot;XSpreadsheet&quot;)
If IsMissing(pvArg) Or IsEmpty(pvArg) Then
Set _PropertyGet = Nothing