public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "") { return InsertEditField(defaultText, _nPosX, _nPosY, _nWidth, 12, echoChar, _xTextListener, _xFocusListener, _xKeyListener, sName); }
public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, int _nHeight, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "") { XTextComponent xTextComponent = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "EDIT"); else sName = createUniqueName(MXDlgModelNameContainer, sName); // create a controlmodel at the multiservicefactory of the dialog model... Object oTFModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_EDIT_MODEL, MXContext); XMultiPropertySet xTFModelMPSet = (XMultiPropertySet)oTFModel; // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xTFModelMPSet.setPropertyValues( new String[] { "Height", "Name", "PositionX", "PositionY", "Text", "Width" }, Any.Get(new Object[] { _nHeight, sName, _nPosX, _nPosY, defaultText, _nWidth })); // The controlmodel is not really available until inserted to the Dialog container MXDlgModelNameContainer.insertByName(sName, Any.Get(oTFModel)); if (!echoChar.Equals(String.Empty)) { XPropertySet xTFModelPSet = (XPropertySet)oTFModel; // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xTFModelPSet.setPropertyValue("EchoChar", Any.Get((short)echoChar.ToCharArray(0, 1)[0])); } if (_xFocusListener != null || _xTextListener != null || _xKeyListener != null) { XControl xTFControl = GetControlByName(sName); // add a textlistener that is notified on each change of the controlvalue... xTextComponent = (XTextComponent)xTFControl; XWindow xTFWindow = (XWindow)xTFControl; if (_xFocusListener != null) xTFWindow.addFocusListener(_xFocusListener); if (_xTextListener != null) xTextComponent.addTextListener(_xTextListener); if (_xKeyListener != null) xTFWindow.addKeyListener(_xKeyListener); } } 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 xTextComponent; }
public XTextComponent InsertCurrencyField(int _nPositionX, int _nPositionY, int _nWidth, double defaultValue, XTextListener _xTextListener, String sName = "") { return InsertCurrencyField( _nPositionX, _nPositionY, _nWidth, 12, String.Empty, defaultValue, _xTextListener, sName); }
public XTextComponent InsertCurrencyField(int _nPositionX, int _nPositionY, int _nWidth, int _nHeight, string curencySymbol, double defaultValue, XTextListener _xTextListener, String sName = "") { XTextComponent xTextComponent = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "CURRENCY_FIELD"); else sName = createUniqueName(MXDlgModelNameContainer, sName); // create a controlmodel at the multiservicefactory of the dialog model... Object oCFModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_CURRENCY_FIELD_MODEL, MXContext); XMultiPropertySet xCFModelMPSet = (XMultiPropertySet)oCFModel; // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xCFModelMPSet.setPropertyValues( new String[] { "Height", "Name", "PositionX", "PositionY", "Width" }, Any.Get(new Object[] { _nHeight, sName, _nPositionX, _nPositionY, _nWidth })); // The controlmodel is not really available until inserted to the Dialog container MXDlgModelNameContainer.insertByName(sName, Any.Get(oCFModel)); XPropertySet xCFModelPSet = (XPropertySet)oCFModel; // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration if (!curencySymbol.Equals(String.Empty)) { xCFModelPSet.setPropertyValue("PrependCurrencySymbol", Any.Get(true)); xCFModelPSet.setPropertyValue("CurrencySymbol", Any.Get(curencySymbol)); } else { xCFModelPSet.setPropertyValue("PrependCurrencySymbol", Any.Get(false)); } xCFModelPSet.setPropertyValue("Value", Any.Get(defaultValue)); if (_xTextListener != null) { // add a textlistener that is notified on each change of the controlvalue... Object oCFControl = GetControlByName(sName); xTextComponent = (XTextComponent)oCFControl; xTextComponent.addTextListener(_xTextListener); } } 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 xTextComponent; }
public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, int _nHeight, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "") { XTextComponent xTextComponent = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) { sName = createUniqueName(MXDlgModelNameContainer, "EDIT"); } else { sName = createUniqueName(MXDlgModelNameContainer, sName); } // create a controlmodel at the multiservicefactory of the dialog model... Object oTFModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_EDIT_MODEL, MXContext); XMultiPropertySet xTFModelMPSet = (XMultiPropertySet)oTFModel; // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xTFModelMPSet.setPropertyValues( new String[] { "Height", "Name", "PositionX", "PositionY", "Text", "Width" }, Any.Get(new Object[] { _nHeight, sName, _nPosX, _nPosY, defaultText, _nWidth })); // The controlmodel is not really available until inserted to the Dialog container MXDlgModelNameContainer.insertByName(sName, Any.Get(oTFModel)); if (!echoChar.Equals(String.Empty)) { XPropertySet xTFModelPSet = (XPropertySet)oTFModel; // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xTFModelPSet.setPropertyValue("EchoChar", Any.Get((short)echoChar.ToCharArray(0, 1)[0])); } if (_xFocusListener != null || _xTextListener != null || _xKeyListener != null) { XControl xTFControl = GetControlByName(sName); // add a textlistener that is notified on each change of the controlvalue... xTextComponent = (XTextComponent)xTFControl; XWindow xTFWindow = (XWindow)xTFControl; if (_xFocusListener != null) { xTFWindow.addFocusListener(_xFocusListener); } if (_xTextListener != null) { xTextComponent.addTextListener(_xTextListener); } if (_xKeyListener != null) { xTFWindow.addKeyListener(_xKeyListener); } } } 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(xTextComponent); }
public XTextComponent InsertEditField(String defaultText, int _nPosX, int _nPosY, int _nWidth, String echoChar, XTextListener _xTextListener, XFocusListener _xFocusListener, XKeyListener _xKeyListener, String sName = "") { return(InsertEditField(defaultText, _nPosX, _nPosY, _nWidth, 12, echoChar, _xTextListener, _xFocusListener, _xKeyListener, sName)); }
public XTextComponent InsertCurrencyField(int _nPositionX, int _nPositionY, int _nWidth, int _nHeight, string curencySymbol, double defaultValue, XTextListener _xTextListener, String sName = "") { XTextComponent xTextComponent = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) { sName = createUniqueName(MXDlgModelNameContainer, "CURRENCY_FIELD"); } else { sName = createUniqueName(MXDlgModelNameContainer, sName); } // create a controlmodel at the multiservicefactory of the dialog model... Object oCFModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_CURRENCY_FIELD_MODEL, MXContext); XMultiPropertySet xCFModelMPSet = (XMultiPropertySet)oCFModel; // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xCFModelMPSet.setPropertyValues( new String[] { "Height", "Name", "PositionX", "PositionY", "Width" }, Any.Get(new Object[] { _nHeight, sName, _nPositionX, _nPositionY, _nWidth })); // The controlmodel is not really available until inserted to the Dialog container MXDlgModelNameContainer.insertByName(sName, Any.Get(oCFModel)); XPropertySet xCFModelPSet = (XPropertySet)oCFModel; // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration if (!curencySymbol.Equals(String.Empty)) { xCFModelPSet.setPropertyValue("PrependCurrencySymbol", Any.Get(true)); xCFModelPSet.setPropertyValue("CurrencySymbol", Any.Get(curencySymbol)); } else { xCFModelPSet.setPropertyValue("PrependCurrencySymbol", Any.Get(false)); } xCFModelPSet.setPropertyValue("Value", Any.Get(defaultValue)); if (_xTextListener != null) { // add a textlistener that is notified on each change of the controlvalue... Object oCFControl = GetControlByName(sName); xTextComponent = (XTextComponent)oCFControl; xTextComponent.addTextListener(_xTextListener); } } 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(xTextComponent); }
public XTextComponent InsertCurrencyField(int _nPositionX, int _nPositionY, int _nWidth, double defaultValue, XTextListener _xTextListener, String sName = "") { return(InsertCurrencyField(_nPositionX, _nPositionY, _nWidth, 12, String.Empty, defaultValue, _xTextListener, sName)); }
public XTextComponent insertFileControl(XTextListener _xTextListener, int _nPosX, int _nPosY, int _nWidth, String sName = "") { XTextComponent xTextComponent = null; try { // create a unique name by means of an own implementation... if (String.IsNullOrWhiteSpace(sName)) sName = createUniqueName(MXDlgModelNameContainer, "FILECONTROL"); else sName = createUniqueName(MXDlgModelNameContainer, sName); // retrieve the configured Work path... Object oPathSettings = MXMcf.createInstanceWithContext(OO.Services.UTIL_PATH_SETTINGS, MXContext); XPropertySet xPropertySet = (XPropertySet)oPathSettings; String sWorkUrl = (String)xPropertySet.getPropertyValue("Work").Value; // convert the Url to a system path that is "human readable"... Object oFCProvider = MXMcf.createInstanceWithContext(OO.Services.UTIL_FILE_CONTENT_PRVIDER, MXContext); XFileIdentifierConverter xFileIdentifierConverter = (XFileIdentifierConverter)oFCProvider; String sSystemWorkPath = xFileIdentifierConverter.getSystemPathFromFileURL(sWorkUrl); // create a controlmodel at the multiservicefactory of the dialog model... Object oFCModel = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_FILE_MODEL, MXContext); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! XMultiPropertySet xFCModelMPSet = (XMultiPropertySet)oFCModel; xFCModelMPSet.setPropertyValues( new String[] { "Height", "Name", "PositionX", "PositionY", "Text", "Width" }, Any.Get(new Object[] { 14, sName, _nPosX, _nPosY, sSystemWorkPath, _nWidth })); // The controlmodel is not really available until inserted to the Dialog container MXDlgModelNameContainer.insertByName(sName, Any.Get(oFCModel)); XPropertySet xFCModelPSet = (XPropertySet)oFCModel; // add a textlistener that is notified on each change of the controlvalue... XControl xFCControl = GetControlByName(sName); xTextComponent = (XTextComponent)xFCControl; XWindow xFCWindow = (XWindow)xFCControl; xTextComponent.addTextListener(_xTextListener); } 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 xTextComponent; }