User: kz Date: 2008-03-05 17:39:21+0000 Modified: dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java
Log: INTEGRATION: CWS rptchart01_DEV300 (1.3.62); FILE MERGED 2008/02/21 09:57:25 oj 1.3.62.6: #i85225# fixes found with PMD 2008/02/20 10:52:56 oj 1.3.62.5: format changes 2008/02/19 11:40:41 oj 1.3.62.4: #i85225# ongoing work 2008/02/19 09:22:25 oj 1.3.62.3: RESYNC: (1.3-1.4); FILE MERGED 2008/02/19 06:42:49 oj 1.3.62.2: #i85225# ongoing work 2008/02/13 07:04:23 oj 1.3.62.1: #i85225# impl chart readhandler and oleproducer File Changes: 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.4&r2=1.5 Delta lines: +1237 -1238 ------------------------- --- TextRawReportTarget.java 2008-01-29 14:35:11+0000 1.4 +++ TextRawReportTarget.java 2008-03-05 17:39:19+0000 1.5 @@ -33,9 +33,9 @@ * MA 02111-1307 USA * ************************************************************************/ - package com.sun.star.report.pentaho.output.text; +import com.sun.star.report.DataSourceFactory; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; @@ -83,13 +83,21 @@ */ public class TextRawReportTarget extends OfficeDocumentReportTarget { + private static final String ALWAYS = "always"; + private static final String FALSE = "false"; + private static final String KEEP_TOGETHER = "keep-together"; + private static final String KEEP_WITH_NEXT = "keep-with-next"; + private static final String NAME = "name"; + private static final String NONE = "none"; + private static final String NORMAL = "normal"; + private static final String PARAGRAPH_PROPERTIES = "paragraph-properties"; + private static final String TABLE_CELL = "table-cell"; + private static final String VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT = "variables_paragraph_with_next"; private static final String VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT = "variables_paragraph_without_next"; - private static final int TABLE_LAYOUT_VARIABLES_PARAGRAPH = 0; private static final int TABLE_LAYOUT_VARIABLES_IN_FIRST_CELL = 1; private static final int TABLE_LAYOUT_SINGLE_DETAIL_TABLE = 2; - private static final int CP_SETUP = 0; private static final int CP_FIRST_TABLE = 1; private static final int CP_NEXT_TABLE = 2; @@ -105,15 +113,12 @@ 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; private boolean pageHeaderOnReportFooter; private boolean pageHeaderOnReportHeader; private int contentProcessingState; private OfficeMasterPage currentMasterPage; - private FastStack activePageContext; private MasterPageFactory masterPageFactory; private LengthCalculator sectionHeight; @@ -123,9 +128,7 @@ private boolean columnBreakPending; private boolean sectionKeepTogether; private AttributeNameGenerator sectionNames; - private int detailBandProcessingState; - private int tableLayoutConfig; private int expectedTableRowCount; private boolean firstCellSeen; @@ -137,10 +140,11 @@ final InputRepository inputRepository, final OutputRepository outputRepository, final String target, - final ImageService imageService) + final ImageService imageService, + final DataSourceFactory datasourcefactory) throws ReportProcessingException { - super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService); + super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, datasourcefactory); activePageContext = new FastStack(); this.sectionNames = new AttributeNameGenerator(); @@ -181,7 +185,6 @@ this.pageBreakDefinition = pageBreakDefinition; } - private PageBreakDefinition getPagebreakDefinition() { return pageBreakDefinition; @@ -290,8 +293,7 @@ if (pageLayoutTemplate == null) { // there is no pagelayout. Create one .. - final String derivedLayout = masterPageFactory.createPageStyle - (getGlobalStylesCollection().getAutomaticStyles(), headerSize, footerSize); + final String derivedLayout = masterPageFactory.createPageStyle(getGlobalStylesCollection().getAutomaticStyles(), headerSize, footerSize); currentMasterPage.setPageLayout(derivedLayout); } else @@ -381,8 +383,8 @@ // the column's content are evenly distributed. final XmlWriter writer = getXmlWriter(); final AttributeList attrs = new AttributeList(); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "style-name", generateSectionStyle(numberOfColumns)); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "name", sectionNames.generateName("Section")); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, STYLE_NAME, generateSectionStyle(numberOfColumns)); + attrs.setAttribute(OfficeNamespaces.TEXT_NS,NAME, sectionNames.generateName("Section")); writer.writeTag(OfficeNamespaces.TEXT_NS, "section", attrs, XmlWriterSupport.OPEN); for (int i = 0; i < numberOfColumns; i++) { @@ -401,9 +403,9 @@ final Section sectionProperties = new Section(); sectionProperties.setNamespace(OfficeNamespaces.STYLE_NS); sectionProperties.setType("section-properties"); - sectionProperties.setAttribute(OfficeNamespaces.FO_NS, "background-color", "transparent"); - sectionProperties.setAttribute(OfficeNamespaces.TEXT_NS, "dont-balance-text-columns", "false"); - sectionProperties.setAttribute(OfficeNamespaces.STYLE_NS, "editable", "false"); + sectionProperties.setAttribute(OfficeNamespaces.FO_NS, BACKGROUND_COLOR, "transparent"); + sectionProperties.setAttribute(OfficeNamespaces.TEXT_NS, "dont-balance-text-columns",FALSE); + sectionProperties.setAttribute(OfficeNamespaces.STYLE_NS, "editable",FALSE); if (columnCount > 1) { @@ -437,7 +439,7 @@ final OfficeStyle style = new OfficeStyle(); style.setNamespace(OfficeNamespaces.STYLE_NS); style.setType("style"); - style.setAttribute(OfficeNamespaces.STYLE_NS, "name", styleName); + style.setAttribute(OfficeNamespaces.STYLE_NS, NAME,styleName); style.setAttribute(OfficeNamespaces.STYLE_NS, "family", "section"); style.addNode(sectionProperties); @@ -445,7 +447,6 @@ return styleName; } - /** * Starts the output of a new office document. This method writes the generic 'office:document-content' tag along with * all known namespace declarations. @@ -483,7 +484,7 @@ private OfficeStyle createVariablesStyle(final boolean keepWithNext) { final OfficeStyle variablesSectionStyle = new OfficeStyle(); - variablesSectionStyle.setStyleFamily("paragraph"); + variablesSectionStyle.setStyleFamily(PARAGRAPH); if (keepWithNext) { variablesSectionStyle.setStyleName(TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); @@ -495,43 +496,43 @@ final Section paragraphProps = new Section(); paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS); - paragraphProps.setType("paragraph-properties"); - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "background-color", "transparent"); + paragraphProps.setType(PARAGRAPH_PROPERTIES); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS, BACKGROUND_COLOR, "transparent"); paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "text-align", "start"); - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always"); - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", "always"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_WITH_NEXT,ALWAYS); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_TOGETHER,ALWAYS); paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-align", "top"); variablesSectionStyle.addNode(paragraphProps); final Section textProps = new Section(); textProps.setNamespace(OfficeNamespaces.STYLE_NS); textProps.setType("text-properties"); - textProps.setAttribute(OfficeNamespaces.FO_NS, "font-variant", "normal"); - textProps.setAttribute(OfficeNamespaces.FO_NS, "text-transform", "none"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-variant",NORMAL); + textProps.setAttribute(OfficeNamespaces.FO_NS, "text-transform",NONE); textProps.setAttribute(OfficeNamespaces.FO_NS, "color", "#ffffff"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-outline", "false"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking", "false"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-style", "none"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-outline",FALSE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking",FALSE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-style",NONE); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-line-through-mode", "continuous"); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-position", "0% 100%"); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-name", "Tahoma"); textProps.setAttribute(OfficeNamespaces.FO_NS, "font-size", "1pt"); - textProps.setAttribute(OfficeNamespaces.FO_NS, "letter-spacing", "normal"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "letter-kerning", "false"); - textProps.setAttribute(OfficeNamespaces.FO_NS, "font-style", "normal"); - textProps.setAttribute(OfficeNamespaces.FO_NS, "text-shadow", "none"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-style", "none"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "letter-spacing",NORMAL); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "letter-kerning",FALSE); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-style",NORMAL); + textProps.setAttribute(OfficeNamespaces.FO_NS, "text-shadow",NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-style",NONE); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-underline-mode", "continuous"); - textProps.setAttribute(OfficeNamespaces.FO_NS, "font-weight", "normal"); + textProps.setAttribute(OfficeNamespaces.FO_NS, "font-weight",NORMAL); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-rotation-angle", "0"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-emphasize", "none"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine", "none"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-emphasize",NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine",NONE); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine-start-char", ""); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-combine-end-char", ""); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking", "false"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-blinking",FALSE); textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-scale", "100%"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-relief", "none"); - textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-display", "none"); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "font-relief",NONE); + textProps.setAttribute(OfficeNamespaces.STYLE_NS, "text-display",NONE); variablesSectionStyle.addNode(textProps); return variablesSectionStyle; } @@ -602,17 +603,17 @@ if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, "variable-set", attrs)) { // update the variables-declaration thingie .. - final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, "name"); + final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS,NAME); final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type"); final String newVarName = variablesDeclarations.produceVariable(varName, varType); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "name", newVarName); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME,newVarName); } else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, "variable-get", attrs)) { - final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, "name"); + final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS,NAME); final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type"); final String newVarName = variablesDeclarations.produceVariable(varName, varType); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "name", newVarName); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME,newVarName); // this one must not be written, as the DTD does not declare it. // attrs.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", null); } @@ -623,17 +624,17 @@ // future they will be made of paragraphs, and then we are prepared .. // Log.debug("Variables-Section in own paragraph " + variables); - StyleUtilities.copyStyle("paragraph", + StyleUtilities.copyStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN); xmlWriter.writeText(variables); xmlWriter.writeCloseTag(); variables = null; } - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_CELL,attrs)) { cellEmpty = true; } @@ -647,8 +648,8 @@ cellEmpty = false; if (firstCellSeen == false && sectionKeepTogether) { - final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, "style-name"); - final OfficeStyle style = deriveStyle("paragraph", styleName); + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, STYLE_NAME); + final OfficeStyle style = deriveStyle(PARAGRAPH, styleName); // Lets set the 'keep-together' flag.. Element paragraphProps = style.getParagraphProperties(); @@ -656,32 +657,32 @@ { paragraphProps = new Section(); paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS); - paragraphProps.setType("paragraph-properties"); + paragraphProps.setType(PARAGRAPH_PROPERTIES); style.addNode(paragraphProps); } - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", "always"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_TOGETHER,ALWAYS); final int keepTogetherState = getCurrentContext().getKeepTogether(); // We prevent pagebreaks within the two adjacent rows (this one and the next one) if // either a group-wide keep-together is defined or if we haven't reached the end of the // current section yet. if (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || expectedTableRowCount > 0) { - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_WITH_NEXT,ALWAYS); } - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "style-name", style.getStyleName()); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, STYLE_NAME, style.getStyleName()); } } } else { - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_CELL,attrs)) { cellEmpty = false; if (firstCellSeen == false && sectionKeepTogether) { - final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name"); - final OfficeStyle style = deriveStyle("table-cell", styleName); + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, STYLE_NAME); + final OfficeStyle style = deriveStyle( TABLE_CELL,styleName); // Lets set the 'keep-together' flag.. Element paragraphProps = style.getParagraphProperties(); @@ -689,20 +690,20 @@ { paragraphProps = new Section(); paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS); - paragraphProps.setType("paragraph-properties"); + paragraphProps.setType(PARAGRAPH_PROPERTIES); style.addNode(paragraphProps); } - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", "always"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_TOGETHER,ALWAYS); final int keepTogetherState = getCurrentContext().getKeepTogether(); // We prevent pagebreaks within the two adjacent rows (this one and the next one) if // either a group-wide keep-together is defined or if we haven't reached the end of the // current section yet. if (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || expectedTableRowCount > 0) { - paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always"); + paragraphProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_WITH_NEXT,ALWAYS); } - attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", style.getStyleName()); + attrs.setAttribute(OfficeNamespaces.TABLE_NS, STYLE_NAME, style.getStyleName()); } } } @@ -734,7 +735,7 @@ { firstCellSeen = false; expectedTableRowCount -= 1; - final String rowStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name"); + final String rowStyle = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, STYLE_NAME); final CSSNumericValue rowHeight = computeRowHeight(rowStyle); // Log.debug("Adding row-Style: " + rowStyle + " " + rowHeight); sectionHeight.add(rowHeight); @@ -798,7 +799,7 @@ else if (currentRole == OfficeDocumentReportTarget.ROLE_REPORT_FOOTER) { breakDefinition = new PageBreakDefinition(isResetPageNumber()); - masterPageName = createMasterPage (pageHeaderOnReportFooter, pageFooterOnReportFooter); + masterPageName = createMasterPage(pageHeaderOnReportFooter, pageFooterOnReportFooter); if (masterPageName == null && isSectionPagebreakBefore(attrs)) { // If we have a manual pagebreak, then activate the current master-page again. @@ -864,20 +865,20 @@ // The predefined style already has the 'keep-together' flags set. // Log.debug("Variables-Section with new Master-Page " + variables + " " + masterPageName); - final OfficeStyle style = deriveStyle("paragraph", TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); + final OfficeStyle style = deriveStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName); if (breakDefinition.isResetPageNumber()) { - final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties"); + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS,PARAGRAPH_PROPERTIES); paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1"); } if (isColumnBreakPending()) { - final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties"); + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS,PARAGRAPH_PROPERTIES); paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column"); setColumnBreakPending(false); } - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", style.getStyleName(), XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN); xmlWriter.writeText(variables); xmlWriter.writeCloseTag(); variables = null; @@ -888,11 +889,11 @@ { setColumnBreakPending(false); - final OfficeStyle style = deriveStyle("paragraph", TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); - final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties"); + final OfficeStyle style = deriveStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT); + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS,PARAGRAPH_PROPERTIES); paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1"); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", style.getStyleName(), XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN); xmlWriter.writeText(variables); xmlWriter.writeCloseTag(); variables = null; @@ -903,10 +904,10 @@ // sure that the style is part of the current 'auto-style' collection. // Log.debug("Variables-Section " + variables); - StyleUtilities.copyStyle("paragraph", + StyleUtilities.copyStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN); xmlWriter.writeText(variables); xmlWriter.writeCloseTag(); @@ -915,8 +916,7 @@ } final boolean keepWithNext = isKeepTableWithNext(); - final boolean localKeepTogether = "true".equals - (attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "keep-together")); + final boolean localKeepTogether = TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS,KEEP_TOGETHER)); final boolean tableMergeActive = isTableMergeActive(); if (tableMergeActive == false) { @@ -931,8 +931,7 @@ if (masterPageName != null || (tableMergeActive == false && (localKeepTogether || keepWithNext)) || isColumnBreakPending()) { - final String styleName = (String) - attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name"); + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, STYLE_NAME); final OfficeStyle style = deriveStyle("table", styleName); if (masterPageName != null) @@ -943,13 +942,13 @@ style.setAttribute(OfficeNamespaces.STYLE_NS, "master-page-name", masterPageName); if (breakDefinition.isResetPageNumber()) { - final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties"); + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS,PARAGRAPH_PROPERTIES); paragraphProps.setAttribute(OfficeNamespaces.STYLE_NS, "page-number", "1"); } } if (isColumnBreakPending()) { - final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "paragraph-properties"); + final Element paragraphProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS,PARAGRAPH_PROPERTIES); paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "break-before", "column"); setColumnBreakPending(false); } @@ -961,7 +960,7 @@ if (localKeepTogether) { final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "table-properties"); - tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows", "false"); + tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows",FALSE); } } else @@ -978,11 +977,11 @@ if (keepWithNext) { final Element tableProps = produceFirstChild(style, OfficeNamespaces.STYLE_NS, "table-properties"); - tableProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", "always"); + tableProps.setAttribute(OfficeNamespaces.FO_NS,KEEP_WITH_NEXT,ALWAYS); // A keep-with-next does not work, if the may-break-betweek rows is not set to false .. - tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows", "false"); + tableProps.setAttribute(OfficeNamespaces.STYLE_NS, "may-break-between-rows",FALSE); } - attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", style.getStyleName()); + attrs.setAttribute(OfficeNamespaces.TABLE_NS, STYLE_NAME, style.getStyleName()); // no need to copy the styles, this was done while deriving the // style .. } @@ -1022,7 +1021,6 @@ tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; } - private void openSection() throws IOException { @@ -1032,6 +1030,7 @@ return; } if (getCurrentRole() == ROLE_TEMPLATE || + getCurrentRole() == ROLE_P_BODY || getCurrentRole() == ROLE_SPREADSHEET_PAGE_HEADER || getCurrentRole() == ROLE_SPREADSHEET_PAGE_FOOTER) { @@ -1047,8 +1046,8 @@ if (pageContext.isSectionOpen() == false) { final AttributeList attrs = new AttributeList(); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "style-name", generateSectionStyle(columnCount.intValue())); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, "name", sectionNames.generateName("Section")); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, STYLE_NAME, generateSectionStyle(columnCount.intValue())); + attrs.setAttribute(OfficeNamespaces.TEXT_NS,NAME, sectionNames.generateName("Section")); getXmlWriter().writeTag(OfficeNamespaces.TEXT_NS, "section", attrs, XmlWriterSupport.OPEN); pageContext.setSectionOpen(true); @@ -1062,6 +1061,7 @@ { sectionHeight = new LengthCalculator(); if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || + role == OfficeDocumentReportTarget.ROLE_P_BODY || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) { @@ -1118,7 +1118,6 @@ } } - protected void startGroup(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException { @@ -1127,12 +1126,12 @@ activePageContext.push(pageContext); final Object resetPageNumber = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "reset-page-number"); - if ("true".equals(resetPageNumber)) + if (TRUE.equals(resetPageNumber)) { setPagebreakDefinition(new PageBreakDefinition(true)); } - final Object keepTogether = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "keep-together"); + final Object keepTogether = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS,KEEP_TOGETHER); if ("whole-group".equals(keepTogether)) { pageContext.setKeepTogether(PageContext.KEEP_TOGETHER_GROUP); @@ -1153,7 +1152,7 @@ } final Object newColumn = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "start-new-column"); - if ("true".equals(newColumn)) + if (TRUE.equals(newColumn)) { setColumnBreakPending(true); } @@ -1203,7 +1202,8 @@ protected void endReportSection(final AttributeMap attrs, final int role) throws IOException, DataSourceException, ReportProcessingException { - if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || + if (role == ROLE_TEMPLATE || + role == OfficeDocumentReportTarget.ROLE_P_BODY || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) { @@ -1247,7 +1247,7 @@ { final String headerText = finishBuffering().getXmlBuffer(); final int iterationCount = getGroupContext().getParent().getIterationCount(); - final boolean repeat = "true".equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "repeat-section")); + final boolean repeat = TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "repeat-section")); if (repeat == false || iterationCount > 0) { getXmlWriter().writeText(headerText); @@ -1276,19 +1276,19 @@ rootAttributes.addNamespaceDeclaration("config", OfficeNamespaces.CONFIG); rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); - final OutputStream outputStream = getOutputRepository().createOutputStream("settings.xml","text/xml"); + final OutputStream outputStream = getOutputRepository().createOutputStream("settings.xml", "text/xml"); final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), createTagDescription()); xmlWriter.setAlwaysAddNamespace(true); xmlWriter.writeXmlDeclaration("UTF-8"); xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "document-settings", rootAttributes, XmlWriterSupport.OPEN); xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "settings", XmlWriterSupport.OPEN); - xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item-set", "name", "ooo:configuration-settings", XmlWriterSupport.OPEN); + xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item-set",NAME, "ooo:configuration-settings", XmlWriterSupport.OPEN); final AttributeList configAttributes = new AttributeList(); - configAttributes.setAttribute(OfficeNamespaces.CONFIG, "name", "TableRowKeep"); + configAttributes.setAttribute(OfficeNamespaces.CONFIG,NAME, "TableRowKeep"); configAttributes.setAttribute(OfficeNamespaces.CONFIG, "type", "boolean"); xmlWriter.writeTag(OfficeNamespaces.CONFIG, "config-item", configAttributes, XmlWriterSupport.OPEN); - xmlWriter.writeText("true"); + xmlWriter.writeText(TRUE); xmlWriter.writeCloseTag(); xmlWriter.writeCloseTag(); @@ -1321,7 +1321,7 @@ final XmlWriter xmlWriter = getXmlWriter(); if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && - ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs)) + ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_CELL,attrs)) { if (variables != null) { @@ -1330,10 +1330,10 @@ //Log.debug("Variables-Section " + variables); if (sectionKeepTogether == true && expectedTableRowCount > 0) { - StyleUtilities.copyStyle("paragraph", + StyleUtilities.copyStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.OPEN); xmlWriter.writeText(variables); xmlWriter.writeCloseTag(); @@ -1341,10 +1341,10 @@ } else { - StyleUtilities.copyStyle("paragraph", + StyleUtilities.copyStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT, getStylesCollection(), getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITHOUT_KEEPWNEXT, XmlWriterSupport.OPEN); xmlWriter.writeText(variables); xmlWriter.writeCloseTag(); @@ -1356,15 +1356,15 @@ sectionKeepTogether == true && firstCellSeen == false) { // we have no variables .. - StyleUtilities.copyStyle("paragraph", + StyleUtilities.copyStyle(PARAGRAPH, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", "style-name", + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "p", STYLE_NAME, TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE); } } - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, "table-cell", attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, TABLE_CELL,attrs)) { firstCellSeen = true; } @@ -1447,7 +1447,7 @@ { final Map.Entry entry = (Map.Entry) mappingsIt.next(); final AttributeList entryList = new AttributeList(); - entryList.setAttribute(OfficeNamespaces.TEXT_NS, "name", (String) entry.getKey()); + entryList.setAttribute(OfficeNamespaces.TEXT_NS,NAME, (String) entry.getKey()); entryList.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", (String) entry.getValue()); writer.writeTag(OfficeNamespaces.TEXT_NS, "variable-decl", entryList, XmlWriterSupport.CLOSE); } @@ -1463,5 +1463,4 @@ { return "raw/" + PentahoReportEngineMetaData.OPENDOCUMENT_TEXT; } - } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
