diff options
author | Alain Romedenne <alain.romedenne@libreoffice.org> | 2021-04-15 11:47:57 +0200 |
---|---|---|
committer | Alain Romedenne <alain.romedenne@libreoffice.org> | 2021-04-29 18:15:58 +0200 |
commit | 4ee2f0f82f99a865e765309eda367d5fc016674b (patch) | |
tree | c6dcbf912d3cbd66b1c2b214c57d9c3e407be41e /source/text/sbasic | |
parent | c8cf56ede34cc13a90a930aab505828ee196005c (diff) |
sf_basic py2bas bridge
It includes Basic functions rework in order to
- share content,
- correct Basic keywords argument names tdf#141474
- accommodate Python lowercased arguments.
Change-Id: If59a82444a8e001b02d085f5e10e0053666f8485
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/114008
Tested-by: Jenkins
Reviewed-by: Alain Romedenne <alain.romedenne@libreoffice.org>
Diffstat (limited to 'source/text/sbasic')
-rw-r--r-- | source/text/sbasic/python/python_programming.xhp | 4 | ||||
-rw-r--r-- | source/text/sbasic/shared/03/sf_basic.xhp | 480 | ||||
-rw-r--r-- | source/text/sbasic/shared/03010101.xhp | 8 | ||||
-rw-r--r-- | source/text/sbasic/shared/03010201.xhp | 14 | ||||
-rw-r--r-- | source/text/sbasic/shared/03010305.xhp | 8 | ||||
-rw-r--r-- | source/text/sbasic/shared/03030102.xhp | 40 | ||||
-rw-r--r-- | source/text/sbasic/shared/03030120.xhp | 9 | ||||
-rw-r--r-- | source/text/sbasic/shared/03120301.xhp | 53 |
8 files changed, 557 insertions, 59 deletions
diff --git a/source/text/sbasic/python/python_programming.xhp b/source/text/sbasic/python/python_programming.xhp index 5efa8df15c..96deb86064 100644 --- a/source/text/sbasic/python/python_programming.xhp +++ b/source/text/sbasic/python/python_programming.xhp @@ -11,14 +11,16 @@ <meta> <topic id="text/sbasic/python/Python_Programming"> <title id="tit" xml-lang="en-US">Python : Programming with Python</title> - <filename>/text/sbasic/python/python_programming.xhp</filename> + <filename>/text/sbasic/python/python_programming.xhp</filename> </topic> </meta> <body> <bookmark branch="index" id="N0218"> <bookmark_value>Python;Programming</bookmark_value> <bookmark_value>XSCRIPTCONTEXT;Python</bookmark_value> + <bookmark_value>XSCRIPTCONTEXT;getComponentContext()</bookmark_value> <bookmark_value>uno.py</bookmark_value> + <bookmark_value>uno.py;getComponentContext()</bookmark_value> </bookmark> <section id="pythonprogramming"> <h1 id="hd_id691546462755220"><variable id="pythonprogrammingheading"><link href="text/sbasic/python/python_programming.xhp" name="python programming">Programming with Python Scripts</link></variable></h1> diff --git a/source/text/sbasic/shared/03/sf_basic.xhp b/source/text/sbasic/shared/03/sf_basic.xhp new file mode 100644 index 0000000000..9ebae2bec6 --- /dev/null +++ b/source/text/sbasic/shared/03/sf_basic.xhp @@ -0,0 +1,480 @@ +<?xml version="1.0" encoding="UTF-8"?> +<helpdocument version="1.0"> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of 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/. + * +--> +<meta> + <topic id="SF_Document" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">ScriptForge.Basic service</title> + <filename>/text/sbasic/shared/03/sf_basic.xhp</filename> + </topic> +</meta> +<body> +<section id="ScriptForge-sf_basic"> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id261582733781987"> + <bookmark_value>Basic service</bookmark_value> + </bookmark> +</section> +<section id="abstract"> + <h1 id="hd_id731582733781114" xml-lang="en-US"><variable id="BasicService"><link href="text/sbasic/shared/03/sf_basic.xhp" name="Basic service"><literal>ScriptForge</literal>.<literal>Basic</literal> service</link></variable></h1> + <paragraph role="paragraph" id="par_id381589189355849" xml-lang="en-US">The <literal>ScriptForge.Basic</literal> service proposes a collection of %PRODUCTNAME Basic methods to be executed in a Python context. <literal>Basic</literal> service methods reproduce the exact syntax and behaviour of Basic builtin functions. +</paragraph> + <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.service"/> +</section> + <paragraph role="paragraph" id="par_id591589189364267" xml-lang="en-US">Typical example:</paragraph> + <pycode> + <paragraph role="pycode" xml-lang="en-US" id="pyc_id971618493778666">svc.MsgBox('This has to be displayed in a message box')</paragraph> + </pycode> + <warning id="par_id151618849022977"><literal>ScriptForge</literal>.<literal>Basic</literal> service is limited to Python scripts.</warning> + <h2 id="hd_id581582885621841" xml-lang="en-US">Service invocation</h2> + <paragraph role="paragraph" id="par_id141610734722352">Before using the <literal>Basic</literal> service, import the <literal>CreateScriptService()</literal> method from the <literal>scriptforge</literal> module:</paragraph> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id551610734764343">from scriptforge import CreateScriptService</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id121618496552817">svc = CreateScriptService("Basic")</paragraph> + </pycode> + <h2 id="hd_id201618922972557">Properties</h2> + <table id="tab_id991618922991909"> + <tablerow> + <tablecell><paragraph id="par_id401618922991909" role="tablehead">Name</paragraph></tablecell> + <tablecell><paragraph id="par_id591618922991909" role="tablehead">ReadOnly</paragraph></tablecell> + <tablecell><paragraph id="par_id211618922991909" role="tablehead">Type</paragraph></tablecell> + <tablecell><paragraph id="par_id971618923022846" role="tablehead">Description</paragraph></tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id541619003984227" role="tablecontent">MB_OK, MB_OKCANCEL, MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id21619004009875" role="tablecontent">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id111619004011627" role="tablecontent">integer</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id791619004012484" role="tablecontent">Values: 0, 1, 5, 4, 3</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id161619003998035" role="tablecontent">MB_ICONEXCLAMATION, MB_ICONINFORMATION, MB_ICONQUESTION, MB_ICONSTOP</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id201619004097755" role="tablecontent">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id981619004098700" role="tablecontent">integer</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id311619004099683" role="tablecontent">Values: 48, 64, 32, 16<br/></paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id831618922991909" role="tablecontent">MB_ABORTRETRYIGNORE, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id581618922991909" role="tablecontent">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id161618922991910" role="tablecontent">integer</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id211618923312141" role="tablecontent">Values: 2, 128, 256, 512</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id471618924470655" role="tablecontent">IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK, IDRETRY, IDYES</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id961618924503848" role="tablecontent">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id571618924505303" role="tablecontent">integer</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id871618924506654" role="tablecontent">Values: 3, 2, 5, 7, 1, 4, 6<br/>Constants indicating <literal>MsgBox</literal> selected button.</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id421619006246768" role="tablecontent">StarDesktop</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id731619006254384" role="tablecontent">Yes</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id711619006255184" role="tablecontent">UNO<br/>object</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id541619006255653" role="tablecontent"><link href="text/sbasic/shared/stardesktop.xhp" name="StarDesktop"><literal>StarDesktop</literal></link> object represents LibreOfficeDev Start Center.</paragraph> + </tablecell> + </tablerow> + </table> + <table id="tab_id901611086279902"> + <tablerow> + <tablecell colspan="3"><paragraph id="par_id651606319520519" role="tablehead">List of Methods in the Basic Service</paragraph></tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id761611086279902" role="tablecontent" localize="false"> + <link href="text/sbasic/shared/03/sf_basic.xhp#ConvertFromUrl" name="ConvertFromUrl method">ConvertFromUrl</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#ConvertToUrl" name="ConvertToUrl method">ConvertToUrl</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#CreateUnoService" name="CreateUnoService method">CreateUnoService</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#DateAdd" name="DateAdd method">DateAdd</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#DateDiff" name="DateDiff method">DateDiff</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#DatePart" name="DatePart method">DatePart</link> + </paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id141611086279902" role="tablecontent" localize="false"> + <link href="text/sbasic/shared/03/sf_basic.xhp#DateValue" name="DateValue method">DateValue</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#Format" name="Format method">Format</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#GetDefaultContext" name="GetDefaultContext method">GetDefaultContext</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#GetGuiType" name="GetGuiType method">GetGuiType</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#GetPathSeparator" name="GetPathSeparator method">GetPathSeparator</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#GetSystemTicks" name="GetSystemTicks method">GetSystemTicks</link><br/> + </paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id761611086279903" role="tablecontent" localize="false"> + <link href="text/sbasic/shared/03/sf_basic.xhp#InputBox" name="InputBox0 method">InputBox</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#MsgBox" name="MsgBox method">MsgBox</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#Now" name="Now method">Now</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#RGB" name="RGB method">RGB</link><br/> + <link href="text/sbasic/shared/03/sf_basic.xhp#Xray" name="Xray method">Xray</link> + </paragraph> + </tablecell> + </tablerow> + </table> +<section id="ConvertFromUrl"> + <comment> ConvertFromUrl ------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id92158919969883"> + <bookmark_value>Basic service;ConvertFromUrl</bookmark_value> + </bookmark> + <h2 id="hd_id201589199698251" localize="false">ConvertFromUrl</h2> + <paragraph role="paragraph" id="par_id93158919969864">Returns a system path file name for the given <literal>file:</literal> URL.</paragraph> + <h3 id="hd_id921589199698523" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" localize="false" id="par_id201618496409224"><input>svc.ConvertFromUrl(url: str): str</input></paragraph> + <h3 id="hd_id891618502357257" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id321618502481706"> <emph>url</emph>: An absolute <literal>file:</literal> URL.</paragraph> + <h3 id="hd_id721618502361001" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id81618502493505">A system path file name.</paragraph> + <h3 id="hd_id5158919969859" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id41158919969836">filename = svc.ConvertFromUrl( "file:///C:/Program%20Files%20(x86)/LibreOffice/News.txt")</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id881611147617212">svc.MsgBox(filename)</paragraph> + </pycode> +</section> +<section id="ConvertToUrl"> + <comment> ConvertToUrl --------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id721589200121249"> + <bookmark_value>Basic service;ConvertToUrl</bookmark_value> + </bookmark> + <h2 id="hd_id261589210021415" localize="false">ConvertToUrl</h2> + <paragraph role="paragraph" id="par_id658519200121138">Returns a <literal>file:</literal> URL for the given system path.</paragraph> + <h3 id="hd_id671528900121173" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id761618501052294" localize="false"><input>svc.ConvertToUrl(systempath: str): str</input></paragraph> + <h3 id="hd_id77158900212192" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id401618521015903"><emph>systempath</emph>: A system file name as a string.</paragraph> + <h3 id="hd_id301618541003255" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id61658101307414">A <literal>file:</literal> URL as a string.</paragraph> + <h3 id="hd_id285159200121838" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id891985200121516">url = svc.ConvertToUrl( 'C:\Program Files(x86)\LibreOffice\News.txt')</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id51589200605125">svc.MsgBox(url)</paragraph> + </pycode> +</section> +<section id="CreateUnoService"> + <comment> CreateUnoService ----------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id721589200121249"> + <bookmark_value>Basic service;CreateUnoService</bookmark_value> + </bookmark> + <h2 id="hd_id261589200121415" localize="false">CreateUnoService</h2> + <paragraph role="paragraph" id="par_id651589200121138">Instantiates a UNO service with the <literal>ProcessServiceManager</literal>.</paragraph> + <h3 id="hd_id671589200121173" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id221618556258876" localize="false"><input>svc.CreateUnoService(servicename: str): uno</input></paragraph> + <h3 id="hd_id77158920012192" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id361589200121646"> <emph>servicename</emph> : A fully qualified service name such as "com.sun.star.ui.dialogs.FilePicker" or 'com.sun.star.sheet.FunctionAccess'.</paragraph> + <h3 id="hd_id251589200121838" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="bascode" localize="false" id="pyc_id891589200121516">dsk = svc.CreateUnoService('com.sun.star.frame.Desktop')</paragraph> + </pycode> +</section> +<section id="DateAdd"> + <comment> DateAdd -------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id311599410266448"> + <bookmark_value>Basic service;DateAdd</bookmark_value> + </bookmark> + <h2 id="hd_id91599410266599" localize="false">DateAdd</h2> + <paragraph role="paragraph" id="par_id901599410483300" xml-lang="en-US">Adds a date or time interval to a given date/time a number of times and returns the resulting date.</paragraph> + <h3 id="hd_id861599410266539" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id771618557939013" localize="false"><input>svc.DateAdd(interval: str, number: num, date: datetime): datetime</input></paragraph> + <h3 id="hd_id861599410266584" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id581618562143601"> <emph>interval</emph>: A string expression from the following table, specifying the date or time interval.</paragraph> + <embed href="text/sbasic/shared/03030110.xhp#datetable"/> + <paragraph role="paragraph" id="par_id281618562144897"> <emph>number</emph>: A numerical expression specifying how often the <literal>interval</literal> value will be added when positive or subtracted when negative.</paragraph> + <paragraph role="paragraph" id="par_id811618561843272"> <emph>date</emph>: A given datetime.datetime value, the <literal>interval</literal> value will be added number times to this date/time value.</paragraph> + <h3 id="hd_id591618558226710" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id181618561778320">A datetime.datetime value.</paragraph> + <h3 id="hd_id30159941026663" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id961618558341526">dt = datetime.datetime(2004, 1, 31)</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id891599410846998">dt = svc.DateAdd("m", 1, dt)</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id621599410266932">print(dt)</paragraph> + </pycode> +</section> +<section id="DateDiff"> + <comment> DateDiff ------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id601589202413561"> + <bookmark_value>Basic service;DateDiff</bookmark_value> + </bookmark> + <h2 id="hd_id611589202413141" localize="false">DateDiff</h2> + <paragraph role="paragraph" id="par_id991589202413257">Returns the number of date or time intervals between two given date/time values.</paragraph> + <h3 id="hd_id69158920241331" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id441618562866810" localize="false"><input>svc.DateDiff(interval: str, date1: datetime, date2: datetime, firstdayofweek = 1, firstweekofyear = 1): int</input></paragraph> + <h3 id="hd_id55158920241343" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id481618563770490"> <emph>interval</emph>: A string expression specifying the date interval, as detailed in above <literal>DateAdd</literal> method.</paragraph> + <paragraph role="paragraph" id="par_id121618563772932"> <emph>date1</emph>, <emph>date2</emph>: The two datetime.datetime values to be compared.</paragraph> + <embed href="text/sbasic/shared/03030120.xhp#weekyear"/> + <h3 id="hd_id631618563376042" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id121618563454738">A number.</paragraph> + <h3 id="hd_id911589202413592" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id401611153339973">date1 = datetime.datetime(2005,1, 1)</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id121589202413630">date2 = datetime.datetime(2005,12,31)</paragraph> + <paragraph role="pycode" id="pyc_id641618564383315">diffDays = svc.DateDiff('d', date1, date2)</paragraph> + <paragraph role="pycode" id="pyc_id151618564392035">print(diffDays)</paragraph> + </pycode> +</section> +<section id="DatePart"> + <comment> DatePart ------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id691589202925124"> + <bookmark_value>Basic service;DatePart</bookmark_value> + </bookmark> + <h2 id="hd_id3615892029256" localize="false">DatePart</h2> + <paragraph role="paragraph" id="par_id81589202925519">The DatePart function returns a specified part of a date.</paragraph> + <h3 id="hd_id741589202925179" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" localize="false" id="par_id761618670376341"><input>svc.DatePart(interval: str, date: datetime, firstdayofweek = 1, firstweekofyear = 1): int</input></paragraph> + <h3 id="hd_id361618670449758" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id761618672192231"> <emph>interval</emph>: A string expression specifying the date interval, as detailed in above <literal>DateAdd</literal> method.</paragraph> + <paragraph role="paragraph" id="par_id61618672313838"> <emph>date</emph>: The date/time from which the result is calculated.</paragraph> + <paragraph role="paragraph" id="par_id511619445271897"> <emph>firstdayofweek, firstweekofyear</emph>: optional parameters that respectively specify the starting day of a week and the starting week of a year, as detailed in above <literal>DateDiff</literal> method.</paragraph> + <h3 id="hd_id911618670488437" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id791618672371743">The extracted part for the given date/time.</paragraph> + <h3 id="hd_id481589202925957" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="bascode" localize="false" id="pyc_id31589202925376">print(svc.DatePart("ww", datetime.datetime(2005,12,31)</paragraph> + <paragraph role="bascode" localize="false" id="pyc_id821589203188905">print(svc.DatePart('q', datetime.datetime(1999,12,30)</paragraph> + </pycode> +</section> +<section id="DateValue"> + <comment> DateValue ------------------------------------------------------------------------------ </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id141589203370367"> + <bookmark_value>Basic service;DateValue</bookmark_value> + </bookmark> + <h2 id="hd_id161589203370594" localize="false">DateValue</h2> + <paragraph role="paragraph" id="par_id121589203370778">Computes a date value from a date string.</paragraph> + <h3 id="hd_id851589203370467" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" localize="false" id="par_id721618673403017"><input>svc.DateValue(date: str): datetime</input></paragraph> + <h3 id="hd_id221589203370830" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <embed href="text/sbasic/shared/03030102.xhp#parm1"/> + <h3 id="hd_id151618673970234"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id441618674018955">The computed date.</paragraph> + <h3 id="hd_id911589203370485" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id81589203370943">dt = svc.DateValue("23-02-2011")</paragraph> + <paragraph role="pycode" id="pyc_id931618674563379">print(dt)</paragraph> + </pycode> +</section> +<section id="Format"> + <comment> Format --------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id71158920514765"> + <bookmark_value>Basic service;Format</bookmark_value> + </bookmark> + <h2 id="hd_id811529844547824" localize="false">Format</h2> + <paragraph role="paragraph" id="par_id458161678389887">Converts a number to a string, and then formats it according to the format that you specify.</paragraph> + <h3 id="hd_id871589205147745" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id901618678405855" localize="false"><input>svc.Format(expression: any, format = ''): str</input></paragraph> + <embed href="text/sbasic/shared/03120301.xhp#ValueParms"/> + <h3 id="hd_id751618825527776">Formatting Codes</h3> + <embed href="text/sbasic/shared/03120301.xhp#codes"/> + <h3 id="hd_id681618825574599">Predefined Formats</h3> + <embed href="text/sbasic/shared/03120301.xhp#formats"/> + <embed href="text/sbasic/shared/00000003.xhp#languageformat"/> + <h3 id="hd_id81985205147631" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id431589205147164">txt = svc.Format(6328.2, '##.##0.00')</paragraph> + <paragraph role="pycode" localize="false" id="pyc_id231618679147769">print(txt)</paragraph> + </pycode> +</section> +<section id="GetDefaultContext"> + <comment> GetDefaultContext ---------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id71158950214765"> + <bookmark_value>Basic service;GetDefaultContext</bookmark_value> + </bookmark> + <h2 id="hd_id811589205147428" localize="false">GetDefaultContext</h2> + <paragraph role="paragraph" id="par_id451618876389887">Returns the default context of the process service factory, if existent, else returns a null reference.</paragraph> + <paragraph role="paragraph" id="par_id881618848030897"><literal>GetDefaultContext</literal> is an alternative to the <link href="text/sbasic/python/python_programming.xhp" name="getComponentContext method">getComponentContext()</link> method available from <literal>XSCRIPTCONTEXT</literal> global variable or from <link href="text/sbasic/python/python_programming.xhp" name="uno.py module">uno.py</link> module.</paragraph> + <h3 id="hd_id871502985147745" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id901668178405855" localize="false"><input>svc.GetDefaultContext(): uno</input></paragraph> + <h3 id="hd_id81580295741136" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id381618831451271">The default component context is used, when instantiating services via <literal>XMultiServiceFactory</literal>. See the <literal>Professional UNO</literal> chapter in the Developer's Guide on <link href="https://api.libreoffice.org/" name="API Developer's Guide">api.libreoffice.org</link> for more information.</paragraph> + <h3 id="hd_id81589205147136" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id451389205147164">ctx = svc.GetDefaultContext()</paragraph> + </pycode> +</section> +<section id="GetGuiType"> + <comment> GetGuiType ----------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id11758950214765"> + <bookmark_value>Basic service;GetGuiType</bookmark_value> + </bookmark> + <h2 id="hd_id118589205147428" localize="false">GetGuiType</h2> + <paragraph role="paragraph" id="par_id154618876389887">Returns a numerical value that specifies the graphical user interface. This function is only provided for backward compatibility with previous versions.</paragraph> + <paragraph role="paragraph" id="par_id341618848532640">Refer to <literal>system()</literal> method from <literal>platform</literal> Python module to <link href="text/sbasic/python/python_platform.xhp" name="identify the operating system">identify the operating system</link>.</paragraph> + <h3 id="hd_id178502985147745" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id109668178405855" localize="false"><input>svc.GetGuiType(): int</input></paragraph> + <h3 id="hd_id51889205147136" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id154389205147164">n = svc.GetGuiType()</paragraph> + </pycode> +</section> +<section id="GetPathSeparator"> + <comment> GetPathSeparator ---------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id71158950214567"> + <bookmark_value>Basic service;GetPathSeparator</bookmark_value> + </bookmark> + <h2 id="hd_id811589205147824" localize="false">GetPathSeparator</h2> + <paragraph role="paragraph" id="par_id451618876389788">Returns the operating system-dependent directory separator used to specify file paths.</paragraph> + <paragraph role="paragraph" id="par_id341618848562340">Use <literal>os.pathsep</literal> from <literal>os</literal> Python module to <link href="text/sbasic/python/python_platform.xhp" name="path delimiter">identify the path separator</link>.</paragraph> + <h3 id="hd_id871502985147547" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id901668178405558" localize="false"><input>svc.GetPathSeparator(): str</input></paragraph> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id53158950247542">svc.GetPathSeparator(): str</paragraph> + </pycode> + <h3 id="hd_id81589205147631" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" localize="false" id="pyc_id451389205147461">sep = svc.GetPathSeparator()</paragraph> + </pycode> +</section> +<section id="GetSystemTicks"> + <comment> GetSystemTicks ------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id71155980214765"> + <bookmark_value>Basic service;GetSystemTicks</bookmark_value> + </bookmark> + <h2 id="hd_id811589503147428" localize="false">GetSystemTicks</h2> + <paragraph role="paragraph" id="par_id451618678389887">Returns the number of system ticks provided by the operating system. You can use this function to optimize certain processes. Use this method to estimate time in milliseconds:</paragraph> + <h3 id="hd_id871502589147745" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id901667188405855" localize="false"><input>svc.GetSystemTicks(): int</input></paragraph> + <h3 id="hd_id81589215047136" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" id="pyc_id251619448108905">ticks_ini = svc.GetSystemTicks()</paragraph> + <paragraph role="pycode" id="pyc_id181619448111210">time.sleep(1)</paragraph> + <paragraph role="pycode" id="pyc_id301619448111744">ticks_end = svc.GetSystemTicks()</paragraph> + <paragraph role="pycode" id="pyc_id651619448112320">svc.MsgBox("{} - {} = {}".format(ticks_end, ticks_ini,ticks_end - ticks_ini))</paragraph> + </pycode> +</section> +<section id="InputBox"> + <comment> InputBox ------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" branch="index" id="bm_id61618905164342"> + <bookmark_value>Basic service;InputBox</bookmark_value> + </bookmark> + <h2 id="hd_id311618905373414" localize="false">InputBox</h2> + <h3 id="hd_id821618905360069" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id91619007097426" localize="false"><input>svc.InputBox(prompt: str, [title: str], [default: str], [xpostwips: int, ypostwips: int]): str</input></paragraph> + <h3 id="hd_id101618905360959" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <embed href="text/sbasic/shared/03010201.xhp#parameters"/> + <h3 id="hd_id141618905361470" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id21619008398677">string</paragraph> + <h3 id="hd_id271618905361880" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <section id="ui"> + <pycode> + <paragraph role="pycode" id="pyc_id751619081201175" xml-lang="en-US">txt = s.InputBox('Please enter a phrase:', "Dear user")</paragraph> + <paragraph role="pycode" id="pyc_id261619081319555" xml-lang="en-US">s.MsgBox(txt, MB_ICONINFORMATION, "Confirmation of phrase")</paragraph> + </pycode> + <note id="par_id651618921455396">For in-depth information please refer to <link href="https://wiki.documentfoundation.org/Macros/General/IO_to_Screen" name="Input/Output to Screen with Python">Input/Output to Screen with Python</link> on the Wiki.</note> + </section> +</section> +<section id="MsgBox"> + <comment> MsgBox -------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" branch="index" id="bm_id681618905411293"> + <bookmark_value>Basic service;MsgBox</bookmark_value> + </bookmark> + <h2 id="hd_id181618br/905397758" localize="false">MsgBox</h2> + <paragraph role="paragraph" id="par_id231618922407948">Displays a dialog box containing a message and returns an optional value.<br/>MB_xx constants help specify the dialog type, the number and type of buttons to display, plus the icon type. By adding their respective values they form bit patterns, that define the <literal>MsgBox</literal> dialog appearance.</paragraph> + <h3 id="hd_id261618905383270" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id71618922431508" localize="false"><input>svc.MsgBox(prompt: str, buttons = svc.MB_OK, [title: str])[: int]</input></paragraph> + <h3 id="hd_id321618905384357" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <embed href="text/sbasic/shared/03010101.xhp#parameters"/> + <h3 id="hd_id811618905385054" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id711619082902143">An optional integer as detailed in above <literal>IDxx</literal> properties.</paragraph> + <h3 id="hd_id641618905386806" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <embed href="text/sbasic/shared/03/sf_basic.xhp#ui"/> +</section> +<section id="Now"> + <comment> Now ------------------------------------------------------------------------------------ </comment> + <bookmark xml-lang="en-US" branch="index" id="bm_id791618906935711"> + <bookmark_value>Basic service;Now</bookmark_value> + </bookmark> + <h2 id="hd_id231618906957248" localize="false">Now</h2> + <paragraph role="paragraph" id="par_id191619084216660">Returns the current system date and time as a date/time value.</paragraph> + <h3 id="hd_id501618906958266" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id631619084685488" localize="false"><input>svc.Now(): datetime</input></paragraph> + <h3 id="hd_id751618906958871" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" id="pyc_id411619084749448" localize="false">svc.MsgBox(svc.Now(), svc.MB_OK, "Now")</paragraph> + </pycode> +</section> +<section id="RGB"> + <comment> RGB ------------------------------------------------------------------------------------ </comment> + <bookmark xml-lang="en-US" branch="index" id="bm_id831618907521168"> + <bookmark_value>Basic service;RGB</bookmark_value> + </bookmark> + <h2 id="hd_id871618907784332" localize="false">RGB</h2> + <paragraph role="paragraph" id="par_id621619448293385">Returns an integer color value consisting of red, green, and blue components.</paragraph> + <h3 id="hd_id721618907785633" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id201619096429785"><input>svc.RGB(red:int, green: int, blue: int): int</input></paragraph> + <h3 id="hd_id211618907785860" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <embed href="text/sbasic/shared/03010305.xhp#parameters"/> + <h3 id="hd_id251618907786074" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3> + <paragraph role="paragraph" id="par_id381619096830033">integer</paragraph> + <paragraph role="paragraph" id="par_id391619096806737"></paragraph> + <h3 id="hd_id311618907786537" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" id="pyc_id321619096903721" localize="false">YELLOW = svc.RGB(255,255,0)</paragraph> + </pycode> +</section> +<section id="Xray"> + <comment> Xray ----------------------------------------------------------------------------------- </comment> + <bookmark xml-lang="en-US" branch="index" id="bm_id81618907851793"> + <bookmark_value>Basic service;Xray</bookmark_value> + </bookmark> + <h2 id="hd_id211618907871281" localize="false">Xray</h2> + <paragraph role="paragraph" id="par_id451619094057178">Inspect Uno objects or variables.</paragraph> + <h3 id="hd_id21618r907872329" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3> + <paragraph role="paragraph" id="par_id301619094111856" localize="false"><input>svc.Xray(obj: any)</input></paragraph> + <h3 id="hd_id861618907872626" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3> + <paragraph role="paragraph" id="par_id21619094660345"> <emph>obj</emph>: A variable or Uno object.</paragraph> + <h3 id="hd_id741618907873241" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3> + <pycode> + <paragraph role="pycode" id="pyc_id751619095024401" localize="false">svc.Xray(svc.StarDesktop)</paragraph> + </pycode> +</section> + <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/> + <section id="relatedtopics"> + <paragraph role="paragraph" id="par_id901618486941514"><link href="text/sbasic/python/python_programming.xhp" name="uno.fileUrlToSystemPath() method">uno.fileUrlToSystemPath() method</link></paragraph> + <paragraph role="paragraph" id="par_id901618496841514"><link href="text/sbasic/python/python_programming.xhp" name="uno.systemPathToFileUrl() method">uno.systemPathToFileUrl() method</link></paragraph> + <paragraph role="paragraph" id="par_id951618554355538"><link href="https://wiki.documentfoundation.org/Macros/General/IO_to_Screen" name="Input/Output to Screen with Python">Input/Output to Screen with Python</link> on the wiki</paragraph> + <paragraph role="paragraph" id="par_id610918486941514"><link href="text/sbasic/python/python_programming.xhp" name="XSCRIPTCONTEXT.getComponentContext() method">XSCRIPTCONTEXT.getComponentContext() method</link></paragraph> + <paragraph role="paragraph" id="par_id901618484961514"><link href="text/sbasic/python/python_programming.xhp" name="uno.getComponentContext() method">uno.getComponentContext() method</link></paragraph> + <paragraph role="paragraph" id="par_id901648186941514"><link href="text/sbasic/python/python_platform.xhp" name="platform.system() method">platform.system() method</link></paragraph> + <paragraph role="paragraph" id="par_id901816486941514"><link href="text/sbasic/python/python_platform.xhp" name="os.pathsep() method">os.pathsep() method</link></paragraph> + </section> +</body> +</helpdocument>
\ No newline at end of file diff --git a/source/text/sbasic/shared/03010101.xhp b/source/text/sbasic/shared/03010101.xhp index c87987c709..02fd4e041d 100644 --- a/source/text/sbasic/shared/03010101.xhp +++ b/source/text/sbasic/shared/03010101.xhp @@ -42,9 +42,11 @@ <section id="MsgBox_statement"> <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> -<paragraph id="par_id3148798" role="paragraph" xml-lang="en-US"> <emph>Prompt</emph>: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).</paragraph> -<paragraph id="par_id3150769" role="paragraph" xml-lang="en-US"> <emph>Title</emph>: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.</paragraph> -<paragraph id="par_id3147228" role="paragraph" xml-lang="en-US"> <emph>Buttons</emph>: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. <emph>Buttons</emph> represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:</paragraph> +<section id="parameters"> +<paragraph id="par_id3148798" role="paragraph" xml-lang="en-US"> <emph>prompt</emph>: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).</paragraph> +<paragraph id="par_id3150769" role="paragraph" xml-lang="en-US"> <emph>title</emph>: String expression displayed in the title bar of the dialog. If omitted, the title bar displays the name of the respective application.</paragraph> +<paragraph id="par_id3147228" role="paragraph" xml-lang="en-US"> <emph>buttons</emph>: Any integer expression that specifies the dialog type, as well as the number and type of buttons to display, and the icon type. <emph>Buttons</emph> represents a combination of bit patterns, that is, a combination of elements can be defined by adding their respective values:</paragraph> +</section> <table id="tbl_051220170220345412"> <tablerow> diff --git a/source/text/sbasic/shared/03010201.xhp b/source/text/sbasic/shared/03010201.xhp index 5e7ee3543d..84ac21c5e4 100644 --- a/source/text/sbasic/shared/03010201.xhp +++ b/source/text/sbasic/shared/03010201.xhp @@ -44,12 +44,14 @@ </bascode> <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> -<paragraph id="par_id3153311" role="paragraph" xml-lang="en-US"> <emph>Prompt</emph>: String expression displayed as the message in the dialog box.</paragraph> -<paragraph id="par_id3145315" role="paragraph" xml-lang="en-US"> <emph>Title</emph>: String expression displayed in the title bar of the dialog box.</paragraph> -<paragraph id="par_id3154307" role="paragraph" xml-lang="en-US"> <emph>Default</emph>: String expression displayed in the text box as default if no other input is given.</paragraph> -<paragraph id="par_id3147573" role="paragraph" xml-lang="en-US"> <emph>xPosTwips</emph>: Integer expression that specifies the horizontal position of the dialog. The position is an absolute coordinate and does not refer to the window of the office application.</paragraph> -<paragraph id="par_id3156024" role="paragraph" xml-lang="en-US"> <emph>yPosTwips</emph>: Integer expression that specifies the vertical position of the dialog. The position is an absolute coordinate and does not refer to the window of the office application.</paragraph> -<paragraph id="par_id3153897" role="paragraph" xml-lang="en-US">If <emph>xPosTwips</emph> and <emph>yPosTwips</emph> are omitted, the dialog is centered on the screen. The position is specified in <link href="text/sbasic/shared/00000002.xhp#twips" name="twips">twips</link>.</paragraph> +<section id="parameters"> +<paragraph id="par_id3153311" role="paragraph" xml-lang="en-US"> <emph>prompt</emph>: String expression displayed as the message in the dialog box.</paragraph> +<paragraph id="par_id3145315" role="paragraph" xml-lang="en-US"> <emph>title</emph>: String expression displayed in the title bar of the dialog box.</paragraph> +<paragraph id="par_id3154307" role="paragraph" xml-lang="en-US"> <emph>default</emph>: String expression displayed in the text box as default if no other input is given.</paragraph> +<paragraph id="par_id3147573" role="paragraph" xml-lang="en-US"> <emph>xpostwips</emph>: Integer expression that specifies the horizontal position of the dialog. The position is an absolute coordinate and does not refer to the window of the office application.</paragraph> +<paragraph id="par_id3156024" role="paragraph" xml-lang="en-US"> <emph>ypostwips</emph>: Integer expression that specifies the vertical position of the dialog. The position is an absolute coordinate and does not refer to the window of the office application.</paragraph> +<paragraph id="par_id3153897" role="paragraph" xml-lang="en-US">If <literal>xpostwips</literal> and <literal>yPosTwips</literal> are omitted, the dialog is centered on the screen. The position is specified in <link href="text/sbasic/shared/00000002.xhp#twips" name="twips">twips</link>.</paragraph> +</section> <embed href="text/sbasic/shared/00000003.xhp#functvalue"/> <paragraph id="par_id3145090" role="paragraph" xml-lang="en-US">String</paragraph> diff --git a/source/text/sbasic/shared/03010305.xhp b/source/text/sbasic/shared/03010305.xhp index 337e079929..093ea3d7ce 100644 --- a/source/text/sbasic/shared/03010305.xhp +++ b/source/text/sbasic/shared/03010305.xhp @@ -46,10 +46,12 @@ <paragraph id="par_id3159153" role="paragraph" xml-lang="en-US">Long</paragraph> <paragraph id="hd_id3154013" role="heading" level="2" xml-lang="en-US">Parameter:</paragraph> -<paragraph id="par_id3152597" role="paragraph" xml-lang="en-US"> <emph>Red</emph>: Any integer expression that represents the red component (0-255) of the composite color.</paragraph> -<paragraph id="par_id3146974" role="paragraph" xml-lang="en-US"> <emph>Green</emph>: Any integer expression that represents the green component (0-255) of the composite color.</paragraph> -<paragraph id="par_id3151113" role="paragraph" xml-lang="en-US"> <emph>Blue</emph>: Any integer expression that represents the blue component (0-255) of the composite color.</paragraph> +<section id="parameters"> +<paragraph id="par_id3152597" role="paragraph" xml-lang="en-US"> <emph>red</emph>: Any integer expression that represents the red component (0-255) of the composite color.</paragraph> +<paragraph id="par_id3146974" role="paragraph" xml-lang="en-US"> <emph>green</emph>: Any integer expression that represents the green component (0-255) of the composite color.</paragraph> +<paragraph id="par_id3151113" role="paragraph" xml-lang="en-US"> <emph>blue</emph>: Any integer expression that represents the blue component (0-255) of the composite color.</paragraph> <tip id="par_id211587653651037">The <link href="text/shared/optionen/01010501.xhp" name="color picker dialog">color picker dialog</link> helps computing red, green and blue components of a composite color. <link href="text/shared/guide/text_color.xhp" name="Changing the color of text">Changing the color of text</link> and selecting <emph>Custom color</emph> displays the color picker dialog.</tip> +</section> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> diff --git a/source/text/sbasic/shared/03030102.xhp b/source/text/sbasic/shared/03030102.xhp index b8332eba19..664e122cf2 100644 --- a/source/text/sbasic/shared/03030102.xhp +++ b/source/text/sbasic/shared/03030102.xhp @@ -20,38 +20,42 @@ <helpdocument version="1.0"> <meta> -<topic id="textsbasicshared03030102xml" indexer="include" status="PUBLISH"> -<title id="tit" xml-lang="en-US">DateValue Function</title> -<filename>/text/sbasic/shared/03030102.xhp</filename> + <topic id="textsbasicshared03030102xml" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">DateValue Function</title> + <filename>/text/sbasic/shared/03030102.xhp</filename> </topic> <history> <created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created> </history> </meta> <body> + <section id="datevalue"> -<bookmark xml-lang="en-US" branch="index" id="bm_id3156344"><bookmark_value>DateValue function</bookmark_value> -</bookmark> -<paragraph role="heading" id="hd_id3156344" xml-lang="en-US" level="1"><link href="text/sbasic/shared/03030102.xhp" name="DateValue Function">DateValue Function</link></paragraph> -<paragraph role="paragraph" id="par_id3150542" xml-lang="en-US">Returns a date value from a date string. The date string is a complete date in a single numeric value. You can also use this serial number to determine the difference between two dates.</paragraph> + <bookmark xml-lang="en-US" branch="index" id="bm_id3156344"><bookmark_value>DateValue function</bookmark_value> + </bookmark> + <h1 id="hd_id3156344"><link href="text/sbasic/shared/03030102.xhp" name="DateValue Function">DateValue Function</link></h1> + <paragraph role="paragraph" id="par_id3150542" xml-lang="en-US">Returns a date value from a date string. The date string is a complete date in a single numeric value. You can also use this serial number to determine the difference between two dates.</paragraph> </section> -<paragraph role="heading" id="hd_id3148799" xml-lang="en-US" level="2">Syntax:</paragraph> + +<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <bascode> -<paragraph role="bascode" id="par_id3154910" xml-lang="en-US">DateValue [(date)]</paragraph> + <paragraph role="bascode" id="par_id3154910" xml-lang="en-US">DateValue(date)</paragraph> </bascode> -<paragraph role="heading" id="hd_id3150870" xml-lang="en-US" level="2">Return value:</paragraph> -<paragraph role="paragraph" id="par_id3153194" xml-lang="en-US">Date<comment>i66764</comment></paragraph> -<paragraph role="heading" id="hd_id3153969" xml-lang="en-US" level="2">Parameters:</paragraph> -<paragraph role="paragraph" id="par_id3153770" xml-lang="en-US"> - <emph>Date:</emph> String expression that contains the date that you want to calculate. In contrast to the DateSerial function that passes years, months and days as separate numeric values, the DateValue function requests the date string to be according to either one of the date acceptance patterns defined for your locale setting (see <switchinline select="sys"><caseinline select="MAC"><menuitem>%PRODUCTNAME - Preferences</menuitem></caseinline><defaultinline><menuitem>Tools - Options</menuitem></defaultinline></switchinline><menuitem> - Language Settings - Languages</menuitem>) or to ISO date format (momentarily, only the ISO format with hyphens, e.g. "2012-12-31" is accepted).</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functparameters"/> +<section id="parm1"> + <paragraph role="paragraph" id="par_id3153770"><emph>Date</emph>: String expression that contains the date that you want to calculate. In contrast to the DateSerial function that passes years, months and days as separate numeric values, the DateValue function requests the date string to be according to either one of the date acceptance patterns defined for your locale setting (see <switchinline select="sys"><caseinline select="MAC"><menuitem>%PRODUCTNAME - Preferences</menuitem></caseinline><defaultinline><menuitem>Tools - Options</menuitem></defaultinline></switchinline><menuitem> - Language Settings - Languages</menuitem>) or to ISO date format (momentarily, only the ISO format with hyphens, e.g. "2012-12-31" is accepted).</paragraph> +</section> +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> +<paragraph role="paragraph" id="par_id3153194">The computed date.<comment>i66764</comment></paragraph> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> -<paragraph role="heading" id="hd_id3153142" xml-lang="en-US" level="2">Example:</paragraph> +<embed href="text/sbasic/shared/00000003.xhp#functexample"/> <bascode> -<paragraph role="bascode" id="par_id3155412" xml-lang="en-US" localize="false">Sub ExampleDateValue</paragraph> -<paragraph role="bascode" id="par_id3153363" xml-lang="en-US" localize="false"> MsgBox DateValue("12/02/2011")</paragraph> -<paragraph role="bascode" id="par_id3149262" xml-lang="en-US" localize="false">End Sub</paragraph> + <paragraph role="bascode" id="par_id3155412" xml-lang="en-US" localize="false">Sub ExampleDateValue</paragraph> + <paragraph role="bascode" id="par_id3153363" xml-lang="en-US" localize="false"> MsgBox DateValue("23/02/2011")</paragraph> + <paragraph role="bascode" id="par_id3149262" xml-lang="en-US" localize="false">End Sub</paragraph> </bascode> + </body> </helpdocument> diff --git a/source/text/sbasic/shared/03030120.xhp b/source/text/sbasic/shared/03030120.xhp index e1e8a2c894..04f6fd4dea 100644 --- a/source/text/sbasic/shared/03030120.xhp +++ b/source/text/sbasic/shared/03030120.xhp @@ -27,7 +27,6 @@ <body> - <section id="datediff"> <bookmark xml-lang="en-US" branch="index" id="bm_id6134830"> <bookmark_value>DateDiff function</bookmark_value> @@ -52,12 +51,12 @@ <embed href="text/sbasic/shared/01020100.xhp#DateLiterals"/> <section id="weekyear"> -<paragraph id="par_idN1066A" role="paragraph" xml-lang="en-US"> <emph>firstDayOfWeek</emph> - An optional parameter that specifies the starting day of a week. </paragraph> +<paragraph id="par_idN1066A" role="paragraph" xml-lang="en-US"> <emph>firstdayofweek</emph>: An optional parameter that specifies the starting day of a week. </paragraph> <table id="tbl_id8356883"> <tablerow> <tablecell> - <paragraph id="par_idN1067A" role="tablehead" xml-lang="en-US">firstDayOfWeek value</paragraph> + <paragraph id="par_idN1067A" role="tablehead" xml-lang="en-US">firstdayofweek value</paragraph> </tablecell> <tablecell> <paragraph id="par_idN10680" role="tablehead" xml-lang="en-US">Explanation</paragraph> @@ -129,12 +128,12 @@ </tablerow> </table> -<paragraph id="par_idN106EB" role="paragraph" xml-lang="en-US"> <emph>firstWeekOfYear</emph> - An optional parameter that specifies the starting week of a year. </paragraph> +<paragraph id="par_idN106EB" role="paragraph" xml-lang="en-US"> <emph>firstweekofyear</emph>: An optional parameter that specifies the starting week of a year. </paragraph> <table id="tbl_id1173436"> <tablerow> <tablecell> - <paragraph id="par_idN106FB" role="tablehead" xml-lang="en-US">firstWeekOfYear value</paragraph> + <paragraph id="par_idN106FB" role="tablehead" xml-lang="en-US">firstweekofyear value</paragraph> </tablecell> <tablecell> <paragraph id="par_idN10701" role="tablehead" xml-lang="en-US">Explanation</paragraph> diff --git a/source/text/sbasic/shared/03120301.xhp b/source/text/sbasic/shared/03120301.xhp index 018e8ccc91..507fd78ecc 100644 --- a/source/text/sbasic/shared/03120301.xhp +++ b/source/text/sbasic/shared/03120301.xhp @@ -35,51 +35,58 @@ <h1 id="hd_id3153539"><link href="text/sbasic/shared/03120301.xhp" name="Format Function">Format Function</link></h1> -<paragraph id="par_id3156042" role="paragraph" xml-lang="en-US">Converts a number to a string, and then formats it according to the format that you specify.</paragraph> +<paragraph id="par_id3156042" role="paragraph" xml-lang="en-US">Converts a numeric expression to a string, and then formats it according to the format that you specify.</paragraph> </section> <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> <bascode> -<paragraph id="par_id3153527" role="bascode" xml-lang="en-US">Format (Number [, Format As String])</paragraph> +<paragraph id="par_id3153527" role="bascode" xml-lang="en-US">Format(expression [, format As String]) As String</paragraph> </bascode> -<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> -<paragraph id="par_id3148474" role="paragraph" xml-lang="en-US">String</paragraph> - +<section id="ValueParms"> <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> -<paragraph id="par_id3149415" role="paragraph" xml-lang="en-US"> <emph>Number:</emph> Numeric expression that you want to convert to a formatted string.</paragraph> -<paragraph id="par_id3147531" role="paragraph" xml-lang="en-US"> <emph>Format:</emph> String that specifies the format code for the number. If <emph>Format</emph> is omitted, the Format function works like the <emph>Str</emph> function.</paragraph> +<paragraph id="par_id3149415" role="paragraph" xml-lang="en-US"> <emph>expression</emph>: Numeric expression that you want to convert to a formatted string.</paragraph> +<paragraph id="par_id3147531" role="paragraph" xml-lang="en-US"> <emph>format</emph>: String that specifies the format code for the number. If <literal>format</literal> is omitted, the Format function works like the %PRODUCTNAME Basic <literal>Str()</literal> function.</paragraph> + +<embed href="text/sbasic/shared/00000003.xhp#functvalue"/> +<paragraph id="par_id3148474" role="paragraph" xml-lang="en-US">Text string.</paragraph> +</section> <h2 id="hd_id3147561">Formatting Codes</h2> -<paragraph id="par_id3147265" role="paragraph" xml-lang="en-US">The following list describes the codes that you can use for formatting a number:</paragraph> -<paragraph id="par_id3153380" role="paragraph" xml-lang="en-US"> <emph>0:</emph> If <emph>Number</emph> has a digit at the position of the 0 in the format code, the digit is displayed, otherwise a zero is displayed.</paragraph> -<paragraph id="par_id3151210" role="paragraph" xml-lang="en-US">If <emph>Number</emph> has fewer digits than the number of zeros in the format code, (on either side of the decimal), leading or trailing zeros are displayed. If the number has more digits to the left of the decimal separator than the amount of zeros in the format code, the additional digits are displayed without formatting.</paragraph> -<paragraph id="par_id3151176" role="paragraph" xml-lang="en-US">Decimal places in the number are rounded according to the number of zeros that appear after the decimal separator in the <emph>Format </emph>code.</paragraph> -<paragraph id="par_id3154123" role="paragraph" xml-lang="en-US"> <emph>#:</emph> If <emph>Number</emph> contains a digit at the position of the # placeholder in the <emph>Format</emph> code, the digit is displayed, otherwise nothing is displayed at this position.</paragraph> -<paragraph id="par_id3148452" role="paragraph" xml-lang="en-US">This symbol works like the 0, except that leading or trailing zeroes are not displayed if there are more # characters in the format code than digits in the number. Only the relevant digits of the number are displayed.</paragraph> +<section id="codes"> +<paragraph id="par_id3147265" role="paragraph" xml-lang="en-US">The following list describes the codes that you can use for formatting a numeric expression:</paragraph> +<paragraph id="par_id3153380" role="paragraph" xml-lang="en-US"> <emph>0:</emph> If <literal>expression</literal> has a digit at the position of the 0 in the <literal>format</literal> code, the digit is displayed, otherwise a zero is displayed.</paragraph> +<paragraph id="par_id3151210" role="paragraph" xml-lang="en-US">If <literal>expression</literal> has fewer digits than the number of zeros in the <literal>format</literal> code, (on either side of the decimal), leading or trailing zeros are displayed. If the <literal>expression</literal> has more digits to the left of the decimal separator than the amount of zeros in the <literal>format</literal> code, the additional digits are displayed without formatting.</paragraph> +<paragraph id="par_id3151176" role="paragraph" xml-lang="en-US">Decimal places in the <literal>expression</literal> are rounded according to the number of zeros that appear after the decimal separator in the <literal>format</literal> code.</paragraph> +<paragraph id="par_id3154123" role="paragraph" xml-lang="en-US"> <emph>#:</emph> If <literal>expression</literal> contains a digit at the position of the # placeholder in the <literal>format</literal> code, the digit is displayed, otherwise nothing is displayed at this position.</paragraph> +<paragraph id="par_id3148452" role="paragraph" xml-lang="en-US">This symbol works like the 0, except that leading or trailing zeroes are not displayed if there are more # characters in the <literal>format</literal> code than digits in the <literal>expression</literal>. Only the relevant digits of the <literal>expression</literal> are displayed.</paragraph> <paragraph id="par_id3159150" role="paragraph" xml-lang="en-US"> <emph>.:</emph> The decimal placeholder determines the number of decimal places to the left and right of the decimal separator.</paragraph> -<paragraph id="par_id3159252" role="paragraph" xml-lang="en-US">If the format code contains only # placeholders to the left of this symbol, numbers less than 1 begin with a decimal separator. To always display a leading zero with fractional numbers, use 0 as a placeholder for the first digit to the left of the decimal separator.</paragraph> -<paragraph id="par_id3153368" role="paragraph" xml-lang="en-US"> <emph>%:</emph> Multiplies the number by 100 and inserts the percent sign (%) where the number appears in the format code.</paragraph> -<paragraph id="par_id3149481" role="paragraph" xml-lang="en-US"> <emph>E- E+ e- e+ :</emph> If the format code contains at least one digit placeholder (0 or #) to the right of the symbol E-, E+, e-, or e+, the number is formatted in the scientific or exponential format. The letter E or e is inserted between the number and the exponent. The number of placeholders for digits to the right of the symbol determines the number of digits in the exponent.</paragraph> +<paragraph id="par_id3159252" role="paragraph" xml-lang="en-US">If the <literal>format</literal> code contains only # placeholders to the left of this symbol, numbers less than 1 begin with a decimal separator. To always display a leading zero with fractional numbers, use 0 as a placeholder for the first digit to the left of the decimal separator.</paragraph> +<paragraph id="par_id3153368" role="paragraph" xml-lang="en-US"> <emph>%:</emph> Multiplies the <literal>expression</literal>by 100 and inserts the percent sign (%) where the <literal>expression</literal> appears in the <literal>format</literal> code.</paragraph> +<paragraph id="par_id3149481" role="paragraph" xml-lang="en-US"> <emph>E- E+ e- e+ :</emph> If the <literal>format</literal> code contains at least one digit placeholder (0 or #) to the right of the symbol E-, E+, e-, or e+, the <literal>expression</literal> is formatted in the scientific or exponential format. The letter E or e is inserted between the number and the exponent. The number of placeholders for digits to the right of the symbol determines the number of digits in the exponent.</paragraph> <paragraph id="par_id3149262" role="paragraph" xml-lang="en-US">If the exponent is negative, a minus sign is displayed directly before an exponent with E-, E+, e-, e+. If the exponent is positive, a plus sign is only displayed before exponents with E+ or e+.</paragraph> -<paragraph id="par_id3148617" role="paragraph" xml-lang="en-US">The thousands delimiter is displayed if the format code contains the delimiter enclosed by digit placeholders (0 or #).</paragraph> +<paragraph id="par_id3148617" role="paragraph" xml-lang="en-US">The thousands delimiter is displayed if the <literal>format</literal> code contains the delimiter enclosed by digit placeholders (0 or #).</paragraph> <paragraph id="par_id3163713" role="paragraph" xml-lang="en-US">The use of a period as a thousands and decimal separator is dependent on the regional setting. When you enter a number directly in Basic source code, always use a period as decimal delimiter. The actual character displayed as a decimal separator depends on the number format in your system settings.</paragraph> -<paragraph id="par_id3152887" role="paragraph" xml-lang="en-US"> <emph>- + $ ( ) space:</emph> A plus (+), minus (-), dollar ($), space, or brackets entered directly in the format code is displayed as a literal character.</paragraph> +<paragraph id="par_id3152887" role="paragraph" xml-lang="en-US"> <emph>- + $ ( ) space:</emph> A plus (+), minus (-), dollar ($), space, or brackets entered directly in the <literal>format</literal> code is displayed as a literal character.</paragraph> <paragraph id="par_id3148576" role="paragraph" xml-lang="en-US">To display characters other than the ones listed here, you must precede it by a backslash (\), or enclose it in quotation marks (" ").</paragraph> -<paragraph id="par_id3153139" role="paragraph" xml-lang="en-US">\ : The backslash displays the next character in the format code.</paragraph> -<paragraph id="par_id3153366" role="paragraph" xml-lang="en-US">Characters in the format code that have a special meaning can only be displayed as literal characters if they are preceded by a backslash. The backslash itself is not displayed, unless you enter a double backslash (\\) in the format code.</paragraph> +<paragraph id="par_id3153139" role="paragraph" xml-lang="en-US"> <emph>\ :</emph> The backslash displays the next character in the <literal>format</literal> code.</paragraph> +<paragraph id="par_id3153366" role="paragraph" xml-lang="en-US">Characters in the <literal>format</literal> code that have a special meaning can only be displayed as literal characters if they are preceded by a backslash. The backslash itself is not displayed, unless you enter a double backslash (\\) in the format code.</paragraph> <paragraph id="par_id3155411" role="paragraph" xml-lang="en-US">Characters that must be preceded by a backslash in the format code in order to be displayed as literal characters are date- and time-formatting characters (a, c, d, h, m, n, p, q, s, t, w, y, /, :), numeric-formatting characters (#, 0, %, E, e, comma, period), and string-formatting characters (@, &, <, >, !).</paragraph> -<paragraph id="par_id3145749" role="paragraph" xml-lang="en-US">You can also use the following predefined number formats. Except for "General Number", all of the predefined format codes return the number as a decimal number with two decimal places.</paragraph> -<paragraph id="par_id3150113" role="paragraph" xml-lang="en-US">If you use predefined formats, the name of the format must be enclosed in quotation marks.</paragraph> +<paragraph id="par_id3145749" role="paragraph" xml-lang="en-US">You can also use the following predefined number formats. Except for <literal>"General Number"</literal>, all of the predefined format codes return the number as a decimal number with two decimal places.</paragraph> +<paragraph id="par_id3150113" role="paragraph" xml-lang="en-US">If you use predefined formats, the name of the <literal>format</literal> must be enclosed in quotation marks.</paragraph> +</section> <h2 id="hd_id3149377">Predefined format</h2> +<section id="formats"> <paragraph id="par_id3154730" role="paragraph" xml-lang="en-US"> <emph>General Number:</emph> Numbers are displayed as entered.</paragraph> <paragraph id="par_id3153158" role="paragraph" xml-lang="en-US"> <emph>Currency:</emph> Inserts a dollar sign in front of the number and encloses negative numbers in brackets.</paragraph> <paragraph id="par_id3154490" role="paragraph" xml-lang="en-US"> <emph>Fixed:</emph> Displays at least one digit in front of the decimal separator.</paragraph> <paragraph id="par_id3153415" role="paragraph" xml-lang="en-US"> <emph>Standard:</emph> Displays numbers with a thousands separator.</paragraph> <paragraph id="par_id3150715" role="paragraph" xml-lang="en-US"> <emph>Percent:</emph> Multiplies the number by 100 and appends a percent sign to the number.</paragraph> <paragraph id="par_id3153836" role="paragraph" xml-lang="en-US"> <emph>Scientific:</emph> Displays numbers in scientific format (for example, 1.00E+03 for 1000).</paragraph> -<paragraph id="par_id3153707" role="paragraph" xml-lang="en-US">A format code can be divided into three sections that are separated by semicolons. The first part defines the format for positive values, the second part for negative values, and the third part for zero. If you only specify one format code, it applies to all numbers.</paragraph> +<paragraph id="par_id3153707" role="paragraph" xml-lang="en-US">A <literal>format</literal> code can be divided into three sections that are separated by semicolons. The first part defines the format for positive values, the second part for negative values, and the third part for zero. If you only specify one <literal>format</literal> code, it applies to all numbers.</paragraph> +</section> + <embed href="text/sbasic/shared/00000003.xhp#languageformat"/> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err5"/> |