wizards/source/scriptforge/SF_Platform.xba | 14 ++++++++++++++ wizards/source/scriptforge/python/scriptforge.py | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-)
New commits: commit 740329373b2fe2c4f7c18ff1921e2f100d49a6bf Author: Jean-Pierre Ledure <j...@ledure.be> AuthorDate: Sun Feb 27 14:04:12 2022 +0100 Commit: Jean-Pierre Ledure <j...@ledure.be> CommitDate: Sun Feb 27 15:27:15 2022 +0100 ScriptForge - (SF_Platform) add the FilterNames property The FilterNames property returns, as an unsorted zero-based array of strings, the list of available/installed import and export filters for components. The property can serve as support for the FilterName argument used for opening and saving documents. The FilterNames property is available both from Basic and Python user scripts. Change-Id: I607500b56836ceeb6716b10d39d22638b0741f3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130624 Tested-by: Jean-Pierre Ledure <j...@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <j...@ledure.be> diff --git a/wizards/source/scriptforge/SF_Platform.xba b/wizards/source/scriptforge/SF_Platform.xba index 33bbf7877b9e..8403866fffe8 100644 --- a/wizards/source/scriptforge/SF_Platform.xba +++ b/wizards/source/scriptforge/SF_Platform.xba @@ -82,6 +82,15 @@ Property Get Extensions() As Variant Extensions = _PropertyGet("Extensions") End Property ' ScriptForge.SF_Platform.Extensions (get) +REM ----------------------------------------------------------------------------- +Property Get FilterNames() As Variant +''' Returns the list of available document import and export filter names as an unsorted array of unique strings +''' To get the list sorted, use SF_Array.Sort() +''' Example: +''' myFilterNamesList = platform.FilterNames + FilterNames = _PropertyGet("FilterNames") +End Property ' ScriptForge.SF_Platform.FilterNames (get) + REM ----------------------------------------------------------------------------- Property Get Fonts() As Variant ''' Returns the list of available fonts as an unsorted array of unique strings @@ -261,6 +270,7 @@ Public Function Properties() As Variant , "CPUCount" _ , "CurrentUser" _ , "Extensions" _ + , "FilterNames" _ , "Fonts" _ , "FormatLocale" _ , "Locale" _ @@ -357,6 +367,7 @@ Dim oLocale As Object ' com.sun.star.lang.Locale Dim oPrinterServer As Object ' com.sun.star.awt.PrinterServer Dim oToolkit As Object ' com.sun.star.awt.Toolkit Dim oDevice As Object ' com.sun.star.awt.XDevice +Dim oFilterFactory As Object ' com.sun.star.document.FilterFactory Dim oFontDescriptors As Variant ' Array of com.sun.star.awt.FontDescriptor Dim sFonts As String ' Comma-separated list of fonts Dim sFont As String ' A single font name @@ -385,6 +396,9 @@ Const cstSubArgs = "" sExtensions = sExtensions & "," & vExtensionsList(i)(0) Next i If Len(sExtensions) > 0 Then _PropertyGet = Split(Mid(sExtensions, 2), ",") Else _PropertyGet = Array() + Case "FilterNames" + Set oFilterFactory = SF_Utils._GetUNOService("FilterFactory") + _PropertyGet = oFilterFactory.getElementNames() Case "Fonts" Set oToolkit = SF_Utils._GetUnoService("Toolkit") Set oDevice = oToolkit.createScreenCompatibleDevice(0, 0) diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index dea3a9854ebf..d9fac9c26d5e 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1234,10 +1234,10 @@ class SFScriptForge: servicename = 'ScriptForge.Platform' servicesynonyms = ('platform', 'scriptforge.platform') serviceproperties = dict(Architecture = False, ComputerName = False, CPUCount = False, CurrentUser = False, - Extensions = False, Fonts = False, FormatLocale = False, Locale = False, - Machine = False, OfficeLocale = False, OfficeVersion = False, OSName = False, - OSPlatform = False, OSRelease = False, OSVersion = False, Printers = False, - Processor = False, PythonVersion = False, SystemLocale = False) + Extensions = False, FilterNames = False, Fonts = False, FormatLocale = False, + Locale = False, Machine = False, OfficeLocale = False, OfficeVersion = False, + OSName = False, OSPlatform = False, OSRelease = False, OSVersion = False, + Printers = False, Processor = False, PythonVersion = False, SystemLocale = False) # Python helper functions py = ScriptForge.pythonhelpermodule + '$' + '_SF_Platform'