Tag: cws_src680_oj14 User: oj Date: 2007-05-14 06:21:10+0000 Modified: dba/reportdesign/java/com/sun/star/report/pentaho/Manifest.mf dba/reportdesign/java/com/sun/star/report/pentaho/StarReportData.java dba/reportdesign/java/com/sun/star/report/pentaho/makefile.mk dba/reportdesign/java/com/sun/star/report/pentaho/model/OfficeStyles.java dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java dba/reportdesign/java/com/sun/star/report/pentaho/output/StyleUtilities.java dba/reportdesign/util/makefile.mk
Log: updates for the report engine File Changes: Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/ ============================================================== File [changed]: Manifest.mf Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/Manifest.mf?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +1 -1 ------------------- --- Manifest.mf 2007-05-10 12:14:23+0000 1.1.2.2 +++ Manifest.mf 2007-05-14 06:21:07+0000 1.1.2.3 @@ -1,6 +1,6 @@ RegistrationClassName: com.sun.star.report.pentaho.SOReportJobFactory Class-Path: jcommon-1.0.8.jar sac.jar - libxml-0.9.3.jar flute-1.3-jfree-20061107.jar jfreereport.jar + libxml-0.9.3.jar flute-1.3-jfree-20061107.jar jfreereport-0.9.0-05.jar liblayout-0.2.6.jar libloader-0.3.3.jar libfonts-0.2.4.jar jcommon-serializer-0.1.0.jar libformula-0.1.7.jar librepository-0.1.0.jar File [changed]: StarReportData.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/StarReportData.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +12 -7 -------------------- --- StarReportData.java 2007-05-09 12:12:37+0000 1.1.2.1 +++ StarReportData.java 2007-05-14 06:21:07+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: StarReportData.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/05/09 12:12:37 $ + * last change: $Author: oj $ $Date: 2007/05/14 06:21:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -59,16 +59,16 @@ this.rowCount = dataSource.getRowCount(); } - public void setCursorPosition(int row) throws DataSourceException + public boolean setCursorPosition(int row) throws DataSourceException { try { if (dataSource.absolute(row + 1)) { currentRow = row; - return; + return true; } - throw new DataSourceException("Failed to move cursor"); + return false; } catch (com.sun.star.report.DataSourceException e) { @@ -126,9 +126,14 @@ } } - public Object get (int column) + public Object get (final int column) throws DataSourceException { + if (isEmpty()) + { + return null; + } + try { return dataSource.getObject(column + 1); File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/makefile.mk?r1=1.1.2.2&r2=1.1.2.3 Delta lines: +4 -4 ------------------- --- makefile.mk 2007-05-10 12:14:23+0000 1.1.2.2 +++ makefile.mk 2007-05-14 06:21:07+0000 1.1.2.3 @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.2.2 $ +# $Revision: 1.1.2.3 $ # -# last change: $Author: oj $ $Date: 2007/05/10 12:14:23 $ +# last change: $Author: oj $ $Date: 2007/05/14 06:21:07 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -44,7 +44,7 @@ #----- compile .java files ----------------------------------------- -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar jcommon-1.0.8.jar libxml-0.9.3.jar jfreereport.jar libloader-0.3.3.jar sac.jar liblayout-0.2.6.jar jcommon-serializer-0.1.0.jar libfonts-0.2.4.jar libformula-0.1.7.jar +JARFILES = ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar jcommon-1.0.8.jar libxml-0.9.3.jar jfreereport-0.9.0-05.jar libloader-0.3.3.jar sac.jar liblayout-0.2.6.jar jcommon-serializer-0.1.0.jar libfonts-0.2.4.jar libformula-0.1.7.jar JAVAFILES := $(shell $(FIND) . -name "*.java") # JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:s/.java/.class/)) Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/model/ ==================================================================== File [changed]: OfficeStyles.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/model/OfficeStyles.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +8 -3 ------------------- --- OfficeStyles.java 2007-05-09 12:31:07+0000 1.1.2.1 +++ OfficeStyles.java 2007-05-14 06:21:07+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: OfficeStyles.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/05/09 12:31:07 $ + * last change: $Author: oj $ $Date: 2007/05/14 06:21:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -206,4 +206,9 @@ { return styles.containsKey(new StyleKey(family, name)); } + + public boolean containsDataStyle(final String styleName) + { + return dataStyles.containsKey(styleName); + } } Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/ ===================================================================== File [changed]: OfficeDocumentReportTarget.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +65 -67 --------------------- --- OfficeDocumentReportTarget.java 2007-05-09 12:30:05+0000 1.1.2.1 +++ OfficeDocumentReportTarget.java 2007-05-14 06:21:07+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: OfficeDocumentReportTarget.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/05/09 12:30:05 $ + * last change: $Author: oj $ $Date: 2007/05/14 06:21:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,36 +48,36 @@ import java.util.Iterator; import java.util.Map; -import com.sun.star.report.OutputRepository; import com.sun.star.report.InputRepository; +import com.sun.star.report.OutputRepository; import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.pentaho.layoutprocessor.ImageElementContext; import com.sun.star.report.pentaho.model.OfficeDocument; import com.sun.star.report.pentaho.model.OfficeStyle; -import com.sun.star.report.pentaho.model.OfficeStylesCollection; import com.sun.star.report.pentaho.model.OfficeStyles; -import com.sun.star.report.pentaho.styles.StyleMapper; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; import com.sun.star.report.pentaho.styles.LengthCalculator; +import com.sun.star.report.pentaho.styles.StyleMapper; import org.jfree.layouting.input.style.parser.CSSValueFactory; import org.jfree.layouting.input.style.parser.StyleSheetParserUtil; import org.jfree.layouting.input.style.values.CSSNumericValue; +import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.layouting.namespace.NamespaceDefinition; import org.jfree.layouting.namespace.Namespaces; import org.jfree.layouting.util.AttributeMap; -import org.jfree.layouting.layouter.style.CSSValueResolverUtility; import org.jfree.report.DataFlags; import org.jfree.report.DataSourceException; import org.jfree.report.JFreeReportBoot; import org.jfree.report.JFreeReportInfo; import org.jfree.report.ReportProcessingException; -import org.jfree.report.structure.Element; -import org.jfree.report.structure.Section; -import org.jfree.report.util.AttributeNameGenerator; -import org.jfree.report.util.IntegerCache; import org.jfree.report.flow.AbstractReportTarget; import org.jfree.report.flow.ReportJob; import org.jfree.report.flow.ReportStructureRoot; import org.jfree.report.flow.ReportTargetUtil; +import org.jfree.report.structure.Element; +import org.jfree.report.structure.Section; +import org.jfree.report.util.AttributeNameGenerator; +import org.jfree.report.util.IntegerCache; import org.jfree.resourceloader.ResourceException; import org.jfree.resourceloader.ResourceKey; import org.jfree.resourceloader.ResourceManager; @@ -172,7 +172,7 @@ return iterationCount; } - public void iterationFinished () + public void iterationFinished() { iterationCount += 1; } @@ -185,22 +185,19 @@ private XmlWriter rootXmlWriter; /** - * This styles-collection contains all styles that were predefined in the - * report definition file. The common styles and the master-styles will be - * written unmodified, the automatic styles will be ignored. + * This styles-collection contains all styles that were predefined in the report definition file. The common styles + * and the master-styles will be written unmodified, the automatic styles will be ignored. */ private OfficeStylesCollection predefinedStylesCollection; /** - * This styles-collection contains all master-styles that have been generated - * by the report definition process. It also contains all automatic styles - * that have been generated for the page-bands (and the pagebands as well). + * This styles-collection contains all master-styles that have been generated by the report definition process. It + * also contains all automatic styles that have been generated for the page-bands (and the pagebands as well). */ private OfficeStylesCollection globalStylesCollection; /** - * The content styles collection contains all automatic styles that have been - * generated for the normal-flow content. + * The content styles collection contains all automatic styles that have been generated for the normal-flow content. */ private OfficeStylesCollection contentStylesCollection; @@ -251,12 +248,11 @@ } /** - * Starts the output of a new office document. This method writes the generic - * 'office:document-content' tag along with all known namespace declarations. + * Starts the output of a new office document. This method writes the generic 'office:document-content' tag along with + * all known namespace declarations. * * @param report the report object. - * @throws DataSourceException if there was an error accessing the - * datasource + * @throws DataSourceException if there was an error accessing the datasource * @throws ReportProcessingException if some other error occured. */ public void startReport(final ReportStructureRoot report) @@ -329,7 +325,7 @@ return autoStyleNameGenerator; } - private void fillStyleNameGenerator (final OfficeStylesCollection stylesCollection) + private void fillStyleNameGenerator(final OfficeStylesCollection stylesCollection) { final OfficeStyles commonStyles = stylesCollection.getCommonStyles(); final OfficeStyle[] allCommonStyles = commonStyles.getAllStyles(); @@ -364,10 +360,9 @@ } /** - * Returns the XML-Writer tag description. This description defines whether an - * element can have character data inside. Such element will disable the - * indention, as in that case the additional whitespaces might alter the - * meaning of the element's contents. + * Returns the XML-Writer tag description. This description defines whether an element can have character data inside. + * Such element will disable the indention, as in that case the additional whitespaces might alter the meaning of the + * element's contents. * * @return the tag description library. */ @@ -395,9 +390,8 @@ } /** - * Starts the processing of an element and updates the processing state. This - * will select an apropriate handler method for the call and will call one of - * the start* methods. + * Starts the processing of an element and updates the processing state. This will select an apropriate handler method + * for the call and will call one of the start* methods. * * @param attrs the attribute map for the current element * @throws DataSourceException @@ -406,6 +400,8 @@ public final void startElement(final AttributeMap attrs) throws DataSourceException, ReportProcessingException { + // todo + Log.debug("Starting " + getCurrentState() + "/" + states.size() + " " + ReportTargetUtil.getNamespaceFromAttribute(attrs) + " -> " + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); try { switch (getCurrentState()) @@ -414,13 +410,13 @@ { if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OFFICE_NS, "body", attrs)) { - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_BODY)); + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_BODY)); startBody(attrs); } else { - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_OTHER)); - if (isFilteredNamespace(ReportTargetUtil.getNamespaceFromAttribute( attrs)) == false) + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_OTHER)); + if (isFilteredNamespace(ReportTargetUtil.getNamespaceFromAttribute(attrs)) == false) { startOther(attrs); } @@ -431,7 +427,7 @@ { if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OFFICE_NS, "report", attrs)) { - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_CONTENT)); + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_CONTENT)); startContent(attrs); } else @@ -446,15 +442,15 @@ case OfficeDocumentReportTarget.STATE_IN_GROUP_BODY: { // A group. - if (ReportTargetUtil.isElementOfType (OfficeNamespaces.INTERNAL_NS, "group-body", attrs) || - ReportTargetUtil.isElementOfType (OfficeNamespaces.INTERNAL_NS, "report-body", attrs)) + if (ReportTargetUtil.isElementOfType(OfficeNamespaces.INTERNAL_NS, "group-body", attrs) || + ReportTargetUtil.isElementOfType(OfficeNamespaces.INTERNAL_NS, "report-body", attrs)) { states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_GROUP_BODY)); startGroupBody(attrs); } - else if (ReportTargetUtil.isElementOfType (OfficeNamespaces.OOREPORT_NS, "group", attrs)) + else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group", attrs)) { - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_GROUP)); + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_GROUP)); groupContext = new GroupContext(groupContext); startGroup(attrs); } @@ -462,7 +458,7 @@ { // Either a page-header, page-footer, report-header, report-footer // or detail-band or variables-section - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_SECTION)); + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_SECTION)); currentRole = computeRoleForSection(attrs); startReportSection(attrs, currentRole); } @@ -470,13 +466,13 @@ } case OfficeDocumentReportTarget.STATE_IN_SECTION: { - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_OTHER)); + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_OTHER)); startOther(attrs); return; } case OfficeDocumentReportTarget.STATE_IN_OTHER: { - states.push(IntegerCache.getInteger (OfficeDocumentReportTarget.STATE_IN_OTHER)); + states.push(IntegerCache.getInteger(OfficeDocumentReportTarget.STATE_IN_OTHER)); startOther(attrs); return; } @@ -560,7 +556,7 @@ } if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-header", attrs)) { - if ("true".equals(attrs.getAttribute (OfficeNamespaces.INTERNAL_NS, "repeated-section"))) + if ("true".equals(attrs.getAttribute(OfficeNamespaces.INTERNAL_NS, "repeated-section"))) { return OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_HEADER; } @@ -568,7 +564,7 @@ } if (ReportTargetUtil.isElementOfType(OfficeNamespaces.OOREPORT_NS, "group-footer", attrs)) { - if ("true".equals(attrs.getAttribute (OfficeNamespaces.INTERNAL_NS, "repeated-section"))) + if ("true".equals(attrs.getAttribute(OfficeNamespaces.INTERNAL_NS, "repeated-section"))) { return OfficeDocumentReportTarget.ROLE_REPEATING_GROUP_FOOTER; } @@ -781,6 +777,9 @@ states.pop(); // Log.debug ("Finishing " + getNamespaceFromAttribute(attrs) + ":" + // getElemenTypeFromAttribute(attrs) + " -> " + i + " -> " + getCurrentState()); + // todo + Log.debug ("Finished " + getCurrentState() + "/" + states.size() + " " + ReportTargetUtil.getElemenTypeFromAttribute(attrs)); + } } @@ -959,7 +958,7 @@ return attrList; } - protected String sanitizeName (final String name) + protected String sanitizeName(final String name) { // A table name cannot contain spaces and should only contain // ascii-characters. @@ -985,9 +984,8 @@ } /** - * Returns the length in point. This method is f**king slow, it eats half of - * the processing time. I surely should replace it with something more - * efficient later. + * Returns the length in point. This method is f**king slow, it eats half of the processing time. I surely should + * replace it with something more efficient later. * * @param text * @return @@ -1014,7 +1012,7 @@ } - protected OfficeStyle deriveStyle (final String styleFamily, final String styleName) + protected OfficeStyle deriveStyle(final String styleFamily, final String styleName) throws ReportProcessingException { // autogenerate a style. The style has already been added to the current @@ -1067,16 +1065,16 @@ final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, "graphic-properties"); final StringBuffer buffer = new StringBuffer(); buffer.append("rect("); - buffer.append(clipWidth/2); + buffer.append(clipWidth / 2); buffer.append(imageAreaWidthVal.getType().getType()); buffer.append(" "); - buffer.append(clipHeight/2); + buffer.append(clipHeight / 2); buffer.append(imageAreaHeightVal.getType().getType()); buffer.append(" "); - buffer.append(clipWidth/2); + buffer.append(clipWidth / 2); buffer.append(imageAreaWidthVal.getType().getType()); buffer.append(" "); - buffer.append(clipHeight/2); + buffer.append(clipHeight / 2); buffer.append(imageAreaHeightVal.getType().getType()); buffer.append(")"); graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString()); @@ -1087,12 +1085,12 @@ final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, "graphic-properties"); final StringBuffer buffer = new StringBuffer(); buffer.append("rect("); - buffer.append(clipWidth/2); + buffer.append(clipWidth / 2); buffer.append(imageAreaWidthVal.getType().getType()); buffer.append(" 0"); buffer.append(imageAreaHeightVal.getType().getType()); buffer.append(" "); - buffer.append(clipWidth/2); + buffer.append(clipWidth / 2); buffer.append(imageAreaWidthVal.getType().getType()); buffer.append(" 0"); buffer.append(imageAreaHeightVal.getType().getType()); @@ -1109,12 +1107,12 @@ buffer.append("rect(0"); buffer.append(imageAreaWidthVal.getType().getType()); buffer.append(" "); - buffer.append(clipHeight/2); + buffer.append(clipHeight / 2); buffer.append(imageAreaHeightVal.getType().getType()); buffer.append(" 0"); buffer.append(imageAreaWidthVal.getType().getType()); buffer.append(" "); - buffer.append(clipHeight/2); + buffer.append(clipHeight / 2); buffer.append(imageAreaHeightVal.getType().getType()); buffer.append(")"); graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString()); @@ -1154,13 +1152,13 @@ if (imageAreaWidthVal != null) { frameList.setAttribute(OfficeNamespaces.SVG_NS, - "width", String.valueOf(imageAreaWidthVal.getValue()) + imageAreaWidthVal.getType().getType() ); + "width", String.valueOf(imageAreaWidthVal.getValue()) + imageAreaWidthVal.getType().getType()); } if (imageAreaHeightVal != null) { frameList.setAttribute(OfficeNamespaces.SVG_NS, - "height", String.valueOf(imageAreaHeightVal.getValue()) + imageAreaHeightVal.getType().getType() ); + "height", String.valueOf(imageAreaHeightVal.getValue()) + imageAreaHeightVal.getType().getType()); } @@ -1176,7 +1174,7 @@ getXmlWriter().writeTag(OfficeNamespaces.DRAWING_NS, "image", imageList, XmlWriterSupport.CLOSE); getXmlWriter().writeCloseTag(); } - catch(IOException ioe) + catch (IOException ioe) { throw new ReportProcessingException("Failed", ioe); } File [changed]: StyleUtilities.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/StyleUtilities.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +85 -30 --------------------- --- StyleUtilities.java 2007-05-09 12:30:18+0000 1.1.2.1 +++ StyleUtilities.java 2007-05-14 06:21:07+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: StyleUtilities.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2007/05/09 12:30:18 $ + * last change: $Author: oj $ $Date: 2007/05/14 06:21:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,19 +39,17 @@ import java.util.HashSet; -import com.sun.star.report.pentaho.model.OfficeStylesCollection; -import com.sun.star.report.pentaho.model.OfficeStyle; -import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.DataStyle; import com.sun.star.report.pentaho.model.FontFaceDeclsSection; import com.sun.star.report.pentaho.model.FontFaceElement; -import com.sun.star.report.pentaho.model.PageLayout; -import com.sun.star.report.pentaho.OfficeNamespaces; +import com.sun.star.report.pentaho.model.OfficeStyle; +import com.sun.star.report.pentaho.model.OfficeStyles; +import com.sun.star.report.pentaho.model.OfficeStylesCollection; import org.jfree.report.ReportProcessingException; -import org.jfree.report.util.AttributeNameGenerator; import org.jfree.report.structure.Element; -import org.jfree.report.structure.Section; +import org.jfree.report.util.AttributeNameGenerator; import org.jfree.util.Log; -import org.jfree.layouting.input.style.values.CSSNumericValue; /** * Todo: Document me! @@ -67,20 +65,17 @@ } /** - * Copies the specififed style (keyed by its family and name) into the current - * styles collection. This copies the style and all inherited styles into the - * target collection. Inherited common styles will be always be added to the + * Copies the specififed style (keyed by its family and name) into the current styles collection. This copies the + * style and all inherited styles into the target collection. Inherited common styles will be always be added to the * common collection (which will be written into the 'styles.xml' later). * <p/> - * This method does nothing if the specified style already exists in the - * styles collection. + * This method does nothing if the specified style already exists in the styles collection. * * @param styleFamily the family of the style to copy * @param styleName the unique name of the style. * @param stylesCollection the current styles collection * @param commonCollection the global styles collection - * @param predefCollection the predefined styles from where to copy the - * styles. + * @param predefCollection the predefined styles from where to copy the styles. * @throws ReportProcessingException if the style copying failed. */ public static void copyStyle(final String styleFamily, @@ -94,6 +89,22 @@ commonCollection, predefCollection, new HashSet()); } + /** + * Copies the specififed style (keyed by its family and name) into the current styles collection. This copies the + * style and all inherited styles into the target collection. Inherited common styles will be always be added to the + * common collection (which will be written into the 'styles.xml' later). + * <p/> + * This method does nothing if the specified style already exists in the styles collection. + * + * @param styleFamily the family of the style to copy + * @param styleName the unique name of the style. + * @param stylesCollection the current styles collection + * @param commonCollection the global styles collection + * @param predefCollection the predefined styles from where to copy the styles. + * @param inheritanceTracker a collection of all styles that have been touched. This is used to prevent infinite + * loops and duplicates. + * @throws ReportProcessingException if the style copying failed. + */ private static void copyStyle(final String styleFamily, final String styleName, final OfficeStylesCollection stylesCollection, @@ -167,6 +178,7 @@ final OfficeStyle preStyle = (OfficeStyle) predefCommonStyle.clone(); styles.addStyle(preStyle); performFontFaceProcessing(preStyle, stylesCollection, predefCollection); + performDataStyleProcessing(preStyle, stylesCollection, predefCollection); // Lookup the parent style .. final String styleParent = preStyle.getStyleParent(); @@ -180,8 +192,7 @@ } else if (styleParent != null) { - Log.warn( - "Inconsistent styles: " + styleFamily + ":" + styleParent + " does not exist."); + Log.warn("Inconsistent styles: " + styleFamily + ":" + styleParent + " does not exist."); } return preStyle; } @@ -262,29 +273,73 @@ } } + private static void performDataStyleProcessing + (final OfficeStyle style, + final OfficeStylesCollection stylesCollection, + final OfficeStylesCollection predefCollection) + throws ReportProcessingException + { + final Object attribute = style.getAttribute(OfficeNamespaces.STYLE_NS, "data-style-name"); + if (attribute == null) + { + // the easy case: It has no number style at all. + return; + } + + final String styleName = String.valueOf(attribute); + if (stylesCollection.getAutomaticStyles().containsDataStyle(styleName)) + { + return; + } + if (stylesCollection.getCommonStyles().containsDataStyle(styleName)) + { + return; + } + + + try + { + final OfficeStyles automaticStyles = predefCollection.getAutomaticStyles(); + final DataStyle autoDataStyle = automaticStyles.getDataStyle(styleName); + if (autoDataStyle != null) + { + final DataStyle derivedStyle = (DataStyle) autoDataStyle.clone(); + stylesCollection.getAutomaticStyles().addDataStyle(derivedStyle); + return; + } + final OfficeStyles commonStyles = predefCollection.getCommonStyles(); + final DataStyle commonDataStyle = commonStyles.getDataStyle(styleName); + if (commonDataStyle != null) + { + final DataStyle derivedStyle = (DataStyle) commonDataStyle.clone(); + stylesCollection.getCommonStyles().addDataStyle(derivedStyle); + return; + } + + Log.warn("Dangling data style: " + styleName); + } + catch (CloneNotSupportedException e) + { + throw new ReportProcessingException("Failed to copy style. This should not have happened."); + } + } /** - * Derives the named style. If the style is a common style, a new automatic - * style is generated and inserted into the given stylesCollection. If the - * named style is an automatic style, the style is copied and inserted as new - * automatic style. + * Derives the named style. If the style is a common style, a new automatic style is generated and inserted into the + * given stylesCollection. If the named style is an automatic style, the style is copied and inserted as new automatic + * style. * <p/> - * After the style has been created, the style's inheritance hierarchy will be - * copied as well. + * After the style has been created, the style's inheritance hierarchy will be copied as well. * <p/> - * If there is no style with the given name and family, a new empty automatic - * style will be created. + * If there is no style with the given name and family, a new empty automatic style will be created. * * @param styleFamily the family of the style to copy * @param styleName the unique name of the style. * @param stylesCollection the current styles collection * @param commonCollection the global styles collection - * @param predefCollection the predefined styles from where to copy the - * styles. - * @param generator the style-name-generator of the current - * report-target + * @param predefCollection the predefined styles from where to copy the styles. + * @param generator the style-name-generator of the current report-target * @return the derived style instance. - * * @throws ReportProcessingException if the style copying failed. */ public static OfficeStyle deriveStyle(final String styleFamily, Directory: /dba/reportdesign/util/ ================================== File [changed]: makefile.mk Url: http://dba.openoffice.org/source/browse/dba/reportdesign/util/makefile.mk?r1=1.1.2.3&r2=1.1.2.4 Delta lines: +3 -3 ------------------- --- makefile.mk 2007-05-11 06:14:07+0000 1.1.2.3 +++ makefile.mk 2007-05-14 06:21:07+0000 1.1.2.4 @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.2.3 $ +# $Revision: 1.1.2.4 $ # -# last change: $Author: oj $ $Date: 2007/05/11 06:14:07 $ +# last change: $Author: oj $ $Date: 2007/05/14 06:21:07 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -217,7 +217,7 @@ $(ZIP1DIR)$/sac.jar \ $(ZIP1DIR)$/libxml-0.9.3.jar \ $(ZIP1DIR)$/flute-1.3-jfree-20061107.jar \ - $(ZIP1DIR)$/jfreereport.jar \ + $(ZIP1DIR)$/jfreereport-0.9.0-05.jar \ $(ZIP1DIR)$/liblayout-0.2.6.jar \ $(ZIP1DIR)$/libloader-0.3.3.jar \ $(ZIP1DIR)$/libformula-0.1.7.jar \ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
