From 441f600d210bd69e4c485c1520eff55a42aa0a2c Mon Sep 17 00:00:00 2001 From: Alain Romedenne Date: Wed, 23 Jan 2019 19:02:00 -0200 Subject: tdf#114263 Undocumented BASIC Options Option Compatible Option ClassModule Change-Id: Ieb07fddb216f4f8cc26089a30226da5760b0065e Reviewed-on: https://gerrit.libreoffice.org/66824 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- source/text/sbasic/shared/00000003.xhp | 3 ++ source/text/sbasic/shared/03090407.xhp | 14 +++--- source/text/sbasic/shared/03103200.xhp | 13 +++--- source/text/sbasic/shared/03103300.xhp | 15 +++---- source/text/sbasic/shared/03103350.xhp | 20 ++++----- source/text/sbasic/shared/classmodule.xhp | 60 +++++++++++++++++++++++++ source/text/sbasic/shared/compatible.xhp | 73 +++++++++++++++++++++++++++++++ 7 files changed, 161 insertions(+), 37 deletions(-) create mode 100644 source/text/sbasic/shared/classmodule.xhp create mode 100644 source/text/sbasic/shared/compatible.xhp (limited to 'source/text') diff --git a/source/text/sbasic/shared/00000003.xhp b/source/text/sbasic/shared/00000003.xhp index a56925dcde..fd5df791d7 100644 --- a/source/text/sbasic/shared/00000003.xhp +++ b/source/text/sbasic/shared/00000003.xhp @@ -189,6 +189,9 @@
This function or constant is enabled with the statement Option VBASupport 1 placed before the executable program code in a module.
+
+ This statement must be added before the executable program code in a module. +
Syntax: diff --git a/source/text/sbasic/shared/03090407.xhp b/source/text/sbasic/shared/03090407.xhp index bdfb4784c0..360c6fbdd1 100644 --- a/source/text/sbasic/shared/03090407.xhp +++ b/source/text/sbasic/shared/03090407.xhp @@ -35,21 +35,19 @@ -Rem Statement +

Rem Statement

Specifies that a program line is a comment.
-Syntax: - -Rem Text - + +Rem Text -Parameters: + Text: Any text that serves as a comment. You can use the single quotation mark instead of the Rem keyword to indicate that the text on a line is comments. This symbol can be inserted directly to the right of the program code, followed by a comment. You can use a space followed by the underline character _ as the last two characters of a line to continue the logical line on the next line. To continue comment lines, you must enter "Option Compatible" in the same Basic module. -Example: + Sub ExampleMid Dim sVar As String @@ -60,4 +58,4 @@ - \ No newline at end of file + diff --git a/source/text/sbasic/shared/03103200.xhp b/source/text/sbasic/shared/03103200.xhp index 33560b1e31..d7418435a8 100644 --- a/source/text/sbasic/shared/03103200.xhp +++ b/source/text/sbasic/shared/03103200.xhp @@ -32,19 +32,17 @@ Option Base statement -Option Base Statement +

Option Base Statement

Defines the default lower boundary for arrays as 0 or 1. -Syntax: - -Option Base { 0 | 1} - + +Option Base { 0 | 1} -Parameters: + This statement must be added before the executable program code in a module. -Example: + Option Base 1 Sub ExampleOptionBase @@ -53,5 +51,4 @@ End Sub - diff --git a/source/text/sbasic/shared/03103300.xhp b/source/text/sbasic/shared/03103300.xhp index 6aadb83d61..96c490d393 100644 --- a/source/text/sbasic/shared/03103300.xhp +++ b/source/text/sbasic/shared/03103300.xhp @@ -32,19 +32,17 @@ Option Explicit statement -Option Explicit Statement +

Option Explicit Statement

Specifies that every variable in the program code must be explicitly declared with the Dim statement. -Syntax: - -Option Explicit - + +Option Explicit -Parameters: -This statement must be added before the executable program code in a module. + + -Example: + Option Explicit Sub ExampleExplicit @@ -56,5 +54,4 @@ End Sub - diff --git a/source/text/sbasic/shared/03103350.xhp b/source/text/sbasic/shared/03103350.xhp index caa57d94d9..015d57770a 100644 --- a/source/text/sbasic/shared/03103350.xhp +++ b/source/text/sbasic/shared/03103350.xhp @@ -28,31 +28,28 @@ -
+
Microsoft Excel macros support;Enable Microsoft Excel macros support;Option VBASupport statement VBA Support;Option VBASupport statement Option VBASupport statement - - -Option VBASupport Statement +

