[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - reportbuilder/java

Lionel Elie Mamane lionel at mamane.lu
Mon Apr 15 00:21:55 PDT 2013


 reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java |   11 +++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 91021f11a30b1a2da4f878e9f245675ef6da17a1
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri Apr 12 18:54:45 2013 +0200

    fdo#36858
    
    1) No valueType (Format/Number/General) is like float valueType (Format/Number/any other)
    2) We use 1/1/1900 as startdate for number-from-date, stick to it more consistently
    
    Change-Id: Ib1008d1c30be602d8173457738c915087ed17391
    Reviewed-on: https://gerrit.libreoffice.org/3363
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

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 ad303af..8c9e986 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
@@ -126,9 +126,10 @@ public class FormatValueUtility
         }
         else if (value instanceof java.sql.Date)
         {
-            if ("float".equals(valueType))//@see http://qa.openoffice.org/issues/show_bug.cgi?id=108954
+            if ("float".equals(valueType) || valueType == null)
             {
-                variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString());
+                // This is to work around fdo#63478
+                variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 0).toString());
             }
             else
             {
@@ -137,8 +138,12 @@ public class FormatValueUtility
         }
         else if (value instanceof Date)
         {
+            // This is what we *should* do, but see fdo#63478
+            // variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date");
+            // variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
+            // so we do that instead to work around:
             variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
-            variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 2).toString());
+            variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 0).toString());
         }
         else if (value instanceof BigDecimal)
         {


More information about the Libreoffice-commits mailing list