diff options
Diffstat (limited to 'reportbuilder/java/com/sun/star/report/pentaho/model')
26 files changed, 2047 insertions, 0 deletions
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java new file mode 100644 index 000000000000..efef723425da --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/DataStyle.java @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: DataStyle.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * Represents an automatic or manual data style definition. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class DataStyle extends Section +{ + public DataStyle() + { + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java new file mode 100644 index 000000000000..7632ee1fd650 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FixedTextElement.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FixedTextElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @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/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java new file mode 100644 index 000000000000..9b509b0b0157 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceDeclsSection.java @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FontFaceDeclsSection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import java.util.HashMap; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import java.util.Map; +import org.jfree.report.structure.Element; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class FontFaceDeclsSection extends Element +{ + private final Map fontFaces; + + public FontFaceDeclsSection() + { + fontFaces = new HashMap(); + 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 (FontFaceElement) fontFaces.get(name); + } + + public FontFaceElement[] getAllFontFaces() + { + return (FontFaceElement[]) fontFaces.values().toArray + (new FontFaceElement[fontFaces.size()]); + } + + + public boolean containsFont(final String fontName) + { + return fontFaces.containsKey(fontName); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java new file mode 100644 index 000000000000..48abe9e1f088 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FontFaceElement.java @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FontFaceElement.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * Represents an automatic or manual data style definition. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class FontFaceElement extends Section +{ + public FontFaceElement() + { + } + + public String getStyleName() + { + return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name"); + } + + public void setStyleName(final String name) + { + setAttribute(OfficeNamespaces.STYLE_NS, "name", name); + } + + +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java new file mode 100644 index 000000000000..43e84abc4651 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormatCondition.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FormatCondition.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.expressions.FormulaExpression; + +/** + * The format condition defines, what style-format is applied to an element. + * + * @author Thomas Morgner + * @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/com/sun/star/report/pentaho/model/FormattedTextElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java new file mode 100644 index 000000000000..f902cae1a346 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/FormattedTextElement.java @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: FormattedTextElement.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.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 arbitary style. (As this is totally undocumented, + * we leave this out for now. Either we'll insert a field there or we call + * an UNO-component to do the formatting. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class FormattedTextElement extends ReportElement +{ + private FormulaExpression valueExpression; + + public FormattedTextElement() + { + } + + + public FormulaExpression getValueExpression() + { + return valueExpression; + } + + public void setValueExpression(final FormulaExpression valueExpression) + { + this.valueExpression = valueExpression; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java new file mode 100644 index 000000000000..45e11580cd8f --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ImageElement.java @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ImageElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.expressions.FormulaExpression; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class ImageElement extends ReportElement +{ + private FormulaExpression formula; + + public ImageElement() + { + } + + public FormulaExpression getFormula() + { + return formula; + } + + public void setFormula(final FormulaExpression formula) + { + this.formula = formula; + } + + public boolean isScale() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.SCALE)); + } + + public void setScale(final boolean scale) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.SCALE, String.valueOf(scale)); + } + + public boolean isPreserveIRI() + { + return OfficeToken.TRUE.equals(getAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI)); + } + + public void setPreserveIRI(final boolean preserveIRI) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, OfficeToken.PRESERVE_IRI, String.valueOf(preserveIRI)); + } + + public String getImageData() + { + return (String) getAttribute(OfficeNamespaces.FORM_NS, OfficeToken.IMAGE_DATA); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java new file mode 100644 index 000000000000..c31c3ae8497a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ObjectOleElement.java @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ObjectOleElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Ocke Janssen + */ +public class ObjectOleElement extends ReportElement{ + + private String url; + private final List masterfields; + private final List detailfields; + private String classid; + + public String getClassid() { + return classid; + } + + public List getDetailfields() { + return detailfields; + } + + public List getMasterfields() { + return masterfields; + } + + public ObjectOleElement() + { + masterfields = new ArrayList(); + detailfields = new ArrayList(); + } + + 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/com/sun/star/report/pentaho/model/OfficeDetailSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java new file mode 100644 index 000000000000..d66c17c29132 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDetailSection.java @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeDetailSection.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.DetailSection; + +/** + * A Marker-Class. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeDetailSection extends DetailSection +{ + public OfficeDetailSection() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java new file mode 100644 index 000000000000..02727c2b9d2a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeDocument.java @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeDocument.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.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. + * + * @author Thomas Morgner + * @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 OfficeDocument() + { + } + + 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/com/sun/star/report/pentaho/model/OfficeGroup.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java new file mode 100644 index 000000000000..2717eadea602 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroup.java @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeGroup.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +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. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeGroup extends Section +{ + public OfficeGroup() + { + } + + public boolean isStartNewColumn () + { + return OfficeToken.TRUE.equals + (getAttribute(OfficeNamespaces.OOREPORT_NS, "start-new-column")); + } + + public boolean isResetPageNumber () + { + return OfficeToken.TRUE.equals + (getAttribute(OfficeNamespaces.OOREPORT_NS, "reset-page-number")); + } + + 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(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java new file mode 100644 index 000000000000..26ec1d8f9c6d --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupInstanceSection.java @@ -0,0 +1,15 @@ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Group; + +/** + * Creation-Date: 25.07.2007, 14:41:54 + * + * @author Thomas Morgner + */ +public class OfficeGroupInstanceSection extends Group +{ + public OfficeGroupInstanceSection() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java new file mode 100644 index 000000000000..72c8e97ddb6a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeGroupSection.java @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeGroupSection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; + +/** + * A group header or footer. If such a section is marked as sticky, it will be + * repeated on each new page. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeGroupSection extends Section +{ + + public OfficeGroupSection() + { + } + + public boolean isRepeatSection() + { + final Object repeatFlag = + getAttribute(OfficeNamespaces.OOREPORT_NS, "repeat-section"); + return OfficeToken.TRUE.equals(repeatFlag); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java new file mode 100644 index 000000000000..6dca280618cc --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterPage.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeMasterPage.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * A master page. A master page can contain header and footer and is linked + * to a page-layout. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class OfficeMasterPage extends Section +{ + + public OfficeMasterPage() + { + } + + 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/com/sun/star/report/pentaho/model/OfficeMasterStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java new file mode 100644 index 000000000000..fed1f04db958 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeMasterStyles.java @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeMasterStyles.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.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. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class OfficeMasterStyles extends Element +{ + private final Map masterPages; + private final Section otherNodes; + + public OfficeMasterStyles() + { + masterPages = new HashMap(); + 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 (OfficeMasterPage) masterPages.get (name); + } + + public OfficeMasterPage[] getAllMasterPages() + { + return (OfficeMasterPage[]) masterPages.values().toArray + (new OfficeMasterPage[masterPages.size()]); + } + + public Section getOtherNodes() + { + return otherNodes; + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java new file mode 100644 index 000000000000..74afacbc4026 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeReport.java @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeReport.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.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. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public class OfficeReport extends Element { + + private Node pageHeader; + private Node pageFooter; + private Node columnHeader; + private Node columnFooter; + 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 OfficeReport() { + } + + 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 columnHeader; + } + + public void setColumnHeader(final Node columnHeader) { + this.columnHeader = columnHeader; + } + + public Node getColumnFooter() { + return columnFooter; + } + + public void setColumnFooter(final Node columnFooter) { + this.columnFooter = columnFooter; + } + + 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/com/sun/star/report/pentaho/model/OfficeStyle.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java new file mode 100644 index 000000000000..5f6bef8f1492 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyle.java @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeStyle.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.report.OfficeToken; +import com.sun.star.report.pentaho.OfficeNamespaces; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; + +/** + * Represents an automatic or manual style definition. + * + * @author Thomas Morgner + * @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. + * + * @return + */ + 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 String getMasterPageName() +// { +// return (String) getAttribute(OfficeNamespaces.STYLE_NS, "master-page-name"); +// } + + 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 getTableProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-properties"); + } + + public Element getTableColumnProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "table-column-properties"); + } + + public Element getSectionProperties () + { + return findFirstChild(OfficeNamespaces.STYLE_NS, "section-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/com/sun/star/report/pentaho/model/OfficeStyles.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java new file mode 100644 index 000000000000..29f2a923dae3 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStyles.java @@ -0,0 +1,199 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeStyles.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.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. + * + * @author Thomas Morgner + * @since 07.03.2007 + */ +public class OfficeStyles extends Element +{ + + public static class StyleKey implements Serializable + { + + private static final long serialVersionUID = 4931878927362887477L; + private final String family; + private final String name; + + public StyleKey(final String family, final String name) + { + if (family == null) + { + throw new NullPointerException(); + } + this.family = family; + this.name = name; + } + + public String getFamily() + { + return family; + } + + public String getName() + { + return name; + } + + 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; + } + + public int hashCode() + { + int result = family.hashCode(); + result = 31 * result + (name != null ? name.hashCode() : 0); + return result; + } + } + private final Map pageStyles; + private final Map dataStyles; + private final Map styles; + private final List otherChilds; + + public OfficeStyles() + { + this.styles = new HashMap(); + this.dataStyles = new HashMap(); + this.pageStyles = new HashMap(); + this.otherChilds = new ArrayList(); + } + + public OfficeStyle getStyle(final String family, final String name) + { + return (OfficeStyle) 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 (PageLayout) pageStyles.get(name); + } + + public void addDataStyle(final DataStyle style) + { + dataStyles.put(style.getStyleName(), style); + } + + public DataStyle getDataStyle(final String name) + { + return (DataStyle) dataStyles.get(name); + } + + public void addOtherNode(final Element node) + { + otherChilds.add(node); + } + + public DataStyle[] getAllDataStyles() + { + return (DataStyle[]) dataStyles.values().toArray(new DataStyle[dataStyles.size()]); + } + + public PageLayout[] getAllPageStyles() + { + return (PageLayout[]) pageStyles.values().toArray(new PageLayout[pageStyles.size()]); + } + + public OfficeStyle[] getAllStyles() + { + return (OfficeStyle[]) styles.values().toArray(new OfficeStyle[styles.size()]); + } + + public Element[] getOtherStyles() + { + return (Element[]) otherChilds.toArray(new Element[otherChilds.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/com/sun/star/report/pentaho/model/OfficeStylesCollection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java new file mode 100644 index 000000000000..58e6d4639add --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeStylesCollection.java @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeStylesCollection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import com.sun.star.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/> + * Style names are unique within the family, no matter whether the style is an + * automatic style, an common style or a master style. + * <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. + * + * @author Thomas Morgner + * @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 dont 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/com/sun/star/report/pentaho/model/OfficeTableSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java new file mode 100644 index 000000000000..96d6a4dd7e9e --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/OfficeTableSection.java @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OfficeTableSection.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; + +/** + * Creation-Date: 24.04.2007, 15:55:17 + * + * @author Thomas Morgner + */ +public class OfficeTableSection extends Section +{ + public OfficeTableSection() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java new file mode 100644 index 000000000000..29b916778ab7 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageLayout.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PageLayout.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * A page layout describes the physical properties of a page. It is equal to + * an @page rule in CSS. + * + * @author Thomas Morgner + * @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/com/sun/star/report/pentaho/model/PageSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java new file mode 100644 index 000000000000..537a1cc3af42 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/PageSection.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PageSection.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; +import org.jfree.layouting.util.AttributeMap; +import com.sun.star.report.pentaho.OfficeNamespaces; + +/** + * This represents either a page header or page footer. + * + * @author Thomas Morgner + * @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 PageSection() + { + } + + 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/com/sun/star/report/pentaho/model/RawText.java b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java new file mode 100644 index 000000000000..679dd30fdff3 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/RawText.java @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: RawText.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.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. + * + * @author Thomas Morgner + * @since 13.03.2007 + */ +public class RawText extends StaticText +{ + public RawText(final String text) + { + super(text); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java new file mode 100644 index 000000000000..df1de0154e6a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/ReportElement.java @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ReportElement.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import java.util.ArrayList; + +import org.jfree.report.structure.Element; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; +import java.util.List; + +/** + * A report element is the base class for all content generating elements in a + * report. + * + * @author Thomas Morgner + * @since 02.03.2007 + */ +public abstract class ReportElement extends Element +{ + private final List formatConditions; + + protected ReportElement() + { + formatConditions = new ArrayList(); + } + + /** + * 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 isPrintWhenGroupChanges() + { + return OfficeToken.TRUE.equals(getAttribute + (OfficeNamespaces.OOREPORT_NS, "print-when-group-changes")); + } + + public void setPrintWhenGroupChanges(final boolean printWhenGroupChanges) + { + setAttribute(OfficeNamespaces.OOREPORT_NS, "print-when-group-changes", + String.valueOf(printWhenGroupChanges)); + } + + /** + * 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 surpressed. + */ + 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 (FormatCondition[]) this.formatConditions.toArray + (new FormatCondition[this.formatConditions.size()]); + } + + public int getFormatConditionCount () + { + return formatConditions.size(); + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java new file mode 100644 index 000000000000..74334dc11c52 --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/TableCellElement.java @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: TableCellElement.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.report.pentaho.model; + +import org.jfree.report.structure.Section; + +/** + * Todo: Document me! + * + * @author Thomas Morgner + * @since 05.03.2007 + */ +public class TableCellElement extends Section +{ + + public TableCellElement() + { + } +} diff --git a/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java new file mode 100644 index 000000000000..3dcdc302ef7a --- /dev/null +++ b/reportbuilder/java/com/sun/star/report/pentaho/model/VariablesDeclarationSection.java @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: VariablesDeclarationSection.java,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package com.sun.star.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. + * + * @author Thomas Morgner + * @since 19.03.2007 + */ +public class VariablesDeclarationSection extends Section +{ + + public VariablesDeclarationSection() + { + setNamespace(JFreeReportInfo.REPORT_NAMESPACE); + setType("variables-section"); + } +} |