/// <summary> /// Gets the last shape of document. /// </summary> /// <param name="doc">The doc.</param> /// <param name="pages">The pages.</param> /// <returns></returns> public static OoShapeObserver GetLastShapeOfDocument(OoAccessibleDocWnd doc, OoDrawPageObserver pages = null) { if (doc != null) { if (pages == null) { pages = doc.GetActivePage(); } if (pages != null && doc.DocumentComponent != null && doc.DocumentComponent.ChildCount > 0) { // a page doesn't have children in the accessible tree --> damn // so we have to go through the shape structure return pages.GetLastChild(); } else { Logger.Instance.Log(LogPriority.DEBUG, "AccDomWalker", "The document to walk through seems to have no child shapes"); } } return null; }
/// <summary> /// Gets the infos about the amount of pages and the current page number of a window. /// </summary> /// <param name="win">The DRAW doc window.</param> /// <returns>a String of type ' X/Y', where X is the current page and Y the amount of pages; otherwise the empty string.</returns> private static string getPageNumInfosOfWindow(OoAccessibleDocWnd win) { String result = String.Empty; if (win != null) { int pC = win.GetPageCount(); if (pC > 1) { var aPObs = win.GetActivePage(); if (aPObs != null) { int cP = aPObs.GetPageNum(); if (cP > 0) { result += " " + cP + "/" + pC; } } } } return result; }