/// <summary>
        /// Gets the property of a PropertySet or a XControl.
        /// </summary>
        /// <param name="propertySet">The property set or the control.</param>
        /// <param name="propName">Name of the property.</param>
        /// <returns>the value of the Any Object returned from the PropertySet</returns>
        public static Object GetProperty(Object propertySet, String propName)
        {
            if (propertySet != null && !String.IsNullOrWhiteSpace(propName))
            {
                XPropertySet ps = null;
                if (propertySet is XPropertySet)
                {
                    ps = propertySet as XPropertySet;
                }
                else if (propertySet is XControl)
                { // for a XControll you have to get the model to change or get the properties
                    XControlModel model = ((XControl)propertySet).getModel();
                    if (model != null && model is XPropertySet)
                    {
                        ps = model as XPropertySet;
                    }
                }

                if (ps != null)
                {
                    return(OoUtils.GetProperty(ps, propName));
                }
            }

            return(null);
        }
        public ResizingContainer(int width, int height, string sName)
        {
            #region inner Container

            // create a control model at the multi service factory of the dialog model...
            innerScrlContrModel = OO.GetMultiServiceFactory(MXContext).createInstance(AWT_UNO_CONTROL_CONTAINER_Model) as XControlModel;
            innerScrlContr      = OO.GetMultiServiceFactory(MXContext).createInstance(AWT_UNO_CONTROL_CONTAINER) as XControl;

            if (innerScrlContr != null && innerScrlContrModel != null)
            {
                innerScrlContr.setModel(innerScrlContrModel);
            }

            XMultiPropertySet xinnerScrlContMPSet = innerScrlContrModel as XMultiPropertySet;

            if (xinnerScrlContMPSet != null)
            {
                xinnerScrlContMPSet.setPropertyValues(
                    new String[] { "Name", "State" },
                    Any.Get(new Object[] { sName, ((short)0) }));
            }

            innerWidth  = width;
            innerHeight = height;

            // Set the size of the surrounding container
            if (innerScrlContr is XWindow)
            {
                ((XWindow)innerScrlContr).setPosSize(0, 0, innerWidth, innerHeight, PosSize.POSSIZE);
            }

            #endregion
        }
예제 #3
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");
        }
예제 #4
0
        /// <summary>
        /// is invoked when the adjustment has changed.
        /// </summary>
        /// <param id="rEvent">The r event.</param>
        void XAdjustmentListener.adjustmentValueChanged(AdjustmentEvent rEvent)
        {
            if (rEvent != null && rEvent.Source is XControl)
            {
                XControlModel sbModel     = ((XControl)rEvent.Source).getModel();
                var           Orientation = OoUtils.GetProperty(rEvent.Source, "Orientation");
                int           o           = (Orientation is int) ? (int)Orientation : -1;

                // the value of a scroll bar is the topmost point of the
                // scroller. That means the size of the scroller (VisibleSize)
                // is some kind of margin to the bottom of the scroll region.
                // Is is not possible to scroll down to the ScrollValueMax.
                // The maximum value that is reachable is
                // ScrollValueMax - VisibleSize !
                // so the unreachable rest rest (VisibleSize) has to be
                // distributed proportionally to the already traveled
                // scroll way (ScrollValue)
                int    step            = OoUtils.GetIntProperty(sbModel, "ScrollValue");
                int    vissize         = OoUtils.GetIntProperty(sbModel, "VisibleSize");
                int    max             = OoUtils.GetIntProperty(sbModel, "ScrollValueMax");
                int    scrollable_size = max - vissize;
                double scrolledRatio   = (double)step / (double)scrollable_size;
                double offset          = (double)vissize * scrolledRatio;
                step += (int)offset;

                switch (o)
                {
                case 0:     // horizontal
                    scrollHorizontal(step);
                    break;

                case 1:     // vertical
                    scrollVertical(step);
                    break;

                default:
                    break;
                }

                //switch (rEvent.Type)
                //{
                //    case AdjustmentType.ADJUST_ABS:
                //        System.Diagnostics.Debug.WriteLine("The event has been triggered by dragging the thumb...");
                //        break;
                //    case AdjustmentType.ADJUST_LINE:
                //        System.Diagnostics.Debug.WriteLine("The event has been triggered by a single line move..");
                //        break;
                //    case AdjustmentType.ADJUST_PAGE:
                //        System.Diagnostics.Debug.WriteLine("The event has been triggered by a block move...");
                //        break;
                //}
                //System.Diagnostics.Debug.WriteLine("The value of the scrollbar is: " + rEvent.Value);
            }
        }
        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);
        }
