wizards/source/scriptforge/SF_Platform.xba        |   13 +++++++++++
 wizards/source/scriptforge/dialog.xlb             |    2 -
 wizards/source/scriptforge/python/scriptforge.py  |    8 ++++++
 wizards/source/scriptforge/python/scriptforge.pyi |    2 +
 wizards/source/scriptforge/script.xlb             |   26 +++++++++++-----------
 5 files changed, 37 insertions(+), 14 deletions(-)

New commits:
commit 2cb150fd2de0fcbc1c136e11b90e455b40518387
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Wed Mar 19 16:40:17 2025 +0100
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Thu Mar 20 11:48:09 2025 +0100

    ScriptForge (Platform) new UntitledPrefix property
    
    Returns the prefix used to name new documents
    (in English = "Untitled ").
    
    Improves the portability of scripts by making
    them more language-agnostic.
    
    Available for Basic and Python scripts.
    The user documentation should be updated.
    
    Change-Id: Ie3c06e25fdc30fc1c3c775ef6ebbcee1d9cd77cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183134
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins

diff --git a/wizards/source/scriptforge/SF_Platform.xba 
b/wizards/source/scriptforge/SF_Platform.xba
index ade9681b54c4..c5baf10f6f4c 100644
--- a/wizards/source/scriptforge/SF_Platform.xba
+++ b/wizards/source/scriptforge/SF_Platform.xba
@@ -217,6 +217,14 @@ Property Get SystemLocale() As String
        SystemLocale = _PropertyGet(&quot;SystemLocale&quot;)
 End Property   &apos;  ScriptForge.SF_Platform.SystemLocale (get)
 
+REM 
-----------------------------------------------------------------------------
+Property Get UntitledPrefix() As String
+&apos;&apos;&apos;     Returns the prefix used to name new documents (in 
English = &quot;Untitled &quot;)
+&apos;&apos;&apos;     Example:
+&apos;&apos;&apos;             MsgBox platform.UntitledPrefix
+       UntitledPrefix = _PropertyGet(&quot;UntitledPrefix&quot;)
+End Property   &apos;  ScriptForge.SF_Platform.UntitledPrefix (get)
+
 REM 
-----------------------------------------------------------------------------
 Property Get UserData() As Variant
 &apos;&apos;&apos;     Returns a dictionary of all Options + User Data values
@@ -293,6 +301,7 @@ Public Function Properties() As Variant
                                        , &quot;Processor&quot; _
                                        , &quot;PythonVersion&quot; _
                                        , &quot;SystemLocale&quot; _
+                                       , &quot;UntitledPrefix&quot; _
                                        , &quot;UserData&quot; _
                                        )
 
@@ -383,6 +392,7 @@ Dim sFont As String                         &apos;  A 
single font name
 Dim vExtensionsList As Variant &apos;  Array of extension descriptors
 Dim sExtensions As String              &apos;  Comma separated list of 
extensions
 Dim sExtension As String               &apos;  A single extension name
+Dim oDesktop As Object                 &apos;  StarDesktop
 Dim vUserDataInternal As Variant&apos; The internal names of the supported 
user data items
 Dim vUserDataExternal As Variant&apos; The external names of the supported 
user data items
 Dim vUserData As Variant               &apos;  A SF_Dictionary instance 
linking user data external names and values
@@ -451,6 +461,9 @@ Const cstSubArgs = &quot;&quot;
                Case &quot;SystemLocale&quot;, &quot;Locale&quot;
                        Set oLocale = 
SF_Utils._GetUNOService(&quot;SystemLocale&quot;)
                        _PropertyGet = oLocale.Language &amp; &quot;-&quot; 
&amp; oLocale.Country
+               Case &quot;UntitledPrefix&quot;
+                       Set oDesktop = StarDesktop
+                       If Not IsNull(oDesktop) Then _PropertyGet = 
oDesktop.UntitledPrefix Else _PropertyGet = &quot;&quot;
                Case &quot;UserData&quot;
                        vUserDataExternal = Array( _
                                &quot;city&quot;, &quot;company&quot;, 
&quot;country&quot;, &quot;email&quot;, &quot;encryptionkey&quot;, 
&quot;encrypttoself&quot;, &quot;fax&quot; _
diff --git a/wizards/source/scriptforge/dialog.xlb 
b/wizards/source/scriptforge/dialog.xlb
index 7b54d071c4f9..5bd67a06a121 100644
--- a/wizards/source/scriptforge/dialog.xlb
+++ b/wizards/source/scriptforge/dialog.xlb
@@ -1,6 +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:element library:name="dlgConsole"/>
 </library:library>
\ No newline at end of file
diff --git a/wizards/source/scriptforge/python/scriptforge.py 
b/wizards/source/scriptforge/python/scriptforge.py
index 54bb6478da03..fb60b3705d3b 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1409,6 +1409,14 @@ class SFScriptForge:
 
         pythonversion, pythonVersion = PythonVersion, PythonVersion
 
+        @property
+        def UntitledPrefix(self):
+            basic = SFScriptForge.SF_Basic()
+            desktop = basic.StarDesktop
+            return desktop.UntitledPrefix
+
+        untitledprefix, untitledPrefix = UntitledPrefix, UntitledPrefix
+
     # #########################################################################
     # SF_Region CLASS
     # #########################################################################
diff --git a/wizards/source/scriptforge/python/scriptforge.pyi 
b/wizards/source/scriptforge/python/scriptforge.pyi
index e0ae4a7f8adf..369ba40fcc3d 100644
--- a/wizards/source/scriptforge/python/scriptforge.pyi
+++ b/wizards/source/scriptforge/python/scriptforge.pyi
@@ -1507,6 +1507,8 @@ class SFScriptForge:
         SystemLocale: str
         """ The locale of the operating system as a string in the format 
"la-CO" (language-COUNTRY).
         This is equivalent to the ``Locale`` property.  """
+        UntitledPrefix: str
+        """ The prefix used to name new documents (in English = "Untitled ").  
 """
         UserData: DICTIONARY
         """ Returns a ``Dictionary`` instance containing key-value pairs in 
relation with the
         ``Tools - Options - User Data`` dialog. """
diff --git a/wizards/source/scriptforge/script.xlb 
b/wizards/source/scriptforge/script.xlb
index dc625046fcef..b91788543b81 100644
--- a/wizards/source/scriptforge/script.xlb
+++ b/wizards/source/scriptforge/script.xlb
@@ -1,23 +1,23 @@
 <?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_Dictionary"/>
  <library:element library:name="SF_Exception"/>
+ <library:element library:name="SF_Services"/>
  <library:element library:name="SF_UI"/>
- <library:element library:name="SF_Platform"/>
+ <library:element library:name="SF_Timer"/>
+ <library:element library:name="SF_FileSystem"/>
+ <library:element library:name="SF_TextStream"/>
+ <library:element library:name="SF_Array"/>
  <library:element library:name="SF_PythonHelper"/>
+ <library:element library:name="SF_Platform"/>
+ <library:element library:name="SF_String"/>
+ <library:element library:name="_CodingConventions"/>
+ <library:element library:name="SF_Utils"/>
+ <library:element library:name="SF_Root"/>
+ <library:element library:name="__License"/>
  <library:element library:name="SF_Region"/>
+ <library:element library:name="SF_L10N"/>
 </library:library>
\ No newline at end of file

Reply via email to