merge the formfield patch from ooo-build
[ooovba.git] / xmlhelp / source / com / sun / star / help / HelpIndexer.java
blob5fecf5abe66180a4b66efeb025ddea355fc669ba
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: HelpIndexer.java,v $
10 * $Revision: 1.21 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package com.sun.star.help;
33 import com.sun.star.lib.uno.helper.WeakBase;
34 import com.sun.star.lang.XServiceInfo;
35 import com.sun.star.script.XInvocation;
36 import com.sun.star.beans.XIntrospectionAccess;
37 import com.sun.star.uno.AnyConverter;
38 import com.sun.star.uno.XComponentContext;
40 import java.io.File;
41 import java.io.FileNotFoundException;
42 import java.io.IOException;
43 import java.util.Date;
44 import java.util.zip.ZipOutputStream;
46 public class HelpIndexer extends WeakBase
47 implements XServiceInfo, XInvocation
49 static private final String __serviceName =
50 "com.sun.star.help.HelpIndexer";
51 static private final String aCreateIndexMethodName = "createIndex";
53 static private com.sun.star.help.HelpIndexerTool helpindexer = new com.sun.star.help.HelpIndexerTool();
55 public HelpIndexer()
59 public HelpIndexer(XComponentContext xCompContext)
63 public static void mainImpl( String[] args, boolean bExtensionMode )
65 helpindexer.mainImpl( args , bExtensionMode );
68 public static void createZipFile( File aDirToZip, String aTargetZipFileStr )
69 throws FileNotFoundException, IOException
71 helpindexer.createZipFile( aDirToZip , aTargetZipFileStr );
74 public static void addToZipRecursively( ZipOutputStream zos, File aFile, String aBasePath )
75 throws FileNotFoundException, IOException
77 helpindexer.addToZipRecursively( zos , aFile , aBasePath );
80 static public boolean deleteRecursively( File aFile )
82 return helpindexer.deleteRecursively( aFile );
85 //===================================================
86 // XInvocation
87 public XIntrospectionAccess getIntrospection()
89 return null;
92 public Object invoke( String aFunctionName, java.lang.Object[] aParams,
93 short[][] aOutParamIndex, java.lang.Object[][] aOutParam )
94 throws com.sun.star.lang.IllegalArgumentException,
95 com.sun.star.script.CannotConvertException,
96 com.sun.star.reflection.InvocationTargetException
98 if(
99 !aFunctionName.equals( aCreateIndexMethodName ) )
100 throw new com.sun.star.lang.IllegalArgumentException();
102 aOutParamIndex[0] = new short[0];
103 aOutParam[0] = new Object[0];
105 int nParamCount = aParams.length;
106 String aStrs[] = new String[nParamCount];
107 for( int i = 0 ; i < nParamCount ; i++ )
111 aStrs[i] = AnyConverter.toString( aParams[i] );
113 catch( IllegalArgumentException e )
115 aStrs[i] = "";
119 boolean bExtensionMode = true;
120 mainImpl( aStrs, bExtensionMode );
122 return null;
125 public void setValue( String aPropertyName, java.lang.Object aValue )
126 throws com.sun.star.beans.UnknownPropertyException,
127 com.sun.star.script.CannotConvertException,
128 com.sun.star.reflection.InvocationTargetException
130 throw new com.sun.star.beans.UnknownPropertyException();
133 public Object getValue( String aPropertyName )
134 throws com.sun.star.beans.UnknownPropertyException
136 throw new com.sun.star.beans.UnknownPropertyException();
139 public boolean hasMethod( String aMethodName )
141 boolean bRet = (aMethodName.equals( aCreateIndexMethodName ) );
142 return bRet;
144 public boolean hasProperty( String aName ) {
145 return false;
150 /** This method returns an array of all supported service names.
151 * @return Array of supported service names.
153 public String[] getSupportedServiceNames()
155 return getServiceNames();
158 /** This method is a simple helper function to used in the
159 * static component initialisation functions as well as in
160 * getSupportedServiceNames.
162 public static String[] getServiceNames()
164 String[] sSupportedServiceNames = { __serviceName };
165 return sSupportedServiceNames;
169 /** This method returns true, if the given service will be
170 * supported by the component.
171 * @param sServiceName Service name.
172 * @return True, if the given service name will be supported.
174 public boolean supportsService( String sServiceName )
176 return sServiceName.equals( __serviceName );
180 /** Return the class name of the component.
181 * @return Class name of the component.
183 public String getImplementationName()
185 return HelpIndexer.class.getName();