helpauthoring/HelpAuthoring/Helpers.xba |   81 +++++++++++---------------------
 helpauthoring/HelpAuthoring/_Main.xba   |   62 ++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 52 deletions(-)

New commits:
commit faa1bf41bb02e21d22dc3082bd53b58aad243c5e
Author: Yousuf Philips <philip...@hotmail.com>
Date:   Thu Sep 10 03:59:50 2015 +0400

    Add wizard to creating new help file
    
    Change-Id: Id56b80da8311078787f17f16a1012580193b0ec0
    Reviewed-on: https://gerrit.libreoffice.org/18455
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>

diff --git a/helpauthoring/HelpAuthoring/Helpers.xba 
b/helpauthoring/HelpAuthoring/Helpers.xba
index 628578d..fdd56bf 100644
--- a/helpauthoring/HelpAuthoring/Helpers.xba
+++ b/helpauthoring/HelpAuthoring/Helpers.xba
@@ -229,11 +229,11 @@ Sub InsertField(Field as String, Content as String)
 End Sub
 
 &apos;=======================================================
-&apos; GoUp
+&apos; GoKey
 &apos;-------------------------------------------------------
-&apos; Simulates the CursorUp key
+&apos; Executes any uno command but targetting to keyboard keystrokes
 &apos;=======================================================
-Sub goUp(Count As Integer, Optional bSelect As Boolean)
+Sub goKey(Command as String, Optional Count As Integer, Optional bSelect As 
Boolean)
     dim document   as object
     dim dispatcher as object
 
@@ -250,7 +250,20 @@ Sub goUp(Count As Integer, Optional bSelect As Boolean)
         args(1).Value = bSelect
     End If
 
-    dispatcher.executeDispatch(document, &quot;.uno:GoUp&quot;, &quot;&quot;, 
0, args())
+    dispatcher.executeDispatch(document, Command, &quot;&quot;, 0, args())
+End Sub
+
+&apos;=======================================================
+&apos; GoUp
+&apos;-------------------------------------------------------
+&apos; Simulates the CursorUp key
+&apos;=======================================================
+Sub goUp(Count As Integer, Optional bSelect As Boolean)
+    If IsMissing(bSelect) Then
+               goKey( &quot;.uno:GoUp&quot;, Count )
+       Else
+               goKey( &quot;.uno:GoUp&quot;, Count, bSelect )
+       End if
 End Sub
 
 &apos;=======================================================
@@ -259,23 +272,11 @@ End Sub
 &apos; Simulates the CursorDown key
 &apos;=======================================================
 Sub goDown(Count As Integer, Optional bSelect As Boolean)
-    dim document   as object
-    dim dispatcher as object
-
-    document   = ThisComponent.CurrentController.Frame
-    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
-
-    dim args(1) as new com.sun.star.beans.PropertyValue
-    args(0).Name = &quot;Count&quot;
-    args(0).Value = Count
-    args(1).Name = &quot;Select&quot;
     If IsMissing(bSelect) Then
-        args(1).Value = false
-    Else
-        args(1).Value = bSelect
-    End If
-
-    dispatcher.executeDispatch(document, &quot;.uno:GoDown&quot;, 
&quot;&quot;, 0, args())
+               goKey( &quot;.uno:GoDown&quot;, Count )
+       Else
+               goKey( &quot;.uno:GoDown&quot;, Count, bSelect )
+       End if
 End Sub
 
 
@@ -285,23 +286,11 @@ End Sub
 &apos; Simulates the CursorRight key
 &apos;=======================================================
 Sub goRight(Count As Integer, Optional bSelect As Boolean)
-    dim document   as object
-    dim dispatcher as object
-
-    document   = ThisComponent.CurrentController.Frame
-    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
-
-    dim args(1) as new com.sun.star.beans.PropertyValue
-    args(0).Name = &quot;Count&quot;
-    args(0).Value = Count
-    args(1).Name = &quot;Select&quot;
     If IsMissing(bSelect) Then
-        args(1).Value = false
-    Else
-        args(1).Value = bSelect
-    End If
-
-    dispatcher.executeDispatch(document, &quot;.uno:GoRight&quot;, 
&quot;&quot;, 0, args())
+               goKey( &quot;.uno:GoRight&quot;, Count )
+       Else
+               goKey( &quot;.uno:GoRight&quot;, Count, bSelect )
+       End if
 End Sub
 
 &apos;=======================================================
@@ -310,23 +299,11 @@ End Sub
 &apos; Simulates the CursorLeft key
 &apos;=======================================================
 Sub goLeft(Count As Integer, optional bSelect As boolean)
-    dim document   as object
-    dim dispatcher as object
-
-    document   = ThisComponent.CurrentController.Frame
-    dispatcher = 
createUnoService(&quot;com.sun.star.frame.DispatchHelper&quot;)
-
-    dim args(1) as new com.sun.star.beans.PropertyValue
-    args(0).Name = &quot;Count&quot;
-    args(0).Value = Count
-    args(1).Name = &quot;Select&quot;
     If IsMissing(bSelect) Then
