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