Tag: cws_src680_oj14 User: oj Date: 2007-06-07 06:39:34+0000 Modified: dba/reportdesign/java/com/sun/star/report/ImageService.java dba/reportdesign/java/com/sun/star/report/pentaho/PentahoReportJob.java dba/reportdesign/java/com/sun/star/report/pentaho/SOReportJobFactory.java dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java dba/reportdesign/java/com/sun/star/report/pentaho/output/ImageProducer.java dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java
Log: #i77097##i77035# #i77460# File Changes: Directory: /dba/reportdesign/java/com/sun/star/report/ ====================================================== File [changed]: ImageService.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/ImageService.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +7 -4 ------------------- --- ImageService.java 2007-06-06 07:04:51+0000 1.1.2.1 +++ ImageService.java 2007-06-07 06:39:31+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: ImageService.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/06/06 07:04:51 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,6 +35,9 @@ package com.sun.star.report; +import java.io.InputStream; +import java.awt.Dimension; + /** * * @author oj93728 @@ -44,7 +47,7 @@ /** * @return the mime-type of the image as string. */ - public String getMimeType(final java.io.InputStream image) throws ReportExecutionException; + public String getMimeType(final InputStream image) throws ReportExecutionException; /** * @return the mime-type of the image as string. @@ -54,12 +57,12 @@ /** * @returns the dimension in 100th mm. **/ - public abstract java.awt.Dimension getImageSize(final java.io.InputStream image) throws ReportExecutionException; + public Dimension getImageSize(final InputStream image) throws ReportExecutionException; /** * @returns the dimension in 100th mm. **/ - public abstract java.awt.Dimension getImageSize(final byte[] image) throws ReportExecutionException; + public Dimension getImageSize(final byte[] image) throws ReportExecutionException; } Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/ ============================================================== File [changed]: PentahoReportJob.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/PentahoReportJob.java?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +2 -2 ------------------- --- PentahoReportJob.java 2007-06-06 07:03:51+0000 1.1.2.2 +++ PentahoReportJob.java 2007-06-07 06:39:31+0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: PentahoReportJob.java,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: oj $ $Date: 2007/06/06 07:03:51 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -246,11 +246,11 @@ { if (PentahoReportEngineMetaData.OPENDOCUMENT_SPREADSHEET.equals(mimeType)) { - return new SpreadsheetRawReportProcessor(inputRepository, outputRepository, outputName,imageService); + return new SpreadsheetRawReportProcessor(inputRepository, outputRepository, outputName, imageService); } if (PentahoReportEngineMetaData.OPENDOCUMENT_TEXT.equals(mimeType)) { - return new TextRawReportProcessor(inputRepository, outputRepository, outputName,imageService); + return new TextRawReportProcessor(inputRepository, outputRepository, outputName, imageService); } if (PentahoReportEngineMetaData.DEBUG.equals(mimeType)) { File [changed]: SOReportJobFactory.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/SOReportJobFactory.java?r1=1.1.2.4&r2=1.1.2.5 Delta lines: +22 -16 --------------------- --- SOReportJobFactory.java 2007-06-06 19:46:22+0000 1.1.2.4 +++ SOReportJobFactory.java 2007-06-07 06:39:31+0000 1.1.2.5 @@ -4,9 +4,9 @@ * * $RCSfile: SOReportJobFactory.java,v $ * - * $Revision: 1.1.2.4 $ + * $Revision: 1.1.2.5 $ * - * last change: $Author: fs $ $Date: 2007/06/06 19:46:22 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -34,27 +34,33 @@ ************************************************************************/ package com.sun.star.report.pentaho; +import java.net.URL; + import com.sun.star.beans.NamedValue; -import java.util.Map; -import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.beans.XPropertySet; +import com.sun.star.embed.XStorage; +import com.sun.star.lang.XInitialization; import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.lang.XServiceInfo; import com.sun.star.lang.XSingleComponentFactory; +import com.sun.star.lib.uno.helper.Factory; +import com.sun.star.lib.uno.helper.PropertySetMixin; import com.sun.star.lib.uno.helper.WeakBase; -import com.sun.star.uno.XComponentContext; import com.sun.star.registry.XRegistryKey; -import com.sun.star.lang.XInitialization; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.beans.XPropertySet; -import com.sun.star.embed.XStorage; -import com.sun.star.task.XJob; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.sdbc.XRowSet; -import com.sun.star.lib.uno.helper.PropertySetMixin; -import com.sun.star.report.pentaho.PentahoReportEngine; -import com.sun.star.report.*; +import com.sun.star.report.DataSourceFactory; +import com.sun.star.report.JobDefinitionException; +import com.sun.star.report.JobProperties; +import com.sun.star.report.ReportEngineParameterNames; +import com.sun.star.report.ReportJob; +import com.sun.star.report.ReportJobDefinition; +import com.sun.star.report.SDBCReportDataFactory; +import com.sun.star.report.SOImageService; import com.sun.star.report.StorageRepository; +import com.sun.star.sdbc.XRowSet; +import com.sun.star.task.XJob; import com.sun.star.uno.Type; -import java.net.URL; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; /** * This class capsulates the class, that implements the minimal component, a Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/ ============================================================================== File [changed]: FormattedTextLayoutController.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +61 -78 --------------------- --- FormattedTextLayoutController.java 2007-05-15 06:50:24+0000 1.1.2.2 +++ FormattedTextLayoutController.java 2007-06-07 06:39:31+0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: FormattedTextLayoutController.java,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: oj $ $Date: 2007/05/15 06:50:24 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,8 +37,6 @@ package com.sun.star.report.pentaho.layoutprocessor; -import java.util.Date; - import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormattedTextElement; import org.jfree.formula.Formula; @@ -50,11 +48,10 @@ import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; -import org.jfree.report.data.DefaultDataFlags; import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.flow.ReportTarget; +import org.jfree.report.flow.layoutprocessor.ElementLayoutController; import org.jfree.report.flow.layoutprocessor.LayoutController; -import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.jfree.report.structure.Element; import org.jfree.util.Log; @@ -67,42 +64,42 @@ public class FormattedTextLayoutController extends AbstractReportElementLayoutController { - private Boolean inRepeatingSection; +// private Boolean inRepeatingSection; public FormattedTextLayoutController() { } - private boolean isInRepeatingSection () - { - if (inRepeatingSection == null) - { - LayoutController parent = getParent(); - while (parent != null && inRepeatingSection == null) - { - if (parent instanceof OfficeRepeatingStructureLayoutController) - { - final OfficeRepeatingStructureLayoutController orslc = - (OfficeRepeatingStructureLayoutController) parent; - if (orslc.isNormalFlowProcessing()) - { - inRepeatingSection = Boolean.FALSE; - } - else - { - inRepeatingSection = Boolean.TRUE; - } - } - parent = parent.getParent(); - } - - if (inRepeatingSection == null) - { - inRepeatingSection = Boolean.FALSE; - } - } - return inRepeatingSection.booleanValue(); - } +// private boolean isInRepeatingSection () +// { +// if (inRepeatingSection == null) +// { +// LayoutController parent = getParent(); +// while (parent != null && inRepeatingSection == null) +// { +// if (parent instanceof OfficeRepeatingStructureLayoutController) +// { +// final OfficeRepeatingStructureLayoutController orslc = +// (OfficeRepeatingStructureLayoutController) parent; +// if (orslc.isNormalFlowProcessing()) +// { +// inRepeatingSection = Boolean.FALSE; +// } +// else +// { +// inRepeatingSection = Boolean.TRUE; +// } +// } +// parent = parent.getParent(); +// } +// +// if (inRepeatingSection == null) +// { +// inRepeatingSection = Boolean.FALSE; +// } +// } +// return inRepeatingSection.booleanValue(); +// } private VariablesCollection getVariablesCollection() { @@ -142,8 +139,7 @@ } } - protected LayoutController delegateContentGeneration( - final ReportTarget target) + protected LayoutController delegateContentGeneration(final ReportTarget target) throws ReportProcessingException, ReportDataFactoryException, DataSourceException { @@ -167,60 +163,47 @@ } else { - computeDataFlag(element, target); + + final DataFlags df = FormatValueUtility.computeDataFlag(element, getFlowController()); + if (df != null) + { + target.processContent(df); + } } return join(getFlowController()); } - private String computeValueType () - throws DataSourceException - { - final FormattedTextElement element = (FormattedTextElement) getNode(); - final Object value = LayoutControllerUtil.evaluateExpression - (getFlowController(), element, element.getValueExpression()); - if (value instanceof Date) - { - return "date"; - } - else if (value instanceof Number) + private Element getParentTableCell() { - return "float"; - } - else if (value instanceof Boolean) + LayoutController parent = getParent(); + while (parent != null) { - return "boolean"; - } - else if (value != null) + if (parent instanceof ElementLayoutController) { - return "string"; + final ElementLayoutController cellController = (ElementLayoutController) parent; + return cellController.getElement(); } - else - { - throw new IllegalStateException(); + parent = parent.getParent(); } + return null; } - private void computeDataFlag(final FormattedTextElement element, - final ReportTarget target) - throws DataSourceException, ReportProcessingException - {// here it is relatively easy. We have to evaluate the expression, convert - // the result into a string, and print that string. - final FormulaExpression formulaExpression = element.getValueExpression(); - final Object result = LayoutControllerUtil.evaluateExpression - (getFlowController(), element, formulaExpression); - if (result == null) + private String computeValueType () { - // ignore it. Ignoring it is much better than printing 'null'. - Log.debug("Formula '" + formulaExpression.getFormula() + "' evaluated to null."); - } - else if (result instanceof DataFlags) + final Element tce = getParentTableCell(); + if (tce == null) { - target.processContent((DataFlags) result); + // NO particular format means: Fallback to string and hope and pray .. + return "string"; } - else + + final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type"); + if (type == null) { - target.processContent (new DefaultDataFlags(null, result, true)); + return "string"; } + return type; } + } File [changed]: TableCellLayoutController.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +59 -12 --------------------- --- TableCellLayoutController.java 2007-05-09 12:21:59+0000 1.1.2.1 +++ TableCellLayoutController.java 2007-06-07 06:39:31+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: TableCellLayoutController.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/05/09 12:21:59 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,28 +39,29 @@ import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.model.FormatCondition; +import com.sun.star.report.pentaho.model.FormattedTextElement; import com.sun.star.report.pentaho.model.ReportElement; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; +import org.jfree.report.DataFlags; import org.jfree.report.expressions.Expression; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil; import org.jfree.report.flow.layoutprocessor.SectionLayoutController; +import org.jfree.report.structure.Element; import org.jfree.report.structure.Node; import org.jfree.report.structure.Section; -import org.jfree.report.structure.Element; import org.jfree.util.ObjectUtilities; /** - * Before writing the table cell, we have to evaluate the childs of the cell. - * The cell itself can either be empty or it has a one ore more paragraphs inside. - * The paragraph contains a single report element, but may contain additional + * Before writing the table cell, we have to evaluate the childs of the cell. The cell itself can either be empty or it + * has a one ore more paragraphs inside. The paragraph contains a single report element, but may contain additional * other content. * * @author Thomas Morgner - * @since 05.03.2007 * @noinspection CloneableClassWithoutClone + * @since 05.03.2007 */ public class TableCellLayoutController extends SectionLayoutController { @@ -74,11 +75,58 @@ throws DataSourceException { final AttributeMap attributeMap = super.computeAttributes(fc, element, target); - final String definedStyle = (String) attributeMap.getAttribute (OfficeNamespaces.TABLE_NS, "style-name"); + final String definedStyle = (String) attributeMap.getAttribute(OfficeNamespaces.TABLE_NS, "style-name"); attributeMap.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", getDisplayStyleName((Section) element, definedStyle)); + + try + { + final DataFlags value = computeValue(); + if (value != null) + { + FormatValueUtility.applyValueForCell(value.getValue(), attributeMap); + } + } + catch (Exception e) + { + // ignore .. + } return attributeMap; } + private DataFlags computeValue() throws DataSourceException + { + // Search for the first FormattedTextElement + final Section cell = (Section) getElement(); + final FormattedTextElement element = findFormattedTextElement(cell); + if (element == null) + { + return null; + } + return FormatValueUtility.computeDataFlag(element, getFlowController()); + } + + private FormattedTextElement findFormattedTextElement(final Section section) + { + final Node[] nodeArray = section.getNodeArray(); + for (int i = 0; i < nodeArray.length; i++) + { + final Node node = nodeArray[i]; + if (node instanceof FormattedTextElement) + { + return (FormattedTextElement) node; + } + if (node instanceof Section) + { + final FormattedTextElement retval = findFormattedTextElement((Section) node); + if (retval != null) + { + return retval; + } + } + } + return null; + } + private String getDisplayStyleName(final Section section, final String defaultStyle) { @@ -119,7 +167,7 @@ continue; } } - catch(DataSourceException e) + catch (DataSourceException e) { // ignore silently .. } @@ -143,7 +191,7 @@ return formCond.getStyleName(); } } - catch(DataSourceException e) + catch (DataSourceException e) { // ignore silently .. } @@ -164,5 +212,4 @@ } - } File [changed]: VariablesDeclarationLayoutController.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +8 -64 -------------------- --- VariablesDeclarationLayoutController.java 2007-05-09 12:22:22+0000 1.1.2.1 +++ VariablesDeclarationLayoutController.java 2007-06-07 06:39:31+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: VariablesDeclarationLayoutController.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/05/09 12:22:22 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,16 +37,13 @@ package com.sun.star.report.pentaho.layoutprocessor; -import java.util.Date; -import java.text.SimpleDateFormat; - -import com.sun.star.report.pentaho.model.FormattedTextElement; import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.FormattedTextElement; import org.jfree.layouting.util.AttributeMap; import org.jfree.report.DataSourceException; +import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportDataFactoryException; import org.jfree.report.ReportProcessingException; -import org.jfree.report.JFreeReportInfo; import org.jfree.report.expressions.FormulaExpression; import org.jfree.report.flow.FlowController; import org.jfree.report.flow.ReportTarget; @@ -65,7 +62,6 @@ extends AbstractLayoutController { private boolean processed; - private SimpleDateFormat dateFormat; public VariablesDeclarationLayoutController() { @@ -146,7 +142,7 @@ } private AttributeMap generateVariableSetSection(final FormattedTextElement variable) - throws DataSourceException, ReportProcessingException + throws DataSourceException { final AttributeMap variableSection = new AttributeMap(); variableSection.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS); @@ -154,64 +150,12 @@ variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "display", "none"); final FormulaExpression valueExpression = variable.getValueExpression(); - final Object value = LayoutControllerUtil.evaluateExpression - (getFlowController(), variable, valueExpression); - if (value instanceof Date) - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", "date"); - variableSection.setAttribute - (OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value)); - } - else if (value instanceof Number) - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", - "float"); - variableSection.setAttribute - (OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value)); - } - else if (value instanceof Boolean) - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", - "boolean"); - if (Boolean.TRUE.equals(value)) - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "boolean-value", - "true"); - } - else - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "boolean-value", - "false"); - } - } - else if (value != null) - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", - "string"); - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "string-value", - String.valueOf(value)); - } - else - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", - "string"); - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "string-value", ""); - } + final Object value = LayoutControllerUtil.evaluateExpression(getFlowController(), variable, valueExpression); + FormatValueUtility.applyValueForVariable(value, variableSection); variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "formula", "ooow:" + String.valueOf(value)); - return variableSection; } - private String formatDate(final Date date) - { - if (dateFormat == null) - { - dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'.'S'Z'"); - } - return dateFormat.format(date); - } - - /** * Checks, whether the layout controller would be advanceable. If this method * returns true, it is generally safe to call the 'advance()' method. Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/ ===================================================================== File [changed]: ImageProducer.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/ImageProducer.java?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +4 -4 ------------------- --- ImageProducer.java 2007-06-06 07:00:01+0000 1.1.2.2 +++ ImageProducer.java 2007-06-07 06:39:31+0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: ImageProducer.java,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: oj $ $Date: 2007/06/06 07:00:01 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:31 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -459,11 +459,11 @@ } catch (IOException e) { - Log.warn("Failed to load image from local input-repository", e); + Log.warn("Failed to load image from local input-repository" + e); } catch (ResourceException e) { - Log.warn("Failed to create image from local input-repository", e); + Log.warn("Failed to create image from local input-repository" + e); } if (preserveIRI == false) File [changed]: OfficeDocumentReportTarget.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java?r1=1.1.2.4&r2=1.1.2.5 Delta lines: +4 -4 ------------------- --- OfficeDocumentReportTarget.java 2007-06-06 07:00:01+0000 1.1.2.4 +++ OfficeDocumentReportTarget.java 2007-06-07 06:39:32+0000 1.1.2.5 @@ -4,9 +4,9 @@ * * $RCSfile: OfficeDocumentReportTarget.java,v $ * - * $Revision: 1.1.2.4 $ + * $Revision: 1.1.2.5 $ * - * last change: $Author: oj $ $Date: 2007/06/06 07:00:01 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:32 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -246,7 +246,7 @@ private AttributeNameGenerator imageNames; private ImageProducer imageProducer; private GroupContext groupContext; - private static final boolean DEBUG_ELEMENTS = true; + private static final boolean DEBUG_ELEMENTS = false; protected OfficeDocumentReportTarget(final ReportJob reportJob, final ResourceManager resourceManager, @@ -763,7 +763,7 @@ // them correctly. xmlWriter.writeText(XmlWriterSupport.normalize(line, false)); line = breader.readLine(); - + // Is this OK? Shouldn't we use soft-breaks instead? if (line != null) { xmlWriter.writeCloseTag(); Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/ ================================================================================= File [changed]: SpreadsheetRawReportProcessor.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +0 -0 ------------------- --- SpreadsheetRawReportProcessor.java 2007-06-06 07:00:01+0000 1.1.2.2 +++ SpreadsheetRawReportProcessor.java 2007-06-07 06:39:32+0000 1.1.2.3 @@ -4,9 +4,9 @@ * * $RCSfile: SpreadsheetRawReportProcessor.java,v $ * - * $Revision: 1.1.2.2 $ + * $Revision: 1.1.2.3 $ * - * last change: $Author: oj $ $Date: 2007/06/06 07:00:01 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:32 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/text/ ========================================================================== File [changed]: TextRawReportTarget.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +92 -22 --------------------- --- TextRawReportTarget.java 2007-06-06 07:00:01+0000 1.1.2.3 +++ TextRawReportTarget.java 2007-06-07 06:39:32+0000 1.1.2.4 @@ -4,9 +4,9 @@ * * $RCSfile: TextRawReportTarget.java,v $ * - * $Revision: 1.1.2.3 $ + * $Revision: 1.1.2.4 $ * - * last change: $Author: oj $ $Date: 2007/06/06 07:00:01 $ + * last change: $Author: oj $ $Date: 2007/06/07 06:39:32 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -70,6 +70,7 @@ import org.jfree.resourceloader.ResourceKey; import org.jfree.resourceloader.ResourceManager; import org.jfree.util.FastStack; +import org.jfree.util.Log; import org.jfree.xmlns.common.AttributeList; import org.jfree.xmlns.writer.XmlWriter; import org.jfree.xmlns.writer.XmlWriterSupport; @@ -92,9 +93,18 @@ private static final int CP_FIRST_TABLE = 1; private static final int CP_NEXT_TABLE = 2; + // This is the initial state of the detail-band processing. It states, that we are now waiting for a + // detail-band to be printed. private static final int DETAIL_SECTION_WAIT = 0; - private static final int DETAIL_SECTION_STARTED = 1; - private static final int DETAIL_SECTION_PRINTED = 2; + // The first detail section has started. + private static final int DETAIL_SECTION_FIRST_STARTED = 1; + // The first detail section has been printed. + private static final int DETAIL_SECTION_FIRST_PRINTED = 2; + // An other detail section has started + private static final int DETAIL_SECTION_OTHER_STARTED = 3; + // The other detail section has been printed. + private static final int DETAIL_SECTION_OTHER_PRINTED = 4; + private boolean pageFooterOnReportFooter; private boolean pageFooterOnReportHeader; @@ -113,7 +123,7 @@ private boolean sectionKeepTogether; private AttributeNameGenerator sectionNames; - private int firstDetailState; + private int detailBandProcessingState; private int tableLayoutConfig; private int expectedTableRowCount; @@ -183,7 +193,7 @@ final boolean keepWithNext; if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL) { - keepWithNext = (firstDetailState == DETAIL_SECTION_WAIT); + keepWithNext = (detailBandProcessingState == DETAIL_SECTION_WAIT); } else { @@ -432,7 +442,7 @@ { super.startReport(report); variablesDeclarations = new VariablesDeclarations(); - firstDetailState = DETAIL_SECTION_WAIT; + detailBandProcessingState = DETAIL_SECTION_WAIT; sectionNames.reset(); pageFooterOnReportFooter = false; @@ -545,9 +555,9 @@ namespace + ", " + elementType); } - if (isTableMergeActive() && - firstDetailState == DETAIL_SECTION_PRINTED) + if (isTableMergeActive() && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED) { + // Skip the columns section if the tables get merged.. if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-columns", attrs)) { startBuffering(getStylesCollection(), true); @@ -818,6 +828,17 @@ tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows", "false"); } } + else + { + if (detailBandProcessingState == DETAIL_SECTION_WAIT) + { + detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED; + } + else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED) + { + detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED; + } + } if (keepWithNext) { final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "table-properties"); @@ -832,14 +853,18 @@ // Check, whether we may be able to skip the table. if (tableMergeActive) { - if (firstDetailState == DETAIL_SECTION_PRINTED) + if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED) { // Skip the whole thing .. return; } - else + else if (detailBandProcessingState == DETAIL_SECTION_WAIT) + { + detailBandProcessingState = DETAIL_SECTION_FIRST_STARTED; + } + else if (detailBandProcessingState == DETAIL_SECTION_FIRST_PRINTED) { - firstDetailState = DETAIL_SECTION_STARTED; + detailBandProcessingState = DETAIL_SECTION_OTHER_STARTED; } } @@ -856,7 +881,8 @@ private boolean isTableMergeActive() { - return getCurrentRole() == ROLE_DETAIL && tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; + return getCurrentRole() == ROLE_DETAIL && + tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; } @@ -868,6 +894,12 @@ // repeating sections have other ways of defining columns .. return; } + if (getCurrentRole() == ROLE_TEMPLATE) + { + // the template section would break the multi-column stuff and we dont open up sections there + // anyway .. + return; + } final PageContext pageContext = getCurrentContext(); final Integer columnCount = pageContext.getColumnCount(); @@ -939,7 +971,7 @@ { // reset the detail-state. The flag will be updated on startTable and endOther(Table) if the // current role is ROLE_DETAIL - firstDetailState = DETAIL_SECTION_WAIT; + detailBandProcessingState = DETAIL_SECTION_WAIT; } } } @@ -1010,6 +1042,20 @@ { throw new ReportProcessingException("IOError", e); } + catch(Exception e) + { + // todo + try + { + getXmlWriter().close(); + final BufferState bufferState = finishBuffering(); + //System.out.println (bufferState.getXmlBuffer()); + + } + catch(Exception ex) + {} + throw new RuntimeException(); + } } } @@ -1114,7 +1160,7 @@ protected void endOther(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException { - if (isTableMergeActive() && firstDetailState == DETAIL_SECTION_PRINTED) + if (isTableMergeActive() && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED) { if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-columns", attrs)) { @@ -1183,17 +1229,38 @@ if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table", attrs)) { - if (getCurrentRole() != ROLE_DETAIL || tableLayoutConfig != TABLE_LAYOUT_SINGLE_DETAIL_TABLE) + if (getCurrentRole() == ROLE_DETAIL) + { + if (isTableMergeActive() == false) { + // We do not merge the detail bands, so an ordinary close will do. xmlWriter.writeCloseTag(); } - if (isSectionPagebreakAfter(attrs)) + else if (detailBandProcessingState == DETAIL_SECTION_FIRST_STARTED) { - setPagebreakDefinition(new PageBreakDefinition(false)); + final int keepTogetherState = getCurrentContext().getKeepTogether(); + if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL) + { + xmlWriter.writeCloseTag(); + detailBandProcessingState = DETAIL_SECTION_FIRST_PRINTED; } - if (getCurrentRole() == OfficeDocumentReportTarget.ROLE_DETAIL) + else { - firstDetailState = DETAIL_SECTION_PRINTED; + detailBandProcessingState = DETAIL_SECTION_OTHER_PRINTED; + } + } + else if (detailBandProcessingState == DETAIL_SECTION_OTHER_STARTED) + { + detailBandProcessingState = DETAIL_SECTION_OTHER_PRINTED; + } + } + else + { + xmlWriter.writeCloseTag(); + } + if (isSectionPagebreakAfter(attrs)) + { + setPagebreakDefinition(new PageBreakDefinition(false)); } } else @@ -1205,11 +1272,14 @@ protected void endGroupBody(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException { - if (firstDetailState == DETAIL_SECTION_PRINTED && tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE) + if (tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE) + { + if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED) { final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeCloseTag(); - firstDetailState = DETAIL_SECTION_WAIT; + detailBandProcessingState = DETAIL_SECTION_WAIT; + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
