Tag: cws_dev300_rptchart02 User: oj Date: 2008-04-03 11:59:23+0000 Modified: dba/reportdesign/java/com/sun/star/report/OfficeToken.java dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java dba/reportdesign/java/com/sun/star/report/pentaho/model/OfficeStyle.java dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java dba/reportdesign/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java
Log: export frames of ole object with special style File Changes: Directory: /dba/reportdesign/java/com/sun/star/report/ ====================================================== File [changed]: OfficeToken.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/OfficeToken.java?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +4 -3 ------------------- --- OfficeToken.java 2008-03-12 09:43:37+0000 1.1.2.1 +++ OfficeToken.java 2008-04-03 11:59:19+0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: OfficeToken.java,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: oj $ $Date: 2008/03/12 09:43:37 $ + * last change: $Author: oj $ $Date: 2008/04/03 11:59:19 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -46,6 +46,7 @@ public static final String PARAGRAPH = "paragraph"; public static final String TRUE = "true"; public static final String FALSE = "false"; + public static final String FRAME = "frame"; public static final String STYLE_NAME = "style-name"; public static final String BACKGROUND_COLOR = "background-color"; public static final String COVERED_TABLE_CELL = "covered-table-cell"; Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/ ============================================================================== File [changed]: FormatValueUtility.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java?r1=1.3.4.1&r2=1.3.4.2 Delta lines: +37 -1 -------------------- --- FormatValueUtility.java 2008-03-12 09:42:45+0000 1.3.4.1 +++ FormatValueUtility.java 2008-04-03 11:59:19+0000 1.3.4.2 @@ -1,3 +1,39 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * + * $Revision$ + * + * last change: $Author$ $Date$ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2007 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * Copyright 2007 by Pentaho Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + package com.sun.star.report.pentaho.layoutprocessor; import java.text.SimpleDateFormat; @@ -25,7 +61,7 @@ private static final String BOOLEAN_VALUE = "boolean-value"; private static final String STRING_VALUE = "string-value"; - private static final String VALUE_TYPE = "value-type"; + public static final String VALUE_TYPE = "value-type"; private static SimpleDateFormat dateFormat; private FormatValueUtility() File [changed]: FormattedTextLayoutController.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java?r1=1.5.4.1&r2=1.5.4.2 Delta lines: +5 -5 ------------------- --- FormattedTextLayoutController.java 2008-03-12 09:42:45+0000 1.5.4.1 +++ FormattedTextLayoutController.java 2008-04-03 11:59:19+0000 1.5.4.2 @@ -131,7 +131,7 @@ } final String valueType = computeValueType(); - variablesGet.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", valueType); + variablesGet.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, valueType); target.startElement(variablesGet); target.endElement(variablesGet); @@ -211,7 +211,7 @@ throw new IllegalStateException("A formatted text element must be a child of a Table-Cell."); } - final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type"); + final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); if (type == null) { Log.error("The Table-Cell does not have a office:value attribute defined. Your content will be messed up."); Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/model/ ==================================================================== File [changed]: OfficeStyle.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/model/OfficeStyle.java?r1=1.2&r2=1.2.100.1 Delta lines: +5 -4 ------------------- --- OfficeStyle.java 2007-07-09 11:56:07+0000 1.2 +++ OfficeStyle.java 2008-04-03 11:59:20+0000 1.2.100.1 @@ -37,6 +37,7 @@ package com.sun.star.report.pentaho.model; +import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.OfficeNamespaces; import org.jfree.report.structure.Element; import org.jfree.report.structure.Section; @@ -134,6 +135,6 @@ public Element getGraphicProperties () { - return findFirstChild(OfficeNamespaces.STYLE_NS, "graphic-properties"); + return findFirstChild(OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES); } } 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.5.4.1&r2=1.5.4.2 Delta lines: +7 -5 ------------------- --- OfficeDocumentReportTarget.java 2008-03-12 09:42:51+0000 1.5.4.1 +++ OfficeDocumentReportTarget.java 2008-04-03 11:59:20+0000 1.5.4.2 @@ -106,6 +106,7 @@ */ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget { + public static final String HORIZONTAL_POS = "horizontal-pos"; public static final String TAG_DEF_PREFIX = "com.sun.star.report.pentaho.output."; public static final int ROLE_NONE = 0; @@ -132,6 +133,7 @@ public static final int STATE_IN_OTHER = 6; public static final int STATE_IN_GROUP_INSTANCE = 7; public static final String FAILED = "Failed"; + public static final String VERTICAL_POS = "vertical-pos"; private static final String ZERO_CM = "0cm"; @@ -392,9 +394,9 @@ graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap", "dynamic"); graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "number-wrapped-paragraphs", "no-limit"); graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap-contour", OfficeToken.FALSE); - graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-pos", "top"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, VERTICAL_POS, "top"); graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-rel",OfficeToken.PARAGRAPH); - graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-pos", "center"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS,HORIZONTAL_POS, "center"); graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-rel",OfficeToken.PARAGRAPH); commonStyles.addStyle(graphicsDefaultStyle); } Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/ ================================================================================= File [changed]: SpreadsheetRawReportTarget.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java?r1=1.5.4.1&r2=1.5.4.2 Delta lines: +4 -4 ------------------- --- SpreadsheetRawReportTarget.java 2008-03-12 09:42:52+0000 1.5.4.1 +++ SpreadsheetRawReportTarget.java 2008-04-03 11:59:20+0000 1.5.4.2 @@ -183,7 +183,7 @@ { if (ReportTargetUtil.isElementOfType(OfficeNamespaces.INTERNAL_NS, OfficeToken.OBJECT_OLE, attrs)) { - if (!isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_DETAIL) + if (!isElementBoundaryCollectionPass() && getCurrentRole() != ROLE_TEMPLATE ) { startChartProcessing(attrs); } Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/text/ ========================================================================== File [changed]: TextRawReportTarget.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java?r1=1.5.4.1&r2=1.5.4.2 Delta lines: +18 -8 -------------------- --- TextRawReportTarget.java 2008-03-12 09:42:53+0000 1.5.4.1 +++ TextRawReportTarget.java 2008-04-03 11:59:20+0000 1.5.4.2 @@ -48,6 +48,7 @@ import com.sun.star.report.pentaho.OfficeNamespaces; import com.sun.star.report.OfficeToken; import com.sun.star.report.pentaho.PentahoReportEngineMetaData; +import com.sun.star.report.pentaho.layoutprocessor.FormatValueUtility; import com.sun.star.report.pentaho.model.OfficeMasterPage; import com.sun.star.report.pentaho.model.OfficeMasterStyles; import com.sun.star.report.pentaho.model.OfficeStyle; @@ -569,7 +570,7 @@ { startImageProcessing(attrs); } - else if (ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType) && getCurrentRole() != ROLE_DETAIL) + else if (ObjectUtilities.equal(OfficeToken.OBJECT_OLE, elementType) && getCurrentRole() != ROLE_TEMPLATE ) { startChartProcessing(attrs); } @@ -614,18 +615,18 @@ { // update the variables-declaration thingie .. final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, NAME); - final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type"); + 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); } else if (ObjectUtilities.equal("variable-get", elementType)) { final String varName = (String) attrs.getAttribute(OfficeNamespaces.TEXT_NS, NAME); - final String varType = (String) attrs.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type"); + 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, "value-type", null); + // attrs.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, null); } } @@ -716,6 +717,15 @@ attrs.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, style.getStyleName()); } } + if ( ObjectUtilities.equal(OfficeNamespaces.DRAWING_NS, namespace) && ObjectUtilities.equal(OfficeToken.FRAME, elementType) ) + { + final String styleName = (String) attrs.getAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME); + final OfficeStyle style = deriveStyle(OfficeToken.GRAPHIC, styleName); + Element graphicProperties = style.getGraphicProperties(); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, VERTICAL_POS, "from-top"); + graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS,HORIZONTAL_POS, "from-left"); + attrs.setAttribute(OfficeNamespaces.DRAWING_NS, OfficeToken.STYLE_NAME, style.getStyleName()); + } // process the styles as usual performStyleProcessing(attrs); @@ -1426,7 +1436,7 @@ final Map.Entry entry = (Map.Entry) mappingsIt.next(); final AttributeList entryList = new AttributeList(); entryList.setAttribute(OfficeNamespaces.TEXT_NS, NAME, (String) entry.getKey()); - entryList.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", (String) entry.getValue()); + entryList.setAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE, (String) entry.getValue()); writer.writeTag(OfficeNamespaces.TEXT_NS, "variable-decl", entryList, XmlWriterSupport.CLOSE); } writer.writeCloseTag(); Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/parser/draw/ ========================================================================== File [changed]: ObjectOleReadHandler.java Url: http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/parser/draw/ObjectOleReadHandler.java?r1=1.2.4.1&r2=1.2.4.2 Delta lines: +8 -4 ------------------- --- ObjectOleReadHandler.java 2008-03-12 09:42:54+0000 1.2.4.1 +++ ObjectOleReadHandler.java 2008-04-03 11:59:21+0000 1.2.4.2 @@ -48,6 +48,8 @@ public class ObjectOleReadHandler extends ElementReadHandler { + private final static String RPT_CHART_CLASS_ID = "80243D39-6741-46C5-926E-069164FF87BB"; + private final static String OOO_CHART_CLASS_ID = "12DCAE26-281F-416F-A234-C3086127382E"; private final ObjectOleElement element; public ObjectOleReadHandler(final ObjectOleElement element) @@ -71,9 +73,11 @@ element.setUrl(url); } - final String classid = attrs.getValue(OfficeNamespaces.DRAWING_NS, "class-id"); + String classid = attrs.getValue(OfficeNamespaces.DRAWING_NS, "class-id"); if (classid != null) { + if ( classid.equalsIgnoreCase(RPT_CHART_CLASS_ID)) + classid = OOO_CHART_CLASS_ID; element.setClassId(classid); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
