diff options
Diffstat (limited to 'wizards/com/sun/star/wizards/web/data')
18 files changed, 1714 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/web/data/CGArgument.java b/wizards/com/sun/star/wizards/web/data/CGArgument.java new file mode 100644 index 000000000000..2ae2c70ce69c --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGArgument.java @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.ConfigGroup; + +public class CGArgument extends ConfigGroup +{ + + public String cp_Value; +} diff --git a/wizards/com/sun/star/wizards/web/data/CGContent.java b/wizards/com/sun/star/wizards/web/data/CGContent.java new file mode 100644 index 000000000000..9bf32f26ff48 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGContent.java @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.*; + +import org.w3c.dom.*; + +public class CGContent extends ConfigSetItem implements XMLProvider +{ + + public String dirName; + public String cp_Name; + public String cp_Description; + public ConfigSet cp_Contents = new ConfigSet(CGContent.class); + public ConfigSet cp_Documents = new ConfigSet(CGDocument.class); + + public CGContent() + { + /*cp_Documents = new ConfigSet(CGDocument.class) { + protected DefaultListModel createChildrenList() { + return cp_Contents.getChildrenList(); + } + };*/ + } + + public Node createDOM(Node parent) + { + + Node myElement = XMLHelper.addElement(parent, "content", + new String[] + { + "name", "directory-name", "description", "directory" + }, + new String[] + { + cp_Name, dirName, cp_Description, dirName + }); + + cp_Documents.createDOM(myElement); + + return myElement; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.java b/wizards/com/sun/star/wizards/web/data/CGDesign.java new file mode 100644 index 000000000000..00c1ea10b949 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGDesign.java @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.*; +import org.w3c.dom.Node; + +public class CGDesign extends ConfigGroup implements XMLProvider +{ + + public String cp_Layout; + public String cp_Style; + public String cp_BackgroundImage; + public String cp_IconSet; + //public int cp_OptimizeDisplay; + public boolean cp_DisplayTitle; + public boolean cp_DisplayDescription; + public boolean cp_DisplayAuthor; + public boolean cp_DisplayCreateDate; + public boolean cp_DisplayUpdateDate; + public boolean cp_DisplayFilename; + public boolean cp_DisplayFileFormat; + public boolean cp_DisplayFormatIcon; + public boolean cp_DisplayPages; + public boolean cp_DisplaySize; + public int cp_OptimizeDisplaySize; + private final String TRUE = "true"; + private final String FALSE = null; + private String styleName; + + public Node createDOM(Node parent) + { + return XMLHelper.addElement(parent, "design", new String[0], + new String[0]); + + } + private static final Short SHORT_TRUE = new Short((short) 1); + private static final Short SHORT_FALSE = new Short((short) 0); + + public short[] getStyle() + { + CGStyle style = ((CGStyle) ((CGSettings) root).cp_Styles.getElement(cp_Style)); + return new short[] + { + (short) ((CGSettings) root).cp_Styles.getIndexOf(style) + }; + } + + public void setStyle(short[] newStyle) + { + Object o = ((CGStyle) ((CGSettings) root).cp_Styles.getElementAt(newStyle[0])); + cp_Style = (String) ((CGSettings) root).cp_Styles.getKey(o); + } + + public int getLayout() + { + CGLayout layout = ((CGLayout) ((CGSettings) root).cp_Layouts.getElement(cp_Layout)); + return layout.cp_Index; + } + + public void setLayout(int layoutIndex) + { + CGLayout layout = (CGLayout) ((CGSettings) root).cp_Layouts.getElementAt(layoutIndex); + cp_Layout = (String) ((CGSettings) root).cp_Layouts.getKey(layout); + } +} + diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java new file mode 100644 index 000000000000..177355612675 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java @@ -0,0 +1,453 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import java.io.File; +import java.io.FileNotFoundException; + +import org.w3c.dom.Node; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.document.MacroExecMode; +import com.sun.star.document.UpdateDocMode; +import com.sun.star.document.XDocumentProperties; +import com.sun.star.document.XDocumentPropertiesSupplier; +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XDesktop; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.DateTime; +import com.sun.star.wizards.common.Desktop; +import com.sun.star.wizards.common.FileAccess; +import com.sun.star.wizards.common.JavaTools; +import com.sun.star.wizards.common.Properties; +import com.sun.star.wizards.common.XMLHelper; +import com.sun.star.wizards.common.XMLProvider; +import com.sun.star.wizards.document.OfficeDocument; +import com.sun.star.wizards.ui.event.Task; + +/** + * About the member fields Title, Decription and Author: + * There is an ambiguicy in handling these fields. + * On the one hand, the user can set those fields to a custom value, + * relevant only for the web-wizard. + * On the other-hand, the web-wizard can read those fields automatically + * from SO documents. + * In order to avoid conflict by saving, I use two fields: "cp_title", which + * should be read from the configuratin (saved session), and "title" which is + * the value read from the document. + * The *cp_title* "overrides" *title*, if exists. if not, *title* is used. + * The same is valid for *description* and *author*. + * @author rpiterman + */ +public class CGDocument extends ConfigSetItem implements XMLProvider +{ + + public static final int PAGE_TYPE_UNKNOWN = 0; + public static final int PAGE_TYPE_PAGE = 1; + public static final int PAGE_TYPE_SLIDE = 2; + public String cp_Title = ""; + public String cp_Description = ""; + public String cp_URL; + public String cp_Author = ""; + public String cp_Exporter; + /** + * the destination filename to which this + * document will be exported to. + */ + public String localFilename = ""; + public String urlFilename = ""; + public String title = ""; + public String description = ""; + public String author = ""; + public DateTime createDate; + public DateTime updateDate; + public int sizeBytes = -1; + public int pages = -1; + /** + * The contents subdirectory name in which the document is in. + * This subdirectory will be created in the content's "docs" + * subdirectory. + */ + public String dirName; + /** + * contains an identifier of the type of this document. + */ + public String appType; + public PropertyValue[] mediaDescriptor; + /** + * Is this document an original SO Document (different versions). + */ + public boolean isSODocument; + /** + * can this document be opend through SO? + */ + public boolean isSOOpenable; + /** + * This flag is set to true after the validate method is called. + */ + public boolean valid = false; + public String targetTypeName; + + public CGDocument() + { + } + + public CGDocument(String url, XMultiServiceFactory xmsf, Task task) throws Exception + { + cp_URL = getSettings().getFileAccess(xmsf).getURL(url); + if (task == null) + { + task = new Task("", "", 5); + } + validate(xmsf, task); + } + + /** + * the task will advance 5 times during validate. + * @param xmsf + * @param task + * @throws Exception + */ + public void validate(XMultiServiceFactory xmsf, Task task) + throws FileNotFoundException, + IllegalArgumentException, + Exception + { + + if (!getSettings().getFileAccess(xmsf).exists(cp_URL, false)) + { + throw new FileNotFoundException("The given URL does not point to a file"); + } + if (getSettings().getFileAccess(xmsf).isDirectory(cp_URL)) + { + throw new IllegalArgumentException("The given URL points to a directory"); //create a TypeDetection service + } + mediaDescriptor = OfficeDocument.getFileMediaDecriptor(xmsf, cp_URL); + + task.advance(true); //1 + + //System.out.println(Properties.getPropertyValue(mediaDescriptor,"UIName")); + + analyzeFileType(mediaDescriptor); + + task.advance(true); //2 + + String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, ""); + localFilename = FileAccess.getFilename(path, File.separator); + + /* if the type is a star office convertable document + * We try to open the document to get some properties + */ + + XDocumentProperties xProps = null; + + task.advance(true); //3 + + if (isSOOpenable) + { // for documents which are openable through SO, use DocumentProperties service. + XDesktop desktop = Desktop.getDesktop(xmsf); + PropertyValue[] props = new PropertyValue[3]; + props[0] = Properties.createProperty("Hidden", Boolean.TRUE); + props[1] = Properties.createProperty("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE)); + props[2] = Properties.createProperty("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE)); + XComponent component = ((XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop)).loadComponentFromURL(cp_URL, "_default", 0, props); + xProps = ((XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, component)).getDocumentProperties(); + } + + task.advance(true); //4 + + //now use the object to read some document properties. + if (xProps != null) + { + title = xProps.getTitle(); + description = xProps.getDescription(); + author = xProps.getAuthor(); + createDate = xProps.getCreationDate(); + updateDate = xProps.getModificationDate(); + } + else + { //get some information from OS. + title = localFilename; + updateDate = getSettings().getFileAccess(xmsf).getLastModified(cp_URL); + } + + task.advance(true); //5 + + valid = true; + + if (cp_Title.equals("")) + { + cp_Title = title; + } + if (cp_Title.equals("")) + { + cp_Title = localFilename; + } + if (cp_Description.equals("")) + { + cp_Description = description; + } + if (cp_Author.equals("")) + { + cp_Author = author; + } + if (cp_Exporter == null || cp_Exporter.equals("")) + { + cp_Exporter = (String) getSettings().cp_Exporters.getKey( + getSettings().getExporters(appType)[0]); + } + } + + /** + * Analyzes a type-detection string, returned from the TypeDetection service, + * and sets the appType, isSOOpenable and isSODocument members. + */ + private void analyzeFileType(PropertyValue[] mediaDesc) + { + + if (mediaDesc == null) + { + } + + String media = (mediaDesc == null) + ? "" : (String) Properties.getPropertyValue(mediaDescriptor, "Name"); + appType = getDocType(media); + + //System.out.println(appType); + + isSOOpenable = + (appType == TypeDetection.WRITER_DOC || appType == TypeDetection.CALC_DOC || appType == TypeDetection.IMPRESS_DOC || appType == TypeDetection.DRAW_DOC) || appType == TypeDetection.HTML_DOC; + +// String[] parts = media.split("_"); // line removed because of compatibility to JDK13 + String[] parts = JavaTools.ArrayoutofString(media, "_"); + + + isSODocument = parts.length < 2 ? false : isSOOpenable && (parts[1].startsWith("Star")); + + } + + /** + * @param media is the media description string returned by an UNO TypeDetection object. + * @return one of the constants in the interface TypeDetection. + * + */ + private String getDocType(String media) + { + if (media.equals("")) + { + return TypeDetection.NO_TYPE; + } + if (media.startsWith("writer")) + { + if (media.startsWith("writer_web_HTML")) + { + return TypeDetection.HTML_DOC; + } + else + { + return TypeDetection.WRITER_DOC; + } + } + else if (media.startsWith("calc")) + { + return TypeDetection.CALC_DOC; + } + else if (media.startsWith("draw")) + { + return TypeDetection.DRAW_DOC; + } + else if (media.startsWith("impress")) + { + return TypeDetection.IMPRESS_DOC; + } + else if (media.startsWith("pdf")) + { + return TypeDetection.PDF_DOC; + } + else if (media.startsWith("gif") || media.startsWith("jpg")) + { + return TypeDetection.WEB_GRAPHICS; + } + else if (media.startsWith("wav")) + { + return TypeDetection.SOUND_FILE; + } + else + { + return TypeDetection.NO_TYPE; + } + } + + public Node createDOM(Node parent) + { + CGDesign d = getSettings().cp_DefaultSession.cp_Design; + CGExporter exp = (CGExporter) getSettings().cp_Exporters.getElement(cp_Exporter); + + return XMLHelper.addElement(parent, "document", + new String[] + { + "title", "description", "author", "format", "filename", "create-date", "update-date", "pages", "size", "icon", "dir", "fn" + }, + new String[] + { + d.cp_DisplayTitle ? cp_Title : "", + d.cp_DisplayDescription ? cp_Description : "", + d.cp_DisplayAuthor ? cp_Author : "", + d.cp_DisplayFileFormat ? getTargetTypeName(exp) : "", + d.cp_DisplayFilename ? localFilename : "", + d.cp_DisplayCreateDate ? createDate() : "", + d.cp_DisplayUpdateDate ? updateDate() : "", + d.cp_DisplayPages && (pages > -1) ? "" + pages() : "", //TODO when do i calculate pages? + d.cp_DisplaySize ? sizeKB() : "",//TODO when do i calculate size? + d.cp_DisplayFormatIcon ? getIcon(exp) : "", + dirName, urlFilename + }); + } + + private String updateDate() + { + if (this.updateDate == null) + { + return ""; + } + return getSettings().formatter.formatCreated(this.updateDate); + } + + private String createDate() + { + if (this.createDate == null) + { + return ""; + } + return getSettings().formatter.formatCreated(this.createDate); + } + + private String sizeKB() + { + if (sizeBytes == -1) + { + return ""; + } + else + { + return getSettings().formatter.formatFileSize(sizeBytes); + } + } + + private String pages() + { + return pages == -1 ? "" + : JavaTools.replaceSubString(pagesTemplate(), "" + pages, "%NUMBER"); + } + + private String pagesTemplate() + { + int pagesType = ((CGExporter) getSettings().cp_Exporters.getElement(cp_Exporter)).cp_PageType; + switch (pagesType) + { + case PAGE_TYPE_UNKNOWN: + return ""; + case PAGE_TYPE_PAGE: + return getSettings().resources[CGSettings.RESOURCE_PAGES_TEMPLATE]; + case PAGE_TYPE_SLIDE: + return getSettings().resources[CGSettings.RESOURCE_SLIDES_TEMPLATE]; + default: + return ""; + } + } + + private String getTargetTypeName(CGExporter exp) + { + return (exp.targetTypeName.equals("")) + ? (String) Properties.getPropertyValue(mediaDescriptor, "UIName") + : exp.targetTypeName; + } + + private String getIcon(CGExporter exporter) + { + return exporter.cp_Icon.equals("") ? getIcon(this.appType) : exporter.cp_Icon; + } + + private String getIcon(String appType) + { + //System.out.println("Getting Icon for: " + appType); + return appType + ".gif"; + } + + /** + * This method is used by the DataAware model + * and returns the index of the exporter of + * this document, <b>in the list of the + * exporters available for this type of document</b> + * @return + */ + public short[] getExporter() + { + return new short[] + { + getExporterIndex() + }; + } + + /** + * @see getExporter() + */ + public void setExporter(short[] exporter_) + { + Object exp = getSettings().getExporters(appType)[exporter_[0]]; + cp_Exporter = (String) getSettings().cp_Exporters.getKey(exp); + } + + /** + * @see getExporter() + * @return + */ + private short getExporterIndex() + { + if (cp_Exporter == null) + { + return 0; + } + Object exporter = getSettings().cp_Exporters.getElement(cp_Exporter); + Object[] exporters = getSettings().getExporters(appType); + for (short i = 0; i < exporters.length; i++) + { + if (exporters[i] == exporter) + { + return i; + } + } + return -1; + } + + public String toString() + { + return localFilename; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.java b/wizards/com/sun/star/wizards/web/data/CGExporter.java new file mode 100644 index 000000000000..c23073fbed01 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGExporter.java @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.ConfigSet; + +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 = ""; + public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class); + + public String toString() + { + return cp_Name; + } + + public boolean supports(String mime) + { + return (cp_SupportedMimeTypes.equals("") || cp_SupportedMimeTypes.indexOf(mime) > -1); + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGFilter.java b/wizards/com/sun/star/wizards/web/data/CGFilter.java new file mode 100644 index 000000000000..dc4f41df746b --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGFilter.java @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +public class CGFilter extends ConfigSetItem +{ + + public String cp_Name; + //public boolean cp_Readonly; + public String cp_Filter; +} diff --git a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java new file mode 100644 index 000000000000..c12d4c92f535 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.util.DateTime; +import com.sun.star.wizards.common.*; +import org.w3c.dom.Node; + +public class CGGeneralInfo extends ConfigGroup implements XMLProvider +{ + + public String cp_Title; + public String cp_Description; + public String cp_Author; + public int cp_CreationDate; + public int cp_UpdateDate; + public String cp_Email; + public String cp_Copyright; + + public Node createDOM(Node parent) + { + return XMLHelper.addElement(parent, "general-info", + new String[] + { + "title", "author", "description", "creation-date", "update-date", "email", "copyright" + }, + new String[] + { + cp_Title, cp_Author, cp_Description, String.valueOf(cp_CreationDate), String.valueOf(cp_UpdateDate), cp_Email, cp_Copyright + }); + } + + public Integer getCreationDate() + { + if (cp_CreationDate == 0) + { + cp_CreationDate = currentDate(); + } + return new Integer(cp_CreationDate); + } + + public Integer getUpdateDate() + { + if (cp_UpdateDate == 0) + { + cp_UpdateDate = currentDate(); + } + return new Integer(cp_UpdateDate); + } + + public void setCreationDate(Integer i) + { + //System.out.println(i); + cp_CreationDate = i.intValue(); + } + + public void setUpdateDate(Integer i) + { + cp_UpdateDate = i.intValue(); + } + + private int currentDate() + { + DateTime dt = JavaTools.getDateTime(System.currentTimeMillis()); + //System.out.println(); + return dt.Day + dt.Month * 100 + dt.Year * 10000; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGIconSet.java b/wizards/com/sun/star/wizards/web/data/CGIconSet.java new file mode 100644 index 000000000000..197c6c3e44b5 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGIconSet.java @@ -0,0 +1,35 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +public class CGIconSet extends ConfigSetItem +{ + + public String cp_FNPrefix; + public String cp_FNPostfix; + public String cp_Name; +} diff --git a/wizards/com/sun/star/wizards/web/data/CGImage.java b/wizards/com/sun/star/wizards/web/data/CGImage.java new file mode 100644 index 000000000000..e6d459bf48d5 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGImage.java @@ -0,0 +1,45 @@ +/* + ************************************************************************ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* + * IconSet.java + * + * Created on 12. September 2003, 17:16 + */ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.ConfigGroup; + +/** + * + * @author rpiterman + */ +public class CGImage extends ConfigGroup +{ + + public String cp_Href; +} diff --git a/wizards/com/sun/star/wizards/web/data/CGLayout.java b/wizards/com/sun/star/wizards/web/data/CGLayout.java new file mode 100644 index 000000000000..9d9557c1615a --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGLayout.java @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.ui.UIConsts; +import java.util.Hashtable; +import java.util.Map; + +import javax.xml.transform.*; +import javax.xml.transform.stream.StreamSource; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.wizards.common.FileAccess; + +public class CGLayout extends ConfigSetItem +{ + + public String cp_Name; + public String cp_FSName; + private Map templates; + + private void createTemplates(XMultiServiceFactory xmsf) throws Exception + { + + templates = new Hashtable(3); + + TransformerFactory tf = TransformerFactory.newInstance(); + + String workPath = getSettings().workPath; + FileAccess fa = new FileAccess(xmsf); + String stylesheetPath = fa.getURL(getSettings().workPath, "layouts/" + cp_FSName); + + String[] files = fa.listFiles(stylesheetPath, false); + + for (int i = 0; i < files.length; i++) + { + if (FileAccess.getExtension(files[i]).equals("xsl")) + { + templates.put(FileAccess.getFilename(files[i]), tf.newTemplates(new StreamSource(files[i]))); + } + } + } + + public Object[] getImageUrls() + { + Object[] sRetUrls = new Object[1]; + int ResId = UIConsts.RID_IMG_WEB + (cp_Index * 2); + return new Integer[] + { + new Integer(ResId), new Integer(ResId + 1) + }; + } + + public Map getTemplates(XMultiServiceFactory xmsf) throws Exception + { + + // TODO uncomment... + // if (templates==null) + createTemplates(xmsf); + + return templates; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.java b/wizards/com/sun/star/wizards/web/data/CGPublish.java new file mode 100644 index 000000000000..1a3746a3873d --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGPublish.java @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.ConfigGroup; + +/** + * + * A Class which describes the publishing arguments + * in a session. + * Each session can contain different publishers, which are configured + * through such a CGPublish object. + */ +public class CGPublish extends ConfigGroup +{ + + public boolean cp_Publish; + public String cp_URL; + public String cp_Username; + public String password; + /** + * cp_URL is the url given by the user + * for this publisher. (in UCB URL form) + * This one will be edited to result the "url" + * field, which is the true url, ucb uses to publish. + * It is used for example to add ftp username and password, or zip url + */ + public String url; + /** + * if the user approved overwriting files in this publisher target + */ + public boolean overwriteApproved; + + /** + * here I get an URL from user input, and parse it to + * a UCB url... + * @param url + */ + public void setURL(String path) + { + try + { + this.cp_URL = ((CGSettings) this.root).getFileAccess().getURL(path); + overwriteApproved = false; + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + public String getURL() + { + try + { + return ((CGSettings) this.root).getFileAccess().getPath(cp_URL, null); + } + catch (Exception e) + { + e.printStackTrace(); + return ""; + } + } + + private String ftpURL() + { + return "ftp://" + cp_Username + + ((password != null && password.length() > 0) ? ":" + password : "") + "@" + cp_URL.substring(7); + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.java b/wizards/com/sun/star/wizards/web/data/CGSession.java new file mode 100644 index 000000000000..3acd570b7878 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGSession.java @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import com.sun.star.wizards.common.*; + +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +public class CGSession extends ConfigSetItem implements XMLProvider +{ + + public String cp_InDirectory; + public String cp_OutDirectory; + public String cp_Name; + public CGContent cp_Content = new CGContent(); + public CGDesign cp_Design = new CGDesign(); + public CGGeneralInfo cp_GeneralInfo = new CGGeneralInfo(); + public ConfigSet cp_Publishing = new ConfigSet(CGPublish.class); + public CGStyle style; // !!! + public boolean valid = false; + + public Node createDOM(Node parent) + { + Node root = XMLHelper.addElement(parent, "session", + new String[] + { + "name", "screen-size" + }, + new String[] + { + cp_Name, getScreenSize() + }); + + //cp_Design.createDOM(root); + cp_GeneralInfo.createDOM(root); + //cp_Publishing.createDOM(root); + cp_Content.createDOM(root); + + return root; + } + + private String getScreenSize() + { + switch (cp_Design.cp_OptimizeDisplaySize) + { + case 0: + return "640"; + case 1: + return "800"; + case 2: + return "1024"; + default: + return "800"; + } + } + + public CGLayout getLayout() + { + return (CGLayout) ((CGSettings) root).cp_Layouts.getElement(cp_Design.cp_Layout); + } + + public CGStyle getStyle() + { + return (CGStyle) ((CGSettings) root).cp_Styles.getElement(cp_Design.cp_Style); + } + + public void setLayout(short[] layout) + { + //dummy + } + + public Node createDOM() + throws ParserConfigurationException + { + + DocumentBuilderFactory factory = + DocumentBuilderFactory.newInstance(); + Document doc = factory.newDocumentBuilder().newDocument(); + createDOM(doc); + return doc; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGSessionName.java b/wizards/com/sun/star/wizards/web/data/CGSessionName.java new file mode 100644 index 000000000000..77cde79a8ca2 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGSessionName.java @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +public class CGSessionName extends ConfigSetItem +{ + + public String cp_Name; + + public String toString() + { + return cp_Name; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java new file mode 100644 index 000000000000..ecc538b9fa83 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java @@ -0,0 +1,212 @@ +/* + ************************************************************************ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* + * IconSet.java + * + * Created on 12. September 2003, 17:16 + */ +package com.sun.star.wizards.web.data; + +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.NoSuchElementException; +import com.sun.star.container.XNameAccess; +import com.sun.star.i18n.NumberFormatIndex; +import com.sun.star.lang.WrappedTargetException; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.DateTime; +import com.sun.star.wizards.common.*; +import com.sun.star.wizards.common.Helper.DateUtils; + +/** + * @author rpiterman + */ +public class CGSettings extends ConfigGroup +{ + + public String soTemplateDir; + public String soGalleryDir; + public String workPath = null; + public String cp_WorkDir; + public ConfigSet cp_Exporters = new ConfigSet(CGExporter.class); + public ConfigSet cp_Layouts = new ConfigSet(CGLayout.class); + public ConfigSet cp_Styles = new ConfigSet(CGStyle.class); + public ConfigSet cp_IconSets = new ConfigSet(CGIconSet.class); + public ConfigSet cp_BackgroundImages = new ConfigSet(CGImage.class); + public ConfigSet cp_SavedSessions = new ConfigSet(CGSessionName.class); + public ConfigSet cp_Filters = new ConfigSet(CGFilter.class); + public ConfigSet savedSessions = new ConfigSet(CGSessionName.class); + public CGSession cp_DefaultSession = new CGSession(); + public String cp_LastSavedSession; + private Map exportersMap = new Hashtable(); + private XMultiServiceFactory xmsf; + String[] resources; + public Formatter formatter; + public static final int RESOURCE_PAGES_TEMPLATE = 0; + public static final int RESOURCE_SLIDES_TEMPLATE = 1; + public static final int RESOURCE_CREATED_TEMPLATE = 2; + public static final int RESOURCE_UPDATED_TEMPLATE = 3; + public static final int RESOURCE_SIZE_TEMPLATE = 4; + + public CGSettings(XMultiServiceFactory xmsf_, String[] resources_, Object document) + { + xmsf = xmsf_; + try + { + soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", "", ""); + soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", ""); + root = this; + formatter = new Formatter(xmsf, document); + resources = resources_; + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + private static final CGExporter[] EMPTY_ARRAY_1 = new CGExporter[0]; + + public CGExporter[] getExporters(String mime) + { + CGExporter[] exps = (CGExporter[]) exportersMap.get(mime); + if (exps == null) + { + exportersMap.put(mime, exps = createExporters(mime)); + } + return exps; + } + + private CGExporter[] createExporters(String mime) + { + Object[] exporters = cp_Exporters.items(); + Vector v = new Vector(); + for (int i = 0; i < exporters.length; i++) + { + if (((CGExporter) exporters[i]).supports(mime)) + { + try + { + v.add(exporters[i]); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + } + return (CGExporter[]) v.toArray(EMPTY_ARRAY_1); + } + + /** + * call after read. + * @param xmsf + * @param document the background document. used for date/number formatting. + */ + public void configure(XMultiServiceFactory xmsf) throws Exception + { + workPath = FileAccess.connectURLs(soTemplateDir, cp_WorkDir); + calcExportersTargetTypeNames(xmsf); + } + + private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception + { + Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection"); + XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect); + for (int i = 0; i < cp_Exporters.getSize(); i++) + { + calcExporterTargetTypeName(xNameAccess, (CGExporter) cp_Exporters.getElementAt(i)); + } + } + + private void calcExporterTargetTypeName(XNameAccess xNameAccess, CGExporter exporter) + throws NoSuchElementException, + WrappedTargetException + { + if (!exporter.cp_TargetType.equals("")) + { + exporter.targetTypeName = + (String) Properties.getPropertyValue( + (PropertyValue[]) xNameAccess.getByName(exporter.cp_TargetType), + "UIName"); + } + } + FileAccess fileAccess; + + FileAccess getFileAccess() throws Exception + { + return getFileAccess(xmsf); + } + + FileAccess getFileAccess(XMultiServiceFactory xmsf) throws Exception + { + if (fileAccess == null) + { + fileAccess = new FileAccess(xmsf); + } + return fileAccess; + } + + public class Formatter + { + + private long docNullTime; + private int dateFormat, numberFormat; + private DateUtils dateUtils; + + public Formatter(XMultiServiceFactory xmsf, Object document) throws Exception + { + dateUtils = new DateUtils(xmsf, document); + dateFormat = dateUtils.getFormat(NumberFormatIndex.DATE_SYS_DMMMYYYY); + numberFormat = dateUtils.getFormat(NumberFormatIndex.NUMBER_1000DEC2); + } + + public String formatCreated(DateTime date) + { + String sDate = dateUtils.format(dateFormat, date); + return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_CREATED_TEMPLATE], sDate, "%DATE"); + } + + public String formatUpdated(DateTime date) + { + String sDate = dateUtils.format(dateFormat, date); + return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_UPDATED_TEMPLATE], sDate, "%DATE"); + } + + public String formatFileSize(int size) + { + float sizeInKB = ((float) size) / 1024f; + String sSize = dateUtils.getFormatter().convertNumberToString(numberFormat, sizeInKB); + return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_SIZE_TEMPLATE], sSize, "%NUMBER"); + } + } +} diff --git a/wizards/com/sun/star/wizards/web/data/CGStyle.java b/wizards/com/sun/star/wizards/web/data/CGStyle.java new file mode 100644 index 000000000000..e6258d8c5fe1 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/CGStyle.java @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.wizards.web.data; + +public class CGStyle extends ConfigSetItem +{ + + public String cp_Name; + //public boolean cp_Readonly; + public String cp_CssHref; + public String cp_BackgroundImage; + public String cp_IconSet; + + public String toString() + { + return cp_Name; + } + + public String getBackgroundUrl() + { + if (cp_BackgroundImage == null || cp_BackgroundImage.equals("")) + { + return null; + } + else + { + return cp_BackgroundImage; + } + } +} diff --git a/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java b/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java new file mode 100644 index 000000000000..06c11a06178e --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java @@ -0,0 +1,55 @@ +/* + ************************************************************************ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +/* + * SetItem.java + * + * Created on 16. September 2003, 12:29 + */ +package com.sun.star.wizards.web.data; + +import com.sun.star.wizards.common.*; + +/** + * + * @author rpiterman + */ +public class ConfigSetItem extends ConfigGroup implements Indexable +{ + + public int cp_Index = -1; + + public int getIndex() + { + return cp_Index; + } + + public CGSettings getSettings() + { + return (CGSettings) root; + } +} diff --git a/wizards/com/sun/star/wizards/web/data/TypeDetection.java b/wizards/com/sun/star/wizards/web/data/TypeDetection.java new file mode 100644 index 000000000000..d6998ac74814 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/TypeDetection.java @@ -0,0 +1,79 @@ +/* + ************************************************************************ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/* + * FileTypes.java + * + * Created on 29. September 2003, 18:52 + */ +package com.sun.star.wizards.web.data; + +/** + * + * @author rpiterman + */ +public class TypeDetection +{ + + /** + * a document which will open in writer. + */ + public final static String WRITER_DOC = "writer"; + /** + * a document which will open in calc. + */ + public final static String CALC_DOC = "calc"; + /** + * a document which will open in impress. + */ + public final static String IMPRESS_DOC = "impress"; + /** + * a document which will open in draw. + */ + public final static String DRAW_DOC = "draw"; + /** + * an HTML document + */ + public final static String HTML_DOC = "html"; + /** + * a GIF or an JPG file. + */ + public final static String WEB_GRAPHICS = "graphics"; + /** + * a PDF document. + */ + public final static String PDF_DOC = "pdf"; + /** + * a Sound file (mp3/wav ect.) + */ + public final static String SOUND_FILE = "sound"; + /** + * a File which can not be handled by neither SO or a Web browser (exe, jar, zip ect.) + */ + public final static String NO_TYPE = "other"; +} diff --git a/wizards/com/sun/star/wizards/web/data/makefile.mk b/wizards/com/sun/star/wizards/web/data/makefile.mk new file mode 100644 index 000000000000..1bfc02cf8351 --- /dev/null +++ b/wizards/com/sun/star/wizards/web/data/makefile.mk @@ -0,0 +1,74 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ = ..$/..$/..$/..$/..$/.. +PRJNAME = wizards +TARGET = web_data +PACKAGE = com$/sun$/star$/wizards$/web$/data + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +#.INCLUDE : $(PRJ)$/util$/makefile.pmk +JARFILES= unoil.jar jurt.jar ridl.jar juh.jar jut.jar java_uno.jar java_uno_accessbridge commonwizards.jar + +.IF "$(SYSTEM_SAXON)" == "YES" +EXTRAJARFILES = $(SAXON_JAR) +.ELSE +JARFILES += saxon9.jar +.ENDIF + +#JARCLASSDIRS = com$/sun$/star$/wizards$/web +#JARTARGET = $(TARGET).jar + +# --- Files -------------------------------------------------------- + +JAVAFILES= \ + CGArgument.java \ + CGContent.java \ + CGDesign.java \ + CGDocument.java \ + CGExporter.java \ + CGFilter.java \ + CGGeneralInfo.java \ + CGIconSet.java \ + CGImage.java \ + CGLayout.java \ + CGPublish.java \ + CGSession.java \ + CGSessionName.java \ + CGSettings.java \ + CGStyle.java \ + ConfigSetItem.java \ + TypeDetection.java + +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk |