diff --git a/scripting/java/manifest.mf b/scripting/java/manifest.mf deleted file mode 100644 index ba14e301b3eb..000000000000 --- a/scripting/java/manifest.mf +++ /dev/null @@ -1,26 +0,0 @@ -Manifest-Version: 1.0 -OpenIDE-Module: org.openoffice.netbeans.modules.office/1 -OpenIDE-Module-Name: Office Support -OpenIDE-Module-Short-Description: Scripting Support for Office Documents -OpenIDE-Module-Localizing-Bundle: org/openoffice/netbeans/modules/office/Bundle.properties -OpenIDE-Module-Specification-Version: 0.2 -OpenIDE-Module-Implementation-Version: 0.2 -OpenIDE-Module-Install: org/openoffice/netbeans/modules/office/utils/OfficeModule.class -OpenIDE-Module-Layer: org/openoffice/netbeans/modules/office/resources/layer.xml - -Name: org/openoffice/netbeans/modules/office/loader/OfficeDocumentDataLoader.class -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelDataLoader.class -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelDescriptorDataLoader.class -Install-Before: org.openide.loaders.XMLDataObject, org.netbeans.modules.xml.core.XMLDataObject -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelFolderDataLoader.class -Install-Before: org.openoffice.netbeans.modules.office.loader.ParcelDescriptorDataLoader -OpenIDE-Module-Class: Loader - -Name: org/openoffice/netbeans/modules/office/loader/ParcelContentsFolderDataLoader.class -OpenIDE-Module-Class: Loader diff --git a/scripting/java/org/openoffice/idesupport/CommandLineTools.java b/scripting/java/org/openoffice/idesupport/CommandLineTools.java deleted file mode 100644 index 85995cdfac42..000000000000 --- a/scripting/java/org/openoffice/idesupport/CommandLineTools.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.StringTokenizer; - -import com.sun.star.script.framework.container.ScriptEntry; -import com.sun.star.script.framework.container.ParcelDescriptor; - -import org.openoffice.idesupport.zip.ParcelZipper; -import org.openoffice.idesupport.filter.AllFilesFilter; -import com.sun.star.script.framework.container.XMLParserFactory; -import org.openoffice.idesupport.*; - -public class CommandLineTools { - private static final String PARCEL_XML_FILE = - ParcelZipper.PARCEL_DESCRIPTOR_XML; - - private static String officePath = null; - - public static void main(String[] args) { - CommandLineTools driver = new CommandLineTools(); - Command command = driver.parseArgs(args); - - // Get the URL for the Office DTD directory and pass it to the - // XMLParserFactory so that Office xml files can be parsed - if (officePath == null) { - try { - SVersionRCFile sv = SVersionRCFile.createInstance(); - - if (sv.getDefaultVersion() != null) { - officePath = sv.getDefaultVersion().getPath(); - } - } catch (IOException ioe) { - System.err.println("Error getting Office directory"); - } - } - - if (officePath == null) { - driver.fatalUsage("Error: Office Installation path not set"); - } - - File officeDir = new File(officePath); - - if (!officeDir.exists() || !officeDir.isDirectory()) { - driver.fatalUsage( - "Error: Office Installation path not valid: " + officePath); - } - - OfficeInstallation oi = new OfficeInstallation(officePath); - String url = oi.getURL("share/dtd/officedocument/1_0/"); - XMLParserFactory.setOfficeDTDURL(url); - - if (command == null) - driver.printUsage(); - else { - try { - command.execute(); - } catch (Exception e) { - driver.fatal("Error: " + e.getMessage()); - } - } - } - - private interface Command { - void execute() throws Exception; - } - - private void printUsage() { - System.out.println("java " + getClass().getName() + " -h " + - "prints this message"); - System.out.println("java " + getClass().getName() + - " [-o Path to Office Installation] " + - "-d - diff --git a/scripting/java/org/openoffice/netbeans/modules/office/resources/webLink.gif b/scripting/java/org/openoffice/netbeans/modules/office/resources/webLink.gif deleted file mode 100644 index ae40f9af595f..000000000000 Binary files a/scripting/java/org/openoffice/netbeans/modules/office/resources/webLink.gif and /dev/null differ diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/FrameworkJarChecker.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/FrameworkJarChecker.java deleted file mode 100644 index 9c6c33900383..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/utils/FrameworkJarChecker.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.utils; - -import java.io.File; -import java.io.IOException; -import java.beans.PropertyVetoException; - -import org.openide.filesystems.Repository; -import org.openide.filesystems.FileSystem; -import org.openide.filesystems.JarFileSystem; - -import org.openoffice.idesupport.SVersionRCFile; -import org.openoffice.netbeans.modules.office.options.OfficeSettings; - -public class FrameworkJarChecker { - - public static void mountDependencies() { - String unoilPath = SVersionRCFile.getPathForUnoil( - OfficeSettings.getDefault().getOfficeDirectory().getPath()); - - if (unoilPath == null) - return; - - File unoilFile = new File(unoilPath + File.separator + "unoil.jar"); - JarFileSystem jfs = new JarFileSystem(); - - try { - jfs.setJarFile(unoilFile); - } catch (IOException ioe) { - return; - } catch (PropertyVetoException pve) { - return; - } - - FileSystem result; - - try { - result = - Repository.getDefault().findFileSystem(jfs.getSystemName()); - } catch (Exception exp) { - result = null; - } finally { - jfs.removeNotify(); - } - - if (result == null) { - JarFileSystem newjfs = new JarFileSystem(); - - try { - newjfs.setJarFile(unoilFile); - } catch (IOException ioe) { - return; - } catch (PropertyVetoException pve) { - return; - } - - Repository.getDefault().addFileSystem(newjfs); - newjfs.setHidden(true); - } - } - - public static void unmountDependencies() { - String unoilPath = SVersionRCFile.getPathForUnoil( - OfficeSettings.getDefault().getOfficeDirectory().getPath()); - - if (unoilPath == null) - return; - - File unoilFile = new File(unoilPath + File.separator + "unoil.jar"); - JarFileSystem jfs = new JarFileSystem(); - - try { - jfs.setJarFile(unoilFile); - } catch (IOException ioe) { - return; - } catch (PropertyVetoException pve) { - return; - } - - FileSystem result; - - try { - result = - Repository.getDefault().findFileSystem(jfs.getSystemName()); - - if (result != null) - Repository.getDefault().removeFileSystem(result); - } catch (Exception exp) { - } - } - - private static void warnBeforeMount() { - OfficeSettings settings = OfficeSettings.getDefault(); - - if (!settings.getWarnBeforeMount()) - return; - - String message = "The Office Scripting Framework support jar file " + - "is not mounted, so Office scripts will not compile. NetBeans " + - "is going to mount this jar file automatically."; - - String prompt = "Show this message in future."; - - NagDialog warning = NagDialog.createInformationDialog( - message, prompt, true); - - if (!warning.getState()) { - settings.setWarnBeforeMount(false); - } - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/ManifestParser.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/ManifestParser.java deleted file mode 100644 index 67e6202c7789..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/utils/ManifestParser.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.utils; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.IOException; -import java.io.File; - -import org.w3c.dom.Document; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import org.openide.xml.XMLUtil; - -import com.sun.star.script.framework.container.XMLParser; -import org.openoffice.netbeans.modules.office.options.OfficeSettings; -import org.openoffice.idesupport.OfficeInstallation; - -public class ManifestParser implements XMLParser { - - private static ManifestParser parser = null; - - private ManifestParser() { - } - - public static synchronized ManifestParser getManifestParser() { - if (parser == null) { - parser = new ManifestParser(); - } - - return parser; - } - - public Document parse(InputStream inputStream) { - InputSource is; - Document result = null; - - try { - OfficeInstallation oi = OfficeSettings.getDefault().getOfficeDirectory(); - String id = oi.getURL("share/dtd/officedocument/1_0/"); - - is = new InputSource(inputStream); - is.setSystemId(id); - - result = XMLUtil.parse(is, false, false, null, null); - } catch (IOException ioe) { - System.out.println("IO Error parsing stream."); - return null; - } catch (SAXParseException spe) { - System.out.println("Sax Error parsing stream: " + spe.getMessage()); - System.out.println("\tPublicId: " + spe.getPublicId()); - System.out.println("\tSystemId: " + spe.getSystemId()); - return null; - } catch (SAXException se) { - System.out.println("Sax Error parsing stream: " + se.getMessage()); - return null; - } - - return result; - } - - public void write(Document doc, OutputStream out) throws IOException { - XMLUtil.write(doc, out, ""); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/NagDialog.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/NagDialog.java deleted file mode 100644 index f6f9ee148e0e..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/utils/NagDialog.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.utils; - -import java.awt.BorderLayout; -import java.awt.Dimension; - -import javax.swing.JPanel; -import javax.swing.JOptionPane; -import javax.swing.JCheckBox; -import javax.swing.border.EmptyBorder; - -import org.openide.TopManager; -import org.openide.NotifyDescriptor; - -public class NagDialog { - - private NotifyDescriptor descriptor; - private JPanel panel; - private JCheckBox checkbox; - - private NagDialog(String message, String prompt, boolean initialState, - int type) { - initUI(message, prompt, initialState, type); - } - - public static NagDialog createInformationDialog( - String message, String prompt, boolean initialState) { - NagDialog result = new NagDialog( - message, prompt, initialState, JOptionPane.INFORMATION_MESSAGE); - - result.setDescriptor(new NotifyDescriptor.Message(result.getPanel(), - NotifyDescriptor.PLAIN_MESSAGE)); - - return result; - } - - public static NagDialog createConfirmationDialog( - String message, String prompt, boolean initialState) { - NagDialog result = new NagDialog( - message, prompt, initialState, JOptionPane.QUESTION_MESSAGE); - - result.setDescriptor(new NotifyDescriptor.Confirmation( - result.getPanel(), NotifyDescriptor.OK_CANCEL_OPTION, - NotifyDescriptor.PLAIN_MESSAGE)); - - return result; - } - - public boolean show() { - TopManager.getDefault().notify(descriptor); - - return (descriptor.getValue() == NotifyDescriptor.OK_OPTION); - } - - public boolean getState() { - return checkbox.isSelected(); - } - - private JPanel getPanel() { - return this.panel; - } - - private void setDescriptor(NotifyDescriptor descriptor) { - this.descriptor = descriptor; - } - - private void initUI(String message, String prompt, boolean initialState, - int type) { - - this.panel = new JPanel(); - JOptionPane optionPane = new JOptionPane(message, type, 0, null, - new Object[0], null) { - public int getMaxCharactersPerLineCount() { - return 100; - } - }; - optionPane.setUI(new javax.swing.plaf.basic.BasicOptionPaneUI() { - public Dimension getMinimumOptionPaneSize() { - if (minimumSize == null) { - return new Dimension(MinimumWidth, 50); - } - - return new Dimension(minimumSize.width, 50); - } - }); - optionPane.setWantsInput(false); - - JPanel checkPanel = new JPanel(); - checkbox = new JCheckBox(prompt, initialState); - checkPanel.setLayout(new BorderLayout()); - checkPanel.setBorder(new EmptyBorder(0, 20, 0, 0)); - checkPanel.add(checkbox, BorderLayout.WEST); - - this.panel.setLayout(new BorderLayout()); - this.panel.add(optionPane, BorderLayout.CENTER); - this.panel.add(checkPanel, BorderLayout.SOUTH); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/OfficeModule.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/OfficeModule.java deleted file mode 100644 index a4d917e2552b..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/utils/OfficeModule.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.utils; - -import org.openide.TopManager; -import org.openide.WizardDescriptor; -import org.openide.NotifyDescriptor; -import org.openide.modules.ModuleInstall; - -import com.sun.star.script.framework.container.XMLParserFactory; -import org.openoffice.idesupport.OfficeInstallation; -import org.openoffice.netbeans.modules.office.wizard.InstallationPathDescriptor; -import org.openoffice.netbeans.modules.office.options.OfficeSettings; - -public class OfficeModule extends ModuleInstall { - - private static final long serialVersionUID = -8499324854301243852L; - - public void installed() { - WizardDescriptor wiz = new InstallationPathDescriptor(); - TopManager.getDefault().createDialog(wiz).show(); - - if (wiz.getValue() == NotifyDescriptor.OK_OPTION) { - OfficeInstallation oi = (OfficeInstallation) - wiz.getProperty(InstallationPathDescriptor.PROP_INSTALLPATH); - - OfficeSettings settings = OfficeSettings.getDefault(); - settings.setOfficeDirectory(oi); - } - - FrameworkJarChecker.mountDependencies(); - XMLParserFactory.setParser(ManifestParser.getManifestParser()); - } - - public void restored() { - FrameworkJarChecker.mountDependencies(); - XMLParserFactory.setParser(ManifestParser.getManifestParser()); - } - - public boolean closing() { - FrameworkJarChecker.unmountDependencies(); - return true; - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java deleted file mode 100644 index f79368f6f495..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/utils/PackageRemover.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.utils; - -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.IOException; - -import org.openoffice.idesupport.zip.ParcelZipper; - -public class PackageRemover { - private PackageRemover() { - } - - public static void removeDeclaration(File source) throws IOException { - File tmp = new File(source.getAbsolutePath() + ".tmp"); - - BufferedReader in = new BufferedReader(new FileReader(source)); - BufferedWriter out = new BufferedWriter(new FileWriter(tmp)); - - try { - String line; - - while ((line = in.readLine()) != null) { - if (line.startsWith("package")) { - String newDeclaration = evaluate(line); - - if (newDeclaration != null) { - out.write(newDeclaration, 0, newDeclaration.length()); - out.newLine(); - } - } else { - out.write(line, 0, line.length()); - out.newLine(); - } - } - } finally { - if (in != null) { - in.close(); - } - - if (out != null) { - out.close(); - } - } - - if (!source.delete()) { - tmp.delete(); - throw new IOException("Could not overwrite " + source); - } else { - tmp.renameTo(source); - } - } - - public static String evaluate(String line) { - - int idx = line.indexOf(ParcelZipper.CONTENTS_DIRNAME); - - if (idx == -1) - return line; - - idx = idx + ParcelZipper.CONTENTS_DIRNAME.length(); - - if (line.charAt(idx) == '.') - return "package " + line.substring(idx + 1);; - - return null; - } - - public static void main(String[] args) { - File source = new File(args[0]); - - try { - removeDeclaration(source); - } catch (IOException ioe) { - ioe.printStackTrace(); - } - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java deleted file mode 100644 index 4163ea1ea99f..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.utils; - -import java.io.*; -import java.util.zip.*; -import java.beans.PropertyVetoException; - -import org.openide.filesystems.FileSystem; -import org.openide.filesystems.Repository; - -import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem; - -public class ZipMounter { - private static ZipMounter mounter = null; - - private ZipMounter() { - } - - public static synchronized ZipMounter getZipMounter() { - if (mounter == null) - mounter = new ZipMounter(); - - return mounter; - } - - public void mountZipFile(File zipfile) - throws IOException, PropertyVetoException { - if (zipfile != null) { - addDocumentToRepository(zipfile, true); - } - } - - private FileSystem addDocumentToRepository(File rootFile, boolean writeable) - throws IOException, PropertyVetoException { - Repository repo = Repository.getDefault(); - OpenOfficeDocFileSystem oofs; - oofs = (OpenOfficeDocFileSystem)getMountedDocument(rootFile); - - if (oofs != null) - repo.removeFileSystem(oofs); - - oofs = new OpenOfficeDocFileSystem(); - oofs.setDocument(rootFile); - repo.addFileSystem(oofs); - return oofs; - } - - /** @return FileSystem which has given jar file as its root or - * null if no such file system could be found in repository */ - private FileSystem getMountedDocument(File rootFile) { - if (rootFile == null) - return null; - - FileSystem oofs = null; - - try { - oofs = Repository.getDefault().findFileSystem( - OpenOfficeDocFileSystem.computeSystemName(rootFile)); - } catch (Exception exp) { - } - - return oofs; - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties deleted file mode 100644 index 7474954ee059..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle.properties +++ /dev/null @@ -1,44 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# -# Window System API -# x-no-translate - -# TopComponent -LBL_component_name= -#LBL_mode_name= -#LBL_workspace_name= - -# WizardDescriptor -# Dialog title: -TITLE_wizard=Select Path to OpenOffice.org Installation - -# WizardDescriptor.Iterator -# Label the sequence #. Appears at top of pane: -# e.g. "Panel Name (1 of 3)" -TITLE_x_of_y={0} of {1} -# Provide list of steps to show in left pane: -#LBL_step_1=Select First Thing -#LBL_step_2=Configure Details - -# WizardDescriptor.Panel -# Will appear in dialog title; see above -TITLE_ParcelPropertiesVisualPanel=Parcel Recipe Properties -TITLE_SelectPathVisualPanel=Path to OpenOffice.org - -# CallableSystemAction -LBL_Action=Run Action diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle_en_US.properties b/scripting/java/org/openoffice/netbeans/modules/office/wizard/Bundle_en_US.properties deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java deleted file mode 100644 index f75873dade3f..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathDescriptor.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.net.URL; -import java.net.MalformedURLException; - -import org.openide.TopManager; -import org.openide.WizardDescriptor; -import org.openide.util.NbBundle; - -/** A wizard descriptor. - */ -public class InstallationPathDescriptor extends WizardDescriptor { - - private final InstallationPathIterator iterator; - public static final String PROP_INSTALLPATH = "INSTALLPATH"; - - /** Make a descriptor suited to use InstallationPathIterator. - * Sets up various wizard properties to follow recommended - * style guidelines. - */ - public InstallationPathDescriptor() { - this(new InstallationPathIterator()); - } - private InstallationPathDescriptor(InstallationPathIterator iterator) { - super(iterator); - this.iterator = iterator; - // Set title for the dialog: - setTitle(NbBundle.getMessage(InstallationPathDescriptor.class, "TITLE_wizard")); - // Make the left pane appear: - putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N - // Make the left pane show list of steps etc.: - putProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N - } - - // Called when user moves forward or backward etc.: - protected void updateState() { - super.updateState(); - putProperty("WizardPanel_contentData", iterator.getSteps()); // NOI18N - putProperty("WizardPanel_contentSelectedIndex", - Integer.valueOf(iterator.getIndex())); // NOI18N - } - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathIterator.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathIterator.java deleted file mode 100644 index fafd40165978..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/InstallationPathIterator.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.HashSet; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Set; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.openide.WizardDescriptor; -import org.openide.util.NbBundle; - -/** A wizard iterator (sequence of panels). - * Used to create a wizard. Create one or more - * panels from template as needed too. - */ -public class InstallationPathIterator implements WizardDescriptor.Iterator { - - // You should define what panels you want to use here: - - protected WizardDescriptor.Panel[] createPanels() { - return new WizardDescriptor.Panel[] { - new SelectPathPanel() - }; - } - - // And the list of step names: - - protected String[] createSteps() { - return new String[] { - "Select OpenOffice.org Installation" - }; - } - - // --- The rest probably does not need to be touched. --- - - // Keep track of the panels and selected panel: - - private transient int index = 0; - // Also package-accessible to descriptor: - protected final int getIndex() { - return index; - } - private transient WizardDescriptor.Panel[] panels = null; - protected final WizardDescriptor.Panel[] getPanels() { - if (panels == null) { - panels = createPanels(); - } - - return panels; - } - - // Also the list of steps in the left pane: - - private transient String[] steps = null; - // Also package-accessible to descriptor: - protected final String[] getSteps() { - if (steps == null) { - steps = createSteps(); - } - - return steps; - } - - // --- WizardDescriptor.Iterator METHODS: --- - // Note that this is very similar to WizardDescriptor.Iterator, but with a - // few more options for customization. If you e.g. want to make panels appear - // or disappear dynamically, go ahead. - - public String name() { - return NbBundle.getMessage(InstallationPathIterator.class, "TITLE_x_of_y", - Integer.valueOf(index + 1), Integer.valueOf(getPanels().length)); - } - - public boolean hasNext() { - return index < getPanels().length - 1; - } - public boolean hasPrevious() { - return index > 0; - } - public void nextPanel() { - if (!hasNext()) throw new NoSuchElementException(); - - index++; - } - public void previousPanel() { - if (!hasPrevious()) throw new NoSuchElementException(); - - index--; - } - public WizardDescriptor.Panel current() { - return getPanels()[index]; - } - - // If nothing unusual changes in the middle of the wizard, simply: - public final void addChangeListener(ChangeListener l) {} - public final void removeChangeListener(ChangeListener l) {} - // If something changes dynamically (besides moving between panels), - // e.g. the number of panels changes in response to user input, then - // uncomment the following and call when needed: - // fireChangeEvent(); - /* - private transient Set listeners = new HashSet(1); // Set - public final void addChangeListener(ChangeListener l) { - synchronized (listeners) { - listeners.add(l); - } - } - public final void removeChangeListener(ChangeListener l) { - synchronized (listeners) { - listeners.remove(l); - } - } - protected final void fireChangeEvent() { - Iterator it; - synchronized (listeners) { - it = new HashSet(listeners).iterator(); - } - ChangeEvent ev = new ChangeEvent(this); - while (it.hasNext()) { - ((ChangeListener)it.next()).stateChanged(ev); - } - } - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - in.defaultReadObject(); - listeners = new HashSet(1); - } - */ - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java deleted file mode 100644 index dd602ce1131d..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/JavaScriptIterator.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.awt.Component; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Set; -import javax.swing.JComponent; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.openide.ErrorManager; -import org.openide.TopManager; -import org.openide.NotifyDescriptor; -import org.openide.WizardDescriptor; -import org.openide.cookies.OpenCookie; -import org.openide.cookies.SourceCookie; -import org.openide.loaders.*; -import org.openide.util.NbBundle; -import org.openide.filesystems.*; - -import org.openoffice.idesupport.zip.ParcelZipper; -import org.openoffice.netbeans.modules.office.loader.ParcelFolder; -import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem; -import org.openoffice.netbeans.modules.office.utils.PackageRemover; - -/** A template wizard iterator (sequence of panels). - * Used to fill in the second and subsequent panels in the New wizard. - * Associate this to a template inside a layer using the - * Sequence of Panels extra property. - * Create one or more panels from template as needed too. - */ -public class JavaScriptIterator implements TemplateWizard.Iterator { - - - // You should define what panels you want to use here: - - protected WizardDescriptor.Panel[] createPanels() { - return new WizardDescriptor.Panel[] { - // keep the default 2nd panel: - wiz.targetChooser(), - }; - } - - // And the list of step names: - - protected String[] createSteps() { - return new String[] { - null, - }; - } - - private DataFolder checkTarget(DataFolder folder) { - FileObject fo = folder.getPrimaryFile(); - - try { - FileSystem fs = fo.getFileSystem(); - - if (fs instanceof OpenOfficeDocFileSystem && fo.isRoot()) { - FileObject scripts = - fo.getFileObject(OpenOfficeDocFileSystem.SCRIPTS_ROOT); - - if (scripts == null) - scripts = - fo.createFolder(OpenOfficeDocFileSystem.SCRIPTS_ROOT); - - FileObject javafolder = scripts.getFileObject("java"); - - if (javafolder == null) - javafolder = scripts.createFolder("java"); - - DataFolder subfolder = new DataFolder(javafolder); - return subfolder; - } - } catch (IOException ioe) { - /* do nothing, we will just return the folder we were passed in */ - } - - return folder; - } - - public Set instantiate(TemplateWizard wiz) throws IOException { - String name = wiz.getTargetName(); - DataFolder targetFolder = wiz.getTargetFolder(); - targetFolder = checkTarget(targetFolder); - - DataObject template = wiz.getTemplate(); - DataObject result; - - if (name == null) { - // Default name. - result = template.createFromTemplate(targetFolder); - } else { - result = template.createFromTemplate(targetFolder, name); - } - - FileObject tmp = result.getPrimaryFile(); - - if (tmp.getExt().equals("java")) { - try { - PackageRemover.removeDeclaration(FileUtil.toFile(tmp)); - - // IssueZilla 11986 - rename the FileObject - // so the JavaNode is resynchronized - tmp.rename(tmp.lock(), tmp.getName(), tmp.getExt()); - } catch (IOException ioe) { - NotifyDescriptor d = new NotifyDescriptor.Message( - "Error removing package declaration from file: " + - tmp.getNameExt() + - ". You should manually remove this declaration " + - "before building the Parcel Recipe"); - TopManager.getDefault().notify(d); - } - } - - return Collections.singleton(result); - } - - // --- The rest probably does not need to be touched. --- - - private transient int index; - private transient WizardDescriptor.Panel[] panels; - private transient TemplateWizard wiz; - - // You can keep a reference to the TemplateWizard which can - // provide various kinds of useful information such as - // the currently selected target name. - // Also the panels will receive wiz as their "settings" object. - public void initialize(TemplateWizard wiz) { - this.wiz = wiz; - index = 0; - panels = createPanels(); - // Make sure list of steps is accurate. - String[] steps = createSteps(); - - for (int i = 0; i < panels.length; i++) { - Component c = panels[i].getComponent(); - - if (steps[i] == null) { - // Default step name to component name of panel. - // Mainly useful for getting the name of the target - // chooser to appear in the list of steps. - steps[i] = c.getName(); - } - - if (c instanceof JComponent) { // assume Swing components - JComponent jc = (JComponent)c; - // Step #. - jc.putClientProperty("WizardPanel_contentSelectedIndex", - Integer.valueOf(i)); // NOI18N - // Step name (actually the whole list for reference). - jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N - } - } - } - public void uninitialize(TemplateWizard wiz) { - this.wiz = null; - panels = null; - } - - // --- WizardDescriptor.Iterator METHODS: --- - // Note that this is very similar to WizardDescriptor.Iterator, but with a - // few more options for customization. If you e.g. want to make panels appear - // or disappear dynamically, go ahead. - - public String name() { - return ""; - } - - public boolean hasNext() { - return index < panels.length - 1; - } - public boolean hasPrevious() { - return index > 0; - } - public void nextPanel() { - if (!hasNext()) throw new NoSuchElementException(); - - index++; - } - public void previousPanel() { - if (!hasPrevious()) throw new NoSuchElementException(); - - index--; - } - public WizardDescriptor.Panel current() { - return panels[index]; - } - - // If nothing unusual changes in the middle of the wizard, simply: - public final void addChangeListener(ChangeListener l) {} - public final void removeChangeListener(ChangeListener l) {} - // If something changes dynamically (besides moving between panels), - // e.g. the number of panels changes in response to user input, then - // uncomment the following and call when needed: - // fireChangeEvent(); - /* - private transient Set listeners = new HashSet(1); // Set - public final void addChangeListener(ChangeListener l) { - synchronized(listeners) { - listeners.add(l); - } - } - public final void removeChangeListener(ChangeListener l) { - synchronized(listeners) { - listeners.remove(l); - } - } - protected final void fireChangeEvent() { - Iterator it; - synchronized (listeners) { - it = new HashSet(listeners).iterator(); - } - ChangeEvent ev = new ChangeEvent(this); - while (it.hasNext()) { - ((ChangeListener)it.next()).stateChanged(ev); - } - } - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - in.defaultReadObject(); - listeners = new HashSet(1); - } - */ - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java deleted file mode 100644 index 4135724d2010..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelContentsIterator.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.awt.Component; -import java.io.File; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Set; -import javax.swing.JComponent; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.openide.TopManager; -import org.openide.NotifyDescriptor; -import org.openide.WizardDescriptor; -import org.openide.cookies.OpenCookie; -import org.openide.cookies.SourceCookie; -import org.openide.loaders.*; -import org.openide.util.NbBundle; -import org.openide.filesystems.*; - -import com.sun.star.script.framework.container.ParcelDescriptor; -import org.openoffice.idesupport.zip.ParcelZipper; -import org.openoffice.netbeans.modules.office.loader.ParcelFolder; -import org.openoffice.netbeans.modules.office.loader.ParcelContentsFolder; -import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem; - -/** A template wizard iterator (sequence of panels). - * Used to fill in the second and subsequent panels in the New wizard. - * Associate this to a template inside a layer using the - * Sequence of Panels extra property. - * Create one or more panels from template as needed too. - */ -public class ParcelContentsIterator implements TemplateWizard.Iterator { - - - // You should define what panels you want to use here: - - public static final String PROP_LANGUAGE = - ParcelFolder.LANGUAGE_ATTRIBUTE; - - protected WizardDescriptor.Panel[] createPanels() { - return new WizardDescriptor.Panel[] { - new ParcelPropertiesPanel(), - }; - } - - // And the list of step names: - - protected String[] createSteps() { - return new String[] { - // null, - "Parcel Properties", - }; - } - - private DataFolder checkTarget(DataFolder folder) { - FileObject fo = folder.getPrimaryFile(); - - try { - FileSystem fs = fo.getFileSystem(); - - if (fs instanceof OpenOfficeDocFileSystem && fo.isRoot()) { - FileObject scripts = - fo.getFileObject(OpenOfficeDocFileSystem.SCRIPTS_ROOT); - - if (scripts == null) - scripts = - fo.createFolder(OpenOfficeDocFileSystem.SCRIPTS_ROOT); - - FileObject javafolder = scripts.getFileObject("java"); - - if (javafolder == null) - javafolder = scripts.createFolder("java"); - - DataFolder subfolder = new DataFolder(javafolder); - return subfolder; - } - } catch (IOException ioe) { - /* do nothing, we will just return the folder we were passed in */ - } - - return folder; - } - - public Set instantiate(TemplateWizard wiz) throws IOException { - String name = wiz.getTargetName(); - DataFolder targetFolder = wiz.getTargetFolder(); - targetFolder = checkTarget(targetFolder); - - String language = (String)wiz.getProperty(PROP_LANGUAGE); - - DataObject template = wiz.getTemplate(); - DataObject result; - - if (name == null) { - // Default name. - result = template.createFromTemplate(targetFolder); - } else { - result = template.createFromTemplate(targetFolder, name); - } - - FileObject recipe = result.getPrimaryFile(); - - FileObject contents = - recipe.getFileObject(ParcelZipper.CONTENTS_DIRNAME); - - if (contents != null) { - File f = FileUtil.toFile(contents); - ParcelDescriptor pd = ParcelDescriptor.createParcelDescriptor(f); - pd.setLanguage(language); - pd.write(); - - DataFolder parent = DataFolder.findFolder(contents); - ParcelContentsFolder.createEmptyScript(parent, language); - } - - return Collections.singleton(result); - } - - // --- The rest probably does not need to be touched. --- - - private transient int index; - private transient WizardDescriptor.Panel[] panels; - private transient TemplateWizard wiz; - - // You can keep a reference to the TemplateWizard which can - // provide various kinds of useful information such as - // the currently selected target name. - // Also the panels will receive wiz as their "settings" object. - public void initialize(TemplateWizard wiz) { - this.wiz = wiz; - index = 0; - panels = createPanels(); - // Make sure list of steps is accurate. - String[] steps = createSteps(); - - for (int i = 0; i < panels.length; i++) { - Component c = panels[i].getComponent(); - - if (steps[i] == null) { - // Default step name to component name of panel. - // Mainly useful for getting the name of the target - // chooser to appear in the list of steps. - steps[i] = c.getName(); - } - - if (c instanceof JComponent) { // assume Swing components - JComponent jc = (JComponent)c; - // Step #. - jc.putClientProperty("WizardPanel_contentSelectedIndex", - Integer.valueOf(i)); // NOI18N - // Step name (actually the whole list for reference). - jc.putClientProperty("WizardPanel_contentData", steps); // NOI18N - } - } - } - public void uninitialize(TemplateWizard wiz) { - this.wiz = null; - panels = null; - } - - // --- WizardDescriptor.Iterator METHODS: --- - // Note that this is very similar to WizardDescriptor.Iterator, but with a - // few more options for customization. If you e.g. want to make panels appear - // or disappear dynamically, go ahead. - - public String name() { - return ""; - } - - public boolean hasNext() { - return index < panels.length - 1; - } - public boolean hasPrevious() { - return index > 0; - } - public void nextPanel() { - if (!hasNext()) throw new NoSuchElementException(); - - index++; - } - public void previousPanel() { - if (!hasPrevious()) throw new NoSuchElementException(); - - index--; - } - public WizardDescriptor.Panel current() { - return panels[index]; - } - - // If nothing unusual changes in the middle of the wizard, simply: - public final void addChangeListener(ChangeListener l) {} - public final void removeChangeListener(ChangeListener l) {} - // If something changes dynamically (besides moving between panels), - // e.g. the number of panels changes in response to user input, then - // uncomment the following and call when needed: - // fireChangeEvent(); - /* - private transient Set listeners = new HashSet(1); // Set - public final void addChangeListener(ChangeListener l) { - synchronized(listeners) { - listeners.add(l); - } - } - public final void removeChangeListener(ChangeListener l) { - synchronized(listeners) { - listeners.remove(l); - } - } - protected final void fireChangeEvent() { - Iterator it; - synchronized (listeners) { - it = new HashSet(listeners).iterator(); - } - ChangeEvent ev = new ChangeEvent(this); - while (it.hasNext()) { - ((ChangeListener)it.next()).stateChanged(ev); - } - } - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - in.defaultReadObject(); - listeners = new HashSet(1); - } - */ - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java deleted file mode 100644 index aaf3abd5a186..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesPanel.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.awt.Component; -import java.net.URL; -import java.net.MalformedURLException; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.openide.WizardDescriptor; -import org.openide.loaders.TemplateWizard; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; - -/** A single panel descriptor for a wizard. - * You probably want to make a wizard iterator to hold it. - */ -public class ParcelPropertiesPanel implements WizardDescriptor.FinishPanel { - - /** The visual component that displays this panel. - * If you need to access the component from this class, - * just use getComponent(). - */ - private ParcelPropertiesVisualPanel component; - - // Get the visual component for the panel. In this template, the component - // is kept separate. This can be more efficient: if the wizard is created - // but never displayed, or not all panels are displayed, it is better to - // create only those which really need to be visible. - public Component getComponent() { - if (component == null) { - component = new ParcelPropertiesVisualPanel(this); - } - - return component; - } - - public HelpCtx getHelp() { - // Show no Help button for this panel: - return HelpCtx.DEFAULT_HELP; - // If you have context help: - // return new HelpCtx(ParcelPropertiesPanel.class); - } - - public boolean isValid() { - // If it is always OK to press Next or Finish, then: - return true; - // If it depends on some condition (form filled out...), then: - // return someCondition(); - // and when this condition changes (last form field filled in...) then: - // fireChangeEvent(); - // and uncomment the complicated stuff below. - } - - public final void addChangeListener(ChangeListener l) {} - public final void removeChangeListener(ChangeListener l) {} - /* - private final Set listeners = new HashSet(1); // Set - public final void addChangeListener(ChangeListener l) { - synchronized (listeners) { - listeners.add(l); - } - } - public final void removeChangeListener(ChangeListener l) { - synchronized (listeners) { - listeners.remove(l); - } - } - protected final void fireChangeEvent() { - Iterator it; - synchronized (listeners) { - it = new HashSet(listeners).iterator(); - } - ChangeEvent ev = new ChangeEvent(this); - while (it.hasNext()) { - ((ChangeListener)it.next()).stateChanged(ev); - } - } - */ - - public void setName(String name) { - this.name = name; - } - - public void setLanguage(String language) { - this.language = language; - } - - private String language = "Java"; - private String name = null; - - // You can use a settings object to keep track of state. - // Normally the settings object will be the WizardDescriptor, - // so you can use WizardDescriptor.getProperty & putProperty - // to store information entered by the user. - public void readSettings(Object settings) { - } - - public void storeSettings(Object settings) { - TemplateWizard wiz = (TemplateWizard)settings; - wiz.setTargetName(name); - wiz.putProperty(ParcelContentsIterator.PROP_LANGUAGE, language); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form deleted file mode 100644 index 5c22ca6f2fe4..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.form +++ /dev/null @@ -1,90 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java deleted file mode 100644 index bf10d713e4c7..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/ParcelPropertiesVisualPanel.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import org.openide.util.NbBundle; - -/** A single panel for a wizard - the GUI portion. - */ -public class ParcelPropertiesVisualPanel extends javax.swing.JPanel { - - /** The wizard panel descriptor associated with this GUI panel. - * If you need to fire state changes or something similar, you can - * use this handle to do so. - */ - private final ParcelPropertiesPanel panel; - - /** Create the wizard panel and set up some basic properties. */ - public ParcelPropertiesVisualPanel(ParcelPropertiesPanel panel) { - this.panel = panel; - initComponents(); - - languagesComboBox.addItem("Java"); - languagesComboBox.addItem("BeanShell"); - - // Provide a name in the title bar. - setName(NbBundle.getMessage(ParcelPropertiesVisualPanel.class, - "TITLE_ParcelPropertiesVisualPanel")); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - java.awt.GridBagConstraints gridBagConstraints; - - jLabel1 = new javax.swing.JLabel(); - recipeName = new javax.swing.JTextField(); - jLabel2 = new javax.swing.JLabel(); - languagesComboBox = new javax.swing.JComboBox(); - jPanel1 = new javax.swing.JPanel(); - - setLayout(new java.awt.GridBagLayout()); - - setPreferredSize(new java.awt.Dimension(500, 300)); - jLabel1.setText("Parcel Recipe Name"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 2); - add(jLabel1, gridBagConstraints); - - recipeName.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - recipeNameActionPerformed(evt); - } - }); - - recipeName.addFocusListener(new java.awt.event.FocusAdapter() { - public void focusGained(java.awt.event.FocusEvent evt) { - recipeNameFocusGained(evt); - } - public void focusLost(java.awt.event.FocusEvent evt) { - recipeNameFocusLost(evt); - } - }); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(12, 0, 11, 11); - add(recipeName, gridBagConstraints); - - jLabel2.setText("Initial Script Language"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 12, 11, 12); - add(jLabel2, gridBagConstraints); - - languagesComboBox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - languagesComboBoxActionPerformed(evt); - } - }); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 11); - add(languagesComboBox, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.weighty = 1.0; - add(jPanel1, gridBagConstraints); - - }//GEN-END:initComponents - - private void recipeNameFocusGained(java.awt.event.FocusEvent - evt) {//GEN-FIRST:event_recipeNameFocusGained - recipeName.selectAll(); - }//GEN-LAST:event_recipeNameFocusGained - - private void recipeNameFocusLost(java.awt.event.FocusEvent - evt) {//GEN-FIRST:event_recipeNameFocusLost - changeName(); - }//GEN-LAST:event_recipeNameFocusLost - - private void languagesComboBoxActionPerformed(java.awt.event.ActionEvent - evt) {//GEN-FIRST:event_languagesComboBoxActionPerformed - String language = (String)languagesComboBox.getSelectedItem(); - panel.setLanguage(language); - }//GEN-LAST:event_languagesComboBoxActionPerformed - - private void recipeNameActionPerformed(java.awt.event.ActionEvent - evt) {//GEN-FIRST:event_recipeNameActionPerformed - changeName(); - }//GEN-LAST:event_recipeNameActionPerformed - - private void changeName() { - String name = recipeName.getText().trim(); - - if (name.length() == 0) - name = null; - - panel.setName(name); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JTextField recipeName; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; - private javax.swing.JComboBox languagesComboBox; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java deleted file mode 100644 index dfa434d75a35..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathPanel.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.awt.Component; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.openide.WizardDescriptor; -import org.openide.util.HelpCtx; -import org.openide.util.NbBundle; - -import org.openoffice.netbeans.modules.office.options.OfficeSettings; -import org.openoffice.idesupport.OfficeInstallation; -import org.openoffice.idesupport.SVersionRCFile; - -/** A single panel descriptor for a wizard. - * You probably want to make a wizard iterator to hold it. - */ -public class SelectPathPanel implements - WizardDescriptor.Panel { /* .FinishPanel */ - - /** The visual component that displays this panel. - * If you need to access the component from this class, - * just use getComponent(). - */ - private SelectPathVisualPanel component; - private OfficeInstallation office; - - /** Create the wizard panel descriptor. */ - public SelectPathPanel() { - office = OfficeSettings.getDefault().getOfficeDirectory(); - - if (office == null) { - try { - office = SVersionRCFile.createInstance().getDefaultVersion(); - } catch (java.io.IOException ioe) {} - } - } - - // Get the visual component for the panel. In this template, the component - // is kept separate. This can be more efficient: if the wizard is created - // but never displayed, or not all panels are displayed, it is better to - // create only those which really need to be visible. - public Component getComponent() { - if (component == null) { - component = new SelectPathVisualPanel(this); - } - - return component; - } - - public HelpCtx getHelp() { - // Show no Help button for this panel: - return HelpCtx.DEFAULT_HELP; - // If you have context help: - // return new HelpCtx(SelectPathPanel.class); - } - - public boolean isValid() { - // If it is always OK to press Next or Finish, then: - return true; - // If it depends on some condition (form filled out...), then: - // return someCondition(); - // and when this condition changes (last form field filled in...) then: - // fireChangeEvent(); - // and uncomment the complicated stuff below. - } - - private final Set listeners = new HashSet(1); // Set - public final void addChangeListener(ChangeListener l) { - synchronized (listeners) { - listeners.add(l); - } - } - public final void removeChangeListener(ChangeListener l) { - synchronized (listeners) { - listeners.remove(l); - } - } - protected final void fireChangeEvent() { - Iterator it; - - synchronized (listeners) { - it = new HashSet(listeners).iterator(); - } - - ChangeEvent ev = new ChangeEvent(this); - - while (it.hasNext()) { - ((ChangeListener)it.next()).stateChanged(ev); - } - } - - public void setSelectedPath(OfficeInstallation oi) { - this.office = oi; - fireChangeEvent(); - } - - public OfficeInstallation getSelectedPath() { - return office; - } - - // You can use a settings object to keep track of state. - // Normally the settings object will be the WizardDescriptor, - // so you can use WizardDescriptor.getProperty & putProperty - // to store information entered by the user. - public void readSettings(Object settings) { - } - - public void storeSettings(Object settings) { - WizardDescriptor wiz = (WizardDescriptor)settings; - wiz.putProperty(InstallationPathDescriptor.PROP_INSTALLPATH, office); - } -} diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form deleted file mode 100644 index eb742089ed19..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.form +++ /dev/null @@ -1,98 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java b/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java deleted file mode 100644 index ca26a25bc150..000000000000 --- a/scripting/java/org/openoffice/netbeans/modules/office/wizard/SelectPathVisualPanel.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package org.openoffice.netbeans.modules.office.wizard; - -import java.util.Hashtable; -import java.util.Enumeration; -import java.io.File; -import java.io.IOException; -import javax.swing.JFileChooser; - -import org.openide.util.NbBundle; -import org.openoffice.idesupport.SVersionRCFile; -import org.openoffice.idesupport.OfficeInstallation; -import org.openoffice.netbeans.modules.office.options.OfficeSettings; - -/** A single panel for a wizard - the GUI portion. - */ -public class SelectPathVisualPanel extends javax.swing.JPanel { - - /** The wizard panel descriptor associated with this GUI panel. - * If you need to fire state changes or something similar, you can - * use this handle to do so. - */ - private final SelectPathPanel panel; - - /** Create the wizard panel and set up some basic properties. */ - public SelectPathVisualPanel(SelectPathPanel panel) { - this.panel = panel; - initComponents(); - OfficeInstallation orig = panel.getSelectedPath(); - - try { - Enumeration enumer = SVersionRCFile.createInstance().getVersions(); - - while (enumer.hasMoreElements()) { - OfficeInstallation oi = (OfficeInstallation)enumer.nextElement(); - installationsComboBox.addItem(oi); - } - } catch (IOException ioe) { - installationsComboBox.addItem(""); - } - - if (orig != null) { - installationsComboBox.setSelectedItem(orig); - installPath.setText(orig.getPath()); - } - - installationsComboBox.addActionListener( - new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - installationsComboBoxActionPerformed(evt); - } - } - ); - - // Provide a name in the title bar. - setName(NbBundle.getMessage(SelectPathVisualPanel.class, - "TITLE_SelectPathVisualPanel")); - } - - private void installationsComboBoxActionPerformed( - java.awt.event.ActionEvent evt) { - - OfficeInstallation oi = - (OfficeInstallation)installationsComboBox.getSelectedItem(); - - installPath.setText(oi.getPath()); - panel.setSelectedPath(oi); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - java.awt.GridBagConstraints gridBagConstraints; - - jLabel1 = new javax.swing.JLabel(); - installPath = new javax.swing.JTextField(); - jLabel2 = new javax.swing.JLabel(); - installationsComboBox = new javax.swing.JComboBox(); - jPanel1 = new javax.swing.JPanel(); - browseButton = new javax.swing.JButton(); - - setLayout(new java.awt.GridBagLayout()); - - setPreferredSize(new java.awt.Dimension(600, 300)); - jLabel1.setText("Installations Detected"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 2); - add(jLabel1, gridBagConstraints); - - installPath.setEditable(false); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(12, 0, 11, 11); - add(installPath, gridBagConstraints); - - jLabel2.setText("Installation Directory"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.insets = new java.awt.Insets(12, 12, 11, 12); - add(jLabel2, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; - gridBagConstraints.insets = new java.awt.Insets(11, 0, 11, 11); - add(installationsComboBox, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; - gridBagConstraints.weighty = 1.0; - add(jPanel1, gridBagConstraints); - - browseButton.setText("Browse..."); - browseButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - browseButtonActionPerformed(evt); - } - }); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 2; - gridBagConstraints.gridy = 1; - gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; - add(browseButton, gridBagConstraints); - - }//GEN-END:initComponents - - private void browseButtonActionPerformed(java.awt.event.ActionEvent - evt) {//GEN-FIRST:event_browseButtonActionPerformed - // Add your handling code here: - File target = null; - - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int result = chooser.showDialog(null, null); - - if (result == JFileChooser.APPROVE_OPTION) { - target = chooser.getSelectedFile(); - - String path; - - try { - path = target.getCanonicalPath(); - } catch (IOException ioe) { - path = target.getAbsolutePath(); - } - - OfficeInstallation oi = new OfficeInstallation(path, path); - - if (oi.supportsFramework()) { - installPath.setText(path); - panel.setSelectedPath(oi); - } - } - - }//GEN-LAST:event_browseButtonActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JTextField installPath; - private javax.swing.JButton browseButton; - private javax.swing.JComboBox installationsComboBox; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; - // End of variables declaration//GEN-END:variables -} diff --git a/scripting/workben/bindings/EditDebug.xdl b/scripting/workben/bindings/EditDebug.xdl deleted file mode 100644 index 5a69935f7950..000000000000 --- a/scripting/workben/bindings/EditDebug.xdl +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/EventsBinding.xdl b/scripting/workben/bindings/EventsBinding.xdl deleted file mode 100644 index 7b4a1b4b5d38..000000000000 --- a/scripting/workben/bindings/EventsBinding.xdl +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/HelpBinding.xdl b/scripting/workben/bindings/HelpBinding.xdl deleted file mode 100644 index f2357e781560..000000000000 --- a/scripting/workben/bindings/HelpBinding.xdl +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/KeyBinding.xdl b/scripting/workben/bindings/KeyBinding.xdl deleted file mode 100644 index 10aabc444eeb..000000000000 --- a/scripting/workben/bindings/KeyBinding.xdl +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/MacroEditor.xdl b/scripting/workben/bindings/MacroEditor.xdl deleted file mode 100644 index 11285df66582..000000000000 --- a/scripting/workben/bindings/MacroEditor.xdl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - diff --git a/scripting/workben/bindings/MenuBinding.xdl b/scripting/workben/bindings/MenuBinding.xdl deleted file mode 100644 index f68969e2eda1..000000000000 --- a/scripting/workben/bindings/MenuBinding.xdl +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/ScriptBinding.xba b/scripting/workben/bindings/ScriptBinding.xba deleted file mode 100644 index f79ef2e5aef4..000000000000 --- a/scripting/workben/bindings/ScriptBinding.xba +++ /dev/null @@ -1,2110 +0,0 @@ - - - -REM ***** BASIC ***** - -REM ----- Global Variables ----- - -'bindingDialog can refer to either KeyBinding or MenuBinding dialog -private languages() as String -private extensions() as Object -private locations() as String -private filesysScripts() as String -private filesysCount as integer -private bindingDialog as object -private helpDialog as object -'Couldn't get redim to work, so scriptDisplayList is and array of arrays -'where the one and only array in scriptDisplayList is an array -'of com.sun.star.beans.PropertyValue, where Name = [logicalName][FunctionName] -'and value is ScriptStorage object -private scriptDisplayList(0) -private testArray() as String -'Array to store lines from the xml file -private xmlFile() as string -'Name of the xml file [writer/calc][menubar/keybindings].xml -private xmlFileName as string -'Number of lines in the xml file -private numberOfLines as integer - -'Parallel arrays to store all top-level menu names and line positions -private menuItems() as string -private menuItemLinePosition() as integer -'Counter for the number of top-level menus -private menuCount as integer - -'Parallel arrays to store all sub-menu names and line positions for a particular top-level menu -private subMenuItems() as string -private subMenuItemLinePosition() as integer -'Counter for the number of sub-menus -private subMenuCount as integer - -'Parallel arrays to store all script names and line positions -private scriptNames() as string -private scriptLinePosition() as integer -'Counter for the number of scripts -private scriptCount as integer - -'Array to store all combinations of key bindings -private allKeyBindings() as string - -'Array of Arrays -'KeyBindArrayOfArrays(0) contains array of "SHIFT + CONTROL + F Keys" data -'Similarly -'KeyBindArrayOfArrays(1) contains SHIFT + CONTROL + digits -'KeyBindArrayOfArrays(2) contains SHIFT + CONTROL + letters -'KeyBindArrayOfArrays(3) contains CONTROL + F keys -'KeyBindArrayOfArrays(4) contains CONTROL + digits -'KeyBindArrayOfArrays(5) contains CONTROL + letters -'KeyBindArrayOfArrays(6) contains SHIFT + F keys -private KeyBindArrayOfArrays(6) - -'Each PropertyValue represents a key, Name member contains the script (if a binding exists) -' the Value contains and integer -' 0 means no script bound -' 1 script is bound to an office function -' >1 line number of entry in xmlfile array -private keyAllocationMap(6,25) as new com.sun.star.beans.PropertyValue -'array to store key group descriptions -private AllKeyGroupsArray(6) as String - - -'Array of props to store all event bindings for the Applications -private allEventTypesApp( 14 ) as new com.sun.star.beans.PropertyValue -'Array of props to store all event bindings for the Document -private allEventTypesDoc( 14 ) as new com.sun.star.beans.PropertyValue -'Array of props to store all event types (Name) and textual description (Value) -private allEventTypes( 14 ) as new com.sun.star.beans.PropertyValue - - -private dialogName as String -REM ------ Storage Refresh Function ------ - - -sub RefreshUserScripts() -' TDB - change Menu bindings to allow user to refresh all, user, share or document script - RefreshAppScripts( "USER" ) -end sub - -sub RefreshAllScripts() - RefreshAppScripts( "USER" ) - RefreshAppScripts( "SHARE" ) - RefreshDocumentScripts -end sub - -sub RefreshAppScripts( appName as String ) - On Error Goto ErrorHandler - smgr = getProcessServiceManager() - context = smgr.getPropertyValue( "DefaultContext" ) - scriptstoragemgr = context.getValueByName( "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager" ) - - scriptstoragemgr.refreshScriptStorage( appName ) - - Exit sub - - ErrorHandler: - reset - MsgBox ("Error: Unable to refresh Java (scripts)" + chr$(10) + chr$(10)+ "Detail: " & error$ + chr$(10) + chr$(10)+ "Action: Please restart Office",0,"Error" ) - -end sub - -sub RefreshDocumentScripts() - On Error Goto ErrorHandler - smgr = getProcessServiceManager() - context = smgr.getPropertyValue( "DefaultContext" ) - scriptstoragemgr = context.getValueByName( "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager" ) - - oDocURL = ThisComponent.GetCurrentController.getModel.getURL - - On Error Goto ErrorHandlerDoc - scriptstoragemgr.refreshScriptStorage( oDocURL ) - - Exit sub - - ErrorHandlerDoc: - reset - ' Ignore document script errors as it will happen when refreshing an unsaved doc - Exit sub - - ErrorHandler: - reset - MsgBox ("Error: Unable to refresh Java (scripts)" + chr$(10) + chr$(10)+ "Detail: " & error$ + chr$(10) + chr$(10)+ "Action: Please restart Office",0,"Error" ) - -end sub - - -REM ----- Launch Functions ----- - -Sub createAndPopulateKeyArrays() - 'Create SHIFT + CONTROL + F keys array - 'Dim keyGroupProp as new com.sun.star.beans.PropertyValue - - Dim SCFKey( 11 ) - for FKey = 1 to 12 - SCFKey( FKey - 1 ) = "SHIFT + CONTROL + F" + FKey - next FKey - - KeyBindArrayOfArrays(0) = SCFKey() - - 'Create SHIFT + CONTROL + digits - Dim SCDKey( 9 ) - for Digit = 0 to 9 - SCDKey( Digit ) = "SHIFT + CONTROL + " + Digit - next Digit - KeyBindArrayOfArrays(1) = SCDKey() - - 'Create SHIFT + CONTROL + letters - - Dim SCLKey( 25 ) - for Alpha = 65 to 90 - SCLKey( Alpha - 65 ) = "SHIFT + CONTROL + " + chr$( Alpha ) - next Alpha - KeyBindArrayOfArrays(2) = SCLKey() - - 'Create CONTROL + F keys - Dim CFKey( 11 ) - for FKey = 1 to 12 - CFKey( Fkey - 1 ) = "CONTROL + F" + FKey - next FKey - KeyBindArrayOfArrays(3) = CFKey() - - 'Create CONTROL + digits - Dim CDKey( 9 ) - for Digit = 0 to 9 - CDKey( Digit ) = "CONTROL + " + Digit - next Digit - KeyBindArrayOfArrays(4) = CDKey() - - 'Create CONTROL + letters - Dim CLKey( 25 ) - for Alpha = 65 to 90 - CLKey( Alpha - 65 ) = "CONTROL + " + chr$( Alpha ) - next Alpha - KeyBindArrayOfArrays(5) = CLKey() - - 'Create SHIFT + F Keys - Dim SFKey( 11 ) - for FKey = 1 to 12 - SFKey( Fkey - 1 ) = "SHIFT + F" + FKey - next FKey - KeyBindArrayOfArrays(6) = SFKey() - -End Sub - -Sub updateMapWithDisabledKeys() - 'disable CONTROL + F1 & - keyAllocationMap( 3, 0 ).Value = 1 - keyAllocationMap( 3, 0 ).Name = "" - 'disable CONTROL + F4 & - keyAllocationMap( 3, 3 ).Value = 1 - keyAllocationMap( 3, 3 ).Name = "" - 'disable CONTROL + F6 - keyAllocationMap( 3, 5 ).Value = 1 - keyAllocationMap( 3, 5 ).Name = "" - - - 'disable SHIFT + F1 & - keyAllocationMap( 6, 0 ).Value = 1 - keyAllocationMap( 6, 0 ).Name = "" - 'disable SHIFT + F2 & - keyAllocationMap( 6, 1 ).Value = 1 - keyAllocationMap( 6, 1 ).Name = "" - 'disable SHIFT + F6 & - keyAllocationMap( 6, 5 ).Value = 1 - keyAllocationMap( 6, 5 ).Name = "" - -End Sub - -Sub initialiseFileExtensions() - ReDim extensions(ubound(languages())+1) as Object - oConfigProvider = CreateUnoService( "com.sun.star.configuration.ConfigurationProvider" ) - Dim configArgs(1) as new com.sun.star.beans.PropertyValue - configargs(0).Name = "nodepath" - configArgs(0).Value = "org.openoffice.Office.Scripting/ScriptRuntimes" - configargs(1).Name = "lazywrite" - configArgs(1).Value = false - oConfigAccess = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", configArgs()) - for index = 0 to ubound(languages()) - if(languages(index) <> "Java") then - xPropSet = oConfigAccess.getByName(languages(index)) - extns() = xPropSet.getPropertyValue("SupportedFileExtensions") - extensions(index) = extns() - endif - next index -end sub - -Sub ExecuteEditDebug() - - locations = Array ( "User", "Share", "Document", "Filesystem" ) - languages = Array ( "BeanShell", "JavaScript" ) - dialogName = "EditDebug" - initialiseFileExtensions() - bindingDialog = LoadDialog( "ScriptBindingLibrary", "EditDebug" ) - - PopulateLanguageCombo() - PopulateLocationCombo() - PopulateScriptList( languages(0), locations(0) ) - - bindingDialog.execute() -End Sub - -Sub ExecuteKeyBinding() - dialogName = "Key" - createAndPopulateKeyArrays() - updateMapWithDisabledKeys() - xmlFileName = GetDocumentType( "Key" ) - - if not (ReadXMLToArray( "Key" )) then - Exit Sub - endif - - bindingDialog = LoadDialog( "ScriptBindingLibrary", "KeyBinding" ) - PopulateKeyBindingList(0) - initialiseNavigationComboArrays() - PopulateLanguageCombo() - PopulateLocationCombo() - PopulateScriptList( languages(0), locations(0) ) - PopulateTopLevelKeyBindingList() - bindingDialog.execute() -end Sub - - -Sub initialiseNavigationComboArrays() - locations = Array ( "User", "Share", "Document", "Filesystem" ) - ReDim languages(0) as String - ReDim extensions(0) as Object - languages(0) = "Java" - REM extensions(0) = "" - - ' Setup languages array for all supported languages - oServiceManager = GetProcessServiceManager() - svrArray = oServiceManager.getAvailableServiceNames - - langCount = 1 - for index = 0 to ubound(svrArray) - iPos = inStr(svrArray(index), "ScriptProviderFor") - - if (iPos > 0) then - lang = Mid(svrArray(index), iPos + Len("ScriptProviderFor") - - if not (lang = "Java") then - 'Add to language vector - ReDim Preserve languages(langCount) as String - languages(langCount) = lang - langCount = langCount + 1 - endif - endif - next index - initialiseFileExtensions() -End Sub - - -Sub ExecuteEventBinding - dialogName = "Event" - createAllEventTypes() - createAllEventBindings() - - 'Populate application event bindings array (from config xml file) - if not (ReadXMLToArray( "Event" )) then - Exit Sub - endif - 'Populate document event bindings array (using Office API calls) - ReadEventsFromDoc() - - bindingDialog = LoadDialog( "ScriptBindingLibrary", "EventsBinding" ) - initialiseNavigationComboArrays() - PopulateLanguageCombo() - PopulateLocationCombo() - PopulateScriptList( languages(0), locations(0) ) - populateEventList( 0 ) - EventListListener() - bindingDialog.execute() -End Sub - -Sub ExecuteMenuBinding() - dialogName = "Menu" - xmlFileName = GetDocumentType( "Menu" ) - if not (ReadXMLToArray( "Menu" )) then - Exit Sub - endif - - bindingDialog = LoadDialog( "ScriptBindingLibrary", "MenuBinding" ) - initialiseNavigationComboArrays() - PopulateLanguageCombo() - PopulateLocationCombo() - PopulateScriptList( languages(0), locations(0) ) - PopulateMenuCombo() - PopulateSubMenuList( 1 ) - - subMenuList = bindingDialog.getControl("SubMenuList") - - subMenuList.selectItemPos( 0, true ) - - bindingDialog.execute() -end Sub - - -REM ----- Initialising functions ----- - - -function LoadDialog( libName as string, dialogName as string ) as object - dim library as object - dim libDialog as object - dim runtimeDialog as object - libContainer = DialogLibraries - libContainer.LoadLibrary( libName ) - library = libContainer.getByName( libname ) - libDialog = library.getByName( dialogName ) - runtimeDialog = CreateUnoDialog( libDialog ) - LoadDialog() = runtimeDialog - -end function - - -function GetDocumentType( bindingType as string ) as string - document = StarDesktop.ActiveFrame.Controller.Model - Dim errornumber As Integer - errornumber = 111 - Error errornumber - if document.SupportsService("com.sun.star.sheet.SpreadsheetDocument") then - if bindingType = "Key" then - GetDocumentType() = "calckeybinding.xml" - else - if bindingType = "Menu" then - GetDocumentType() = "calcmenubar.xml" - end if - end if - elseif document.SupportsService("com.sun.star.text.TextDocument") then - if bindingType = "Key" then - GetDocumentType() = "writerkeybinding.xml" - else - if bindingType = "Menu" then - GetDocumentType() = "writermenubar.xml" - end if - end if - elseif document.SupportsService("com.sun.star.presentation.PresentationDocument") then - if bindingType = "Key" then - GetDocumentType() = "impresskeybinding.xml" - else - if bindingType = "Menu" then - GetDocumentType() = "impressmenubar.xml" - end if - end if - elseif document.SupportsService("com.sun.star.presentation.PresentationDocument") then - if bindingType = "Key" then - GetDocumentType() = "impresskeybinding.xml" - else - if bindingType = "Menu" then - GetDocumentType() = "impressmenubar.xml" - end if - end if - elseif document.SupportsService("com.sun.star.drawing.DrawingDocument") then - if bindingType = "Key" then - GetDocumentType() = "drawkeybinding.xml" - else - if bindingType = "Menu" then - GetDocumentType() = "drawmenubar.xml" - end if - end if - else - MsgBox ("Error: Couldn't determine configuration file type" + chr$(10) + chr$(10) + "Action: Please reinstall Scripting Framework",0,"Error" ) - end if -end function - -function lastIndexOf( targetStr as String, substr as String ) as Integer - copyStr = targetStr - while instr(copyStr, substr) > 0 - pos = instr(copyStr, substr) - tpos = tpos + pos - copyStr = mid(copyStr, pos+1, len(copyStr)-pos ) - wend - lastIndexOf() = tpos -end function - -function getScriptURI( selectedScript as String ) as String - combo = bindingDialog.getControl( "LocationCombo" ) - location = combo.text - if ( location = "User" ) then - location = "user" - elseif ( location = "Share" ) then - location = "share" - elseif ( location = "Filesystem" ) then - location = "filesystem" - else - location = "document" - end if - - - - if ( location = "filesystem" ) then - REM need to build URI here - dcf - combo = bindingDialog.getControl( "LanguageCombo" ) - language = combo.text - url = selectedscript - pos = lastIndexOf( url, "/" ) - locationPath = mid( url, 1, pos) - url = mid( url, pos+1, len( url ) - pos ) - functionName = url - pos = lastIndexOf( url, "." ) - logicalName = mid( url, 1, pos - 1 ) - getScriptURI() = "script://" + logicalName + "?language=" _ - + language + "&amp;function=" + functionName _ - + "&amp;location=filesystem:" + locationPath - else - Dim scriptInfo as Object - scripts() = scriptDisplayList(0) - for n = LBOUND( scripts() ) to UBOUND( scripts() ) - - if ( scripts( n ).Name = selectedScript ) then - scriptInfo = scripts( n ).Value - exit for - end if - next n - getScriptURI() = "script://" + scriptInfo.getLogicalName + "?language=" _ - + scriptInfo.getLanguage() + "&amp;function=" + _ - scriptInfo.getFunctionName() + "&amp;location=" + location - end if - -end function - -function GetOfficePath() as string - REM Error check and prompt user to manually input Office Path - settings = CreateUnoService( "com.sun.star.frame.Settings" ) - path = settings.getByName( "PathSettings" ) - unformattedOfficePath = path.getPropertyValue( "UserPath" ) - - dim officePath as string - const removeFromEnd = "/user" - const removeFromEndWindows = "\user" - - REM If Solaris or Linux - if not ( instr( unformattedOfficePath, removeFromEnd ) = 0 ) then - endPosition = instr( unformattedOfficePath, removeFromEnd ) - officePath = mid( unformattedOfficePath, 1, endPosition ) - REM If Windows - else if not ( instr( unformattedOfficePath, removeFromEndWindows ) = 0 ) then - endPosition = instr( unformattedOfficePath, removeFromEndWindows ) - officePath = mid( unformattedOfficePath, 1, endPosition ) - while instr( officePath, "\" ) > 0 - backSlash = instr( officePath, "\" ) - startPath = mid( officePath, 1, backSlash - 1 ) - endPath = mid( officePath, backslash + 1, len( officePath ) - backSlash ) - officePath = startPath + "/" + endPath - wend - else - MsgBox ("Error: Office path not found" + chr$(10) + chr$(10) + "Action: Please reinstall Scripting Framework",0,"Error" ) - REM Prompt user - end if - end if - - GetOfficePath() = officePath -end function - - - -REM ----- File I/O functions ----- - - -function ReadXMLToArray( bindingType as string ) as boolean - On Error Goto ErrorHandler - if ( bindingType = "Event" ) then - xmlfilename = "eventbindings.xml" - endif - - simplefileaccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" ) - filestream = simplefileaccess.openFileRead( "file://" + GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName ) - - textin = CreateUnoService( "com.sun.star.io.TextInputStream" ) - textin.setInputStream( filestream ) - - redim xmlFile( 400 ) as String - redim menuItems( 30 ) as String - redim menuItemLinePosition( 30 ) as Integer - redim scriptNames( 120 ) as string - redim scriptLinePosition( 120) as integer - - lineCount = 1 - menuCount = 1 - scriptCount = 1 - - do while not textin.isEOF() - xmlline = textin.readLine() - xmlFile( lineCount ) = xmlline - - const menuItemWhiteSpace = 2 - const menuXMLTag = "<menu:menu" - - if bindingType = "Menu" then - evaluateForMenu( xmlline, lineCount ) - elseif bindingType = "Key" then - processKeyXMLLine( lineCount, xmlline ) - elseif bindingType = "Event" then - evaluateForEvent( xmlline, lineCount ) - else - MsgBox ("Error: Couldn't determine file type" + chr$(10) + chr$(10) + "Action: Please reinstall Scripting Framework",0,"Error" ) - end if - lineCount = lineCount + 1 - loop - - 'Set global variable numberOfLines (lineCount is one too many at end of the loop) - numberOfLines = lineCount - 1 - 'Set global variable menuCount (it is one too many at end of the loop) - menuCount = menuCount - 1 - - filestream.closeInput() - ReadXMLToArray( ) = true - Exit function - - ErrorHandler: - reset - MsgBox ("Error: Unable to read Star Office configuration file - " + xmlFileName + chr$(10) + chr$(10) + "Action: Please reinstall Scripting Framework",0,"Error" ) - ReadXMLToArray( ) = false -end function - - - -sub evaluateForMenu( xmlline as string, lineCount as integer ) - const menuItemWhiteSpace = 2 - const menuXMLTag = "<menu:menu" - 'If the xml line is a top-level menu - if instr( xmlline, menuXMLTag ) = menuItemWhiteSpace then - menuLabel = ExtractLabelFromXMLLine( xmlline ) - menuItems( menuCount ) = menuLabel - menuItemLinePosition( menuCount ) = lineCount - menuCount = menuCount + 1 - end if -end sub - -sub evaluateForEvent( xmlline as string, lineCount as integer ) - dim eventName as String - 'if the xml line identifies a script or SB macro - dim scriptName as string - dim lineNumber as integer - if instr( xmlline, "event:language=" + chr$(34) + "Script" ) > 0 then - eventName = ExtractEventNameFromXMLLine( xmlline ) - scriptName = ExtractEventScriptFromXMLLine( xmlline ) - lineNumber = lineCount - elseif instr( xmlline, "event:language=" + chr$(34) + "StarBasic" ) > 0 then - eventName = ExtractEventNameFromXMLLine( xmlline ) - scriptName = "Allocated to Office function" - lineNumber = 1 - end if - - 'Need to sequence to find the corresponding index for the event type - for n = 0 to ubound( allEventTypesApp() ) - if ( eventName = allEventTypes( n ).Name ) then - allEventTypesApp( n ).Name = scriptName - allEventTypesApp( n ).Value = lineNumber - end if - next n -end sub - - -function isOKscriptProps( props() as Object, eventName as string ) as Boolean - On Error Goto ErrorHandler - props = ThisComponent.getEvents().getByName( eventName ) - test = ubound( props() ) - isOKscriptProps() = true - exit function - - ErrorHandler: - isOKscriptProps() = false -end function - -sub ReadEventsFromDoc() - On Error Goto ErrorHandler - - eventSupplier = ThisComponent - for n = 0 to ubound( allEventTypes() ) - Dim scriptProps() as Object - if (isOKscriptProps( scriptProps(), allEventTypes( n ).Name) ) then - if ( ubound( scriptProps ) > 0 ) then - if ( scriptProps(0).Value = "Script" ) then - 'Script binding - allEventTypesDoc(n).Name = scriptProps(1).Value - allEventTypesDoc(n).value = 2 - elseif( scriptProps(0).Value = "StarBasic" ) then - 'StarBasic macro - allEventTypesDoc(n).Name = "Allocated to Office function" - allEventTypesDoc(n).value = 1 - end if - end if - end if - next n - - exit sub - - ' eventProps is undefined if there are no event bindings in the doc - ErrorHandler: - reset -end sub - - -sub WriteEventsToDoc() - On Error Goto ErrorHandler - - eventSupplier = ThisComponent - for n = 0 to ubound( allEventTypes() ) - scriptName = allEventTypesDoc( n ).Name - eventName = allEventTypes( n ).Name - if( allEventTypesDoc( n ).Value > 1 ) then 'script - 'add to doc - AddEventToDocViaAPI( scriptName, eventName ) - elseif( allEventTypesDoc( n ).Value = 0 ) then 'blank (this will "remove" already blank entries) - 'remove from doc - RemoveEventFromDocViaAPI( eventName ) - endif - 'Otherwise it is a StarBasic binding - leave alone - next n - 'Mark document as modified ( should happen automatically as a result of calling the API ) - ThisComponent.CurrentController.getModel().setModified( True ) - exit sub - - ErrorHandler: - reset - msgbox( "Error calling UNO API for writing event bindings to the document" ) -end sub - - -sub RemoveEventFromDocViaAPI( event as string ) - dim document as object - dim dispatcher as object - dim parser as object - dim url as new com.sun.star.util.URL - - document = ThisComponent.CurrentController.Frame - parser = createUnoService("com.sun.star.util.URLTransformer") - dim args(0) as new com.sun.star.beans.PropertyValue - args(0).Name = "" - args(0).Value = event - - url.Complete = "script://_$ScriptFrmwrkHelper.removeEvent?" _ - + "language=Java&function=ScriptFrmwrkHelper.removeEvent" _ - + "&location=share" - - parser.parseStrict(url) - disp = document.queryDispatch(url,"",0) - disp.dispatch(url,args()) -end sub - - -sub AddEventToDocViaAPI( scriptName as string, eventName as string ) - dim properties( 1 ) as new com.sun.star.beans.PropertyValue - properties( 0 ).Name = "EventType" - properties( 0 ).Value = "Script" - properties( 1 ).Name = "Script" - properties( 1 ).Value = scriptName - - eventSupplier = ThisComponent - nameReplace = eventSupplier.getEvents() - nameReplace.replaceByName( eventName, properties() ) -end sub - - -' returns 0 for Fkey -' 1 for digit -' 2 for letter - -function getKeyTypeOffset( key as String ) as integer - length = Len( key ) - if ( length > 1 ) then - getKeyTypeOffset() = 0 - - elseif ( key >= "0" AND key <= "9" ) then - getKeyTypeOffset() = 1 - else - getKeyTypeOffset() = 2 - end if -end function - -function getKeyGroupIndex( key as String, offset as Integer ) as Integer - ' Keys we are interested in are A - Z, F2 - F12, 0 - 9 anything else should - ' ensure -1 is returned - cutKey = mid( key,2 ) - - if ( cutKey <> "" ) then - acode = asc ( mid( cutKey,1,1) ) - if ( acode > 57 ) then - getKeyGroupIndex() = -1 - exit function - end if - end if - - select case offset - case 0: - num = cint( cutKey ) - getKeyGroupIndex() = num - 1 - exit function - case 1: - num = asc( key ) - 48 - getKeyGroupIndex() = num - exit function - case 2: - num = asc( key ) - 65 - getKeyGroupIndex() = num - exit function - end select - getKeyGroupIndex() = -1 -end function - -Sub processKeyXMLLine( lineCount as Integer, xmlline as String ) - - if instr( xmlline, "<accel:item" ) > 0 then - shift = false - control = false - if instr( xmlline, "accel:shift="+chr$(34)+"true"+chr$(34) ) > 0 then - shift = true - end if - if instr( xmlFile( lineCount ), "accel:mod1="+chr$(34)+"true"+chr$(34) ) > 0 then - control = true - end if - offsetIntoArrayOfArrays = -1 'default unknown - if ( control AND shift ) then - offsetIntoArrayOfArrays = 0 - elseif ( control ) then - offsetIntoArrayOfArrays = 3 - elseif ( shift ) then - offsetIntoArrayOfArrays = 6 - endif - ' Calculate which of the 7 key group arrays we need to point to - key = ExtractKeyCodeFromXMLLine( xmlline ) - keyTypeOffset = getKeyTypeOffset( key ) - offsetIntoArrayOfArrays = offsetIntoArrayOfArrays + keyTypeOffset - - ' Calculate from the key the offset into key group array we need to point to - KeyGroupIndex = getKeyGroupIndex( key, keyTypeOffset ) - if ( offsetIntoArrayOfArrays = -1 ) then - 'Unknown key group, no processing necessary - Exit Sub - end if - if ( KeyGroupIndex > -1 ) then - - ' Determine if a script framework binding is present or not - if instr( xmlline, "script://" ) > 0 then - ' its one of ours so update its details - scriptName = ExtractScriptIdFromXMLLine( xmlline ) - - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value = lineCount - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Name = scriptName - else - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value = 1 - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Name = "" - - end if - end if - end if -End Sub - -Sub WriteXMLFromArray() - On Error Goto ErrorHandler - cfgFile = GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName - updateCfgFile( cfgFile ) - 'if ( false ) then' config stuff not in build yet - if ( true ) then - updateConfig( xmlFileName ) - else - msgbox ("Office must be restarted before your changes will take effect."+ chr$(10)+"Also close the Office QuickStarter (Windows and Linux)", 48, "Assign Script (Java) To Menu" ) - endif - Exit Sub - - ErrorHandler: - reset - MsgBox ("Error: Unable to write to Star Office configuration file" + chr$(10) + "/" + GetOfficePath() + "user/config/soffice.cfg/" +xmlFileName + chr$(10) + chr$(10) + "Action: Please make sure you have write access to this file",0,"Error" ) -end Sub - - -Sub UpdateCfgFile ( fileName as String ) - dim ScriptProvider as Object - dim Script as Object - dim args(1) - dim displayDialogFlag as boolean - displayDialogFlag = false - args(0) = ThisComponent - args(1) = displayDialogFlag - - ScriptProvider = createUnoService("drafts.com.sun.star.script.framework.provider.MasterScriptProvider") - ScriptProvider.initialize( args() ) - Script = ScriptProvider.getScript("script://_$ScriptFrmwrkHelper.updateCfgFile?" _ - + "language=Java&function=ScriptFrmwrkHelper.updateCfgFile&location=share") - Dim inArgs(2) - Dim outArgs() - Dim outIndex() - dim localNumLines as integer - - inArgs(0) = xmlFile() - inArgs(1) = fileName - inArgs(2) = numberOfLines - Script.invoke( inArgs(), outIndex(), outArgs() ) -End Sub - -sub UpdateConfig( a$ ) - dim document as object - dim dispatcher as object - dim parser as object - dim disp as object - dim url as new com.sun.star.util.URL - document = ThisComponent.CurrentController.Frame - parser = createUnoService("com.sun.star.util.URLTransformer") - dim args1(0) as new com.sun.star.beans.PropertyValue - args1(0).Name = "StreamName" - args1(0).Value = a$ - url.Complete = ".uno:UpdateConfiguration" - parser.parseStrict(url) - disp = document.queryDispatch(url,"",0) - disp.dispatch(url,args1()) - -End Sub - - -sub AddNewEventBinding( scriptName as string, eventPosition as integer, isApp as boolean ) - event = allEventTypes( eventPosition ).Name - 'dim scriptProp as new com.sun.star.beans.PropertyValue - if isApp then - 'scriptProp.Name = scriptName - 'scriptProp.Value = numberOfLines - allEventTypesApp( eventPosition ).Name = scriptName - allEventTypesApp( eventPosition ).Value = numberOfLines - - newline = " <event:event event:name=" + chr$(34) + event + chr$(34) - newline = newline + " event:language=" + chr$(34) + "Script" + chr$(34) + " xlink:href=" + chr$(34) - newline = newline + scriptName + chr$(34) + " xlink:type=" + chr$(34) + "simple" + chr$(34) + "/>" - xmlFile( numberOfLines ) = newline - xmlFile( numberOfLines + 1 ) = "</event:events>" - numberOfLines = numberOfLines + 1 - else - 'scriptProp.Name = scriptName - 'scriptProp.Value = 2 - allEventTypesDoc( eventPosition ).Name = scriptName - allEventTypesDoc( eventPosition ).Value = 2 - end if -end sub - -REM ----- Array update functions ----- - - -sub AddNewMenuBinding( newScript as string, newMenuLabel as string, newLinePosition as integer ) - dim newXmlFile( 400 ) as string - dim newLineInserted as boolean - dim lineCounter as integer - lineCounter = 1 - - do while lineCounter <= numberOfLines - if not newLineInserted then - REM If the line number is the position at which to insert the new line - if lineCounter = newLinePosition then - if( instr( xmlFile( lineCounter ), "<menu:menupopup>" ) > 0 ) then - indent = GetMenuWhiteSpace( xmlFile( newLinePosition + 1 ) ) - newXmlFile( lineCounter ) = xmlFile( lineCounter ) - newXmlFile( lineCounter + 1 ) = ( indent + "<menu:menuitem menu:id="+chr$(34) + newScript + chr$(34)+" menu:helpid="+chr$(34)+"1929"+chr$(34)+" menu:label="+chr$(34)+ newMenuLabel + chr$(34)+"/>" ) - else - indent = GetMenuWhiteSpace( xmlFile( newLinePosition - 1 ) ) - newXmlFile( lineCounter ) = ( indent + "<menu:menuitem menu:id="+chr$(34) + newScript + chr$(34)+" menu:helpid="+chr$(34)+"1929"+chr$(34)+" menu:label="+chr$(34)+ newMenuLabel + chr$(34)+"/>" ) - newXmlFile( lineCounter + 1 ) = xmlFile( lineCounter ) - end if - REM added -1 for debug --> - ' indent = GetMenuWhiteSpace( xmlFile( newLinePosition ) ) - ' newXmlFile( lineCounter ) = ( indent + "<menu:menuitem menu:id="+chr$(34)+"script://" + newScript + chr$(34)+" menu:helpid="+chr$(34)+"1929"+chr$(34)+" menu:label="+chr$(34)+ newMenuLabel + chr$(34)+"/>" ) - ' newXmlFile( lineCounter + 1 ) = xmlFile( lineCounter ) - newLineInserted = true - else - newXmlFile( lineCounter ) = xmlFile( lineCounter ) - end if - else - REM if the new line has been inserted the read from one position behind - newXmlFile( lineCounter + 1 ) = xmlFile( lineCounter ) - end if - lineCounter = lineCounter + 1 - loop - - numberOfLines = numberOfLines + 1 - - REM read the new file into the global array - for n = 1 to numberOfLines - xmlFile( n ) = newXmlFile( n ) - next n - -end sub - - -sub AddNewKeyBinding( scriptName as string, shift as boolean, control as boolean, key as string ) - - dim keyCombo as string - newLine = " <accel:item accel:code="+chr$(34)+"KEY_" + key +chr$(34) - if shift then - keyCombo = "SHIFT + " - newLine = newLine + " accel:shift="+chr$(34)+"true"+chr$(34) - end if - if control then - keyCombo = keyCombo + "CONTROL + " - newLine = newLine + " accel:mod1="+chr$(34)+"true"+chr$(34) - end if - keyCombo = keyCombo + key - newLine = newLine + " xlink:href="+chr$(34)+ scriptName +chr$(34) +"/>" - - if ( control AND shift ) then - offsetIntoArrayOfArrays = 0 - elseif ( control ) then - offsetIntoArrayOfArrays = 3 - elseif ( shift ) then - offsetIntoArrayOfArrays = 6 - endif - - keyTypeOffset = getKeyTypeOffset( key ) - offsetIntoArrayOfArrays = offsetIntoArrayOfArrays + keyTypeOffset - ' Calculate from the key the offset into key group array we need to point to - KeyGroupIndex = getKeyGroupIndex( key, keyTypeOffset ) - - ' if key is already allocated to a script then just reallocate - if ( keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value > 1 ) then - - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Name = scriptName - 'replace line in xml file - xmlFile( keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value ) = newLine - else - ' this is a new binding, create a new line in xml file - for n = 1 to numberOfLines - if n = numberOfLines then - xmlFile( n ) = newLine - xmlFile( n + 1 ) = "</accel:acceleratorlist>" - exit for - else - xmlFile( n ) = xmlFile( n ) - end if - next n - - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value = n - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Name = scriptName - numberOfLines = numberOfLines + 1 - endif - -end sub - - -Sub RemoveBinding( lineToRemove as Integer ) - xmlFile( lineToRemove ) = "" -end Sub - -REM Adds or removes the starting xml line positions for each top-level menu after the menu with the added script -sub UpdateTopLevelMenus( topLevelMenuPosition as integer, addLine as boolean ) - for n = topLevelMenuPosition to 8 - if addLine then - menuItemLinePosition( n ) = menuItemLinePosition( n ) + 1 - - end if - next n -end sub - - -REM Remove scriptNames and scriptLinePosition entries -sub RemoveScriptNameAndPosition( keyComboPosition ) - dim updatedScriptNames( 120 ) as string - dim updatedScriptLinePosition( 120 ) as integer - dim removedScript as boolean - removedScript = false - - for n = 1 to scriptCount - if not removedScript then - if not( n = keyComboPosition ) then - updatedScriptNames( n ) = scriptNames( n ) - else - removedScript = true - end if - else - updatedScriptNames( n - 1 ) = scriptNames( n ) - end if - next n - scriptCount = scriptCount - 1 - - for n = 1 to scriptCount - scriptNames( n ) = updatedScriptNames( n ) - next n -end sub - - - -REM ----- Populating Dialog Controls ----- - -Sub PopulateLanguageCombo() - langCombo = bindingDialog.getControl( "LanguageCombo" ) - langCombo.removeItems( 0, langCombo.getItemCount() ) - for n = LBOUND( languages() ) to UBOUND ( languages() ) - langCombo.addItem( languages( n ), n ) - next n - langCombo.setDropDownLineCount( n ) - langCombo.text = langCombo.getItem( 0 ) -End Sub - -Sub PopulateLocationCombo() - dim ScriptProvider as Object - dim args(1) - dim displayDialogFlag as boolean - displayDialogFlag = false - args(0) = ThisComponent - args(1) = displayDialogFlag - - ScriptProvider = createUnoService("drafts.com.sun.star.script.framework.provider.MasterScriptProvider") - ScriptProvider.initialize( args() ) - - locCombo = bindingDialog.getControl( "LocationCombo" ) - locCombo.removeItems( 0, locCombo.getItemCount() ) - for n = LBOUND( locations() ) to UBOUND ( locations() ) - locCombo.addItem( locations( n ), n ) - next n - locCombo.setDropDownLineCount( n ) - locCombo.text = locCombo.getItem( 0 ) -End Sub - -sub PopulateScriptList( lang as String, loc as String ) - Dim detailedView as boolean - detailedView = bindingDialog.Model.detail.state - scriptList = bindingDialog.getControl( "ScriptList" ) - scriptList.removeItems( 0, scriptList.getItemCount() ) - - smgr = getProcessServiceManager() - context = smgr.getPropertyValue( "DefaultContext" ) - scriptstoragemgr = context.getValueByName( "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager" ) - scriptLocationURI = "USER" - if ( loc = "Share" ) then - scriptLocationURI = "SHARE" - elseif ( loc = "Document" )then - document = StarDesktop.ActiveFrame.Controller.Model - scriptLocationURI = document.getURL() - elseif ( loc = "Filesystem" ) then - REM populate the list from the filesysScripts list - if(lang = "Java" ) then - exit sub - endif - length = UBOUND( filesysScripts() ) - if(length = -1) then - exit sub - endif - for langIndex = lbound(languages()) to ubound(languages()) - if ( lang = languages(langIndex)) then - extns = extensions(langIndex) - exit for - endif - next langIndex - dim locnDisplayList( length ) as new com.sun.star.beans.PropertyValue - for index = lbound(filesysScripts()) to ubound(filesysScripts()) - scriptextn = filesysScripts( index ) - pos = lastIndexOf( scriptextn, "." ) - scriptextn = mid( scriptextn, pos + 1, len( scriptextn ) - pos ) - - for extnsIndex = lbound(extns()) to ubound(extns()) - extn = extns(extnsIndex) - if ( scriptextn = extn ) then - if ( detailedView ) then - locnDisplayList( index ).Name = filesysScripts( index ) - locnDisplayList( index ).Value = filesysScripts( index ) - else - REM replace name with simplified view - locnDisplayList( index ).Name = filesysScripts( index ) - locnDisplayList( index ).Value = filesysScripts( index ) - end if - scriptList.addItem( locnDisplayList( index ).Name, index ) - exit for - end if - next extnsIndex - next index - ScriptDisplayList(0) = locnDisplayList() - scriptList.selectItemPos( 0, true ) - - REM !!!!At this point we exit the sub!!!! - exit sub - - endif - - scriptStorageID = scriptstoragemgr.getScriptStorageID( scriptLocationURI ) - dim resultList() as Object - if ( scriptStorageID > -1 ) then - storage = scriptstoragemgr.getScriptStorage( scriptStorageID ) - implementations() = storage.getAllImplementations() - length = UBOUND( implementations() ) - reservedScriptTag = "_$" - if ( length > -1 ) then - dim tempDisplayList( length ) as new com.sun.star.beans.PropertyValue - for n = LBOUND( implementations() ) to UBOUND( implementations() ) - logicalName = implementations( n ).getLogicalName() - firstTwoChars = LEFT( logicalName, 2 ) - 'Only display scripts whose logicalnames don't begin with "_$" - if ( firstTwoChars <> reservedScriptTag ) then - if ( lang = implementations( n ).getLanguage() ) then - if ( detailedView ) then - tempDisplayList( n ).Name = logicalName _ - + " [" + implementations( n ).getFunctionName() + "]" - tempDisplayList( n ).Value = implementations( n ) - else - tempDisplayList( n ).Name = logicalName - tempDisplayList( n ).Value = implementations( n ) - endif - scriptList.addItem( tempDisplayList( n ).Name, n ) - endif - endif - next n - resultList = tempDisplayList() - endif - ScriptDisplayList(0) = resultList() - endif - scriptList.selectItemPos( 0, true ) - -end sub - -sub PopulateMenuCombo() - menuComboBox = bindingDialog.getControl( "MenuCombo" ) - menuComboBox.removeItems( 0, menuComboBox.getItemCount() ) - for n = 1 to menuCount - menuComboBox.addItem( menuItems( n ), n - 1 ) - next n - menuComboBox.setDropDownLineCount( 8 ) - menuComboBox.text = menuComboBox.getItem( 0 ) -end sub - - -sub PopulateSubMenuList( menuItemPosition as integer ) - redim subMenuItems( 100 ) as string - redim subMenuItemLinePosition( 100 ) as integer - dim lineNumber as integer - const menuItemWhiteSpace = 4 - const menuXMLTag = "<menu:menu" - subMenuCount = 1 - - REM xmlStartLine and xmlEndLine refer to the first and last lines - ' menuItemPosition of a top-level menu ( 1=File to 8=Help ) add one line - xmlStartLine = menuItemLinePosition( menuItemPosition ) + 1 - - REM If last menu item is chosen - if menuItemPosition = menuCount then - xmlEndLine = numberOfLines - else - REM Other wise get the line before the next top-level menu begins - xmlEndLine = menuItemLinePosition( menuItemPosition + 1 ) - 1 - end if - - for lineNumber = xmlStartLine to xmlEndLine - REM Insert all sub-menus and sub-popupmenus - if not( instr( xmlFile( lineNumber ), menuXMLTag ) = 0 ) and instr( xmlFile( lineNumber ), "menupopup") = 0 then - subMenuIndent = GetMenuWhiteSpace( xmlFile( lineNumber ) ) - if subMenuIndent = " " then - subMenuIndent = "" - else - subMenuIndent = subMenuIndent + subMenuIndent - end if - if not( instr( xmlFile( lineNumber ), "menuseparator" ) = 0 ) then - subMenuItems( subMenuCount ) = subMenuIndent + "----------------" - else - subMenuName = ExtractLabelFromXMLLine( xmlFile( lineNumber ) ) - REM Add script Name if there is one bound to menu item - if instr( xmlFile( lineNumber ), "script://" ) > 0 then - script = ExtractScriptIdFromXMLLine( xmlFile( lineNumber ) ) - subMenuItems( subMenuCount ) = ( subMenuIndent + subMenuName + " [" + script + "]" ) - else - subMenuItems( subMenuCount ) = subMenuIndent + subMenuName - end if - end if - subMenuItemLinePosition( subMenuCount ) = lineNumber - subMenuCount = subMenuCount + 1 - end if - next lineNumber - - subMenuList = bindingDialog.getControl( "SubMenuList" ) - - currentPosition = subMenuList.getSelectedItemPos() - - subMenuList.removeItems( 0, subMenuList.getItemCount() ) - 'If there are no sub-menus i.e. a dynamically generated menu like Format - 'if subMenuCount = 1 then - if menuItems( menuItemPosition ) = "Format" then - subMenuList.addItem( "Unable to Assign Scripts to this menu", 0 ) - else - for n = 1 to subMenuCount - 1 - subMenuList.addItem( subMenuItems( n ), n - 1 ) - next n - end if - - subMenuList.selectItemPos( currentPosition, true ) - - SubMenuListListener() - MenuLabelBoxListener() -end sub - - - -sub PopulateTopLevelKeyBindingList() - - allKeyGroupsArray(0) = "SHIFT + CONTROL + F keys" - allKeyGroupsArray(1) = "SHIFT + CONTROL + digits" ' CURRENTLY DISABLED - allKeyGroupsArray(2) = "SHIFT + CONTROL + letters" - allKeyGroupsArray(3) = "CONTROL + F keys" - allKeyGroupsArray(4) = "CONTROL + digits" - allKeyGroupsArray(5) = "CONTROL + letters" - allKeyGroupsArray(6) = "SHIFT + F keys" - - keyCombo = bindingDialog.getControl( "KeyCombo" ) - keyCombo.removeItems( 0, keyCombo.getItemCount() ) - pos = 0 - for n = LBOUND( allKeyGroupsArray() ) to UBOUND( allKeyGroupsArray() ) - ' SHIFT + CONTROL + digits group is disabled at the moment, so skip - ' it - if ( n <> 1 ) then - keyCombo.addItem( allKeyGroupsArray( n ), pos ) - pos = pos +1 - endif - next n - keyCombo.text = keyCombo.getItem( 0 ) -end sub - -sub PopulateKeyBindingList( keyGroupIndex as Integer ) - keyList = bindingDialog.getControl( "KeyList" ) - selectedPos = keyList.getSelectedItemPos() - keyList.removeItems( 0, keyList.getItemCount() ) - - ShortCutKeyArray() = KeyBindArrayOfArrays( keyGroupIndex ) - - Dim keyProp as new com.sun.star.beans.PropertyValue - for n = lbound( ShortCutKeyArray() ) to ubound( ShortCutKeyArray() ) - keyName = ShortCutKeyArray( n ) - if ( keyAllocationMap( keyGroupIndex, n ).Value = 1 ) then - keyName = keyName + " [Allocated to Office function]" - - elseif ( keyAllocationMap( keyGroupIndex, n ).Value > 1 ) then - keyName = keyName + " " + keyAllocationMap( keyGroupIndex, n ).Name - endif - keyList.addItem( keyName, n ) - next n - - if ( selectedPos <> -1 )then - keyList.selectItemPos( selectedPos, true ) - else - keyList.selectItemPos( 0, true ) - end if - KeyListListener() -end sub - -sub populateEventList( focusPosition as integer ) - allApps = bindingDialog.getControl( "AllAppsOption" ) - eventList = bindingDialog.getControl( "EventList" ) - eventList.removeItems( 0, eventList.getItemCount() ) - - dim isApp as boolean - if allApps.state = true then ' Application event - isApp = true - else - isApp = false - end if - - ' use allEventTypes() to fill list box - ' for each element compare with allEventTypesApp - dim scriptName as string - dim lineNumber as integer - for n = 0 to ubound( allEventTypes() ) - ' If the line number is 1 then SB macro - ' more than 1 it is the line number of the script - if isApp and n > 12 then - exit for - endif - if isApp then - lineNumber = allEventTypesApp( n ).Value - scriptName = allEventTypesApp( n ).Name - else - lineNumber = allEventTypesDoc( n ).Value - scriptName = allEventTypesDoc( n ).Name - end if - stringToAdd = "" - if ( lineNumber >= 1 ) then - stringToAdd = " [" + scriptName + "]" - end if - eventList.addItem( allEventTypes( n ).Value + " " + stringToAdd, n ) - next n - - eventList.selectItemPos( focusPosition, true ) -end sub - - - -sub CreateAllKeyBindings() - reDim allKeyBindings( 105 ) as string - keyBindingPosition = 1 - - for FKey = 2 to 12 - allKeyBindings( keyBindingPosition ) = "SHIFT + CONTROL + F" + FKey - keyBindingPosition = keyBindingPosition + 1 - next FKey - for Digit = 0 to 9 - allKeyBindings( keyBindingPosition ) = "SHIFT + CONTROL + " + Digit - keyBindingPosition = keyBindingPosition + 1 - next Digit - for Alpha = 65 to 90 - allKeyBindings( keyBindingPosition ) = "SHIFT + CONTROL + " + chr$( Alpha ) - keyBindingPosition = keyBindingPosition + 1 - next Alpha - - for FKey = 2 to 12 - allKeyBindings( keyBindingPosition ) = "CONTROL + F" + FKey - keyBindingPosition = keyBindingPosition + 1 - next FKey - for Digit = 0 to 9 - allKeyBindings( keyBindingPosition ) = "CONTROL + " + Digit - keyBindingPosition = keyBindingPosition + 1 - next Digit - for Alpha = 65 to 90 - allKeyBindings( keyBindingPosition ) = "CONTROL + " + chr$( Alpha ) - keyBindingPosition = keyBindingPosition + 1 - next Alpha - - for FKey = 2 to 12 - allKeyBindings( keyBindingPosition ) = "SHIFT + F" + FKey - keyBindingPosition = keyBindingPosition + 1 - next FKey -end sub - - -sub createAllEventTypes() - allEventTypes( 0 ).Name = "OnStartApp" - allEventTypes( 0 ).Value = "Start Application" - allEventTypes( 1 ).Name = "OnCloseApp" - allEventTypes( 1 ).Value = "Close Application" - allEventTypes( 2 ).Name = "OnNew" - allEventTypes( 2 ).Value = "Create Document" - allEventTypes( 3 ).Name = "OnLoad" - allEventTypes( 3 ).Value = "Open Document" - allEventTypes( 4 ).Name = "OnSaveAs" - allEventTypes( 4 ).Value = "Save Document As" - allEventTypes( 5 ).Name = "OnSaveAsDone" - allEventTypes( 5 ).Value = "Document has been saved as" - allEventTypes( 6 ).Name = "OnSave" - allEventTypes( 6 ).Value = "Save Document" - allEventTypes( 7 ).Name = "OnSaveDone" - allEventTypes( 7 ).Value = "Document has been saved" - allEventTypes( 8 ).Name = "OnPrepareUnload" - allEventTypes( 8 ).Value = "Close Document" - allEventTypes( 9 ).Name = "OnUnload" - allEventTypes( 9 ).Value = "Close Document" - allEventTypes( 10 ).Name = "OnFocus" - allEventTypes( 10 ).Value = "Activate document" - allEventTypes( 11 ).Name = "OnUnfocus" - allEventTypes( 11 ).Value = "DeActivate document" - allEventTypes( 12 ).Name = "OnPrint" - allEventTypes( 12 ).Value = "Print Document" - REM The following are document-only events - allEventTypes( 13 ).Name = "OnMailMerge" - allEventTypes( 13 ).Value = "Print form letters" - allEventTypes( 14 ).Name = "OnPageCountChange" - allEventTypes( 14 ).Value = "Changing the page count" -end sub - - -sub createAllEventBindings() - 'dim props as new com.sun.star.beans.PropertyValue - 'props.Name = "" 'Name = script name - 'props.Value = 0 'Value = 0 for empty, 1 for macro, linenumber for script - - ' Creates all types of event bindings for both Application and Document - ' Initially both arrays have no bindings allocated to the events - ' The value for Doc is only Script/macro name (no need for line number) - for n = 0 to ubound( allEventTypes() ) - allEventTypesApp( n ).Name = "" - allEventTypesApp( n ).Value = 0 - allEventTypesDoc( n ).Name = "" - allEventTypesDoc( n ).Value = 0 - next n -end sub - - -REM ----- Text Handling Functions ----- - - -function ExtractLabelFromXMLLine( XMLLine as string ) as string - labelStart = instr( XMLLine, "label="+chr$(34)) + 7 - labelEnd = instr( XMLLine, chr$(34)+">" ) - if labelEnd = 0 then - labelEnd = instr( XMLLine, chr$(34)+"/>" ) - end if - labelLength = labelEnd - labelStart - - menuLabelUnformatted = mid( XMLLine, labelStart, labelLength ) - tildePosition = instr( menuLabelUnformatted, "~" ) - select case tildePosition - case 0 - menuLabel = menuLabelUnformatted - case 1 - menuLabel = right( menuLabelUnformatted, labelLength - 1 ) - case else - menuLabelLeft = left( menuLabelUnformatted, tildePosition - 1 ) - menuLabelRight = right( menuLabelUnformatted, labelLength - tildePosition ) - menuLabel = menuLabelLeft + menuLabelRight - end select - - ExtractLabelFromXMLLine() = menuLabel -end function - - -function ExtractScriptIdFromXMLLine( XMLLine as string ) as string - idStart = instr( XMLLine, "script://") + 9 - if instr( XMLLine, chr$(34)+" menu:helpid=" ) = 0 then - idEnd = instr( XMLLIne, "?location=" ) - else - idEnd = instr( XMLLine, ""+chr$(34)+" menu:helpid=" ) - end if - idLength = idEnd - idStart - scriptId = mid( XMLLine, idStart, idLength ) - - ExtractScriptIdFromXMLLine() = scriptId -end function - -function ExtractEventScriptFromXMLLine( xmlline as string ) - if instr( xmlline, "script://" ) > 0 then - idStart = instr( xmlline, "script://") + 9 - idEnd = instr( xmlline, chr$(34)+" xlink:type=" ) - idLength = idEnd - idStart - scriptId = mid( xmlline, idStart, idLength ) - end if - ExtractEventScriptFromXMLLine() = scriptId -end function - - -function ExtractEventNameFromXMLLine( xmlline as string ) - idStart = instr( xmlline, "event:name=" + chr$(34) ) + 12 - idEnd = instr( xmlline, chr$(34)+" event:language" ) - idLength = idEnd - idStart - event = mid( xmlline, idStart, idLength ) - - ExtractEventNameFromXMLLine() = event -end function - -function ExtractKeyCodeFromXMLLine( XMLLine as string ) as string - keyStart = instr( XMLLine, "code="+chr$(34)+"KEY_") + 10 - keyCode = mid( XMLLine, keyStart, ( len( XMLLine ) - keyStart ) ) - keyEnd = instr( keyCode, chr$(34) ) - keyCode = mid( keyCode, 1, keyEnd - 1 ) - - ExtractKeyCodeFromXMLLine() = keyCode -end function - - -function GetMenuWhiteSpace( MenuXMLLine as string ) as string - whiteSpace = "" - numberOfSpaces = instr( MenuXMLLine, "<" ) - 1 - for i = 1 to numberOfSpaces - whiteSpace = whiteSpace + " " - next i - - GetMenuWhiteSpace() = whiteSpace -end function - -function IsAllocatedMenuItem( script as string ) as boolean - foundMenuItem = false - Allocated = false - count = 0 - do - count = count + 1 - if strcomp( script, subMenuItems( count ) ) = 0 then - foundMenuItem = true - end if - loop while not( foundMenuItem ) and count < subMenuCount - - linePosition = subMenuItemLinePosition( count ) - - if not( instr( xmlFile( linePosition ), "script://" ) = 0 ) then - Allocated = true - end if - - isAllocatedMenuItem() = Allocated -end Function - - -function HasShiftKey( keyCombo ) as boolean - if instr( keyCombo, "SHIFT" ) = 0 then - hasShift = false - else - hasShift = true - end if - - HasShiftKey = hasShift -end function - - -function HasControlKey( keyCombo ) as boolean - if instr( keyCombo, "CONTROL" ) = 0 then - hasControl = false - else - hasControl = true - end if - - HasControlKey = hasControl -end function - - -function ExtractKeyFromCombo( keyString as string ) as string - while not( instr( keyString, "+" ) = 0 ) - removeTo = instr( keyString, "+ " ) + 2 - keyString = mid( keyString, removeTo, ( len( keyString ) - removeTo ) + 1 ) - wend - ExtractKeyFromCombo() = keyString -end function - - - -REM ------ Event Handling Functions (Listeners) ------ - - -sub KeyListListener() - keyShortCutList = bindingDialog.getControl( "KeyList" ) - selectedShortCut = keyShortCutList.getSelectedItem() - combo = bindingDialog.getControl( "KeyCombo" ) - - menuScriptList = bindingDialog.getControl( "ScriptList" ) - selectedScript = menuScriptList.getSelectedItem() - - keyGroup = combo.text - dim keyGroupIndex as Integer - dim selectedKeyIndex as Integer - for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) - if ( allKeyGroupsArray( n ) = keyGroup )then - keyGroupIndex = n - exit for - end if - next n - selectedKeyIndex = keyShortCutList.getSelectedItemPos() - - if keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Value > 1 then - bindingDialog.Model.Delete.enabled = true - bindingDialog.Model.AddOn.enabled = true - if selectedScript <> "" then - bindingDialog.Model.NewButton.enabled = true - endif - - else - - if keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Value = 1 then - bindingDialog.Model.Delete.enabled = false - bindingDialog.Model.AddOn.enabled = false - bindingDialog.Model.NewButton.enabled = false - else - bindingDialog.Model.Delete.enabled = false - bindingDialog.Model.AddOn.enabled = false - if selectedScript <> "" then - bindingDialog.Model.NewButton.enabled = true - end if - end if - end if -end sub - - -sub SubMenuListListener() - scriptList = bindingDialog.getControl( "ScriptList" ) - subMenuList = bindingDialog.getControl( "SubMenuList" ) - selectedMenuItem = subMenuList.getSelectedItem() - if IsAllocatedMenuItem( selectedMenuItem ) then - bindingDialog.Model.Delete.enabled = true - bindingDialog.Model.AddOn.enabled = true - else - bindingDialog.Model.Delete.enabled = false - bindingDialog.Model.AddOn.enabled = false - end if -end sub - -REM a keypress listener that in turn fires the MenuCL on a return key even only -sub fireMenuComboListernerOnRet( eventobj as object ) - if (eventobj.KeyCode = 1280 ) then - MenuComboListener() - endif -end sub - -'Populates the SubMenuList with the appropriate menu items from the Top-level menu selected from the combo box -sub MenuComboListener() - combo = bindingDialog.getControl( "MenuCombo" ) - newToplevelMenu = combo.text - counter = 0 - do - counter = counter + 1 - loop while not( newToplevelMenu = menuItems( counter ) ) - - PopulateSubMenuList( counter ) -end sub - -REM a keypress listener that in turn fires the LLCL on a return key even only -sub fireLangLocComboListernerOnRet( eventobj as object ) - if (eventobj.KeyCode = 1280 ) then - LangLocComboListener() - endif -end sub - -sub LangLocComboListener() - - combo = bindingDialog.getControl( "LanguageCombo" ) - language = combo.text - combo = bindingDialog.getControl( "LocationCombo" ) - location = combo.text - - PopulateScriptList( language,location ) - - 'Enable/disable Assign button - scriptList = bindingDialog.getControl( "ScriptList" ) - if not (dialogName = "EditDebug") then - if scriptList.getSelectedItem() = "" then - bindingDialog.Model.NewButton.enabled = false - end if - end if - - if ( location = "Filesystem" ) and ( language <> "Java" ) then - bindingDialog.Model.Browse.enabled = true - if not (dialogName = "EditDebug") then - bindingDialog.Model.fsonly.enabled = true - end if - else - bindingDialog.Model.Browse.enabled = false - if not (dialogName = "EditDebug") then - bindingDialog.Model.fsonly.enabled = false - end if - endif - - ' extra dialog dependent processing - if dialogName = "Menu" then - ' will set New button to false if no text in LabelBox - MenuLabelBoxListener() - elseif dialogName = "Key" then - ' will set Assigne button to false if appropriate - KeyListListener() - elseif dialogName = "Event" then - EventListListener() - end if - -end sub - -REM a keypress listener that in turn fires the KeyCL on a return key even only -sub fireKeyComboListernerOnRet( eventobj as object ) - if (eventobj.KeyCode = 1280 ) then - KeyComboListener() - endif -end sub - -'Populates the KeyList with the appropriate key combos from the Top-level key group selected from the combo box -sub KeyComboListener() - combo = bindingDialog.getControl( "KeyCombo" ) - keyGroup = combo.text - for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) - if ( allKeyGroupsArray( n ) = keyGroup )then - keyGroupIndex = n - exit for - end if - next n - PopulateKeyBindingList( keyGroupIndex ) -end sub - - -sub MenuLabelBoxListener() - menuScriptList = bindingDialog.getControl( "ScriptList" ) - selectedScript = menuScriptList.getSelectedItem() - 'if the SubMenuList is from a dynamically created menu (e.g. Format) - 'or if the Menu Label text box is empty - subMenuList = bindingDialog.getControl( "SubMenuList" ) - firstItem = subMenuList.getItem( 0 ) - if bindingDialog.Model.MenuLabelBox.text = "" OR firstItem = "Unable to Assign Scripts to this menu" OR selectedScript = "" then - bindingDialog.Model.NewButton.enabled = false - else - bindingDialog.Model.NewButton.enabled = true - end if -end sub - -sub AppDocEventListener() - populateEventList( 0 ) - EventListListener() -end sub - - -sub EventListListener() - on error goto ErrorHandler - - eventList = bindingDialog.getControl( "EventList" ) - eventPos = eventList.getSelectedItemPos() - - allApps = bindingDialog.getControl( "AllAppsOption" ) - - menuScriptList = bindingDialog.getControl( "ScriptList" ) - selectedScript = menuScriptList.getSelectedItem() - - dim binding as integer - if allApps.state = true then - binding = allEventTypesApp( eventPos ).Value - else - binding = allEventTypesDoc( eventPos ).Value - endif - - if ( binding > 1 ) then - bindingDialog.Model.Delete.enabled = true - else - bindingDialog.Model.Delete.enabled = false - end if - - if ( binding = 1 ) then - ' staroffice binding, can't assign - bindingDialog.Model.NewButton.enabled = false - elseif ( selectedScript <> "" ) then - bindingDialog.Model.NewButton.enabled = true - end if - exit sub - - ErrorHandler: - reset - bindingDialog.Model.Delete.enabled = false - -end sub - - -REM ------ Event Handling Functions (Buttons) ------ - -function getFilePicker() as Object - REM file dialog - oFilePicker = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" ) - - combo = bindingDialog.getControl( "LanguageCombo" ) - language = combo.text - currentFilter = "" - - for langIndex = 0 to ubound(languages()) - if( languages(langIndex) <> "Java" ) then - filterName = languages(langIndex) + " (" - filterVal="" - extns = extensions(langIndex) - for extnIndex = lbound(extns()) to ubound(extns()) - filterName = filterName + "*." + extns(extnIndex) + "," - filterVal = filterVal + "*." + extns(extnIndex) + "," - next extnIndex - filterName = left(filterName, len(filterName) -1) + ")" - filterVal = left(filterVal, len(filterVal) -1) - if(instr(filterName,language) = 1 ) then - currentFilter = filterName - end if - oFilePicker.AppendFilter(filterName, filterVal) - end if - next langIndex - if(len(currentFilter) > 0 ) then - oFilePicker.SetCurrentFilter( currentFilter ) - end if - - If sFileURL = "" Then - oSettings = CreateUnoService( "com.sun.star.frame.Settings" ) - oPathSettings = oSettings.getByName( "PathSettings" ) - sFileURL = oPathSettings.getPropertyValue( "Work" ) - End If - - REM set display directory - oSimpleFileAccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" ) - - If oSimpleFileAccess.exists( sFileURL ) And oSimpleFileAccess.isFolder( sFileURL ) Then - oFilePicker.setDisplayDirectory( sFileURL ) - End If - getFilePicker() = oFilePicker -end function - -Sub DoBrowseAndEdit() - Dim oFilePicker As Object, oSimpleFileAccess As Object - Dim oSettings As Object, oPathSettings As Object - Dim sFileURL As String - Dim sFiles As Variant - - oFilePicker = getFilePicker() - REM execute file dialog - If oFilePicker.execute() Then - sFiles = oFilePicker.getFiles() - - sFileURL = sFiles(0) - oSimpleFileAccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" ) - If oSimpleFileAccess.exists( sFileURL ) Then - for langIndex = 0 to ubound(languages()) - If (instr(oFilePicker.GetCurrentFilter, languages(langIndex)) = 1 ) then - RunDebugger(languages(langIndex), sFileURL, "") - End If - next langIndex - End If - bindingDialog.endExecute() - End If -End Sub - -Sub RunDebugger(lang as String, uri as String, filename as String) - dim document as object - dim dispatcher as object - dim parser as object - dim url as new com.sun.star.util.URL - - document = ThisComponent.CurrentController.Frame - parser = createUnoService("com.sun.star.util.URLTransformer") - dim args(2) as new com.sun.star.beans.PropertyValue - args(0).Name = "language" - args(0).Value = lang - args(1).Name = "uri" - args(1).Value = uri - args(2).Name = "filename" - args(2).Value = filename - - url.Complete = "script://_$DebugRunner.Debug?" _ - + "language=Java&function=DebugRunner.go" _ - + "&location=share" - - parser.parseStrict(url) - disp = document.queryDispatch(url,"",0) - disp.dispatch(url, args()) -End Sub - -sub DoEdit() - Dim scriptInfo as Object - - menuScriptList = bindingDialog.getControl( "ScriptList" ) - selectedScript = menuScriptList.getSelectedItem() - - if not (selectedScript = "") then - scripts() = scriptDisplayList(0) - for n = LBOUND( scripts() ) to UBOUND( scripts() ) - if ( scripts( n ).Name = selectedScript ) then - scriptInfo = scripts( n ).Value - exit for - end if - next n - - RunDebugger(scriptInfo.getLanguage, scriptInfo.getParcelURI, scriptInfo.getFunctionName) - bindingDialog.endExecute() - end if -end sub - -sub MenuOKButton() - WriteXMLFromArray() - bindingDialog.endExecute() -end sub - - -sub MenuCancelButton() - bindingDialog.endExecute() -end sub - - -sub MenuHelpButton() - helpDialog = LoadDialog( "ScriptBindingLibrary", "HelpBinding" ) - helpDialog.execute() -end sub - - -sub MenuDeleteButton() - subMenuList = bindingDialog.getControl( "SubMenuList" ) - linePos = subMenuItemLinePosition( subMenuList.getSelectedItemPos() + 1 ) - - RemoveBinding( linePos ) - - REM Update the top-level menu's line positions - combo = bindingDialog.getControl( "MenuCombo" ) - newToplevelMenu = combo.text - counter = 0 - do - counter = counter + 1 - loop while not( newToplevelMenu = menuItems( counter ) ) - UpdateTopLevelMenus( counter + 1, false ) - - MenuComboListener() - - subMenuList.selectItemPos( subMenuList.getSelectedItemPos(), true ) -end sub - - -sub MenuNewButton() - menuScriptList = bindingDialog.getControl( "ScriptList" ) - selectedScript = menuScriptList.getSelectedItem() - scriptURI = getScriptURI( selectedScript ) - newMenuLabel = bindingDialog.Model.MenuLabelBox.text - - subMenuList = bindingDialog.getControl( "SubMenuList" ) - - REM Update the top-level menu's line positions - combo = bindingDialog.getControl( "MenuCombo" ) - newToplevelMenu = combo.text - counter = 0 - do - counter = counter + 1 - loop while not( newToplevelMenu = menuItems( counter ) ) - UpdateTopLevelMenus( counter + 1, true ) - - REM New line position is one ahead of the selected sub menu item - linePos = subMenuItemLinePosition( subMenuList.getSelectedItemPos() + 1 ) + 1 - - AddNewMenuBinding( scriptURI, newMenuLabel, linePos ) - - MenuComboListener() - subMenuList.selectItemPos( subMenuList.getSelectedItemPos() + 1, true ) - SubMenuListListener() -end sub - -sub BrowseButton() - Dim oFilePicker As Object, oSimpleFileAccess As Object - Dim oSettings As Object, oPathSettings As Object - Dim sFileURL As String - Dim sFiles As Variant - - oFilePicker = getFilePicker() - - REM execute file dialog - If oFilePicker.execute() Then - sFiles = oFilePicker.getFiles() - sFileURL = sFiles(0) - oSimpleFileAccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" ) - If oSimpleFileAccess.exists( sFileURL ) Then - REM add sFileURL to the list - ReDim preserve filesysScripts(filesysCount) as String - filesysScripts( filesysCount ) = sFileURL - filesysCount=filesysCount+1 - ' if user changed filter in file picker then populate - ' language with language associated with that in file picker - sFilter = oFilePicker.getCurrentFilter() - langCombo = bindingDialog.getControl( "LanguageCombo" ) - dim items() as String - items() = langCombo.getItems() - for index = lbound(items()) to ubound(items()) - iPos = inStr(sFilter," ") - Dim theLanguage as String - if( iPos > 0 ) then - theLanguage = Left( sFilter, iPos - 1) - if ( theLanguage = items( index ) ) then - langCombo.text = items( index ) - exit for - end if - end if - next index - End If - End If - LangLocComboListener() -End Sub - -sub KeyOKButton() - WriteXMLFromArray() - bindingDialog.endExecute() -end sub - - -sub KeyCancelButton() - bindingDialog.endExecute() -end sub - - -sub KeyHelpButton() - helpDialog = LoadDialog( "ScriptBindingLibrary", "HelpBinding" ) - helpDialog.execute() -end sub - - -sub KeyNewButton() - combo = bindingDialog.getControl( "KeyCombo" ) - keyGroup = combo.text - for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) - if ( allKeyGroupsArray( n ) = keyGroup )then - keyGroupIndex = n - exit for - end if - next n - menuScriptList = bindingDialog.getControl( "ScriptList" ) - script = menuScriptList.getSelectedItem() - scriptURI = getScriptURI( script ) - - keyList = bindingDialog.getControl( "KeyList" ) - keyIndex = keyList.getSelectedItemPos() - ShortCutKeyArray() = KeyBindArrayOfArrays( keyGroupIndex ) - keyText = ShortCutKeyArray( keyIndex ) - - AddNewKeyBinding( scriptURI, HasShiftKey( keyText ), HasControlKey( keyText ), ExtractKeyFromCombo( keyText ) ) - - KeyComboListener() -end sub - - -sub KeyDeleteButton() - - keyShortCutList = bindingDialog.getControl( "KeyList" ) - selectedShortCut = keyShortCutList.getSelectedItem() - combo = bindingDialog.getControl( "KeyCombo" ) - - keyGroup = combo.text - dim keyGroupIndex as Integer - dim selectedKeyIndex as Integer - for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) - if ( allKeyGroupsArray( n ) = keyGroup )then - keyGroupIndex = n - exit for - end if - next n - selectedKeyIndex = keyShortCutList.getSelectedItemPos() - linePosition = keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Value - keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Value = 0 - keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Name = "" - RemoveBinding( linePosition ) - KeyComboListener() -end sub - - -sub EventNewButton() - eventScriptList = bindingDialog.getControl( "ScriptList" ) - selectedScript = eventScriptList.getSelectedItem() - scriptURI = getScriptURI( selectedScript ) - eventList = bindingDialog.getControl( "EventList" ) - eventPosition = eventList.getSelectedItemPos() - - allApps = bindingDialog.getControl( "AllAppsOption" ) - dim isApp as boolean - if allApps.state = true then 'Application - isApp = true - else 'Document - isApp = false - end if - AddNewEventBinding( scriptURI, eventPosition, isApp ) - - populateEventList( eventPosition ) - EventListListener() -end sub - - -sub EventDeleteButton() - eventList = bindingDialog.getControl( "EventList" ) - REM Check that combo is a script - eventPosition = eventList.getSelectedItemPos() - - allApps = bindingDialog.getControl( "AllAppsOption" ) - if allApps.state = true then 'Application - linePosition = allEventTypesApp( eventPosition ).Value - 'dim eventProp as new com.sun.star.beans.PropertyValue - 'eventProp.Name = "" - 'eventProp.Value = 0 - allEventTypesApp( eventPosition ).Name = "" - allEventTypesApp( eventPosition ).Value = 0 - RemoveBinding( linePosition ) - else 'Document - 'DeleteEvent( allEventTypes( eventPosition ) ) - allEventTypesDoc( eventPosition ).Name = "" - allEventTypesDoc( eventPosition ).Value = 0 - end if - - PopulateEventList( eventPosition ) - EventListListener() -end sub - - -sub EventOKButton - WriteEventsToDoc() - WriteXMLFromArray() - bindingDialog.endExecute() -end sub - - -sub HelpOKButton() - helpDialog.endExecute() -end sub - diff --git a/scripting/workben/bindings/calckeybinding.xml b/scripting/workben/bindings/calckeybinding.xml deleted file mode 100644 index 665b0a926447..000000000000 --- a/scripting/workben/bindings/calckeybinding.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/calcmenubar.xml b/scripting/workben/bindings/calcmenubar.xml deleted file mode 100644 index e305e5300545..000000000000 --- a/scripting/workben/bindings/calcmenubar.xml +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/workben/bindings/drawkeybinding.xml b/scripting/workben/bindings/drawkeybinding.xml deleted file mode 100644 index 034110583e25..000000000000 --- a/scripting/workben/bindings/drawkeybinding.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/drawmenubar.xml b/scripting/workben/bindings/drawmenubar.xml deleted file mode 100644 index 4f0d1e9d0d93..000000000000 --- a/scripting/workben/bindings/drawmenubar.xml +++ /dev/null @@ -1,369 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/workben/bindings/eventbindings.xml b/scripting/workben/bindings/eventbindings.xml deleted file mode 100644 index 96ce4eece869..000000000000 --- a/scripting/workben/bindings/eventbindings.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/scripting/workben/bindings/impresskeybinding.xml b/scripting/workben/bindings/impresskeybinding.xml deleted file mode 100644 index 0b88c1545820..000000000000 --- a/scripting/workben/bindings/impresskeybinding.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/impressmenubar.xml b/scripting/workben/bindings/impressmenubar.xml deleted file mode 100644 index c0b3a4683853..000000000000 --- a/scripting/workben/bindings/impressmenubar.xml +++ /dev/null @@ -1,344 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/workben/bindings/manifest.xml b/scripting/workben/bindings/manifest.xml deleted file mode 100644 index 18138467ea07..000000000000 --- a/scripting/workben/bindings/manifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/writerkeybinding.xml b/scripting/workben/bindings/writerkeybinding.xml deleted file mode 100644 index ee7996976f12..000000000000 --- a/scripting/workben/bindings/writerkeybinding.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripting/workben/bindings/writermenubar.xml b/scripting/workben/bindings/writermenubar.xml deleted file mode 100644 index ef813de6bfc2..000000000000 --- a/scripting/workben/bindings/writermenubar.xml +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/workben/build.xml b/scripting/workben/build.xml deleted file mode 100644 index 87f2c2f0839e..000000000000 --- a/scripting/workben/build.xml +++ /dev/null @@ -1,387 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripting/workben/data/ExampleSpreadSheetLatest.sxc b/scripting/workben/data/ExampleSpreadSheetLatest.sxc deleted file mode 100644 index 7be6c0d4be05..000000000000 Binary files a/scripting/workben/data/ExampleSpreadSheetLatest.sxc and /dev/null differ diff --git a/scripting/workben/data/doc_with_beanshell_scripts.sxw b/scripting/workben/data/doc_with_beanshell_scripts.sxw deleted file mode 100644 index f0066610d577..000000000000 Binary files a/scripting/workben/data/doc_with_beanshell_scripts.sxw and /dev/null differ diff --git a/scripting/workben/data/doc_with_one_script.sxw b/scripting/workben/data/doc_with_one_script.sxw deleted file mode 100644 index 7445f4afca47..000000000000 Binary files a/scripting/workben/data/doc_with_one_script.sxw and /dev/null differ diff --git a/scripting/workben/data/doc_with_two_scripts.sxw b/scripting/workben/data/doc_with_two_scripts.sxw deleted file mode 100644 index 23a12ac9f86a..000000000000 Binary files a/scripting/workben/data/doc_with_two_scripts.sxw and /dev/null differ diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.protocolhandler.Dispatch.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.protocolhandler.Dispatch.csv deleted file mode 100644 index 614260db95c3..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.protocolhandler.Dispatch.csv +++ /dev/null @@ -1,5 +0,0 @@ -"Dispatch";"drafts::com::sun::star::frame::XDispatchProvider";"queryDispatch()" -"Dispatch";"drafts::com::sun::star::frame::XDispatchProvider";"queryDispatches()" -"Dispatch";"drafts::com::sun::star::frame::XDispatch";"dispatch()" -"Dispatch";"drafts::com::sun::star::frame::XDispatch";"addStatusListener()" -"Dispatch";"drafts::com::sun::star::frame::XDispatch";"removeStatusListener()" diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.Function.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.Function.csv deleted file mode 100644 index 87327525908a..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.Function.csv +++ /dev/null @@ -1 +0,0 @@ -"Function";"drafts::com::sun::star::script::framework::provider::XFunction";"invoke()" diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.FunctionProvider.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.FunctionProvider.csv deleted file mode 100644 index 0f1c41772cfb..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.provider.FunctionProvider.csv +++ /dev/null @@ -1 +0,0 @@ -"FunctionProvider";"drafts::com::sun::star::script::framework::provider::XFunctionProvider";"getFunction()" diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager.csv deleted file mode 100644 index 0bff1a1a89b7..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager.csv +++ /dev/null @@ -1,2 +0,0 @@ -"ScriptRuntimeManager";"drafts::com::sun::star::script::framework::runtime::XScriptNameResolver";"resolve()" -"ScriptRuntimeManager";"drafts::com::sun::star::script::framework::runtime::XScriptInvocation";"invoke()" diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptInfo.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptInfo.csv deleted file mode 100644 index 79e8c91e19c1..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptInfo.csv +++ /dev/null @@ -1,8 +0,0 @@ -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getLogicalName()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getParcelURI()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getLanguage()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getFunctionName()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getLanguageProperties()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getFileSetNames()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getFilesInFileSet()" -"ScriptInfo";"drafts::com::sun::star::script::framework::storage::XScriptInfo";"getDescription()" diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorage.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorage.csv deleted file mode 100644 index 69628462fedb..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorage.csv +++ /dev/null @@ -1,4 +0,0 @@ -"ScriptStorage";"drafts::com::sun::star::script::framework::storage::XScriptInfoAccess";"getScriptLogicalNames()" -"ScriptStorage";"drafts::com::sun::star::script::framework::storage::XScriptInfoAccess";"getImplementations()" -"ScriptStorage";"drafts::com::sun::star::script::framework::storage::XScriptInfoAccess";"getAllImplementations()" -"ScriptStorage";"drafts::com::sun::star::script::framework::storage::XScriptStorageRefresh";"refresh()" diff --git a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorageManager.csv b/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorageManager.csv deleted file mode 100644 index 6e255c869f67..000000000000 --- a/scripting/workben/data/objdsc/drafts.com.sun.star.script.framework.storage.ScriptStorageManager.csv +++ /dev/null @@ -1,6 +0,0 @@ -"ScriptStorageManager";"drafts::com::sun::star::script::framework::storage::XScriptStorageManager";"createScriptStorage()" -"ScriptStorageManager";"drafts::com::sun::star::script::framework::storage::XScriptStorageManager";"createScriptStorageWithURI()" -"ScriptStorageManager";"drafts::com::sun::star::script::framework::storage::XScriptStorageManager";"getScriptStorage()" -"ScriptStorageManager";"drafts::com::sun::star::script::framework::storage::XScriptStorageManager";"refreshScriptStorage()" -"ScriptStorageManager";"drafts::com::sun::star::script::framework::security::XScriptSecurity";"checkPermission()" -"ScriptStorageManager";"::com::sun::star::lang::XEventListener";"disposing()" diff --git a/scripting/workben/data/script_in_class_file.sxw b/scripting/workben/data/script_in_class_file.sxw deleted file mode 100644 index ddb44c14d2d3..000000000000 Binary files a/scripting/workben/data/script_in_class_file.sxw and /dev/null differ diff --git a/scripting/workben/data/script_in_jar_file.sxw b/scripting/workben/data/script_in_jar_file.sxw deleted file mode 100644 index 93b10494d266..000000000000 Binary files a/scripting/workben/data/script_in_jar_file.sxw and /dev/null differ diff --git a/scripting/workben/data/share_scripts.zip b/scripting/workben/data/share_scripts.zip deleted file mode 100644 index 7c7fec622930..000000000000 Binary files a/scripting/workben/data/share_scripts.zip and /dev/null differ diff --git a/scripting/workben/data/testdata/Function.csv b/scripting/workben/data/testdata/Function.csv deleted file mode 100644 index b924c86f4bd6..000000000000 --- a/scripting/workben/data/testdata/Function.csv +++ /dev/null @@ -1,4 +0,0 @@ -_invoke;description=Try to find and invoke a valid user level XFunction;logicalname=script://HighlightText.showForm;expected=success -_invoke;description=Try to invoke a valid beanshell XFunction that returns an Integer;logicalname=script://returns-Integer;returntype=java.lang.Integer;expected=success -_invoke;description=Try to invoke a valid beanshell XFunction that returns a String;logicalname=script://returns-String;returntype=java.lang.String;returnvalue=testing;expected=success -_invoke;description=Try to invoke a valid beanshell XFunction that returns a Frame;logicalname=script://returns-Frame;expected=com.sun.star.uno.RuntimeException diff --git a/scripting/workben/data/testdata/FunctionProvider.csv b/scripting/workben/data/testdata/FunctionProvider.csv deleted file mode 100644 index 88dcfae118e3..000000000000 --- a/scripting/workben/data/testdata/FunctionProvider.csv +++ /dev/null @@ -1 +0,0 @@ -_getFunction;description=Try to get a valid XFunction;logicalname=script://MemoryUtils.MemUsage;expected=XFunction.class diff --git a/scripting/workben/data/testdata/ScriptInfo.csv b/scripting/workben/data/testdata/ScriptInfo.csv deleted file mode 100644 index a5fab2ad5d16..000000000000 --- a/scripting/workben/data/testdata/ScriptInfo.csv +++ /dev/null @@ -1,8 +0,0 @@ -_getLogicalName;description=Try to get a logical name;expected=MemoryUtils.MemUsage -_getParcelURI;description=Try to get a parcel URI;expected=ExampleSpreadSheetLatest.sxc/Scripts/java/MemoryUsage -_getLanguage;description=Try to get language;expected=Java -_getFunctionName;description=Try to get a function name;expected=MemoryUsage.updateMemoryUsage -_getLanguageProperties;description=Try to get language properties;expected=MemUsage.jar -_getFileSetNames;description=Try to get fileset names;expected=delivered -_getFilesInFileSet;description=Try to get files in fileset;expected=google.jar -_getDescription;description=Try to get description;expected=Show JVM memory usage stats diff --git a/scripting/workben/data/testdata/ScriptRuntimeManager.csv b/scripting/workben/data/testdata/ScriptRuntimeManager.csv deleted file mode 100644 index b5d049b5f425..000000000000 --- a/scripting/workben/data/testdata/ScriptRuntimeManager.csv +++ /dev/null @@ -1,8 +0,0 @@ -_resolve;description=Try to resolve a valid document URI;location=script_in_class_file.sxw;logicalname=script://doc.jsuite.testMethod;expected=XScriptInfo.class -_resolve;description=Try to resolve a valid user URI;location=user;logicalname=script://user.jsuite.test;expected=XScriptInfo.class -_resolve;description=Try to resolve a valid share URI;location=share;logicalname=script://share.jsuite.test;expected=XScriptInfo.class -_resolve;description=Try to resolve an invalid URI;location=user;logicalname=scrpit://user.jsuite.test;expected=com.sun.star.lang.IllegalArgumentException -_resolve;description=Try to resolve a valid but non existent URI;location=user;logicalname=script://non.existent.test;expected=null -_invoke;description=Try to invoke a valid user level URI;location=user;context=null;logicalname=script://user.jsuite.test;expected=success -_invoke;description=Try to invoke a valid user level URI with a valid context;location=user;context=xscriptcontext_test_document.sxw;logicalname=script://xscriptcontext.jsuite.test;expected=success -_invoke;description=Try to invoke a valid user level script in a jar file;location=user;context=null;logicalname=script://jarscript.jsuite.test;expected=success diff --git a/scripting/workben/data/testdata/ScriptStorage.csv b/scripting/workben/data/testdata/ScriptStorage.csv deleted file mode 100644 index a5b4589e6f64..000000000000 --- a/scripting/workben/data/testdata/ScriptStorage.csv +++ /dev/null @@ -1,4 +0,0 @@ -_getScriptLogicalNames;description=Try to get logical names;expected=MemoryUtils.MemUsage -_getImplementations;description=Try to get a valid implementation;logicalname=script://MemoryUtils.MemUsage?location=document;expected=MemoryUtils.MemUsage -_getAllImplementations;description=Try to get all valid implementations;location=doc_with_beanshell_scripts.sxw;expected=returns-Integer,returns-String,returns-Frame -_refresh;description=Try calling refresh;expected=success diff --git a/scripting/workben/data/testdata/ScriptStorageManager.csv b/scripting/workben/data/testdata/ScriptStorageManager.csv deleted file mode 100644 index 9dc2a9b67bf2..000000000000 --- a/scripting/workben/data/testdata/ScriptStorageManager.csv +++ /dev/null @@ -1,18 +0,0 @@ -_createScriptStorage;description=Try to create a ScriptStorage;expected=success -_createScriptStorageWithURI;description=Try to create a document ScriptStorage;location=script_in_class_file.sxw;expected=XScriptInfoAccess.class -_getScriptStorage;description=Try to get application share ScriptStorage;location=share;expected=XScriptInfoAccess.class -_getScriptStorage;description=Try to get application user ScriptStorage;location=user;expected=XScriptInfoAccess.class -_refreshScriptStorage;description=Try to refresh non-existent ScriptStorage;location=non-existent;expected=success -_refreshScriptStorage;description=Try to refresh valid document ScriptStorage;location=script_in_class_file.sxw;expected=success -_checkPermission;description=Try to get permssion when run macro is set to never;location=check_perms_file1.sxw;runmacro=never;pathlist=false;confirm=false;warning=false;dialog=false;checkbox=false;buttonName=Run;checkpath=false;expected=com.sun.star.security.AccessControlException -_checkPermission;description=Try to get permssion when run macro is set to always, and no warning dialog;location=check_perms_file2.sxw;runmacro=always;pathlist=false;confirm=false;warning=false;dialog=false;checkbox=false;buttonName=Run;checkpath=false;expected=true -_checkPermission;description=Try to get permssion when run macro is set to always, warning dialog, and run button pressed;location=check_perms_file3.sxw;runmacro=always;pathlist=false;confirm=false;warning=true;dialog=true;checkbox=false;buttonName=Run;checkpath=false;expected=true -_checkPermission;description=Try to get permssion when run macro is set to always, warning dialog, and do not run button pressed;location=check_perms_file4.sxw;runmacro=always;pathlist=false;confirm=false;warning=true;dialog=true;checkbox=false;buttonName=Do Not Run;checkpath=false;expected=com.sun.star.security.AccessControlException -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc in path, no warning dialog, and no confirmation;location=check_perms_file5.sxw;runmacro=pathlist;pathlist=true;confirm=false;warning=false;dialog=false;checkbox=false;buttonName=Do Not Run;checkpath=false;expected=true -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc not in path, no warning dialog, and no confirmation;location=check_perms_file6.sxw;runmacro=pathlist;pathlist=false;confirm=false;warning=false;dialog=false;checkbox=false;buttonName=Do Not Run;checkpath=false;expected=com.sun.star.security.AccessControlException -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc in path, warning dialog, run button pressed;location=check_perms_file7.sxw;runmacro=pathlist;pathlist=true;confirm=false;warning=true;dialog=true;checkbox=false;buttonName=Run;checkpath=false;expected=true -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc in path, warning dialog, do not run button pressed;location=check_perms_file8.sxw;runmacro=pathlist;pathlist=true;confirm=false;warning=true;dialog=true;checkbox=false;buttonName=Do Not Run;checkpath=false;expected=com.sun.star.security.AccessControlException -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc not in path, warning dialog, confirm dialog, checkbox not checked, run button pressed;location=check_perms_file9.sxw;runmacro=pathlist;pathlist=false;confirm=true;warning=true;dialog=true;checkbox=false;buttonName=Run;checkpath=true;expected=true -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc not in path, warning dialog, confirm dialog, checkbox checked, run button pressed;location=check_perms_file10.sxw;runmacro=pathlist;pathlist=true;confirm=true;warning=true;dialog=true;checkbox=true;buttonName=Run;checkpath=true;expected=true -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc not in path, warning dialog, confirm dialog, checkbox not checked, do not run button pressed;location=check_perms_file11.sxw;runmacro=pathlist;pathlist=false;confirm=true;warning=true;dialog=true;checkbox=false;buttonName=Do Not Run;checkpath=true;expected=com.sun.star.security.AccessControlException -_checkPermission;description=Try to get permssion when run macro is set to according to path list, doc not in path, warning dialog, confirm dialog, checkbox checked, do not run button pressed;location=check_perms_file12.sxw;runmacro=pathlist;pathlist=false;confirm=true;warning=true;dialog=true;checkbox=true;buttonName=Do Not Run;checkpath=true;expected=com.sun.star.security.AccessControlException diff --git a/scripting/workben/data/user_scripts.zip b/scripting/workben/data/user_scripts.zip deleted file mode 100644 index f5eed7657365..000000000000 Binary files a/scripting/workben/data/user_scripts.zip and /dev/null differ diff --git a/scripting/workben/data/xscriptcontext_test_document.sxw b/scripting/workben/data/xscriptcontext_test_document.sxw deleted file mode 100644 index da6dafb0b805..000000000000 Binary files a/scripting/workben/data/xscriptcontext_test_document.sxw and /dev/null differ diff --git a/scripting/workben/ifc/scripting/ScriptingUtils.java b/scripting/workben/ifc/scripting/ScriptingUtils.java deleted file mode 100644 index 03ef3f5ca680..000000000000 --- a/scripting/workben/ifc/scripting/ScriptingUtils.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.storage.XScriptStorageManager; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XComponentContext; - -public class ScriptingUtils { - private XScriptStorageManager storageManager; - private static ScriptingUtils utils; - - private ScriptingUtils() { - } - - public static synchronized ScriptingUtils getDefault() { - if (utils == null) - utils = new ScriptingUtils(); - - return utils; - } - - - - - - public Object getScriptStorage(XMultiServiceFactory xMSF, String location) { - int id = getStorageId(xMSF, location); - return storageManager.getScriptStorage(id); - } - - private int getStorageId(XMultiServiceFactory xMSF, String location) { - - if (location.equals("share")) - return 0; - - if (location.equals("user")) - return 1; - - XSimpleFileAccess access = null; - String uri = util.utils.getFullTestURL(location); - - if (storageManager == null) { - try { - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, xMSF); - - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); - - XInterface ifc = (XInterface) - xContext.getValueByName("/singletons/drafts.com.sun.star." + - "script.framework.storage.theScriptStorageManager"); - - storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); - } catch (Exception e) { - return -1; - } - } - - access = getXSimpleFileAccess(xMSF); - - if (access == null) - return -1; - - int id = storageManager.createScriptStorageWithURI(access, uri); - - return id; - } - - private XSimpleFileAccess getXSimpleFileAccess(XMultiServiceFactory xMSF) { - XSimpleFileAccess access = null; - - try { - Object fa = - xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); - } catch (com.sun.star.uno.Exception e) { - return null; - } - - return access; - } -} diff --git a/scripting/workben/ifc/scripting/SecurityDialogUtil.java b/scripting/workben/ifc/scripting/SecurityDialogUtil.java deleted file mode 100644 index 349b70bfa24f..000000000000 --- a/scripting/workben/ifc/scripting/SecurityDialogUtil.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -package ifc.scripting; - -import com.sun.star.awt.*; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; - -import com.sun.star.accessibility.*; -import com.sun.star.awt.XExtendedToolkit; - -// Jsuite classes -import util.AccessibilityTools; -/** -* Thread that pushes the buttons or checkbox -* on the message box that is on top. -*/ -public class SecurityDialogUtil extends Thread { - - private XMultiServiceFactory xMSF = null; - private String errorMsg; - private String btnName; - private boolean checkBox; - - /** - * Constructor. - */ - public SecurityDialogUtil(XMultiServiceFactory xMSF, String btnName, - boolean checkBox) { - this.xMSF = xMSF; - this.btnName = btnName; - this.checkBox = checkBox; - this.errorMsg = ""; - } - - /** - * Returns the error message that occurred while - * accessing and pressing the button. - * @return Error message. - */ - public String getErrorMessage() { - return errorMsg; - } - - - - /** - * Press the named button in the currently visible dialog box. - */ - @Override - public void run() { - // wait for the message box to appear - try { - Thread.sleep(4000) ; - } catch (InterruptedException e) { - System.err.println("While waiting :" + e.getMessage()) ; - } - - // access the message box - - XAccessibleContext xCon = null; - - try { - XInterface x = (XInterface) xMSF.createInstance( - "com.sun.star.awt.Toolkit") ; - XExtendedToolkit tk = - UnoRuntime.queryInterface( - XExtendedToolkit.class, x); - new AccessibilityTools(); - XWindow xWindow = UnoRuntime.queryInterface( - XWindow.class, tk.getActiveTopWindow()); - XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); - xCon = xRoot.getAccessibleContext(); - } catch (Exception e) { - errorMsg = "Exception while using Accessibility\n" + - e.getMessage(); - return; - } - - // get the button - XInterface oObj = null; - - try { - int count = xCon.getAccessibleChildCount(); - - for (int i = 0; i < count; i++) { - XAccessible xAcc = xCon.getAccessibleChild(i); - String name = - xAcc.getAccessibleContext().getAccessibleName(); - - // check for button - if (name.equals(btnName) && (UnoRuntime.queryInterface( - XButton.class, xAcc) != null)) { - oObj = xAcc.getAccessibleContext(); - } - - // check for checkbox - if (checkBox && (UnoRuntime.queryInterface(XCheckBox.class, xAcc) != null)) { - // want to do this action now - // probably equates to toggle cb - XAccessibleAction xAction = - UnoRuntime.queryInterface( - XAccessibleAction.class, xAcc.getAccessibleContext()); - xAction.doAccessibleAction(0); - - // might be worth using oObj2 to double check the new state?? - } - } - - if (oObj == null) { - errorMsg = "No button has been found:\n" + - "No action is triggered."; - return; - } - - // press button - XAccessibleAction xAction = - UnoRuntime.queryInterface( - XAccessibleAction.class, oObj); - xAction.doAccessibleAction(0); - } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - errorMsg = "Exception\n" + - e.getMessage(); - } - } - -} - - - - diff --git a/scripting/workben/ifc/scripting/_XFunction.java b/scripting/workben/ifc/scripting/_XFunction.java deleted file mode 100644 index 31c1742b2d8b..000000000000 --- a/scripting/workben/ifc/scripting/_XFunction.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.provider.XFunction; -import drafts.com.sun.star.script.framework.provider.XFunctionProvider; - -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -import java.util.Collection; -import java.util.Iterator; - -public class _XFunction extends MultiMethodTest { - - public XFunction oObj = null; - public XFunctionProvider oProvider = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - log.println("getting provider"); - oProvider = (XFunctionProvider) tEnv.getObjRelation("provider"); - - if (oProvider == null) - log.println("it's null"); - else - log.println("it's not null"); - } - - public void _invoke() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_invoke"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runInvokeTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("invoke()", result); - } - - private boolean runInvokeTest(Parameters testdata) { - String description = testdata.get("description"); - String logicalname = testdata.get("logicalname"); - - String expreturntype = testdata.get("returntype"); - String expreturnvalue = testdata.get("returnvalue"); - String gotreturntype = "null"; - String gotreturnvalue = "null"; - - String location = testdata.get("location"); - - String expected = testdata.get("expected"); - String output = ""; - boolean result = true; - - log.println(testdata.get("description")); - - try { - Object[] aParams = new Object[0]; - short[][] aOutParamIndex = new short[1][]; - aOutParamIndex[0] = new short[0]; - Object[][] aOutParam = new Object[1][]; - aOutParam[0] = new Object[0]; - - XFunction func = oProvider.getFunction(logicalname); - - if (func == null) { - log.println("Couldn't get XFunction for:" + logicalname); - return false; - } - - Object ret = func.invoke(aParams, aOutParamIndex, aOutParam); - - if (ret != null) { - gotreturntype = ret.getClass().getName(); - gotreturnvalue = ret.toString(); - } - - output = "success"; - } catch (com.sun.star.lang.IllegalArgumentException iae) { - log.println("Couldn't invoke script:" + iae); - output = "com.sun.star.lang.IllegalArgumentException"; - } catch (com.sun.star.script.CannotConvertException cce) { - log.println("Couldn't invoke script:" + cce); - output = "com.sun.star.script.CannotConvertException"; - } catch (com.sun.star.reflection.InvocationTargetException ite) { - log.println("Couldn't invoke script:" + ite); - output = "com.sun.star.reflection.InvocationTargetException"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Couldn't invoke script:" + re); - output = "com.sun.star.uno.RuntimeException"; - } catch (java.lang.Exception e) { - log.println("Couldn't invoke script:" + e); - output = "java.lang.Exception"; - } - - if (expreturntype != null) { - log.println("expected return type: " + expreturntype + - ", got return type: " + gotreturntype); - - if (!gotreturntype.equals(expreturntype)) - result = false; - } - - if (expreturnvalue != null) { - log.println("expected return value: " + expreturnvalue + - ", got return value: " + gotreturnvalue); - - if (!gotreturnvalue.equals(expreturnvalue)) - result = false; - } - - log.println("expected: " + expected + ", output: " + output); - - if (!output.equals(expected)) - result = false; - - return result; - } -} diff --git a/scripting/workben/ifc/scripting/_XFunctionProvider.java b/scripting/workben/ifc/scripting/_XFunctionProvider.java deleted file mode 100644 index a8bfbca6b687..000000000000 --- a/scripting/workben/ifc/scripting/_XFunctionProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.provider.XFunctionProvider; -import drafts.com.sun.star.script.framework.provider.XFunction; - -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -import java.util.Collection; -import java.util.Iterator; - -public class _XFunctionProvider extends MultiMethodTest { - - public XFunctionProvider oObj = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - public void _getFunction() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getFunction"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runGetFunctionTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("getFunction()", result); - } - - private boolean runGetFunctionTest(Parameters testdata) { - String description = testdata.get("description"); - String logicalname = testdata.get("logicalname"); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - XFunction function = oObj.getFunction(logicalname); - - if (function == null) - output = "null"; - else - output = "XFunction.class"; - - log.println("expected: " + expected + ", output: " + output); - return (output.equals(expected)); - } -} diff --git a/scripting/workben/ifc/scripting/_XScriptInfo.java b/scripting/workben/ifc/scripting/_XScriptInfo.java deleted file mode 100644 index 8e1cff6bf5ea..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptInfo.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.storage.XScriptInfo; - -import com.sun.star.beans.XPropertySet; - -import java.util.Collection; -import java.util.Iterator; - -import lib.Parameters; -import lib.MultiMethodTest; -import lib.StatusException; - -public class _XScriptInfo extends MultiMethodTest { - - public XScriptInfo oObj = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - public void _getLogicalName() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getLogicalName"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - output = oObj.getLogicalName(); - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - } else { - result = false; - } - - tRes.tested("getLogicalName()", result); - } - - public void _getParcelURI() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getParcelURI"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - output = oObj.getParcelURI(); - - log.println("expected: " + expected + ", output: " + output); - result &= output.endsWith(expected); - } - } else { - result = false; - } - - tRes.tested("getParcelURI()", result); - } - - public void _getLanguage() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getLanguage"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - output = oObj.getLanguage(); - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - } else { - result = false; - } - - tRes.tested("getLanguage()", result); - } - - public void _getFunctionName() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getFunctionName"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - output = oObj.getFunctionName(); - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - } else { - result = false; - } - - tRes.tested("getFunctionName()", result); - } - - public void _getLanguageProperties() { - - Collection c = - (Collection) tEnv.getObjRelation("_getLanguageProperties"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - try { - XPropertySet langProps = oObj.getLanguageProperties(); - output = (String)langProps.getPropertyValue("classpath"); - - if (output == null) - output = "null"; - } catch (com.sun.star.uno.Exception e) { - log.println("caught UNO Exception:" + e); - output = "com.sun.star.uno.Exception"; - } - - log.println("expected: " + expected + ", output: " + output); - } - } - - tRes.tested("getLanguageProperties()", true); - } - - public void _getFileSetNames() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getFileSetNames"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - String[] fileSets = oObj.getFileSetNames(); - - if (fileSets == null) - output = "null"; - else if (fileSets.length != 1) - output = "WrongNumberOfFileSets"; - else - output = fileSets[0]; - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - } else { - result = false; - } - - tRes.tested("getFileSetNames()", result); - } - - public void _getFilesInFileSet() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getFilesInFileSet"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - String[] filesInFileSet = - oObj.getFilesInFileSet(oObj.getFileSetNames()[0]); - - if (filesInFileSet == null) - output = "null"; - else if (filesInFileSet.length != 1) - output = "WrongNumberOfFilesInFileSet"; - else - output = filesInFileSet[0]; - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - } else { - result = false; - } - - tRes.tested("getFilesInFileSet()", result); - } - - public void _getDescription() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getDescription"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - output = oObj.getDescription(); - - if (output == null) - output = "null"; - else if (output.length() == 0) - output = "empty"; - - log.println("expected: [" + expected + "], output: [" + - output + "]"); - result &= output.equals(expected); - } - } else { - result = false; - } - - tRes.tested("getDescription()", result); - } -} diff --git a/scripting/workben/ifc/scripting/_XScriptInfoAccess.java b/scripting/workben/ifc/scripting/_XScriptInfoAccess.java deleted file mode 100644 index bf2095635fdb..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptInfoAccess.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.storage.XScriptInfoAccess; -import drafts.com.sun.star.script.framework.storage.XScriptInfo; - -import com.sun.star.uno.UnoRuntime; -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -import java.util.Collection; -import java.util.Iterator; - -public class _XScriptInfoAccess extends MultiMethodTest { - - public XScriptInfoAccess oObj = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - public void _getScriptLogicalNames() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getScriptLogicalNames"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runGetScriptLogicalNamesTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("getScriptLogicalNames()", result); - } - - private boolean runGetScriptLogicalNamesTest(Parameters testdata) { - String description = testdata.get("description"); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - log.println("In _XScriptInfoAccess.getScriptLogicalNames()"); - String[] logicalNames = oObj.getScriptLogicalNames(); - - if (logicalNames == null) - output = "null"; - else if (logicalNames.length == 0) - output = "empty"; - else { - for (int i = 0; i < logicalNames.length; i++) { - if (logicalNames[i].equals(expected)) { - output = logicalNames[i]; - break; - } - } - } - - log.println("expected: " + expected + ", output: " + output); - return (output.equals(expected)); - } - - public void _getImplementations() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getImplementations"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runGetImplementationsTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("getImplementations()", result); - } - - private boolean runGetImplementationsTest(Parameters testdata) { - String description = testdata.get("description"); - String logicalname = testdata.get("logicalname"); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - // performs a basic check to see if 1 match (XScriptInfo) is returned - // the XScriptInfo object is tested more completely in _XScriptInfo - // which is drive from ScriptInfo - - try { - XScriptInfo[] impls = oObj.getImplementations(logicalname); - - // should only be one match - if (impls == null) - output = "null"; - else if (impls.length == 0) - output = "empty"; - else - output = impls[0].getLogicalName(); - } catch (com.sun.star.uno.Exception e) { - log.println("Caught UNO Exception:" + e); - output = "com.sun.star.uno.Exception"; - } - - log.println("expected: " + expected + ", output: " + output); - return (output.equals(expected)); - } - - public void _getAllImplementations() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getAllImplementations"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runGetAllImplementationsTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("getAllImplementations()", result); - } - - private boolean runGetAllImplementationsTest(Parameters testdata) { - String description = testdata.get("description"); - String location = testdata.get("location"); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - Object obj = ScriptingUtils.getDefault().getScriptStorage( - tParam.getMSF(), location); - - XScriptInfoAccess access = UnoRuntime.queryInterface(XScriptInfoAccess.class, - obj); - - XScriptInfo[] impls = access.getAllImplementations(); - - if (impls == null || impls.length == 0) { - output = "empty"; - } else { - for (int i = 0; i < impls.length - 1; i++) - output += impls[i].getLogicalName() + ","; - - output += impls[impls.length - 1].getLogicalName(); - } - - log.println("expected: " + expected + ", output: " + output); - return (output.equals(expected)); - } -} diff --git a/scripting/workben/ifc/scripting/_XScriptInvocation.java b/scripting/workben/ifc/scripting/_XScriptInvocation.java deleted file mode 100644 index 06c76e75ba06..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptInvocation.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Collection; - -import drafts.com.sun.star.script.framework.runtime.XScriptInvocation; -import drafts.com.sun.star.script.framework.storage.XScriptStorageManager; - -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.frame.XModel; - -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; -import util.SOfficeFactory; - -public class _XScriptInvocation extends MultiMethodTest { - - public XScriptInvocation oObj = null; - private XScriptStorageManager storageManager = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - @Override - public void after() throws StatusException { - } - - public void _invoke() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_invoke"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runInvokeTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("invoke()", result); - } - - private boolean runInvokeTest(Parameters testdata) { - String description = testdata.get("description"); - String logicalname = testdata.get("logicalname"); - String context = testdata.get("context"); - String location = testdata.get("location"); - String expected = testdata.get("expected"); - String output = ""; - - int storageId = getStorageId(location); - - XModel ctx = null; - - if (!context.equals("null")) - ctx = loadDocument(context); - - HashMap map = new HashMap(); - map.put("SCRIPTING_DOC_STORAGE_ID", Integer.valueOf(storageId)); - map.put("SCRIPTING_DOC_URI", "hahaha"); - - if (ctx != null) - map.put("SCRIPTING_DOC_REF", ctx); - - Parameters params = new Parameters(map); - Object[] args = new Object[0]; - - Object[][] result = new Object[1][0]; - result[0] = new Object[0]; - - short[][] num = new short[1][0]; - num[0] = new short[0]; - - log.println(description + ": " + logicalname); - - try { - Object ret = oObj.invoke(logicalname, params, args, num, result); - log.println("return type is: " + ret.getClass().getName() + - ", value is: " + ret.toString()); - output = "success"; - } catch (com.sun.star.lang.IllegalArgumentException iae) { - log.println("Couldn't invoke script:" + iae); - output = "com.sun.star.lang.IllegalArgumentException"; - } catch (com.sun.star.script.CannotConvertException cce) { - log.println("Couldn't invoke script:" + cce); - output = "com.sun.star.script.CannotConvertException"; - } catch (com.sun.star.reflection.InvocationTargetException ite) { - log.println("Couldn't invoke script:" + ite); - output = "com.sun.star.reflection.InvocationTargetException"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Couldn't invoke script:" + re); - output = "com.sun.star.uno.RuntimeException"; - } - - if (ctx != null) - ctx.dispose(); - - log.println("expected: " + expected + ", output: " + output); - return (output.equals(expected)); - } - - private int getStorageId(String location) { - - if (location.equals("share")) - return 0; - - if (location.equals("user")) - return 1; - - XSimpleFileAccess access = null; - String uri = util.utils.getFullTestURL(location); - - if (storageManager == null) { - try { - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, tParam.getMSF()); - - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); - - XInterface ifc = (XInterface) - xContext.getValueByName("/singletons/drafts.com.sun.star." + - "script.framework.storage.theScriptStorageManager"); - - storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); - } catch (Exception e) { - return -1; - } - } - - access = getXSimpleFileAccess(); - - if (access == null) - return -1; - - int id = storageManager.createScriptStorageWithURI(access, uri); - - return id; - } - - private XSimpleFileAccess getXSimpleFileAccess() { - XSimpleFileAccess access = null; - - try { - Object fa = tParam.getMSF().createInstance( - "com.sun.star.ucb.SimpleFileAccess"); - - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); - } catch (com.sun.star.uno.Exception e) { - return null; - } - - return access; - } - - private XModel loadDocument(String name) { - XModel model = null; - SOfficeFactory factory = SOfficeFactory.getFactory(tParam.getMSF()); - - String fullname = util.utils.getFullTestURL(name); - - try { - Object obj = factory.loadDocument(fullname); - model = UnoRuntime.queryInterface(XModel.class, obj); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - return null; - } catch (Exception e) { - return null; - } - - try { - Thread.sleep(5000); - } catch (InterruptedException ie) { - } - - return model; - } -} diff --git a/scripting/workben/ifc/scripting/_XScriptNameResolver.java b/scripting/workben/ifc/scripting/_XScriptNameResolver.java deleted file mode 100644 index 851ed9c936e5..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptNameResolver.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Collection; - -import drafts.com.sun.star.script.framework.runtime.XScriptNameResolver; -import drafts.com.sun.star.script.framework.storage.XScriptInfo; -import drafts.com.sun.star.script.framework.storage.XScriptStorageManager; - -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; - -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -public class _XScriptNameResolver extends MultiMethodTest { - - public XScriptNameResolver oObj = null; - private XScriptStorageManager storageManager = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - public void _resolve() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_resolve"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runResolveTest((Parameters)tests.next()); - } - } else { - result = false; - } - - tRes.tested("resolve()", result); - } - - private boolean runResolveTest(Parameters data) { - String description = data.get("description"); - String location = data.get("location"); - String logicalname = data.get("logicalname"); - String expected = data.get("expected"); - String output = ""; - - int storageId = getStorageId(location); - - log.println(description + ": " + logicalname); - - HashMap map = new HashMap(); - map.put("SCRIPTING_DOC_STORAGE_ID", Integer.valueOf(storageId)); - map.put("SCRIPTING_DOC_URI", util.utils.getFullTestURL(location)); - - Parameters params = new Parameters(map); - Object[] args = new Object[] {params}; - - try { - XInterface ifc = (XInterface) oObj.resolve(logicalname, args); - - if (ifc == null) - output = "null"; - else if (UnoRuntime.queryInterface(XScriptInfo.class, ifc) == null) - output = "null"; - else - output = "XScriptInfo.class"; - } catch (com.sun.star.lang.IllegalArgumentException iae) { - log.println("caught IllegalArgumentException: " + iae); - output = "com.sun.star.lang.IllegalArgumentException"; - } catch (com.sun.star.script.CannotConvertException cce) { - log.println("caught CannotConvertException: " + cce); - output = "com.sun.star.script.CannotConvertException"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("caught RuntimeException: " + re); - output = "com.sun.star.uno.RuntimeException"; - } - - log.println("expected: " + expected + ", output: " + output); - return (output.equals(expected)); - } - - private int getStorageId(String location) { - - if (location.equals("share")) - return 0; - - if (location.equals("user")) - return 1; - - XSimpleFileAccess access = null; - String uri = util.utils.getFullTestURL(location); - - if (storageManager == null) { - try { - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, tParam.getMSF()); - - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); - - XInterface ifc = (XInterface) - xContext.getValueByName("/singletons/drafts.com.sun.star." + - "script.framework.storage.theScriptStorageManager"); - - storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); - } catch (Exception e) { - return -1; - } - } - - access = getXSimpleFileAccess(); - - if (access == null) - return -1; - - int id = storageManager.createScriptStorageWithURI(access, uri); - - return id; - } - - private XSimpleFileAccess getXSimpleFileAccess() { - XSimpleFileAccess access = null; - - try { - Object fa = tParam.getMSF().createInstance( - "com.sun.star.ucb.SimpleFileAccess"); - - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); - } catch (com.sun.star.uno.Exception e) { - return null; - } - - return access; - } -} diff --git a/scripting/workben/ifc/scripting/_XScriptSecurity.java b/scripting/workben/ifc/scripting/_XScriptSecurity.java deleted file mode 100644 index f06d4288a6c4..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptSecurity.java +++ /dev/null @@ -1,353 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import java.util.Iterator; -import java.util.Collection; - -import drafts.com.sun.star.script.framework.security.XScriptSecurity; -import drafts.com.sun.star.script.framework.storage.XScriptStorageManager; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.PropertyValue; -import com.sun.star.uno.XComponentContext; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.container.XNameReplace; -import com.sun.star.util.XChangesBatch; -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -public class _XScriptSecurity extends MultiMethodTest { - - public XScriptSecurity oObj = null; - private XScriptStorageManager storageManager = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - @Override - public void after() throws StatusException { - } - - public void _checkPermission() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_checkPermission"); - - Iterator tests; - - if (c != null) { - tests = c.iterator(); - - while (tests.hasNext()) { - result &= runCheckPermissionTest((Parameters)tests.next()); - } - } else { - result = false; - } - - // set security to always without confirmation dialog and empty path - // list so other tests can run without dialog popping up - setSecurity(2, "false", "false", null); - - tRes.tested("checkPermission()", result); - } - - private boolean runCheckPermissionTest(Parameters testdata) { - // description of test - String description = testdata.get("description"); - - // document location - String location = testdata.get("location"); - - //security settings - String runmacro = testdata.get("runmacro"); - String confirm = testdata.get("confirm"); - String warning = testdata.get("warning"); - String pathlist = testdata.get("pathlist"); - - //do this test produce a dialog? - String dialog = testdata.get("dialog"); - //is checkbox to be ticked? - String checkBoxStr = testdata.get("checkbox"); - //name of button in dialog to press - String buttonName = testdata.get("buttonName"); - - //expected result - String expected = testdata.get("expected"); - //do we need to check the pathlist? - String checkpath = testdata.get("checkpath"); - - String output = null; - - log.println(description); - - // get the officeBasic setting - int officeBasic = 0; - - if (runmacro.equals("never")) { - officeBasic = 0; - } else if (runmacro.equals("pathlist")) { - officeBasic = 1; - } else if (runmacro.equals("always")) { - officeBasic = 2; - } - - // should pathlist include doc? - String secureURLs = null; - - if (pathlist.equals("true")) { - String uri = util.utils.getFullTestURL(location); - secureURLs = uri.substring(0, uri.lastIndexOf('/')); - } - - if (!setSecurity(officeBasic, confirm, warning, secureURLs)) { - log.println("failed to set security"); - return false; - } - - if (dialog.equals("true")) { - // is the checkbox to be ticked? - boolean checkBox = false; - - if (checkBoxStr.equals("true")) { - checkBox = true; - } - - new SecurityDialogUtil(tParam.getMSF(), buttonName, checkBox).start(); - } - - // need to set up dialog utils thread first - int storageId = getStorageId(location); - - try { - String uri = util.utils.getFullTestURL(location); - oObj.checkPermission(uri, "execute"); - output = "true"; - } catch (com.sun.star.security.AccessControlException ace) { - log.println("Couldn't invoke script:" + ace); - output = "com.sun.star.security.AccessControlException"; - } catch (com.sun.star.lang.IllegalArgumentException iae) { - log.println("Couldn't invoke script:" + iae); - output = "com.sun.star.lang.IllegalArgumentException"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Couldn't invoke script:" + re); - output = "com.sun.star.uno.RuntimeException"; - } - - log.println("expected: " + expected + ", output: " + output); - - if (output.equals(expected)) { - if (checkpath.equals("true")) { - String setPath = getPathList(); - String expectedPath = "empty"; - - if (checkBoxStr.equals("true")) { - String uri = util.utils.getFullTestURL(location); - expectedPath = uri.substring(0, uri.lastIndexOf('/')); - } - - log.println("pathlist: expected: " + expectedPath + ", output: " + setPath); - return setPath.equals(expectedPath); - } - - return true; - } else - return false; - } - - private String getPathList() { - String result = ""; - - try { - Object oProv = tParam.getMSF().createInstance( - "com.sun.star.configuration.ConfigurationProvider"); - - XMultiServiceFactory xProv = UnoRuntime.queryInterface( - XMultiServiceFactory.class, oProv); - - //the path to the security settings in the registry - PropertyValue aPathArg = new PropertyValue(); - aPathArg.Name = "nodepath"; - aPathArg.Value = "org.openoffice.Office.Common/Security/Scripting"; - // we don't want to cache the write - PropertyValue aModeArg = new PropertyValue(); - aModeArg.Name = "lazywrite"; - aModeArg.Value = Boolean.FALSE; - - Object[] aArgs = new Object[2]; - aArgs[0] = aPathArg; - aArgs[1] = aModeArg; - Object oConfigUpdate = xProv.createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", - aArgs); - XPropertySet xPropertySet = UnoRuntime.queryInterface( - XPropertySet.class, oConfigUpdate); - - String[] paths = (String[])xPropertySet.getPropertyValue("SecureURL"); - - if (paths == null || paths.length == 0) - result = "empty"; - else - result = paths[0]; - - } catch (Exception e) { - result = e.getClass().getName() + " getting list of secure URLs"; - } - - return result; - } - - private boolean setSecurity(int officeBasic, String confirm, - String warning, String secureURLs) { - boolean success = false; - - try { - Object oProv = tParam.getMSF().createInstance( - "com.sun.star.configuration.ConfigurationProvider"); - - XMultiServiceFactory xProv = UnoRuntime.queryInterface( - XMultiServiceFactory.class, oProv); - - //the path to the security settings in the registry - PropertyValue aPathArg = new PropertyValue(); - aPathArg.Name = "nodepath"; - aPathArg.Value = "org.openoffice.Office.Common/Security/Scripting"; - // we don't want to cache the write - PropertyValue aModeArg = new PropertyValue(); - aModeArg.Name = "lazywrite"; - aModeArg.Value = Boolean.FALSE; - - Object[] aArgs = new Object[2]; - aArgs[0] = aPathArg; - aArgs[1] = aModeArg; - Object oConfigUpdate = xProv.createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationUpdateAccess", - aArgs); - XNameReplace xNameReplace = UnoRuntime.queryInterface( - XNameReplace.class, oConfigUpdate); - XChangesBatch xChangesBatch = UnoRuntime.queryInterface( - XChangesBatch.class, oConfigUpdate); - - Object[] aSecureURLs; - - if (secureURLs == null) { - aSecureURLs = new Object[0]; - } else { - aSecureURLs = new Object[1]; - aSecureURLs[0] = secureURLs; - } - - log.println("setting SecureURL"); - xNameReplace.replaceByName("SecureURL", aSecureURLs); - - log.println("setting OfficeBasic"); - xNameReplace.replaceByName("OfficeBasic", Integer.valueOf(officeBasic)); - - Boolean bConfirm = null; - - if ((confirm != null) && (confirm.equals("true"))) { - bConfirm = Boolean.TRUE; - } else { - bConfirm = Boolean.FALSE; - } - - log.println("setting Confirmation"); - xNameReplace.replaceByName("Confirmation", bConfirm); - - Boolean bWarning = null; - - if ((warning != null) && (warning.equals("true"))) { - bWarning = Boolean.TRUE; - } else { - bWarning = Boolean.FALSE; - } - - log.println("setting Warning"); - xNameReplace.replaceByName("Warning", bWarning); - - // and now commit the changes - xChangesBatch.commitChanges(); - success = true; - } catch (Exception e) { - log.println("Error updating security settings: " + - e.getMessage()); - } - - return success; - } - - private int getStorageId(String location) { - - XSimpleFileAccess access = null; - String uri = util.utils.getFullTestURL(location); - - if (storageManager == null) { - try { - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, tParam.getMSF()); - - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); - - XInterface ifc = (XInterface) - xContext.getValueByName("/singletons/drafts.com.sun.star." + - "script.framework.storage.theScriptStorageManager"); - - storageManager = UnoRuntime.queryInterface(XScriptStorageManager.class, ifc); - } catch (Exception e) { - return -1; - } - } - - access = getXSimpleFileAccess(); - - if (access == null) - return -1; - - int id = storageManager.createScriptStorageWithURI(access, uri); - - return id; - } - - private XSimpleFileAccess getXSimpleFileAccess() { - XSimpleFileAccess access = null; - - try { - Object fa = tParam.getMSF().createInstance( - "com.sun.star.ucb.SimpleFileAccess"); - - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); - } catch (com.sun.star.uno.Exception e) { - return null; - } - - return access; - } - -} diff --git a/scripting/workben/ifc/scripting/_XScriptStorageManager.java b/scripting/workben/ifc/scripting/_XScriptStorageManager.java deleted file mode 100644 index 0e300317cb60..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptStorageManager.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.storage.XScriptStorageManager; -import drafts.com.sun.star.script.framework.storage.XScriptInfoAccess; - -import java.util.Iterator; -import java.util.Collection; - -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XInterface; -import com.sun.star.ucb.XSimpleFileAccess; -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -public class _XScriptStorageManager extends MultiMethodTest { - - public XScriptStorageManager oObj = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - public void _createScriptStorage() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_createScriptStorage"); - - if (c == null) { - tRes.tested("createScriptStorage()", false); - return; - } - - Iterator tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - XSimpleFileAccess access = getXSimpleFileAccess(); - - if (access == null) { - output = "Couldn't create XSimpleFileAccess"; - } else { - try { - int id = oObj.createScriptStorage(access); - output = "success"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Exception from createScriptStorage: " + re); - output = "com.sun.star.uno.RuntimeException"; - } - } - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - - tRes.tested("createScriptStorage()", result); - } - - public void _createScriptStorageWithURI() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_createScriptStorageWithURI"); - - if (c == null) { - tRes.tested("createScriptStorageWithURI()", false); - return; - } - - Iterator tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String location = testdata.get("location"); - String output = ""; - - log.println(testdata.get("description")); - - String uri = util.utils.getFullTestURL(location); - XSimpleFileAccess access = getXSimpleFileAccess(); - - try { - int id = oObj.createScriptStorageWithURI(access, uri); - - XInterface ifc = (XInterface)oObj.getScriptStorage(id); - - if (ifc == null) - output = "null"; - else { - Object info = UnoRuntime.queryInterface( - XScriptInfoAccess.class, ifc); - - if (info == null) - output = "null"; - else - output = "XScriptInfoAccess.class"; - } - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Caught RuntimeException: " + re); - output = "com.sun.star.uno.RuntimeException"; - } - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - - tRes.tested("createScriptStorageWithURI()", result); - } - - public void _getScriptStorage() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_getScriptStorage"); - - if (c == null) { - tRes.tested("getScriptStorage()", false); - return; - } - - Iterator tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String location = testdata.get("location"); - String output = ""; - - log.println(testdata.get("description")); - - try { - int storageid = getStorageId(location); - - XInterface ifc = (XInterface)oObj.getScriptStorage(storageid); - - if (ifc == null) - output = "null"; - else { - Object info = UnoRuntime.queryInterface( - XScriptInfoAccess.class, ifc); - - if (info == null) - output = "null"; - else - output = "XScriptInfoAccess.class"; - } - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Caught RuntimeException: " + re); - output = "com.sun.star.uno.RuntimeException"; - } - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - - tRes.tested("getScriptStorage()", result); - } - - public void _refreshScriptStorage() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_refreshScriptStorage"); - - if (c == null) { - tRes.tested("refreshScriptStorage()", false); - return; - } - - Iterator tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String location = testdata.get("location"); - String output = ""; - - log.println(testdata.get("description")); - - try { - String uri = util.utils.getFullTestURL(location); - log.println("calling refreshScriptStorage with URI: " + uri); - oObj.refreshScriptStorage(uri); - output = "success"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Caught RuntimeException: " + re); - output = "com.sun.star.uno.RuntimeException"; - } - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - - tRes.tested("refreshScriptStorage()", result); - } - - private int getStorageId(String location) { - - if (location.equals("share")) - return 0; - - if (location.equals("user")) - return 1; - - String uri = util.utils.getFullTestURL(location); - - XSimpleFileAccess access = getXSimpleFileAccess(); - - if (access == null) - return -1; - - return oObj.createScriptStorageWithURI(access, uri); - } - - private XSimpleFileAccess getXSimpleFileAccess() { - XSimpleFileAccess access = null; - - try { - Object fa = tParam.getMSF().createInstance( - "com.sun.star.ucb.SimpleFileAccess"); - - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, fa); - } catch (com.sun.star.uno.Exception e) { - return null; - } - - return access; - } -} diff --git a/scripting/workben/ifc/scripting/_XScriptStorageRefresh.java b/scripting/workben/ifc/scripting/_XScriptStorageRefresh.java deleted file mode 100644 index fb4bd7c0a316..000000000000 --- a/scripting/workben/ifc/scripting/_XScriptStorageRefresh.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package ifc.scripting; - -import drafts.com.sun.star.script.framework.storage.XScriptStorageRefresh; - -import java.util.Collection; -import java.util.Iterator; - -import lib.MultiMethodTest; -import lib.StatusException; -import lib.Parameters; - -public class _XScriptStorageRefresh extends MultiMethodTest { - - public XScriptStorageRefresh oObj = null; - - /** - * Retrieves object relation. - */ - @Override - public void before() throws StatusException { - } - - public void _refresh() { - boolean result = true; - - Collection c = - (Collection) tEnv.getObjRelation("_refresh"); - - if (c == null) { - tRes.tested("refresh()", false); - return; - } - - Iterator tests = c.iterator(); - - while (tests.hasNext()) { - Parameters testdata = (Parameters)tests.next(); - String expected = testdata.get("expected"); - String output = ""; - - log.println(testdata.get("description")); - - try { - oObj.refresh(); - output = "success"; - } catch (com.sun.star.uno.RuntimeException re) { - log.println("Caught RuntimeException: " + re); - output = "com.sun.star.uno.RuntimeException"; - } - - log.println("expected: " + expected + ", output: " + output); - result &= output.equals(expected); - } - - tRes.tested("refresh()", result); - } -} diff --git a/scripting/workben/ifc/scripting/makefile.mk b/scripting/workben/ifc/scripting/makefile.mk deleted file mode 100644 index 00a60eef73f3..000000000000 --- a/scripting/workben/ifc/scripting/makefile.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ = ..$/..$/..$/.. -PRJNAME = testcase -TARGET = testcase - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar $(CLASSPATH)$ -JAVAFILES = $(foreach,j,$(shell @ls | grep java) $j) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/scripting/workben/installer/Banner.java b/scripting/workben/installer/Banner.java deleted file mode 100644 index 79e28a7d5af8..000000000000 --- a/scripting/workben/installer/Banner.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.*; - -public class Banner extends Canvas { - Image img; - Banner() { - setBackground(Color.white); - img = Toolkit.getDefaultToolkit().createImage("sidebar.jpg"); - } - - @Override - public void paint(Graphics g) { - g.drawImage(img, 0, 0, Color.white, null); - g.dispose(); - } - - @Override - public Dimension getPreferredSize() { - return new Dimension(137, 358); - } - -} diff --git a/scripting/workben/installer/ExceptionTraceHelper.java b/scripting/workben/installer/ExceptionTraceHelper.java deleted file mode 100644 index ecde5e448072..000000000000 --- a/scripting/workben/installer/ExceptionTraceHelper.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; - -// class for propagating the exception stack traces across the Java/UNO bridge -public class ExceptionTraceHelper { - public static String getTrace(Exception e) { - ByteArrayOutputStream baos = null; - PrintStream ps = null; - String result = ""; - - try { - baos = new ByteArrayOutputStream(128); - ps = new PrintStream(baos); - e.printStackTrace(ps); - } finally { - try { - if (baos != null) { - baos.close(); - } - - if (ps != null) { - ps.close(); - } - } catch (Exception excp) { - } - } - - return result; - } -} diff --git a/scripting/workben/installer/ExecCmd.java b/scripting/workben/installer/ExecCmd.java deleted file mode 100644 index e52a63aefac0..000000000000 --- a/scripting/workben/installer/ExecCmd.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; -import java.io.*; -public class ExecCmd { - - public boolean exec(String cmd, String[] env) { - System.out.println("About to exectute " + cmd); - final Process p; - boolean result = false; - - try { - Runtime rt = Runtime.getRuntime(); - p = rt.exec(cmd, env); - new Thread(new Runnable() { - public void run() { - BufferedReader br_in = null; - - try { - br_in = new BufferedReader(new InputStreamReader(p.getInputStream())); - String buff = null; - - while ((buff = br_in.readLine()) != null) { - System.out.println("Process out :" + buff); - /*try - { - Thread.sleep(100); - } - catch(Exception e) {}*/ - } - - System.out.println("finished reading out"); - } catch (IOException ioe) { - System.out.println("Exception caught printing javac result"); - ioe.printStackTrace(); - } finally { - if (br_in != null) { - try { - br_in.close(); - } catch (Exception e) {} // nothing can be done - } - } - } - }).start(); - - new Thread(new Runnable() { - public void run() { - BufferedReader br_err = null; - - try { - br_err = new BufferedReader(new InputStreamReader(p.getErrorStream())); - String buff = null; - - while ((buff = br_err.readLine()) != null) { - System.out.println("Process err :" + buff); - } - - System.out.println("finished reading err"); - } catch (IOException ioe) { - System.out.println("Exception caught printing javac result"); - ioe.printStackTrace(); - } finally { - if (br_err != null) { - try { - br_err.close(); - } catch (Exception e) {} // nothing can be done - } - } - } - }).start(); - int exitcode = p.waitFor(); - - if (exitcode != 0) { - System.out.println("cmd [" + cmd + "] failed"); - result = false; - } else { - System.out.println("cmd [" + cmd + "] completed successfully"); - result = true; - } - } catch (Exception e) { - System.out.println("Exception"); - e.printStackTrace(); - } - - System.out.println("command complete"); - return result; - } -} - diff --git a/scripting/workben/installer/FileUpdater.java b/scripting/workben/installer/FileUpdater.java deleted file mode 100644 index 6ba73692ca99..000000000000 --- a/scripting/workben/installer/FileUpdater.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import javax.swing.JLabel; - -public class FileUpdater { - - - - - public static boolean updateScriptXLC(String installPath, JLabel statusLabel) { - - File in_file = null; - File out_file = null; - FileWriter out = null; - int count = 0; - - try { - in_file = new File(installPath + File.separator + "user" + File.separator + - "basic" + File.separator + "script.xlc"); - - String[] xmlArray = new String[50]; - - try { - BufferedReader reader = new BufferedReader(new FileReader(in_file)); - count = -1; - - for (String s = reader.readLine(); s != null; - s = reader.readLine()) { // - count = count + 1; - xmlArray[count] = s; - } - - reader.close(); - } catch (IOException ioe) { - String message = "Error reading script.xlc, please view SFrameworkInstall.log."; - System.out.println(message); - ioe.printStackTrace(); - statusLabel.setText(message); - return false; - } - - in_file.delete(); - - out_file = new File(installPath + File.separator + "user" + File.separator + - "basic" + File.separator + "script.xlc"); - out_file.createNewFile(); - out = new FileWriter(out_file); - - //split the string into a string array with one line of xml in each element - for (int i = 0; i < count + 1; i++) { - out.write(xmlArray[i] + "\n"); - - if ((xmlArray[i].indexOf("\n"); - } else { - out.write(" \n"); - } - } - } - } catch (Exception e) { - String message = - "\nError updating script.xlc, please view SFrameworkInstall.log."; - System.out.println(message); - e.printStackTrace(); - statusLabel.setText(message); - return false; - } finally { - try { - out.close(); - } catch (Exception e) { - System.out.println("Update Script.xlc Failed, please view SFrameworkInstall.log."); - e.printStackTrace(); - System.err.println(e); - } - } - - return true; - }// updateScriptXLC - - - public static boolean updateDialogXLC(String installPath, JLabel statusLabel) { - File in_file = null; - File out_file = null; - FileWriter out = null; - int count = 0; - - try { - in_file = new File(installPath + File.separator + "user" + File.separator + - "basic" + File.separator + "dialog.xlc"); - - String[] xmlArray = new String[50]; - - try { - BufferedReader reader = new BufferedReader(new FileReader(in_file)); - count = -1; - - for (String s = reader.readLine(); s != null; s = reader.readLine()) { - count = count + 1; - xmlArray[count] = s; - } - - reader.close(); - } catch (IOException ioe) { - - String message = - "\nError reading dialog.xlc, please view SFrameworkInstall.log."; - System.out.println(message); - statusLabel.setText(message); - return false; - } - - in_file.delete(); - - out_file = new File(installPath + File.separator + "user" + File.separator + - "basic" + File.separator + "dialog.xlc"); - out_file.createNewFile(); - - out = new FileWriter(out_file); - - //split the string into a string array with one line of xml in each element - for (int i = 0; i < count + 1; i++) { - out.write(xmlArray[i] + "\n"); - - if ((xmlArray[i].indexOf("\n"); - } else { - out.write(" \n"); - } - } - } - } catch (Exception e) { - String message = - "\nError updating dialog.xlc, please view SFrameworkInstall.log."; - System.out.println(message); - e.printStackTrace(); - statusLabel.setText(message); - return false; - } finally { - try { - out.close(); - } catch (Exception e) { - System.out.println("Update dialog.xlc Failed, please view SFrameworkInstall.log."); - e.printStackTrace(); - System.err.println(e); - } - } - - return true; - }// updateScriptXLC - - -} diff --git a/scripting/workben/installer/Final.java b/scripting/workben/installer/Final.java deleted file mode 100644 index b951537e8e0c..000000000000 --- a/scripting/workben/installer/Final.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; -import java.util.*; -import javax.swing.*; - -public class Final extends javax.swing.JPanel implements ActionListener, - InstallListener { - - /** Creates new form Welcome */ - public Final(InstallWizard wizard) { - this.wizard = wizard; - setBackground(java.awt.Color.white); - xud = null; - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - statusPanel = new javax.swing.JPanel(); - statusPanel.setBackground(java.awt.Color.white); - statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER); - - setLayout(new java.awt.BorderLayout()); - - statusPanel.setLayout(new java.awt.BorderLayout()); - - statusLine.setText("Waiting to install. \n All Office processes must be terminated."); - statusPanel.add(statusLine, java.awt.BorderLayout.CENTER); - - add(statusPanel, java.awt.BorderLayout.CENTER); - nav = new NavPanel(wizard, true, true, true, InstallWizard.VERSIONS, ""); - nav.setNextListener(this); - nav.removeCancelListener(nav); - nav.setCancelListener(this); - nav.navNext.setText("Install"); - add(nav, java.awt.BorderLayout.SOUTH); - - - - }//GEN-END:initComponents - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent e) { - // navNext is "Install" - if (e.getSource() == nav.navNext) { - JProgressBar progressBar = new JProgressBar(); - progressBar.setMaximum(10); - progressBar.setValue(0); - statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH); - nav.enableNext(false); - nav.enableBack(false); - nav.enableCancel(false); - ArrayList locations = InstallWizard.getLocations(); - // Returned 1 - String path = null; - - for (int i = 0; i < locations.size(); i++) { - path = (String)locations.get(i); - xud = new XmlUpdater(path, statusLine, progressBar, - InstallWizard.bNetworkInstall, InstallWizard.bBindingsInstall); - xud.addInstallListener(this); - InstallWizard.setInstallStarted(true); - InstallWizard.setPatchedTypes(false); - InstallWizard.setPatchedJava(false); - InstallWizard.setPatchedRDB(false); - xud.start(); - } - } - - // set to "Exit" at end of installation process - if (e.getSource() == nav.navCancel) { - int answer = JOptionPane.showConfirmDialog(wizard, - "Are you sure you want to exit?"); - - if (answer == JOptionPane.YES_OPTION) { - wizard.exitForm(); - } else { - return; - } - } - }// actionPerformed - - - public void installationComplete(InstallationEvent ev) { - if (InstUtil.hasNetbeansInstallation()) { - nav.removeCancelListener(this); - nav.setCancelListener(nav); - nav.navCancel.setText("Finish"); - nav.enableIDE(true); - nav.enableCancel(true); - xud = null; - } else { - nav.removeCancelListener(this); - nav.setCancelListener(nav); - nav.navCancel.setText("Finish"); - nav.enableCancel(true); - xud = null; - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel statusPanel; - private javax.swing.JLabel statusLine; - private InstallWizard wizard; - private NavPanel nav; - private XmlUpdater xud; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/workben/installer/IdeFinal.java b/scripting/workben/installer/IdeFinal.java deleted file mode 100644 index 93159b7b4e2b..000000000000 --- a/scripting/workben/installer/IdeFinal.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; -import java.util.*; -import javax.swing.*; - -public class IdeFinal extends javax.swing.JPanel implements ActionListener, - InstallListener { - - /** Creates new form Welcome */ - public IdeFinal(InstallWizard wizard) { - this.wizard = wizard; - setBackground(java.awt.Color.white); - ideupdater = null; - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - statusPanel = new javax.swing.JPanel(); - statusPanel.setBackground(java.awt.Color.white); - statusLine = new javax.swing.JLabel("Ready", javax.swing.JLabel.CENTER); - - setLayout(new java.awt.BorderLayout()); - - statusPanel.setLayout(new java.awt.BorderLayout()); - - statusLine.setText("Waiting to install IDE support."); - statusPanel.add(statusLine, java.awt.BorderLayout.CENTER); - - add(statusPanel, java.awt.BorderLayout.CENTER); - nav = new NavPanel(wizard, true, true, true, InstallWizard.IDEVERSIONS, ""); - nav.setNextListener(this); - nav.removeCancelListener(nav); - nav.setCancelListener(this); - nav.navNext.setText("Install"); - add(nav, java.awt.BorderLayout.SOUTH); - }//GEN-END:initComponents - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent e) { - // navNext is "Install" - if (e.getSource() == nav.navNext) { - JProgressBar progressBar = new JProgressBar(); - progressBar.setMaximum(10); - progressBar.setValue(0); - statusPanel.add(progressBar, java.awt.BorderLayout.SOUTH); - nav.enableNext(false); - nav.enableBack(false); - nav.enableCancel(false); - ArrayList locations = InstallWizard.getLocations(); - // Returned 1 - String path = null; - - for (int i = 0; i < locations.size(); i++) { - path = (String)locations.get(i); - - ideupdater = new IdeUpdater(path, statusLine, progressBar); - ideupdater.addInstallListener(this); - InstallWizard.setInstallStarted(true); - ideupdater.start(); - } - } - - // set to "Exit" at end of installation process - if (e.getSource() == nav.navCancel) { - int answer = JOptionPane.showConfirmDialog(wizard, - "Are you sure you want to exit?"); - - if (answer == JOptionPane.YES_OPTION) { - wizard.exitForm(); - } else { - return; - } - } - }// actionPerformed - - - public void installationComplete(InstallationEvent ev) { - nav.removeCancelListener(this); - nav.setCancelListener(nav); - nav.navCancel.setText("Finish"); - nav.enableCancel(true); - ideupdater = null; - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel statusPanel; - private javax.swing.JLabel statusLine; - private InstallWizard wizard; - private NavPanel nav; - private IdeUpdater ideupdater; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/workben/installer/IdeUpdater.java b/scripting/workben/installer/IdeUpdater.java deleted file mode 100644 index b0ec0cd35cbf..000000000000 --- a/scripting/workben/installer/IdeUpdater.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import java.util.*; -import javax.swing.*; - -/** - * The XmlUpdater pulls a META-INF/converter.xml - * file out of a jar file and parses it, providing access to this - * information in a Vector of ConverterInfo - * objects. - */ -public class IdeUpdater extends Thread { - - private String installPath; - - private JLabel statusLabel; - - private ArrayList listeners; - private Thread internalThread; - private boolean threadSuspended; - private JProgressBar progressBar; - - private boolean isNetbeansPath = false; - - - public IdeUpdater(String installPath, JLabel statusLabel, JProgressBar pBar) { - - if (!installPath.endsWith(File.separator)) - installPath += File.separator; - - File netbeansLauncher = new File(installPath + "bin"); - - if (netbeansLauncher.isDirectory()) { - isNetbeansPath = true; - installPath = installPath + "modules" + File.separator; - } - - System.out.println("IdeUpdater installPath is " + installPath + - " isNetbeansPath is " + isNetbeansPath); - this.installPath = installPath; - this.statusLabel = statusLabel; - listeners = new ArrayList(); - threadSuspended = false; - progressBar = pBar; - progressBar.setStringPainted(true); - }// XmlUpdater - - - @Override - public void run() { - - internalThread = Thread.currentThread(); - - progressBar.setString("Unzipping Required Files"); - ZipData zd = new ZipData(); - - // Adding IDE support - if (isNetbeansPath) { - if (!zd.extractEntry("ide/office.jar", installPath, statusLabel)) { - onInstallComplete(); - return; - } - } else { - if (!zd.extractEntry("ide/idesupport.jar", installPath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("ide/OfficeScripting.jar", installPath, statusLabel)) { - onInstallComplete(); - return; - } - } - - statusLabel.setText("Installation Complete"); - progressBar.setString("Installation Complete"); - progressBar.setValue(10); - onInstallComplete(); - - }// run - - - public void addInstallListener(InstallListener listener) { - listeners.add(listener); - }// addInstallListener - - - private void onInstallComplete() { - for (InstallListener l : listeners) { - l.installationComplete(null); - } - }// onInstallComplete - -}// XmlUpdater class diff --git a/scripting/workben/installer/IdeVersion.java b/scripting/workben/installer/IdeVersion.java deleted file mode 100644 index 3a7cc5a485a4..000000000000 --- a/scripting/workben/installer/IdeVersion.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.*; -import java.awt.event.*; -import java.util.*; - -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; - -public class IdeVersion extends javax.swing.JPanel implements ActionListener, - TableModelListener { - - /** Creates new form Welcome */ - public IdeVersion(InstallWizard wizard) { - this.wizard = wizard; - setBackground(Color.white); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() { - Properties props = null; - JPanel versionPanel = new JPanel(); - setLayout(new BorderLayout()); - - - try { - Properties netbeansProps = InstUtil.getNetbeansLocation(); - Properties ideProps = new Properties(); - - if (netbeansProps != null) { - System.out.println("**** Found netbeans install"); - - for (int n = 0; n < netbeansProps.size(); n++) { - for (int v = 0; v < InstUtil.versions.length; v++) { - System.out.println("n: " + n + " v: " + v); - String key = InstUtil.versions[v]; - System.out.println("It got here1"); - String path = null; - - if ((path = netbeansProps.getProperty(key)) != null) { - ideProps.put(key, path); - } - } - } - } - - props = ideProps; - } catch (Exception e) { - System.err.println("Exception thrown in initComponents"); - } - - tableModel = new MyTableModelIDE(props, InstUtil.versions); - - if (tableModel.getRowCount() == 0) { - JOptionPane.showMessageDialog(this, "No compatible IDEs were found.", - "Invalid versions", JOptionPane.ERROR_MESSAGE); - } - - tableModel.addTableModelListener(this); - JTable tableVersions = new JTable(tableModel) { - @Override - public String getToolTipText(MouseEvent event) { - int col = columnAtPoint(event.getPoint()); - - if (col != 2) - return null; - - int row = rowAtPoint(event.getPoint()); - Object o = getValueAt(row, col); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - return o.toString(); - } - - @Override - public Point getToolTipLocation(MouseEvent event) { - int col = columnAtPoint(event.getPoint()); - - if (col != 2) - return null; - - int row = rowAtPoint(event.getPoint()); - Object o = getValueAt(row, col); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - Point pt = getCellRect(row, col, true).getLocation(); - pt.translate(-1, -2); - return pt; - } - }; - - JScrollPane scroll = new JScrollPane(tableVersions); - - tableVersions.setPreferredSize( - new Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT)); - - tableVersions.setRowSelectionAllowed(false); - tableVersions.setColumnSelectionAllowed(false); - tableVersions.setCellSelectionEnabled(false); - - initColumnSizes(tableVersions, tableModel); - versionPanel.add(scroll); - - JTextArea area = new - JTextArea("Please select IDEs below that you wish to add Scripting support to"); - area.setLineWrap(true); - area.setEditable(false); - add(area, BorderLayout.NORTH); - add(versionPanel, BorderLayout.CENTER); - nav = new NavPanel(wizard, true, false, true, InstallWizard.IDEWELCOME, - InstallWizard.IDEFINAL); - nav.setNextListener(this); - add(nav, BorderLayout.SOUTH); - - }// initComponents - - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(320, 280); - } - - - public void actionPerformed(ActionEvent ev) { - InstallWizard.clearLocations(); - int len = tableModel.data.size(); - - for (int i = 0; i < len; i++) { - ArrayList list = tableModel.data.get(i); - - if (((Boolean)list.get(0)).booleanValue()) - InstallWizard.storeLocation((String)list.get(2)); - } - } - - - public void tableChanged(TableModelEvent e) { - if (tableModel.isAnySelected()) { - nav.enableNext(true); - } else { - nav.enableNext(false); - } - } - - private void initColumnSizes(JTable table, MyTableModelIDE model) { - TableColumn column = null; - Component comp = null; - int headerWidth = 0; - int cellWidth = 0; - int preferredWidth = 0; - int totalWidth = 0; - Object[] longValues = model.longValues; - - for (int i = 0; i < 3; i++) { - column = table.getColumnModel().getColumn(i); - - try { - comp = column.getHeaderRenderer(). - getTableCellRendererComponent( - null, column.getHeaderValue(), - false, false, 0, 0); - headerWidth = comp.getPreferredSize().width; - } catch (NullPointerException e) { - // System.err.println("Null pointer exception!"); - // System.err.println(" getHeaderRenderer returns null in 1.3."); - // System.err.println(" The replacement is getDefaultRenderer."); - } - - // need to replace spaces in String before getting preferred width - if (longValues[i] instanceof String) { - longValues[i] = ((String)longValues[i]).replace(' ', '_'); - } - - System.out.println("longValues: " + longValues[i]); - comp = table.getDefaultRenderer(model.getColumnClass(i)). - getTableCellRendererComponent( - table, longValues[i], - false, false, 0, i); - cellWidth = comp.getPreferredSize().width; - - preferredWidth = Math.max(headerWidth, cellWidth); - - if (false) { - System.out.println("Initializing width of column " - + i + ". " - + "preferredWidth = " + preferredWidth - + "; totalWidth = " + totalWidth - + "; leftWidth = " + (InstallWizard.DEFWIDTH - totalWidth)); - } - - //XXX: Before Swing 1.1 Beta 2, use setMinWidth instead. - if (i == 2) { - if (preferredWidth > InstallWizard.DEFWIDTH - totalWidth) - column.setPreferredWidth(InstallWizard.DEFWIDTH - totalWidth); - else - column.setPreferredWidth(preferredWidth); - } else { - column.setMinWidth(preferredWidth); - totalWidth += preferredWidth; - } - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private InstallWizard wizard; - private MyTableModelIDE tableModel; - private NavPanel nav; - // End of variables declaration//GEN-END:variables - -} - -class MyTableModelIDE extends AbstractTableModel { - ArrayList> data; - private String colNames[] = {"", "IDE Name", "IDE Location"}; - Object[] longValues = new Object[] {Boolean.TRUE, "Name", "Location"}; - - MyTableModelIDE(Properties properties, String [] validVersions) { - data = new ArrayList>(); - - int len = validVersions.length; - - for (int i = 0; i < len; i++) { - String key = validVersions[i]; - String path = null; - - if ((path = properties.getProperty(key)) != null) { - ArrayList row = new ArrayList(); - row.add(0, Boolean.FALSE); - - row.add(1, key); - - if (key.length() > ((String)longValues[1]).length()) { - longValues[1] = key; - } - - row.add(2, path); - - if (path.length() > ((String)longValues[2]).length()) { - longValues[2] = path; - } - - data.add(row); - } - } - }// MyTableModel - - public int getColumnCount() { - return 3; - } - - public int getRowCount() { - return data.size(); - } - - @Override - public String getColumnName(int col) { - return colNames[col]; - } - - public Object getValueAt(int row, int col) { - if (row < 0 || row > getRowCount() || - col < 0 || col > getColumnCount()) - return null; - - ArrayList aRow = data.get(row); - return aRow.get(col); - } - - @Override - public Class getColumnClass(int c) { - return getValueAt(0, c).getClass(); - } - - @Override - public boolean isCellEditable(int row, int col) { - return (col == 0); - } - - @Override - public void setValueAt(Object value, int row, int col) { - ArrayList aRow = data.get(row); - aRow.set(col, value); - fireTableCellUpdated(row, col); - } - - - - public boolean isAnySelected() { - Iterator iter = data.iterator(); - - while (iter.hasNext()) { - ArrayList row = (ArrayList)iter.next(); - - if (((Boolean)row.get(0)).booleanValue()) { - return true; - } - } - - return false; - } - -} - diff --git a/scripting/workben/installer/IdeWelcome.java b/scripting/workben/installer/IdeWelcome.java deleted file mode 100644 index c6852bbd639c..000000000000 --- a/scripting/workben/installer/IdeWelcome.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; - -public class IdeWelcome extends javax.swing.JPanel implements ActionListener { - - /** Creates new form Welcome */ - public IdeWelcome(InstallWizard wizard) { - this.wizard = wizard; - setBorder(new javax.swing.border.EtchedBorder( - javax.swing.border.EtchedBorder.RAISED)); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - welcomePanel = new javax.swing.JPanel(); - area = new javax.swing.JTextArea(); - - setLayout(new java.awt.BorderLayout()); - - welcomePanel.setLayout(new java.awt.BorderLayout()); - area.setEditable(false); - area.setLineWrap(true); - area.setText("\n Click Next to include Scripting Framework support for IDEs."); - area.append("\n Click Cancel exit the Installation process. \n"); - - if (InstUtil.hasNetbeansInstallation()) { - area.append("\n \tA version of Netbeans has been detected. \n"); - } - - welcomePanel.add(area, java.awt.BorderLayout.CENTER); - add(welcomePanel, java.awt.BorderLayout.CENTER); - NavPanel nav = new NavPanel(wizard, false, true, true, "", - InstallWizard.IDEVERSIONS); - nav.setNextListener(this); - add(nav, java.awt.BorderLayout.SOUTH); - - }//GEN-END:initComponents - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent ev) { - //Perform next actions here... - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel welcomePanel; - private javax.swing.JTextArea area; - private InstallWizard wizard; - - // End of variables declaration//GEN-END:variables -} diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java deleted file mode 100644 index 262ce6c01e6b..000000000000 --- a/scripting/workben/installer/InstUtil.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.net.URLDecoder; -import java.io.*; -import java.util.*; -import java.net.*; - -public class InstUtil { - - public static File buildSversionLocation() throws IOException { - File theFile = null; - StringBuffer str = new StringBuffer(); - str.append(System.getProperty("user.home")); - str.append(File.separator); - StringBuffer thePath = new StringBuffer(str.toString()); - - String os = System.getProperty("os.name"); - - if (os.indexOf("Windows") != -1) { - boolean bSVersionInHomeDir = new File(thePath.toString() + - "sversion.ini").exists(); - - if (!bSVersionInHomeDir) { - thePath.append("Application Data"); - thePath.append(File.separator); - } - - theFile = findVersionFile(new File(thePath.toString())); - } else if (os.indexOf("SunOS") != -1) { - thePath.append(".sversionrc"); - theFile = new File(thePath.toString()); - } else if (os.indexOf("Linux") != -1) { - thePath.append(".sversionrc"); - theFile = new File(thePath.toString()); - } - - if (theFile == null) { - throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?"); - } - - if (!theFile.exists()) { - throw new IOException("Could not locate the OpenOffice settings file.\nAre you sure StarOffice is installed on your system?"); - } - - return theFile; - } - - - - public static boolean hasNetbeansInstallation() { - boolean result = false; - result = checkForSupportedVersion(getNetbeansLocation(), versions); - - if (!result) - System.out.println("No supported version of NetBeans found."); - - return result; - } - - private static boolean checkForSupportedVersion(Properties installs, - String[] supportedVersions) { - if (installs != null) { - for (int index = 0; index < supportedVersions.length; index++) { - String key = supportedVersions[ index ]; - - if (installs.getProperty(key) != null) { - // at least one supported version for netbeans present, so return; - return true; - } - - } - } - - return false; - } - - - - - - - public static Properties getNetbeansLocation() { - Properties results = new Properties(); - - StringBuffer str = new StringBuffer(); - str.append(System.getProperty("user.home")); - str.append(File.separator); - StringBuffer thePath = new StringBuffer(str.toString()); - - String os = System.getProperty("os.name"); - - if (os.indexOf("Windows") != -1) { - thePath.append(".netbeans"); - } else if (os.indexOf("SunOS") != -1) { - thePath.append(".netbeans"); - } else if (os.indexOf("Linux") != -1) { - thePath.append(".netbeans"); - } - - if (thePath.toString().indexOf(".netbeans") == -1) - return null; - else if (new File(thePath.append(File.separator + "3.4" + - File.separator).toString()).isDirectory()) { - - System.out.println("Found NetBeans 3.4 user directory: " + thePath); - File netbeansLogFile = new File(thePath.toString() + File.separator + "system" + - File.separator + "ide.log"); - - if (netbeansLogFile.exists()) { - String installPath = getNetbeansInstallation(netbeansLogFile); - File f = new File(installPath); - results.put("NetBeans 3.4", f.getPath() + File.separator); - System.out.println("NetBeans Installation directory: " + f.getPath()); - } else { - System.out.println("No NetBeans log file found"); - return null; - } - } else { - System.out.println("No NetBeans user directory found"); - return null; - } - - - return results; - } - - - - private static String getNetbeansInstallation(File logFile) { - String installPath = ""; - - try { - BufferedReader reader = new BufferedReader(new FileReader(logFile)); - - for (String s = reader.readLine(); s != null; s = reader.readLine()) { - if (s.indexOf("IDE Install") != -1) { - int pathStart = s.indexOf("=") + 2; - installPath = s.substring(pathStart, s.length()); - int pathEnd = installPath.indexOf(";"); - installPath = installPath.substring(0, pathEnd) + File.separator; - break; - } - } - - reader.close(); - } catch (IOException ioe) { - System.out.println("Error reading Netbeans location information"); - } - - return installPath; - } - - - private static File findVersionFile(File start) { - File versionFile = null; - - File files[] = start.listFiles(new VersionFilter()); - - if (files.length == 0) { - File dirs[] = start.listFiles(new DirFilter()); - - for (int i = 0; i < dirs.length; i++) { - versionFile = findVersionFile(dirs[i]); - - if (versionFile != null) { - break; - } - } - } else { - versionFile = files[0]; - } - - return versionFile; - } - - private static boolean verifySversionExists(File sversionFile) { - if (!sversionFile.exists()) - return false; - - return true; - } - - public static Properties getOfficeVersions(File sversionFile) throws - IOException { - BufferedReader reader = new BufferedReader(new FileReader(sversionFile)); - String sectionName = null; - Properties results = new Properties(); - - for (String s = reader.readLine(); s != null; s = reader.readLine()) { - if (s.length() == 0) - continue; - - if (s.charAt(0) == '[') { - sectionName = s.substring(1, s.length() - 1); - continue; - } - - if ((sectionName != null) && sectionName.equalsIgnoreCase("Versions")) { - int equals = s.indexOf("="); - String officeName = s.substring(0, equals); - - String instPath = s.substring(equals + 8, s.length()); - String [] parts = new String[2]; - parts[0] = officeName; - parts[1] = instPath + File.separator; - - if (parts.length == 2) { - try { - URL url = new URL("file://" + parts[1].trim()); - String opSys = System.getProperty("os.name"); - - if (opSys.indexOf("Windows") != -1) { - String windowsPath = URLDecoder.decode(url.getPath()); - boolean firstSlash = true; - - while (windowsPath.indexOf("/") != -1) { - int forwardSlashPos = windowsPath.indexOf("/"); - String firstPart = windowsPath.substring(0, forwardSlashPos); - String lastPart = windowsPath.substring(forwardSlashPos + 1, - windowsPath.length()); - - if (firstSlash) { - windowsPath = lastPart; - firstSlash = false; - } else { - windowsPath = firstPart + "\\" + lastPart; - } - } - - int lastSlash = windowsPath.lastIndexOf("\\"); - windowsPath = windowsPath.substring(0, lastSlash); - results.put(parts[0].trim(), windowsPath); - } else { - results.put(parts[0].trim(), URLDecoder.decode(url.getPath())); - } - } catch (MalformedURLException eSyntax) { - results.put(parts[0].trim(), parts[1].trim()); - System.err.println("GotHereException"); - } - } else { - System.out.println("not splitting on equals"); - } - } - } - - reader.close(); - return results; - } - - private static String getJavaVersion() { - return System.getProperty("java.version"); - } - - private static boolean isCorrectJavaVersion() { - if (System.getProperty("java.version").startsWith("1.4")) - return true; - - return false; - } - - public static void main(String args[]) { - InstUtil inst = new InstUtil(); - File f = null; - - try { - f = InstUtil.buildSversionLocation(); - } catch (IOException e) { - e.printStackTrace(); - System.out.println(e.getMessage()); - } - - if (!InstUtil.verifySversionExists(f)) { - System.err.println("Problem with sversion.ini"); - } - - try { - InstUtil.getOfficeVersions(f); - } catch (IOException e) { - e.printStackTrace(); - System.err.println(e); - } - - System.out.println(InstUtil.getJavaVersion()); - - if (!InstUtil.isCorrectJavaVersion()) { - System.err.println("Not correct Java Version"); - } - } - - public static final String [] versions = {"NetBeans 3.4", "jEdit 4.0.3", "jEdit 4.1pre5" }; -} - - - -class DirFilter implements java.io.FileFilter { - public boolean accept(File aFile) { - return aFile.isDirectory(); - } -} -class VersionFilter implements java.io.FileFilter { - public boolean accept(File aFile) { - if (aFile.getName().compareToIgnoreCase("sversion.ini") == 0) { - return true; - } - - return false; - } -} diff --git a/scripting/workben/installer/InstallListener.java b/scripting/workben/installer/InstallListener.java deleted file mode 100644 index 81a005668369..000000000000 --- a/scripting/workben/installer/InstallListener.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -public interface InstallListener { - void installationComplete(InstallationEvent e); -} diff --git a/scripting/workben/installer/InstallWizard.java b/scripting/workben/installer/InstallWizard.java deleted file mode 100644 index fc9d3bdf19da..000000000000 --- a/scripting/workben/installer/InstallWizard.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -import java.util.*; -import java.net.*; -import java.io.*; - -public class InstallWizard extends javax.swing.JFrame implements - ActionListener { - /* - private static class ShutdownHook extends Thread { - public void run() - { - if (InstallWizard.isInstallStarted()) - { - // Check for and backup any config.xml files - // Check for and backup any StarBasic macro files - // Check for and backup ProtocolHandler - - if (!InstallWizard.isPatchedTypes()) - { - File backup = new File(InstUtil.getTmpDir(), "TypeDetection.xml"); - File destination = new File(InstallWizard.getTypesPath()); - InstUtil.copy(backup, destination); //Restore typedetection.xml - } - if (!InstallWizard.isPatchedJava()) - { - File backup = new File(InstUtil.getTmpDir(), "Java.xml"); - File destination = new File(InstallWizard.getJavaPath()); - InstUtil.copy(backup, destination); //Restore typedetection.xml - } - if (!InstallWizard.isPatchedRDB()) - { - File backup = new File(InstUtil.getTmpDir(), "applicat.rdb"); - File destination = new File(InstallWizard.getJavaPath()); - //InstUtil.copy(backup, destination); //Restore typedetection.xml - } - - System.out.println( "ShutdownHook" ); - } - - InstUtil.removeTmpDir(); - } - }// class ShutdownHook - - static { - Runtime rt=Runtime.getRuntime(); - rt.addShutdownHook(new ShutdownHook()); - } - */ - /** Creates new form InstallWizard */ - public InstallWizard() { - super("Office Scripting Framework Installer - Early Developer Release"); - - try { - System.out.print("All diagnostic output is being redirected to SFrameworkInstall.log\n"); - System.out.print("Location: " + System.getProperty("user.dir") + - File.separator + "SFrameworkInstall.log\n"); - - LogStream log = new LogStream("SFrameworkInstall.log"); - System.setErr(log); - - System.setOut(log); - } catch (FileNotFoundException fnfe) { - System.err.println("Office Scripting Framework Installer - Error: "); - System.err.println("Unable to create log file for installation."); - exitForm(); - } - - setBackground(new Color(0, 0, 0)); - locations = new ArrayList(); - Point center = new Point(400, 400); - int windowWidth = 200; - int windowHeight = 300; - setSize(windowWidth, windowHeight); - setBounds((center.x - windowWidth / 2) - 115, - (center.y - windowWidth / 2) - 100, windowWidth, windowHeight); - initComponents(); - setResizable(false); - } - - /** This method is called from within the constructor to - * initialize the form. - */ - private void initComponents() { - navigation = new javax.swing.JPanel(); - navBack = new javax.swing.JButton(); - navNext = new javax.swing.JButton(); - navCancel = new javax.swing.JButton(); - screens = new javax.swing.JPanel(); - - addWindowListener(new java.awt.event.WindowAdapter() { - @Override - public void windowClosing(java.awt.event.WindowEvent evt) { - exitForm(); - } - }); - - navigation.setLayout(new java.awt.GridBagLayout()); - java.awt.GridBagConstraints gridBagConstraints1; - - navBack.setText("<< Back"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.insets = new java.awt.Insets(1, 1, 1, 1); - - navNext.setText("Next >>"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 2; - gridBagConstraints1.gridy = 0; - - navCancel.setText("Cancel"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 6; - gridBagConstraints1.gridy = 0; - - getContentPane().add(navigation, java.awt.BorderLayout.SOUTH); - screens.setLayout(new java.awt.CardLayout()); - screens.add(WELCOME, new Welcome(this)); - version = new Version(this); - screens.add(VERSIONS, version); - _final = new Final(this); - screens.add(FINAL, _final); - - boolean hasIDEInstallation = (InstUtil.hasNetbeansInstallation()) ; - - if (hasIDEInstallation) { - idewelcome = new IdeWelcome(this); - screens.add(IDEWELCOME, idewelcome); - ideversion = new IdeVersion(this); - screens.add(IDEVERSIONS, ideversion); - idefinal = new IdeFinal(this); - screens.add(IDEFINAL, idefinal); - } - - getContentPane().add(screens, java.awt.BorderLayout.CENTER); - - navNext.addActionListener(this); - navNext.addActionListener(version); - navNext.addActionListener(_final); - - if (hasIDEInstallation) { - navNext.addActionListener(ideversion); - navNext.addActionListener(idefinal); - } - - navCancel.addActionListener(this); - navBack.addActionListener(this); - - - URL url = this.getClass().getResource("sidebar.jpg"); - JLabel sideBar = new JLabel(); - sideBar.setIcon(new ImageIcon(url)); - getContentPane().add(sideBar, java.awt.BorderLayout.WEST); - pack(); - }// initComponents - - /** Exit the Application */ - public void exitForm() { - System.exit(0); - } - - - public void actionPerformed(ActionEvent e) { - if (e.getSource() == navNext) { - ((CardLayout)screens.getLayout()).next(screens); - } - - if (e.getSource() == navCancel) { - exitForm(); - } - - if (e.getSource() == navBack) { - ((CardLayout)screens.getLayout()).previous(screens); - } - }// actionPerformed - - public static void storeLocation(String path) { - locations.add(path); - } - - public static ArrayList getLocations() { - return locations; - } - - public static void clearLocations() { - locations.clear(); - } - - public void show(String cardName) { - ((CardLayout)screens.getLayout()).show(screens, cardName); - } - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - String officePath = null; - String netbeansPath = null; - int i = 0; - - while (i < args.length) { - if (args[i].equals("-help")) { - printUsage(); - System.exit(0); - } - - if (args[i].equals("-office")) - officePath = args[++i]; - - if (args[i].equals("-netbeans")) - netbeansPath = args[++i]; - - if (args[i].equals("-net")) - bNetworkInstall = true; - - if (args[i].equals("-bindings")) - bBindingsInstall = true; - - i++; - } - - if (officePath == null && netbeansPath == null) - new InstallWizard().show(); - - JLabel label = new JLabel(); - JProgressBar progressbar = new JProgressBar(); - - try { - System.out.println("Log file is: " + - System.getProperty("user.dir") + - File.separator + "SFrameworkInstall.log"); - - LogStream log = new LogStream("SFrameworkInstall.log"); - System.setErr(log); - System.setOut(log); - } catch (FileNotFoundException fnfe) { - System.err.println("Error: Unable to create log file: " - + fnfe.getMessage()); - System.exit(-1); - } - - if (officePath != null) { - XmlUpdater xud = new XmlUpdater(officePath, label, progressbar, bNetworkInstall, - bBindingsInstall); - xud.run(); - } - - if (netbeansPath != null) { - IdeUpdater ideup = new IdeUpdater(netbeansPath, label, progressbar); - ideup.run(); - } - } - - private static void printUsage() { - System.err.println("java -jar SFrameworkInstall.jar"); - System.err.println("\t[-office locations = null; - - public static String VERSIONS = "VERSIONS"; - public static String WELCOME = "WELCOME"; - public static String FINAL = "FINAL"; - public static String IDEVERSIONS = "IDEVERSIONS"; - public static String IDEWELCOME = "IDEWELCOME"; - public static String IDEFINAL = "IDEFINAL"; - - public static int DEFWIDTH = 480; - public static int DEFHEIGHT = 240; - - private static String typesPath = null; - private static String javaPath = null; - - public static boolean bNetworkInstall = false; - public static boolean bBindingsInstall = false; - - private static boolean bPatchedTypes = false; - private static boolean bPatchedJava = false; - private static boolean bPatchedRDB = false; - private static boolean bInstallStarted = false; - -}// InstallWizard diff --git a/scripting/workben/installer/InstallationEvent.java b/scripting/workben/installer/InstallationEvent.java deleted file mode 100644 index 9d91f9bf4505..000000000000 --- a/scripting/workben/installer/InstallationEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -public class InstallationEvent { - private Object source; - private String message; - InstallationEvent(Object source, String message) { - this.source = source; - this.message = message; - } - - public Object getSource() { - return source; - } - - public String getMessage() { - return message; - } -} diff --git a/scripting/workben/installer/LogStream.java b/scripting/workben/installer/LogStream.java deleted file mode 100644 index 27f33860d9d2..000000000000 --- a/scripting/workben/installer/LogStream.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; -import java.io.PrintStream; -import java.io.FileOutputStream; - -import java.util.Date; -import java.text.DateFormat; -import java.text.SimpleDateFormat; - - -public class LogStream extends PrintStream { - static final private DateFormat formatter = new - SimpleDateFormat("yyyy-MM-dd HH:mm:ss z: "); - - private String getTimeStamp() { - String timeStamp = formatter.format(new Date()); - return timeStamp; - } - public LogStream(String logFileName) throws java.io.FileNotFoundException { - super(new FileOutputStream(logFileName)); - } - @Override - public void println(String x) { - super.println(getTimeStamp() + x); - } - public static void main(String[] args) { - if (args.length > 0) { - try { - LogStream log = new LogStream(args[0]); - System.setErr(log); - System.setOut(log); - System.out.println("Test from logger from out"); - System.err.println("Test from logger from err"); - System.out.println("finised test from out"); - System.err.println("finised test from err"); - } catch (java.io.FileNotFoundException fe) { - System.err.println("Error creating logStream: " + fe); - fe.printStackTrace(); - } - } else { - System.err.println("specify log file java LogStream [logfile]"); - System.exit(1); - } - } -} diff --git a/scripting/workben/installer/NavPanel.java b/scripting/workben/installer/NavPanel.java deleted file mode 100644 index 89cfed25b1de..000000000000 --- a/scripting/workben/installer/NavPanel.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -public class NavPanel extends JPanel implements ActionListener { - - NavPanel(InstallWizard wizard, boolean bBack, boolean bNext, boolean bCancel, - String prev, String next) { - setBackground(Color.white); - setBorder(new javax.swing.border.EtchedBorder( - javax.swing.border.EtchedBorder.LOWERED)); - this.wizard = wizard; - this.next = next; - this.prev = prev; - navBack = new javax.swing.JButton("<< Back"); - navNext = new javax.swing.JButton("Next >>"); - navCancel = new javax.swing.JButton("Cancel"); - setLayout(new GridBagLayout()); - - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.insets = new java.awt.Insets(1, 1, 1, 1); - gridBagConstraints1.anchor = GridBagConstraints.WEST; - - gridBagConstraints2 = new java.awt.GridBagConstraints(); - gridBagConstraints2.gridx = 2; - gridBagConstraints2.gridy = 0; - - gridBagConstraints3 = new java.awt.GridBagConstraints(); - gridBagConstraints3.gridx = 6; - gridBagConstraints3.gridy = 0; - - navNext.setEnabled(bNext); - navBack.setEnabled(bBack); - navCancel.setEnabled(bCancel); - navNext.addActionListener(this); - navBack.addActionListener(this); - navCancel.addActionListener(this); - add(navBack, gridBagConstraints1); - add(navNext, gridBagConstraints2); - add(navCancel, gridBagConstraints3); - } - - public void enableNext(boolean bEnable) { - navNext.setEnabled(bEnable); - } - - public void enableBack(boolean bEnable) { - navBack.setEnabled(bEnable); - } - - public void enableCancel(boolean bEnable) { - navCancel.setEnabled(bEnable); - } - - public void enableIDE(boolean bEnable) { - ideDetected = bEnable; - } - - public void actionPerformed(ActionEvent ev) { - if ((ev.getSource() == navNext) && (next.length() != 0)) { - wizard.show(next); - } - - if ((ev.getSource() == navBack) && (prev.length() != 0)) { - wizard.show(prev); - } - - if (ev.getSource() == navCancel) { - if (ideDetected) { - wizard.show(InstallWizard.IDEWELCOME); - } else { - wizard.exitForm(); - } - - enableIDE(false); - } - } - - public void setNextListener(ActionListener listener) { - navNext.addActionListener(listener); - } - - public void setBackListener(ActionListener listener) { - navBack.addActionListener(listener); - } - - public void setCancelListener(ActionListener listener) { - navCancel.addActionListener(listener); - } - - - - - - public void removeCancelListener(ActionListener listener) { - navCancel.removeActionListener(listener); - } - - private JButton navBack; - public JButton navNext; - public JButton navCancel; - private GridBagConstraints gridBagConstraints1; - private GridBagConstraints gridBagConstraints2; - private GridBagConstraints gridBagConstraints3; - private InstallWizard wizard; - private String next; - private String prev; - private boolean ideDetected = false; -} diff --git a/scripting/workben/installer/Navigation.java b/scripting/workben/installer/Navigation.java deleted file mode 100644 index 82c63a35ad9b..000000000000 --- a/scripting/workben/installer/Navigation.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -public class Navigation extends javax.swing.JPanel { - - /** Creates new form Navigation */ - public Navigation() { - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - navBack = new javax.swing.JButton(); - navNext = new javax.swing.JButton(); - navCancel = new javax.swing.JButton(); - - setLayout(new java.awt.GridBagLayout()); - java.awt.GridBagConstraints gridBagConstraints1; - - navBack.setText("<< Back"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - add(navBack, gridBagConstraints1); - - navNext.setText("Next >>"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 2; - gridBagConstraints1.gridy = 0; - add(navNext, gridBagConstraints1); - - navCancel.setText("Cancel"); - gridBagConstraints1 = new java.awt.GridBagConstraints(); - gridBagConstraints1.gridx = 6; - gridBagConstraints1.gridy = 0; - add(navCancel, gridBagConstraints1); - - }//GEN-END:initComponents - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton navBack; - private javax.swing.JButton navNext; - private javax.swing.JButton navCancel; - // End of variables declaration//GEN-END:variables - -} diff --git a/scripting/workben/installer/ProtocolHandler.xcu b/scripting/workben/installer/ProtocolHandler.xcu deleted file mode 100644 index fe55294f37da..000000000000 --- a/scripting/workben/installer/ProtocolHandler.xcu +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - script:* - - - - diff --git a/scripting/workben/installer/Register.java b/scripting/workben/installer/Register.java deleted file mode 100644 index afe95f5d1de6..000000000000 --- a/scripting/workben/installer/Register.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import javax.swing.*; -public class Register { - - - public static boolean register(String path, JLabel statusLabel) { - String[] packages = {"ooscriptframe.zip", "bshruntime.zip", "jsruntime.zip"}; - - try { - boolean goodResult = false; - String env[] = new String[1]; - ExecCmd command = new ExecCmd(); - boolean isWindows = - (System.getProperty("os.name").indexOf("Windows") != -1); - - String progpath = path.concat("program" + File.separator); - - statusLabel.setText("Registering Scripting Framework..."); - - // pkgchk Scripting Framework Components - statusLabel.setText("Registering Scripting Framework Components..."); - System.out.println("Registering Scripting Framework Components..."); - - for (int i = 0; i < packages.length; i++) { - String cmd = ""; - - if (!isWindows) { - env[0] = "LD_LIBRARY_PATH=" + progpath; - - goodResult = command.exec("chmod a+x " + progpath + "pkgchk", null); - - if (goodResult) { - cmd = progpath + "pkgchk -s -f " + progpath + packages[i]; - - System.err.println(cmd); - goodResult = command.exec(cmd, env); - } - } else { - cmd = "\"" + progpath + "pkgchk.exe\" -s -f \"" + progpath + - packages[i] + "\""; - - System.err.println(cmd); - goodResult = command.exec(cmd, null); - - } - - if (!goodResult) { - System.err.println("\nPkgChk Failed"); - - if (!isWindows) - System.err.println("Command: " + cmd + "\n" + env[0]); - else - System.err.println("Command: \"" + cmd + "\""); - - statusLabel.setText( - "PkgChk Failed, please view SFrameworkInstall.log"); - - return false; - } - } - - // updating StarBasic libraries - statusLabel.setText("Updating StarBasic libraries..."); - - if (!FileUpdater.updateScriptXLC(path, statusLabel)) { - statusLabel.setText("Updating user/basic/script.xlc failed, please view SFrameworkInstall.log"); - return false; - } - - if (!FileUpdater.updateDialogXLC(path, statusLabel)) { - statusLabel.setText("Updating user/basic/dialog.xlc failed, please view SFrameworkInstall.log"); - return false; - } - - } catch (Exception e) { - String message = - "\nError installing scripting package, please view SFrameworkInstall.log."; - System.out.println(message); - e.printStackTrace(); - statusLabel.setText(message); - return false; - } - - return true; - }// register - -}//Register diff --git a/scripting/workben/installer/Scripting.BeanShell.xcu b/scripting/workben/installer/Scripting.BeanShell.xcu deleted file mode 100644 index fdcc5d6b8695..000000000000 --- a/scripting/workben/installer/Scripting.BeanShell.xcu +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - bsh - bsh - - - - diff --git a/scripting/workben/installer/Scripting.JavaScript.xcu b/scripting/workben/installer/Scripting.JavaScript.xcu deleted file mode 100644 index 1849dff273e1..000000000000 --- a/scripting/workben/installer/Scripting.JavaScript.xcu +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - js - js - - - - diff --git a/scripting/workben/installer/Scripting.xcs b/scripting/workben/installer/Scripting.xcs deleted file mode 100644 index 1daeab8e978d..000000000000 --- a/scripting/workben/installer/Scripting.xcs +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - DF - - Contains the various settings needed by the Scripting Framework and its runtimes. - - - - - - Specifies the runtimes available to the Scripting Framework. - - - - - Lists the file extensions that are recognized by this runtime. - - - - - - - - - Lists the registered Scripting Framework runtimes. - - - - diff --git a/scripting/workben/installer/Version.java b/scripting/workben/installer/Version.java deleted file mode 100644 index 8ede6c54527e..000000000000 --- a/scripting/workben/installer/Version.java +++ /dev/null @@ -1,350 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.*; -import java.awt.event.*; -import java.io.*; -import java.util.*; - -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; - -public class Version extends javax.swing.JPanel implements ActionListener, - TableModelListener { - - /** Creates new form Welcome */ - public Version(InstallWizard wizard) { - this.wizard = wizard; - setBackground(Color.white); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() { - Properties props = null; - JPanel versionPanel = new JPanel(); - setLayout(new BorderLayout()); - - System.out.println("Initialising versions"); - - File fileVersions = null; - - try { - fileVersions = InstUtil.buildSversionLocation(); - } catch (IOException eFnF) { - System.err.println("Cannot find sversion.ini/.sversionrc"); - JOptionPane.showMessageDialog(this, eFnF.getMessage(), "File not Found", - JOptionPane.ERROR_MESSAGE); - wizard.exitForm(); - } - - try { - props = InstUtil.getOfficeVersions(fileVersions); - } catch (IOException eIO) { - //Message about no installed versions found - System.err.println("Failed to parse SVERSION"); - JOptionPane.showMessageDialog(this, - "There was a problem reading from the Office settings file.", "Parse Error", - JOptionPane.ERROR_MESSAGE); - wizard.exitForm(); - } - - tableModel = new MyTableModel(props); - - if (tableModel.getRowCount() == 0) { - JOptionPane.showMessageDialog(this, - "No compatible versions of Office were found.", "Invalid versions", - JOptionPane.ERROR_MESSAGE); - wizard.exitForm(); - } - - tableModel.addTableModelListener(this); - JTable tableVersions = new JTable(tableModel) { - @Override - public String getToolTipText(MouseEvent event) { - int col = columnAtPoint(event.getPoint()); - - if (col != 2) - return null; - - int row = rowAtPoint(event.getPoint()); - Object o = getValueAt(row, col); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - return o.toString(); - } - - @Override - public Point getToolTipLocation(MouseEvent event) { - int col = columnAtPoint(event.getPoint()); - - if (col != 2) - return null; - - int row = rowAtPoint(event.getPoint()); - Object o = getValueAt(row, col); - - if (o == null) - return null; - - if (o.toString().equals("")) - return null; - - Point pt = getCellRect(row, col, true).getLocation(); - pt.translate(-1, -2); - return pt; - } - }; - - JScrollPane scroll = new JScrollPane(tableVersions); - - tableVersions.setPreferredSize( - new Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT)); - - tableVersions.setRowSelectionAllowed(false); - tableVersions.setColumnSelectionAllowed(false); - tableVersions.setCellSelectionEnabled(false); - - initColumnSizes(tableVersions, tableModel); - versionPanel.add(scroll); - - JTextArea area = new - JTextArea("Please select the Office version you wish to Update"); - area.setLineWrap(true); - area.setEditable(false); - add(area, BorderLayout.NORTH); - add(versionPanel, BorderLayout.CENTER); - //nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, InstallWizard.FINAL); - nav = new NavPanel(wizard, true, false, true, InstallWizard.WELCOME, - InstallWizard.FINAL); - nav.setNextListener(this); - add(nav, BorderLayout.SOUTH); - - }// initComponents - - private void initColumnSizes(JTable table, MyTableModel model) { - TableColumn column = null; - Component comp = null; - int headerWidth = 0; - int cellWidth = 0; - int preferredWidth = 0; - int totalWidth = 0; - Object[] longValues = model.longValues; - - for (int i = 0; i < 3; i++) { - column = table.getColumnModel().getColumn(i); - - try { - comp = column.getHeaderRenderer(). - getTableCellRendererComponent( - null, column.getHeaderValue(), - false, false, 0, 0); - headerWidth = comp.getPreferredSize().width; - } catch (NullPointerException e) { - // System.err.println("Null pointer exception!"); - // System.err.println(" getHeaderRenderer returns null in 1.3."); - // System.err.println(" The replacement is getDefaultRenderer."); - } - - // need to replace spaces in String before getting preferred width - if (longValues[i] instanceof String) { - longValues[i] = ((String)longValues[i]).replace(' ', '_'); - } - - System.out.println("longValues: " + longValues[i]); - comp = table.getDefaultRenderer(model.getColumnClass(i)). - getTableCellRendererComponent( - table, longValues[i], - false, false, 0, i); - cellWidth = comp.getPreferredSize().width; - - preferredWidth = Math.max(headerWidth, cellWidth); - - if (false) { - System.out.println("Initializing width of column " - + i + ". " - + "preferredWidth = " + preferredWidth - + "; totalWidth = " + totalWidth - + "; leftWidth = " + (InstallWizard.DEFWIDTH - totalWidth)); - } - - //XXX: Before Swing 1.1 Beta 2, use setMinWidth instead. - if (i == 2) { - if (preferredWidth > InstallWizard.DEFWIDTH - totalWidth) - column.setPreferredWidth(InstallWizard.DEFWIDTH - totalWidth); - else - column.setPreferredWidth(preferredWidth); - } else { - column.setMinWidth(preferredWidth); - totalWidth += preferredWidth; - } - } - } - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(320, 280); - } - - - public void actionPerformed(ActionEvent ev) { - InstallWizard.clearLocations(); - int len = tableModel.data.size(); - - for (int i = 0; i < len; i++) { - ArrayList list = tableModel.data.get(i); - - if (((Boolean)list.get(0)).booleanValue()) - InstallWizard.storeLocation((String)list.get(2)); - } - } - - - public void tableChanged(TableModelEvent e) { - if (tableModel.isAnySelected()) { - nav.enableNext(true); - } else { - nav.enableNext(false); - } - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private InstallWizard wizard; - private MyTableModel tableModel; - private NavPanel nav; - private static final String [] versions = {"StarOffice 6.1", "OpenOffice.org 1.1Beta", "OpenOffice.org 644", "OpenOffice.org 1.1"}; - // End of variables declaration//GEN-END:variables - -} - -class MyTableModel extends AbstractTableModel { - ArrayList> data; - private String colNames[] = {"", "Name", "Location"}; - Object[] longValues = new Object[] {Boolean.TRUE, "Name", "Location"}; - - MyTableModel(Properties properties) { - data = new ArrayList>(); - boolean isWindows = - (System.getProperty("os.name").indexOf("Windows") != -1); - - for (Enumeration e = properties.propertyNames(); e.hasMoreElements() ;) { - String key = (String)e.nextElement(); - String path = null; - - if (!(key.startsWith("#")) && - (path = properties.getProperty(key)) != null) { - String pkgChkPath = path + File.separator + "program" + File.separator; - - if (isWindows) { - pkgChkPath += "pkgchk.exe"; - } else { - pkgChkPath += "pkgchk"; - } - - File pkgChk = new File(pkgChkPath); - - if (pkgChk.exists()) { - ArrayList row = new ArrayList(); - row.add(0, Boolean.FALSE); - - row.add(1, key); - - if (key.length() > ((String)longValues[1]).length()) { - longValues[1] = key; - } - - row.add(2, path); - - if (path.length() > ((String)longValues[2]).length()) { - longValues[2] = path; - } - - data.add(row); - } - } - } - }// MyTableModel - - public int getColumnCount() { - return 3; - } - - public int getRowCount() { - return data.size(); - } - - @Override - public String getColumnName(int col) { - return colNames[col]; - } - - public Object getValueAt(int row, int col) { - if (row < 0 || row > getRowCount() || - col < 0 || col > getColumnCount()) - return null; - - ArrayList aRow = data.get(row); - return aRow.get(col); - } - - @Override - public Class getColumnClass(int c) { - return getValueAt(0, c).getClass(); - } - - @Override - public boolean isCellEditable(int row, int col) { - return (col == 0); - } - - @Override - public void setValueAt(Object value, int row, int col) { - ArrayList aRow = data.get(row); - aRow.set(col, value); - fireTableCellUpdated(row, col); - } - - - - public boolean isAnySelected() { - Iterator iter = data.iterator(); - - while (iter.hasNext()) { - ArrayList row = (ArrayList)iter.next(); - - if (((Boolean)row.get(0)).booleanValue()) { - return true; - } - } - - return false; - } - -} diff --git a/scripting/workben/installer/Welcome.java b/scripting/workben/installer/Welcome.java deleted file mode 100644 index c71a7af6b4fb..000000000000 --- a/scripting/workben/installer/Welcome.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.awt.event.*; - -public class Welcome extends javax.swing.JPanel implements ActionListener { - - /** Creates new form Welcome */ - public Welcome(InstallWizard wizard) { - this.wizard = wizard; - setBorder(new javax.swing.border.EtchedBorder( - javax.swing.border.EtchedBorder.RAISED)); - initComponents(); - } - - /** This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - private void initComponents() {//GEN-BEGIN:initComponents - welcomePanel = new javax.swing.JPanel(); - area = new javax.swing.JTextArea(); - nextButtonEnable = true; - - setLayout(new java.awt.BorderLayout()); - - welcomePanel.setLayout(new java.awt.BorderLayout()); - area.setEditable(false); - area.setLineWrap(true); - - String message = "\n\tOffice Scripting Framework Version 0.3" + - "\n\n\n\tPlease ensure that you have exited from Office"; - - setUpWelcomePanel(message); - - }//GEN-END:initComponents - - private void setUpWelcomePanel(String message) { - area.setText(message); - welcomePanel.add(area, java.awt.BorderLayout.CENTER); - add(welcomePanel, java.awt.BorderLayout.CENTER); - NavPanel nav = new NavPanel(wizard, false, nextButtonEnable, true, "", - InstallWizard.VERSIONS); - nav.setNextListener(this); - add(nav, java.awt.BorderLayout.SOUTH); - } - - - @Override - public java.awt.Dimension getPreferredSize() { - return new java.awt.Dimension(InstallWizard.DEFWIDTH, InstallWizard.DEFHEIGHT); - } - - public void actionPerformed(ActionEvent ev) { - //Perform next actions here... - } - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel welcomePanel; - private javax.swing.JTextArea area; - private InstallWizard wizard; - private boolean nextButtonEnable = true; - - // End of variables declaration//GEN-END:variables -} diff --git a/scripting/workben/installer/XmlUpdater.java b/scripting/workben/installer/XmlUpdater.java deleted file mode 100644 index c7bd2ff6ac3a..000000000000 --- a/scripting/workben/installer/XmlUpdater.java +++ /dev/null @@ -1,389 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import java.util.*; -import javax.swing.*; - -public class XmlUpdater extends Thread { - - private String installPath; - private boolean netInstall; - private boolean bindingsInstall; - - private JLabel statusLabel; - - private ArrayList listeners; - private Thread internalThread; - private boolean threadSuspended; - private JProgressBar progressBar; - - private final String[] bakFiles = { - "writermenubar.xml", - "writerkeybinding.xml", - "calcmenubar.xml", - "calckeybinding.xml", - "impressmenubar.xml", - "impresskeybinding.xml", - "drawmenubar.xml", - "drawkeybinding.xml", - "eventbindings.xml", - "META-INF" + File.separator + "manifest.xml" - }; - - private final String[] dirs = { - "java" + File.separator + "Highlight", - "java" + File.separator + "MemoryUsage", - "java" + File.separator + "ScriptFrmwrkHelper", - "java" + File.separator + "debugger", - "java" + File.separator + "debugger" + File.separator + "rhino", - "beanshell" + File.separator + "InteractiveBeanShell", - "beanshell" + File.separator + "Highlight", - "beanshell" + File.separator + "MemoryUsage", - "javascript" + File.separator + "ExportSheetsToHTML" - }; - - private final String[] names = { - "java/Highlight/HighlightUtil.java", - "java/Highlight/HighlightText.java", - "java/Highlight/Highlight.jar", - "java/Highlight/parcel-descriptor.xml", - "java/MemoryUsage/MemoryUsage.java", - "java/MemoryUsage/MemoryUsage.class", - "java/MemoryUsage/parcel-descriptor.xml", - "java/MemoryUsage/ExampleSpreadSheet.sxc", - "java/ScriptFrmwrkHelper/parcel-descriptor.xml", - "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.java", - "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.class", - "java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar", - "java/debugger/debugger.jar", - "java/debugger/OOBeanShellDebugger.java", - "java/debugger/OOScriptDebugger.java", - "java/debugger/DebugRunner.java", - "java/debugger/OORhinoDebugger.java", - "java/debugger/parcel-descriptor.xml", - "java/debugger/rhino/Main.java", - "beanshell/InteractiveBeanShell/parcel-descriptor.xml", - "beanshell/InteractiveBeanShell/interactive.bsh", - "beanshell/Highlight/parcel-descriptor.xml", - "beanshell/Highlight/highlighter.bsh", - "beanshell/MemoryUsage/parcel-descriptor.xml", - "beanshell/MemoryUsage/memusage.bsh", - "javascript/ExportSheetsToHTML/parcel-descriptor.xml", - "javascript/ExportSheetsToHTML/exportsheetstohtml.js" - }; - - - public XmlUpdater(String installPath, JLabel statusLabel, JProgressBar pBar, - boolean netInstall, boolean bindingsInstall) { - this.installPath = installPath; - this.statusLabel = statusLabel; - this.netInstall = netInstall; - this.bindingsInstall = bindingsInstall; - listeners = new ArrayList(); - threadSuspended = false; - progressBar = pBar; - progressBar.setStringPainted(true); - }// XmlUpdater - - - - - - public void setResume() { - threadSuspended = false; - notify(); - }// setResume - - - @Override - public void run() { - - internalThread = Thread.currentThread(); - - String progpath = installPath; - progpath = progpath.concat(File.separator + "program" + File.separator); - - String starBasicPath = installPath; - starBasicPath = starBasicPath.concat(File.separator + "share" + File.separator + - "basic" + File.separator + "ScriptBindingLibrary" + File.separator); - - String regSchemaOfficePath = installPath; - regSchemaOfficePath = regSchemaOfficePath.concat(File.separator + "share" + - File.separator + "registry" + File.separator + "schema" + File.separator + "org" - + File.separator + "openoffice" + File.separator + "Office" + File.separator); - - progressBar.setString("Unzipping Required Files"); - ZipData zd = new ZipData(); - - - if ((!netInstall) || bindingsInstall) { - String configPath = installPath; - configPath = configPath.concat(File.separator + "user" + File.separator + - "config" + File.separator + "soffice.cfg" + File.separator); - String manifestPath = configPath + "META-INF" + File.separator; - - //Adding /user/config/soffice.cfg/ - File configDir = new File(configPath); - - if (!configDir.isDirectory()) { - if (!configDir.mkdir()) { - System.out.println("creating " + configDir + "directory failed"); - } else { - System.out.println(configDir + "directory created"); - } - } else - System.out.println("soffice.cfg exists"); - - File manifestDir = new File(manifestPath); - - if (!manifestDir.isDirectory()) { - if (!manifestDir.mkdir()) { - System.out.println("creating " + manifestPath + "directory failed"); - } else { - System.out.println(manifestPath + " directory created"); - } - } else - System.out.println(manifestPath + " exists"); - - // Backup the confguration files in - // /user/config/soffice.cfg/ - // If they already exist. - - for (int i = 0; i < bakFiles.length; i++) { - String pathNameBak = configPath + bakFiles[i]; - File origFile = new File(pathNameBak); - - if (origFile.exists()) { - System.out.println("Attempting to backup " + pathNameBak + " to " + pathNameBak - + ".bak"); - - if (! origFile.renameTo(new File(pathNameBak + ".bak"))) { - System.out.println("Failed to backup " + pathNameBak + " to " + pathNameBak + - ".bak"); - } - } - } - - // Adding Office configuration files - if (!zd.extractEntry("bindingdialog/writermenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/writerkeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/calcmenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/calckeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/impressmenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/impresskeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/drawmenubar.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/drawkeybinding.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/eventbindings.xml", configPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/manifest.xml", manifestPath, statusLabel)) { - onInstallComplete(); - return; - } - } - - if (!bindingsInstall) { - // Adding new directories to Office - // Adding /user/basic/ScriptBindingLibrary/ - File scriptBindingLib = new File(starBasicPath); - - if (!scriptBindingLib.isDirectory()) { - if (!scriptBindingLib.mkdir()) { - System.out.println("ScriptBindingLibrary failed"); - } else { - System.out.println("ScriptBindingLibrary directory created"); - } - } else - System.out.println("ScriptBindingLibrary exists"); - - // Adding Scripting Framework and tools - if (!zd.extractEntry("sframework/ooscriptframe.zip", progpath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("sframework/bshruntime.zip", progpath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("sframework/jsruntime.zip", progpath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("schema/Scripting.xcs", regSchemaOfficePath, - statusLabel)) { - onInstallComplete(); - return; - } - - - - progressBar.setString("Registering Scripting Framework"); - progressBar.setValue(3); - - if (!Register.register(installPath + File.separator, statusLabel)) { - onInstallComplete(); - return; - } - - progressBar.setValue(5); - - String path = installPath + File.separator + - "share" + File.separator + "Scripts" + File.separator; - - for (int i = 0; i < dirs.length; i++) { - File dir = new File(path + dirs[i]); - - if (!dir.exists()) { - if (!dir.mkdirs()) { - System.err.println("Error making dir: " + - dir.getAbsolutePath()); - onInstallComplete(); - return; - } - } - } - - for (int i = 0; i < names.length; i++) { - String source = "/examples/" + names[i]; - String dest = path + names[i].replace('/', File.separatorChar); - - if (!zd.extractEntry(source, dest, statusLabel)) { - onInstallComplete(); - return; - } - } - - - // Adding binding dialog - if (!zd.extractEntry("bindingdialog/ScriptBinding.xba", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/MenuBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/KeyBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/EventsBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/HelpBinding.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/EditDebug.xdl", starBasicPath, - statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/dialog.xlb", starBasicPath, statusLabel)) { - onInstallComplete(); - return; - } - - if (!zd.extractEntry("bindingdialog/script.xlb", starBasicPath, statusLabel)) { - onInstallComplete(); - return; - } - } - - - statusLabel.setText("Installation Complete"); - progressBar.setString("Installation Complete"); - progressBar.setValue(10); - onInstallComplete(); - - }// run - - - public void addInstallListener(InstallListener listener) { - listeners.add(listener); - }// addInstallListener - - - private void onInstallComplete() { - for (InstallListener l : listeners) { - l.installationComplete(null); - } - }// onInstallComplete - -}// XmlUpdater class diff --git a/scripting/workben/installer/ZipData.java b/scripting/workben/installer/ZipData.java deleted file mode 100644 index 6e5d513a16be..000000000000 --- a/scripting/workben/installer/ZipData.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package installer; - -import java.io.*; -import javax.swing.*; - -public class ZipData { - - public boolean extractEntry(String entry, String destination, - JLabel statusLabel) { - - OutputStream out = null; - InputStream in = null; - - System.out.println("Copying: " + entry); - System.out.println("To: " + destination); - - if (statusLabel != null) { - statusLabel.setText("Copying " + entry); - } - - String entryName; - - if (entry.lastIndexOf("/") != -1) { - entryName = entry.substring(entry.lastIndexOf("/") + 1); - } else { - entryName = entry; - } - - String destName; - - if (destination.lastIndexOf(File.separator) != -1) { - destName = destination.substring(destination - .lastIndexOf(File.separator) + 1); - } else { - destName = destination; - } - - if (!destName.equals(entryName)) - destination = destination.concat(entryName); - - System.out.println("Unzipping " + entry + " to " + destination); - - if (!entry.startsWith("/")) - entry = "/" + entry; - - in = this.getClass().getResourceAsStream(entry); - - if (in == null) { - System.err.println("File " + entry + " not found in jar file"); - - if (statusLabel != null) - statusLabel.setText("Failed extracting " + entry - + "see SFramework.log for more information"); - - return false; - } - - try { - out = new FileOutputStream(destination); - } catch (IOException ioe) { - System.err.println("Error opening " + destination + ": " - + ioe.getMessage()); - - if (statusLabel != null) - statusLabel.setText("Error opening" + destination - + "see SFramework.log for more information"); - - return false; - } - - try { - byte[] bytes = new byte[1024]; - int len; - - while ((len = in.read(bytes)) != -1) - out.write(bytes, 0, len); - } catch (IOException ioe) { - System.err.println("Error writing " + destination + ": " - + ioe.getMessage()); - - if (statusLabel != null) - statusLabel.setText("Failed writing " + destination - + "see SFramework.log for more information"); - - return false; - } finally { - try { - in.close(); - out.close(); - } catch (IOException ioe) { - } - } - - return true; - } -} diff --git a/scripting/workben/installer/sidebar.jpg b/scripting/workben/installer/sidebar.jpg deleted file mode 100644 index c2b366f74e76..000000000000 Binary files a/scripting/workben/installer/sidebar.jpg and /dev/null differ diff --git a/scripting/workben/makefile.mk b/scripting/workben/makefile.mk deleted file mode 100644 index 41d18bc2b952..000000000000 --- a/scripting/workben/makefile.mk +++ /dev/null @@ -1,26 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ=.. -PRJNAME=scriptinginstaller -TARGET=scriptinginstaller - -.INCLUDE : ant.mk - -ALLTAR : ANTBUILD - diff --git a/scripting/workben/mod/_scripting/Dispatch.java b/scripting/workben/mod/_scripting/Dispatch.java deleted file mode 100644 index 20542cf02d10..000000000000 --- a/scripting/workben/mod/_scripting/Dispatch.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import java.io.PrintWriter; - -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; - -import util.SOfficeFactory; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XComponent; - -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.frame.XModel; -import com.sun.star.frame.XFrame; -import com.sun.star.util.URL; -import com.sun.star.util.XURLTransformer; - - - -public class Dispatch extends TestCase { - private String scriptURL = "script://HighlightText.showForm"; - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { - log.println("creating test environment"); - XInterface oObj = null; - URL dispatchURL = null; - - try { - - XMultiServiceFactory xMSF = tParam.getMSF(); - SOfficeFactory SOF = null; - SOF = SOfficeFactory.getFactory(xMSF); - String docPath = util.utils.getFullTestURL("ExampleSpreadSheetLatest.sxc"); - XComponent doc = SOF.loadDocument(docPath); - XModel model = UnoRuntime.queryInterface(XModel.class, - doc); - XFrame frame = model.getCurrentController().getFrame(); - oObj = (XInterface) - xMSF.createInstanceWithArguments("com.sun.star.comp.ScriptProtocolHandler", - new Object[] { frame }); - - XURLTransformer xParser = UnoRuntime.queryInterface(XURLTransformer.class, - tParam.getMSF().createInstance - ("com.sun.star.util.URLTransformer")); - // Because it's an in/out parameter we must use an array of - // URL objects. - URL[] aParseURL = new URL[1]; - aParseURL[0] = new URL(); - aParseURL[0].Complete = scriptURL; - xParser.parseStrict(aParseURL); - dispatchURL = aParseURL[0]; - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(); - throw new StatusException("Can't create object environment", e) ; - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - tEnv.addObjRelation("XDispatchProvider.URL", scriptURL); - tEnv.addObjRelation("XDispatch.URL", dispatchURL); - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} - - diff --git a/scripting/workben/mod/_scripting/Function.java b/scripting/workben/mod/_scripting/Function.java deleted file mode 100644 index 9a2d8b273144..000000000000 --- a/scripting/workben/mod/_scripting/Function.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import com.sun.star.uno.XInterface; -import java.io.PrintWriter; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.frame.XModel; -import com.sun.star.lang.XComponent; -import util.SOfficeFactory; - -import drafts.com.sun.star.script.framework.provider.XFunctionProvider; - -public class Function extends TestCase { - private String script = "script://returns-Integer"; - private String doc = "doc_with_beanshell_scripts.sxw"; - - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { - XInterface oObj = null; - XFunctionProvider provider = null; - - log.println("creating test environment"); - - try { - - XMultiServiceFactory xMSF = tParam.getMSF(); - SOfficeFactory SOF = null; - SOF = SOfficeFactory.getFactory(xMSF); - String docPath = util.utils.getFullTestURL(doc); - XComponent doc = SOF.loadDocument(docPath); - XModel model = UnoRuntime.queryInterface(XModel.class, - doc); - oObj = - (XInterface) - xMSF.createInstanceWithArguments("drafts.com.sun.star.script.framework.provider.FunctionProvider", - new Object[] { model }); - provider = UnoRuntime.queryInterface(XFunctionProvider.class, oObj); - oObj = provider.getFunction(script); - - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(); - throw new StatusException("Can't create object environment", e) ; - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - tEnv.addObjRelation("provider", provider); - TestDataLoader.setupData(tEnv, "Function"); - - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} - - diff --git a/scripting/workben/mod/_scripting/FunctionProvider.java b/scripting/workben/mod/_scripting/FunctionProvider.java deleted file mode 100644 index 8cbedee9935e..000000000000 --- a/scripting/workben/mod/_scripting/FunctionProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import com.sun.star.uno.XInterface; -import java.io.PrintWriter; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; - -import com.sun.star.frame.XModel; -import com.sun.star.frame.XDesktop; - -public class FunctionProvider extends TestCase { - - String docPath = null; - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { - XInterface oObj = null; - log.println("creating test environment"); - - try { - - XMultiServiceFactory xMSF = tParam.getMSF(); - - Object xInterface = xMSF.createInstance("com.sun.star.frame.Desktop"); - XDesktop dtop = UnoRuntime.queryInterface(XDesktop.class, - xInterface); - - XModel model = dtop.getCurrentFrame().getController().getModel(); - oObj = - (XInterface) - xMSF.createInstanceWithArguments("drafts.com.sun.star.script.framework.provider.FunctionProvider", - new Object[] { model }); - - - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - TestDataLoader.setupData(tEnv, "FunctionProvider"); - - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} - - diff --git a/scripting/workben/mod/_scripting/ScriptInfo.java b/scripting/workben/mod/_scripting/ScriptInfo.java deleted file mode 100644 index 05b7b3d0c80e..000000000000 --- a/scripting/workben/mod/_scripting/ScriptInfo.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import com.sun.star.uno.XInterface; -import java.io.PrintWriter; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import java.net.URLEncoder; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.uno.UnoRuntime; - -import drafts.com.sun.star.script.framework.storage.XScriptInfoAccess; -import drafts.com.sun.star.script.framework.storage.XScriptInfo; - -public class ScriptInfo extends TestCase { - - String docPath = null; - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - // Get path to test documents - String rootDocPath = (String)tParam.get("TEST_DOCUMENT_PATH"); - System.out.println("TEST_DOCUMENT_PATH is " + rootDocPath); - rootDocPath = util.utils.getFullTestURL("ExampleSpreadSheetLatest.sxc"); - - if (rootDocPath != null && rootDocPath.length() > 1) { - // convert all "\\" to "/", necessary for UCB - if (rootDocPath.indexOf("\\") > 0) { - rootDocPath = rootDocPath.replace('\\', '/'); - } - - System.out.println("After processing the path is " + rootDocPath); - // encode the ulr (for UCB) - String encodedPath = URLEncoder.encode(rootDocPath); - System.out.println("The encoded path is " + encodedPath); - docPath = "vnd.sun.star.pkg://" + encodedPath; - System.out.println("docPath path is " + docPath); - } - - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { - - log.println("creating test environment"); - - if (docPath == null) { - log.println("Testdata not set up, docPath is null"); - throw new StatusException( - "Can't create object environment, no test document available", - new Exception()) ; - } - - XInterface oObj = null; - XSimpleFileAccess access = null; - - try { - XMultiServiceFactory xMSF = tParam.getMSF(); - Object xInterface = - xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); - Object storageObj = xMSF.createInstanceWithArguments( - "drafts.com.sun.star.script.framework.storage.ScriptStorage", - new Object[] { access, Integer.valueOf(99), docPath }); - XScriptInfoAccess infoAccess = UnoRuntime.queryInterface( - XScriptInfoAccess.class, storageObj); - XScriptInfo[] infos = - infoAccess.getImplementations("script://MemoryUtils.MemUsage?location=document"); - oObj = infos[0]; - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - TestDataLoader.setupData(tEnv, "ScriptInfo"); - - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} - - diff --git a/scripting/workben/mod/_scripting/ScriptRuntimeManager.java b/scripting/workben/mod/_scripting/ScriptRuntimeManager.java deleted file mode 100644 index 6051adb1ae70..000000000000 --- a/scripting/workben/mod/_scripting/ScriptRuntimeManager.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import com.sun.star.uno.XInterface; -import java.io.PrintWriter; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; - -public class ScriptRuntimeManager extends TestCase { - - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { - - log.println("creating test environment"); - - XInterface oObj = null; - - try { - oObj = (XInterface) Param.getMSF().createInstance - ("drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager"); - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - TestDataLoader.setupData(tEnv, "ScriptRuntimeManager"); - - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} diff --git a/scripting/workben/mod/_scripting/ScriptStorage.java b/scripting/workben/mod/_scripting/ScriptStorage.java deleted file mode 100644 index c09f24c083fd..000000000000 --- a/scripting/workben/mod/_scripting/ScriptStorage.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import com.sun.star.uno.XInterface; -import java.io.PrintWriter; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; -import java.net.URLEncoder; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ucb.XSimpleFileAccess; -import com.sun.star.uno.UnoRuntime; - -public class ScriptStorage extends TestCase { - - String docPath = null; - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - // Get path to test documents - String rootDocPath = (String)tParam.get("TEST_DOCUMENT_PATH"); - System.out.println("TEST_DOCUMENT_PATH is " + rootDocPath); - rootDocPath = util.utils.getFullTestURL("ExampleSpreadSheetLatest.sxc"); - - if (rootDocPath != null && rootDocPath.length() > 1) { - // convert all "\\" to "/", necessary for UCB - if (rootDocPath.indexOf("\\") > 0) { - rootDocPath = rootDocPath.replace('\\', '/'); - } - - System.out.println("After processing the path is " + rootDocPath); - // encode the ulr (for UCB) - String encodedPath = URLEncoder.encode(rootDocPath); - System.out.println("The encoded path is " + encodedPath); - docPath = "vnd.sun.star.pkg://" + encodedPath; - System.out.println("docPath path is " + docPath); - } - - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters tParam, PrintWriter log) throws StatusException { - - log.println("creating test environment"); - - if (docPath == null) { - log.println("Testdata not set up, docPath is null"); - throw new StatusException( - "Can't create object environment, no test document available", - new Exception()) ; - } - - XInterface oObj = null; - XSimpleFileAccess access = null; - - try { - XMultiServiceFactory xMSF = tParam.getMSF(); - Object xInterface = - xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess"); - access = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface); - oObj = (XInterface)xMSF.createInstanceWithArguments( - "drafts.com.sun.star.script.framework.storage.ScriptStorage", - new Object[] { access, Integer.valueOf(99), docPath }); - - } catch (com.sun.star.uno.Exception e) { - throw new StatusException("Can't create object environment", e) ; - } - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - TestDataLoader.setupData(tEnv, "ScriptStorage"); - - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} - - diff --git a/scripting/workben/mod/_scripting/ScriptStorageManager.java b/scripting/workben/mod/_scripting/ScriptStorageManager.java deleted file mode 100644 index b18c613f59e8..000000000000 --- a/scripting/workben/mod/_scripting/ScriptStorageManager.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.beans.XPropertySet; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; -import java.io.PrintWriter; -import lib.StatusException; -import lib.TestCase; -import lib.TestEnvironment; -import lib.TestParameters; - -public class ScriptStorageManager extends TestCase { - - @Override - public void initialize(TestParameters tParam, PrintWriter log) { - } - - @Override - - public synchronized TestEnvironment createTestEnvironment( - TestParameters Param, PrintWriter log) throws StatusException { - - XInterface oObj = null; - Object oInterface = null; - - try { - XMultiServiceFactory xMSF = Param.getMSF(); - XPropertySet xProp = UnoRuntime.queryInterface( - XPropertySet.class, xMSF); - // get context - XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, - xProp.getPropertyValue("DefaultContext")); - // get the script storage manager from context - oInterface = xContext.getValueByName("/singletons/" + - "drafts.com.sun.star.script.framework.storage.theScriptStorageManager"); - } catch (Exception e) { - log.println("ScriptStorageManager singleton service not available"); - e.printStackTrace(); - } - - oObj = (XInterface) oInterface; - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - TestDataLoader.setupData(tEnv, "ScriptStorageManager"); - - return tEnv ; - } - - @Override - - public synchronized void disposeTestEnvironment(TestEnvironment tEnv, - TestParameters tParam) { - } -} - - diff --git a/scripting/workben/mod/_scripting/TestDataLoader.java b/scripting/workben/mod/_scripting/TestDataLoader.java deleted file mode 100644 index 6f8078656058..000000000000 --- a/scripting/workben/mod/_scripting/TestDataLoader.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -package mod._scripting; - -import java.io.File; -import java.io.FileReader; -import java.io.BufferedReader; -import java.io.IOException; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.StringTokenizer; - -import lib.TestEnvironment; -import lib.Parameters; - -public class TestDataLoader { - - private TestDataLoader() { - } - - public static void setupData(TestEnvironment tEnv, String name) { - String filename = - util.utils.getFullTestDocName("testdata"); - File testdatadir = new File(filename); - File f = new File(testdatadir, name + ".csv"); - - if (!f.exists()) - return; - - - try { - BufferedReader in = new BufferedReader(new FileReader(f)); - - String s, previous, current; - ArrayList list = new ArrayList(11); - - if ((s = in.readLine()) != null) { - StringTokenizer st = new StringTokenizer(s, ";"); - - current = previous = st.nextToken(); - list.add(getParameters(st)); - } else { - in.close(); - return; - } - - while ((s = in.readLine()) != null) { - StringTokenizer st = new StringTokenizer(s, ";"); - - current = st.nextToken(); - - if (!current.equals(previous)) { - tEnv.addObjRelation(previous, list); - previous = current; - list = new ArrayList(11); - } - - list.add(getParameters(st)); - } - - tEnv.addObjRelation(previous, list); - in.close(); - } catch (IOException ioe) { - } - } - - private static Parameters getParameters(StringTokenizer st) { - String separator = "="; - HashMap map = new HashMap(5); - - while (st.hasMoreTokens()) { - String pair = st.nextToken(); - StringTokenizer tokens = new StringTokenizer(pair, separator); - - String name; - String value; - - if (tokens.countTokens() < 2) - continue; - - name = tokens.nextToken(); - - if (tokens.countTokens() == 1) - value = tokens.nextToken(); - else { - StringBuffer buf = new StringBuffer(tokens.nextToken()); - - while (tokens.hasMoreTokens()) - buf.append(separator).append(tokens.nextToken()); - - value = buf.toString(); - } - - map.put(name, value); - } - - return new Parameters(map); - } -} diff --git a/scripting/workben/mod/_scripting/makefile.mk b/scripting/workben/mod/_scripting/makefile.mk deleted file mode 100644 index 0519fc57a953..000000000000 --- a/scripting/workben/mod/_scripting/makefile.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# - -PRJ = ..$/..$/..$/.. -PRJNAME = testcase -TARGET = testcase - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar $(CLASSPATH) -JAVAFILES = $(foreach,j,$(shell @ls | grep java) $j) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk