From 352d6ffa8e3aee793486d8e065ad044b58ca5dac Mon Sep 17 00:00:00 2001
From: Xisco Fauli
Date: Sun, 9 Jun 2013 21:59:05 +0200
Subject: fdo#38820 - Remove java web wizard
Change-Id: Iff32e2dbde7f0a7eedd5cf62c5b37fba8bb9ff54
---
.../sun/star/wizards/web/AbstractErrorHandler.java | 229 ----
.../sun/star/wizards/web/BackgroundsDialog.java | 274 -----
wizards/com/sun/star/wizards/web/CallWizard.java | 284 -----
wizards/com/sun/star/wizards/web/ErrorHandler.java | 102 --
.../sun/star/wizards/web/ExtensionVerifier.java | 53 -
wizards/com/sun/star/wizards/web/FTPDialog.java | 741 ------------
.../sun/star/wizards/web/FTPDialogResources.java | 89 --
wizards/com/sun/star/wizards/web/IconsDialog.java | 192 ---
.../com/sun/star/wizards/web/ImageListDialog.java | 266 ----
.../com/sun/star/wizards/web/LogTaskListener.java | 88 --
wizards/com/sun/star/wizards/web/MANIFEST.MF | 2 -
wizards/com/sun/star/wizards/web/Process.java | 808 -------------
.../sun/star/wizards/web/ProcessErrorHandler.java | 82 --
.../com/sun/star/wizards/web/ProcessErrors.java | 38 -
.../star/wizards/web/ProcessStatusRenderer.java | 57 -
wizards/com/sun/star/wizards/web/StatusDialog.java | 289 -----
wizards/com/sun/star/wizards/web/StylePreview.java | 145 ---
wizards/com/sun/star/wizards/web/TOCPreview.java | 111 --
wizards/com/sun/star/wizards/web/WWD_Events.java | 1276 --------------------
wizards/com/sun/star/wizards/web/WWD_General.java | 377 ------
wizards/com/sun/star/wizards/web/WWD_Startup.java | 942 ---------------
wizards/com/sun/star/wizards/web/WWHID.java | 169 ---
wizards/com/sun/star/wizards/web/WebWizard.java | 54 -
.../com/sun/star/wizards/web/WebWizardConst.java | 64 -
.../com/sun/star/wizards/web/WebWizardDialog.java | 879 --------------
.../star/wizards/web/WebWizardDialogResources.java | 339 ------
.../com/sun/star/wizards/web/data/CGArgument.java | 26 -
.../com/sun/star/wizards/web/data/CGContent.java | 59 -
.../com/sun/star/wizards/web/data/CGDesign.java | 82 --
.../com/sun/star/wizards/web/data/CGDocument.java | 435 -------
.../com/sun/star/wizards/web/data/CGExporter.java | 49 -
.../com/sun/star/wizards/web/data/CGFilter.java | 26 -
.../sun/star/wizards/web/data/CGGeneralInfo.java | 83 --
.../com/sun/star/wizards/web/data/CGIconSet.java | 26 -
wizards/com/sun/star/wizards/web/data/CGImage.java | 26 -
.../com/sun/star/wizards/web/data/CGLayout.java | 78 --
.../com/sun/star/wizards/web/data/CGPublish.java | 86 --
.../com/sun/star/wizards/web/data/CGSession.java | 101 --
.../sun/star/wizards/web/data/CGSessionName.java | 29 -
.../com/sun/star/wizards/web/data/CGSettings.java | 203 ----
wizards/com/sun/star/wizards/web/data/CGStyle.java | 47 -
.../sun/star/wizards/web/data/ConfigSetItem.java | 41 -
.../sun/star/wizards/web/data/TypeDetection.java | 65 -
.../star/wizards/web/export/AbstractExporter.java | 175 ---
.../wizards/web/export/ConfiguredExporter.java | 76 --
.../sun/star/wizards/web/export/CopyExporter.java | 67 -
.../com/sun/star/wizards/web/export/Exporter.java | 47 -
.../star/wizards/web/export/FilterExporter.java | 78 --
.../wizards/web/export/ImpressHTMLExporter.java | 84 --
.../com/sun/star/wizards/web/status/ErrorLog.java | 48 -
.../sun/star/wizards/web/status/ErrorReporter.java | 25 -
.../star/wizards/web/status/LogTaskListener.java | 66 -
wizards/com/sun/star/wizards/web/status/Task.java | 163 ---
.../com/sun/star/wizards/web/status/TaskEvent.java | 47 -
.../sun/star/wizards/web/status/TaskListener.java | 37 -
55 files changed, 10325 deletions(-)
delete mode 100644 wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
delete mode 100644 wizards/com/sun/star/wizards/web/BackgroundsDialog.java
delete mode 100644 wizards/com/sun/star/wizards/web/CallWizard.java
delete mode 100644 wizards/com/sun/star/wizards/web/ErrorHandler.java
delete mode 100644 wizards/com/sun/star/wizards/web/ExtensionVerifier.java
delete mode 100644 wizards/com/sun/star/wizards/web/FTPDialog.java
delete mode 100644 wizards/com/sun/star/wizards/web/FTPDialogResources.java
delete mode 100644 wizards/com/sun/star/wizards/web/IconsDialog.java
delete mode 100644 wizards/com/sun/star/wizards/web/ImageListDialog.java
delete mode 100644 wizards/com/sun/star/wizards/web/LogTaskListener.java
delete mode 100644 wizards/com/sun/star/wizards/web/MANIFEST.MF
delete mode 100644 wizards/com/sun/star/wizards/web/Process.java
delete mode 100644 wizards/com/sun/star/wizards/web/ProcessErrorHandler.java
delete mode 100644 wizards/com/sun/star/wizards/web/ProcessErrors.java
delete mode 100644 wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java
delete mode 100644 wizards/com/sun/star/wizards/web/StatusDialog.java
delete mode 100644 wizards/com/sun/star/wizards/web/StylePreview.java
delete mode 100644 wizards/com/sun/star/wizards/web/TOCPreview.java
delete mode 100644 wizards/com/sun/star/wizards/web/WWD_Events.java
delete mode 100644 wizards/com/sun/star/wizards/web/WWD_General.java
delete mode 100644 wizards/com/sun/star/wizards/web/WWD_Startup.java
delete mode 100644 wizards/com/sun/star/wizards/web/WWHID.java
delete mode 100644 wizards/com/sun/star/wizards/web/WebWizard.java
delete mode 100644 wizards/com/sun/star/wizards/web/WebWizardConst.java
delete mode 100644 wizards/com/sun/star/wizards/web/WebWizardDialog.java
delete mode 100644 wizards/com/sun/star/wizards/web/WebWizardDialogResources.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGArgument.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGContent.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGDesign.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGDocument.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGExporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGFilter.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGIconSet.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGImage.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGLayout.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGPublish.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGSession.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGSessionName.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGSettings.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/CGStyle.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/ConfigSetItem.java
delete mode 100644 wizards/com/sun/star/wizards/web/data/TypeDetection.java
delete mode 100644 wizards/com/sun/star/wizards/web/export/AbstractExporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/export/CopyExporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/export/Exporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/export/FilterExporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/status/ErrorLog.java
delete mode 100644 wizards/com/sun/star/wizards/web/status/ErrorReporter.java
delete mode 100644 wizards/com/sun/star/wizards/web/status/LogTaskListener.java
delete mode 100644 wizards/com/sun/star/wizards/web/status/Task.java
delete mode 100644 wizards/com/sun/star/wizards/web/status/TaskEvent.java
delete mode 100644 wizards/com/sun/star/wizards/web/status/TaskListener.java
(limited to 'wizards/com')
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.
- * 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 (__getServiceFactory).
- */
-public class CallWizard
-{
-
- /**
- * Gives a factory for creating the service. This method is called by the
- * JavaLoader
- *
- *
- *
- * @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 XSingleServiceFactory 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.
- * 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.
- */
-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 = new ArrayList();
- 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:
- * 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 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.
- *
- * 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.
- *
- * 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.
- * 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.
- * it does the following:
- * 1. create a temporary directory.
- * 2. export documents to the temporary directory.
- * 3. generate the TOC page, includes copying images from the
- * web wizard work directory and other layout files.
- * 4. publish, or copy, from the temporary directory to
- * different destinations.
- * 5. delete the temporary directory.
- *
- * to follow up the status/errors it uses a TaskListener object,
- * and an ErrorHandler.
- * in practice, the TaskListener is the status dialog,
- * and the Errorhandler does the interaction with the user,
- * if something goes wrong.
- * 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.
- *
- *
- *
- * note on error handling:
- * 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 exporters = new HashMap(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 templates = layout.getTemplates(xmsf);
-
- task.advance(true, TASK_GENERATE_XSL);
-
- /*
- * each template generates a page.
- */
- for (Iterator 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 strings = new HashMap(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).
- *
- * 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 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 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.
- *
Data Aware Concept
- *
I use DataAware objects, which synchronize
- * UI and Data. A DataAware object a kind of interface
- * between a Value and a UI element.
- *
- *
- * A Value is either a JavaBean property with
- * a Getter and a Setter or a public class Memeber.
- *
- * 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.
- *
- *
- * here I use only UI Listeners, and keep calling
- * the updateUI() method whenever I change the Value.
- *
- * 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.
- *
- * 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.
- * This is what happends when a session loads: I Load the session into
- * a tree of DataObjects, and change the DataAware's DataObject.
- * 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 docAware = new ArrayList();
- /**
- * The Vector containing DataAware objects
- * which relay on the session's generalInfo
- * Object (CGSession.cp_GeneralInfo) as
- * DataObject (or model).
- */
- protected List genAware = new ArrayList();
- /**
- * The vector containing DataAware objectscm25npd ..
- * which relay on the session's Design Object
- * (CGSession.cp_Design) as DataObject
- * (or model).
- *
- */
- protected List designAware = new ArrayList();
- /**
- * A Vector containig the DataAware objects
- * which relay on Publishing Objects.
- * Differently from other Vectors, each
- * DataAware object in this Vector relays
- * on a different CGPublish object,
- * So they are handled with more care.
- */
- protected List pubAware = new ArrayList(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:
- * Check if ftp http proxy is set, and warn user he can not use
- * ftp if it is.
- * draw NaviBar and steps 1 to 7, incl. Step X,
- * which is the Layouts ImageList on step 3.
- * load the settings from the configuration.
- * set the default save session name to the first
- * available one (sessionX or something like that).
- * set the Layouts ImageList ListModel, and call
- * its "create()" method.
- * check the content (documents) specified in the default session.
- * fill the list boxes (saved sessions, styles, combobox save session).
- * make data aware.
- * updateUI (refreshes the display to crrespond to the data in
- * the default session.)
- * fill the documents listbox.
- * 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.
- * Checks the documents (validate), fills the
- * documents listbox, and changes the
- * DataAware data objects to the
- * new session's objects.
- * 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 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