diff options
author | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2011-01-17 12:32:14 +0100 |
---|---|---|
committer | Ocke.Janssen <Ocke.Janssen@oracle.com> | 2011-01-17 12:32:14 +0100 |
commit | 1b46f8da574d7c3dfe469f91821f63f9017300bb (patch) | |
tree | 6ed9e5c753fdf91f96dc071f0829d3a33dcf2941 | |
parent | 1d112bec03b394340d645193264e042d8819e059 (diff) |
dba34d: #i116463# fix string and NaN
2 files changed, 20 insertions, 12 deletions
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 707c2de1c8ab..76ee85b52aba 100755 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java @@ -143,7 +143,7 @@ public class FormatValueUtility { if ("date".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal)value, false, 0))); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal) value, false, 0))); } else { @@ -156,13 +156,21 @@ public class FormatValueUtility } else if (value instanceof Boolean) { - if (Boolean.TRUE.equals(value)) + if ("float".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); + float fvalue = Boolean.TRUE.equals(value) ? 1 : 0; + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(fvalue)); } else { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); + if (Boolean.TRUE.equals(value)) + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE); + } + else + { + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE); + } } } else if (value != null) @@ -178,12 +186,10 @@ public class FormatValueUtility } if (!"string".equals(valueType)) { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); - } - else - { - variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string"); + //variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value)); } + variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, String.valueOf(value)); } else { diff --git a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java index f3c5ef383057..e575831ebf2a 100644 --- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java +++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java @@ -69,12 +69,12 @@ public class TableCellLayoutController extends SectionLayoutController { final AttributeMap attributeMap = new AttributeMap(super.computeAttributes(fc, element, target)); final String definedStyle = (String) attributeMap.getAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME); - final String valueType = (String) attributeMap.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); attributeMap.setAttribute(OfficeNamespaces.TABLE_NS, OfficeToken.STYLE_NAME, getDisplayStyleName((Section) element, definedStyle)); try { - final DataFlags value = computeValue(); + final DataFlags value = computeValue(attributeMap); + final String valueType = (String) attributeMap.getAttribute(OfficeNamespaces.OFFICE_NS, FormatValueUtility.VALUE_TYPE); if (value != null) { FormatValueUtility.applyValueForCell(value.getValue(), attributeMap, valueType); @@ -100,7 +100,7 @@ public class TableCellLayoutController extends SectionLayoutController return attributeMap; } - private DataFlags computeValue() throws DataSourceException + private DataFlags computeValue(final AttributeMap attributeMap) throws DataSourceException { // Search for the first FormattedTextElement final Section cell = (Section) getElement(); @@ -115,6 +115,8 @@ public class TableCellLayoutController extends SectionLayoutController final Object o = LayoutControllerUtil.evaluateExpression(getFlowController(), element, dc); if (Boolean.FALSE.equals(o)) { + attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS, + FormatValueUtility.VALUE_TYPE, "string"); return null; } } |