helpauthoring/Addons.xcu                                                     | 
 216 +
 helpauthoring/Filter.xcu                                                     | 
  34 
 helpauthoring/HelpAuthoring/Comment.xba                                      | 
  72 
 helpauthoring/HelpAuthoring/Embed.xba                                        | 
 344 +
 helpauthoring/HelpAuthoring/Find.xba                                         | 
 166 
 helpauthoring/HelpAuthoring/HID.xba                                          | 
 130 
 helpauthoring/HelpAuthoring/Helpers.xba                                      | 
1104 +++++
 helpauthoring/HelpAuthoring/IND.xba                                          | 
 178 
 helpauthoring/HelpAuthoring/Link.xba                                         | 
 100 
 helpauthoring/HelpAuthoring/Meta.xba                                         | 
 196 +
 helpauthoring/HelpAuthoring/Module1.xba                                      | 
  23 
 helpauthoring/HelpAuthoring/OtherElements.xba                                | 
 514 ++
 helpauthoring/HelpAuthoring/Switch.xba                                       | 
 335 +
 helpauthoring/HelpAuthoring/TOC.xba                                          | 
 153 
 helpauthoring/HelpAuthoring/Table.xba                                        | 
  35 
 helpauthoring/HelpAuthoring/Validate.xba                                     | 
 722 +++
 helpauthoring/HelpAuthoring/_Main.xba                                        | 
 213 +
 helpauthoring/HelpAuthoring/dialog.xlb                                       | 
  20 
 helpauthoring/HelpAuthoring/dlgCase.xdl                                      | 
  39 
 helpauthoring/HelpAuthoring/dlgComment.xdl                                   | 
  30 
 helpauthoring/HelpAuthoring/dlgConfigure.xdl                                 | 
  29 
 helpauthoring/HelpAuthoring/dlgEmbed.xdl                                     | 
  52 
 helpauthoring/HelpAuthoring/dlgFind.xdl                                      | 
  30 
 helpauthoring/HelpAuthoring/dlgHID.xdl                                       | 
  31 
 helpauthoring/HelpAuthoring/dlgIND.xdl                                       | 
  48 
 helpauthoring/HelpAuthoring/dlgLink.xdl                                      | 
  32 
 helpauthoring/HelpAuthoring/dlgMeta.xdl                                      | 
  44 
 helpauthoring/HelpAuthoring/dlgObjProp.xdl                                   | 
  34 
 helpauthoring/HelpAuthoring/dlgRepeatFind.xdl                                | 
  30 
 helpauthoring/HelpAuthoring/dlgSwitch.xdl                                    | 
  31 
 helpauthoring/HelpAuthoring/dlgTOC.xdl                                       | 
  43 
 helpauthoring/HelpAuthoring/dlgTable.xdl                                     | 
  32 
 helpauthoring/HelpAuthoring/dlgWarn.xdl                                      | 
  32 
 helpauthoring/HelpAuthoring/dlg_BrowseEmbed.xdl                              | 
  43 
 helpauthoring/HelpAuthoring/script.xlb                                       | 
  18 
 helpauthoring/META-INF/manifest.xml                                          | 
  26 
 helpauthoring/Paths.xcu                                                      | 
  35 
 helpauthoring/Type.xcu                                                       | 
  34 
 helpauthoring/description.xml                                                | 
  37 
 helpauthoring/filter/soffice2xmlhelp.xsl                                     | 
1315 ++++++
 helpauthoring/filter/xmlhelp.dtd                                             | 
 233 +
 helpauthoring/filter/xmlhelp2soffice.xsl                                     | 
1937 ++++++++++
 helpauthoring/help/en-US/help.tree                                           | 
  35 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-docroot.xhp         | 
  37 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-elements.xhp        | 
  42 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-extendedtips.xhp    | 
  35 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-hidsindex.xhp       | 
  37 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-ids.xhp             | 
  46 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-l10n.xhp            | 
  35 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-metadata.xhp        | 
  35 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-newfile.xhp         | 
  35 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-specialsections.xhp | 
  55 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-switch.xhp          | 
  32 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-transclude.xhp      | 
  37 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/ha-validating.xhp      | 
  35 
 helpauthoring/help/en-US/org.openoffice.helpauthoring/helpauthoring.xhp      | 
  35 
 helpauthoring/images/dialog-question.png                                     
|binary
 helpauthoring/images/emblem-symbolic-link.png                                
|binary
 helpauthoring/images/favorites.png                                           
|binary
 helpauthoring/images/web-browser.png                                         
|binary
 helpauthoring/template/Help/xmlhelptemplate.ott                              
|binary
 61 files changed, 9301 insertions(+)

New commits:
commit 2145f670bf16c51ee417763c22d5c9b3a25659d5
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Fri Jul 3 16:11:14 2015 +0200

    helpauthoring: New release.
    
    To release the new .oxt, it is enough to:
    
    cd dev-tools/helpauthoring
    zip -r ~/HelpAuthoring-3.0-`date +%Y%m%d`.oxt .

diff --git a/helpauthoring/HelpAuthoring/_Main.xba 
b/helpauthoring/HelpAuthoring/_Main.xba
index 9e1e065..84182e1 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -24,7 +24,7 @@
 &apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 &apos; #
 
-Global Const Version = &quot;v3.20150605&quot;
+Global Const Version = &quot;v3.20150703&quot;
 
 Global Const strErr_NoHelpFile = &quot;Not a Help File&quot;
 
diff --git a/helpauthoring/description.xml b/helpauthoring/description.xml
index c8cdf68..ec7082d 100644
--- a/helpauthoring/description.xml
+++ b/helpauthoring/description.xml
@@ -21,7 +21,7 @@
 
         <identifier value="org.openoffice.helpauthoring"/>
 
-        <version value="3.0-20150605"/>
+        <version value="3.0-20150703"/>
         <display-name>
             <name lang="en">Help authoring extension tool</name>
         </display-name>
commit 2ea6bf8143a7ca20d6bee3bff6b80d2cf5c29fbe
Author: Olivier Hallot <olivier.hal...@edx.srv.br>
Date:   Fri Jul 3 16:06:44 2015 +0200

    helpauthoring: Menu entry to get filepicker set to xhp when opening files.

diff --git a/helpauthoring/Addons.xcu b/helpauthoring/Addons.xcu
index 2ce8e1d..7330bce 100644
--- a/helpauthoring/Addons.xcu
+++ b/helpauthoring/Addons.xcu
@@ -29,6 +29,15 @@
                     <value>com.sun.star.text.TextDocument</value>
                 </prop>
                 <node oor:name="Submenu">
+                    <node oor:name="m00" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring._Main.OpenXHP?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Open Help File</value>
+                        </prop>
+                    </node>
                     <node oor:name="m01" oor:op="replace">
                         <prop oor:name="URL" oor:type="xs:string">
                             
<value>vnd.sun.star.script:HelpAuthoring._Main.CreateFile?language=Basic&amp;location=application</value>
diff --git a/helpauthoring/HelpAuthoring/_Main.xba 
b/helpauthoring/HelpAuthoring/_Main.xba
index 317dd04..9e1e065 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -187,4 +187,27 @@ End Sub
 Sub DisplayVersion
     msgbox &quot;LibreOffice Help Authoring 
Framework&quot;+chr(13)+&quot;Version &quot;+Version,256
 End Sub
+
+Sub OpenXHP
+Dim ListAny(0) as Long
+Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
+
+    sLastSaveDir = ReadConfig(&quot;LastSaveDir&quot;)
+    sDocRoot = ReadConfig(&quot;HelpPrefix&quot;)
+    ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+    oFileDialog = 
CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
+    oFileDialog.Initialize(ListAny())
+    oFileDialog.DisplayDirectory = sDocRoot
+    oFileDialog.AppendFilter(&quot;Help&quot;, &quot;*.xhp&quot;)
+    oFileDialog.SetTitle(&quot;Open Help File&quot;)
+    iAccept = oFileDialog.Execute()
+    If iAccept = 1 Then
+        sPath = oFileDialog.Files(0)
+        FileProperties(0).Name = &quot;FilterName&quot;
+        FileProperties(0).Value =&quot;XHP_Help&quot;
+        oDoc = StarDesktop.loadComponentFromURL(sPath, &quot;_blank&quot;, 0, 
FileProperties())
+    End If
+    oFileDialog.Dispose()
+End Sub
+
 </script:module>
commit db7f60b24ad69481734d1ddab6fa1f8aee8b7152
Author: Olivier Hallot <olivier.hal...@edx.srv.br>
Date:   Fri Jul 3 15:59:09 2015 +0200

    helpauthoring: Fix opening, editing and saving existing help files.

diff --git a/helpauthoring/HelpAuthoring/Meta.xba 
b/helpauthoring/HelpAuthoring/Meta.xba
index 29427c1..57d9b1c 100644
--- a/helpauthoring/HelpAuthoring/Meta.xba
+++ b/helpauthoring/HelpAuthoring/Meta.xba
@@ -47,7 +47,7 @@ Sub Main
 &apos;    End If
 
     oTxtTitle = oDialog.GetControl(&quot;txtTitle&quot;)
-    oTxtTitle.Text = document.DocumentInfo.Title
+    oTxtTitle.Text = document.DocumentProperties.Title
 
     oOpIndInc = oDialog.GetControl(&quot;opIndexInclude&quot;)
     oOpIndExc = oDialog.GetControl(&quot;opIndexExclude&quot;)
@@ -64,7 +64,10 @@ Sub Main
     &apos;End If
 
 
-    If 
document.DocumentInfo.GetUserFieldValue(GetUserFieldNumber(&quot;Indexer&quot;))
 = &quot;exclude&quot; then
+
+&apos;    If 
document.DocumentInfo.GetUserFieldValue(GetUserFieldNumber(&quot;Indexer&quot;))
 = &quot;exclude&quot; then
+    If document.DocumentProperties.UserDefinedProperties.Indexer = 
&quot;exclude&quot; then
+
         oOpIndExc.State = True
     Else
         oOpIndInc.State = True
@@ -80,7 +83,7 @@ Sub Main
     &apos;oTxtEdited.Text = document.DocumentInfo.GetUserFieldValue(3)
 
     If oDialog.Execute() = 1 Then &apos; update the meta data
-        document.DocumentInfo.Title = oTxtTitle.Text
+        document.DocumentProperties.Title = oTxtTitle.Text
         &apos;document.DocumentInfo.SetUserFieldValue(1,oTxtTopicID.Text)
         
&apos;document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber(&quot;Comment&quot;),oTxtComment.Text)
         &apos;document.DocumentInfo.SetUserFieldValue(3,oTxtEdited.Text)
@@ -92,9 +95,11 @@ Sub Main
         &apos;End If
 
         If oOpIndExc.State = True Then
-            
document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber(&quot;Indexer&quot;),&quot;exclude&quot;)
+            
&apos;document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber(&quot;Indexer&quot;),&quot;exclude&quot;)
+            document.DocumentProperties.UserDefinedProperties.Indexer = 
&quot;exclude&quot;
         Else
-            
document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber(&quot;Indexer&quot;),&quot;include&quot;)
+&apos;            
document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber(&quot;Indexer&quot;),&quot;include&quot;)
+            document.DocumentProperties.UserDefinedProperties.Indexer = 
&quot;include&quot;
         End If
     End If
     oDialog.dispose
@@ -122,6 +127,7 @@ Sub SetTopicID(txt As String)
     oTxtTopicID = oDialog.GetControl(&quot;txtTopicID&quot;)
     If txt = &quot;&quot; Then
         oTxtTopicID.Text = 
