User: kz Date: 2008-05-05 14:39:35+0000 Modified: dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java
Log: INTEGRATION: CWS dba30beta (1.6.6); FILE MERGED 2008/04/22 10:30:28 oj 1.6.6.1: #i88503# merge changes from rptchart02 File Changes: Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/ ================================================================================= File [changed]: SpreadsheetRawReportTarget.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java?r1=1.6&r2=1.7 Delta lines: +766 -639 ----------------------- --- SpreadsheetRawReportTarget.java 2008-04-10 17:38:34+0000 1.6 +++ SpreadsheetRawReportTarget.java 2008-05-05 14:39:32+0000 1.7 @@ -27,7 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - package com.sun.star.report.pentaho.output.spreadsheet; import com.sun.star.report.DataSourceFactory; @@ -41,6 +40,7 @@ import com.sun.star.report.OutputRepository; import com.sun.star.report.ImageService; import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; import com.sun.star.report.pentaho.model.OfficeStyle; import com.sun.star.report.pentaho.model.OfficeStyles; @@ -51,6 +51,8 @@ import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget; import com.sun.star.report.pentaho.output.StyleUtilities; import com.sun.star.report.pentaho.output.text.MasterPageFactory; +import com.sun.star.report.pentaho.styles.LengthCalculator; +import java.util.Set; import org.jfree.layouting.util.AttributeMap; import org.jfree.layouting.input.style.values.CSSNumericValue; import org.jfree.layouting.input.style.values.CSSNumericType; @@ -67,6 +69,7 @@ import org.jfree.report.util.TextUtilities; import org.jfree.resourceloader.ResourceKey; import org.jfree.resourceloader.ResourceManager; +import org.jfree.util.Log; import org.jfree.xmlns.common.AttributeList; import org.jfree.xmlns.writer.XmlWriter; import org.jfree.xmlns.writer.XmlWriterSupport; @@ -78,11 +81,9 @@ */ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget { - private static final String COVERED_TABLE_CELL = "covered-table-cell"; - private static final String TABLE = "table"; - private static final String TABLE_COLUMN = "table-column"; - private static final String TABLE_COLUMNS = "table-columns"; + private boolean paragraphFound = false; + private boolean paragraphHandled = false; /** * This class represents a column boundary, not in width, but it's actual boundary location. One of the motivations @@ -91,9 +92,9 @@ */ private static class ColumnBoundary implements Comparable { - private HashSet tableIndices; - private float boundary; + private final Set tableIndices; + private final float boundary; private ColumnBoundary(final float boundary) { @@ -146,22 +147,21 @@ return false; } } - private String tableBackgroundColor; // null means transparent ... - private static final ColumnBoundary[] EMPTY_COLBOUNDS = new ColumnBoundary[0]; - private boolean elementBoundaryCollectionPass; - private List columnBoundaryList; + private boolean oleHandled; + private final List columnBoundaryList; private float currentRowBoundaryMarker; - private ColumnBoundary[] sortedBoundaryArray; private ColumnBoundary[] boundariesForTableArray; - private int tableCounter; private int columnCounter; private int columnSpanCounter; private String unitsOfMeasure; + private ArrayList shapes; + private ArrayList ole; + private ArrayList rowHeights; public SpreadsheetRawReportTarget(final ReportJob reportJob, final ResourceManager resourceManager, @@ -173,13 +173,26 @@ final DataSourceFactory dataSourceFactory) throws ReportProcessingException { - super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService,dataSourceFactory); + super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, dataSourceFactory); columnBoundaryList = new ArrayList(); elementBoundaryCollectionPass = true; + rowHeights = new ArrayList(); + shapes = new ArrayList(); + ole = new ArrayList(); + oleHandled = false; } public void startOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException { + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.INTERNAL_NS, OfficeToken.OBJECT_OLE, attrs)) + { + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) + { + ole.add(attrs); + } + oleHandled = true; + return; + } final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); if (isRepeatingSection() || isFilteredNamespace(namespace)) { @@ -187,8 +200,50 @@ } final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + if (OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType)) + { + paragraphFound = true; + return; + } + + if (OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType)) + { + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) + { + final LengthCalculator len = new LengthCalculator(); + double val = 0.0; + for (int i = 0; i < rowHeights.size(); i++) + { + len.add((CSSNumericValue) rowHeights.get(i)); + // val += ((CSSNumericValue)rowHeights.get(i)).getValue(); + } + + rowHeights.clear(); + final CSSNumericValue currentRowHeight = len.getResult(); + rowHeights.add(currentRowHeight); + attrs.setAttribute(OfficeNamespaces.DRAWING_NS, "z-index", String.valueOf(shapes.size())); + final String y = (String) attrs.getAttribute(OfficeNamespaces.SVG_NS, "y"); + if (y != null) + { + len.add(parseLength(y)); + final CSSNumericValue currentY = len.getResult(); + attrs.setAttribute(OfficeNamespaces.SVG_NS, "y", currentY.getValue() + currentY.getType().getType()); + } + shapes.add(attrs); + } + return; + } + if (oleHandled) + { + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) + { + ole.add(attrs); + } + return; + } + // if this is the report namespace, write out a table definition .. - if (OfficeNamespaces.TABLE_NS.equals(namespace) && TABLE.equals(elementType)) + if (OfficeNamespaces.TABLE_NS.equals(namespace) && OfficeToken.TABLE.equals(elementType)) { // whenever we see a new table, we increment our tableCounter // this is used to keep tracked of the boundary conditions per table @@ -217,48 +272,69 @@ { if ((role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) && - (PageSection.isPrintWithReportHeader(attrs) == false || - PageSection.isPrintWithReportFooter(attrs) == false)) + (!PageSection.isPrintWithReportHeader(attrs) || + !PageSection.isPrintWithReportFooter(attrs))) { startBuffering(new OfficeStylesCollection(), true); - return; + } + else + { super.startReportSection(attrs, role); } + } protected void endReportSection(final AttributeMap attrs, final int role) throws IOException, DataSourceException, ReportProcessingException { if ((role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) && - (PageSection.isPrintWithReportHeader(attrs) == false || - PageSection.isPrintWithReportFooter(attrs) == false)) + (!PageSection.isPrintWithReportHeader(attrs) || + !PageSection.isPrintWithReportFooter(attrs))) { finishBuffering(); - return; } - + else + { super.endReportSection(attrs, role); } + } + + private void handleParagraph() + { + if (paragraphFound) + { + try + { + final XmlWriter xmlWriter = getXmlWriter(); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, null, XmlWriterSupport.OPEN); + paragraphHandled = true; + } + catch (IOException ex) + { + Log.error("ReportProcessing failed", ex); + } + } + } private void processElement(final AttributeMap attrs, final String namespace, final String elementType) throws IOException, ReportProcessingException { final XmlWriter xmlWriter = getXmlWriter(); - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE,attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE, attrs)) { // a new table means we must clear our "calculated" table boundary array cache boundariesForTableArray = null; - final String tableStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS,STYLE_NAME); + final String tableStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); if (tableStyle == null) { tableBackgroundColor = null; } else { - final Object raw = StyleUtilities.queryStyle(getPredefinedStylesCollection(), TABLE,tableStyle, - "table-properties", OfficeNamespaces.FO_NS,BACKGROUND_COLOR); + final Object raw = StyleUtilities.queryStyle(getPredefinedStylesCollection(), OfficeToken.TABLE, tableStyle, + "table-properties", OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); if (raw == null || "transparent".equals(raw)) { tableBackgroundColor = null; @@ -271,15 +347,15 @@ return; } - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_COLUMN,attrs) - || ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_COLUMNS,attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs) || + ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs)) { return; } // covered-table-cell elements may appear in the input from row or column spans. In the event that we hit a // column-span we simply ignore these elements because we are going to adjust the span to fit the uniform table. - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, COVERED_TABLE_CELL,attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, attrs)) { if (columnSpanCounter > 0) { @@ -295,42 +371,42 @@ // elements for (int i = 0; i < span; i++) { - xmlWriter.writeTag(namespace,COVERED_TABLE_CELL, null, XmlWriter.CLOSE); + xmlWriter.writeTag(namespace, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); } } return; } - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-row", attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs)) { // a new row means our column counter gets reset columnCounter = 0; // Lets make sure the color of the table is ok .. if (tableBackgroundColor != null) { - final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS,STYLE_NAME); - final OfficeStyle style = deriveStyle("table-row", styleName); + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + final OfficeStyle style = deriveStyle(OfficeToken.TABLE_ROW, styleName); Element tableRowProperties = style.getTableRowProperties(); if (tableRowProperties == null) { tableRowProperties = new Section(); tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS); tableRowProperties.setType("table-row-properties"); - tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, BACKGROUND_COLOR,tableBackgroundColor); + tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor); style.addNode(tableRowProperties); } else { - final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS,BACKGROUND_COLOR); + final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); if (oldValue == null || "transparent".equals(oldValue)) { - tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, BACKGROUND_COLOR,tableBackgroundColor); + tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor); } } - attrs.setAttribute(OfficeNamespaces.TABLE_NS,STYLE_NAME, style.getStyleName()); + attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); } } - else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs)) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs)) { columnCounter++; final String numColSpanStr = (String) attrs.getAttribute(namespace, "number-columns-spanned"); @@ -366,7 +442,7 @@ attrs.setAttribute(namespace, "number-columns-spanned", "" + span); } // we must also generate "covered-table-cell" elements for each column spanned - // but we'll do this in the endElement, after we close this "table-cell" + // but we'll do this in the endElement, after we close this OfficeToken.TABLE_CELL } // All styles have to be processed or you will loose the paragraph-styles and inline text-styles. @@ -380,21 +456,21 @@ private void collectBoundaryForElement(final AttributeMap attrs) { - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_COLUMNS,attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, attrs)) { // A table row resets the column counter. resetCurrentRowBoundaryMarker(); } - else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_COLUMN,attrs)) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs)) { - final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS,STYLE_NAME); + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); if (styleName == null) { // This should not happen, but if it does, we will ignore that cell. return; } - final OfficeStyle style = getPredefinedStylesCollection().getStyle( TABLE_COLUMN,styleName); + final OfficeStyle style = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_COLUMN, styleName); if (style == null) { // Now this is very bad. It means that there is no style defined with the given name. @@ -406,15 +482,15 @@ widthStr = widthStr.substring(0, widthStr.indexOf(getUnitsOfMeasure(widthStr))); addColumnWidthToRowBoundaryMarker(Float.parseFloat(widthStr)); ColumnBoundary currentRowBoundary = new ColumnBoundary(getCurrentRowBoundaryMarker()); - final List columnBoundaryList = getColumnBoundaryList(); - final int idx = columnBoundaryList.indexOf(currentRowBoundary); + final List columnBoundaryList_ = getColumnBoundaryList(); + final int idx = columnBoundaryList_.indexOf(currentRowBoundary); if (idx == -1) { - columnBoundaryList.add(currentRowBoundary); + columnBoundaryList_.add(currentRowBoundary); } else { - currentRowBoundary = (ColumnBoundary) columnBoundaryList.get(idx); + currentRowBoundary = (ColumnBoundary) columnBoundaryList_.get(idx); } currentRowBoundary.addTableIndex(tableCounter); } @@ -445,6 +521,37 @@ return unitsOfMeasure; } + private void createTableShapes() throws ReportProcessingException + { + try + { + final XmlWriter xmlWriter = getXmlWriter(); + // at this point we need to generate the table-columns section based on our boundary table + // <table:shapes> + // <draw:frame /> + // .. + // </table:shapes> + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.SHAPES, null, XmlWriterSupport.OPEN); + + + for (int i = 0; i < shapes.size(); i++) + { + final AttributeMap attrs = (AttributeMap) shapes.get(i); + final AttributeList attrList = buildAttributeList(attrs); + attrList.removeAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME); + xmlWriter.writeTag(OfficeNamespaces.DRAWING_NS, OfficeToken.FRAME, attrList, XmlWriterSupport.OPEN); + startChartProcessing((AttributeMap) ole.get(i)); + + xmlWriter.writeCloseTag(); + } + xmlWriter.writeCloseTag(); + } + catch (IOException e) + { + throw new ReportProcessingException("Failed", e); + } + } + private void createTableColumns() throws ReportProcessingException { try @@ -456,7 +563,7 @@ // .. // </table-columns> // the first boundary is '0' which is a placeholder so we will ignore it - xmlWriter.writeTag(OfficeNamespaces.TABLE_NS,TABLE_COLUMNS, null, XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMNS, null, XmlWriterSupport.OPEN); // blow away current column styles // start processing at i=1 because we added a boundary for "0" which is virtual @@ -469,17 +576,16 @@ { columnWidth -= cba[i - 1].getBoundary(); } - final OfficeStyle style = deriveStyle(TABLE_COLUMN, ("co" + String.valueOf(i) + "_")); + final OfficeStyle style = deriveStyle(OfficeToken.TABLE_COLUMN, ("co" + i + "_")); final Section tableColumnProperties = new Section(); tableColumnProperties.setType("table-column-properties"); tableColumnProperties.setNamespace(style.getNamespace()); - tableColumnProperties.setAttribute(style.getNamespace(), "column-width", String.valueOf(columnWidth) - + getUnitsOfMeasure(null)); + tableColumnProperties.setAttribute(style.getNamespace(), "column-width", columnWidth + getUnitsOfMeasure(null)); style.addNode(tableColumnProperties); final AttributeList myAttrList = new AttributeList(); - myAttrList.setAttribute(OfficeNamespaces.TABLE_NS,STYLE_NAME, style.getStyleName()); - xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, TABLE_COLUMN,myAttrList, XmlWriterSupport.CLOSE); + myAttrList.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, myAttrList, XmlWriterSupport.CLOSE); } xmlWriter.writeCloseTag(); } @@ -491,6 +597,19 @@ protected void endOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException { + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.INTERNAL_NS, OfficeToken.OBJECT_OLE, attrs) || oleHandled) + { + oleHandled = false; + return; + } + + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs) + && isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); + rowHeights.add(computeRowHeight(styleName)); + } + if (isRepeatingSection() || isElementBoundaryCollectionPass()) { return; @@ -502,14 +621,26 @@ return; } final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); + if (OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType)) + { + return; + } + // if this is the report namespace, write out a table definition .. - if (OfficeNamespaces.TABLE_NS.equals(namespace) - && (TABLE.equals(elementType) || COVERED_TABLE_CELL.equals(elementType) - || TABLE_COLUMN.equals(elementType) || TABLE_COLUMNS.equals(elementType))) + if (OfficeNamespaces.TABLE_NS.equals(namespace) && (OfficeToken.TABLE.equals(elementType) || + OfficeToken.COVERED_TABLE_CELL.equals(elementType) || + OfficeToken.TABLE_COLUMN.equals(elementType) || + OfficeToken.TABLE_COLUMNS.equals(elementType))) { return; } + if (!paragraphHandled && OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType)) + { + return; + } + + paragraphHandled = false; try { final XmlWriter xmlWriter = getXmlWriter(); @@ -526,7 +657,7 @@ private void generateCoveredTableCells(final AttributeMap attrs) throws IOException { - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs) == false) + if (!ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs)) { return; } @@ -537,7 +668,7 @@ final int span = TextUtilities.parseInt((String) attribute, 0); for (int i = 1; i < span; i++) { - xmlWriter.writeTag(OfficeNamespaces.TABLE_NS,COVERED_TABLE_CELL, null, XmlWriter.CLOSE); + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); } } @@ -549,22 +680,21 @@ // ///////////////////////////////////////////////////////////////////////// public void processText(final String text) throws DataSourceException, ReportProcessingException { - if (isRepeatingSection() || isElementBoundaryCollectionPass()) + if (!(isRepeatingSection() || isElementBoundaryCollectionPass())) { - return; - } + handleParagraph(); super.processText(text); } + } public void processContent(final DataFlags value) throws DataSourceException, ReportProcessingException { - if (isRepeatingSection() || isElementBoundaryCollectionPass()) + if (!(isRepeatingSection() || isElementBoundaryCollectionPass())) { - return; - } - // System.out.println(value.getValue()); + handleParagraph(); super.processContent(value); } + } protected String getStartContent() { @@ -574,40 +704,39 @@ protected void startContent(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException { - if (isElementBoundaryCollectionPass()) + if (!isElementBoundaryCollectionPass()) { - return; - } - final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, getStartContent(), null, XmlWriterSupport.OPEN); final AttributeMap tableAttributes = new AttributeMap(); tableAttributes.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TABLE_NS); - tableAttributes.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE,TABLE); - tableAttributes.setAttribute(OfficeNamespaces.TABLE_NS,STYLE_NAME, generateInitialTableStyle()); + tableAttributes.setAttribute(JFreeReportInfo.REPORT_NAMESPACE, Element.TYPE_ATTRIBUTE, OfficeToken.TABLE); + tableAttributes.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, generateInitialTableStyle()); tableAttributes.setAttribute(OfficeNamespaces.TABLE_NS, "name", "Report"); performStyleProcessing(tableAttributes); - xmlWriter.writeTag(OfficeNamespaces.TABLE_NS,TABLE, buildAttributeList(tableAttributes), XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE, buildAttributeList(tableAttributes), XmlWriterSupport.OPEN); + createTableShapes(); createTableColumns(); } + } - private String generateInitialTableStyle () throws ReportProcessingException + private String generateInitialTableStyle() throws ReportProcessingException { final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); final OfficeStyles commonStyles = predefStyles.getAutomaticStyles(); - if (commonStyles.containsStyle(TABLE,"Initial_Table") == false) + if (!commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table")) { final String masterPageName = createMasterPage(); final OfficeStyle tableStyle = new OfficeStyle(); - tableStyle.setStyleFamily(TABLE); + tableStyle.setStyleFamily(OfficeToken.TABLE); tableStyle.setStyleName("Initial_Table"); tableStyle.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName); final Element tableProperties = produceFirstChild(tableStyle, OfficeNamespaces.STYLE_NS, "table-properties"); - tableProperties.setAttribute(OfficeNamespaces.FO_NS,BACKGROUND_COLOR, "transparent"); + tableProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, "transparent"); commonStyles.addStyle(tableStyle); } return "Initial_Table"; @@ -618,7 +747,7 @@ final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); final MasterPageFactory masterPageFactory = new MasterPageFactory(predefStyles.getMasterStyles()); final OfficeMasterPage masterPage; - if (masterPageFactory.containsMasterPage("Standard", null, null) == false) + if (!masterPageFactory.containsMasterPage("Standard", null, null)) { masterPage = masterPageFactory.createMasterPage("Standard", null, null); @@ -627,8 +756,7 @@ if (pageLayoutTemplate == null) { // there is no pagelayout. Create one .. - final String derivedLayout = masterPageFactory.createPageStyle - (getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); + final String derivedLayout = masterPageFactory.createPageStyle(getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); masterPage.setPageLayout(derivedLayout); } else @@ -654,7 +782,7 @@ ReportProcessingException { // todo - if (isElementBoundaryCollectionPass() == false) + if (!isElementBoundaryCollectionPass()) { final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeCloseTag(); @@ -788,5 +916,4 @@ { return "application/vnd.oasis.opendocument.spreadsheet"; } - } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
