/// <summary> /// Gets the OoShapeObserver for an accessible if already registered. /// </summary> /// <param name="accComp">The acc comp to get the observer for.</param> /// <param name="page">The page observer to search the observer in.</param> /// <returns>The related OoShapeObserver if already registered</returns> private static OoShapeObserver getObserverForAccessible(OoAccComponent accComp, OoDrawPageObserver page) { if (accComp != null && accComp.IsValid() && page != null) { var pObs = page.PagesObserver; if (pObs != null) { OoShapeObserver sObs = pObs.GetRegisteredShapeObserver(accComp); if (sObs == null) // shape is not registered { page.Update(); // try to do it better for the next term AudioRenderer.Instance.PlayWaveImmediately(StandardSounds.Error); ////TODO: try to get the parent return null; } return sObs; } else { Logger.Instance.Log(LogPriority.DEBUG, "OpenOfficeDrawShapeManipulator", "[ERROR] can't get the pages observer to get a ShapeObserver for the next item"); } } return null; }
private static OoAccComponent moveToParentComponent(OoAccComponent comp) { if (comp != null && comp.IsValid()) { try { OoAccComponent parent = comp.GetParent(); if (parent != null && acceptAsUsableShape(parent)) { return parent; } } catch { } } return null; }
private static OoAccComponent moveToChildComponent(OoAccComponent comp, ref int index) { if (comp != null && comp.IsValid() && comp.HasChildren) { try { int childNumber = comp.ChildCount; index = index % childNumber; return comp.GetChild(index); } catch { } } return null; }
private static OoAccComponent moveToPrevComponent(OoAccComponent comp) { if (comp != null && comp.IsValid()) { //-------------------------- // try to get the parent OoAccComponent parent = comp.GetParent(); if (parent != null) { int pIndex = comp.IndexInParent; int pcCount = parent.ChildCount; int npIndex = mod(pIndex - 1, pcCount); if (pIndex != npIndex) { // get prev sibling var prevSibling = parent.GetChild(npIndex); if (prevSibling != null) { System.Diagnostics.Debug.WriteLine("[MOVE PREV] ---> return prev sibling: " + prevSibling); return prevSibling; } } } } return null; }