コード例 #1
0
        /// <summary>
        /// tries to calculate the absolute on screen bounding box in px of some given rectangle or if none is provided, based on the shape observer dom position, openoffice zoom etc.
        /// the accessibility interface is used for getting the controller main window position on the screen
        /// </summary>
        /// <param name="relativeBounds">the given relative bounds are used for transformation into absolute px coordinates.
        /// if the given value is null, getRelativeScreenBoundsByDom() of this shape observer will be called
        /// </param>
        /// <returns>Bounding box in pixels as absolute screen position.</returns>
        /// <remarks>Parts of this function are time limited to 100 ms.</remarks>
        virtual public System.Drawing.Rectangle GetAbsoluteScreenBoundsByDom(System.Drawing.Rectangle relativeBounds)
        {
            if (_updatingBounds)
            {
                return(_lastBounds);
            }

            _updatingBounds = true;
            System.Drawing.Rectangle result = new System.Drawing.Rectangle();
            try
            {
                result = (relativeBounds.Height * relativeBounds.Width <= 0) ? GetRelativeScreenBoundsByDom() : relativeBounds;
                //XModel docModel = (XModel)GetDocument();
                if (result.Width * result.Height > 0
                    //&& docModel != null
                    )
                {
                    // get page properties like zoom and offset
                    //docModel.lockControllers();
                    try
                    {
                        TimeLimitExecutor.WaitForExecuteWithTimeLimit(100, () =>
                        {
                            try
                            {
                                // add offset for draw view
                                XAccessibleComponent xaCmp = (XAccessibleComponent)Page.PagesObserver.DocWnd.Document.getAccessibleContext();
                                Point drawViewWindowPos    = (xaCmp != null) ? xaCmp.getLocationOnScreen() : new Point(0, 0);
                                result.X = result.X + drawViewWindowPos.X;
                                result.Y = result.Y + drawViewWindowPos.Y;
                            }
                            catch (System.Threading.ThreadAbortException) { }
                        }, "GetAbsoluteScreenBoundsByDom [" + Name + "]");
                    }
                    catch (System.Threading.ThreadAbortException) { }
                    catch (Exception ex)
                    {
                        Logger.Instance.Log(LogPriority.DEBUG, this, ex);
                    }
                    finally
                    {
                        // docModel.unlockControllers();
                    }
                }
                else
                {
                    Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE] can't get relative screen bounds from shape ");
                }

                _lastBounds = result;
            }
            finally
            {
                _updatingBounds = false;
            }
            return(result);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OoAccComponent"/> struct.
 /// </summary>
 /// <param name="accComp">The base XAccessibleComponent that shoulb be wraped.</param>
 private OoAccComponent(XAccessibleComponent accComp)
 {
     this.AccComp = accComp;
     AccCont      = (AccComp != null && AccComp is XAccessibleContext) ? AccComp as XAccessibleContext :
                    AccComp is XAccessible ? ((XAccessible)AccComp).getAccessibleContext() : null;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OoAccComponent"/> struct.
 /// </summary>
 /// <param name="accComp">The base XAccessibleComponent that shoulb be wraped.</param>
 private OoAccComponent(XAccessibleComponent accComp)
 {
     this.AccComp = accComp;
     AccCont = (AccComp != null && AccComp is XAccessibleContext) ? AccComp as XAccessibleContext :
         AccComp is XAccessible ? ((XAccessible)AccComp).getAccessibleContext() : null;
 }
コード例 #4
0
 /// <summary>
 /// Gets the registered shape observer to the accessible component if it is already registered.
 /// </summary>
 /// <param name="xAccessibleComponent">The x accessible component.</param>
 /// <returns>an accessible component if it is already registered</returns>
 internal OoShapeObserver GetRegisteredShapeObserver(XAccessibleComponent xAccessibleComponent)
 {
     OoShapeObserver shape = DrawPagesObs.GetRegisteredShapeObserver(xAccessibleComponent);
     return shape;
 }