summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibreOļ¬ƒciant <LibreOfficiant@sfr.fr>2020-02-05 17:50:18 +0100
committerOlivier Hallot <olivier.hallot@libreoffice.org>2020-02-22 13:13:19 +0100
commitad3253b3663b04e06e21cba1f9aac82c9e088d3d (patch)
tree935381e17b74b87f2c33ea0994ceba011b6881c5
parentd0bf3b122de80bce6edddcb309bf7ed3a176e9cd (diff)
Basic Property statement new help
Change-Id: I4386954ea6f6a22fa1f6d8df5695c574cacba19e Reviewed-on: https://gerrit.libreoffice.org/c/help/+/88051 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
-rw-r--r--AllLangHelp_sbasic.mk1
-rw-r--r--source/text/sbasic/shared/03090404.xhp3
-rw-r--r--source/text/sbasic/shared/03090412.xhp8
-rw-r--r--source/text/sbasic/shared/property.xhp102
4 files changed, 110 insertions, 4 deletions
diff --git a/AllLangHelp_sbasic.mk b/AllLangHelp_sbasic.mk
index 0b31b3e7a..714338107 100644
--- a/AllLangHelp_sbasic.mk
+++ b/AllLangHelp_sbasic.mk
@@ -363,6 +363,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,sbasic,\
helpcontent2/source/text/sbasic/shared/compatibilitymode \
helpcontent2/source/text/sbasic/shared/enum \
helpcontent2/source/text/sbasic/shared/partition \
+ helpcontent2/source/text/sbasic/shared/property \
helpcontent2/source/text/sbasic/shared/replace \
helpcontent2/source/text/sbasic/shared/uno_objects \
helpcontent2/source/text/sbasic/shared/stardesktop \
diff --git a/source/text/sbasic/shared/03090404.xhp b/source/text/sbasic/shared/03090404.xhp
index 0c933d7cb..ada8a37a8 100644
--- a/source/text/sbasic/shared/03090404.xhp
+++ b/source/text/sbasic/shared/03090404.xhp
@@ -40,7 +40,7 @@
<paragraph id="hd_id3147264" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
<bascode>
-<paragraph id="par_id3148552" role="bascode" localize="false" xml-lang="en-US">End, End Enum, End Function, End If, End Select, End Sub, End With</paragraph>
+<paragraph id="par_id3148552" role="bascode" localize="false" xml-lang="en-US">End, End Enum, End Function, End If, End Property, End Select, End Sub, End With</paragraph>
</bascode>
<paragraph id="hd_id3149456" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
@@ -51,6 +51,7 @@
<paragraph role="paragraph" id="par_id371543799561260">End Enum: Ends an Enum VBA statement</paragraph>
<paragraph id="par_id3145171" role="paragraph" xml-lang="en-US">End Function: Ends a <emph>Function</emph> statement.</paragraph>
<paragraph id="par_id3153192" role="paragraph" xml-lang="en-US">End If: Marks the end of a <emph>If...Then...Else</emph> block.</paragraph>
+<paragraph role="paragraph" id="par_id51581259731973" xml-lang="en-US">End Property: Marks the end of a <emph>Property</emph> statement.</paragraph>
<paragraph id="par_id3148451" role="paragraph" xml-lang="en-US">End Select: Marks the end of a <emph>Select Case</emph> block.</paragraph>
<paragraph id="par_id3155131" role="paragraph" xml-lang="en-US">End Sub: Ends a <emph>Sub</emph> statement.</paragraph>
<paragraph role="paragraph" id="par_id811543799601628">End With: Ends a With statement</paragraph>
diff --git a/source/text/sbasic/shared/03090412.xhp b/source/text/sbasic/shared/03090412.xhp
index 81d2c871c..86523ddc9 100644
--- a/source/text/sbasic/shared/03090412.xhp
+++ b/source/text/sbasic/shared/03090412.xhp
@@ -32,15 +32,15 @@
<bookmark xml-lang="en-US" branch="index" id="bm_id3152924">
<bookmark_value>Exit statement</bookmark_value>
</bookmark>
-
+
<paragraph id="hd_id3152924" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03090412.xhp" name="Exit Statement">Exit Statement</link></paragraph>
-<paragraph id="par_id3153394" role="paragraph" xml-lang="en-US">Exits a <emph>Do...Loop</emph>, <emph>For...Next</emph>, a function, or a subroutine.</paragraph>
+<paragraph id="par_id3153394" role="paragraph" xml-lang="en-US">Exits a <emph>Do...Loop</emph>, <emph>For...Next</emph>, a function, a property, or a subroutine.</paragraph>
</section>
<paragraph id="hd_id3149763" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
<bascode>
-<paragraph id="par_id3159157" role="bascode" xml-lang="en-US">see Parameters</paragraph>
+<paragraph id="par_id3159157" role="bascode" xml-lang="en-US">Exit Do, Exit For, Exit Function, Exit Property, Exit Sub</paragraph>
</bascode>
<paragraph id="hd_id3148943" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
@@ -50,6 +50,8 @@
<paragraph id="par_id3148797" role="paragraph" xml-lang="en-US">Only valid within a <emph>For...Next</emph> loop to exit the loop. Program execution continues with the first statement that follows the <emph>Next</emph> statement. In nested statements, the control is transferred to the loop in the next higher level.</paragraph>
<paragraph id="par_id3147229" role="paragraph" xml-lang="en-US"> <emph>Exit Function</emph> </paragraph>
<paragraph id="par_id3154685" role="paragraph" xml-lang="en-US">Exits the <emph>Function</emph> procedure immediately. Program execution continues with the statement that follows the <emph>Function</emph> call.</paragraph>
+<paragraph id="par_id31581260355116" role="paragraph" xml-lang="en-US"> <emph>Exit Property</emph> </paragraph>
+<paragraph id="par_id1001581260355700" role="paragraph" xml-lang="en-US">Exits the <emph>Property</emph> procedure immediately. Program execution continues with the statement that follows the <emph>Property</emph> call.</paragraph>
<paragraph id="par_id3155132" role="paragraph" xml-lang="en-US"> <emph>Exit Sub</emph> </paragraph>
<paragraph id="par_id3149561" role="paragraph" xml-lang="en-US">Exits the subroutine immediately. Program execution continues with the statement that follows the <emph>Sub</emph> call.</paragraph>
<paragraph id="par_id3153143" role="note" xml-lang="en-US">The Exit statement does not define the end of a structure, and must not be confused with the End statement.</paragraph>
diff --git a/source/text/sbasic/shared/property.xhp b/source/text/sbasic/shared/property.xhp
new file mode 100644
index 000000000..1a4cfd3d1
--- /dev/null
+++ b/source/text/sbasic/shared/property.xhp
@@ -0,0 +1,102 @@
+<?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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+ <meta>
+ <topic id="text/sbasic/shared/Property">
+ <title id="Property Statement" xml-lang="en-US">Property Statement</title>
+ <filename>/text/sbasic/shared/Property.xhp</filename>
+ </topic>
+ </meta>
+ <body>
+ <bookmark branch="index" id="N0181">
+ <bookmark_value>Property statement</bookmark_value>
+ </bookmark>
+ <h1 id="N0182">Property Statement</h1>
+ <paragraph role="paragraph" id="N0183">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 <emph>Get</emph>, <emph>Let</emph> or <emph>Set</emph> accessers enforces properties&apos; consistency when necessary.</paragraph>
+ <warning id="N0184">This statement requires <link href="text/sbasic/shared/compatible.xhp" name ="Option Compatible">Option Compatible</link> to be placed before the executable program code in a module. </warning>
+ <h2 id="N0185">Syntax</h2>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="N0186">[Global | Private | Public] Property [Get | Let | Set] propName[(value As VarType)] [As VarType]</paragraph>
+ <paragraph role="bascode" localize="false" id="N0187">End Property</paragraph>
+ </bascode>
+ <h2 id="N0188">Examples</h2>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="N0189">Option Compatible</paragraph>
+ <paragraph role="bascode" localize="false" id="N0190">Sub Main</paragraph>
+ <paragraph role="bascode" localize="false" id="N0191"> ProductName = &quot;Office&quot;</paragraph>
+ <paragraph role="bascode" xml-lang="en-US" id="N0192"> Print ProductName &apos; displays &quot;LibreOffice&quot;</paragraph>
+ <paragraph role="bascode" localize="false" id="N0193">End Sub</paragraph>
+ <paragraph role="bascode" localize="false" id="N0194"></paragraph>
+ <paragraph role="bascode" localize="false" id="N0195">Private _office As String</paragraph>
+ <paragraph role="bascode" localize="false" id="N0196">Property Get ProductName As String</paragraph>
+ <paragraph role="bascode" localize="false" id="N0197"> ProductName = _office</paragraph>
+ <paragraph role="bascode" localize="false" id="N0198">End Property</paragraph>
+ <paragraph role="bascode" localize="false" id="N0199">Property Let ProductName(value As String)</paragraph>
+ <paragraph role="bascode" localize="false" id="N0200"> _office = &quot;Libre&quot;&amp; value</paragraph>
+ <paragraph role="bascode" localize="false" id="N0201">End Property</paragraph>
+ </bascode>
+ <tip id="N0202">In the absence of Property <emph>Let</emph> or Property <emph>Set</emph>, Property <emph>Get</emph> helps define protected information, which can not be accidently altered by a foreign module:</tip>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="N0203">Option Compatible</paragraph>
+ <paragraph role="bascode" xml-lang="en-US" id="N0204">Public Property Get PathDelimiter As String &apos; Read-only variable</paragraph>
+ <paragraph role="bascode" localize="false" id="N0205"> Static this As String</paragraph>
+ <paragraph role="bascode" localize="false" id="N0206"> If this = &quot;&quot; Then : Select Case GetGuiType()</paragraph>
+ <paragraph role="bascode" localize="false" id="N0207"> Case 1 : this = &quot;;&quot; &apos; Windows</paragraph>
+ <paragraph role="bascode" xml-lang="en-US" id="N0208"> Case 4 : this = &quot;:&quot; &apos; Linux or MacOS X</paragraph>
+ <paragraph role="bascode" xml-lang="en-US" id="N0209"> Case Else : Error 423 &apos; Property or method not defined: PathDelimiter</paragraph>
+ <paragraph role="bascode" localize="false" id="N0210"> End Select : End If</paragraph>
+ <paragraph role="bascode" localize="false" id="N0211"> PathDelimiter = this</paragraph>
+ <paragraph role="bascode" xml-lang="en-US" id="N0212">End Property &apos; read-only PathDelimiter</paragraph>
+ <paragraph role="bascode" localize="false" id="N0213"></paragraph>
+ <paragraph role="bascode" localize="false" id="N0214">Sub Main</paragraph>
+ <paragraph role="bascode" xml-lang="en-US" id="N0215"> PathDelimiter = &quot;a sentence&quot; &apos; does nothing</paragraph>
+ <paragraph role="bascode" localize="false" id="N0216">End Sub</paragraph>
+ </bascode>
+ <note id="N0217">Use <emph>Let</emph> or <emph>Set</emph> when handling UNO services or class objects:</note>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="N0218">Option Compatible</paragraph>
+ <paragraph role="bascode" localize="false" id="N0219">Sub Main</paragraph>
+ <paragraph role="bascode" localize="false" id="N0220"> &apos;Set anObject = CreateUnoService( &quot;com.sun.star.frame.Desktop&quot; )</paragraph>
+ <paragraph role="bascode" localize="false" id="N0221"> anObject = CreateUnoService( &quot;com.sun.star.frame.Desktop&quot; )</paragraph>
+ <paragraph role="bascode" localize="false" id="N0222"> Print anObject.SupportedServiceNames(0) &apos; displays &quot;com.sun.star.frame.Frame&quot;</paragraph>
+ <paragraph role="bascode" localize="false" id="N0223">End Sub</paragraph>
+ <paragraph role="bascode" localize="false" id="N0224"></paragraph>
+ <paragraph role="bascode" localize="false" id="N0225">Property Get anObject As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="N0226"> Set anObject = _obj</paragraph>
+ <paragraph role="bascode" localize="false" id="N0227">End Property</paragraph>
+ <paragraph role="bascode" localize="false" id="N0228"></paragraph>
+ <paragraph role="bascode" localize="false" id="N0229">Private _obj As Object</paragraph>
+ <paragraph role="bascode" localize="false" id="N0230"></paragraph>
+ <paragraph role="bascode" localize="false" id="N0231">&apos;Property Set anObject(value As Object)</paragraph>
+ <paragraph role="bascode" localize="false" id="N0232"> &apos;Set _obj = value.CurrentFrame</paragraph>
+ <paragraph role="bascode" localize="false" id="N0233">&apos;End Property</paragraph>
+ <paragraph role="bascode" localize="false" id="N0234">Property Let anObject(value As Object)</paragraph>
+ <paragraph role="bascode" localize="false" id="N0235"> Set _obj = value.CurrentFrame</paragraph>
+ <paragraph role="bascode" localize="false" id="N0236">End Property</paragraph>
+ </bascode>
+ <section id="relatedtopics" >
+ <paragraph role="paragraph" id="N0237"><link href="text/sbasic/shared/03090404.xhp" name="End">End</link>, <link href="text/sbasic/shared/03090412.xhp" name="Exit">Exit</link> statements</paragraph>
+ <paragraph role="paragraph" id="N0238">
+ <link href="text/sbasic/shared/01020300.xhp" name ="Using Procedures and Fonctions">Using Procedures and Functions</link>
+ </paragraph>
+ <embed href="text/sbasic/shared/classmodule.xhp#classmodulestatement"/>
+ <embed href="text/sbasic/shared/compatible.xhp#compatiblestatement"/>
+ </section>
+ </body>
+</helpdocument> \ No newline at end of file