예제 #6
0
 /// <summary>
 /// Gets all properties of the object.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="debug">if set to <c>true</c> the properies will be printed
 /// to the System.Diagnostics.Debug output.</param>
 /// <returns>A dictionary with the properties. The name is the key an the value
 /// is set as uno.Any. You can access the real value by using uno.Any.Value</returns>
 public static Dictionary <String, uno.Any> GetAllProperties(Object obj, bool debug = true)
 {
     if (obj != null)
     {
         if (obj is XControl)
         {
             XControlModel model = ((XControl)obj).getModel();
             return(GetAllProperties(model as XPropertySet, debug));
         }
         else
         {
             return(GetAllProperties(obj as XPropertySet, debug));
         }
     }
     return(null);
 }
        public static XControlContainer createDialog(XMultiComponentFactory xMultiComponentFactory, XComponentContext xContext,
                                                     int posX, int posY, int width, int height, string title
                                                     )
        {
            try
            {
                Object oDialogModel = xMultiComponentFactory.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", xContext);

                // The XMultiServiceFactory of the dialog model is needed to instantiate the controls...
                var MXMsfDialogModel = (XMultiServiceFactory)oDialogModel;

                // The named container is used to insert the created controls into...
                var MXDlgModelNameContainer = (XNameContainer)oDialogModel;

                // create the dialog...
                Object oUnoDialog      = xMultiComponentFactory.createInstanceWithContext("com.sun.star.awt.UnoControlDialog", xContext);
                var    MXDialogControl = (XControl)oUnoDialog;

                // The scope of the control container is public...
                var MXDlgContainer = (XControlContainer)oUnoDialog;

                var MXTopWindow = (XTopWindow)MXDlgContainer;

                // link the dialog and its model...
                XControlModel xControlModel = (XControlModel)oDialogModel;
                MXDialogControl.setModel(xControlModel);
            }
            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);
            }


            //xMultiPropertySet.setPropertyValues(PropertyNames, Any.Get(PropertyValues));

            return(null);
        }
        /// <summary>
        /// Sets a property if possible.
        /// </summary>
        /// <param name="propertySet">The property set.</param>
        /// <param name="name">The name of the property.</param>
        /// <param name="value">The value.</param>
        /// <returns><c>true</c> if the property could be set otherwise <c>false</c></returns>
        public bool SetProperty(object propertySet, string name, object value)
        {
            if (propertySet != null)
            {
                XPropertySet ps = null;
                if (propertySet is XPropertySet)
                {
                    ps = propertySet as XPropertySet;
                }
                else if (propertySet is XControl)
                { // for a XControll you have to get the model to change or get the properties
                    XControlModel model = ((XControl)propertySet).getModel();
                    if (model != null && model is XPropertySet)
                    {
                        ps = model as XPropertySet;
                    }
                }

                if (ps != null)
                {
                    var  psInfo = ps.getPropertySetInfo();
                    bool exist  = psInfo.hasPropertyByName(name);

                    //util.Debug.GetAllProperties(ps);

                    if (exist)
                    {
                        ps.setPropertyValue(name, Any.Get(value));
                        return(true);
                    }
                    else
                    {
                    }
                }
            }
            return(false);
        }
        /// <summary>
        /// Creates the dialog model and container.
        /// Variables MXMsfDialogModel, MXDlgModelNameContainer, MXDialogControl, MXDlgContainer and MXTopWindow are created.
        /// Properties: Height, Name, PositionX, PositionY, Step, TabIndex, Tag, Width, BackgroundColor, Closeable, Enabled, FontDescriptor, FontEmphasisMark, FontRelief, HelpText, HelpURL, Moveable, Sizeable, TextColor, TextLineColor, Title
        /// </summary>
        /// <param name="XMcf">The XMultiComponentFactory to use.</param>
        protected virtual void CreateDialog(XMultiComponentFactory XMcf)
        {
            try
            {
                Object oDialogModel = XMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_DIALOG_MODEL, MXContext);

                // The XMultiServiceFactory of the dialog model is needed to instantiate the controls...
                MXMsfDialogModel = (XMultiServiceFactory)oDialogModel;

                // The named container is used to insert the created controls into...
                MXDlgModelNameContainer = (XNameContainer)oDialogModel;

                // create the dialog...
                Object oUnoDialog = XMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_DIALOG, MXContext);
                MXDialogControl = (XControl)oUnoDialog;

                // The scope of the control container is public...
                MXDlgContainer = (XControlContainer)oUnoDialog;

                MXTopWindow = (XTopWindow)MXDlgContainer;

                // link the dialog and its model...
                XControlModel xControlModel = (XControlModel)oDialogModel;
                MXDialogControl.setModel(xControlModel);
            }
            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);
            }
        }
