merge the formfield patch from ooo-build
[ooovba.git] / wizards / source / launcher / DicOOo.xba
blob474494e718c998f4aa46a6f4a7db8b791afd6191
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
5 Sub StartDicOOo
7 Dim ThePath as string
8 Dim DefPath as string
9 Dim aService as object
10 Dim MyDicOOo as string
11 dim TheDoc as object
12 dim args(1) as new com.sun.star.beans.PropertyValue
14 on error resume next
16 &apos; Find path
17 aService = CreateUnoService(&quot;com.sun.star.util.PathSubstitution&quot;)
18 ThePath =ConvertToURL(aService.substituteVariables(&quot;$(user)&quot;, true))
19 ThePath=ThePath &amp; &quot;/wordbook&quot;
20 DefPath =ConvertToURL(aService.substituteVariables(&quot;$(prog)&quot;, true))
21 DefPath=DefPath &amp; &quot;/../share/dict/ooo&quot;
23 MyDicOOo=&quot;&quot;
25 if 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
30 else
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
42 endif
44 &apos;security
45 if Not fileExists(MyDicOOo) then
46 MyDicOOo= DefPath &amp; &quot;/DicOOo.sxw&quot;
47 endif
49 MyDicOOo=ConvertToURL(MyDicOOo)
51 &apos;Opens DicOOo main file
52 args(0).name=&quot;InteractionHandler&quot;
53 args(0).value=&quot;&quot;
54 args(1).name=&quot;MacroExecutionMode&quot;
55 args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN &apos;4
56 TheDoc=StarDesktop.loadComponentFromURL(MyDicOOo,&quot;_blank&quot;,0,args())
58 End Sub
59 </script:module>