xref: /aoo41x/main/wizards/source/launcher/DicOOo.xba (revision cdf0e10c)
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DicOOo" script:language="StarBasic">Option Explicit
4
5Sub StartDicOOo
6
7Dim ThePath as string
8Dim DefPath as string
9Dim aService as object
10Dim MyDicOOo as string
11dim TheDoc as object
12dim args(1) as new com.sun.star.beans.PropertyValue
13
14on error resume next
15
16&apos; Find path
17aService = CreateUnoService(&quot;com.sun.star.util.PathSubstitution&quot;)
18ThePath =ConvertToURL(aService.substituteVariables(&quot;$(user)&quot;, true))
19ThePath=ThePath &amp; &quot;/wordbook&quot;
20DefPath =ConvertToURL(aService.substituteVariables(&quot;$(prog)&quot;, true))
21DefPath=DefPath &amp; &quot;/../share/dict/ooo&quot;
22
23MyDicOOo=&quot;&quot;
24
25if  fileExists(ThePath &amp; &quot;/DicOOo.lst&quot;) then
26	&apos;read DicOOo.lst file in user directory
27        Open ThePath &amp; &quot;/DicOOo.lst&quot; for input as #1
28                line input #1, MyDicOOo
29        close #1
30else
31	if fileExists(DefPath &amp; &quot;/DicOOo.lst&quot;) then
32	&apos;read DicOOo.lst file in share directory
33	    Open DefPath &amp; &quot;/DicOOo.lst&quot; for input as #1
34                line input #1, MyDicOOo
35        close #1
36    else
37    	&apos;creates default file in user directory
38    	Open ThePath &amp; &quot;/DicOOo.lst&quot; for output as #1
39    		print #1,convertFromURL(DefPath &amp; &quot;/DicOOo.sxw&quot;)
40    	close #1
41    endif
42endif
43
44&apos;security
45if Not fileExists(MyDicOOo) then
46        MyDicOOo= DefPath &amp; &quot;/DicOOo.sxw&quot;
47endif
48
49MyDicOOo=ConvertToURL(MyDicOOo)
50
51&apos;Opens DicOOo main file
52args(0).name=&quot;InteractionHandler&quot;
53args(0).value=&quot;&quot;
54args(1).name=&quot;MacroExecutionMode&quot;
55args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN &apos;4
56TheDoc=StarDesktop.loadComponentFromURL(MyDicOOo,&quot;_blank&quot;,0,args())
57
58End Sub
59</script:module>
60