summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/sbasic/shared/03/sf_ui.xhp
diff options
context:
space:
mode:
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03/sf_ui.xhp')
-rw-r--r--helpcontent2/source/text/sbasic/shared/03/sf_ui.xhp704
1 files changed, 704 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03/sf_ui.xhp b/helpcontent2/source/text/sbasic/shared/03/sf_ui.xhp
new file mode 100644
index 000000000..313577f48
--- /dev/null
+++ b/helpcontent2/source/text/sbasic/shared/03/sf_ui.xhp
@@ -0,0 +1,704 @@
+<?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_UI" indexer="include" status="PUBLISH">
+ <title id="tit" xml-lang="en-US">ScriptForge.UI service</title>
+ <filename>/text/sbasic/shared/03/sf_ui.xhp</filename>
+ </topic>
+</meta>
+<body>
+<section id="abstract">
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id151587913266190">
+ <bookmark_value>UI service</bookmark_value>
+ </bookmark>
+
+<h1 id="hd_id371587913266310" xml-lang="en-US"><variable id="UIService"><link href="text/sbasic/shared/03/sf_ui.xhp" name="ScriptForge.UI service"><literal>ScriptForge</literal>.<literal>UI</literal> service</link></variable></h1>
+
+<paragraph role="paragraph" xml-lang="en-US" id="par_id31587913266153">The UI (User Interface) service simplifies the identification and the manipulation of the different windows composing the whole %PRODUCTNAME application:</paragraph>
+<list type="unordered">
+ <listitem>
+ <paragraph role="listitem" id="par_id591587913266547" xml-lang="en-US">Windows selection</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id511587913266292" xml-lang="en-US">Windows moving and resizing</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id51587913266596" xml-lang="en-US">Statusbar settings</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id401599404339702" role="listitem" xml-lang="en-US">Display of a floating progress bar</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id761587913266388" xml-lang="en-US">Creation of new windows</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id591587913266489" xml-lang="en-US">Access to the underlying "documents"</paragraph>
+ </listitem>
+</list>
+</section>
+
+<tip id="par_id181620312953395">The UI service is the starting point to open, create or access to the content of new or existing documents from a user script.</tip>
+
+<h2 id="hd_id881587913266307">Definitions</h2>
+
+<section id="WindowName">
+ <h3 id="hd_id761587913266887" localize="false">WindowName</h3>
+ <paragraph role="paragraph" id="par_id741587913266919">A window can be designated using various ways:</paragraph>
+ <list type="unordered">
+ <listitem>
+ <paragraph role="listitem" id="par_id291587913946648" xml-lang="en-US">a full path and file name</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id991587914045862" xml-lang="en-US">the last component of the full file name or even only the last component without its suffix</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id541587914079744" xml-lang="en-US">the title of the window</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id191587914134221" xml-lang="en-US">for new documents, something like "Untitled 1"</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph role="listitem" id="par_id911587914185746" xml-lang="en-US">one of the special windows "<literal>BASICIDE</literal>" and "<literal>WELCOMESCREEN</literal>"</paragraph>
+ </listitem>
+ </list>
+ <paragraph role="paragraph" id="par_id181587914255236" xml-lang="en-US">The window name is case-sensitive.</paragraph>
+ <h3 id="hd_id541588520711430" xml-lang="en-US">Document object</h3>
+</section>
+ <paragraph role="paragraph" id="par_id841588521238711" xml-lang="en-US">The methods <literal>CreateDocument</literal>, <literal>CreateBaseDocument</literal>, <literal>GetDocument</literal>, <literal>OpenBaseDocument</literal> and <literal>OpenDocument</literal>, described below, generate document objects. When a window contains a document, an instance of the <literal>Document</literal> class represents that document. A counterexample the Basic IDE is not a document but is a window in our terminology. Additionally a document has a type: <literal>Calc</literal>, <literal>Impress</literal>, <literal>Writer</literal>, ...</paragraph>
+ <paragraph role="paragraph" id="par_id331588521254916" xml-lang="en-US">The specific properties and methods applicable on documents are implemented in a document class.</paragraph>
+ <tip id="par_id971588521292976" xml-lang="en-US">The implementation of the document objects class is done in the <literal>SFDocuments</literal> associated library. See its "<literal>Document</literal>" service.</tip>
+
+<h2 id="hd_id91587913266988" xml-lang="en-US">Service invocation</h2>
+ <paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>UI</literal> service the <literal>ScriptForge</literal> library needs to be loaded or imported:</paragraph>
+ <embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#importLibs"/>
+
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id391587913266269">Dim ui As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id851582897798335">GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id1001587913266355">Set ui = CreateScriptService("UI")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id61620310677393">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id601620310674922">ui = CreateScriptService("UI")</paragraph>
+ </pycode>
+
+<h2 id="hd_id841587913266618" xml-lang="en-US">Properties</h2>
+ <table id="tab_id291587913266435">
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id521587913266568" role="tablehead" xml-lang="en-US">Name</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587913266368" role="tablehead" xml-lang="en-US">ReadOnly</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id631587914939732" role="tablehead" xml-lang="en-US">Type</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id951587913266220" role="tablehead" xml-lang="en-US">Description</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161587913266162" role="tablecontent" localize="false">ActiveWindow</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id651587913266754" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587914989890" role="tablecontent" localize="false">String</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id351587913266349" role="tablecontent" xml-lang="en-US">a valid and unique <literal>WindowName</literal> for the currently active window. When the window cannot be identified, a zero-length string is returned.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161597813266162" role="tablecontent" localize="false">Documents</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id658517913266754" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587994189890" role="tablecontent" localize="false">String array</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id153587913266349" role="tablecontent" xml-lang="en-US">The list of the currently open documents. Special windows are ignored. This list consists of a zero-based one dimensional array either of filenames (in SF_FileSystem.FileNaming notation) or of window titles for unsaved documents.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161587913266563" role="tablecontent" localize="false">Height</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id651587913266945" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587914989732" role="tablecontent" localize="false">Integer</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id351587913266211" role="tablecontent" xml-lang="en-US">Returns the height of the active window in pixels.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161587913266574" role="tablecontent" localize="false">Width</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id651587913266645" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587914989935" role="tablecontent" localize="false">Integer</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id351587913266036" role="tablecontent" xml-lang="en-US">Returns the width of the active window in pixels.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161587913266096" role="tablecontent" localize="false">X</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id651587913266312" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587914989789" role="tablecontent" localize="false">Integer</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id351587913266296" role="tablecontent" xml-lang="en-US">Returns the X coordinate of the active window, which is the distance to the left edge of the screen in pixels.</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id161587913266323" role="tablecontent" localize="false">Y</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id651587913266670" role="tablecontent" xml-lang="en-US">Yes</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id421587914989902" role="tablecontent" localize="false">Integer</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id351587913266216" role="tablecontent" xml-lang="en-US">Returns the Y coordinate of the active window, which is the distance to the top edge of the screen in pixels. This value does not consider window decorations added by your operating system, so even when the window is maximized this value may not be zero.</paragraph>
+ </tablecell>
+ </tablerow>
+ </table>
+
+<section id="Constants">
+<h2 id="hd_id511620762163390">Constants</h2>
+<table id="tab_id51620761856238">
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id761620761856238" role="tablehead">Name</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id591620761856238" role="tablehead">Value</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id711620761856238" role="tablehead">Description</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id511620761856238" localize="false" role="tablecontent">MACROEXECALWAYS</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id761620761856107" localize="false" role="tablecontent">2</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id341620761856238" role="tablecontent">Macros are always executed</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id661620761881513" localize="false" role="tablecontent">MACROEXECNEVER</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id661620761891082" localize="false" role="tablecontent">1</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id101620761893011" role="tablecontent">Macros are never executed</paragraph>
+ </tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell>
+ <paragraph id="par_id311620761888379" localize="false" role="tablecontent">MACROEXECNORMAL</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id951620761899067" localize="false" role="tablecontent">0</paragraph>
+ </tablecell>
+ <tablecell>
+ <paragraph id="par_id11620761899780" role="tablecontent">Macro execution depends on user settings</paragraph>
+ </tablecell>
+ </tablerow>
+</table>
+</section>
+
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id311620312548992">The examples below show a <literal>MsgBox</literal> with the names of all currently open documents.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id201587985861232">Dim openDocs as Object, strDocs as String</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id261587985839734">Set openDocs = ui.Documents()</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id621587985950181">strDocs = openDocs(0)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id11587985956383">For i = 1 to UBound(openDocs)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id981620312219531"> strDocs = strDocs &amp; Chr(10) &amp; openDocs(i)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id341587985962974">Next i</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id191620312244070">MsgBox strDocs</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id21620312350189">ui = CreateScriptService("UI")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id631620312351013">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id141620312351286">openDocs = ui.Documents()</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id661620312351500">strDocs = "\n".join(openDocs)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id801620312351676">bas.MsgBox(strDocs)</paragraph>
+ </pycode>
+
+ <table id="tab_id891606472825856">
+ <tablerow>
+ <tablecell colspan="3"><paragraph id="par_id881608131596153" role="tablehead">List of Methods in the UI Service</paragraph></tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell><paragraph id="par_id381606472825856" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_ui.xhp#Activate" name="Activate method">Activate</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#CreateBaseDocument" name="CreateBaseDocument method">CreateBaseDocument</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#CreateDocument" name="CreateDocument method">CreateDocument</link> (*)<br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#GetDocument" name="GetDocument method">GetDocument</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#Maximize" name="Maximize method">Maximize</link>
+ </paragraph></tablecell>
+ <tablecell><paragraph id="par_id451606472825856" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_ui.xhp#Minimize" name="Minimize method">Minimize</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#OpenBaseDocument" name="OpenBaseDocument method">OpenBaseDocument</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#OpenDocument" name="OpenDocument method">OpenDocument</link> (*)<br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#Resize" name="Resize method">Resize</link><br/><br/>
+ </paragraph></tablecell>
+ <tablecell><paragraph id="par_id161606472825856" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_ui.xhp#RunCommand" name="RunCommand method">RunCommand</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#SetStatusBar" name="SetStatusBar method">SetStatusBar</link> (*)<br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#ShowProgressBar" name="ShowProgressBar method">ShowProgressBar</link><br/>
+ <link href="text/sbasic/shared/03/sf_ui.xhp#WindowExists" name="WindowExists method">WindowExists</link><br/><br/>
+ </paragraph></tablecell>
+ </tablerow>
+ </table>
+<warning id="par_id431620322170443">Note, as an exception, that the methods marked <emph>(*)</emph> are <emph>not applicable to Base documents</emph>.</warning>
+
+<section id="Activate">
+ <comment> Activate -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id991587913266189">
+ <bookmark_value>UI service;Activate</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id76158791326673" localize="false">Activate</h2>
+ <paragraph role="paragraph" id="par_id201587913266596">Make the specified window active. The method returns <literal>True</literal> if the given window is found and can be activated. There is no change in the actual user interface if no window matches the selection.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id331620319796672">
+ <input>svc.Activate(windowname: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id381587913266946"><emph>windowname</emph>: see the definitions above.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id201587913266745">ui.Activate("C:\Documents\My file.odt")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id941620322846267">ui.Activate(r"C:\Documents\My file.odt")</paragraph>
+ </pycode>
+</section>
+
+<section id="CreateBaseDocument">
+ <comment> CreateBaseDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id871596554849122">
+ <bookmark_value>UI service;CreateBaseDocument</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id281596554849363" localize="false">CreateBaseDocument</h2>
+ <paragraph role="paragraph" id="par_id13159655484952">Creates and stores a new %PRODUCTNAME Base document embedding an empty database of the given type. The method returns a <literal>Document</literal> service instance.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id461620320014911">
+ <input>svc.CreateBaseDocument(filename: str, embeddeddatabase: str = 'HSQLDB', registrationname: str = '', opt calcfilename: str): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441596554849949"><emph>filename</emph> : Identifies the file to create. It must follow the <literal>SF_FileSystem.FileNaming</literal> notation. If the file already exists, it is overwritten without warning</paragraph>
+ <paragraph role="paragraph" id="par_id381596554849698" xml-lang="en-US"><emph>embeddeddatabase</emph> : Either "HSQLDB" (default), "FIREBIRD" or "CALC".</paragraph>
+ <paragraph role="paragraph" id="par_id521596554849185" xml-lang="en-US"><emph>registrationname</emph> : The name used to store the new database in the databases register. When = "" (default), no registration takes place. If the name already exists it is overwritten without warning.</paragraph>
+ <paragraph role="paragraph" id="par_id181629364905056" xml-lang="en-US"><emph>calcfilename</emph> : Only when <literal>embeddeddatabase</literal> = "CALC", <literal>calcfilename</literal> represents the file containing the tables as Calc sheets. The file must exist or an error is raised.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id631596554849994">Dim myBase As Object, myCalcBase As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id921596554849612">Set myBase = ui.CreateBaseDocument("C:\Databases\MyBaseFile.odb", "FIREBIRD")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id51629365306345">Set myCalcBase = ui.CreateBaseDocument("C:\Databases\MyCalcBaseFile.odb", _</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id911629365353801"> "CALC", , "C:\Databases\MyCalcFile.ods")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id361620323808010">myBase = ui.CreateBaseDocument(r"C:\Databases\MyBaseFile.odb", "FIREBIRD")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id251629365641121">myCalcBase = ui.CreateBaseDocument(r"C:\Databases\MyCalcBaseFile.odb", \</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id431629366045258"> "CALC", calcfilename = r"C:\Databases\MyCalcFile.ods")</paragraph>
+ </pycode>
+</section>
+
+<section id="CreateDocument">
+ <comment> CreateDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id461588521753429">
+ <bookmark_value>UI service;CreateDocument</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id45158852175376" localize="false">CreateDocument (*)</h2>
+ <paragraph role="paragraph" id="par_id651588521753997">Create a new %PRODUCTNAME document of a given type or based on a given template. The method returns a document object.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id401620320696126">
+ <input>svc.CreateDocument(documenttype: str = '', templatefile: str = '', hidden: bool = False): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id51588521753302"><emph>documenttype</emph> : "Calc", "Writer", etc. If absent, the <literal>templatefile</literal> argument must be present.</paragraph>
+ <paragraph role="paragraph" id="par_id401588522663325" xml-lang="en-US"><emph>templatefile</emph> : The full <literal>FileName</literal> of the template to build the new document on. If the file does not exist, the argument is ignored. The <literal>FileSystem</literal> service provides the <literal>TemplatesFolder</literal> and <literal>UserTemplatesFolder</literal> properties to help to build the argument.</paragraph>
+ <paragraph role="paragraph" id="par_id131588522824366" xml-lang="en-US"><emph>hidden</emph>: if <literal>True</literal>, open the new document in the background (default = <literal>False</literal>). To use with caution: activation or closure afterwards can only happen programmatically.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id701620762417802">In both examples below, the first call to <literal>CreateDocument</literal> method creates a blank Calc document, whereas the second creates a document from a template file.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id201588522371030">Dim myDoc1 As Object, myDoc2 As Object, FSO As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id931588522377598">Set myDoc1 = ui.CreateDocument("Calc")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id821588522387111">Set FSO = CreateScriptService("FileSystem")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id661588522393007">Set myDoc2 = ui.CreateDocument(, FSO.BuildPath(FSO.TemplatesFolder, "personal/CV.ott"))</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id901620324433095">myDoc1 = ui.CreateDocument("Calc")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id361620324544381">fs = CreateScriptService("FileSystem")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id161620324434583">myDoc2 = ui.CreateDocument(templatefile = fs.BuildPath(fs.TemplatesFolder, "personal/CV.ott"))</paragraph>
+ </pycode>
+</section>
+
+<section id="GetDocument">
+ <comment> GetDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id351588520551838">
+ <bookmark_value>UI service;GetDocument</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id171588520551515" localize="false">GetDocument</h2>
+ <paragraph role="paragraph" id="par_id201588520551463">Returns an open document object referring to either the active window, a given window or the active document.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id811620320778478"> <input>svc.GetDocument(windowname: str = ''): svc</input></paragraph>
+ <paragraph role="paragraph" localize="false" id="par_id251624026292796"><input>svc.GetDocument(windowname: uno): svc</input></paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id851588520551368"><emph>windowname</emph>: See the definitions <link href="text/sbasic/shared/03/sf_ui.xhp#WindowName" name="WindowName section">above</link>. If this argument is absent, the active window is used. UNO objects of types <literal>com.sun.star.lang.XComponent</literal> or <literal>com.sun.star.comp.dba.ODatabaseDocument</literal> are also accepted. Thus passing <literal>ThisComponent</literal> or <literal>ThisDatabaseDocument</literal> as argument creates a new <link href="text/sbasic/shared/03/sf_document.xhp" name="Document service">SFDocuments.Document</link>, <link href="text/sbasic/shared/03/sf_base.xhp" name="Base service">Base</link> or <link href="text/sbasic/shared/03/sf_calc.xhp" name="Calc service">Calc</link> service.
+</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id191588522924110">Dim myDoc As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id591588520551682">Set myDoc = ui.GetDocument("C:\Documents\My file.odt")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651624025734467">Set myBase = ui.GetDocument(ThisDatabaseDocument)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id931624025986035">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id641624026031595">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id831620330074037">myDoc = ui.GetDocument(r"C:\Documents\My file.odt")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id601624025839840">myDoc = ui.GetDocument(bas.ThisComponent)</paragraph>
+ </pycode>
+ <tip id="par_id521620330287071">To access the name of the currently active window, refer to the <literal>ActiveWindow</literal> property.</tip>
+</section>
+
+<section id="Maximize">
+ <comment> Maximize -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id441587986441397">
+ <bookmark_value>UI service;Maximize</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id261587986441738" localize="false">Maximize</h2>
+ <paragraph role="paragraph" id="par_id24158798644169">Maximizes the active window or the given window.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id631620320925633">
+ <input>svc.Maximize(windowname: str)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id951587986441954"><emph>windowname</emph>: see the definitions <link href="text/sbasic/shared/03/sf_ui.xhp#WindowName" name="WindowName section">above</link>. If this argument is absent, the active window is maximized.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id891587986441319">ui.Maximize("Untitled 1")</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id181620330373220">ui.Maximize("Untitled 1")</paragraph>
+ </pycode>
+</section>
+
+<section id="Minimize">
+ <comment> Minimize -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id2315879865929">
+ <bookmark_value>UI service;Minimize</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id21158798659210" localize="false">Minimize</h2>
+ <paragraph role="paragraph" id="par_id871587986592696">Minimizes the active window or the given window.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id201620321224368">
+ <input>svc.Minimize(windowname: str)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id751587986592626"><emph>windowname</emph>: see the definitions <link href="text/sbasic/shared/03/sf_ui.xhp#WindowName" name="WindowName section">above</link>. If this argument is absent, the active window is minimized.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id671587986592107">ui.Minimize()</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id481620330501644">ui.Minimize()</paragraph>
+ </pycode>
+</section>
+
+<section id="OpenBaseDocument">
+ <comment> OpenBaseDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id291596555746452">
+ <bookmark_value>UI service;OpenBaseDocument</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id671596555746148" localize="false">OpenBaseDocument</h2>
+ <paragraph role="paragraph" id="par_id691596555746539">Open an existing %PRODUCTNAME Base document. The method returns a document object.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id21620321395150">
+ <input>svc.OpenBaseDocument(filename: str = '', registrationname: str = '', macroexecution: int = 0): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id231596555746385"><emph>filename</emph>: Identifies the file to open. It must follow the <literal>SF_FileSystem.FileNaming</literal> notation.</paragraph>
+ <paragraph role="paragraph" id="par_id711596555746281" xml-lang="en-US"><emph>registrationname</emph>: The name to use to find the database in the databases register. It is ignored if <literal>FileName</literal> &lt;&gt; "".</paragraph>
+ <paragraph role="paragraph" id="id721596556313545" xml-lang="en-US"><emph>macroexecution</emph>: 0 = behaviour is defined by the user configuration, 1 = macros are not executable, 2 = macros are executable.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id761596555746795">Dim myBase As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id91596555746449">Set myBase = ui.OpenBaseDocument("C:\Documents\myDB.odb", MacroExecution := ui.MACROEXECALWAYS)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id431620331254271">ui.OpenBaseDocument(r"C:\Documents\myDB.odb", macroexecution = ui.MACROEXECALWAYS)</paragraph>
+ </pycode>
+ <tip id="par_id941620762989833">To improve code readability you can use <link href="text/sbasic/shared/03/sf_ui.xhp#Constants" name="CHANGE ME">predefined constants</link> for the <literal>macroexecution</literal> argument, as in the examples above.</tip>
+</section>
+
+<section id="OpenDocument">
+ <comment> OpenDocument -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id141588523635836">
+ <bookmark_value>UI service;OpenDocument</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id451588523635719" localize="false">OpenDocument (*)</h2>
+ <paragraph role="paragraph" id="par_id541588523635283">Opens an existing %PRODUCTNAME document with the given options. Returns a document object or one of its subclasses. The method returns <literal>Nothing</literal> (in Basic) / <literal>None</literal> (in Python) if the opening failed, even when the failure is caused by a user decision.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id271620321692960">
+ <input>svc.Opendocument(filename: str, password: str = '', readonly: bool = False, hidden: bool = False, macroexecution: int = 0, filtername: str = '', filteroptions: str = ''): svc</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id481588523635890"><emph>filename</emph>: Identifies the file to open. It must follow the <literal>FileNaming</literal> notation of the <literal>FileSystem</literal> service.</paragraph>
+ <paragraph role="paragraph" id="par_id451588523635507" xml-lang="en-US"><emph>password</emph>: To use when the document is protected. If wrong or absent while the document is protected, the user will be prompted to enter a password.</paragraph>
+ <paragraph role="paragraph" id="par_id611588524329781" xml-lang="en-US"><emph>readonly</emph>: Default = <literal>False</literal>.</paragraph>
+ <paragraph role="paragraph" id="par_id641588523635497" xml-lang="en-US"><emph>hidden</emph>: if <literal>True</literal>, open the new document in the background (default = <literal>False</literal>). To use with caution: activation or closure afterwards can only happen programmatically.</paragraph>
+ <paragraph role="paragraph" id="par_id981588524474719" xml-lang="en-US"><emph>macroexecution</emph>: 0 = behaviour is defined by the user configuration, 1 = macros are not executable, 2 = macros are executable.</paragraph>
+ <paragraph role="paragraph" id="par_id611588524584693" xml-lang="en-US"><emph>filtername</emph>: The name of a filter that should be used for loading the document. If present, the filter must exist.</paragraph>
+ <paragraph role="paragraph" id="par_id191588524634348" xml-lang="en-US"><emph>filteroptions</emph>: An optional string of options associated with the filter.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id811588523635720">Dim myDoc As Object, FSO As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id391588523635826">Set myDoc = ui.OpenDocument("C:\Documents\myFile.odt", ReadOnly := True)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id891620331804571">ui.OpenDocument(r"C:\Documents\myFile.odt", readonly = True)</paragraph>
+ </pycode>
+</section>
+
+<section id="Resize">
+ <comment> Resize -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id951587986945259">
+ <bookmark_value>UI service;Resize</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id551587986945514" localize="false">Resize</h2>
+ <paragraph role="paragraph" id="par_id751587986945965">Resizes and/or moves the active window. Absent and negative arguments are ignored. If the window is minimized or maximized, calling <literal>Resize</literal> without arguments restores it.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id411620321819387">
+ <input>svc.Resize(left: int = -1, top: int = -1, width: int = -1, height: int = -1)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441587986945696"><emph>left, top</emph>: Distances of the top-left corner from top and left edges of the screen, in pixels.</paragraph>
+ <paragraph role="paragraph" id="par_id601587987453825" xml-lang="en-US"><emph>width, height</emph>: New dimensions of the window, in pixels.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id801587987507028">In the following examples, the <literal>width</literal> and <literal>height</literal> of the window are changed while <literal>top</literal> and <literal>left</literal> are left unchanged.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id171587986945392">ui.Resize(, ,500, 500)</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id971620331945744">ui.Resize(width = 500, height = 500)</paragraph>
+ </pycode>
+ <tip id="par_id21620332301809">To resize a window that is not active, first activate it using the <literal>Activate</literal> method.</tip>
+</section>
+
+<section id="RunCommand">
+ <comment> RunCommand --------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id601589202413561">
+ <bookmark_value>UI service;RunCommand</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id611589202413141" localize="false">RunCommand</h2>
+ <paragraph role="paragraph" id="par_id991589202413257">Runs a UNO command on the current window. A few typical commands are: Save, SaveAs, ExportToPDF, Undo, Copy, Paste, etc.</paragraph>
+ <paragraph role="paragraph" id="par_id921611152932311">Commands can be run with or without arguments. Arguments are not validated before running the command. If the command or its arguments are invalid, then nothing will happen.</paragraph>
+ <tip id="par_id31644182402479">For a complete list of UNO commands that can be run in %PRODUCTNAME, refer to the Wiki page <link href="https://wiki.documentfoundation.org/Development/DispatchCommands" name="Commands_Wiki">Development/DispatchCommands</link>.</tip>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id521622828226683">
+ <input>svc.RunCommand(command: str, [args: any])</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id401589202413575"><emph>command</emph>: Case-sensitive string containing the UNO command name. The inclusion of the prefix ".uno:" in the command is optional. The command itself is not checked for correctness. If nothing happens after the command call, then the command is probably wrong.</paragraph>
+ <paragraph role="paragraph" id="par_id521644182774710"><emph>args</emph>: For each argument to be passed to the command, specify a pair containing the argument name and value.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <paragraph role="paragraph" id="par_id721611153068137">The following example runs the <literal>.uno:About</literal> command in the current window.</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id401611153339973">Set ui = CreateScriptService("UI")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id121589202413630">ui.RunCommand("About")</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id371644184276886">Below is an example that runs the UNO command <literal>.uno:BasicIDEAppear</literal> and passes the arguments required to open the Basic IDE at a specific line of a module.</paragraph>
+ <bascode>
+ <paragraph role="bascode" id="bas_id631644184414955">' Arguments passed to the command:</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id621644184336024">' Document = "LibreOffice Macros &amp; Dialogs"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id516441843364240">' LibName = "ScriptForge"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id721644186851722">' Name = "SF_Session"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id231644186851949">' Line = 600</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id391644184337449">ui.RunCommand(".uno:BasicIDEAppear", "Document", "LibreOffice Macros &amp; Dialogs", _ </paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id971644186963686"> "LibName", "ScriptForge", "Name", "SF_Session", "Line", 600)</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id41644184549167">Note that calling the command <literal>BasicIDEAppear</literal> without arguments will simply open the <menuitem>Basic IDE</menuitem>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id821622828361025">ui = CreateScriptService("UI")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id211622828361293">ui.RunCommand("About")</paragraph>
+ </pycode>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id661644184648102">ui.RunCommand(".uno:BasicIDEAppear", "Document", "LibreOffice Macros &amp; Dialogs", \</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id981644187044060"> "LibName", "ScriptForge", "Name", "SF_Session", "Line", 600)</paragraph>
+ </pycode>
+ <paragraph role="paragraph" id="par_id311644243516674">In Python it is also possible to call <literal>RunCommand</literal> using keyword arguments:</paragraph>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id821644243549887">ui.RunCommand(".uno:BasicIDEAppear", Document = "LibreOffice Macros &amp; Dialogs", \</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id681644243592324"> LibName = "ScriptForge", Name = "SF_Session", Line = 600)</paragraph>
+ </pycode>
+ <tip id="par_id191611153511038">Each %PRODUCTNAME component has its own set of commands available. One easy way to learn commands is going to <emph>Tools - Customize - Keyboard</emph>. When you position your mouse over a function in the <emph>Function</emph> list, a tooltip will appear with the corresponding UNO command.</tip>
+</section>
+
+<section id="SetStatusBar">
+ <comment> SetStatusbar -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id25158799642119">
+ <bookmark_value>UI service;SetStatusbar</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id171587996421550" localize="false">SetStatusbar (*)</h2>
+ <paragraph role="paragraph" id="par_id281587996421580">Display a text and a progressbar in the status bar of the active window. Any subsequent calls in the same macro run refer to the same status bar of the same window, even if the window is not visible anymore. A call without arguments resets the status bar to its normal state.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id461620321923929">
+ <input>svc.SetStatusbar(text: str = '', percentage: int = -1)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id71587996421829"><emph>text</emph>: An optional text to be displayed in front of the progress bar.</paragraph>
+ <paragraph role="paragraph" id="par_id881587996421777" xml-lang="en-US"><emph>percentage</emph>: an optional degree of progress between 0 and 100.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id61587996791867">Dim i As Integer</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id291587996799353">For i = 0 To 100</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id331587996806267"> ui.SetStatusbar("Progress ...", i)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id491587996813628"> Wait 50</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id841587996820714">Next i</paragraph>
+ <paragraph role="bascode" id="bas_id651620332601083">' Resets the statusbar</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id141587996829242">ui.SetStatusbar</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id631620332653004">from time import sleep</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id351620332422330">for i in range(101):</paragraph>
+ <paragraph role="pycode" localize="false" id="bas_id261620332627647"> ui.SetStatusbar("Test:", i)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id181620332715974"> sleep(0.05)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id381620332733373">ui.SetStatusbar()</paragraph>
+ </pycode>
+</section>
+
+<section id="ShowProgressBar">
+ <comment> ShowProgressBar -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id91159886425573">
+ <bookmark_value>UI service;ShowProgressBar</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id31598864255380" localize="false">ShowProgressBar</h2>
+ <paragraph role="paragraph" id="par_id571598864255776">Displays a non-modal dialog box. Specify its title, an explicatory text and a percentage of progress to be represented on a progressbar. The dialog will remain visible until a call to the method without arguments or until the user manually closes the dialog.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id41620322016943">
+ <input>svc.ShowProgressBar(title: str = '', text: str = '', percentage: str = -1)</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441598864535695" xml-lang="en-US"><emph>title</emph> : The title appearing on top of the dialog box. Default = "ScriptForge".</paragraph>
+ <paragraph role="paragraph" id="par_id311598864255297"><emph>text</emph>: An optional text to be displayed above the progress bar.</paragraph>
+ <paragraph role="paragraph" id="par_id881598864255424" xml-lang="en-US"><emph>percentage</emph>: an optional degree of progress between 0 and 100.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id931598864255666">Dim i As Integer</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id211598864255731">For i = 0 To 100</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id341598864255351"> ui.ShowProgressBar("Window Title", "Progress ..." &amp; i &amp; "/100", i)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id34159886425576"> Wait 50</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id541598864255593">Next i</paragraph>
+ <paragraph role="bascode" id="bas_id651620333289753">' Closes the Progress Bar window</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id21598864255428">ui.ShowProgressBar</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id821620333264948">from time import sleep</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id611620333268146">for i in range(101):</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id331620333268525"> ui.ShowProgressBar("Window Title", "Progress ... " + str(i) + "/100", i)</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id451620333268900"> sleep(0.05)</paragraph>
+ <paragraph role="pycode" id="pyc_id761620333269236"># Closes the Progress Bar window</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id81620333269484">ui.ShowProgressBar()</paragraph>
+ </pycode>
+</section>
+
+<section id="WindowExists">
+ <comment> WindowExists -------------------------------------------------------------------------------------------------------------------------- </comment>
+ <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id431588587119136">
+ <bookmark_value>UI service;WindowExists</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id21588587119344" localize="false">WindowExists</h2>
+ <paragraph role="paragraph" id="par_id431588587119925">Returns <literal>True</literal> if the given window could be identified.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id521620322090015">
+ <input>svc.WindowExists(windowname: str): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id45158858711917"><emph>windowname</emph>: see the definitions above.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id941588587119772">If ui.WindowExists("C:\Document\My file.odt") Then</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id871588587295216"> ' ...</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id441620333481074">if ui.WindowExists(r"C:\Document\My file.odt"):</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id801620333495532"> # ...</paragraph>
+ </pycode>
+</section>
+
+<section id="relatedtopics">
+ <embed href="text/sbasic/shared/03/sf_basic.xhp#BasicService"/>
+ <embed href="text/sbasic/shared/03/sf_calc.xhp#CalcService"/>
+ <embed href="text/sbasic/shared/03/sf_document.xhp#DocumentService"/>
+</section>
+</body>
+</helpdocument>