示例#1
0
        /// <summary>
        /// Copies the text.
        /// </summary>
        /// <param name="xDialog">The x dialog.</param>
        /// <param name="aEvent">A event object.</param>
        public void CopyText(XDialog xDialog, Object aEvent)
        {
            XControlContainer xControlContainer = (XControlContainer)xDialog;

            String        aTextPropertyStr   = "Text";
            String        aText              = "";
            XControl      xTextField1Control = xControlContainer.getControl("TextField1");
            XControlModel xControlModel1     = xTextField1Control.getModel();
            XPropertySet  xPropertySet1      = (XPropertySet)xControlModel1;

            try
            {
                aText = (String)xPropertySet1.getPropertyValue(aTextPropertyStr).Value;
            }
            catch (unoidl.com.sun.star.uno.Exception e)
            {
                Console.WriteLine("copyText caught exception! " + e);
            }

            XControl      xTextField2Control = xControlContainer.getControl("TextField2");
            XControlModel xControlModel2     = xTextField2Control.getModel();
            XPropertySet  xPropertySet2      = (XPropertySet)xControlModel2;

            try
            {
                xPropertySet2.setPropertyValue(aTextPropertyStr, new uno.Any(aText));
            }
            catch (unoidl.com.sun.star.uno.Exception e)
            {
                Console.WriteLine("copyText caught exception! " + e);
            }

            global::System.Windows.Forms.MessageBox.Show("DialogComponent", "copyText() called");
        }
        public static XPropertySet GetPropertysetOfControl(XControl xCtr)
        {
            if (xCtr != null)
            {
                XControlModel model = xCtr.getModel();
                if (model != null && model is XPropertySet)
                {
                    return(model as XPropertySet);
                }
            }

            return(null);
        }
        public static XPropertySet GetPropertysetOfControl(XControl xCtr){

            if (xCtr != null)
            {
                XControlModel model =xCtr.getModel();
                if (model != null && model is XPropertySet)
                {
                   return model as XPropertySet;
                }
            }
            
            return null;
        }