-        args(1).Value = false
-    Else
-        args(1).Value = bSelect
-    End If
-
-    dispatcher.executeDispatch(document, &quot;.uno:GoLeft&quot;, 
&quot;&quot;, 0, args())
+               goKey( &quot;.uno:GoLeft&quot;, Count )
+       Else
+               goKey( &quot;.uno:GoLeft&quot;, Count, bSelect )
+       End if
 End Sub
 
 &apos;=======================================================
diff --git a/helpauthoring/HelpAuthoring/_Main.xba 
b/helpauthoring/HelpAuthoring/_Main.xba
index 9746c02..ff3ab44 100644
--- a/helpauthoring/HelpAuthoring/_Main.xba
+++ b/helpauthoring/HelpAuthoring/_Main.xba
@@ -73,6 +73,68 @@ Sub SetMetaDataOnSave(Path as String)
 &apos;    document.DocumentInfo.SetUserFieldName(2,&quot;Comment&quot;)
     document.DocumentProperties.Subject = Path
 
+       If document.DocumentProperties.Title = &quot;&quot; Then
+               Ret = msgbox( &quot;Automatically generate a basic help 
file?&quot;, 1+32, &quot;Basic Help File&quot; )
+               If Ret = 0 Then
+                       Exit Sub
+               End if
+       
+               document.DocumentProperties.UserDefinedProperties.ID = Replace( 
AlphaNum(Path), &quot;xhp&quot;, &quot;xml&quot; )
+               document.DocumentProperties.UserDefinedProperties.Indexer = 
&quot;include&quot;
+
+               title = inputbox(&quot;The help title is a few word description 
of the help file topic.&quot;,&quot;Enter Help Title&quot;)
+               If title = "" Then
+                       title = "Help Title"
+               End If
+               document.DocumentProperties.Title = title
+
+               InsertText( title )
+        InsertTag(&quot;_LINK&quot;,&quot;&lt;/LINK&gt;&quot;)
+               InsertNewParaData()
+               InsertTag(&quot;LINK_&quot;,&quot;&lt;LINK 
href=&quot;&quot;&quot; + Right( Path, Len(Path) - 1 ) + 
&quot;&quot;&quot;&gt;&quot;)
+               CR()
+
+               SetParaStyle(&quot;hlp_paragraph&quot;)
+               SetCharStyle(&quot;Default Style&quot;)
+               desc = inputbox(&quot;The help description is a sentence of 
text to further describe the help title.&quot;+chr(10)+&quot;example: This menu 
contains commands for editing the contents of the current 
document.&quot;,&quot;Enter Help Description&quot;)
+               If desc = "" Then
+                       desc = "Help description"
+               End If
+               InsertText( desc )
+               InsertNewParaData()
+               CR()
+
+               SetParaStyle(&quot;hlp_paragraph&quot;)
+               SetCharStyle(&quot;Default Style&quot;)
+               startTyping = &quot;Start Typing Here...&quot;
+               InsertText( startTyping )
+
+               goKey( &quot;.uno:GoToStartOfLine&quot; )
+               goLeft(1)
+               
+               goKey( &quot;.uno:StartOfParaSel&quot;, 1, 1 )
+               goUp( 1, 1 )
+
+               InsertSection( lcase( AlphaNum(title) ) )
+
+               sHID = inputbox(&quot;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.&quot;+chr(10)+&quot;examples: 
.uno:InsertCtrl, SID_FM_CONVERTTO_IMAGECONTROL&quot;,&quot;Enter Help ID 
(hID)&quot;,&quot;.uno:&quot; )
+               if sHID &lt;&gt; &quot;&quot; and sHID &lt;&gt; 
&quot;.uno:&quot; then
+                       goKey( &quot;.uno:GoToPrevPara&quot; )
+                       goKey( &quot;.uno:GoToPrevPara&quot; )
+                       CR_before()
+                       goUp(1)
+                       SetParaStyle(&quot;hlp_aux_bookmark&quot;)
+                       SetCharStyle(&quot;hlp_aux_tag&quot;)
+                       InsertTag(&quot;BOOKMARK&quot;,&quot;&lt;BOOKMARK 
branch=&quot;&quot;hid/&quot; + sHID + &quot;&quot;&quot; 
id=&quot;&quot;bm_id&quot; + CreateID + &quot;&quot;&quot; 
localize=&quot;&quot;false&quot;&quot;/&gt;&quot;)
+               else
+                       goKey( &quot;.uno:GoToPrevPara&quot; )
+               end if
+
+               goKey( &quot;.uno:GoToEndOfDoc&quot; ) &apos; will stop at end 
of section instead of end of doc
+               goRight( 1 )
+               goRight( len(startTyping), 1 )
+       end if
+
 End Sub
 
 &apos;=======================================================
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to