diff options
Diffstat (limited to 'wizards/com/sun/star/wizards/ui/WizardDialog.java')
-rw-r--r-- | wizards/com/sun/star/wizards/ui/WizardDialog.java | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java index f17c44b82aa5..c03ceb2dc257 100644 --- a/wizards/com/sun/star/wizards/ui/WizardDialog.java +++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java @@ -32,7 +32,6 @@ import com.sun.star.wizards.ui.event.CommonListener; import com.sun.star.wizards.ui.event.EventNames; import com.sun.star.wizards.ui.event.MethodInvocation; import com.sun.star.uno.UnoRuntime; -// import com.sun.star.awt.XItemEventBroadcaster; import com.sun.star.awt.*; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.XInterface; @@ -47,6 +46,8 @@ import com.sun.star.frame.XTerminateListener; import com.sun.star.frame.TerminationVetoException; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.beans.*; +import com.sun.star.wizards.common.HelpIds; +import com.sun.star.wizards.common.PropertyNames; public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeListener, XTerminateListener, XCompletion { @@ -163,7 +164,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL try { nNewStep = itemEvent.ItemId; - nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step")); + nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP)); if (nNewStep != nOldStep) { switchToStep(); @@ -227,7 +228,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL { try { - int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Height")).intValue(); + int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue(); // the roadmap control has got no real TabIndex ever // that is not correct, but changing this would need time, so it is used @@ -235,13 +236,13 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL oRoadmap = insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi", new String[] { - "Height", - "PositionX", - "PositionY", - "Step", - "TabIndex", + PropertyNames.PROPERTY_HEIGHT, + PropertyNames.PROPERTY_POSITION_X, + PropertyNames.PROPERTY_POSITION_Y, + PropertyNames.PROPERTY_STEP, + PropertyNames.PROPERTY_TABINDEX, "Tabstop", - "Width" + PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -254,7 +255,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL new Integer(85) }); XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap); - xPSet.setPropertyValue("Name", "rdmNavi"); + xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, "rdmNavi"); xSSFRoadmap = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap); xIndexContRoadmap = (XIndexContainer) UnoRuntime.queryInterface(XIndexContainer.class, oRoadmap); @@ -308,8 +309,8 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL try { Object oRoadmapItem = xSSFRoadmap.createInstance(); - Helper.setUnoPropertyValue(oRoadmapItem, "Label", _sLabel); - Helper.setUnoPropertyValue(oRoadmapItem, "Enabled", new Boolean(_bEnabled)); + Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_LABEL, _sLabel); + Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnabled)); Helper.setUnoPropertyValue(oRoadmapItem, "ID", new Integer(_CurItemID)); xIndexContRoadmap.insertByIndex(Index, oRoadmapItem); int NextIndex = Index + 1; @@ -386,7 +387,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL protected void changeToStep(int nNewStep) { - Helper.setUnoPropertyValue(xDialogModel, "Step", new Integer(nNewStep)); + Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(nNewStep)); setCurrentRoadmapItemID((short) (nNewStep)); enableNextButton(getNextAvailableStep() > 0); enableBackButton(nNewStep != 1); @@ -454,8 +455,8 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL int iButtonHeight = 14; Integer IButtonHeight = new Integer(iButtonHeight); Integer ICurStep = new Integer(0); - int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Height")).intValue(); - int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Width")).intValue(); + int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue(); + int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_WIDTH)).intValue(); int iHelpPosX = 8; int iBtnPosY = iDialogHeight - iButtonHeight - 6; int iCancelPosX = iDialogWidth - iButtonWidth - 6; @@ -466,7 +467,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnNaviSep", new String[] { - "Height", "Orientation", "PositionX", "PositionY", "Step", "Width" + PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -476,7 +477,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep", new String[] { - "Height", "Orientation", "PositionX", "PositionY", "Step", "Width" + PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -485,13 +486,13 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL String[] propNames = new String[] { - "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width" + PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }; - Helper.setUnoPropertyValue(super.xDialogModel, "HelpURL", "HID:" + hid); + Helper.setUnoPropertyValue(super.xDialogModel, PropertyNames.PROPERTY_HELPURL, HelpIds.getHelpIdString(hid)); insertButton("btnWizardHelp", HELP_ACTION_PERFORMED, new String[] { - "Enabled", "Height", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width" + PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "PushButtonType", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { @@ -500,25 +501,25 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertButton("btnWizardBack", BACK_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(false), IButtonHeight, "HID:" + (hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), new Integer(iBackPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + new Boolean(false), IButtonHeight, HelpIds.getHelpIdString(hid + 2), oWizardResource.getResText(UIConsts.RID_COMMON + 13), new Integer(iBackPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardNext", NEXT_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(true), IButtonHeight, "HID:" + (hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), new Integer(iNextPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + new Boolean(true), IButtonHeight, HelpIds.getHelpIdString(hid + 3), oWizardResource.getResText(UIConsts.RID_COMMON + 14), new Integer(iNextPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardFinish", FINISH_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(true), IButtonHeight, "HID:" + (hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), new Integer(iFinishPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + new Boolean(true), IButtonHeight, HelpIds.getHelpIdString(hid + 4), oWizardResource.getResText(UIConsts.RID_COMMON + 12), new Integer(iFinishPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); insertButton("btnWizardCancel", CANCEL_ACTION_PERFORMED, propNames, new Object[] { - new Boolean(true), IButtonHeight, "HID:" + (hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), new Integer(iCancelPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth + new Boolean(true), IButtonHeight, HelpIds.getHelpIdString(hid + 5), oWizardResource.getResText(UIConsts.RID_COMMON + 11), new Integer(iCancelPosX), new Integer(iBtnPosY), new Short((short) PushButtonType.STANDARD_value), ICurStep, new Short(curtabindex++), IButtonWidth }); setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE); @@ -527,7 +528,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL // close the dialog. MethodInvocation windowHidden = new MethodInvocation("windowHidden", this); xWindow.addWindowListener((CommonListener) getGuiEventListener()); - String dialogName = (String) Helper.getUnoPropertyValue(xDialogModel, "Name"); + String dialogName = (String) Helper.getUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_NAME); getGuiEventListener().add(dialogName, EVENT_ACTION_PERFORMED, windowHidden); } @@ -569,17 +570,17 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL public void enableBackButton(boolean enabled) { - setControlProperty("btnWizardBack", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE); + setControlProperty("btnWizardBack", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE); } public void enableNextButton(boolean enabled) { - setControlProperty("btnWizardNext", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE); + setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE); } public void enableFinishButton(boolean enabled) { - setControlProperty("btnWizardFinish", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE); + setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, enabled ? Boolean.TRUE : Boolean.FALSE); } public void setStepEnabled(int _nStep, boolean bEnabled) @@ -587,7 +588,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL XInterface xRoadmapItem = getRoadmapItemByID(_nStep); if (xRoadmapItem != null) { - Helper.setUnoPropertyValue(xRoadmapItem, "Enabled", new Boolean(bEnabled)); + Helper.setUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled)); } } @@ -622,7 +623,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL { return false; } - bIsEnabled = AnyConverter.toBoolean(Helper.getUnoPropertyValue(xRoadmapItem, "Enabled")); + bIsEnabled = AnyConverter.toBoolean(Helper.getUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED)); return bIsEnabled; } catch (com.sun.star.uno.Exception exception) @@ -713,7 +714,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL { try { - return AnyConverter.toInt(Helper.getUnoPropertyValue(this.MSFDialogModel, "Step")); + return AnyConverter.toInt(Helper.getUnoPropertyValue(this.MSFDialogModel, PropertyNames.PROPERTY_STEP)); } catch (com.sun.star.uno.Exception exception) { @@ -746,7 +747,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL insertLabel("lblQueryTitle" + String.valueOf(i), new String[] { - "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width" + "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH }, new Object[] { |