1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DicOOo" script:language="StarBasic">Option Explicit
24
25Sub StartDicOOo
26
27Dim ThePath as string
28Dim DefPath as string
29Dim aService as object
30Dim MyDicOOo as string
31dim TheDoc as object
32dim args(1) as new com.sun.star.beans.PropertyValue
33
34on error resume next
35
36&apos; Find path
37aService = CreateUnoService(&quot;com.sun.star.util.PathSubstitution&quot;)
38ThePath =ConvertToURL(aService.substituteVariables(&quot;$(user)&quot;, true))
39ThePath=ThePath &amp; &quot;/wordbook&quot;
40DefPath =ConvertToURL(aService.substituteVariables(&quot;$(prog)&quot;, true))
41DefPath=DefPath &amp; &quot;/../share/dict/ooo&quot;
42
43MyDicOOo=&quot;&quot;
44
45if  fileExists(ThePath &amp; &quot;/DicOOo.lst&quot;) then
46	&apos;read DicOOo.lst file in user directory
47        Open ThePath &amp; &quot;/DicOOo.lst&quot; for input as #1
48                line input #1, MyDicOOo
49        close #1
50else
51	if fileExists(DefPath &amp; &quot;/DicOOo.lst&quot;) then
52	&apos;read DicOOo.lst file in share directory
53	    Open DefPath &amp; &quot;/DicOOo.lst&quot; for input as #1
54                line input #1, MyDicOOo
55        close #1
56    else
57    	&apos;creates default file in user directory
58    	Open ThePath &amp; &quot;/DicOOo.lst&quot; for output as #1
59    		print #1,convertFromURL(DefPath &amp; &quot;/DicOOo.sxw&quot;)
60    	close #1
61    endif
62endif
63
64&apos;security
65if Not fileExists(MyDicOOo) then
66        MyDicOOo= DefPath &amp; &quot;/DicOOo.sxw&quot;
67endif
68
69MyDicOOo=ConvertToURL(MyDicOOo)
70
71&apos;Opens DicOOo main file
72args(0).name=&quot;InteractionHandler&quot;
73args(0).value=&quot;&quot;
74args(1).name=&quot;MacroExecutionMode&quot;
75args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN &apos;4
76TheDoc=StarDesktop.loadComponentFromURL(MyDicOOo,&quot;_blank&quot;,0,args())
77
78End Sub
79</script:module>
80