Ejemplo n.º 1
0
  /**
   * Use this if there is more than one object type (eg Tables and Paragraphs) you are interested in
   * doing something with during the traversal.
   *
   * <p>This method is for traversing an arbitrary WML object (eg a table), as opposed to eg the
   * main document part, or a header.
   *
   * @param parent
   * @param visitorList
   */
  public static void visit(Object parent, List<TraversalUtilVisitor> visitorList) {

    CompoundTraversalUtilVisitorCallback callback = null;
    if ((visitorList != null) && (!visitorList.isEmpty())) {
      if (visitorList.size() > 1) {
        visit(parent, new CompoundTraversalUtilVisitorCallback(visitorList));
      } else {
        visit(parent, visitorList.get(0));
      }
    }
  }
Ejemplo n.º 2
0
  /**
   * Use this if there is more than one object type (eg Tables and Paragraphs) you are interested in
   * doing something with during the traversal.
   *
   * <p>This method allows you to traverse just the main document part, or also headers/footers,
   * footnotes/endnotes, and comments as well.
   *
   * @param wmlPackage
   * @param bodyOnly
   * @param visitorList
   */
  public static void visit(
      WordprocessingMLPackage wmlPackage,
      boolean bodyOnly,
      List<TraversalUtilVisitor> visitorList) {

    CompoundTraversalUtilVisitorCallback callback = null;
    if ((visitorList != null) && (!visitorList.isEmpty())) {
      if (visitorList.size() > 1) {
        visit(wmlPackage, bodyOnly, new CompoundTraversalUtilVisitorCallback(visitorList));
      } else {
        visit(wmlPackage, bodyOnly, visitorList.get(0));
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * Use this if there is only a single object type (eg just P's) you are interested in doing
   * something with.
   *
   * <p>This method allows you to traverse just the main document part, or also headers/footers,
   * footnotes/endnotes, and comments as well.
   *
   * @param wmlPackage
   * @param bodyOnly
   * @param visitor
   */
  public static void visit(
      WordprocessingMLPackage wmlPackage, boolean bodyOnly, TraversalUtilVisitor visitor) {

    if (visitor != null) {
      visit(wmlPackage, bodyOnly, new SingleTraversalUtilVisitorCallback(visitor));
    }
  }
 protected static String findXPathStorageItemIdInContentControls(
     WordprocessingMLPackage wmlPackage) {
   FindContentControlsVisitor visitor = null;
   if ((wmlPackage.getCustomXmlDataStorageParts() != null)
       && (!wmlPackage.getCustomXmlDataStorageParts().isEmpty())) {
     try {
       visitor =
           new FindContentControlsVisitor(wmlPackage.getCustomXmlDataStorageParts().keySet());
       TraversalUtil.visit(wmlPackage, false, visitor);
     } catch (FindContentControlsVisitor.BreakException be) { // noop
     }
   }
   return (visitor != null ? visitor.getdefinedStoreItemId() : null);
 }
Ejemplo n.º 5
0
  /**
   * Use this if there is only a single object type (eg just P's) you are interested in doing
   * something with.
   *
   * <p>This method is for traversing an arbitrary WML object (eg a table), as opposed to eg the
   * main document part, or a header.
   *
   * @param parent
   * @param visitor
   */
  public static void visit(Object parent, TraversalUtilVisitor visitor) {

    if (visitor != null) {
      visit(parent, new SingleTraversalUtilVisitorCallback(visitor));
    }
  }