' *** 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
' *** 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