summaryrefslogtreecommitdiff
path: root/reportbuilder/java/com/sun/star
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commit3a80394617f6a19d917c4a8f4e519c3979b669c6 (patch)
treea0a848d72ef5a431a79ec83ce71af627f5241972 /reportbuilder/java/com/sun/star
parent572c44a17ff476581d25bc49e42fe3d5bc3199f7 (diff)
parent4feb6e731fad8c4f3f29f7b3b7d74b9a2530000c (diff)
merge commit to DEV300_m57
Diffstat (limited to 'reportbuilder/java/com/sun/star')
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/configuration.properties1
-rwxr-xr-xreportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java47
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java2
5 files changed, 42 insertions, 16 deletions
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java
index a5fe1ab5c61f..321acb017728 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/SOFormulaParser.java
@@ -155,7 +155,7 @@ public final class SOFormulaParser extends ComponentBase
;
// com.sun.star.sheet.XFormulaParser:
- public com.sun.star.sheet.FormulaToken[] parseFormula(String aFormula)
+ public com.sun.star.sheet.FormulaToken[] parseFormula(String aFormula, com.sun.star.table.CellAddress aReferencePos)
{
final ArrayList tokens = new ArrayList();
if ( !"=".equals(aFormula) )
@@ -239,7 +239,7 @@ public final class SOFormulaParser extends ComponentBase
return (FormulaToken[]) tokens.toArray(new FormulaToken[tokens.size()]);
}
- public String printFormula(com.sun.star.sheet.FormulaToken[] aTokens)
+ public String printFormula(com.sun.star.sheet.FormulaToken[] aTokens, com.sun.star.table.CellAddress aReferencePos)
{
final StringBuffer ret = new StringBuffer();
for (int i = 0; i < aTokens.length; i++)
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties
index 8af708eb60c5..186b8568cb6a 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties
+++ b/reportbuilder/java/com/sun/star/report/pentaho/configuration.properties
@@ -140,6 +140,7 @@ com.sun.star.report.pentaho.output.namespace.oasis-data=urn:oasis:names:tc:opend
com.sun.star.report.pentaho.output.default.oasis-data=allow
com.sun.star.report.pentaho.output.tag.oasis-data.text=deny
com.sun.star.report.pentaho.output.tag.oasis-data.currency-symbol=deny
+com.sun.star.report.pentaho.output.tag.oasis-data.embedded-text=deny
com.sun.star.report.pentaho.output.namespace.oasis-draw=urn:oasis:names:tc:opendocument:xmlns:drawing:1.0
com.sun.star.report.pentaho.output.default.oasis-draw=deny
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
index e6f27564b519..8515b4997d53 100755
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
@@ -32,6 +32,7 @@ package com.sun.star.report.pentaho.layoutprocessor;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.sql.Time;
import com.sun.star.report.pentaho.OfficeNamespaces;
import com.sun.star.report.OfficeToken;
@@ -58,6 +59,7 @@ public class FormatValueUtility
public static final String VALUE_TYPE = "value-type";
private static SimpleDateFormat dateFormat;
+ private static SimpleDateFormat timeFormat;
private FormatValueUtility()
{
@@ -66,12 +68,24 @@ public class FormatValueUtility
public static String applyValueForVariable(final Object value, final AttributeMap variableSection)
{
String ret = null;
- if (value instanceof Date)
+ if (value instanceof Time)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "time");
+ ret = formatTime((Time) value);
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", ret);
+ }
+ else if (value instanceof java.sql.Date )
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date");
ret = formatDate((Date) value);
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", ret);
}
+ else if (value instanceof Date)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
+ ret = HSSFDateUtil.getExcelDate((Date)value,false,2).toString();
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", ret);
+ }
else if (value instanceof Number)
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
@@ -104,19 +118,20 @@ public class FormatValueUtility
public static void applyValueForCell(final Object value, final AttributeMap variableSection,final String valueType)
{
- if (value instanceof Date )
+ if (value instanceof Time)
{
- if ( "date".equals(valueType) )
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
- }
- else
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(HSSFDateUtil.getExcelDate((Date)value)));
- }
-
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", formatTime((Time) value));
}
- else if (value instanceof Number )
+ else if (value instanceof java.sql.Date )
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
+ }
+ else if (value instanceof Date)
+ {
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", HSSFDateUtil.getExcelDate((Date)value,false,2).toString());
+ }
+ else if (value instanceof Number)
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "value", String.valueOf(value));
}
@@ -166,6 +181,14 @@ public class FormatValueUtility
}
return dateFormat.format(date);
}
+ private static synchronized String formatTime(final Date date)
+ {
+ if (timeFormat == null)
+ {
+ timeFormat = new SimpleDateFormat("'PT'HH'H'mm'M'ss'S'");
+ }
+ return timeFormat.format(date);
+ }
public static DataFlags computeDataFlag(final FormattedTextElement element,
final FlowController flowController)
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java
index 6a6b6f19d1f0..55f4f2999aab 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/VariablesDeclarationLayoutController.java
@@ -44,6 +44,7 @@ import org.jfree.report.flow.ReportTarget;
import org.jfree.report.flow.layoutprocessor.AbstractLayoutController;
import org.jfree.report.flow.layoutprocessor.LayoutController;
import org.jfree.report.flow.layoutprocessor.LayoutControllerUtil;
+import org.pentaho.reporting.libraries.formula.util.HSSFDateUtil;
import org.jfree.report.structure.Element;
import java.util.Date;
import java.text.SimpleDateFormat;
@@ -150,13 +151,14 @@ public class VariablesDeclarationLayoutController
String formula = FormatValueUtility.applyValueForVariable(value, variableSection);
if ( formula == null )
formula = "" + value;
- if (value instanceof Date)
+ if (value instanceof java.sql.Date)
{
final Date date = (Date)value;
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy;MM;dd");
formula = "Date(" + dateFormat.format(date) + ")";
}
variableSection.setAttribute(OfficeNamespaces.TEXT_NS, "formula", "ooow:" + formula);
+
return variableSection;
}
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java b/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java
index eaf6d4a2d7b8..b4787ca63cb9 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/parser/data/DataStyleReadHandler.java
@@ -70,7 +70,7 @@ public class DataStyleReadHandler extends ElementReadHandler
{
if (OfficeNamespaces.DATASTYLE_NS.equals(uri) || OfficeNamespaces.STYLE_NS.equals(uri))
{
- final DataStyleReadHandler xrh = new DataStyleReadHandler("text".equals(tagName) || "currency-symbol".equals(tagName));
+ final DataStyleReadHandler xrh = new DataStyleReadHandler("text".equals(tagName) || "currency-symbol".equals(tagName) || "embedded-text".equals(tagName));
children.add(xrh);
return xrh;
}