/// <summary>
        /// Selects the first polygon point.
        /// </summary>
        public void SelectFirstPolygonPoint()
        {
            Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "first poly point");

            if (LastSelectedShapePolygonPoints == null && LastSelectedShape != null)
            {
                var pObs = LastSelectedShape.GetPolygonPointsObserver();
                if (pObs != null)
                {
                    LastSelectedShapePolygonPoints = pObs;
                }
            }

            if (LastSelectedShapePolygonPoints != null)
            {
                PolyPointDescriptor point;
                if (LastSelectedShapePolygonPoints.HasPoints())
                {
                    point = LastSelectedShapePolygonPoints.First();
                }
                else
                {
                    point = new PolyPointDescriptor();
                }

                SpeakPolygonPoint(LastSelectedShapePolygonPoints);
                fire_PolygonPointSelected(LastSelectedShapePolygonPoints, point);
            }
            else
            {
                fire_PolygonPointSelected_Reset();
            }
        }
 /// <summary>
 /// Updates the last selected polygon points if the current selected shape is a freeform.
 /// This is necessary e.g. to keep position or transformation changes!
 /// </summary>
 public void UpdateLastSelectedPolygonPoints()
 {
     if (LastSelectedShapePolygonPoints != null)
     {
         LastSelectedShapePolygonPoints.Update();
         // FIXME: reset iterator (call .ResetIterator()) or keep old index?!
     }
 }
        /// <summary>
        /// Selects the previous polygon point.
        /// </summary>
        public void SelectPreviousPolygonPoint(bool ignoreLastDuplicate = true)
        {
            Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "previous poly point");

            if (LastSelectedShapePolygonPoints == null && LastSelectedShape != null)
            {
                var pObs = LastSelectedShape.GetPolygonPointsObserver();
                if (pObs != null)
                {
                    LastSelectedShapePolygonPoints = pObs;
                }
            }

            if (LastSelectedShapePolygonPoints != null)
            {
                PolyPointDescriptor point;
                if (LastSelectedShapePolygonPoints.HasPoints())
                {
                    if (LastSelectedShapePolygonPoints.HasPrevious())
                    {
                        point = LastSelectedShapePolygonPoints.Previous();
                    }
                    else
                    {
                        point = LastSelectedShapePolygonPoints.Last();
                        if (ignoreLastDuplicate && LastSelectedShapePolygonPoints.HasPrevious())
                        {
                            point = LastSelectedShapePolygonPoints.Previous();
                        }
                    }
                }
                else
                {
                    point = new PolyPointDescriptor();
                }

                SpeakPolygonPoint(LastSelectedShapePolygonPoints);
                fire_PolygonPointSelected(LastSelectedShapePolygonPoints, point);
            }
            else
            {
                fire_PolygonPointSelected_Reset();
            }
        }
 public void ChoosePreviousElement()
 {
     Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "previous element");
     if (LastSelectedShapePolygonPoints != null &&
         LastSelectedShapePolygonPoints.IsValid() &&
         LastSelectedShapePolygonPoints.Shape == LastSelectedShape)
     {
         SelectPreviousPolygonPoint();
     }
     else if (LastSelectedShape == null)
     {
         //try to get the last shape of the current page
         var activeDoc = OoConnection.GetActiveDrawDocument() as OoAccessibleDocWnd;
         if (activeDoc != null)
         {
             OoShapeObserver last = AccDomWalker.GetLastShapeOfDocument(activeDoc);
             if (last != null)
             {
                 AudioRenderer.Instance.Abort(); // stop current audio to return the shape change
                 LastSelectedShape = last;
                 //sayLastSelectedShape();
             }
             else
             {
                 playError();
             }
         }
     }
     else
     {
         OoShapeObserver prev = AccDomWalker.MoveToPrevious(LastSelectedShape);
         if (prev != null)
         {
             AudioRenderer.Instance.Abort(); // stop current audio to return the shape change
             LastSelectedShape = prev as OoShapeObserver;
             //sayLastSelectedShape();
         }
         else
         {
             playError();
         }
     }
 }
 /// <summary>
 /// Go to the next element in the document tree.
 /// </summary>
 public void ChooseNextElement()
 {
     Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "next element");
     if (LastSelectedShapePolygonPoints != null &&
         LastSelectedShapePolygonPoints.IsValid() &&
         LastSelectedShapePolygonPoints.Shape == LastSelectedShape)
     {
         SelectNextPolygonPoint(LastSelectedShapePolygonPoints != null && LastSelectedShapePolygonPoints.IsClosed(true));
     }
     else if (LastSelectedShape == null)
     {
         //try to get the first shape of the current page
         var activeDoc = OoConnection.GetActiveDrawDocument() as OoAccessibleDocWnd;
         if (activeDoc != null)
         {
             OoShapeObserver first = AccDomWalker.GetFirstShapeOfDocument(activeDoc);
             if (first != null)
             {
                 AudioRenderer.Instance.Abort(); // stop current audio to return the shape change
                 LastSelectedShape = first;
                 //sayLastSelectedShape();
             }
             else
             {
                 playError();
             }
         }
     }
     else
     {
         OoShapeObserver next = AccDomWalker.MoveToNext(LastSelectedShape);
         if (next != null)
         {
             AudioRenderer.Instance.Abort(); // stop current audio to return the shape change
             LastSelectedShape = next as OoShapeObserver;
             //sayLastSelectedShape();
         }
         else
         {
             playError();
         }
     }
 }
 public void ChooseFirstChildOfElement()
 {
     Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "first child");
     if (LastSelectedShape == null)
     {
         //try to get the first shape of the current page
         var activeDoc = OoConnection.GetActiveDrawDocument() as OoAccessibleDocWnd;
         if (activeDoc != null)
         {
             OoShapeObserver first = AccDomWalker.GetFirstShapeOfDocument(activeDoc);
             if (first != null)
             {
                 AudioRenderer.Instance.Abort(); // stop current audio to return the shape change
                 LastSelectedShape = first;
                 //sayLastSelectedShape();
             }
             else
             {
                 playError();
             }
         }
     }
     else
     {
         int             index = 0;
         OoShapeObserver child = AccDomWalker.MoveToChild(LastSelectedShape, ref index);
         if (child != null)
         {
             AudioRenderer.Instance.Abort(); // stop current audio to return the shape change
             LastSelectedShape = child as OoShapeObserver;
             //sayLastSelectedShape();
         }
         else
         {
             SelectNextPolygonPoint(LastSelectedShapePolygonPoints != null && LastSelectedShapePolygonPoints.IsClosed(true));
             if (LastSelectedShapePolygonPoints == null)
             {
                 playError();
             }
         }
     }
 }
        /// <summary>
        /// Selects the first available polygon point.
        /// </summary>
        public void SelectPolygonPoint()
        {
            Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "select poly point");

            if (LastSelectedShapePolygonPoints == null && LastSelectedShape != null)
            {
                LastSelectedShapePolygonPoints = LastSelectedShape.GetPolygonPointsObserver();
                UpdateLastSelectedPolygonPoints();
            }
            if (LastSelectedShapePolygonPoints != null)
            {
                SpeakPolygonPoint(LastSelectedShapePolygonPoints);
                int i;
                fire_PolygonPointSelected(LastSelectedShapePolygonPoints, LastSelectedShapePolygonPoints.Current(out i));
            }
            else
            {
                fire_PolygonPointSelected_Reset();
            }
        }
        /// <summary>
        /// Selects the next following polygon point.
        /// </summary>
        /// <param name="ignoreLastDuplicate">if set to <c>true</c> to ignore the last point of an closed bezier,
        /// because it's the same as the first point..</param>
        public void SelectNextPolygonPoint(bool ignoreLastDuplicate = true)
        {
            // check if the shape is closed or not


            Logger.Instance.Log(LogPriority.DEBUG, this, "[NOTICE]\t[INTERACTION]\t[NAVIGATION]\t" + "next poly point");

            if (LastSelectedShapePolygonPoints == null && LastSelectedShape != null)
            {
                LastSelectedShapePolygonPoints = LastSelectedShape.GetPolygonPointsObserver();
                UpdateLastSelectedPolygonPoints();
            }
            if (LastSelectedShapePolygonPoints != null)
            {
                PolyPointDescriptor point;
                if (LastSelectedShapePolygonPoints.HasPoints())
                {
                    if (!LastSelectedShapePolygonPoints.HasNext(ignoreLastDuplicate))
                    {
                        LastSelectedShapePolygonPoints.ResetIterator();
                    }
                    point = LastSelectedShapePolygonPoints.Next();
                }
                else
                {
                    point = new PolyPointDescriptor();
                }

                SpeakPolygonPoint(LastSelectedShapePolygonPoints);
                fire_PolygonPointSelected(LastSelectedShapePolygonPoints, point);
            }
            else
            {
                fire_PolygonPointSelected_Reset();
            }
        }