Kaydet (Commit) 352d6ffa authored tarafından Xisco Fauli's avatar Xisco Fauli

fdo#38820 - Remove java web wizard

Change-Id: Iff32e2dbde7f0a7eedd5cf62c5b37fba8bb9ff54
üst 11a56096
/*
* 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);
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web;
import javax.swing.DefaultListModel;
import com.sun.star.awt.Size;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.ConfigSet;
import com.sun.star.wizards.common.Configuration;
import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.SystemDialog;
import com.sun.star.wizards.ui.ImageList;
import com.sun.star.wizards.web.data.CGImage;
import com.sun.star.wizards.web.data.CGSettings;
public class BackgroundsDialog extends ImageListDialog
{
private FileAccess fileAccess;
private SystemDialog sd;
private CGSettings settings;
/**
* @param xmsf
*/
public BackgroundsDialog(
XMultiServiceFactory xmsf,
ConfigSet set_, WebWizardDialogResources resources) throws Exception
{
super(xmsf, WWHID.HID_BG, new String[]
{
resources.resBackgroundsDialog,
resources.resBackgroundsDialogCaption,
resources.resOK,
resources.resCancel,
resources.resHelp,
resources.resDeselect,
resources.resOther,
resources.resCounter
});
sd = SystemDialog.createOpenDialog(xmsf);
sd.addFilter(resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", true);
sd.addFilter(resources.resAllFiles, "*.*", false);
settings = (CGSettings) set_.root;
fileAccess = new FileAccess(xmsf);
il.setListModel(new Model(set_));
il.setImageSize(new Size(40, 40));
il.setRenderer(new BGRenderer(0));
build();
}
/**
* trigered when the user clicks the "other" button.
* opens a "file open" dialog, adds the selected
* image to the list and to the web wizard configuration,
* and then jumps to the new image, selecting it in the list.
* @see #add(String)
*/
public void other()
{
String filename[] = sd.callOpenDialog(false, settings.cp_DefaultSession.cp_InDirectory);
if (filename != null && filename.length > 0 && filename[0] != null)
{
settings.cp_DefaultSession.cp_InDirectory = FileAccess.getParentDir(filename[0]);
int i = add(filename[0]);
il.setSelected(i);
il.display(i);
}
}
/**
* adds the given image to the image list (to the model)
* and to the web wizard configuration.
* @param s
* @return
*/
private int add(String s)
{
//first i check the item does not already exists in the list...
for (int i = 0; i < il.getListModel().getSize(); i++)
{
if (il.getListModel().getElementAt(i).equals(s))
{
return i;
}
}
((DefaultListModel) il.getListModel()).addElement(s);
try
{
Object configView = Configuration.getConfigurationRoot(xMSF, FileAccess.connectURLs(WebWizardConst.CONFIG_PATH, "BackgroundImages"), true);
int i = Configuration.getChildrenNames(configView).length + 1;
Object o = Configuration.addConfigNode(configView, PropertyNames.EMPTY_STRING + i);
Configuration.set(s, "Href", o);
Configuration.commit(configView);
}
catch (Exception ex)
{
ex.printStackTrace();
}
return il.getListModel().getSize() - 1;
}
/**
* an ImageList Imagerenderer implemtation.
* The image URL is the object given from the list model.
* the image name, got from the "render" method is
* the filename portion of the url.
*
*/
private class BGRenderer implements ImageList.IImageRenderer
{
private int cut;
public BGRenderer(int cut_)
{
cut = cut_;
}
public Object[] getImageUrls(Object listItem)
{
Object[] sRetUrls;
if (listItem != null)
{
sRetUrls = new Object[1];
sRetUrls[0] = listItem;
return sRetUrls;
}
return null;
}
public String render(Object object)
{
return object == null ? PropertyNames.EMPTY_STRING : FileAccess.getPathFilename(fileAccess.getPath((String) object, null));
}
}
/**
* This is a list model for the image list of the
* backgrounds dialog.
* It takes the Backgrounds config set as an argument,
* and "parses" it to a list of files:
* It goes through each image in the set, and checks it:
* if it is a directory it lists all image files in this directory.
* if it is a file, it adds the file to the list.
*/
private class Model extends DefaultListModel
{
/**
* constructor. </br>
* see class description for a description of
* the handling of the given model
* @param model the configuration set of the background images.
*/
public Model(ConfigSet model)
{
try
{
for (int i = 0; i < model.getSize(); i++)
{
CGImage image = (CGImage) model.getElementAt(i);
String path = sd.xStringSubstitution.substituteVariables(image.cp_Href, false);
if (fileAccess.exists(path, false))
{
addDir(path);
}
else
{
remove((String) model.getKey(image));
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
* when instanciating the model, it checks if each image
* exists. If it doesnot, it will be removed from
* the configuration.
* This is what this method does...
* @param imageName
*/
private void remove(String imageName)
{
try
{
Object conf = Configuration.getConfigurationRoot(xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages", true);
Configuration.removeNode(conf, imageName);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
/**
* if the given url is a directory
* adds the images in the given directory,
* otherwise (if it is a file) adds the file to the list.
* @param url
*/
private void addDir(String url)
{
if (fileAccess.isDirectory(url))
{
add(fileAccess.listFiles(url, false));
}
else
{
add(url);
}
}
/**
* adds the given filenames (urls) to
* the list
* @param filenames
*/
private void add(String[] filenames)
{
for (int i = 0; i < filenames.length; i++)
{
add(filenames[i]);
}
}
/**
* adds the given image url to the list.
* if and only if it ends with jpg, jpeg or gif
* (case insensitive)
* @param filename image url.
*/
private void add(String filename)
{
String lcase = filename.toLowerCase();
if (lcase.endsWith("jpg") ||
lcase.endsWith("jpeg") ||
lcase.endsWith("gif"))
{
Model.this.addElement(filename);
}
}
}
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web;
import com.sun.star.beans.XPropertyAccess;
import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.task.XJob;
import com.sun.star.task.XJobExecutor;
import com.sun.star.uno.Type;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
/**
* This class capsulates the class, that implements the minimal component, a factory for
* creating the service (<CODE>__getServiceFactory</CODE>).
*/
public class CallWizard
{
/**
* Gives a factory for creating the service. This method is called by the
* <code>JavaLoader</code>
*
* <p></p>
*
* @param stringImplementationName The implementation name of the component.
* @param xMSF The service manager, who gives access to every known service.
* @param xregistrykey Makes structural information (except regarding tree
* structures) of a single registry key accessible.
*
* @return Returns a <code>XSingleServiceFactory</code> for creating the component.
*
* @see com.sun.star.comp.loader.JavaLoader
*/
public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
{
XSingleServiceFactory xsingleservicefactory = null;
if (stringImplementationName.equals(WizardImplementation.class.getName()))
{
xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
}
return xsingleservicefactory;
}
/**
* This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor
{
/**
* The constructor of the inner class has a XMultiServiceFactory parameter.
*
* @param xmultiservicefactoryInitialization A special service factory could be
* introduced while initializing.
*/
public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
{
xmultiservicefactory = xmultiservicefactoryInitialization;
if (xmultiservicefactory != null)
{
}
}
private static WebWizard webWizard = null;
/**
* Execute Wizard
*
* @param str only valid parameter is 'start' at the moment.
*/
public void trigger(String str)
{
if (str.equalsIgnoreCase(PropertyNames.START))
{
if (webWizard == null)
{
WebWizard ww = null;
try
{
webWizard = new WebWizard(xmultiservicefactory);
ww = webWizard;
webWizard.show();
webWizard = null;
}
catch (Exception ex)
{
webWizard = null;
ex.printStackTrace();
Resource.showCommonResourceError(xmultiservicefactory);
}
finally
{
webWizard = null;
try
{
if (ww != null)
{
ww.cleanup();
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
else
{
webWizard.activate();
}
}
} //*******************************************
/**
* The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.web.CallWizard";
/**
* The service manager, that gives access to all registered services.
*/
private XMultiServiceFactory xmultiservicefactory;
/**
* This method is a member of the interface for initializing an object directly
* after its creation.
*
* @param object This array of arbitrary objects will be passed to the component
* after its creation.
*
* @throws com.sun.star.uno.Exception Every exception will not be handled, but
* will be passed to the caller.
*/
public void initialize(Object[] object) throws com.sun.star.uno.Exception
{
//wizardStarted = false;
}
/**
* This method returns an array of all supported service names.
*
* @return Array of supported service names.
*/
public java.lang.String[] getSupportedServiceNames()
{
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
return (stringSupportedServiceNames);
}
/**
* This method returns true, if the given service will be supported by the
* component.
*
* @param stringService Service name.
*
* @return True, if the given service name will be supported.
*/
public boolean supportsService(String stringService)
{
boolean booleanSupportsService = false;
if (stringService.equals(__serviceName))
{
booleanSupportsService = true;
}
return (booleanSupportsService);
}
/**
* This method returns an array of bytes, that can be used to unambiguously
* distinguish between two sets of types, e.g. to realise hashing functionality
* when the object is introspected. Two objects that return the same ID also
* have to return the same set of types in getTypes(). If an unique
* implementation Id cannot be provided this method has to return an empty
* sequence. Important: If the object aggregates other objects the ID has to be
* unique for the whole combination of objects.
*
* @return Array of bytes, in order to distinguish between two sets.
*/
public byte[] getImplementationId()
{
byte[] byteReturn =
{
};
try
{
byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
System.err.println(exception);
}
return (byteReturn);
}
/**
* Return the class name of the component.
*
* @return Class name of the component.
*/
public java.lang.String getImplementationName()
{
return (WizardImplementation.class.getName());
}
/**
* Provides a sequence of all types (usually interface types) provided by the
* object.
*
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
public com.sun.star.uno.Type[] getTypes()
{
Type[] typeReturn =
{
};
try
{
typeReturn = new Type[]
{
new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)
};
}
catch (Exception exception)
{
System.err.println(exception);
}
return (typeReturn);
}
}
public static void main(String[] s)
{
String ConnectStr =
"uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
try
{
XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf);
ww.trigger(PropertyNames.START);
}
catch (Exception exception)
{
exception.printStackTrace(System.err);
}
}
}
/*
* 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);
}
/*
* 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;
}
}
/*
* 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 = "/";
}
}
/*
* 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);
}
}
/*
* 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;
}
}
RegistrationClassName: com.sun.star.wizards.web.CallWizard
UNO-Type-Path:
/*
* 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);
}
}
}
/*
* 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;
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web;
import java.util.HashMap;
import java.util.Map;
import com.sun.star.wizards.common.IRenderer;
/**
* recieves status calls from the status dialog which
* apears when the user clicks "create".
* allocates strings from the resources to
* display the current task status.
* (renders the state to resource strings)
*/
public class ProcessStatusRenderer implements IRenderer, WebWizardConst
{
Map<String, String> strings = new HashMap<String, String>(12);
public ProcessStatusRenderer(WebWizardDialogResources res)
{
strings.put(TASK_EXPORT_DOCUMENTS, res.resTaskExportDocs);
strings.put(TASK_EXPORT_PREPARE, res.resTaskExportPrepare);
strings.put(TASK_GENERATE_COPY, res.resTaskGenerateCopy);
strings.put(TASK_GENERATE_PREPARE, res.resTaskGeneratePrepare);
strings.put(TASK_GENERATE_XSL, res.resTaskGenerateXsl);
strings.put(TASK_PREPARE, res.resTaskPrepare);
strings.put(LOCAL_PUBLISHER, res.resTaskPublishLocal);
strings.put(ZIP_PUBLISHER, res.resTaskPublishZip);
strings.put(FTP_PUBLISHER, res.resTaskPublishFTP);
strings.put(TASK_PUBLISH_PREPARE, res.resTaskPublishPrepare);
strings.put(TASK_FINISH, res.resTaskFinish);
}
public String render(Object object)
{
return strings.get(object);
}
}
/*
* 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;
}
}
/*
* 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);
}
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web;
import org.w3c.dom.Document;
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.XDispatch;
import com.sun.star.frame.XFrame;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.util.URL;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.UCB;
import com.sun.star.wizards.ui.event.Task;
import com.sun.star.wizards.web.data.CGLayout;
import com.sun.star.wizards.web.data.CGSettings;
/**
* This class both copies necessary files to
* a temporary directory, generates a temporary TOC page,
* and opens the generated html document in a web browser,
* by default "index.html" (unchangeable).
* <br/>
* Since the files are both static and dynamic (some are always the same,
* while other change according to user choices)
* I divide this tasks to two: all necessary
* static files, which should not regularily update are copied upon
* instanciation.
* The TOC is generated in refresh(...);
*/
public class TOCPreview
{
private String tempDir = null;
private XMultiServiceFactory xmsf;
private FileAccess fileAccess;
private WebWizardDialogResources resources;
private URL openHyperlink;
private XDispatch xDispatch;
private PropertyValue[] loadArgs;
private UCB ucb;
private XFrame xFrame;
/**
* @param xmsf_
* @param settings web wizard settings
* @param res resources
* @param tempDir_ destination
* @throws Exception
*/
public TOCPreview(XMultiServiceFactory xmsf_, CGSettings settings, WebWizardDialogResources res, String tempDir_, XFrame _xFrame)
throws Exception
{
xFrame = _xFrame;
xmsf = xmsf_;
resources = res;
fileAccess = new FileAccess(xmsf);
tempDir = tempDir_;
loadArgs = loadArgs(FileAccess.connectURLs(tempDir, "/index.html"));
openHyperlink = Desktop.getDispatchURL(xmsf, ".uno:OpenHyperlink");
xDispatch = Desktop.getDispatcher(xmsf, xFrame, "_top", openHyperlink);
ucb = new UCB(xmsf);
Process.copyStaticImages(ucb, settings, tempDir);
}
/**
* generates a TOC, copies the layout-specific files, and
* calles a browser to show "index.html".
* @param settings
* @throws Exception
*/
public void refresh(CGSettings settings)
throws Exception
{
Document doc = (Document) settings.cp_DefaultSession.createDOM();
CGLayout layout = settings.cp_DefaultSession.getLayout();
Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 10000);
Process.generate(xmsf, layout, doc, fileAccess, tempDir, task);
Process.copyLayoutFiles(ucb, fileAccess, settings, layout, tempDir);
xDispatch.dispatch(openHyperlink, loadArgs);
}
private PropertyValue[] loadArgs(String url)
{
PropertyValue pv = new PropertyValue();
pv.Name = PropertyNames.URL;
pv.Value = url;
return new PropertyValue[]
{
pv
};
}
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
/*
* Created on May 5, 2004
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.sun.star.wizards.web;
/**
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
public interface WWHID
{
// web wizard general controls
public static final int HID0_WEBWIZARD = 34200 + 0;
public static final int HID0_HELP = 34200 + 1;
public static final int HID0_NEXT = 34200 + 2;
public static final int HID0_PREV = 34200 + 3;
public static final int HID0_CREATE = 34200 + 4;
public static final int HID0_CANCEL = 34200 + 5;
public static final int HID0_STATUS_DIALOG = 34200 + 6;// step 1
public static final int HID1_LST_SESSIONS = 34200 + 7;
public static final int HID1_BTN_DEL_SES = 34200 + 9;// step 2
public static final int HID2_LST_DOCS = 34200 + 10;
public static final int HID2_BTN_ADD_DOC = 34200 + 11;
public static final int HID2_BTN_REM_DOC = 34200 + 12;
public static final int HID2_BTN_DOC_UP = 34200 + 13;
public static final int HID2_BTN_DOC_DOWN = 34200 + 14;
public static final int HID2_TXT_DOC_TITLE = 34200 + 15;
public static final int HID2_TXT_DOC_DESC = 34200 + 16;
public static final int HID2_TXT_DOC_AUTHOR = 34200 + 17;
public static final int HID2_LST_DOC_EXPORT = 34200 + 18;
public static final int HID2_STATUS_ADD_DOCS = 34200 + 19;// step 3
public static final int HID3_IL_LAYOUTS_IMG1 = 34200 + 20;
public static final int HID3_IL_LAYOUTS_IMG2 = 34200 + 21;
public static final int HID3_IL_LAYOUTS_IMG3 = 34200 + 22;
public static final int HID3_IL_LAYOUTS_IMG4 = 34200 + 23;
public static final int HID3_IL_LAYOUTS_IMG5 = 34200 + 24;
public static final int HID3_IL_LAYOUTS_IMG6 = 34200 + 25;
public static final int HID3_IL_LAYOUTS_IMG7 = 34200 + 26;
public static final int HID3_IL_LAYOUTS_IMG8 = 34200 + 27;
public static final int HID3_IL_LAYOUTS_IMG9 = 34200 + 28;
public static final int HID3_IL_LAYOUTS_IMG10 = 34200 + 29;
public static final int HID3_IL_LAYOUTS_IMG11 = 34200 + 30;
public static final int HID3_IL_LAYOUTS_IMG12 = 34200 + 31;
public static final int HID3_IL_LAYOUTS_IMG13 = 34200 + 32;
public static final int HID3_IL_LAYOUTS_IMG14 = 34200 + 33;
public static final int HID3_IL_LAYOUTS_IMG15 = 34200 + 34;// step 4
public static final int HID4_CHK_DISPLAY_FILENAME = 34200 + 35;
public static final int HID4_CHK_DISPLAY_DESCRIPTION = 34200 + 36;
public static final int HID4_CHK_DISPLAY_AUTHOR = 34200 + 37;
public static final int HID4_CHK_DISPLAY_CR_DATE = 34200 + 38;
public static final int HID4_CHK_DISPLAY_UP_DATE = 34200 + 39;
public static final int HID4_CHK_DISPLAY_FORMAT = 34200 + 40;
public static final int HID4_CHK_DISPLAY_F_ICON = 34200 + 41;
public static final int HID4_CHK_DISPLAY_PAGES = 34200 + 42;
public static final int HID4_CHK_DISPLAY_SIZE = 34200 + 43;
public static final int HID4_GRP_OPTIMAIZE_640 = 34200 + 44;
public static final int HID4_GRP_OPTIMAIZE_800 = 34200 + 45;
public static final int HID4_GRP_OPTIMAIZE_1024 = 34200 + 46;// step 5
public static final int HID5_LST_STYLES = 34200 + 47;
public static final int HID5_BTN_BACKGND = 34200 + 48;
public static final int HID5_BTN_ICONS = 34200 + 49;// step 6
public static final int HID6_TXT_SITE_TITLE = 34200 + 50;
public static final int HID6_TXT_SITE_ICON = 34200 + 51;
public static final int HID6_BTN_SITE_ICON = 34200 + 52;
public static final int HID6_TXT_SITE_DESC = 34200 + 53;
public static final int HID6_TXT_SITE_KEYWRDS = 34200 + 54;
public static final int HID6_DATE_SITE_CREATED = 34200 + 55;
public static final int HID6_DATE_SITE_UPDATED = 34200 + 56;
public static final int HID6_NUM_SITE_REVISTS = 34200 + 57;
public static final int HID6_TXT_SITE_EMAIL = 34200 + 58;
public static final int HID6_TXT_SITE_COPYRIGHT = 34200 + 59;// step 7
public static final int HID7_BTN_PREVIEW = 34200 + 60;
public static final int HID7_CHK_PUBLISH_LOCAL = 34200 + 61;
public static final int HID7_TXT_LOCAL = 34200 + 62;
public static final int HID7_BTN_LOCAL = 34200 + 63;
public static final int HID7_CHK_PUBLISH_ZIP = 34200 + 64;
public static final int HID7_TXT_ZIP = 34200 + 65;
public static final int HID7_BTN_ZIP = 34200 + 66;
public static final int HID7_CHK_PUBLISH_FTP = 34200 + 67;
public static final int HID7_BTN_FTP = 34200 + 69;
public static final int HID7_CHK_SAVE = 34200 + 70;
public static final int HID7_TXT_SAVE = 34200 + 71;// web wizard backgrounds dialog
public static final int HID_BG = 34200 + 90;
public static final int HID_BG_BTN_OTHER = 34200 + 91;
public static final int HID_BG_BTN_NONE = 34200 + 92;
public static final int HID_BG_BTN_OK = 34200 + 93;
public static final int HID_BG_BTN_CANCEL = 34200 + 94;
public static final int HID_BG_BTN_BACK = 34200 + 95;
public static final int HID_BG_BTN_FW = 34200 + 96;
public static final int HID_BG_BTN_IMG1 = 34200 + 97;
public static final int HID_BG_BTN_IMG2 = 34200 + 98;
public static final int HID_BG_BTN_IMG3 = 34200 + 99;
public static final int HID_BG_BTN_IMG4 = 34200 + 100;
public static final int HID_BG_BTN_IMG5 = 34200 + 101;
public static final int HID_BG_BTN_IMG6 = 34200 + 102;
public static final int HID_BG_BTN_IMG7 = 34200 + 103;
public static final int HID_BG_BTN_IMG8 = 34200 + 104;
public static final int HID_BG_BTN_IMG9 = 34200 + 105;
public static final int HID_BG_BTN_IMG10 = 34200 + 106;
public static final int HID_BG_BTN_IMG11 = 34200 + 107;
public static final int HID_BG_BTN_IMG12 = 34200 + 108;// web wizard icons sets dialog
public static final int HID_IS = 41000 + 0;
public static final int HID_IS_ICONSETS = 41000 + 1;
public static final int HID_IS_BTN_NONE = 41000 + 2;
public static final int HID_IS_BTN_OK = 41000 + 3;
public static final int HID_IS_BTN_IMG1 = 41000 + 5;
public static final int HID_IS_BTN_IMG2 = 41000 + 6;
public static final int HID_IS_BTN_IMG3 = 41000 + 7;
public static final int HID_IS_BTN_IMG4 = 41000 + 8;
public static final int HID_IS_BTN_IMG5 = 41000 + 9;
public static final int HID_IS_BTN_IMG6 = 41000 + 10;
public static final int HID_IS_BTN_IMG7 = 41000 + 11;
public static final int HID_IS_BTN_IMG8 = 41000 + 12;
public static final int HID_IS_BTN_IMG9 = 41000 + 13;
public static final int HID_IS_BTN_IMG10 = 41000 + 14;
public static final int HID_IS_BTN_IMG11 = 41000 + 15;
public static final int HID_IS_BTN_IMG12 = 41000 + 16;
public static final int HID_IS_BTN_IMG13 = 41000 + 17;
public static final int HID_IS_BTN_IMG14 = 41000 + 18;
public static final int HID_IS_BTN_IMG15 = 41000 + 19;
public static final int HID_IS_BTN_IMG16 = 41000 + 20;
public static final int HID_IS_BTN_IMG17 = 41000 + 21;
public static final int HID_IS_BTN_IMG18 = 41000 + 22;
public static final int HID_IS_BTN_IMG19 = 41000 + 23;
public static final int HID_IS_BTN_IMG20 = 41000 + 24;
public static final int HID_IS_BTN_IMG21 = 41000 + 25;
public static final int HID_IS_BTN_IMG22 = 41000 + 26;
public static final int HID_IS_BTN_IMG23 = 41000 + 27;
public static final int HID_IS_BTN_IMG24 = 41000 + 28;
public static final int HID_IS_BTN_IMG25 = 41000 + 29;
public static final int HID_IS_BTN_IMG26 = 41000 + 30;
public static final int HID_IS_BTN_IMG27 = 41000 + 31;
public static final int HID_IS_BTN_IMG28 = 41000 + 32;
public static final int HID_IS_BTN_IMG29 = 41000 + 33;
public static final int HID_IS_BTN_IMG30 = 41000 + 34;
public static final int HID_IS_BTN_IMG31 = 41000 + 35;
public static final int HID_IS_BTN_IMG32 = 41000 + 36;
// web wizard ftp dialog
public static final int HID_FTP = 41000 + 40;
public static final int HID_FTP_SERVER = 41000 + 41;
public static final int HID_FTP_USERNAME = 41000 + 42;
public static final int HID_FTP_PASS = 41000 + 43;
public static final int HID_FTP_TEST = 41000 + 44;
public static final int HID_FTP_TXT_PATH = 41000 + 45;
public static final int HID_FTP_BTN_PATH = 41000 + 46;
public static final int HID_FTP_OK = 41000 + 47;
public static final int HID_FTP_CANCEL = 41000 + 48;
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Desktop;
/**
* The last class in the WebWizard Dialog class hirarchy.
* Has no functionality, is just nice to have it instanciated.
*/
public class WebWizard extends WWD_Events
{
public WebWizard(XMultiServiceFactory xmsf) throws Exception
{
super(xmsf);
}
public static void main(String args[])
{
String ConnectStr =
"uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
try
{
XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
WebWizard ww = new WebWizard(xmsf);
ww.show();
ww.cleanup();
}
catch (Exception exception)
{
exception.printStackTrace(System.err);
}
}
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web;
public interface WebWizardConst
{
public static final String LSTLOADSETTINGS_ITEM_CHANGED = "sessionSelected"; // "lstLoadSettingsItemChanged";
public static final String BTNLOADSESSION_ACTION_PERFORMED = "loadSession"; // "btnLoadSessionActionPerformed";
public static final String BTNDELSESSION_ACTION_PERFORMED = "delSession"; // "btnDelSessionActionPerformed";
public static final String BTNADDDOC_ACTION_PERFORMED = "addDocument"; // "btnAddDocActionPerformed";
public static final String BTNREMOVEDOC_ACTION_PERFORMED = "removeDocument"; // "btnRemoveDocActionPerformed";
public static final String BTNDOCUP_ACTION_PERFORMED = "docUp"; // "btnDocUpActionPerformed";
public static final String BTNDOCDOWN_ACTION_PERFORMED = "docDown"; // "btnDocDownActionPerformed";
public static final String LSTSTYLES_ITEM_CHANGED = "refreshStylePreview"; // "lstStylesItemChanged";
public static final String BTNBACKGROUNDS_ACTION_PERFORMED = "chooseBackground"; // "btnBackgroundsActionPerformed";
public static final String BTNICONSETS_ACTION_PERFORMED = "chooseIconset"; // "btnIconSetsActionPerformed";
public static final String BTNFAVICON_ACTION_PERFORMED = "chooseFavIcon"; // "btnFavIconActionPerformed";
public static final String BTNPREVIEW_ACTION_PERFORMED = "documentPreview"; // "btnPreviewActionPerformed";
public static final String BTNFTP_ACTION_PERFORMED = "setFTPPublish"; // "btnFTPActionPerformed";
public static final String CHKLOCALDIR_ITEM_CHANGED = "checkPublish"; // "chkLocalDirItemChanged";
public static final String CHKSAVESETTINGS_ITEM_CHANGED = "checkPublish"; // "chkSaveSettingsItemChanged";
public static final String TXTSAVESETTINGS_TEXT_CHANGED = "checkPublish"; // "txtSaveSettingsTextChanged";
public static final String BTNLOCALDIR_ACTION_PERFORMED = "setPublishLocalDir"; // "btnLocalDirActionPerformed";
public static final String BTNZIP_ACTION_PERFORMED = "setZipFilename";// "btnZipActionPerformed";
public static final String CONFIG_PATH = "/org.openoffice.Office.WebWizard/WebWizard";
public static final String CONFIG_READ_PARAM = "cp_";
public static final String TASK = "WWIZ";
public static final String TASK_PREPARE = "t-prep";
public static final String LOCAL_PUBLISHER = "local";
public static final String FTP_PUBLISHER = "ftp";
public static final String ZIP_PUBLISHER = "zip";
public static final String TASK_EXPORT = "t_exp";
public static final String TASK_EXPORT_PREPARE = "t_exp_prep";
public static final String TASK_EXPORT_DOCUMENTS = "t_exp_docs";
public static final String TASK_GENERATE_PREPARE = "t_gen_prep";
public static final String TASK_GENERATE_XSL = "t_gen_x";
public static final String TASK_GENERATE_COPY = "t_gen_cp";
public static final String TASK_PUBLISH_PREPARE = "t_pub_prep";
//public static final String TASK_PUBLISH = "t_pub";
public static final String TASK_FINISH = "t_fin";
/**
* when the user adds more than this number
* of documents to the list, a status dialog opens.
*/
public static final int MIN_ADD_FILES_FOR_DIALOG = 2;
}
\ No newline at end of file
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigGroup;
public class CGArgument extends ConfigGroup
{
public String cp_Value;
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.*;
import org.w3c.dom.*;
public class CGContent extends ConfigSetItem implements XMLProvider
{
public String dirName;
public String cp_Name;
public String cp_Description;
public ConfigSet cp_Contents = new ConfigSet(CGContent.class);
public ConfigSet cp_Documents = new ConfigSet(CGDocument.class);
public CGContent()
{
/*cp_Documents = new ConfigSet(CGDocument.class) {
protected DefaultListModel createChildrenList() {
return cp_Contents.getChildrenList();
}
};*/
}
public Node createDOM(Node parent)
{
Node myElement = XMLHelper.addElement(parent, "content",
new String[]
{
"name", "directory-name", "description", "directory"
},
new String[]
{
cp_Name, dirName, cp_Description, dirName
});
cp_Documents.createDOM(myElement);
return myElement;
}
}
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigSet;
import com.sun.star.wizards.common.PropertyNames;
public class CGExporter extends ConfigSetItem
{
public String cp_Name;
public String cp_ExporterClass;
public boolean cp_OwnDirectory;
public boolean cp_SupportsFilename;
public String cp_DefaultFilename;
public String cp_Extension;
public String cp_SupportedMimeTypes;
public String cp_Icon;
public String cp_TargetType;
public boolean cp_Binary;
public int cp_PageType;
public String targetTypeName = PropertyNames.EMPTY_STRING;
public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class);
public String toString()
{
return cp_Name;
}
public boolean supports(String mime)
{
return (cp_SupportedMimeTypes.equals(PropertyNames.EMPTY_STRING) || cp_SupportedMimeTypes.indexOf(mime) > -1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment