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">' *** MODULE COMMENT *** 24 25Dim oDialog AS Object 26Dim document AS Object 27 28'======================================================= 29' Main 30'------------------------------------------------------- 31' Inserts a comment 32'======================================================= 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("HelpAuthoring") 43 oDialog = LoadDialog("HelpAuthoring", "dlgComment") 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("txtComment") 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 = "" Then 60 SetParaStyle("hlp_aux_comment") 61 End If 62 63 If oTxtComment.Text <> "" Then 64 InsertTag("COMMENT_","<COMMENT>") 65 SetCharStyle("hlp_aux_comment") 66 InsertTag("COMMENT",oTxtComment.Text) 67 InsertTag("_COMMENT","</COMMENT>") 68 End If 69 End If 70 71 oDialog.dispose 72 73End Sub 74 75</script:module> 76