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

Yousuf Philips philipz85 at hotmail.com
Thu Sep 17 01:03:04 PDT 2015


 helpauthoring/HelpAuthoring/Comment.xba       |    3 ++
 helpauthoring/HelpAuthoring/Embed.xba         |   27 ++++++++++++++++++--------
 helpauthoring/HelpAuthoring/Helpers.xba       |    8 +++----
 helpauthoring/HelpAuthoring/OtherElements.xba |    6 +++--
 4 files changed, 30 insertions(+), 14 deletions(-)

New commits:
commit 947978deaff85e19270d21ff09a76fbf33b69f2e
Author: Yousuf Philips <philipz85 at hotmail.com>
Date:   Tue Sep 15 00:07:11 2015 +0400

    Various fixes to functions so they preform better
    
    Change-Id: I8fddd3be3dbcfbbf9f1c8673d5de6932d413f600
    Reviewed-on: https://gerrit.libreoffice.org/18577
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/helpauthoring/HelpAuthoring/Comment.xba b/helpauthoring/HelpAuthoring/Comment.xba
index 3156357..52b428d 100644
--- a/helpauthoring/HelpAuthoring/Comment.xba
+++ b/helpauthoring/HelpAuthoring/Comment.xba
@@ -61,6 +61,9 @@ Sub Main
             InsertTag("COMMENT_","<COMMENT>")
             SetCharStyle("hlp_aux_comment")
             InsertTag("COMMENT",oTxtComment.Text)
+            goLeft( 1, 1 )
+            SetCharStyle("hlp_aux_comment")
+            goRight( 1 )
             InsertTag("_COMMENT","</COMMENT>")
         End If
     End If
diff --git a/helpauthoring/HelpAuthoring/Embed.xba b/helpauthoring/HelpAuthoring/Embed.xba
index 0f82833..8291232 100644
--- a/helpauthoring/HelpAuthoring/Embed.xba
+++ b/helpauthoring/HelpAuthoring/Embed.xba
@@ -182,6 +182,11 @@ Sub UpdateFileName
             oTxtHidFName.Text = ShortFName
         End If
 
+		DocRoot = GetDocumentRoot()
+		if FileExists( DocRoot + oTxtHidFName.Text ) then
+			oTxtHidFName.Text = DocRoot + oTxtHidFName.Text
+		end if
+
         oButBrowseIDs = oDialog.GetControl("butBrowseIDs")
         If not(FileExists(oTxtHidFName.Text)) Then
             msgbox oTxtHidFName.Text+" cannot be found.",48,"D'oh!"
@@ -242,11 +247,13 @@ Sub BrowseEmbed
                 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
+                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)+"..."
+	                If Len(arTmp(n) > 100) Then
+	                    arTmp(n) = Left(arTmp(n),100)+"..."
+	                End If
+	            else
+	                arTmp(n) = "[[Unable to get related text]]"
                 End If
                 sDim = ubound(arSecs())
                 arSecs(sDim) = sId+": "+arTmp(n)
@@ -261,10 +268,14 @@ Sub BrowseEmbed
                 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
+                if Instr(arTmp(n),"</variable>") > 0 then
+	                arTmp(n) = Left(arTmp(n),Instr(arTmp(n),"</variable>")-1)
+	                If Len(arTmp(n) > 100) Then
+	                    arTmp(n) = Left(arTmp(n),100)+"..."
+	                End If
+	            else
+	                arTmp(n) = "[[Unable to get related text]]"
+	            end if
                 sDim = ubound(arVars())
                 arVars(sDim) = sId+": "+arTmp(n)
                 sDim = ubound(arVars())+1
diff --git a/helpauthoring/HelpAuthoring/Helpers.xba b/helpauthoring/HelpAuthoring/Helpers.xba
index 25d533e..cece54b 100644
--- a/helpauthoring/HelpAuthoring/Helpers.xba
+++ b/helpauthoring/HelpAuthoring/Helpers.xba
@@ -409,10 +409,10 @@ end Sub
 '=======================================================
 Sub InsertNewParaData
 
-        If not IsHelpFile Then
-        msgbox(strErr_NoHelpFile)
-        Exit Sub
-    End If
+    'If not IsHelpFile Then
+    '    msgbox(strErr_NoHelpFile)
+    '    Exit Sub
+    'End If
 
     oSel = thiscomponent.getcurrentcontroller.getselection
     oCur = oSel(0).getText.createTextCursorByRange(oSel(0))
diff --git a/helpauthoring/HelpAuthoring/OtherElements.xba b/helpauthoring/HelpAuthoring/OtherElements.xba
index bae4f31..ab81d99 100644
--- a/helpauthoring/HelpAuthoring/OtherElements.xba
+++ b/helpauthoring/HelpAuthoring/OtherElements.xba
@@ -90,6 +90,8 @@ Sub InsertSwitchOSParagraph
 End Sub
 
 Sub InsertSwitchOSInline
+    InsertText( " " )
+    GoLeft( 1 )
 	InsertTag("SWITCHINLINE_","<SWITCHINLINE select=""sys"">","hlp_aux_switch")
 
 	InsertCaseInlineNow("WIN")
@@ -103,7 +105,6 @@ Sub InsertSwitchOSInline
 
     InsertTag("_SWITCHINLINE","</SWITCHINLINE>")
     SetCharStyle("Default Style")
-    InsertText( " " )
 End Sub
 
 Sub InsertSwitchAppParagraph
@@ -139,6 +140,8 @@ Sub InsertSwitchAppParagraph
 End Sub
 
 Sub InsertSwitchAppInline
+    InsertText( " " )
+    GoLeft( 1 )
 	InsertTag("SWITCHINLINE_","<SWITCHINLINE select=""appl"">","hlp_aux_switch")
 
 	InsertCaseInlineNow("WRITER")
@@ -156,7 +159,6 @@ Sub InsertSwitchAppInline
 
     InsertTag("_SWITCHINLINE","</SWITCHINLINE>")
     SetCharStyle("Default Style")
-    InsertText( " " )
 End Sub
 
 Sub InsertCaseNow(sType As String)


More information about the Libreoffice-commits mailing list