AlphaNum(document.DocumentInfo.PropertyValues(29).Value)
+&apos;        oTxtTopicID.Text = 
AlphaNum(document.DocumentProperties.UserDefinedProperties.Comments) &apos; OH 
need to find what is this...
     Else
         oTxtTopicID.Text = AlphaNum(txt)
     End If
diff --git a/helpauthoring/HelpAuthoring/Validate.xba 
b/helpauthoring/HelpAuthoring/Validate.xba
index f3b1143..862e32b 100644
--- a/helpauthoring/HelpAuthoring/Validate.xba
+++ b/helpauthoring/HelpAuthoring/Validate.xba
@@ -505,16 +505,25 @@ End Sub
 &apos;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Sub CheckMetaData(oDoc As Object)
 
-    sTopicID = oDoc.DocumentInfo.GetUserFieldValue(1)
+    &apos;sTopicID = oDoc.DocumentInfo.GetUserFieldValue(1)
+     sTopicID = oDoc.DocumentProperties.UserDefinedProperties.ID
+
+
 
     If sTopicID &lt;&gt; AlphaNum(sTopicID) OR sTopicID=&quot;&quot; Then
         sTopicID = &quot;topic_&quot;+CreateID &apos; create a topic id
     End If
 
-    oDoc.DocumentInfo.SetUserFieldValue(1,sTopicID)
-    sCreated = oDoc.DocumentInfo.GetUserFieldValue(2)
-    sEdited = oDoc.DocumentInfo.GetUserFieldValue(3)
-    sTitle = oDoc.DocumentInfo.Title
+    &apos;oDoc.DocumentInfo.SetUserFieldValue(1,sTopicID)
+    oDoc.DocumentProperties.UserDefinedProperties.ID = sTopicID
+
+
+    &apos;sCreated = oDoc.DocumentInfo.GetUserFieldValue(2) &apos; OH not 
used...
+    sCreated = oDoc.DocumentProperties.CreationDate
+    &apos;sEdited = oDoc.DocumentInfo.GetUserFieldValue(3) &apos; OH not used
+
+    &apos;sTitle = oDoc.DocumentInfo.Title
+    sTitle = oDoc.DocumentProperties.Title
 
     If sTitle=&quot;&quot; OR sTitle=&quot;&lt;Set Topic Title&gt;&quot; Then
         Enum = document.Text.createEnumeration
@@ -529,14 +538,14 @@ Sub CheckMetaData(oDoc As Object)
                             strg = strg + TextPortion.String
                         End If
                     Wend
-                    document.DocumentInfo.Title = strg
+                    document.DocumentProperties.Title = strg
                     Exit Do
                 End If
             End If
         Loop
     End If
 
-    sIndex = oDoc.DocumentInfo.GetUserFieldValue(0)
+    &apos;sIndex = oDoc.DocumentInfo.GetUserFieldValue(0) &apos;OH not used 
anywhere
 
 End Sub
 
diff --git a/helpauthoring/HelpAuthoring/_Main.xba 
b/helpauthoring/HelpAuthoring/_Main.xba
index 42be1ef..317dd04 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -59,11 +59,15 @@ Sub SetMetaDataOnSave(Path as String)
         Path = Right(Path,Len(Path)-Len(sDocRoot))
     End If
 
-    document.DocumentInfo.SetUserFieldName(0,&quot;Indexer&quot;)
-    document.DocumentInfo.SetUserFieldName(1,&quot;ID&quot;)
-&apos;    document.DocumentInfo.SetUserFieldName(2,&quot;Comment&quot;)
-    document.DocumentInfo.SetPropertyValue(&quot;Subject&quot;,Path)
+&apos;    document.DocumentInfo.SetUserFieldName(0,&quot;Indexer&quot;)
+&apos;    document.DocumentInfo.SetUserFieldName(1,&quot;ID&quot;)
+&apos;&apos;    document.DocumentInfo.SetUserFieldName(2,&quot;Comment&quot;)
+&apos;    document.DocumentInfo.SetPropertyValue(&quot;Subject&quot;,Path)
 
+    document.DocumentProperties.UserDefinedProperties.Indexer = &quot;&quot; 
&apos; Present in template properties
+    document.DocumentProperties.UserDefinedProperties.ID = &quot;&quot; &apos; 
Present in template properties
+&apos;    document.DocumentInfo.SetUserFieldName(2,&quot;Comment&quot;)
+    document.DocumentProperties.Subject = Path
 
 End Sub
 
diff --git a/helpauthoring/template/Help/xmlhelptemplate.ott 
b/helpauthoring/template/Help/xmlhelptemplate.ott
index 4e43c9f..f3b0a30 100644
Binary files a/helpauthoring/template/Help/xmlhelptemplate.ott and 
b/helpauthoring/template/Help/xmlhelptemplate.ott differ
commit 14548fd40e2c734280f44552c79987989dcd9dd1
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Thu Jul 2 18:07:08 2015 +0200

    helpauthoring: Add the extension that helps editing the helpcontent.

