11ecadb57SMathias Bauer<?xml version="1.0" encoding="UTF-8"?> 21ecadb57SMathias Bauer<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*3e02b54dSAndrew Rist<!--*********************************************************** 4*3e02b54dSAndrew Rist * 5*3e02b54dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 6*3e02b54dSAndrew Rist * or more contributor license agreements. See the NOTICE file 7*3e02b54dSAndrew Rist * distributed with this work for additional information 8*3e02b54dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 9*3e02b54dSAndrew Rist * to you under the Apache License, Version 2.0 (the 10*3e02b54dSAndrew Rist * "License"); you may not use this file except in compliance 11*3e02b54dSAndrew Rist * with the License. You may obtain a copy of the License at 12*3e02b54dSAndrew Rist * 13*3e02b54dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14*3e02b54dSAndrew Rist * 15*3e02b54dSAndrew Rist * Unless required by applicable law or agreed to in writing, 16*3e02b54dSAndrew Rist * software distributed under the License is distributed on an 17*3e02b54dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18*3e02b54dSAndrew Rist * KIND, either express or implied. See the License for the 19*3e02b54dSAndrew Rist * specific language governing permissions and limitations 20*3e02b54dSAndrew Rist * under the License. 21*3e02b54dSAndrew Rist * 22*3e02b54dSAndrew Rist ***********************************************************--> 231ecadb57SMathias Bauer<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HID" script:language="StarBasic">' *** MODULE HID *** 241ecadb57SMathias Bauer 251ecadb57SMathias BauerDim oDialog AS Object 261ecadb57SMathias BauerDim document AS Object 271ecadb57SMathias Bauer 281ecadb57SMathias BauerSub Main 291ecadb57SMathias Bauer 301ecadb57SMathias Bauer If not IsHelpFile Then 311ecadb57SMathias Bauer msgbox(strErr_NoHelpFile) 321ecadb57SMathias Bauer Exit Sub 331ecadb57SMathias Bauer End If 341ecadb57SMathias Bauer 351ecadb57SMathias Bauer document = StarDesktop.CurrentComponent 361ecadb57SMathias Bauer 371ecadb57SMathias Bauer BasicLibraries.LoadLibrary("HelpAuthoring") 381ecadb57SMathias Bauer oDialog = LoadDialog("HelpAuthoring", "dlgHID") 391ecadb57SMathias Bauer oDialogModel = oDialog.Model 401ecadb57SMathias Bauer 411ecadb57SMathias Bauer' oPath = createUNOService("com.sun.star.util.PathSettings") 421ecadb57SMathias Bauer' filename = oPath.UserConfig+"/help_hid.lst" 431ecadb57SMathias Bauer' oButHIDList = oDialog.GetControl("butHIDList") 441ecadb57SMathias Bauer' If FileExists(filename) Then 451ecadb57SMathias Bauer' oButHIDList.Enable = true 461ecadb57SMathias Bauer' Else 471ecadb57SMathias Bauer' oLblWait = oDialog.GetControl("lblWait") 481ecadb57SMathias Bauer' oLblWait.Text = "No hid list found in your config folder" 491ecadb57SMathias Bauer' oButHIDList.Enable = false 501ecadb57SMathias Bauer' End If 511ecadb57SMathias Bauer oTxtHID = oDialog.GetControl("txtHID") 521ecadb57SMathias Bauer 531ecadb57SMathias Bauer ' Check if bookmarks are allowed here 541ecadb57SMathias Bauer If IsInList Then 551ecadb57SMathias Bauer msgbox "No Bookmarks allowed inside a list.", 48, "D'oh!" 561ecadb57SMathias Bauer Exit Sub 571ecadb57SMathias Bauer End If 581ecadb57SMathias Bauer 591ecadb57SMathias Bauer ' Find out if we are in front of an existing HID 601ecadb57SMathias Bauer If oDialog.Execute() = 1 Then 611ecadb57SMathias Bauer 621ecadb57SMathias Bauer If oTxtHID.Text = "" Then 631ecadb57SMathias Bauer msgbox "Empty Help ID. No Help ID element added." 641ecadb57SMathias Bauer Else 651ecadb57SMathias Bauer If IsInBookmark > 0 or Not(ParaIsEmpty) Then 661ecadb57SMathias Bauer CR 671ecadb57SMathias Bauer End If 681ecadb57SMathias Bauer If not(join(split(oTxtHID.Text," "),"") = oTxtHID.Text) Then 691ecadb57SMathias Bauer' msgbox "Help ID seems to contain forbidden characters (like spaces). You may need to verify this." 701ecadb57SMathias Bauer' HID and uno command 711ecadb57SMathias Bauer arHID = split(oTxtHID.Text," ") 721ecadb57SMathias Bauer sHID = arHID(0) 731ecadb57SMathias Bauer sUNO = arHID(1) 741ecadb57SMathias Bauer Else 751ecadb57SMathias Bauer sHID = oTxtHID.Text 761ecadb57SMathias Bauer sUNO = "" 771ecadb57SMathias Bauer End If 781ecadb57SMathias Bauer 791ecadb57SMathias Bauer If sHID <> "" Then 801ecadb57SMathias Bauer bmid = CreateID 811ecadb57SMathias Bauer InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sHID + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark") 821ecadb57SMathias Bauer End If 831ecadb57SMathias Bauer If sUNO <> "" Then 841ecadb57SMathias Bauer bmid = CreateID 851ecadb57SMathias Bauer InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sUNO + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark") 861ecadb57SMathias Bauer End If 871ecadb57SMathias Bauer 881ecadb57SMathias Bauer End If 891ecadb57SMathias Bauer End If 901ecadb57SMathias Bauer oDialog.dispose 911ecadb57SMathias Bauer 921ecadb57SMathias BauerEnd Sub 931ecadb57SMathias Bauer 941ecadb57SMathias BauerSub ConvertToSymbol 951ecadb57SMathias Bauer oPath = createUNOService("com.sun.star.util.PathSettings") 961ecadb57SMathias Bauer filename = oPath.UserConfig+"/help_hid.lst" 971ecadb57SMathias Bauer oTxtHID = oDialog.GetControl("txtHID") 981ecadb57SMathias Bauer oButHIDList = oDialog.GetControl("butHIDList") 991ecadb57SMathias Bauer sHID = oTxtHID.Text 1001ecadb57SMathias Bauer sCt = 0 1011ecadb57SMathias Bauer If FileExists(filename) AND sHID <> "" Then 1021ecadb57SMathias Bauer oLblWait = oDialog.GetControl("lblWait") 1031ecadb57SMathias Bauer oLblWait.Text = "Searching help_hid.lst. Please wait..." 1041ecadb57SMathias Bauer iNumber = Freefile 1051ecadb57SMathias Bauer bFound = false 1061ecadb57SMathias Bauer Open filename For Input As iNumber 1071ecadb57SMathias Bauer Do While (not eof(iNumber) AND not(bFound)) 1081ecadb57SMathias Bauer Line Input #iNumber, sLine 1091ecadb57SMathias Bauer sCt = sCt+1 1101ecadb57SMathias Bauer arHID = split(sLine,",") 1111ecadb57SMathias Bauer If arHID(1) = sHID Then 1121ecadb57SMathias Bauer If arHID(2) <> "" Then 1131ecadb57SMathias Bauer symHID = arHID(0) + " " + arHID(2) 1141ecadb57SMathias Bauer Else 1151ecadb57SMathias Bauer symHID = arHID(0) 1161ecadb57SMathias Bauer End If 1171ecadb57SMathias Bauer bFound = true 1181ecadb57SMathias Bauer End If 1191ecadb57SMathias Bauer Loop 1201ecadb57SMathias Bauer Close #iNumber 1211ecadb57SMathias Bauer If not bFound Then 1221ecadb57SMathias Bauer oLblWait.Text = "Nothing found. Searched "+sCt+" Help IDs" 1231ecadb57SMathias Bauer Else 1241ecadb57SMathias Bauer oTxtHID.Text = symHID 1251ecadb57SMathias Bauer oLblWait.Text = "HelpID found. Searched "+sCt+" Help IDs" 1261ecadb57SMathias Bauer oButHIDList.Enable = false 1271ecadb57SMathias Bauer End If 1281ecadb57SMathias Bauer Else 1291ecadb57SMathias Bauer oLblWait.Text = "No help_hid.lst found in your config folder" 1301ecadb57SMathias Bauer End If 1311ecadb57SMathias BauerEnd Sub 1321ecadb57SMathias Bauer 133*3e02b54dSAndrew Rist</script:module> 134