diff options
author | Xisco Fauli <anistenis@gmail.com> | 2013-06-09 21:59:05 +0200 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2013-06-09 22:02:58 +0200 |
commit | 352d6ffa8e3aee793486d8e065ad044b58ca5dac (patch) | |
tree | dca4fafa0d55a5d27edaa642444470bfc67c4c52 /wizards/com | |
parent | 11a560967f11f10ec570f665d0e65e17f124912a (diff) |
fdo#38820 - Remove java web wizard
Change-Id: Iff32e2dbde7f0a7eedd5cf62c5b37fba8bb9ff54
Diffstat (limited to 'wizards/com')
55 files changed, 0 insertions, 10325 deletions
diff --git a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java deleted file mode 100644 index cd388ed3beaf..000000000000 --- a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java +++ /dev/null @@ -1,229 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.VclWindowPeerAttribute; -import com.sun.star.awt.XWindowPeer; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.SystemDialog; - -/** - * An abstract implementation of ErrorHandler, which - * uses a renderer method geMessageFor(Exception, Object, int, int) - * (in this class still abstract...) - * to render the errors, and displays - * error messeges. - */ -public abstract class AbstractErrorHandler implements ErrorHandler -{ - - XMultiServiceFactory xmsf; - XWindowPeer peer; - - protected AbstractErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer_) - { - this.xmsf = xmsf; - peer = peer_; - } - - /** - * Implementation of ErrorHandler: - * shows a message box with the rendered error. - * @param arg identifies the error. This object is passed to the render method - * which returns the right error message. - * @return true/false for continue/abort. - */ - public boolean error(Exception ex, Object arg, int ix, int errorType) - { - //ex.printStackTrace(); - switch (errorType) - { - case ErrorHandler.ERROR_FATAL: - return !showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_PROCESS_FATAL: - return !showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_NORMAL_ABORT: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_NORMAL_IGNORE: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_QUESTION_CANCEL: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_QUESTION_OK: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_QUESTION_NO: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_QUESTION_YES: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_WARNING: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - case ErrorHandler.ERROR_MESSAGE: - return showMessage(getMessageFor(ex, arg, ix, errorType), errorType); - } - throw new IllegalArgumentException("unknown error type"); - } - - /** - * @deprecated - * @param message - * @param errorType - * @return true if the ok/yes button is clicked, false otherwise. - */ - protected boolean showMessage(String message, int errorType) - { - return showMessage(xmsf, peer, message, errorType); - } - - /** - * display a message - * @deprecated - * @param xmsf - * @param message the message to display - * @param errorType an int constant from the ErrorHandler interface. - * @return - */ - public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer, String message, int errorType) - { - String serviceName = getServiceNameFor(errorType); - int attribute = getAttributeFor(errorType); - int b = SystemDialog.showMessageBox(xmsf, peer, serviceName, attribute, message); - return b == getTrueFor(errorType); - } - - public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer, - String message, - String dialogtype, - int buttons, - int defaultButton, - int returnTrueOn) - { - int b = SystemDialog.showMessageBox(xmsf, peer, dialogtype, defaultButton + buttons, message); - return b == returnTrueOn; - } - - /** - * normally ok(1) is the value for true. - * but a question dialog may use yes. so i use this method - * for each error type to get its type of "true" value. - * @param errorType - * @return - */ - private static int getTrueFor(int errorType) - { - switch (errorType) - { - case ErrorHandler.ERROR_FATAL: - case ErrorHandler.ERROR_PROCESS_FATAL: - case ErrorHandler.ERROR_NORMAL_ABORT: - case ErrorHandler.ERROR_NORMAL_IGNORE: - case ErrorHandler.ERROR_QUESTION_CANCEL: - case ErrorHandler.ERROR_QUESTION_OK: - - return 1; - - case ErrorHandler.ERROR_QUESTION_NO: - case ErrorHandler.ERROR_QUESTION_YES: - - return 2; - - case ErrorHandler.ERROR_WARNING: - case ErrorHandler.ERROR_MESSAGE: - - return 1; - } - throw new IllegalArgumentException("unkonown error type"); - } - - /** - * @param errorType - * @return the Uno attributes for each error type. - */ - private static int getAttributeFor(int errorType) - { - switch (errorType) - { - case ErrorHandler.ERROR_FATAL: - return VclWindowPeerAttribute.OK; - case ErrorHandler.ERROR_PROCESS_FATAL: - return VclWindowPeerAttribute.OK; - case ErrorHandler.ERROR_NORMAL_ABORT: - return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL; - case ErrorHandler.ERROR_NORMAL_IGNORE: - return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK; - case ErrorHandler.ERROR_QUESTION_CANCEL: - return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL; - case ErrorHandler.ERROR_QUESTION_OK: - return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK; - case ErrorHandler.ERROR_QUESTION_NO: - return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO; - case ErrorHandler.ERROR_QUESTION_YES: - return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_YES; - case ErrorHandler.ERROR_WARNING: - return VclWindowPeerAttribute.OK; - case ErrorHandler.ERROR_MESSAGE: - return VclWindowPeerAttribute.OK; - } - throw new IllegalArgumentException("unkonown error type"); - } - - /** - * @deprecated - * @param errorType - * @return the uno service name for each error type - */ - private static String getServiceNameFor(int errorType) - { - switch (errorType) - { - case ErrorHandler.ERROR_FATAL: - return "errorbox"; - case ErrorHandler.ERROR_PROCESS_FATAL: - return "errorbox"; - case ErrorHandler.ERROR_NORMAL_ABORT: - return "errorbox"; - case ErrorHandler.ERROR_NORMAL_IGNORE: - return "warningbox"; - case ErrorHandler.ERROR_QUESTION_CANCEL: - return "querybox"; - case ErrorHandler.ERROR_QUESTION_OK: - return "querybox"; - case ErrorHandler.ERROR_QUESTION_NO: - return "querybox"; - case ErrorHandler.ERROR_QUESTION_YES: - return "querybox"; - case ErrorHandler.ERROR_WARNING: - return "warningbox"; - case ErrorHandler.ERROR_MESSAGE: - return "infobox"; - } - throw new IllegalArgumentException("unkonown error type"); - } - - /** - * renders the error - * @param ex the exception - * @param arg a free argument - * @param ix a free argument - * @param type the error type (from the int constants - * in ErrorHandler interface) - * @return a Strings which will be displayed in the message box, - * and which describes the error, and the needed action from the user. - */ - protected abstract String getMessageFor(Exception ex, Object arg, int ix, int type); -} - - diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java deleted file mode 100644 index 0fc9b57df775..000000000000 --- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java +++ /dev/null @@ -1,274 +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 com.sun.star.wizards.web; - -import javax.swing.DefaultListModel; - -import com.sun.star.awt.Size; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.ConfigSet; -import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.ui.ImageList; -import com.sun.star.wizards.web.data.CGImage; -import com.sun.star.wizards.web.data.CGSettings; - -public class BackgroundsDialog extends ImageListDialog -{ - - private FileAccess fileAccess; - private SystemDialog sd; - private CGSettings settings; - - /** - * @param xmsf - */ - public BackgroundsDialog( - XMultiServiceFactory xmsf, - ConfigSet set_, WebWizardDialogResources resources) throws Exception - { - - super(xmsf, WWHID.HID_BG, new String[] - { - resources.resBackgroundsDialog, - resources.resBackgroundsDialogCaption, - resources.resOK, - resources.resCancel, - resources.resHelp, - resources.resDeselect, - resources.resOther, - resources.resCounter - }); - - sd = SystemDialog.createOpenDialog(xmsf); - sd.addFilter(resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", true); - sd.addFilter(resources.resAllFiles, "*.*", false); - - settings = (CGSettings) set_.root; - - fileAccess = new FileAccess(xmsf); - il.setListModel(new Model(set_)); - il.setImageSize(new Size(40, 40)); - il.setRenderer(new BGRenderer(0)); - build(); - - - } - - /** - * trigered when the user clicks the "other" button. - * opens a "file open" dialog, adds the selected - * image to the list and to the web wizard configuration, - * and then jumps to the new image, selecting it in the list. - * @see #add(String) - */ - public void other() - { - String filename[] = sd.callOpenDialog(false, settings.cp_DefaultSession.cp_InDirectory); - if (filename != null && filename.length > 0 && filename[0] != null) - { - settings.cp_DefaultSession.cp_InDirectory = FileAccess.getParentDir(filename[0]); - int i = add(filename[0]); - il.setSelected(i); - il.display(i); - } - } - - /** - * adds the given image to the image list (to the model) - * and to the web wizard configuration. - * @param s - * @return - */ - private int add(String s) - { - - //first i check the item does not already exists in the list... - for (int i = 0; i < il.getListModel().getSize(); i++) - { - if (il.getListModel().getElementAt(i).equals(s)) - { - return i; - } - } - ((DefaultListModel) il.getListModel()).addElement(s); - try - { - Object configView = Configuration.getConfigurationRoot(xMSF, FileAccess.connectURLs(WebWizardConst.CONFIG_PATH, "BackgroundImages"), true); - int i = Configuration.getChildrenNames(configView).length + 1; - Object o = Configuration.addConfigNode(configView, PropertyNames.EMPTY_STRING + i); - Configuration.set(s, "Href", o); - Configuration.commit(configView); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - return il.getListModel().getSize() - 1; - - } - - /** - * an ImageList Imagerenderer implemtation. - * The image URL is the object given from the list model. - * the image name, got from the "render" method is - * the filename portion of the url. - * - */ - private class BGRenderer implements ImageList.IImageRenderer - { - - private int cut; - - public BGRenderer(int cut_) - { - cut = cut_; - } - - public Object[] getImageUrls(Object listItem) - { - Object[] sRetUrls; - if (listItem != null) - { - sRetUrls = new Object[1]; - sRetUrls[0] = listItem; - return sRetUrls; - } - return null; - } - - public String render(Object object) - { - return object == null ? PropertyNames.EMPTY_STRING : FileAccess.getPathFilename(fileAccess.getPath((String) object, null)); - } - } - - /** - * This is a list model for the image list of the - * backgrounds dialog. - * It takes the Backgrounds config set as an argument, - * and "parses" it to a list of files: - * It goes through each image in the set, and checks it: - * if it is a directory it lists all image files in this directory. - * if it is a file, it adds the file to the list. - */ - private class Model extends DefaultListModel - { - - /** - * constructor. </br> - * see class description for a description of - * the handling of the given model - * @param model the configuration set of the background images. - */ - public Model(ConfigSet model) - { - try - { - for (int i = 0; i < model.getSize(); i++) - { - CGImage image = (CGImage) model.getElementAt(i); - String path = sd.xStringSubstitution.substituteVariables(image.cp_Href, false); - if (fileAccess.exists(path, false)) - { - addDir(path); - } - else - { - remove((String) model.getKey(image)); - } - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * when instanciating the model, it checks if each image - * exists. If it doesnot, it will be removed from - * the configuration. - * This is what this method does... - * @param imageName - */ - private void remove(String imageName) - { - try - { - Object conf = Configuration.getConfigurationRoot(xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages", true); - Configuration.removeNode(conf, imageName); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * if the given url is a directory - * adds the images in the given directory, - * otherwise (if it is a file) adds the file to the list. - * @param url - */ - private void addDir(String url) - { - if (fileAccess.isDirectory(url)) - { - add(fileAccess.listFiles(url, false)); - } - else - { - add(url); - } - } - - /** - * adds the given filenames (urls) to - * the list - * @param filenames - */ - private void add(String[] filenames) - { - for (int i = 0; i < filenames.length; i++) - { - add(filenames[i]); - } - } - - /** - * adds the given image url to the list. - * if and only if it ends with jpg, jpeg or gif - * (case insensitive) - * @param filename image url. - */ - private void add(String filename) - { - String lcase = filename.toLowerCase(); - if (lcase.endsWith("jpg") || - lcase.endsWith("jpeg") || - lcase.endsWith("gif")) - { - Model.this.addElement(filename); - } - } - } -} diff --git a/wizards/com/sun/star/wizards/web/CallWizard.java b/wizards/com/sun/star/wizards/web/CallWizard.java deleted file mode 100644 index 2976bd598d62..000000000000 --- a/wizards/com/sun/star/wizards/web/CallWizard.java +++ /dev/null @@ -1,284 +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 com.sun.star.wizards.web; - -import com.sun.star.beans.XPropertyAccess; -import com.sun.star.comp.loader.FactoryHelper; -import com.sun.star.lang.XInitialization; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.lang.XTypeProvider; -import com.sun.star.registry.XRegistryKey; -import com.sun.star.task.XJob; -import com.sun.star.task.XJobExecutor; -import com.sun.star.uno.Type; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.Resource; - -/** - * This class capsulates the class, that implements the minimal component, a factory for - * creating the service (<CODE>__getServiceFactory</CODE>). - */ -public class CallWizard -{ - - /** - * Gives a factory for creating the service. This method is called by the - * <code>JavaLoader</code> - * - * <p></p> - * - * @param stringImplementationName The implementation name of the component. - * @param xMSF The service manager, who gives access to every known service. - * @param xregistrykey Makes structural information (except regarding tree - * structures) of a single registry key accessible. - * - * @return Returns a <code>XSingleServiceFactory</code> for creating the component. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey) - { - XSingleServiceFactory xsingleservicefactory = null; - - if (stringImplementationName.equals(WizardImplementation.class.getName())) - { - xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey); - } - - return xsingleservicefactory; - } - - /** - * This class implements the component. At least the interfaces XServiceInfo, - * XTypeProvider, and XInitialization should be provided by the service. - */ - public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor - { - - /** - * The constructor of the inner class has a XMultiServiceFactory parameter. - * - * @param xmultiservicefactoryInitialization A special service factory could be - * introduced while initializing. - */ - public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization) - { - xmultiservicefactory = xmultiservicefactoryInitialization; - - if (xmultiservicefactory != null) - { - } - } - private static WebWizard webWizard = null; - - /** - * Execute Wizard - * - * @param str only valid parameter is 'start' at the moment. - */ - public void trigger(String str) - { - if (str.equalsIgnoreCase(PropertyNames.START)) - { - if (webWizard == null) - { - WebWizard ww = null; - try - { - webWizard = new WebWizard(xmultiservicefactory); - ww = webWizard; - webWizard.show(); - webWizard = null; - } - catch (Exception ex) - { - webWizard = null; - ex.printStackTrace(); - Resource.showCommonResourceError(xmultiservicefactory); - } - finally - { - webWizard = null; - try - { - if (ww != null) - { - ww.cleanup(); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - } - } - else - { - webWizard.activate(); - } - - - } - } //******************************************* - /** - * The service name, that must be used to get an instance of this service. - */ - private static final String __serviceName = "com.sun.star.wizards.web.CallWizard"; - /** - * The service manager, that gives access to all registered services. - */ - private XMultiServiceFactory xmultiservicefactory; - - /** - * This method is a member of the interface for initializing an object directly - * after its creation. - * - * @param object This array of arbitrary objects will be passed to the component - * after its creation. - * - * @throws com.sun.star.uno.Exception Every exception will not be handled, but - * will be passed to the caller. - */ - public void initialize(Object[] object) throws com.sun.star.uno.Exception - { - //wizardStarted = false; - } - - /** - * This method returns an array of all supported service names. - * - * @return Array of supported service names. - */ - public java.lang.String[] getSupportedServiceNames() - { - String[] stringSupportedServiceNames = new String[1]; - stringSupportedServiceNames[0] = __serviceName; - - return (stringSupportedServiceNames); - } - - /** - * This method returns true, if the given service will be supported by the - * component. - * - * @param stringService Service name. - * - * @return True, if the given service name will be supported. - */ - public boolean supportsService(String stringService) - { - boolean booleanSupportsService = false; - - if (stringService.equals(__serviceName)) - { - booleanSupportsService = true; - } - - return (booleanSupportsService); - } - - /** - * This method returns an array of bytes, that can be used to unambiguously - * distinguish between two sets of types, e.g. to realise hashing functionality - * when the object is introspected. Two objects that return the same ID also - * have to return the same set of types in getTypes(). If an unique - * implementation Id cannot be provided this method has to return an empty - * sequence. Important: If the object aggregates other objects the ID has to be - * unique for the whole combination of objects. - * - * @return Array of bytes, in order to distinguish between two sets. - */ - public byte[] getImplementationId() - { - byte[] byteReturn = - { - }; - - try - { - byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes(); - } - catch (Exception exception) - { - System.err.println(exception); - } - - return (byteReturn); - } - - /** - * Return the class name of the component. - * - * @return Class name of the component. - */ - public java.lang.String getImplementationName() - { - return (WizardImplementation.class.getName()); - } - - /** - * Provides a sequence of all types (usually interface types) provided by the - * object. - * - * @return Sequence of all types (usually interface types) provided by the - * service. - */ - public com.sun.star.uno.Type[] getTypes() - { - Type[] typeReturn = - { - }; - - try - { - typeReturn = new Type[] - { - new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class) - }; - } - catch (Exception exception) - { - System.err.println(exception); - } - - return (typeReturn); - } - } - - public static void main(String[] s) - { - - String ConnectStr = - "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager"; - try - { - XMultiServiceFactory xmsf = Desktop.connect(ConnectStr); - CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf); - ww.trigger(PropertyNames.START); - - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } -} diff --git a/wizards/com/sun/star/wizards/web/ErrorHandler.java b/wizards/com/sun/star/wizards/web/ErrorHandler.java deleted file mode 100644 index 8bd2beaa04b5..000000000000 --- a/wizards/com/sun/star/wizards/web/ErrorHandler.java +++ /dev/null @@ -1,102 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.VclWindowPeerAttribute; - -public interface ErrorHandler -{ - - public static final String MESSAGE_INFO = "infobox"; - public static final String MESSAGE_QUESTION = "querybox"; - public static final String MESSAGE_ERROR = "errorbox"; - public static final String MESSAGE_WARNING = "warningbox"; - public static int BUTTONS_OK = VclWindowPeerAttribute.OK; - public static int BUTTONS_OK_CANCEL = VclWindowPeerAttribute.OK_CANCEL; - public static int BUTTONS_YES_NO = VclWindowPeerAttribute.YES_NO; - public static int RESULT_CANCEL = 0; - public static int RESULT_OK = 1; - public static int RESULT_YES = 2; - public static int DEF_OK = VclWindowPeerAttribute.DEF_OK; - public static int DEF_CANCEL = VclWindowPeerAttribute.DEF_CANCEL; - public static int DEF_YES = VclWindowPeerAttribute.DEF_YES; - public static int DEF_NO = VclWindowPeerAttribute.DEF_NO; - /** - * Error type for fatal errors which should abort application - * execution. Should actually never be used :-) - */ - public static final int ERROR_FATAL = 0; - /** - * An Error type for errors which should stop the current process. - */ - public static final int ERROR_PROCESS_FATAL = 1; - /** - * An Error type for errors to which the user can choose, whether - * to continue or to abort the current process. - * default is abort. - */ - public static final int ERROR_NORMAL_ABORT = 2; - /** - * An Error type for errors to which the user can choose, whether - * to continue or to abort the current process. - * default is continue. - */ - public static final int ERROR_NORMAL_IGNORE = 3; - /** - * An error type for warnings which requires user interaction. - * (a question :-) ) - * Default is abort (cancel). - */ - public static final int ERROR_QUESTION_CANCEL = 4; - /** - * An error type for warnings which requires user interaction - * (a question :-) ) - * Default is to continue (ok). - */ - public static final int ERROR_QUESTION_OK = 5; - /** - * An error type for warnings which requires user interaction. - * (a question :-) ) - * Default is abort (No). - */ - public static final int ERROR_QUESTION_NO = 6; - /** - * An error type for warnings which requires user interaction - * (a question :-) ) - * Default is to continue (Yes). - */ - public static final int ERROR_QUESTION_YES = 7; - /** - * An error type which is just a warning... - */ - public static final int ERROR_WARNING = 8; - /** - * An error type which just tells the user something - * ( like "you look tired! you should take a bath! and so on) - */ - public static final int ERROR_MESSAGE = 9; - - /** - * @param ex the exception that accured - * @param arg an object as help for recognizing the exception - * @param ix an integer which helps for detailed recognizing of the exception - * @param errorType one of the int constants defined by this Interface - * @return true if the execution should continue, false if it should stop. - */ - public boolean error(Exception ex, Object arg, int ix, int errorType); -} diff --git a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java b/wizards/com/sun/star/wizards/web/ExtensionVerifier.java deleted file mode 100644 index 0b7963261b5f..000000000000 --- a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java +++ /dev/null @@ -1,53 +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 com.sun.star.wizards.web; - -import com.sun.star.wizards.common.UCB; - -/** - * Verifies all String that do not end with - * the given extension. - * This is used to exclude from a copy all the - * xsl files, so I copy from a layout directory - * all the files that do *not* end with xsl. - * - */ -public class ExtensionVerifier implements UCB.Verifier -{ - - private String extension; - - public ExtensionVerifier(String extension_) - { - extension = "." + extension_; - } - - /** - * @return true if the given object is - * a String which does not end with the - * given extension. - */ - public boolean verify(Object object) - { - if (object instanceof String) - { - return !((String) object).endsWith(extension); - } - return false; - } -} diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java deleted file mode 100644 index 13faea96ad74..000000000000 --- a/wizards/com/sun/star/wizards/web/FTPDialog.java +++ /dev/null @@ -1,741 +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 com.sun.star.wizards.web; - -import java.util.ArrayList; -import java.util.List; - -import com.sun.star.awt.PushButtonType; -import com.sun.star.awt.XButton; -import com.sun.star.awt.XControl; -import com.sun.star.awt.XFixedText; -import com.sun.star.awt.XTextComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.ucb.AuthenticationRequest; -import com.sun.star.ucb.InteractiveAugmentedIOException; -import com.sun.star.ucb.InteractiveNetworkConnectException; -import com.sun.star.ucb.InteractiveNetworkResolveNameException; -import com.sun.star.ucb.OpenCommandArgument2; -import com.sun.star.ucb.OpenMode; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.HelpIds; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.common.UCB; -import com.sun.star.wizards.ui.UIConsts; -import com.sun.star.wizards.ui.UnoDialog; -import com.sun.star.wizards.ui.UnoDialog2; -import com.sun.star.wizards.ui.event.DataAware; -import com.sun.star.wizards.ui.event.UnoDataAware; -import com.sun.star.wizards.web.data.CGPublish; -import com.sun.star.wizards.web.data.CGSettings; - -/** - * This is the FTP Dialog. <br/> - * The Dialog enables the user: - * (*) entering FTP server and user information. - * (*) testing the connection. - * (*) choosing a directory on the server. - * If a connection was established successfully, the user may - * press OK, which will change - * the CGPublish object propertiers according the user's input. - * If no connection was established. the OK and Choose-Dir button are disabled. - * See the method "disconnect()" which disables them. - * - * I use here the DataAware concept to automatically update - * the members ip, username, and password (via the methods setXXX(...)) - * for details see the ui.events.DataAware classes. <br/> - */ -public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID -{ - - /** - * A Constant used for the setLabel(int) method to change the - * status-display. "unknown" is the status when the user first - * opens the dialog, or changes the servername/username/password. - */ - private final static int STATUS_UNKONWN = 0; - /** - * A Constant used for the setLabel(int) method to change the - * status-display. (connection established) - */ - private final static int STATUS_OK = 1; - /** - * A Constant used for the setLabel(int) method to change the - * status-display. - */ - private final static int STATUS_USER_PWD_WRONG = 2; - /** - * A Constant used for the setLabel(int) method to change the - * status-display. - */ - private final static int STATUS_SERVER_NOT_FOUND = 3; - /** - * A Constant used for the setLabel(int) method to change the - * status-display. - */ - private final static int STATUS_NO_RIGHTS = 4; - /** - * A Constant used for the setLabel(int) method to change the - * status-display. - */ - private final static int STATUS_HOST_UNREACHABLE = 5; - /** - * A Constant used for the setLabel(int) method to change the - * status-display. - */ - private final static int STATUS_CONNECTING = 6; - /** - * The icon url for error - */ - private final static String ICON_ERROR = "ftperror.gif"; - /** - * The icon url for ok (connection ok) - */ - private final static String ICON_OK = "ftpconnected.gif"; - /** - * The icon url for unknown - this is the status when - * the user first opens the dialog - */ - private final static String ICON_UNKNOWN = "ftpunknown.gif"; - /** - * The icon url for an icon representing the "connecting" state. - */ - private final static String ICON_CONNECTING = "ftpconnecting.gif"; //GUI Components as Class members. - //Fixed Line - private XControl ln1; - private XFixedText lblFTPAddress; - private XTextComponent txtHost; - private XFixedText lblUsername; - private XTextComponent txtUsername; - private XFixedText lblPassword; - private XTextComponent txtPassword; - //Fixed Line - private XControl ln2; - private XButton btnTestConnection; - private XControl imgStatus; - private XFixedText lblStatus; - //Fixed Line - private XControl ln3; - private XTextComponent txtDir; - private XButton btnDir; - private XButton btnOK; - private XButton btnCancel; - private XButton btnHelp; - //Font Descriptors as Class members. - - //Resources Object - private FTPDialogResources resources; - private List<DataAware> dataAware = new ArrayList<DataAware>(); - public String username = PropertyNames.EMPTY_STRING; - public String password = PropertyNames.EMPTY_STRING; - /** - * The ftp host name - */ - public String host = PropertyNames.EMPTY_STRING; - /** - * The ftp directory. - */ - private String dir = PropertyNames.EMPTY_STRING; - /** - * the ftp publish object which contains the - * data for this dialog. - */ - private CGPublish publish; - private UCB ucb; - /** - * used for the status images url. - */ - private String imagesDirectory; - - /** - * constructor. - * constructs the UI. - * @param xmsf - * @param p the publishert object that contains the data - * for this dialog - * @throws Exception - */ - public FTPDialog(XMultiServiceFactory xmsf, CGPublish p) throws Exception - { - super(xmsf); - publish = p; - - - imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "../wizard/bitmap/"); - - //Load Resources - resources = new FTPDialogResources(xmsf); - ucb = new UCB(xmsf); - - //set dialog properties... - Helper.setUnoPropertyValues(xDialogModel, - new String[] - { - PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, 160, HelpIds.getHelpIdString(HID_FTP), Boolean.TRUE, "FTPDialog", 167, 82, resources.resFTPDialog_title, 222 - }); - - //add controls to dialog - build(); - //make the hostname, username and password textfield data-aware. - configure(); - //make sure we display a disconnected status. - disconnect(); - } - - /** - * Add controls to dialog. - */ - public void build() - { - final String[] PROPNAMES_LABEL = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - final String[] PROPNAMES_BUTTON = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - final String[] PROPNAMES_BUTTON2 = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - - ln1 = insertFixedLine("ln1", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), 210 - }); - lblFTPAddress = insertLabel("lblFTPAddress", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, 20, new Short((short) 1), 95 - }); - txtHost = insertTextField("txtHost", "disconnect", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID_FTP_SERVER), "txtIP", 110, 18, new Short((short) 2), 106 - }); - lblUsername = insertLabel("lblUsername", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, 36, new Short((short) 3), 85 - }); - txtUsername = insertTextField("txtUsername", "disconnect", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID_FTP_USERNAME), "txtUsername", 110, 34, new Short((short) 4), 106 - }); - lblPassword = insertLabel("lblPassword", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, 52, new Short((short) 5), 85 - }); - txtPassword = insertTextField("txtPassword", "disconnect", - new String[] - { - "EchoChar", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Short((short) 42), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_PASS), "txtPassword", 110, 50, new Short((short) 6), 106 - }); - ln2 = insertFixedLine("ln2", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], 68, new Short((short) 7), 210 - }); - btnTestConnection = insertButton("btnConnect", "connect", - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_TEST), resources.resbtnConnect_value, "btnConnect", INTEGER_12, 80, new Short((short) 8), INTEGER_50 - }); - - imgStatus = insertImage("imgStatus", - new String[] - { - PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", "Tabstop", PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Short((short) 0), INTEGER_14, 68, 80, Boolean.FALSE, Boolean.FALSE, INTEGER_14 - }); - - lblStatus = insertLabel("lblStatus", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.resFTPDisconnected, "lblStatus", 86, 82, new Short((short) 9), 99 - }); - - ln3 = insertFixedLine("ln3", - PROPNAMES_LABEL, - new Object[] - { - INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], 100, new Short((short) 10), 210 - }); - - txtDir = insertTextField("txtDir", - null, new String[] - { - PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.FALSE, INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, 113, new Short((short) 11), resources.restxtDir_value, 184 - }); - btnDir = insertButton("btnDir", "chooseDirectory", - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_BTN_PATH), resources.resbtnDir_value, "btnDir", 199, 112, new Short((short) 12), INTEGER_16 - }); - - btnOK = insertButton("btnOK", null, - PROPNAMES_BUTTON2, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_OK), resources.resbtnOK_value, "btnOK", 165, 142, new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50 - }); - - btnCancel = insertButton("btnCancel", - null, PROPNAMES_BUTTON2, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID_FTP_CANCEL), resources.resbtnCancel_value, "btnCancel", 113, 142, new Short((short) PushButtonType.CANCEL_value), new Short((short) 14), INTEGER_50 - }); - - btnHelp = insertButton("btnHelp", null, - PROPNAMES_BUTTON2, - new Object[] - { - INTEGER_14, PropertyNames.EMPTY_STRING, resources.resbtnHelp_value, "btnHelp", 57, 142, new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50 - }); - - } - - /** - * Make hostname, username and password text fields data aware. - */ - private void configure() - { - dataAware.add(UnoDataAware.attachEditControl(this, "host", txtHost, null, true)); - dataAware.add(UnoDataAware.attachEditControl(this, "username", txtUsername, null, true)); - dataAware.add(UnoDataAware.attachEditControl(this, "password", txtPassword, null, true)); - } - - /** - * Shows the dialog. - * If the user clicks ok, changes the given CGPublish properties to the - * user input. - * @param parent a dialog to center this dialog to. - * @return 0 for cancel, 1 for ok. - * @throws Exception - well, if something goes wrong... - */ - public short execute(UnoDialog parent) throws Exception - { - host = extractHost(publish.cp_URL); - username = publish.cp_Username == null ? PropertyNames.EMPTY_STRING : publish.cp_Username; - password = publish.password == null ? PropertyNames.EMPTY_STRING : publish.password; - dir = extractDir(publish.cp_URL); - setLabel(STATUS_UNKONWN); - - enableTestButton(); - updateUI(); - short result = executeDialog(parent); - //change the CGPublish properties - if (result == 1) - { - publish.cp_URL = "ftp://" + host() + getDir(); - publish.cp_Username = username; - publish.password = password; - } - - return result; - } - - /** - * updates the hostname, username, password and - * directory text fields. - * is called uppon initialization. - */ - private void updateUI() - { - DataAware.updateUI(dataAware); - setDir(dir); - } - - /** - * extract the hostname out of the url used by the - * publisher. This url does not include the username:password string. - * @param ftpUrl - * @return - */ - private String extractHost(String ftpUrl) - { - if (ftpUrl == null || ftpUrl.length() < 6) - { - return PropertyNames.EMPTY_STRING; - } - String url = ftpUrl.substring(6); - int i = url.indexOf("/"); - if (i == -1) - { - return url; - } - else - { - return url.substring(0, i); - } - } - - /** - * used to get data from the CGPublish object. - * @param ftpUrl - * @return the directory portion of the ftp-url - */ - private String extractDir(String ftpUrl) - { - if (ftpUrl == null || ftpUrl.length() < 6) - { - return "/"; - } - String url = ftpUrl.substring(6); - int i = url.indexOf("/"); - if (i == -1) - { - return "/"; - } - else - { - return url.substring(i); - } - } - - /** - * enables/disables the "test" button - * according to the status of the hostname, username, password text fields. - * If one of these fields is empty, the button is disabled. - */ - private void enableTestButton() - { - setEnabled(btnTestConnection, !(isEmpty(host) || isEmpty(username) || isEmpty(password))); - - } - - /** - * @param s - * @return true if the string is null or PropertyNames.EMPTY_STRING. - */ - private final boolean isEmpty(String s) - { - return (s == null) || (s.equals(PropertyNames.EMPTY_STRING)); - } - - /** - * @return the ftp url with username and password, - * but without the directory portion. - */ - public String getAcountUrl() - { - return "ftp://" + username + ":" + password + "@" + host(); - } - - /** - * return the host name without the "ftp://" - * @return - */ - private String host() - { - return host(host); - } - - private static String host(String s) - { - return (s.startsWith("ftp://") ? s.substring(6) : s); - } - - /** - * @return the full ftp url including username, password and directory portion. - */ - private String getFullUrl() - { - return getAcountUrl() + dir; - } - - /** - * First I try to connect to the full url, including directory. - * If an InteractiveAugmentedIOException accures, I try again, - * this time without the dir spec. If this works, I change the dir - * to "/", if not I say to the user its his problem... - * - */ - public void connect() - { - setEnabled(btnTestConnection, false); - setLabel(STATUS_CONNECTING); - boolean success = false; - try - { - connect(getFullUrl()); - success = true; - } - catch (InteractiveAugmentedIOException iaioex) - { - try - { - connect(getAcountUrl()); - setDir("/"); - success = true; - } - catch (Exception ex) - { - setLabel(STATUS_NO_RIGHTS); - } - } - catch (InteractiveNetworkResolveNameException inrne) - { - setLabel(STATUS_SERVER_NOT_FOUND); - } - catch (AuthenticationRequest ar) - { - setLabel(STATUS_USER_PWD_WRONG); - } - catch (InteractiveNetworkConnectException incx) - { - setLabel(STATUS_HOST_UNREACHABLE); - } - catch (Exception ex) - { - setLabel(-1); - ex.printStackTrace(); - } - - - if (success) - { - setLabel(STATUS_OK); - setEnabled(btnDir, true); - setEnabled(btnOK, true); - } - - setEnabled(btnTestConnection, true); - - } - - /** - * To try the conenction I do some actions that - * seem logical to me: <br/> - * I get a ucb content. - * I list the files in this content. - * I call the ucb "open" command. - * I get the PropertyNames.PROPERTY_TITLE property of this content. - * @param acountUrl - * @throws Exception - */ - private void connect(String acountUrl) throws Exception - { - Object content = ucb.getContent(acountUrl); - - //list files in the content. - List<String> l = ucb.listFiles(acountUrl, null); - - //open the content - OpenCommandArgument2 aArg = new OpenCommandArgument2(); - aArg.Mode = OpenMode.FOLDERS; // FOLDER, DOCUMENTS -> simple filter - aArg.Priority = 32768; // Ignored by most implementations - - ucb.executeCommand(content, "open", aArg); - - //get the title property of the content. - Object obj = ucb.getContentProperty(content, PropertyNames.PROPERTY_TITLE, String.class); - - } - - /** - * changes the ftp subdirectory, in both - * the UI and the data. - * @param s the directory. - */ - public void setDir(String s) - { - dir = s; - Helper.setUnoPropertyValue(getModel(txtDir), "Text", dir); - } - - /** - * @return the ftp subdirecrtory. - */ - public String getDir() - { - return dir; - } - - /** - * changes the status label to disconnected status, and - * disables the ok and choose-dir buttons. - * This method is called also when the hostname, username - * and passwordtext fields change. - */ - public void disconnect() - { - enableTestButton(); - setEnabled(btnOK, false); - setEnabled(btnDir, false); - setLabel(STATUS_UNKONWN); - } - - /** - * used for debuging. - * @param args - */ - public static void main(String args[]) - { - String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager"; - try - { - XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr); - CGPublish p = new CGPublish(); - p.cp_URL = "ftp://tv-1/Folder"; - p.cp_Username = "ronftp"; - p.password = "ronftp"; - - FTPDialog dialog = new FTPDialog(xLocMSF, p); - dialog.execute(null); - } - catch (Exception exception) - { - exception.printStackTrace(); - } - } - - /** - * changes the status label and icon, according to the - * given status - * @param status one opf the private status-constants. - * if this param is not one of them, an "unknown error" status is displayed. - */ - private void setLabel(int status) - { - switch (status) - { - //not connected yet - case STATUS_UNKONWN: - setLabel(resources.resFTPDisconnected, ICON_UNKNOWN); - break; - //connected! - case STATUS_OK: - setLabel(resources.resFTPConnected, ICON_OK); - break; - case STATUS_USER_PWD_WRONG: - setLabel(resources.resFTPUserPwdWrong, ICON_ERROR); - break; - //problem resolving server name - case STATUS_SERVER_NOT_FOUND: - setLabel(resources.resFTPServerNotFound, ICON_ERROR); - break; - //rights problem - case STATUS_NO_RIGHTS: - setLabel(resources.resFTPRights, ICON_ERROR); - break; - //host unreachable (firewall?) - case STATUS_HOST_UNREACHABLE: - setLabel(resources.resFTPHostUnreachable, ICON_ERROR); - break; - case STATUS_CONNECTING: - setLabel(resources.resConnecting, ICON_CONNECTING); - break; - default: - setLabel(resources.resFTPUnknownError, ICON_ERROR); - } - } - - /** - * changes the text of the status label and - * (TODO) the status image. - * @param label - * @param image - */ - private void setLabel(String label, String image) - { - Helper.setUnoPropertyValue(getModel(lblStatus), PropertyNames.PROPERTY_LABEL, label); - Helper.setUnoPropertyValue(getModel(imgStatus), PropertyNames.PROPERTY_IMAGEURL, imageUrl(image)); - } - - private String imageUrl(String s) - { - return imagesDirectory + s; - } - - /** - * called when the user clicks - * the choose-dir button. ("...") - * Opens the pickFolder dialog. - * checks if the returned folder is an ftp folder. - * sets the textbox and the data to the new selected dir. - */ - public void chooseDirectory() - { - SystemDialog sd = SystemDialog.createOfficeFolderDialog(xMSF); - String newUrl = sd.callFolderDialog(resources.resFTPDirectory, PropertyNames.EMPTY_STRING, getFullUrl()); - if (newUrl != null) - { - /* if the user chose a local directory, - * sI do not accept it. - */ - if (newUrl.startsWith("ftp://")) - { - setDir(extractDir(newUrl)); - } - else - { - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resIllegalFolder, ErrorHandler.ERROR_PROCESS_FATAL); - } - } - } - - /** - * practical to have such a method... - * @param p the publisher obejct that contains the ftp connection info. - * @return the full ftp url with username password and everything one needs. - */ - public static final String getFullURL(CGPublish p) - { - return "ftp://" + p.cp_Username + ":" + p.password + "@" + host(p.cp_URL); - } -} diff --git a/wizards/com/sun/star/wizards/web/FTPDialogResources.java b/wizards/com/sun/star/wizards/web/FTPDialogResources.java deleted file mode 100644 index e0b61e3168be..000000000000 --- a/wizards/com/sun/star/wizards/web/FTPDialogResources.java +++ /dev/null @@ -1,89 +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 com.sun.star.wizards.web; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Resource; - -public class FTPDialogResources extends Resource -{ - - final static String UNIT_NAME = "dbwizres"; - final static String MODULE_NAME = "dbw"; - final static int RID_FTPDIALOG_START = 4200; - final static int RID_COMMON_START = 500; - String resFTPDialog_title; - String reslblUsername_value; - String reslblPassword_value; - String resbtnConnect_value; - String resbtnOK_value; - String resbtnHelp_value; - String resbtnCancel_value; - String resln1_value; - String reslblFTPAddress_value; - String resln2_value; - String resln3_value; - String restxtDir_value; - String resbtnDir_value; - String resFTPDisconnected; - String resFTPConnected; - String resFTPUserPwdWrong; - String resFTPServerNotFound; - String resFTPRights; - String resFTPHostUnreachable; - String resFTPUnknownError; - String resFTPDirectory; - String resIllegalFolder; - String resConnecting; - - public FTPDialogResources(XMultiServiceFactory xmsf) - { - super(xmsf, UNIT_NAME, MODULE_NAME); - - /** - * Delete the String, uncomment the getResText method - * - */ - resFTPDialog_title = getResText(RID_FTPDIALOG_START + 0); - reslblUsername_value = getResText(RID_FTPDIALOG_START + 1); - reslblPassword_value = getResText(RID_FTPDIALOG_START + 2); - resbtnConnect_value = getResText(RID_FTPDIALOG_START + 3); - resln1_value = getResText(RID_FTPDIALOG_START + 4); - reslblFTPAddress_value = getResText(RID_FTPDIALOG_START + 5); - resln2_value = getResText(RID_FTPDIALOG_START + 6); - resln3_value = getResText(RID_FTPDIALOG_START + 7); - resbtnDir_value = getResText(RID_FTPDIALOG_START + 8); - resFTPDisconnected = getResText(RID_FTPDIALOG_START + 9); - resFTPConnected = getResText(RID_FTPDIALOG_START + 10); - resFTPUserPwdWrong = getResText(RID_FTPDIALOG_START + 11); - resFTPServerNotFound = getResText(RID_FTPDIALOG_START + 12); - resFTPRights = getResText(RID_FTPDIALOG_START + 13); - resFTPHostUnreachable = getResText(RID_FTPDIALOG_START + 14); - resFTPUnknownError = getResText(RID_FTPDIALOG_START + 15); - resFTPDirectory = getResText(RID_FTPDIALOG_START + 16); - resIllegalFolder = getResText(RID_FTPDIALOG_START + 17); - resConnecting = getResText(RID_FTPDIALOG_START + 18); - - resbtnCancel_value = getResText(RID_COMMON_START + 11); - resbtnOK_value = getResText(RID_COMMON_START + 18); - resbtnHelp_value = getResText(RID_COMMON_START + 15); - - restxtDir_value = "/"; - - } -} diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java deleted file mode 100644 index 572834c870d4..000000000000 --- a/wizards/com/sun/star/wizards/web/IconsDialog.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 com.sun.star.wizards.web; - -import javax.swing.ListModel; - -import com.sun.star.awt.Size; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.ConfigSet; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.ui.ImageList; -import com.sun.star.wizards.web.data.CGIconSet; - -/** - * The dialog class for choosing an icon set. - * This class simulates a model, though it does not functions really as one, - * since it does not cast events. - * It also implements the ImageList.ImageRenderer interface, to handle - * its own objects. - */ -public class IconsDialog extends ImageListDialog implements ImageList.IImageRenderer, ListModel -{ - - private ConfigSet set; - String htmlexpDirectory; - /** - * this icons filename prefixes are used to display the icons. - */ - private String[] icons = new String[] - { - "firs", "prev", "next", "last", "nav", "text", "up", "down" - }; - private Integer[] objects; - - /** - * @param xmsf - * @param set_ the configuration set of the supported - * icon sets. - */ - public IconsDialog(XMultiServiceFactory xmsf, - ConfigSet set_, - WebWizardDialogResources resources) - throws Exception - { - super(xmsf, WWHID.HID_IS, new String[] - { - resources.resIconsDialog, - resources.resIconsDialogCaption, - resources.resOK, - resources.resCancel, - resources.resHelp, - resources.resDeselect, - resources.resOther, - resources.resCounter - }); - - htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING); - set = set_; - objects = new Integer[set.getSize() * icons.length]; - for (int i = 0; i < objects.length; i++) - { - objects[i] = new Integer(i); - } - il.setListModel(this); - il.setRenderer(this); - il.setRows(4); - il.setCols(8); - il.setImageSize(new Size(20, 20)); - il.setShowButtons(false); - il.setRowSelect(true); - il.scaleImages = Boolean.FALSE; - - showDeselectButton = true; - showOtherButton = false; - - build(); - } - - public String getIconset() - { - if (getSelected() == null) - { - return null; - } - else - { - return (String) set.getKey(((Number) getSelected()).intValue() / icons.length); - } - } - - public void setIconset(String iconset) - { - int icon = set.getIndexOf(set.getElement(iconset)) * icons.length; - this.setSelected(icon >= 0 ? objects[icon] : null); - } - - public synchronized void addListDataListener(javax.swing.event.ListDataListener listener) - { - } - - public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener) - { - } - - /* (non-Javadoc) - * @see javax.swing.ListModel#getSize() - */ - public int getSize() - { - return set.getSize() * icons.length; - } - /* (non-Javadoc) - * @see javax.swing.ListModel#getElementAt(int) - */ - - public Object getElementAt(int arg0) - { - return objects[arg0]; - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.ui.ImageList.ImageRenderer#getImageUrls(java.lang.Object) - */ - public Object[] getImageUrls(Object listItem) - { - int i = ((Number) listItem).intValue(); - int iset = getIconsetNum(i); - int icon = getIconNum(i); - String[] sRetUrls = new String[2]; - sRetUrls[0] = htmlexpDirectory + "/htmlexpo/" + - getIconsetPref(iset) + - icons[icon] + - getIconsetPostfix(iset); - sRetUrls[1] = sRetUrls[0]; - return sRetUrls; - } - /* (non-Javadoc) - * @see com.sun.star.wizards.common.Renderer#render(java.lang.Object) - */ - - public String render(Object object) - { - if (object == null) - { - return PropertyNames.EMPTY_STRING; - } - int i = ((Number) object).intValue(); - int iset = getIconsetNum(i); - return getIconset(iset).cp_Name; - } - - private int getIconsetNum(int i) - { - return i / icons.length; - } - - private int getIconNum(int i) - { - return i % icons.length; - } - - private String getIconsetPref(int iconset) - { - return getIconset(iconset).cp_FNPrefix; - } - - private String getIconsetPostfix(int iconset) - { - return getIconset(iconset).cp_FNPostfix; - } - - private CGIconSet getIconset(int i) - { - return (CGIconSet) set.getElementAt(i); - } -} diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java deleted file mode 100644 index f9e446a1913e..000000000000 --- a/wizards/com/sun/star/wizards/web/ImageListDialog.java +++ /dev/null @@ -1,266 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.FontDescriptor; -import com.sun.star.awt.Size; -import com.sun.star.awt.XButton; -import com.sun.star.awt.XFixedText; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.HelpIds; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.IRenderer; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.ui.ImageList; -import com.sun.star.wizards.ui.UIConsts; -import com.sun.star.wizards.ui.UnoDialog2; -import com.sun.star.wizards.ui.ImageList.Counter; - -/** - * This class is a general implementation for a - * dialog which displays a choice of images. - * The model and the renderer are - * still abstract in this class. - * To use the class one should extend it, - * in the constructor then set the imageList - * properties (member name il) like image size, grid size, - * model renderer aso, and then call "build". - * This class uses a counter renderer which - * gets an expression which contains %START %END %TOTAL and replaces - * them with the actual numbers. - * <BR/> - * two buttons: "other" and "none" which are there - * to enable choosing images that are not in the list and - * "no image" respectivley, are optional, with default to true, - * so dialogs which do not need those, should set the corresponding - * members showDeselectButton and/or showOtherButton to false. - * <br/> - * the consturctor should receive, among others, an Array of String resources - see - * constructor documentation for details. - */ -public abstract class ImageListDialog extends UnoDialog2 implements UIConsts -{ - - private String[] resources; - private final static int RES_TITLE = 0; - private final static int RES_LABEL = 1; - private final static int RES_OK = 2; - private final static int RES_CANCEL = 3; - private final static int RES_HELP = 4; - private final static int RES_DESELECT = 5; - private final static int RES_OTHER = 6; - private final static int RES_COUNTER = 7; //GUI Components as Class members. - private XButton btnOK; - private XButton btnCancel; - private XButton btnHelp; - private XButton btnOther; - private XButton btnDeselect; - private static final String START = "%START"; - private static final String END = "%END"; - private static final String TOTAL = "%TOTAL"; - protected int cutFilename = 0; - protected boolean showDeselectButton = true; - protected boolean showOtherButton = true; - private XFixedText lblTitle; - //Font Descriptors as Class members. - private FontDescriptor fontDescriptor1 = new FontDescriptor(); - protected ImageList il; //private FileAccess fileAccess; - private Object result; - private int hid; - - /** - * @param xmsf - * @param resources_ a string array with the following strings : - * dialog title, label text, ok, cancel, help, deselect, other. - * <br/> if "deselect" and "other" are not displayed, - * the array can also be shorter. but if "other" is displayed - * and "deselect" not, both must be there :-( - */ - public ImageListDialog( - XMultiServiceFactory xmsf, int hid_, String[] resources_) - { - super(xmsf); - hid = hid_; - resources = resources_; - il = new ImageList(); - il.counterRenderer = new ARenderer(resources[RES_COUNTER]); - } - - /** - * adds the controls to the dialog, depending on - * the size of the image list. - * This method should be called by subclasses after setting - * the il ImageList member properties - */ - protected void build() - { - //set dialog properties... - - int ilWidth = (il.getImageSize().Width + il.getGap().Width) * il.getCols() + il.getGap().Width; - int ilHeight = (il.getImageSize().Height + il.getGap().Height) * il.getRows() + il.getGap().Height; - - int dialogWidth = 6 + ilWidth + 6 + 50 + 6; - int dialogHeight = 3 + 16 + 3 + (ilHeight + 8 + 14) + 6; - - Helper.setUnoPropertyValues(xDialogModel, - new String[] - { - PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, new Integer(dialogHeight), HelpIds.getHelpIdString(hid), Boolean.TRUE, "imgDialog", 59, 24, INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth) - }); - //Set member- FontDescriptors... - fontDescriptor1.Weight = 150; - - final String[] PROPNAMES = new String[] - { - "DefaultButton", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - - Integer iButtonsX = new Integer(6 + ilWidth + 6); - - btnOK = insertButton("btnOK", null, - PROPNAMES, - new Object[] - { - Boolean.TRUE, INTEGER_14, HelpIds.getHelpIdString(hid + 3), resources[RES_OK], "btnOK", iButtonsX, 22, new Short((short) com.sun.star.awt.PushButtonType.OK_value), new Short((short) 7), INTEGER_50 - }); - btnCancel = insertButton("btnCancel", null, - PROPNAMES, - new Object[] - { - Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 4), resources[RES_CANCEL], "btnCancel", iButtonsX, 41, new Short((short) com.sun.star.awt.PushButtonType.CANCEL_value), new Short((short) 8), INTEGER_50 - }); - btnHelp = insertButton("btnHelp", null, - PROPNAMES, - new Object[] - { - Boolean.FALSE, INTEGER_14, PropertyNames.EMPTY_STRING, resources[RES_HELP], "CommandButton3", iButtonsX, 71, new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50 - }); - - if (showOtherButton) - { - - int otherY = 22 + ilHeight - 14 - (showDeselectButton ? 19 : 0); - - btnOther = insertButton("btnOther", "other", - PROPNAMES, - new Object[] - { - Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 1), resources[RES_OTHER], "btnOther", iButtonsX, new Integer(otherY), new Short((short) com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short) 5), INTEGER_50 - }); - } - - if (showDeselectButton) - { - - int deselectY = 22 + ilHeight - 14; - - btnDeselect = insertButton("btnNoImage", "deselect", - PROPNAMES, - new Object[] - { - Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 2), resources[RES_DESELECT], "btnNoImage", iButtonsX, new Integer(deselectY), new Short((short) com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short) 4), INTEGER_50 - }); - } - - il.setStep(new Short((short) 1)); - il.setPos(new Size(6, 22)); - il.helpURL = hid + 5; - il.tabIndex = 1; - il.create(this); - - lblTitle = insertLabel("lblTitle", - new String[] - { - PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), 216 - }); - - } - - /** - * is called when the user clicks "none" - */ - public void deselect() - { - il.setSelected(-1); - } - - /** - * is called when the user clicks "other" - * - */ - public void other() - { - } - - /** - * @return the currently elected object. - */ - public Object getSelected() - { - return il.getSelectedObject(); - } - - /** - * sets the currently selected object. - * @param obj the object (out of the model) to be selected. - */ - public void setSelected(Object obj) - { - il.setSelected(obj); - il.showSelected(); - } - - /** - * The counter renderer, which uses a template. - * The template replaces the Strings "%START", "%END" and - * "%TOTAL" with the respective values. - * - */ - public static class ARenderer implements IRenderer - { - - String template; - - /** - * @param aTemplate a template for this renderer. - * The strings %START, %END ,%TOTAL will be replaced - * with the actual values. - */ - public ARenderer(String aTemplate) - { - template = aTemplate; - } - - public String render(Object counter) - { - String s = JavaTools.replaceSubString(template, PropertyNames.EMPTY_STRING + ((Counter) counter).start, START); - s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).end, END); - s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).max, TOTAL); - return s; - } - } -} diff --git a/wizards/com/sun/star/wizards/web/LogTaskListener.java b/wizards/com/sun/star/wizards/web/LogTaskListener.java deleted file mode 100644 index b3784a5b11b6..000000000000 --- a/wizards/com/sun/star/wizards/web/LogTaskListener.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 com.sun.star.wizards.web; - -import com.sun.star.wizards.common.PropertyNames; -import java.io.PrintStream; - -import com.sun.star.wizards.ui.event.TaskEvent; -import com.sun.star.wizards.ui.event.TaskListener; - -/** - * used for debugging. - */ -public class LogTaskListener implements TaskListener, ErrorHandler -{ - - private PrintStream out; - - public LogTaskListener(PrintStream os) - { - out = os; - } - - public LogTaskListener() - { - this(System.out); - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent) - */ - public void taskStarted(TaskEvent te) - { - out.println("TASK " + te.getTask().getTaskName() + " STARTED."); - - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent) - */ - public void taskFinished(TaskEvent te) - { - out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded."); - - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent) - */ - public void taskStatusChanged(TaskEvent te) - { - out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax()); - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent) - */ - public void subtaskNameChanged(TaskEvent te) - { - out.println("SUBTASK Name:" + te.getTask().getSubtaskName()); - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.ErrorReporter#error(java.lang.Exception, java.lang.Object, java.lang.String) - */ - public boolean error(Exception ex, Object arg, int ix, int i) - { - System.out.println(PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage()); - ex.printStackTrace(); - return true; - } -} diff --git a/wizards/com/sun/star/wizards/web/MANIFEST.MF b/wizards/com/sun/star/wizards/web/MANIFEST.MF deleted file mode 100644 index 1a7a0e51b83a..000000000000 --- a/wizards/com/sun/star/wizards/web/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -RegistrationClassName: com.sun.star.wizards.web.CallWizard -UNO-Type-Path: diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java deleted file mode 100644 index 42160c13f742..000000000000 --- a/wizards/com/sun/star/wizards/web/Process.java +++ /dev/null @@ -1,808 +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 com.sun.star.wizards.web; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.xml.transform.Templates; -import javax.xml.transform.Transformer; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.w3c.dom.Document; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.ConfigSet; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.UCB; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.CGContent; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGExporter; -import com.sun.star.wizards.web.data.CGLayout; -import com.sun.star.wizards.web.data.CGPublish; -import com.sun.star.wizards.web.data.CGSettings; -import com.sun.star.wizards.web.export.Exporter; - -/** - * This class is used to process a CGSession object - * and generate a site. </br> - * it does the following: <br/> - * 1. create a temporary directory.<br/> - * 2. export documents to the temporary directory.<br/> - * 3. generate the TOC page, includes copying images from the - * web wizard work directory and other layout files.<br/> - * 4. publish, or copy, from the temporary directory to - * different destinations.<br/> - * 5. delete the temporary directory.<br/> - * <br/> - * to follow up the status/errors it uses a TaskListener object, - * and an ErrorHandler. <br/> - * in practice, the TaskListener is the status dialog, - * and the Errorhandler does the interaction with the user, - * if something goes wrong.<br/> - * Note that this class takes it in count that - * the given session object is prepared for it - - * all preparations are done in WWD_Events.finishWizard methods. - * <br/> - * <br/> - * - * note on error handling: <br/> - * on "catch" clauses I tries to decide whether the - * exception is fatal or not. For fatal exception an error message - * is displayed (or rather: the errorHandler is being called...) - * and a false is returned. - * In less-fatal errors, the errorHandler "should decide" which means, - * the user is given the option to "OK" or to "Cancel" and depending - * on that interaction I cary on. - */ -public class Process implements WebWizardConst, ProcessErrors -{ - - private static final int TASKS_PER_DOC = 5; - private static final int TASKS_PER_XSL = 2; - private static final int TASKS_PER_PUBLISH = 2; - private static final int TASKS_IN_PREPARE = 1; - private static final int TASKS_IN_EXPORT = 2; - private static final int TASKS_IN_GENERATE = 2; - private static final int TASKS_IN_PUBLISH = 2; - private static final int TASKS_IN_FINISHUP = 1; - private CGSettings settings; - private XMultiServiceFactory xmsf; - private ErrorHandler errorHandler; - private String tempDir; - private FileAccess fileAccess; - private UCB ucb; - public Task myTask; - /** - * This is a cache for exporters, so I do not need to - * instanciate the same exporter more than once. - */ - private Map<CGExporter, Exporter> exporters = new HashMap<CGExporter, Exporter>(3); - private boolean result; - - public Process( - CGSettings settings, - XMultiServiceFactory xmsf, - ErrorHandler er) - throws Exception - { - this.xmsf = xmsf; - this.settings = settings; - fileAccess = new FileAccess(xmsf); - errorHandler = er; - - ucb = new UCB(xmsf); - - int taskSteps = getTaskSteps(); - myTask = new Task(TASK, TASK_PREPARE, taskSteps); - - } - - /** - * @return to how many destinations should the - * generated site be published. - */ - private int countPublish() - { - int count = 0; - ConfigSet publishers = settings.cp_DefaultSession.cp_Publishing; - for (int i = 0; i < publishers.getSize(); i++) - { - if (((CGPublish) publishers.getElementAt(i)).cp_Publish) - { - count++; - } - } - return count; - } - - /** - * @return the number of task steps that this - * session should have - */ - private int getTaskSteps() - { - int docs = settings.cp_DefaultSession.cp_Content.cp_Documents.getSize(); - int xsl = 0; - try - { - xsl = settings.cp_DefaultSession.getLayout().getTemplates(xmsf).size(); - } - catch (Exception ex) - { - } - int publish = countPublish(); - return - TASKS_IN_PREPARE + - TASKS_IN_EXPORT + docs * TASKS_PER_DOC + - TASKS_IN_GENERATE + xsl * TASKS_PER_XSL + - TASKS_IN_PUBLISH + publish * TASKS_PER_PUBLISH + - TASKS_IN_FINISHUP; - } - - /** - * does the job - */ - public void runProcess() - { - myTask.start(); - try - { - try - { - /* - * I use here '&&' so if one of the - * methods returns false, the next - * will not be called. - */ - result = createTempDir(myTask) && export(myTask) && generate(tempDir, myTask) && publish(tempDir, myTask); - - } - finally - { - //cleanup must be called. - result = result & cleanup(myTask); - } - } - catch (Exception ex) - { - result = false; - } - - if (!result) - { - myTask.fail(); //this is a bug protection. - } - while (myTask.getStatus() < myTask.getMax()) - { - myTask.advance(true); - } - } - - /** - * creates a temporary directory. - * @param task - * @return true should continue - */ - private boolean createTempDir(Task task) - { - - tempDir = fileAccess.createNewDir(getSOTempDir(xmsf), "wwiztemp"); - if (tempDir == null) - { - error(null, null, ERROR_MKDIR, ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - else - { - task.advance(true); - return true; - } - } - - /** - * @param xmsf - * @return the staroffice /openoffice temporary directory - */ - static String getSOTempDir(XMultiServiceFactory xmsf) - { - try - { - return FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - } - catch (Exception e) - { - } - return null; - } - - // CLEANUP - /** - * delete the temporary directory - * @return true should continue - */ - private boolean cleanup(Task task) - { - - task.setSubtaskName(TASK_FINISH); - boolean b = fileAccess.delete(tempDir); - if (!b) - { - error(null, null, ERROR_CLEANUP, ErrorHandler.ERROR_WARNING); - } - task.advance(b); - return b; - } - - /** - * This method is used to copy style files to a target - * Directory: css and background. - * Note that this method is static since it is - * also used when displaying a "preview" - */ - public static void copyMedia(UCB copy, CGSettings settings, String targetDir, Task task) throws Exception - { - - //1. .css - String sourceDir = FileAccess.connectURLs(settings.workPath, "styles"); - String filename = settings.cp_DefaultSession.getStyle().cp_CssHref; - copy.copy(sourceDir, filename, targetDir, "style.css"); - - task.advance(true); - - //2. background image - String background = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage; - if (background != null && !background.equals(PropertyNames.EMPTY_STRING)) - { - sourceDir = FileAccess.getParentDir(background); - filename = background.substring(sourceDir.length()); - copy.copy(sourceDir, filename, targetDir + "/images", "background.gif"); - } - - task.advance(true); - } - - /** - * Copy "static" files (which are always the same, - * thus not user-input-dependant) to a target directory. - * Note that this method is static since it is - * also used when displaying a "preview" - * @param copy - * @param settings - * @param targetDir - * @throws Exception - */ - public static void copyStaticImages(UCB copy, CGSettings settings, String targetDir) - throws Exception - { - copy.copy(FileAccess.connectURLs(settings.workPath, "images"), targetDir + "/images"); - } - - /** - * publish the given directory. - * @param dir the source directory to publish from - * @param task task tracking. - * @return true if should continue - */ - private boolean publish(String dir, Task task) - { - task.setSubtaskName(TASK_PUBLISH_PREPARE); - ConfigSet set = settings.cp_DefaultSession.cp_Publishing; - try - { - - copyMedia(ucb, settings, dir, task); - copyStaticImages(ucb, settings, dir); - task.advance(true); - } - catch (Exception ex) - { - //error in copying media - error(ex, PropertyNames.EMPTY_STRING, ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - - boolean result = true; - - for (int i = 0; i < set.getSize(); i++) - { - - CGPublish p = (CGPublish) set.getElementAt(i); - - if (p.cp_Publish) - { - - String key = (String) set.getKey(p); - task.setSubtaskName(key); - - if (key.equals(ZIP_PUBLISHER)) - { - fileAccess.delete(p.cp_URL); - } - if (!publish(dir, p, ucb, task)) - { - return false; - } - - } - } - - return result; - } - - /** - * publish the given directory to the - * given target CGPublish. - * @param dir the dir to copy from - * @param publish the object that specifies the target - * @param copy ucb encapsulation - * @param task task tracking - * @return true if should continue - */ - private boolean publish(String dir, CGPublish publish, UCB copy, Task task) - { - try - { - task.advance(true); - copy.copy(dir, publish.url); - task.advance(true); - return true; - } - catch (Exception e) - { - task.advance(false); - return error(e, publish, ERROR_PUBLISH, ErrorHandler.ERROR_NORMAL_IGNORE); - } - } - /** - * Generates the TOC pages for the current session. - * @param targetDir generating to this directory. - */ - public boolean generate(String targetDir, Task task) - { - boolean result = false; - task.setSubtaskName(TASK_GENERATE_PREPARE); - - - CGLayout layout = settings.cp_DefaultSession.getLayout(); - - try - { - /* - * here I create the DOM of the TOC to pass to the XSL - */ - Document doc = (Document) settings.cp_DefaultSession.createDOM(); - generate(xmsf, layout, doc, fileAccess, targetDir, task); - - } - catch (Exception ex) - { - error(ex, PropertyNames.EMPTY_STRING, ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - - /* copy files which are not xsl from layout directory to - * website root. - */ - try - { - - task.setSubtaskName(TASK_GENERATE_COPY); - - copyLayoutFiles(ucb, fileAccess, settings, layout, targetDir); - - task.advance(true); - - result = true; - } - catch (Exception ex) - { - task.advance(false); - return error(ex, null, ERROR_GENERATE_COPY, ErrorHandler.ERROR_NORMAL_ABORT); - } - - - - return result; - - } - - /** - * copies layout files which are not .xsl files - * to the target directory. - * @param ucb UCB encapsulatzion object - * @param fileAccess filaAccess encapsulation object - * @param settings web wizard settings - * @param layout the layout object - * @param targetDir the target directory to copy to - * @throws Exception - */ - public static void copyLayoutFiles(UCB ucb, FileAccess fileAccess, CGSettings settings, CGLayout layout, String targetDir) - throws Exception - { - String filesPath = fileAccess.getURL( - FileAccess.connectURLs(settings.workPath, "layouts/"), layout.cp_FSName); - ucb.copy(filesPath, targetDir, new ExtensionVerifier("xsl")); - - } - - /** - * generates the TOC page for the given layout. - * This method might generate more than one file, depending - * on how many .xsl files are in the - * directory specifies by the given layout object. - * @param xmsf - * @param layout specifies the layout to use. - * @param doc the DOM representation of the web wizard session - * @param fileAccess encapsulation of FileAccess - * @param targetPath target directory - * @param task - * @throws Exception - */ - public static void generate( - XMultiServiceFactory xmsf, - CGLayout layout, - Document doc, - FileAccess fileAccess, - String targetPath, - Task task) - throws Exception - { - /* - * a map that contains xsl templates. the keys are the xsl file names. - */ - Map<String, Templates> templates = layout.getTemplates(xmsf); - - task.advance(true, TASK_GENERATE_XSL); - - /* - * each template generates a page. - */ - for (Iterator<String> i = templates.keySet().iterator(); i.hasNext();) - { - - String key = PropertyNames.EMPTY_STRING; - - key = i.next(); - - Transformer transformer = templates.get(key).newTransformer(); - - doc.normalize(); - task.advance(true); - - /* - * The target file name is like the xsl template filename - * without the .xsl extension. - */ - String fn = fileAccess.getPath(targetPath, key.substring(0, key.length() - 4)); - File f = new File(fn); - FileOutputStream oStream = new FileOutputStream(f); - // Due to a problem occuring when using Xalan-Java 2.6.0 and - // Java 1.5.0, wrap f in a FileOutputStream here (otherwise, the - // StreamResult's getSystemId would return a "file:/..." URL while - // the Xalan code expects a "file:///..." URL): - transformer.transform( - new DOMSource(doc), new StreamResult(oStream)); - oStream.close(); - task.advance(true); - } - } - - /** - * I broke the export method to two methods - * in a time where a tree with more than one contents was planned. - * I left it that way, because it may be used in the future. - * @param task - * @return - */ - private boolean export(Task task) - { - - return export(settings.cp_DefaultSession.cp_Content, tempDir, task); - - } - - /** - * This method could actually, with light modification, use recursion. - * In the present situation, where we only use a "flat" list of - * documents, instead of the original plan to use a tree, - * the recursion is not implemented. - * @param content the content ( directory-like, contains documents) - * @param dir (target directory for exporting this content. - * @param task - * @return true if should continue - */ - private boolean export(CGContent content, String dir, Task task) - { - int toPerform = 1; - String contentDir = dir; - - try - { - - task.setSubtaskName(TASK_EXPORT_PREPARE); - - /* 1. create a content directory. - * each content (at the moment there is only one :-( ) - * is created in its own directory. - * faileure here is fatal. - */ - contentDir = fileAccess.createNewDir(dir, content.cp_Name); - if (contentDir == null || contentDir.equals(PropertyNames.EMPTY_STRING)) - { - throw new IOException("Directory " + dir + " could not be created."); - } - content.dirName = FileAccess.getFilename(contentDir); - - task.advance(true, TASK_EXPORT_DOCUMENTS); - toPerform--; - - /*2. export all documents and sub contents. - * (at the moment, only documents, no subcontents) - */ - Object item = null; - for (int i = 0; i < content.cp_Documents.getSize(); i++) - { - try - { - item = content.cp_Documents.getElementAt(i); - /* - * In present this is always the case. - * may be in the future, when - * a tree is used, it will be abit different. - */ - if (item instanceof CGDocument) - { - if (!export((CGDocument) item, contentDir, task)) - { - return false; - } - } - else /* - * we never get here since we - * did not implement sub-contents. - */ if (!export((CGContent) item, contentDir, task)) - { - return false; - } - } - catch (SecurityException sx) - { - // nonfatal - if (!error(sx, item, ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE)) - { - return false; - } - result = false; - } - } - } - catch (IOException iox) - { - //nonfatal - return error(iox, content, ERROR_EXPORT_IO, ErrorHandler.ERROR_NORMAL_IGNORE); - - } - catch (SecurityException se) - { - //nonfatal - return error(se, content, ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE); - } - failTask(task, toPerform); - return true; - - } - - /** - * exports a single document - * @param doc the document to export - * @param dir the target directory - * @param task task tracking - * @return true if should continue - */ - private boolean export(CGDocument doc, String dir, Task task) - { - - //first I check if the document was already validated... - if (!doc.valid) - { - try - { - doc.validate(xmsf, null); - } - catch (Exception ex) - { - //fatal - error(ex, doc, ERROR_DOC_VALIDATE, ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - //get the exporter specified for this document - } - CGExporter exporter = (CGExporter) settings.cp_Exporters.getElement(doc.cp_Exporter); - - - try - { - - /* - * here I calculate the destination filename. - * I take the original filename (docFilename), substract the extension, (docExt) -> (fn) - * and find an available filename which starts with - * this filename, but with the new extension. (destExt) - */ - String docFilename = FileAccess.getFilename(doc.cp_URL); - - String docExt = FileAccess.getExtension(docFilename); - String fn = doc.localFilename.substring(0, doc.localFilename.length() - docExt.length() - 1); //filename without extension - - /* - * the copyExporter does not change - * the extension of the target... - */ - String destExt = (exporter.cp_Extension.equals(PropertyNames.EMPTY_STRING) - ? FileAccess.getExtension(docFilename) - : exporter.cp_Extension); - - /* if this filter needs to export to its own directory... - * this is the case in, for example, impress html export - */ - if (exporter.cp_OwnDirectory) - { //+++ - dir = fileAccess.createNewDir(dir, fn); - doc.dirName = FileAccess.getFilename(dir); - } - - /* - * if two files with the same name - * need to be exported ? So here - * i get a new filename, so I do not - * overwrite files... - */ - String file = fileAccess.getNewFile(dir, fn, destExt); - - - /* set filename with extension. - * this will be used by the exporter, - * and to generate the TOC. - */ - doc.urlFilename = FileAccess.getFilename(file); - - task.advance(true); - - try - { - //export - getExporter(exporter).export(doc, file, xmsf, task); - task.advance(true); - } - /* - * getExporter(..) throws - * IllegalAccessException, InstantiationException, ClassNotFoundException - * export() throws Exception - */ - catch (Exception ex) - { - //nonfatal - if (!error(ex, doc, ERROR_EXPORT, ErrorHandler.ERROR_NORMAL_IGNORE)) - { - return false; - } - } - } - catch (Exception ex) - { - //nonfatal - if (!error(ex, doc, ERROR_EXPORT_MKDIR, ErrorHandler.ERROR_NORMAL_ABORT)) - { - return false; - } - } - - return true; - - } - - /** - * submit an error. - * @param ex the exception - * @param arg1 error argument - * @param arg2 error argument 2 - * @param errType error type - * @return the interaction result - */ - private boolean error(Exception ex, Object arg1, int arg2, int errType) - { - result = false; - return errorHandler.error(ex, arg1, arg2, errType); - } - - /** - * advances the given task in the given count of steps, - * marked as failed. - * @param task the task to advance - * @param count the number of steps to advance - */ - private void failTask(Task task, int count) - { - while (count-- > 0) - { - task.advance(false); - } - } - - /** - * creates an instance of the exporter class - * as specified by the - * exporter object. - * @param export specifies the exporter to be created - * @return the Exporter instance - * @throws ClassNotFoundException - * @throws IllegalAccessException - * @throws InstantiationException - */ - private Exporter createExporter(CGExporter export) - throws ClassNotFoundException, - IllegalAccessException, - InstantiationException - { - Exporter e = (Exporter) Class.forName(export.cp_ExporterClass).newInstance(); - e.init(export); - return e; - } - - /** - * searches the an exporter for the given CGExporter object - * in the cache. - * If its not there, creates it, stores it in the cache and - * returns it. - * @param export specifies the needed exporter. - * @return an Exporter instance - * @throws ClassNotFoundException thrown when using Class.forName(string) - * @throws IllegalAccessException thrown when using Class.forName(string) - * @throws InstantiationException thrown when using Class.forName(string) - */ - private Exporter getExporter(CGExporter export) - throws ClassNotFoundException, - IllegalAccessException, - InstantiationException - { - Exporter exp = exporters.get(export); - if (exp == null) - { - exp = createExporter(export); - exporters.put(export, exp); - } - return exp; - } - - /** - * @return tru if everything went smooth, false - * if error(s) accured. - */ - public boolean getResult() - { - return (myTask.getFailed() == 0) && result; - } -} diff --git a/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java b/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java deleted file mode 100644 index 02586ae33c44..000000000000 --- a/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java +++ /dev/null @@ -1,82 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.XWindowPeer; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGPublish; - -/** - * used to interact error accuring when generating the - * web-site to the user. - * This class renders the different errors, - * replaceing some strings from the resources with - * content of the given arguments, depending on the error - * that accured. - */ -public class ProcessErrorHandler extends AbstractErrorHandler - implements WebWizardConst, - ProcessErrors -{ - - private static final String FILENAME = "%FILENAME"; - private static final String URL = "%URL"; - private static final String ERROR = "%ERROR"; - WebWizardDialogResources resources; - - public ProcessErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer, WebWizardDialogResources res) - { - super(xmsf, peer); - resources = res; - } - - protected String getMessageFor(Exception ex, Object obj, int ix, int errType) - { - - switch (ix) - { - - case ERROR_MKDIR: - return JavaTools.replaceSubString(resources.resErrDocExport, ((CGDocument) obj).localFilename, FILENAME); - case ERROR_EXPORT_MKDIR: - return JavaTools.replaceSubString(resources.resErrMkDir, ((CGDocument) obj).localFilename, FILENAME); - case ERROR_DOC_VALIDATE: - return JavaTools.replaceSubString(resources.resErrDocInfo, ((CGDocument) obj).localFilename, FILENAME); - case ERROR_EXPORT_IO: - return JavaTools.replaceSubString(resources.resErrExportIO, ((CGDocument) obj).localFilename, FILENAME); - case ERROR_EXPORT_SECURITY: - return JavaTools.replaceSubString(resources.resErrSecurity, ((CGDocument) obj).localFilename, FILENAME); - case ERROR_GENERATE_XSLT: - return resources.resErrTOC; - case ERROR_GENERATE_COPY: - return resources.resErrTOCMedia; - case ERROR_PUBLISH: - return JavaTools.replaceSubString(resources.resErrPublish, ((CGPublish) obj).cp_URL, URL); - case ERROR_EXPORT: - case ERROR_PUBLISH_MEDIA: - return resources.resErrPublishMedia; - case ERROR_CLEANUP: - return resources.resErrUnexpected; - - default: - return JavaTools.replaceSubString(resources.resErrUnknown, ex.getClass().getName() + "/" + obj.getClass().getName() + "/" + ix, ERROR); - } - } -} diff --git a/wizards/com/sun/star/wizards/web/ProcessErrors.java b/wizards/com/sun/star/wizards/web/ProcessErrors.java deleted file mode 100644 index 7be7ef578ff0..000000000000 --- a/wizards/com/sun/star/wizards/web/ProcessErrors.java +++ /dev/null @@ -1,38 +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 com.sun.star.wizards.web; - -/** - * Error IDs for errors that can accure - * in the interaction with the Process class. - */ -public interface ProcessErrors -{ - - public final static int ERROR_MKDIR = 0; - public final static int ERROR_EXPORT = 1; - public final static int ERROR_EXPORT_MKDIR = 2; - public final static int ERROR_DOC_VALIDATE = 3; - public final static int ERROR_EXPORT_IO = 4; - public final static int ERROR_EXPORT_SECURITY = 5; - public final static int ERROR_GENERATE_XSLT = 6; - public final static int ERROR_GENERATE_COPY = 7; - public final static int ERROR_PUBLISH = 8; - public final static int ERROR_PUBLISH_MEDIA = 9; - public final static int ERROR_CLEANUP = 10; -} diff --git a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java deleted file mode 100644 index c8cb917c0c07..000000000000 --- a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java +++ /dev/null @@ -1,57 +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 com.sun.star.wizards.web; - -import java.util.HashMap; -import java.util.Map; - -import com.sun.star.wizards.common.IRenderer; - -/** - * recieves status calls from the status dialog which - * apears when the user clicks "create". - * allocates strings from the resources to - * display the current task status. - * (renders the state to resource strings) - */ -public class ProcessStatusRenderer implements IRenderer, WebWizardConst -{ - - Map<String, String> strings = new HashMap<String, String>(12); - - public ProcessStatusRenderer(WebWizardDialogResources res) - { - strings.put(TASK_EXPORT_DOCUMENTS, res.resTaskExportDocs); - strings.put(TASK_EXPORT_PREPARE, res.resTaskExportPrepare); - strings.put(TASK_GENERATE_COPY, res.resTaskGenerateCopy); - strings.put(TASK_GENERATE_PREPARE, res.resTaskGeneratePrepare); - strings.put(TASK_GENERATE_XSL, res.resTaskGenerateXsl); - strings.put(TASK_PREPARE, res.resTaskPrepare); - strings.put(LOCAL_PUBLISHER, res.resTaskPublishLocal); - strings.put(ZIP_PUBLISHER, res.resTaskPublishZip); - strings.put(FTP_PUBLISHER, res.resTaskPublishFTP); - - strings.put(TASK_PUBLISH_PREPARE, res.resTaskPublishPrepare); - strings.put(TASK_FINISH, res.resTaskFinish); - } - - public String render(Object object) - { - return strings.get(object); - } -} diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java deleted file mode 100644 index 8f7ba7e01bf8..000000000000 --- a/wizards/com/sun/star/wizards/web/StatusDialog.java +++ /dev/null @@ -1,289 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.XButton; -import com.sun.star.awt.XFixedText; -import com.sun.star.awt.XProgressBar; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.IRenderer; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.ui.UnoDialog; -import com.sun.star.wizards.ui.UnoDialog2; -import com.sun.star.wizards.ui.event.MethodInvocation; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.ui.event.TaskEvent; -import com.sun.star.wizards.ui.event.TaskListener; - -/** - * A Class which displays a Status Dialog with status bars. - * This can display an X number of bars, to enable the - * status display of more complex tasks. - * - */ -public class StatusDialog extends UnoDialog2 implements TaskListener -{ - - public static final int STANDARD_WIDTH = 240; - private XProgressBar progressBar; - private XFixedText lblTaskName; - private XFixedText lblCounter; - private XButton btnCancel; - private String[] res; - private IRenderer renderer; - private boolean enableBreak = false; - private boolean closeOnFinish = true; - private MethodInvocation finishedMethod; - private UnoDialog parent; - private boolean finished; - - /** - * Note on the argument resource: - * This should be a String array containing the followin strings, in the - * following order: - * dialog title, cancel, close, counter prefix, counter midfix, counter postfix - */ - public StatusDialog(XMultiServiceFactory xmsf, int width, String taskName, boolean displayCount, String[] resources, String hid) - { - super(xmsf); - - res = resources; - if (res.length != 6) - { - throw new IllegalArgumentException("The resources argument should contain 6 Strings, see Javadoc on constructor."); //display a close button? - } - boolean b = !enableBreak && !closeOnFinish; - - Helper.setUnoPropertyValues(xDialogModel, - new String[] - { - PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.FALSE, new Integer(6 + 25 + (b ? 27 : 7)), hid, Boolean.TRUE, "StatusDialog", 102, 52, 0, res[0], new Integer(width) - }); - - short tabstop = 1; - - lblTaskName = insertLabel("lblTask", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 8, taskName, 6, 6, new Short(tabstop++), new Integer(width * 2 / 3) - }); - lblCounter = insertLabel("lblCounter", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 8, PropertyNames.EMPTY_STRING, new Integer(width * 2 / 3), 6, new Short(tabstop++), new Integer(width / 3 - 4) - }); - progressBar = insertProgressBar("progress", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 10, 6, 16, new Short(tabstop++), new Integer(width - 12) - }); - - - if (b) - { - btnCancel = insertButton("btnCancel", "performCancel", this, - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 14, res[1], new Integer(width / 2 - 20), new Integer(6 + 25 + 7), new Short(tabstop++), 40 - }); - } - - } - - private void initProgressBar(Task t) - { - progressBar.setRange(0, t.getMax()); - progressBar.setValue(0); - } - - private void setStatus(int status) - { - if (finished) - { - return; - } - progressBar.setValue(status); - xReschedule.reschedule(); - } - - public void setLabel(String s) - { - Helper.setUnoPropertyValue(UnoDialog.getModel(lblTaskName), PropertyNames.PROPERTY_LABEL, s); - xReschedule.reschedule(); - } - - /** - * change the max property of the status bar - * @param max - */ - private void setMax(int max) - { - if (finished) - { - return; - } - Helper.setUnoPropertyValue(getModel(progressBar), "ProgressValueMax", new Integer(max)); - } - - /** - * initialize the status bar according - * to the given event. - */ - public void taskStarted(TaskEvent te) - { - finished = false; - initProgressBar(te.getTask()); - } - - /** - * closes the dialog. - */ - public void taskFinished(TaskEvent te) - { - finished = true; - if (closeOnFinish) - { - parent.xWindow.setEnable(true); - try - { - xWindow.setVisible(false); - xComponent.dispose(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - else - { - Helper.setUnoPropertyValue(getModel(btnCancel), PropertyNames.PROPERTY_LABEL, res[2]); - } - } - - /** - * changes the status display - */ - public void taskStatusChanged(TaskEvent te) - { - setMax(te.getTask().getMax()); - setStatus(te.getTask().getStatus()); - } - - /** - * changes the displayed text. - * A renderer is used to render - * the task's subtask name to a resource string. - */ - public void subtaskNameChanged(TaskEvent te) - { - if (renderer != null) - { - setLabel(renderer.render(te.getTask().getSubtaskName())); - } - } - - /** - * displays the status dialog - * @param parent_ the parent dialog - * @param task what to do - */ - public void execute(final UnoDialog parent_, final Task task, String title) - { - try - { - this.parent = parent_; - Helper.setUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_TITLE, title); - try - { - //TODO change this to another execute dialog method. - task.addTaskListener(StatusDialog.this); - setMax(10); - setStatus(0); - setLabel(task.getSubtaskName()); - parent.xWindow.setEnable(false); - setVisible(parent); - if (finishedMethod != null) - { - finishedMethod.invoke(); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * not supported ! - */ - public void performCancel() - {//TODO - implement a thread thing here... - xWindow.setVisible(false); - } - - /** - * @return the subTask renderer object - */ - public IRenderer getRenderer() - { - return renderer; - } - - /** - * @param renderer - */ - public void setRenderer(IRenderer renderer) - { - this.renderer = renderer; - } - - /** - * sets a method to be invoced when the - * - */ - public void setFinishedMethod(MethodInvocation mi) - { - finishedMethod = mi; - } -} diff --git a/wizards/com/sun/star/wizards/web/StylePreview.java b/wizards/com/sun/star/wizards/web/StylePreview.java deleted file mode 100644 index edd3d0323760..000000000000 --- a/wizards/com/sun/star/wizards/web/StylePreview.java +++ /dev/null @@ -1,145 +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 com.sun.star.wizards.web; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.web.data.CGStyle; - -/** - * the style preview, which is a OOo Document Preview in - * an Image Control. - * This class copies the files needed for this - * preview from the web wizard work directory - * to a given temporary directory, and updates them - * on request, according to the current style/background selection - * of the user. - */ -public class StylePreview -{ - - private FileAccess fileAccess; - /** - * the destination html url. - */ - public String htmlFilename; - /** - * the destination css url - */ - private String cssFilename; - /** - * destination directory - */ - public String tempDir; - /** - * destination background file url - */ - private String backgroundFilename; - /** - * web wizard work directory - */ - private String wwRoot; - - /** - * copies the html file to the temp directory, and calculates the - * destination names of the background and css files. - * @param wwRoot_ is the root directory of the web wizard files ( - * usually [oo]/share/template/[lang]/wizard/web - */ - public StylePreview(XMultiServiceFactory xmsf, String wwRoot_) throws Exception - { - fileAccess = new FileAccess(xmsf); - - tempDir = createTempDir(xmsf); - - htmlFilename = FileAccess.connectURLs(tempDir, "wwpreview.html"); - cssFilename = FileAccess.connectURLs(tempDir, "style.css"); - backgroundFilename = FileAccess.connectURLs(tempDir, "images/background.gif"); - - wwRoot = wwRoot_; - - fileAccess.copy(FileAccess.connectURLs(wwRoot, "preview.html"), htmlFilename); - } - - /** - * copies the given style and background files to the temporary - * directory. - * @param style - * @param background - * @throws Exception - */ - public void refresh(CGStyle style, String background) throws Exception - { - - String css = FileAccess.connectURLs(wwRoot, "styles/" + style.cp_CssHref); - - if (background == null || background.equals(PropertyNames.EMPTY_STRING)) - { - //delete the background image - if (fileAccess.exists(backgroundFilename, false)) - { - fileAccess.delete(backgroundFilename); - } - } - else - { - // a solaris bug workaround - // TODO - //copy the background image to the temp directory. - fileAccess.copy(background, backgroundFilename); - } - //copy the actual css to the temp directory - fileAccess.copy(css, cssFilename); - } - - public void cleanup() - { - try - { - removeTempDir(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * creates a temporary directory. - * @param xmsf - * @return the url of the new directory. - * @throws Exception - */ - private String createTempDir(XMultiServiceFactory xmsf) throws Exception - { - String tempPath = FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - String s = fileAccess.createNewDir(tempPath, "wwiz"); - fileAccess.createNewDir(s, "images"); - return s; - } - - /** - * deletes/removes the temporary directroy. - * @throws Exception - */ - private void removeTempDir() throws Exception - { - fileAccess.delete(tempDir); - } -} diff --git a/wizards/com/sun/star/wizards/web/TOCPreview.java b/wizards/com/sun/star/wizards/web/TOCPreview.java deleted file mode 100644 index dc7cf6a3a1a2..000000000000 --- a/wizards/com/sun/star/wizards/web/TOCPreview.java +++ /dev/null @@ -1,111 +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 com.sun.star.wizards.web; - -import org.w3c.dom.Document; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.frame.XDispatch; -import com.sun.star.frame.XFrame; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.util.URL; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.UCB; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.CGLayout; -import com.sun.star.wizards.web.data.CGSettings; - -/** - * This class both copies necessary files to - * a temporary directory, generates a temporary TOC page, - * and opens the generated html document in a web browser, - * by default "index.html" (unchangeable). - * <br/> - * Since the files are both static and dynamic (some are always the same, - * while other change according to user choices) - * I divide this tasks to two: all necessary - * static files, which should not regularily update are copied upon - * instanciation. - * The TOC is generated in refresh(...); - */ -public class TOCPreview -{ - - private String tempDir = null; - private XMultiServiceFactory xmsf; - private FileAccess fileAccess; - private WebWizardDialogResources resources; - private URL openHyperlink; - private XDispatch xDispatch; - private PropertyValue[] loadArgs; - private UCB ucb; - private XFrame xFrame; - - /** - * @param xmsf_ - * @param settings web wizard settings - * @param res resources - * @param tempDir_ destination - * @throws Exception - */ - public TOCPreview(XMultiServiceFactory xmsf_, CGSettings settings, WebWizardDialogResources res, String tempDir_, XFrame _xFrame) - throws Exception - { - xFrame = _xFrame; - xmsf = xmsf_; - resources = res; - fileAccess = new FileAccess(xmsf); - tempDir = tempDir_; - loadArgs = loadArgs(FileAccess.connectURLs(tempDir, "/index.html")); - openHyperlink = Desktop.getDispatchURL(xmsf, ".uno:OpenHyperlink"); - xDispatch = Desktop.getDispatcher(xmsf, xFrame, "_top", openHyperlink); - ucb = new UCB(xmsf); - - Process.copyStaticImages(ucb, settings, tempDir); - } - - /** - * generates a TOC, copies the layout-specific files, and - * calles a browser to show "index.html". - * @param settings - * @throws Exception - */ - public void refresh(CGSettings settings) - throws Exception - { - Document doc = (Document) settings.cp_DefaultSession.createDOM(); - CGLayout layout = settings.cp_DefaultSession.getLayout(); - Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 10000); - Process.generate(xmsf, layout, doc, fileAccess, tempDir, task); - Process.copyLayoutFiles(ucb, fileAccess, settings, layout, tempDir); - xDispatch.dispatch(openHyperlink, loadArgs); - } - - private PropertyValue[] loadArgs(String url) - { - PropertyValue pv = new PropertyValue(); - pv.Name = PropertyNames.URL; - pv.Value = url; - return new PropertyValue[] - { - pv - }; - } -} diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java deleted file mode 100644 index 3b557d50d2f1..000000000000 --- a/wizards/com/sun/star/wizards/web/WWD_Events.java +++ /dev/null @@ -1,1276 +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 com.sun.star.wizards.web; - -import javax.swing.ListModel; - -import com.sun.star.awt.KeyEvent; -import com.sun.star.awt.XControl; -import com.sun.star.awt.XKeyListener; -import com.sun.star.awt.XWindow; -import com.sun.star.container.NoSuchElementException; -import com.sun.star.lang.EventObject; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.XCloseable; -import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.ui.UnoDialog; -import com.sun.star.wizards.ui.event.ListModelBinder; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGPublish; -import com.sun.star.wizards.web.data.CGSession; -import com.sun.star.wizards.web.data.CGSessionName; - -/** - * This class implements the ui-events of the - * web wizard. - * it is therfore sorted to steps. - * not much application-logic here - just plain - * methods which react to events. - * The only exception are the finish methods with the save - * session methods. - */ -public abstract class WWD_Events extends WWD_Startup -{ - - private static final short[] EMPTY_SHORT_ARRAY = new short[0]; - /** - * Tracks the current loaded session. - * If PropertyNames.EMPTY_STRING - it means the current session is the default one (empty) - * If a session is loaded, this will be the name of the loaded session. - */ - protected String currentSession = PropertyNames.EMPTY_STRING; - - /** - * He - my constructor ! - * I add a window listener, which, when - * the window closes, deltes the temp directory. - */ - public WWD_Events(XMultiServiceFactory xmsf) throws Exception - { - super(xmsf); - Create c = new Create(); - XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, chkFTP); - xWindow.addKeyListener(c); - xWindow = UnoRuntime.queryInterface(XWindow.class, chkLocalDir); - xWindow.addKeyListener(c); - xWindow = UnoRuntime.queryInterface(XWindow.class, chkZip); - xWindow.addKeyListener(c); - } - - /* ********************************************************* - * ******************************************************* - * EVENT and UI METHODS - * ******************************************************* - * *********************************************************/ - protected void leaveStep(int nOldStep, int nNewStep) - { - if (nOldStep == 1 && nNewStep == 2) - { - // 1. check if the selected session is the same as the current one. - } - } - - protected void enterStep(int old, int newStep) - { - if ((old == 1)) - { - String sessionToLoad = PropertyNames.EMPTY_STRING; - short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS); - if (s.length == 0 || s[0] == 0) - { - sessionToLoad = PropertyNames.EMPTY_STRING; - } - else - { - sessionToLoad = ((CGSessionName) settings.cp_SavedSessions.getElementAt(s[0])).cp_Name; - } - if (!sessionToLoad.equals(currentSession)) - { - loadSession(sessionToLoad); - } - } - if (newStep == 5) - { - } - } - - /* ********************************* - * STEP 1 - */ - /** - * Called from the Uno event dispatcher when the - * user selects a saved session. - */ - public void sessionSelected() - { - short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS); - setEnabled(btnDelSession, s.length > 0 && s[0] > 0); - } - - /** - * Ha ! the session should be loaded :-) - */ - public void loadSession(final String sessionToLoad) - { - try - { - final StatusDialog sd = getStatusDialog(); - - final Task task = new Task("LoadDocs", PropertyNames.EMPTY_STRING, 10); - - sd.execute(this, task, resources.resLoadingSession); - task.start(); - - setSelectedDoc(EMPTY_SHORT_ARRAY); - Helper.setUnoPropertyValue(getModel(lstDocuments), PropertyNames.SELECTED_ITEMS, EMPTY_SHORT_ARRAY); - Helper.setUnoPropertyValue(getModel(lstDocuments), PropertyNames.STRING_ITEM_LIST, EMPTY_STRING_ARRAY); - - Object view = null; - - if (sessionToLoad.equals(PropertyNames.EMPTY_STRING)) - { - view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/DefaultSession", false); - } - else - { - view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", false); - view = Configuration.getNode(sessionToLoad, view); - } - - CGSession session = new CGSession(); - session.setRoot(settings); - session.readConfiguration(view, CONFIG_READ_PARAM); - task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7); - task.advance(true); - - if (sessionToLoad.equals(PropertyNames.EMPTY_STRING)) - { - setSaveSessionName(session); - } - mount(session, task, false, sd.xControl); - - checkSteps(); - currentSession = sessionToLoad; - - while (task.getStatus() <= task.getMax()) - { - task.advance(false); - } - task.removeTaskListener(sd); - } - catch (Exception ex) - { - unexpectedError(ex); - } - - try - { - refreshStylePreview(); - updateIconsetText(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - /** - * hmm. the user clicked the delete button. - */ - public void delSession() - { - short[] selected = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS); - if (selected.length == 0) - { - return; - } - if (selected[0] == 0) - { - return; - } - boolean confirm = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resDelSessionConfirm, ErrorHandler.ERROR_QUESTION_NO); - if (confirm) - { - try - { - String name = (String) settings.cp_SavedSessions.getKey(selected[0]); - // first delete the session from the registry/configuration. - - Configuration.removeNode(xMSF, CONFIG_PATH + "/SavedSessions", name); - - // then delete the session from the java-set (settings.cp_SavedSessions) - settings.cp_SavedSessions.remove(selected[0]); - settings.savedSessions.remove(selected[0] - 1); - - short[] nextSelected = new short[] - { - (short) 0 - }; - // We try to select the same item index again, if possible - if (settings.cp_SavedSessions.getSize() > selected[0]) - { - nextSelected[0] = selected[0]; - } - else - // this will always be available because - // the user can not remove item 0. - { - nextSelected[0] = (short) (selected[0] - 1); // if the <none> session will be selected, disable the remove button... - } - if (nextSelected[0] == 0) - { - Helper.setUnoPropertyValue(getModel(btnDelSession), PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // select... - } - Helper.setUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS, nextSelected); - } - catch (Exception ex) - { - ex.printStackTrace(); - unexpectedError(ex); - } - } - } - - /* ******************************** - * STEP 2 - */ - /** - * A method used by the UnoDataAware attached - * to the Documents listbox. - * See the concept of the DataAware objects to undestand - * why it is there... - */ - public short[] getSelectedDoc() - { - return selectedDoc; - } - private static String[] EMPTY_STRING_ARRAY = new String[0]; - - /** - * when the user clicks another document - * in the listbox, this method is called, - * and couses the display in - * the textboxes title,description, author and export format - * to change - */ - public void setSelectedDoc(short[] s) - { - CGDocument oldDoc = getDoc(selectedDoc); - CGDocument doc = getDoc(s); - - if (doc == null) - { - fillExportList(EMPTY_STRING_ARRAY); - //I try to avoid refreshing the export list if - //the same type of document is chosen. - } - else if (oldDoc == null || (!oldDoc.appType.equals(doc.appType))) - { - fillExportList(settings.getExporters(doc.appType)); - } - - - selectedDoc = s; - - mount(doc, docAware); - disableDocUpDown(); - } - - /** - * The user clicks the "Add" button. - * This will open a "FileOpen" dialog, - * and, if the user chooses more than one file, - * will open a status dialog, when validating each document. - */ - public void addDocument() - { - - final String[] files = getDocAddDialog().callOpenDialog(true, settings.cp_DefaultSession.cp_InDirectory); - if (files == null) - { - return; - } - final Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, files.length * 5); - - /* - * If more than a certain number - * of documents have been added, - * open the status dialog. - */ - if (files.length > MIN_ADD_FILES_FOR_DIALOG) - { - StatusDialog sd = getStatusDialog(); - sd.setLabel(resources.resValidatingDocuments); - sd.execute(this, task, resources.prodName); - LoadDocs oLoadDocs = new LoadDocs(this.xControl, files, task); - oLoadDocs.loadDocuments(); - task.removeTaskListener(sd); - } - /* - * When adding a single document, do not use a - * status dialog... - */ - else - { - LoadDocs oLoadDocs = new LoadDocs(this.xControl, files, task); - oLoadDocs.loadDocuments(); - } - - } - - /** - * The user clicked delete. - */ - public void removeDocument() - { - if (selectedDoc.length == 0) - { - return; - } - settings.cp_DefaultSession.cp_Content.cp_Documents.remove(selectedDoc[0]); - - // update the selected document - while (selectedDoc[0] >= getDocsCount()) - { - selectedDoc[0]--; // if there are no documents... - } - if (selectedDoc[0] == -1) - { - selectedDoc = EMPTY_SHORT_ARRAY; // update the list to show the right selection. - } - docListDA.updateUI(); - // disables all the next steps, if the list of docuemnts - // is empty. - checkSteps(); - } - - /** - * doc up. - */ - public void docUp() - { - Object doc = settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(selectedDoc[0]); - settings.cp_DefaultSession.cp_Content.cp_Documents.remove(selectedDoc[0]); - settings.cp_DefaultSession.cp_Content.cp_Documents.add(--selectedDoc[0], doc); - docListDA.updateUI(); - disableDocUpDown(); - } - - /** - * doc down - */ - public void docDown() - { - Object doc = settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(selectedDoc[0]); - settings.cp_DefaultSession.cp_Content.cp_Documents.remove(selectedDoc[0]); - settings.cp_DefaultSession.cp_Content.cp_Documents.add(++selectedDoc[0], doc); - docListDA.updateUI(); - disableDocUpDown(); - } - - /* ****************************** - * STEP 5 - */ - /** - * invoked when the user clicks "Choose backgrounds" button. - */ - private ImageListDialog bgDialog; - - /** - * the user clicked the "backgrounds" button - */ - public void chooseBackground() - { - try - { - setEnabled(btnBackgrounds, false); - if (bgDialog == null) - { - bgDialog = new BackgroundsDialog(xMSF, settings.cp_BackgroundImages, resources); - bgDialog.createWindowPeer(xControl.getPeer()); - } - bgDialog.setSelected(settings.cp_DefaultSession.cp_Design.cp_BackgroundImage); - short i = bgDialog.executeDialog((UnoDialog) WWD_Events.this); - if (i == 1) //ok - { - setBackground(bgDialog.getSelected()); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - setEnabled(btnBackgrounds, true); - } - } - - /** - * invoked when the BackgorundsDialog is "OKed". - */ - public void setBackground(Object background) - { - if (background == null) - { - background = PropertyNames.EMPTY_STRING; - } - settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = (String) background; - refreshStylePreview(); - } - private IconsDialog iconsDialog; - - /** - * is called when the user clicks "Icon sets" button. - * - */ - public void chooseIconset() - { - try - { - setEnabled(btnIconSets, false); - if (iconsDialog == null) - { - iconsDialog = new IconsDialog(xMSF, settings.cp_IconSets, resources); - iconsDialog.createWindowPeer(xControl.getPeer()); - } - - iconsDialog.setIconset(settings.cp_DefaultSession.cp_Design.cp_IconSet); - - short i = iconsDialog.executeDialog((UnoDialog) WWD_Events.this); - if (i == 1) //ok - { - setIconset(iconsDialog.getIconset()); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - finally - { - setEnabled(btnIconSets, true); - } - } - - /** - * invoked when the Iconsets Dialog is OKed. - */ - public void setIconset(String icon) - { - settings.cp_DefaultSession.cp_Design.cp_IconSet = icon; - updateIconsetText(); - } - - /* ****************************** - * STEP 7 - */ - /** - * sets the publishing url of either a local/zip or ftp publisher. - * updates the ui.... - */ - private CGPublish setPublishUrl(String publisher, String url, int number) - { - if (url == null) - { - return null; - } - CGPublish p = getPublisher(publisher); - p.cp_URL = url; - p.cp_Publish = true; - updatePublishUI(number); - p.overwriteApproved = true; - return p; - } - - /** - * updates the ui of a certain publisher - * (the text box url) - * @param number - */ - private void updatePublishUI(int number) - { - pubAware.get(number).updateUI(); - pubAware.get(number + 1).updateUI(); - checkPublish(); - } - - /** - * The user clicks the local "..." button. - * - */ - public void setPublishLocalDir() - { - String dir = showFolderDialog("Local destination directory", PropertyNames.EMPTY_STRING, settings.cp_DefaultSession.cp_OutDirectory); - //if ok was pressed... - setPublishUrl(LOCAL_PUBLISHER, dir, 0); - - } - - /** - * The user clicks the "Configure" FTP button. - * - */ - public void setFTPPublish() - { - if (showFTPDialog(getPublisher(FTP_PUBLISHER))) - { - getPublisher(FTP_PUBLISHER).cp_Publish = true; - updatePublishUI(2); - } - } - - /** - * show the ftp dialog - * @param pub - * @return true if OK was pressed, otherwise false. - */ - private boolean showFTPDialog(CGPublish pub) - { - try - { - return getFTPDialog(pub).execute(this) == 1; - } - catch (Exception ex) - { - ex.printStackTrace(); - return false; - } - } - - /** - * the user clicks the zip "..." button. - * Choose a zip file... - */ - public void setZipFilename() - { - SystemDialog sd = getZipDialog(); - String zipFile = sd.callStoreDialog(settings.cp_DefaultSession.cp_OutDirectory, resources.resDefaultArchiveFilename); - setPublishUrl(ZIP_PUBLISHER, zipFile, 4); - getPublisher(ZIP_PUBLISHER).overwriteApproved = true; - } - private TOCPreview docPreview; - - /** - * the user clicks the "Preview" button. - */ - public void documentPreview() - { - try - { - if (docPreview == null) - { - docPreview = new TOCPreview(xMSF, settings, resources, stylePreview.tempDir, myFrame); - } - docPreview.refresh(settings); - } - catch (Exception ex) - { - unexpectedError(ex); - } - } - - /* ********************** - * FINISH - */ - /** - * This method checks if the given target's path, added the pathExtension argument, - * exists, and asks the user what to do about it. - * If the user says its all fine, then the target will - * be replaced. - * @return true if "create" should continue. false if "create" should abort. - */ - private boolean publishTargetApproved() - { - boolean result = true; - // 1. check local publish target - - CGPublish p = getPublisher(LOCAL_PUBLISHER); - - // should publish ? - if (p.cp_Publish) - { - String path = getFileAccess().getPath(p.url, null); - // target exists? - if (getFileAccess().exists(p.url, false)) - { - //if its a directory - if (getFileAccess().isDirectory(p.url)) - { - //check if its empty - String[] files = getFileAccess().listFiles(p.url, true); - if (files.length > 0) - { - /* it is not empty :-( - * it either a local publisher or an ftp (zip uses no directories - * as target...) - */ - String message = JavaTools.replaceSubString(resources.resLocalTragetNotEmpty, - path, "%FILENAME"); - result = AbstractErrorHandler.showMessage( - xMSF, xControl.getPeer(), message, - ErrorHandler.MESSAGE_WARNING, ErrorHandler.BUTTONS_YES_NO, - ErrorHandler.DEF_NO, ErrorHandler.RESULT_YES); - - if (!result) - { - return result; - } - } - } - else - {//not a directory, but still exists - String message = JavaTools.replaceSubString(resources.resLocalTargetExistsAsfile, - path, "%FILENAME"); - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - - // try to write to the path... - } - else - { - // the local target directory does not exist. - String message = JavaTools.replaceSubString(resources.resLocalTargetCreate, - path, "%FILENAME"); - try - { - result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_QUESTION_YES); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - if (!result) - { - return result; - // try to create the directory... - } - try - { - getFileAccess().fileAccess.createFolder(p.cp_URL); - } - catch (Exception ex) - { - message = JavaTools.replaceSubString(resources.resLocalTargetCouldNotCreate, - path, "%FILENAME"); - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - } - } - - // 2. Check ZIP - // should publish ? - p = getPublisher(ZIP_PUBLISHER); - - if (p.cp_Publish) - { - - String path = getFileAccess().getPath(p.cp_URL, null); - // target exists? - if (getFileAccess().exists(p.cp_URL, false)) - { - //if its a directory - if (getFileAccess().isDirectory(p.cp_URL)) - { - String message = JavaTools.replaceSubString(resources.resZipTargetIsDir, - path, "%FILENAME"); - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - else - {//not a directory, but still exists ( a file...) - if (!p.overwriteApproved) - { - String message = JavaTools.replaceSubString(resources.resZipTargetExists, - path, "%FILENAME"); - result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_QUESTION_YES); - if (!result) - { - return false; - } - } - } - } - } - - // 3. check FTP - p = getPublisher(FTP_PUBLISHER); - - // should publish ? - if (p.cp_Publish) - { - - String path = getFileAccess().getPath(p.cp_URL, null); - - // target exists? - if (getFileAccess().exists(p.url, false)) - { - //if its a directory - if (getFileAccess().isDirectory(p.url)) - { - //check if its empty - String[] files = getFileAccess().listFiles(p.url, true); - if (files.length > 0) - { - /* it is not empty :-( - * it either a local publisher or an ftp (zip uses no directories - * as target...) - */ - String message = JavaTools.replaceSubString(resources.resFTPTargetNotEmpty, - path, "%FILENAME"); - result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_QUESTION_CANCEL); - if (!result) - { - return result; - } - } - } - else - {//not a directory, but still exists (as a file) - String message = JavaTools.replaceSubString(resources.resFTPTargetExistsAsfile, - path, "%FILENAME"); - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - - // try to write to the path... - } - else - { - // the ftp target directory does not exist. - String message = JavaTools.replaceSubString(resources.resFTPTargetCreate, - path, "%FILENAME"); - result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_QUESTION_YES); - if (!result) - { - return result; - // try to create the directory... - } - try - { - getFileAccess().fileAccess.createFolder(p.url); - } - catch (Exception ex) - { - message = JavaTools.replaceSubString(resources.resFTPTargetCouldNotCreate, - path, "%FILENAME"); - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, - ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - } - } - return true; - } - - /* - * return false if "create" should be aborted. true if everything is fine. - */ - private boolean saveSession() - { - try - { - Object node = null; - String name = getSessionSaveName(); - - //set documents index field. - ListModel docs = settings.cp_DefaultSession.cp_Content.cp_Documents; - - for (int i = 0; i < docs.getSize(); i++) - { - ((CGDocument) docs.getElementAt(i)).cp_Index = i; - } - Object conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", true); - // first I check if a session with the given name exists - try - { - node = Configuration.getNode(name, conf); - if (node != null) - { - if (!AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), - JavaTools.replaceSubString(resources.resSessionExists, name, "${NAME}"), - ErrorHandler.ERROR_NORMAL_IGNORE)) - { - return false; //remove the old session - } - } - Configuration.removeNode(conf, name); - - } - catch (NoSuchElementException nsex) - { - } - - settings.cp_DefaultSession.cp_Index = 0; - node = Configuration.addConfigNode(conf, name); - settings.cp_DefaultSession.cp_Name = name; - settings.cp_DefaultSession.writeConfiguration(node, CONFIG_READ_PARAM); - settings.cp_SavedSessions.reindexSet(conf, name, "Index"); - Configuration.commit(conf); - - // now I reload the sessions to actualize the list/combo boxes load/save sessions. - settings.cp_SavedSessions.clear(); - - Object confView = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", false); - settings.cp_SavedSessions.readConfiguration(confView, CONFIG_READ_PARAM); - - settings.cp_LastSavedSession = name; - currentSession = name; - // now save the name of the last saved session... - - settings.cp_LastSavedSession = name; - - // TODO add the <none> session... - prepareSessionLists(); - ListModelBinder.fillList(lstLoadSettings, settings.cp_SavedSessions.items(), null); - ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null); - selectSession(); - - currentSession = settings.cp_LastSavedSession; - - return true; - } - catch (Exception ex) - { - ex.printStackTrace(); - return false; - } - } - - private String targetStringFor(String publisher) - { - CGPublish p = getPublisher(publisher); - if (p.cp_Publish) - { - return "\n" + getFileAccess().getPath(p.cp_URL, null); - } - else - { - return PropertyNames.EMPTY_STRING; - } - } - - /** - * this method will be called when the Status Dialog - * is hidden. - * It checks if the "Process" was successful, and if so, - * it closes the wizard dialog. - */ - public void finishWizardFinished() - { - if (process.getResult()) - { - String targets = - targetStringFor(LOCAL_PUBLISHER) + - targetStringFor(ZIP_PUBLISHER) + - targetStringFor(FTP_PUBLISHER); - String message = JavaTools.replaceSubString(resources.resFinishedSuccess, targets, "%FILENAME"); - - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, ErrorHandler.ERROR_MESSAGE); - if (exitOnCreate) - { - this.xDialog.endExecute(); - } - } - else - { - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resFinishedNoSuccess, ErrorHandler.ERROR_WARNING); - } - } - - public void cancel() - { - xDialog.endExecute(); - } - private Process process; - private boolean exitOnCreate = true; - - /** - * the user clicks the finish/create button. - */ - public boolean finishWizard() - { - finishWizard(true); - return true; - } - - /** - * finish the wizard - * @param exitOnCreate_ should the wizard close after - * a successful create. - * Default is true, - * I have a hidden feature which enables false here - */ - public void finishWizard(boolean exitOnCreate_) - { - - exitOnCreate = exitOnCreate_; - - /** - * First I check if ftp password was set, if not - the ftp dialog pops up... - * This may happen when a session is loaded, since the - * session saves the ftp url and username, but not the password. - */ - final CGPublish p = getPublisher(FTP_PUBLISHER); - // if ftp is checked, and no proxies are set, and password is empty... - if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals(PropertyNames.EMPTY_STRING))) - { - if (showFTPDialog(p)) - { - updatePublishUI(2); - //now continue... - finishWizard2(); - } - } - else - { - finishWizard2(); - } - } - - /** - * this method is only called - * if ftp-password was eather set, or - * the user entered one in the FTP Dialog which - * popped up when clicking "Create". - * - */ - private void finishWizard2() - { - - CGPublish p = getPublisher(LOCAL_PUBLISHER); - p.url = p.cp_URL; - - /* - * zip publisher is using another url form... - */ - p = getPublisher(ZIP_PUBLISHER); - //replace the '%' with '%25' - String url1 = JavaTools.replaceSubString(p.cp_URL, "%25", "%"); - //replace all '/' with '%2F' - url1 = JavaTools.replaceSubString(url1, "%2F", "/"); - - p.url = "vnd.sun.star.zip://" + url1 + "/"; - - /* - * and now ftp... - */ - p = getPublisher(FTP_PUBLISHER); - p.url = FTPDialog.getFullURL(p); - - - /* first we check the publishing targets. If they exist we warn and ask - * what to do. a False here means the user said "cancel" (or rather: clicked...) - */ - if (!publishTargetApproved()) - { - return; - /* - * In order to save the session correctly, - * I return the value of the ftp publisher cp_Publish - * property to its original value... - */ - } - p.cp_Publish = __ftp; - - //if the "save settings" checkbox is on... - if (isSaveSession()) - { - // if canceled by user - if (!saveSession()) - { - return; - } - } - else - { - settings.cp_LastSavedSession = PropertyNames.EMPTY_STRING; - } - try - { - Object conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, true); - Configuration.set( - settings.cp_LastSavedSession, - "LastSavedSession", conf); - Configuration.commit(conf); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - /* - * again, if proxies are on, I disable ftp before the creation process - * starts. - */ - if (proxies) - { - p.cp_Publish = false; - - /* - * There is currently a bug, which crashes office when - * writing folders to an existing zip file, after deleting - * its content, so I "manually" delete it here... - */ - } - p = getPublisher(ZIP_PUBLISHER); - if (getFileAccess().exists(p.cp_URL, false)) - { - getFileAccess().delete(p.cp_URL); - } - try - { - - ErrorHandler eh = new ProcessErrorHandler(xMSF, xControl.getPeer(), resources); - - process = new Process(settings, xMSF, eh); - - StatusDialog pd = getStatusDialog(); - - pd.setRenderer(new ProcessStatusRenderer(resources)); - pd.execute(this, process.myTask, resources.prodName); //process, - process.runProcess(); - finishWizardFinished(); - process.myTask.removeTaskListener(pd); - - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - } - - /** - * implements a hidden feature for "finishing" without - * closing the wizard. - * press "&%" quite fast when the focus is on one - * of the last steps' checkboxes. - */ - private class Create implements XKeyListener - { - - long time = 0; - int count = 0; - - /* (non-Javadoc) - * @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent) - */ - public void keyPressed(KeyEvent ke) - { - if (ke.KeyChar == '&') - { - time = System.currentTimeMillis(); - } - else if (ke.KeyChar == '%' && ((System.currentTimeMillis() - time) < 300)) - { - Boolean b = (Boolean) getControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED); - if (b.booleanValue()) - { - finishWizard(false); - } - } - } - - public void keyReleased(KeyEvent arg0) - { - } - - public void disposing(EventObject arg0) - { - } - } - - /** - * is called on the WindowHidden event, - * deletes the temporary directory. - */ - public void cleanup() - { - - - try - { - dpStylePreview.dispose(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - stylePreview.cleanup(); - - try - { - if (bgDialog != null) - { - bgDialog.xComponent.dispose(); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - try - { - if (iconsDialog != null) - { - iconsDialog.xComponent.dispose(); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - try - { - if (ftpDialog != null) - { - ftpDialog.xComponent.dispose(); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - try - { - xComponent.dispose(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - try - { - XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myFrame); - if (xCloseable != null) - { - xCloseable.close(false); - } - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - } - - public class LoadDocs - { - - private XControl xC; - String[] files; - Task task; - - public LoadDocs(XControl xC_, String[] files_, Task task_) - { - xC = xC_; - files = files_; - task = task_; - } - - public void loadDocuments() - { - // where the documents are added to in the list (offset) - int offset = (getSelectedDoc().length > 0 ? selectedDoc[0] + 1 : getDocsCount()); - - /* if the user chose one file, the list starts at 0, - * if he chose more than one, the first entry is a directory name, - * all the others are filenames. - */ - int start = (files.length > 1 ? 1 : 0); - /* - * Number of documents failed to validate. - */ - int failed = 0; - - // store the directory - settings.cp_DefaultSession.cp_InDirectory = start == 1 ? files[0] : FileAccess.getParentDir(files[0]); - - /* - * Here i go through each file, and validate it. - * If its ok, I add it to the ListModel/ConfigSet - */ - for (int i = start; i < files.length; i++) - { - CGDocument doc = new CGDocument(); - doc.setRoot(settings); - - doc.cp_URL = (start == 0) ? files[i] : FileAccess.connectURLs(files[0], files[i]); - - /* so - i check each document and if it is ok I add it. - * The failed variable is used only to calculate the place to add - - * Error reporting to the user is (or should (-: )done in the checkDocument(...) method - */ - if (checkDocument(doc, task, xC)) - { - settings.cp_DefaultSession.cp_Content.cp_Documents.add(offset + i - failed - start, doc); - } - else - { - failed++; - } - } - - // if any documents where added, - // set the first one to be the current-selected document. - if (files.length > start + failed) - { - setSelectedDoc(new short[] - { - (short) offset - }); - } - // update the ui... - docListDA.updateUI(); - // this enables/disables the next steps. - // when no documents in the list, all next steps are disabled - checkSteps(); - /* a small insurance that the status dialog will - * really close... - */ - while (task.getStatus() < task.getMax()) - { - task.advance(false); - } - } - } -} - diff --git a/wizards/com/sun/star/wizards/web/WWD_General.java b/wizards/com/sun/star/wizards/web/WWD_General.java deleted file mode 100644 index 8e532eee9dd1..000000000000 --- a/wizards/com/sun/star/wizards/web/WWD_General.java +++ /dev/null @@ -1,377 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.XWindowPeer; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.util.XStringSubstitution; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.HelpIds; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.ui.event.ListModelBinder; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGFilter; -import com.sun.star.wizards.web.data.CGPublish; -import com.sun.star.wizards.web.data.CGSettings; - -/** - * This class implements general methods, used by different sub-classes (either WWD_Sturtup, or WWD_Events) - * or both. - */ -public abstract class WWD_General extends WebWizardDialog -{ - - private FileAccess fileAccess; - private SystemDialog docAddDialog, folderDialog, favIconDialog, zipDialog; - protected FTPDialog ftpDialog; - protected CGSettings settings; - /** - * true if proxies are on, which means, ftp is disabled. - */ - protected boolean proxies; - private XStringSubstitution xStringSubstitution; - - protected StatusDialog getStatusDialog() - { - - StatusDialog statusDialog = new StatusDialog(xMSF, StatusDialog.STANDARD_WIDTH, resources.resLoadingSession, false, new String[] - { - resources.prodName, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING - }, HelpIds.getHelpIdString(HID0_STATUS_DIALOG)); - try - { - statusDialog.createWindowPeer(xControl.getPeer()); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return statusDialog; - } - - /** - * @param xmsf - */ - public WWD_General(XMultiServiceFactory xmsf) - { - super(xmsf); - xStringSubstitution = SystemDialog.createStringSubstitution(xmsf); - } - - /* - * File Dialog methods - */ - protected SystemDialog getDocAddDialog() - { - docAddDialog = SystemDialog.createOpenDialog(xMSF); - for (int i = 0; i < settings.cp_Filters.getSize(); i++) - { - CGFilter f = ((CGFilter) settings.cp_Filters.getElementAt(i)); - docAddDialog.addFilter( - JavaTools.replaceSubString(f.cp_Name, resources.prodName, "%PRODNAME"), f.cp_Filter, i == 0); - } - return docAddDialog; - } - - protected SystemDialog getZipDialog() - { - if (zipDialog == null) - { - zipDialog = SystemDialog.createStoreDialog(xMSF); - zipDialog.addFilter(resources.resZipFiles, "*.zip", true); - } - return zipDialog; - } - - protected FTPDialog getFTPDialog(CGPublish pub) - { - if (ftpDialog == null) - { - try - { - ftpDialog = new FTPDialog(xMSF, pub); - ftpDialog.createWindowPeer(xControl.getPeer()); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - return ftpDialog; - } - - protected String showFolderDialog(String title, String description, String dir) - { - if (folderDialog == null) - { - folderDialog = SystemDialog.createFolderDialog(xMSF); - } - return folderDialog.callFolderDialog(title, description, dir); - } - - protected FileAccess getFileAccess() - { - if (fileAccess == null) - { - try - { - fileAccess = new FileAccess(xMSF); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - return fileAccess; - } - - /** - * returns the document specified - * by the given short array. - * @param s - * @return - */ - protected CGDocument getDoc(short[] s) - { - if (s.length == 0) - { - return null; - } - else if (settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0]) - { - return null; - } - else - { - return (CGDocument) settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0]); - } - } - - /** - * how many documents are in the list? - * @return the number of documents in the docs list. - */ - protected int getDocsCount() - { - return settings.cp_DefaultSession.cp_Content.cp_Documents.getSize(); - } - - /** - * fills the export listbox. - * @param listContent - */ - protected void fillExportList(Object[] listContent) - { - ListModelBinder.fillList(lstDocTargetType, listContent, null); - } - - /** - * returns a publisher object for the given name - * @param name one of the WebWizardConst constants : FTP - * @return - */ - protected CGPublish getPublisher(String name) - { - return (CGPublish) settings.cp_DefaultSession.cp_Publishing.getElement(name); - } - - /** - * @return true if the checkbox "save session" is checked. - */ - protected boolean isSaveSession() - { - return (((Number) Helper.getUnoPropertyValue( - getModel(chkSaveSettings), PropertyNames.PROPERTY_STATE)).intValue() == 1); - } - - /** - * @return the name to save the session (step 7) - */ - protected String getSessionSaveName() - { - return (String) Helper.getUnoPropertyValue( - getModel(cbSaveSettings), "Text"); - } - - /** - * This method checks the status of the wizards and - * enables or disables the 'next' and the 'create' button. - * - */ - protected void checkSteps() - { - /* first I check the document list. - * If it is empty, then step3 and on are disabled. - */ - if (checkDocList()) - { - checkPublish(); - } - } - - /** - * enables/disables the steps 3 to 7) - * @param enabled true = enabled, false = disabled. - */ - private void enableSteps(boolean enabled) - { - - if (!enabled && !isStepEnabled(3)) - { - return; - /* - * disbale steps 3-7 - */ - } - for (int i = 3; i < 8; i++) - { - setStepEnabled(i, enabled, true); - /* in this place i just disable the finish button. - * later, in the checkPublish, which is only performed if - * this one is true, it will be enabled (if the check - * is positive) - */ - } - if (!enabled) - { - enableFinishButton(false); - } - } - - /** - * Checks if the documents list is - * empty. If it is, disables the steps 3-7, and the - * create button. - * @return - */ - protected boolean checkDocList() - { - if (settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() == 0) - { - enableSteps(false); - return false; - } - else - { - enableSteps(true); - return true; - } - } - - /** - * check if the save-settings input is ok. - * (eather the checkbox is unmarked, or, - * if it is marked, a session name exists. - * - */ - public boolean checkSaveSession() - { - return (!isSaveSession() || - !getSessionSaveName().equals(PropertyNames.EMPTY_STRING)); - - } - - /** - * @return false if this publisher is not active, or, if it - * active, returns true if the url is not empty... - * if the url is empty, throws an exception - */ - private boolean checkPublish(String s, Object text, String property) - { - CGPublish p = getPublisher(s); - if (p.cp_Publish) - { - String url = (String) Helper.getUnoPropertyValue(getModel(text), property); - if ((url == null) || (url.equals(PropertyNames.EMPTY_STRING))) - { - throw new IllegalArgumentException(); - } - else - { - return true; - } - } - else - { - return false; - } - } - - /** - * @return false either if publishing input is wrong or there - * are no publishing targets chosen. returns true when at least - * one target is chosen, *and* all - * which are chosen are legal. - * If proxies are on, ftp publisher is ignored. - */ - private boolean checkPublish_() - { - try - { - return (checkPublish(LOCAL_PUBLISHER, txtLocalDir, "Text") | (!proxies && checkPublish(FTP_PUBLISHER, lblFTP, PropertyNames.PROPERTY_LABEL)) | checkPublish(ZIP_PUBLISHER, txtZip, "Text")) && checkSaveSession(); - } - catch (IllegalArgumentException ex) - { - return false; - } - } - - /** - * This method checks if the publishing - * input is ok, and enables and disables - * the 'create' button. - * public because it is called from - * an event listener object. - */ - public void checkPublish() - { - enableFinishButton(checkPublish_()); - } - - /** - * shows a message box "Unexpected Error... " :-) - * @param ex - */ - protected void unexpectedError(Exception ex) - { - ex.printStackTrace(); - XWindowPeer peer = xControl.getPeer(); - AbstractErrorHandler.showMessage(xMSF, peer, resources.resErrUnexpected, ErrorHandler.ERROR_PROCESS_FATAL); - } - - /** - * substitutes path variables with the corresponding values. - * @param path a path, which might contain OOo path variables. - * @return the path, after substituing path variables. - */ - protected String substitute(String path) - { - try - { - return xStringSubstitution.substituteVariables(path, false); - } - catch (Exception ex) - { - return path; - } - } -} diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java deleted file mode 100644 index c33f913772ae..000000000000 --- a/wizards/com/sun/star/wizards/web/WWD_Startup.java +++ /dev/null @@ -1,942 +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 com.sun.star.wizards.web; - -import java.io.FileNotFoundException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import com.sun.star.awt.VclWindowPeerAttribute; -import com.sun.star.awt.XControl; -import com.sun.star.awt.XItemListener; -import com.sun.star.awt.XWindow; -import com.sun.star.awt.XWindowPeer; -import com.sun.star.frame.XDesktop; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.XModel; -import com.sun.star.lang.EventObject; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.wizards.common.ConfigSet; -import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.SystemDialog; -import com.sun.star.wizards.document.OfficeDocument; -import com.sun.star.wizards.ui.DocumentPreview; -import com.sun.star.wizards.ui.event.DataAware; -import com.sun.star.wizards.ui.event.ListModelBinder; -import com.sun.star.wizards.ui.event.RadioDataAware; -import com.sun.star.wizards.ui.event.SimpleDataAware; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.ui.event.UnoDataAware; -import com.sun.star.wizards.web.data.CGContent; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGIconSet; -import com.sun.star.wizards.web.data.CGPublish; -import com.sun.star.wizards.web.data.CGSession; -import com.sun.star.wizards.web.data.CGSessionName; -import com.sun.star.wizards.web.data.CGSettings; -import com.sun.star.wizards.web.data.CGStyle; - -/** - * Web Wizard Dialog implementation : Startup. - * This class contains the startup implementation and session mounting methods.<p/> - * <h2> Data Aware Concept </h2> - * <p> I use DataAware objects, which synchronize - * UI and Data. A DataAware object a kind of interface - * between a Value and a UI element. - * </P> - * <p> - * A Value is either a JavaBean property with - * a Getter and a Setter or a public class Memeber. - * </P> - * When the UI Control changes, the Value changes correspondingly. - * This depends on settings a Listener which calls the updateData() - * method od the DataAware object. - * When the Value changes, the UI Control changes respopndingly. - * This also depends on settings a Listener which calls the updateUI() - * method of the DataAware object. - * </P> - * <P> - * here I use only UI Listeners, and keep calling - * the updateUI() method whenever I change the Value. - * </P> - * To contain the Data, I use the Configuration Data Objects - * which read themselfs out of the Configuration. they are all located under - * the data package. - * <p/> - * Different groups of DataAware objects are grouped into vectors. - * Each group (all elements of a vector) uses the same DataObject, - * so when I change the underlying dataObject, I change the whole vector's DataObject, - * thus actualizing UI.<br/> - * This is what happends when a session loads: I Load the session into - * a tree of DataObjects, and change the DataAware's DataObject. <br/> - * One could also look at this as a kind of "View-Model" relationship. - * The controls are the View, The DataObjects are the Model, containing the - * Data rad directly from the configuration, and the DataAware objects - * are the controller inbetween. - */ -public abstract class WWD_Startup extends WWD_General -{ - - SimpleDataAware sda = null; - /** - * This is currently not used. - * It should have been a Listener which invoces - * an Update to the Preview-Document, only - * We did not implement the live-preview document, - * so this became obsolete. - */ - protected DataAware.Listener refresh; - /** - * Is called whenever a field is changed which - * could affect the "create" button enable state, - * like publishing-checkboxes, save-session check- and textbox. - */ - protected DataAware.Listener checkPublish = new CheckPublish(); - /** - * The Vector containing DataAware objects - * which relay on the selected document - * as DataObject (or Model). - */ - protected List<DataAware> docAware = new ArrayList<DataAware>(); - /** - * The Vector containing DataAware objects - * which relay on the session's generalInfo - * Object (CGSession.cp_GeneralInfo) as - * DataObject (or model). - */ - protected List<DataAware> genAware = new ArrayList<DataAware>(); - /** - * The vector containing DataAware objectscm25npd .. - * which relay on the session's Design Object - * (CGSession.cp_Design) as DataObject - * (or model). - * - */ - protected List<DataAware> designAware = new ArrayList<DataAware>(); - /** - * A Vector containig the DataAware objects - * which relay on Publishing Objects. - * Differently from other Vectors, each - * DataAware object in this Vector relays - * on a <b>different</b> CGPublish object, - * So they are handled with more care. - */ - protected List<DataAware> pubAware = new ArrayList<DataAware>(3); - /** - * The DataAware object which handles - * the documents-list events. - * This will call the set/getDocument() method - * implemented in WWD_General. - */ - protected UnoDataAware docListDA; - /** - * DataAware object which synchronizes the session - * name in step 7 with the CGSession.cp_Name - */ - protected UnoDataAware sessionNameDA; - /** - * Binds a ListModel to the UnoControlListBox. - */ - protected ListModelBinder docsBinder; - /** - * a DocumentPreview object is - * the UI OO Document preview - * in the Dialog - */ - protected DocumentPreview dpStylePreview; - /** - * An Object that implements the - * File-copy and refresh of the - * style preview - */ - protected StylePreview stylePreview; - /** - * the currently selected document. - */ - protected short[] selectedDoc = new short[0]; - /** - * If ftp proxies are on, ftp is disabled, and - * the true/false of the FTP publisher is set to false. - * In order to save it correctly when saving the session - * at the end, the original loaded value is saved to this variable; - */ - boolean __ftp; - /** - * When the wizard starts, a new document opens. - * The backgroundDoc member contains the TextDocument - * instance used for that purpose. - */ - protected XFrame myFrame; - /** - * He - my constructor ! - * I call/do here in this order: <br/> - * Check if ftp http proxy is set, and warn user he can not use - * ftp if it is.<br/> - * draw NaviBar and steps 1 to 7, incl. Step X, - * which is the Layouts ImageList on step 3.<br/> - * load the settings from the configuration. <br/> - * set the default save session name to the first - * available one (sessionX or something like that). <br/> - * set the Layouts ImageList ListModel, and call - * its "create()" method. <br/> - * check the content (documents) specified in the default session.<br/> - * fill the list boxes (saved sessions, styles, combobox save session). <br/> - * make data aware. <br/> - * updateUI (refreshes the display to crrespond to the data in - * the default session.)<br/> - * fill the documents listbox. <br/> - * if proxies are set, disable the ftp controls in step 7. - */ - public WWD_Startup(XMultiServiceFactory xmsf) throws Exception - { - super(xmsf); - - proxies = getOOProxies(); - - String soTemplateDir = FileAccess.getOfficePath(xmsf, "Template", "share", "/wizard"); - - String exclamationURL = FileAccess.connectURLs(soTemplateDir, "../wizard/bitmap/caution_16.png"); - this.drawNaviBar(); - this.buildStep1(); - this.buildStep2(); - this.buildStep3(); - - this.buildStep4(); - this.buildStep5(); - this.buildStep6(); - this.buildStep7(proxies, exclamationURL); - buildStepX(); - - this.xMSF = xmsf; - XDesktop xDesktop = Desktop.getDesktop(xMSF); - myFrame = OfficeDocument.createNewFrame(xMSF, this); - Object doc = OfficeDocument.createNewDocument(myFrame, "swriter", false, true); - - loadSettings(doc); - setSaveSessionName(settings.cp_DefaultSession); - - ilLayouts.setListModel(settings.cp_Layouts); - ilLayouts.create(this); - - checkContent(settings.cp_DefaultSession.cp_Content, new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 99999), this.xControl); - - //saved sessions, styles, combobox save session. - // also set the chosen saved session... - fillLists(); - makeDataAware(); - // change the display to correspond to the current session. - updateUI(); - // fill the documents listbox. - mount(settings.cp_DefaultSession.cp_Content); - - - if (proxies) - { - setEnabled(btnFTP, false); - setEnabled(chkFTP, false); - } - } - - /** - * return true if http proxies or other proxies - * which do not enable ftp to function correctly are set. - * @return true if (http) proxies are on. - * @throws Exception - */ - private boolean getOOProxies() throws Exception - { - Object node = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Inet/Settings", false); - int i = Configuration.getInt("ooInetProxyType", node); - switch (i) - { - case 0: //no proxies - return false; - case 2: //http proxies - return true; - default: - return true; - } - } - - /** - * calculates the first available session name, - * and sets the current session name to it. - * The combobox text in step 7 will be updated - * automatically when updateUI() is called. - */ - protected void setSaveSessionName(CGSession session) - { - int max = 0; - int len = resources.resSessionName.length(); - // traverse between the sessions and find the one that - // has the biggest number. - for (int i = 0; i < settings.cp_SavedSessions.getSize(); i++) - { - String sessionName = ((CGSessionName) settings.cp_SavedSessions.getElementAt(i)).cp_Name; - if (sessionName.startsWith(resources.resSessionName)) - { - max = max(max, Integer.valueOf(sessionName.substring(len)).intValue()); - } - } - - session.cp_Name = resources.resSessionName + ++max; - - } - - private int max(int i1, int i2) - { - if (i1 > i2) - { - return i1; - } - else - { - return i2; - } - } - - /** - * fills the road map, and sets the necessary properties, - * like MaxStep, Complete, Interactive- - * Disables the finbihButton. - */ - private void addRoadMapItems() - { - insertRoadMapItems(new String[] - { - resources.resStep1, resources.resStep2, resources.resStep3, resources.resStep4, resources.resStep5, resources.resStep6, resources.resStep7 - }, new int[] - { - 1, 2, 3, 4, 5, 6, 7 - }, new boolean[] - { - true, true, false, false, false, false, false - }); - - setRoadmapInteractive(true); - setRoadmapComplete(true); - setCurrentRoadmapItemID((short) 1); - setMaxStep(7); - enableFinishButton(false); - - } - - /** - * This method goes through all - * the DataAware vectors and objects and - * calls their updateUI() method. - * In response, the UI is synchronized to - * the state of the corresponding data objects. - * - */ - private void updateUI() - { - DataAware.updateUI(designAware); - DataAware.updateUI(genAware); - DataAware.updateUI(pubAware); - sessionNameDA.updateUI(); - checkPublish(); - } - - private XFrame getFrame(Object model) - { - XModel xmodel = UnoRuntime.queryInterface(XModel.class, model); - return xmodel.getCurrentController().getFrame(); - } - - /** - * create the peer, add roadmap, - * add roadmap items, add style-preview, - * disable the steps 3 to 7 if no documents are - * on the list, and... show the dialog! - */ - public void show() - { - try - { - XWindow xContainerWindow = myFrame.getComponentWindow(); - XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow); - - createWindowPeer(xWindowPeer); - - addRoadmap(); - addRoadMapItems(); - addStylePreview(); - checkSteps(); - - executeDialog(myFrame); - removeTerminateListener(); - - } - catch (java.lang.Exception jexception) - { - jexception.printStackTrace(System.err); - } - } - - /** - * initializes the style preview. - */ - private void addStylePreview() - { - try - { - dpStylePreview = new DocumentPreview(xMSF, imgPreview); - stylePreview = new StylePreview(xMSF, settings.workPath); - stylePreview.refresh(settings.cp_DefaultSession.getStyle(), settings.cp_DefaultSession.cp_Design.cp_BackgroundImage); - dpStylePreview.setDocument(stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE); - - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * Loads the web wizard settings from the registry. - */ - private void loadSettings(Object document) - { - try - { - // instanciate - String[] settingsResources = new String[] - { - resources.resPages, - resources.resSlides, - resources.resCreatedTemplate, - resources.resUpdatedTemplate, - resources.resSizeTemplate - }; - - settings = new CGSettings(xMSF, settingsResources, document); - - // get configuration view - Object confRoot = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, false); - // read - settings.readConfiguration(confRoot, CONFIG_READ_PARAM); - - ConfigSet set = settings.cp_DefaultSession.cp_Publishing; - - // now if path variables are used in publisher paths, they - // are getting replaced here... - for (int i = 0; i < set.getSize(); i++) - { - CGPublish p = (CGPublish) set.getElementAt(i); - p.cp_URL = substitute(p.cp_URL); - } - - // initialize the settings. - settings.configure(xMSF); - - // set resource needed for web page. - - // sort the styles alphabetically - settings.cp_Styles.sort(new StylesComparator()); - - prepareSessionLists(); - - if (proxies) - { - __ftp = getPublisher(FTP_PUBLISHER).cp_Publish; - getPublisher(FTP_PUBLISHER).cp_Publish = false; - - } - - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - protected void prepareSessionLists() - { - // now copy the sessions list... - Object[] sessions = settings.cp_SavedSessions.items(); - settings.savedSessions.clear(); - for (int i = 0; i < sessions.length; i++) - { - settings.savedSessions.add(i, sessions[i]); // add an empty session to the saved session list which apears in step 1 - } - CGSessionName sn = new CGSessionName(); - sn.cp_Name = resources.resSessionNameNone; - settings.cp_SavedSessions.add(0, sn); - } - - /** - * fills the saved session list, the styles list, - * and save session combo box. - * Also set the selected "load" session to the last session - * which was saved. - */ - private void fillLists() - { - // fill the saved session list. - ListModelBinder.fillList(lstLoadSettings, settings.cp_SavedSessions.items(), null); - - // set the selected session to load. (step 1) - selectSession(); - - // fill the styles list. - ListModelBinder.fillList(lstStyles, settings.cp_Styles.items(), null); - - // fill the save session combobox (step 7) - ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null); - - - } - - protected void selectSession() - { - int selectedSession = 0; - if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals(PropertyNames.EMPTY_STRING)) - { - - Object ses = settings.cp_SavedSessions.getElement(settings.cp_LastSavedSession); - if (ses != null) - { - selectedSession = settings.cp_SavedSessions.getIndexOf(ses); - } - } - Helper.setUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS, new short[] - { - (short) selectedSession - }); - - } - - public class SimpleDataawareUpdater implements XItemListener - { - /* (non-Javadoc) - * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject) - */ - - public void disposing(EventObject arg0) - { - // TODO Auto-generated method stub - } - - public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) - { - sda.updateData(); - //TODO xf uncomment - } - } - - /** - * attaches to each ui-data-control (like checkbox, groupbox or - * textbox, no buttons though), a DataObject's JavaBean Property, - * or class member. - */ - private void makeDataAware() - { - //page 1 - new ListModelBinder(lstLoadSettings, settings.cp_SavedSessions); - - //page 2 : document properties - - docListDA = UnoDataAware.attachListBox(this, "SelectedDoc", lstDocuments, null, false); - docListDA.disableControls(new Object[] - { - /*btnDocDown, btnDocUp, */ - lnDocsInfo, btnRemoveDoc, lblDocTitle, txtDocTitle, lblDocInfo, txtDocInfo, lblDocAuthor, txtDocAuthor, lblDocExportFormat, lstDocTargetType - }); - docListDA.updateUI(); - - CGDocument doc = new CGDocument(); //dummy - - docsBinder = new ListModelBinder(lstDocuments, settings.cp_DefaultSession.cp_Content.cp_Documents); - - docAware.add(UnoDataAware.attachEditControl(doc, "cp_Title", txtDocTitle, refresh, true)); - docAware.add(UnoDataAware.attachEditControl(doc, "cp_Description", txtDocInfo, refresh, true)); - docAware.add(UnoDataAware.attachEditControl(doc, "cp_Author", txtDocAuthor, refresh, true)); - docAware.add(UnoDataAware.attachListBox(doc, "Exporter", lstDocTargetType, refresh, false)); - - //page 3 : Layout - Object design = settings.cp_DefaultSession.cp_Design; - sda = new SimpleDataAware(design, new DataAware.PropertyValue("Layout", design), ilLayouts, new DataAware.PropertyValue("Selected", ilLayouts)); - ilLayouts.addItemListener(new SimpleDataawareUpdater()); - designAware.add(sda); - - //page 4 : layout 2 - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayDescription", chbDocDesc, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayAuthor", chbDocAuthor, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayCreateDate", chkDocCreated, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayUpdateDate", chkDocChanged, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayFilename", chkDocFilename, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayFileFormat", chkDocFormat, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayFormatIcon", chkDocFormatIcon, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayPages", chkDocPages, refresh, true)); - designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplaySize", chkDocSize, refresh, true)); - designAware.add(RadioDataAware.attachRadioButtons(settings.cp_DefaultSession.cp_Design, "cp_OptimizeDisplaySize", new Object[] - { - optOptimize640x480, optOptimize800x600, optOptimize1024x768 - }, refresh, true)); - - - //page 5 : Style - /* - * note : on style change, i do not call here refresh ,but rather on - * a special method which will perform some display, background and Iconsets changes. - */ - designAware.add(UnoDataAware.attachListBox(settings.cp_DefaultSession.cp_Design, "Style", lstStyles, null, false)); - - //page 6 : site general props - genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Title", txtSiteTitle, refresh, true)); - genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Description", txtSiteDesc, refresh, true)); - - genAware.add(UnoDataAware.attachDateControl(settings.cp_DefaultSession.cp_GeneralInfo, "CreationDate", dateSiteCreated, refresh, false)); - genAware.add(UnoDataAware.attachDateControl(settings.cp_DefaultSession.cp_GeneralInfo, "UpdateDate", dateSiteUpdate, refresh, false)); - genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Email", txtEmail, refresh, true)); - genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Copyright", txtCopyright, refresh, true)); - - //page 7 : publishing - - pubAware(LOCAL_PUBLISHER, chkLocalDir, txtLocalDir, false); - pubAware(FTP_PUBLISHER, chkFTP, lblFTP, true); - pubAware(ZIP_PUBLISHER, chkZip, txtZip, false); - - sessionNameDA = UnoDataAware.attachEditControl(settings.cp_DefaultSession, "cp_Name", cbSaveSettings, null, true); - - //cleanup when exiting wizard. - } - - /** - * A help method to attach a Checkbox and a TextBox to - * a CGPublish object properties/class members, - * @param publish - * @param checkbox - * @param textbox - */ - private void pubAware(String publish, Object checkbox, Object textbox, boolean isLabel) - { - Object p = settings.cp_DefaultSession.cp_Publishing.getElement(publish); - UnoDataAware uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, checkPublish, true); - uda.setInverse(true); - - uda.disableControls(new Object[] - { - textbox - }); - pubAware.add(uda); - pubAware.add( - isLabel ? UnoDataAware.attachLabel(p, PropertyNames.URL, textbox, checkPublish, false) - : UnoDataAware.attachEditControl(p, PropertyNames.URL, textbox, checkPublish, false)); - - } - - /* - * Session load methods - * (are used both on the start of the wizard and - * when the user loads a session) - */ - /** - * Is called when a new session/settings is - * loaded. <br/> - * Checks the documents (validate), fills the - * documents listbox, and changes the - * DataAware data objects to the - * new session's objects.<br/> - * Task advances 4 times in the mount method, - * and ??? times for each document in the session. - * - */ - protected void mount(CGSession session, Task task, boolean refreshStyle, XControl xC) - { - /* This checks the documents. If the user - * chooses to cancel, the session is not loaded. - */ - checkContent(session.cp_Content, task, xC); - - settings.cp_DefaultSession = session; - - mount(session.cp_Content); - - task.advance(true); - - mount(session.cp_Design, designAware); - mount(session.cp_GeneralInfo, genAware); - - task.advance(true); - - mount(session.cp_Publishing.getElement(LOCAL_PUBLISHER), 0); - mount(session.cp_Publishing.getElement(FTP_PUBLISHER), 1); - mount(session.cp_Publishing.getElement(ZIP_PUBLISHER), 2); - - task.advance(true); - - sessionNameDA.setDataObject(session, true); - Helper.setUnoPropertyValue(getModel(chkSaveSettings), PropertyNames.PROPERTY_STATE, new Short((short) 1)); - docListDA.updateUI(); - - task.advance(true); - - if (refreshStyle) - { - refreshStylePreview(); - updateIconsetText(); - } - - //updateUI(); - } - - /** - * used to mount the publishing objects. This is somehow cryptic - - * there are 6 DataAware objects, 2 for each Publishing Object (CGPublish). - * All 6 reside on one Vector (pubAware). - * Since, otherwise than other DataAware objects, different - * Objects on the same Vector need different DataObjectBinding, - * I use this method... - * @param data the CGPublish object - * @param i the number of the object (0 = local, 1 = ftp, 2 = zip) - */ - private void mount(Object data, int i) - { - pubAware.get(i * 2).setDataObject(data, true); - pubAware.get(i * 2 + 1).setDataObject(data, true); - } - - /** - * Fills the documents listbox. - * @param root the CGContent object - * that contains the documents (a ListModel) - */ - private void mount(CGContent root) - { - ListModelBinder.fillList(lstDocuments, root.cp_Documents.items(), null); - docsBinder.setListModel(root.cp_Documents); - disableDocUpDown(); - - } - - /** - * changes the DataAwares Objects' (in - * the gioen list) DataObject to the - * @param data - * @param list - */ - protected void mount(Object data, List<DataAware> list) - { - for (int i = 0; i < list.size(); i++) - { - list.get(i).setDataObject(data, true); - } - } - - /** - * Checks if the document specified by the given CGDocument - * object (cp_URL) exists. Calls also the validate(...) method - * of this document. - * If the document does not exist, it asks the user whether - * to specify a new URL, or forget about this document. - * @param doc the document to check. - * @param task while loading a session, a status is - * displayed, using the Task object to monitor progress. - * @return true if the document is ok (a file exists in the given url). - */ - protected boolean checkDocument(CGDocument doc, Task task, XControl xC) - { - try - { - doc.validate(xMSF, task); - return true; - } - catch (FileNotFoundException ex) - { - - int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer(), "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING) + "\n\n" + resources.resSpecifyNewFileLocation); - - if (relocate == 2) - { - String[] file = getDocAddDialog().callOpenDialog(false, FileAccess.getParentDir(doc.cp_URL)); - if (file == null) - { - return false; - } - else - { - doc.cp_URL = file[0]; - return checkDocument(doc, task, xC); - } - } - else - { - return false; - } - } - catch (IllegalArgumentException iaex) - { - //file is a directory - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), - JavaTools.replaceSubString(resources.resErrIsDirectory, - getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING), - "%FILENAME"), - ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - catch (Exception exp) - { - //something went wrong. - exp.printStackTrace(); - AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), - JavaTools.replaceSubString(resources.resErrDocValidate, - getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING), - "%FILENAME"), ErrorHandler.ERROR_PROCESS_FATAL); - return false; - } - - } - - /** - * Checks the documents contained in this content. - * @param content - * @param task - */ - private void checkContent(CGContent content, Task task, XControl xC) - { - for (int i = 0; i < content.cp_Documents.getSize(); i++) - { - if (!checkDocument((CGDocument) content.cp_Documents.getElementAt(i), task, xC)) - // I use here 'i--' since, when the document is removed - // an index change accures - { - content.cp_Documents.remove(i--); - } - } - } - - /** - * A Listener which is called whenever - * a Publish checkbox/textbox state changes, and - * changes the "create" button enable state accordingly. - */ - private class CheckPublish implements DataAware.Listener - { - - public void eventPerformed(Object event) - { - checkPublish(); - } - } - - /** - * Disables/enables the docUpDown buttons (step 2) - * according to the currently selected document - * (no doc selected - both disbaled, last doc selected, - * down disabled and so on...) - * - */ - protected void disableDocUpDown() - { - try - { - setEnabled(btnDocUp, selectedDoc.length == 0 ? Boolean.FALSE : (selectedDoc[0] == 0 ? Boolean.FALSE : Boolean.TRUE)); - setEnabled(btnDocDown, selectedDoc.length == 0 ? Boolean.FALSE : (selectedDoc[0] + 1 < settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() ? Boolean.TRUE : Boolean.FALSE)); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - void updateBackgroundText() - { - String bg = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage; - if (bg == null || bg.equals(PropertyNames.EMPTY_STRING)) - { - bg = resources.resBackgroundNone; - } - else - { - bg = FileAccess.getPathFilename(getFileAccess().getPath(bg, null)); - } - Helper.setUnoPropertyValue(getModel(txtBackground), PropertyNames.PROPERTY_LABEL, bg); - } - - void updateIconsetText() - { - String iconset = settings.cp_DefaultSession.cp_Design.cp_IconSet; - String iconsetName; - if (iconset == null || iconset.equals(PropertyNames.EMPTY_STRING)) - { - iconsetName = resources.resIconsetNone; - } - else - { - CGIconSet is = (CGIconSet) settings.cp_IconSets.getElement(iconset); - if (is == null) - { - iconsetName = resources.resIconsetNone; - } - else - { - iconsetName = is.cp_Name; - } - } - - Helper.setUnoPropertyValue(getModel(txtIconset), PropertyNames.PROPERTY_LABEL, iconsetName); - } - - /** - * refreshes the style preview. - * I also call here "updateBackgroundtext", because always - * when the background is changed, this method - * has to be called, so I am walking on the safe side here... - */ - public void refreshStylePreview() - { - try - { - updateBackgroundText(); - stylePreview.refresh(settings.cp_DefaultSession.getStyle(), settings.cp_DefaultSession.cp_Design.cp_BackgroundImage); - dpStylePreview.reload(xMSF); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - private class StylesComparator implements Comparator<Object> - { - - /* (non-Javadoc) - * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) - */ - public int compare(Object o1, Object o2) - { - if (o1 instanceof CGStyle && o2 instanceof CGStyle) - { - return ((CGStyle) o1).cp_Name.compareTo( - ((CGStyle) o2).cp_Name); - } - else - { - throw new IllegalArgumentException("Cannot compare objects which are not CGStyle."); - } - } - } -} diff --git a/wizards/com/sun/star/wizards/web/WWHID.java b/wizards/com/sun/star/wizards/web/WWHID.java deleted file mode 100644 index 9ef8ef4ed77d..000000000000 --- a/wizards/com/sun/star/wizards/web/WWHID.java +++ /dev/null @@ -1,169 +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 . - */ -/* - * Created on May 5, 2004 - * - * TODO To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package com.sun.star.wizards.web; - -/** - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -public interface WWHID -{ - -// web wizard general controls - public static final int HID0_WEBWIZARD = 34200 + 0; - public static final int HID0_HELP = 34200 + 1; - public static final int HID0_NEXT = 34200 + 2; - public static final int HID0_PREV = 34200 + 3; - public static final int HID0_CREATE = 34200 + 4; - public static final int HID0_CANCEL = 34200 + 5; - public static final int HID0_STATUS_DIALOG = 34200 + 6;// step 1 - public static final int HID1_LST_SESSIONS = 34200 + 7; - public static final int HID1_BTN_DEL_SES = 34200 + 9;// step 2 - public static final int HID2_LST_DOCS = 34200 + 10; - public static final int HID2_BTN_ADD_DOC = 34200 + 11; - public static final int HID2_BTN_REM_DOC = 34200 + 12; - public static final int HID2_BTN_DOC_UP = 34200 + 13; - public static final int HID2_BTN_DOC_DOWN = 34200 + 14; - public static final int HID2_TXT_DOC_TITLE = 34200 + 15; - public static final int HID2_TXT_DOC_DESC = 34200 + 16; - public static final int HID2_TXT_DOC_AUTHOR = 34200 + 17; - public static final int HID2_LST_DOC_EXPORT = 34200 + 18; - public static final int HID2_STATUS_ADD_DOCS = 34200 + 19;// step 3 - public static final int HID3_IL_LAYOUTS_IMG1 = 34200 + 20; - public static final int HID3_IL_LAYOUTS_IMG2 = 34200 + 21; - public static final int HID3_IL_LAYOUTS_IMG3 = 34200 + 22; - public static final int HID3_IL_LAYOUTS_IMG4 = 34200 + 23; - public static final int HID3_IL_LAYOUTS_IMG5 = 34200 + 24; - public static final int HID3_IL_LAYOUTS_IMG6 = 34200 + 25; - public static final int HID3_IL_LAYOUTS_IMG7 = 34200 + 26; - public static final int HID3_IL_LAYOUTS_IMG8 = 34200 + 27; - public static final int HID3_IL_LAYOUTS_IMG9 = 34200 + 28; - public static final int HID3_IL_LAYOUTS_IMG10 = 34200 + 29; - public static final int HID3_IL_LAYOUTS_IMG11 = 34200 + 30; - public static final int HID3_IL_LAYOUTS_IMG12 = 34200 + 31; - public static final int HID3_IL_LAYOUTS_IMG13 = 34200 + 32; - public static final int HID3_IL_LAYOUTS_IMG14 = 34200 + 33; - public static final int HID3_IL_LAYOUTS_IMG15 = 34200 + 34;// step 4 - public static final int HID4_CHK_DISPLAY_FILENAME = 34200 + 35; - public static final int HID4_CHK_DISPLAY_DESCRIPTION = 34200 + 36; - public static final int HID4_CHK_DISPLAY_AUTHOR = 34200 + 37; - public static final int HID4_CHK_DISPLAY_CR_DATE = 34200 + 38; - public static final int HID4_CHK_DISPLAY_UP_DATE = 34200 + 39; - public static final int HID4_CHK_DISPLAY_FORMAT = 34200 + 40; - public static final int HID4_CHK_DISPLAY_F_ICON = 34200 + 41; - public static final int HID4_CHK_DISPLAY_PAGES = 34200 + 42; - public static final int HID4_CHK_DISPLAY_SIZE = 34200 + 43; - public static final int HID4_GRP_OPTIMAIZE_640 = 34200 + 44; - public static final int HID4_GRP_OPTIMAIZE_800 = 34200 + 45; - public static final int HID4_GRP_OPTIMAIZE_1024 = 34200 + 46;// step 5 - public static final int HID5_LST_STYLES = 34200 + 47; - public static final int HID5_BTN_BACKGND = 34200 + 48; - public static final int HID5_BTN_ICONS = 34200 + 49;// step 6 - public static final int HID6_TXT_SITE_TITLE = 34200 + 50; - public static final int HID6_TXT_SITE_ICON = 34200 + 51; - public static final int HID6_BTN_SITE_ICON = 34200 + 52; - public static final int HID6_TXT_SITE_DESC = 34200 + 53; - public static final int HID6_TXT_SITE_KEYWRDS = 34200 + 54; - public static final int HID6_DATE_SITE_CREATED = 34200 + 55; - public static final int HID6_DATE_SITE_UPDATED = 34200 + 56; - public static final int HID6_NUM_SITE_REVISTS = 34200 + 57; - public static final int HID6_TXT_SITE_EMAIL = 34200 + 58; - public static final int HID6_TXT_SITE_COPYRIGHT = 34200 + 59;// step 7 - public static final int HID7_BTN_PREVIEW = 34200 + 60; - public static final int HID7_CHK_PUBLISH_LOCAL = 34200 + 61; - public static final int HID7_TXT_LOCAL = 34200 + 62; - public static final int HID7_BTN_LOCAL = 34200 + 63; - public static final int HID7_CHK_PUBLISH_ZIP = 34200 + 64; - public static final int HID7_TXT_ZIP = 34200 + 65; - public static final int HID7_BTN_ZIP = 34200 + 66; - public static final int HID7_CHK_PUBLISH_FTP = 34200 + 67; - public static final int HID7_BTN_FTP = 34200 + 69; - public static final int HID7_CHK_SAVE = 34200 + 70; - public static final int HID7_TXT_SAVE = 34200 + 71;// web wizard backgrounds dialog - public static final int HID_BG = 34200 + 90; - public static final int HID_BG_BTN_OTHER = 34200 + 91; - public static final int HID_BG_BTN_NONE = 34200 + 92; - public static final int HID_BG_BTN_OK = 34200 + 93; - public static final int HID_BG_BTN_CANCEL = 34200 + 94; - public static final int HID_BG_BTN_BACK = 34200 + 95; - public static final int HID_BG_BTN_FW = 34200 + 96; - public static final int HID_BG_BTN_IMG1 = 34200 + 97; - public static final int HID_BG_BTN_IMG2 = 34200 + 98; - public static final int HID_BG_BTN_IMG3 = 34200 + 99; - public static final int HID_BG_BTN_IMG4 = 34200 + 100; - public static final int HID_BG_BTN_IMG5 = 34200 + 101; - public static final int HID_BG_BTN_IMG6 = 34200 + 102; - public static final int HID_BG_BTN_IMG7 = 34200 + 103; - public static final int HID_BG_BTN_IMG8 = 34200 + 104; - public static final int HID_BG_BTN_IMG9 = 34200 + 105; - public static final int HID_BG_BTN_IMG10 = 34200 + 106; - public static final int HID_BG_BTN_IMG11 = 34200 + 107; - public static final int HID_BG_BTN_IMG12 = 34200 + 108;// web wizard icons sets dialog - public static final int HID_IS = 41000 + 0; - public static final int HID_IS_ICONSETS = 41000 + 1; - public static final int HID_IS_BTN_NONE = 41000 + 2; - public static final int HID_IS_BTN_OK = 41000 + 3; - public static final int HID_IS_BTN_IMG1 = 41000 + 5; - public static final int HID_IS_BTN_IMG2 = 41000 + 6; - public static final int HID_IS_BTN_IMG3 = 41000 + 7; - public static final int HID_IS_BTN_IMG4 = 41000 + 8; - public static final int HID_IS_BTN_IMG5 = 41000 + 9; - public static final int HID_IS_BTN_IMG6 = 41000 + 10; - public static final int HID_IS_BTN_IMG7 = 41000 + 11; - public static final int HID_IS_BTN_IMG8 = 41000 + 12; - public static final int HID_IS_BTN_IMG9 = 41000 + 13; - public static final int HID_IS_BTN_IMG10 = 41000 + 14; - public static final int HID_IS_BTN_IMG11 = 41000 + 15; - public static final int HID_IS_BTN_IMG12 = 41000 + 16; - public static final int HID_IS_BTN_IMG13 = 41000 + 17; - public static final int HID_IS_BTN_IMG14 = 41000 + 18; - public static final int HID_IS_BTN_IMG15 = 41000 + 19; - public static final int HID_IS_BTN_IMG16 = 41000 + 20; - public static final int HID_IS_BTN_IMG17 = 41000 + 21; - public static final int HID_IS_BTN_IMG18 = 41000 + 22; - public static final int HID_IS_BTN_IMG19 = 41000 + 23; - public static final int HID_IS_BTN_IMG20 = 41000 + 24; - public static final int HID_IS_BTN_IMG21 = 41000 + 25; - public static final int HID_IS_BTN_IMG22 = 41000 + 26; - public static final int HID_IS_BTN_IMG23 = 41000 + 27; - public static final int HID_IS_BTN_IMG24 = 41000 + 28; - public static final int HID_IS_BTN_IMG25 = 41000 + 29; - public static final int HID_IS_BTN_IMG26 = 41000 + 30; - public static final int HID_IS_BTN_IMG27 = 41000 + 31; - public static final int HID_IS_BTN_IMG28 = 41000 + 32; - public static final int HID_IS_BTN_IMG29 = 41000 + 33; - public static final int HID_IS_BTN_IMG30 = 41000 + 34; - public static final int HID_IS_BTN_IMG31 = 41000 + 35; - public static final int HID_IS_BTN_IMG32 = 41000 + 36; -// web wizard ftp dialog - public static final int HID_FTP = 41000 + 40; - public static final int HID_FTP_SERVER = 41000 + 41; - public static final int HID_FTP_USERNAME = 41000 + 42; - public static final int HID_FTP_PASS = 41000 + 43; - public static final int HID_FTP_TEST = 41000 + 44; - public static final int HID_FTP_TXT_PATH = 41000 + 45; - public static final int HID_FTP_BTN_PATH = 41000 + 46; - public static final int HID_FTP_OK = 41000 + 47; - public static final int HID_FTP_CANCEL = 41000 + 48; -} diff --git a/wizards/com/sun/star/wizards/web/WebWizard.java b/wizards/com/sun/star/wizards/web/WebWizard.java deleted file mode 100644 index 6635aafd1974..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizard.java +++ /dev/null @@ -1,54 +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 com.sun.star.wizards.web; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Desktop; - -/** - * The last class in the WebWizard Dialog class hirarchy. - * Has no functionality, is just nice to have it instanciated. - */ -public class WebWizard extends WWD_Events -{ - - public WebWizard(XMultiServiceFactory xmsf) throws Exception - { - super(xmsf); - } - - public static void main(String args[]) - { - - String ConnectStr = - "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager"; - try - { - XMultiServiceFactory xmsf = Desktop.connect(ConnectStr); - WebWizard ww = new WebWizard(xmsf); - ww.show(); - ww.cleanup(); - - } - catch (Exception exception) - { - exception.printStackTrace(System.err); - } - } -} diff --git a/wizards/com/sun/star/wizards/web/WebWizardConst.java b/wizards/com/sun/star/wizards/web/WebWizardConst.java deleted file mode 100644 index 4d21ff6337c2..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizardConst.java +++ /dev/null @@ -1,64 +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 com.sun.star.wizards.web; - -public interface WebWizardConst -{ - - public static final String LSTLOADSETTINGS_ITEM_CHANGED = "sessionSelected"; // "lstLoadSettingsItemChanged"; - public static final String BTNLOADSESSION_ACTION_PERFORMED = "loadSession"; // "btnLoadSessionActionPerformed"; - public static final String BTNDELSESSION_ACTION_PERFORMED = "delSession"; // "btnDelSessionActionPerformed"; - public static final String BTNADDDOC_ACTION_PERFORMED = "addDocument"; // "btnAddDocActionPerformed"; - public static final String BTNREMOVEDOC_ACTION_PERFORMED = "removeDocument"; // "btnRemoveDocActionPerformed"; - public static final String BTNDOCUP_ACTION_PERFORMED = "docUp"; // "btnDocUpActionPerformed"; - public static final String BTNDOCDOWN_ACTION_PERFORMED = "docDown"; // "btnDocDownActionPerformed"; - public static final String LSTSTYLES_ITEM_CHANGED = "refreshStylePreview"; // "lstStylesItemChanged"; - public static final String BTNBACKGROUNDS_ACTION_PERFORMED = "chooseBackground"; // "btnBackgroundsActionPerformed"; - public static final String BTNICONSETS_ACTION_PERFORMED = "chooseIconset"; // "btnIconSetsActionPerformed"; - public static final String BTNFAVICON_ACTION_PERFORMED = "chooseFavIcon"; // "btnFavIconActionPerformed"; - public static final String BTNPREVIEW_ACTION_PERFORMED = "documentPreview"; // "btnPreviewActionPerformed"; - public static final String BTNFTP_ACTION_PERFORMED = "setFTPPublish"; // "btnFTPActionPerformed"; - public static final String CHKLOCALDIR_ITEM_CHANGED = "checkPublish"; // "chkLocalDirItemChanged"; - public static final String CHKSAVESETTINGS_ITEM_CHANGED = "checkPublish"; // "chkSaveSettingsItemChanged"; - public static final String TXTSAVESETTINGS_TEXT_CHANGED = "checkPublish"; // "txtSaveSettingsTextChanged"; - public static final String BTNLOCALDIR_ACTION_PERFORMED = "setPublishLocalDir"; // "btnLocalDirActionPerformed"; - public static final String BTNZIP_ACTION_PERFORMED = "setZipFilename";// "btnZipActionPerformed"; - public static final String CONFIG_PATH = "/org.openoffice.Office.WebWizard/WebWizard"; - public static final String CONFIG_READ_PARAM = "cp_"; - public static final String TASK = "WWIZ"; - public static final String TASK_PREPARE = "t-prep"; - public static final String LOCAL_PUBLISHER = "local"; - public static final String FTP_PUBLISHER = "ftp"; - public static final String ZIP_PUBLISHER = "zip"; - public static final String TASK_EXPORT = "t_exp"; - public static final String TASK_EXPORT_PREPARE = "t_exp_prep"; - public static final String TASK_EXPORT_DOCUMENTS = "t_exp_docs"; - public static final String TASK_GENERATE_PREPARE = "t_gen_prep"; - public static final String TASK_GENERATE_XSL = "t_gen_x"; - public static final String TASK_GENERATE_COPY = "t_gen_cp"; - public static final String TASK_PUBLISH_PREPARE = "t_pub_prep"; - //public static final String TASK_PUBLISH = "t_pub"; - public static final String TASK_FINISH = "t_fin"; - /** - * when the user adds more than this number - * of documents to the list, a status dialog opens. - */ - public static final int MIN_ADD_FILES_FOR_DIALOG = 2; -} -
\ No newline at end of file diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java deleted file mode 100644 index c41b061d7750..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java +++ /dev/null @@ -1,879 +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 com.sun.star.wizards.web; - -import com.sun.star.awt.FontDescriptor; -import com.sun.star.awt.Size; -import com.sun.star.awt.XButton; -import com.sun.star.awt.XCheckBox; -import com.sun.star.awt.XComboBox; -import com.sun.star.awt.XControl; -import com.sun.star.awt.XDateField; -import com.sun.star.awt.XFixedText; -import com.sun.star.awt.XListBox; -import com.sun.star.awt.XRadioButton; -import com.sun.star.awt.XTextComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Helper; -import com.sun.star.wizards.common.HelpIds; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.ui.ImageList; -import com.sun.star.wizards.ui.UIConsts; -import com.sun.star.wizards.ui.WizardDialog; -import com.sun.star.wizards.web.data.CGLayout; - -/** - * This class is generated Automatically.... - */ -public abstract class WebWizardDialog extends WizardDialog implements WebWizardConst, UIConsts, WWHID -{ - //GUI Components as Class members. - XFixedText lbIntroTitle; - XFixedText lblIntroduction; - //Fixed Line - XControl lnLoadSettings; - XFixedText lblLoadSettings; - XListBox lstLoadSettings; - XButton btnDelSession; - XFixedText lblContentTitle; - //Fixed Line - XFixedText lblSiteContent; - XListBox lstDocuments; - XButton btnAddDoc; - XButton btnRemoveDoc; - XButton btnDocUp; - XButton btnDocDown; - //Fixed Line - XControl lnDocsInfo; - XFixedText lblDocTitle; - XTextComponent txtDocTitle; - XFixedText lblDocInfo; - XTextComponent txtDocInfo; - XFixedText lblDocAuthor; - XTextComponent txtDocAuthor; - XFixedText lblDocExportFormat; - XListBox lstDocTargetType; - XFixedText lblLayoutTitle; - XFixedText lblLayouts; - XCheckBox chbDocDesc; - XCheckBox chkDocFilename; - XCheckBox chbDocAuthor; - XCheckBox chkDocFormat; - XCheckBox chkDocFormatIcon; - XCheckBox chkDocCreated; - XCheckBox chkDocChanged; - XCheckBox chkDocPages; - XCheckBox chkDocSize; - XFixedText lnDisplay; - XRadioButton optOptimize640x480; - XRadioButton optOptimize800x600; - XRadioButton optOptimize1024x768; - XFixedText lblLayout2Title; - XFixedText lblOptimizeFor; // Step 5 - XFixedText lblStyle; - XFixedText lblStyleTitle; - XListBox lstStyles; //Image Control - XFixedText txtBackground; - XFixedText txtIconset; - XButton btnBackgrounds; - XButton btnIconSets; - XControl imgPreview; // Step 6 - XFixedText lblSiteTitle; - XFixedText lblSiteCreated; - XFixedText lblEmail; - XFixedText lblSiteDesc; - XTextComponent txtSiteTitle; - XTextComponent txtSiteDesc; - XTextComponent txtEmail; - XDateField dateSiteCreated; - XDateField dateSiteUpdate; - XFixedText lblSiteUpdated; - XTextComponent txtCopyright; - XFixedText lblCopyright; - XFixedText lblTitleGeneralPage; - XButton btnPreview; - XButton btnFTP; - XCheckBox chkLocalDir; - //Fixed Line - XControl lblCreateSite; - XCheckBox chkFTP; - XFixedText lblFTP; - XCheckBox chkZip; - XCheckBox chkSaveSettings; - XFixedText lblSaveSettings; - //Fixed Line - XControl lnSaveSetting; - XComboBox cbSaveSettings; - XTextComponent txtLocalDir; - XTextComponent txtZip; - XButton btnLocalDir; - XButton btnZip; - XFixedText lblTitlePublish; - //Fixed Line - XControl FixedLine1; - //Font Descriptors as Class members. - FontDescriptor fontDescriptor0 = new FontDescriptor(); - FontDescriptor fontDescriptor1 = new FontDescriptor(); - FontDescriptor fontDescriptor4 = new FontDescriptor(); - FontDescriptor fontDescriptor5 = new FontDescriptor(); - FontDescriptor fontDescriptor6 = new FontDescriptor(); - FontDescriptor fontDescriptor7 = new FontDescriptor(); - private static String[] PROPNAMES_LBL = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - private static String[] PROPNAMES_CHKBOX = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - private static String[] PROPNAMES_BUTTON = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - private static String[] PROPNAMES_TXT = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - private static String[] PROPNAMES_TXT_2 = new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - private static String[] PROPNAMES_TITLE = new String[] - { - PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }; - private static Integer INTEGER_91 = 91; - private static Integer INTEGER_97 = 97; - private static Integer INTEGER_103 = 103; - private static Integer INTEGER_169 = 169; //Resources Object - WebWizardDialogResources resources; - - public WebWizardDialog(XMultiServiceFactory xmsf) - { - super(xmsf, HID0_WEBWIZARD); - //Load Resources - resources = new WebWizardDialogResources(xmsf, super.getResource()); - - - //set dialog properties... - Helper.setUnoPropertyValues(xDialogModel, - new String[] - { - PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, 210, HelpIds.getHelpIdString(HID0_WEBWIZARD), Boolean.TRUE, "WebWizardDialog", 102, 52, INTEGERS[1], new Short((short) 6), resources.resWebWizardDialog_title, 330 - }); - - //Set member- FontDescriptors... - fontDescriptor0.Weight = 100; - fontDescriptor1.Weight = 150; - fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE; - fontDescriptor4.Weight = 150; - fontDescriptor5.Name = "Angsana New"; - fontDescriptor5.Height = 16; - fontDescriptor5.StyleName = "Regular"; - fontDescriptor5.Family = com.sun.star.awt.FontFamily.ROMAN; - fontDescriptor5.Weight = 100; - fontDescriptor6.Name = "Andalus"; - fontDescriptor6.Height = 22; - fontDescriptor6.StyleName = "Bold Italic"; - fontDescriptor6.Weight = 150; - fontDescriptor6.Slant = com.sun.star.awt.FontSlant.ITALIC; - fontDescriptor7.Name = "StarSymbol"; - fontDescriptor7.Height = 9; - fontDescriptor7.StyleName = "Regular"; - fontDescriptor7.Weight = 100; - } - //build components - public void buildStep1() - { - short tabIndex = 100; - lbIntroTitle = insertLabel("lbIntroTitle", - PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGER_16, resources.reslbIntroTitle_value, Boolean.TRUE, "lbIntroTitle", 91, INTEGERS[8], INTEGERS[1], new Short(tabIndex++), 232 - }); - lblIntroduction = insertLabel("lblIntroduction", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 119, resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", 97, 28, INTEGERS[1], new Short(tabIndex++), 226 - }); - - lnLoadSettings = insertFixedLine("lnLoadSettings", - PROPNAMES_TXT, - new Object[] - { - INTEGERS[2], PropertyNames.EMPTY_STRING, "lnLoadSettings", 91, 147, INTEGERS[1], new Short(tabIndex++), 234 - }); - lblLoadSettings = insertLabel("lblLoadSettings", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - INTEGERS[8], resources.reslblLoadSettings_value, Boolean.TRUE, "lblLoadSettings", 97, 153, INTEGERS[1], new Short(tabIndex++), 226 - }); - lstLoadSettings = insertListBox("lstLoadSettings", null, LSTLOADSETTINGS_ITEM_CHANGED, - new String[] - { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID1_LST_SESSIONS), new Short((short) 14), "lstLoadSettings", 97, 165, INTEGERS[1], new Short(tabIndex++), 173 - }); - btnDelSession = insertButton("btnDelSession", BTNDELSESSION_ACTION_PERFORMED, - new String[] - { - PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "ImageAlign", PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(HID1_BTN_DEL_SES), new Short(com.sun.star.awt.ImageAlign.LEFT), resources.resbtnDelSession_value, "btnDelSession", 274, 164, INTEGERS[1], new Short(tabIndex++), INTEGER_50 - }); - } - - public void buildStep2() - { - short tabIndex = 200; - - lblContentTitle = insertLabel("lblContentTitle", - PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGER_16, resources.reslblContentTitle_value, Boolean.TRUE, "lblContentTitle", 91, INTEGERS[8], INTEGERS[2], new Short(tabIndex++), 232 - }); - lblSiteContent = insertLabel("lblSiteContent", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblSiteContent_value, "lblSiteContent", 97, 28, INTEGERS[2], new Short(tabIndex++), 105 - }); - lstDocuments = insertListBox("lstDocuments", null, null, - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 123, HelpIds.getHelpIdString(HID2_LST_DOCS), new Short((short) 9), "lstDocuments", 97, 38, INTEGERS[2], new Short(tabIndex++), 103 - }); - btnAddDoc = insertButton("btnAddDoc", BTNADDDOC_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_ADD_DOC), resources.resbtnAddDoc_value, "btnAddDoc", 97, 165, INTEGERS[2], new Short(tabIndex++), INTEGER_50 - }); - btnRemoveDoc = insertButton("btnRemoveDoc", BTNREMOVEDOC_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_REM_DOC), resources.resbtnRemoveDoc_value, "btnRemoveDoc", 150, 165, INTEGERS[2], new Short(tabIndex++), INTEGER_50 - }); - btnDocUp = insertButton("btnDocUp", BTNDOCUP_ACTION_PERFORMED, - new String[] - { - PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_UP), resources.resbtnDocUp_value, "btnDocUp", 205, 87, INTEGERS[2], new Short(tabIndex++), 18 - }); - btnDocDown = insertButton("btnDocDown", BTNDOCDOWN_ACTION_PERFORMED, - new String[] - { - PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_DOWN), resources.resbtnDocDown_value, "btnDocDown", 205, 105, INTEGERS[2], new Short(tabIndex++), 18 - }); - - lblDocExportFormat = insertLabel("lblDocExportFormat", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblDocExportFormat_value, "lblDocExportFormat", 235, 28, INTEGERS[2], new Short(tabIndex++), 89 - }); - lstDocTargetType = insertListBox("lstDocTargetType", null, null, - new String[] - { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID2_LST_DOC_EXPORT), new Short((short) 14), "lstDocTargetType", 235, 38, INTEGERS[2], new Short(tabIndex++), 89 - }); - - - - - lnDocsInfo = insertFixedLine("lnDocsInfo", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslnDocsInfo_value, "lnDocsInfo", 235, 66, INTEGERS[2], new Short(tabIndex++), 90 - }); - lblDocTitle = insertLabel("lblDocTitle", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblDocTitle_value, "lblDocTitle", 235, 78, INTEGERS[2], new Short(tabIndex++), 89 - }); - txtDocTitle = insertTextField("txtDocTitle", null, - PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_TITLE), "txtDocTitle", 235, 88, INTEGERS[2], new Short(tabIndex++), 89 - }); - lblDocInfo = insertLabel("lblDocInfo", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblDocInfo_value, "lblDocInfo", 235, 103, INTEGERS[2], new Short(tabIndex++), 89 - }); - txtDocInfo = insertTextField("txtDocInfo", null, - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - INTEGER_40, HelpIds.getHelpIdString(HID2_TXT_DOC_DESC), Boolean.TRUE, "txtDocInfo", 235, 113, INTEGERS[2], new Short(tabIndex++), 89 - }); - lblDocAuthor = insertLabel("lblDocAuthor", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblDocAuthor_value, "lblDocAuthor", 235, 155, INTEGERS[2], new Short(tabIndex++), 89 - }); - txtDocAuthor = insertTextField("txtDocAuthor", null, - PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_AUTHOR), "txtDocAuthor", 235, 165, INTEGERS[2], new Short(tabIndex++), 89 - }); - } - - public void buildStep3() - { - lblLayoutTitle = insertLabel("lblLayoutTitle", - PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGER_16, resources.reslblLayoutTitle_value, Boolean.TRUE, "lblLayoutTitle", 91, INTEGERS[8], INTEGERS[3], new Short((short) 29), 232 - }); - lblLayouts = insertLabel("lblLayouts", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblLayouts_value, "lblLayouts", 97, 28, INTEGERS[3], new Short((short) 30), 206 - }); - - } - - public void buildStep4() - { - lblLayout2Title = insertLabel("lblLayout2Title", - PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGER_16, resources.reslblLayout2Title_value, Boolean.TRUE, "lblLayout2Title", 91, INTEGERS[8], INTEGERS[4], new Short((short) 33), 232 - }); - lnDisplay = insertLabel("lblDisplay", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - INTEGER_16, resources.reslblDisplay_value, Boolean.TRUE, "lblDisplay", 97, 28, INTEGERS[4], new Short((short) 34), 226 - }); - chkDocFilename = insertCheckBox("chkDocFilename", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FILENAME), resources.reschkDocFilename_value, "chkDocFilename", 103, 50, new Short((short) 0), INTEGERS[4], new Short((short) 35), 99 - }); - chbDocDesc = insertCheckBox("chbDocDesc", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_DESCRIPTION), resources.reschbDocDesc_value, "chbDocDesc", 103, 60, new Short((short) 0), INTEGERS[4], new Short((short) 36), 99 - }); - chbDocAuthor = insertCheckBox("chbDocAuthor", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_AUTHOR), resources.reschbDocAuthor_value, "chbDocAuthor", 103, 70, new Short((short) 0), INTEGERS[4], new Short((short) 37), 99 - }); - chkDocCreated = insertCheckBox("chkDocCreated", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_CR_DATE), resources.reschkDocCreated_value, "chkDocCreated", 103, 80, new Short((short) 0), INTEGERS[4], new Short((short) 38), 99 - }); - chkDocChanged = insertCheckBox("chkDocChanged", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_UP_DATE), resources.reschkDocChanged_value, "chkDocChanged", 103, 90, new Short((short) 0), INTEGERS[4], new Short((short) 39), 99 - }); - - chkDocFormat = insertCheckBox("chkDocFormat", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FORMAT), resources.reschkDocFormat_value, "chkDocFormat", 200, 50, new Short((short) 0), INTEGERS[4], new Short((short) 40), 110 - }); - chkDocFormatIcon = insertCheckBox("chkDocFormatIcon", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_F_ICON), resources.reschkDocFormatIcon_value, "chkDocFormatIcon", 200, 60, new Short((short) 0), INTEGERS[4], new Short((short) 41), 110 - }); - chkDocPages = insertCheckBox("chkDocPages", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_PAGES), resources.reschkDocPages_value, "chkDocPages", 200, 70, new Short((short) 0), INTEGERS[4], new Short((short) 42), 110 - }); - chkDocSize = insertCheckBox("chkDocSize", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_SIZE), resources.reschkDocSize_value, "chkDocSize", 200, 80, new Short((short) 0), INTEGERS[4], new Short((short) 43), 110 - }); - lblOptimizeFor = insertLabel("lblOptimizeFor", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblOptimizeFor_value, "lblOptimizeFor", 97, 113, INTEGERS[4], new Short((short) 44), 226 - }); - optOptimize640x480 = insertRadioButton("optOptimize640x480", null, - PROPNAMES_BUTTON, - new Object[] - { - INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_640), resources.resoptOptimize640x480_value, "optOptimize640x480", 103, 133, INTEGERS[4], new Short((short) 45), 44 - }); - optOptimize800x600 = insertRadioButton("optOptimize800x600", null, - PROPNAMES_BUTTON, - new Object[] - { - INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_800), resources.resoptOptimize800x600_value, "optOptimize800x600", 103, 146, INTEGERS[4], new Short((short) 46), 44 - }); - optOptimize1024x768 = insertRadioButton("optOptimize1024x768", null, - PROPNAMES_BUTTON, - new Object[] - { - INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_1024), resources.resoptOptimize1024x768_value, "optOptimize1024x768", 103, 158, INTEGERS[4], new Short((short) 47), 44 - }); - - } - - public void buildStep5() - { - lblStyleTitle = insertLabel("lblStyleTitle", PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGER_16, resources.reslblStyleTitle_value, Boolean.TRUE, "lblStyleTitle", 91, INTEGERS[8], INTEGERS[5], new Short((short) 50), 232 - }); - - lblStyle = insertLabel("lblStyle", PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblStyle_value, "lblStyle", 97, 28, INTEGERS[5], new Short((short) 51), 80 - }); - lstStyles = insertListBox("lstStyles", null, LSTSTYLES_ITEM_CHANGED, - new String[] - { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID5_LST_STYLES), new Short((short) 14), "lstStyles", 179, 26, INTEGERS[5], new Short((short) 52), 145 - }); - - insertLabel("lblBackground", PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblBackground, "lblBackground", 97, 46, INTEGERS[5], new Short((short) 51), 70 - }); - txtBackground = insertLabel("txtBackground", - new String[] - { - PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Short((short) 1), INTEGER_12, resources.resBackgroundNone, "txtBackground", 179, 44, INTEGERS[5], new Short((short) 52), 90 - }); - btnBackgrounds = insertButton("btnBackgrounds", BTNBACKGROUNDS_ACTION_PERFORMED, PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_BACKGND), resources.resBtnChooseBackground, "btnBackgrounds", 274, 43, INTEGERS[5], new Short((short) 53), INTEGER_50 - }); - - insertLabel("lblIconset", PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblIconset, "lblIconset", 97, 64, INTEGERS[5], new Short((short) 51), 70 - }); - txtIconset = insertLabel("txtIconset", - new String[] - { - PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Short((short) 1), INTEGER_12, resources.resIconsetNone, "txtIconset", 179, 62, INTEGERS[5], new Short((short) 52), 90 - }); - btnIconSets = insertButton("btnIconSets", BTNICONSETS_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_ICONS), resources.resBtnChooseIconset, "btnIconSets", 274, 61, INTEGERS[5], new Short((short) 54), INTEGER_50 - }); - insertLabel("lblIconsetInfo", - new String[] - { - PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - INTEGER_16, resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo", 179, 78, INTEGERS[5], new Short((short) 51), 145 - }); - - - imgPreview = insertImage("imgPreview", - new String[] - { - "BackgroundColor", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - 0, Boolean.FALSE, 78, PropertyNames.EMPTY_STRING, "imgPreview", 91, 100, Boolean.FALSE, INTEGERS[5], new Short((short) 55), 232 - }); - - } - - public void buildStep6() - { - short tabIndex = 60; - lblTitleGeneralPage = insertLabel("lblTitleGeneralPage", - PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGERS[8], resources.reslblTitleGeneralPage_value, Boolean.TRUE, "lblTitleGeneralPage", 90, INTEGERS[9], INTEGERS[6], new Short(tabIndex++), 232 - }); - lblSiteTitle = insertLabel("lblSiteTitle", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblSiteTitle_value, "lblSiteTitle", 97, 28, INTEGERS[6], new Short(tabIndex++), 80 - }); - txtSiteTitle = insertTextField("txtSiteTitle", null, - PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_TITLE), "txtSiteTitle", 179, 26, INTEGERS[6], new Short(tabIndex++), 145 - }); - - - insertFixedLine("FixedLineMetaData", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[9], resources.reslblMetaData, "FixedLineMetaData", 97, 56, INTEGERS[6], new Short(tabIndex++), 228 - }); - - - lblSiteDesc = insertLabel("lblSiteDesc", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblSiteDesc_value, "lblSiteDesc", 103, 72, INTEGERS[6], new Short(tabIndex++), 80 - }); - txtSiteDesc = insertTextField("txtSiteDesc", null, - PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_DESC), "txtSiteDesc", 179, 70, INTEGERS[6], new Short(tabIndex++), 145 - }); - - lblEmail = insertLabel("lblEmail", PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblEmail_value, "lblEmail", 103, 90, INTEGERS[6], new Short(tabIndex++), 80 - }); - txtEmail = insertTextField("txtEmail", null, PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_EMAIL), "txtEmail", 179, 87, INTEGERS[6], new Short(tabIndex++), 145 - }); - - lblCopyright = insertLabel("lblCopyright", PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblCopyright_value, "lblCopyright", 103, 108, INTEGERS[6], new Short(tabIndex++), 80 - }); - txtCopyright = insertTextField("txtCopyright", null, PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_COPYRIGHT), "txtCopyright", 179, 106, INTEGERS[6], new Short(tabIndex++), 145 - }); - - - lblSiteCreated = insertLabel("lblSiteCreated", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblSiteCreated_value, "lblSiteCreated", 103, 126, INTEGERS[6], new Short(tabIndex++), 80 - }); - dateSiteCreated = insertDateField("dateSiteCreated", null, - new String[] - { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_CREATED), "dateSiteCreated", 179, 124, INTEGERS[6], new Short(tabIndex++), 49 - }); - lblSiteUpdated = insertLabel("lblSiteUpdated", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblSiteUpdated_value, "lblSiteUpdated", 103, 144, INTEGERS[6], new Short(tabIndex++), 80 - }); - - dateSiteUpdate = insertDateField("dateSiteUpdate", null, - new String[] - { - "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_UPDATED), "dateSiteUpdate", 179, 142, INTEGERS[6], new Short(tabIndex++), 49 - }); - - - - } - - public void buildStep7(boolean disableFTP, String exclamationURL) - { - short tabIndex = 700; - - lblTitlePublish = insertLabel("lblTitlePublish", - PROPNAMES_TITLE, - new Object[] - { - fontDescriptor4, INTEGER_16, resources.reslblTitlePublish_value, Boolean.TRUE, "lblTitlePublish", 91, INTEGERS[8], INTEGERS[7], new Short(tabIndex++), 232 - }); - - FixedLine1 = insertFixedLine("FixedLine1", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[9], resources.resFixedLine1_value, "FixedLine1", 97, 28, INTEGERS[7], new Short(tabIndex++), 228 - }); - - btnPreview = insertButton("btnPreview", BTNPREVIEW_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_PREVIEW), resources.resbtnPreview_value, "btnPreview", 103, 40, INTEGERS[7], new Short(tabIndex++), INTEGER_50 - }); - - lblCreateSite = insertFixedLine("lblCreateSite", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[9], resources.reslblCreateSite_value, "lblCreateSite", 97, 56, INTEGERS[7], new Short(tabIndex++), 228 - }); - - chkLocalDir = insertCheckBox("chkLocalDir", CHKLOCALDIR_ITEM_CHANGED, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_LOCAL), resources.reschkLocalDir_value, "chkLocalDir", 103, 68, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215 - }); - txtLocalDir = insertTextField("txtLocalDir", null, - PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_LOCAL), "txtLocalDir", 113, 78, INTEGERS[7], new Short(tabIndex++), 190 - }); - btnLocalDir = insertButton("btnLocalDir", BTNLOCALDIR_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_LOCAL), resources.resbtnLocalDir_value, "btnLocalDir", 308, 77, INTEGERS[7], new Short(tabIndex++), INTEGER_16 - }); - - chkZip = insertCheckBox("chkZip", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_ZIP), resources.reschkZip_value, "chkZip", 103, 96, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215 - }); - txtZip = insertTextField("txtZip", null, - PROPNAMES_TXT, - new Object[] - { - INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_ZIP), "txtZip", 113, 108, INTEGERS[7], new Short(tabIndex++), 190 - }); - btnZip = insertButton("btnZip", BTNZIP_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_ZIP), resources.resbtnZip_value, "btnZip", 308, 107, INTEGERS[7], new Short(tabIndex++), INTEGER_16 - }); - - chkFTP = insertCheckBox("chkFTP", null, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_FTP), resources.reschkFTP_value, "chkFTP", 103, 124, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215 - }); - - Integer FTP_STEP = disableFTP ? 99 : INTEGERS[7]; - - lblFTP = insertLabel("lblFTP", - new String[] - { - PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Short((short) 1), INTEGER_12, "txtFTP", 113, 134, FTP_STEP, new Short(tabIndex++), 156 - }); - - btnFTP = insertButton("btnFTP", BTNFTP_ACTION_PERFORMED, - PROPNAMES_BUTTON, - new Object[] - { - INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_FTP), resources.resbtnFTP_value, "btnFTP", 274, 133, FTP_STEP, new Short(tabIndex++), INTEGER_50 - }); - - if (disableFTP) - { - - insertImage("imgFTPDisabled", - new String[] - { - "BackgroundColor", PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Integer(-1), new Short((short) 0), Boolean.FALSE, 10, exclamationURL, "imgFTPDisabled", 115, 135, Boolean.FALSE, INTEGERS[7], new Short(tabIndex++), 8 - }); - insertLabel("lblFTPDisabled", - new String[] - { - "BackgroundColor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - new Integer(-1), INTEGER_8, resources.reslblFTPDisabled, Boolean.TRUE, "lblFTPDisabled", 125, 136, INTEGERS[7], new Short(tabIndex++), 226 - }); - } - //else - - lnSaveSetting = insertFixedLine("lnSaveSetting", - PROPNAMES_TXT, - new Object[] - { - INTEGERS[2], PropertyNames.EMPTY_STRING, "lnSaveSetting", 97, 151, INTEGERS[7], new Short(tabIndex++), 228 - }); - chkSaveSettings = insertCheckBox("chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED, - PROPNAMES_CHKBOX, - new Object[] - { - INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_SAVE), resources.reschkSaveSettings_value, "chkSaveSettings", 97, 157, new Short((short) 1), INTEGERS[7], new Short(tabIndex++), 215 - }); - lblSaveSettings = insertLabel("lblSaveSettings", - PROPNAMES_LBL, - new Object[] - { - INTEGERS[8], resources.reslblSaveSettings_value, "lblSaveSettings", 107, 169, INTEGERS[7], new Short(tabIndex++), 45 - }); - cbSaveSettings = insertComboBox("txtSaveSettings", TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, - new String[] - { - "Autocomplete", "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH - }, - new Object[] - { - Boolean.TRUE, Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_SAVE), new Short((short) 14), "txtSaveSettings", 179, 167, INTEGERS[7], new Short(tabIndex++), 145 - }); - - } - XControl[] imgIconsPrev = new XControl[8]; - ImageList ilLayouts; - - /** - * builds the layouts image list. - */ - public void buildStepX() - { - ilLayouts = new ImageList(); - ilLayouts.setPos(new Size(97, 38)); - ilLayouts.setImageSize(new Size(34, 30)); - ilLayouts.setCols(5); - ilLayouts.setRows(3); - ilLayouts.setStep(new Short((short) 3)); - ilLayouts.setShowButtons(false); - ilLayouts.setRenderer(new LayoutRenderer()); - ilLayouts.scaleImages = Boolean.FALSE; - ilLayouts.tabIndex = 31; - ilLayouts.helpURL = HID3_IL_LAYOUTS_IMG1; - - } - - /** - * renders the images and titles of - * the layouts - */ - private class LayoutRenderer implements ImageList.IImageRenderer - { - - public Object[] getImageUrls(Object listItem) - { - Object[] oResIds = null; - if (listItem != null) - { - oResIds = ((CGLayout) listItem).getImageUrls(); - } - return oResIds; - } - - public String render(Object listItem) - { - return listItem == null ? PropertyNames.EMPTY_STRING : ((CGLayout) listItem).cp_Name; - } - } -} diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java deleted file mode 100644 index a9df07e0bdad..000000000000 --- a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java +++ /dev/null @@ -1,339 +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 com.sun.star.wizards.web; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Configuration; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.common.Resource; -import com.sun.star.wizards.document.OfficeDocument; - -public class WebWizardDialogResources -{ - - String resSessionName; - String resSizeTemplate; - String resSpecifyNewFileLocation; - String resCreatedTemplate; - String resUpdatedTemplate; - String resSlides; - String resDelSessionConfirm; - String resErrIsDirectory; - String resErrDocValidate; - String resStep1; - String resStep2; - String resStep3; - String resStep4; - String resStep5; - String resStep6; - String resStep7; - String resDefaultArchiveFilename; - String resValidatingDocuments; - String resErrUnexpected; - String resLoadingSession; - String resErrExportIO; - String resErrPublishMedia; - String resErrPublish; - String resErrUnknown; - //String resErrDocClose; - String resErrSecurity; - String resErrMkDir; - //String resErrDocOpen; - String resErrDocExport; - String resErrDocInfo; - String resErrTOCMedia; - String resErrTOC; - final static String UNIT_NAME = "dbwizres"; - final static String MODULE_NAME = "dbw"; - final static int RID_WEBWIZARDDIALOG_START = 4000; - final static int RID_COMMON_START = 500; - final static int RID_DB_COMMON_START = 1000; - String resWebWizardDialog_title; - String reslblIntroduction_value; - String resbtnDelSession_value; - String reslbIntroTitle_value; - String reslblContentTitle_value; - String reslnDocsInfo_value; - String reslblDocTitle_value; - String reslblDocInfo_value; - String reslblDocAuthor_value; - String reslblDocExportFormat_value; - String reslblTitleGeneralPage_value; - String reslblSiteTitle_value; - String reslblSiteDesc_value; - String reslblSiteCreated_value; - String reslblEmail_value; - String reslblCopyright_value; - String reslblSiteUpdated_value; - String resbtnPreview_value; - String reslblTitlePublish_value; - String reslblCreateSite_value; - String reschkLocalDir_value; - String resbtnLocalDir_value; - String reschkFTP_value; - String resbtnFTP_value; - String reschkZip_value; - String resbtnZip_value; - String reschkSaveSettings_value; - String reslblSaveSettings_value; - String reslblLoadSettings_value; - String reslblSiteContent_value; - String resbtnAddDoc_value; - String resbtnRemoveDoc_value; - String reslblLayoutTitle_value; - String reslblStyleTitle_value; - String reslblStyle_value; - String reslblLayouts_value; - String reschbDocDesc_value; - String reschbDocAuthor_value; - String reschkDocCreated_value; - String reschkDocChanged_value; - String reschkDocFilename_value; - String reschkDocFormat_value; - String reschkDocFormatIcon_value; - String reschkDocPages_value; - String reschkDocSize_value; - String resFixedLine1_value; - String reslblLayout2Title_value; - String reslblDisplay_value; - String reslblOptimizeFor_value; - String resoptOptimize640x480_value; - String resoptOptimize800x600_value; - String resoptOptimize1024x768_value; - final String resbtnDocUp_value = String.valueOf((char) 8743); - final String resbtnDocDown_value = String.valueOf((char) 8744); - String reslblBackground; - String reslblIconset; - String reslblIconSetInfo; - String reslblMetaData; - String resBtnChooseBackground; - String resBtnChooseIconset; //String resGenerate; - //String resPublish; - //String resExport; - String resCancel; - String resClose; - String resCounter; - String resStatusDialogTitle; - String resPublishDir; - String resFTPTargetExistsAsfile; - String resLocalTargetExistsAsfile; - String resZipTargetExists; - String resFTPTargetNotEmpty; - String resLocalTragetNotEmpty; - String resSessionExists; - String resTaskExport; - String resTaskExportDocs; - String resTaskExportPrepare; - String resTaskGenerateCopy; - String resTaskGeneratePrepare; - String resTaskGenerateXsl; - String resTaskPrepare; - String resTaskPublishPrepare; - String resTaskPublishLocal; - String resTaskPublishFTP; - String resTaskPublishZip; - String resTaskFinish; - String resPages; - String resImages; - String resAllFiles; - String resZipFiles; - String resGifFiles; - String resOK; - String resHelp; - String resBackgroundsDialog; - String resBackgroundsDialogCaption; - String resIconsDialog; - String resIconsDialogCaption; - String resOther; - String resDeselect; - String resFinishedSuccess; - String resFinishedNoSuccess; - String resSessionNameNone; - String reslblFTPDisabled; - String resBackgroundNone; - String resIconsetNone; - String prodName; - String resFTPTargetCouldNotCreate; - String resFTPTargetCreate; - String resZipTargetIsDir; - String resLocalTargetCouldNotCreate; - String resLocalTargetCreate; - Resource oResource; - - public WebWizardDialogResources(XMultiServiceFactory xmsf, Resource _oResource) - { - oResource = _oResource; - /** - * Delete the String, uncomment the getResText method - * - */ - resWebWizardDialog_title = oResource.getResText(RID_WEBWIZARDDIALOG_START + 1); - reslblIntroduction_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 2); - resbtnDelSession_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 4); - reslbIntroTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 5); - reslblContentTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 6); - reslnDocsInfo_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 8); - reslblDocTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 9); - reslblDocInfo_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 10); - reslblDocAuthor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 11); - reslblDocExportFormat_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 12); - reslblTitleGeneralPage_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 13); - reslblSiteTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 14); - reslblSiteDesc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 16); - reslblSiteCreated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 18); - reslblEmail_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 20); - reslblCopyright_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 21); - reslblSiteUpdated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 22); - resbtnPreview_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 24); - reslblTitlePublish_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 25); - reslblCreateSite_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 26); - reschkLocalDir_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 27); - resbtnLocalDir_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 28); - reschkFTP_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 29); - // - resbtnFTP_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 31); - reschkZip_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 32); - resbtnZip_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 33); - reschkSaveSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 34); - reslblSaveSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 35); - reslblLoadSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 36); - reslblSiteContent_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 37); - resbtnAddDoc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 38); - resbtnRemoveDoc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 39); - reslblLayoutTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 40); - reslblStyleTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 41); - reslblStyle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 42); - // - reslblLayouts_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 48); - // - reschbDocDesc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 50); - reschbDocAuthor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 51); - reschkDocCreated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 52); - reschkDocChanged_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 53); - reschkDocFilename_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 54); - reschkDocFormat_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 55); - reschkDocFormatIcon_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 56); - reschkDocPages_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 57); - reschkDocSize_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 58); - resFixedLine1_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 59); - reslblLayout2Title_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 60); - reslblDisplay_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 61); - reslblOptimizeFor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 62); - resoptOptimize640x480_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 64); - resoptOptimize800x600_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 65); - resoptOptimize1024x768_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 66); - //resExport = oResource.getResText(RID_WEBWIZARDDIALOG_START + 67); - //resGenerate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 68); - //resPublish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 69); - resStatusDialogTitle = oResource.getResText(RID_WEBWIZARDDIALOG_START + 70); - resCounter = oResource.getResText(RID_WEBWIZARDDIALOG_START + 71); - resPublishDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 72); - resFTPTargetExistsAsfile = oResource.getResText(RID_WEBWIZARDDIALOG_START + 73); - resLocalTargetExistsAsfile = oResource.getResText(RID_WEBWIZARDDIALOG_START + 74); - resZipTargetExists = oResource.getResText(RID_WEBWIZARDDIALOG_START + 75); - resFTPTargetNotEmpty = oResource.getResText(RID_WEBWIZARDDIALOG_START + 76); - resLocalTragetNotEmpty = oResource.getResText(RID_WEBWIZARDDIALOG_START + 77); - resSessionExists = oResource.getResText(RID_WEBWIZARDDIALOG_START + 78); - resTaskExportDocs = oResource.getResText(RID_WEBWIZARDDIALOG_START + 79); - resTaskExportPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 80); - resTaskGenerateCopy = oResource.getResText(RID_WEBWIZARDDIALOG_START + 81); - resTaskGeneratePrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 82); - resTaskGenerateXsl = oResource.getResText(RID_WEBWIZARDDIALOG_START + 83); - resTaskPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 84); - resTaskPublishPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 86); - resTaskPublishLocal = oResource.getResText(RID_WEBWIZARDDIALOG_START + 87); - resTaskPublishFTP = oResource.getResText(RID_WEBWIZARDDIALOG_START + 88); - resTaskPublishZip = oResource.getResText(RID_WEBWIZARDDIALOG_START + 89); - resTaskFinish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 90); - //resPages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 91); - resImages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 94); - resAllFiles = oResource.getResText(RID_WEBWIZARDDIALOG_START + 95); - resZipFiles = oResource.getResText(RID_WEBWIZARDDIALOG_START + 96); - resBackgroundsDialog = oResource.getResText(RID_WEBWIZARDDIALOG_START + 98); - resBackgroundsDialogCaption = oResource.getResText(RID_WEBWIZARDDIALOG_START + 99); - resIconsDialog = oResource.getResText(RID_WEBWIZARDDIALOG_START + 100); - resIconsDialogCaption = oResource.getResText(RID_WEBWIZARDDIALOG_START + 101); - resOther = oResource.getResText(RID_WEBWIZARDDIALOG_START + 102); - resDeselect = oResource.getResText(RID_WEBWIZARDDIALOG_START + 103); - resFinishedSuccess = oResource.getResText(RID_WEBWIZARDDIALOG_START + 104); - resFinishedNoSuccess = oResource.getResText(RID_WEBWIZARDDIALOG_START + 105); - resErrTOC = oResource.getResText(RID_WEBWIZARDDIALOG_START + 106); - resErrTOCMedia = oResource.getResText(RID_WEBWIZARDDIALOG_START + 107); - resErrDocInfo = oResource.getResText(RID_WEBWIZARDDIALOG_START + 108); - resErrDocExport = oResource.getResText(RID_WEBWIZARDDIALOG_START + 109); - resErrMkDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 110); - resErrSecurity = oResource.getResText(RID_WEBWIZARDDIALOG_START + 111); - resErrExportIO = oResource.getResText(RID_WEBWIZARDDIALOG_START + 112); - resErrPublishMedia = oResource.getResText(RID_WEBWIZARDDIALOG_START + 113); - resErrPublish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 114); - resErrUnknown = oResource.getResText(RID_WEBWIZARDDIALOG_START + 115); - resErrDocValidate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 116); - resErrIsDirectory = oResource.getResText(RID_WEBWIZARDDIALOG_START + 117); - resLoadingSession = oResource.getResText(RID_WEBWIZARDDIALOG_START + 118); - resErrUnexpected = oResource.getResText(RID_WEBWIZARDDIALOG_START + 119); - resValidatingDocuments = oResource.getResText(RID_WEBWIZARDDIALOG_START + 120); - resDefaultArchiveFilename = oResource.getResText(RID_WEBWIZARDDIALOG_START + 121); - resStep1 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 122); - resStep2 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 123); - resStep3 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 124); - resStep4 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 125); - resStep5 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 126); - resStep6 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 127); - resStep7 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 128); - resDelSessionConfirm = oResource.getResText(RID_WEBWIZARDDIALOG_START + 130); - resPages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 131); - resSlides = oResource.getResText(RID_WEBWIZARDDIALOG_START + 132); - resCreatedTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 133); - resUpdatedTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 134); - resSessionName = oResource.getResText(RID_WEBWIZARDDIALOG_START + 135); - - reslblBackground = oResource.getResText(RID_WEBWIZARDDIALOG_START + 136); - reslblIconset = oResource.getResText(RID_WEBWIZARDDIALOG_START + 137); - reslblIconSetInfo = oResource.getResText(RID_WEBWIZARDDIALOG_START + 138); - reslblMetaData = oResource.getResText(RID_WEBWIZARDDIALOG_START + 139); - resBtnChooseBackground = oResource.getResText(RID_WEBWIZARDDIALOG_START + 140); - resBtnChooseIconset = oResource.getResText(RID_WEBWIZARDDIALOG_START + 141); - resSessionNameNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 142); - reslblFTPDisabled = oResource.getResText(RID_WEBWIZARDDIALOG_START + 143); - resBackgroundNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 144); - resIconsetNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 145); - resFTPTargetCouldNotCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 146); - resFTPTargetCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 147); - resZipTargetIsDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 148); - resLocalTargetCouldNotCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 149); - resLocalTargetCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 150); - resSizeTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 151); - resSpecifyNewFileLocation = oResource.getResText(RID_WEBWIZARDDIALOG_START + 152); - - resClose = oResource.getResText(RID_COMMON_START + 17); - resCancel = oResource.getResText(RID_COMMON_START + 11); - resOK = oResource.getResText(RID_COMMON_START + 18); - resHelp = oResource.getResText(RID_COMMON_START + 15); - - try - { - prodName = Configuration.getProductName(xmsf); - resGifFiles = (String) Properties.getPropertyValue(OfficeDocument.getTypeMediaDescriptor(xmsf, "gif_Graphics_Interchange"), "UIName"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGArgument.java b/wizards/com/sun/star/wizards/web/data/CGArgument.java deleted file mode 100644 index e958648e99c7..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGArgument.java +++ /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 . - */ -package com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.ConfigGroup; - -public class CGArgument extends ConfigGroup -{ - - public String cp_Value; -} diff --git a/wizards/com/sun/star/wizards/web/data/CGContent.java b/wizards/com/sun/star/wizards/web/data/CGContent.java deleted file mode 100644 index 40512c45c0da..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGContent.java +++ /dev/null @@ -1,59 +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 com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.*; - -import org.w3c.dom.*; - -public class CGContent extends ConfigSetItem implements XMLProvider -{ - - public String dirName; - public String cp_Name; - public String cp_Description; - public ConfigSet cp_Contents = new ConfigSet(CGContent.class); - public ConfigSet cp_Documents = new ConfigSet(CGDocument.class); - - public CGContent() - { - /*cp_Documents = new ConfigSet(CGDocument.class) { - protected DefaultListModel createChildrenList() { - return cp_Contents.getChildrenList(); - } - };*/ - } - - public Node createDOM(Node parent) - { - - Node myElement = XMLHelper.addElement(parent, "content", - new String[] - { - "name", "directory-name", "description", "directory" - }, - new String[] - { - cp_Name, dirName, cp_Description, dirName - }); - - cp_Documents.createDOM(myElement); - - return myElement; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.java b/wizards/com/sun/star/wizards/web/data/CGDesign.java deleted file mode 100644 index 88c6f159fd94..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGDesign.java +++ /dev/null @@ -1,82 +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 com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.*; -import org.w3c.dom.Node; - -public class CGDesign extends ConfigGroup implements XMLProvider -{ - - public String cp_Layout; - public String cp_Style; - public String cp_BackgroundImage; - public String cp_IconSet; - //public int cp_OptimizeDisplay; - public boolean cp_DisplayTitle; - public boolean cp_DisplayDescription; - public boolean cp_DisplayAuthor; - public boolean cp_DisplayCreateDate; - public boolean cp_DisplayUpdateDate; - public boolean cp_DisplayFilename; - public boolean cp_DisplayFileFormat; - public boolean cp_DisplayFormatIcon; - public boolean cp_DisplayPages; - public boolean cp_DisplaySize; - public int cp_OptimizeDisplaySize; - private final String TRUE = "true"; - private final String FALSE = null; - private String styleName; - - public Node createDOM(Node parent) - { - return XMLHelper.addElement(parent, "design", new String[0], - new String[0]); - - } - private static final Short SHORT_TRUE = new Short((short) 1); - private static final Short SHORT_FALSE = new Short((short) 0); - - public short[] getStyle() - { - CGStyle style = ((CGStyle) ((CGSettings) root).cp_Styles.getElement(cp_Style)); - return new short[] - { - (short) ((CGSettings) root).cp_Styles.getIndexOf(style) - }; - } - - public void setStyle(short[] newStyle) - { - Object o = ((CGSettings) root).cp_Styles.getElementAt(newStyle[0]); - cp_Style = (String) ((CGSettings) root).cp_Styles.getKey(o); - } - - public int getLayout() - { - CGLayout layout = ((CGLayout) ((CGSettings) root).cp_Layouts.getElement(cp_Layout)); - return layout.cp_Index; - } - - public void setLayout(int layoutIndex) - { - CGLayout layout = (CGLayout) ((CGSettings) root).cp_Layouts.getElementAt(layoutIndex); - cp_Layout = (String) ((CGSettings) root).cp_Layouts.getKey(layout); - } -} - diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java deleted file mode 100644 index 82dc63c775a6..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGDocument.java +++ /dev/null @@ -1,435 +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 com.sun.star.wizards.web.data; - -import java.io.File; -import java.io.FileNotFoundException; - -import org.w3c.dom.Node; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.document.MacroExecMode; -import com.sun.star.document.UpdateDocMode; -import com.sun.star.document.XDocumentProperties; -import com.sun.star.document.XDocumentPropertiesSupplier; -import com.sun.star.frame.XComponentLoader; -import com.sun.star.frame.XDesktop; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.DateTime; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.common.XMLHelper; -import com.sun.star.wizards.common.XMLProvider; -import com.sun.star.wizards.document.OfficeDocument; -import com.sun.star.wizards.ui.event.Task; - -/** - * About the member fields Title, Decription and Author: - * There is an ambiguicy in handling these fields. - * On the one hand, the user can set those fields to a custom value, - * relevant only for the web-wizard. - * On the other-hand, the web-wizard can read those fields automatically - * from SO documents. - * In order to avoid conflict by saving, I use two fields: "cp_title", which - * should be read from the configuratin (saved session), and "title" which is - * the value read from the document. - * The *cp_title* "overrides" *title*, if exists. if not, *title* is used. - * The same is valid for *description* and *author*. - */ -public class CGDocument extends ConfigSetItem implements XMLProvider -{ - - public static final int PAGE_TYPE_UNKNOWN = 0; - public static final int PAGE_TYPE_PAGE = 1; - public static final int PAGE_TYPE_SLIDE = 2; - public String cp_Title = PropertyNames.EMPTY_STRING; - public String cp_Description = PropertyNames.EMPTY_STRING; - public String cp_URL; - public String cp_Author = PropertyNames.EMPTY_STRING; - public String cp_Exporter; - /** - * the destination filename to which this - * document will be exported to. - */ - public String localFilename = PropertyNames.EMPTY_STRING; - public String urlFilename = PropertyNames.EMPTY_STRING; - public String title = PropertyNames.EMPTY_STRING; - public String description = PropertyNames.EMPTY_STRING; - public String author = PropertyNames.EMPTY_STRING; - public DateTime createDate; - public DateTime updateDate; - public int sizeBytes = -1; - public int pages = -1; - /** - * The contents subdirectory name in which the document is in. - * This subdirectory will be created in the content's "docs" - * subdirectory. - */ - public String dirName; - /** - * contains an identifier of the type of this document. - */ - public String appType; - public PropertyValue[] mediaDescriptor; - /** - * Is this document an original SO Document (different versions). - */ - public boolean isSODocument; - /** - * can this document be opend through SO? - */ - public boolean isSOOpenable; - /** - * This flag is set to true after the validate method is called. - */ - public boolean valid = false; - public String targetTypeName; - - public CGDocument() - { - } - - public CGDocument(String url, XMultiServiceFactory xmsf, Task task) throws Exception - { - cp_URL = getSettings().getFileAccess(xmsf).getURL(url); - if (task == null) - { - task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 5); - } - validate(xmsf, task); - } - - /** - * the task will advance 5 times during validate. - * @param xmsf - * @param task - * @throws Exception - */ - public void validate(XMultiServiceFactory xmsf, Task task) - throws FileNotFoundException, - IllegalArgumentException, - Exception - { - - if (!getSettings().getFileAccess(xmsf).exists(cp_URL, false)) - { - throw new FileNotFoundException("The given URL does not point to a file"); - } - if (getSettings().getFileAccess(xmsf).isDirectory(cp_URL)) - { - throw new IllegalArgumentException("The given URL points to a directory"); //create a TypeDetection service - } - mediaDescriptor = OfficeDocument.getFileMediaDecriptor(xmsf, cp_URL); - - task.advance(true); //1 - - analyzeFileType(mediaDescriptor); - - task.advance(true); //2 - - String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, PropertyNames.EMPTY_STRING); - localFilename = FileAccess.getFilename(path, File.separator); - - /* if the type is a star office convertible document - * We try to open the document to get some properties - */ - - XDocumentProperties xProps = null; - - task.advance(true); //3 - - if (isSOOpenable) - { // for documents which are openable through SO, use DocumentProperties service. - XDesktop desktop = Desktop.getDesktop(xmsf); - PropertyValue[] props = new PropertyValue[3]; - props[0] = Properties.createProperty("Hidden", Boolean.TRUE); - props[1] = Properties.createProperty("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE)); - props[2] = Properties.createProperty("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE)); - XComponent component = UnoRuntime.queryInterface(XComponentLoader.class, desktop).loadComponentFromURL(cp_URL, "_default", 0, props); - xProps = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, component).getDocumentProperties(); - } - - task.advance(true); //4 - - //now use the object to read some document properties. - if (xProps != null) - { - title = xProps.getTitle(); - description = xProps.getDescription(); - author = xProps.getAuthor(); - createDate = xProps.getCreationDate(); - updateDate = xProps.getModificationDate(); - } - else - { //get some information from OS. - title = localFilename; - updateDate = getSettings().getFileAccess(xmsf).getLastModified(cp_URL); - } - - task.advance(true); //5 - - valid = true; - - if (cp_Title.equals(PropertyNames.EMPTY_STRING)) - { - cp_Title = title; - } - if (cp_Title.equals(PropertyNames.EMPTY_STRING)) - { - cp_Title = localFilename; - } - if (cp_Description.equals(PropertyNames.EMPTY_STRING)) - { - cp_Description = description; - } - if (cp_Author.equals(PropertyNames.EMPTY_STRING)) - { - cp_Author = author; - } - if (cp_Exporter == null || cp_Exporter.equals(PropertyNames.EMPTY_STRING)) - { - cp_Exporter = (String) getSettings().cp_Exporters.getKey( - getSettings().getExporters(appType)[0]); - } - } - - /** - * Analyzes a type-detection string, returned from the TypeDetection service, - * and sets the appType, isSOOpenable and isSODocument members. - */ - private void analyzeFileType(PropertyValue[] mediaDesc) - { - - if (mediaDesc == null) - { - } - - String media = (mediaDesc == null) - ? PropertyNames.EMPTY_STRING : (String) Properties.getPropertyValue(mediaDescriptor, PropertyNames.PROPERTY_NAME); - appType = getDocType(media); - - isSOOpenable = - (appType.equals(TypeDetection.WRITER_DOC) || appType.equals(TypeDetection.CALC_DOC) || appType.equals(TypeDetection.IMPRESS_DOC) || appType.equals(TypeDetection.DRAW_DOC)) || appType.equals(TypeDetection.HTML_DOC); - - String[] parts = JavaTools.ArrayoutofString(media, "_"); - - - isSODocument = parts.length >= 2 && isSOOpenable && (parts[1].startsWith("Star")); - - } - - /** - * @param media is the media description string returned by an UNO TypeDetection object. - * @return one of the constants in the interface TypeDetection. - * - */ - private String getDocType(String media) - { - if (media.equals(PropertyNames.EMPTY_STRING)) - { - return TypeDetection.NO_TYPE; - } - if (media.startsWith("generic_HTML")) - { - return TypeDetection.HTML_DOC; - } - if (media.startsWith("writer")) - { - return TypeDetection.WRITER_DOC; - } - else if (media.startsWith("calc")) - { - return TypeDetection.CALC_DOC; - } - else if (media.startsWith("draw")) - { - return TypeDetection.DRAW_DOC; - } - else if (media.startsWith("impress")) - { - return TypeDetection.IMPRESS_DOC; - } - else if (media.startsWith("pdf")) - { - return TypeDetection.PDF_DOC; - } - else if (media.startsWith("gif") || media.startsWith("jpg")) - { - return TypeDetection.WEB_GRAPHICS; - } - else if (media.startsWith("wav")) - { - return TypeDetection.SOUND_FILE; - } - else - { - return TypeDetection.NO_TYPE; - } - } - - public Node createDOM(Node parent) - { - CGDesign d = getSettings().cp_DefaultSession.cp_Design; - CGExporter exp = (CGExporter) getSettings().cp_Exporters.getElement(cp_Exporter); - - return XMLHelper.addElement(parent, "document", - new String[] - { - "title", "description", "author", "format", "filename", "create-date", "update-date", "pages", "size", "icon", "dir", "fn" - }, - new String[] - { - d.cp_DisplayTitle ? cp_Title : PropertyNames.EMPTY_STRING, - d.cp_DisplayDescription ? cp_Description : PropertyNames.EMPTY_STRING, - d.cp_DisplayAuthor ? cp_Author : PropertyNames.EMPTY_STRING, - d.cp_DisplayFileFormat ? getTargetTypeName(exp) : PropertyNames.EMPTY_STRING, - d.cp_DisplayFilename ? localFilename : PropertyNames.EMPTY_STRING, - d.cp_DisplayCreateDate ? createDate() : PropertyNames.EMPTY_STRING, - d.cp_DisplayUpdateDate ? updateDate() : PropertyNames.EMPTY_STRING, - d.cp_DisplayPages && (pages > -1) ? PropertyNames.EMPTY_STRING + pages() : PropertyNames.EMPTY_STRING, //TODO when do i calculate pages? - d.cp_DisplaySize ? sizeKB() : PropertyNames.EMPTY_STRING,//TODO when do i calculate size? - d.cp_DisplayFormatIcon ? getIcon(exp) : PropertyNames.EMPTY_STRING, - dirName, urlFilename - }); - } - - private String updateDate() - { - if (this.updateDate == null) - { - return PropertyNames.EMPTY_STRING; - } - return getSettings().formatter.formatCreated(this.updateDate); - } - - private String createDate() - { - if (this.createDate == null) - { - return PropertyNames.EMPTY_STRING; - } - return getSettings().formatter.formatCreated(this.createDate); - } - - private String sizeKB() - { - if (sizeBytes == -1) - { - return PropertyNames.EMPTY_STRING; - } - else - { - return getSettings().formatter.formatFileSize(sizeBytes); - } - } - - private String pages() - { - return pages == -1 ? PropertyNames.EMPTY_STRING - : JavaTools.replaceSubString(pagesTemplate(), PropertyNames.EMPTY_STRING + pages, "%NUMBER"); - } - - private String pagesTemplate() - { - int pagesType = ((CGExporter) getSettings().cp_Exporters.getElement(cp_Exporter)).cp_PageType; - switch (pagesType) - { - case PAGE_TYPE_UNKNOWN: - return PropertyNames.EMPTY_STRING; - case PAGE_TYPE_PAGE: - return getSettings().resources[CGSettings.RESOURCE_PAGES_TEMPLATE]; - case PAGE_TYPE_SLIDE: - return getSettings().resources[CGSettings.RESOURCE_SLIDES_TEMPLATE]; - default: - return PropertyNames.EMPTY_STRING; - } - } - - private String getTargetTypeName(CGExporter exp) - { - return (exp.targetTypeName.equals(PropertyNames.EMPTY_STRING)) - ? (String) Properties.getPropertyValue(mediaDescriptor, "UIName") - : exp.targetTypeName; - } - - private String getIcon(CGExporter exporter) - { - return exporter.cp_Icon.equals(PropertyNames.EMPTY_STRING) ? getIcon(this.appType) : exporter.cp_Icon; - } - - private String getIcon(String appType) - { - return appType + ".gif"; - } - - /** - * This method is used by the DataAware model - * and returns the index of the exporter of - * this document, <b>in the list of the - * exporters available for this type of document</b> - * @return - */ - public short[] getExporter() - { - return new short[] - { - getExporterIndex() - }; - } - - /** - * @see #getExporter() - */ - public void setExporter(short[] exporter_) - { - Object exp = getSettings().getExporters(appType)[exporter_[0]]; - cp_Exporter = (String) getSettings().cp_Exporters.getKey(exp); - } - - /** - * @see #getExporter() - * @return - */ - private short getExporterIndex() - { - if (cp_Exporter == null) - { - return 0; - } - Object exporter = getSettings().cp_Exporters.getElement(cp_Exporter); - Object[] exporters = getSettings().getExporters(appType); - for (short i = 0; i < exporters.length; i++) - { - if (exporters[i] == exporter) - { - return i; - } - } - return -1; - } - - public String toString() - { - return localFilename; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.java b/wizards/com/sun/star/wizards/web/data/CGExporter.java deleted file mode 100644 index 5e94f28de2bf..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGExporter.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 com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.ConfigSet; -import com.sun.star.wizards.common.PropertyNames; - -public class CGExporter extends ConfigSetItem -{ - - public String cp_Name; - public String cp_ExporterClass; - public boolean cp_OwnDirectory; - public boolean cp_SupportsFilename; - public String cp_DefaultFilename; - public String cp_Extension; - public String cp_SupportedMimeTypes; - public String cp_Icon; - public String cp_TargetType; - public boolean cp_Binary; - public int cp_PageType; - public String targetTypeName = PropertyNames.EMPTY_STRING; - public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class); - - public String toString() - { - return cp_Name; - } - - public boolean supports(String mime) - { - return (cp_SupportedMimeTypes.equals(PropertyNames.EMPTY_STRING) || cp_SupportedMimeTypes.indexOf(mime) > -1); - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGFilter.java b/wizards/com/sun/star/wizards/web/data/CGFilter.java deleted file mode 100644 index 90fa5b31ad95..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGFilter.java +++ /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 . - */ -package com.sun.star.wizards.web.data; - -public class CGFilter extends ConfigSetItem -{ - - public String cp_Name; - //public boolean cp_Readonly; - public String cp_Filter; -} diff --git a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java deleted file mode 100644 index 0067da5fb12c..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.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 com.sun.star.wizards.web.data; - -import com.sun.star.util.DateTime; -import com.sun.star.wizards.common.*; -import org.w3c.dom.Node; - -public class CGGeneralInfo extends ConfigGroup implements XMLProvider -{ - - public String cp_Title; - public String cp_Description; - public String cp_Author; - public int cp_CreationDate; - public int cp_UpdateDate; - public String cp_Email; - public String cp_Copyright; - - public Node createDOM(Node parent) - { - return XMLHelper.addElement(parent, "general-info", - new String[] - { - "title", "author", "description", "creation-date", "update-date", "email", "copyright" - }, - new String[] - { - cp_Title, cp_Author, cp_Description, String.valueOf(cp_CreationDate), String.valueOf(cp_UpdateDate), cp_Email, cp_Copyright - }); - } - - public Integer getCreationDate() - { - if (cp_CreationDate == 0) - { - cp_CreationDate = currentDate(); - } - return new Integer(cp_CreationDate); - } - - public Integer getUpdateDate() - { - if (cp_UpdateDate == 0) - { - cp_UpdateDate = currentDate(); - } - return new Integer(cp_UpdateDate); - } - - public void setCreationDate(Integer i) - { - //System.out.println(i); - cp_CreationDate = i.intValue(); - } - - public void setUpdateDate(Integer i) - { - cp_UpdateDate = i.intValue(); - } - - private int currentDate() - { - DateTime dt = JavaTools.getDateTime(System.currentTimeMillis()); - //System.out.println(); - return dt.Day + dt.Month * 100 + dt.Year * 10000; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGIconSet.java b/wizards/com/sun/star/wizards/web/data/CGIconSet.java deleted file mode 100644 index 00e12e3787fb..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGIconSet.java +++ /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 . - */ -package com.sun.star.wizards.web.data; - -public class CGIconSet extends ConfigSetItem -{ - - public String cp_FNPrefix; - public String cp_FNPostfix; - public String cp_Name; -} diff --git a/wizards/com/sun/star/wizards/web/data/CGImage.java b/wizards/com/sun/star/wizards/web/data/CGImage.java deleted file mode 100644 index cdea04cd6a48..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGImage.java +++ /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 . - */ - -package com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.ConfigGroup; - -public class CGImage extends ConfigGroup -{ - public String cp_Href; -} diff --git a/wizards/com/sun/star/wizards/web/data/CGLayout.java b/wizards/com/sun/star/wizards/web/data/CGLayout.java deleted file mode 100644 index c4c26c0e4968..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGLayout.java +++ /dev/null @@ -1,78 +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 com.sun.star.wizards.web.data; - -import com.sun.star.wizards.ui.UIConsts; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.transform.*; -import javax.xml.transform.stream.StreamSource; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.FileAccess; - -public class CGLayout extends ConfigSetItem -{ - - public String cp_Name; - public String cp_FSName; - private Map<String, Templates> templates; - - private void createTemplates(XMultiServiceFactory xmsf) throws Exception - { - - templates = new HashMap<String, Templates>(3); - - TransformerFactory tf = TransformerFactory.newInstance(); - - String workPath = getSettings().workPath; - FileAccess fa = new FileAccess(xmsf); - String stylesheetPath = fa.getURL(getSettings().workPath, "layouts/" + cp_FSName); - - String[] files = fa.listFiles(stylesheetPath, false); - - for (int i = 0; i < files.length; i++) - { - if (FileAccess.getExtension(files[i]).equals("xsl")) - { - templates.put(FileAccess.getFilename(files[i]), tf.newTemplates(new StreamSource(files[i]))); - } - } - } - - public Object[] getImageUrls() - { - Object[] sRetUrls = new Object[1]; - int ResId = UIConsts.RID_IMG_WEB + (cp_Index * 2); - return new Integer[] - { - new Integer(ResId), new Integer(ResId + 1) - }; - } - - public Map<String, Templates> getTemplates(XMultiServiceFactory xmsf) throws Exception - { - - // TODO uncomment... - // if (templates==null) - createTemplates(xmsf); - - return templates; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.java b/wizards/com/sun/star/wizards/web/data/CGPublish.java deleted file mode 100644 index 4febdb8d9343..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGPublish.java +++ /dev/null @@ -1,86 +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 com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.ConfigGroup; -import com.sun.star.wizards.common.PropertyNames; - -/** - * - * A Class which describes the publishing arguments - * in a session. - * Each session can contain different publishers, which are configured - * through such a CGPublish object. - */ -public class CGPublish extends ConfigGroup -{ - - public boolean cp_Publish; - public String cp_URL; - public String cp_Username; - public String password; - /** - * cp_URL is the url given by the user - * for this publisher. (in UCB URL form) - * This one will be edited to result the "url" - * field, which is the true url, ucb uses to publish. - * It is used for example to add ftp username and password, or zip url - */ - public String url; - /** - * if the user approved overwriting files in this publisher target - */ - public boolean overwriteApproved; - - /** - * here I get an URL from user input, and parse it to - * a UCB url... - * @param path - */ - public void setURL(String path) - { - try - { - this.cp_URL = ((CGSettings) this.root).getFileAccess().getURL(path); - overwriteApproved = false; - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - public String getURL() - { - try - { - return ((CGSettings) this.root).getFileAccess().getPath(cp_URL, null); - } - catch (Exception e) - { - e.printStackTrace(); - return PropertyNames.EMPTY_STRING; - } - } - - private String ftpURL() - { - return "ftp://" + cp_Username + - ((password != null && password.length() > 0) ? ":" + password : PropertyNames.EMPTY_STRING) + "@" + cp_URL.substring(7); - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.java b/wizards/com/sun/star/wizards/web/data/CGSession.java deleted file mode 100644 index 0ea6485b2956..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGSession.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 com.sun.star.wizards.web.data; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import com.sun.star.wizards.common.*; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -public class CGSession extends ConfigSetItem implements XMLProvider -{ - - public String cp_InDirectory; - public String cp_OutDirectory; - public String cp_Name; - public CGContent cp_Content = new CGContent(); - public CGDesign cp_Design = new CGDesign(); - public CGGeneralInfo cp_GeneralInfo = new CGGeneralInfo(); - public ConfigSet cp_Publishing = new ConfigSet(CGPublish.class); - public CGStyle style; // !!! - public boolean valid = false; - - public Node createDOM(Node parent) - { - Node root = XMLHelper.addElement(parent, "session", - new String[] - { - "name", "screen-size" - }, - new String[] - { - cp_Name, getScreenSize() - }); - - //cp_Design.createDOM(root); - cp_GeneralInfo.createDOM(root); - //cp_Publishing.createDOM(root); - cp_Content.createDOM(root); - - return root; - } - - private String getScreenSize() - { - switch (cp_Design.cp_OptimizeDisplaySize) - { - case 0: - return "640"; - case 1: - return "800"; - case 2: - return "1024"; - default: - return "800"; - } - } - - public CGLayout getLayout() - { - return (CGLayout) ((CGSettings) root).cp_Layouts.getElement(cp_Design.cp_Layout); - } - - public CGStyle getStyle() - { - return (CGStyle) ((CGSettings) root).cp_Styles.getElement(cp_Design.cp_Style); - } - - public void setLayout(short[] layout) - { - //dummy - } - - public Node createDOM() - throws ParserConfigurationException - { - - DocumentBuilderFactory factory = - DocumentBuilderFactory.newInstance(); - Document doc = factory.newDocumentBuilder().newDocument(); - createDOM(doc); - return doc; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGSessionName.java b/wizards/com/sun/star/wizards/web/data/CGSessionName.java deleted file mode 100644 index ca21d95796f4..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGSessionName.java +++ /dev/null @@ -1,29 +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 com.sun.star.wizards.web.data; - -public class CGSessionName extends ConfigSetItem -{ - - public String cp_Name; - - public String toString() - { - return cp_Name; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java deleted file mode 100644 index ee464a41f8be..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGSettings.java +++ /dev/null @@ -1,203 +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 . - */ - -/* - * IconSet.java - * - * Created on 12. September 2003, 17:16 - */ -package com.sun.star.wizards.web.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.container.NoSuchElementException; -import com.sun.star.container.XNameAccess; -import com.sun.star.i18n.NumberFormatIndex; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.DateTime; -import com.sun.star.wizards.common.ConfigGroup; -import com.sun.star.wizards.common.ConfigSet; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Helper.DateUtils; -import com.sun.star.wizards.common.JavaTools; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.common.PropertyNames; - -public class CGSettings extends ConfigGroup -{ - - public String soTemplateDir; - public String soGalleryDir; - public String workPath = null; - public String cp_WorkDir; - public ConfigSet cp_Exporters = new ConfigSet(CGExporter.class); - public ConfigSet cp_Layouts = new ConfigSet(CGLayout.class); - public ConfigSet cp_Styles = new ConfigSet(CGStyle.class); - public ConfigSet cp_IconSets = new ConfigSet(CGIconSet.class); - public ConfigSet cp_BackgroundImages = new ConfigSet(CGImage.class); - public ConfigSet cp_SavedSessions = new ConfigSet(CGSessionName.class); - public ConfigSet cp_Filters = new ConfigSet(CGFilter.class); - public ConfigSet savedSessions = new ConfigSet(CGSessionName.class); - public CGSession cp_DefaultSession = new CGSession(); - public String cp_LastSavedSession; - private Map<String, CGExporter[]> exportersMap = new HashMap<String, CGExporter[]>(); - private XMultiServiceFactory xmsf; - String[] resources; - public Formatter formatter; - public static final int RESOURCE_PAGES_TEMPLATE = 0; - public static final int RESOURCE_SLIDES_TEMPLATE = 1; - public static final int RESOURCE_CREATED_TEMPLATE = 2; - public static final int RESOURCE_UPDATED_TEMPLATE = 3; - public static final int RESOURCE_SIZE_TEMPLATE = 4; - - public CGSettings(XMultiServiceFactory xmsf_, String[] resources_, Object document) - { - xmsf = xmsf_; - try - { - soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING); - soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING); - root = this; - formatter = new Formatter(xmsf, document); - resources = resources_; - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - private static final CGExporter[] EMPTY_ARRAY_1 = new CGExporter[0]; - - public CGExporter[] getExporters(String mime) - { - CGExporter[] exps = exportersMap.get(mime); - if (exps == null) - { - exportersMap.put(mime, exps = createExporters(mime)); - } - return exps; - } - - private CGExporter[] createExporters(String mime) - { - Object[] exporters = cp_Exporters.items(); - ArrayList<Object> v = new ArrayList<Object>(); - for (int i = 0; i < exporters.length; i++) - { - if (((CGExporter) exporters[i]).supports(mime)) - { - try - { - v.add(exporters[i]); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - } - return v.toArray(new CGExporter[v.size()]); - } - - /** - * call after read. - * @param xmsf - */ - public void configure(XMultiServiceFactory xmsf) throws Exception - { - workPath = FileAccess.connectURLs(soTemplateDir, cp_WorkDir); - calcExportersTargetTypeNames(xmsf); - } - - private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception - { - Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); - XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect); - for (int i = 0; i < cp_Exporters.getSize(); i++) - { - calcExporterTargetTypeName(xNameAccess, (CGExporter) cp_Exporters.getElementAt(i)); - } - } - - private void calcExporterTargetTypeName(XNameAccess xNameAccess, CGExporter exporter) - throws NoSuchElementException, - WrappedTargetException - { - if (!exporter.cp_TargetType.equals(PropertyNames.EMPTY_STRING)) - { - exporter.targetTypeName = - (String) Properties.getPropertyValue( - (PropertyValue[]) xNameAccess.getByName(exporter.cp_TargetType), - "UIName"); - } - } - FileAccess fileAccess; - - FileAccess getFileAccess() throws Exception - { - return getFileAccess(xmsf); - } - - FileAccess getFileAccess(XMultiServiceFactory xmsf) throws Exception - { - if (fileAccess == null) - { - fileAccess = new FileAccess(xmsf); - } - return fileAccess; - } - - public class Formatter - { - - private long docNullTime; - private int dateFormat, numberFormat; - private DateUtils dateUtils; - - public Formatter(XMultiServiceFactory xmsf, Object document) throws Exception - { - dateUtils = new DateUtils(xmsf, document); - dateFormat = dateUtils.getFormat(NumberFormatIndex.DATE_SYS_DMMMYYYY); - numberFormat = dateUtils.getFormat(NumberFormatIndex.NUMBER_1000DEC2); - } - - public String formatCreated(DateTime date) - { - String sDate = dateUtils.format(dateFormat, date); - return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_CREATED_TEMPLATE], sDate, "%DATE"); - } - - public String formatUpdated(DateTime date) - { - String sDate = dateUtils.format(dateFormat, date); - return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_UPDATED_TEMPLATE], sDate, "%DATE"); - } - - public String formatFileSize(int size) - { - float sizeInKB = size / 1024f; - String sSize = dateUtils.getFormatter().convertNumberToString(numberFormat, sizeInKB); - return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_SIZE_TEMPLATE], sSize, "%NUMBER"); - } - } -} diff --git a/wizards/com/sun/star/wizards/web/data/CGStyle.java b/wizards/com/sun/star/wizards/web/data/CGStyle.java deleted file mode 100644 index 0293fdb1d5a8..000000000000 --- a/wizards/com/sun/star/wizards/web/data/CGStyle.java +++ /dev/null @@ -1,47 +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 com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.PropertyNames; - -public class CGStyle extends ConfigSetItem -{ - - public String cp_Name; - //public boolean cp_Readonly; - public String cp_CssHref; - public String cp_BackgroundImage; - public String cp_IconSet; - - public String toString() - { - return cp_Name; - } - - public String getBackgroundUrl() - { - if (cp_BackgroundImage == null || cp_BackgroundImage.equals(PropertyNames.EMPTY_STRING)) - { - return null; - } - else - { - return cp_BackgroundImage; - } - } -} diff --git a/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java b/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java deleted file mode 100644 index 0b27a537432d..000000000000 --- a/wizards/com/sun/star/wizards/web/data/ConfigSetItem.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 . - */ -/* - * SetItem.java - * - * Created on 16. September 2003, 12:29 - */ -package com.sun.star.wizards.web.data; - -import com.sun.star.wizards.common.*; - -public class ConfigSetItem extends ConfigGroup implements Indexable -{ - - public int cp_Index = -1; - - public int getIndex() - { - return cp_Index; - } - - public CGSettings getSettings() - { - return (CGSettings) root; - } -} diff --git a/wizards/com/sun/star/wizards/web/data/TypeDetection.java b/wizards/com/sun/star/wizards/web/data/TypeDetection.java deleted file mode 100644 index c236bfcc0ab6..000000000000 --- a/wizards/com/sun/star/wizards/web/data/TypeDetection.java +++ /dev/null @@ -1,65 +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 . - */ - -/* - * FileTypes.java - * - * Created on 29. September 2003, 18:52 - */ -package com.sun.star.wizards.web.data; - -public class TypeDetection -{ - - /** - * a document which will open in writer. - */ - public final static String WRITER_DOC = "writer"; - /** - * a document which will open in calc. - */ - public final static String CALC_DOC = "calc"; - /** - * a document which will open in impress. - */ - public final static String IMPRESS_DOC = "impress"; - /** - * a document which will open in draw. - */ - public final static String DRAW_DOC = "draw"; - /** - * an HTML document - */ - public final static String HTML_DOC = "html"; - /** - * a GIF or an JPG file. - */ - public final static String WEB_GRAPHICS = "graphics"; - /** - * a PDF document. - */ - public final static String PDF_DOC = "pdf"; - /** - * a Sound file (mp3/wav ect.) - */ - public final static String SOUND_FILE = "sound"; - /** - * a File which can not be handled by neither SO or a Web browser (exe, jar, zip ect.) - */ - public final static String NO_TYPE = "other"; -} diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java deleted file mode 100644 index 284b44168b10..000000000000 --- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java +++ /dev/null @@ -1,175 +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 . - */ -/* - * AbstractExporter.java - * - * Created on 1. Oktober 2003, 16:12 - */ -package com.sun.star.wizards.web.export; - -import com.sun.star.beans.PropertyValue; -import com.sun.star.document.MacroExecMode; -import com.sun.star.document.UpdateDocMode; -import com.sun.star.frame.XComponentLoader; -import com.sun.star.frame.XDesktop; -import com.sun.star.frame.XStorable; -import com.sun.star.io.IOException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.XCloseable; -import com.sun.star.wizards.common.Desktop; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.document.OfficeDocument; -import com.sun.star.wizards.text.TextDocument; -import com.sun.star.wizards.web.data.CGArgument; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGExporter; -import com.sun.star.wizards.web.data.TypeDetection; - -public abstract class AbstractExporter implements Exporter -{ - - protected CGExporter exporter; - protected FileAccess fileAccess; - - protected void storeToURL(Object officeDocument, Properties props, String targetUrl, String filterName, PropertyValue[] filterData) - throws IOException - { - - props = new Properties(); - props.put("FilterName", filterName); - - if (filterData.length > 0) - { - props.put("FilterData", filterData); - } - XStorable xs = UnoRuntime.queryInterface(XStorable.class, officeDocument); - PropertyValue[] o = props.getProperties(); - xs.storeToURL(targetUrl, o); - } - - protected void storeToURL(Object officeDocument, String targetUrl, String filterName, PropertyValue[] filterData) - throws IOException - { - - storeToURL(officeDocument, new Properties(), targetUrl, filterName, filterData); - } - - protected void storeToURL(Object officeDocument, String targetUrl, String filterName) - throws IOException - { - - storeToURL(officeDocument, new Properties(), targetUrl, filterName, new PropertyValue[0]); - - } - - protected String getArgument(String name, CGExporter p) - { - return ((CGArgument) p.cp_Arguments.getElement(name)).cp_Value; - } - - protected Object openDocument(CGDocument doc, XMultiServiceFactory xmsf) - throws com.sun.star.io.IOException - { - Object document = null; - //open the document. - try - { - XDesktop desktop = Desktop.getDesktop(xmsf); - Properties props = new Properties(); - props.put("Hidden", Boolean.TRUE); - props.put("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE)); - props.put("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE)); - document = UnoRuntime.queryInterface(XComponentLoader.class, desktop).loadComponentFromURL(doc.cp_URL, "_blank", 0, props.getProperties()); - } - catch (com.sun.star.lang.IllegalArgumentException iaex) - { - } - //try to get the number of pages in the document; - try - { - pageCount(doc, document); - } - catch (Exception ex) - { - //Here i do nothing since pages is not *so* important. - } - return document; - } - - protected void closeDocument(Object doc, XMultiServiceFactory xmsf) - { - try - { - XCloseable xc = UnoRuntime.queryInterface(XCloseable.class, doc); - xc.close(false); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - - private void pageCount(CGDocument doc, Object document) - { - if (doc.appType.equals(TypeDetection.WRITER_DOC)) - { - doc.pages = TextDocument.getPageCount(document); - } - else if (doc.appType.equals(TypeDetection.IMPRESS_DOC)) - { - doc.pages = OfficeDocument.getSlideCount(document); - } - else if (doc.appType.equals(TypeDetection.DRAW_DOC)) - { - doc.pages = OfficeDocument.getSlideCount(document); - } - } - - public void init(CGExporter exporter_) - { - exporter = exporter_; - } - - protected FileAccess getFileAccess(XMultiServiceFactory xmsf) - { - if (fileAccess == null) - { - try - { - fileAccess = new FileAccess(xmsf); - } - catch (Exception ex) - { - } - } - return fileAccess; - } - - protected void calcFileSize(CGDocument doc, String url, XMultiServiceFactory xmsf) - { - /*if the exporter exports to a - * binary format, get the size of the destination. - */ - if (exporter.cp_Binary) - { - doc.sizeBytes = getFileAccess(xmsf).getSize(url); - } - } -} diff --git a/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java b/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java deleted file mode 100644 index ec5986086633..000000000000 --- a/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.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 com.sun.star.wizards.web.export; - -import java.util.Iterator; - -import com.sun.star.wizards.web.data.CGArgument; -import com.sun.star.wizards.web.data.CGExporter; - -public class ConfiguredExporter extends FilterExporter -{ - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter) - */ - public void init(CGExporter exporter) - { - super.init(exporter); - for (Iterator<String> i = exporter.cp_Arguments.keys().iterator(); i.hasNext();) - { - String key = i.next(); - if (!key.equals("Filter")) - { - Object value = exporter.cp_Arguments.getElement(key); - props.put(key, cast(((CGArgument) value).cp_Value)); - } - } - } - - private Object cast(String s) - { - String s1 = s.substring(1); - char c = s.charAt(0); - switch (c) - { - case '$': - return s1; - case '%': - return Integer.valueOf(s1); - case '#': - return Short.valueOf(s1); - case '&': - return Double.valueOf(s1); - case 'f': - if (s.equals("false")) - { - return Boolean.FALSE; - } - break; - case 't': - if (s.equals("true")) - { - return Boolean.TRUE; - } - break; - } - return null; - } -} - diff --git a/wizards/com/sun/star/wizards/web/export/CopyExporter.java b/wizards/com/sun/star/wizards/web/export/CopyExporter.java deleted file mode 100644 index 50dca0195f01..000000000000 --- a/wizards/com/sun/star/wizards/web/export/CopyExporter.java +++ /dev/null @@ -1,67 +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 com.sun.star.wizards.web.export; - -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.FileAccess; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.CGDocument; - -public class CopyExporter extends AbstractExporter -{ - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.export.Exporter#export(java.lang.Object, java.io.File, com.sun.star.wizards.web.data.CGSettings, com.sun.star.lang.XMultiServiceFactory) - */ - public boolean export(CGDocument source, String target, XMultiServiceFactory xmsf, Task task) - { - try - { - task.advance(true); - - - /* - * this will open the document, and calculate the pages/slides number - * in it. - */ - if (exporter.cp_PageType > 0) - { - closeDocument(openDocument(source, xmsf), xmsf); - } - - task.advance(true); - - String newTarget = FileAccess.connectURLs( - FileAccess.getParentDir(target), source.urlFilename); - - boolean b = getFileAccess(xmsf).copy(source.cp_URL, newTarget); - - task.advance(true); - - calcFileSize(source, newTarget, xmsf); - - return b; - - } - catch (Exception ex) - { - return false; - } - } -} diff --git a/wizards/com/sun/star/wizards/web/export/Exporter.java b/wizards/com/sun/star/wizards/web/export/Exporter.java deleted file mode 100644 index 0533b2eaff68..000000000000 --- a/wizards/com/sun/star/wizards/web/export/Exporter.java +++ /dev/null @@ -1,47 +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 com.sun.star.wizards.web.export; - -import com.sun.star.io.IOException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.*; - -public interface Exporter -{ - - /** - * This method exports a document with a specified filter.<br/> - * The method is responsible for exporting the given source document - * to the given target directory. - * The exporter *must* also set the given CGDocument sizeBytes field to the - * size of the converted document, *if* the target document is - * of a binary format. - * always use source.urlFilename as destination filename. - * @param source is a CGDocument object. - * @param targetDirectory contains the URL of a directory to which the file should be exported to. - * @param xmsf this is a basic multiServiceFactory. - * @param task - a task monitoring object. This should advance - * (call task.advance(true) ) 3 times, while exporting. - * - */ - public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException; - - public void init(CGExporter exporter); -} - diff --git a/wizards/com/sun/star/wizards/web/export/FilterExporter.java b/wizards/com/sun/star/wizards/web/export/FilterExporter.java deleted file mode 100644 index 4b5bf47ff44e..000000000000 --- a/wizards/com/sun/star/wizards/web/export/FilterExporter.java +++ /dev/null @@ -1,78 +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 com.sun.star.wizards.web.export; - -import com.sun.star.io.IOException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.Properties; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGExporter; - -/** - * An exporter which is configured with a filter name, and - * uses the specified filter to export documents. - */ -public class FilterExporter extends AbstractExporter -{ - - protected String filterName; - protected Properties props = new Properties(); - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.export.Exporter#export(java.lang.Object, java.io.File, com.sun.star.wizards.web.data.CGSettings, com.sun.star.lang.XMultiServiceFactory) - */ - public boolean export(CGDocument source, String target, XMultiServiceFactory xmsf, Task task) throws IOException - { - - boolean result = true; - Object document = null; - - try - { - document = openDocument(source, xmsf); - task.advance(true); - storeToURL(document, target, filterName, props.getProperties()); - task.advance(true); - - } - catch (IOException iox) - { - iox.printStackTrace(System.err); - result = false; - throw iox; - } - finally - { - closeDocument(document, xmsf); - calcFileSize(source, target, xmsf); - task.advance(true); - } - return result; - - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter) - */ - public void init(CGExporter exporter_) - { - super.init(exporter_); - filterName = getArgument("Filter", exporter_); - } -} diff --git a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java deleted file mode 100644 index 3392140e7a2e..000000000000 --- a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.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 com.sun.star.wizards.web.export; - -import com.sun.star.io.IOException; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.wizards.common.PropertyNames; -import com.sun.star.wizards.ui.event.Task; -import com.sun.star.wizards.web.data.CGDocument; -import com.sun.star.wizards.web.data.CGSession; - -public class ImpressHTMLExporter extends ConfiguredExporter -{ - - private static final Integer SMALL_IMAGE = 512; - private static final Integer MEDIUM_IMAGE = 640; - private static final Integer LARGE_IMAGE = 800; - - public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException - { - - /* here set some filter specific properties. - * other properties, which are not dependant on - * user input are set through the exporter - * configuration. - */ - - CGSession session = getSession(source); - - props.put("Author", source.cp_Author); - props.put("Email", session.cp_GeneralInfo.cp_Email); - props.put("HomepageURL", getHomepageURL(session)); - props.put("UserText", source.cp_Title); - - props.put(PropertyNames.PROPERTY_WIDTH, getImageWidth(session)); - - props.put("UseButtonSet", new Integer(session.cp_Design.cp_IconSet)); - - - //now export - return super.export(source, targetDirectory, xmsf, task); - - } - - private String getHomepageURL(CGSession session) - { - return "../" + - (exporter.cp_OwnDirectory ? "../index.html" : "index.html"); - } - - private Integer getImageWidth(CGSession session) - { - switch (session.cp_Design.cp_OptimizeDisplaySize) - { - case 0: - return SMALL_IMAGE; - case 1: - return MEDIUM_IMAGE; - case 2: - return LARGE_IMAGE; - } - return MEDIUM_IMAGE; - } - - private CGSession getSession(CGDocument doc) - { - return doc.getSettings().cp_DefaultSession; - } -} diff --git a/wizards/com/sun/star/wizards/web/status/ErrorLog.java b/wizards/com/sun/star/wizards/web/status/ErrorLog.java deleted file mode 100644 index 99bd8a73e091..000000000000 --- a/wizards/com/sun/star/wizards/web/status/ErrorLog.java +++ /dev/null @@ -1,48 +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 com.sun.star.wizards.web.status; - -import java.util.ArrayList; -import java.util.List; - -public class ErrorLog implements ErrorReporter -{ - - private List<Err> errors = new ArrayList<Err>(); - - public void error(Exception ex, Object obj, String s) - { - errors.add(new Err(ex, obj, s)); - } - - public class Err - { - - public Exception exception; - public Object argument; - public String string; - - public Err(Exception ex, Object arg, String s) - { - exception = ex; - argument = arg; - string = s; - } - } -} diff --git a/wizards/com/sun/star/wizards/web/status/ErrorReporter.java b/wizards/com/sun/star/wizards/web/status/ErrorReporter.java deleted file mode 100644 index 14c9fc752d22..000000000000 --- a/wizards/com/sun/star/wizards/web/status/ErrorReporter.java +++ /dev/null @@ -1,25 +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 com.sun.star.wizards.web.status; - -public interface ErrorReporter -{ - - public void error(Exception ex, Object arg, String st); -} diff --git a/wizards/com/sun/star/wizards/web/status/LogTaskListener.java b/wizards/com/sun/star/wizards/web/status/LogTaskListener.java deleted file mode 100644 index ebe025016d63..000000000000 --- a/wizards/com/sun/star/wizards/web/status/LogTaskListener.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 com.sun.star.wizards.web.status; - -import java.io.PrintStream; - -public class LogTaskListener implements TaskListener -{ - - private PrintStream out; - - public LogTaskListener(PrintStream os) - { - out = os; - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent) - */ - public void taskStarted(TaskEvent te) - { - out.println("TASK " + te.getTask().getTaskName() + " STARTED."); - - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent) - */ - public void taskFinished(TaskEvent te) - { - out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded."); - - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent) - */ - public void taskStatusChanged(TaskEvent te) - { - out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax()); - } - - /* (non-Javadoc) - * @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent) - */ - public void subtaskNameChanged(TaskEvent te) - { - out.println("SUBTASK Name:" + te.getTask().getSubtaskName()); - } -} diff --git a/wizards/com/sun/star/wizards/web/status/Task.java b/wizards/com/sun/star/wizards/web/status/Task.java deleted file mode 100644 index 59e8bd1528fd..000000000000 --- a/wizards/com/sun/star/wizards/web/status/Task.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 com.sun.star.wizards.web.status; - -import java.util.ArrayList; -import java.util.List; - -public class Task -{ - - private int successful = 0; - private int failed = 0; - private int max = 0; - private String taskName; - private List<TaskListener> listeners = new ArrayList<TaskListener>(); - private String subtaskName; - - public Task(String taskName_, String subtaskName_, int max_) - { - taskName = taskName_; - subtaskName = subtaskName_; - max = max_; - } - - public void start() - { - fireTaskStarted(); - } - - public int getMax() - { - return max; - } - - public void setMax(int max_) - { - max = max_; - fireTaskStatusChanged(); - } - - public void advance(boolean success_) - { - if (success_) - { - successful++; - } - else - { - failed++; - } - fireTaskStatusChanged(); - if (failed + successful == max) - { - fireTaskFinished(); - } - } - - public void advance(boolean success_, String nextSubtaskName) - { - advance(success_); - setSubtaskName(nextSubtaskName); - } - - public int getStatus() - { - return successful + failed; - } - - public void addTaskListener(TaskListener tl) - { - listeners.add(tl); - } - - public void removeTaskListener(TaskListener tl) - { - listeners.remove(tl); - } - - protected void fireTaskStatusChanged() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STATUS_CHANGED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskStatusChanged(te); - } - } - - protected void fireTaskStarted() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STARTED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskStarted(te); - } - } - - protected void fireTaskFinished() - { - TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FINISHED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).taskFinished(te); - } - } - - protected void fireSubtaskNameChanged() - { - TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED); - - for (int i = 0; i < listeners.size(); i++) - { - listeners.get(i).subtaskNameChanged(te); - } - } - - public String getSubtaskName() - { - return subtaskName; - } - - public String getTaskName() - { - return taskName; - } - - /** - * @param string - */ - public void setSubtaskName(String string) - { - subtaskName = string; - fireSubtaskNameChanged(); - } - - public int getFailed() - { - return failed; - } - - public int getSuccessfull() - { - return successful; - } -} diff --git a/wizards/com/sun/star/wizards/web/status/TaskEvent.java b/wizards/com/sun/star/wizards/web/status/TaskEvent.java deleted file mode 100644 index d84c9cf44846..000000000000 --- a/wizards/com/sun/star/wizards/web/status/TaskEvent.java +++ /dev/null @@ -1,47 +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 com.sun.star.wizards.web.status; - -import java.util.EventObject; - -public class TaskEvent extends EventObject -{ - - public static final int TASK_STARTED = 1; - public static final int TASK_FINISHED = 2; - public static final int TASK_STATUS_CHANGED = 3; - public static final int SUBTASK_NAME_CHANGED = 4; - private int type; - - /** - * general constructor- - * @param source - * @param type_ - */ - public TaskEvent(Task source, int type_) - { - super(source); - type = type_; - } - - public Task getTask() - { - return (Task) getSource(); - } -} diff --git a/wizards/com/sun/star/wizards/web/status/TaskListener.java b/wizards/com/sun/star/wizards/web/status/TaskListener.java deleted file mode 100644 index d0dfcaece8c9..000000000000 --- a/wizards/com/sun/star/wizards/web/status/TaskListener.java +++ /dev/null @@ -1,37 +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 com.sun.star.wizards.web.status; - -import java.util.EventListener; - -public interface TaskListener extends EventListener -{ - - public void taskStarted(TaskEvent te); - - public void taskFinished(TaskEvent te); - - /** - * is called when the status of the task has advanced. - * @param te - */ - public void taskStatusChanged(TaskEvent te); - - public void subtaskNameChanged(TaskEvent te); -} |