[Libreoffice-commits] dev-tools.git: helpauthoring/Addons.xcu helpauthoring/HelpAuthoring
Yousuf Philips
philipz85 at hotmail.com
Fri Sep 11 02:51:55 PDT 2015
helpauthoring/Addons.xcu | 131 +++++++++++++++++++---------------
helpauthoring/HelpAuthoring/_Main.xba | 42 ++++++++++
2 files changed, 119 insertions(+), 54 deletions(-)
New commits:
commit 03d93d6e77da4ff0fccafb0dbb3f77ceb322a3bf
Author: Yousuf Philips <philipz85 at hotmail.com>
Date: Fri Sep 11 09:43:59 2015 +0400
Open a embedded or linked help file and some menu cleanup
Change-Id: I1d04f1294c795aca0efb2882a9ee53ad20af2f61
Reviewed-on: https://gerrit.libreoffice.org/18485
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/helpauthoring/Addons.xcu b/helpauthoring/Addons.xcu
index 84c7d31..fb092ce 100644
--- a/helpauthoring/Addons.xcu
+++ b/helpauthoring/Addons.xcu
@@ -44,15 +44,6 @@
<value xml:lang="en-US">Open 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.ReloadXHP?language=Basic&location=application</value>
- </prop>
- <prop oor:name="Title" oor:type="xs:string">
- <value/>
- <value xml:lang="en-US">Reload File</value>
- </prop>
- </node>
<node oor:name="m05" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
@@ -146,7 +137,6 @@
</node>
</node>
- <!-- Functions that embed and link to content -->
<node oor:name="m10" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>private:separator</value>
@@ -158,7 +148,7 @@
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value/>
- <value xml:lang="en-US">Transclude (<embed>) </value>
+ <value xml:lang="en-US">Insert Embed (<embed>) </value>
</prop>
</node>
<node oor:name="m12" oor:op="replace">
@@ -172,6 +162,22 @@
</node>
<node oor:name="m13" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:HelpAuthoring._Main.OpenLink?language=Basic&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Open <Embed> or <Link> Help File </value>
+ </prop>
+ </node>
+
+ <!-- Functions that define resuable content -->
+ <node oor:name="m20" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>private:separator</value>
+ </prop>
+ </node>
+ <node oor:name="m21" 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">
@@ -179,7 +185,7 @@
<value xml:lang="en-US">Insert Section (<section>) </value>
</prop>
</node>
- <node oor:name="m14" oor:op="replace">
+ <node oor:name="m22" 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>
@@ -188,7 +194,7 @@
<value xml:lang="en-US">Insert "How to Get" Section </value>
</prop>
</node>
- <node oor:name="m15" oor:op="replace">
+ <node oor:name="m23" 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>
@@ -197,55 +203,32 @@
<value xml:lang="en-US">Insert "Related Topics" Section </value>
</prop>
</node>
- <node oor:name="m16" oor:op="replace">
+ <node oor:name="m24" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
- <value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertVariable?language=Basic&location=application</value>
+ <value>.uno:EditRegion</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value/>
- <value xml:lang="en-US">Insert Variable (<variable>) </value>
+ <value xml:lang="en-US">Edit IDs and Delete Sections </value>
</prop>
</node>
-
- <node oor:name="m18" oor:op="replace">
+ <node oor:name="m25" 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 xml:lang="en-US">Insert Product Variables</value>
+ <value/>
+ <value xml:lang="en-US">Insert Variable (<variable>) </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.OtherElements.InsertProductName?language=Basic&location=application</value>
- </prop>
- <prop oor:name="Title" oor:type="xs:string">
- <value xml:lang="en-US">Insert %PRODUCTNAME</value>
- </prop>
- </node>
- <node oor:name="m01" oor:op="replace">
- <prop oor:name="URL" oor:type="xs:string">
- <value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertProductVersion?language=Basic&location=application</value>
- </prop>
- <prop oor:name="Title" oor:type="xs:string">
- <value xml:lang="en-US">Insert %PRODUCTVERSION</value>
- </prop>
- </node>
- <node oor:name="m02" oor:op="replace">
- <prop oor:name="URL" oor:type="xs:string">
- <value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertOfficeName?language=Basic&location=application</value>
- </prop>
- <prop oor:name="Title" oor:type="xs:string">
- <value xml:lang="en-US">Insert $[officename]</value>
- </prop>
- </node>
- </node>
</node>
<!-- Insert invisible tags -->
- <node oor:name="m20" oor:op="replace">
+ <node oor:name="m30" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>private:separator</value>
</prop>
</node>
- <node oor:name="m21" oor:op="replace">
+ <node oor:name="m31" 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>
@@ -254,7 +237,7 @@
<value xml:lang="en-US">Insert Help ID (<bookmark branch="hid/...">) </value>
</prop>
</node>
- <node oor:name="m22" oor:op="replace">
+ <node oor:name="m32" 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>
@@ -263,7 +246,7 @@
<value xml:lang="en-US">Insert Extended Tip (<avis>/<ahis>) </value>
</prop>
</node>
- <node oor:name="m23" oor:op="replace">
+ <node oor:name="m33" 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>
@@ -272,18 +255,18 @@
<value xml:lang="en-US">Insert Comment (<comment>) </value>
</prop>
</node>
- <node oor:name="m24" oor:op="replace">
+ <node oor:name="m34" 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>
+ <value xml:lang="en-US">Insert Index Entry (<bookmark branch="index">) </value>
</prop>
</node>
<!-- Switch entry should go here -->
- <!-- Insert visible objects -->
+ <!-- Insert visible objects/elements -->
<node oor:name="m50" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>private:separator</value>
@@ -307,8 +290,39 @@
<value xml:lang="en-US">Insert Image </value>
</prop>
</node>
+ <node oor:name="m53" oor:op="replace">
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Insert Product Variables</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.OtherElements.InsertProductName?language=Basic&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Insert %PRODUCTNAME</value>
+ </prop>
+ </node>
+ <node oor:name="m01" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertProductVersion?language=Basic&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Insert %PRODUCTVERSION</value>
+ </prop>
+ </node>
+ <node oor:name="m02" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:HelpAuthoring.OtherElements.InsertOfficeName?language=Basic&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value xml:lang="en-US">Insert $[officename]</value>
+ </prop>
+ </node>
+ </node>
+ </node>
- <!-- Functions that are automatically run when saving a file, so they arent that needed -->
+ <!-- Functions that are least used -->
<node oor:name="m80" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>private:separator</value>
@@ -350,8 +364,17 @@
<value xml:lang="en-US">Validate Help File </value>
</prop>
</node>
+ <node oor:name="m86" oor:op="replace">
+ <prop oor:name="URL" oor:type="xs:string">
+ <value>vnd.sun.star.script:HelpAuthoring._Main.ReloadXHP?language=Basic&location=application</value>
+ </prop>
+ <prop oor:name="Title" oor:type="xs:string">
+ <value/>
+ <value xml:lang="en-US">Reload File</value>
+ </prop>
+ </node>
- <!-- Functions that could easily be removed -->
+ <!-- Functions that maybe opened by the user only once -->
<node oor:name="m90" oor:op="replace">
<prop oor:name="URL" oor:type="xs:string">
<value>private:separator</value>
diff --git a/helpauthoring/HelpAuthoring/_Main.xba b/helpauthoring/HelpAuthoring/_Main.xba
index 90a2eae..4e1c0b3 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -275,6 +275,48 @@ Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
oFileDialog.Dispose()
End Sub
+Sub OpenLink
+ If not IsHelpFile Then
+ msgbox( strErr_NoHelpFile )
+ Exit Sub
+ End If
+
+ oVC = ThisComponent.CurrentController.getViewCursor
+ If oVC.isCollapsed Then
+ Print "Please select a <embed> or <link> tag."
+ Else
+ link_start = instr(oVC.String,"<LINK")
+ embed_start = instr(oVC.String,"<EMBED")
+ If link_start Or embed_start Then
+ If link_start Then
+ href_start = instr( link_start, oVC.String, "href=""" )
+ Else
+ href_start = instr( embed_start, oVC.String, "href=""" )
+ End If
+ href_end = instr( href_start + 6, oVC.String, """" )
+ href = mid( oVC.String, href_start + 6, href_end - href_start - 6 )
+ section_start = instr( href, "#" )
+ If section_start Then
+ section = mid( href, section_start + 1, len(href) - section_start )
+ href = mid( href, 1, section_start - 1 )
+ End If
+
+ sPath = ReadConfig("HelpPrefix") + href
+ if StarDesktop.CurrentComponent.URL = sPath then
+ print "Cant open currently open help file"
+ else
+ Dim FileProperties(1) As New com.sun.star.beans.PropertyValue
+ FileProperties(0).Name = "FilterName"
+ FileProperties(0).Value ="XHP_Help"
+ oDoc = StarDesktop.loadComponentFromURL(sPath, "_blank", 0, FileProperties())
+ ' would be good to add code here to jump to the link's section/variable reference location in the file
+ end if
+ Else
+ Print "Please select a <embed> or <link> tag."
+ End If
+ EndIf
+End Sub
+
Sub ReloadXHP
If not IsHelpFile Then
msgbox( strErr_NoHelpFile )
More information about the Libreoffice-commits
mailing list