[Libreoffice-commits] dev-tools.git: 4 commits - helpauthoring/Addons.xcu helpauthoring/description.xml helpauthoring/filter helpauthoring/Filter.xcu helpauthoring/help helpauthoring/HelpAuthoring helpauthoring/images helpauthoring/META-INF helpauthoring/Paths.xcu helpauthoring/template helpauthoring/Type.xcu
Jan Holesovsky
kendy at collabora.com
Fri Jul 3 07:41:38 PDT 2015
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 <kendy at 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 @@
' # the License at http://www.apache.org/licenses/LICENSE-2.0 .
' #
-Global Const Version = "v3.20150605"
+Global Const Version = "v3.20150703"
Global Const strErr_NoHelpFile = "Not a Help File"
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.hallot at 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&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&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 "LibreOffice Help Authoring Framework"+chr(13)+"Version "+Version,256
End Sub
+
+Sub OpenXHP
+Dim ListAny(0) as Long
+Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
+
+ sLastSaveDir = ReadConfig("LastSaveDir")
+ sDocRoot = ReadConfig("HelpPrefix")
+ ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+ oFileDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
+ oFileDialog.Initialize(ListAny())
+ oFileDialog.DisplayDirectory = sDocRoot
+ oFileDialog.AppendFilter("Help", "*.xhp")
+ oFileDialog.SetTitle("Open Help File")
+ iAccept = oFileDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFileDialog.Files(0)
+ FileProperties(0).Name = "FilterName"
+ FileProperties(0).Value ="XHP_Help"
+ oDoc = StarDesktop.loadComponentFromURL(sPath, "_blank", 0, FileProperties())
+ End If
+ oFileDialog.Dispose()
+End Sub
+
</script:module>
commit db7f60b24ad69481734d1ddab6fa1f8aee8b7152
Author: Olivier Hallot <olivier.hallot at 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
' End If
oTxtTitle = oDialog.GetControl("txtTitle")
- oTxtTitle.Text = document.DocumentInfo.Title
+ oTxtTitle.Text = document.DocumentProperties.Title
oOpIndInc = oDialog.GetControl("opIndexInclude")
oOpIndExc = oDialog.GetControl("opIndexExclude")
@@ -64,7 +64,10 @@ Sub Main
'End If
- If document.DocumentInfo.GetUserFieldValue(GetUserFieldNumber("Indexer")) = "exclude" then
+
+' If document.DocumentInfo.GetUserFieldValue(GetUserFieldNumber("Indexer")) = "exclude" then
+ If document.DocumentProperties.UserDefinedProperties.Indexer = "exclude" then
+
oOpIndExc.State = True
Else
oOpIndInc.State = True
@@ -80,7 +83,7 @@ Sub Main
'oTxtEdited.Text = document.DocumentInfo.GetUserFieldValue(3)
If oDialog.Execute() = 1 Then ' update the meta data
- document.DocumentInfo.Title = oTxtTitle.Text
+ document.DocumentProperties.Title = oTxtTitle.Text
'document.DocumentInfo.SetUserFieldValue(1,oTxtTopicID.Text)
'document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber("Comment"),oTxtComment.Text)
'document.DocumentInfo.SetUserFieldValue(3,oTxtEdited.Text)
@@ -92,9 +95,11 @@ Sub Main
'End If
If oOpIndExc.State = True Then
- document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber("Indexer"),"exclude")
+ 'document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber("Indexer"),"exclude")
+ document.DocumentProperties.UserDefinedProperties.Indexer = "exclude"
Else
- document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber("Indexer"),"include")
+' document.DocumentInfo.SetUserFieldValue(GetUserFieldNumber("Indexer"),"include")
+ document.DocumentProperties.UserDefinedProperties.Indexer = "include"
End If
End If
oDialog.dispose
@@ -122,6 +127,7 @@ Sub SetTopicID(txt As String)
oTxtTopicID = oDialog.GetControl("txtTopicID")
If txt = "" Then
oTxtTopicID.Text = AlphaNum(document.DocumentInfo.PropertyValues(29).Value)
+' oTxtTopicID.Text = AlphaNum(document.DocumentProperties.UserDefinedProperties.Comments) ' 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
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sub CheckMetaData(oDoc As Object)
- sTopicID = oDoc.DocumentInfo.GetUserFieldValue(1)
+ 'sTopicID = oDoc.DocumentInfo.GetUserFieldValue(1)
+ sTopicID = oDoc.DocumentProperties.UserDefinedProperties.ID
+
+
If sTopicID <> AlphaNum(sTopicID) OR sTopicID="" Then
sTopicID = "topic_"+CreateID ' 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
+ 'oDoc.DocumentInfo.SetUserFieldValue(1,sTopicID)
+ oDoc.DocumentProperties.UserDefinedProperties.ID = sTopicID
+
+
+ 'sCreated = oDoc.DocumentInfo.GetUserFieldValue(2) ' OH not used...
+ sCreated = oDoc.DocumentProperties.CreationDate
+ 'sEdited = oDoc.DocumentInfo.GetUserFieldValue(3) ' OH not used
+
+ 'sTitle = oDoc.DocumentInfo.Title
+ sTitle = oDoc.DocumentProperties.Title
If sTitle="" OR sTitle="<Set Topic Title>" 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)
+ 'sIndex = oDoc.DocumentInfo.GetUserFieldValue(0) '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,"Indexer")
- document.DocumentInfo.SetUserFieldName(1,"ID")
-' document.DocumentInfo.SetUserFieldName(2,"Comment")
- document.DocumentInfo.SetPropertyValue("Subject",Path)
+' document.DocumentInfo.SetUserFieldName(0,"Indexer")
+' document.DocumentInfo.SetUserFieldName(1,"ID")
+'' document.DocumentInfo.SetUserFieldName(2,"Comment")
+' document.DocumentInfo.SetPropertyValue("Subject",Path)
+ document.DocumentProperties.UserDefinedProperties.Indexer = "" ' Present in template properties
+ document.DocumentProperties.UserDefinedProperties.ID = "" ' Present in template properties
+' document.DocumentInfo.SetUserFieldName(2,"Comment")
+ 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 <kendy at 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&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&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&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&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&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&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&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&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&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&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&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&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&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&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">"How to Get" 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&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&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&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&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&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">"Related Topics" 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">' *** MODULE COMMENT ***
+' #
+' # 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 .
+' #
+
+Dim oDialog AS Object
+Dim document AS Object
+
+'=======================================================
+' Main
+'-------------------------------------------------------
+' Inserts a comment
+'=======================================================
+Sub Main
+
+ If not IsHelpFile Then
+ msgbox(strErr_NoHelpFile)
+ Exit Sub
+ End If
+
+ document = StarDesktop.CurrentComponent
+
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oDialog = LoadDialog("HelpAuthoring", "dlgComment")
+ oDialogModel = oDialog.Model
+
+ if not IsHelpFile Then
+ msgbox(strErr_NoHelpFile)
+ Exit Sub
+ End If
+
+ oTxtComment = oDialog.GetControl("txtComment")
+
+ 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 = "" Then
+ SetParaStyle("hlp_aux_comment")
+ End If
+
+ If oTxtComment.Text <> "" Then
+ InsertTag("COMMENT_","<COMMENT>")
+ SetCharStyle("hlp_aux_comment")
+ InsertTag("COMMENT",oTxtComment.Text)
+ InsertTag("_COMMENT","</COMMENT>")
+ 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">' *** MODULE EMBED ***
+' #
+' # 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 .
+' #
+
+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
+
+'=======================================================
+' Main
+'-------------------------------------------------------
+' Embeds a variable or a section
+'=======================================================
+Sub Main(optional bCR As Boolean)
+
+ If not IsHelpFile Then
+ msgbox(strErr_NoHelpFile)
+ Exit Sub
+ End If
+
+ GlobalScope.BasicLibraries.loadLibrary("Tools")
+
+ document = StarDesktop.CurrentComponent
+
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oDialog = LoadDialog("HelpAuthoring", "dlgEmbed")
+ oDialogModel = oDialog.Model
+
+ oTxtFilePath = oDialog.GetControl("txtFilePath") ' path to file, rel to Docroot
+ oTxtID = oDialog.GetControl("txtID") ' anchor
+ oTxtHidFName = oDialog.GetControl("txtHidFName") ' pure filename
+ oOpVariable = oDialog.GetControl("opVariable")
+ oOpSection = oDialog.GetControl("opSection")
+
+ DocRoot = ReadConfig("HelpPrefix")
+ EmbedFolder = ReadConfig("LastEmbedDir")
+ EmbedFile = ReadConfig("LastEmbedFile")
+ EmbedID = ReadConfig("LastEmbedAnchor")
+ EmbedType = ReadConfig("LastEmbedType")
+ If EmbedType = "Variable" 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) > "" 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 <> "") Then
+' msgbox (oTxtFilePath.Text)
+
+ If oTxtID.Text = "" Then
+ msgbox "You did not specify a section or variable to embed.",256
+ Else
+ WriteConfig("LastEmbedAnchor",oTxtID.Text)
+ If oOpVariable.State Then
+ txtEmbed = oTxtFilePath.Text + "#" + oTxtID.Text
+ InsertTag("EMBEDVAR","<EMBEDVAR var=""" + txtEmbed + """>","hlp_aux_tag")
+ SetCharStyle("Default")
+ WriteConfig("LastEmbedType","Variable")
+ Else
+ txtEmbed = oTxtFilePath.Text + "#" + oTxtID.Text
+ CR
+ SetParaStyle("hlp_aux_embed")
+ SetCharStyle("hlp_aux_tag")
+ InsertTag("EMBED","<EMBED href=""" + txtEmbed + """>","hlp_aux_tag")
+ CR
+ WriteConfig("LastEmbedType","Section")
+ End If
+ End If
+ End If
+ oDialog.dispose
+End Sub
+
+'=======================================================
+' SetLabel
+'-------------------------------------------------------
+' Changes the text field label in the dialog
+'=======================================================
+Sub SetLabel
+ olblID = oDialog.GetControl("lblID")
+ oOpVariable = oDialog.GetControl("opVariable")
+ If oOpVariable.getState Then
+ olblID.setText("Variable ID")
+ oDialog.Title = "Embed Variable"
+ Else
+ olblID.setText("Section or Paragraph ID")
+ oDialog.Title = "Embed Section"
+ End If
+End Sub
+
+Sub GetFile
+Dim ListAny(0) as Long
+ ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+ oFileDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
+ oFileDialog.Initialize(ListAny())
+
+ DocRoot = ReadConfig("HelpPrefix")
+ sLastEmbedDir = ReadConfig("LastEmbedDir")
+ sLastEmbedFile = ReadConfig("LastEmbedFile")
+
+ If IsSubDir(sLastEmbedDir,DocRoot) Then
+ oFileDialog.setDisplayDirectory(sLastEmbedDir)
+ If sLastEmbedFile <> "" AND Dir(sLastEmbedDir+sLastEmbedFile) > "" Then
+ oFileDialog.setDefaultName(sLastEmbedFile)
+ End If
+ Else
+ oFileDialog.setDisplayDirectory(DocRoot)
+ End If
+
+ oMasterKey = GetRegistryKeyContent("org.openoffice.TypeDetection.Types/")
+ oTypes() = oMasterKey.Types
+ oFileDialog.AppendFilter("Help", "*.xhp")
+
+ oFileDialog.SetTitle("Embed From Help File")
+ iAccept = oFileDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFileDialog.Files(0)
+ sCurDir = oFileDialog.getDisplayDirectory +"/"
+ WriteConfig("LastEmbedDir",sCurDir)
+ LastFile = Right(sPath, Len(sPath) - Len(sCurDir))
+ WriteConfig("LastEmbedFile",LastFile)
+
+ oTxtPath = oDialog.GetControl("txtFilePath")
+ oTxtHidFName = oDialog.GetControl("txtHidFName")
+ oTxtHidFName.Text = sPath
+
+ If IsSubDir(sCurDir,DocRoot) Then
+ oTxtPath.Text = GetRelPath(sPath, DocRoot)
+ Else
+ oTxtPath.Text = sPath
+ msgbox("File is outside of your Document Root",48,"Warning")
+ End If
+
+ oButBrowseIDs = oDialog.GetControl("butBrowseIDs")
+ oButBrowseIDs.Enable = true
+ End If
+
+End Sub
+
+Sub UpdateFileName
+ oTxtPath = oDialog.GetControl("txtFilePath")
+ ShortFName = oTxtPath.Text
+
+ If ShortFName > "" Then
+
+ oTxtHidFName = oDialog.GetControl("txtHidFName")
+ FName = oTxtHidFName.Text
+
+ If Right(FName, Len(ShortFName)) <> ShortFName Then
+ ' oTxtHidFName.Text = MakeAbsPath(ShortFName)
+ oTxtHidFName.Text = ShortFName
+ End If
+
+ oButBrowseIDs = oDialog.GetControl("butBrowseIDs")
+ If not(FileExists(oTxtHidFName.Text)) Then
+ msgbox oTxtHidFName.Text+" cannot be found.",48,"D'oh!"
+ oButBrowseIDs.Enable = false
+ Else
+ oButBrowseIDs.Enable = true
+ End If
+ End If
+End Sub
+
+Sub BrowseEmbed
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oBrowseDialog = LoadDialog("HelpAuthoring", "dlg_BrowseEmbed")
+ oOpVariable = oDialog.GetControl("opVariable")
+ oTxtPath = oDialog.GetControl("txtFilePath")
+ oTxtHidFName = oDialog.GetControl("txtHidFName")
+ filename = oTxtHidFName.Text
+
+ ReDim arParas(0)
+ ReDim arVars(0)
+ ReDim arSecs(0)
+
+' 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()," ")
+
+ arTmp() = split(sContent,"<paragraph")
+ For n=1 to ubound(arTmp())
+ If arTmp(n) <> "" Then
+ arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),"id=")-3)
+ sId = Left(arTmp(n),Instr(arTmp(n),"""")-1)
+ arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),">"))
+ arTmp(n) = Left(arTmp(n),Instr(arTmp(n),"</paragraph>")-1)
+ If Len(arTmp(n) > 100) Then
+ arTmp(n) = Left(arTmp(n),100)+"..."
+ End If
+ sDim = ubound(arParas())
+ arParas(sDim) = sId+": "+arTmp(n)
+ sDim = ubound(arParas())+1
+ ReDim Preserve arParas(sDim)
+ End If
+ Next n
+
+ arTmp() = split(sContent,"<section")
+ For n=1 to ubound(arTmp())
+ If arTmp(n) <> "" Then
+ arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),"id=")-3)
+ sId = Left(arTmp(n),Instr(arTmp(n),"""")-1)
+ arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),">"))
+ If Instr(arTmp(n),"</section>")>0 Then
+ arTmp(n) = Left(arTmp(n),Instr(arTmp(n),"</section>")-1)
+ End If
+ If Len(arTmp(n) > 100) Then
+ arTmp(n) = Left(arTmp(n),100)+"..."
+ End If
+ sDim = ubound(arSecs())
+ arSecs(sDim) = sId+": "+arTmp(n)
+ sDim = ubound(arSecs())+1
+ ReDim Preserve arSecs(sDim)
+ End If
+ Next n
+
+ arTmp() = split(sContent,"<variable")
+ For n=1 to ubound(arTmp())
+ If arTmp(n) <> "" Then
+ arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),"id=")-3)
+ sId = Left(arTmp(n),Instr(arTmp(n),"""")-1)
+ arTmp(n) = Right(arTmp(n),Len(arTmp(n))-Instr(arTmp(n),">"))
+ arTmp(n) = Left(arTmp(n),Instr(arTmp(n),"</variable>")-1)
+ If Len(arTmp(n) > 100) Then
+ arTmp(n) = Left(arTmp(n),100)+"..."
+ End If
+ sDim = ubound(arVars())
+ arVars(sDim) = sId+": "+arTmp(n)
+ sDim = ubound(arVars())+1
+ ReDim Preserve arVars(sDim)
+ End If
+ Next n
+
+ ShowSecs
+
+ If oBrowseDialog.Execute() = 1 Then
+ olbElements = oBrowseDialog.GetControl("lbElements")
+ sSelected = olbElements.SelectedItem
+ sSelected = Left(sSelected,Instr(sSelected,":")-1)
+ oTxtID = oDialog.GetControl("txtID")
+ oTxtID.Text = sSelected
+ End If
+ Else
+ msgbox "Cannot open "+filename,48,"Error"
+ End If
+End Sub
+
+Sub UpdateLIst
+ oOpSections = oBrowseDialog.GetControl("opSections")
+ oOpVariables = oBrowseDialog.GetControl("opVariables")
+ oOpParas = oBrowseDialog.GetControl("opParas")
+ If oOpSections.getState Then
+ ShowSecs
+ ElseIf oOpVariables.getState Then
+ ShowVars
+ ElseIf oOpParas.getState Then
+ ShowParas
+ End If
+End Sub
+
+Sub ShowSecs
+ olbElements = oBrowseDialog.GetControl("lbElements")
+ olbElements.RemoveItems(0,olbElements.ItemCount)
+ olbElements.AddItems(arSecs(),ubound(arSecs()))
+ oOpSection = oDialog.GetControl("opSection")
+ oOpSection.setState(TRUE)
+ SetLabel
+End Sub
+
+Sub ShowVars
+ olbElements = oBrowseDialog.GetControl("lbElements")
+ olbElements.RemoveItems(0,olbElements.ItemCount)
+ olbElements.AddItems(arVars(),ubound(arVars()))
+ oOpVariable = oDialog.GetControl("opVariable")
+ oOpVariable.setState(TRUE)
+ SetLabel
+End Sub
+
+Sub ShowParas
+ olbElements = oBrowseDialog.GetControl("lbElements")
+ olbElements.RemoveItems(0,olbElements.ItemCount)
+ olbElements.AddItems(arParas(),ubound(arParas()))
+ oOpVariable = oDialog.GetControl("opSection")
+ oOpVariable.setState(TRUE)
+ SetLabel
+End Sub
+
+Sub CheckButton
+ olbElements = oBrowseDialog.GetControl("lbElements")
+ obutSelect = oBrowseDialog.GetControl("butSelect")
+ sSelected = olbElements.SelectedItem
+ If sSelected = "" 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">' *** MODULE FIND ***
+' #
+' # 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 .
+' #
+
+Dim oDialog AS Object
+Dim document AS Object
+Dim Found(0) As Object
+Dim nPos As Integer
+
+'=======================================================
+' Main
+'-------------------------------------------------------
+' Calls the Find routine to search in fields
+'=======================================================
+Sub Main
+
+ If not IsHelpFile Then
+ msgbox(strErr_NoHelpFile)
+ Exit Sub
+ End If
+
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oDialog = LoadDialog("HelpAuthoring", "dlgFind")
+
+ oDoc = StarDesktop.CurrentComponent
+ Enum = oDoc.Text.createEnumeration
+
+ LastSearchTerm = ReadConfig("SearchTerm")
+ If LastSearchTerm <> "" Then
+ oTxtFind = oDialog.GetControl("txtFind")
+ oTxtFind.Text = LastSearchTerm
+ End If
+
+ If oDialog.execute() = 1 Then
+ oTxtFind = oDialog.GetControl("txtFind")
+ sFind = oTxtFind.Text
+ WriteConfig("SearchTerm",sFind)
+
+ Do While Enum.hasMoreElements
+ TE = Enum.nextElement
+ If TE.supportsService("com.sun.star.text.Paragraph") Then
+ TP = TE.createEnumeration
+ While TP.hasmoreElements
+ TPE = TP.nextElement
+ If TPE.supportsService("com.sun.star.text.TextField") 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("com.sun.star.text.TextTable") Then
+ CellName = "A1"
+ 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) & RowIndex
+ Cell = TE.getCellByName(CellName)
+ CellEnum = Cell.createEnumeration
+
+ Do While CellEnum.hasMoreElements
+
+ CellElement = CellEnum.nextElement
+
+ If CellElement.supportsService("com.sun.star.text.Paragraph") Then
+ TP = CellElement.createEnumeration
+ While TP.hasmoreElements
+ TPE = TP.nextElement
+ If TPE.supportsService("com.sun.star.text.TextField") 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()) < 1 Then
+ msgbox "Nothing found"
+ ElseIf ubound(Found()) > 1 Then
+ nPos = 1
+ thiscomponent.getcurrentcontroller.select(Found(1))
+ oDialog = LoadDialog("HelpAuthoring", "dlgRepeatFind")
+ oPrev = oDialog.GetControl("butPrev")
+ oPrev.Enable = FALSE
+ oDialog.Execute()
+ Else
+ thiscomponent.getcurrentcontroller.select(Found(1))
+ End If
+ End If
+End Sub
+
+'=======================================================
+' FindNext
+'-------------------------------------------------------
+' Goes to the next search result position.
+'=======================================================
+Sub FindNext
+ If nPos < ubound(Found()) Then
+ nPos = nPos + 1
+ thiscomponent.getcurrentcontroller.select(Found(nPos))
+ If nPos = ubound(Found()) Then
+ oNext = oDialog.GetControl("butNext")
+ oNext.Enable = FALSE
+ End If
+ If nPos > 1 Then
+ oPrev = oDialog.GetControl("butPrev")
+ oPrev.Enable = TRUE
+ End If
+ End If
+End Sub
+
+'=======================================================
+' FindPrev
+'-------------------------------------------------------
+' Goes to the previous search result position.
+'=======================================================
+Sub FindPrev
+ If nPos > 1 Then
+ nPos = nPos - 1
+ thiscomponent.getcurrentcontroller.select(Found(nPos))
+ If nPos = 1 Then
+ oPrev = oDialog.GetControl("butPrev")
+ oPrev.Enable = FALSE
+ End If
+ If nPos < ubound(Found()) Then
+ oNext = oDialog.GetControl("butNext")
+ 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">' *** MODULE HID ***
+' #
+' # 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 .
+' #
+
+Dim oDialog AS Object
+Dim document AS Object
+
+Sub Main
+
+ If not IsHelpFile Then
+ msgbox(strErr_NoHelpFile)
+ Exit Sub
+ End If
+
+ document = StarDesktop.CurrentComponent
+
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oDialog = LoadDialog("HelpAuthoring", "dlgHID")
+ oDialogModel = oDialog.Model
+
+' oPath = createUNOService("com.sun.star.util.PathSettings")
+' filename = oPath.UserConfig+"/help_hid.lst"
+' oButHIDList = oDialog.GetControl("butHIDList")
+' If FileExists(filename) Then
+' oButHIDList.Enable = true
+' Else
+' oLblWait = oDialog.GetControl("lblWait")
+' oLblWait.Text = "No hid list found in your config folder"
+' oButHIDList.Enable = false
+' End If
+ oTxtHID = oDialog.GetControl("txtHID")
+
+ ' Check if bookmarks are allowed here
+ If IsInList Then
+ msgbox "No Bookmarks allowed inside a list.", 48, "D'oh!"
+ Exit Sub
+ End If
+
+ ' Find out if we are in front of an existing HID
+ If oDialog.Execute() = 1 Then
+
+ If oTxtHID.Text = "" Then
+ msgbox "Empty Help ID. No Help ID element added."
+ Else
+ If IsInBookmark > 0 or Not(ParaIsEmpty) Then
+ CR
+ End If
+ If not(join(split(oTxtHID.Text," "),"") = oTxtHID.Text) Then
+' msgbox "Help ID seems to contain forbidden characters (like spaces). You may need to verify this."
+' HID and uno command
+ arHID = split(oTxtHID.Text," ")
+ sHID = arHID(0)
+ sUNO = arHID(1)
+ Else
+ sHID = oTxtHID.Text
+ sUNO = ""
+ End If
+
+ If sHID <> "" Then
+ bmid = CreateID
+ InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sHID + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark")
+ End If
+ If sUNO <> "" Then
+ bmid = CreateID
+ InsertTagCR("BOOKMARK","<BOOKMARK branch=""hid/" + sUNO + """ id=""bm_id" + bmid + """ localize=""false""/>","hlp_aux_bookmark")
+ End If
+
+ End If
+ End If
+ oDialog.dispose
+
+End Sub
+
+Sub ConvertToSymbol
+ oPath = createUNOService("com.sun.star.util.PathSettings")
+ filename = oPath.UserConfig+"/help_hid.lst"
+ oTxtHID = oDialog.GetControl("txtHID")
+ oButHIDList = oDialog.GetControl("butHIDList")
+ sHID = oTxtHID.Text
+ sCt = 0
+ If FileExists(filename) AND sHID <> "" Then
+ oLblWait = oDialog.GetControl("lblWait")
+ oLblWait.Text = "Searching help_hid.lst. Please wait..."
+ iNumber = Freefile
+ bFound = false
+ Open filename For Input As iNumber
+ Do While (not eof(iNumber) AND not(bFound))
+ Line Input #iNumber, sLine
+ sCt = sCt+1
+ arHID = split(sLine,",")
+ If arHID(1) = sHID Then
+ If arHID(2) <> "" Then
+ symHID = arHID(0) + " " + arHID(2)
+ Else
+ symHID = arHID(0)
+ End If
+ bFound = true
+ End If
+ Loop
+ Close #iNumber
+ If not bFound Then
+ oLblWait.Text = "Nothing found. Searched "+sCt+" Help IDs"
+ Else
+ oTxtHID.Text = symHID
+ oLblWait.Text = "HelpID found. Searched "+sCt+" Help IDs"
+ oButHIDList.Enable = false
+ End If
+ Else
+ oLblWait.Text = "No help_hid.lst found in your config folder"
+ End If
+End Sub
+
+</script:module>
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">' *** MODULE HELPERS ***
+' #
+' # 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 .
+' #
+
+'=======================================================
+' Main
+'-------------------------------------------------------
+' Ensure that necessary library functions are available
+'=======================================================
+Sub Main
+ GlobalScope.BasicLibraries.loadLibrary("Tools")
+End Sub
+
+'=======================================================
+' ShowProp
+'-------------------------------------------------------
+' Displays a dialog that shows the properties and
+' the methods of an object. Used for debugging.
+'=======================================================
+Sub ShowProp(Elem As Object)
+ dim oDialog As Object
+
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oDialog = LoadDialog("HelpAuthoring", "dlgObjProp")
+ oDialogModel = oDialog.Model
+
+ oTxtProp = oDialog.GetControl("txtProp")
+ oTxtProp.Text = Join(Split(Elem.dbg_properties,";"),chr(13))
+
+ oTxtMeth = oDialog.GetControl("txtMeth")
+ oTxtMeth.Text = Join(Split(Elem.dbg_methods,";"),chr(13))
+
+ oTxtInt = oDialog.GetControl("txtInt")
+ oTxtInt.Text = Join(Split(Elem.dbg_supportedInterfaces,";"),chr(13))
+
+ oDialog.Execute()
+ oDialog.dispose
+End Sub
+
+'=======================================================
+' AlphaNum
+'-------------------------------------------------------
+' Removes all invalid characters from a string
+'=======================================================
+Function AlphaNum(Strg As String)
+ dim OutStrg As String
+ dim sValid As String
+
+ sValid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789"
+
+ 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
+
+'=======================================================
+' Replace
+'-------------------------------------------------------
+' Replaces a character with another character in a string
+'=======================================================
+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
+
+
+'=======================================================
+' ReplaceAll
+'-------------------------------------------------------
+' Replaces a character with another character in a string
+'=======================================================
+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
+
+
+
+'=======================================================
+' CreateID
+'-------------------------------------------------------
+' Creates a numerical randomized ID
+'=======================================================
+Function CreateID
+ sDate = ReplaceAll(Date,"/:. \","")
+ sTime = ReplaceAll(Time,"/:. \AMP","")
+ Randomize
+ CreateID = sDate + sTime + Int(Rnd * 100)
+End Function
+
+'=======================================================
+' InsertTag
+'-------------------------------------------------------
+' Inserts an inline tag (element) in the document at the
+' current cursor position. It also sets the character
+' format to hlp_aux_tag
+'=======================================================
+Sub InsertTag (Element As String, Content As String)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(5) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Type"
+ args(0).Value = 8
+ args(1).Name = "SubType"
+ args(1).Value = 1
+ args(2).Name = "Name"
+ args(2).Value = Element
+ args(3).Name = "Content"
+ args(3).Value = Content
+ args(4).Name = "Format"
+ args(4).Value = -1
+ args(5).Name = "Separator"
+ args(5).Value = " "
+ SetCharStyle("hlp_aux_tag")
+ dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args())
+ SetCharStyle("Default")
+End Sub
+
+'=======================================================
+' INSERTTAGCR
+'-------------------------------------------------------
+' Inserts a tag (element) in the document at the
+' current cursor position in its own newly created paragraph.
+' It also sets the character format to hlp_aux_tag and
+' the paragraph to the specified value (should start with hlp_)
+'=======================================================
+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("com.sun.star.frame.DispatchHelper")
+
+ dim args(5) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Type"
+ args(0).Value = 8
+ args(1).Name = "SubType"
+ args(1).Value = 1
+ args(2).Name = "Name"
+ args(2).Value = Element
+ args(3).Name = "Content"
+ args(3).Value = Content
+ args(4).Name = "Format"
+ args(4).Value = -1
+ args(5).Name = "Separator"
+ args(5).Value = " "
+
+ CR
+ goUp(1)
+ SetParaStyle(Style)
+ SetCharStyle("hlp_aux_tag")
+ dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args())
+ SetCharStyle("Default")
+ goDown(1)
+End Sub
+
+'=======================================================
+' InsertField
+'-------------------------------------------------------
+' Inserts a field in the document at the
+' current cursor position.
+'=======================================================
+Sub InsertField(Field as String, Content as String)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(5) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Type"
+ args(0).Value = 8
+ args(1).Name = "SubType"
+ args(1).Value = 1
+ args(2).Name = "Name"
+ args(2).Value = Field
+ args(3).Name = "Content"
+ args(3).Value = Content
+ args(4).Name = "Format"
+ args(4).Value = -1
+ args(5).Name = "Separator"
+ args(5).Value = " "
+
+ dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args())
+End Sub
+
+'=======================================================
+' GoUp
+'-------------------------------------------------------
+' Simulates the CursorUp key
+'=======================================================
+Sub goUp(Count As Integer, Optional bSelect As Boolean)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(1) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Count"
+ args(0).Value = Count
+ args(1).Name = "Select"
+ If IsMissing(bSelect) Then
+ args(1).Value = false
+ Else
+ args(1).Value = bSelect
+ End If
+
+ dispatcher.executeDispatch(document, ".uno:GoUp", "", 0, args())
+End Sub
+
+'=======================================================
+' GoDown
+'-------------------------------------------------------
+' Simulates the CursorDown key
+'=======================================================
+Sub goDown(Count As Integer, Optional bSelect As Boolean)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(1) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Count"
+ args(0).Value = Count
+ args(1).Name = "Select"
+ If IsMissing(bSelect) Then
+ args(1).Value = false
+ Else
+ args(1).Value = bSelect
+ End If
+
+ dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args())
+End Sub
+
+
+'=======================================================
+' GoRight
+'-------------------------------------------------------
+' Simulates the CursorRight key
+'=======================================================
+Sub goRight(Count As Integer, Optional bSelect As Boolean)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(1) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Count"
+ args(0).Value = Count
+ args(1).Name = "Select"
+ If IsMissing(bSelect) Then
+ args(1).Value = false
+ Else
+ args(1).Value = bSelect
+ End If
+
+ dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args())
+End Sub
+
+'=======================================================
+' GoLeft
+'-------------------------------------------------------
+' Simulates the CursorLeft key
+'=======================================================
+Sub goLeft(Count As Integer, optional bSelect As boolean)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(1) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Count"
+ args(0).Value = Count
+ args(1).Name = "Select"
+ If IsMissing(bSelect) Then
+ args(1).Value = false
+ Else
+ args(1).Value = bSelect
+ End If
+
+ dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args())
+End Sub
+
+'=======================================================
+' CR
+'-------------------------------------------------------
+' Inserts a Carriage Return (a new paragraph)
+'=======================================================
+Sub CR
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+ oCur.gotoEndOfParagraph(0)
+ thiscomponent.getcurrentcontroller.select(oCur)
+
+ dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
+End Sub
+
+'=======================================================
+' CR_before
+'-------------------------------------------------------
+' Inserts a Carriage Return (a new paragraph) before the current para
+'=======================================================
+Sub CR_before
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+ oCur.gotoStartOfParagraph(0)
+ thiscomponent.getcurrentcontroller.select(oCur)
+
+ dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())
+End Sub
+
+'=======================================================
+' LF
+'-------------------------------------------------------
+' Inserts a line feed (manual line break)
+'=======================================================
+sub LF
+ dim document as object
+ dim dispatcher as object
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dispatcher.executeDispatch(document, ".uno:InsertLinebreak", "", 0, Array())
+end sub
+
+'=======================================================
+' SetParaStyle
+'-------------------------------------------------------
+' Sets the para style to the given value
+'=======================================================
+Sub SetParaStyle(StyleName As String)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(1) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Template"
+ args(0).Value = StyleName
+ args(1).Name = "Family"
+ args(1).Value = 2
+
+ dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args())
+end Sub
+
+'=======================================================
+' SetCharStyle
+'-------------------------------------------------------
+' Sets the character style to the given value
+'=======================================================
+Sub SetCharStyle(StyleName As String)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(1) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Template"
+ args(0).Value = StyleName
+ args(1).Name = "Family"
+ args(1).Value = 1
+
+ dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args())
+end Sub
+
+'=======================================================
+' InsertNewParaData
+'-------------------------------------------------------
+' Inserts a new ID for the paragraph
+'=======================================================
+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 <> "" Then
+ msgbox "Cannot assign paragraph id:"+chr(13)+sMsg,48,"Error"
+ Exit Sub
+ End If
+
+ If sID <> "" Then
+ msgbox "Paragraph already has an ID."+chr(13)+"If you want to assign a new ID delete the existing one first.",48,"Error"
+ Exit Sub
+ End If
+
+ oCur.gotoStartOfParagraph(0)
+
+ If (Left(oCur.ParaStyleName,8) = "hlp_head") Then
+ id = "hd_id" + CreateID
+ thiscomponent.getcurrentcontroller.select(oCur)
+ MetaData = id
+ SetCharStyle("hlp_aux_parachanged")
+ InsertField("ID",MetaData)
+ SetCharStyle("Default")
+ Else
+ id = "par_id" + CreateID
+ thiscomponent.getcurrentcontroller.select(oCur)
+ MetaData = id
+ SetCharStyle("hlp_aux_parachanged")
+ InsertField("ID",MetaData)
+ SetCharStyle("Default")
+ End If
+
+
+End Sub
+
+'=======================================================
+' LoadDialog
+'-------------------------------------------------------
+' Loads a BASIC dialog
+'=======================================================
+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
+
+'=======================================================
+' Surprise
+'-------------------------------------------------------
+' D'oh
+'=======================================================
+Sub Surprise
+ msgbox "This function is unsupported."+chr(13)+"If you know how to implement this -- go ahead!",0,"D'oh!"
+End Sub
+
+'=======================================================
+' InsertNote
+'-------------------------------------------------------
+' Inserts a note (annotation) at the current position
+'=======================================================
+sub InsertNote(Content As String)
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dim args(2) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Text"
+ args(0).Value = Content
+ args(1).Name = "Author"
+ args(1).Value = "Help Tooling - DO NOT EDIT"
+ args(2).Name = "Date"
+ args(2).Value = "02/27/2004"
+
+ dispatcher.executeDispatch(document, ".uno:InsertAnnotation", "", 0, args())
+end sub
+
+'=======================================================
+' InsertText
+'-------------------------------------------------------
+' Inserts a string at the current position
+'=======================================================
+Sub InsertText(strg As String)
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+ oCur.String = strg
+End Sub
+
+'=======================================================
+' ParaIsEmpty
+'-------------------------------------------------------
+' Evaluates if a paragraph is empty.
+'=======================================================
+Function ParaIsEmpty
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+ oCur.gotoStartOfParagraph(0)
+ ParaIsEmpty = oCur.IsEndOfParagraph
+End Function
+
+'=======================================================
+' IsInBookmark
+'-------------------------------------------------------
+' Evaluates if the cursor is inside a <bookmark> </bookmark> element
+'=======================================================
+Function IsInBookmark
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+
+ If ((oCur.ParaStyleName = "hlp_aux_bookmark") AND (not(oCur.IsEndOfParagraph))) Then
+ oCur.GotoStartOfParagraph(0)
+ oCur.GotoEndOfParagraph(1)
+ sText = Left(oCur.GetString,Instr(oCur.GetString,""" id=""")-1)
+ sText = Right(sText,Len(sText)-InStr(sText,""""))
+ Select Case Left(sText,3)
+ Case "ind"
+ IsInBookmark = 1
+ Case "hid"
+ IsInBookmark = 2
+ Case "con"
+ IsInBookmark = 3
+ Case Else
+ IsInBookmark = 0
+ End Select
+ Else
+ IsInBookmark = 0
+ End If
+End Function
+
+'=======================================================
+' IsInTable
+'-------------------------------------------------------
+' Evaluates if the cursor is in a table
+'=======================================================
+Function IsInTable
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+
+ IsInTable = (VarType(oCur.TextTable) <> 0)
+End Function
+
+'=======================================================
+' InsertLink
+'-------------------------------------------------------
+' Inserts a hyperlink at the current position
+'=======================================================
+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("com.sun.star.frame.DispatchHelper")
+
+ dim args(4) as new com.sun.star.beans.PropertyValue
+ args(0).Name = "Hyperlink.Text"
+ args(0).Value = sText
+ args(1).Name = "Hyperlink.URL"
+ args(1).Value = sPath
+ args(2).Name = "Hyperlink.Target"
+ args(2).Value = ""
+ args(3).Name = "Hyperlink.Name"
+ args(3).Value = sName
+ args(4).Name = "Hyperlink.Type"
+ args(4).Value = 1
+
+ dispatcher.executeDispatch(document, ".uno:SetHyperlink", "", 0, args())
+ args(0).Name = "Count"
+ args(0).Value = 1
+ args(1).Name = "Select"
+ args(1).Value = false
+
+ dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args())
+
+End Sub
+
+'=======================================================
+' AssignMissingIDs
+'-------------------------------------------------------
+' Assigns IDs to elements that miss them
+'=======================================================
+Sub AssignMissingIDs
+' NOT IMPLEMENTED YET
+end sub
+
+'=======================================================
+' CreateTable
+'-------------------------------------------------------
+' Creates a new table
+'=======================================================
+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("com.sun.star.frame.DispatchHelper")
+
+ dim args1(3) as new com.sun.star.beans.PropertyValue
+ args1(0).Name = "TableName"
+ args1(0).Value = sID
+ args1(1).Name = "Columns"
+ args1(1).Value = nCols
+ args1(2).Name = "Rows"
+ args1(2).Value = nRows
+ args1(3).Name = "Flags"
+ args1(3).Value = 9
+
+ dispatcher.executeDispatch(document, ".uno:InsertTable", "", 0, args1())
+
+ args1(0).Name = "TopBottomMargin.TopMargin"
+ args1(0).Value = 500
+ args1(1).Name = "TopBottomMargin.BottomMargin"
+ args1(1).Value = 0
+ args1(2).Name = "TopBottomMargin.TopRelMargin"
+ args1(2).Value = 100
+ args1(3).Name = "TopBottomMargin.BottomRelMargin"
+ args1(3).Value = 100
+
+ dispatcher.executeDispatch(document, ".uno:TopBottomMargin", "", 0, args1())
+ dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
+ SetParaStyle("hlp_tablecontent")
+ GoDown(1)
+end Sub
+
+'=======================================================
+' IsBlockImage
+'-------------------------------------------------------
+' Evaluates if the cursor is in a paragraph with
+' a block image (image in its own paragraph)
+'=======================================================
+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," ")) 'string must start with <IMG and end with IMG with no <IMG in between
+ IsBlockImage = (not(Left(sStr,4)="IMG>") AND (Right(sStr,6)="</IMG>"))
+End Function
+
+'=======================================================
+' HasCaption
+'-------------------------------------------------------
+' Evaluates if the current image has a caption element
+'=======================================================
+Function HasCaption
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ If oSel.ImplementationName = "SwXTextGraphicObject" 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,"<IMGCAPTION")>0)
+End Function
+
+'=======================================================
+' GetImageID
+'-------------------------------------------------------
+' Returns the ID of an image at the cursor position
+'=======================================================
+Function GetImageID
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ If oSel.ImplementationName = "SwXTextGraphicObject" 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,"IMG ID=""")+7))
+ GetImageID = Left(sStr,InStr(sStr,""">")+1) 'string must start with <IMG and end with IMG with no <IMG in between
+End Function
+
+'=======================================================
+' SelAll
+'-------------------------------------------------------
+' Selects everything
+'=======================================================
+Sub SelAll
+ dim document as object
+ dim dispatcher as object
+
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())
+End Sub
+
+'=======================================================
+' GetParaData
+'-------------------------------------------------------
+' Returns the Paragraph ID and localization status
+'=======================================================
+Function GetParaData
+ arParaData = Array("","","") ' ID, localize, #message
+
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+ oCur.gotoStartOfParagraph(0)
+ oCur.gotoEndOfParagraph(1)
+ sID = ""
+ 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="TextField" Then
+ If TPE.TextField.TextFieldMaster.Name="ID" Then
+ sID = TPE.TextField.Content
+ Fd = TRUE
+ Exit Do
+ End If
+ End If
+ If TPE.String = "" Then
+ Ct = Ct-1
+ End If
+ Loop
+
+ If ((Left(oCur.ParaStyleName,8) = "hlp_aux_") or (Left(oCur.ParaStyleName,4) <> "hlp_")) Then
+ arParaData(2)="Invalid Paragraph Style"
+ GetParaData = arParaData
+ Exit Function
+ End If
+
+ If sID = "" Then
+ GetParaData = arParaData
+ Exit Function
+ End If
+
+ If Right(sID,7) = "_NOL10N" Then
+ arParaData(0) = Left(sID,Len(sID)-7)
+ arParaData(1) = "no"
+ Else
+ arParaData(0) = sID
+ arParaData(1) = "yes"
+ End If
+
+ GetParaData = arParaData
+End Function
+
+'=======================================================
+' SetsParaData
+'-------------------------------------------------------
+' Sets the Paragraph ID and localization status
+'=======================================================
+
+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="TextField" Then
+ If TPE.TextField.TextFieldMaster.Name="ID" Then
+ posID = Ct
+ If sLocalize = "no" Then
+ TPE.TextField.Content = sID+"_NOL10N"
+ TPE.TextField.IsVisible = TRUE
+ ElseIf sLocalize = "yes" Then
+ TPE.TextField.Content = sID
+ TPE.TextField.IsVisible = TRUE
+ Else
+ msgbox "Unknown localization parameter: "+sLocalize,0,"Error"
+ End If
+ Fd = TRUE
+ Exit Do
+ End If
+ End If
+ If TPE.String = "" Then
+ Ct = Ct-1
+ End If
+ Loop
+ If Fd Then
+ Exit Do
+ End If
+ Loop
+
+ oCur.TextField.update
+ UpdateFields
+
+End Sub
+
+
+'=======================================================
+' IsInList
+'-------------------------------------------------------
+' Evaluates if the cursor is inside a list (ordered or unordered)
+'=======================================================
+Function IsInList
+ oSel = thiscomponent.getcurrentcontroller.getselection
+ oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
+ If oCur.NumberingStyleName = "" Then
+ IsInList = false
+ ElseIf oCur.NumberingRules.NumberingIsOutline = true Then
+ IsInList = false
+ Else
+ IsInList = true
+ End If
+End Function
+
+'=======================================================
+' TagFormatIsCorrect
+'-------------------------------------------------------
+' Checks for correct paragraph format for tags
+'=======================================================
+Function TagFormatIsCorrect(sTN As String, sPS As String)
+
+ arTag = Array("BOOKMARK","SORT","SECTION","SWITCH","CASE","DEFAULT")
+ arTagFormat = Array("hlp_aux_bookmark","hlp_aux_sort","hlp_aux_section","hlp_aux_switch","hlp_aux_switch","hlp_aux_switch")
+
+ For n=0 to ubound(arTag)
+ If (sTN = arTag(n) AND sPS <> arTagFormat(n)) Then
+ TagFormatIsCorrect = arTagFormat(n)
+ Exit Function
+ End If
+ TagFormatIsCorrect = ""
+ Next n
+
+End Function
+
+'=======================================================
+' GetFilePath
+'-------------------------------------------------------
+' look for the "text/..." part of the file name and separate it
+'=======================================================
+Function GetFilePath(fname As String)
+
+ i = 1
+ Do
+ If (Mid(fname,i,5) = "text/") Then
+ Strg = Mid(fname,i,Len(fname)-i+1)
+ Exit Do
+ Else
+ i = i+1
+ Strg = fname
+ End If
+ Loop While (i+5 < Len(fname))
+ GetFilePath = Strg
+End Function
+
+'=======================================================
+' OpenGraphics
+'-------------------------------------------------------
+' Calls the graphic open dialog for inserting an image
+'=======================================================
+Function OpenGraphics(oDoc As Object)
+Dim ListAny(0) as Long
+Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
+ GlobalScope.BasicLibraries.loadLibrary("Tools")
+ ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+' ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE
+ oFileDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
+ oFileDialog.Initialize(ListAny())
+
+ sLastImgDir = ReadConfig("LastImgDir")
+ If sLastImgDir <> "" Then
+ oFileDialog.setDisplayDirectory(sLastImgDir)
+ End If
+
+ oMasterKey = GetRegistryKeyContent("org.openoffice.TypeDetection.Types/")
+ oTypes() = oMasterKey.Types
+
+ oFileDialog.AppendFilter(oTypes.GetByName("gif_Graphics_Interchange").UIName, "*.gif")
+ oFileDialog.AppendFilter(oTypes.GetByName("png_Portable_Network_Graphic").UIName, "*.png")
+
+ oFileDialog.SetTitle("Insert Image")
+ iAccept = oFileDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFileDialog.Files(0)
+ WriteConfig("LastImgDir",oFileDialog.getDisplayDirectory)
+ UIFilterName = oFileDialog.GetCurrentFilter()
+ OpenGraphics = oFileDialog.Files(0)
+ Else
+ OpenGraphics = ""
+ End If
+ oFileDialog.Dispose()
+End Function
+
+'=======================================================
+' WriteConfig
+'-------------------------------------------------------
+' Reads a parameter value from the config file
+'=======================================================
+Function ReadConfig(Parm As String)
+ oPath = createUNOService("com.sun.star.util.PathSettings")
+ filename = oPath.UserConfig+"/helpauthoring.cfg"
+ 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, "=") > 0 Then
+ arLine = split(sLine,"=")
+ If arLine(0) = Parm Then
+ sResult = arLine(1)
+ bFound = true
+ End If
+ End If
+ Loop
+ Close #iNumber
+ If bFound Then
+ ReadConfig = sResult
+ Else
+ ReadConfig = ""
+ End If
+ Else
+ ReadConfig = ""
+ End If
+End Function
+
+
+'=======================================================
+' WriteConfig
+'-------------------------------------------------------
+' Writes a parameter/value pair to the config file
+'=======================================================
+Function WriteConfig(Parm As String, Value As String)
+ Dim arLines(0) As String
+ bFound = false
+ oPath = createUNOService("com.sun.star.util.PathSettings")
+ filename = oPath.UserConfig+"/helpauthoring.cfg"
+ iNumber = Freefile
+ If FileExists(filename) Then
+
+ Open filename For Input As iNumber
+ Do While (not eof(iNumber))
+ Line Input #iNumber, sLine
+ If InStr(sLine, "=") > 0 Then
+ sDim = ubound(arLines())+1
+ ReDim Preserve arLines(sDim)
+ arLines(sDim) = sLine
+ End If
+ Loop
+ Close #iNumber
+
+ nLine = 1
+ Do While (nLine <= ubound(arLines())) and (not bFound)
+ arLine = split(arLines(nLine),"=")
+ If arLine(0) = Parm Then
+ arLines(nLine) = Parm+"="+Value
+ bFound = true
+ End If
+ nLine = nLine +1
+ Loop
+
+ nLine = 1
+ Open filename For Output As iNumber
+ Do While (nLine <= ubound(arLines()))
+ Print #iNumber, arLines(nLine)
+ nLine = nLine + 1
+ Loop
+ If (not bFound) Then
+ Print #iNumber, Parm+"="+Value
+ End If
+ Close #iNumber
+
+ Else
+ Open filename For Output As iNumber
+ Print #iNumber, Parm+"="+Value
+ Close #iNumber
+ End If
+End Function
+
+Function GetRelPath(sPath As String)
+ sHelpPrefix = ReadConfig("HelpPrefix")
+ If sHelpPrefix = "" Then
+ sHelpPrefix = SetDocumentRoot
+ End If
+ GetRelPath = Right(sPath, Len(sPath)-(InStr(sPath,sHelpPrefix) + Len(sHelpPrefix)-1))
+End Function
+
+Function SetDocumentRoot
+ sHelpPrefix = ReadConfig("HelpPrefix")
+ oFolderDialog = CreateUnoService("com.sun.star.ui.dialogs.FolderPicker")
+ oFolderDialog.SetTitle("Select Document Root Folder")
+ If sHelpPrefix > "" Then
+ oFolderDialog.setDisplayDirectory(sHelpPrefix)
+ End If
+ iAccept = oFolderDialog.Execute()
+
+ If iAccept = 1 Then
+ sHelpPrefix = oFolderDialog.getDirectory + "/"
+ WriteConfig("HelpPrefix",sHelpPrefix)
+ End If
+
+ SetDocumentRoot = sHelpPrefix
+End Function
+
+Function MakeAbsPath(sPath As String)
+
+ sHelpPrefix = ReadConfig("HelpPrefix")
+ If sHelpPrefix = "" Then
+ sHelpPrefix = SetDocumentRoot
+ End If
+
+ If Right(sPath,4) <> ".xhp" Then
+ sPath=sPath+".xhp"
+ End If
+ MakeAbsPath = sHelpPrefix+sPath
+End Function
+
+
+Sub UpdateFields
+ dim document as object
+ dim dispatcher as object
+ document = ThisComponent.CurrentController.Frame
+ dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
+
+ dispatcher.executeDispatch(document, ".uno:UpdateFields", "", 0, Array())
+End Sub
+
+Function IsHelpFile
+ document = StarDesktop.CurrentComponent
+ IsHelpFile = (Right(GetFilePath(document.URL),4)=".xhp")
+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 *****
+' #
+' # 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 .
+' #
+
+Dim oDialog AS Object
+Dim document AS Object
+
+Sub Main
+
+ If not IsHelpFile Then
+ msgbox(strErr_NoHelpFile)
+ Exit Sub
+ End If
+
+ document = StarDesktop.CurrentComponent
+
+ BasicLibraries.LoadLibrary("HelpAuthoring")
+ oDialog = LoadDialog("HelpAuthoring", "dlgIND")
+ ocbAddTag = oDialog.GetControl("cbAddTag")
+
+ ' Check if bookmarks are allowed here
+ If IsInList Then
+ msgbox "No Bookmarks allowed inside a list.", 48, "D'oh!"
+ Exit Sub
+ End If
+
+
+ nBookmarkType = IsInBookmark
+ If nBookmarkType = 1 Then ' inside INDEX bookmark
+ ocbAddTag.State = 0
+ End If
+
+ oDialogModel = oDialog.Model
+
+ If oDialog.Execute() = 1 Then
+ ' Insert the bookmark construction
+ olbIND = oDialog.GetControl("lbIND")
+
+ If nBookmarkType = 0 Then' not in a bookmark, always add parent tags
+ bmid = CreateID
+ ' now check if we are in a para with text (this wouldn't be valid)
+ If Not(ParaIsEmpty) Then
+ CR
+ End If
+ InsertTag("BOOKMARK_","<BOOKMARK branch=""index"" id=""bm_id" + bmid + """>","hlp_aux_bookmark")
+
+ For i=0 to ubound(olbIND.Items)
+ LF
+ InsertTag("BOOKMARKVALUE_","<BOOKMARKVALUE>")
+ InsertField("BOOKMARKVALUE",olbIND.Items(i))
+ InsertTag("_BOOKMARKVALUE","</BOOKMARKVALUE>")
+ Next i
+ LF
+ InsertTagCR("_BOOKMARK","</BOOKMARK>","hlp_aux_bookmark")
+
+ ElseIf nBookmarkType = 1 Then ' in a correct bookmark type
+ If ocbAddTag.State = 1 Then
+ If Not(ParaIsEmpty) Then
+ CR
+ End If
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list