summaryrefslogtreecommitdiff
path: root/wizards/source/sfdocuments
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2024-09-06 15:26:17 +0200
committerJean-Pierre Ledure <jp@ledure.be>2024-09-08 14:25:35 +0200
commit609a6dc2df2492d75bad2a77b24c588a977d408d (patch)
tree29298a9fda6b651504184fefb60a7eff2b5945e5 /wizards/source/sfdocuments
parenta6a957405e5c9d8639e709916fe7b5bbd472676b (diff)
ScriptForge New IsAlive property
When a document is closed inadvertently by the user during a macro run, or between two macros triggered by events, the actual behaviour is an error message and a stop of the execution of the macro. As this can be counter-productive, the macro may test at any moment if everything is ok with the IsAlive As Boolean (True = OK) property applied on next service instances: Document Base Calc FormDocument Writer Datasheet Dialog The functionality is available both for Basic and Python user scripts. The user documentation should be completed accordingly. Change-Id: I0b055dacc06c9da70c611dbb4e7bf841160168fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172970 Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards/source/sfdocuments')
-rw-r--r--wizards/source/sfdocuments/SF_Base.xba6
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba6
-rw-r--r--wizards/source/sfdocuments/SF_Document.xba15
-rw-r--r--wizards/source/sfdocuments/SF_FormDocument.xba6
-rw-r--r--wizards/source/sfdocuments/SF_Writer.xba6
5 files changed, 37 insertions, 2 deletions
diff --git a/wizards/source/sfdocuments/SF_Base.xba b/wizards/source/sfdocuments/SF_Base.xba
index 30713e88b587..5c0feaec5c63 100644
--- a/wizards/source/sfdocuments/SF_Base.xba
+++ b/wizards/source/sfdocuments/SF_Base.xba
@@ -687,6 +687,7 @@ Public Function Properties() As Variant
Properties = Array( _
&quot;DocumentType&quot; _
, &quot;FileSystem&quot; _
+ , &quot;IsAlive&quot; _
, &quot;IsBase&quot; _
, &quot;IsCalc&quot; _
, &quot;IsDraw &quot; _
@@ -831,6 +832,11 @@ Property Get FileSystem() As String
End Property &apos; SFDocuments.SF_Base.FileSystem
REM -----------------------------------------------------------------------------
+Property Get IsAlive() As Boolean
+ IsAlive = [_Super].GetProperty(&quot;IsAlive&quot;)
+End Property &apos; SFDocuments.SF_Base.IsAlive
+
+REM -----------------------------------------------------------------------------
Property Get IsBase() As Boolean
IsBase = [_Super].GetProperty(&quot;IsBase&quot;)
End Property &apos; SFDocuments.SF_Base.IsBase
diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba
index b917b36a85fa..f7d1eebae18c 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -2557,6 +2557,7 @@ Public Function Properties() As Variant
, &quot;FirstRow&quot; _
, &quot;Height&quot; _
, &quot;ImportFilters&quot; _
+ , &quot;IsAlive&quot; _
, &quot;IsBase&quot; _
, &quot;IsCalc&quot; _
, &quot;IsDraw&quot; _
@@ -3632,6 +3633,11 @@ Property Get ImportFilters() As Variant
End Property &apos; SFDocuments.SF_Calc.ImportFilters
REM -----------------------------------------------------------------------------
+Property Get IsAlive() As Boolean
+ IsAlive = [_Super].GetProperty(&quot;IsAlive&quot;)
+End Property &apos; SFDocuments.SF_Calc.IsAlive
+
+REM -----------------------------------------------------------------------------
Property Get IsBase() As Boolean
IsBase = [_Super].GetProperty(&quot;IsBase&quot;)
End Property &apos; SFDocuments.SF_Calc.IsBase
diff --git a/wizards/source/sfdocuments/SF_Document.xba b/wizards/source/sfdocuments/SF_Document.xba
index 2b80dd4cb5d6..d839538879d6 100644
--- a/wizards/source/sfdocuments/SF_Document.xba
+++ b/wizards/source/sfdocuments/SF_Document.xba
@@ -294,6 +294,11 @@ Property Get ImportFilters() As Variant
End Property &apos; SFDocuments.SF_Document.ImportFilters
REM -----------------------------------------------------------------------------
+Property Get IsAlive() As Boolean
+ IsAlive = _PropertyGet(&quot;IsAlive&quot;)
+End Property &apos; SFDocuments.SF_Document.IsAlive
+
+REM -----------------------------------------------------------------------------
Property Get IsBase() As Boolean
IsBase = _PropertyGet(&quot;IsBase&quot;)
End Property &apos; SFDocuments.SF_Document.IsBase
@@ -997,6 +1002,7 @@ Public Function Properties() As Variant
, &quot;ExportFilters&quot; _
, &quot;FileSystem&quot; _
, &quot;ImportFilters&quot; _
+ , &quot;IsAlive&quot; _
, &quot;IsBase&quot; _
, &quot;IsCalc&quot; _
, &quot;IsDraw&quot; _
@@ -2152,11 +2158,14 @@ Const cstSubArgs = &quot;&quot;
_PropertyGet = False
Select Case _DocumentType
- Case &quot;Calc&quot; : cstThisSub = &quot;SFDocuments.SF_&quot; &amp; _DocumentType &amp; &quot;.get&quot; &amp; psProperty
+ Case &quot;Base&quot;, &quot;Calc&quot;, &quot;FormDocument&quot;, &quot;Writer&quot;
+ cstThisSub = &quot;SFDocuments.SF_&quot; &amp; _DocumentType &amp; &quot;.get&quot; &amp; psProperty
Case Else : cstThisSub = &quot;SFDocuments.SF_Document.get&quot; &amp; psProperty
End Select
ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
- If Not _IsStillAlive() Then GoTo Finally
+ If psProperty &lt;&gt; &quot;IsAlive&quot; Then
+ If Not _IsStillAlive() Then GoTo Finally
+ End If
Select Case psProperty
Case &quot;CustomProperties&quot;
@@ -2181,6 +2190,8 @@ Const cstSubArgs = &quot;&quot;
_PropertyGet = oContent.getIdentifier().ContentIdentifier &amp; &quot;/&quot;
Case &quot;ImportFilters&quot;
_PropertyGet = _GetFilterNames(False)
+ Case &quot;IsAlive&quot;
+ _PropertyGet = _IsStillAlive(False, False)
Case &quot;IsBase&quot;, &quot;IsCalc&quot;, &quot;IsDraw&quot;, &quot;IsFormDocument&quot;, &quot;IsImpress&quot;, &quot;IsMath&quot;, &quot;IsWriter&quot;
_PropertyGet = ( Mid(psProperty, 3) = _DocumentType )
Case &quot;Keywords&quot;
diff --git a/wizards/source/sfdocuments/SF_FormDocument.xba b/wizards/source/sfdocuments/SF_FormDocument.xba
index f187bb85441b..6f055ff359ef 100644
--- a/wizards/source/sfdocuments/SF_FormDocument.xba
+++ b/wizards/source/sfdocuments/SF_FormDocument.xba
@@ -423,6 +423,7 @@ Public Function Properties() As Variant
Properties = Array( _
&quot;DocumentType&quot; _
, &quot;FileSystem&quot; _
+ , &quot;IsAlive&quot; _
, &quot;IsBase&quot; _
, &quot;IsCalc&quot; _
, &quot;IsDraw&quot; _
@@ -445,6 +446,11 @@ Property Get FileSystem() As String
End Property &apos; SFDocuments.SF_FormDocument.FileSystem
REM -----------------------------------------------------------------------------
+Property Get IsAlive() As Boolean
+ IsAlive = [_Super].GetProperty(&quot;IsAlive&quot;)
+End Property &apos; SFDocuments.SF_FormDocument.IsAlive
+
+REM -----------------------------------------------------------------------------
Property Get IsBase() As Boolean
IsBase = [_Super].GetProperty(&quot;IsBase&quot;)
End Property &apos; SFDocuments.SF_FormDocument.IsBase
diff --git a/wizards/source/sfdocuments/SF_Writer.xba b/wizards/source/sfdocuments/SF_Writer.xba
index 5be6e37cf06a..38767666300e 100644
--- a/wizards/source/sfdocuments/SF_Writer.xba
+++ b/wizards/source/sfdocuments/SF_Writer.xba
@@ -444,6 +444,7 @@ Public Function Properties() As Variant
, &quot;FileSystem&quot; _
, &quot;Frames&quot; _
, &quot;ImportFilters&quot; _
+ , &quot;IsAlive&quot; _
, &quot;IsBase&quot; _
, &quot;IsCalc&quot; _
, &quot;IsDraw&quot; _
@@ -558,6 +559,11 @@ Property Get ImportFilters() As Variant
End Property &apos; SFDocuments.SF_Writer.ImportFilters
REM -----------------------------------------------------------------------------
+Property Get IsAlive() As Boolean
+ IsAlive = [_Super].GetProperty(&quot;IsAlive&quot;)
+End Property &apos; SFDocuments.SF_Writer.IsAlive
+
+REM -----------------------------------------------------------------------------
Property Get IsBase() As Boolean
IsBase = [_Super].GetProperty(&quot;IsBase&quot;)
End Property &apos; SFDocuments.SF_Writer.IsBase