diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2014-12-19 15:34:32 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2014-12-19 23:33:26 +0100 |
commit | 68f65c4c08a8804b9a28b926c2a08cee486b60e9 (patch) | |
tree | 031895595ac672b4013a8759b4c54595375cb9a5 | |
parent | c47795a6f950f6cc1657819a3411c5828d649771 (diff) |
fdo#87301 don't rely on the shape to get the control
as it forgets its associated control
Change-Id: Ia5bd2212725376ab629f2c271102cea2cff9e823
-rw-r--r-- | wizards/com/sun/star/wizards/document/TimeStampControl.java | 21 | ||||
-rw-r--r-- | wizards/com/sun/star/wizards/form/StyleApplier.java | 4 |
2 files changed, 10 insertions, 15 deletions
diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java index 42b8b5351d89..e77c6b12adee 100644 --- a/wizards/com/sun/star/wizards/document/TimeStampControl.java +++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java @@ -62,22 +62,17 @@ public class TimeStampControl extends DatabaseControl nreltimewidth = 1.0 - nreldatewidth; } - public XPropertySet getControlofGroupShapeByIndex(int _i) + public XPropertySet getControlByIndex(int _i) { - try - { - if (_i < xShapes.getCount()) - { - Object oControl = xShapes.getByIndex(_i); - XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, oControl); - return UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl()); - } - } - catch (Exception e) + switch (_i) { - e.printStackTrace(System.err); + case 0: + return oDateControl.xPropertySet; + case 1: + return oTimeControl.xPropertySet; + default: + return null; } - return null; } public TimeStampControl(Resource _oResource, GridControl _oGridControl, FieldColumn _curfieldcolumn) diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java index 4a171e022fba..10037aa4990c 100644 --- a/wizards/com/sun/star/wizards/form/StyleApplier.java +++ b/wizards/com/sun/star/wizards/form/StyleApplier.java @@ -271,7 +271,7 @@ public class StyleApplier TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n]; for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); + XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER)) { xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue); @@ -405,7 +405,7 @@ public class StyleApplier TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl; for (int i = 0; i < 2; i++) { - XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i); + XPropertySet xPropertySet = oTimeStampControl.getControlByIndex(i); setDBControlColors(xPropertySet, _iStyleColors); } } |