| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> |
| <!--*********************************************************** |
| * |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| * |
| ***********************************************************--> |
| <script:module xmlns:script="http://openoffice.org/2000/script" script:name="HID" script:language="StarBasic">' *** MODULE HID *** |
| |
| Dim oDialog AS Object |
| Dim document AS Object |
| |
| Sub Main |
| |
| If not IsHelpFile Then |
| msgbox(strErr_NoHelpFile) |
| Exit Sub |
| End If |
| |
| document = StarDesktop.CurrentComponent |
| |
| BasicLibraries.LoadLibrary("HelpAuthoring") |
| oDialog = LoadDialog("HelpAuthoring", "dlgHID") |
| oDialogModel = oDialog.Model |
| |
| ' oPath = createUNOService("com.sun.star.util.PathSettings") |
| ' filename = oPath.UserConfig+"/help_hid.lst" |
| ' oButHIDList = oDialog.GetControl("butHIDList") |
| ' If FileExists(filename) Then |
| ' oButHIDList.Enable = true |
| ' Else |
| ' oLblWait = oDialog.GetControl("lblWait") |
| ' oLblWait.Text = "No hid list found in your config folder" |
| ' oButHIDList.Enable = false |
| ' End If |
| oTxtHID = oDialog.GetControl("txtHID") |
| |
| ' Check if bookmarks are allowed here |
| If IsInList Then |
| msgbox "No Bookmarks allowed inside a list.", 48, "D'oh!" |
| Exit Sub |
| End If |
| |
| ' Find out if we are in front of an existing HID |
| If oDialog.Execute() = 1 Then |
| |
| If oTxtHID.Text = "" Then |
| msgbox "Empty Help ID. No Help ID element added." |
| Else |
| If IsInBookmark > 0 or Not(ParaIsEmpty) Then |
| CR |
| End If |
| If not(join(split(oTxtHID.Text," "),"") = oTxtHID.Text) Then |
| ' msgbox "Help ID seems to contain forbidden characters (like spaces). You may need to verify this." |
| ' HID and uno command |
| arHID = split(oTxtHID.Text," ") |
| sHID = arHID(0) |
| sUNO = arHID(1) |
| Else |
| sHID = oTxtHID.Text |
| sUNO = "" |
| End If |
| |
| If sHID <> "" Then |
| bmid = CreateID |
| InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sHID + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark") |
| End If |
| If sUNO <> "" Then |
| bmid = CreateID |
| InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sUNO + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark") |
| End If |
| |
| End If |
| End If |
| oDialog.dispose |
| |
| End Sub |
| |
| Sub ConvertToSymbol |
| oPath = createUNOService("com.sun.star.util.PathSettings") |
| filename = oPath.UserConfig+"/help_hid.lst" |
| oTxtHID = oDialog.GetControl("txtHID") |
| oButHIDList = oDialog.GetControl("butHIDList") |
| sHID = oTxtHID.Text |
| sCt = 0 |
| If FileExists(filename) AND sHID <> "" Then |
| oLblWait = oDialog.GetControl("lblWait") |
| oLblWait.Text = "Searching help_hid.lst. Please wait..." |
| iNumber = Freefile |
| bFound = false |
| Open filename For Input As iNumber |
| Do While (not eof(iNumber) AND not(bFound)) |
| Line Input #iNumber, sLine |
| sCt = sCt+1 |
| arHID = split(sLine,",") |
| If arHID(1) = sHID Then |
| If arHID(2) <> "" Then |
| symHID = arHID(0) + " " + arHID(2) |
| Else |
| symHID = arHID(0) |
| End If |
| bFound = true |
| End If |
| Loop |
| Close #iNumber |
| If not bFound Then |
| oLblWait.Text = "Nothing found. Searched "+sCt+" Help IDs" |
| Else |
| oTxtHID.Text = symHID |
| oLblWait.Text = "HelpID found. Searched "+sCt+" Help IDs" |
| oButHIDList.Enable = false |
| End If |
| Else |
| oLblWait.Text = "No help_hid.lst found in your config folder" |
| End If |
| End Sub |
| |
| </script:module> |