diff --git a/helpauthoring/Addons.xcu b/helpauthoring/Addons.xcu
new file mode 100644
index 0000000..2ce8e1d
--- /dev/null
+++ b/helpauthoring/Addons.xcu
@@ -0,0 +1,207 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   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 .
+-->
+
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; oor:name="Addons" 
oor:package="org.openoffice.Office">
+    <node oor:name="AddonUI">
+        <node oor:name="OfficeMenuBar">
+            <node oor:name="org.openoffice.helpauthoring" oor:op="replace">
+                <prop oor:name="Title" oor:type="xs:string">
+                    <value/>
+                    <value xml:lang="en-US">Help Authoring</value>
+                </prop>
+                <prop oor:name="Context" oor:type="xs:string">
+                    <value>com.sun.star.text.TextDocument</value>
+                </prop>
+                <node oor:name="Submenu">
+                    <node oor:name="m01" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring._Main.CreateFile?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Create Help File</value>
+                        </prop>
+                    </node>
+                    <node oor:name="m02" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring._Main.DisplayVersion?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">About</value>
+                        </prop>
+                    </node>
+                    <node oor:name="m03" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Helpers.SetDocumentRoot?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Set Document Root</value>
+                        </prop>
+                    </node>
+                    <node oor:name="m04" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Meta.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Edit Meta Data </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m05" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Validate.Validate?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Validate this Help File 
</value>
+                        </prop>
+                    </node>
+                    <node oor:name="m06" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.ToggleParaL10NStatus?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Toggle L10N </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m07" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Helpers.InsertNewParaData?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Assign ID </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m08" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Comment.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Comment </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m09" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Table.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Table </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m10" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Link.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Link </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m11" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.HID.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Help ID </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m12" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.IND.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Index Entry </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m13" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertExtendedTip?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Extended Tip 
</value>
+                        </prop>
+                    </node>
+                    <node oor:name="m14" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertHowToGet?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">&quot;How to Get&quot; 
Section </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m15" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertGraphic?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Image </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m16" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertSection?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Section </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m17" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertVariable?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Insert Variable </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m18" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.Embed.Main?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Transclude (Embed) </value>
+                        </prop>
+                    </node>
+                    <node oor:name="m19" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            
<value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertRelatedTopics?language=Basic&amp;location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">&quot;Related Topics&quot; 
Section </value>
+                        </prop>
+                    </node>
+                </node>
+            </node>
+        </node>
+    </node>
+</oor:component-data>
diff --git a/helpauthoring/Filter.xcu b/helpauthoring/Filter.xcu
new file mode 100644
index 0000000..c8cf855
--- /dev/null
+++ b/helpauthoring/Filter.xcu
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   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 .
+-->
+
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; oor:name="Filter" 
oor:package="org.openoffice.TypeDetection">
+ <node oor:name="Filters">
+  <node oor:name="XHP_Help" oor:op="replace">
+        <prop oor:name="UIComponent"/>
+        <prop oor:name="TemplateName"/>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop oor:name="Type"><value>XHP_Help</value></prop>
+        <prop 
oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,%origin%/filter/xmlhelp2soffice.xsl,%origin%/filter/soffice2xmlhelp.xsl,%origin%/filter/xmlhel.dtd,%origin%/filter/xmlhelptemplate.ott</value></prop>
+        <prop 
oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+        <prop oor:name="UIName"><value>Help (xhp)</value></prop>
+        <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 
3RDPARTYFILTER</value></prop>
+  </node>
+ </node>
+</oor:component-data>
diff --git a/helpauthoring/HelpAuthoring/Comment.xba 
b/helpauthoring/HelpAuthoring/Comment.xba
new file mode 100644
index 0000000..3156357
--- /dev/null
+++ b/helpauthoring/HelpAuthoring/Comment.xba
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" 
"module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script"; 
script:name="Comment" script:language="StarBasic">&apos; *** MODULE COMMENT ***
+&apos; #
+&apos; # This file is part of the LibreOffice project.
+&apos; #
+&apos; # This Source Code Form is subject to the terms of the Mozilla Public
+&apos; # License, v. 2.0. If a copy of the MPL was not distributed with this
+&apos; # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+&apos; #
+&apos; # This file incorporates work covered by the following license notice:
+&apos; #
+&apos; #   Licensed to the Apache Software Foundation (ASF) under one or more
+&apos; #   contributor license agreements. See the NOTICE file distributed
+&apos; #   with this work for additional information regarding copyright
+&apos; #   ownership. The ASF licenses this file to you under the Apache
+&apos; #   License, Version 2.0 (the &quot;License&quot;); you may not use 
this file
+&apos; #   except in compliance with the License. You may obtain a copy of
+&apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+&apos; #
+
+Dim oDialog AS Object
+Dim document AS Object
+
+&apos;=======================================================
+&apos; Main
+&apos;-------------------------------------------------------
+&apos; Inserts a comment
+&apos;=======================================================
+Sub Main
+
+    If not IsHelpFile Then
+        msgbox(strErr_NoHelpFile)
+        Exit Sub
+    End If
+
+    document = StarDesktop.CurrentComponent
+
+    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
+    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgComment&quot;)
+    oDialogModel = oDialog.Model
+
+    if not IsHelpFile Then
+        msgbox(strErr_NoHelpFile)
+        Exit Sub
+    End If
+
+    oTxtComment = oDialog.GetControl(&quot;txtComment&quot;)
+
+    If oDialog.Execute() = 1 Then
+        oSel = thiscomponent.getcurrentcontroller.getselection
+        oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+        oCur.gotoStartOfParagraph(0)
+        oCur.gotoEndOfParagraph(1)
+
+        If oCur.GetString = &quot;&quot; Then
+            SetParaStyle(&quot;hlp_aux_comment&quot;)
+        End If
+
+        If oTxtComment.Text &lt;&gt; &quot;&quot; Then
+            InsertTag(&quot;COMMENT_&quot;,&quot;&lt;COMMENT&gt;&quot;)
+            SetCharStyle(&quot;hlp_aux_comment&quot;)
+            InsertTag(&quot;COMMENT&quot;,oTxtComment.Text)
+            InsertTag(&quot;_COMMENT&quot;,&quot;&lt;/COMMENT&gt;&quot;)
+        End If
+    End If
+
+    oDialog.dispose
+
+End Sub
+
+</script:module>
diff --git a/helpauthoring/HelpAuthoring/Embed.xba 
b/helpauthoring/HelpAuthoring/Embed.xba
new file mode 100644
index 0000000..704d16f
--- /dev/null
+++ b/helpauthoring/HelpAuthoring/Embed.xba
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" 
"module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script"; 
script:name="Embed" script:language="StarBasic">&apos; *** MODULE EMBED ***
+&apos; #
+&apos; # This file is part of the LibreOffice project.
+&apos; #
+&apos; # This Source Code Form is subject to the terms of the Mozilla Public
+&apos; # License, v. 2.0. If a copy of the MPL was not distributed with this
+&apos; # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+&apos; #
+&apos; # This file incorporates work covered by the following license notice:
+&apos; #
+&apos; #   Licensed to the Apache Software Foundation (ASF) under one or more
+&apos; #   contributor license agreements. See the NOTICE file distributed
+&apos; #   with this work for additional information regarding copyright
+&apos; #   ownership. The ASF licenses this file to you under the Apache
+&apos; #   License, Version 2.0 (the &quot;License&quot;); you may not use 
this file
+&apos; #   except in compliance with the License. You may obtain a copy of
+&apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+&apos; #
+
+Dim oDialog AS Object
+Dim oBrowseDialog As Object
+Dim document AS Object
+Dim arParas(0) As String
+Dim arSecs(0) As String
+Dim arVars(0) As String
+
+&apos;=======================================================
+&apos; Main
+&apos;-------------------------------------------------------
+&apos; Embeds a variable or a section
+&apos;=======================================================
+Sub Main(optional bCR As Boolean)
+
+    If not IsHelpFile Then
+        msgbox(strErr_NoHelpFile)
+        Exit Sub
+    End If
+
+    GlobalScope.BasicLibraries.loadLibrary(&quot;Tools&quot;)
+
+    document = StarDesktop.CurrentComponent
+
+    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
+    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgEmbed&quot;)
+    oDialogModel = oDialog.Model
+
+    oTxtFilePath = oDialog.GetControl(&quot;txtFilePath&quot;)           
&apos; path to file, rel to Docroot
+    oTxtID = oDialog.GetControl(&quot;txtID&quot;)                     &apos; 
anchor
+    oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)        &apos; 
pure filename
+    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
+    oOpSection = oDialog.GetControl(&quot;opSection&quot;)
+
+    DocRoot = ReadConfig(&quot;HelpPrefix&quot;)
+    EmbedFolder = ReadConfig(&quot;LastEmbedDir&quot;)
+    EmbedFile = ReadConfig(&quot;LastEmbedFile&quot;)
+    EmbedID = ReadConfig(&quot;LastEmbedAnchor&quot;)
+    EmbedType = ReadConfig(&quot;LastEmbedType&quot;)
+    If EmbedType = &quot;Variable&quot; Then
+        oOpVariable.State = TRUE
+    Else
+        oOpVariable.State = FALSE
+    End If
+    SetLabel
+
+    If IsSubDir(EmbedFolder,DocRoot) Then
+        RelDir = Right(EmbedFolder,Len(EmbedFolder)-Len(DocRoot))
+        If Dir(DocRoot+RelDir+EmbedFile) &gt; &quot;&quot; Then
+            oTxtFilePath.Text = RelDir+EmbedFile
+            oTxtHidFName.Text = DocRoot+RelDir+EmbedFile
+            oTxtID.Text = EmbedID
+        End If
+    End If
+
+
+    GoForIt = 1
+
+    If (oDialog.Execute() = 1 AND oTxtFilePath.Text &lt;&gt; &quot;&quot;) Then
+&apos;        msgbox (oTxtFilePath.Text)
+
+        If oTxtID.Text = &quot;&quot; Then
+            msgbox &quot;You did not specify a section or variable to 
embed.&quot;,256
+        Else
+            WriteConfig(&quot;LastEmbedAnchor&quot;,oTxtID.Text)
+            If oOpVariable.State Then
+                txtEmbed = oTxtFilePath.Text + &quot;#&quot; + oTxtID.Text
+                InsertTag(&quot;EMBEDVAR&quot;,&quot;&lt;EMBEDVAR 
var=&quot;&quot;&quot; + txtEmbed + 
&quot;&quot;&quot;&gt;&quot;,&quot;hlp_aux_tag&quot;)
+                SetCharStyle(&quot;Default&quot;)
+                WriteConfig(&quot;LastEmbedType&quot;,&quot;Variable&quot;)
+            Else
+                txtEmbed = oTxtFilePath.Text + &quot;#&quot; + oTxtID.Text
+                CR
+                SetParaStyle(&quot;hlp_aux_embed&quot;)
+                SetCharStyle(&quot;hlp_aux_tag&quot;)
+                InsertTag(&quot;EMBED&quot;,&quot;&lt;EMBED 
href=&quot;&quot;&quot; + txtEmbed + 
&quot;&quot;&quot;&gt;&quot;,&quot;hlp_aux_tag&quot;)
+                CR
+                WriteConfig(&quot;LastEmbedType&quot;,&quot;Section&quot;)
+            End If
+        End If
+    End If
+    oDialog.dispose
+End Sub
+
+&apos;=======================================================
+&apos; SetLabel
+&apos;-------------------------------------------------------
+&apos; Changes the text field label in the dialog
+&apos;=======================================================
+Sub SetLabel
+    olblID = oDialog.GetControl(&quot;lblID&quot;)
+    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
+    If oOpVariable.getState Then
+        olblID.setText(&quot;Variable ID&quot;)
+        oDialog.Title = &quot;Embed Variable&quot;
+    Else
+        olblID.setText(&quot;Section or Paragraph ID&quot;)
+        oDialog.Title = &quot;Embed Section&quot;
+    End If
+End Sub
+
+Sub GetFile
+Dim ListAny(0) as Long
+    ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+    oFileDialog = 
CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
+    oFileDialog.Initialize(ListAny())
+
+    DocRoot = ReadConfig(&quot;HelpPrefix&quot;)
+    sLastEmbedDir = ReadConfig(&quot;LastEmbedDir&quot;)
+    sLastEmbedFile = ReadConfig(&quot;LastEmbedFile&quot;)
+
+    If IsSubDir(sLastEmbedDir,DocRoot) Then
+        oFileDialog.setDisplayDirectory(sLastEmbedDir)
+        If sLastEmbedFile &lt;&gt; &quot;&quot; AND 
Dir(sLastEmbedDir+sLastEmbedFile) &gt; &quot;&quot; Then
+            oFileDialog.setDefaultName(sLastEmbedFile)
+        End If
+    Else
+        oFileDialog.setDisplayDirectory(DocRoot)
+    End If
+
+    oMasterKey = 
GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types/&quot;)
+    oTypes() = oMasterKey.Types
+    oFileDialog.AppendFilter(&quot;Help&quot;, &quot;*.xhp&quot;)
+
+    oFileDialog.SetTitle(&quot;Embed From Help File&quot;)
+    iAccept = oFileDialog.Execute()
+    If iAccept = 1 Then
+        sPath = oFileDialog.Files(0)
+        sCurDir = oFileDialog.getDisplayDirectory +&quot;/&quot;
+        WriteConfig(&quot;LastEmbedDir&quot;,sCurDir)
+        LastFile = Right(sPath, Len(sPath) - Len(sCurDir))
+        WriteConfig(&quot;LastEmbedFile&quot;,LastFile)
+
+        oTxtPath = oDialog.GetControl(&quot;txtFilePath&quot;)
+        oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)
+        oTxtHidFName.Text = sPath
+
+        If IsSubDir(sCurDir,DocRoot) Then
+            oTxtPath.Text = GetRelPath(sPath, DocRoot)
+        Else
+            oTxtPath.Text = sPath
+            msgbox(&quot;File is outside of your Document 
Root&quot;,48,&quot;Warning&quot;)
+        End If
+
+        oButBrowseIDs = oDialog.GetControl(&quot;butBrowseIDs&quot;)
+        oButBrowseIDs.Enable = true
+    End If
+
+End Sub
+
+Sub UpdateFileName
+    oTxtPath = oDialog.GetControl(&quot;txtFilePath&quot;)
+    ShortFName = oTxtPath.Text
+
+    If ShortFName &gt; &quot;&quot; Then
+
+        oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)
+        FName = oTxtHidFName.Text
+
+        If Right(FName, Len(ShortFName)) &lt;&gt; ShortFName Then
+        &apos;    oTxtHidFName.Text = MakeAbsPath(ShortFName)
+            oTxtHidFName.Text = ShortFName
+        End If
+
+        oButBrowseIDs = oDialog.GetControl(&quot;butBrowseIDs&quot;)
+        If not(FileExists(oTxtHidFName.Text)) Then
+            msgbox oTxtHidFName.Text+&quot; cannot be 
found.&quot;,48,&quot;D&apos;oh!&quot;
+            oButBrowseIDs.Enable = false
+        Else
+            oButBrowseIDs.Enable = true
+        End If
+    End If
+End Sub
+
+Sub BrowseEmbed
+    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
+    oBrowseDialog = LoadDialog(&quot;HelpAuthoring&quot;, 
&quot;dlg_BrowseEmbed&quot;)
+    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
+    oTxtPath = oDialog.GetControl(&quot;txtFilePath&quot;)
+    oTxtHidFName = oDialog.GetControl(&quot;txtHidFName&quot;)
+    filename = oTxtHidFName.Text
+
+    ReDim arParas(0)
+    ReDim arVars(0)
+    ReDim arSecs(0)
+
+&apos;    msgbox(filename)
+
+    iNumber = Freefile
+    If FileExists(filename) Then
+        Dim arLines(0) As String
+        Open filename For Input As iNumber
+        Do While (not eof(iNumber))
+            Line Input #iNumber, sLine
+            sDim = ubound(arLines())+1
+            ReDim Preserve arLines(sDim)
+            arLines(sDim) = sLine
+        Loop
+        Close #iNumber
+        sContent = join(arLines(),&quot; &quot;)
+
+        arTmp() = split(sContent,&quot;&lt;paragraph&quot;)
+        For n=1 to ubound(arTmp())
+            If arTmp(n) &lt;&gt; &quot;&quot; Then
+                arTmp(n) = 
Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;id=&quot;)-3)
+                sId = Left(arTmp(n),Instr(arTmp(n),&quot;&quot;&quot;&quot;)-1)
+                arTmp(n) = 
Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;&gt;&quot;))
+                arTmp(n) = 
Left(arTmp(n),Instr(arTmp(n),&quot;&lt;/paragraph&gt;&quot;)-1)
+                If Len(arTmp(n) &gt; 100) Then
+                    arTmp(n) = Left(arTmp(n),100)+&quot;...&quot;
+                End If
+                sDim = ubound(arParas())
+                arParas(sDim) = sId+&quot;: &quot;+arTmp(n)
+                sDim = ubound(arParas())+1
+                ReDim Preserve arParas(sDim)
+            End If
+        Next n
+
+        arTmp() = split(sContent,&quot;&lt;section&quot;)
+        For n=1 to ubound(arTmp())
+            If arTmp(n) &lt;&gt; &quot;&quot; Then
+                arTmp(n) = 
Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;id=&quot;)-3)
+                sId = Left(arTmp(n),Instr(arTmp(n),&quot;&quot;&quot;&quot;)-1)
+                arTmp(n) = 
Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;&gt;&quot;))
+                If Instr(arTmp(n),&quot;&lt;/section&gt;&quot;)&gt;0 Then
+                    arTmp(n) = 
Left(arTmp(n),Instr(arTmp(n),&quot;&lt;/section&gt;&quot;)-1)
+                End If
+                If Len(arTmp(n) &gt; 100) Then
+                    arTmp(n) = Left(arTmp(n),100)+&quot;...&quot;
+                End If
+                sDim = ubound(arSecs())
+                arSecs(sDim) = sId+&quot;: &quot;+arTmp(n)
+                sDim = ubound(arSecs())+1
+                ReDim Preserve arSecs(sDim)
+            End If
+        Next n
+
+        arTmp() = split(sContent,&quot;&lt;variable&quot;)
+        For n=1 to ubound(arTmp())
+            If arTmp(n) &lt;&gt; &quot;&quot; Then
+                arTmp(n) = 
Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;id=&quot;)-3)
+                sId = Left(arTmp(n),Instr(arTmp(n),&quot;&quot;&quot;&quot;)-1)
+                arTmp(n) = 
Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),&quot;&gt;&quot;))
+                arTmp(n) = 
Left(arTmp(n),Instr(arTmp(n),&quot;&lt;/variable&gt;&quot;)-1)
+                If Len(arTmp(n) &gt; 100) Then
+                    arTmp(n) = Left(arTmp(n),100)+&quot;...&quot;
+                End If
+                sDim = ubound(arVars())
+                arVars(sDim) = sId+&quot;: &quot;+arTmp(n)
+                sDim = ubound(arVars())+1
+                ReDim Preserve arVars(sDim)
+            End If
+        Next n
+
+        ShowSecs
+
+        If oBrowseDialog.Execute() = 1 Then
+            olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
+            sSelected = olbElements.SelectedItem
+            sSelected = Left(sSelected,Instr(sSelected,&quot;:&quot;)-1)
+            oTxtID = oDialog.GetControl(&quot;txtID&quot;)
+            oTxtID.Text = sSelected
+        End If
+    Else
+        msgbox &quot;Cannot open &quot;+filename,48,&quot;Error&quot;
+    End If
+End Sub
+
+Sub UpdateLIst
+    oOpSections = oBrowseDialog.GetControl(&quot;opSections&quot;)
+    oOpVariables = oBrowseDialog.GetControl(&quot;opVariables&quot;)
+    oOpParas = oBrowseDialog.GetControl(&quot;opParas&quot;)
+    If oOpSections.getState Then
+        ShowSecs
+    ElseIf oOpVariables.getState Then
+        ShowVars
+    ElseIf oOpParas.getState Then
+        ShowParas
+    End If
+End Sub
+
+Sub ShowSecs
+    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
+    olbElements.RemoveItems(0,olbElements.ItemCount)
+    olbElements.AddItems(arSecs(),ubound(arSecs()))
+    oOpSection = oDialog.GetControl(&quot;opSection&quot;)
+    oOpSection.setState(TRUE)
+    SetLabel
+End Sub
+
+Sub ShowVars
+    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
+    olbElements.RemoveItems(0,olbElements.ItemCount)
+    olbElements.AddItems(arVars(),ubound(arVars()))
+    oOpVariable = oDialog.GetControl(&quot;opVariable&quot;)
+    oOpVariable.setState(TRUE)
+    SetLabel
+End Sub
+
+Sub ShowParas
+    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
+    olbElements.RemoveItems(0,olbElements.ItemCount)
+    olbElements.AddItems(arParas(),ubound(arParas()))
+    oOpVariable = oDialog.GetControl(&quot;opSection&quot;)
+    oOpVariable.setState(TRUE)
+    SetLabel
+End Sub
+
+Sub CheckButton
+    olbElements = oBrowseDialog.GetControl(&quot;lbElements&quot;)
+    obutSelect = oBrowseDialog.GetControl(&quot;butSelect&quot;)
+    sSelected = olbElements.SelectedItem
+    If sSelected = &quot;&quot; Then
+        oButSelect.enable = false
+    Else
+        oButSelect.enable = true
+    End If
+End Sub
+
+
+Function IsSubDir(D as String, R as String)
+     IsSubDir = (Left(D,Len(R)) = R)
+End Function
+</script:module>
diff --git a/helpauthoring/HelpAuthoring/Find.xba 
b/helpauthoring/HelpAuthoring/Find.xba
new file mode 100644
index 0000000..a7681af
--- /dev/null
+++ b/helpauthoring/HelpAuthoring/Find.xba
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" 
"module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script"; 
script:name="Find" script:language="StarBasic">&apos; *** MODULE FIND ***
+&apos; #
+&apos; # This file is part of the LibreOffice project.
+&apos; #
+&apos; # This Source Code Form is subject to the terms of the Mozilla Public
+&apos; # License, v. 2.0. If a copy of the MPL was not distributed with this
+&apos; # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+&apos; #
+&apos; # This file incorporates work covered by the following license notice:
+&apos; #
+&apos; #   Licensed to the Apache Software Foundation (ASF) under one or more
+&apos; #   contributor license agreements. See the NOTICE file distributed
+&apos; #   with this work for additional information regarding copyright
+&apos; #   ownership. The ASF licenses this file to you under the Apache
+&apos; #   License, Version 2.0 (the &quot;License&quot;); you may not use 
this file
+&apos; #   except in compliance with the License. You may obtain a copy of
+&apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+&apos; #
+
+Dim oDialog AS Object
+Dim document AS Object
+Dim Found(0) As Object
+Dim nPos As Integer
+
+&apos;=======================================================
+&apos; Main
+&apos;-------------------------------------------------------
+&apos; Calls the Find routine to search in fields
+&apos;=======================================================
+Sub Main
+
+    If not IsHelpFile Then
+        msgbox(strErr_NoHelpFile)
+        Exit Sub
+    End If
+
+    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
+    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgFind&quot;)
+
+    oDoc = StarDesktop.CurrentComponent
+    Enum = oDoc.Text.createEnumeration
+
+    LastSearchTerm = ReadConfig(&quot;SearchTerm&quot;)
+    If LastSearchTerm &lt;&gt; &quot;&quot; Then
+        oTxtFind = oDialog.GetControl(&quot;txtFind&quot;)
+        oTxtFind.Text = LastSearchTerm
+    End If
+
+    If oDialog.execute() = 1 Then
+        oTxtFind = oDialog.GetControl(&quot;txtFind&quot;)
+        sFind = oTxtFind.Text
+        WriteConfig(&quot;SearchTerm&quot;,sFind)
+
+        Do While Enum.hasMoreElements
+            TE = Enum.nextElement
+            If TE.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then
+                TP = TE.createEnumeration
+                While TP.hasmoreElements
+                    TPE = TP.nextElement
+                    If 
TPE.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
+                        If Instr(TPE.String, sFind) Then
+                            sDim = ubound(Found())+1
+                            Redim Preserve Found(sDim) As Object
+                            Found(sDim) = 
TPE.TextField.getAnchor.getText.createTextCursorbyRange(TPE.TextField.getAnchor)
+                        End If
+                    End If
+                Wend
+            ElseIf TE.supportsService(&quot;com.sun.star.text.TextTable&quot;) 
Then
+                CellName = &quot;A1&quot;
+                Cell = TE.getCellByName(CellName)
+                tmpCellEnum = Cell.createEnumeration
+                tmpCellElement = tmpCellEnum.nextElement
+
+                Rows = TE.getRows
+                Cols = TE.getColumns
+
+                For RowIndex = 1 to Rows.getCount()
+                    For ColIndex = 1 to Cols.getCount()
+                        CellName = Chr(64 + ColIndex) &amp; RowIndex
+                        Cell = TE.getCellByName(CellName)
+                        CellEnum = Cell.createEnumeration
+
+                        Do While CellEnum.hasMoreElements
+
+                            CellElement = CellEnum.nextElement
+
+                            If 
CellElement.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then
+                                TP = CellElement.createEnumeration
+                                While TP.hasmoreElements
+                                    TPE = TP.nextElement
+                                    If 
TPE.supportsService(&quot;com.sun.star.text.TextField&quot;) Then
+                                        If Instr(TPE.String, sFind) Then
+                                            sDim = ubound(Found())+1
+                                            Redim Preserve Found(sDim) As 
Object
+                                            Found(sDim) = 
TPE.TextField.getAnchor.getText.createTextCursorbyRange(TPE.TextField.getAnchor)
+                                        End If
+                                    End If
+                                Wend
+                            EndIf
+
+                        Loop
+
+                    Next
+                Next
+
+            EndIf
+        Loop
+
+        If ubound(Found()) &lt; 1     Then
+            msgbox &quot;Nothing found&quot;
+        ElseIf ubound(Found()) &gt; 1     Then
+            nPos = 1
+            thiscomponent.getcurrentcontroller.select(Found(1))
+            oDialog = LoadDialog(&quot;HelpAuthoring&quot;, 
&quot;dlgRepeatFind&quot;)
+            oPrev = oDialog.GetControl(&quot;butPrev&quot;)
+            oPrev.Enable = FALSE
+            oDialog.Execute()
+        Else
+            thiscomponent.getcurrentcontroller.select(Found(1))
+        End If
+    End If
+End Sub
+
+&apos;=======================================================
+&apos; FindNext
+&apos;-------------------------------------------------------
+&apos; Goes to the next search result position.
+&apos;=======================================================
+Sub FindNext
+    If nPos &lt; ubound(Found()) Then
+        nPos = nPos + 1
+        thiscomponent.getcurrentcontroller.select(Found(nPos))
+        If nPos = ubound(Found()) Then
+            oNext = oDialog.GetControl(&quot;butNext&quot;)
+            oNext.Enable = FALSE
+        End If
+        If nPos &gt; 1 Then
+            oPrev = oDialog.GetControl(&quot;butPrev&quot;)
+            oPrev.Enable = TRUE
+        End If
+    End If
+End Sub
+
+&apos;=======================================================
+&apos; FindPrev
+&apos;-------------------------------------------------------
+&apos; Goes to the previous search result position.
+&apos;=======================================================
+Sub FindPrev
+    If nPos &gt; 1 Then
+        nPos = nPos - 1
+        thiscomponent.getcurrentcontroller.select(Found(nPos))
+        If nPos = 1 Then
+            oPrev = oDialog.GetControl(&quot;butPrev&quot;)
+            oPrev.Enable = FALSE
+        End If
+        If nPos &lt; ubound(Found()) Then
+            oNext = oDialog.GetControl(&quot;butNext&quot;)
+            oNext.Enable = TRUE
+        End If
+    End If
+End Sub
+
+</script:module>
diff --git a/helpauthoring/HelpAuthoring/HID.xba 
b/helpauthoring/HelpAuthoring/HID.xba
new file mode 100644
index 0000000..5610e67
--- /dev/null
+++ b/helpauthoring/HelpAuthoring/HID.xba
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" 
"module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script"; 
script:name="HID" script:language="StarBasic">&apos; *** MODULE HID ***
+&apos; #
+&apos; # This file is part of the LibreOffice project.
+&apos; #
+&apos; # This Source Code Form is subject to the terms of the Mozilla Public
+&apos; # License, v. 2.0. If a copy of the MPL was not distributed with this
+&apos; # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+&apos; #
+&apos; # This file incorporates work covered by the following license notice:
+&apos; #
+&apos; #   Licensed to the Apache Software Foundation (ASF) under one or more
+&apos; #   contributor license agreements. See the NOTICE file distributed
+&apos; #   with this work for additional information regarding copyright
+&apos; #   ownership. The ASF licenses this file to you under the Apache
+&apos; #   License, Version 2.0 (the &quot;License&quot;); you may not use 
this file
+&apos; #   except in compliance with the License. You may obtain a copy of
+&apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+&apos; #
+
+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(&quot;HelpAuthoring&quot;)
+    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgHID&quot;)
+    oDialogModel = oDialog.Model
+
+&apos;    oPath = createUNOService(&quot;com.sun.star.util.PathSettings&quot;)
+&apos;    filename = oPath.UserConfig+&quot;/help_hid.lst&quot;
+&apos;    oButHIDList = oDialog.GetControl(&quot;butHIDList&quot;)
+&apos;    If FileExists(filename) Then
+&apos;        oButHIDList.Enable = true
+&apos;    Else
+&apos;        oLblWait = oDialog.GetControl(&quot;lblWait&quot;)
+&apos;        oLblWait.Text = &quot;No hid list found in your config 
folder&quot;
+&apos;        oButHIDList.Enable = false
+&apos;    End If
+    oTxtHID = oDialog.GetControl(&quot;txtHID&quot;)
+
+    &apos; Check if bookmarks are allowed here
+    If IsInList Then
+        msgbox &quot;No Bookmarks allowed inside a list.&quot;, 48, 
&quot;D&apos;oh!&quot;
+        Exit Sub
+    End If
+
+    &apos; Find out if we are in front of an existing HID
+    If oDialog.Execute() = 1 Then
+
+        If oTxtHID.Text = &quot;&quot; Then
+            msgbox &quot;Empty Help ID. No Help ID element added.&quot;
+        Else
+            If IsInBookmark &gt; 0 or Not(ParaIsEmpty) Then
+                CR
+            End If
+            If not(join(split(oTxtHID.Text,&quot; &quot;),&quot;&quot;) = 
oTxtHID.Text) Then
+&apos;                msgbox &quot;Help ID seems to contain forbidden 
characters (like spaces). You may need to verify this.&quot;
+&apos;               HID and uno command
+                arHID = split(oTxtHID.Text,&quot; &quot;)
+                sHID = arHID(0)
+                sUNO = arHID(1)
+            Else
+                sHID = oTxtHID.Text
+                sUNO = &quot;&quot;
+            End If
+
+            If sHID &lt;&gt; &quot;&quot; Then
+                bmid = CreateID
+                InsertTagCR(&quot;BOOKMARK&quot;,&quot;&lt;BOOKMARK 
branch=&quot;&quot;hid/&quot; + sHID + &quot;&quot;&quot; 
id=&quot;&quot;bm_id&quot; + bmid + &quot;&quot;&quot; 
localize=&quot;&quot;false&quot;&quot;/&gt;&quot;,&quot;hlp_aux_bookmark&quot;)
+            End If
+            If sUNO &lt;&gt; &quot;&quot; Then
+                bmid = CreateID
+                InsertTagCR(&quot;BOOKMARK&quot;,&quot;&lt;BOOKMARK 
branch=&quot;&quot;hid/&quot; + sUNO + &quot;&quot;&quot; 
id=&quot;&quot;bm_id&quot; + bmid + &quot;&quot;&quot; 
localize=&quot;&quot;false&quot;&quot;/&gt;&quot;,&quot;hlp_aux_bookmark&quot;)
+            End If
+
+        End If
+    End If
+    oDialog.dispose
+
+End Sub
+
+Sub ConvertToSymbol
+    oPath = createUNOService(&quot;com.sun.star.util.PathSettings&quot;)
+    filename = oPath.UserConfig+&quot;/help_hid.lst&quot;
+    oTxtHID = oDialog.GetControl(&quot;txtHID&quot;)
+    oButHIDList = oDialog.GetControl(&quot;butHIDList&quot;)
+    sHID = oTxtHID.Text
+    sCt = 0
+    If FileExists(filename) AND sHID &lt;&gt; &quot;&quot; Then
+        oLblWait = oDialog.GetControl(&quot;lblWait&quot;)
+        oLblWait.Text = &quot;Searching help_hid.lst. Please wait...&quot;
+        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,&quot;,&quot;)
+            If arHID(1) = sHID Then
+                If arHID(2) &lt;&gt; &quot;&quot; Then
+                    symHID = arHID(0) + &quot; &quot; + arHID(2)
+                Else
+                    symHID = arHID(0)
+                End If
+                bFound = true
+            End If
+        Loop
+        Close #iNumber
+        If not bFound Then
+            oLblWait.Text = &quot;Nothing found. Searched &quot;+sCt+&quot; 
Help IDs&quot;
+        Else
+            oTxtHID.Text = symHID
+            oLblWait.Text = &quot;HelpID found. Searched &quot;+sCt+&quot; 
Help IDs&quot;
+            oButHIDList.Enable = false
+        End If
+    Else
+        oLblWait.Text = &quot;No help_hid.lst found in your config folder&quot;
+    End If
+End Sub
+
+</script:module>
diff --git a/helpauthoring/HelpAuthoring/Helpers.xba 
b/helpauthoring/HelpAuthoring/Helpers.xba
new file mode 100644
index 0000000..6e13da9
--- /dev/null
+++ b/helpauthoring/HelpAuthoring/Helpers.xba
@@ -0,0 +1,1104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" 
"module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script"; 
script:name="Helpers" script:language="StarBasic">&apos; *** MODULE HELPERS ***
+&apos; #
+&apos; # This file is part of the LibreOffice project.
+&apos; #
+&apos; # This Source Code Form is subject to the terms of the Mozilla Public
+&apos; # License, v. 2.0. If a copy of the MPL was not distributed with this
+&apos; # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+&apos; #
+&apos; # This file incorporates work covered by the following license notice:
+&apos; #
+&apos; #   Licensed to the Apache Software Foundation (ASF) under one or more
+&apos; #   contributor license agreements. See the NOTICE file distributed
+&apos; #   with this work for additional information regarding copyright
+&apos; #   ownership. The ASF licenses this file to you under the Apache
+&apos; #   License, Version 2.0 (the &quot;License&quot;); you may not use 
this file
+&apos; #   except in compliance with the License. You may obtain a copy of
+&apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+&apos; #
+
+&apos;=======================================================
+&apos; Main
+&apos;-------------------------------------------------------
+&apos; Ensure that necessary library functions are available
+&apos;=======================================================
+Sub Main
+    GlobalScope.BasicLibraries.loadLibrary(&quot;Tools&quot;)
+End Sub
+
+&apos;=======================================================
+&apos; ShowProp
+&apos;-------------------------------------------------------
+&apos; Displays a dialog that shows the properties and
+&apos; the methods of an object. Used for debugging.
+&apos;=======================================================
+Sub ShowProp(Elem As Object)
+    dim oDialog As Object
+
+    BasicLibraries.LoadLibrary(&quot;HelpAuthoring&quot;)
+    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgObjProp&quot;)
+    oDialogModel = oDialog.Model
+
+    oTxtProp = oDialog.GetControl(&quot;txtProp&quot;)
+    oTxtProp.Text = Join(Split(Elem.dbg_properties,&quot;;&quot;),chr(13))
+
+    oTxtMeth = oDialog.GetControl(&quot;txtMeth&quot;)
+    oTxtMeth.Text = Join(Split(Elem.dbg_methods,&quot;;&quot;),chr(13))
+
+    oTxtInt = oDialog.GetControl(&quot;txtInt&quot;)
+    oTxtInt.Text = 
Join(Split(Elem.dbg_supportedInterfaces,&quot;;&quot;),chr(13))
+
+    oDialog.Execute()
+    oDialog.dispose
+End Sub
+
+&apos;=======================================================
+&apos; AlphaNum
+&apos;-------------------------------------------------------
+&apos; Removes all invalid characters from a string
+&apos;=======================================================
+Function AlphaNum(Strg As String)
+    dim OutStrg As String
+    dim sValid As String
+
+    sValid = 
&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789&quot;
+
+    For i=1 to Len(Strg)
+        If (Instr(sValid,LCase(Mid(Strg,i,1)))) Then
+            OutStrg = OutStrg + Mid(Strg,i,1)
+        End If
+    Next i
+    AlphaNum = OutStrg
+End Function
+
+&apos;=======================================================
+&apos; Replace
+&apos;-------------------------------------------------------
+&apos; Replaces a character with another character in a string
+&apos;=======================================================
+Function Replace(txt As String, ReplaceFrom As String, ReplaceTo As String)
+    dim OutStr As String
+    For i=1 to len(txt)
+        If LCase(mid(txt,i,1))=ReplaceFrom Then
+            OutStr = OutStr + ReplaceTo
+        Else
+            OutStr = OutStr + mid(txt,i,1)
+        End If
+    Next i
+    Replace = OutStr
+End Function
+
+
+&apos;=======================================================
+&apos; ReplaceAll
+&apos;-------------------------------------------------------
+&apos; Replaces a character with another character in a string
+&apos;=======================================================
+Function ReplaceAll(txt As String, ReplaceFrom As String, ReplaceTo As String)
+    dim OutStr As String
+    For i=1 to len(txt)
+        bFound = 0
+        For j=1 to len(ReplaceFrom)
+            If LCase(mid(txt,i,1))=LCase(mid(ReplaceFrom,j,1)) Then
+                bFound = 1
+                OutStr = OutStr + ReplaceTo
+                j = len(ReplaceFrom)
+            End If
+        Next j
+        If bFound=0 Then
+            OutStr = OutStr + mid(txt,i,1)
+        End If
+    Next i
+    ReplaceAll = OutStr
+End Function
+
+
+
+&apos;=======================================================
+&apos; CreateID
+&apos;-------------------------------------------------------
+&apos; Creates a numerical randomized ID
+&apos;=======================================================
+Function CreateID
+    sDate = ReplaceAll(Date,&quot;/:. \&quot;,&quot;&quot;)
+    sTime = ReplaceAll(Time,&quot;/:. \AMP&quot;,&quot;&quot;)
+    Randomize
+    CreateID = sDate + sTime + Int(Rnd * 100)
+End Function
+
+&apos;=======================================================
+&apos; InsertTag
+&apos;-------------------------------------------------------
+&apos; Inserts an inline tag (element) in the document at the
+&apos; current cursor position. It also sets the character
+&apos; format to hlp_aux_tag
+&apos;=======================================================
+Sub InsertTag (Element As String, Content As String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(5) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Type&quot;
+    args(0).Value = 8
+    args(1).Name = &quot;SubType&quot;
+    args(1).Value = 1
+    args(2).Name = &quot;Name&quot;
+    args(2).Value = Element
+    args(3).Name = &quot;Content&quot;
+    args(3).Value = Content
+    args(4).Name = &quot;Format&quot;
+    args(4).Value = -1
+    args(5).Name = &quot;Separator&quot;
+    args(5).Value = &quot; &quot;
+    SetCharStyle(&quot;hlp_aux_tag&quot;)
+    dispatcher.executeDispatch(document, &quot;.uno:InsertField&quot;, 
&quot;&quot;, 0, args())
+    SetCharStyle(&quot;Default&quot;)
+End Sub
+
+&apos;=======================================================
+&apos; INSERTTAGCR
+&apos;-------------------------------------------------------
+&apos; Inserts a tag (element) in the document at the
+&apos; current cursor position in its own newly created paragraph.
+&apos; It also sets the character format to hlp_aux_tag and
+&apos; the paragraph to the specified value (should start with hlp_)
+&apos;=======================================================
+Sub InsertTagCR (Element As String, Content As String, Style As String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(5) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Type&quot;
+    args(0).Value = 8
+    args(1).Name = &quot;SubType&quot;
+    args(1).Value = 1
+    args(2).Name = &quot;Name&quot;
+    args(2).Value = Element
+    args(3).Name = &quot;Content&quot;
+    args(3).Value = Content
+    args(4).Name = &quot;Format&quot;
+    args(4).Value = -1
+    args(5).Name = &quot;Separator&quot;
+    args(5).Value = &quot; &quot;
+
+    CR
+    goUp(1)
+    SetParaStyle(Style)
+    SetCharStyle(&quot;hlp_aux_tag&quot;)
+    dispatcher.executeDispatch(document, &quot;.uno:InsertField&quot;, 
&quot;&quot;, 0, args())
+    SetCharStyle(&quot;Default&quot;)
+    goDown(1)
+End Sub
+
+&apos;=======================================================
+&apos; InsertField
+&apos;-------------------------------------------------------
+&apos; Inserts a field in the document at the
+&apos; current cursor position.
+&apos;=======================================================
+Sub InsertField(Field as String, Content as String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(5) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Type&quot;
+    args(0).Value = 8
+    args(1).Name = &quot;SubType&quot;
+    args(1).Value = 1
+    args(2).Name = &quot;Name&quot;
+    args(2).Value = Field
+    args(3).Name = &quot;Content&quot;
+    args(3).Value = Content
+    args(4).Name = &quot;Format&quot;
+    args(4).Value = -1
+    args(5).Name = &quot;Separator&quot;
+    args(5).Value = &quot; &quot;
+
+    dispatcher.executeDispatch(document, &quot;.uno:InsertField&quot;, 
&quot;&quot;, 0, args())
+End Sub
+
+&apos;=======================================================
+&apos; GoUp
+&apos;-------------------------------------------------------
+&apos; Simulates the CursorUp key
+&apos;=======================================================
+Sub goUp(Count As Integer, Optional bSelect As Boolean)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(1) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Count&quot;
+    args(0).Value = Count
+    args(1).Name = &quot;Select&quot;
+    If IsMissing(bSelect) Then
+        args(1).Value = false
+    Else
+        args(1).Value = bSelect
+    End If
+
+    dispatcher.executeDispatch(document, &quot;.uno:GoUp&quot;, &quot;&quot;, 
0, args())
+End Sub
+
+&apos;=======================================================
+&apos; GoDown
+&apos;-------------------------------------------------------
+&apos; Simulates the CursorDown key
+&apos;=======================================================
+Sub goDown(Count As Integer, Optional bSelect As Boolean)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(1) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Count&quot;
+    args(0).Value = Count
+    args(1).Name = &quot;Select&quot;
+    If IsMissing(bSelect) Then
+        args(1).Value = false
+    Else
+        args(1).Value = bSelect
+    End If
+
+    dispatcher.executeDispatch(document, &quot;.uno:GoDown&quot;, 
&quot;&quot;, 0, args())
+End Sub
+
+
+&apos;=======================================================
+&apos; GoRight
+&apos;-------------------------------------------------------
+&apos; Simulates the CursorRight key
+&apos;=======================================================
+Sub goRight(Count As Integer, Optional bSelect As Boolean)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(1) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Count&quot;
+    args(0).Value = Count
+    args(1).Name = &quot;Select&quot;
+    If IsMissing(bSelect) Then
+        args(1).Value = false
+    Else
+        args(1).Value = bSelect
+    End If
+
+    dispatcher.executeDispatch(document, &quot;.uno:GoRight&quot;, 
&quot;&quot;, 0, args())
+End Sub
+
+&apos;=======================================================
+&apos; GoLeft
+&apos;-------------------------------------------------------
+&apos; Simulates the CursorLeft key
+&apos;=======================================================
+Sub goLeft(Count As Integer, optional bSelect As boolean)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(1) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Count&quot;
+    args(0).Value = Count
+    args(1).Name = &quot;Select&quot;
+    If IsMissing(bSelect) Then
+        args(1).Value = false
+    Else
+        args(1).Value = bSelect
+    End If
+
+    dispatcher.executeDispatch(document, &quot;.uno:GoLeft&quot;, 
&quot;&quot;, 0, args())
+End Sub
+
+&apos;=======================================================
+&apos; CR
+&apos;-------------------------------------------------------
+&apos; Inserts a Carriage Return (a new paragraph)
+&apos;=======================================================
+Sub CR
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.gotoEndOfParagraph(0)
+    thiscomponent.getcurrentcontroller.select(oCur)
+
+    dispatcher.executeDispatch(document, &quot;.uno:InsertPara&quot;, 
&quot;&quot;, 0, Array())
+End Sub
+
+&apos;=======================================================
+&apos; CR_before
+&apos;-------------------------------------------------------
+&apos; Inserts a Carriage Return (a new paragraph) before the current para
+&apos;=======================================================
+Sub CR_before
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.gotoStartOfParagraph(0)
+    thiscomponent.getcurrentcontroller.select(oCur)
+
+    dispatcher.executeDispatch(document, &quot;.uno:InsertPara&quot;, 
&quot;&quot;, 0, Array())
+End Sub
+
+&apos;=======================================================
+&apos; LF
+&apos;-------------------------------------------------------
+&apos; Inserts a line feed (manual line break)
+&apos;=======================================================
+sub LF
+    dim document   as object
+    dim dispatcher as object
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dispatcher.executeDispatch(document, &quot;.uno:InsertLinebreak&quot;, 
&quot;&quot;, 0, Array())
+end sub
+
+&apos;=======================================================
+&apos; SetParaStyle
+&apos;-------------------------------------------------------
+&apos; Sets the para style to the given value
+&apos;=======================================================
+Sub SetParaStyle(StyleName As String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(1) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Template&quot;
+    args(0).Value = StyleName
+    args(1).Name = &quot;Family&quot;
+    args(1).Value = 2
+
+    dispatcher.executeDispatch(document, &quot;.uno:StyleApply&quot;, 
&quot;&quot;, 0, args())
+end Sub
+
+&apos;=======================================================
+&apos; SetCharStyle
+&apos;-------------------------------------------------------
+&apos; Sets the character style to the given value
+&apos;=======================================================
+Sub SetCharStyle(StyleName As String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(1) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Template&quot;
+    args(0).Value = StyleName
+    args(1).Name = &quot;Family&quot;
+    args(1).Value = 1
+
+    dispatcher.executeDispatch(document, &quot;.uno:StyleApply&quot;, 
&quot;&quot;, 0, args())
+end Sub
+
+&apos;=======================================================
+&apos; InsertNewParaData
+&apos;-------------------------------------------------------
+&apos; Inserts a new ID for the paragraph
+&apos;=======================================================
+Sub InsertNewParaData
+
+        If not IsHelpFile Then
+        msgbox(strErr_NoHelpFile)
+        Exit Sub
+    End If
+
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+
+    arParaData = GetParaData
+    sID = arParaData(0)
+    slocalize = arParaData(1)
+    sMsg = arParaData(2)
+
+    If sMsg &lt;&gt; &quot;&quot; Then
+        msgbox &quot;Cannot assign paragraph 
id:&quot;+chr(13)+sMsg,48,&quot;Error&quot;
+        Exit Sub
+    End If
+
+    If sID &lt;&gt; &quot;&quot; Then
+        msgbox &quot;Paragraph already has an ID.&quot;+chr(13)+&quot;If you 
want to assign a new ID delete the existing one 
first.&quot;,48,&quot;Error&quot;
+        Exit Sub
+    End If
+
+    oCur.gotoStartOfParagraph(0)
+
+    If (Left(oCur.ParaStyleName,8) = &quot;hlp_head&quot;) Then
+        id = &quot;hd_id&quot; + CreateID
+        thiscomponent.getcurrentcontroller.select(oCur)
+        MetaData = id
+        SetCharStyle(&quot;hlp_aux_parachanged&quot;)
+        InsertField(&quot;ID&quot;,MetaData)
+        SetCharStyle(&quot;Default&quot;)
+    Else
+        id = &quot;par_id&quot; + CreateID
+        thiscomponent.getcurrentcontroller.select(oCur)
+        MetaData = id
+        SetCharStyle(&quot;hlp_aux_parachanged&quot;)
+        InsertField(&quot;ID&quot;,MetaData)
+        SetCharStyle(&quot;Default&quot;)
+    End If
+
+
+End Sub
+
+&apos;=======================================================
+&apos; LoadDialog
+&apos;-------------------------------------------------------
+&apos; Loads a BASIC dialog
+&apos;=======================================================
+Function LoadDialog(Libname as String, DialogName as String, Optional 
oLibContainer)
+    Dim oLib as Object
+    Dim oLibDialog as Object
+    Dim oRuntimeDialog as Object
+
+    If IsMissing(oLibContainer ) then
+        oLibContainer = DialogLibraries
+    End If
+
+    oLibContainer.LoadLibrary(LibName)
+    oLib = oLibContainer.GetByName(Libname)
+    oLibDialog = oLib.GetByName(DialogName)
+    oRuntimeDialog = CreateUnoDialog(oLibDialog)
+    LoadDialog() = oRuntimeDialog
+End Function
+
+&apos;=======================================================
+&apos; Surprise
+&apos;-------------------------------------------------------
+&apos; D&apos;oh
+&apos;=======================================================
+Sub Surprise
+    msgbox &quot;This function is unsupported.&quot;+chr(13)+&quot;If you know 
how to implement this -- go ahead!&quot;,0,&quot;D&apos;oh!&quot;
+End Sub
+
+&apos;=======================================================
+&apos; InsertNote
+&apos;-------------------------------------------------------
+&apos; Inserts a note (annotation) at the current position
+&apos;=======================================================
+sub InsertNote(Content As String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(2) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Text&quot;
+    args(0).Value = Content
+    args(1).Name = &quot;Author&quot;
+    args(1).Value = &quot;Help Tooling - DO NOT EDIT&quot;
+    args(2).Name = &quot;Date&quot;
+    args(2).Value = &quot;02/27/2004&quot;
+
+    dispatcher.executeDispatch(document, &quot;.uno:InsertAnnotation&quot;, 
&quot;&quot;, 0, args())
+end sub
+
+&apos;=======================================================
+&apos; InsertText
+&apos;-------------------------------------------------------
+&apos; Inserts a string at the current position
+&apos;=======================================================
+Sub InsertText(strg As String)
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.String = strg
+End Sub
+
+&apos;=======================================================
+&apos; ParaIsEmpty
+&apos;-------------------------------------------------------
+&apos; Evaluates if a paragraph is empty.
+&apos;=======================================================
+Function ParaIsEmpty
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.gotoStartOfParagraph(0)
+    ParaIsEmpty = oCur.IsEndOfParagraph
+End Function
+
+&apos;=======================================================
+&apos; IsInBookmark
+&apos;-------------------------------------------------------
+&apos; Evaluates if the cursor is inside a &lt;bookmark&gt; &lt;/bookmark&gt; 
element
+&apos;=======================================================
+Function IsInBookmark
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+
+    If ((oCur.ParaStyleName = &quot;hlp_aux_bookmark&quot;) AND 
(not(oCur.IsEndOfParagraph))) Then
+        oCur.GotoStartOfParagraph(0)
+        oCur.GotoEndOfParagraph(1)
+        sText = Left(oCur.GetString,Instr(oCur.GetString,&quot;&quot;&quot; 
id=&quot;&quot;&quot;)-1)
+        sText = Right(sText,Len(sText)-InStr(sText,&quot;&quot;&quot;&quot;))
+        Select Case Left(sText,3)
+            Case &quot;ind&quot;
+                IsInBookmark = 1
+            Case &quot;hid&quot;
+                IsInBookmark = 2
+            Case &quot;con&quot;
+                IsInBookmark = 3
+            Case Else
+                IsInBookmark = 0
+        End Select
+    Else
+        IsInBookmark = 0
+    End If
+End Function
+
+&apos;=======================================================
+&apos; IsInTable
+&apos;-------------------------------------------------------
+&apos; Evaluates if the cursor is in a table
+&apos;=======================================================
+Function IsInTable
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+
+    IsInTable = (VarType(oCur.TextTable) &lt;&gt; 0)
+End Function
+
+&apos;=======================================================
+&apos; InsertLink
+&apos;-------------------------------------------------------
+&apos; Inserts a hyperlink at the current position
+&apos;=======================================================
+Sub InsertLink(sPath As String, sText As String, sName As String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args(4) as new com.sun.star.beans.PropertyValue
+    args(0).Name = &quot;Hyperlink.Text&quot;
+    args(0).Value = sText
+    args(1).Name = &quot;Hyperlink.URL&quot;
+    args(1).Value = sPath
+    args(2).Name = &quot;Hyperlink.Target&quot;
+    args(2).Value = &quot;&quot;
+    args(3).Name = &quot;Hyperlink.Name&quot;
+    args(3).Value = sName
+    args(4).Name = &quot;Hyperlink.Type&quot;
+    args(4).Value = 1
+
+    dispatcher.executeDispatch(document, &quot;.uno:SetHyperlink&quot;, 
&quot;&quot;, 0, args())
+    args(0).Name = &quot;Count&quot;
+    args(0).Value = 1
+    args(1).Name = &quot;Select&quot;
+    args(1).Value = false
+
+    dispatcher.executeDispatch(document, &quot;.uno:GoRight&quot;, 
&quot;&quot;, 0, args())
+
+End Sub
+
+&apos;=======================================================
+&apos; AssignMissingIDs
+&apos;-------------------------------------------------------
+&apos; Assigns IDs to elements that miss them
+&apos;=======================================================
+Sub AssignMissingIDs
+&apos; NOT IMPLEMENTED YET
+end sub
+
+&apos;=======================================================
+&apos; CreateTable
+&apos;-------------------------------------------------------
+&apos; Creates a new table
+&apos;=======================================================
+Sub CreateTable(nRows as Integer, nCols as Integer, sID as String)
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dim args1(3) as new com.sun.star.beans.PropertyValue
+    args1(0).Name = &quot;TableName&quot;
+    args1(0).Value = sID
+    args1(1).Name = &quot;Columns&quot;
+    args1(1).Value = nCols
+    args1(2).Name = &quot;Rows&quot;
+    args1(2).Value = nRows
+    args1(3).Name = &quot;Flags&quot;
+    args1(3).Value = 9
+
+    dispatcher.executeDispatch(document, &quot;.uno:InsertTable&quot;, 
&quot;&quot;, 0, args1())
+
+    args1(0).Name = &quot;TopBottomMargin.TopMargin&quot;
+    args1(0).Value = 500
+    args1(1).Name = &quot;TopBottomMargin.BottomMargin&quot;
+    args1(1).Value = 0
+    args1(2).Name = &quot;TopBottomMargin.TopRelMargin&quot;
+    args1(2).Value = 100
+    args1(3).Name = &quot;TopBottomMargin.BottomRelMargin&quot;
+    args1(3).Value = 100
+
+    dispatcher.executeDispatch(document, &quot;.uno:TopBottomMargin&quot;, 
&quot;&quot;, 0, args1())
+    dispatcher.executeDispatch(document, &quot;.uno:SelectAll&quot;, 
&quot;&quot;, 0, Array())
+    SetParaStyle(&quot;hlp_tablecontent&quot;)
+    GoDown(1)
+end Sub
+
+&apos;=======================================================
+&apos; IsBlockImage
+&apos;-------------------------------------------------------
+&apos; Evaluates if the cursor is in a paragraph with
+&apos; a block image (image in its own paragraph)
+&apos;=======================================================
+Function IsBlockImage
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.gotoStartOfParagraph(0)
+    oCur.gotoEndOfParagraph(1)
+    sStr = Right(oCur.String,Len(oCur.String)-InStr(oCur.String,&quot; 
&quot;))  &apos;string must start with &lt;IMG and end with IMG with no &lt;IMG 
in between
+    IsBlockImage = (not(Left(sStr,4)=&quot;IMG&gt;&quot;) AND 
(Right(sStr,6)=&quot;&lt;/IMG&gt;&quot;))
+End Function
+
+&apos;=======================================================
+&apos; HasCaption
+&apos;-------------------------------------------------------
+&apos; Evaluates if the current image has a caption element
+&apos;=======================================================
+Function HasCaption
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    If oSel.ImplementationName = &quot;SwXTextGraphicObject&quot; Then
+        oCur = 
oSel(0).getAnchor.getText.createTextCursorByRange(oSel(0).getAnchor)
+    Else
+        oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    End If
+    oCur.gotoStartOfParagraph(0)
+    oCur.gotoEndOfParagraph(1)
+    HasCaption = (InStr(oCur.String,&quot;&lt;IMGCAPTION&quot;)&gt;0)
+End Function
+
+&apos;=======================================================
+&apos; GetImageID
+&apos;-------------------------------------------------------
+&apos; Returns the ID of an image at the cursor position
+&apos;=======================================================
+Function GetImageID
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    If oSel.ImplementationName = &quot;SwXTextGraphicObject&quot; Then
+        oCur = 
oSel(0).getAnchor.getText.createTextCursorByRange(oSel(0).getAnchor)
+    Else
+        oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    End If
+    oCur.gotoStartOfParagraph(0)
+    oCur.gotoEndOfParagraph(1)
+    sStr = Right(oCur.String,Len(oCur.String)-(InStr(oCur.String,&quot;IMG 
ID=&quot;&quot;&quot;)+7))
+    GetImageID = Left(sStr,InStr(sStr,&quot;&quot;&quot;&gt;&quot;)+1)  
&apos;string must start with &lt;IMG and end with IMG with no &lt;IMG in between
+End Function
+
+&apos;=======================================================
+&apos; SelAll
+&apos;-------------------------------------------------------
+&apos; Selects everything
+&apos;=======================================================
+Sub SelAll
+    dim document   as object
+    dim dispatcher as object
+
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dispatcher.executeDispatch(document, &quot;.uno:SelectAll&quot;, 
&quot;&quot;, 0, Array())
+End Sub
+
+&apos;=======================================================
+&apos; GetParaData
+&apos;-------------------------------------------------------
+&apos; Returns the Paragraph ID and localization status
+&apos;=======================================================
+Function GetParaData
+    arParaData = Array(&quot;&quot;,&quot;&quot;,&quot;&quot;) &apos; ID, 
localize, #message
+
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.gotoStartOfParagraph(0)
+    oCur.gotoEndOfParagraph(1)
+    sID = &quot;&quot;
+    Enum = oCur.createEnumeration
+    Fd = FALSE
+
+
+    TE = Enum.nextElement
+
+    TP = TE.createEnumeration
+    Ct = 0
+    posID = 0
+
+    Do While TP.hasmoreElements
+        Ct = Ct+1
+        TPE = TP.nextElement
+        If TPE.TextPortionType=&quot;TextField&quot; Then
+            If TPE.TextField.TextFieldMaster.Name=&quot;ID&quot; Then
+                sID = TPE.TextField.Content
+                Fd = TRUE
+                Exit Do
+            End If
+        End If
+        If TPE.String = &quot;&quot; Then
+            Ct = Ct-1
+        End If
+    Loop
+
+    If ((Left(oCur.ParaStyleName,8) = &quot;hlp_aux_&quot;) or 
(Left(oCur.ParaStyleName,4) &lt;&gt; &quot;hlp_&quot;)) Then
+        arParaData(2)=&quot;Invalid Paragraph Style&quot;
+        GetParaData = arParaData
+        Exit Function
+    End If
+
+    If sID = &quot;&quot; Then
+        GetParaData = arParaData
+        Exit Function
+    End If
+
+    If Right(sID,7) = &quot;_NOL10N&quot; Then
+        arParaData(0) = Left(sID,Len(sID)-7)
+        arParaData(1) = &quot;no&quot;
+    Else
+        arParaData(0) = sID
+        arParaData(1) = &quot;yes&quot;
+    End If
+
+    GetParaData = arParaData
+End Function
+
+&apos;=======================================================
+&apos; SetsParaData
+&apos;-------------------------------------------------------
+&apos; Sets the Paragraph ID and localization status
+&apos;=======================================================
+
+Sub SetParaData(sID as String, sLocalize as String)
+
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    oCur.gotoStartOfParagraph(0)
+    oCur.gotoEndOfParagraph(1)
+    Enum = oCur.createEnumeration
+    Fd = FALSE
+
+
+    Do While Enum.hasMoreElements
+        TE = Enum.nextElement
+
+        TP = TE.createEnumeration
+        Ct = 0
+        posID = 0
+
+        Do While TP.hasmoreElements
+            Ct = Ct+1
+            TPE = TP.nextElement
+            If TPE.TextPortionType=&quot;TextField&quot; Then
+                If TPE.TextField.TextFieldMaster.Name=&quot;ID&quot; Then
+                    posID = Ct
+                    If sLocalize = &quot;no&quot; Then
+                        TPE.TextField.Content = sID+&quot;_NOL10N&quot;
+                        TPE.TextField.IsVisible = TRUE
+                    ElseIf sLocalize = &quot;yes&quot; Then
+                        TPE.TextField.Content = sID
+                        TPE.TextField.IsVisible = TRUE
+                    Else
+                        msgbox &quot;Unknown localization parameter: 
&quot;+sLocalize,0,&quot;Error&quot;
+                    End If
+                    Fd = TRUE
+                    Exit Do
+                End If
+            End If
+            If TPE.String = &quot;&quot; Then
+                Ct = Ct-1
+            End If
+        Loop
+        If Fd Then
+            Exit Do
+        End If
+    Loop
+
+    oCur.TextField.update
+    UpdateFields
+
+End Sub
+
+
+&apos;=======================================================
+&apos; IsInList
+&apos;-------------------------------------------------------
+&apos; Evaluates if the cursor is inside a list (ordered or unordered)
+&apos;=======================================================
+Function IsInList
+    oSel = thiscomponent.getcurrentcontroller.getselection
+    oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+    If oCur.NumberingStyleName = &quot;&quot;  Then
+        IsInList = false
+    ElseIf oCur.NumberingRules.NumberingIsOutline = true Then
+        IsInList = false
+    Else
+        IsInList = true
+    End If
+End Function
+
+&apos;=======================================================
+&apos; TagFormatIsCorrect
+&apos;-------------------------------------------------------
+&apos; Checks for correct paragraph format for tags
+&apos;=======================================================
+Function TagFormatIsCorrect(sTN As String, sPS As String)
+
+    arTag = 
Array(&quot;BOOKMARK&quot;,&quot;SORT&quot;,&quot;SECTION&quot;,&quot;SWITCH&quot;,&quot;CASE&quot;,&quot;DEFAULT&quot;)
+    arTagFormat = 
Array(&quot;hlp_aux_bookmark&quot;,&quot;hlp_aux_sort&quot;,&quot;hlp_aux_section&quot;,&quot;hlp_aux_switch&quot;,&quot;hlp_aux_switch&quot;,&quot;hlp_aux_switch&quot;)
+
+    For n=0 to ubound(arTag)
+        If (sTN = arTag(n) AND sPS &lt;&gt; arTagFormat(n)) Then
+            TagFormatIsCorrect = arTagFormat(n)
+            Exit Function
+        End If
+        TagFormatIsCorrect = &quot;&quot;
+    Next n
+
+End Function
+
+&apos;=======================================================
+&apos; GetFilePath
+&apos;-------------------------------------------------------
+&apos; look for the &quot;text/...&quot; part of the file name and separate it
+&apos;=======================================================
+Function GetFilePath(fname As String)
+
+    i = 1
+    Do
+        If (Mid(fname,i,5) = &quot;text/&quot;) Then
+            Strg = Mid(fname,i,Len(fname)-i+1)
+            Exit Do
+        Else
+            i = i+1
+            Strg = fname
+        End If
+    Loop While (i+5 &lt; Len(fname))
+    GetFilePath = Strg
+End Function
+
+&apos;=======================================================
+&apos; OpenGraphics
+&apos;-------------------------------------------------------
+&apos; Calls the graphic open dialog for inserting an image
+&apos;=======================================================
+Function OpenGraphics(oDoc As Object)
+Dim ListAny(0) as Long
+Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
+    GlobalScope.BasicLibraries.loadLibrary(&quot;Tools&quot;)
+    ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+&apos;    ListAny(0) = 
com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE
+    oFileDialog = 
CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
+    oFileDialog.Initialize(ListAny())
+
+    sLastImgDir = ReadConfig(&quot;LastImgDir&quot;)
+    If sLastImgDir &lt;&gt; &quot;&quot; Then
+        oFileDialog.setDisplayDirectory(sLastImgDir)
+    End If
+
+    oMasterKey = 
GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types/&quot;)
+    oTypes() = oMasterKey.Types
+
+    
oFileDialog.AppendFilter(oTypes.GetByName(&quot;gif_Graphics_Interchange&quot;).UIName,
 &quot;*.gif&quot;)
+    
oFileDialog.AppendFilter(oTypes.GetByName(&quot;png_Portable_Network_Graphic&quot;).UIName,
 &quot;*.png&quot;)
+
+    oFileDialog.SetTitle(&quot;Insert Image&quot;)
+    iAccept = oFileDialog.Execute()
+    If iAccept = 1 Then
+        sPath = oFileDialog.Files(0)
+        WriteConfig(&quot;LastImgDir&quot;,oFileDialog.getDisplayDirectory)
+        UIFilterName = oFileDialog.GetCurrentFilter()
+        OpenGraphics = oFileDialog.Files(0)
+    Else
+        OpenGraphics = &quot;&quot;
+    End If
+    oFileDialog.Dispose()
+End Function
+
+&apos;=======================================================
+&apos; WriteConfig
+&apos;-------------------------------------------------------
+&apos; Reads a parameter value from the config file
+&apos;=======================================================
+Function ReadConfig(Parm As String)
+    oPath = createUNOService(&quot;com.sun.star.util.PathSettings&quot;)
+    filename = oPath.UserConfig+&quot;/helpauthoring.cfg&quot;
+    iNumber = Freefile
+    bFound = false
+    If FileExists(filename) Then
+        Open filename For Input As iNumber
+        Do While (not eof(iNumber) AND not(bFound))
+            Line Input #iNumber, sLine
+            If InStr(sLine, &quot;=&quot;) &gt; 0 Then
+                arLine = split(sLine,&quot;=&quot;)
+                If arLine(0) = Parm Then
+                    sResult = arLine(1)
+                    bFound = true
+                End If
+            End If
+        Loop
+        Close #iNumber
+        If bFound Then
+            ReadConfig = sResult
+        Else
+            ReadConfig = &quot;&quot;
+        End If
+    Else
+        ReadConfig = &quot;&quot;
+    End If
+End Function
+
+
+&apos;=======================================================
+&apos; WriteConfig
+&apos;-------------------------------------------------------
+&apos; Writes a parameter/value pair to the config file
+&apos;=======================================================
+Function WriteConfig(Parm As String, Value As String)
+    Dim arLines(0) As String
+    bFound = false
+    oPath = createUNOService(&quot;com.sun.star.util.PathSettings&quot;)
+    filename = oPath.UserConfig+&quot;/helpauthoring.cfg&quot;
+    iNumber = Freefile
+    If FileExists(filename) Then
+
+        Open filename For Input As iNumber
+        Do While (not eof(iNumber))
+            Line Input #iNumber, sLine
+            If InStr(sLine, &quot;=&quot;) &gt; 0 Then
+                sDim = ubound(arLines())+1
+                ReDim Preserve arLines(sDim)
+                arLines(sDim) = sLine
+            End If
+        Loop
+        Close #iNumber
+
+        nLine = 1
+        Do While (nLine &lt;= ubound(arLines())) and (not bFound)
+            arLine = split(arLines(nLine),&quot;=&quot;)
+            If arLine(0) = Parm Then
+                arLines(nLine) = Parm+&quot;=&quot;+Value
+                bFound = true
+            End If
+            nLine = nLine +1
+        Loop
+
+        nLine = 1
+        Open filename For Output As iNumber
+        Do While (nLine &lt;= ubound(arLines()))
+            Print #iNumber, arLines(nLine)
+            nLine = nLine + 1
+        Loop
+        If (not bFound) Then
+            Print #iNumber, Parm+&quot;=&quot;+Value
+        End If
+        Close #iNumber
+
+    Else
+        Open filename For Output As iNumber
+        Print #iNumber, Parm+&quot;=&quot;+Value
+        Close #iNumber
+    End If
+End Function
+
+Function GetRelPath(sPath As String)
+    sHelpPrefix = ReadConfig(&quot;HelpPrefix&quot;)
+    If sHelpPrefix = &quot;&quot; Then
+        sHelpPrefix = SetDocumentRoot
+    End If
+    GetRelPath = Right(sPath, Len(sPath)-(InStr(sPath,sHelpPrefix) + 
Len(sHelpPrefix)-1))
+End Function
+
+Function SetDocumentRoot
+    sHelpPrefix = ReadConfig(&quot;HelpPrefix&quot;)
+    oFolderDialog = 
CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
+    oFolderDialog.SetTitle(&quot;Select Document Root Folder&quot;)
+    If sHelpPrefix &gt; &quot;&quot; Then
+        oFolderDialog.setDisplayDirectory(sHelpPrefix)
+    End If
+    iAccept = oFolderDialog.Execute()
+
+    If iAccept = 1 Then
+        sHelpPrefix = oFolderDialog.getDirectory + &quot;/&quot;
+        WriteConfig(&quot;HelpPrefix&quot;,sHelpPrefix)
+    End If
+
+    SetDocumentRoot = sHelpPrefix
+End Function
+
+Function MakeAbsPath(sPath As String)
+
+    sHelpPrefix = ReadConfig(&quot;HelpPrefix&quot;)
+    If sHelpPrefix = &quot;&quot; Then
+        sHelpPrefix = SetDocumentRoot
+    End If
+
+    If Right(sPath,4) &lt;&gt; &quot;.xhp&quot; Then
+        sPath=sPath+&quot;.xhp&quot;
+    End If
+    MakeAbsPath = sHelpPrefix+sPath
+End Function
+
+
+Sub UpdateFields
+    dim document   as object
+    dim dispatcher as object
+    document   = ThisComponent.CurrentController.Frame
+    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
+
+    dispatcher.executeDispatch(document, &quot;.uno:UpdateFields&quot;, 
&quot;&quot;, 0, Array())
+End Sub
+
+Function IsHelpFile
+    document = StarDesktop.CurrentComponent
+    IsHelpFile = (Right(GetFilePath(document.URL),4)=&quot;.xhp&quot;)
+End Function
+
+Function GetUserFieldNumber(fn as String)
+    fnum = -1
+    For a=0 to document.DocumentInfo.getUserFieldCount - 1
+        If document.DocumentInfo.getUserFieldName(a) = fn Then
+            fnum = a
+            Exit for
+        End If
+    Next a
+    GetUserFieldNumber = fnum
+End Function
+</script:module>
diff --git a/helpauthoring/HelpAuthoring/IND.xba 
b/helpauthoring/HelpAuthoring/IND.xba
new file mode 100644
index 0000000..8fbcf63
--- /dev/null
+++ b/helpauthoring/HelpAuthoring/IND.xba
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" 
"module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script"; 
script:name="IND" script:language="StarBasic">REM  *****  BASIC  *****
+&apos; #
+&apos; # This file is part of the LibreOffice project.
+&apos; #
+&apos; # This Source Code Form is subject to the terms of the Mozilla Public
+&apos; # License, v. 2.0. If a copy of the MPL was not distributed with this
+&apos; # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+&apos; #
+&apos; # This file incorporates work covered by the following license notice:
+&apos; #
+&apos; #   Licensed to the Apache Software Foundation (ASF) under one or more
+&apos; #   contributor license agreements. See the NOTICE file distributed
+&apos; #   with this work for additional information regarding copyright
+&apos; #   ownership. The ASF licenses this file to you under the Apache
+&apos; #   License, Version 2.0 (the &quot;License&quot;); you may not use 
this file
+&apos; #   except in compliance with the License. You may obtain a copy of
+&apos; #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+&apos; #
+
+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(&quot;HelpAuthoring&quot;)
+    oDialog = LoadDialog(&quot;HelpAuthoring&quot;, &quot;dlgIND&quot;)
+    ocbAddTag = oDialog.GetControl(&quot;cbAddTag&quot;)
+
+    &apos; Check if bookmarks are allowed here
+    If IsInList Then
+        msgbox &quot;No Bookmarks allowed inside a list.&quot;, 48, 
&quot;D&apos;oh!&quot;
+        Exit Sub
+    End If
+
+
+    nBookmarkType = IsInBookmark
+    If nBookmarkType = 1 Then &apos; inside INDEX bookmark
+        ocbAddTag.State = 0
+    End If
+
+    oDialogModel = oDialog.Model
+
+    If oDialog.Execute() = 1 Then
+        &apos; Insert the bookmark construction
+        olbIND = oDialog.GetControl(&quot;lbIND&quot;)
+
+        If nBookmarkType = 0 Then&apos; not in a bookmark, always add parent 
tags
+            bmid = CreateID
+            &apos; now check if we are in a para with text (this wouldn&apos;t 
be valid)
+            If Not(ParaIsEmpty) Then
+                CR
+            End If
+            InsertTag(&quot;BOOKMARK_&quot;,&quot;&lt;BOOKMARK 
branch=&quot;&quot;index&quot;&quot; id=&quot;&quot;bm_id&quot; + bmid + 
&quot;&quot;&quot;&gt;&quot;,&quot;hlp_aux_bookmark&quot;)
+
+            For i=0 to ubound(olbIND.Items)
+                LF
+                
InsertTag(&quot;BOOKMARKVALUE_&quot;,&quot;&lt;BOOKMARKVALUE&gt;&quot;)
+                InsertField(&quot;BOOKMARKVALUE&quot;,olbIND.Items(i))
+                
InsertTag(&quot;_BOOKMARKVALUE&quot;,&quot;&lt;/BOOKMARKVALUE&gt;&quot;)
+            Next i
+            LF
+            
InsertTagCR(&quot;_BOOKMARK&quot;,&quot;&lt;/BOOKMARK&gt;&quot;,&quot;hlp_aux_bookmark&quot;)
+
+        ElseIf nBookmarkType = 1 Then &apos; in a correct bookmark type
+            If ocbAddTag.State = 1 Then
+                If Not(ParaIsEmpty) Then
+                    CR
+                End If

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to