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