summaryrefslogtreecommitdiff
path: root/reportbuilder/java/org/libreoffice/report/pentaho/parser
diff options
context:
space:
mode:
Diffstat (limited to 'reportbuilder/java/org/libreoffice/report/pentaho/parser')
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/AttributeSpecification.java48
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/ElementReadHandler.java81
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java41
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeParserUtil.java182
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeStylesXmlResourceFactory.java49
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/StarStyleXmlFactoryModule.java53
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/StarXmlFactoryModule.java53
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java29
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/chart/ChartReadHandler.java99
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/data/DataStyleReadHandler.java121
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/draw/ObjectOleReadHandler.java75
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/office/BodyReadHandler.java82
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentContentReadHandler.java227
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentStylesReadHandler.java96
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/office/FontFaceDeclsReadHandler.java107
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/office/MasterStylesReadHandler.java113
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt-schema-v1.0-os.xsd405
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java71
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/DetailRootTableReadHandler.java29
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FixedContentReadHandler.java88
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormatConditionReadHandler.java90
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormattedTextReadHandler.java108
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FunctionReadHandler.java106
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupReadHandler.java172
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupSectionReadHandler.java29
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ImageReadHandler.java131
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/MasterDetailReadHandler.java96
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportElementReadHandler.java100
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportReadHandler.java232
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/RootTableReadHandler.java96
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/SubDocumentReadHandler.java124
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/selectors.properties104
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style-mapping.txt8
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style/FontFaceReadHandler.java46
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style/MasterPageReadHandler.java95
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStyleReadHandler.java96
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStylesReadHandler.java130
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style/PageLayoutReadHandler.java94
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/style/StyleDefinitionReadHandler.java90
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java68
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java36
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java41
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java34
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/ColorMapper.java43
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java37
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java37
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java37
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java38
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java56
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java56
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontNameMapper.java40
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontPitchMapper.java34
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontReliefMapper.java37
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java36
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java45
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java40
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java67
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java34
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java38
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java43
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/RowHeightMapper.java43
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/CoveredCellReadHandler.java44
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableCellReadHandler.java36
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnReadHandler.java43
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnsReadHandler.java93
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableReadHandler.java135
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowReadHandler.java116
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowsReadHandler.java89
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/text/NoCDATATextContentReadHandler.java182
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/text/TextContentReadHandler.java60
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/parser/xlink/XLinkReadHandler.java87
71 files changed, 5821 insertions, 0 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/AttributeSpecification.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/AttributeSpecification.java
new file mode 100644
index 000000000000..937f7a40591c
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/AttributeSpecification.java
@@ -0,0 +1,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 org.libreoffice.report.pentaho.parser;
+
+public final class AttributeSpecification
+{
+
+ private final String namespaceUrl;
+ private final String attributName;
+ private final String mapperImplementation;
+
+ public AttributeSpecification(String namespaceUrl, String attributName, String mapperImplementation)
+ {
+ this.namespaceUrl = namespaceUrl;
+ this.attributName = attributName;
+ this.mapperImplementation = mapperImplementation;
+ }
+
+ public String getAttributName()
+ {
+ return attributName;
+ }
+
+ public String getMapperImplementation()
+ {
+ return mapperImplementation;
+ }
+
+ public String getNamespaceUrl()
+ {
+ return namespaceUrl;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/ElementReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/ElementReadHandler.java
new file mode 100644
index 000000000000..c311f45d1390
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/ElementReadHandler.java
@@ -0,0 +1,81 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 03.07.2006, 14:22:34
+ *
+ */
+public abstract class ElementReadHandler extends AbstractXmlReadHandler
+{
+
+ public ElementReadHandler()
+ {
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ final Element element = getElement();
+ copyElementType(element);
+ copyAttributes(attrs, element);
+ }
+
+ protected void copyElementType(final Element element)
+ {
+ element.setType(getTagName());
+ element.setNamespace(getUri());
+ }
+
+ protected void copyAttributes(final Attributes attrs, final Element element)
+ {
+ final int length = attrs.getLength();
+ for (int i = 0; i < length; i++)
+ {
+ final String value = attrs.getValue(i);
+ final String namespace = attrs.getURI(i);
+ final String attr = attrs.getLocalName(i);
+ element.setAttribute(namespace, attr, value);
+ }
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Object getObject() throws SAXException
+ {
+ return getElement();
+ }
+
+ public abstract Element getElement();
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java
new file mode 100644
index 000000000000..edcb56cb9f71
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeDocumentXmlResourceFactory.java
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import org.libreoffice.report.pentaho.model.OfficeDocument;
+
+import org.jfree.report.modules.factories.report.base.JFreeReportXmlResourceFactory;
+
+/**
+ * A LibLoader resource factory for OfficeDocument objects. OfficeDocuments are
+ * JFreeReport instances which have some additional properties.
+ *
+ * @since 09.03.2007
+ */
+public class OfficeDocumentXmlResourceFactory extends JFreeReportXmlResourceFactory
+{
+
+ public OfficeDocumentXmlResourceFactory()
+ {
+ }
+
+ public Class getFactoryType()
+ {
+ return OfficeDocument.class;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeParserUtil.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeParserUtil.java
new file mode 100644
index 000000000000..9cc91f22b6d3
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeParserUtil.java
@@ -0,0 +1,182 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jfree.layouting.namespace.NamespaceDefinition;
+import org.jfree.layouting.namespace.Namespaces;
+import org.jfree.report.JFreeReportBoot;
+
+import org.pentaho.reporting.libraries.base.config.DefaultConfiguration;
+import org.pentaho.reporting.libraries.resourceloader.Resource;
+import org.pentaho.reporting.libraries.resourceloader.ResourceException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+
+
+public class OfficeParserUtil
+{
+
+ private static final Log LOGGER = LogFactory.getLog(OfficeParserUtil.class);
+ private static OfficeParserUtil instance;
+ private static final String NAMESPACES_PREFIX = "namespaces.";
+
+ public static synchronized OfficeParserUtil getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new OfficeParserUtil();
+ }
+ return instance;
+ }
+ private final DefaultConfiguration props;
+ private final NamespaceDefinition[] namespaces;
+
+ private OfficeParserUtil()
+ {
+ props = new DefaultConfiguration();
+
+ final ResourceManager resourceManager = new ResourceManager();
+ resourceManager.registerDefaults();
+ try
+ {
+ final Resource res = resourceManager.createDirectly("res://org/libreoffice/report/pentaho/parser/selectors.properties", Properties.class);
+ final Properties resProps = (Properties) res.getResource();
+ props.putAll(resProps);
+ }
+ catch (ResourceException e)
+ {
+ LOGGER.warn("Unable to load mapping rules. Parsing services may not be available.", e);
+ }
+
+ namespaces = Namespaces.createFromConfig(JFreeReportBoot.getInstance().getGlobalConfig(),
+ "org.jfree.report.namespaces.", resourceManager);
+ }
+
+ public NamespaceDefinition getNamespaceDeclaration(final String uri)
+ {
+ if (uri == null)
+ {
+ throw new NullPointerException("URI must not be null");
+ }
+
+ for (int i = 0; i < namespaces.length; i++)
+ {
+ final NamespaceDefinition definition = namespaces[i];
+ if (uri.equals(definition.getURI()))
+ {
+ return definition;
+ }
+ }
+ return null;
+ }
+
+ public String getGenericFont(final String officeFont)
+ {
+ return props.getProperty("font-family." + officeFont.toLowerCase(), officeFont);
+ }
+
+ public String getNamespaceURI(final String namespacePrefix)
+ {
+ return props.getProperty(NAMESPACES_PREFIX + namespacePrefix);
+ }
+
+ public String getNamespaceForStyleFamily(final String styleFamily)
+ {
+ return props.getProperty("style-family." + styleFamily);
+ }
+
+ public Map<String,String> getNamespaces()
+ {
+ final Map<String,String> map = new HashMap<String,String>();
+ final Iterator keys = props.findPropertyKeys(NAMESPACES_PREFIX);
+ while (keys.hasNext())
+ {
+ final String key = (String) keys.next();
+ final String value = props.getConfigProperty(key);
+ map.put(key.substring(NAMESPACES_PREFIX.length()), value);
+ }
+ return map;
+ }
+
+ public String getNamespacePrefix(final String namespaceURI)
+ {
+ final Iterator keys = props.findPropertyKeys(NAMESPACES_PREFIX);
+ while (keys.hasNext())
+ {
+ final String key = (String) keys.next();
+ final String value = props.getConfigProperty(key);
+ if (namespaceURI.equals(value))
+ {
+ return key.substring(NAMESPACES_PREFIX.length());
+ }
+ }
+ return null;
+ }
+
+ public AttributeSpecification parseStyleAttrDefinition(final String key, final String prefix, final String tagname)
+ {
+ final String configPrefix = "attr." + prefix + "." + tagname + ".";
+ final String configSuffix = key.substring(configPrefix.length());
+ final int dotPosition = configSuffix.indexOf('.');
+ if (dotPosition == -1)
+ {
+ return null;
+ }
+ final String namespaceUri = getNamespaceURI(configSuffix.substring(0, dotPosition));
+ final String attrName = configSuffix.substring(dotPosition + 1);
+ final String value = props.getProperty(key);
+ return new AttributeSpecification(namespaceUri, attrName, value);
+ }
+
+ public Iterator findStylesForElement(final String prefix,
+ final String tagname)
+ {
+ final String configPrefix = "attr." + prefix + "." + tagname + ".";
+ return props.findPropertyKeys(configPrefix);
+ }
+
+ public boolean isValidStyleElement(final String uri, final String tagName)
+ {
+ final String prefix = getNamespacePrefix(uri);
+ if (prefix == null)
+ {
+ return false;
+ }
+
+ final Iterator stylesForElement = findStylesForElement(prefix, tagName);
+ return stylesForElement.hasNext();
+ }
+
+ public String getSelectorPattern()
+ {
+ return props.getConfigProperty("style-selector.pattern");
+ }
+
+ public static void main(final String[] args)
+ {
+ JFreeReportBoot.getInstance().start();
+ System.out.print(OfficeParserUtil.getInstance().getNamespaces());
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeStylesXmlResourceFactory.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeStylesXmlResourceFactory.java
new file mode 100644
index 000000000000..18267f21382f
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/OfficeStylesXmlResourceFactory.java
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import org.libreoffice.report.pentaho.model.OfficeStylesCollection;
+
+import org.jfree.report.JFreeReportBoot;
+
+import org.pentaho.reporting.libraries.base.config.Configuration;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlResourceFactory;
+
+/**
+ * A LibLoader resource factory for loading an OfficeStyles-collection. This
+ * implementation is meant to parse the 'styles.xml' file.
+ *
+ * @since 09.03.2007
+ */
+public class OfficeStylesXmlResourceFactory extends AbstractXmlResourceFactory
+{
+
+ public OfficeStylesXmlResourceFactory()
+ {
+ }
+
+ protected Configuration getConfiguration()
+ {
+ return JFreeReportBoot.getInstance().getGlobalConfig();
+ }
+
+ public Class getFactoryType()
+ {
+ return OfficeStylesCollection.class;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/StarStyleXmlFactoryModule.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StarStyleXmlFactoryModule.java
new file mode 100644
index 000000000000..bf793e1d8acf
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StarStyleXmlFactoryModule.java
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.office.DocumentStylesReadHandler;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+public class StarStyleXmlFactoryModule implements XmlFactoryModule
+{
+
+ public StarStyleXmlFactoryModule()
+ {
+ }
+
+ public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo)
+ {
+ return new DocumentStylesReadHandler();
+ }
+
+ public int getDocumentSupport(final XmlDocumentInfo documentInfo)
+ {
+ final String rootNamespace = documentInfo.getRootElementNameSpace();
+ if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && "document-styles".equals(documentInfo.getRootElement()))
+ {
+ return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE;
+ }
+ return XmlFactoryModule.NOT_RECOGNIZED;
+ }
+
+ public String getDefaultNamespace(final XmlDocumentInfo documentInfo)
+ {
+ return null;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/StarXmlFactoryModule.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StarXmlFactoryModule.java
new file mode 100644
index 000000000000..78f0633f0956
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StarXmlFactoryModule.java
@@ -0,0 +1,53 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.office.DocumentContentReadHandler;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlDocumentInfo;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlFactoryModule;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+public class StarXmlFactoryModule implements XmlFactoryModule
+{
+
+ public StarXmlFactoryModule()
+ {
+ }
+
+ public XmlReadHandler createReadHandler(final XmlDocumentInfo documentInfo)
+ {
+ return new DocumentContentReadHandler();
+ }
+
+ public int getDocumentSupport(final XmlDocumentInfo documentInfo)
+ {
+ final String rootNamespace = documentInfo.getRootElementNameSpace();
+ if (OfficeNamespaces.OFFICE_NS.equals(rootNamespace) && ("document-content".equals(documentInfo.getRootElement()) || "document".equals(documentInfo.getRootElement())))
+ {
+ return XmlFactoryModule.RECOGNIZED_BY_NAMESPACE;
+ }
+ return XmlFactoryModule.NOT_RECOGNIZED;
+ }
+
+ public String getDefaultNamespace(final XmlDocumentInfo documentInfo)
+ {
+ return null;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java
new file mode 100644
index 000000000000..a248ce5a4ce1
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/StyleMapper.java
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+
+public interface StyleMapper
+{
+
+ void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule);
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/chart/ChartReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/chart/ChartReadHandler.java
new file mode 100644
index 000000000000..a7a6e55ceb31
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/chart/ChartReadHandler.java
@@ -0,0 +1,99 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.chart;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.DetailRootTableReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.ReportReadHandler;
+import org.libreoffice.report.pentaho.parser.text.TextContentReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class ChartReadHandler extends ElementReadHandler
+{
+
+ private final Section element;
+ private final List<ElementReadHandler> children;
+ private final ReportReadHandler reportHandler;
+
+ public ChartReadHandler(ReportReadHandler reportHandler)
+ {
+ this.reportHandler = reportHandler;
+ children = new ArrayList<ElementReadHandler>();
+ element = new Section();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if ("detail".equals(tagName))
+ {
+ final DetailRootTableReadHandler detail = new DetailRootTableReadHandler();
+ reportHandler.setDetail(detail);
+ return detail;
+ }
+ else if ("p".equals(tagName) && OfficeNamespaces.TEXT_NS.equals(uri))
+ {
+ final TextContentReadHandler readHandler = new TextContentReadHandler();
+ children.add(readHandler);
+ return readHandler;
+ }
+ final ChartReadHandler erh = new ChartReadHandler(reportHandler);
+ children.add(erh);
+ return erh;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (ElementReadHandler handler : children)
+ {
+ element.addNode(handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/data/DataStyleReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/data/DataStyleReadHandler.java
new file mode 100644
index 000000000000..693ed0173b79
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/data/DataStyleReadHandler.java
@@ -0,0 +1,121 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.data;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.DataStyle;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.StaticText;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class DataStyleReadHandler extends ElementReadHandler
+{
+
+ private final DataStyle dataStyle;
+ private final List<Object> children;
+ private final boolean hasCData;
+
+ public DataStyleReadHandler(final boolean hasCData)
+ {
+ this.hasCData = hasCData;
+ this.dataStyle = new DataStyle();
+ this.children = new ArrayList<Object>();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.DATASTYLE_NS.equals(uri) || OfficeNamespaces.STYLE_NS.equals(uri))
+ {
+ final DataStyleReadHandler xrh = new DataStyleReadHandler("text".equals(tagName) || "currency-symbol".equals(tagName) || "embedded-text".equals(tagName));
+ children.add(xrh);
+ return xrh;
+ }
+
+ return null;
+ }
+
+ /**
+ * This method is called to process the character data between element tags.
+ *
+ * @param ch the character buffer.
+ * @param start the start index.
+ * @param length the length.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ public void characters(final char[] ch, final int start, final int length)
+ throws SAXException
+ {
+ if (hasCData)
+ {
+ children.add(new StaticText(new String(ch, start, length)));
+ }
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ final Object o = children.get(i);
+ if (o instanceof ElementReadHandler)
+ {
+ final ElementReadHandler handler = (ElementReadHandler) o;
+ dataStyle.addNode(handler.getElement());
+ }
+ else if (o instanceof StaticText)
+ {
+ dataStyle.addNode((StaticText) o);
+ }
+ }
+ }
+
+ public DataStyle getDataStyle()
+ {
+ return dataStyle;
+ }
+
+ public Element getElement()
+ {
+ return dataStyle;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/draw/ObjectOleReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/draw/ObjectOleReadHandler.java
new file mode 100644
index 000000000000..291490752619
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/draw/ObjectOleReadHandler.java
@@ -0,0 +1,75 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.draw;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.ObjectOleElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.structure.Element;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ */
+public class ObjectOleReadHandler extends ElementReadHandler
+{
+
+ private final static String RPT_CHART_CLASS_ID = "80243D39-6741-46C5-926E-069164FF87BB";
+ private final static String OOO_CHART_CLASS_ID = "12DCAE26-281F-416F-A234-C3086127382E";
+ private final ObjectOleElement element;
+
+ public ObjectOleReadHandler(final ObjectOleElement element)
+ {
+ this.element = element;
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+
+ final String url = attrs.getValue(OfficeNamespaces.XLINK_NS, "href");
+ if (url != null)
+ {
+ element.setUrl(url);
+ }
+
+ String classid = attrs.getValue(OfficeNamespaces.DRAWING_NS, "class-id");
+ if (classid != null)
+ {
+ if (classid.equalsIgnoreCase(RPT_CHART_CLASS_ID))
+ {
+ classid = OOO_CHART_CLASS_ID;
+ }
+ element.setClassId(classid);
+ }
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/BodyReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/BodyReadHandler.java
new file mode 100644
index 000000000000..0baecda6261d
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/BodyReadHandler.java
@@ -0,0 +1,82 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.office;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.ReportReadHandler;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class BodyReadHandler extends ElementReadHandler
+{
+
+ private ElementReadHandler reportReadHandler;
+ private final Section body;
+
+ public BodyReadHandler()
+ {
+ body = new Section();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri, final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OFFICE_NS.equals(uri) && "report".equals(tagName))
+ {
+ reportReadHandler = new ReportReadHandler();
+ return reportReadHandler;
+ }
+
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ if (reportReadHandler != null)
+ {
+ body.addNode(reportReadHandler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return body;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentContentReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentContentReadHandler.java
new file mode 100644
index 000000000000..6557227f8dd7
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentContentReadHandler.java
@@ -0,0 +1,227 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.office;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeDocument;
+import org.libreoffice.report.pentaho.model.OfficeStylesCollection;
+import org.libreoffice.report.pentaho.parser.style.OfficeStylesReadHandler;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jfree.report.JFreeReport;
+
+import org.pentaho.reporting.libraries.resourceloader.Resource;
+import org.pentaho.reporting.libraries.resourceloader.ResourceException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKey;
+import org.pentaho.reporting.libraries.resourceloader.ResourceKeyCreationException;
+import org.pentaho.reporting.libraries.resourceloader.ResourceManager;
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * This is the root handler for the document context. The
+ * 'office:document-context' element is encountered, if the document is split
+ * into separate files.
+ * <p/>
+ * Alternativly, there is the option to keep everything in one file. The root
+ * element for that format is 'office:document'.
+ */
+public class DocumentContentReadHandler extends AbstractXmlReadHandler
+{
+
+ private static final Log LOGGER = LogFactory.getLog(DocumentContentReadHandler.class);
+ private OfficeDocument report;
+ private FontFaceDeclsReadHandler fontFaceReadHandler;
+ private BodyReadHandler bodyReadHandler;
+ private OfficeStylesCollection officeStylesCollection;
+
+ public DocumentContentReadHandler()
+ {
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs)
+ throws SAXException
+ {
+ super.startParsing(attrs);
+ // parse the external 'styles.xml' if it exists
+ // parse the external 'meta.xml' if it exists
+ // parse the external 'settings.xml' if it exists
+ this.report = parseContentXml();
+ this.report.setVirtual(true);
+ this.report.setType("document-content");
+ this.report.setNamespace(OfficeNamespaces.OFFICE_NS);
+ this.report.setVirtual(true);
+ this.officeStylesCollection = parseStylesXml();
+ }
+
+ private OfficeStylesCollection parseStylesXml()
+ {
+ final ResourceKey contextKey = getRootHandler().getContext();
+ final ResourceManager resourceManager = getRootHandler().getResourceManager();
+
+ try
+ {
+ final ResourceKey key =
+ resourceManager.deriveKey(contextKey, "styles.xml");
+ final Resource resource =
+ resourceManager.create(key, contextKey, OfficeStylesCollection.class);
+ final OfficeStylesCollection styles =
+ (OfficeStylesCollection) resource.getResource();
+ if (styles != null)
+ {
+ return styles;
+ }
+ }
+ catch (ResourceKeyCreationException e)
+ {
+ // ignore ..
+ LOGGER.debug("Failed to create resource-key for 'styles.xml'. Ignoring.", e);
+ }
+ catch (ResourceException e)
+ {
+ // ignore ..
+ LOGGER.debug("Failed to parse resource for 'styles.xml'. Ignoring.", e);
+ }
+
+ return new OfficeStylesCollection();
+ }
+
+ private OfficeDocument parseContentXml()
+ {
+ // Check whether this is a content.xml.
+ if (!OfficeNamespaces.OFFICE_NS.equals(getUri()) || "document-content".equals(getTagName()))
+ {
+ return new OfficeDocument();
+ }
+
+ // we may have to parse an existing content.xml.
+ final ResourceKey contextKey = getRootHandler().getContext();
+ final ResourceManager resourceManager = getRootHandler().getResourceManager();
+ try
+ {
+ final ResourceKey key =
+ resourceManager.deriveKey(contextKey, "content.xml");
+ final Resource resource =
+ resourceManager.create(key, contextKey, JFreeReport.class);
+ final OfficeDocument doc = (OfficeDocument) resource.getResource();
+ if (doc != null)
+ {
+ return doc;
+ }
+ }
+ catch (ResourceKeyCreationException e)
+ {
+ // ignore ..
+ LOGGER.debug("Failed to create resource-key for 'content.xml'. Ignoring.");
+ }
+ catch (ResourceException e)
+ {
+ // ignore ..
+ LOGGER.debug("Failed to parse resource for 'content.xml'. Ignoring.");
+ }
+ return new OfficeDocument();
+
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OFFICE_NS.equals(uri))
+ {
+ if ("font-face-decls".equals(tagName))
+ {
+ if (fontFaceReadHandler == null)
+ {
+ fontFaceReadHandler = new FontFaceDeclsReadHandler(officeStylesCollection.getFontFaceDecls());
+ }
+ return fontFaceReadHandler;
+ }
+ else if ("automatic-styles".equals(tagName))
+ {
+ return new OfficeStylesReadHandler(officeStylesCollection.getAutomaticStyles());
+ }
+ else if ("styles".equals(tagName))
+ {
+ return new OfficeStylesReadHandler(officeStylesCollection.getCommonStyles());
+ }
+ else if ("master-styles".equals(tagName))
+ {
+ return new MasterStylesReadHandler(officeStylesCollection.getMasterStyles());
+ }
+ else if ("body".equals(tagName))
+ {
+ bodyReadHandler = new BodyReadHandler();
+ return bodyReadHandler;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing()
+ throws SAXException
+ {
+ // The office-document is the only node of the report. It allows us to
+ // switch the layout-processing implementation later on.
+
+ report.setStylesCollection(officeStylesCollection);
+
+ if (bodyReadHandler != null)
+ {
+ report.addNode(bodyReadHandler.getElement());
+ }
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Object getObject()
+ throws SAXException
+ {
+ return report;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentStylesReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentStylesReadHandler.java
new file mode 100644
index 000000000000..958fd896d9ba
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/DocumentStylesReadHandler.java
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.office;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeStylesCollection;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.style.OfficeStylesReadHandler;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * The root parser for a 'styles.xml' document. This generates the global
+ * (or common) style collection. These styles contain the named common styles
+ * and the page layouts.
+ *
+ * @since 08.03.2007
+ */
+public class DocumentStylesReadHandler extends ElementReadHandler
+{
+
+ private final OfficeStylesCollection officeStylesCollection;
+ private FontFaceDeclsReadHandler fontFaceReadHandler;
+
+ public DocumentStylesReadHandler()
+ {
+ officeStylesCollection = new OfficeStylesCollection();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (!OfficeNamespaces.OFFICE_NS.equals(uri))
+ {
+ return null;
+ }
+
+ if ("font-face-decls".equals(tagName))
+ {
+ if (fontFaceReadHandler == null)
+ {
+ fontFaceReadHandler = new FontFaceDeclsReadHandler(officeStylesCollection.getFontFaceDecls());
+ }
+ return fontFaceReadHandler;
+ }
+ else if ("automatic-styles".equals(tagName))
+ {
+ return new OfficeStylesReadHandler(officeStylesCollection.getAutomaticStyles());
+ }
+ else if ("styles".equals(tagName))
+ {
+ return new OfficeStylesReadHandler(officeStylesCollection.getCommonStyles());
+ }
+ else if ("master-styles".equals(tagName))
+ {
+ return new MasterStylesReadHandler(officeStylesCollection.getMasterStyles());
+ }
+ return null;
+ }
+
+ public Element getElement()
+ {
+ return officeStylesCollection;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/FontFaceDeclsReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/FontFaceDeclsReadHandler.java
new file mode 100644
index 000000000000..de13cf10a53a
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/FontFaceDeclsReadHandler.java
@@ -0,0 +1,107 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.office;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.FontFaceDeclsSection;
+import org.libreoffice.report.pentaho.model.FontFaceElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.style.FontFaceReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Reads the font-face declarations section. This one can only contain
+ * font-face elements.
+ *
+ * @since 13.03.2007
+ */
+public class FontFaceDeclsReadHandler extends ElementReadHandler
+{
+
+ private final FontFaceDeclsSection fontFaceDecls;
+ private final List<FontFaceReadHandler> fontFaceReadHandlers;
+
+ public FontFaceDeclsReadHandler(final FontFaceDeclsSection fontFaceDecls)
+ {
+ this.fontFaceDecls = fontFaceDecls;
+ this.fontFaceReadHandlers = new ArrayList<FontFaceReadHandler>();
+ }
+
+ public FontFaceDeclsSection getFontFaceDecls()
+ {
+ return fontFaceDecls;
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (!OfficeNamespaces.STYLE_NS.equals(uri))
+ {
+ return null;
+ }
+
+ if ("font-face".equals(tagName))
+ {
+ final FontFaceReadHandler frh = new FontFaceReadHandler();
+ fontFaceReadHandlers.add(frh);
+ return frh;
+ }
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing()
+ throws SAXException
+ {
+ for (int i = 0; i < fontFaceReadHandlers.size(); i++)
+ {
+ final FontFaceReadHandler handler = fontFaceReadHandlers.get(i);
+ fontFaceDecls.addFontFace((FontFaceElement) handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return fontFaceDecls;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/MasterStylesReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/MasterStylesReadHandler.java
new file mode 100644
index 000000000000..0b2b25430090
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/office/MasterStylesReadHandler.java
@@ -0,0 +1,113 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.office;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeMasterStyles;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.style.MasterPageReadHandler;
+import org.libreoffice.report.pentaho.parser.style.StyleDefinitionReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Todo: Document me!
+ *
+ * @since 13.03.2007
+ */
+public class MasterStylesReadHandler extends ElementReadHandler
+{
+
+ private final OfficeMasterStyles masterStyles;
+ private final List<ElementReadHandler> otherHandlers;
+ private final List<MasterPageReadHandler> masterPageHandlers;
+
+ public MasterStylesReadHandler(final OfficeMasterStyles masterStyles)
+ {
+ this.masterStyles = masterStyles;
+ this.masterPageHandlers = new ArrayList<MasterPageReadHandler>();
+ this.otherHandlers = new ArrayList<ElementReadHandler>();
+ }
+
+ public OfficeMasterStyles getMasterStyles()
+ {
+ return masterStyles;
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.STYLE_NS.equals(uri) && "master-page".equals(tagName))
+ {
+ final MasterPageReadHandler mrh = new MasterPageReadHandler();
+ masterPageHandlers.add(mrh);
+ return mrh;
+ }
+
+ final StyleDefinitionReadHandler readHandler =
+ new StyleDefinitionReadHandler();
+ otherHandlers.add(readHandler);
+ return readHandler;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing()
+ throws SAXException
+ {
+ for (int i = 0; i < otherHandlers.size(); i++)
+ {
+ final ElementReadHandler handler = otherHandlers.get(i);
+ masterStyles.getOtherNodes().addNode(handler.getElement());
+ }
+
+ for (int i = 0; i < masterPageHandlers.size(); i++)
+ {
+ final MasterPageReadHandler handler = masterPageHandlers.get(i);
+ masterStyles.addMasterPage(handler.getMasterPage());
+ }
+ }
+
+ public Element getElement()
+ {
+ return masterStyles;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt-schema-v1.0-os.xsd b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt-schema-v1.0-os.xsd
new file mode 100644
index 000000000000..4c296ac7a75f
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt-schema-v1.0-os.xsd
@@ -0,0 +1,405 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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 .
+-->
+<!---->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="urn:oasis:names:tc:opendocument:xmlns:report:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:rpt="urn:oasis:names:tc:opendocument:xmlns:report:1.0"
+ xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"
+ xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"
+ xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:ns1="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd"/>
+ <xs:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="math.xsd"/>
+ <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd"/>
+ <xs:import namespace="http://www.w3.org/2002/xforms" schemaLocation="xforms.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" schemaLocation="anim.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" schemaLocation="chart.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:config:1.0" schemaLocation="config.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" schemaLocation="ns1.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" schemaLocation="dr3d.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" schemaLocation="draw.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:form:1.0" schemaLocation="form.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" schemaLocation="meta.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:office:1.0" schemaLocation="office.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" schemaLocation="presentation.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:script:1.0" schemaLocation="script.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" schemaLocation="smil.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:style:1.0" schemaLocation="style.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" schemaLocation="svg.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:table:1.0" schemaLocation="table.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:text:1.0" schemaLocation="OpenDocument-schema-v1.0-os.xsd"/>
+ <xs:import namespace="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" schemaLocation="fo.xsd"/>
+ <xs:attributeGroup name="office-report-attlist">
+ <xs:attribute name="command-type" default="command" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="table"/>
+ <xs:enumeration value="query"/>
+ <xs:enumeration value="command"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="command" form="qualified" type="text:string"/>
+ <xs:attribute name="escape-processing" default="true" form="qualified" type="text:boolean"/>
+ <xs:attribute name="filter" form="qualified" type="text:string"/>
+ <xs:attribute name="caption" form="qualified" type="text:string"/>
+ </xs:attributeGroup>
+ <xs:element name="report-component">
+ <xs:complexType>
+ <xs:attributeGroup ref="text:common-draw-name-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="group">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="rpt:function"/>
+ <xs:element minOccurs="0" ref="rpt:group-header"/>
+ <xs:choice>
+ <xs:element ref="rpt:group"/>
+ <xs:element ref="rpt:detail"/>
+ </xs:choice>
+ <xs:element minOccurs="0" ref="rpt:group-footer"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:rpt-group-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="rpt-group-attlist">
+ <xs:attribute name="sort-ascending" use="required" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="start-new-column" default="false" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="reset-page-number" default="false" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="print-header-on-each-page" default="false" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="group-expression" use="required" form="qualified" type="text:string"/>
+ <xs:attribute name="keep-together" default="no" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="no"/>
+ <xs:enumeration value="whole-group"/>
+ <xs:enumeration value="with-first-detail"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:element name="group-header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:rpt-group-section-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="group-footer">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:rpt-group-section-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="report-header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="page-header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:rpt-page-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="column-header">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="detail">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="column-footer">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="page-footer">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:rpt-page-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="report-footer">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="table:table"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="rpt-page-attlist">
+ <xs:attribute name="page-print-option" default="all-pages" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="all-pages"/>
+ <xs:enumeration value="not-with-report-header"/>
+ <xs:enumeration value="not-with-report-footer"/>
+ <xs:enumeration value="not-with-report-header-nor-footer"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="rpt-section-attlist">
+ <xs:attribute name="visible" default="true" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="force-new-page" default="none" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="none"/>
+ <xs:enumeration value="before-section"/>
+ <xs:enumeration value="after-section"/>
+ <xs:enumeration value="before-after-section"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="new-row-or-column" default="none" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="none"/>
+ <xs:enumeration value="before-section"/>
+ <xs:enumeration value="after-section"/>
+ <xs:enumeration value="before-after-section"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="keep-together" default="false" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:attributeGroup name="rpt-group-section-attlist">
+ <xs:attribute name="repeat-section" default="false" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:element name="sub-document">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:group ref="rpt:report-master-detail-fields"/>
+ <xs:element ref="rpt:report-element"/>
+ <xs:choice minOccurs="0">
+ <xs:element ref="office:document"/>
+ <xs:element ref="math:math"/>
+ </xs:choice>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:report-sub-document-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="report-sub-document-attlist">
+ <xs:attribute ref="xlink:href"/>
+ <xs:attribute ref="xlink:type"/>
+ <xs:attributeGroup ref="xlink:show"/>
+ <xs:attributeGroup ref="xlink:actuate"/>
+ </xs:attributeGroup>
+ <xs:group name="report-master-detail-fields">
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="rpt:master-detail-fields"/>
+ </xs:sequence>
+ </xs:group>
+ <xs:element name="master-detail-fields">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="rpt:master-detail-field"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="master-detail-field">
+ <xs:complexType>
+ <xs:attribute name="master" use="required" form="qualified" type="text:string"/>
+ <xs:attribute name="detail" form="qualified" type="text:string"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="function">
+ <xs:complexType>
+ <xs:attribute name="formula" use="required" form="qualified" type="text:formula"/>
+ <xs:attribute name="name" use="required" form="qualified" type="text:string"/>
+ <xs:attribute name="pre-evaluated" use="required" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="report-element">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" ref="rpt:conditional-print-expression"/>
+ <xs:element minOccurs="0" ref="rpt:report-component"/>
+ <xs:element minOccurs="0" maxOccurs="unbounded" ref="rpt:format-condition"/>
+ </xs:sequence>
+ <xs:attributeGroup ref="rpt:rpt-report-element-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="rpt-report-element-attlist">
+ <xs:attribute name="print-when-group-change" default="true" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="print-repeated-values" default="true" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+ <xs:element name="conditional-print-expression" type="xs:string"/>
+ <xs:element name="format-condition">
+ <xs:complexType>
+ <xs:attributeGroup ref="rpt:rpt-format-condition-attlist"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="rpt-format-condition-attlist">
+ <xs:attribute name="enabled" default="false" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="formula" form="qualified" type="text:formula"/>
+ </xs:attributeGroup>
+ <xs:element name="fixed-content">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="rpt:report-element"/>
+ <xs:element ref="text:p"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="formatted-text">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="rpt:report-element"/>
+ <xs:group ref="text:common-form-control-content"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="rpt-formatted-text-attlist">
+ <xs:attributeGroup ref="text:common-data-field-attlist"/>
+ </xs:attributeGroup>
+ <xs:element name="image">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="rpt:report-element"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="rpt-image-attlist">
+ <xs:attributeGroup ref="text:common-data-field-attlist"/>
+ <xs:attributeGroup ref="text:image-data"/>
+ <xs:attribute name="scale" use="required" form="qualified">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="true"/>
+ <xs:enumeration value="false"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:attributeGroup>
+</xs:schema>
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java
new file mode 100644
index 000000000000..a15f1610e770
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ConditionalPrintExpressionReadHandler.java
@@ -0,0 +1,71 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+
+import org.jfree.report.expressions.FormulaFunction;
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Handles the 'report:conditional-print-expression' element that can appear
+ * in all report elements and all root-level sections.
+ *
+ * @since 02.03.2007
+ */
+public class ConditionalPrintExpressionReadHandler
+ extends AbstractXmlReadHandler
+{
+
+ private final Element element;
+
+ public ConditionalPrintExpressionReadHandler(final Element element)
+ {
+ this.element = element;
+ }
+
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+ final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula");
+ if (formula != null)
+ {
+ final FormulaFunction valueExpression = new FormulaFunction();
+ valueExpression.setFormula(formula);
+ element.setDisplayCondition(valueExpression);
+ }
+
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Object getObject()
+ throws SAXException
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/DetailRootTableReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/DetailRootTableReadHandler.java
new file mode 100644
index 000000000000..2a0677065ecc
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/DetailRootTableReadHandler.java
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.model.OfficeDetailSection;
+
+public class DetailRootTableReadHandler extends RootTableReadHandler
+{
+
+ public DetailRootTableReadHandler()
+ {
+ super(new OfficeDetailSection());
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FixedContentReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FixedContentReadHandler.java
new file mode 100644
index 000000000000..ab0fc52b1fee
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FixedContentReadHandler.java
@@ -0,0 +1,88 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.FixedTextElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.text.TextContentReadHandler;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 01.10.2006, 18:48:11
+ *
+ */
+public class FixedContentReadHandler extends ElementReadHandler
+{
+
+ private final FixedTextElement element;
+
+ public FixedContentReadHandler()
+ {
+ element = new FixedTextElement();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.TEXT_NS.equals(uri) && OfficeToken.P.equals(tagName))
+ {
+ // expect a paragraph (which will be ignored; it is a structural
+ // component that needs not to be printed at all.
+ return new TextContentReadHandler(element.getContent());
+ }
+
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ // expect a report control. The control will modifiy the current
+ // element (as we do not separate the elements that strictly ..)
+ if ("report-control".equals(tagName))
+ {
+ return new IgnoreAnyChildReadHandler();
+ }
+ if ("report-element".equals(tagName))
+ {
+ return new ReportElementReadHandler(element);
+ }
+ }
+ return null;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormatConditionReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormatConditionReadHandler.java
new file mode 100644
index 000000000000..cb3fa0a96039
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormatConditionReadHandler.java
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.FormatCondition;
+import org.libreoffice.report.pentaho.model.ReportElement;
+
+import org.jfree.report.expressions.FormulaExpression;
+
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * I'm quite sure I should parse something here. But what?
+ *
+ */
+public class FormatConditionReadHandler extends AbstractXmlReadHandler
+{
+
+ private final ReportElement element;
+
+ public FormatConditionReadHandler(final ReportElement element)
+ {
+ if (element == null)
+ {
+ throw new NullPointerException();
+ }
+ this.element = element;
+ }
+
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+
+
+ final String formula =
+ attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula");
+ if (formula == null)
+ {
+ throw new ParseException("Required attribute 'formula' is missing.", getLocator());
+ }
+ final String stylename =
+ attrs.getValue(OfficeNamespaces.OOREPORT_NS, OfficeToken.STYLE_NAME);
+ if (stylename == null)
+ {
+ throw new ParseException("Required attribute 'style-name' is missing.", getLocator());
+ }
+ final FormulaExpression valueExpression = new FormulaExpression();
+ valueExpression.setFormula(formula);
+
+ final String enabledText = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "enabled");
+ final boolean enabled = (enabledText == null || OfficeToken.TRUE.equals(enabledText));
+ final FormatCondition formatCondition =
+ new FormatCondition(valueExpression, stylename, enabled);
+ element.addFormatCondition(formatCondition);
+
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Object getObject()
+ throws SAXException
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormattedTextReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormattedTextReadHandler.java
new file mode 100644
index 000000000000..a1408d20dd52
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FormattedTextReadHandler.java
@@ -0,0 +1,108 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.FormattedTextElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.expressions.FormulaExpression;
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Creation-Date: 01.10.2006, 19:06:45
+ *
+ */
+public class FormattedTextReadHandler extends ElementReadHandler
+{
+
+ private final FormattedTextElement element;
+
+ public FormattedTextReadHandler()
+ {
+ element = new FormattedTextElement();
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+
+ final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula");
+ if (formula != null)
+ {
+ final FormulaExpression valueExpression = new FormulaExpression();
+ valueExpression.setFormula(formula);
+ element.setValueExpression(valueExpression);
+ }
+
+ // * Print-Repeated-Values
+ // * Print-In-First-New-Section
+ // * Print-When-Group-Change
+
+ // * Print-When-Section-Overflows
+ // That property cannot be evaluated yet, as this would require us to
+ // have a clue about pagebreaking. We dont have that - not yet and never
+ // in the future, as pagebreaks are computed by OpenOffice instead
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ // expect a report control. The control will modifiy the current
+ // element (as we do not separate the elements that strictly ..)
+ if ("report-control".equals(tagName))
+ {
+ return new IgnoreAnyChildReadHandler();
+ }
+ if ("report-element".equals(tagName))
+ {
+ return new ReportElementReadHandler(element);
+ }
+ }
+ return null;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FunctionReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FunctionReadHandler.java
new file mode 100644
index 000000000000..b1352d20c909
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/FunctionReadHandler.java
@@ -0,0 +1,106 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+
+import org.jfree.report.expressions.Expression;
+import org.jfree.report.expressions.FormulaExpression;
+import org.jfree.report.expressions.FormulaFunction;
+
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.ParseException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Parses a named expression. These expressions are encountered on reports and
+ * groups and compute global values. Expressions must have an unique name.
+ *
+ */
+public class FunctionReadHandler extends AbstractXmlReadHandler
+{
+
+ private Expression expression;
+
+ public FunctionReadHandler()
+ {
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs)
+ throws SAXException
+ {
+ final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula");
+ if (formula == null)
+ {
+ throw new ParseException("Required attribute 'formula' is missing", getLocator());
+ }
+
+ final String name = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "name");
+ if (name == null)
+ {
+ throw new ParseException("Required attribute 'name' is missing", getLocator());
+ }
+ final String initialFormula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "initial-formula");
+ final String deepTraversing = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "deep-traversing");
+
+ if (initialFormula != null)
+ {
+ final FormulaFunction function = new FormulaFunction();
+ function.setInitial(initialFormula);
+ function.setFormula(formula);
+ this.expression = function;
+ }
+ else
+ {
+ final FormulaExpression expression = new FormulaExpression();
+ expression.setFormula(formula);
+ this.expression = expression;
+ }
+
+ expression.setName(name);
+ expression.setDeepTraversing(OfficeToken.TRUE.equals(deepTraversing));
+ final String preEvaluated = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "pre-evaluated");
+ expression.setPrecompute(OfficeToken.TRUE.equals(preEvaluated));
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Object getObject()
+ throws SAXException
+ {
+ return getExpression();
+ }
+
+ public Expression getExpression()
+ {
+ return expression;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupReadHandler.java
new file mode 100644
index 000000000000..22def36e179b
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupReadHandler.java
@@ -0,0 +1,172 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeGroup;
+import org.libreoffice.report.pentaho.model.OfficeGroupInstanceSection;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.expressions.FormulaExpression;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class GroupReadHandler extends ElementReadHandler
+{
+
+ private GroupSectionReadHandler groupHeader;
+ private GroupSectionReadHandler groupFooter;
+ private GroupReadHandler childGroup;
+ private RootTableReadHandler detailSection;
+ private final OfficeGroup group;
+ private final OfficeGroupInstanceSection groupInstanceSection;
+ private final List<FunctionReadHandler> functionHandlers;
+ private final ReportReadHandler rh;
+
+ public GroupReadHandler(final ReportReadHandler _rh)
+ {
+ rh = _rh;
+ group = new OfficeGroup();
+ groupInstanceSection = new OfficeGroupInstanceSection();
+ groupInstanceSection.setNamespace(JFreeReportInfo.REPORT_NAMESPACE);
+ groupInstanceSection.setType("group-instance");
+ group.addNode(groupInstanceSection);
+ functionHandlers = new ArrayList<FunctionReadHandler>();
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+
+ final String groupExpr = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "group-expression");
+ if (groupExpr != null && !"".equals(groupExpr))
+ {
+ final FormulaExpression function = new FormulaExpression();
+ function.setFormula(groupExpr);
+ groupInstanceSection.setGroupingExpression(function);
+ }
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (!OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ return null;
+ }
+ if ("function".equals(tagName))
+ {
+ final FunctionReadHandler erh = new FunctionReadHandler();
+ functionHandlers.add(erh);
+ return erh;
+ }
+ if ("group-header".equals(tagName))
+ {
+ groupHeader = new GroupSectionReadHandler();
+ return groupHeader;
+ }
+ if ("group".equals(tagName))
+ {
+ childGroup = new GroupReadHandler(rh);
+ return childGroup;
+ }
+ if ("detail".equals(tagName))
+ {
+ detailSection = new DetailRootTableReadHandler();
+ rh.setDetail(detailSection);
+ return detailSection;
+ }
+ if ("group-footer".equals(tagName))
+ {
+ ((Element) ((Section) rh.getDetail().getElement()).getNode(0)).setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "has-group-footer", OfficeToken.TRUE);
+ groupFooter = new GroupSectionReadHandler();
+ return groupFooter;
+ }
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < functionHandlers.size(); i++)
+ {
+ final FunctionReadHandler handler = functionHandlers.get(i);
+ groupInstanceSection.addExpression(handler.getExpression());
+ }
+
+ if (groupHeader != null)
+ {
+ groupInstanceSection.addNode(groupHeader.getElement());
+ }
+
+ final Section groupBody = new Section();
+ groupBody.setNamespace(JFreeReportInfo.REPORT_NAMESPACE);
+ groupBody.setType("group-body");
+ groupInstanceSection.addNode(groupBody);
+ // XOR: Either the detail or the group section can be set ..
+ if (detailSection != null)
+ {
+ groupBody.addNode(detailSection.getElement());
+ }
+ else if (childGroup != null)
+ {
+ groupBody.addNode(childGroup.getElement());
+ }
+
+ if (groupFooter != null)
+ {
+ groupInstanceSection.addNode(groupFooter.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return group;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupSectionReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupSectionReadHandler.java
new file mode 100644
index 000000000000..461cf67840f0
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/GroupSectionReadHandler.java
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.model.OfficeGroupSection;
+
+public class GroupSectionReadHandler extends RootTableReadHandler
+{
+
+ public GroupSectionReadHandler()
+ {
+ super(new OfficeGroupSection());
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ImageReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ImageReadHandler.java
new file mode 100644
index 000000000000..39f0d82326e6
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ImageReadHandler.java
@@ -0,0 +1,131 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.ImageElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.xlink.XLinkReadHandler;
+
+import org.jfree.report.expressions.FormulaExpression;
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Deals with Image-content. There are two ways to specify the image;
+ * as formula or as static image data.
+ *
+ */
+public class ImageReadHandler extends ElementReadHandler
+{
+
+ private final ImageElement contentElement;
+ private XLinkReadHandler xLinkReadHandler;
+
+ public ImageReadHandler()
+ {
+ contentElement = new ImageElement();
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+ final String formula = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "formula");
+// final String preserveIRI = attrs.getValue(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI);
+ if (formula != null && formula.length() != 0)
+ {
+ // now, the evaulated content ends up in the 'content' attribute of the
+ // element.
+ final FormulaExpression valueExpression = new FormulaExpression();
+ valueExpression.setFormula(formula);
+ contentElement.setFormula(valueExpression);
+ }
+
+ contentElement.setNamespace(OfficeNamespaces.FORM_NS);
+ contentElement.setType(OfficeToken.IMAGE);
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.DRAWING_NS.equals(uri) && OfficeToken.IMAGE_DATA.equals(tagName))
+ {
+ xLinkReadHandler = new XLinkReadHandler();
+ return xLinkReadHandler;
+ }
+
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ // expect a report control. The control will modifiy the current
+ // element (as we do not separate the elements that strictly ..)
+ if ("report-control".equals(tagName))
+ {
+ return new IgnoreAnyChildReadHandler();
+ }
+ if ("report-element".equals(tagName))
+ {
+ return new ReportElementReadHandler(contentElement);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ // if we have static content (as well or only), that one goes into the
+ // alternate-content attribute right now. It is part of the output target
+ // and style rules to deal with them properly ..
+ if (xLinkReadHandler != null)
+ {
+ contentElement.setAttribute(OfficeNamespaces.OOREPORT_NS,
+ "alternate-content", xLinkReadHandler.getUri());
+ }
+ }
+
+ public Element getElement()
+ {
+ return contentElement;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/MasterDetailReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/MasterDetailReadHandler.java
new file mode 100644
index 000000000000..7fe32ecc5d70
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/MasterDetailReadHandler.java
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.ObjectOleElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class MasterDetailReadHandler extends ElementReadHandler
+{
+
+ private final ObjectOleElement element;
+ private final boolean parseMasterDetail;
+
+ public MasterDetailReadHandler(final ObjectOleElement element)
+ {
+ this.element = element;
+ parseMasterDetail = false;
+ }
+
+ public MasterDetailReadHandler(final ObjectOleElement element, final boolean parseMasterDetail)
+ {
+ this.element = element;
+ this.parseMasterDetail = parseMasterDetail;
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+ if (parseMasterDetail)
+ {
+ final String master = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "master");
+ if (master != null && master.length() > 0)
+ {
+ final String detail = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "detail");
+ element.addMasterDetailFields(master, detail);
+ }
+ }
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri) && "master-detail-field".equals(tagName))
+ {
+ // expect a report control. The control will modifiy the current
+ // element (as we do not separate the elements that strictly ..)
+ return new MasterDetailReadHandler(element, true);
+ }
+
+ return null;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportElementReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportElementReadHandler.java
new file mode 100644
index 000000000000..c29488435fa3
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportElementReadHandler.java
@@ -0,0 +1,100 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.ReportElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ReportElementReadHandler extends ElementReadHandler
+{
+
+ private final ReportElement element;
+
+ public ReportElementReadHandler(final ReportElement element)
+ {
+ if (element == null)
+ {
+ throw new NullPointerException();
+ }
+
+ this.element = element;
+ }
+
+ public Element getElement()
+ {
+ return element;
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs)
+ throws SAXException
+ {
+ super.startParsing(attrs);
+ final String printWhenGroupChange = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-when-group-change");
+ element.setPrintWhenGroupChange(OfficeToken.TRUE.equals(printWhenGroupChange));
+ final String printRepeatingValues = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "print-repeated-values");
+ element.setPrintRepeatedValues(printRepeatingValues == null || OfficeToken.TRUE.equals(printRepeatingValues));
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (!OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ return null;
+ }
+ if ("conditional-print-expression".equals(tagName))
+ {
+ return new ConditionalPrintExpressionReadHandler(element);
+ }
+ if ("format-condition".equals(tagName))
+ {
+ return new FormatConditionReadHandler(element);
+ }
+ if ("report-component".equals(tagName))
+ {
+ return new IgnoreAnyChildReadHandler();
+ }
+ return null;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportReadHandler.java
new file mode 100644
index 000000000000..ec270543b904
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/ReportReadHandler.java
@@ -0,0 +1,232 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeReport;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.chart.ChartReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.JFreeReportInfo;
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class ReportReadHandler extends ElementReadHandler
+{
+
+ private RootTableReadHandler pageHeader;
+ private RootTableReadHandler pageFooter;
+ private RootTableReadHandler reportHeader;
+ private RootTableReadHandler reportFooter;
+ private RootTableReadHandler detail;
+ private GroupReadHandler groups;
+ private final OfficeReport rootSection;
+ private final List<FunctionReadHandler> functionHandlers;
+ private final List<ElementReadHandler> preBodyHandlers;
+ private final List<ElementReadHandler> postBodyHandlers;
+ private boolean pre = true;
+
+ public ReportReadHandler()
+ {
+ rootSection = new OfficeReport();
+ rootSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, "simple-report-structure", Boolean.TRUE);
+ functionHandlers = new ArrayList<FunctionReadHandler>();
+ preBodyHandlers = new ArrayList<ElementReadHandler>();
+ postBodyHandlers = new ArrayList<ElementReadHandler>();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ final XmlReadHandler erh;
+ if (OfficeNamespaces.CHART_NS.equals(uri))
+ {
+ ChartReadHandler crh = new ChartReadHandler(this);
+ if (pre)
+ {
+ preBodyHandlers.add(crh);
+ }
+ else
+ {
+ postBodyHandlers.add(crh);
+ }
+ erh = crh;
+ }
+ else if (OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ if ("function".equals(tagName))
+ {
+ FunctionReadHandler frh = new FunctionReadHandler();
+ functionHandlers.add(frh);
+ erh = frh;
+ }
+ else if ("page-header".equals(tagName))
+ {
+ pageHeader = new RootTableReadHandler();
+ erh = pageHeader;
+ }
+ else if ("report-header".equals(tagName))
+ {
+ reportHeader = new RootTableReadHandler();
+ erh = reportHeader;
+ }
+ else if ("report-footer".equals(tagName))
+ {
+ reportFooter = new RootTableReadHandler();
+ erh = reportFooter;
+ }
+ else if ("page-footer".equals(tagName))
+ {
+ pageFooter = new RootTableReadHandler();
+ erh = pageFooter;
+ }
+ else if ("detail".equals(tagName))
+ {
+ pre = false;
+ detail = new DetailRootTableReadHandler();
+ erh = detail;
+ }
+ else if ("group".equals(tagName))
+ {
+ groups = new GroupReadHandler(this);
+ erh = groups;
+ }
+ else
+ {
+ erh = null;
+ }
+ }
+ else
+ {
+ erh = null;
+ }
+ return erh;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ if (pageHeader != null)
+ {
+ rootSection.setPageHeader(pageHeader.getElement());
+ }
+ if (pageFooter != null)
+ {
+ rootSection.setPageFooter(pageFooter.getElement());
+ }
+ if (reportHeader != null)
+ {
+ rootSection.setReportHeader(reportHeader.getElement());
+ }
+
+ final Section preBody = createSection("report-pre-body", preBodyHandlers);
+ if (preBody != null)
+ {
+ rootSection.setPreBodySection(preBody);
+ }
+
+ final Section groupBody = new Section();
+ groupBody.setNamespace(JFreeReportInfo.REPORT_NAMESPACE);
+ groupBody.setType("report-body");
+ rootSection.setBodySection(groupBody);
+
+ // XOR: Either the detail or the group section can be set ..
+ if (groups != null)
+ {
+ groupBody.addNode(groups.getElement());
+ }
+ else if (detail != null)
+ {
+ groupBody.addNode(detail.getElement());
+ }
+
+ final Section postBody = createSection("report-post-body", postBodyHandlers);
+ if (postBody != null)
+ {
+ rootSection.setPostBodySection(postBody);
+ }
+
+ if (reportFooter != null)
+ {
+ rootSection.setReportFooter(reportFooter.getElement());
+ }
+
+ for (int i = 0; i < functionHandlers.size(); i++)
+ {
+ final FunctionReadHandler handler = functionHandlers.get(i);
+ rootSection.addExpression(handler.getExpression());
+ }
+ }
+
+ public Element getElement()
+ {
+ return rootSection;
+ }
+
+ private final Section createSection(final String name, final List<ElementReadHandler> handler)
+ {
+ if (!handler.isEmpty())
+ {
+ final Section section = new Section();
+ section.setNamespace(JFreeReportInfo.REPORT_NAMESPACE);
+ section.setType(name);
+
+ for (int i = 0; i < handler.size(); i++)
+ {
+ final ElementReadHandler erh = handler.get(i);
+ section.addNode(erh.getElement());
+ }
+ return section;
+ }
+ return null;
+ }
+
+ public void setDetail(final RootTableReadHandler detail)
+ {
+ this.detail = detail;
+ }
+
+ public final RootTableReadHandler getDetail()
+ {
+ return detail;
+ }
+
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/RootTableReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/RootTableReadHandler.java
new file mode 100644
index 000000000000..54b753b8f630
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/RootTableReadHandler.java
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.table.TableReadHandler;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class RootTableReadHandler extends ElementReadHandler
+{
+
+ private TableReadHandler sectionTableReadHandler;
+ private final Section section;
+
+ public RootTableReadHandler()
+ {
+ section = new Section();
+ }
+
+ protected RootTableReadHandler(final Section section)
+ {
+ if (section == null)
+ {
+ throw new NullPointerException();
+ }
+ this.section = section;
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.TABLE_NS.equals(uri) && "table".equals(tagName))
+ {
+ sectionTableReadHandler = new TableReadHandler();
+ return sectionTableReadHandler;
+ }
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri) && "conditional-print-expression".equals(tagName))
+ {
+ return new ConditionalPrintExpressionReadHandler(section);
+ }
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing()
+ throws SAXException
+ {
+ if (sectionTableReadHandler != null)
+ {
+ section.addNode(sectionTableReadHandler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return section;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/SubDocumentReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/SubDocumentReadHandler.java
new file mode 100644
index 000000000000..c815a69ba7ae
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/rpt/SubDocumentReadHandler.java
@@ -0,0 +1,124 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.rpt;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.ObjectOleElement;
+import org.libreoffice.report.pentaho.parser.draw.ObjectOleReadHandler;
+import org.libreoffice.report.pentaho.parser.text.NoCDATATextContentReadHandler;
+
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.IgnoreAnyChildReadHandler;
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class SubDocumentReadHandler extends NoCDATATextContentReadHandler
+{
+
+ private final ObjectOleElement element;
+ private boolean ignore = false;
+
+ public SubDocumentReadHandler(final ObjectOleElement element)
+ {
+ this.element = element;
+ }
+
+ public SubDocumentReadHandler(final Section section, final ObjectOleElement element)
+ {
+ super(section);
+ this.element = element;
+ }
+
+ public SubDocumentReadHandler(final Section section)
+ {
+ this(section, new ObjectOleElement());
+ ignore = true;
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ if (!ignore)
+ {
+ super.startParsing(attrs);
+ }
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ // expect a report control. The control will modifiy the current
+ // element (as we do not separate the elements that strictly ..)
+ if ("report-control".equals(tagName))
+ {
+ return new IgnoreAnyChildReadHandler();
+ }
+ if ("report-element".equals(tagName))
+ {
+ return new ReportElementReadHandler(element);
+ }
+ if ("master-detail-fields".equals(tagName))
+ {
+ return new MasterDetailReadHandler(element);
+ }
+ }
+ if (OfficeNamespaces.DRAWING_NS.equals(uri))
+ {
+ final XmlReadHandler readHandler;
+ if (OfficeToken.OBJECT_OLE.equals(tagName))
+ {
+ readHandler = new ObjectOleReadHandler(element);
+ }
+ else if ("frame".equals(tagName))
+ {
+ readHandler = new SubDocumentReadHandler(new Section(), element);
+ }
+ else
+ {
+ readHandler = null;
+ }
+ if (readHandler != null)
+ {
+ getChildren().add(readHandler);
+ return readHandler;
+ }
+ }
+ return super.getHandlerForChild(uri, tagName, atts);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/selectors.properties b/reportbuilder/java/org/libreoffice/report/pentaho/parser/selectors.properties
new file mode 100644
index 000000000000..f9640d001fa5
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/selectors.properties
@@ -0,0 +1,104 @@
+#
+# 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 .
+#
+# x-no-translate
+
+# <style:style style:name="S1" style:family="graphics">
+# <style:section-properties fo:background-color="#ffffff"/>
+# </style:style>
+#
+# gets translated into:
+#
+# *[draw|style-name~="S1"]
+
+namespaces.draw=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0
+namespaces.fo=urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0
+namespaces.style=urn:oasis:names:tc:opendocument:xmlns:style:1.0
+namespaces.table=urn:oasis:names:tc:opendocument:xmlns:table:1.0
+namespaces.chart=urn:oasis:names:tc:opendocument:xmlns:chart:1.0
+namespaces.rpt=http://openoffice.org/2005/report
+
+#
+# maps the style family type (graphics) into a style rule of the
+# common form: *[<namespace>|<style-name>~="<classname>"]
+#
+style-family.graphic=draw
+style-family.graphics=draw
+style-family.control=control
+style-family.report-element=rpt
+style-family.table-column=table
+style-family.table-row=table
+style-family.table-cell=table
+style-family.table=table
+
+# Builds the selector pattern for a star-office stylesheet
+#
+# 0: Namespace prefix
+# 1: Style-class attribute name (from the global namespace definition)
+# 2: Style-class value
+style-selector.pattern=*[{0}|{1}~="{2}"]
+
+#
+# The following properties map the OpenOffice-generic font names
+# into their CSS counterparts. As I dont have a clue, whats the difference
+# between modern and swiss typeface, I am ignorant for now and ignore
+# them. Blame me for that :)
+font-family.roman=serif
+font-family.swiss=sans-serif
+font-family.modern=sans-serif
+font-family.decorative=fantasy
+font-family.script=cursive
+font-family.system=monospace
+
+
+#
+# Defines the style property mapping for the resolve process from the
+# OpenOffice report format into the internal LibLayout format
+#
+# attr.style.<group>.<namespace>.<attr-name>=<class>
+#
+# Group is an selector, which corresponds to one of the sub-elements of
+# the style element of the OpenDocument format. (It must match the element
+# name for which the attributes are defined.)
+#
+# Namespace is a defined namespace prefix from this file as defined in the
+# namespaces.<prefix> section above
+#
+# AttrName is the defined attribute name for this namespace as defined by the
+# opendocument standard.
+attr.style.graphic-properties.draw.textarea-vertical-align=org.libreoffice.report.pentaho.parser.stylemapper.draw.TextAreaVerticalAlignMapper
+attr.style.section-properties.fo.background-color=org.libreoffice.report.pentaho.parser.stylemapper.fo.BackgroundColorMapper
+attr.style.paragraph-properties.fo.text-align=org.libreoffice.report.pentaho.parser.stylemapper.fo.TextAlignMapper
+attr.style.paragraph-properties.style.vertical-align=org.libreoffice.report.pentaho.parser.stylemapper.style.VerticalAlignMapper
+attr.style.text-properties.fo.color=org.libreoffice.report.pentaho.parser.stylemapper.fo.ColorMapper
+attr.style.text-properties.style.font-name=org.libreoffice.report.pentaho.parser.stylemapper.style.FontNameMapper
+attr.style.text-properties.fo.font-family=org.libreoffice.report.pentaho.parser.stylemapper.style.FontFamilyMapper
+attr.style.table-properties.fo.background-color=org.libreoffice.report.pentaho.parser.stylemapper.fo.BackgroundColorMapper
+#attr.style.text-properties.style.font-style-name=
+attr.style.text-properties.style.font-family-generic=org.libreoffice.report.pentaho.parser.stylemapper.style.FontFamilyGenericMapper
+attr.style.text-properties.style.font-pitch=org.libreoffice.report.pentaho.parser.stylemapper.style.FontPitchMapper
+attr.style.text-properties.fo.font-size=org.libreoffice.report.pentaho.parser.stylemapper.fo.FontSizeMapper
+attr.style.text-properties.fo.font-style=org.libreoffice.report.pentaho.parser.stylemapper.fo.FontStyleMapper
+attr.style.text-properties.style.text-underline-style=org.libreoffice.report.pentaho.parser.stylemapper.style.TextUnderlineStyleMapper
+attr.style.text-properties.style.text-underline-width=org.libreoffice.report.pentaho.parser.stylemapper.style.TextUnderlineWidthMapper
+attr.style.text-properties.style.text-underline-color=org.libreoffice.report.pentaho.parser.stylemapper.style.TextUnderlineColorMapper
+attr.style.text-properties.fo.font-weight=org.libreoffice.report.pentaho.parser.stylemapper.fo.FontWeightMapper
+attr.style.text-properties.style.text-emphasize=org.libreoffice.report.pentaho.parser.stylemapper.style.TextEmphasizeMapper
+attr.style.text-properties.style.font-relief=org.libreoffice.report.pentaho.parser.stylemapper.style.FontReliefMapper
+attr.style.table-column-properties.table.column-width=org.libreoffice.report.pentaho.parser.stylemapper.table.ColumnWidthMapper
+attr.style.table-row-properties.table.row-height=org.libreoffice.report.pentaho.parser.stylemapper.table.RowHeightMapper
+attr.style.table-cell-properties.fo.border-right=org.libreoffice.report.pentaho.parser.stylemapper.fo.BorderRightMapper
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style-mapping.txt b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style-mapping.txt
new file mode 100644
index 000000000000..6b1ede5d98cf
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style-mapping.txt
@@ -0,0 +1,8 @@
+ <style:style style:name="S1" style:family="graphics">
+ <style:section-properties fo:background-color="#ffffff"/>
+ </style:style>
+
+gets translated into:
+
+*[draw|style-name~="S1"]
+
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/FontFaceReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/FontFaceReadHandler.java
new file mode 100644
index 000000000000..d6f7ed04f78b
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/FontFaceReadHandler.java
@@ -0,0 +1,46 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.style;
+
+import org.libreoffice.report.pentaho.model.FontFaceElement;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.structure.Element;
+
+/**
+ * Reads a single font-face declaration. This is equal to the @font rule of
+ * the CSS standard. We do not interpret the attributes of the element in
+ * any way yet.
+ *
+ * @since 13.03.2007
+ */
+public class FontFaceReadHandler extends ElementReadHandler
+{
+
+ private final FontFaceElement fontFaceElement;
+
+ public FontFaceReadHandler()
+ {
+ this.fontFaceElement = new FontFaceElement();
+ }
+
+ public Element getElement()
+ {
+ return fontFaceElement;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/MasterPageReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/MasterPageReadHandler.java
new file mode 100644
index 000000000000..993331d02933
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/MasterPageReadHandler.java
@@ -0,0 +1,95 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.style;
+
+import org.libreoffice.report.pentaho.model.OfficeMasterPage;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Todo: Document me!
+ *
+ * @since 13.03.2007
+ */
+public class MasterPageReadHandler extends ElementReadHandler
+{
+
+ private final OfficeMasterPage masterPage;
+ private final List<ElementReadHandler> otherHandlers;
+
+ public MasterPageReadHandler()
+ {
+ masterPage = new OfficeMasterPage();
+ this.otherHandlers = new ArrayList<ElementReadHandler>();
+ }
+
+ public OfficeMasterPage getMasterPage()
+ {
+ return masterPage;
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ final StyleDefinitionReadHandler readHandler =
+ new StyleDefinitionReadHandler();
+ otherHandlers.add(readHandler);
+ return readHandler;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing()
+ throws SAXException
+ {
+ for (int i = 0; i < otherHandlers.size(); i++)
+ {
+ final ElementReadHandler handler = otherHandlers.get(i);
+ masterPage.addNode(handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return masterPage;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStyleReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStyleReadHandler.java
new file mode 100644
index 000000000000..ed6b9ddeaa23
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStyleReadHandler.java
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.style;
+
+import org.libreoffice.report.pentaho.model.OfficeStyle;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * This class reads a single style rule. The resulting 'office-style' element
+ * is added to an 'office-styles' set.
+ */
+public class OfficeStyleReadHandler extends ElementReadHandler
+{
+
+ private final OfficeStyle officeStyle;
+ private final List<ElementReadHandler> children;
+
+ public OfficeStyleReadHandler()
+ {
+ this.officeStyle = new OfficeStyle();
+ this.children = new ArrayList<ElementReadHandler>();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+// if (OfficeParserUtil.getInstance().isValidStyleElement(uri, tagName))
+// {
+// }
+ final StyleDefinitionReadHandler readHandler =
+ new StyleDefinitionReadHandler();
+ children.add(readHandler);
+ return readHandler;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ final ElementReadHandler handler = children.get(i);
+ officeStyle.addNode(handler.getElement());
+ }
+ }
+
+ public OfficeStyle getOfficeStyle()
+ {
+ return officeStyle;
+ }
+
+ public Element getElement()
+ {
+ return officeStyle;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStylesReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStylesReadHandler.java
new file mode 100644
index 000000000000..17e684838bae
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/OfficeStylesReadHandler.java
@@ -0,0 +1,130 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.style;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeStyles;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.data.DataStyleReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.modules.factories.report.flow.SectionReadHandler;
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class OfficeStylesReadHandler extends ElementReadHandler
+{
+
+ private final List<OfficeStyleReadHandler> textStyleChildren;
+ private final List<DataStyleReadHandler> dataStyleChildren;
+ private final List<SectionReadHandler> otherStyleChildren;
+ private final List<PageLayoutReadHandler> pageLayoutChildren;
+ private final OfficeStyles officeStyles;
+
+ public OfficeStylesReadHandler(final OfficeStyles officeStyles)
+ {
+ this.officeStyles = officeStyles;
+ this.pageLayoutChildren = new ArrayList<PageLayoutReadHandler>();
+ this.dataStyleChildren = new ArrayList<DataStyleReadHandler>();
+ this.textStyleChildren = new ArrayList<OfficeStyleReadHandler>();
+ this.otherStyleChildren = new ArrayList<SectionReadHandler>();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri, final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.STYLE_NS.equals(uri))
+ {
+ if ("style".equals(tagName))
+ {
+ final OfficeStyleReadHandler xrh = new OfficeStyleReadHandler();
+ textStyleChildren.add(xrh);
+ return xrh;
+ }
+ else if ("page-layout".equals(tagName))
+ {
+ final PageLayoutReadHandler prh = new PageLayoutReadHandler();
+ pageLayoutChildren.add(prh);
+ return prh;
+ }
+ }
+ else if (OfficeNamespaces.DATASTYLE_NS.equals(uri))
+ {
+ final DataStyleReadHandler xrh = new DataStyleReadHandler(false);
+ dataStyleChildren.add(xrh);
+ return xrh;
+ }
+
+ final SectionReadHandler genericReadHander = new SectionReadHandler();
+ otherStyleChildren.add(genericReadHander);
+ return genericReadHander;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < textStyleChildren.size(); i++)
+ {
+ final OfficeStyleReadHandler handler = textStyleChildren.get(i);
+ officeStyles.addStyle(handler.getOfficeStyle());
+ }
+
+ for (int i = 0; i < pageLayoutChildren.size(); i++)
+ {
+ final PageLayoutReadHandler handler = pageLayoutChildren.get(i);
+ officeStyles.addPageStyle(handler.getPageLayout());
+ }
+
+ for (int i = 0; i < dataStyleChildren.size(); i++)
+ {
+ final DataStyleReadHandler handler = dataStyleChildren.get(i);
+ officeStyles.addDataStyle(handler.getDataStyle());
+ }
+
+ for (int i = 0; i < otherStyleChildren.size(); i++)
+ {
+ final SectionReadHandler handler = otherStyleChildren.get(i);
+ officeStyles.addOtherNode((Element) handler.getNode());
+ }
+ }
+
+ public Element getElement()
+ {
+ return officeStyles;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/PageLayoutReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/PageLayoutReadHandler.java
new file mode 100644
index 000000000000..f0ff7c8f3572
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/PageLayoutReadHandler.java
@@ -0,0 +1,94 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.style;
+
+import org.libreoffice.report.pentaho.model.PageLayout;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Reads a page-layout element.
+ *
+ * @since 13.03.2007
+ */
+public class PageLayoutReadHandler extends ElementReadHandler
+{
+
+ private final PageLayout pageLayout;
+ private final List<ElementReadHandler> children;
+
+ public PageLayoutReadHandler()
+ {
+ this.pageLayout = new PageLayout();
+ this.children = new ArrayList<ElementReadHandler>();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ final StyleDefinitionReadHandler readHandler =
+ new StyleDefinitionReadHandler();
+ children.add(readHandler);
+ return readHandler;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ final ElementReadHandler handler = children.get(i);
+ pageLayout.addNode(handler.getElement());
+ }
+ }
+
+ public PageLayout getPageLayout()
+ {
+ return pageLayout;
+ }
+
+ public Element getElement()
+ {
+ return pageLayout;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/StyleDefinitionReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/StyleDefinitionReadHandler.java
new file mode 100644
index 000000000000..b50f7f9767e4
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/style/StyleDefinitionReadHandler.java
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.style;
+
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Reads all children of a style-definition. This simply copies everything that
+ * is contained in the source-file into a generic structure that can be
+ * written out later.
+ */
+public class StyleDefinitionReadHandler extends ElementReadHandler
+{
+
+ private final Section rawSection;
+ private final List<ElementReadHandler> children;
+
+ public StyleDefinitionReadHandler()
+ {
+ this.rawSection = new Section();
+ this.children = new ArrayList<ElementReadHandler>();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ final StyleDefinitionReadHandler readHandler =
+ new StyleDefinitionReadHandler();
+ children.add(readHandler);
+ return readHandler;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing()
+ throws SAXException
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ final ElementReadHandler handler = children.get(i);
+ rawSection.addNode(handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return rawSection;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java
new file mode 100644
index 000000000000..0f7583dc6b74
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/OneOfConstantsMapper.java
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.StyleKey;
+import org.jfree.layouting.input.style.values.CSSValue;
+
+
+public abstract class OneOfConstantsMapper implements StyleMapper
+{
+
+ private final StyleKey styleKey;
+ private final Map<String, CSSValue> mappings;
+
+ protected OneOfConstantsMapper(final StyleKey styleKey)
+ {
+ this.styleKey = styleKey;
+ this.mappings = new HashMap<String, CSSValue>();
+ }
+
+ public void addMapping(final String value, final CSSValue target)
+ {
+ mappings.put(value, target);
+ }
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ final CSSValue value = lookupMapping(attrValue);
+ if (value != null)
+ {
+ targetRule.setPropertyValue(styleKey, value);
+ }
+ }
+
+ public StyleKey getStyleKey()
+ {
+ return styleKey;
+ }
+
+ protected CSSValue lookupMapping(final String attrValue)
+ {
+ return mappings.get(attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java
new file mode 100644
index 000000000000..af921da41ff8
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/draw/TextAreaVerticalAlignMapper.java
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.draw;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.keys.box.BoxStyleKeys;
+import org.jfree.layouting.input.style.values.CSSConstant;
+
+public class TextAreaVerticalAlignMapper extends OneOfConstantsMapper
+{
+
+ public TextAreaVerticalAlignMapper()
+ {
+ super(BoxStyleKeys.BOX_VERTICAL_ALIGN);
+ addMapping("top", new CSSConstant("top"));
+ addMapping("bottom", new CSSConstant("bottom"));
+ addMapping("middle", new CSSConstant("middle"));
+ addMapping("justify", new CSSConstant("justify"));
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java
new file mode 100644
index 000000000000..1ccad389f9b0
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BackgroundColorMapper.java
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.border.BorderStyleKeys;
+import org.jfree.layouting.input.style.values.CSSColorValue;
+import org.jfree.layouting.util.ColorUtil;
+
+public class BackgroundColorMapper implements StyleMapper
+{
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue);
+ if (cv != null)
+ {
+ targetRule.setPropertyValue(BorderStyleKeys.BACKGROUND_COLOR, cv);
+ }
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java
new file mode 100644
index 000000000000..dc669bd0d7a0
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/BorderRightMapper.java
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+
+public class BorderRightMapper implements StyleMapper
+{
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(attrName, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/ColorMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/ColorMapper.java
new file mode 100644
index 000000000000..9e19b8e898b8
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/ColorMapper.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.color.ColorStyleKeys;
+import org.jfree.layouting.input.style.values.CSSColorValue;
+import org.jfree.layouting.util.ColorUtil;
+
+public class ColorMapper implements StyleMapper
+{
+
+ public ColorMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue);
+ if (cv != null)
+ {
+ targetRule.setPropertyValue(ColorStyleKeys.COLOR, cv);
+ }
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java
new file mode 100644
index 000000000000..683a79fa2932
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontSizeMapper.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+
+public class FontSizeMapper implements StyleMapper
+{
+
+ public FontSizeMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(FontStyleKeys.FONT_SIZE, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java
new file mode 100644
index 000000000000..ebe7cb6505f1
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontStyleMapper.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+
+public class FontStyleMapper implements StyleMapper
+{
+
+ public FontStyleMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(FontStyleKeys.FONT_STYLE, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java
new file mode 100644
index 000000000000..d9a5edcc1be4
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/FontWeightMapper.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+
+public class FontWeightMapper implements StyleMapper
+{
+
+ public FontWeightMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(FontStyleKeys.FONT_WEIGHT, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java
new file mode 100644
index 000000000000..f369af9bfa0a
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/fo/TextAlignMapper.java
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.fo;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.keys.text.TextAlign;
+import org.jfree.layouting.input.style.keys.text.TextStyleKeys;
+
+public class TextAlignMapper extends OneOfConstantsMapper
+{
+
+ public TextAlignMapper()
+ {
+ super(TextStyleKeys.TEXT_ALIGN);
+ addMapping("start", TextAlign.START);
+ addMapping("end", TextAlign.END);
+ addMapping("left", TextAlign.LEFT);
+ addMapping("center", TextAlign.CENTER);
+ addMapping("right", TextAlign.RIGHT);
+ addMapping("justify", TextAlign.JUSTIFY);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java
new file mode 100644
index 000000000000..fd9f3f7d029a
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyGenericMapper.java
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+import org.jfree.layouting.input.style.values.CSSStringType;
+import org.jfree.layouting.input.style.values.CSSStringValue;
+import org.jfree.layouting.input.style.values.CSSValue;
+import org.jfree.layouting.input.style.values.CSSValueList;
+
+public class FontFamilyGenericMapper implements StyleMapper
+{
+
+ public FontFamilyGenericMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ final CSSValue value = targetRule.getPropertyCSSValue(FontStyleKeys.FONT_FAMILY);
+ if (!(value instanceof CSSValueList))
+ {
+ final CSSStringValue cssVal = new CSSStringValue(CSSStringType.STRING, attrValue);
+ targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY,
+ new CSSValueList(new CSSValue[]
+ {
+ cssVal
+ }));
+ }
+ else
+ {
+ final CSSValueList list = (CSSValueList) value;
+ targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY,
+ CSSValueList.insertLast(list, value));
+ }
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java
new file mode 100644
index 000000000000..7268b29c697a
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontFamilyMapper.java
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+import org.jfree.layouting.input.style.values.CSSStringType;
+import org.jfree.layouting.input.style.values.CSSStringValue;
+import org.jfree.layouting.input.style.values.CSSValue;
+import org.jfree.layouting.input.style.values.CSSValueList;
+
+public class FontFamilyMapper implements StyleMapper
+{
+
+ public FontFamilyMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ final CSSValue value = targetRule.getPropertyCSSValue(FontStyleKeys.FONT_FAMILY);
+ if (!(value instanceof CSSValueList))
+ {
+ final CSSStringValue cssVal = new CSSStringValue(CSSStringType.STRING, attrValue);
+ targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY,
+ new CSSValueList(new CSSValue[]
+ {
+ cssVal
+ }));
+ }
+ else
+ {
+ final CSSValueList list = (CSSValueList) value;
+ targetRule.setPropertyValue(FontStyleKeys.FONT_FAMILY,
+ CSSValueList.insertFirst(list, value));
+ }
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontNameMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontNameMapper.java
new file mode 100644
index 000000000000..fbf0aa226674
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontNameMapper.java
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+import org.jfree.layouting.input.style.values.CSSStringType;
+import org.jfree.layouting.input.style.values.CSSStringValue;
+
+public class FontNameMapper implements StyleMapper
+{
+
+ public FontNameMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValue(FontStyleKeys.FONT_NAME,
+ new CSSStringValue(CSSStringType.STRING, attrValue));
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontPitchMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontPitchMapper.java
new file mode 100644
index 000000000000..15d87ae2ee10
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontPitchMapper.java
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+import org.jfree.layouting.input.style.values.CSSConstant;
+
+public class FontPitchMapper extends OneOfConstantsMapper
+{
+
+ public FontPitchMapper()
+ {
+ super(FontStyleKeys.FONT_PITCH);
+ addMapping("variable", new CSSConstant("variable"));
+ addMapping("fixed", new CSSConstant("fixed"));
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontReliefMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontReliefMapper.java
new file mode 100644
index 000000000000..c8f397eaf459
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/FontReliefMapper.java
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.font.FontStyleKeys;
+
+public class FontReliefMapper implements StyleMapper
+{
+
+ public FontReliefMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(FontStyleKeys.FONT_EFFECT, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java
new file mode 100644
index 000000000000..f3cdb77762da
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextEmphasizeMapper.java
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+
+public class TextEmphasizeMapper implements StyleMapper
+{
+
+ public TextEmphasizeMapper()
+ {
+ }
+
+ public void updateStyle(final String uri, final String attrName, final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString("font-emphasize", attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java
new file mode 100644
index 000000000000..2be734d86361
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineColorMapper.java
@@ -0,0 +1,45 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.text.TextStyleKeys;
+import org.jfree.layouting.input.style.values.CSSColorValue;
+import org.jfree.layouting.util.ColorUtil;
+
+public class TextUnderlineColorMapper implements StyleMapper
+{
+
+ public TextUnderlineColorMapper()
+ {
+ }
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ final CSSColorValue cv = (CSSColorValue) ColorUtil.parseColor(attrValue);
+ if (cv != null)
+ {
+ targetRule.setPropertyValue(TextStyleKeys.TEXT_UNDERLINE_COLOR, cv);
+ }
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java
new file mode 100644
index 000000000000..bb81af95417c
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineStyleMapper.java
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.keys.text.TextDecorationStyle;
+import org.jfree.layouting.input.style.keys.text.TextStyleKeys;
+
+public class TextUnderlineStyleMapper extends OneOfConstantsMapper
+{
+
+ public TextUnderlineStyleMapper()
+ {
+ super(TextStyleKeys.TEXT_UNDERLINE_STYLE);
+ addMapping("none", TextDecorationStyle.NONE);
+ addMapping("solid", TextDecorationStyle.SOLID);
+ addMapping("dotted", TextDecorationStyle.DOTTED);
+ addMapping("dash", TextDecorationStyle.DASHED);
+ addMapping("long-dash", TextDecorationStyle.LONG_DASH);
+ addMapping("dot-dash", TextDecorationStyle.DOT_DASH);
+ addMapping("dot-dot-dash", TextDecorationStyle.DOT_DOT_DASH);
+ addMapping("wave", TextDecorationStyle.WAVE);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java
new file mode 100644
index 000000000000..1ce8fd7346e2
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWidthMapper.java
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.border.BorderWidth;
+import org.jfree.layouting.input.style.keys.text.TextDecorationWidth;
+import org.jfree.layouting.input.style.keys.text.TextStyleKeys;
+import org.jfree.layouting.input.style.values.CSSAutoValue;
+import org.jfree.layouting.input.style.values.CSSValue;
+
+public class TextUnderlineWidthMapper extends OneOfConstantsMapper
+{
+
+ public TextUnderlineWidthMapper()
+ {
+ super(TextStyleKeys.TEXT_UNDERLINE_WIDTH);
+ addMapping("auto", CSSAutoValue.getInstance());
+ addMapping("normal", BorderWidth.MEDIUM);
+ addMapping("bold", TextDecorationWidth.BOLD);
+ addMapping("thin", BorderWidth.THIN);
+ addMapping("dash", TextDecorationWidth.DASH);
+ addMapping("medium", BorderWidth.MEDIUM);
+ addMapping("thick", BorderWidth.THICK);
+ }
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ if (attrName == null)
+ {
+ throw new NullPointerException();
+ }
+
+ final CSSValue value = lookupMapping(attrValue);
+ if (value != null)
+ {
+ targetRule.setPropertyValue(getStyleKey(), value);
+ }
+ else
+ // percent
+ // positive integer
+ // positive length
+ {
+ targetRule.setPropertyValueAsString(getStyleKey(), attrValue);
+ }
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java
new file mode 100644
index 000000000000..733835c28849
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/TextUnderlineWordMode.java
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.keys.text.TextDecorationMode;
+import org.jfree.layouting.input.style.keys.text.TextStyleKeys;
+
+public class TextUnderlineWordMode extends OneOfConstantsMapper
+{
+
+ public TextUnderlineWordMode()
+ {
+ super(TextStyleKeys.TEXT_UNDERLINE_MODE);
+ addMapping("continuous", TextDecorationMode.CONTINUOUS);
+ addMapping("skip-white-space", TextDecorationMode.SKIP_WHITE_SPACE);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java
new file mode 100644
index 000000000000..12759a67329d
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/style/VerticalAlignMapper.java
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.style;
+
+import org.libreoffice.report.pentaho.parser.stylemapper.OneOfConstantsMapper;
+
+import org.jfree.layouting.input.style.keys.line.LineStyleKeys;
+import org.jfree.layouting.input.style.values.CSSAutoValue;
+import org.jfree.layouting.input.style.values.CSSConstant;
+
+public class VerticalAlignMapper extends OneOfConstantsMapper
+{
+
+ public VerticalAlignMapper()
+ {
+ super(LineStyleKeys.VERTICAL_ALIGN);
+ addMapping("top", new CSSConstant("top"));
+ addMapping("bottom", new CSSConstant("bottom"));
+ addMapping("middle", new CSSConstant("middle"));
+ addMapping("baseline", new CSSConstant("baseline"));
+ addMapping("auto", CSSAutoValue.getInstance());
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java
new file mode 100644
index 000000000000..c12d6aa62ed5
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/ColumnWidthMapper.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.table;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.box.BoxStyleKeys;
+
+/**
+ * Creation-Date: 03.07.2006, 13:08:27
+ *
+ */
+public class ColumnWidthMapper implements StyleMapper
+{
+
+ public ColumnWidthMapper()
+ {
+ }
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(BoxStyleKeys.WIDTH, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/RowHeightMapper.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/RowHeightMapper.java
new file mode 100644
index 000000000000..1d48b696853f
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/stylemapper/table/RowHeightMapper.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.stylemapper.table;
+
+import org.libreoffice.report.pentaho.parser.StyleMapper;
+
+import org.jfree.layouting.input.style.CSSDeclarationRule;
+import org.jfree.layouting.input.style.keys.box.BoxStyleKeys;
+
+/**
+ * Creation-Date: 03.07.2006, 13:08:27
+ *
+ */
+public class RowHeightMapper implements StyleMapper
+{
+
+ public RowHeightMapper()
+ {
+ }
+
+ public void updateStyle(final String uri,
+ final String attrName,
+ final String attrValue,
+ final CSSDeclarationRule targetRule)
+ {
+ targetRule.setPropertyValueAsString(BoxStyleKeys.HEIGHT, attrValue);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/CoveredCellReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/CoveredCellReadHandler.java
new file mode 100644
index 000000000000..c2cba6187024
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/CoveredCellReadHandler.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+/**
+ * Todo: Document me!
+ *
+ * @since 14.03.2007
+ */
+public class CoveredCellReadHandler extends ElementReadHandler
+{
+
+ private final Element coveredCell;
+
+ public CoveredCellReadHandler()
+ {
+ coveredCell = new Section();
+ }
+
+ public Element getElement()
+ {
+ return coveredCell;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableCellReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableCellReadHandler.java
new file mode 100644
index 000000000000..e987dbbe8712
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableCellReadHandler.java
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.pentaho.model.TableCellElement;
+import org.libreoffice.report.pentaho.parser.text.NoCDATATextContentReadHandler;
+
+/**
+ * A read handler for table-cell contents. This is basicly a text-content
+ * read handler; we may extend this implementation later.
+ *
+ * @since 05.03.2007
+ */
+public class TableCellReadHandler extends NoCDATATextContentReadHandler
+{
+
+ public TableCellReadHandler()
+ {
+ super(new TableCellElement(), true);
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnReadHandler.java
new file mode 100644
index 000000000000..ba83447ea4f6
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnReadHandler.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+/**
+ * Creation-Date: 03.07.2006, 14:26:55
+ *
+ */
+public class TableColumnReadHandler extends ElementReadHandler
+{
+
+ private final Section tableColumn;
+
+ public TableColumnReadHandler()
+ {
+ tableColumn = new Section();
+ }
+
+ public Element getElement()
+ {
+ return tableColumn;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnsReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnsReadHandler.java
new file mode 100644
index 000000000000..d8e866991053
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableColumnsReadHandler.java
@@ -0,0 +1,93 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Creation-Date: 03.07.2006, 13:50:41
+ *
+ */
+public class TableColumnsReadHandler extends ElementReadHandler
+{
+
+ private final List<TableColumnReadHandler> columns;
+ private final Section tableColumns;
+
+ public TableColumnsReadHandler()
+ {
+ columns = new ArrayList<TableColumnReadHandler>();
+ tableColumns = new Section();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.TABLE_NS.equals(uri) && OfficeToken.TABLE_COLUMN.equals(tagName))
+ {
+ final TableColumnReadHandler readHandler = new TableColumnReadHandler();
+ columns.add(readHandler);
+ return readHandler;
+ }
+
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < columns.size(); i++)
+ {
+ final TableColumnReadHandler handler = columns.get(i);
+ tableColumns.addNode(handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return tableColumns;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableReadHandler.java
new file mode 100644
index 000000000000..eec0954eeff6
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableReadHandler.java
@@ -0,0 +1,135 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.model.OfficeTableSection;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.ConditionalPrintExpressionReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Creation-Date: 03.07.2006, 13:47:47
+ *
+ */
+public class TableReadHandler extends ElementReadHandler
+{
+
+ private final List<ElementReadHandler> children;
+ private final Section table;
+
+ public TableReadHandler()
+ {
+ children = new ArrayList<ElementReadHandler>();
+ table = new OfficeTableSection();
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs)
+ throws SAXException
+ {
+ super.startParsing(attrs);
+ final String enabled = attrs.getValue(OfficeNamespaces.OOREPORT_NS, "visible");
+ if (enabled == null || OfficeToken.TRUE.equals(enabled))
+ {
+ table.setEnabled(true);
+ }
+ else
+ {
+ table.setEnabled(false);
+ }
+
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri) && "conditional-print-expression".equals(tagName))
+ {
+ return new ConditionalPrintExpressionReadHandler(table);
+ }
+ else if (OfficeNamespaces.TABLE_NS.equals(uri))
+ {
+ if (OfficeToken.TABLE_COLUMNS.equals(tagName) || OfficeToken.TABLE_HEADER_COLUMNS.equals(tagName))
+ {
+ final TableColumnsReadHandler columns = new TableColumnsReadHandler();
+ children.add(columns);
+ return columns;
+ }
+ else if (OfficeToken.TABLE_ROW.equals(tagName))
+ {
+ final TableRowReadHandler rowHandler = new TableRowReadHandler();
+ children.add(rowHandler);
+ return rowHandler;
+ }
+ else if (OfficeToken.TABLE_ROWS.equals(tagName) || OfficeToken.TABLE_HEADER_ROWS.equals(tagName))
+ {
+ final TableRowsReadHandler rowsHandler = new TableRowsReadHandler();
+ children.add(rowsHandler);
+ return rowsHandler;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ final ElementReadHandler handler = children.get(i);
+ table.addNode(handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return table;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowReadHandler.java
new file mode 100644
index 000000000000..413cfaefbb68
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowReadHandler.java
@@ -0,0 +1,116 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Creation-Date: 03.07.2006, 13:51:47
+ *
+ */
+public class TableRowReadHandler extends ElementReadHandler
+{
+
+ private final List<ElementReadHandler> tableCells;
+ private final Section tableRow;
+
+ public TableRowReadHandler()
+ {
+ tableCells = new ArrayList<ElementReadHandler>();
+ tableRow = new Section();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ final ElementReadHandler rh;
+ if (OfficeNamespaces.TABLE_NS.equals(uri))
+ {
+ if (OfficeToken.TABLE_CELL.equals(tagName))
+ {
+ rh = new TableCellReadHandler();
+ }
+ else if (OfficeToken.COVERED_TABLE_CELL.equals(tagName))
+ {
+ rh = new CoveredCellReadHandler();
+ }
+ else
+ {
+ rh = null;
+ }
+ if (rh != null)
+ {
+ tableCells.add(rh);
+ }
+ }
+ else
+ {
+ rh = null;
+ }
+ return rh;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < tableCells.size(); i++)
+ {
+ final ElementReadHandler handler = tableCells.get(i);
+ tableRow.addNode(handler.getElement());
+ }
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Element getElement()
+ {
+ return tableRow;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowsReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowsReadHandler.java
new file mode 100644
index 000000000000..019fdbdc8c34
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/table/TableRowsReadHandler.java
@@ -0,0 +1,89 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.table;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class TableRowsReadHandler extends ElementReadHandler
+{
+
+ private final List<TableRowReadHandler> rows;
+ private final Section tableRows;
+
+ public TableRowsReadHandler()
+ {
+ rows = new ArrayList<TableRowReadHandler>();
+ tableRows = new Section();
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.TABLE_NS.equals(uri) && OfficeToken.TABLE_ROW.equals(tagName))
+ {
+ final TableRowReadHandler readHandler = new TableRowReadHandler();
+ rows.add(readHandler);
+ return readHandler;
+ }
+
+ return null;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < rows.size(); i++)
+ {
+ final TableRowReadHandler handler = rows.get(i);
+ tableRows.addNode(handler.getElement());
+ }
+ }
+
+ public Element getElement()
+ {
+ return tableRows;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/text/NoCDATATextContentReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/text/NoCDATATextContentReadHandler.java
new file mode 100644
index 000000000000..fd05be68a572
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/text/NoCDATATextContentReadHandler.java
@@ -0,0 +1,182 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+package org.libreoffice.report.pentaho.parser.text;
+
+import org.libreoffice.report.OfficeToken;
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+import org.libreoffice.report.pentaho.parser.ElementReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.FixedContentReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.FormattedTextReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.ImageReadHandler;
+import org.libreoffice.report.pentaho.parser.rpt.SubDocumentReadHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jfree.report.structure.Element;
+import org.jfree.report.structure.Section;
+import org.jfree.report.structure.StaticText;
+
+import org.pentaho.reporting.libraries.xmlns.parser.XmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * This is a generic implementation that accepts all input and adds special
+ * handlers for the report-elements.
+ *
+ */
+public class NoCDATATextContentReadHandler extends ElementReadHandler
+{
+
+ private Section section;
+ private List<Object> children;
+ private boolean copyType;
+
+ public NoCDATATextContentReadHandler(final Section section,
+ final boolean copyType)
+ {
+ this.children = new ArrayList<Object>();
+ this.section = section;
+ this.copyType = copyType;
+ }
+
+ public NoCDATATextContentReadHandler(final Section section)
+ {
+ this(section, false);
+ }
+
+ public NoCDATATextContentReadHandler()
+ {
+ this(new Section(), true);
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ super.startParsing(attrs);
+ final Element element = getElement();
+ if (copyType)
+ {
+ copyElementType(element);
+ }
+ copyAttributes(attrs, element);
+ }
+
+ /**
+ * Returns the handler for a child element.
+ *
+ * @param tagName the tag name.
+ * @param atts the attributes.
+ * @return the handler or null, if the tagname is invalid.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected XmlReadHandler getHandlerForChild(final String uri,
+ final String tagName,
+ final Attributes atts)
+ throws SAXException
+ {
+ if (OfficeNamespaces.OOREPORT_NS.equals(uri))
+ {
+ if ("fixed-content".equals(tagName))
+ {
+ final FixedContentReadHandler fixedContentReadHandler = new FixedContentReadHandler();
+ children.add(fixedContentReadHandler);
+ return fixedContentReadHandler;
+ }
+ if ("formatted-text".equals(tagName))
+ {
+ final FormattedTextReadHandler formattedTextReadHandler = new FormattedTextReadHandler();
+ children.add(formattedTextReadHandler);
+ return formattedTextReadHandler;
+ }
+ if (OfficeToken.IMAGE.equals(tagName))
+ {
+ final ImageReadHandler imageReadHandler = new ImageReadHandler();
+ children.add(imageReadHandler);
+ return imageReadHandler;
+ }
+ if ("sub-document".equals(tagName))
+ {
+ final SubDocumentReadHandler subDocReadHandler = new SubDocumentReadHandler(section);
+ // children.add(subDocReadHandler);
+ return subDocReadHandler;
+ }
+ }
+ if (OfficeNamespaces.DRAWING_NS.equals(uri))
+ {
+ final XmlReadHandler readHandler;
+ if (OfficeToken.IMAGE.equals(tagName))
+ {
+ readHandler = new ImageReadHandler();
+ }
+ else
+ {
+ readHandler = new NoCDATATextContentReadHandler();
+ }
+ children.add(readHandler);
+ return readHandler;
+ }
+ else
+ {
+ final TextContentReadHandler readHandler = new TextContentReadHandler();
+ children.add(readHandler);
+ return readHandler;
+ }
+ }
+
+ public List<Object> getChildren()
+ {
+ return children;
+ }
+
+ /**
+ * Done parsing.
+ *
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void doneParsing() throws SAXException
+ {
+ for (int i = 0; i < children.size(); i++)
+ {
+ final Object o = children.get(i);
+ if (o instanceof ElementReadHandler)
+ {
+ final ElementReadHandler handler = (ElementReadHandler) o;
+ section.addNode(handler.getElement());
+ }
+ else if (o instanceof StaticText)
+ {
+ section.addNode((StaticText) o);
+ }
+ }
+ }
+
+ public Element getElement()
+ {
+ return section;
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/text/TextContentReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/text/TextContentReadHandler.java
new file mode 100644
index 000000000000..08a410a5c7bc
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/text/TextContentReadHandler.java
@@ -0,0 +1,60 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.text;
+
+import org.jfree.report.structure.Section;
+import org.jfree.report.structure.StaticText;
+
+import org.xml.sax.SAXException;
+
+/**
+ * This is a generic implementation that accepts all input and adds special
+ * handlers for the report-elements.
+ *
+ */
+public class TextContentReadHandler extends NoCDATATextContentReadHandler
+{
+
+ public TextContentReadHandler(final Section section, final boolean copyType)
+ {
+ super(section, copyType);
+ }
+
+ public TextContentReadHandler(final Section section)
+ {
+ super(section);
+ }
+
+ public TextContentReadHandler()
+ {
+ }
+
+ /**
+ * This method is called to process the character data between element tags.
+ *
+ * @param ch the character buffer.
+ * @param start the start index.
+ * @param length the length.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ public void characters(final char[] ch, final int start, final int length)
+ throws SAXException
+ {
+ getChildren().add(new StaticText(new String(ch, start, length)));
+ }
+}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/parser/xlink/XLinkReadHandler.java b/reportbuilder/java/org/libreoffice/report/pentaho/parser/xlink/XLinkReadHandler.java
new file mode 100644
index 000000000000..beb57b2eabb9
--- /dev/null
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/parser/xlink/XLinkReadHandler.java
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+package org.libreoffice.report.pentaho.parser.xlink;
+
+import org.libreoffice.report.pentaho.OfficeNamespaces;
+
+import org.pentaho.reporting.libraries.xmlns.parser.AbstractXmlReadHandler;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * An image reference.
+ *
+ */
+public class XLinkReadHandler extends AbstractXmlReadHandler
+{
+
+ private String uri;
+ private String type;
+ private String show;
+ private String actuate;
+
+ public XLinkReadHandler()
+ {
+ }
+
+ /**
+ * Starts parsing.
+ *
+ * @param attrs the attributes.
+ * @throws org.xml.sax.SAXException if there is a parsing error.
+ */
+ protected void startParsing(final Attributes attrs) throws SAXException
+ {
+ uri = attrs.getValue(OfficeNamespaces.XLINK_NS, "uri");
+ type = attrs.getValue(OfficeNamespaces.XLINK_NS, "type");
+ show = attrs.getValue(OfficeNamespaces.XLINK_NS, "show");
+ actuate = attrs.getValue(OfficeNamespaces.XLINK_NS, "actuate");
+ }
+
+ /**
+ * Returns the object for this element or null, if this element does not
+ * create an object.
+ *
+ * @return the object.
+ */
+ public Object getObject() throws SAXException
+ {
+ return uri;
+ }
+
+ public String getUri()
+ {
+ return uri;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getShow()
+ {
+ return show;
+ }
+
+ public String getActuate()
+ {
+ return actuate;
+ }
+}