diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2024-09-06 15:26:17 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2024-09-08 14:25:35 +0200 |
commit | 609a6dc2df2492d75bad2a77b24c588a977d408d (patch) | |
tree | 29298a9fda6b651504184fefb60a7eff2b5945e5 /wizards/source/sfdocuments | |
parent | a6a957405e5c9d8639e709916fe7b5bbd472676b (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.xba | 6 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Calc.xba | 6 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Document.xba | 15 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_FormDocument.xba | 6 | ||||
-rw-r--r-- | wizards/source/sfdocuments/SF_Writer.xba | 6 |
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( _ "DocumentType" _ , "FileSystem" _ + , "IsAlive" _ , "IsBase" _ , "IsCalc" _ , "IsDraw " _ @@ -831,6 +832,11 @@ Property Get FileSystem() As String End Property ' SFDocuments.SF_Base.FileSystem REM ----------------------------------------------------------------------------- +Property Get IsAlive() As Boolean + IsAlive = [_Super].GetProperty("IsAlive") +End Property ' SFDocuments.SF_Base.IsAlive + +REM ----------------------------------------------------------------------------- Property Get IsBase() As Boolean IsBase = [_Super].GetProperty("IsBase") End Property ' 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 , "FirstRow" _ , "Height" _ , "ImportFilters" _ + , "IsAlive" _ , "IsBase" _ , "IsCalc" _ , "IsDraw" _ @@ -3632,6 +3633,11 @@ Property Get ImportFilters() As Variant End Property ' SFDocuments.SF_Calc.ImportFilters REM ----------------------------------------------------------------------------- +Property Get IsAlive() As Boolean + IsAlive = [_Super].GetProperty("IsAlive") +End Property ' SFDocuments.SF_Calc.IsAlive + +REM ----------------------------------------------------------------------------- Property Get IsBase() As Boolean IsBase = [_Super].GetProperty("IsBase") End Property ' 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 ' SFDocuments.SF_Document.ImportFilters REM ----------------------------------------------------------------------------- +Property Get IsAlive() As Boolean + IsAlive = _PropertyGet("IsAlive") +End Property ' SFDocuments.SF_Document.IsAlive + +REM ----------------------------------------------------------------------------- Property Get IsBase() As Boolean IsBase = _PropertyGet("IsBase") End Property ' SFDocuments.SF_Document.IsBase @@ -997,6 +1002,7 @@ Public Function Properties() As Variant , "ExportFilters" _ , "FileSystem" _ , "ImportFilters" _ + , "IsAlive" _ , "IsBase" _ , "IsCalc" _ , "IsDraw" _ @@ -2152,11 +2158,14 @@ Const cstSubArgs = "" _PropertyGet = False Select Case _DocumentType - Case "Calc" : cstThisSub = "SFDocuments.SF_" & _DocumentType & ".get" & psProperty + Case "Base", "Calc", "FormDocument", "Writer" + cstThisSub = "SFDocuments.SF_" & _DocumentType & ".get" & psProperty Case Else : cstThisSub = "SFDocuments.SF_Document.get" & psProperty End Select ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) - If Not _IsStillAlive() Then GoTo Finally + If psProperty <> "IsAlive" Then + If Not _IsStillAlive() Then GoTo Finally + End If Select Case psProperty Case "CustomProperties" @@ -2181,6 +2190,8 @@ Const cstSubArgs = "" _PropertyGet = oContent.getIdentifier().ContentIdentifier & "/" Case "ImportFilters" _PropertyGet = _GetFilterNames(False) + Case "IsAlive" + _PropertyGet = _IsStillAlive(False, False) Case "IsBase", "IsCalc", "IsDraw", "IsFormDocument", "IsImpress", "IsMath", "IsWriter" _PropertyGet = ( Mid(psProperty, 3) = _DocumentType ) Case "Keywords" 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( _ "DocumentType" _ , "FileSystem" _ + , "IsAlive" _ , "IsBase" _ , "IsCalc" _ , "IsDraw" _ @@ -445,6 +446,11 @@ Property Get FileSystem() As String End Property ' SFDocuments.SF_FormDocument.FileSystem REM ----------------------------------------------------------------------------- +Property Get IsAlive() As Boolean + IsAlive = [_Super].GetProperty("IsAlive") +End Property ' SFDocuments.SF_FormDocument.IsAlive + +REM ----------------------------------------------------------------------------- Property Get IsBase() As Boolean IsBase = [_Super].GetProperty("IsBase") End Property ' 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 , "FileSystem" _ , "Frames" _ , "ImportFilters" _ + , "IsAlive" _ , "IsBase" _ , "IsCalc" _ , "IsDraw" _ @@ -558,6 +559,11 @@ Property Get ImportFilters() As Variant End Property ' SFDocuments.SF_Writer.ImportFilters REM ----------------------------------------------------------------------------- +Property Get IsAlive() As Boolean + IsAlive = [_Super].GetProperty("IsAlive") +End Property ' SFDocuments.SF_Writer.IsAlive + +REM ----------------------------------------------------------------------------- Property Get IsBase() As Boolean IsBase = [_Super].GetProperty("IsBase") End Property ' SFDocuments.SF_Writer.IsBase |