ScriptForge (SF_Calc new XRectangle property

The
   XReetangle(rangename)
property returns a com.sun.star.awt.Rectangle
structure describing the coordinates (in pixels)
on the screen where the given range is
located.

This opens the door to effective interactivity
in calc sheets with the use of popup menus.

Example:
   r = calc.XRectangle("B2")
   menu = CreateScriptService("PopupMenu", , _
           X := r.X + r.Width/2, Y := r.Y + r.Height/2)
initializes a popup menu centered on the given
cell.

The property exists in Basic and Python.
The SF_Calc help page should be updated
according to the actual patch.

Change-Id: I2a97c5c7b5bf84d36a2aab5e4b822e30c9d53d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180140
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
This commit is contained in:
Jean-Pierre Ledure
2025-01-12 16:15:38 +01:00
parent 52a0fe7371
commit b86e078d79
4 changed files with 77 additions and 4 deletions
@@ -164,6 +164,7 @@ try:
from com.sun.star.sheet import XSheetCellCursor
from com.sun.star.sheet import XSpreadsheet
from com.sun.star.table import XCellRange
from com.sun.star.awt import XRectangle
from com.sun.star.table import XTableChart
from com.sun.star.uno import XComponentContext
from com.sun.star.uno import XInterface
@@ -194,6 +195,7 @@ except ImportError:
XSheetCellCursor = NewType('XSheetCellCursor', UNO)
XSpreadsheet = NewType('XSpreadsheet', UNO)
XCellRange = NewType('XCellRange', UNO)
XRectangle = NewType('XRectangle', UNO)
XTableChart = NewType('XTableChart', UNO)
XComponentContext = NewType('XComponentContext', UNO)
XInterface = NewType('XInterface', UNO)
@@ -5040,6 +5042,10 @@ class SFDocuments:
def XCellRange(self, rangename: RANGE) -> XCellRange:
""" A ``com.sun.star.Table.XCellRange`` UNO object. """
...
def XRectangle(self, rangename: RANGE) -> XRectangle:
""" A ``com.sun.star.awt.XRectangle`` UNO structure describing the area in pixels on the screen
where the range is located. """
...
def XSheetCellCursor(self, rangename: str) -> XSheetCellCursor:
""" A ``com.sun.star.sheet.XSheetCellCursor`` UNO object. """
...