Esempio n. 1
0
  private void handleListItem(Element node, LaTeXDocumentPortion ldp, Context oc) {
    // Are we ignoring this list?
    if (oc.isIgnoreLists()) {
      traverseBlockText(node, ldp, oc);
      return;
    }

    // Apply the style
    BeforeAfter ba = new BeforeAfter();
    palette
        .getListSc()
        .applyListItemStyle(
            oc.getListStyleName(),
            oc.getListLevel(),
            node.getNodeName().equals(XMLString.TEXT_LIST_HEADER),
            "true".equals(node.getAttribute(XMLString.TEXT_RESTART_NUMBERING)),
            Misc.getPosInteger(node.getAttribute(XMLString.TEXT_START_VALUE), 1) - 1,
            ba);

    // export the list item
    if (ba.getBefore().length() > 0) {
      ldp.append(ba.getBefore());
      if (config.formatting() >= LaTeXConfig.CONVERT_MOST) {
        ldp.nl();
      }
    }
    traverseBlockText(node, ldp, oc);
    if (ba.getAfter().length() > 0) {
      ldp.append(ba.getAfter()).nl();
    }
  }
Esempio n. 2
0
  /**
   * Process a list (text:ordered-lst or text:unordered-list tag)
   *
   * @param node The element containing the list
   * @param ldp the <code>LaTeXDocumentPortion</code> to which LaTeX code should be added
   * @param oc the current context
   */
  public void handleList(Element node, LaTeXDocumentPortion ldp, Context oc) {
    // Set up new context
    Context ic = (Context) oc.clone();
    ic.incListLevel();

    // Get the style name, if we don't know it already
    if (ic.getListStyleName() == null) {
      ic.setListStyleName(node.getAttribute(XMLString.TEXT_STYLE_NAME));
    }

    // Use the style to determine the type of list
    ListStyle style = ofr.getListStyle(ic.getListStyleName());
    boolean bOrdered = style != null && style.isNumber(ic.getListLevel());

    // If the list contains headings, ignore it!
    if (ic.isIgnoreLists() || listContainsHeadings(node)) {
      ic.setIgnoreLists(true);
      traverseList(node, ldp, ic);
      return;
    }

    // Apply the style
    BeforeAfter ba = new BeforeAfter();
    palette
        .getListSc()
        .applyListStyle(
            ic.getListStyleName(),
            ic.getListLevel(),
            bOrdered,
            "true".equals(node.getAttribute(XMLString.TEXT_CONTINUE_NUMBERING)),
            ba);

    // Export the list
    if (ba.getBefore().length() > 0) {
      ldp.append(ba.getBefore()).nl();
    }
    traverseList(node, ldp, ic);
    if (ba.getAfter().length() > 0) {
      ldp.append(ba.getAfter()).nl();
    }
  }