diff options
Diffstat (limited to 'reportbuilder/java/com/sun/star/report/pentaho/output')
12 files changed, 543 insertions, 581 deletions
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java index af34c5ed5a00..ac98c9a97953 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/ImageProducer.java @@ -71,7 +71,9 @@ import org.pentaho.reporting.libraries.base.util.WaitingImageObserver; */ public class ImageProducer { + private static final Log LOGGER = LogFactory.getLog(ImageProducer.class); + public static class OfficeImage { @@ -140,7 +142,7 @@ public class ImageProducer { if (hashCode != null) { - return hashCode.intValue(); + return hashCode; } final int length = Math.min(keyData.length, 512); @@ -150,7 +152,7 @@ public class ImageProducer final byte b = keyData[i]; hashValue = b + hashValue * 23; } - this.hashCode = Integer.valueOf(hashValue); + this.hashCode = hashValue; return hashValue; } } @@ -320,7 +322,7 @@ public class ImageProducer } catch (MalformedURLException e) { - // ignore .. but we had to try this .. + // ignore .. but we had to try this .. } final OfficeImage o = (OfficeImage) imageCache.get(source); @@ -365,6 +367,22 @@ public class ImageProducer LOGGER.warn("Failed to create image from local input-repository", e); } } + else + { + try + { + URI rootURI = new URI(inputRepository.getRootURL()); + final URI uri = rootURI.resolve(source); + return produceFromURL(uri.toURL(), preserveIRI); + } + catch (URISyntaxException ex) + { + } + catch (MalformedURLException e) + { + // ignore .. but we had to try this .. + } + } // Return the image as broken image instead .. final OfficeImage officeImage = new OfficeImage(source, null, null); @@ -381,7 +399,7 @@ public class ImageProducer { uri = new URI(urlString); } - catch ( URISyntaxException ex ) + catch (URISyntaxException ex) { Logger.getLogger(ImageProducer.class.getName()).log(Level.SEVERE, null, ex); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java index 42fef8d10f45..3892944eb1f2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java @@ -104,6 +104,7 @@ import org.w3c.css.sac.LexicalUnit; */ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { + protected static final Log LOGGER = LogFactory.getLog(OfficeDocumentReportTarget.class); public static final String HORIZONTAL_POS = "horizontal-pos"; public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; @@ -228,11 +229,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget public String toString() { - return "GroupContext{" + - "parent=" + parent + - ", iterationCount=" + iterationCount + - ", groupWithRepeatingSection=" + groupWithRepeatingSection + - '}'; + return "GroupContext{" + "parent=" + parent + ", iterationCount=" + iterationCount + ", groupWithRepeatingSection=" + groupWithRepeatingSection + '}'; } } private final FastStack states; @@ -301,7 +298,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget this.imageNames = new AttributeNameGenerator(); this.imageProducer = new ImageProducer(inputRepository, outputRepository, imageService); - this.oleProducer = new OleProducer(inputRepository, outputRepository, imageService, datasourcefactory,(Integer)reportJob.getParameters().get(ReportEngineParameterNames.MAXROWS)); + this.oleProducer = new OleProducer(inputRepository, outputRepository, imageService, datasourcefactory, (Integer) reportJob.getParameters().get(ReportEngineParameterNames.MAXROWS)); try { @@ -489,7 +486,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget throw new IllegalStateException(); } final Integer o = (Integer) states.peek(); - return o.intValue(); + return o; } /** @@ -507,9 +504,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget // todo if (DEBUG_ELEMENTS) { - LOGGER.debug("Starting " + getCurrentState() + '/' + states.size() + ' ' + - ReportTargetUtil.getNamespaceFromAttribute(attrs) + " -> " + - ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + LOGGER.debug("Starting " + getCurrentState() + '/' + states.size() + ' ' + ReportTargetUtil.getNamespaceFromAttribute(attrs) + " -> " + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); } try { @@ -599,8 +594,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget } else { - throw new IllegalStateException("Expected either 'template', 'report-body', " + - "'report-header', 'report-footer', 'variables-section', 'page-header' or 'page-footer'"); + throw new IllegalStateException("Expected either 'template', 'report-body', " + "'report-header', 'report-footer', 'variables-section', 'page-header' or 'page-footer'"); } startReportSection(attrs, currentRole); } @@ -648,20 +642,17 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { // repeating group header/footer, but *no* variables section states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); - if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs) && - OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs) && OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) { currentRole = OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER; } - else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs) && - OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs) && OfficeToken.TRUE.equals(attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, "repeated-section"))) { currentRole = OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER; } else { - throw new IllegalStateException("Expected either 'group-instance', " + - "'repeating group-header' or 'repeating group-footer'"); + throw new IllegalStateException("Expected either 'group-instance', " + "'repeating group-header' or 'repeating group-footer'"); } startReportSection(attrs, currentRole); } @@ -788,9 +779,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget private final boolean allowBuffering(final int role) { - return (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || - role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || - role == OfficeDocumentReportTarget.ROLE_TEMPLATE); + return (role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || role == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || role == OfficeDocumentReportTarget.ROLE_TEMPLATE); } protected void startReportSection(final AttributeMap attrs, final int role) @@ -845,12 +834,12 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget String line = br.readLine(); while (line != null) { - xmlWriter.writeTextNormalized(line, false); - line = br.readLine(); - if (line != null) - { - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "line-break", XmlWriterSupport.CLOSE); - } + xmlWriter.writeTextNormalized(line, false); + line = br.readLine(); + if (line != null) + { + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, "line-break", XmlWriterSupport.CLOSE); + } } } catch (IOException e) @@ -989,9 +978,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget if (DEBUG_ELEMENTS) { - LOGGER.debug("Finished " + getCurrentState() + "/" + states.size() + " " + - ReportTargetUtil.getNamespaceFromAttribute(attrs) + ":" + - ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + LOGGER.debug("Finished " + getCurrentState() + "/" + states.size() + " " + ReportTargetUtil.getNamespaceFromAttribute(attrs) + ":" + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); } } @@ -1122,7 +1109,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget } catch (IOException ioe) { - throw new ReportProcessingException("Unable to create the buffer",ioe); + throw new ReportProcessingException("Unable to create the buffer", ioe); } } @@ -1172,17 +1159,14 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { final Map.Entry entry = (Map.Entry) entries.next(); final String key = String.valueOf(entry.getKey()); - if (OfficeNamespaces.TABLE_NS.equals(attrNamespace) && - "name".equals(key)) + if (OfficeNamespaces.TABLE_NS.equals(attrNamespace) && "name".equals(key)) { final String tableName = String.valueOf(entry.getValue()); final String saneName = sanitizeName(tableName); attrList.setAttribute(attrNamespace, key, tableNameGenerator.generateName(saneName)); } - else if (OfficeNamespaces.DRAWING_NS.equals(attrNamespace) && - "name".equals(key) && - !"equation".equals(elementType) ) + else if (OfficeNamespaces.DRAWING_NS.equals(attrNamespace) && "name".equals(key) && !"equation".equals(elementType)) { final String objectName = String.valueOf(entry.getValue()); attrList.setAttribute(attrNamespace, key, @@ -1243,11 +1227,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget protected boolean isRepeatingSection() { - return (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || - currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || - currentRole == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER || - currentRole == OfficeDocumentReportTarget.ROLE_PAGE_HEADER || - currentRole == OfficeDocumentReportTarget.ROLE_VARIABLES); + return (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER || currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_PAGE_FOOTER || currentRole == OfficeDocumentReportTarget.ROLE_PAGE_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_VARIABLES); } @@ -1309,8 +1289,8 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget final CSSNumericValue normalizedImageHeight = CSSValueResolverUtility.convertLength(height, imageAreaHeightVal.getType()); - final String scale = (String)attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE); - if ( OfficeToken.NONE.equals(scale) && normalizedImageWidth.getValue() > 0 && normalizedImageHeight.getValue() > 0) + final String scale = (String) attrs.getAttribute(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.SCALE); + if (OfficeToken.NONE.equals(scale) && normalizedImageWidth.getValue() > 0 && normalizedImageHeight.getValue() > 0) { final double clipWidth = normalizedImageWidth.getValue() - imageAreaWidthVal.getValue(); final double clipHeight = normalizedImageHeight.getValue() - imageAreaHeightVal.getValue(); @@ -1379,24 +1359,23 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget imageAreaHeightVal = normalizedImageHeight; } } - else if ( OfficeToken.ISOTROPIC.equals(scale) ) + else if (OfficeToken.ISOTROPIC.equals(scale)) { - final double[] ret = calcPaintSize(imageAreaWidthVal,imageAreaHeightVal,normalizedImageWidth,normalizedImageHeight); + final double[] ret = calcPaintSize(imageAreaWidthVal, imageAreaHeightVal, normalizedImageWidth, normalizedImageHeight); - posX = CSSNumericValue.createValue(imageAreaWidthVal.getType(),( imageAreaWidthVal.getValue() - ret[0]) * 0.5); - posY = CSSNumericValue.createValue(imageAreaHeightVal.getType(),( imageAreaHeightVal.getValue() - ret[1]) * 0.5); + posX = CSSNumericValue.createValue(imageAreaWidthVal.getType(), (imageAreaWidthVal.getValue() - ret[0]) * 0.5); + posY = CSSNumericValue.createValue(imageAreaHeightVal.getType(), (imageAreaHeightVal.getValue() - ret[1]) * 0.5); - imageAreaWidthVal = CSSNumericValue.createValue(imageAreaWidthVal.getType(),ret[0]); - imageAreaHeightVal = CSSNumericValue.createValue(imageAreaHeightVal.getType(),ret[1]); + imageAreaWidthVal = CSSNumericValue.createValue(imageAreaWidthVal.getType(), ret[0]); + imageAreaHeightVal = CSSNumericValue.createValue(imageAreaHeightVal.getType(), ret[1]); } } - // If we do scale, then we simply use the given image-area-size as valid image size and dont - // care about the image itself .. + // If we do scale, then we simply use the given image-area-size as valid image size and dont + // care about the image itself .. } else { - LOGGER.debug("There is no image-context, so we have to rely on the image's natural bounds. " + - "This may go awfully wrong."); + LOGGER.debug("There is no image-context, so we have to rely on the image's natural bounds. " + "This may go awfully wrong."); imageAreaWidthVal = image.getWidth(); imageAreaHeightVal = image.getHeight(); } @@ -1653,19 +1632,21 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget throw new ReportProcessingException(FAILED, ioe); } } - static private double[] calcPaintSize( final CSSNumericValue areaWidth, final CSSNumericValue areaHeight, - final CSSNumericValue imageWidth, final CSSNumericValue imageHeight) + + static private double[] calcPaintSize(final CSSNumericValue areaWidth, final CSSNumericValue areaHeight, + final CSSNumericValue imageWidth, final CSSNumericValue imageHeight) { final double ratioX = areaWidth.getValue() / imageWidth.getValue(); final double ratioY = areaHeight.getValue() / imageHeight.getValue(); - final double ratioMin = Math.min( ratioX, ratioY ); + final double ratioMin = Math.min(ratioX, ratioY); double[] ret = new double[2]; ret[0] = imageWidth.getValue() * ratioMin; ret[1] = imageHeight.getValue() * ratioMin; return ret; } + protected void writeNullDate() throws IOException { // write NULL DATE diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java index 36dffa290da1..66b0a0435b17 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OleProducer.java @@ -49,7 +49,8 @@ import org.apache.commons.logging.LogFactory; * * @author Ocke Janssen */ -public class OleProducer { +public class OleProducer +{ private static final Log LOGGER = LogFactory.getLog(OleProducer.class); private final InputRepository inputRepository; @@ -59,13 +60,15 @@ public class OleProducer { private final ImageService imageService; private final Integer maxRows; - public OleProducer(final InputRepository inputRepository, - final OutputRepository outputRepository,final ImageService imageService,final DataSourceFactory dataSourceFactory,final Integer maxRows) { - if (inputRepository == null) { + final OutputRepository outputRepository, final ImageService imageService, final DataSourceFactory dataSourceFactory, final Integer maxRows) + { + if (inputRepository == null) + { throw new NullPointerException(); } - if (outputRepository == null) { + if (outputRepository == null) + { throw new NullPointerException(); } @@ -77,15 +80,18 @@ public class OleProducer { this.maxRows = maxRows; } - String produceOle(final String source,final List masterColumns,final List masterValues,final List detailColumns) { + String produceOle(final String source, final List masterColumns, final List masterValues, final List detailColumns) + { InputRepository subInputRepository = null; OutputRepository subOutputRepository = null; String output = ""; - try { + try + { subInputRepository = inputRepository.openInputRepository(source); output = nameGenerator.generateStorageName("Object", null); subOutputRepository = outputRepository.openOutputRepository(output, PentahoReportEngineMetaData.OPENDOCUMENT_CHART); - try { + try + { final PentahoReportEngine engine = new PentahoReportEngine(); final ReportJobDefinition definition = engine.createJobDefinition(); @@ -104,18 +110,27 @@ public class OleProducer { procParms.setProperty(ReportEngineParameterNames.MAXROWS, maxRows); engine.createJob(definition).execute(); - } catch (ReportExecutionException ex) { + } + catch (ReportExecutionException ex) + { LOGGER.error("ReportProcessing failed", ex); - } catch (IOException ex) { + } + catch (IOException ex) + { LOGGER.error("ReportProcessing failed", ex); } - } catch (IOException ex) { + } + catch (IOException ex) + { LOGGER.error("ReportProcessing failed", ex); - } finally { - if (subInputRepository != null) { + } finally + { + if (subInputRepository != null) + { subInputRepository.closeInputRepository(); } - if (subOutputRepository != null) { + if (subOutputRepository != null) + { subOutputRepository.closeOutputRepository(); } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java index 948e140f76ff..4bccca1e9612 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StyleUtilities.java @@ -55,6 +55,7 @@ import org.apache.commons.logging.LogFactory; */ public class StyleUtilities { + private static final Log LOGGER = LogFactory.getLog(StyleUtilities.class); private static final String STYLE = "style"; @@ -117,8 +118,7 @@ public class StyleUtilities } inheritanceTracker.add(styleName); - if (stylesCollection.containsStyle(styleFamily, styleName) || - commonCollection.getCommonStyles().containsStyle(styleFamily, styleName)) + if (stylesCollection.containsStyle(styleFamily, styleName) || commonCollection.getCommonStyles().containsStyle(styleFamily, styleName)) { // fine, there's already a copy of the stylesheet. return; @@ -193,7 +193,8 @@ public class StyleUtilities LOGGER.warn("Inconsistent styles: " + styleFamily + ":" + styleParent + " does not exist."); } return preStyle; - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException("Failed to derive a stylesheet", e); } @@ -248,7 +249,8 @@ public class StyleUtilities currentFonts.addFontFace((FontFaceElement) element.clone()); } } - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException("Failed to clone font-face element"); } @@ -264,12 +266,13 @@ public class StyleUtilities { try { - final Section styleMap = (Section) derivedStyle.findFirstChild(OfficeNamespaces.STYLE_NS,"map"); + final Section styleMap = (Section) derivedStyle.findFirstChild(OfficeNamespaces.STYLE_NS, "map"); if (styleMap != null) { performDataStyleProcessing(styleMap, stylesCollection, predefCollection, "apply-style-name"); } - } catch (Exception e) + } + catch (Exception e) { } } @@ -286,8 +289,7 @@ public class StyleUtilities if (attribute != null) { final String styleName = String.valueOf(attribute); - if (!stylesCollection.getAutomaticStyles().containsDataStyle(styleName) && - !stylesCollection.getCommonStyles().containsDataStyle(styleName)) + if (!stylesCollection.getAutomaticStyles().containsDataStyle(styleName) && !stylesCollection.getCommonStyles().containsDataStyle(styleName)) { try { @@ -313,7 +315,8 @@ public class StyleUtilities derivedStyle = null; } } - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException("Failed to copy style. This should not have happened."); } @@ -508,7 +511,8 @@ public class StyleUtilities predefCollection); } return autostyle; - } catch (CloneNotSupportedException e) + } + catch (CloneNotSupportedException e) { throw new ReportProcessingException( "Deriving the style failed. Clone error: ", e); diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java index 4300d44defd3..24fb64d3b95e 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/StylesWriter.java @@ -27,8 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - - package com.sun.star.report.pentaho.output; import java.io.IOException; @@ -70,305 +68,319 @@ import org.pentaho.reporting.libraries.xmlns.writer.XmlWriterSupport; */ public class StylesWriter { - private final XmlWriter xmlWriter; - private final boolean writeOpeningTag; - - public StylesWriter(final Writer writer) - { - final DefaultTagDescription tagDescription = new DefaultTagDescription(); - tagDescription.configure (JFreeReportBoot.getInstance().getGlobalConfig(), - OfficeDocumentReportTarget.TAG_DEF_PREFIX); - - this.xmlWriter = new XmlWriter(writer, tagDescription); - this.xmlWriter.setAlwaysAddNamespace(true); - this.writeOpeningTag = true; - } - - public StylesWriter(final XmlWriter xmlWriter) - { - this.xmlWriter = xmlWriter; - this.writeOpeningTag = false; - } - - public void writeContentStyles (final OfficeStylesCollection predefined, - final OfficeStylesCollection globals) - throws IOException, ReportProcessingException - { - writeFontFaces(new OfficeStylesCollection[] { globals }); - writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); - } - - public void writeGlobalStyles (final OfficeStylesCollection predefined, - final OfficeStylesCollection globals) - throws IOException, ReportProcessingException - { - if (writeOpeningTag) - { - performWriteRootTag(); - } - writeFontFaces(new OfficeStylesCollection[] { globals }); - writeAutomaticStylesSection(new OfficeStylesCollection[] { globals }); - writeCommonStylesSection(new OfficeStylesCollection[] { globals }); - writeMasterStylesSection(new OfficeStylesCollection[] { globals }); + private final XmlWriter xmlWriter; + private final boolean writeOpeningTag; - if (writeOpeningTag) + public StylesWriter(final Writer writer) { - xmlWriter.writeCloseTag(); + final DefaultTagDescription tagDescription = new DefaultTagDescription(); + tagDescription.configure(JFreeReportBoot.getInstance().getGlobalConfig(), + OfficeDocumentReportTarget.TAG_DEF_PREFIX); + + this.xmlWriter = new XmlWriter(writer, tagDescription); + this.xmlWriter.setAlwaysAddNamespace(true); + this.writeOpeningTag = true; } - } - - private void writeMasterStylesSection(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "master-styles", XmlWriterSupport.OPEN); - for (int sci = 0; sci < osc.length; sci++) + + public StylesWriter(final XmlWriter xmlWriter) { - final OfficeStylesCollection collection = osc[sci]; - final OfficeMasterStyles officeStyles = collection.getMasterStyles(); - final OfficeMasterPage[] officeMasterPages = officeStyles.getAllMasterPages(); - for (int i = 0; i < officeMasterPages.length; i++) - { - final OfficeMasterPage masterPage = officeMasterPages[i]; - writeSection(masterPage); - } - - writeSectionChilds(officeStyles.getOtherNodes().getNodeArray()); + this.xmlWriter = xmlWriter; + this.writeOpeningTag = false; } - xmlWriter.writeCloseTag(); - } - - private void writeCommonStylesSection(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "styles", XmlWriterSupport.OPEN); - - for (int sci = 0; sci < osc.length; sci++) + public void writeContentStyles(final OfficeStylesCollection predefined, + final OfficeStylesCollection globals) + throws IOException, ReportProcessingException { - final OfficeStylesCollection collection = osc[sci]; - final OfficeStyles officeStyles = collection.getCommonStyles(); - writeStyles(officeStyles); + writeFontFaces(new OfficeStylesCollection[] + { + globals + }); + writeAutomaticStylesSection(new OfficeStylesCollection[] + { + globals + }); } - xmlWriter.writeCloseTag(); - } - - private void writeAutomaticStylesSection(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "automatic-styles", XmlWriterSupport.OPEN); - for (int sci = 0; sci < osc.length; sci++) + public void writeGlobalStyles(final OfficeStylesCollection predefined, + final OfficeStylesCollection globals) + throws IOException, ReportProcessingException { - final OfficeStylesCollection collection = osc[sci]; - final OfficeStyles officeStyles = collection.getAutomaticStyles(); - writeStyles(officeStyles); + if (writeOpeningTag) + { + performWriteRootTag(); + } + + writeFontFaces(new OfficeStylesCollection[] + { + globals + }); + writeAutomaticStylesSection(new OfficeStylesCollection[] + { + globals + }); + writeCommonStylesSection(new OfficeStylesCollection[] + { + globals + }); + writeMasterStylesSection(new OfficeStylesCollection[] + { + globals + }); + + if (writeOpeningTag) + { + xmlWriter.writeCloseTag(); + } } - xmlWriter.writeCloseTag(); - } - - private void writeFontFaces(final OfficeStylesCollection[] osc) - throws IOException - { - xmlWriter.writeTag - (OfficeNamespaces.OFFICE_NS, "font-face-decls", XmlWriterSupport.OPEN); - - final TreeMap fontFaces = new TreeMap(); - for (int sci = 0; sci < osc.length; sci++) + private void writeMasterStylesSection(final OfficeStylesCollection[] osc) + throws IOException { - final OfficeStylesCollection collection = osc[sci]; - final FontFaceDeclsSection fontFaceDecls = collection.getFontFaceDecls(); - final FontFaceElement[] fontFaceElements = fontFaceDecls.getAllFontFaces(); - for (int i = 0; i < fontFaceElements.length; i++) - { - final FontFaceElement element = fontFaceElements[i]; - fontFaces.put (element.getStyleName(), element); - } + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "master-styles", XmlWriterSupport.OPEN); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeMasterStyles officeStyles = collection.getMasterStyles(); + final OfficeMasterPage[] officeMasterPages = officeStyles.getAllMasterPages(); + for (int i = 0; i < officeMasterPages.length; i++) + { + final OfficeMasterPage masterPage = officeMasterPages[i]; + writeSection(masterPage); + } + + writeSectionChilds(officeStyles.getOtherNodes().getNodeArray()); + } + + xmlWriter.writeCloseTag(); } - final Iterator values = fontFaces.values().iterator(); - while (values.hasNext()) + private void writeCommonStylesSection(final OfficeStylesCollection[] osc) + throws IOException { - final FontFaceElement element = (FontFaceElement) values.next(); - writeElement(element); - } + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "styles", XmlWriterSupport.OPEN); - xmlWriter.writeCloseTag(); - } + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeStyles officeStyles = collection.getCommonStyles(); + writeStyles(officeStyles); + } - private void writeStyles (final OfficeStyles styles) - throws IOException - { - final OfficeStyle[] allStyles = styles.getAllStyles(); - for (int i = 0; i < allStyles.length; i++) - { - final OfficeStyle style = allStyles[i]; - writeSection(style); + xmlWriter.writeCloseTag(); } - final DataStyle[] allDataStyles = styles.getAllDataStyles(); - for (int i = 0; i < allDataStyles.length; i++) + private void writeAutomaticStylesSection(final OfficeStylesCollection[] osc) + throws IOException { - final DataStyle style = allDataStyles[i]; - writeSection(style); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "automatic-styles", XmlWriterSupport.OPEN); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final OfficeStyles officeStyles = collection.getAutomaticStyles(); + writeStyles(officeStyles); + } + + xmlWriter.writeCloseTag(); } - final PageLayout[] allPageStyles = styles.getAllPageStyles(); - for (int i = 0; i < allPageStyles.length; i++) + private void writeFontFaces(final OfficeStylesCollection[] osc) + throws IOException { - final PageLayout style = allPageStyles[i]; - writeSection(style); + xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, "font-face-decls", XmlWriterSupport.OPEN); + + final TreeMap fontFaces = new TreeMap(); + for (int sci = 0; sci < osc.length; sci++) + { + final OfficeStylesCollection collection = osc[sci]; + final FontFaceDeclsSection fontFaceDecls = collection.getFontFaceDecls(); + final FontFaceElement[] fontFaceElements = fontFaceDecls.getAllFontFaces(); + for (int i = 0; i < fontFaceElements.length; i++) + { + final FontFaceElement element = fontFaceElements[i]; + fontFaces.put(element.getStyleName(), element); + } + } + + final Iterator values = fontFaces.values().iterator(); + while (values.hasNext()) + { + final FontFaceElement element = (FontFaceElement) values.next(); + writeElement(element); + } + + xmlWriter.writeCloseTag(); } - writeSectionChilds(styles.getOtherStyles()); - } - - private void writeElement (final Element element) - throws IOException - { - final String type = element.getType(); - final String namespace = element.getNamespace(); - final AttributeList attrList = buildAttributeList(element.getAttributeMap()); - xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); - } - - private void writeSection (final Section section) - throws IOException - { - final String type = section.getType(); - final String namespace = section.getNamespace(); - final AttributeList attrList = buildAttributeList(section.getAttributeMap()); - if (section.getNodeCount() == 0) + private void writeStyles(final OfficeStyles styles) + throws IOException { - xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); - return; + final OfficeStyle[] allStyles = styles.getAllStyles(); + for (int i = 0; i < allStyles.length; i++) + { + final OfficeStyle style = allStyles[i]; + writeSection(style); + } + + final DataStyle[] allDataStyles = styles.getAllDataStyles(); + for (int i = 0; i < allDataStyles.length; i++) + { + final DataStyle style = allDataStyles[i]; + writeSection(style); + } + + final PageLayout[] allPageStyles = styles.getAllPageStyles(); + for (int i = 0; i < allPageStyles.length; i++) + { + final PageLayout style = allPageStyles[i]; + writeSection(style); + } + + writeSectionChilds(styles.getOtherStyles()); } - xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.OPEN); - writeSectionChilds(section.getNodeArray()); - - xmlWriter.writeCloseTag(); - } - - private void writeSectionChilds(final Node[] nodes) - throws IOException - { - for (int i = 0; i < nodes.length; i++) + private void writeElement(final Element element) + throws IOException { - final Node node = nodes[i]; - if (node instanceof Section) - { - writeSection((Section) node); - } - else if (node instanceof Element) - { - writeElement((Element) node); - } - else if (node instanceof RawText) - { - final RawText text = (RawText) node; - xmlWriter.writeText(text.getText()); - } - else if (node instanceof StaticText) - { - final StaticText text = (StaticText) node; - xmlWriter.writeTextNormalized(text.getText(), false); - } + final String type = element.getType(); + final String namespace = element.getNamespace(); + final AttributeList attrList = buildAttributeList(element.getAttributeMap()); + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); } - } - protected AttributeList buildAttributeList(final AttributeMap attrs) - { - final AttributeList attrList = new AttributeList(); - final String[] namespaces = attrs.getNameSpaces(); - for (int i = 0; i < namespaces.length; i++) + private void writeSection(final Section section) + throws IOException { - final String attrNamespace = namespaces[i]; - if (isFilteredNamespace(attrNamespace)) - { - continue; - } - - final Map localAttributes = attrs.getAttributes(attrNamespace); - final Iterator entries = localAttributes.entrySet().iterator(); - while (entries.hasNext()) - { - final Map.Entry entry = (Map.Entry) entries.next(); - final String key = String.valueOf(entry.getKey()); - attrList.setAttribute(attrNamespace, key, String.valueOf(entry.getValue())); - } + final String type = section.getType(); + final String namespace = section.getNamespace(); + final AttributeList attrList = buildAttributeList(section.getAttributeMap()); + if (section.getNodeCount() == 0) + { + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.CLOSE); + return; + } + + xmlWriter.writeTag(namespace, type, attrList, XmlWriterSupport.OPEN); + writeSectionChilds(section.getNodeArray()); + + xmlWriter.writeCloseTag(); } - return attrList; - } - protected boolean isFilteredNamespace(final String namespace) - { - if (Namespaces.LIBLAYOUT_NAMESPACE.equals(namespace)) + private void writeSectionChilds(final Node[] nodes) + throws IOException { - return true; + for (int i = 0; i < nodes.length; i++) + { + final Node node = nodes[i]; + if (node instanceof Section) + { + writeSection((Section) node); + } + else if (node instanceof Element) + { + writeElement((Element) node); + } + else if (node instanceof RawText) + { + final RawText text = (RawText) node; + xmlWriter.writeText(text.getText()); + } + else if (node instanceof StaticText) + { + final StaticText text = (StaticText) node; + xmlWriter.writeTextNormalized(text.getText(), false); + } + } } - if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + + protected AttributeList buildAttributeList(final AttributeMap attrs) { - return true; + final AttributeList attrList = new AttributeList(); + final String[] namespaces = attrs.getNameSpaces(); + for (int i = 0; i < namespaces.length; i++) + { + final String attrNamespace = namespaces[i]; + if (isFilteredNamespace(attrNamespace)) + { + continue; + } + + final Map localAttributes = attrs.getAttributes(attrNamespace); + final Iterator entries = localAttributes.entrySet().iterator(); + while (entries.hasNext()) + { + final Map.Entry entry = (Map.Entry) entries.next(); + final String key = String.valueOf(entry.getKey()); + attrList.setAttribute(attrNamespace, key, String.valueOf(entry.getValue())); + } + } + return attrList; } - if (JFreeReportInfo.COMPATIBILITY_NAMESPACE.equals(namespace)) + + protected boolean isFilteredNamespace(final String namespace) { - return true; + if (Namespaces.LIBLAYOUT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.REPORT_NAMESPACE.equals(namespace)) + { + return true; + } + if (JFreeReportInfo.COMPATIBILITY_NAMESPACE.equals(namespace)) + { + return true; + } + if (OfficeNamespaces.OOREPORT_NS.equals(namespace)) + { + return true; + } + return false; } - if (OfficeNamespaces.OOREPORT_NS.equals(namespace)) + + private void performWriteRootTag() + throws IOException { - return true; + final AttributeList rootAttributes = new AttributeList(); + rootAttributes.addNamespaceDeclaration("office", + OfficeNamespaces.OFFICE_NS); + rootAttributes.addNamespaceDeclaration("style", OfficeNamespaces.STYLE_NS); + rootAttributes.addNamespaceDeclaration("text", OfficeNamespaces.TEXT_NS); + rootAttributes.addNamespaceDeclaration("table", OfficeNamespaces.TABLE_NS); + rootAttributes.addNamespaceDeclaration("draw", OfficeNamespaces.DRAWING_NS); + rootAttributes.addNamespaceDeclaration("fo", OfficeNamespaces.FO_NS); + rootAttributes.addNamespaceDeclaration("xlink", OfficeNamespaces.XLINK_NS); + rootAttributes.addNamespaceDeclaration("dc", OfficeNamespaces.PURL_NS); + rootAttributes.addNamespaceDeclaration("meta", OfficeNamespaces.META_NS); + rootAttributes.addNamespaceDeclaration("number", + OfficeNamespaces.DATASTYLE_NS); + rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); + rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); + rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); + rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); + rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); + rootAttributes.addNamespaceDeclaration("script", + OfficeNamespaces.SCRIPT_NS); + rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); + rootAttributes.addNamespaceDeclaration("ooow", OfficeNamespaces.OOW2004_NS); + rootAttributes.addNamespaceDeclaration("oooc", OfficeNamespaces.OOC2004_NS); + rootAttributes.addNamespaceDeclaration("dom", + OfficeNamespaces.XML_EVENT_NS); + rootAttributes.addNamespaceDeclaration("xforms", + OfficeNamespaces.XFORMS_NS); + rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); + rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); + rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); + + this.xmlWriter.writeXmlDeclaration("UTF-8"); + this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, + "document-content", rootAttributes, XmlWriterSupport.OPEN); } - return false; - } - - private void performWriteRootTag() - throws IOException - { - final AttributeList rootAttributes = new AttributeList(); - rootAttributes.addNamespaceDeclaration("office", - OfficeNamespaces.OFFICE_NS); - rootAttributes.addNamespaceDeclaration("style", OfficeNamespaces.STYLE_NS); - rootAttributes.addNamespaceDeclaration("text", OfficeNamespaces.TEXT_NS); - rootAttributes.addNamespaceDeclaration("table", OfficeNamespaces.TABLE_NS); - rootAttributes.addNamespaceDeclaration("draw", OfficeNamespaces.DRAWING_NS); - rootAttributes.addNamespaceDeclaration("fo", OfficeNamespaces.FO_NS); - rootAttributes.addNamespaceDeclaration("xlink", OfficeNamespaces.XLINK_NS); - rootAttributes.addNamespaceDeclaration("dc", OfficeNamespaces.PURL_NS); - rootAttributes.addNamespaceDeclaration("meta", OfficeNamespaces.META_NS); - rootAttributes.addNamespaceDeclaration("number", - OfficeNamespaces.DATASTYLE_NS); - rootAttributes.addNamespaceDeclaration("svg", OfficeNamespaces.SVG_NS); - rootAttributes.addNamespaceDeclaration("chart", OfficeNamespaces.CHART_NS); - rootAttributes.addNamespaceDeclaration("dr3d", OfficeNamespaces.DR3D_NS); - rootAttributes.addNamespaceDeclaration("math", OfficeNamespaces.MATHML_NS); - rootAttributes.addNamespaceDeclaration("form", OfficeNamespaces.FORM_NS); - rootAttributes.addNamespaceDeclaration("script", - OfficeNamespaces.SCRIPT_NS); - rootAttributes.addNamespaceDeclaration("ooo", OfficeNamespaces.OO2004_NS); - rootAttributes.addNamespaceDeclaration("ooow", OfficeNamespaces.OOW2004_NS); - rootAttributes.addNamespaceDeclaration("oooc", OfficeNamespaces.OOC2004_NS); - rootAttributes.addNamespaceDeclaration("dom", - OfficeNamespaces.XML_EVENT_NS); - rootAttributes.addNamespaceDeclaration("xforms", - OfficeNamespaces.XFORMS_NS); - rootAttributes.addNamespaceDeclaration("xsd", OfficeNamespaces.XSD_NS); - rootAttributes.addNamespaceDeclaration("xsi", OfficeNamespaces.XSI_NS); - rootAttributes.setAttribute(OfficeNamespaces.OFFICE_NS, "version", "1.0"); - - this.xmlWriter.writeXmlDeclaration("UTF-8"); - this.xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, - "document-content", rootAttributes, XmlWriterSupport.OPEN); - } - - public void close() - throws IOException - { - xmlWriter.close(); - } + public void close() + throws IOException + { + xmlWriter.close(); + } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java index 9328be4fd031..05e70d1e49e2 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/chart/ChartRawReportTarget.java @@ -138,21 +138,19 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } } private boolean isFiltered(final String elementType) { - return OfficeToken.TABLE_HEADER_COLUMNS.equals(elementType) || - OfficeToken.TABLE_HEADER_ROWS.equals(elementType) || - OfficeToken.TABLE_COLUMNS.equals(elementType); + return OfficeToken.TABLE_HEADER_COLUMNS.equals(elementType) || OfficeToken.TABLE_HEADER_ROWS.equals(elementType) || OfficeToken.TABLE_COLUMNS.equals(elementType); } protected void endOther(final AttributeMap attrs) throws IOException, DataSourceException, ReportProcessingException { - if ( tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) + if (tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) { return; } @@ -163,8 +161,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget // if this is the report namespace, write out a table definition .. if (OfficeNamespaces.TABLE_NS.equals(namespace)) { - if (OfficeToken.TABLE.equals(elementType) || - OfficeToken.TABLE_ROWS.equals(elementType)) + if (OfficeToken.TABLE.equals(elementType) || OfficeToken.TABLE_ROWS.equals(elementType)) { return; } @@ -194,7 +191,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget public void processContent(final DataFlags value) throws DataSourceException, ReportProcessingException { - if ( !(tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE)) + if (!(tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE)) { super.processContent(value); } @@ -203,7 +200,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget private void processElement(final AttributeMap attrs, final String namespace, final String elementType) throws IOException, ReportProcessingException { - if ( tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) + if (tableRowsStarted && getCurrentRole() == ROLE_TEMPLATE) { return; } @@ -247,9 +244,10 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeTag(namespace, elementType, attrList, XmlWriter.OPEN); ++closeTags; - // System.out.println("elementType = " + elementType); + // System.out.println("elementType = " + elementType); } // ///////////////////////////////////////////////////////////////////////// + public void processText(final String text) throws DataSourceException, ReportProcessingException { if (inFilterElements && tableCount > 1) @@ -258,6 +256,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } super.processText(text); } + public void endReport(final ReportStructureRoot report) throws DataSourceException, ReportProcessingException { @@ -281,7 +280,7 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget } catch (IOException ioe) { - throw new ReportProcessingException("Failed to write settings document",ioe); + throw new ReportProcessingException("Failed to write settings document", ioe); } } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java index 268450de3b08..ddc644d52ef3 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportProcessor.java @@ -115,7 +115,7 @@ public class SpreadsheetRawReportProcessor extends AbstractReportProcessor if (context instanceof ReportContextImpl) { final ReportContextImpl impl = (ReportContextImpl) context; - impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(),job.getConfiguration())); + impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(), job.getConfiguration())); } return context; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java index 3be3c523662e..01e5135c3613 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java @@ -130,13 +130,13 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget public int compareTo(final Object arg0) { - if ( arg0.equals(this) ) + if (arg0.equals(this)) { return 0; } - if ( arg0 instanceof ColumnBoundary ) + if (arg0 instanceof ColumnBoundary) { - if ( boundary > ((ColumnBoundary) arg0).boundary ) + if (boundary > ((ColumnBoundary) arg0).boundary) { return 1; } @@ -150,11 +150,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget public boolean equals(final Object obj) { - if ( obj instanceof ColumnBoundary ) - { - return ((ColumnBoundary) obj).boundary == boundary; - } - return false; + return obj instanceof ColumnBoundary && ((ColumnBoundary) obj).boundary == boundary; } public int hashCode() @@ -164,7 +160,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } } private String tableBackgroundColor; // null means transparent ... - private static final ColumnBoundary[] EMPTY_COLBOUNDS = new ColumnBoundary[ 0 ]; + private static final ColumnBoundary[] EMPTY_COLBOUNDS = new ColumnBoundary[0]; private boolean elementBoundaryCollectionPass; private boolean oleHandled; private final List columnBoundaryList; @@ -181,14 +177,14 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget final private List rowHeights; public SpreadsheetRawReportTarget(final ReportJob reportJob, - final ResourceManager resourceManager, - final ResourceKey baseResource, - final InputRepository inputRepository, - final OutputRepository outputRepository, - final String target, - final ImageService imageService, - final DataSourceFactory dataSourceFactory) - throws ReportProcessingException + final ResourceManager resourceManager, + final ResourceKey baseResource, + final InputRepository inputRepository, + final OutputRepository outputRepository, + final String target, + final ImageService imageService, + final DataSourceFactory dataSourceFactory) + throws ReportProcessingException { super(reportJob, resourceManager, baseResource, inputRepository, outputRepository, target, imageService, dataSourceFactory); columnBoundaryList = new ArrayList(); @@ -201,9 +197,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget public void startOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException { - if ( ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs) ) + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs)) { - if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) { ole.add(attrs); } @@ -211,24 +207,24 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget return; } final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); - if ( isRepeatingSection() || isFilteredNamespace(namespace) ) + if (isRepeatingSection() || isFilteredNamespace(namespace)) { return; } final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); - if ( OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType) && !paragraphHandled ) + if (OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType) && !paragraphHandled) { paragraphFound = true; return; } - if ( OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType) ) + if (OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType)) { - if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) { final LengthCalculator len = new LengthCalculator(); - for ( int i = 0; i < rowHeights.size(); i++ ) + for (int i = 0; i < rowHeights.size(); i++) { len.add((CSSNumericValue) rowHeights.get(i)); // val += ((CSSNumericValue)rowHeights.get(i)).getValue(); @@ -239,7 +235,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget 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 ) + if (y != null) { len.add(parseLength(y)); final CSSNumericValue currentY = len.getResult(); @@ -249,9 +245,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } return; } - if ( oleHandled ) + if (oleHandled) { - if ( isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) + if (isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE) { ole.add(attrs); } @@ -259,14 +255,14 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } // if this is the report namespace, write out a table definition .. - if ( OfficeNamespaces.TABLE_NS.equals(namespace) && OfficeToken.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 tableCounter++; } - if ( isElementBoundaryCollectionPass() ) + if (isElementBoundaryCollectionPass()) { collectBoundaryForElement(attrs); } @@ -277,19 +273,16 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget { processElement(attrs, namespace, elementType); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } } protected void startReportSection(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) || - !PageSection.isPrintWithReportFooter(attrs)) ) + if ((role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) && (!PageSection.isPrintWithReportHeader(attrs) || !PageSection.isPrintWithReportFooter(attrs))) { startBuffering(new OfficeStylesCollection(), true); } @@ -301,10 +294,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget 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) || - !PageSection.isPrintWithReportFooter(attrs)) ) + if ((role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) && (!PageSection.isPrintWithReportHeader(attrs) || !PageSection.isPrintWithReportFooter(attrs))) { finishBuffering(); } @@ -316,7 +306,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private void handleParagraph() { - if ( paragraphFound ) + if (paragraphFound) { try { @@ -325,7 +315,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget paragraphHandled = true; paragraphFound = false; } - catch ( IOException ex ) + catch (IOException ex) { LOGGER.error("ReportProcessing failed", ex); } @@ -333,25 +323,25 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } private void processElement(final AttributeMap attrs, final String namespace, final String elementType) - throws IOException, ReportProcessingException + throws IOException, ReportProcessingException { final XmlWriter xmlWriter = getXmlWriter(); - if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.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, OfficeToken.STYLE_NAME); - if ( tableStyle == null ) + if (tableStyle == null) { tableBackgroundColor = null; } else { final Object raw = StyleUtilities.queryStyle(getPredefinedStylesCollection(), OfficeToken.TABLE, tableStyle, - "table-properties", OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); - if ( raw == null || TRANSPARENT.equals(raw) ) + "table-properties", OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); + if (raw == null || TRANSPARENT.equals(raw)) { tableBackgroundColor = null; } @@ -363,29 +353,28 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget return; } - if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs) || - ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.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, OfficeToken.COVERED_TABLE_CELL, attrs) ) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, attrs)) { - if ( columnSpanCounter > 0 ) + if (columnSpanCounter > 0) { columnSpanCounter--; } - if ( columnSpanCounter == 0 ) + if (columnSpanCounter == 0) { // if we weren't expecting a covered-table-cell, let's use it, it's probably from a row-span columnCounter++; final int span = getColumnSpanForCell(tableCounter, columnCounter, 1); // use the calculated span for the column in the uniform table to create any additional covered-table-cell // elements - for ( int i = 0; i < span; i++ ) + for (int i = 0; i < span; i++) { xmlWriter.writeTag(namespace, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); } @@ -393,17 +382,17 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget return; } - if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.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 ) + if (tableBackgroundColor != null) { 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 ) + if (tableRowProperties == null) { tableRowProperties = new Section(); tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS); @@ -414,7 +403,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget else { final Object oldValue = tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); - if ( oldValue == null || TRANSPARENT.equals(oldValue) ) + if (oldValue == null || TRANSPARENT.equals(oldValue)) { tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, tableBackgroundColor); } @@ -422,33 +411,33 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); } } - else if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs) ) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs)) { columnCounter++; final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); - if ( styleName != null ) + if (styleName != null) { final OfficeStyle cellStyle = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_CELL, styleName); - if ( cellStyle != null ) + if (cellStyle != null) { final Section textProperties = (Section) cellStyle.getTextProperties(); - if ( textProperties != null ) + if (textProperties != null) { - for ( String i : FOPROPS ) + for (String i : FOPROPS) { textProperties.setAttribute(OfficeNamespaces.FO_NS, i, null); } textProperties.setAttribute(OfficeNamespaces.TEXT_NS, "display", null); - for ( String i : STYLEPROPS ) + for (String i : STYLEPROPS) { textProperties.setAttribute(OfficeNamespaces.STYLE_NS, i, null); } } final Section props = (Section) cellStyle.getTableCellProperties(); - if ( props != null ) + if (props != null) { final Object raw = props.getAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR); - if ( TRANSPARENT.equals(raw) ) + if (TRANSPARENT.equals(raw)) { props.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, null); // cellStyle.removeNode(props); @@ -458,15 +447,15 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, styleName); } - final String numColSpanStr = (String) attrs.getAttribute(namespace,NUMBERCOLUMNSSPANNED); + final String numColSpanStr = (String) attrs.getAttribute(namespace, NUMBERCOLUMNSSPANNED); int initialColumnSpan = columnSpanCounter = 1; - if ( numColSpanStr != null ) + if (numColSpanStr != null) { initialColumnSpan = Integer.parseInt(numColSpanStr); columnSpanCounter = initialColumnSpan; } final int span = getColumnSpanForCell(tableCounter, columnCounter, initialColumnSpan); - if ( initialColumnSpan > 1 ) + if (initialColumnSpan > 1) { // add the initial column span to our column counter index (subtract 1, since it is counted by default) columnCounter += initialColumnSpan - 1; @@ -486,9 +475,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // } // there's no point to create number-columns-spanned attributes if we only span 1 column - if ( span > 1 ) + if (span > 1) { - attrs.setAttribute(namespace,NUMBERCOLUMNSSPANNED, "" + span); + attrs.setAttribute(namespace, NUMBERCOLUMNSSPANNED, "" + span); currentSpan = span; } // we must also generate "covered-table-cell" elements for each column spanned @@ -506,22 +495,22 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private void collectBoundaryForElement(final AttributeMap attrs) { - if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.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, OfficeToken.TABLE_COLUMN, attrs) ) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_COLUMN, attrs)) { final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); - if ( styleName == null ) + if (styleName == null) { // This should not happen, but if it does, we will ignore that cell. return; } final OfficeStyle style = getPredefinedStylesCollection().getStyle(OfficeToken.TABLE_COLUMN, styleName); - if ( style == null ) + if (style == null) { // Now this is very bad. It means that there is no style defined with the given name. return; @@ -535,7 +524,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget ColumnBoundary currentRowBoundary = new ColumnBoundary(getCurrentRowBoundaryMarker()); final List columnBoundaryList_ = getColumnBoundaryList(); final int idx = columnBoundaryList_.indexOf(currentRowBoundary); - if ( idx == -1 ) + if (idx == -1) { columnBoundaryList_.add(currentRowBoundary); } @@ -549,9 +538,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private String getUnitsOfMeasure(final String str) { - if ( unitsOfMeasure == null || "".equals(unitsOfMeasure) ) + if (unitsOfMeasure == null || "".equals(unitsOfMeasure)) { - if ( str == null || "".equals(str) ) + if (str == null || "".equals(str)) { unitsOfMeasure = "cm"; return unitsOfMeasure; @@ -559,10 +548,10 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // build units of measure, set it int i = str.length() - 1; - for ( ; i >= 0; i-- ) + for (; i >= 0; i--) { final char c = str.charAt(i); - if ( Character.isDigit(c) || c == '.' || c == ',' ) + if (Character.isDigit(c) || c == '.' || c == ',') { break; } @@ -574,7 +563,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private void createTableShapes() throws ReportProcessingException { - if ( !shapes.isEmpty() ) + if (!shapes.isEmpty()) { try { @@ -587,7 +576,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.SHAPES, null, XmlWriterSupport.OPEN); - for ( int i = 0; i < shapes.size(); i++ ) + for (int i = 0; i < shapes.size(); i++) { final AttributeMap attrs = (AttributeMap) shapes.get(i); final AttributeList attrList = buildAttributeList(attrs); @@ -599,9 +588,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } xmlWriter.writeCloseTag(); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } } @@ -622,11 +611,11 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // blow away current column styles // start processing at i=1 because we added a boundary for "0" which is virtual final ColumnBoundary[] cba = getSortedColumnBoundaryArray(); - for ( int i = 1; i < cba.length; i++ ) + for (int i = 1; i < cba.length; i++) { final ColumnBoundary cb = cba[i]; float columnWidth = cb.getBoundary(); - if ( i > 1 ) + if (i > 1) { columnWidth -= cba[i - 1].getBoundary(); } @@ -644,54 +633,51 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } xmlWriter.writeCloseTag(); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } protected void endOther(final AttributeMap attrs) throws DataSourceException, ReportProcessingException { - if ( ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs) || oleHandled ) + if (ReportTargetUtil.isElementOfType(JFreeReportInfo.REPORT_NAMESPACE, OfficeToken.OBJECT_OLE, attrs) || oleHandled) { oleHandled = false; return; } - if ( ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_ROW, attrs) && isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) + 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() ) + if (isRepeatingSection() || isElementBoundaryCollectionPass()) { return; } final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); - if ( isFilteredNamespace(namespace) ) + if (isFilteredNamespace(namespace)) { return; } final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs); - if ( OfficeNamespaces.DRAWING_NS.equals(namespace) && OfficeToken.FRAME.equals(elementType) ) + 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) && (OfficeToken.TABLE.equals(elementType) || - OfficeToken.COVERED_TABLE_CELL.equals(elementType) || - OfficeToken.TABLE_COLUMN.equals(elementType) || - OfficeToken.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) ) + if (!paragraphHandled && OfficeNamespaces.TEXT_NS.equals(namespace) && OfficeToken.P.equals(elementType)) { - if ( !paragraphHandled ) + if (!paragraphHandled) { return; } @@ -706,15 +692,15 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // 'covered-table-cell' elements we need to generate generateCoveredTableCells(attrs); } - catch ( IOException e ) + catch (IOException e) { - throw new ReportProcessingException("Failed", e); + throw new ReportProcessingException(OfficeDocumentReportTarget.FAILED, e); } } private void generateCoveredTableCells(final AttributeMap attrs) throws IOException { - if ( !ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs) ) + if (!ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, OfficeToken.TABLE_CELL, attrs)) { return; } @@ -725,7 +711,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // final int span = TextUtilities.parseInt((String) attribute, 0); final int span = currentSpan; currentSpan = 0; - for ( int i = 1; i < span; i++ ) + for (int i = 1; i < span; i++) { xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, OfficeToken.COVERED_TABLE_CELL, null, XmlWriter.CLOSE); } @@ -739,7 +725,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget // ///////////////////////////////////////////////////////////////////////// public void processText(final String text) throws DataSourceException, ReportProcessingException { - if ( !(isRepeatingSection() || isElementBoundaryCollectionPass()) ) + if (!(isRepeatingSection() || isElementBoundaryCollectionPass())) { handleParagraph(); super.processText(text); @@ -748,7 +734,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget public void processContent(final DataFlags value) throws DataSourceException, ReportProcessingException { - if ( !(isRepeatingSection() || isElementBoundaryCollectionPass()) ) + if (!(isRepeatingSection() || isElementBoundaryCollectionPass())) { handleParagraph(); super.processContent(value); @@ -761,9 +747,9 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } protected void startContent(final AttributeMap attrs) throws IOException, DataSourceException, - ReportProcessingException + ReportProcessingException { - if ( !isElementBoundaryCollectionPass() ) + if (!isElementBoundaryCollectionPass()) { final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeTag(OfficeNamespaces.OFFICE_NS, getStartContent(), null, XmlWriterSupport.OPEN); @@ -788,7 +774,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget { final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); final OfficeStyles commonStyles = predefStyles.getAutomaticStyles(); - if ( !commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table") ) + if (!commonStyles.containsStyle(OfficeToken.TABLE, "Initial_Table")) { final String masterPageName = createMasterPage(); @@ -797,7 +783,7 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget 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, OfficeToken.BACKGROUND_COLOR,TRANSPARENT); + tableProperties.setAttribute(OfficeNamespaces.FO_NS, OfficeToken.BACKGROUND_COLOR, TRANSPARENT); commonStyles.addStyle(tableStyle); } return "Initial_Table"; @@ -808,13 +794,13 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget final OfficeStylesCollection predefStyles = getPredefinedStylesCollection(); final MasterPageFactory masterPageFactory = new MasterPageFactory(predefStyles.getMasterStyles()); final OfficeMasterPage masterPage; - if ( !masterPageFactory.containsMasterPage("Standard", null, null) ) + if (!masterPageFactory.containsMasterPage("Standard", null, null)) { masterPage = masterPageFactory.createMasterPage("Standard", null, null); final CSSNumericValue zeroLength = CSSNumericValue.createValue(CSSNumericType.CM, 0); final String pageLayoutTemplate = masterPage.getPageLayout(); - if ( pageLayoutTemplate == null ) + if (pageLayoutTemplate == null) { // there is no pagelayout. Create one .. final String derivedLayout = masterPageFactory.createPageStyle(getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); @@ -823,8 +809,8 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget else { final String derivedLayout = masterPageFactory.derivePageStyle(pageLayoutTemplate, - getPredefinedStylesCollection().getAutomaticStyles(), - getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); + getPredefinedStylesCollection().getAutomaticStyles(), + getGlobalStylesCollection().getAutomaticStyles(), zeroLength, zeroLength); masterPage.setPageLayout(derivedLayout); } @@ -840,10 +826,10 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget } protected void endContent(final AttributeMap attrs) throws IOException, DataSourceException, - ReportProcessingException + ReportProcessingException { // todo - if ( !isElementBoundaryCollectionPass() ) + if (!isElementBoundaryCollectionPass()) { final XmlWriter xmlWriter = getXmlWriter(); xmlWriter.writeCloseTag(); @@ -871,10 +857,10 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private ColumnBoundary[] getSortedColumnBoundaryArray() { - if ( sortedBoundaryArray == null ) + if (sortedBoundaryArray == null) { getColumnBoundaryList().add(new ColumnBoundary(0)); - sortedBoundaryArray = (ColumnBoundary[]) getColumnBoundaryList().toArray(EMPTY_COLBOUNDS); + sortedBoundaryArray = (ColumnBoundary[]) getColumnBoundaryList().toArray(new ColumnBoundary[getColumnBoundaryList().size()]); Arrays.sort(sortedBoundaryArray); } return sortedBoundaryArray; @@ -907,19 +893,19 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget private ColumnBoundary[] getBoundariesForTable(final int table) { - if ( boundariesForTableArray == null ) + if (boundariesForTableArray == null) { final List boundariesForTable = new ArrayList(); final List boundaryList = getColumnBoundaryList(); - for ( int i = 0; i < boundaryList.size(); i++ ) + for (int i = 0; i < boundaryList.size(); i++) { final ColumnBoundary b = (ColumnBoundary) boundaryList.get(i); - if ( b.isContainedByTable(table) ) + if (b.isContainedByTable(table)) { boundariesForTable.add(b); } } - boundariesForTableArray = (ColumnBoundary[]) boundariesForTable.toArray(EMPTY_COLBOUNDS); + boundariesForTableArray = (ColumnBoundary[]) boundariesForTable.toArray(new ColumnBoundary[boundariesForTable.size()]); Arrays.sort(boundariesForTableArray); } return boundariesForTableArray; @@ -935,12 +921,12 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget float cellBoundary = tableBoundaries[col - 1].getBoundary(); float cellWidth = tableBoundaries[col - 1].getBoundary(); - if ( col > 1 ) + if (col > 1) { cellWidth = cellWidth - tableBoundaries[col - 2].getBoundary(); } - if ( initialColumnSpan > 1 ) + if (initialColumnSpan > 1) { // ok we've got some additional spanning specified on the input final int index = (col - 1) + (initialColumnSpan - 1); @@ -950,21 +936,21 @@ public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget int beginBoundaryIndex = 0; int endBoundaryIndex = globalBoundaries.length - 1; - for ( int i = 0; i < globalBoundaries.length; i++ ) + for (int i = 0; i < globalBoundaries.length; i++) { // find beginning boundary - if ( globalBoundaries[i].getBoundary() <= cellBoundary - cellWidth ) + if (globalBoundaries[i].getBoundary() <= cellBoundary - cellWidth) { beginBoundaryIndex = i; } - if ( globalBoundaries[i].getBoundary() <= cellBoundary ) + if (globalBoundaries[i].getBoundary() <= cellBoundary) { endBoundaryIndex = i; } } final int span = endBoundaryIndex - beginBoundaryIndex; // span will be zero for the first column, so we adjust it to 1 - if ( span == 0 ) + if (span == 0) { return 1; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java index 0a5988a44b94..ca3047a16c16 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/MasterPageFactory.java @@ -178,13 +178,9 @@ public class MasterPageFactory { return false; } - if (templateName != null ? !templateName.equals( - key.templateName) : key.templateName != null) - { - return false; - } + return !(templateName != null ? !templateName.equals( + key.templateName) : key.templateName != null); - return true; } public int hashCode() @@ -196,7 +192,6 @@ public class MasterPageFactory return result; } } - // todo: Patch the page-layout ... private static final String DEFAULT_PAGE_NAME = "Default"; private final OfficeMasterStyles predefinedStyles; @@ -265,7 +260,7 @@ public class MasterPageFactory } catch (CloneNotSupportedException cne) { - throw new IllegalStateException("Implementation error: Unable to derive page",cne); + throw new IllegalStateException("Implementation error: Unable to derive page", cne); } } @@ -403,7 +398,7 @@ public class MasterPageFactory } catch (CloneNotSupportedException e) { - throw new IllegalStateException("Clone failed.",e); + throw new IllegalStateException("Clone failed.", e); } } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java index 88c2742c91d5..740582c9b347 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/PageContext.java @@ -75,7 +75,7 @@ public class PageContext // TODO: IS this code correct? Why not columnCount = pc.getColumnCount(); ? if (columnCount != null) { - return columnCount.intValue(); + return columnCount; } pc = pc.getParent(); } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java index 16374193aec8..3b23ffb4c3df 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportProcessor.java @@ -108,7 +108,7 @@ public class TextRawReportProcessor extends SinglePassReportProcessor if (context instanceof ReportContextImpl) { final ReportContextImpl impl = (ReportContextImpl) context; - impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(),job.getConfiguration())); + impl.setFormulaContext(new PentahoFormulaContext(impl.getFormulaContext(), job.getConfiguration())); } return context; } diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java index cdbb36abc337..947087a17c11 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java @@ -100,7 +100,6 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget private static final int CP_SETUP = 0; 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; @@ -166,11 +165,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget private boolean isResetPageNumber() { - if (pageBreakDefinition == null) - { - return false; - } - return pageBreakDefinition.isResetPageNumber(); + return pageBreakDefinition != null && pageBreakDefinition.isResetPageNumber(); } /** @@ -198,14 +193,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } final boolean keepWithNext; - if (keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL) - { - keepWithNext = (detailBandProcessingState == DETAIL_SECTION_WAIT); - } - else - { - keepWithNext = false; - } + keepWithNext = keepTogetherState == PageContext.KEEP_TOGETHER_FIRST_DETAIL && (detailBandProcessingState == DETAIL_SECTION_WAIT); return keepWithNext; } @@ -213,15 +201,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget { final Object forceNewPage = attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, "force-new-page"); - if ("after-section".equals(forceNewPage)) - { - return true; - } - if ("before-after-section".equals(forceNewPage)) - { - return true; - } - return false; + return "after-section".equals(forceNewPage) || "before-after-section".equals(forceNewPage); } private boolean isSectionPagebreakBefore(final AttributeMap attrs) @@ -268,8 +248,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } final String masterPageName; - if (currentMasterPage == null || - !masterPageFactory.containsMasterPage(STANDARD, activePageHeader, activePageFooter)) + if (currentMasterPage == null || !masterPageFactory.containsMasterPage(STANDARD, activePageHeader, activePageFooter)) { final CSSNumericValue headerSize = context.getAllHeaderSize(); @@ -325,8 +304,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget // report header, then this implies that we have to insert a manual // pagebreak at the end of the section. - if ((!printHeader && context.getHeader() != null) || - (!printFooter && context.getFooter() != null)) + if ((!printHeader && context.getHeader() != null) || (!printFooter && context.getFooter() != null)) { setPagebreakDefinition(new PageBreakDefinition(isResetPageNumber())); } @@ -577,15 +555,13 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } else if (isFilteredNamespace(namespace)) { - throw new IllegalStateException("This element should be hidden: " + - namespace + ", " + elementType); + throw new IllegalStateException("This element should be hidden: " + namespace + ", " + elementType); } if (isTableMergeActive() && detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && ObjectUtilities.equal(OfficeNamespaces.TABLE_NS, namespace) && ObjectUtilities.equal(OfficeToken.TABLE_COLUMNS, elementType)) { // Skip the columns section if the tables get merged.. startBuffering(getStylesCollection(), true); - return; } else { @@ -624,8 +600,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); final String newVarName = variablesDeclarations.produceVariable(varName, varType); 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, FormatValueUtility.VALUE_TYPE, null); + // this one must not be written, as the DTD does not declare it. + // attrs.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, null); } } @@ -724,7 +700,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "flow-with-text", "false"); graphicProperties.setAttribute(OfficeNamespaces.DRAWING_NS, "ole-draw-aspect", "1"); - // attrs.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, predefAutoStyle.getStyleName()); + // attrs.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, predefAutoStyle.getStyleName()); } } @@ -734,11 +710,10 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final AttributeList attrList = buildAttributeList(attrs); xmlWriter.writeTag(namespace, elementType, attrList, XmlWriterSupport.OPEN); - if ( tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH + if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && variables != null && !isRepeatingSection() - && ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs) - ) + && ReportTargetUtil.isElementOfType(OfficeNamespaces.TEXT_NS, OfficeToken.P, attrs)) { //LOGGER.debug("Variables-Section in existing cell " + variables); xmlWriter.writeText(variables); @@ -785,7 +760,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } else { - expectedTableRowCount = trc.intValue(); + expectedTableRowCount = trc; } if (isSectionPagebreakBefore(attrs)) @@ -822,16 +797,15 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget // If we have a manual pagebreak, then activate the current master-page again. masterPageName = currentMasterPage.getStyleName(); } - // But we skip this (and therefore the resulting pagebreak) if there is no manual break - // and no other condition that would force an break. + // But we skip this (and therefore the resulting pagebreak) if there is no manual break + // and no other condition that would force an break. } else if (currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER || currentRole == OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) { breakDefinition = null; - // no pagebreaks .. + // no pagebreaks .. } - else if (currentMasterPage == null || - isPagebreakPending()) + else if (currentMasterPage == null || isPagebreakPending()) { // Must be the first table, as we have no master-page yet. masterPageName = createMasterPage(true, true); @@ -848,9 +822,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget breakDefinition = null; } } - else if (isPagebreakPending() && - currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER && - currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) + else if (isPagebreakPending() && currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER && currentRole != OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER) { // Derive an automatic style for the pagebreak. // LOGGER.debug("Manual pagebreak (within the section): " + getCurrentRole()); @@ -869,8 +841,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } final XmlWriter xmlWriter = getXmlWriter(); - if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && - masterPageName != null) + if (detailBandProcessingState == DETAIL_SECTION_OTHER_PRINTED && masterPageName != null) { // close the last table-tag, we will open a new one xmlWriter.writeCloseTag(); @@ -903,7 +874,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, style.getStyleName(), XmlWriterSupport.OPEN); masterPageName = null; - //breakDefinition = null; + //breakDefinition = null; } else if (isColumnBreakPending()) { @@ -935,19 +906,10 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget final boolean keepWithNext = isKeepTableWithNext(); final boolean localKeepTogether = OfficeToken.TRUE.equals(attrs.getAttribute(OfficeNamespaces.OOREPORT_NS, KEEP_TOGETHER)); final boolean tableMergeActive = isTableMergeActive(); - if (tableMergeActive) - { - this.sectionKeepTogether = localKeepTogether; - } - else - { - this.sectionKeepTogether = false; - - } + this.sectionKeepTogether = tableMergeActive && localKeepTogether; // Check, whether we have a reason to derive a style... - if (masterPageName != null || - (!tableMergeActive && (localKeepTogether || keepWithNext)) || isColumnBreakPending()) + if (masterPageName != null || (!tableMergeActive && (localKeepTogether || keepWithNext)) || isColumnBreakPending()) { final String styleName = (String) attrs.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); final OfficeStyle style = deriveStyle("table", styleName); @@ -1009,8 +971,8 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget } } attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); - // no need to copy the styles, this was done while deriving the - // style .. + // no need to copy the styles, this was done while deriving the + // style .. } else { @@ -1074,8 +1036,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget private boolean isTableMergeActive() { - return getCurrentRole() == ROLE_DETAIL && - tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; + return getCurrentRole() == ROLE_DETAIL && tableLayoutConfig == TABLE_LAYOUT_SINGLE_DETAIL_TABLE; } private void openSection() @@ -1086,9 +1047,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget // repeating sections have other ways of defining columns .. return; } - if (getCurrentRole() == ROLE_TEMPLATE || - getCurrentRole() == ROLE_SPREADSHEET_PAGE_HEADER || - getCurrentRole() == ROLE_SPREADSHEET_PAGE_FOOTER) + if (getCurrentRole() == ROLE_TEMPLATE || getCurrentRole() == ROLE_SPREADSHEET_PAGE_HEADER || getCurrentRole() == ROLE_SPREADSHEET_PAGE_FOOTER) { // the template section would break the multi-column stuff and we dont open up sections there // anyway .. @@ -1100,7 +1059,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget if (columnCount != null && !pageContext.isSectionOpen()) { final AttributeList attrs = new AttributeList(); - attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, generateSectionStyle(columnCount.intValue())); + attrs.setAttribute(OfficeNamespaces.TEXT_NS, OfficeToken.STYLE_NAME, generateSectionStyle(columnCount)); attrs.setAttribute(OfficeNamespaces.TEXT_NS, NAME, sectionNames.generateName("Section")); getXmlWriter().writeTag(OfficeNamespaces.TEXT_NS, "section", attrs, XmlWriterSupport.OPEN); @@ -1113,9 +1072,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget throws IOException, DataSourceException, ReportProcessingException { sectionHeight = new LengthCalculator(); - if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) + if (role == OfficeDocumentReportTarget.ROLE_TEMPLATE || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) { // Start buffering with an dummy styles-collection, so that the global styles dont get polluted .. startBuffering(new OfficeStylesCollection(), true); @@ -1241,9 +1198,7 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget protected void endReportSection(final AttributeMap attrs, final int role) throws IOException, DataSourceException, ReportProcessingException { - if (role == ROLE_TEMPLATE || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || - role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) + if (role == ROLE_TEMPLATE || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_HEADER || role == OfficeDocumentReportTarget.ROLE_SPREADSHEET_PAGE_FOOTER) { finishBuffering(); return; @@ -1369,16 +1324,13 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget return; } - if (isInternalNS && (ObjectUtilities.equal(OfficeToken.IMAGE, elementType) || - ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType))) + if (isInternalNS && (ObjectUtilities.equal(OfficeToken.IMAGE, elementType) || ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType))) { return; } final XmlWriter xmlWriter = getXmlWriter(); - if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && - isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) && - !isRepeatingSection() ) + if (tableLayoutConfig != TABLE_LAYOUT_VARIABLES_PARAGRAPH && isTableNs && ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) && !isRepeatingSection()) { if (variables != null) { @@ -1403,19 +1355,19 @@ public class TextRawReportTarget extends OfficeDocumentReportTarget xmlWriter.writeCloseTag(); variables = null; } - /** - // Only generate the empty paragraph, if we have to add the keep-together .. - else if (cellEmpty && expectedTableRowCount > 0 && - sectionKeepTogether && !firstCellSeen) - { - // we have no variables .. - StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, - TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), - getGlobalStylesCollection(), getPredefinedStylesCollection()); - xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, - TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE); - } - */ + /** + // Only generate the empty paragraph, if we have to add the keep-together .. + else if (cellEmpty && expectedTableRowCount > 0 && + sectionKeepTogether && !firstCellSeen) + { + // we have no variables .. + StyleUtilities.copyStyle(OfficeToken.PARAGRAPH, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, getStylesCollection(), + getGlobalStylesCollection(), getPredefinedStylesCollection()); + xmlWriter.writeTag(OfficeNamespaces.TEXT_NS, OfficeToken.P, OfficeToken.STYLE_NAME, + TextRawReportTarget.VARIABLES_HIDDEN_STYLE_WITH_KEEPWNEXT, XmlWriterSupport.CLOSE); + } + */ } if (isTableNs && (ObjectUtilities.equal(OfficeToken.TABLE_CELL, elementType) || ObjectUtilities.equal(OfficeToken.COVERED_TABLE_CELL, elementType))) |