diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2023-09-02 17:57:24 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2023-09-03 11:00:26 +0200 |
commit | b3278aa41d036a7fd9f3a8ce9aa683397e87e6a8 (patch) | |
tree | a10dfc4d33a969cbdfc5321914bbd228dc0f009d /wizards | |
parent | 3c7a35dd28fbc337a23473873b3dd47392b883ae (diff) |
ScriptForge (SF_Document) new XDocumentSettings property
The XDocumentSettings property returns a
com.sun.star.XXX.DocumentSettings
UNO object.
XXX = sheet, text, drawing or presentation
It gives access to a bunch of UNO internal
properties, specific to the document(s type.
The property is available in Basic and Python
user scripts.
An update of the SF_Document service help
page is required.
Change-Id: I9d6db473c91ac5b1814def9cd100e874aa5490cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156475
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/scriptforge/python/scriptforge.py | 8 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Base.xba | 2 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Calc.xba | 6 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Document.xba | 24 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_FormDocument.xba | 6 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Writer.xba | 6 |
6 files changed, 47 insertions, 5 deletions
diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index b235a791f87d..01da93cf6c28 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -2165,7 +2165,7 @@ class SFDocuments: DocumentType = False, ExportFilters = False, FileSystem = False, ImportFilters = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, IsWriter = False, Keywords = True, Readonly = False, - Subject = True, Title = True, XComponent = False) + Subject = True, Title = True, XComponent = False, XDocumentSettings = False) # Force for each property to get its value from Basic - due to intense interactivity with user forceGetProperty = True @@ -2292,7 +2292,7 @@ class SFDocuments: FileSystem = False, ImportFilters = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, IsWriter = False, Keywords = True, Readonly = False, Sheets = False, Subject = True, - Title = True, XComponent = False) + Title = True, XComponent = False, XDocumentSettings = False) # Force for each property to get its value from Basic - due to intense interactivity with user forceGetProperty = True @@ -2648,7 +2648,7 @@ class SFDocuments: servicesynonyms = ('formdocument', 'sfdocuments.formdocument') serviceproperties = dict(DocumentType = False, FileSystem = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, - IsWriter = False, Readonly = False, XComponent = False) + IsWriter = False, Readonly = False, XComponent = False, XDocumentSettings = False) @classmethod def ReviewServiceArgs(cls, windowname = ''): @@ -2687,7 +2687,7 @@ class SFDocuments: DocumentType = False, ExportFilters = False, FileSystem = False, ImportFilters = False, IsBase = False, IsCalc = False, IsDraw = False, IsFormDocument = False, IsImpress = False, IsMath = False, IsWriter = False, Keywords = True, Readonly = False, - Subject = True, Title = True, XComponent = False) + Subject = True, Title = True, XComponent = False, XDocumentSettings = False) # Force for each property to get its value from Basic - due to intense interactivity with user forceGetProperty = True diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba index 67e4663b0748..f96ddfd22e46 100644 --- a/wizards/source/sfdocuments/SF_Base.xba +++ b/wizards/source/sfdocuments/SF_Base.xba @@ -1125,4 +1125,4 @@ Private Function _Repr() As String End Function ' SFDocuments.SF_Base._Repr REM ============================================ END OF SFDOCUMENTS.SF_BASE -</script:module> +</script:module>
\ No newline at end of file diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index a78762056fb0..941f23834230 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -2579,6 +2579,7 @@ Public Function Properties() As Variant , "Width" _ , "XCellRange" _ , "XComponent" _ + , "XDocumentSettings" _ , "XSheetCellCursor" _ , "XSpreadsheet" _ ) @@ -3704,6 +3705,11 @@ Property Get XComponent() As Variant XComponent = [_Super].GetProperty("XComponent") End Property ' SFDocuments.SF_Calc.XComponent +REM ----------------------------------------------------------------------------- +Property Get XDocumentSettings() As Variant + XDocumentSettings = [_Super].GetProperty("XDocumentSettings") +End Property ' SFDocuments.SF_Calc.XDocumentSettings + REM ========================================================== SUPERCLASS METHODS REM ----------------------------------------------------------------------------- diff --git a/wizards/source/sfdocuments/SF_Document.xba b/wizards/source/sfdocuments/SF_Document.xba index 37cb39fa2010..209834999c3b 100644 --- a/wizards/source/sfdocuments/SF_Document.xba +++ b/wizards/source/sfdocuments/SF_Document.xba @@ -75,6 +75,7 @@ Private _WindowName As String ' Object Name Private _WindowTitle As String ' Only mean to identify new documents Private _WindowFileName As String ' URL of file name Private _DocumentType As String ' Writer, Calc, ... +Private _DocumentSettings As Object ' com.sun.star.XXX.DocumentSettings (XXX = sheet, text, drawing or presentation) ' Properties (work variables - real properties could have been set manually by user) Private _DocumentProperties As Object ' Dictionary of document properties @@ -102,6 +103,7 @@ Private Sub Class_Initialize() _WindowTitle = "" _WindowFileName = "" _DocumentType = "" + Set _DocumentSettings = Nothing Set _DocumentProperties = Nothing Set _CustomProperties = Nothing Set _Toolbars = Nothing @@ -406,6 +408,13 @@ Property Get XComponent() As Variant XComponent = _PropertyGet("XComponent") End Property ' SFDocuments.SF_Document.XComponent +REM ----------------------------------------------------------------------------- +Property Get XDocumentSettings() As Variant +''' Gives access to a bunch of additional properties, specific to the document's type, about the document +''' Returns Nothing or a com.sun.star.XXX.DocumentSettings, XXX = text, sheet, drawing or presentation. + XDocumentSettings = _PropertyGet("XDocumentSettings") +End Property ' SFDocuments.SF_Document.XDocumentSettings + REM ===================================================================== METHODS REM ----------------------------------------------------------------------------- @@ -860,6 +869,7 @@ Public Function Properties() As Variant , "Subject" _ , "Title" _ , "XComponent" _ + , "XDocumentSettings" _ ) End Function ' SFDocuments.SF_Document.Properties @@ -1636,6 +1646,20 @@ Const cstSubArgs = "" _PropertyGet = _Component.DocumentProperties.Title Case "XComponent" Set _PropertyGet = _Component + Case "XDocumentSettings" + With _Component + If IsNull(_DocumentSettings) Then + Select Case _DocumentType + Case "Calc" : Set _DocumentSettings = .createInstance("com.sun.star.sheet.DocumentSettings") + Case "Draw" : Set _DocumentSettings = .createInstance("com.sun.star.drawing.DocumentSettings") + Case "FormDocument", "Writer" + Set _DocumentSettings = .createInstance("com.sun.star.text.DocumentSettings") + Case "Impress" : Set _DocumentSettings = .createInstance("com.sun.star.presentation.DocumentSettings") + Case Else : Set _DocumentSettings = Nothing + End Select + End If + Set _PropertyGet = _DocumentSettings + End With Case Else _PropertyGet = Null End Select diff --git a/wizards/source/sfdocuments/SF_FormDocument.xba b/wizards/source/sfdocuments/SF_FormDocument.xba index 5269cea09c1c..9411d234caaf 100644 --- a/wizards/source/sfdocuments/SF_FormDocument.xba +++ b/wizards/source/sfdocuments/SF_FormDocument.xba @@ -430,6 +430,7 @@ Public Function Properties() As Variant , "IsMath" _ , "Readonly" _ , "XComponent" _ + , "XDocumentSettings" _ ) End Function ' SFDocuments.SF_FormDocument.Properties @@ -481,6 +482,11 @@ Property Get XComponent() As Variant XComponent = [_Super].GetProperty("XComponent") End Property ' SFDocuments.SF_FormDocument.XComponent +REM ----------------------------------------------------------------------------- +Property Get XDocumentSettings() As Variant + XDocumentSettings = [_Super].GetProperty("XDocumentSettings") +End Property ' SFDocuments.SF_FormDocument.XDocumentSettings + REM ========================================================== SUPERCLASS METHODS REM ----------------------------------------------------------------------------- diff --git a/wizards/source/sfdocuments/SF_Writer.xba b/wizards/source/sfdocuments/SF_Writer.xba index bc41e0fef7bc..6a54ca2e3d10 100644 --- a/wizards/source/sfdocuments/SF_Writer.xba +++ b/wizards/source/sfdocuments/SF_Writer.xba @@ -324,6 +324,7 @@ Public Function Properties() As Variant , "Subject" _ , "Title" _ , "XComponent" _ + , "XDocumentSettings" _ ) End Function ' SFDocuments.SF_Writer.Properties @@ -498,6 +499,11 @@ Property Get XComponent() As Variant XComponent = [_Super].GetProperty("XComponent") End Property ' SFDocuments.SF_Writer.XComponent +REM ----------------------------------------------------------------------------- +Property Get XDocumentSettings() As Variant + XDocumentSettings = [_Super].GetProperty("XDocumentSettings") +End Property ' SFDocuments.SF_Writer.XDocumentSettings + REM ========================================================== SUPERCLASS METHODS REM ----------------------------------------------------------------------------- |