diff options
Diffstat (limited to 'source/text/sbasic')
-rw-r--r-- | source/text/sbasic/shared/03102100.xhp | 5 | ||||
-rw-r--r-- | source/text/sbasic/shared/03103700.xhp | 4 | ||||
-rw-r--r-- | source/text/sbasic/shared/03132400.xhp | 53 | ||||
-rw-r--r-- | source/text/sbasic/shared/new_keyword.xhp | 77 |
4 files changed, 114 insertions, 25 deletions
diff --git a/source/text/sbasic/shared/03102100.xhp b/source/text/sbasic/shared/03102100.xhp index 8413c080e5..a992f45270 100644 --- a/source/text/sbasic/shared/03102100.xhp +++ b/source/text/sbasic/shared/03102100.xhp @@ -153,6 +153,9 @@ <paragraph id="par_idm871025984" role="bascode" localize="false"> Next i</paragraph> <paragraph id="par_idm871024752" role="bascode" localize="false">End Sub</paragraph> </bascode> -</body> + <section id="relatedtopics"> + <embed href="text/sbasic/shared/new_keyword.xhp#NewOperator_h1"/> + </section> +</body> </helpdocument>
\ No newline at end of file diff --git a/source/text/sbasic/shared/03103700.xhp b/source/text/sbasic/shared/03103700.xhp index 8203a58d51..45f6ce0e04 100644 --- a/source/text/sbasic/shared/03103700.xhp +++ b/source/text/sbasic/shared/03103700.xhp @@ -30,7 +30,6 @@ <section id="set"> <bookmark xml-lang="en-US" branch="index" id="bm_id3154422"> <bookmark_value>Set statement</bookmark_value> - <bookmark_value>New keyword</bookmark_value> <bookmark_value>Nothing object</bookmark_value> </bookmark> @@ -69,5 +68,8 @@ </bascode> <tip id="par_id841586014507226" xml-lang="en-US"><literal>New</literal> creates UNO objects or <link href="text/sbasic/shared/classmodule" name="ClassModule">class module</link> objects, before assigning it to a variable.</tip> + <section id="relatedtopics"> + <embed href="text/sbasic/shared/new_keyword.xhp#NewOperator_h1"/> + </section> </body> </helpdocument>
\ No newline at end of file diff --git a/source/text/sbasic/shared/03132400.xhp b/source/text/sbasic/shared/03132400.xhp index 32c3b0573f..665fe359d1 100644 --- a/source/text/sbasic/shared/03132400.xhp +++ b/source/text/sbasic/shared/03132400.xhp @@ -24,29 +24,36 @@ <filename>/text/sbasic/shared/03132400.xhp</filename> </topic> </meta> - <body> -<section id="createobject"> -<bookmark xml-lang="en-US" branch="index" id="bm_id659810"> - <bookmark_value>CreateObject function</bookmark_value> -</bookmark> -<paragraph id="par_idN10580" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03132400.xhp">CreateObject Function</link></paragraph> -<paragraph id="par_idN10590" role="paragraph" xml-lang="en-US"><ahelp hid=".">Creates a UNO object. On Windows, can also create OLE objects.</ahelp><comment>see i70942</comment></paragraph> -<paragraph id="par_idN1059F" role="paragraph" xml-lang="en-US">This method creates instances of the type that is passed as parameter.</paragraph> -</section> -<embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> -<paragraph id="par_idN105A6" role="code" xml-lang="en-US">oObj = CreateObject( type )</paragraph> -<embed href="text/sbasic/shared/00000003.xhp#functexample"/> -<bascode> -<paragraph id="par_idm1341251920" role="bascode" localize="false" xml-lang="en-US">Type address</paragraph> -<paragraph id="par_idm1341250688" role="bascode" localize="false" xml-lang="en-US"> Name1 As String</paragraph> -<paragraph id="par_idm1341249456" role="bascode" localize="false" xml-lang="en-US"> City As String</paragraph> -<paragraph id="par_idm1341248224" role="bascode" localize="false" xml-lang="en-US">End Type</paragraph> -<paragraph id="par_idm1341246992" role="bascode" localize="false" xml-lang="en-US"> </paragraph> -<paragraph id="par_idm1341245744" role="bascode" localize="false" xml-lang="en-US">Sub main</paragraph> -<paragraph id="par_idm1341244512" role="bascode" localize="false" xml-lang="en-US"> myaddress = CreateObject("address")</paragraph> -<paragraph id="par_idm1341243264" role="bascode" localize="false" xml-lang="en-US"> MsgBox IsObject(myaddress)</paragraph> -<paragraph id="par_idm1341242016" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> -</bascode> + <section id="createobject"> + <bookmark xml-lang="en-US" branch="index" id="bm_id659810"> + <bookmark_value>CreateObject function</bookmark_value> + </bookmark> + <h1 id="par_idN10580"><variable id="CreateObject_h1"><link href="text/sbasic/shared/03132400.xhp">CreateObject Function</link></variable></h1> + <paragraph id="par_idN10590" role="paragraph" xml-lang="en-US"><ahelp hid=".">Creates a UNO object. On Windows, can also create OLE objects.</ahelp><comment>see i70942</comment></paragraph> + <paragraph id="par_idN1059F" role="paragraph" xml-lang="en-US">This method creates instances of the type that is passed as parameter.</paragraph> + </section> + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <paragraph role="paragraph" localize="false" id="par_id721633632080570"> + <input>oObj = CreateObject(type)</input> + </paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> + <paragraph role="paragraph" id="par_id191633632167310"><emph>type:</emph> the type of the object to be created, as a string.</paragraph> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + <bascode> + <paragraph id="par_idm1341251920" role="bascode" localize="false">Type address</paragraph> + <paragraph id="par_idm1341250688" role="bascode" localize="false"> Name1 As String</paragraph> + <paragraph id="par_idm1341249456" role="bascode" localize="false"> City As String</paragraph> + <paragraph id="par_idm1341248224" role="bascode" localize="false">End Type</paragraph> + <paragraph id="par_idm1341246992" role="bascode" localize="false"> </paragraph> + <paragraph id="par_idm1341245744" role="bascode" localize="false">Sub main</paragraph> + <paragraph id="par_idm1341244512" role="bascode" localize="false"> myaddress = CreateObject("address")</paragraph> + <paragraph id="par_idm1341243264" role="bascode" localize="false"> MsgBox IsObject(myaddress)</paragraph> + <paragraph id="par_idm1341242016" role="bascode" localize="false">End Sub</paragraph> + </bascode> + + <section id="relatedtopics"> + <embed href="text/sbasic/shared/new_keyword.xhp#NewOperator_h1"/> + </section> </body> </helpdocument> diff --git a/source/text/sbasic/shared/new_keyword.xhp b/source/text/sbasic/shared/new_keyword.xhp new file mode 100644 index 0000000000..95d2ccff84 --- /dev/null +++ b/source/text/sbasic/shared/new_keyword.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/. + * + * 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="newkeywordtopic" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">New Operator</title> + <filename>/text/sbasic/shared/new_keyword.xhp</filename> + </topic> +</meta> +<body> + <section id="new_keyword_desc"> + <bookmark xml-lang="en-US" branch="index" id="bm_id3149205"> + <bookmark_value>New Operator</bookmark_value> + </bookmark> + <h1 id="hd_id791633472607429"><variable id="NewOperator_h1"><link href="text/sbasic/shared/new_keyword.xhp" name="New_Operator">New Operator</link></variable></h1> + <paragraph role="paragraph" id="par_id3145090">Use the <literal>New</literal> operator to instantiate objects of user-defined types, as well as Uno services, structs and enumerations.</paragraph> + </section> + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <paragraph role="paragraph" localize="false" id="par_id711633530276845"> + <input>Dim oObj as New ObjectType</input> + </paragraph> + <paragraph role="paragraph" localize="false" id="par_id411633630491643"> + <input>oObj = New ObjectType</input> + </paragraph> + <note id="par_id831633630704012">The <literal>New</literal> operator can be used either during variable declaration or in an assignment operation.</note> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + <paragraph role="paragraph" id="par_id621633630563936">The following example uses the <literal>New</literal> operator to create an instance of the <literal>PropertyValue</literal> Uno struct.</paragraph> + <bascode> + <paragraph role="bascode" id="bas_id631633630856218">' Instantiating the object during variable declaration</paragraph> + <paragraph role="bascode" localize="false" id="bas_id801633630856388">Dim oProp1 as New com.sun.star.beans.PropertyValue</paragraph> + <paragraph role="bascode" localize="false" id="bas_id901633630856534">oProp1.Name = "Some name"</paragraph> + <paragraph role="bascode" localize="false" id="bas_id441633630856694">oProp1.Value = 100</paragraph> + <paragraph role="bascode" id="bas_id11633631135918">' The same can be accomplished with an assignment</paragraph> + <paragraph role="bascode" localize="false" id="bas_id821633631136215">Dim oProp2 as Object</paragraph> + <paragraph role="bascode" localize="false" id="bas_id851633631136449">oProp2 = New com.sun.star.beans.PropertyValue</paragraph> + <paragraph role="bascode" localize="false" id="bas_id461633631136636">oProp2.Name = "Other name"</paragraph> + <paragraph role="bascode" localize="false" id="bas_id121633631136838">oProp2.Value = 200</paragraph> + </bascode> + <paragraph role="paragraph" id="par_id971633631328827">The example below creates a new type <literal>Student</literal> and instantiates an object of this type:</paragraph> + <bascode> + <paragraph role="bascode" localize="false" id="bas_id981633473836933">Type Student</paragraph> + <paragraph role="bascode" localize="false" id="bas_id941633473837598"> FirstName as String</paragraph> + <paragraph role="bascode" localize="false" id="bas_id941633473837123"> Program as String</paragraph> + <paragraph role="bascode" localize="false" id="bas_id371633532557876">End Type</paragraph> + <paragraph role="bascode" localize="false" id="bas_id301633532616004"></paragraph> + <paragraph role="bascode" localize="false" id="bas_id481633532558146">Sub TestObjects</paragraph> + <paragraph role="bascode" localize="false" id="bas_id471633532558363"> Dim oStudent1 as New Student</paragraph> + <paragraph role="bascode" localize="false" id="bas_id991633532558572"> oStudent1.FirstName = "John"</paragraph> + <paragraph role="bascode" localize="false" id="bas_id181633532558771"> oStudent2.Program = "Computer Science"</paragraph> + <paragraph role="bascode" localize="false" id="bas_id501633532559284">End Sub</paragraph> + </bascode> + + <section id="relatedtopics"> + <embed href="text/sbasic/shared/03102100.xhp#Dimh1"/> + <embed href="text/sbasic/shared/03132400.xhp#CreateObject_h1"/> + <embed href="text/sbasic/shared/03103700.xhp#Set_h1"/> + <embed href="text/sbasic/shared/03090413.xhp#Type_h1"/> + </section> +</body> +</helpdocument> |