1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Comment" script:language="StarBasic">&apos; *** MODULE COMMENT ***
24
25Dim oDialog AS Object
26Dim document AS Object
27
28&apos;=======================================================
29&apos; Main
30&apos;-------------------------------------------------------
31&apos; Inserts a comment
32&apos;=======================================================
33Sub Main
34
35	If not IsHelpFile Then
36		msgbox(strErr_NoHelpFile)
37		Exit Sub
38	End If
39
40	document = StarDesktop.CurrentComponent
41
42	BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
43	oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgComment&quot;)
44	oDialogModel = oDialog.Model
45
46	if not IsHelpFile Then
47		msgbox(strErr_NoHelpFile)
48		Exit Sub
49	End If
50
51	oTxtComment = oDialog.GetControl(&quot;txtComment&quot;)
52
53	If oDialog.Execute() = 1 Then
54		oSel = thiscomponent.getcurrentcontroller.getselection
55		oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
56		oCur.gotoStartOfParagraph(0)
57		oCur.gotoEndOfParagraph(1)
58
59		If oCur.GetString = &quot;&quot; Then
60			SetParaStyle(&quot;hlp_aux_comment&quot;)
61		End If
62
63		If oTxtComment.Text &lt;&gt; &quot;&quot; Then
64			InsertTag(&quot;COMMENT_&quot;,&quot;&lt;COMMENT&gt;&quot;)
65			SetCharStyle(&quot;hlp_aux_comment&quot;)
66			InsertTag(&quot;COMMENT&quot;,oTxtComment.Text)
67			InsertTag(&quot;_COMMENT&quot;,&quot;&lt;/COMMENT&gt;&quot;)
68		End If
69	End If
70
71	oDialog.dispose
72
73End Sub
74
75</script:module>
76