From 115422426e5c514b05d8f64afa27141bb9ef1ae0 Mon Sep 17 00:00:00 2001 From: LibreOļ¬ƒciant Date: Mon, 27 Apr 2020 14:11:43 +0100 Subject: tdf#131416 Basic Subroutines help pages - Function, Property & Sub statements - Public, Private are keywords, Global removed from diagrams: - Global=Public as Basic libraries remain in memory - Basic toc & index Change-Id: If107f4d148b4da399dd03d1b18ea3da5454bb9ac Reviewed-on: https://gerrit.libreoffice.org/c/help/+/92784 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- source/auxiliary/sbasic.tree | 5 +- source/media/helpimg/sbasic/Function_statement.svg | 57 +++++++++++----------- .../helpimg/sbasic/Property-Get_statement.svg | 36 +++++++------- .../helpimg/sbasic/Property-Set_statement.svg | 37 +++++++------- source/media/helpimg/sbasic/Sub_statement.svg | 45 +++++++++-------- source/text/sbasic/shared/03090406.xhp | 45 +++++++++++------ source/text/sbasic/shared/03090409.xhp | 33 +++++++------ source/text/sbasic/shared/03103450.xhp | 4 +- source/text/sbasic/shared/fragments.xhp | 2 +- source/text/sbasic/shared/property.xhp | 30 ++++++++++-- 10 files changed, 165 insertions(+), 129 deletions(-) diff --git a/source/auxiliary/sbasic.tree b/source/auxiliary/sbasic.tree index c4012f0391..17b9540a69 100644 --- a/source/auxiliary/sbasic.tree +++ b/source/auxiliary/sbasic.tree @@ -165,6 +165,7 @@ GetSolarVersion Function GetSystemTicks Function Get Statement + Global keyword GlobalScope GoSub...Return Statement GoTo Statement @@ -236,7 +237,7 @@ PPmt Function [VBA] Print Statement Property Statement - Public Statement + Public keyword Put Statement PV Function [VBA] QBColor Function @@ -271,7 +272,7 @@ Sqr Function Square Root Calculation StarDesktop object - Static Statement + Static keyword Stop Statement StrComp Function Str Function diff --git a/source/media/helpimg/sbasic/Function_statement.svg b/source/media/helpimg/sbasic/Function_statement.svg index f3c0c7a2b5..b5b30ca81b 100644 --- a/source/media/helpimg/sbasic/Function_statement.svg +++ b/source/media/helpimg/sbasic/Function_statement.svg @@ -1,4 +1,4 @@ - + - - - - - -Global -Public -Private -Function -name - - -type-car -( - -argument -, -) - -( - -argument -, -) -As -type-name -statements -End Function \ No newline at end of file + + + + + +Public +Private +Function +name + + +( + +argument +, +) +As +typename + +char +( + +argument +, +) +statements +End Function \ No newline at end of file diff --git a/source/media/helpimg/sbasic/Property-Get_statement.svg b/source/media/helpimg/sbasic/Property-Get_statement.svg index 6671ed85ed..6bdff2db2a 100644 --- a/source/media/helpimg/sbasic/Property-Get_statement.svg +++ b/source/media/helpimg/sbasic/Property-Get_statement.svg @@ -1,4 +1,4 @@ - + - - - - - -Global -Public -Private -Property Get -name - - -type-car - -As -type-name -statements -End Property \ No newline at end of file + + + + + +Public +Private +Property Get +name + + +As +typename +char +statements +End Property \ No newline at end of file diff --git a/source/media/helpimg/sbasic/Property-Set_statement.svg b/source/media/helpimg/sbasic/Property-Set_statement.svg index 51235b1748..f5de4045c1 100644 --- a/source/media/helpimg/sbasic/Property-Set_statement.svg +++ b/source/media/helpimg/sbasic/Property-Set_statement.svg @@ -1,4 +1,4 @@ - + - - - - - -Global -Public -Private -Property - -Let -Set -name -( -argument -) -statements -End Property \ No newline at end of file + + + + + +Public +Private +Property + +Set +Let +name +( +argument +) +statements +End Property \ No newline at end of file diff --git a/source/media/helpimg/sbasic/Sub_statement.svg b/source/media/helpimg/sbasic/Sub_statement.svg index f1e46ae8d2..b5b47356e3 100644 --- a/source/media/helpimg/sbasic/Sub_statement.svg +++ b/source/media/helpimg/sbasic/Sub_statement.svg @@ -1,4 +1,4 @@ - + - - - - - -Global -Public -Private -Sub -name - - - -( - - - -argument -, -) -statements -End Sub \ No newline at end of file + + + + + +Public +Private +Sub +name + + + +( + + + +argument +, +) +statements +End Sub \ No newline at end of file diff --git a/source/text/sbasic/shared/03090406.xhp b/source/text/sbasic/shared/03090406.xhp index 415b4f7bde..eb10a54c33 100644 --- a/source/text/sbasic/shared/03090406.xhp +++ b/source/text/sbasic/shared/03090406.xhp @@ -27,33 +27,44 @@ -
Function statement - Function Statement Defines a subroutine that can be used as an expression to determine a return type.
-Syntax -see Parameter +
+Sub or Function statements are similar methods, without distinction. They receive parameters by reference allowing them to be modified. %PRODUCTNAME Basic compiler accepts their respective syntax to be used interchangeably. +
-Parameters: -Syntax -Function Name[(VarName1 [As Type][, VarName2 [As Type][,...]]]) [As Type] -statement block -[Exit Function] -statement block -End Function -Parameter - Name: Name of the subroutine to contain the value returned by the function. - VarName: Parameter to be passed to the subroutine. - Type: Type-declaration keyword. + + + Function Statement diagram + + [Private | Public] Function Name[char] (argument1 [As Type][, argument2[char][,...]]) [As typename] + statements + [Exit Function] + statements + End Function + -Example: + +
+ scope: Function default scope is Public. A Private scope denotes a module internal routine, not intended to be used from other modules. +
+ + name: Name of the subroutine to contain the value returned by the function. + arguments: Parameters to be passed to the subroutine. + + + + + +
+