예제 #10
0
        public void CreateScrollableContainer(int _nPosX, int _nPosY, int _nWidth, int _nHeight, String sName)
        {
            try
            {
                // create a unique id by means of an own implementation...
                if (String.IsNullOrWhiteSpace(sName))
                {
                    sName = AbstactUnoDialogBase.createUniqueName(MXDlgModelNameContainer, "SCROLL_CONTAINER");
                }
                else
                {
                    sName = AbstactUnoDialogBase.createUniqueName(MXDlgModelNameContainer, sName);
                }

                //XMultiServiceFactory _xMSF = OO.GetMultiServiceFactory(MXContext);
                XMultiComponentFactory _xMcf = OO.GetMultiComponentFactory(MXContext, true);

                #region Outer Container

                // create a UnoControlContainerModel. A thing which differs from other dialog-controls in many aspects
                // Position and size of the model have no effect, so we apply setPosSize() on it's view later.
                // Unlike a dialog-model the container-model can not have any control-models.
                // As an instance of a dialog-model it can have the property "Step"(among other things),
                // provided by service awt.UnoControlDialogElement, without actually supporting this service!

                // create a control model at the multi service factory of the dialog model...
                outerScrlContrModel = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER_Model, MXContext) as XControlModel;
                OuterScrlContr      = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER, MXContext) as XControl;


                if (OuterScrlContr != null && outerScrlContrModel != null)
                {
                    OuterScrlContr.setModel(outerScrlContrModel);
                }

                XMultiPropertySet xoScrlContMPSet = outerScrlContrModel as XMultiPropertySet;

                if (xoScrlContMPSet != null)
                {
                    // Set the properties at the model - keep in mind to pass the property names in alphabetical order!
                    xoScrlContMPSet.setPropertyValues(
                        new String[] { "Height", "Name", "PositionX", "PositionY", "State", "Width" },
                        Any.Get(new Object[] { 0, sName, 0, 0, ((short)0), 0, 0 }));
                }

                //add to the dialog
                XControlContainer xCntrCont = parentCnt as XControlContainer;
                if (xCntrCont != null)
                {
                    xCntrCont.addControl(sName, OuterScrlContr as XControl);
                }

                #endregion

                #region Scroll bars

                //insert scroll bars
                HorizontalScrlBar = insertHorizontalScrollBar(this, _nPosX, _nPosY + _nHeight, _nWidth);
                VerticalScrlBar   = insertVerticalScrollBar(this, _nPosX + _nWidth, _nPosY, _nHeight);

                #endregion

                #region Set Size of outer Container

                //make the outer container pos and size via the pos and size of the scroll bars
                if (HorizontalScrlBar is XWindow)
                {
                    Rectangle hSBPos = ((XWindow)HorizontalScrlBar).getPosSize();
                    _width = hSBPos.Width;
                    _posX  = hSBPos.X;
                }
                if (VerticalScrlBar is XWindow)
                {
                    Rectangle vSBPos = ((XWindow)VerticalScrlBar).getPosSize();
                    _height = vSBPos.Height;
                    _posY   = vSBPos.Y;
                }

                // Set the size of the surrounding container
                if (OuterScrlContr is XWindow)
                {
                    ((XWindow)OuterScrlContr).setPosSize(PosX, PosY, Width, Height, PosSize.POSSIZE);
                    ((XWindow)OuterScrlContr).addMouseListener(this);
                }
                #endregion

                #region inner Container


                // create a control model at the multi service factory of the dialog model...
                innerScrlContrModel = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER_Model, MXContext) as XControlModel;
                InnerScrlContr      = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER, MXContext) as XControl;


                if (InnerScrlContr != null && innerScrlContrModel != null)
                {
                    InnerScrlContr.setModel(innerScrlContrModel);
                }

                XMultiPropertySet xinnerScrlContMPSet = innerScrlContrModel as XMultiPropertySet;

                if (xinnerScrlContMPSet != null)
                {
                    xinnerScrlContMPSet.setPropertyValues(
                        new String[] { "Name", "State" },
                        Any.Get(new Object[] { sName + "_S", ((short)0) }));
                }

                //// FIXME: only for fixing

                //util.Debug.GetAllServicesOfObject(parentCnt);

                //Object oDialogModel = OO.GetMultiComponentFactory().createInstanceWithContext(OO.Services.AWT_CONTROL_DIALOG_MODEL, MXContext);

                //// The named container is used to insert the created controls into...
                //MXDlgModelNameContainer = (XNameContainer)oDialogModel;

                //System.Diagnostics.Debug.WriteLine("_________");

                //util.Debug.GetAllServicesOfObject(MXDlgModelNameContainer);

                //// END

                //add inner container to the outer scroll container
                XControlContainer outerCntrCont = OuterScrlContr as XControlContainer;
                if (outerCntrCont != null)
                {
                    outerCntrCont.addControl(sName + "_S", InnerScrlContr as XControl);

                    InnerWidth  = Width;
                    InnerHeight = Height;

                    // Set the size of the surrounding container
                    if (InnerScrlContr is XWindow)
                    {
                        ((XWindow)InnerScrlContr).setPosSize(0, 0, InnerWidth, InnerHeight, PosSize.POSSIZE);
                        ((XWindow)InnerScrlContr).addMouseListener(this);
                    }
                }

                #endregion
            }
            catch (System.Exception) { }
        }
        public void CreateScrollableContainer(int _nPosX, int _nPosY, int _nWidth, int _nHeight, String sName)
        {
            try
            {
                // create a unique id by means of an own implementation...
                if (String.IsNullOrWhiteSpace(sName)) sName = AbstactUnoDialogBase.createUniqueName(MXDlgModelNameContainer, "SCROLL_CONTAINER");
                else sName = AbstactUnoDialogBase.createUniqueName(MXDlgModelNameContainer, sName);

                //XMultiServiceFactory _xMSF = OO.GetMultiServiceFactory(MXContext);
                XMultiComponentFactory _xMcf = OO.GetMultiComponentFactory(MXContext, true);

                #region Outer Container

                // create a UnoControlContainerModel. A thing which differs from other dialog-controls in many aspects
                // Position and size of the model have no effect, so we apply setPosSize() on it's view later.
                // Unlike a dialog-model the container-model can not have any control-models.
                // As an instance of a dialog-model it can have the property "Step"(among other things),
                // provided by service awt.UnoControlDialogElement, without actually supporting this service!

                // create a control model at the multi service factory of the dialog model...
                outerScrlContrModel = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER_Model, MXContext) as XControlModel;
                OuterScrlContr = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER, MXContext) as XControl;


                if (OuterScrlContr != null && outerScrlContrModel != null)
                {
                    OuterScrlContr.setModel(outerScrlContrModel);
                }

                XMultiPropertySet xoScrlContMPSet = outerScrlContrModel as XMultiPropertySet;

                if (xoScrlContMPSet != null)
                {
                    // Set the properties at the model - keep in mind to pass the property names in alphabetical order!
                    xoScrlContMPSet.setPropertyValues(
                            new String[] { "Height", "Name", "PositionX", "PositionY", "State", "Width" },
                            Any.Get(new Object[] { 0, sName, 0, 0, ((short)0), 0, 0 }));
                }

                //add to the dialog
                XControlContainer xCntrCont = parentCnt as XControlContainer;
                if (xCntrCont != null)
                {
                    xCntrCont.addControl(sName, OuterScrlContr as XControl);
                }

                #endregion

                #region Scroll bars

                //insert scroll bars
                HorizontalScrlBar = insertHorizontalScrollBar(this, _nPosX, _nPosY + _nHeight, _nWidth);
                VerticalScrlBar = insertVerticalScrollBar(this, _nPosX + _nWidth, _nPosY, _nHeight);

                #endregion

                #region Set Size of outer Container

                //make the outer container pos and size via the pos and size of the scroll bars
                if (HorizontalScrlBar is XWindow)
                {
                    Rectangle hSBPos = ((XWindow)HorizontalScrlBar).getPosSize();
                    _width = hSBPos.Width;
                    _posX = hSBPos.X;
                }
                if (VerticalScrlBar is XWindow)
                {
                    Rectangle vSBPos = ((XWindow)VerticalScrlBar).getPosSize();
                    _height = vSBPos.Height;
                    _posY = vSBPos.Y;
                }

                // Set the size of the surrounding container
                if (OuterScrlContr is XWindow)
                {
                    ((XWindow)OuterScrlContr).setPosSize(PosX, PosY, Width, Height, PosSize.POSSIZE);
                    ((XWindow)OuterScrlContr).addMouseListener(this);

                }
                #endregion

                #region inner Container


                // create a control model at the multi service factory of the dialog model...
                innerScrlContrModel = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER_Model, MXContext) as XControlModel;
                InnerScrlContr = _xMcf.createInstanceWithContext(AWT_UNO_CONTROL_CONTAINER, MXContext) as XControl;


                if (InnerScrlContr != null && innerScrlContrModel != null)
                {
                    InnerScrlContr.setModel(innerScrlContrModel);
                }

                XMultiPropertySet xinnerScrlContMPSet = innerScrlContrModel as XMultiPropertySet;

                if (xinnerScrlContMPSet != null)
                {
                    xinnerScrlContMPSet.setPropertyValues(
                            new String[] { "Name", "State" },
                            Any.Get(new Object[] { sName + "_S", ((short)0) }));
                }

                //// FIXME: only for fixing

                //util.Debug.GetAllServicesOfObject(parentCnt);

                //Object oDialogModel = OO.GetMultiComponentFactory().createInstanceWithContext(OO.Services.AWT_CONTROL_DIALOG_MODEL, MXContext);

                //// The named container is used to insert the created controls into...
                //MXDlgModelNameContainer = (XNameContainer)oDialogModel;

                //System.Diagnostics.Debug.WriteLine("_________");

                //util.Debug.GetAllServicesOfObject(MXDlgModelNameContainer);

                //// END

                //add inner container to the outer scroll container
                XControlContainer outerCntrCont = OuterScrlContr as XControlContainer;
                if (outerCntrCont != null)
                {
                    outerCntrCont.addControl(sName + "_S", InnerScrlContr as XControl);

                    InnerWidth = Width;
                    InnerHeight = Height;

                    // Set the size of the surrounding container
                    if (InnerScrlContr is XWindow)
                    {
                        ((XWindow)InnerScrlContr).setPosSize(0, 0, InnerWidth, InnerHeight, PosSize.POSSIZE);
                        ((XWindow)InnerScrlContr).addMouseListener(this);
                    }
                }

                #endregion

            }
            catch (System.Exception) { }
        }
        public ResizingContainer(int width, int height, string sName)
        {

            #region inner Container

            // create a control model at the multi service factory of the dialog model...
            innerScrlContrModel = OO.GetMultiServiceFactory(MXContext).createInstance(AWT_UNO_CONTROL_CONTAINER_Model) as XControlModel;
            innerScrlContr = OO.GetMultiServiceFactory(MXContext).createInstance(AWT_UNO_CONTROL_CONTAINER) as XControl;

            if (innerScrlContr != null && innerScrlContrModel != null)
            {
                innerScrlContr.setModel(innerScrlContrModel);
            }

            XMultiPropertySet xinnerScrlContMPSet = innerScrlContrModel as XMultiPropertySet;

            if (xinnerScrlContMPSet != null)
            {
                xinnerScrlContMPSet.setPropertyValues(
                        new String[] { "Name", "State" },
                        Any.Get(new Object[] { sName , ((short)0) }));
            }

            innerWidth = width;
            innerHeight = height;

            // Set the size of the surrounding container
            if (innerScrlContr is XWindow)
            {
                ((XWindow)innerScrlContr).setPosSize(0, 0, innerWidth, innerHeight, PosSize.POSSIZE);
            }

            #endregion

        }
        public static XControlContainer createDialog(XMultiComponentFactory xMultiComponentFactory, XComponentContext xContext,
                                                     int posX, int posY, int width, int height, string title
                                                     )
        {
            //dialog model
            Object oDialogModel = xMultiComponentFactory.createInstanceWithContext(
                "com.sun.star.awt.UnoControlDialogModel", xContext);


            XPropertySet xPSetDialog = (XPropertySet)oDialogModel;

            xPSetDialog.setPropertyValue("PositionX", Any.Get(posX));
            xPSetDialog.setPropertyValue("PositionY", Any.Get(posY));
            xPSetDialog.setPropertyValue("Width", Any.Get(width));
            xPSetDialog.setPropertyValue("Height", Any.Get(height));
            xPSetDialog.setPropertyValue("Title", Any.Get(title));

            // get service manager from  dialog model
            XMultiServiceFactory MXMsfDialogModel = (XMultiServiceFactory)oDialogModel;

            // dialog control model
            Object oUnoDialog = xMultiComponentFactory.createInstanceWithContext(
                "com.sun.star.awt.UnoControlDialog", xContext);


            XControl      MXDialogControl = (XControl)oUnoDialog;
            XControlModel xControlModel   = (XControlModel)oDialogModel;

            MXDialogControl.setModel(xControlModel);



            XToolkit xToolkit = (XToolkit)xMultiComponentFactory
                                .createInstanceWithContext("com.sun.star.awt.Toolkit",
                                                           xContext);

            WindowDescriptor aDescriptor = new WindowDescriptor();

            aDescriptor.Type = WindowClass.TOP;
            aDescriptor.WindowServiceName = "";
            aDescriptor.ParentIndex       = -1;
            aDescriptor.Parent            = xToolkit.getDesktopWindow();
            aDescriptor.Bounds            = new Rectangle(100, 200, 300, 400);

            aDescriptor.WindowAttributes = WindowAttribute.BORDER
                                           | WindowAttribute.MOVEABLE | WindowAttribute.SIZEABLE
                                           | WindowAttribute.CLOSEABLE;

            XWindowPeer xPeer = xToolkit.createWindow(aDescriptor);

            XWindow xWindow = (XWindow)xPeer;

            xWindow.setVisible(false);
            MXDialogControl.createPeer(xToolkit, xPeer);

            // execute the dialog
            XDialog xDialog = (XDialog)oUnoDialog;

            xDialog.execute();

            // dispose the dialog
            XComponent xComponent = (XComponent)oUnoDialog;

            xComponent.dispose();

            return(oUnoDialog as XControlContainer);
        }