[Libreoffice-commits] dev-tools.git: helpauthoring/Addons.xcu helpauthoring/HelpAuthoring

Yousuf Philips philipz85 at hotmail.com
Thu Sep 17 00:43:53 PDT 2015


 helpauthoring/Addons.xcu              |   14 ++++++
 helpauthoring/HelpAuthoring/_Main.xba |   69 +++++++++++++++++++++++++++++-----
 2 files changed, 73 insertions(+), 10 deletions(-)

New commits:
commit 1031396e89098d3aaf6039d3a619be016fa28d5d
Author: Yousuf Philips <philipz85 at hotmail.com>
Date:   Tue Sep 15 00:05:11 2015 +0400

    Compare changes in git apps and view help files in web view
    
    Change-Id: If26d02f480ac2e597c7e6213a58f564c0b95b482
    Reviewed-on: https://gerrit.libreoffice.org/18576
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/helpauthoring/Addons.xcu b/helpauthoring/Addons.xcu
index b696983..194c723 100644
--- a/helpauthoring/Addons.xcu
+++ b/helpauthoring/Addons.xcu
@@ -25,6 +25,9 @@
                     <value/>
                     <value xml:lang="en-US">Help Authoring</value>
                 </prop>
+                <prop oor:name="ontext" oor:type="xs:string">
+                    <value>com.sun.star.text.TextDocument,com.sun.star.sdb.OfficeDatabaseDocument,com.sun.star.script.BasicIDE</value>
+                </prop>
                 <node oor:name="Submenu">
                     <node oor:name="m00" oor:op="replace">
                         <prop oor:name="URL" oor:type="xs:string">
@@ -252,7 +255,7 @@
                         </prop>
                         <prop oor:name="Title" oor:type="xs:string">
                             <value/>
-                            <value xml:lang="en-US">Insert Extended Tip (<ahelp>/<avis>/<ahid>) </value>
+                            <value xml:lang="en-US">Insert Extended Tooltip (<ahelp>/<avis>/<ahid>) </value>
                         </prop>
                     </node>
                     <node oor:name="m33" oor:op="replace">
@@ -444,6 +447,15 @@
                             <value xml:lang="en-US">View File Source</value>
                         </prop>
                     </node>
+                    <node oor:name="m85" oor:op="replace">
+                        <prop oor:name="URL" oor:type="xs:string">
+                            <value>vnd.sun.star.script:HelpAuthoring._Main.OpenGitCompare?language=Basic&location=application</value>
+                        </prop>
+                        <prop oor:name="Title" oor:type="xs:string">
+                            <value/>
+                            <value xml:lang="en-US">Compare Changes [GIT]</value>
+                        </prop>
+                    </node>
 
                     <!-- Functions that maybe opened by the user only once -->
                     <node oor:name="m90" oor:op="replace">
diff --git a/helpauthoring/HelpAuthoring/_Main.xba b/helpauthoring/HelpAuthoring/_Main.xba
index c181ab1..98289d2 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -28,6 +28,10 @@ Global Const Version = "v3.1.1"
 
 Global Const strErr_NoHelpFile = "Not a Help File"
 
+Global Const GitClient = "git-gui"
+
+Global Const WebView = "false"
+
 '=======================================================
 ' Main
 '-------------------------------------------------------
@@ -74,6 +78,10 @@ Sub SetMetaDataOnSave(Path as String)
     document.DocumentProperties.Subject = Path
 
 	If document.DocumentProperties.Title = "" Then
+        if WebView = "true" then
+        	goKey( ".uno:BrowseView" )
+        end if
+
 		Ret = msgbox( "Automatically generate a basic help file?", 1+32, "Basic Help File" )
 		If Ret = 2 Then
 			Exit Sub
@@ -82,8 +90,8 @@ Sub SetMetaDataOnSave(Path as String)
 		document.DocumentProperties.UserDefinedProperties.ID = Replace( AlphaNum(Path), "xhp", "xml" )
 
 		title = inputbox("The help title is a few word description of the help file topic.","Enter Help Title")
-		If title = "" Then
-			title = "Help Title"
+		If title = "" Then
+			title = "Help Title"
 		End If
 		document.DocumentProperties.Title = title
 
@@ -96,8 +104,8 @@ Sub SetMetaDataOnSave(Path as String)
 		SetParaStyle("hlp_paragraph")
 		SetCharStyle("Default Style")
 		desc = inputbox("The help description is a sentence of text to further describe the help title."+chr(10)+"example: This menu contains commands for editing the contents of the current document.","Enter Help Description")
-		If desc = "" Then
-			desc = "Help description"
+		If desc = "" Then
+			desc = "Help description"
 		End If
 		InsertTag("AVIS_","<AVIS hid=""."">")
 		SetCharStyle("Default Style")
