[Libreoffice-commits] help.git: source/text
Rafael Lima (via logerrit)
logerrit at kemper.freedesktop.org
Sat Oct 2 12:04:40 UTC 2021
source/text/sbasic/shared/03/sf_platform.xhp | 156 ++++++++++++++++-----------
1 file changed, 96 insertions(+), 60 deletions(-)
New commits:
commit 39a1884a024666840913646b12841a458aeb51ab
Author: Rafael Lima <rafael.palma.lima at gmail.com>
AuthorDate: Thu Sep 30 19:07:12 2021 +0200
Commit: Rafael Lima <rafael.palma.lima at gmail.com>
CommitDate: Sat Oct 2 14:04:20 2021 +0200
Update SF_Platform help page to add the new Fonts property
This patch also adds a new example showing how to use the Fonts property in Basic and Python.
Change-Id: Idfab1df904e69cdb8974b774be1eac52bed2aa16
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/122859
Tested-by: Jenkins
Reviewed-by: Rafael Lima <rafael.palma.lima at gmail.com>
diff --git a/source/text/sbasic/shared/03/sf_platform.xhp b/source/text/sbasic/shared/03/sf_platform.xhp
index 0df4c2337..e0f8886c1 100644
--- a/source/text/sbasic/shared/03/sf_platform.xhp
+++ b/source/text/sbasic/shared/03/sf_platform.xhp
@@ -21,25 +21,25 @@
</bookmark>
</section>
<section id="abstract">
- <h1 id="bm_id681600788076499" xml-lang="en-US"><variable id="PlatformService"><link href="text/sbasic/shared/03/sf_platform.xhp" name="Platform service"><literal>ScriptForge</literal>.<literal>Platform</literal> service</link></variable></h1>
- <paragraph role="paragraph" id="par_id181600788076612" xml-lang="en-US">The <literal>Platform</literal> service provides a collection of properties about the current execution environment and context, such as:</paragraph>
+ <h1 id="bm_id681600788076499"><variable id="PlatformService"><link href="text/sbasic/shared/03/sf_platform.xhp" name="Platform service"><literal>ScriptForge</literal>.<literal>Platform</literal> service</link></variable></h1>
+ <paragraph role="paragraph" id="par_id181600788076612">The <literal>Platform</literal> service provides a collection of properties about the current execution environment and context, such as:</paragraph>
<list type="unordered">
<listitem>
- <paragraph id="par_id301600788076785" role="listitem" xml-lang="en-US">The hardware platform (architecture, CPU count, machine type, etc)</paragraph>
+ <paragraph id="par_id301600788076785" role="listitem">The hardware platform (architecture, CPU count, machine type, etc)</paragraph>
</listitem>
<listitem>
- <paragraph id="par_id1001600788076848" role="listitem" xml-lang="en-US">Operating system information (OS type, release, version, etc)</paragraph>
+ <paragraph id="par_id1001600788076848" role="listitem">Operating system information (OS type, release, version, etc)</paragraph>
</listitem>
<listitem>
- <paragraph id="par_id67160078807676" role="listitem" xml-lang="en-US">The %PRODUCTNAME version</paragraph>
+ <paragraph id="par_id67160078807676" role="listitem">The %PRODUCTNAME version</paragraph>
</listitem>
<listitem>
- <paragraph id="par_id671600788076855" role="listitem" xml-lang="en-US">The current user name</paragraph>
+ <paragraph id="par_id671600788076855" role="listitem">The current user name</paragraph>
</listitem>
</list>
</section>
<note id="par_id951614903258253">All properties of the <literal>Platform</literal> service are read-only.</note>
- <h2 id="hd_id281600788076359" xml-lang="en-US">Service invocation</h2>
+ <h2 id="hd_id281600788076359">Service invocation</h2>
<paragraph role="paragraph" id="par_id321614902851541">The examples below in Basic and Python instantiate the <literal>Platform</literal> service and access the <literal>Architecture</literal> property.</paragraph>
<embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
<bascode>
@@ -60,6 +60,7 @@
<bookmark_value>Platform service;ComputerName</bookmark_value>
<bookmark_value>Platform service;CPUCount</bookmark_value>
<bookmark_value>Platform service;CurrentUser</bookmark_value>
+ <bookmark_value>Platform service;Fonts</bookmark_value>
<bookmark_value>Platform service;Machine</bookmark_value>
<bookmark_value>Platform service;OfficeVersion</bookmark_value>
<bookmark_value>Platform service;OSName</bookmark_value>
@@ -69,197 +70,232 @@
<bookmark_value>Platform service;Printers</bookmark_value>
<bookmark_value>Platform service;Processor</bookmark_value>
</bookmark>
- <h2 id="hd_id711600788076834" xml-lang="en-US">Properties</h2>
+ <h2 id="hd_id711600788076834">Properties</h2>
<table id="tab_id701600788076583">
<tablerow>
<tablecell>
- <paragraph id="par_id461600788076917" role="tablehead" xml-lang="en-US">Name</paragraph>
+ <paragraph id="par_id461600788076917" role="tablehead">Name</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id221600788076591" role="tablehead" xml-lang="en-US">Readonly</paragraph>
+ <paragraph id="par_id221600788076591" role="tablehead">Readonly</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id761600788076328" role="tablehead" xml-lang="en-US">Type</paragraph>
+ <paragraph id="par_id761600788076328" role="tablehead">Type</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id67160078807636" role="tablehead" xml-lang="en-US">Description</paragraph>
+ <paragraph id="par_id67160078807636" role="tablehead">Description</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id491600788076621" role="tablecontent" xml-lang="en-US" localize="false">Architecture</paragraph>
+ <paragraph id="par_id491600788076621" role="tablecontent" localize="false">Architecture</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id311600788076756" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id311600788076756" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id831600788076785" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id831600788076785" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id441600788076826" role="tablecontent" xml-lang="en-US">The hardware bit architecture. Example: '<literal>32bit</literal>' or '<literal>64bit</literal>'</paragraph>
+ <paragraph id="par_id441600788076826" role="tablecontent">The hardware bit architecture. Example: '<literal>32bit</literal>' or '<literal>64bit</literal>'</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id941600788076595" role="tablecontent" xml-lang="en-US" localize="false">ComputerName</paragraph>
+ <paragraph id="par_id941600788076595" role="tablecontent" localize="false">ComputerName</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id49160078807654" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id49160078807654" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id961600788076376" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id961600788076376" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id81600788076419" role="tablecontent" xml-lang="en-US">The computer's network name.</paragraph>
+ <paragraph id="par_id81600788076419" role="tablecontent">The computer's network name.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id721600788076638" role="tablecontent" xml-lang="en-US" localize="false">CPUCount</paragraph>
+ <paragraph id="par_id721600788076638" role="tablecontent" localize="false">CPUCount</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id711600788076534" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id711600788076534" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id911600788076842" role="tablecontent" xml-lang="en-US" localize="false">Integer</paragraph>
+ <paragraph id="par_id911600788076842" role="tablecontent" localize="false">Integer</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id541600788076645" role="tablecontent" xml-lang="en-US">The number of central processing units.</paragraph>
+ <paragraph id="par_id541600788076645" role="tablecontent">The number of central processing units.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id961600788076890" role="tablecontent" xml-lang="en-US" localize="false">CurrentUser</paragraph>
+ <paragraph id="par_id961600788076890" role="tablecontent" localize="false">CurrentUser</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id891600788076190" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id891600788076190" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id761600788076562" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id761600788076562" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id91600788076674" role="tablecontent" xml-lang="en-US">The name of the currently logged user.</paragraph>
+ <paragraph id="par_id91600788076674" role="tablecontent">The name of the currently logged user.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id951600788076443" role="tablecontent" xml-lang="en-US" localize="false">Machine</paragraph>
+ <paragraph id="par_id831633021719135" localize="false" role="tablecontent">Fonts</paragraph>
</tablecell>
+ <tablecell>
+ <paragraph id="par_id561633021747903" role="tablecontent">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id201633021748455" role="tablecontent">String array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id831633021749007" role="tablecontent">Returns a zero-based array of strings containing the names of all available fonts.</paragraph>
+ <embed href="text/sbasic/shared/03/avail_release.xhp#7.3.property"/>
+ </tablecell>
+ </tablerow>
+ <tablerow>
<tablecell>
- <paragraph id="par_id391600788076253" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id951600788076443" role="tablecontent" localize="false">Machine</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id381600788076799" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id391600788076253" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id21600788076541" role="tablecontent" xml-lang="en-US">The machine type. Examples are: '<literal>i386</literal>' or '<literal>x86_64</literal>'.</paragraph>
+ <paragraph id="par_id381600788076799" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id21600788076541" role="tablecontent">The machine type. Examples are: '<literal>i386</literal>' or '<literal>x86_64</literal>'.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id41600788076936" role="tablecontent" xml-lang="en-US" localize="false">OfficeVersion</paragraph>
+ <paragraph id="par_id41600788076936" role="tablecontent" localize="false">OfficeVersion</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id211600788076138" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id211600788076138" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id221600788076518" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id221600788076518" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id521600788076371" role="tablecontent" xml-lang="en-US">The actual %PRODUCTNAME version expressed as<br />' <literal>%PRODUCTNAME w.x.y.z (The Document Foundation)</literal>'.</paragraph>
+ <paragraph id="par_id521600788076371" role="tablecontent">The actual %PRODUCTNAME version expressed as<br />' <literal>%PRODUCTNAME w.x.y.z (The Document Foundation)</literal>'.</paragraph>
<paragraph role="paragraph" id="par_id621614902220807">Example: '<literal>LibreOffice 7.1.1.2 (The Document Foundation, Debian and Ubuntu)</literal>'</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id161600788076362" role="tablecontent" xml-lang="en-US" localize="false">OSName</paragraph>
+ <paragraph id="par_id161600788076362" role="tablecontent" localize="false">OSName</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id21600788076758" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id21600788076758" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id871600788076196" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id871600788076196" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id781600788076694" role="tablecontent" xml-lang="en-US">The operating system type. Example: '<literal>Darwin</literal>, <literal>Linux</literal>' or '<literal>Windows</literal>'.</paragraph>
+ <paragraph id="par_id781600788076694" role="tablecontent">The operating system type. Example: '<literal>Darwin</literal>, <literal>Linux</literal>' or '<literal>Windows</literal>'.</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id471600788076885" role="tablecontent" xml-lang="en-US" localize="false">OSPlatform</paragraph>
+ <paragraph id="par_id471600788076885" role="tablecontent" localize="false">OSPlatform</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id261600788076841" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id261600788076841" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id661600788076636" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id661600788076636" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id11600788076757" role="tablecontent" xml-lang="en-US">A single string identifying the underlying platform with as much useful and human-readable information as possible.</paragraph>
+ <paragraph id="par_id11600788076757" role="tablecontent">A single string identifying the underlying platform with as much useful and human-readable information as possible.</paragraph>
<paragraph role="paragraph" id="par_id501614902381381">Example: '<literal>Linux-5.8.0-44-generic-x86_64-with-glibc2.32</literal>'</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id221600789141781" role="tablecontent" xml-lang="en-US" localize="false">OSRelease</paragraph>
+ <paragraph id="par_id221600789141781" role="tablecontent" localize="false">OSRelease</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id531600789141795" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id531600789141795" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id561600789141282" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id561600789141282" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id301600789141619" role="tablecontent" xml-lang="en-US">The operating system's release. Example: '<literal>5.8.0-44-generic</literal>'</paragraph>
+ <paragraph id="par_id301600789141619" role="tablecontent">The operating system's release. Example: '<literal>5.8.0-44-generic</literal>'</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id821600789286339" role="tablecontent" xml-lang="en-US" localize="false">OSVersion</paragraph>
+ <paragraph id="par_id821600789286339" role="tablecontent" localize="false">OSVersion</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id541600789286532" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id541600789286532" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id181600789286889" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id181600789286889" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id701600789286280" role="tablecontent" xml-lang="en-US">The operating system's build or version.</paragraph>
+ <paragraph id="par_id701600789286280" role="tablecontent">The operating system's build or version.</paragraph>
<paragraph role="paragraph" id="par_id351614902520555">Example: '<literal>#50-Ubuntu SMP Tue Feb 9 06:29:41 UTC 2021</literal>'</paragraph>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id31600789752717" role="tablecontent" xml-lang="en-US" localize="false">Printers</paragraph>
+ <paragraph id="par_id31600789752717" role="tablecontent" localize="false">Printers</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id941608709527698" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id941608709527698" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id100100678952791" role="tablecontent" xml-lang="en-US" localize="false">String<br/>array</paragraph>
+ <paragraph id="par_id100100678952791" role="tablecontent" localize="false">String<br/>array</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id661300789527859" role="tablecontent" xml-lang="en-US">The list of available printers as a zero-based array.</paragraph>
+ <paragraph id="par_id661300789527859" role="tablecontent">The list of available printers as a zero-based array.</paragraph>
<paragraph role="paragraph" id="par_id111614952098396">The default printer is put in the first position of the list (index = 0).</paragraph>
<embed href="text/sbasic/shared/03/avail_release.xhp#7.3.property"/>
</tablecell>
</tablerow>
<tablerow>
<tablecell>
- <paragraph id="par_id31600789527717" role="tablecontent" xml-lang="en-US" localize="false">Processor</paragraph>
+ <paragraph id="par_id31600789527717" role="tablecontent" localize="false">Processor</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id941600789527698" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ <paragraph id="par_id941600789527698" role="tablecontent">Yes</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id100160078952791" role="tablecontent" xml-lang="en-US" localize="false">String</paragraph>
+ <paragraph id="par_id100160078952791" role="tablecontent" localize="false">String</paragraph>
</tablecell>
<tablecell>
- <paragraph id="par_id631600789527859" role="tablecontent" xml-lang="en-US">The real processor name. Example: '<literal>amdk6</literal>'.</paragraph>
+ <paragraph id="par_id631600789527859" role="tablecontent">The real processor name. Example: '<literal>amdk6</literal>'.</paragraph>
<paragraph role="paragraph" id="par_id111614902598396">This property may return the same value as the <literal>Machine</literal> property.</paragraph>
</tablecell>
</tablerow>
</table>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id311633022159446">The following examples in Basic and Python illustrate how to use the <literal>Fonts</literal> property to write the names of all available fonts to the current Calc sheet starting at cell "A1":</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id671633022413022">Dim oDoc as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id721633022413266">Dim allFonts as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id691633022413526">Dim svcPlatform as Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id41633022413831">Set oDoc = CreateScriptService("Calc")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id541633022414069">Set svcPlatform = CreateScriptService("Platform")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id641633022414366">allFonts = svcPlatform.Fonts</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651633022414637">oDoc.setArray("~.A1", allFonts)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id701633022704347">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id841633022704586">svc_platform = CreateScriptService("Platform")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id281633022704771">doc = CreateScriptService("Calc")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id211633022704988">all_fonts = svc_platform.Fonts</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id941633022705212">doc.setArray("~.A1", all_fonts)</paragraph>
+ </pycode>
<embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
<section id="relatedtopics">
<embed href="text/sbasic/python/python_platform.xhp#pythonplatform"/>
More information about the Libreoffice-commits
mailing list