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="HID" script:language="StarBasic">' *** MODULE HID *** 24 25Dim oDialog AS Object 26Dim document AS Object 27 28Sub Main 29 30 If not IsHelpFile Then 31 msgbox(strErr_NoHelpFile) 32 Exit Sub 33 End If 34 35 document = StarDesktop.CurrentComponent 36 37 BasicLibraries.LoadLibrary("HelpAuthoring") 38 oDialog = LoadDialog("HelpAuthoring", "dlgHID") 39 oDialogModel = oDialog.Model 40 41' oPath = createUNOService("com.sun.star.util.PathSettings") 42' filename = oPath.UserConfig+"/help_hid.lst" 43' oButHIDList = oDialog.GetControl("butHIDList") 44' If FileExists(filename) Then 45' oButHIDList.Enable = true 46' Else 47' oLblWait = oDialog.GetControl("lblWait") 48' oLblWait.Text = "No hid list found in your config folder" 49' oButHIDList.Enable = false 50' End If 51 oTxtHID = oDialog.GetControl("txtHID") 52 53 ' Check if bookmarks are allowed here 54 If IsInList Then 55 msgbox "No Bookmarks allowed inside a list.", 48, "D'oh!" 56 Exit Sub 57 End If 58 59 ' Find out if we are in front of an existing HID 60 If oDialog.Execute() = 1 Then 61 62 If oTxtHID.Text = "" Then 63 msgbox "Empty Help ID. No Help ID element added." 64 Else 65 If IsInBookmark > 0 or Not(ParaIsEmpty) Then 66 CR 67 End If 68 If not(join(split(oTxtHID.Text," "),"") = oTxtHID.Text) Then 69' msgbox "Help ID seems to contain forbidden characters (like spaces). You may need to verify this." 70' HID and uno command 71 arHID = split(oTxtHID.Text," ") 72 sHID = arHID(0) 73 sUNO = arHID(1) 74 Else 75 sHID = oTxtHID.Text 76 sUNO = "" 77 End If 78 79 If sHID <> "" Then 80 bmid = CreateID 81 InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sHID + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark") 82 End If 83 If sUNO <> "" Then 84 bmid = CreateID 85 InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sUNO + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark") 86 End If 87 88 End If 89 End If 90 oDialog.dispose 91 92End Sub 93 94Sub ConvertToSymbol 95 oPath = createUNOService("com.sun.star.util.PathSettings") 96 filename = oPath.UserConfig+"/help_hid.lst" 97 oTxtHID = oDialog.GetControl("txtHID") 98 oButHIDList = oDialog.GetControl("butHIDList") 99 sHID = oTxtHID.Text 100 sCt = 0 101 If FileExists(filename) AND sHID <> "" Then 102 oLblWait = oDialog.GetControl("lblWait") 103 oLblWait.Text = "Searching help_hid.lst. Please wait..." 104 iNumber = Freefile 105 bFound = false 106 Open filename For Input As iNumber 107 Do While (not eof(iNumber) AND not(bFound)) 108 Line Input #iNumber, sLine 109 sCt = sCt+1 110 arHID = split(sLine,",") 111 If arHID(1) = sHID Then 112 If arHID(2) <> "" Then 113 symHID = arHID(0) + " " + arHID(2) 114 Else 115 symHID = arHID(0) 116 End If 117 bFound = true 118 End If 119 Loop 120 Close #iNumber 121 If not bFound Then 122 oLblWait.Text = "Nothing found. Searched "+sCt+" Help IDs" 123 Else 124 oTxtHID.Text = symHID 125 oLblWait.Text = "HelpID found. Searched "+sCt+" Help IDs" 126 oButHIDList.Enable = false 127 End If 128 Else 129 oLblWait.Text = "No help_hid.lst found in your config folder" 130 End If 131End Sub 132 133</script:module> 134