summaryrefslogtreecommitdiff
path: root/source/text
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2019-06-27 13:04:40 -0300
committerOlivier Hallot <olivier.hallot@libreoffice.org>2019-06-28 14:21:59 +0200
commitea0f53e1c29a43422531d62d04b4e939b5577ac7 (patch)
tree6a831e88e984d5d2eca4b60036fddbc861e89a9f /source/text
parent11389d81999e8e8f788dc407d6398b8ed18b0870 (diff)
Split VBA Compatibility files and enhance
Add examples, Add cross-links Split files Change-Id: I92bef363f008aeed367167b50c4ea9a9943a62ff Reviewed-on: https://gerrit.libreoffice.org/74812 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'source/text')
-rw-r--r--source/text/sbasic/shared/compatibilitymode.xhp77
-rw-r--r--source/text/sbasic/shared/compatible.xhp45
2 files changed, 97 insertions, 25 deletions
diff --git a/source/text/sbasic/shared/compatibilitymode.xhp b/source/text/sbasic/shared/compatibilitymode.xhp
new file mode 100644
index 0000000000..68b6b444a3
--- /dev/null
+++ b/source/text/sbasic/shared/compatibilitymode.xhp
@@ -0,0 +1,77 @@
+<?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="text/sbasic/shared/compatiblemode">
+ <title id="tit" xml-lang="en-US">CompatibleMode function</title>
+ <filename>/text/sbasic/shared/compatibilitymode.xhp</filename>
+ </topic>
+ </meta>
+ <body>
+ <bookmark branch="index" id="N0103">
+ <bookmark_value>CompatibilityMode</bookmark_value>
+ <bookmark_value>VBA compatibility mode</bookmark_value>
+ </bookmark>
+ <section id="compatibilitymodefunction">
+ <h1 id="N0118"><variable id="compatibilitymodeh1"><link href="text/sbasic/shared/compatibilitymode.xhp" name="CompatibilityMode">CompatibilityMode() Function</link></variable></h1>
+ <paragraph role="paragraph" id="N0120"><literal>CompatibilityMode()</literal> function is controlling runtime mode and affects all code executed after setting or resetting the mode. </paragraph>
+ </section>
+ <warning id="N0119">Use this feature with caution, limit it to document conversion situations for example.</warning>
+ <note id="par_id271561645872679"><literal>Option Compatible</literal> turns on VBA compatibility at module level for the %PRODUCTNAME Basic compiler.</note>
+ <paragraph role="paragraph" id="N0121">This function may affect or help in the following situations:</paragraph>
+ <list type="unordered">
+ <listitem><paragraph role="listitem" id="N0122">Creating enumerations with <link href="text/sbasic/shared/enum.xhp" name="enum statement">Enum statement</link></paragraph></listitem>
+ <listitem><paragraph role="listitem" id="N0123">Updating <literal>Dir</literal> execution conditions.</paragraph></listitem>
+ <listitem><paragraph role="listitem" id="N0124">Running <literal>RmDir</literal> command in VBA mode. In VBA only empty directories are removed by <literal>RmDir</literal> while %PRODUCTNAME Basic removes a directory recursively.</paragraph></listitem>
+ <listitem><paragraph role="listitem" id="N0125">Changing behaviour of Basic <literal>Dir</literal> command. The directory flag (16) for the <literal>Dir</literal> command means that only directories are returned in %PRODUCTNAME Basic, while in VBA normal files and directories are returned.</paragraph></listitem>
+ </list>
+ <note id="N0126"><literal>CompatibilityMode()</literal> function may be necessary when resorting to <literal>Option Compatible</literal> or <literal>Option VBASupport</literal> compiler modes.</note>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="code" localize="false" id="N0128">CompatibilityMode(True | False)</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id541561646705787">Given a NOT empty directory at <emph>file:///home/me/Test</emph></paragraph>
+ <bascode>
+ <paragraph role="bascode" id="par_id491561646553280" xml-lang="en-US" localize="false">Sub RemoveDir</paragraph>
+ <paragraph role="bascode" id="par_id771561646565613" xml-lang="en-US" localize="false"> CompatibilityMode( true )</paragraph>
+ <paragraph role="bascode" id="par_id311561646572637" xml-lang="en-US" localize="false"> RmDir( "file:///home/me/Test" )</paragraph>
+ <paragraph role="bascode" id="par_id851561646579895" xml-lang="en-US" localize="false">End Sub</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id461561646613414">With <literal>CompatibilityMode( true )</literal> the program results in an error, otherwise the Test directory and all its content is deleted.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id411561647797398">Modifying <literal>Dir</literal> behavior</paragraph>
+ <bascode>
+ <paragraph role="bascode" id="par_id941561647889938" xml-lang="en-US" localize="false">Sub VBADirCommand</paragraph>
+ <paragraph role="bascode" id="par_id831561647900147" xml-lang="en-US"> CompatibilityMode( true ) ' Shows also normal files</paragraph>
+ <paragraph role="bascode" id="par_id931561647920869" xml-lang="en-US" localize="false"> Entry$ = Dir( "file:///home/me/Tmp/*.*", 16 )</paragraph>
+ <paragraph role="bascode" id="par_id31561647939939" xml-lang="en-US" localize="false"> Total$ = ""</paragraph>
+ <paragraph role="bascode" id="par_id71561647964220" xml-lang="en-US" localize="false"> While Entry$ &lt;&gt; ""</paragraph>
+ <paragraph role="bascode" id="par_id51561647969918" xml-lang="en-US" localize="false"> Total$ = Total$ + Entry$ + Chr$(13)</paragraph>
+ <paragraph role="bascode" id="par_id111561647975134" xml-lang="en-US" localize="false"> Entry$ = Dir</paragraph>
+ <paragraph role="bascode" id="par_id751561647979743" xml-lang="en-US" localize="false"> Wend</paragraph>
+ <paragraph role="bascode" id="par_id401561647986945" xml-lang="en-US" localize="false"> MsgBox Total$</paragraph>
+ <paragraph role="bascode" id="par_id111561647991525" xml-lang="en-US" localize="false">End Sub</paragraph>
+ </bascode>
+
+ <section id="relatedtopics">
+ <embed href="text/sbasic/shared/compatible.xhp#compatiblestatement"/>
+ <paragraph role="paragraph" id="N0129">
+ Refer to <link href="text/sbasic/python/python_platform.xhp">Identifying the Operating System</link> and <link href="text/sbasic/python/python_session.xhp">Getting Session Information</link> for <literal>Option Compatible</literal> simple examples, or <link href="text/sbasic/guide/access2base.xhp">Access2Base shared Basic library</link> for other class examples making use of <literal>Option Compatible</literal> compiler mode.
+ </paragraph>
+ <embed href="text/sbasic/shared/03090407.xhp#remstatement"/>
+ <paragraph role="paragraph" id="N0131">
+ Variables scope modification in <link href="text/sbasic/shared/01020300.xhp">Using Procedures and Functions</link> with <literal>CompatibilityMode()</literal> function.
+ </paragraph>
+ <embed href="text/sbasic/shared/03103200.xhp#optionbasestatement"/>
+ <embed href="text/sbasic/shared/03103300.xhp#explicitstatement"/>
+ <embed href="text/sbasic/shared/03103350.xhp#vbasupportstatement"/>
+ <embed href="text/sbasic/shared/classmodule.xhp#classmodulestatement"/>
+ </section>
+</body>
+</helpdocument>
diff --git a/source/text/sbasic/shared/compatible.xhp b/source/text/sbasic/shared/compatible.xhp
index a2655de54a..4a48a388c4 100644
--- a/source/text/sbasic/shared/compatible.xhp
+++ b/source/text/sbasic/shared/compatible.xhp
@@ -17,19 +17,21 @@
<body>
<bookmark branch="index" id="N0103">
<bookmark_value>Option Compatible</bookmark_value>
- <bookmark_value>CompatibilityMode</bookmark_value>
- <bookmark_value>VBA compatibility</bookmark_value>
+ <bookmark_value>VBA compatibility option</bookmark_value>
</bookmark>
<section id="optioncompatiblestatement">
<h1 id="N0104"><variable id="compatiblestatement"><link href="text/sbasic/shared/compatible.xhp" name="compatible">Option Compatible Statement</link></variable></h1>
- <paragraph role="paragraph" id="N0106"><literal>Option Compatible</literal> turns on the VBA-compatible Basic compiler mode at the module level. The function <literal>CompatibilityMode()</literal> controls runtime mode and affects all code executed after setting or resetting the mode.</paragraph>
+ <paragraph role="paragraph" id="N0106"><literal>Option Compatible</literal> turns on the VBA-compatible Basic compiler mode at the module level.</paragraph>
</section>
<embed href="text/sbasic/shared/00000003.xhp#beforeexecutable"/>
+ <note id="par_id931561646897105">The function <link href="text/sbasic/shared/compatibilitymode.xhp" name="copatibilitymode"><literal>CompatibilityMode()</literal></link> controls runtime mode and affects all code executed after setting or resetting the mode.</note>
<paragraph role="paragraph" id="N0107">This option may affect or assist in the following situations:</paragraph>
<list type="unordered">
- <listitem><paragraph role="listitem" id="N0108">Allow special characters as identifiers.</paragraph></listitem>
- <listitem><paragraph role="listitem" id="N0109">Create constants including non-printable characters.</paragraph></listitem>
+ <listitem><paragraph role="listitem" id="N0108">Allow special characters as identifiers. all characters that are defined as
+ letter in the Latin-1 (ISO 8859-1) character set, are accepted
+ as part of identifiers.</paragraph></listitem>
+ <listitem><paragraph role="listitem" id="N0109">Create <link href="text/sbasic/shared/03040000.xhp#addvbaconstants" name="addvbaconstants">VBA constants including non-printable characters</link>.</paragraph></listitem>
<listitem><paragraph role="listitem" id="N0110">Support <literal>Private</literal>/<literal>Public</literal> keywords for procedures.</paragraph></listitem>
<listitem><paragraph role="listitem" id="N0111">Compulsory <literal>Set</literal> statement for objects.</paragraph></listitem>
<listitem><paragraph role="listitem" id="N0112">Default values for optional parameters in procedures.</paragraph></listitem>
@@ -39,28 +41,21 @@
<note id="N0115"><literal>Option Compatible</literal> is required when coding class modules.</note>
<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
<paragraph role="code" localize="false" id="N0117">Option Compatible</paragraph>
- <section id="compatibilitymodefunction">
- <h1 id="N0118"><variable id="compatibilitymodestatement"><link href="text/sbasic/shared/compatible.xhp" name="CompatibilityMode">CompatibilityMode() Function</link></variable></h1>
- <paragraph role="paragraph" id="N0120"><literal>CompatibilityMode()</literal> function is controlling runtime mode and affects all code executed after setting or resetting the mode. <literal>Option Compatible</literal> turns on VBA compatibility at module level for the %PRODUCTNAME Basic compiler.</paragraph>
- </section>
- <warning id="N0119">Use this feature with caution, limit it to document conversion situations for example.</warning>
- <paragraph role="paragraph" id="N0121">This function may affect or help in the following situations:</paragraph>
- <list type="unordered">
- <listitem><paragraph role="listitem" id="N0122">Creating enumerations with Enum statement</paragraph></listitem>
- <listitem><paragraph role="listitem" id="N0123">Updating Dir execution conditions</paragraph></listitem>
- <listitem><paragraph role="listitem" id="N0124">Running RmDir command in VBA mode</paragraph></listitem>
- <listitem><paragraph role="listitem" id="N0125">Changing behaviour of Basic Dir command</paragraph></listitem>
- </list>
- <note id="N0126"><literal>CompatibilityMode()</literal> function may be necessary when resorting to <literal>Option Compatible</literal> or <literal>Option VBASupport</literal> compiler modes.</note>
- <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
- <paragraph role="code" localize="false" id="N0128">CompatibilityMode(True | False)</paragraph>
-
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <h3 id="hd_id231561639199292">Special characters as identifiers</h3>
+ <bascode>
+ <paragraph role="bascode" id="par_id661561636654077">Option Compatible ' With this option the code works, other-</paragraph>
+ <paragraph role="bascode" id="par_id81561636660626"> ' wise it will cause a compiling error</paragraph>
+ <paragraph role="bascode" id="par_id921561636641311" localize="false">Sub Main</paragraph>
+ <paragraph role="bascode" id="par_id631561636632573" localize="false"> ä = 10</paragraph>
+ <paragraph role="bascode" id="par_id101561636625260" localize="false"> print ä</paragraph>
+ <paragraph role="bascode" id="par_id21561636616652" localize="false">End Sub</paragraph>
+ </bascode>
+ <tip id="par_id381561650119146">Statement <literal>Option VBAsupport 1</literal> sets <literal>Option Compatible</literal> statement automatically.</tip>
<section id="relatedtopics">
- <paragraph role="paragraph" id="N0129">
- Refer to <link href="text/sbasic/python/python_platform.xhp">Identifying the Operating System</link> and <link href="text/sbasic/python/python_session.xhp">Getting Session Information</link> for <literal>Option Compatible</literal> simple examples, or <link href="text/sbasic/guide/access2base.xhp">Access2Base shared Basic library</link> for other class examples making use of <literal>Option Compatible</literal> compiler mode.
- </paragraph>
+ <embed href="text/sbasic/shared/compatibilitymode.xhp#compatibilitymodeh1"/>
+ <paragraph role="paragraph" id="N0129">Refer to <link href="text/sbasic/python/python_platform.xhp">Identifying the Operating System</link> and <link href="text/sbasic/python/python_session.xhp">Getting Session Information</link> for <literal>Option Compatible</literal> simple examples, or <link href="text/sbasic/guide/access2base.xhp">Access2Base shared Basic library</link> for other class examples making use of <literal>Option Compatible</literal> compiler mode.</paragraph>
<embed href="text/sbasic/shared/03090407.xhp#remstatement"/>
-
<paragraph role="paragraph" id="N0131">
Variables scope modification in <link href="text/sbasic/shared/01020300.xhp">Using Procedures and Functions</link> with <literal>CompatibilityMode()</literal> function.
</paragraph>