@@ -118,7 +126,7 @@ Sub SetMetaDataOnSave(Path as String)
 		goKey( ".uno:StartOfParaSel", 1, 1 )
 		goUp( 1, 1 )
 
-		InsertSection( lcase( AlphaNum(title) ) )
+		InsertSection( lcase( AlphaNum( Replace( title, " ", "_" ) ) ) )
 
 		sHID = inputbox("A help ID (hID) is a unique reference key to context-sensitive help when a user uses the F1 key or the Help button. There are two types: UNO commands and Symbolic names."+chr(10)+"examples: .uno:InsertCtrl, SID_FM_CONVERTTO_IMAGECONTROL","Enter Help ID (hID)",".uno:" )
 		if sHID <> "" and sHID <> ".uno:" then
@@ -280,6 +288,9 @@ 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())
+        if WebView = "true" then
+        	goKey( ".uno:BrowseView" )
+        end if
     End If
     oFileDialog.Dispose()
 End Sub
@@ -305,6 +316,43 @@ Sub OpenXHPText( optional doc_url as string )
 	End Select
 End Sub
 
+Sub OpenGitCompare
+	Dim oSvc as Object
+	document = StarDesktop.CurrentComponent
+	oSvc = createUnoService("com.sun.star.system.SystemShellExecute")
+
+	systemOS = getOS()
+
+	if systemOS = "UNIX" then
+		sDocRoot = convertfromurl( ReadConfig("HelpPrefix") )
+
+		if FileExists("/usr/bin/xfce4-terminal") then
+			Terminal = "xfce4-terminal"
+		elseif FileExists("/usr/bin/mate-terminal") then
+			Terminal = "mate-terminal"
+		end if
+
+		if FileExists("/usr/bin/git-cola") and ( GitClient = "" or GitClient = "git-cola" ) then
+			shell( Terminal + " --working-directory=" + sDocRoot + " -e git-cola", 0 )
+
+		elseif FileExists("/usr/bin/git") and ( GitClient = "" or GitClient = "git-gui" ) then
+			shell( "git -C " + sDocRoot + " gui", 0 )
+
+		elseif FileExists("/usr/bin/gitk") and ( GitClient = "" or GitClient = "gitk" ) then
+			shell( Terminal + " --working-directory=" +  sDocRoot + " -e gitk", 0 )
+
+		elseif FileExists("/usr/bin/gitg") and ( GitClient = "" or GitClient = "gitg" ) then
+			shell( "gitg " + sDocRoot, 0 )
+
+		elseif FileExists("/usr/bin/giggle") and ( GitClient = "" or GitClient = "giggle" ) then
+			shell( "giggle -d " + sDocRoot, 0 )
+
+		end if
+	else
+		msgbox "This feature is only available on Unix systems"
+	end if
+End Sub
+
 Sub OpenLink
     If not IsHelpFile Then
         msgbox( strErr_NoHelpFile )
@@ -313,7 +361,7 @@ Sub OpenLink
 
 	oVC = ThisComponent.CurrentController.getViewCursor
 	If oVC.isCollapsed Then
-	 	msgbox "Please select a <embed> or <link> tag."
+	 	msgbox "Please select a <embed>, <embedvar> or <link> tag."
 	 Else
 	 	link_start = instr(oVC.String,"<LINK")
 	 	embed_start = instr(oVC.String,"<EMBED")
@@ -340,12 +388,15 @@ Sub OpenLink
 				FileProperties(0).Name = "FilterName"
 		        FileProperties(0).Value ="XHP_Help"
 		        oDoc = StarDesktop.loadComponentFromURL(sPath, "_blank", 0, FileProperties())
+		        if WebView = "true" then
+		        	goKey( ".uno:BrowseView" )
+		        end if
 		        if section <> "" then
 		        	FindLink( oDoc, section )
 		        end if
 		     end if
 	 	Else
-	 		msgbox "Please select a <embed> or <link> tag."
+	 		msgbox "Please select a <embed>, <embedvar> or <link> tag."
 	 	End If 
 	EndIf
 End Sub
@@ -358,7 +409,7 @@ Sub OpenLinkSource
 
 	oVC = ThisComponent.CurrentController.getViewCursor
 	If oVC.isCollapsed Then
-	 	msgbox "Please select a <embed> or <link> tag."
+	 	msgbox "Please select a <embed>, <embedvar> or <link> tag."
 	 Else
 	 	link_start = instr(oVC.String,"<LINK")
 	 	embed_start = instr(oVC.String,"<EMBED")
@@ -384,7 +435,7 @@ Sub OpenLinkSource
 				OpenXHPText( sPath )
 		    end if
 	 	Else
-	 		msgbox "Please select a <embed> or <link> tag."
+	 		msgbox "Please select a <embed>, <embedvar> or <link> tag."
 	 	End If 
 	EndIf
 End Sub


More information about the Libreoffice-commits mailing list