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' Find path 37aService = CreateUnoService("com.sun.star.util.PathSubstitution") 38ThePath =ConvertToURL(aService.substituteVariables("$(user)", true)) 39ThePath=ThePath & "/wordbook" 40DefPath =ConvertToURL(aService.substituteVariables("$(prog)", true)) 41DefPath=DefPath & "/../share/dict/ooo" 42 43MyDicOOo="" 44 45if fileExists(ThePath & "/DicOOo.lst") then 46 'read DicOOo.lst file in user directory 47 Open ThePath & "/DicOOo.lst" for input as #1 48 line input #1, MyDicOOo 49 close #1 50else 51 if fileExists(DefPath & "/DicOOo.lst") then 52 'read DicOOo.lst file in share directory 53 Open DefPath & "/DicOOo.lst" for input as #1 54 line input #1, MyDicOOo 55 close #1 56 else 57 'creates default file in user directory 58 Open ThePath & "/DicOOo.lst" for output as #1 59 print #1,convertFromURL(DefPath & "/DicOOo.sxw") 60 close #1 61 endif 62endif 63 64'security 65if Not fileExists(MyDicOOo) then 66 MyDicOOo= DefPath & "/DicOOo.sxw" 67endif 68 69MyDicOOo=ConvertToURL(MyDicOOo) 70 71'Opens DicOOo main file 72args(0).name="InteractionHandler" 73args(0).value="" 74args(1).name="MacroExecutionMode" 75args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN '4 76TheDoc=StarDesktop.loadComponentFromURL(MyDicOOo,"_blank",0,args()) 77 78End Sub 79</script:module> 80