mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-05-07 07:24:03 +00:00
集成OpenOffice替换为LibreOffice
This commit is contained in:
2549
office-plugin/windows-office/share/basic/ScriptForge/SF_Array.xba
Normal file
2549
office-plugin/windows-office/share/basic/ScriptForge/SF_Array.xba
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
696
office-plugin/windows-office/share/basic/ScriptForge/SF_L10N.xba
Normal file
696
office-plugin/windows-office/share/basic/ScriptForge/SF_L10N.xba
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_Platform" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
|
||||
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
|
||||
REM === Full documentation is available on https://help.libreoffice.org/ ===
|
||||
REM =======================================================================================================================
|
||||
|
||||
Option Compatible
|
||||
Option Explicit
|
||||
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
''' SF_Platform
|
||||
''' ===========
|
||||
''' Singleton class implementing the "ScriptForge.Platform" service
|
||||
''' Implemented as a usual Basic module
|
||||
'''
|
||||
''' A collection of properties about the execution environment:
|
||||
''' - HW platform
|
||||
''' - Operating System
|
||||
''' - current user
|
||||
''' - LibreOffice version
|
||||
'''
|
||||
''' Service invocation example:
|
||||
''' Dim platform As Variant
|
||||
''' platform = CreateScriptService("Platform")
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
REM ================================================================== EXCEPTIONS
|
||||
|
||||
REM ============================================================ MODULE CONSTANTS
|
||||
|
||||
REM ===================================================== CONSTRUCTOR/DESTRUCTOR
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Dispose() As Variant
|
||||
Set Dispose = Nothing
|
||||
End Function ' ScriptForge.SF_Array Explicit destructor
|
||||
|
||||
REM ================================================================== PROPERTIES
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get Architecture() As String
|
||||
''' Returns the actual bit architecture
|
||||
''' Example:
|
||||
''' MsgBox platform.Architecture ' 64bit
|
||||
Architecture = _PropertyGet("Architecture")
|
||||
End Property ' ScriptForge.SF_Platform.Architecture (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get ComputerName() As String
|
||||
''' Returns the computer's network name
|
||||
''' Example:
|
||||
''' MsgBox platform.ComputerName
|
||||
ComputerName = _PropertyGet("ComputerName")
|
||||
End Property ' ScriptForge.SF_Platform.ComputerName (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get CPUCount() As Integer
|
||||
''' Returns the number of Central Processor Units
|
||||
''' Example:
|
||||
''' MsgBox platform.CPUCount ' 4
|
||||
CPUCount = _PropertyGet("CPUCount")
|
||||
End Property ' ScriptForge.SF_Platform.CPUCount (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get CurrentUser() As String
|
||||
''' Returns the name of logged in user
|
||||
''' Example:
|
||||
''' MsgBox platform.CurrentUser
|
||||
CurrentUser = _PropertyGet("CurrentUser")
|
||||
End Property ' ScriptForge.SF_Platform.CurrentUser (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get Machine() As String
|
||||
''' Returns the machine type like 'i386' or 'x86_64'
|
||||
''' Example:
|
||||
''' MsgBox platform.Machine
|
||||
Machine = _PropertyGet("Machine")
|
||||
End Property ' ScriptForge.SF_Platform.Machine (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get ObjectType As String
|
||||
''' Only to enable object representation
|
||||
ObjectType = "SF_Platform"
|
||||
End Property ' ScriptForge.SF_Platform.ObjectType
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get ServiceName As String
|
||||
''' Internal use
|
||||
ServiceName = "ScriptForge.Platform"
|
||||
End Property ' ScriptForge.SF_Platform.ServiceName
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get OfficeVersion() As String
|
||||
''' Returns the office software version in the form 'LibreOffice w.x.y.z (The Document Foundation)'
|
||||
''' Example:
|
||||
''' MsgBox platform.OfficeVersion
|
||||
OfficeVersion = _PropertyGet("OfficeVersion")
|
||||
End Property ' ScriptForge.SF_Platform.OfficeVersion (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get OSName() As String
|
||||
''' Returns the name of the operating system like 'Linux' or 'Windows'
|
||||
''' Example:
|
||||
''' MsgBox platform.OSName
|
||||
OSName = _PropertyGet("OSName")
|
||||
End Property ' ScriptForge.SF_Platform.OSName (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get OSPlatform() As String
|
||||
''' Returns a single string identifying the underlying platform with as much useful and human-readable information as possible
|
||||
''' Example:
|
||||
''' MsgBox platform.OSPlatform ' Linux-4.15.0-117-generic-x86_64-with-Ubuntu-18.04-bionic
|
||||
OSPlatform = _PropertyGet("OSPlatform")
|
||||
End Property ' ScriptForge.SF_Platform.OSPlatform (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get OSRelease() As String
|
||||
''' Returns the operating system's release
|
||||
''' Example:
|
||||
''' MsgBox platform.OSRelease ' 4.15.0-117-generic
|
||||
OSRelease = _PropertyGet("OSRelease")
|
||||
End Property ' ScriptForge.SF_Platform.OSRelease (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get OSVersion() As String
|
||||
''' Returns the name of the operating system build or version
|
||||
''' Example:
|
||||
''' MsgBox platform.OSVersion ' #118-Ubuntu SMP Fri Sep 4 20:02:41 UTC 2020
|
||||
OSVersion = _PropertyGet("OSVersion")
|
||||
End Property ' ScriptForge.SF_Platform.OSVersion (get)
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get Processor() As String
|
||||
''' Returns the (real) processor name, e.g. 'amdk6'. Might return the same value as Machine
|
||||
''' Example:
|
||||
''' MsgBox platform.Processor
|
||||
Processor = _PropertyGet("Processor")
|
||||
End Property ' ScriptForge.SF_Platform.Processor (get)
|
||||
|
||||
REM ===================================================================== METHODS
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
|
||||
''' Return the actual value of the given property
|
||||
''' Args:
|
||||
''' PropertyName: the name of the property as a string
|
||||
''' Returns:
|
||||
''' The actual value of the property
|
||||
''' If the property does not exist, returns Null
|
||||
''' Exceptions:
|
||||
''' ARGUMENTERROR The property does not exist
|
||||
|
||||
Const cstThisSub = "Platform.GetProperty"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
|
||||
GetProperty = Null
|
||||
|
||||
Check:
|
||||
If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
|
||||
If Not SF_Utils._Validate(PropertyName, "PropertyName", V_STRING, Properties()) Then GoTo Catch
|
||||
End If
|
||||
|
||||
Try:
|
||||
GetProperty = _PropertyGet(PropertyName)
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
Catch:
|
||||
GoTo Finally
|
||||
End Function ' ScriptForge.SF_Platform.GetProperty
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Methods() As Variant
|
||||
''' Return the list of public methods of the Model service as an array
|
||||
|
||||
Methods = Array( _
|
||||
)
|
||||
|
||||
End Function ' ScriptForge.SF_Platform.Methods
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Properties() As Variant
|
||||
''' Return the list or properties of the Platform class as an array
|
||||
|
||||
Properties = Array( _
|
||||
"Architecture" _
|
||||
, "ComputerName" _
|
||||
, "CPUCount" _
|
||||
, "CurrentUser" _
|
||||
, "Machine" _
|
||||
, "OfficeVersion" _
|
||||
, "OSName" _
|
||||
, "OSPlatform" _
|
||||
, "OSRelease" _
|
||||
, "OSVersion" _
|
||||
, "Processor" _
|
||||
)
|
||||
|
||||
End Function ' ScriptForge.SF_Platform.Properties
|
||||
|
||||
REM =========================================================== PRIVATE FUNCTIONS
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function _GetProductName() as String
|
||||
''' Returns Office product and version numbers found in configuration registry
|
||||
''' Derived from the Tools library
|
||||
|
||||
Dim oProdNameAccess as Object ' configmgr.RootAccess
|
||||
Dim sProdName as String
|
||||
Dim sVersion as String
|
||||
Dim sVendor As String
|
||||
|
||||
On Local Error GoTo Catch ' Prevent any error
|
||||
_GetProductName = ""
|
||||
|
||||
Try:
|
||||
Set oProdNameAccess = SF_Utils._GetRegistryKeyContent("org.openoffice.Setup/Product")
|
||||
|
||||
sProdName = oProdNameAccess.ooName
|
||||
sVersion = oProdNameAccess.ooSetupVersionAboutBox
|
||||
sVendor = oProdNameAccess.ooVendor
|
||||
|
||||
_GetProductName = sProdName & " " & sVersion & " (" & sVendor & ")"
|
||||
|
||||
Finally:
|
||||
Exit Function
|
||||
Catch:
|
||||
GoTo Finally
|
||||
End Function ' ScriptForge.SF_Platform._GetProductName
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant
|
||||
''' Return the value of the named property
|
||||
''' Args:
|
||||
''' psProperty: the name of the property
|
||||
|
||||
Dim sOSName As String ' Operating system
|
||||
|
||||
Const cstPyHelper = "$" & "_SF_Platform"
|
||||
Dim cstThisSub As String
|
||||
Const cstSubArgs = ""
|
||||
|
||||
cstThisSub = "Platform.get" & psProperty
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Select Case psProperty
|
||||
Case "Architecture", "ComputerName", "CPUCount", "CurrentUser", "Machine" _
|
||||
, "OSPlatform", "OSRelease", "OSVersion", "Processor"
|
||||
With ScriptForge.SF_Session
|
||||
_PropertyGet = .ExecutePythonScript(.SCRIPTISSHARED, _SF_.PythonHelper & cstPyHelper, psProperty)
|
||||
End With
|
||||
Case "OfficeVersion"
|
||||
_PropertyGet = _GetProductName()
|
||||
Case "OSName"
|
||||
' Calc INFO function preferred to Python script to avoid ScriptForge initialization risks when Python is not installed
|
||||
sOSName = _SF_.OSName
|
||||
If sOSName = "" Then
|
||||
sOSName = SF_Session.ExecuteCalcFunction("INFO", "system")
|
||||
Select Case sOSName
|
||||
Case "WNT" : sOSName = "Windows"
|
||||
Case "MACOSX" : sOSName = "macOS"
|
||||
Case "LINUX" : sOSName = "Linux"
|
||||
Case "SOLARIS" : sOSName = "Solaris"
|
||||
Case Else : sOSName = SF_String.Capitalize(sOSName)
|
||||
End Select
|
||||
EndIf
|
||||
_PropertyGet = sOSName
|
||||
Case Else
|
||||
_PropertyGet = Null
|
||||
End Select
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Platform._PropertyGet
|
||||
|
||||
REM ============================================ END OF SCRIPTFORGE.SF_PLATFORM
|
||||
</script:module>
|
||||
822
office-plugin/windows-office/share/basic/ScriptForge/SF_Root.xba
Normal file
822
office-plugin/windows-office/share/basic/ScriptForge/SF_Root.xba
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
2642
office-plugin/windows-office/share/basic/ScriptForge/SF_String.xba
Normal file
2642
office-plugin/windows-office/share/basic/ScriptForge/SF_String.xba
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,463 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_Timer" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
|
||||
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
|
||||
REM === Full documentation is available on https://help.libreoffice.org/ ===
|
||||
REM =======================================================================================================================
|
||||
|
||||
Option Compatible
|
||||
Option ClassModule
|
||||
|
||||
Option Explicit
|
||||
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
''' SF_Timer
|
||||
''' ========
|
||||
''' Class for management of scripts execution performance
|
||||
''' A Timer measures durations. It can be suspended, resumed, restarted
|
||||
''' Duration properties are expressed in seconds with a precision of 3 decimal digits
|
||||
'''
|
||||
''' Service invocation example:
|
||||
''' Dim myTimer As Variant
|
||||
''' myTimer = CreateScriptService("Timer")
|
||||
''' myTimer = CreateScriptService("Timer", True) ' => To start timer immediately
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
REM ================================================================== EXCEPTIONS
|
||||
|
||||
REM ============================================================= PRIVATE MEMBERS
|
||||
|
||||
Private [Me] As Object
|
||||
Private [_Parent] As Object
|
||||
Private ObjectType As String ' Must be "TIMER"
|
||||
Private ServiceName As String
|
||||
Private _TimerStatus As Integer ' inactive, started, suspended or stopped
|
||||
Private _StartTime As Double ' Moment when timer started, restarted
|
||||
Private _EndTime As Double ' Moment when timer stopped
|
||||
Private _SuspendTime As Double ' Moment when timer suspended
|
||||
Private _SuspendDuration As Double ' Duration of suspended status as a difference of times
|
||||
|
||||
REM ============================================================ MODULE CONSTANTS
|
||||
|
||||
Private Const STATUSINACTIVE = 0
|
||||
Private Const STATUSSTARTED = 1
|
||||
Private Const STATUSSUSPENDED = 2
|
||||
Private Const STATUSSTOPPED = 3
|
||||
|
||||
Private Const DSECOND As Double = 1 / (24 * 60 * 60) ' Duration of 1 second as compared to 1.0 = 1 day
|
||||
|
||||
REM ===================================================== CONSTRUCTOR/DESTRUCTOR
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Sub Class_Initialize()
|
||||
Set [Me] = Nothing
|
||||
Set [_Parent] = Nothing
|
||||
ObjectType = "TIMER"
|
||||
ServiceName = "ScriptForge.Timer"
|
||||
_TimerStatus = STATUSINACTIVE
|
||||
_StartTime = 0
|
||||
_EndTime = 0
|
||||
_SuspendTime = 0
|
||||
_SuspendDuration = 0
|
||||
End Sub ' ScriptForge.SF_Timer Constructor
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Sub Class_Terminate()
|
||||
Call Class_Initialize()
|
||||
End Sub ' ScriptForge.SF_Timer Destructor
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Dispose() As Variant
|
||||
Call Class_Terminate()
|
||||
Set Dispose = Nothing
|
||||
End Function ' ScriptForge.SF_Timer Explicit destructor
|
||||
|
||||
REM ================================================================== PROPERTIES
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Duration() As Double
|
||||
''' Returns the actual (out of suspensions) time elapsed since start or between start and stop
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' A Double expressing the duration in seconds
|
||||
''' Example:
|
||||
''' myTimer.Duration returns 1.234 (1 sec, 234 ms)
|
||||
|
||||
Duration = _PropertyGet("Duration")
|
||||
|
||||
End Function ' ScriptForge.SF_Timer.Duration
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get IsStarted() As Boolean
|
||||
''' Returns True if timer is started or suspended
|
||||
''' Example:
|
||||
''' myTimer.IsStarted
|
||||
|
||||
IsStarted = _PropertyGet("IsStarted")
|
||||
|
||||
End Property ' ScriptForge.SF_Timer.IsStarted
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get IsSuspended() As Boolean
|
||||
''' Returns True if timer is started and suspended
|
||||
''' Example:
|
||||
''' myTimer.IsSuspended
|
||||
|
||||
IsSuspended = _PropertyGet("IsSuspended")
|
||||
|
||||
End Property ' ScriptForge.SF_Timer.IsSuspended
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function SuspendDuration() As Double
|
||||
''' Returns the actual time elapsed while suspended since start or between start and stop
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' A Double expressing the duration in seconds
|
||||
''' Example:
|
||||
''' myTimer.SuspendDuration returns 1.234 (1 sec, 234 ms)
|
||||
|
||||
SuspendDuration = _PropertyGet("SuspendDuration")
|
||||
|
||||
End Function ' ScriptForge.SF_Timer.SuspendDuration
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function TotalDuration() As Double
|
||||
''' Returns the actual time elapsed (including suspensions) since start or between start and stop
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' A Double expressing the duration in seconds
|
||||
''' Example:
|
||||
''' myTimer.TotalDuration returns 1.234 (1 sec, 234 ms)
|
||||
|
||||
TotalDuration = _PropertyGet("TotalDuration")
|
||||
|
||||
End Function ' ScriptForge.SF_Timer.TotalDuration
|
||||
|
||||
REM ===================================================================== METHODS
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Continue() As Boolean
|
||||
''' Halt suspension of a running timer
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' True if successful, False if the timer is not suspended
|
||||
''' Examples:
|
||||
''' myTimer.Continue()
|
||||
|
||||
Const cstThisSub = "Timer.Continue"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
Check:
|
||||
Continue = False
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Try:
|
||||
If _TimerStatus = STATUSSUSPENDED Then
|
||||
_TimerStatus = STATUSSTARTED
|
||||
_SuspendDuration = _SuspendDuration + _Now() - _SuspendTime
|
||||
_SuspendTime = 0
|
||||
Continue = True
|
||||
End If
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Timer.Continue
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
|
||||
''' Return the actual value of the given property
|
||||
''' Args:
|
||||
''' PropertyName: the name of the property as a string
|
||||
''' Returns:
|
||||
''' The actual value of the property
|
||||
''' Exceptions
|
||||
''' ARGUMENTERROR The property does not exist
|
||||
''' Examples:
|
||||
''' myTimer.GetProperty("Duration")
|
||||
|
||||
Const cstThisSub = "Timer.GetProperty"
|
||||
Const cstSubArgs = "PropertyName"
|
||||
|
||||
If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
|
||||
GetProperty = Null
|
||||
|
||||
Check:
|
||||
If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
|
||||
If Not SF_Utils._Validate(PropertyName, "PropertyName", V_STRING, Properties()) Then GoTo Catch
|
||||
End If
|
||||
|
||||
Try:
|
||||
GetProperty = _PropertyGet(PropertyName)
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
Catch:
|
||||
GoTo Finally
|
||||
End Function ' ScriptForge.SF_Timer.Properties
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Methods() As Variant
|
||||
''' Return the list or methods of the Timer class as an array
|
||||
|
||||
Methods = Array( _
|
||||
"Continue" _
|
||||
, "Restart" _
|
||||
, "Start" _
|
||||
, "Suspend" _
|
||||
, "Terminate" _
|
||||
)
|
||||
|
||||
End Function ' ScriptForge.SF_Timer.Methods
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Properties() As Variant
|
||||
''' Return the list or properties of the Timer class as an array
|
||||
|
||||
Properties = Array( _
|
||||
"Duration" _
|
||||
, "IsStarted" _
|
||||
, "IsSuspended" _
|
||||
, "SuspendDuration" _
|
||||
, "TotalDuration" _
|
||||
)
|
||||
|
||||
End Function ' ScriptForge.SF_Timer.Properties
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Restart() As Boolean
|
||||
''' Terminate the timer and restart a new clean timer
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' True if successful, False if the timer is inactive
|
||||
''' Examples:
|
||||
''' myTimer.Restart()
|
||||
|
||||
Const cstThisSub = "Timer.Restart"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
Check:
|
||||
Restart = False
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Try:
|
||||
If _TimerStatus <> STATUSINACTIVE Then
|
||||
If _TimerStatus <> STATUSSTOPPED Then Terminate()
|
||||
Start()
|
||||
Restart = True
|
||||
End If
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Timer.Restart
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function SetProperty(Optional ByVal PropertyName As Variant _
|
||||
, Optional ByRef Value As Variant _
|
||||
) As Boolean
|
||||
''' Set a new value to the given property
|
||||
''' Args:
|
||||
''' PropertyName: the name of the property as a string
|
||||
''' Value: its new value
|
||||
''' Exceptions
|
||||
''' ARGUMENTERROR The property does not exist
|
||||
|
||||
Const cstThisSub = "Timer.SetProperty"
|
||||
Const cstSubArgs = "PropertyName, Value"
|
||||
|
||||
If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
|
||||
SetProperty = False
|
||||
|
||||
Check:
|
||||
If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
|
||||
If Not SF_Utils._Validate(PropertyName, "PropertyName", V_STRING, Properties()) Then GoTo Catch
|
||||
End If
|
||||
|
||||
Try:
|
||||
Select Case UCase(PropertyName)
|
||||
Case Else
|
||||
End Select
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
Catch:
|
||||
GoTo Finally
|
||||
End Function ' ScriptForge.SF_Timer.SetProperty
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Start() As Boolean
|
||||
''' Start a new clean timer
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' True if successful, False if the timer is already started
|
||||
''' Examples:
|
||||
''' myTimer.Start()
|
||||
|
||||
Const cstThisSub = "Timer.Start"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
Check:
|
||||
Start = False
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Try:
|
||||
If _TimerStatus = STATUSINACTIVE Or _TimerStatus = STATUSSTOPPED Then
|
||||
_TimerStatus = STATUSSTARTED
|
||||
_StartTime = _Now()
|
||||
_EndTime = 0
|
||||
_SuspendTime = 0
|
||||
_SuspendDuration = 0
|
||||
Start = True
|
||||
End If
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Timer.Start
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Suspend() As Boolean
|
||||
''' Suspend a running timer
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' True if successful, False if the timer is not started or already suspended
|
||||
''' Examples:
|
||||
''' myTimer.Suspend()
|
||||
|
||||
Const cstThisSub = "Timer.Suspend"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
Check:
|
||||
Suspend = False
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Try:
|
||||
If _TimerStatus = STATUSSTARTED Then
|
||||
_TimerStatus = STATUSSUSPENDED
|
||||
_SuspendTime = _Now()
|
||||
Suspend = True
|
||||
End If
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Timer.Suspend
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Terminate() As Boolean
|
||||
''' Terminate a running timer
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' True if successful, False if the timer is neither started nor suspended
|
||||
''' Examples:
|
||||
''' myTimer.Terminate()
|
||||
|
||||
Const cstThisSub = "Timer.Terminate"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
Check:
|
||||
Terminate = False
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Try:
|
||||
If _TimerStatus = STATUSSTARTED Or _TimerStatus = STATUSSUSPENDED Then
|
||||
If _TimerSTatus = STATUSSUSPENDED Then Continue()
|
||||
_TimerStatus = STATUSSTOPPED
|
||||
_EndTime = _Now()
|
||||
Terminate = True
|
||||
End If
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Timer.Terminate
|
||||
|
||||
REM =========================================================== PRIVATE FUNCTIONS
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Function _Now() As Double
|
||||
''' Returns the current date and time
|
||||
''' Uses the Calc NOW() function to get a higher precision than the usual Basic Now() function
|
||||
''' Args:
|
||||
''' Returns:
|
||||
''' The actual time as a number
|
||||
''' The integer part represents the date, the decimal part represents the time
|
||||
|
||||
_Now = SF_Session.ExecuteCalcFunction("NOW")
|
||||
|
||||
End Function ' ScriptForge.SF_Timer._Now
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Function _PropertyGet(Optional ByVal psProperty As String)
|
||||
''' Return the named property
|
||||
''' Args:
|
||||
''' psProperty: the name of the property
|
||||
|
||||
Dim dDuration As Double ' Computed duration
|
||||
Dim cstThisSub As String
|
||||
Dim cstSubArgs As String
|
||||
|
||||
cstThisSub = "Timer.get" & psProperty
|
||||
cstSubArgs = ""
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Select Case UCase(psProperty)
|
||||
Case UCase("Duration")
|
||||
Select Case _TimerStatus
|
||||
Case STATUSINACTIVE : dDuration = 0.0
|
||||
Case STATUSSTARTED
|
||||
dDuration = _Now() - _StartTime - _SuspendDuration
|
||||
Case STATUSSUSPENDED
|
||||
dDuration = _SuspendTime - _StartTime - _SuspendDuration
|
||||
Case STATUSSTOPPED
|
||||
dDuration = _EndTime - _StartTime - _SuspendDuration
|
||||
End Select
|
||||
_PropertyGet = Fix(dDuration * 1000 / DSECOND) / 1000
|
||||
Case UCase("IsStarted")
|
||||
_PropertyGet = ( _TimerStatus = STATUSSTARTED Or _TimerStatus = STATUSSUSPENDED )
|
||||
Case UCase("IsSuspended")
|
||||
_PropertyGet = ( _TimerStatus = STATUSSUSPENDED )
|
||||
Case UCase("SuspendDuration")
|
||||
Select Case _TimerStatus
|
||||
Case STATUSINACTIVE : dDuration = 0.0
|
||||
Case STATUSSTARTED, STATUSSTOPPED
|
||||
dDuration = _SuspendDuration
|
||||
Case STATUSSUSPENDED
|
||||
dDuration = _Now() - _SuspendTime + _SuspendDuration
|
||||
End Select
|
||||
_PropertyGet = Fix(dDuration * 1000 / DSECOND) / 1000
|
||||
Case UCase("TotalDuration")
|
||||
Select Case _TimerStatus
|
||||
Case STATUSINACTIVE : dDuration = 0.0
|
||||
Case STATUSSTARTED, STATUSSUSPENDED
|
||||
dDuration = _Now() - _StartTime
|
||||
Case STATUSSTOPPED
|
||||
dDuration = _EndTime - _StartTime
|
||||
End Select
|
||||
_PropertyGet = Fix(dDuration * 1000 / DSECOND) / 1000
|
||||
End Select
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Timer._PropertyGet
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Function _Repr() As String
|
||||
''' Convert the Timer instance to a readable string, typically for debugging purposes (DebugPrint ...)
|
||||
''' Args:
|
||||
''' Return:
|
||||
''' "[Timer] Duration:xxx.yyy
|
||||
|
||||
Const cstTimer = "[Timer] Duration: "
|
||||
Const cstMaxLength = 50 ' Maximum length for items
|
||||
|
||||
_Repr = cstTimer & Replace(SF_Utils._Repr(Duration), ".", """")
|
||||
|
||||
End Function ' ScriptForge.SF_Timer._Repr
|
||||
|
||||
REM ============================================ END OF SCRIPTFORGE.SF_TIMER
|
||||
</script:module>
|
||||
1175
office-plugin/windows-office/share/basic/ScriptForge/SF_UI.xba
Normal file
1175
office-plugin/windows-office/share/basic/ScriptForge/SF_UI.xba
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="_CodingConventions" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
|
||||
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
|
||||
REM === Full documentation is available on https://help.libreoffice.org/ ===
|
||||
REM =======================================================================================================================
|
||||
|
||||
'''
|
||||
' Conventions used in the coding of the *ScriptForge* library
|
||||
' -----------------------------------------------------------
|
||||
'''
|
||||
' Library and Modules
|
||||
' ===================
|
||||
' * Module names are all prefixed with "SF_".
|
||||
' * The *Option Explicit* statement is mandatory in every module.
|
||||
' * The *Option Private Module* statement is recommended in internal modules.
|
||||
' * A standard header presenting the module/class is mandatory
|
||||
' * An end of file (eof) comment line is mandatory
|
||||
' * Every module lists the constants that are related to it and documented as return values, arguments, etc.
|
||||
' They are defined as *Global Const*.
|
||||
' The scope of global constants being limited to one single library, their invocation from user scripts shall be qualified.
|
||||
' * The Basic reserved words are *Proper-Cased*.
|
||||
'''
|
||||
' Functions and Subroutines
|
||||
' =========================
|
||||
' * LibreOffice ignores the Private/Public attribute in Functions or Subs declarations.
|
||||
' Nevertheless the attribute must be present.
|
||||
' Rules to recognize their scope are:
|
||||
' * Public + name starts with a letter
|
||||
' The Sub/Function belongs to the official ScriptForge API.
|
||||
' As such it may be called from any user script.
|
||||
' * Public + name starts with an underscore "_"
|
||||
' The Sub/Function may be called only from within the ScriptForge library.
|
||||
' As such it MUST NOT be called from another library or from a user script,
|
||||
' as there is no guarantee about the arguments, the semantic or even the existence of that piece of code in a later release.
|
||||
' * Private - The Sub/Function name must start with an underscore "_".
|
||||
' The Sub/Function may be called only from the module in which it is located.
|
||||
' * Functions and Subroutines belonging to the API (= "standard" functions/Subs) are defined in their module in alphabetical order.
|
||||
' For class modules, all the properties precede the methods which precede the events.
|
||||
' * Functions and Subroutines not belonging to the API are defined in their module in alphabetical order below the standard ones.
|
||||
' * The return value of a function is always declared explicitly.
|
||||
' * The parameters are always declared explicitly even if they're variants.
|
||||
' * The Function and Sub declarations start at the 1st column of the line.
|
||||
' * The End Function/Sub statement is followed by a comment reminding the name of the containing library.module and of the function or sub.
|
||||
' If the Function/Sub is declared for the first time or modified in a release > initial public release, the actual release number is mentioned as well.
|
||||
'''
|
||||
' Variable declarations
|
||||
' =====================
|
||||
' * Variable names use only alpha characters, the underscore and digits (no accented characters).
|
||||
' Exceptionally, names of private variables may be embraced with `[` and `]` if `Option Compatible` is present.
|
||||
' * The Global, Dim and Const statements always start in the first column of the line.
|
||||
' * The type (*Dim ... As ...*, *Function ... As ...*) is always declared explicitly, even if the type is Variant.
|
||||
' * Variables are *Proper-Cased*. They are always preceded by a lower-case letter indicating their type.
|
||||
' With next exception: variables i, j, k, l, m and n must be declared as integers or longs.
|
||||
' > b Boolean
|
||||
' > d Date
|
||||
' > v Variant
|
||||
' > o Object
|
||||
' > i Integer
|
||||
' > l Long
|
||||
' > s String
|
||||
' Example:
|
||||
' Dim sValue As String
|
||||
' * Parameters are preceded by the letter *p* which itself precedes the single *typing letter*.
|
||||
' In official methods, to match their published documentation, the *p* and the *typing letter* may be omitted. Like in:
|
||||
' Private Function MyFunction(psValue As String) As Variant
|
||||
' Public Function MyOfficialFunction(Value As String) As Variant
|
||||
' * Global variables in the ScriptForge library are ALL preceded by an underscore "_" as NONE of them should be invoked from outside the library.
|
||||
' * Constant values with a local scope are *Proper-Cased* and preceded by the letters *cst*.
|
||||
' * Constants with a global scope are *UPPER-CASED*.
|
||||
' Example:
|
||||
' Global Const ACONSTANT = "This is a global constant"
|
||||
' Function MyFunction(pocControl As Object, piValue) As Variant
|
||||
' Dim iValue As Integer
|
||||
' Const cstMyConstant = 3
|
||||
'''
|
||||
' Indentation
|
||||
' ===========
|
||||
' Code shall be indented with TAB characters.
|
||||
'''
|
||||
' Goto/Gosub
|
||||
' ==========
|
||||
' The *GoSub* … *Return* statement is forbidden.
|
||||
' The *GoTo* statement is forbidden.
|
||||
' However *GoTo* is highly recommended for *error* and *exception* handling.
|
||||
'''
|
||||
' Comments (english only)
|
||||
' ========
|
||||
' * Every public routine should be documented with a python-like "docstring":
|
||||
' 1. Role of Sub/Function
|
||||
' 2. List of arguments, mandatory/optional, role
|
||||
' 3. Returned value(s) type and meaning
|
||||
' 4. Examples when useful
|
||||
' 5. Eventual specific exception codes
|
||||
' * The "docstring" comments shall be marked by a triple (single) quote character at the beginning of the line
|
||||
' * Meaningful variables shall be declared one per line. Comment on same line.
|
||||
' * Comments about a code block should be left indented.
|
||||
' If it concerns only the next line, no indent required (may also be put at the end of the line).
|
||||
'''
|
||||
</script:module>
|
||||
@@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="_ModuleModel" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
|
||||
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
|
||||
REM === Full documentation is available on https://help.libreoffice.org/ ===
|
||||
REM =======================================================================================================================
|
||||
|
||||
Option Compatible
|
||||
Option ClassModule
|
||||
'Option Private Module
|
||||
|
||||
Option Explicit
|
||||
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
''' ModuleModel (aka SF_Model)
|
||||
''' ===========
|
||||
''' Illustration of how the ScriptForge modules are structured
|
||||
''' Copy and paste this code in an empty Basic module to start a new service
|
||||
''' Comment in, comment out, erase what you want, but at the end respect the overall structure
|
||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||
|
||||
REM ================================================================== EXCEPTIONS
|
||||
|
||||
''' FAKENEWSERROR
|
||||
|
||||
REM ============================================================= PRIVATE MEMBERS
|
||||
|
||||
Private [Me] As Object ' Should be initialized immediately after the New statement
|
||||
' Dim obj As Object : Set obj = New SF_Model
|
||||
' Set obj.[Me] = obj
|
||||
Private [_Parent] As Object ' To keep trace of the instance having created a sub-instance
|
||||
' Set obj._Parent = [Me]
|
||||
Private ObjectType As String ' Must be UNIQUE
|
||||
|
||||
REM ============================================================ MODULE CONSTANTS
|
||||
|
||||
Private Const SOMECONSTANT = 1
|
||||
|
||||
REM ====================================================== CONSTRUCTOR/DESTRUCTOR
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Sub Class_Initialize()
|
||||
Set [Me] = Nothing
|
||||
Set [_Parent] = Nothing
|
||||
ObjectType = "MODEL"
|
||||
End Sub ' ScriptForge.SF_Model Constructor
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Sub Class_Terminate()
|
||||
Call Class_Initialize()
|
||||
End Sub ' ScriptForge.SF_Model Destructor
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Dispose() As Variant
|
||||
Call Class_Terminate()
|
||||
Set Dispose = Nothing
|
||||
End Function ' ScriptForge.SF_Model Explicit Destructor
|
||||
|
||||
REM ================================================================== PROPERTIES
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Property Get MyProperty() As Boolean
|
||||
''' Returns True or False
|
||||
''' Example:
|
||||
''' myModel.MyProperty
|
||||
|
||||
MyProperty = _PropertyGet("MyProperty")
|
||||
|
||||
End Property ' ScriptForge.SF_Model.MyProperty
|
||||
|
||||
REM ===================================================================== METHODS
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
|
||||
''' Return the actual value of the given property
|
||||
''' Args:
|
||||
''' PropertyName: the name of the property as a string
|
||||
''' Returns:
|
||||
''' The actual value of the property
|
||||
''' If the property does not exist, returns Null
|
||||
''' Exceptions:
|
||||
''' see the exceptions of the individual properties
|
||||
''' Examples:
|
||||
''' myModel.GetProperty("MyProperty")
|
||||
|
||||
Const cstThisSub = "Model.GetProperty"
|
||||
Const cstSubArgs = ""
|
||||
|
||||
If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
|
||||
GetProperty = Null
|
||||
|
||||
Check:
|
||||
If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
|
||||
If Not SF_Utils._Validate(PropertyName, "PropertyName", V_STRING, Properties()) Then GoTo Catch
|
||||
End If
|
||||
|
||||
Try:
|
||||
GetProperty = _PropertyGet(PropertyName)
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
Catch:
|
||||
GoTo Finally
|
||||
End Function ' ScriptForge.SF_Model.GetProperty
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Methods() As Variant
|
||||
''' Return the list of public methods of the Model service as an array
|
||||
|
||||
Methods = Array( _
|
||||
"MyFunction" _
|
||||
, "etc" _
|
||||
)
|
||||
|
||||
End Function ' ScriptForge.SF_Model.Methods
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function MyFunction(Optional ByVal Arg1 As Variant _
|
||||
, Optional ByVal Arg2 As Variant _
|
||||
) As Variant
|
||||
''' Fictive function that concatenates Arg1 Arg2 times
|
||||
''' Args:
|
||||
''' Arg1 String Text
|
||||
''' Arg2 Numeric Number of times (default = 2)
|
||||
''' Returns:
|
||||
''' The new string
|
||||
''' Exceptions:
|
||||
''' FAKENEWSERROR
|
||||
''' Examples:
|
||||
''' MyFunction("value1") returns "value1value1"
|
||||
|
||||
Dim sOutput As String ' Output buffer
|
||||
Dim i As Integer
|
||||
Const cstThisSub = "Model.myFunction"
|
||||
Const cstSubArgs = "Arg1, [Arg2=2]"
|
||||
|
||||
' _ErrorHandling returns False when, for debugging, the standard error handling is preferred
|
||||
If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
|
||||
myFunction = ""
|
||||
|
||||
Check:
|
||||
If IsMissing(Arg2) Then Arg2 = 2
|
||||
' _EnterFunction returns True when current method is invoked from a user script
|
||||
If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
|
||||
' Check Arg1 is a string and Arg2 is a number.
|
||||
' Validation rules for scalars and arrays are described in SF_Utils
|
||||
If Not SF_Utils._Validate(Arg1, "Arg1", V_STRING) Then GoTo Finally
|
||||
If Not SF_Utils._Validate(Arg2, "Arg2", V_NUMERIC) Then GoTo Finally
|
||||
' Fatal error ?
|
||||
If Arg2 < 0 Then GoTo CatchFake
|
||||
End If
|
||||
|
||||
Try:
|
||||
sOutput = ""
|
||||
For i = 0 To Arg2
|
||||
sOutput = sOutput & Arg1
|
||||
Next i
|
||||
myFunction = sOutput
|
||||
|
||||
Finally:
|
||||
' _ExitFunction manages internal (On Local) errors
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
Catch:
|
||||
GoTo Finally
|
||||
CatchFake:
|
||||
SF_Exception.RaiseFatal("FAKENEWSERROR", cstThisSub)
|
||||
GoTo Finally
|
||||
End Function ' ScriptForge.SF_Model.myFunction
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Public Function Properties() As Variant
|
||||
''' Return the list or properties of the Model class as an array
|
||||
|
||||
Properties = Array( _
|
||||
"MyProperty" _
|
||||
, "etc" _
|
||||
)
|
||||
|
||||
End Function ' ScriptForge.SF_Model.Properties
|
||||
|
||||
REM =========================================================== PRIVATE FUNCTIONS
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant
|
||||
''' Return the value of the named property
|
||||
''' Args:
|
||||
''' psProperty: the name of the property
|
||||
|
||||
Dim cstThisSub As String
|
||||
Const cstSubArgs = ""
|
||||
|
||||
cstThisSub = "SF_Model.get" & psProperty
|
||||
SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
|
||||
|
||||
Select Case psProperty
|
||||
Case "MyProperty"
|
||||
_PropertyGet = TBD
|
||||
Case Else
|
||||
_PropertyGet = Null
|
||||
End Select
|
||||
|
||||
Finally:
|
||||
SF_Utils._ExitFunction(cstThisSub)
|
||||
Exit Function
|
||||
End Function ' ScriptForge.SF_Model._PropertyGet
|
||||
|
||||
REM -----------------------------------------------------------------------------
|
||||
Private Function _Repr() As String
|
||||
''' Convert the Model instance to a readable string, typically for debugging purposes (DebugPrint ...)
|
||||
''' Args:
|
||||
''' Return:
|
||||
''' "[MODEL]: A readable string"
|
||||
|
||||
_Repr = "[MODEL]: A readable string"
|
||||
|
||||
End Function ' ScriptForge.SF_Model._Repr
|
||||
|
||||
REM ============================================ END OF SCRIPTFORGE.SF_MODEL
|
||||
</script:module>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="__License" script:language="StarBasic" script:moduleType="normal">
|
||||
''' Copyright 2019-2020 Jean-Pierre LEDURE, Jean-François NIFENECKER, Alain ROMEDENNE
|
||||
|
||||
REM =======================================================================================================================
|
||||
REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. ===
|
||||
REM === Full documentation is available on https://help.libreoffice.org/ ===
|
||||
REM =======================================================================================================================
|
||||
|
||||
''' ScriptForge is distributed in the hope that it will be useful,
|
||||
''' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
''' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
''' ScriptForge is free software; you can redistribute it and/or modify it under the terms of either (at your option):
|
||||
|
||||
''' 1) The Mozilla Public License, v. 2.0. If a copy of the MPL was not
|
||||
''' distributed with this file, you can obtain one at http://mozilla.org/MPL/2.0/ .
|
||||
|
||||
''' 2) The GNU Lesser General Public License as published by
|
||||
''' the Free Software Foundation, either version 3 of the License, or
|
||||
''' (at your option) any later version. If a copy of the LGPL was not
|
||||
''' distributed with this file, see http://www.gnu.org/licenses/ .
|
||||
|
||||
</script:module>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
||||
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ScriptForge" library:readonly="false" library:passwordprotected="false">
|
||||
<library:element library:name="dlgConsole"/>
|
||||
<library:element library:name="dlgProgress"/>
|
||||
</library:library>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="dlgConsole" dlg:left="114" dlg:top="32" dlg:width="321" dlg:height="239" dlg:closeable="true" dlg:moveable="true" dlg:title="ScriptForge">
|
||||
<dlg:styles>
|
||||
<dlg:style dlg:style-id="0" dlg:font-name="Courier New" dlg:font-stylename="Regular" dlg:font-family="modern"/>
|
||||
</dlg:styles>
|
||||
<dlg:bulletinboard>
|
||||
<dlg:textfield dlg:style-id="0" dlg:id="ConsoleLines" dlg:tab-index="0" dlg:left="4" dlg:top="2" dlg:width="312" dlg:height="225" dlg:hscroll="true" dlg:vscroll="true" dlg:multiline="true" dlg:readonly="true"/>
|
||||
<dlg:button dlg:id="CloseNonModalButton" dlg:tab-index="2" dlg:left="265" dlg:top="228" dlg:width="50" dlg:height="10" dlg:default="true" dlg:value="Close">
|
||||
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ScriptForge.SF_Exception._CloseConsole?language=Basic&location=application" script:language="Script"/>
|
||||
</dlg:button>
|
||||
<dlg:button dlg:id="CloseModalButton" dlg:tab-index="1" dlg:left="265" dlg:top="228" dlg:width="50" dlg:height="10" dlg:default="true" dlg:value="Close" dlg:button-type="ok"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="dlgProgress" dlg:left="180" dlg:top="90" dlg:width="275" dlg:height="37" dlg:closeable="true" dlg:moveable="true">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:text dlg:id="ProgressText" dlg:tab-index="1" dlg:left="16" dlg:top="7" dlg:width="245" dlg:height="8" dlg:value="ProgressText" dlg:tabstop="true"/>
|
||||
<dlg:progressmeter dlg:id="ProgressBar" dlg:tab-index="0" dlg:left="16" dlg:top="18" dlg:width="190" dlg:height="10" dlg:value="50"/>
|
||||
<dlg:button dlg:id="CloseButton" dlg:tab-index="2" dlg:left="210" dlg:top="18" dlg:width="50" dlg:height="10" dlg:value="Close">
|
||||
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ScriptForge.SF_UI._CloseProgressBar?language=Basic&location=application" script:language="Script"/>
|
||||
</dlg:button>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
||||
File diff suppressed because it is too large
Load Diff
801
office-plugin/windows-office/share/basic/ScriptForge/po/en.po
Normal file
801
office-plugin/windows-office/share/basic/ScriptForge/po/en.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
||||
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ScriptForge" library:readonly="false" library:passwordprotected="false">
|
||||
<library:element library:name="__License"/>
|
||||
<library:element library:name="SF_String"/>
|
||||
<library:element library:name="_CodingConventions"/>
|
||||
<library:element library:name="SF_Timer"/>
|
||||
<library:element library:name="_ModuleModel"/>
|
||||
<library:element library:name="SF_Utils"/>
|
||||
<library:element library:name="SF_Root"/>
|
||||
<library:element library:name="SF_Array"/>
|
||||
<library:element library:name="SF_Services"/>
|
||||
<library:element library:name="SF_Dictionary"/>
|
||||
<library:element library:name="SF_Session"/>
|
||||
<library:element library:name="SF_FileSystem"/>
|
||||
<library:element library:name="SF_TextStream"/>
|
||||
<library:element library:name="SF_L10N"/>
|
||||
<library:element library:name="SF_Exception"/>
|
||||
<library:element library:name="SF_UI"/>
|
||||
<library:element library:name="SF_Platform"/>
|
||||
</library:library>
|
||||
Reference in New Issue
Block a user