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