Examples of OdfWhitespaceProcessor


Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

   * @return the text displayed in this cell
   */
  public String getDisplayText() {
    //TODO: This function doesn't work well if a cell contains a list.
    //Refer to testGetSetTextValue();
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    return textProcessor.getText(mCellElement);
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

    if (content == null) {
      content = "";
    }
    removeContent();

    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    OdfTextParagraph para = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
    textProcessor.append(para, content);

    mCellElement.appendChild(para);
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

    if (content == null) {
      content = "";
    }
    removeContent();

    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    OdfTextParagraph para = new OdfTextParagraph((OdfFileDom) mCellElement.getOwnerDocument());
    if ((stylename != null) && (stylename.length() > 0)) {
      para.setStyleName(stylename);
    }
    textProcessor.append(para, content);

    mCellElement.appendChild(para);
  }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

   *
   * @param fromCell  another cell whose content will be appended to this cell
   */
  void appendContentFrom(OdfTableCell fromCell) {
    splitRepeatedCells();
    OdfWhitespaceProcessor textProcess = new OdfWhitespaceProcessor();
    TableTableCellElementBase cell = fromCell.getOdfElement();
    Node node = cell.getFirstChild();
    while (node != null) {
      if (node instanceof OdfTextParagraph) {
        if (!textProcess.getText(node).equals("")) {
          mCellElement.appendChild(node.cloneNode(true));
        }
      } else {
        mCellElement.appendChild(node.cloneNode(true));
      }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

    OdfElement element = null;

    if (selected != null) {
      OdfElement containerElement = selected.getContainerElement();
      int index = selected.getIndex();
      OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
      String content = textProcessor.getText(containerElement);

      int nextIndex = -1;
      Pattern pattern = Pattern.compile(mPatternText);
      Matcher matcher = pattern.matcher(content);
      //start from the end index of the selected item
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

      }
    }

    OdfElement containerElement = selected.getContainerElement();
    int index = selected.getIndex();
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    String content = textProcessor.getText(containerElement);

    int nextIndex = -1;
    Pattern pattern = Pattern.compile(mPatternText);
    Matcher matcher = pattern.matcher(content);
    //start from the end index of the selected item
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

   */
  @Override
  public boolean match(Node element) {
    if (element instanceof OdfElement) {
      if (mMatchedElementName.indexOf(element.getNodeName()) != -1) {
        OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
        String content = textProcessor.getText(element);

        Pattern pattern = Pattern.compile(mPatternText);
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()) {
          // here just consider \n\r\t occupy one char
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

    }
    OdfElement container = getContainerElement();
    if (container == null) {
      return false;
    }
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();
    String content = textProcessor.getText(container);
    if (content.indexOf(mMatchedText, mIndexInContainer) == mIndexInContainer) {
      return true;
    } else {
      return false;
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

    if ((fromindex == 0) && (leftLength == 0)) {
      return;
    }
    int nodeLength = 0;
    Node node = pNode.getFirstChild();
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();

    while (node != null) {
      if ((fromindex == 0) && (leftLength == 0)) {
        return;
      }
      if (node.getNodeType() == Node.TEXT_NODE) {
        nodeLength = node.getNodeValue().length();
      } else if (node.getNodeType() == Node.ELEMENT_NODE) {
        if (node.getLocalName().equals("s")) // text:s
        {
          try {
            nodeLength = Integer.parseInt(((Element) node).getAttributeNS(OdfDocumentNamespace.TEXT.getUri(), "c"));
          } catch (Exception e) {
            nodeLength = 1;
          }

        } else if (node.getLocalName().equals("line-break")) {
          nodeLength = 1;
        } else if (node.getLocalName().equals("tab")) {
          nodeLength = 1;
        } else {
          nodeLength = textProcessor.getText((OdfElement) node).length();
        }

      }
      if (nodeLength <= fromindex) {
        fromindex -= nodeLength;
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor

    if ((fromindex == 0) && (leftLength == 0)) {
      return;
    }
    int nodeLength = 0;
    Node node = pNode.getFirstChild();
    OdfWhitespaceProcessor textProcessor = new OdfWhitespaceProcessor();

    while (node != null) {
      if ((fromindex == 0) && (leftLength == 0)) {
        return;
      }
      if (node.getNodeType() == Node.TEXT_NODE) {
        nodeLength = node.getNodeValue().length();
      } else if (node.getNodeType() == Node.ELEMENT_NODE) {
        if (node.getLocalName().equals("s")) // text:s
        {
          try {
            nodeLength = Integer.parseInt(((Element) node).getAttributeNS(OdfDocumentNamespace.TEXT.getUri(), "c"));
          } catch (Exception e) {
            nodeLength = 1;
          }

        } else if (node.getLocalName().equals("line-break")) {
          nodeLength = 1;
        } else if (node.getLocalName().equals("tab")) {
          nodeLength = 1;
        } else {
          nodeLength = textProcessor.getText((OdfElement) node).length();
        }

      }
      if (nodeLength <= fromindex) {
        fromindex -= nodeLength;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.