summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-07-23 19:14:04 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-23 21:30:12 +0000
commitac2d93cca0791a728583a40dc379c89c22582855 (patch)
tree85ab2fa94d3cba699a3fc0fb7ef75cc144524ca0
parentf3f0fd9dc42cc5767ba5512581203df5406f45a8 (diff)
fdo#67186 switch reporbuilder to null date == 1899-12-30
This brings it in line with the default for other LibreOffice components (e.g. Calc), or with the only supported value (e.g. Writer tables), respectively. Configure Pentaho jfreereport to also take null date == 1899-12-30 This combined allows reportbuilder to make absolutely no fiddly conversion itself, leaving them to jfreereport and Writer table cell format. Also: - Make absolutely no conversion itself, also e.g. for booleans. - ODF compliance: make the value-type match the set foo-value attribute. - Use value-type="void" instead of empty value-type="string" Conflicts: reportdesign/source/core/sdr/RptObject.cxx Conflicts: reportdesign/source/core/sdr/RptObject.cxx reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx Change-Id: I67990232dbc9e86ac3fa37cd0c20edecb87cf8ee Reviewed-on: https://gerrit.libreoffice.org/5055 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java53
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java4
-rw-r--r--reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java2
-rw-r--r--reportbuilder/java/libformula.properties4
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx3
-rw-r--r--reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx2
6 files changed, 23 insertions, 45 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 8c9e986d4555..a462caeae91f 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/FormatValueUtility.java
@@ -85,7 +85,7 @@ public class FormatValueUtility
else if (value instanceof Date)
{
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
- ret = HSSFDateUtil.getExcelDate((Date) value, false, 2).toString();
+ ret = HSSFDateUtil.getExcelDate((Date) value).toString();
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, ret);
}
else if (value instanceof Number)
@@ -112,8 +112,7 @@ public class FormatValueUtility
}
else
{
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "string");
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, "");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "void");
}
return ret;
}
@@ -122,61 +121,39 @@ public class FormatValueUtility
{
if (value instanceof Time)
{
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "time");
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "time-value", formatTime((Time) value));
}
else if (value instanceof java.sql.Date)
{
- if ("float".equals(valueType) || valueType == null)
- {
- // This is to work around fdo#63478
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, HSSFDateUtil.getExcelDate((Date) value, false, 0).toString());
- }
- else
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
- }
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
}
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, 0).toString());
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "date");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate((Date) value));
}
else if (value instanceof BigDecimal)
{
- if ("date".equals(valueType))
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, "date-value", formatDate(HSSFDateUtil.getJavaDate((BigDecimal) value, false, 0)));
- }
- else
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value));
- }
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value));
}
else if (value instanceof Number)
{
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "float");
variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(value));
}
else if (value instanceof Boolean)
{
- if ("float".equals(valueType))
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "boolean");
+ if (Boolean.TRUE.equals(value))
{
- float fvalue = Boolean.TRUE.equals(value) ? 1 : 0;
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE, String.valueOf(fvalue));
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE);
}
else
{
- if (Boolean.TRUE.equals(value))
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.TRUE);
- }
- else
- {
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE);
- }
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, BOOLEAN_VALUE, OfficeToken.FALSE);
}
}
else if (value != null)
@@ -199,7 +176,7 @@ public class FormatValueUtility
}
else
{
- variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, STRING_VALUE, "");
+ variableSection.setAttribute(OfficeNamespaces.OFFICE_NS, VALUE_TYPE, "void");
}
}
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 9f0340aaf43a..066c5531aa29 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/layoutprocessor/TableCellLayoutController.java
@@ -78,7 +78,7 @@ public class TableCellLayoutController extends SectionLayoutController
else if (!"string".equals(valueType))
{
attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS,
- FormatValueUtility.VALUE_TYPE, "string");
+ FormatValueUtility.VALUE_TYPE, "void");
}
}
catch (Exception e)
@@ -101,7 +101,7 @@ public class TableCellLayoutController extends SectionLayoutController
if (!FormatValueUtility.shouldPrint(this, element))
{
attributeMap.setAttribute(OfficeNamespaces.OFFICE_NS,
- FormatValueUtility.VALUE_TYPE, "string");
+ FormatValueUtility.VALUE_TYPE, "void");
return null;
}
return FormatValueUtility.computeDataFlag(element, getFlowController());
diff --git a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java
index e9b91ada8df8..a36ca6f08396 100644
--- a/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java
+++ b/reportbuilder/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java
@@ -1715,7 +1715,7 @@ public abstract class OfficeDocumentReportTarget extends AbstractReportTarget
final XmlWriter xmlWriter = getXmlWriter();
xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, "calculation-settings", null, XmlWriterSupport.OPEN);
final AttributeMap nullDateAttributes = new AttributeMap();
- nullDateAttributes.setAttribute(OfficeNamespaces.TABLE_NS, "date-value", "1900-01-01");
+ nullDateAttributes.setAttribute(OfficeNamespaces.TABLE_NS, "date-value", "1899-12-30");
xmlWriter.writeTag(OfficeNamespaces.TABLE_NS, "null-date", buildAttributeList(nullDateAttributes), XmlWriterSupport.CLOSE);
xmlWriter.writeCloseTag();
}
diff --git a/reportbuilder/java/libformula.properties b/reportbuilder/java/libformula.properties
index 78d0e75f2cc1..3c026f49b740 100644
--- a/reportbuilder/java/libformula.properties
+++ b/reportbuilder/java/libformula.properties
@@ -19,8 +19,8 @@
##
# Any configuration will happen here.
-org.pentaho.reporting.libraries.formula.datesystem.StartYear=1930
-org.pentaho.reporting.libraries.formula.datesystem.ExcelHack=false
+org.pentaho.reporting.libraries.formula.ZeroDate=1899
+org.pentaho.reporting.libraries.formula.ExcelDateBugAware=false
#
# A list of all known functions.
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 278664ce6b8d..06f5855f7751 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -1238,7 +1238,8 @@ void OOle2Obj::initializeOle()
{
uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY );
if ( xChartProps.is() )
- xChartProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate")),uno::makeAny(util::DateTime(0,0,0,0,1,1,1900)));
+ xChartProps->setPropertyValue("NullDate",
+ uno::makeAny(util::DateTime(0,0,0,0,30,12,1899,false)));
}
}
}
diff --git a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
index 73349a4f64d9..64e4978e031e 100644
--- a/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
+++ b/reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
@@ -184,7 +184,7 @@ void SAL_CALL ExportDocumentHandler::startElement(const ::rtl::OUString & _sName
m_xDelegatee->startElement(sTableCalc,NULL);
pList = new SvXMLAttributeList();
uno::Reference< xml::sax::XAttributeList > xNullAttr = pList;
- pList->AddAttribute(lcl_createAttribute(XML_NP_TABLE,XML_DATE_VALUE),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1900-01-01")));
+ pList->AddAttribute(lcl_createAttribute(XML_NP_TABLE,XML_DATE_VALUE),OUString("1899-12-30"));
const ::rtl::OUString sNullDate = lcl_createAttribute(XML_NP_TABLE,XML_NULL_DATE);
m_xDelegatee->startElement(sNullDate,xNullAttr);