Option VBASupport Statement

Specifies that %PRODUCTNAME Basic will support some VBA statements, functions and objects.
The support for VBA is not complete, but covers a large portion of the common usage patterns. -Syntax: - -Option VBASupport {1|0} - + +Option VBASupport {1|0} + + + -Parameters: -This statement must be added before the executable program code in a module. 1: Enable VBA support in %PRODUCTNAME 0: Disable VBA support -Example: + Option VBASupport 1 Sub ExampleVBA @@ -67,5 +64,4 @@ VBA support in %PRODUCTNAME
- diff --git a/source/text/sbasic/shared/classmodule.xhp b/source/text/sbasic/shared/classmodule.xhp new file mode 100644 index 0000000000..a6ddac7386 --- /dev/null +++ b/source/text/sbasic/shared/classmodule.xhp @@ -0,0 +1,60 @@ + + + + + + Option ClassModule + /text/sbasic/shared/classmodule.xhp + + + + + Option ClassModule + +

Option ClassModule Statement

+ Specifies that the module is a class module that contains members, properties, procedures and functions. + + Option ClassModule + + This statement must be added before the executable program code in a module. + This statement must be used jointly with Option Compatible statement or Option VBASupport 1, the former is enabling VBA compatibility mode, while the latter is enforcing VBA support on top of compatibility. + + + Option Compatible + Option ClassModule + + ' Optional members go here + + Private Sub Class_Initialize() + ' Optional construction code goes here + End Sub ' Constructor + Private Sub Class_Terminate() + ' Optional destruction code goes here + End Sub ' Destructor + + ' Properties go here. + + ' Procedures & functions go here. + + +
+ + Refer to Identifying the Operating System and Getting Session Information for class module simple examples. + + + Multiple thorough class examples are available from Access2Base shared Basic library. + + + + + +
+ +
diff --git a/source/text/sbasic/shared/compatible.xhp b/source/text/sbasic/shared/compatible.xhp new file mode 100644 index 0000000000..3d8824adf6 --- /dev/null +++ b/source/text/sbasic/shared/compatible.xhp @@ -0,0 +1,73 @@ + + + + + + Option Compatible + /text/sbasic/shared/compatible.xhp + + + + + Option Compatible + CompatibilityMode + VBA compatibility + + +
+

Option Compatible Statement

+
+ + Option Compatible turns on VBA compatible Basic compiler mode at module level. Function CompatibilityMode() controls runtime mode and affects all code executed after setting or resetting the mode. + This option may affect or assist in the following situations: + + Allow special characters as identifiers. + Create constants including non-printable characters. + Support Private/Public keywords for procedures. + Compulsory Set statement for objects. + Default values for optional parameters in procedures. + Named arguments when multiple optional parameters exist. + Preload of %PRODUCTNAME Basic libraries + + Option Compatible is required when coding class modules. + + Option Compatible +
+

CompatibilityMode() function

+
+ Use this feature with caution, limit it to document conversion situations for example. + CompatibilityMode() function is controlling runtime mode and affects all code executed after setting or resetting the mode. Option Compatible turns on VBA compatibility at module level for the %PRODUCTNAME Basic compiler. + This function may affect or help in the following situations: + + Creating enumerations with Enum statement + Updating Dir execution conditions + Running RmDir command in VBA mode + Changing behaviour of Basic Dir command + + CompatibilityMode() function may be necessary when resorting to Option Compatible or Option VBASupport compiler modes. + + CompatibilityMode(True | False) + +
+ + Refer to Identifying the Operating System and Getting Session Information for Option Compatible simple examples, or Access2Base shared Basic library for other class examples making use of Option Compatible compiler mode. + + + + + Variables scope modification in Using Procedures and Functions with CompatibilityMode() function. + + + + + +
+ +
-- cgit