public Object addRoadmap(XItemListener _xItemListener, String sName = "") { XPropertySet xDialogModelPropertySet = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "ROADMAP"); else sName = createUniqueName(MXDlgModelNameContainer, sName); xDialogModelPropertySet = (XPropertySet)MXContext; // Similar to the office assistants the roadmap is adjusted to the height of the dialog // where a certain space is left at the bottom for the buttons... int nDialogHeight = (int)(xDialogModelPropertySet.getPropertyValue("Height").Value); // instantiate the roadmapmodel... Object oRoadmapModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_ROADMAP_MODEL, MXContext); // define the properties of the roadmapmodel XMultiPropertySet xRMMPSet = (XMultiPropertySet)oRoadmapModel; xRMMPSet.setPropertyValues( new String[] { "Complete", "Height", "Name", "PositionX", "PositionY", "Text", "Width" }, Any.Get(new Object[] { false, (nDialogHeight - 26), sName, 0, 0, "Steps", 85 })); m_xRMPSet = (XPropertySet)oRoadmapModel; // add the roadmapmodel to the dialog container.. MXDlgModelNameContainer.insertByName(sName, Any.Get(oRoadmapModel)); // the roadmapmodel is a SingleServiceFactory to instantiate the roadmapitems... m_xSSFRoadmap = (XSingleServiceFactory)oRoadmapModel; m_xRMIndexCont = (XIndexContainer)oRoadmapModel; //util.Debug.GetAllProperties(oRoadmapModel); //util.Debug.GetAllServicesOfObject(oRoadmapModel); // add the itemlistener to the control... XControl xRMControl = GetControlByName(sName); XItemEventBroadcaster xRMBroadcaster = (XItemEventBroadcaster)xRMControl; xRMBroadcaster.addItemListener(_xItemListener); return oRoadmapModel; } catch (System.Exception) { //jexception.printStackTrace(System.out); } return null; }
/// <summary> /// Inserts the radio button. /// </summary> /// <param name="_nPosX">The _n pos X.</param> /// <param name="_nPosY">The _n pos Y.</param> /// <param name="_nWidth">Width of the _n.</param> /// <param name="label">The label. Mark the access key with the '~' char in front</param> /// <param name="sName">Name of the s.</param> public XRadioButton insertRadioButton(XItemListener _itemListener, int _nPosX, int _nPosY, int _nWidth, String label, String sName = "") { try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "RADIOBUTTON"); else sName = createUniqueName(MXDlgModelNameContainer, sName); // create a controlmodel at the multiservicefactory of the dialog model... Object oRBModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_RADIOBUTTON_MODEL, MXContext); XMultiPropertySet xRBMPSet = (XMultiPropertySet)oRBModel; // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xRBMPSet.setPropertyValues( new String[] { "Height", "Label", "Name", "PositionX", "PositionY", "State", "Width", "Enabled", "Tabstop", "TabIndex" }, Any.Get(new Object[] { 8, label, sName, _nPosX, _nPosY, ((short)0), _nWidth, true, true, ((short)(0)) })); // add the model to the NameContainer of the dialog model MXDlgModelNameContainer.insertByName(sName, Any.Get(oRBModel)); XControl xRBControl = GetControlByName(sName); if (xRBControl != null && xRBControl is XRadioButton && _itemListener != null) { ((XRadioButton)xRBControl).addItemListener(_itemListener); } return xRBControl as XRadioButton; } catch (System.Exception ex) { } return null; }
public void insertRatingGroup(XItemListener _itemListener, int _nPosX, int _nPosY, int _nWidth, int step, String label, String sName = "") { try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "RATING_GROUP"); else sName = createUniqueName(MXDlgModelNameContainer, sName); var gb = insertGroupBox(_nPosX, _nPosY, 30, _nWidth, label, sName); SetStepProperty(gb, step); var l1= InsertFixedLabel("schlecht", _nPosX + 2, _nPosY + 10, 50, sName+ "label1"); var l2= InsertFixedLabel("gut", _nPosX + 63, _nPosY + 10, 50, sName+"label2"); SetStepProperty(l1, step); SetStepProperty(l2, step); for (int i = 0; i < 5; i++) { var a = insertRadioButton(_itemListener, _nPosX + 5 + (i * 15), _nPosY + 20, 10, String.Empty, sName + "_RATING_" + i); SetStepProperty(a, step); } } catch (System.Exception ex) { } //return null; }
public XCheckBox insertCheckBox(XItemListener _xItemListener, int _nPosX, int _nPosY, int _nWidth, String sName = "") { XCheckBox xCheckBox = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "CHECKBOX"); else sName = createUniqueName(MXDlgModelNameContainer, sName); // create a controlmodel at the multiservicefactory of the dialog model... Object oCBModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_CHECKBOX_MODEL, MXContext); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! XMultiPropertySet xCBMPSet = (XMultiPropertySet)oCBModel; xCBMPSet.setPropertyValues( new String[] { "Height", "Label", "Name", "PositionX", "PositionY", "Width" }, Any.Get(new Object[] { 8, "~Include page number", sName, _nPosX, _nPosY, _nWidth })); // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration XPropertySet xCBModelPSet = (XPropertySet)xCBMPSet; xCBModelPSet.setPropertyValue("TriState", Any.Get(true)); xCBModelPSet.setPropertyValue("State", Any.Get((short)1)); // add the model to the NameContainer of the dialog model MXDlgModelNameContainer.insertByName(sName, Any.Get(oCBModel)); XControl xCBControl = GetControlByName(sName); xCheckBox = (XCheckBox)xCBControl; // An ActionListener will be notified on the activation of the button... xCheckBox.addItemListener(_xItemListener); } catch (unoidl.com.sun.star.uno.Exception ex) { System.Diagnostics.Debug.WriteLine("uno.Exception:"); System.Diagnostics.Debug.WriteLine(ex); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine("System.Exception:"); System.Diagnostics.Debug.WriteLine(ex); } return xCheckBox; }