summaryrefslogtreecommitdiff
path: root/wizards/source
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/source')
-rw-r--r--wizards/source/scriptforge/SF_PythonHelper.xba5
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py64
2 files changed, 66 insertions, 3 deletions
diff --git a/wizards/source/scriptforge/SF_PythonHelper.xba b/wizards/source/scriptforge/SF_PythonHelper.xba
index 7368390c97bf..5acd2dfc9228 100644
--- a/wizards/source/scriptforge/SF_PythonHelper.xba
+++ b/wizards/source/scriptforge/SF_PythonHelper.xba
@@ -558,6 +558,7 @@ Const cstNoArgs = "+++NOARGS+++", cstSymEmpty = "+++EMPTY+++&quot
' Determines the CallType
Const vbGet = 2, vbLet = 4, vbMethod = 1, vbSet = 8
' Protocol flags
+Const cstDateArg = 64 ' May contain a date argument
Const cstDateRet = 128 ' Return value can be a date
Const cstArgArray = 512 ' 1st argument can be a 2D array
Const cstRetArray = 1024 ' Return value can be an array
@@ -589,9 +590,9 @@ Check:
vArg = Null
ElseIf vArg = cstSymMissing Then
Exit For ' Next arguments must be missing also
- Else
+ ElseIf ( CallType And cstDateArg ) = cstDateArg Then ' Arguments might be dates
vArg = SF_Utils._CStrToDate(vArg)
- If vArg < 0 Then vArg = Args(i) 'Conversion of iso format failed => forget
+ If vArg < 0 Then vArg = Args(i) ' Conversion of iso format failed => reset
End If
End If
iNbArgs = iNbArgs + 1
diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py
index 14ba1e48c8db..92f214c34e52 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -360,6 +360,7 @@ class SFServices(object):
"""
# Python-Basic protocol constants and flags
vbGet, vbLet, vbMethod, vbSet = 2, 4, 1, 8 # CallByName constants
+ flgDateArg = 64 # Invoked service method may contain a date argument
flgDateRet = 128 # Invoked service method can return a date
flgArrayArg = 512 # 1st argument can be a 2D array
flgArrayRet = 1024 # Invoked service method can return a 2D array
@@ -764,7 +765,7 @@ class SFScriptForge:
result = []
for pv in iter(propertyvalues):
key = pv.Name
- if key not in self:
+ if overwrite is True or key not in self:
item = pv.Value
if 'com.sun.star.util.DateTime' in repr(type(item)):
item = datetime.datetime(item.Year, item.Month, item.Day,
@@ -1057,6 +1058,67 @@ class SFScriptForge:
processor = Processor
# #########################################################################
+ # SF_String CLASS
+ # #########################################################################
+ class SF_String(SFServices, metaclass = _Singleton):
+ """
+ Focus on string manipulation, regular expressions, encodings and hashing algorithms.
+ The methods implemented in Basic that are redundant with Python builtin functions
+ are not duplicated
+ """
+ # Mandatory class properties for service registration
+ serviceimplementation = 'basic'
+ servicename = 'ScriptForge.String'
+ servicesynonyms = ('string', 'scriptforge.string')
+ serviceproperties = dict()
+ propertysynonyms = SFServices._getAttributeSynonyms(serviceproperties)
+
+ def HashStr(self, inputstr, algorithm):
+ py = ScriptForge.pythonhelpermodule + '$' + '_SF_String__HashStr'
+ return self.SIMPLEEXEC(py, inputstr, algorithm.lower())
+ hashStr, hashstr = HashStr, HashStr
+
+ def IsADate(self, inputstr, dateformat = 'YYYY-MM-DD'):
+ return self.Execute(self.vbMethod, 'IsADate', inputstr, dateformat)
+ isADate, isadate = IsADate, IsADate
+
+ def IsEmail(self, inputstr):
+ return self.Execute(self.vbMethod, 'IsEmail', inputstr)
+ isEmail, isemail = IsEmail, IsEmail
+
+ def IsFileName(self, inputstr, osname = ScriptForge.cstSymEmpty):
+ return self.Execute(self.vbMethod, 'IsFileName', inputstr, osname)
+ isFileName, isfilename = IsFileName, IsFileName
+
+ def IsIBAN(self, inputstr):
+ return self.Execute(self.vbMethod, 'IsIBAN', inputstr)
+ isIBAN, isiban = IsIBAN, IsIBAN
+
+ def IsIPv4(self, inputstr):
+ return self.Execute(self.vbMethod, 'IsIPv4', inputstr)
+ isIPv4, isipv4 = IsIPv4, IsIPv4
+
+ def IsLike(self, inputstr, pattern, casesensitive = False):
+ return self.Execute(self.vbMethod, 'IsLike', inputstr, pattern, casesensitive)
+ isLike, islike = IsLike, IsLike
+
+ def IsSheetName(self, inputstr):
+ return self.Execute(self.vbMethod, 'IsSheetName', inputstr)
+ isSheetName, issheetname = IsSheetName, IsSheetName
+
+ def IsUrl(self, inputstr):
+ return self.Execute(self.vbMethod, 'IsUrl', inputstr)
+ isUrl, isurl = IsUrl, IsUrl
+
+ def SplitNotQuoted(self, inputstr, delimiter = ' ', occurrences = 0, quotechar = '"'):
+ return self.Execute(self.vbMethod, 'SplitNotQuoted', inputstr, delimiter, occurrences, quotechar)
+ splitNotQuoted, splitnotquoted = SplitNotQuoted, SplitNotQuoted
+
+ def Wrap(self, inputstr, width = 70, tabsize = 8):
+ return self.Execute(self.vbMethod, 'Wrap', inputstr, width, tabsize)
+ wrap = Wrap
+
+ # #########################################################################
# SF_TextStream CLASS
# #########################################################################
class SF_TextStream(SFServices):