Package org.apache.poi.hslf.record

Examples of org.apache.poi.hslf.record.StyleTextPropAtom$CharFlagsTextProp


      // All there
      return;
    }

    // Create a new one at the right size
    _styleAtom = new StyleTextPropAtom(getRawText().length() + 1);

    // Use the TextHeader atom to get at the parent
    RecordContainer runAtomsParent = _headerAtom.getParentRecord();

    // Add the new StyleTextPropAtom after the TextCharsAtom / TextBytesAtom
View Full Code Here


        0x01 , 0x00, 0x01 , 0x00 , 0x00, 0x00 , 0x01 , 0x00 , 0x14 , 0x00
    };
    private int data_d_text_len = 0xA0-1;

    public void testRecordType() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    StyleTextPropAtom stpc = new StyleTextPropAtom(data_c,0,data_c.length);
    assertEquals(4001l, stpa.getRecordType());
    assertEquals(4001l, stpb.getRecordType());
    assertEquals(4001l, stpc.getRecordType());
  }
View Full Code Here

    assertEquals(4001l, stpc.getRecordType());
  }


  public void testCharacterStyleCounts() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);

    // Set for the appropriate text sizes
    stpa.setParentTextSize(data_a_text_len);
    stpb.setParentTextSize(data_b_text_len);

    // In case A, there is a single styling of the characters
    assertEquals(3, stpa.getCharacterStyles().size());
    // In case B, there are 5 different stylings
    assertEquals(5, stpb.getCharacterStyles().size());
  }
View Full Code Here

    // In case B, there are 5 different stylings
    assertEquals(5, stpb.getCharacterStyles().size());
  }

  public void testParagraphStyleCounts() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);

    // Set for the appropriate text sizes
    stpa.setParentTextSize(data_a_text_len);
    stpb.setParentTextSize(data_b_text_len);

    // In case A, all has the same spacing and alignment
    assertEquals(1, stpa.getParagraphStyles().size());
    // In case B, all 4 sets have different alignments
    assertEquals(4, stpb.getParagraphStyles().size());
  }
View Full Code Here

    assertEquals(4, stpb.getParagraphStyles().size());
  }


  public void testCharacterStyleLengths() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);

    // Set for the appropriate text sizes
    stpa.setParentTextSize(data_a_text_len);
    stpb.setParentTextSize(data_b_text_len);

    // 54 chars, 21 + 17 + 16
    LinkedList a_ch_l = stpa.getCharacterStyles();
    TextPropCollection a_ch_1 = (TextPropCollection)a_ch_l.get(0);
    TextPropCollection a_ch_2 = (TextPropCollection)a_ch_l.get(1);
    TextPropCollection a_ch_3 = (TextPropCollection)a_ch_l.get(2);
    assertEquals(21, a_ch_1.getCharactersCovered());
    assertEquals(17, a_ch_2.getCharactersCovered());
    assertEquals(16, a_ch_3.getCharactersCovered());

    // 179 chars, 30 + 28 + 25
    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
    assertEquals(30, b_ch_1.getCharactersCovered());
View Full Code Here

    assertEquals(96, b_ch_4.getCharactersCovered());
  }


  public void testCharacterPropOrdering() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
   
View Full Code Here

    assertEquals("font.size", tp_4_3.getName());
    assertEquals(24, tp_4_3.getValue());
  }

  public void testParagraphProps() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);
   
    LinkedList b_p_l = stpb.getParagraphStyles();
    TextPropCollection b_p_1 = (TextPropCollection)b_p_l.get(0);
    TextPropCollection b_p_2 = (TextPropCollection)b_p_l.get(1);
    TextPropCollection b_p_3 = (TextPropCollection)b_p_l.get(2);
    TextPropCollection b_p_4 = (TextPropCollection)b_p_l.get(3);
   
View Full Code Here

    assertEquals(0, tp_4_1.getValue());
    assertEquals(80, tp_4_2.getValue());
  }

  public void testCharacterProps() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
View Full Code Here

    // The value should now be 3
    assertEquals(0x0003, cf_4_1.getValue());
  }
 
  public void testFindAddTextProp() {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    LinkedList b_p_l = stpb.getParagraphStyles();
    TextPropCollection b_p_1 = (TextPropCollection)b_p_l.get(0);
    TextPropCollection b_p_2 = (TextPropCollection)b_p_l.get(1);
    TextPropCollection b_p_3 = (TextPropCollection)b_p_l.get(2);
    TextPropCollection b_p_4 = (TextPropCollection)b_p_l.get(3);
   
    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
View Full Code Here

   * Try to recreate an existing StyleTextPropAtom (a) from the empty
   *  constructor, and setting the required properties
   */
  public void testCreateAFromScatch() throws Exception {
    // Start with an empty one
    StyleTextPropAtom stpa = new StyleTextPropAtom(54);
   
    // Don't need to touch the paragraph styles
    // Add two more character styles
    LinkedList cs = stpa.getCharacterStyles();
   
    // First char style is boring, and 21 long
    TextPropCollection tpca = (TextPropCollection)cs.get(0);
    tpca.updateTextSize(21);
   
    // Second char style is coloured, 00 00 00 05, and 17 long
    TextPropCollection tpcb = stpa.addCharacterTextPropCollection(17);
    TextProp tpb = tpcb.addWithName("font.color");
    tpb.setValue(0x05000000);
   
    // Third char style is coloured, FF 33 00 FE, and 16 long
    TextPropCollection tpcc = stpa.addCharacterTextPropCollection(16);
    TextProp tpc = tpcc.addWithName("font.color");
    tpc.setValue(0xFE0033FF);
   
    // Should now be the same as data_a
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    stpa.writeOut(baos);
    byte[] b = baos.toByteArray();

    assertEquals(data_a.length, b.length);
    for(int i=0; i<data_a.length; i++) {
      assertEquals(data_a[i],b[i]);
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.record.StyleTextPropAtom$CharFlagsTextProp

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.