Examples:

Sub ExampleExit Dim sReturn As String @@ -80,6 +91,8 @@ LinSearch = iCount End Function +
+ \ No newline at end of file diff --git a/source/text/sbasic/shared/03090409.xhp b/source/text/sbasic/shared/03090409.xhp index 08348414d4..9dbe587897 100644 --- a/source/text/sbasic/shared/03090409.xhp +++ b/source/text/sbasic/shared/03090409.xhp @@ -27,35 +27,38 @@ -
Sub statement - Sub Statement Defines a subroutine.
+ -Syntax + + + Sub Statement diagram + -Sub Name[(VarName1 [As Type][, VarName2 [As Type][,...]])] -statement block +[Private | Public] Sub name[(argument1 [As typename][, argument2[char][,...]])] + ' statements + [Exit Sub] + ' statements End Sub -Parameters: - Name: Name of the subroutine. - VarName: Parameter that you want to pass to the subroutine. - Type: Type-declaration key word. + + name: Name of the subroutine. + arguments: Optional parameters that you want to pass to the subroutine. + + + + + + -Example: - -Sub Example - ' some statements -End Sub - \ No newline at end of file diff --git a/source/text/sbasic/shared/03103450.xhp b/source/text/sbasic/shared/03103450.xhp index 67f74ca6fe..b2c0e5144e 100644 --- a/source/text/sbasic/shared/03103450.xhp +++ b/source/text/sbasic/shared/03103450.xhp @@ -30,11 +30,11 @@
- Global statement + Global keyword -Global Statement +Global keyword Dimensions a variable or an array at the global level (that is, not within a subroutine or function), so that the variable and the array are valid in all libraries and modules for the current session.
diff --git a/source/text/sbasic/shared/fragments.xhp b/source/text/sbasic/shared/fragments.xhp index ad22ea5194..ffbf564c52 100644 --- a/source/text/sbasic/shared/fragments.xhp +++ b/source/text/sbasic/shared/fragments.xhp @@ -59,7 +59,7 @@
-

type-car fragment

+

char fragment

type declaration characters { % | & | ! | # | $ | @ } diff --git a/source/text/sbasic/shared/property.xhp b/source/text/sbasic/shared/property.xhp index 1138716fde..31a4897151 100644 --- a/source/text/sbasic/shared/property.xhp +++ b/source/text/sbasic/shared/property.xhp @@ -27,15 +27,39 @@ Property statement +

Property Statement

A property, also called field or attribute, characterizes a given object or piece of information. Properties can be used to control access to data. It is common use to include instructions at setting or reading time of properties. Code can vary from simple assignment to complex context dependant routines. Using Get, Let or Set accessers enforces properties' consistency when necessary. This statement requires Option Compatible to be placed before the executable program code in a module. -

Syntax

+ + + + Property Get Statement diagram + - [Global | Private | Public] Property [Get | Let | Set] propName[([Optional [ByRef | ByVal]]value As Typename)] [As Typename] + [Private | Public] Property Get name[char | As typename] + End Property + + + + Property Set Statement diagram + + + [Private | Public] Property [Let | Set] name[char] [([Optional [ByRef | ByVal]]value[char | As typename])] [As typename] End Property -

Examples

+ + + name: The property name. + + argument: Value to be passed to the Property setter routine. + Property setters often use a single argument. Multiple arguments are equally accepted. + + + + + +

Examples

Option Compatible Sub Main -- cgit v1.2.3