summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2023-09-02 17:57:24 +0200
committerJean-Pierre Ledure <jp@ledure.be>2023-09-03 11:00:26 +0200
commitb3278aa41d036a7fd9f3a8ce9aa683397e87e6a8 (patch)
treea10dfc4d33a969cbdfc5321914bbd228dc0f009d /wizards
parent3c7a35dd28fbc337a23473873b3dd47392b883ae (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.py8
-rw-r--r--wizards/source/sfdocuments/SF_Base.xba2
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba6
-rw-r--r--wizards/source/sfdocuments/SF_Document.xba24
-rw-r--r--wizards/source/sfdocuments/SF_FormDocument.xba6
-rw-r--r--wizards/source/sfdocuments/SF_Writer.xba6
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 &apos; 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
, &quot;Width&quot; _
, &quot;XCellRange&quot; _
, &quot;XComponent&quot; _
+ , &quot;XDocumentSettings&quot; _
, &quot;XSheetCellCursor&quot; _
, &quot;XSpreadsheet&quot; _
)
@@ -3704,6 +3705,11 @@ Property Get XComponent() As Variant
XComponent = [_Super].GetProperty(&quot;XComponent&quot;)
End Property &apos; SFDocuments.SF_Calc.XComponent
+REM -----------------------------------------------------------------------------
+Property Get XDocumentSettings() As Variant
+ XDocumentSettings = [_Super].GetProperty(&quot;XDocumentSettings&quot;)
+End Property &apos; 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 &apos; Object Name
Private _WindowTitle As String &apos; Only mean to identify new documents
Private _WindowFileName As String &apos; URL of file name
Private _DocumentType As String &apos; Writer, Calc, ...
+Private _DocumentSettings As Object &apos; com.sun.star.XXX.DocumentSettings (XXX = sheet, text, drawing or presentation)
&apos; Properties (work variables - real properties could have been set manually by user)
Private _DocumentProperties As Object &apos; Dictionary of document properties
@@ -102,6 +103,7 @@ Private Sub Class_Initialize()
_WindowTitle = &quot;&quot;
_WindowFileName = &quot;&quot;
_DocumentType = &quot;&quot;
+ Set _DocumentSettings = Nothing
Set _DocumentProperties = Nothing
Set _CustomProperties = Nothing
Set _Toolbars = Nothing
@@ -406,6 +408,13 @@ Property Get XComponent() As Variant
XComponent = _PropertyGet(&quot;XComponent&quot;)
End Property &apos; SFDocuments.SF_Document.XComponent
+REM -----------------------------------------------------------------------------
+Property Get XDocumentSettings() As Variant
+&apos;&apos;&apos; Gives access to a bunch of additional properties, specific to the document&apos;s type, about the document
+&apos;&apos;&apos; Returns Nothing or a com.sun.star.XXX.DocumentSettings, XXX = text, sheet, drawing or presentation.
+ XDocumentSettings = _PropertyGet(&quot;XDocumentSettings&quot;)
+End Property &apos; SFDocuments.SF_Document.XDocumentSettings
+
REM ===================================================================== METHODS
REM -----------------------------------------------------------------------------
@@ -860,6 +869,7 @@ Public Function Properties() As Variant
, &quot;Subject&quot; _
, &quot;Title&quot; _
, &quot;XComponent&quot; _
+ , &quot;XDocumentSettings&quot; _
)
End Function &apos; SFDocuments.SF_Document.Properties
@@ -1636,6 +1646,20 @@ Const cstSubArgs = &quot;&quot;
_PropertyGet = _Component.DocumentProperties.Title
Case &quot;XComponent&quot;
Set _PropertyGet = _Component
+ Case &quot;XDocumentSettings&quot;
+ With _Component
+ If IsNull(_DocumentSettings) Then
+ Select Case _DocumentType
+ Case &quot;Calc&quot; : Set _DocumentSettings = .createInstance(&quot;com.sun.star.sheet.DocumentSettings&quot;)
+ Case &quot;Draw&quot; : Set _DocumentSettings = .createInstance(&quot;com.sun.star.drawing.DocumentSettings&quot;)
+ Case &quot;FormDocument&quot;, &quot;Writer&quot;
+ Set _DocumentSettings = .createInstance(&quot;com.sun.star.text.DocumentSettings&quot;)
+ Case &quot;Impress&quot; : Set _DocumentSettings = .createInstance(&quot;com.sun.star.presentation.DocumentSettings&quot;)
+ 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
, &quot;IsMath&quot; _
, &quot;Readonly&quot; _
, &quot;XComponent&quot; _
+ , &quot;XDocumentSettings&quot; _
)
End Function &apos; SFDocuments.SF_FormDocument.Properties
@@ -481,6 +482,11 @@ Property Get XComponent() As Variant
XComponent = [_Super].GetProperty(&quot;XComponent&quot;)
End Property &apos; SFDocuments.SF_FormDocument.XComponent
+REM -----------------------------------------------------------------------------
+Property Get XDocumentSettings() As Variant
+ XDocumentSettings = [_Super].GetProperty(&quot;XDocumentSettings&quot;)
+End Property &apos; 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
, &quot;Subject&quot; _
, &quot;Title&quot; _
, &quot;XComponent&quot; _
+ , &quot;XDocumentSettings&quot; _
)
End Function &apos; SFDocuments.SF_Writer.Properties
@@ -498,6 +499,11 @@ Property Get XComponent() As Variant
XComponent = [_Super].GetProperty(&quot;XComponent&quot;)
End Property &apos; SFDocuments.SF_Writer.XComponent
+REM -----------------------------------------------------------------------------
+Property Get XDocumentSettings() As Variant
+ XDocumentSettings = [_Super].GetProperty(&quot;XDocumentSettings&quot;)
+End Property &apos; SFDocuments.SF_Writer.XDocumentSettings
+
REM ========================================================== SUPERCLASS METHODS
REM -----------------------------------------------------------------------------