1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Comment" script:language="StarBasic">&apos; *** MODULE COMMENT ***
4
5Dim oDialog AS Object
6Dim document AS Object
7
8&apos;=======================================================
9&apos; Main
10&apos;-------------------------------------------------------
11&apos; Inserts a comment
12&apos;=======================================================
13Sub Main
14
15	If not IsHelpFile Then
16		msgbox(strErr_NoHelpFile)
17		Exit Sub
18	End If
19
20	document = StarDesktop.CurrentComponent
21
22	BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
23	oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgComment&quot;)
24	oDialogModel = oDialog.Model
25
26	if not IsHelpFile Then
27		msgbox(strErr_NoHelpFile)
28		Exit Sub
29	End If
30
31	oTxtComment = oDialog.GetControl(&quot;txtComment&quot;)
32
33	If oDialog.Execute() = 1 Then
34		oSel = thiscomponent.getcurrentcontroller.getselection
35		oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
36		oCur.gotoStartOfParagraph(0)
37		oCur.gotoEndOfParagraph(1)
38
39		If oCur.GetString = &quot;&quot; Then
40			SetParaStyle(&quot;hlp_aux_comment&quot;)
41		End If
42
43		If oTxtComment.Text &lt;&gt; &quot;&quot; Then
44			InsertTag(&quot;COMMENT_&quot;,&quot;&lt;COMMENT&gt;&quot;)
45			SetCharStyle(&quot;hlp_aux_comment&quot;)
46			InsertTag(&quot;COMMENT&quot;,oTxtComment.Text)
47			InsertTag(&quot;_COMMENT&quot;,&quot;&lt;/COMMENT&gt;&quot;)
48		End If
49	End If
50
51	oDialog.dispose
52
53End Sub
54
55</script:module>