summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-06-18 16:28:14 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-19 09:18:15 +0200
commit3de97fff254c369927216d341057dbad3b3fbde2 (patch)
tree0289510edf5a7fc8bc5da2f6d50b0cb621e48408
parentf9ef83a80fb05274e4c5268459d84af9b4558df1 (diff)
fdo#43967 legacy report designer wizard formats dates improperly
1) Set FormatsSupplier property only if underlying object has one. Else, exception is thrown and the format is not set 2) getTyperelatedFieldData uses the format keys, so initialize them before call, not after. Signed-off-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 7d0fbe9070ea01f3b650776edcb9ecfee7921bf4) Signed-off-by: Miklos Vajna <vmiklos@suse.cz> Signed-off-by: Stephan Bergmann <sbergman@redhat.com> Change-Id: I68c4c96a9da9a6afdc3ab8964e973588f53ee814
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.java5
-rw-r--r--wizards/com/sun/star/wizards/db/FieldColumn.java16
2 files changed, 12 insertions, 9 deletions
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java
index 9c0feb5644a3..bbf63852b3f6 100644
--- a/wizards/com/sun/star/wizards/common/NumberFormatter.java
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java
@@ -201,7 +201,10 @@ public class NumberFormatter
Locale oLocale = (Locale) Helper.getUnoPropertyValue(xNumberFormat, "Locale");
int NewFormatKey = defineNumberFormat(FormatString, oLocale);
XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject);
- xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier());
+ if (xPSet.getPropertySetInfo().hasPropertyByName("FormatsSupplier"))
+ {
+ xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier());
+ }
if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat"))
{
xPSet.setPropertyValue("NumberFormat", new Integer(NewFormatKey));
diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java
index ebedd22d281a..47b37df71d66 100644
--- a/wizards/com/sun/star/wizards/db/FieldColumn.java
+++ b/wizards/com/sun/star/wizards/db/FieldColumn.java
@@ -154,13 +154,8 @@ public class FieldColumn
{
try
{
- m_xColPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName));
- ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1;
- m_nFieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
- getTyperelatedFieldData();
-
- if (!bFormatKeysInitialized)
- {
+ if (!bFormatKeysInitialized)
+ {
final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter();
iDateFormatKey = aNumberFormatter.getDateFormatKey();
@@ -170,7 +165,12 @@ public class FieldColumn
iTimeFormatKey = aNumberFormatter.getTimeFormatKey();
iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey();
bFormatKeysInitialized = true;
- }
+ }
+
+ m_xColPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName));
+ ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1;
+ m_nFieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
+ getTyperelatedFieldData();
}
catch (Exception e)
{