diff options
Diffstat (limited to 'reportbuilder/java/org/libreoffice/report/pentaho/model')
26 files changed, 1660 insertions, 0 deletions
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/DataStyle.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/DataStyle.java new file mode 100644 index 000000000..38b6aada4 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/DataStyle.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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Section; + +/** + * Represents an automatic or manual data style definition. + * + * @since 02.03.2007 + */ +public class DataStyle extends Section +{ + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/FixedTextElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/FixedTextElement.java new file mode 100644 index 000000000..45145b7cf --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/FixedTextElement.java @@ -0,0 +1,42 @@ +/* + * 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.model; + +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @since 02.03.2007 + */ +public class FixedTextElement extends ReportElement +{ + + private final Section content; + + public FixedTextElement() + { + content = new Section(); + content.setVirtual(true); + } + + public Section getContent() + { + return content; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/FontFaceDeclsSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/FontFaceDeclsSection.java new file mode 100644 index 000000000..b4e4bd1d5 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/FontFaceDeclsSection.java @@ -0,0 +1,64 @@ +/* + * 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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import java.util.HashMap; +import java.util.Map; + +import org.jfree.report.structure.Element; + + +/** + * Todo: Document me! + * + * @since 13.03.2007 + */ +public class FontFaceDeclsSection extends Element +{ + + private final Map<String,FontFaceElement> fontFaces; + + public FontFaceDeclsSection() + { + fontFaces = new HashMap<String,FontFaceElement>(); + setType("font-face-decls"); + setNamespace(OfficeNamespaces.OFFICE_NS); + } + + public void addFontFace(final FontFaceElement style) + { + fontFaces.put(style.getStyleName(), style); + } + + public FontFaceElement getFontFace(final String name) + { + return fontFaces.get(name); + } + + public FontFaceElement[] getAllFontFaces() + { + return fontFaces.values().toArray(new FontFaceElement[fontFaces.size()]); + } + + public boolean containsFont(final String fontName) + { + return fontFaces.containsKey(fontName); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/FontFaceElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/FontFaceElement.java new file mode 100644 index 000000000..93d9399dd --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/FontFaceElement.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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Section; + +/** + * Represents an automatic or manual data style definition. + * + * @since 02.03.2007 + */ +public class FontFaceElement extends Section +{ + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/FormatCondition.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/FormatCondition.java new file mode 100644 index 000000000..32ca96eef --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/FormatCondition.java @@ -0,0 +1,57 @@ +/* + * 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.model; + +import org.jfree.report.expressions.FormulaExpression; + +/** + * The format condition defines, what style-format is applied to an element. + * + * @since 02.03.2007 + */ +public class FormatCondition +{ + + private final FormulaExpression formula; + private final String styleName; + private final boolean enabled; + + public FormatCondition(final FormulaExpression formula, + final String styleName, + final boolean enabled) + { + this.formula = formula; + this.styleName = styleName; + this.enabled = enabled; + } + + public FormulaExpression getFormula() + { + return formula; + } + + public String getStyleName() + { + return styleName; + } + + public boolean isEnabled() + { + return enabled; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/FormattedTextElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/FormattedTextElement.java new file mode 100644 index 000000000..b6cb58ebc --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/FormattedTextElement.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.model; + +import org.jfree.report.expressions.FormulaExpression; + +/** + * A formatted text element takes a formula, evaluates it and formats the + * given element using some arbitrary style. (As this is totally undocumented, + * we leave this out for now. Either we'll insert a field there or we call + * a UNO-component to do the formatting. + * + * @since 02.03.2007 + */ +public class FormattedTextElement extends ReportElement +{ + + private FormulaExpression valueExpression; + + public FormulaExpression getValueExpression() + { + return valueExpression; + } + + public void setValueExpression(final FormulaExpression valueExpression) + { + this.valueExpression = valueExpression; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/ImageElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/ImageElement.java new file mode 100644 index 000000000..fe29bd6f5 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/ImageElement.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.model; + +import org.libreoffice.report.OfficeToken; +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.expressions.FormulaExpression; + +/** + * Todo: Document me! + * + * @since 02.03.2007 + */ +public class ImageElement extends ReportElement +{ + + private FormulaExpression formula; + + public FormulaExpression getFormula() + { + return formula; + } + + public void setFormula(final FormulaExpression formula) + { + this.formula = formula; + } + + public String getScaleMode() + { + String val = (String) getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.SCALE); + if (OfficeToken.TRUE.equals(val)) + { + val = OfficeToken.ANISOTROPIC; + } + else if (OfficeToken.FALSE.equals(val) || val == null) + { + val = OfficeToken.NONE; + } + return val; + } + + public boolean isPreserveIRI() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI)); + } + + public String getImageData() + { + return (String) getAttribute(OfficeNamespaces.FORM_NS, OfficeToken.IMAGE_DATA); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/ObjectOleElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/ObjectOleElement.java new file mode 100644 index 000000000..ddd74bd8b --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/ObjectOleElement.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.model; + +import java.util.ArrayList; +import java.util.List; + +public class ObjectOleElement extends ReportElement +{ + + private String url; + private final List<String> masterfields; + private final List<String> detailfields; + private String classid; + + public ObjectOleElement() + { + masterfields = new ArrayList<String>(); + detailfields = new ArrayList<String>(); + } + + public String getClassid() + { + return classid; + } + + public List<String> getDetailfields() + { + return detailfields; + } + + public List<String> getMasterfields() + { + return masterfields; + } + + public String getUrl() + { + return url; + } + + public void setClassId(final String classid) + { + this.classid = classid; + } + + public void setUrl(final String _url) + { + url = _url; + } + + public void addMasterDetailFields(final String master, final String detail) + { + if (master != null) + { + masterfields.add(master); + detailfields.add(detail == null ? master : detail); + } + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeDetailSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeDetailSection.java new file mode 100644 index 000000000..aaf8f7d95 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeDetailSection.java @@ -0,0 +1,30 @@ +/* + * 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.model; + +import org.jfree.report.structure.DetailSection; + +/** + * A Marker-Class. + * + * @since 02.03.2007 + */ +public class OfficeDetailSection extends DetailSection +{ + +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeDocument.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeDocument.java new file mode 100644 index 000000000..e7da21583 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeDocument.java @@ -0,0 +1,59 @@ +/* + * 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.model; + +import org.libreoffice.report.JobProperties; + +import org.jfree.report.JFreeReport; + +/** + * An office document represents the root of the report processing. In + * OpenOffice reports, this is the only child of the report object. + * + * @since 02.03.2007 + */ +public class OfficeDocument extends JFreeReport +{ + + private OfficeStylesCollection stylesCollection; + private JobProperties jobProperties; + + public JobProperties getJobProperties() + { + return jobProperties; + } + + public void setJobProperties(final JobProperties jobProperties) + { + this.jobProperties = jobProperties; + } + + public OfficeStylesCollection getStylesCollection() + { + return stylesCollection; + } + + public void setStylesCollection(final OfficeStylesCollection stylesCollection) + { + if (stylesCollection == null) + { + throw new NullPointerException(); + } + this.stylesCollection = stylesCollection; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroup.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroup.java new file mode 100644 index 000000000..e632cc938 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroup.java @@ -0,0 +1,80 @@ +/* + * 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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.expressions.Expression; +import org.jfree.report.structure.Section; + +/** + * An office group is a virtual section that contains the group header, footer + * and either a detail section or another group. + * + * @since 02.03.2007 + */ +public class OfficeGroup extends Section +{ + + public OfficeGroupSection getHeader() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return (OfficeGroupSection) instanceSection.findFirstChild(OfficeNamespaces.OOREPORT_NS, "group-header"); + + } + + public OfficeGroupSection getFooter() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return (OfficeGroupSection) instanceSection.findFirstChild(OfficeNamespaces.OOREPORT_NS, "group-footer"); + + } + + public Expression getGroupingExpression() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return instanceSection.getGroupingExpression(); + } + + public String getSortingExpression() + { + final OfficeGroupInstanceSection instanceSection = + (OfficeGroupInstanceSection) findFirstChild(JFreeReportInfo.REPORT_NAMESPACE, "group-instance"); + if (instanceSection == null) + { + return null; + } + return instanceSection.getSortingExpression(); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroupInstanceSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroupInstanceSection.java new file mode 100644 index 000000000..cf8728f65 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroupInstanceSection.java @@ -0,0 +1,42 @@ +/* + * 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.model; + +import org.jfree.report.structure.Group; + +/** + * Creation-Date: 25.07.2007, 14:41:54 + * + */ +public class OfficeGroupInstanceSection extends Group +{ + + private String sortingExpression; + + public void setSortingExpression(String s) + { + sortingExpression=s; + } + + public String getSortingExpression() + { + return sortingExpression; + } + +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroupSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroupSection.java new file mode 100644 index 000000000..d49c96064 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeGroupSection.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.model; + +import org.libreoffice.report.OfficeToken; +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Section; + +/** + * A group header or footer. If such a section is marked as sticky, it will be + * repeated on each new page. + * + * @since 02.03.2007 + */ +public class OfficeGroupSection extends Section +{ + + public boolean isRepeatSection() + { + final Object repeatFlag = + getAttribute(OfficeNamespaces.OOREPORT_NS, "repeat-section"); + return OfficeToken.TRUE.equals(repeatFlag); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeMasterPage.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeMasterPage.java new file mode 100644 index 000000000..43216f6b9 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeMasterPage.java @@ -0,0 +1,52 @@ +/* + * 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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Section; + +/** + * A master page. A master page can contain header and footer and is linked + * to a page-layout. + * + * @since 13.03.2007 + */ +public class OfficeMasterPage extends Section +{ + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + public String getPageLayout() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name"); + } + + public void setPageLayout(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "page-layout-name", name); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeMasterStyles.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeMasterStyles.java new file mode 100644 index 000000000..be42e9862 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeMasterStyles.java @@ -0,0 +1,73 @@ +/* + * 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.model; + +import java.util.HashMap; +import java.util.Map; + +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + + +/** + * The master-styles section can have either a master-page, handout-master + * or draw-layer-set. (The latter ones are ignored for the reporting purposes, + * they are PowerPoint related.) + * + * There is no documentation how the system selects a master-page if there is + * no master-page assigned to the paragraph. However, it seems as if the + * master-page called 'Standard' is used as initial default. + * + * @since 13.03.2007 + */ +public class OfficeMasterStyles extends Element +{ + + private final Map<String,OfficeMasterPage> masterPages; + private final Section otherNodes; + + public OfficeMasterStyles() + { + masterPages = new HashMap<String,OfficeMasterPage>(); + otherNodes = new Section(); + } + + public void addMasterPage(final OfficeMasterPage masterPage) + { + if (masterPage == null) + { + throw new NullPointerException(); + } + this.masterPages.put(masterPage.getStyleName(), masterPage); + } + + public OfficeMasterPage getMasterPage(final String name) + { + return masterPages.get(name); + } + + public OfficeMasterPage[] getAllMasterPages() + { + return masterPages.values().toArray(new OfficeMasterPage[masterPages.size()]); + } + + public Section getOtherNodes() + { + return otherNodes; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeReport.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeReport.java new file mode 100644 index 000000000..e9ba60f6d --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeReport.java @@ -0,0 +1,122 @@ +/* + * 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.model; + +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Node; + +/** + * A office report is an ordered section. It contains several root-level bands + * which need to be processed in a given order. + * + * A report can have named expression attached. These expressions will be + * computed at the global scope and will be available for all child elements. + * + * @since 02.03.2007 + */ +public class OfficeReport extends Element +{ + + private Node pageHeader; + private Node pageFooter; + private Node reportHeader; + private Node reportFooter; + private Node bodySection; + private Node preBodySection; + private Node postBodySection; + + public Node getPostBodySection() + { + return postBodySection; + } + + public void setPostBodySection(final Node postBodySection) + { + this.postBodySection = postBodySection; + } + + public Node getPreBodySection() + { + return preBodySection; + } + + public void setPreBodySection(final Node preBodySection) + { + this.preBodySection = preBodySection; + } + + public Node getPageHeader() + { + return pageHeader; + } + + public void setPageHeader(final Node pageHeader) + { + this.pageHeader = pageHeader; + } + + public Node getPageFooter() + { + return pageFooter; + } + + public void setPageFooter(final Node pageFooter) + { + this.pageFooter = pageFooter; + } + + public Node getColumnHeader() + { + return null; + } + + public Node getColumnFooter() + { + return null; + } + + public Node getReportHeader() + { + return reportHeader; + } + + public void setReportHeader(final Node reportHeader) + { + this.reportHeader = reportHeader; + } + + public Node getReportFooter() + { + return reportFooter; + } + + public void setReportFooter(final Node reportFooter) + { + this.reportFooter = reportFooter; + } + + public Node getBodySection() + { + return bodySection; + } + + public void setBodySection(final Node bodySection) + { + this.bodySection = bodySection; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyle.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyle.java new file mode 100644 index 000000000..e5fdf1378 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyle.java @@ -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 . + */ +package org.libreoffice.report.pentaho.model; + +import org.libreoffice.report.OfficeToken; +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + +/** + * Represents an automatic or manual style definition. + * + * @since 02.03.2007 + */ +public class OfficeStyle extends Section +{ + + public OfficeStyle() + { + setNamespace(OfficeNamespaces.STYLE_NS); + setType("style"); + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + /** + * A parent style name must be a common style (it cannot be an automatic + * style) and has to exist. If no parent style is given, an implementation + * specific default style is used. + */ + public String getStyleParent() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name"); + } + + public void setStyleParent(final String parentName) + { + setAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name", parentName); + } + + public String getStyleFamily() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "family"); + } + + public void setStyleFamily(final String family) + { + setAttribute(OfficeNamespaces.STYLE_NS, "family", family); + } + + public Element getParagraphProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "paragraph-properties"); + } + + public Element getTextProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "text-properties"); + } + + public Element getTableRowProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-row-properties"); + } + + public Element getTableColumnProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-column-properties"); + } + + public Element getTableCellProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-cell-properties"); + } + + public Element getGraphicProperties() + { + return findFirstChild(OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java new file mode 100644 index 000000000..3844a0ba2 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStyles.java @@ -0,0 +1,180 @@ +/* + * 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.model; + +import java.io.Serializable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.jfree.report.structure.Element; + + +/** + * Holds one style type, either an automatic, common or master style. This is a + * marker container that defines the nature of the styles contained within this + * container. (Yeah, it is awkward, but that's how the document model describes + * it.) + * + * The style family can be one of paragraph, text, section, table, table-column, + * table-row, table-cell, table-page, chart, default, drawing-page, graphic, + * presentation, control and ruby. + * + * @since 07.03.2007 + */ +public class OfficeStyles extends Element +{ + + private static class StyleKey implements Serializable + { + + private static final long serialVersionUID = 4931878927362887477L; + private final String family; + private final String name; + + private StyleKey(final String family, final String name) + { + if (family == null) + { + throw new NullPointerException(); + } + this.family = family; + this.name = name; + } + + @Override + public boolean equals(final Object obj) + { + if (this != obj) + { + if (obj == null || getClass() != obj.getClass()) + { + return false; + } + + final StyleKey styleKey = (StyleKey) obj; + + if (!family.equals(styleKey.family) || (name != null ? !name.equals(styleKey.name) : styleKey.name != null)) + { + return false; + } + } + return true; + } + + @Override + public int hashCode() + { + int result = family.hashCode(); + result = 31 * result + (name != null ? name.hashCode() : 0); + return result; + } + } + private final Map<String,PageLayout> pageStyles; + private final Map<String,DataStyle> dataStyles; + private final Map<StyleKey,OfficeStyle> styles; + private final List<Element> otherChildren; + + public OfficeStyles() + { + this.styles = new HashMap<StyleKey,OfficeStyle>(); + this.dataStyles = new HashMap<String,DataStyle>(); + this.pageStyles = new HashMap<String,PageLayout>(); + this.otherChildren = new ArrayList<Element>(); + } + + public OfficeStyle getStyle(final String family, final String name) + { + return styles.get(new StyleKey(family, name)); + } + + public void addStyle(final OfficeStyle style) + { + if (style == null) + { + throw new NullPointerException(); + } + final String styleFamily = style.getStyleFamily(); + if (styleFamily == null) + { + throw new NullPointerException(); + } + if (style.getStyleName() == null) + { + throw new NullPointerException(); + } + styles.put(new StyleKey(styleFamily, style.getStyleName()), style); + } + + public void addPageStyle(final PageLayout style) + { + pageStyles.put(style.getStyleName(), style); + } + + public PageLayout getPageStyle(final String name) + { + return pageStyles.get(name); + } + + public void addDataStyle(final DataStyle style) + { + dataStyles.put(style.getStyleName(), style); + } + + public DataStyle getDataStyle(final String name) + { + return dataStyles.get(name); + } + + public void addOtherNode(final Element node) + { + otherChildren.add(node); + } + + public DataStyle[] getAllDataStyles() + { + return dataStyles.values().toArray(new DataStyle[dataStyles.size()]); + } + + public PageLayout[] getAllPageStyles() + { + return pageStyles.values().toArray(new PageLayout[pageStyles.size()]); + } + + public OfficeStyle[] getAllStyles() + { + return styles.values().toArray(new OfficeStyle[styles.size()]); + } + + public Element[] getOtherStyles() + { + return otherChildren.toArray(new Element[otherChildren.size()]); + } + + public boolean containsStyle(final String family, final String name) + { + return styles.containsKey(new StyleKey(family, name)); + } + + public boolean containsDataStyle(final String styleName) + { + return dataStyles.containsKey(styleName); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStylesCollection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStylesCollection.java new file mode 100644 index 000000000..eee9ad553 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeStylesCollection.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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Element; + +/** + * Holds all style-definitions and provides some simplified lookup methods to + * grab them by their type and name. + * + * <p>For now, we are only interested in 'style:style' nodes. Each of these nodes + * has a style-name and a style-family. Each style declaration can have a parent + * style, from which properties are inherited.</p> + * + * <p>Style names are unique within the family, no matter whether the style is an + * automatic style, a common style or a master style.</p> + * + * <p>The contents of this element are the union of the 'styles.xml' file (if it + * exists), the font-declarations and auto-styles of the document-content.xml + * and the styles declared in the main document.</p> + * + * @since 06.03.2007 + */ +public class OfficeStylesCollection extends Element +{ + // Font-face declarations are copied as is. We simply merge them by adding + // them all in one set. This may result in duplicate entries, but as the + // fileformat does not forbid that, it therefore must be ok. + + private final FontFaceDeclsSection fontFaceDecls; + private final OfficeStyles automaticStyles; + private final OfficeStyles commonStyles; + private final OfficeMasterStyles masterStyles; + + public OfficeStylesCollection() + { + fontFaceDecls = new FontFaceDeclsSection(); + + automaticStyles = new OfficeStyles(); + automaticStyles.setType("automatic-styles"); + automaticStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + + commonStyles = new OfficeStyles(); + commonStyles.setType("styles"); + commonStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + + masterStyles = new OfficeMasterStyles(); + masterStyles.setType("master-styles"); + masterStyles.setNamespace(OfficeNamespaces.OFFICE_NS); + } + + public OfficeStyle getStyle(final String family, final String name) + { + final OfficeStyle commonStyle = commonStyles.getStyle(family, name); + if (commonStyle != null) + { + return commonStyle; + } + final OfficeStyle autoStyle = automaticStyles.getStyle(family, name); + if (autoStyle != null) + { + return autoStyle; + } + + // And later: Autogenerate one of the default styles. + // However, at this moment, we don't have a clue about the default styles + // at all. Maybe we should add them to make this implementation more robust + // against invalid documents. + return null; + } + + public boolean containsStyle(final String family, final String name) + { + return (getStyle(family, name) != null); + } + + public OfficeStyles getAutomaticStyles() + { + return automaticStyles; + } + + public OfficeStyles getCommonStyles() + { + return commonStyles; + } + + public OfficeMasterStyles getMasterStyles() + { + return masterStyles; + } + + public FontFaceDeclsSection getFontFaceDecls() + { + return fontFaceDecls; + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeTableSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeTableSection.java new file mode 100644 index 000000000..821fb3b89 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/OfficeTableSection.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.model; + +import org.jfree.report.structure.Section; + +/** + * Creation-Date: 24.04.2007, 15:55:17 + * + */ +public class OfficeTableSection extends Section +{ + +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/PageLayout.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/PageLayout.java new file mode 100644 index 000000000..8ef007c7e --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/PageLayout.java @@ -0,0 +1,58 @@ +/* + * 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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.report.structure.Section; + +/** + * A page layout describes the physical properties of a page. It is equal to + * an @page rule in CSS. + * + * @since 13.03.2007 + */ +public class PageLayout extends Section +{ + + public PageLayout() + { + setNamespace(OfficeNamespaces.STYLE_NS); + setType("page-layout"); + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + public Section getHeaderStyle() + { + return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "header-style"); + } + + public Section getFooterStyle() + { + return (Section) findFirstChild(OfficeNamespaces.STYLE_NS, "footer-style"); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/PageSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/PageSection.java new file mode 100644 index 000000000..732339705 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/PageSection.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.model; + +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import org.jfree.layouting.util.AttributeMap; +import org.jfree.report.structure.Section; + +/** + * This represents either a page header or page footer. + * + * @since 02.03.2007 + */ +public class PageSection extends Section +{ + + private static final String NOT_WITH_REPORT_HEADER_NOR_FOOTER = "not-with-report-header-nor-footer"; + + public static boolean isPrintWithReportHeader(final AttributeMap attrs) + { + final String pagePrintOption = (String) attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "page-print-option"); + return !("not-with-report-header".equals(pagePrintOption) || NOT_WITH_REPORT_HEADER_NOR_FOOTER.equals(pagePrintOption)); + } + + public static boolean isPrintWithReportFooter(final AttributeMap attrs) + { + final String pagePrintOption = (String) attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "page-print-option"); + return !("not-with-report-footer".equals(pagePrintOption) || NOT_WITH_REPORT_HEADER_NOR_FOOTER.equals(pagePrintOption)); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/RawText.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/RawText.java new file mode 100644 index 000000000..bebbb8637 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/RawText.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.model; + +import org.jfree.report.structure.StaticText; + +/** + * A marker implementation. If encountered by the OfficeRawTarget, this text + * will be written without being normalized. Such text represents a page + * header or footer. + * + * @since 13.03.2007 + */ +public class RawText extends StaticText +{ + + public RawText(final String text) + { + super(text); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/ReportElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/ReportElement.java new file mode 100644 index 000000000..59dabe01d --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/ReportElement.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.model; + +import org.libreoffice.report.OfficeToken; +import org.libreoffice.report.pentaho.OfficeNamespaces; + +import java.util.ArrayList; +import java.util.List; + +import org.jfree.report.structure.Element; + + +/** + * A report element is the base class for all content generating elements in a + * report. + * + * @since 02.03.2007 + */ +public abstract class ReportElement extends Element +{ + + private final List<FormatCondition> formatConditions; + + protected ReportElement() + { + formatConditions = new ArrayList<FormatCondition>(); + } + + /** + * Checks the current group and prints this element only if the current row is + * the first row for that particular group. + * + * @return true, if the element should only be printed in the first row of the + * current group, false otherwise. + */ + public boolean isPrintWhenGroupChange() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-change")); + } + + public void setPrintWhenGroupChange(final boolean printWhenGroupChange) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-change", + String.valueOf(printWhenGroupChange)); + } + + /** + * Checks, whether the printed value has been changed since the last run. The + * element will only be printed, if there was at least one change. + * + * @return true, if repeated values should be printed, false if repeated + * values should be suppressed. + */ + public boolean isPrintRepeatedValues() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, "print-repeated-values")); + } + + public void setPrintRepeatedValues(final boolean printRepeatedValues) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-repeated-values", + String.valueOf(printRepeatedValues)); + } + + public void addFormatCondition(final FormatCondition formatCondition) + { + if (formatCondition == null) + { + throw new NullPointerException(); + } + + this.formatConditions.add(formatCondition); + } + + public FormatCondition[] getFormatConditions() + { + return this.formatConditions.toArray(new FormatCondition[this.formatConditions.size()]); + } + + public int getFormatConditionCount() + { + return formatConditions.size(); + } +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/TableCellElement.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/TableCellElement.java new file mode 100644 index 000000000..4acc89f39 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/TableCellElement.java @@ -0,0 +1,30 @@ +/* + * 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.model; + +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @since 05.03.2007 + */ +public class TableCellElement extends Section +{ + +} diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/model/VariablesDeclarationSection.java b/reportbuilder/java/org/libreoffice/report/pentaho/model/VariablesDeclarationSection.java new file mode 100644 index 000000000..c42917653 --- /dev/null +++ b/reportbuilder/java/org/libreoffice/report/pentaho/model/VariablesDeclarationSection.java @@ -0,0 +1,42 @@ +/* + * 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.model; + +import org.jfree.report.JFreeReportInfo; +import org.jfree.report.structure.Section; + +/** + * A paragraph that contains variables-declarations. This paragraph will be + * printed in the first cell of the first table (if there's one). + * + * The VariablesDeclarationSection is an auto-generated structure element that + * has no model-representation. The section itself is empty and simply acts + * as flag for the output-processor. The output processor itself is responsible + * to maintain the variables. + * + * @since 19.03.2007 + */ +public class VariablesDeclarationSection extends Section +{ + + public VariablesDeclarationSection() + { + setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + setType("variables-section"); + } +} |