Package org.apache.poi.hwpf.model

Examples of org.apache.poi.hwpf.model.PropertyNode


   *         second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end)
  {
    int x = min;
    PropertyNode node = (PropertyNode)rpl.get(x);
    while(node.getEnd() <= start && x < rpl.size()-1)
    {
      x++;
      node = (PropertyNode)rpl.get(x);
    }

    int y = x;
    node = (PropertyNode)rpl.get(y);
    while(node.getEnd() < end && y < rpl.size()-1)
    {
      y++;
      node = (PropertyNode)rpl.get(y);
    }
    return new int[]{x, y + 1};
View Full Code Here


    assertEquals(35, pDefs.size());

    // Check that the last paragraph ends where it should do
    assertEquals(531, u.getOverallRange().text().length());
    assertEquals(530, u.getCPSplitCalculator().getHeaderTextboxEnd());
    PropertyNode pLast = (PropertyNode)pDefs.get(34);
//    assertEquals(530, pLast.getEnd());

    // Only care about the first few really though
    PropertyNode p0 = (PropertyNode)pDefs.get(0);
    PropertyNode p1 = (PropertyNode)pDefs.get(1);
    PropertyNode p2 = (PropertyNode)pDefs.get(2);
    PropertyNode p3 = (PropertyNode)pDefs.get(3);
    PropertyNode p4 = (PropertyNode)pDefs.get(4);

    // 5 paragraphs should get us to the end of our text
    assertTrue(p0.getStart() < 408);
    assertTrue(p0.getEnd() < 408);
    assertTrue(p1.getStart() < 408);
    assertTrue(p1.getEnd() < 408);
    assertTrue(p2.getStart() < 408);
    assertTrue(p2.getEnd() < 408);
    assertTrue(p3.getStart() < 408);
    assertTrue(p3.getEnd() < 408);
    assertTrue(p4.getStart() < 408);
    assertTrue(p4.getEnd() < 408);

    // Paragraphs should match with lines
    assertEquals(
        0,
        p0.getStart()
View Full Code Here

   *         second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end)
  {
    int x = min;
    PropertyNode node = (PropertyNode)rpl.get(x);
    while(node.getEnd() <= start && x < rpl.size()-1)
    {
      x++;
      node = (PropertyNode)rpl.get(x);
    }

    int y = x;
    node = (PropertyNode)rpl.get(y);
    while(node.getEnd() < end && y < rpl.size()-1)
    {
      y++;
      node = (PropertyNode)rpl.get(y);
    }
    return new int[]{x, y + 1};
View Full Code Here

   *  file, including main text, footnotes, headers
   *  and comments
   */
  public Range getOverallRange() {
    // hack to get the ending cp of the document, Have to revisit this.
      PropertyNode p =  _tpt.getTextPieces().get(_tpt.getTextPieces().size() - 1);

      return new Range(0, p.getEnd(), this);
  }
View Full Code Here

   *         second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end)
  {
    int x = min;
    PropertyNode node = (PropertyNode)rpl.get(x);
    while(node.getEnd() <= start && x < rpl.size()-1)
    {
      x++;
      node = (PropertyNode)rpl.get(x);
    }

    int y = x;
    node = (PropertyNode)rpl.get(y);
    while(node.getEnd() < end && y < rpl.size()-1)
    {
      y++;
      node = (PropertyNode)rpl.get(y);
    }
    return new int[]{x, y + 1};
View Full Code Here

   * @return An int array of length 2. The first int is the start index and
   *         the second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end) {
    int x = min;
    PropertyNode node = (PropertyNode) rpl.get(x);
    while (node.getEnd() <= start && x < rpl.size() - 1) {
      x++;
      node = (PropertyNode) rpl.get(x);
    }

    if (node.getEnd() <= start) {
      return new int[] { rpl.size(), rpl.size() };
    }

    int y = x;
    node = (PropertyNode) rpl.get(y);
    while (node.getEnd() < end && y < rpl.size() - 1) {
      y++;
      node = (PropertyNode) rpl.get(y);
    }
    return new int[] { x, y + 1 };
  }
View Full Code Here

    assertEquals(35, pDefs.size());

    // Check that the last paragraph ends where it should do
    assertEquals(531, u.getOverallRange().text().length());
    assertEquals(530, u.getCPSplitCalculator().getHeaderTextboxEnd());
    PropertyNode pLast = (PropertyNode)pDefs.get(34);
//    assertEquals(530, pLast.getEnd());

    // Only care about the first few really though
    PropertyNode p0 = (PropertyNode)pDefs.get(0);
    PropertyNode p1 = (PropertyNode)pDefs.get(1);
    PropertyNode p2 = (PropertyNode)pDefs.get(2);
    PropertyNode p3 = (PropertyNode)pDefs.get(3);
    PropertyNode p4 = (PropertyNode)pDefs.get(4);

    // 5 paragraphs should get us to the end of our text
    assertTrue(p0.getStart() < 408);
    assertTrue(p0.getEnd() < 408);
    assertTrue(p1.getStart() < 408);
    assertTrue(p1.getEnd() < 408);
    assertTrue(p2.getStart() < 408);
    assertTrue(p2.getEnd() < 408);
    assertTrue(p3.getStart() < 408);
    assertTrue(p3.getEnd() < 408);
    assertTrue(p4.getStart() < 408);
    assertTrue(p4.getEnd() < 408);

    // Paragraphs should match with lines
    assertEquals(
        0,
        p0.getStart()
View Full Code Here

   *         second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end)
  {
    int x = min;
    PropertyNode node = (PropertyNode)rpl.get(x);
    while(node.getEnd() <= start && x < rpl.size()-1)
    {
      x++;
      node = (PropertyNode)rpl.get(x);
    }

    int y = x;
    node = (PropertyNode)rpl.get(y);
    while(node.getEnd() < end && y < rpl.size()-1)
    {
      y++;
      node = (PropertyNode)rpl.get(y);
    }
    return new int[]{x, y + 1};
View Full Code Here

   * @return An int array of length 2. The first int is the start index and
   *         the second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end) {
    int x = min;
    PropertyNode node = (PropertyNode) rpl.get(x);
    while (node.getEnd() <= start && x < rpl.size() - 1) {
      x++;
      node = (PropertyNode) rpl.get(x);
    }

    if (node.getEnd() <= start) {
      return new int[] { rpl.size(), rpl.size() };
    }

    int y = x;
    node = (PropertyNode) rpl.get(y);
    while (node.getEnd() < end && y < rpl.size() - 1) {
      y++;
      node = (PropertyNode) rpl.get(y);
    }
    return new int[] { x, y + 1 };
  }
View Full Code Here

   *         second int is the end index.
   */
  private int[] findRange(List rpl, int min, int start, int end)
  {
    int x = min;
    PropertyNode node = (PropertyNode)rpl.get(x);
    while(node.getEnd() <= start && x < rpl.size()-1)
    {
      x++;
      node = (PropertyNode)rpl.get(x);
    }

    int y = x;
    node = (PropertyNode)rpl.get(y);
    while(node.getEnd() < end && y < rpl.size()-1)
    {
      y++;
      node = (PropertyNode)rpl.get(y);
    }
    return new int[]{x, y + 1};
View Full Code Here

TOP

Related Classes of org.apache.poi.hwpf.model.PropertyNode

Copyright © 2018 www.massapicom. 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.