Package org.apache.poi.hslf.record

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


                   
            int size = (children[j-1] instanceof TextCharsAtom) ?
                    ((TextCharsAtom)children[j-1]).getText().length() :
                    ((TextBytesAtom)children[j-1]).getText().length();
                   
            StyleTextPropAtom tsp = (StyleTextPropAtom)children[j];
            tsp.setParentTextSize(size);
           
          } else {
            buf.append("Error! Couldn't find preceding TextAtom for style\n");
          }
         
View Full Code Here


            _txtbox.appendChildRecord(tha);

            TextCharsAtom tca = new TextCharsAtom();
            _txtbox.appendChildRecord(tca);

            StyleTextPropAtom sta = new StyleTextPropAtom(0);
            _txtbox.appendChildRecord(sta);

            _txtrun = new TextRun(tha,tca,sta);
            _txtrun._records = new Record[]{tha, tca, sta};
            _txtrun.setText("");
View Full Code Here

 
  public void testNotEnoughDataProp() throws Exception {
    // We don't have enough data in the record to cover
    //  all the properties the mask says we have
    // Make sure we just do the best we can
    StyleTextPropAtom stpc = new StyleTextPropAtom(data_c,0,data_c.length);
    stpc.setParentTextSize(data_c_text_len);
   
    // If we get here, we didn't break
  }
View Full Code Here

    /**
     * Check the test data for Bug 40143.
     */
    public void testBug40143() throws Exception {
        StyleTextPropAtom atom = new StyleTextPropAtom(data_d, 0, data_d.length);
        atom.setParentTextSize(data_d_text_len);

        TextPropCollection prprops = (TextPropCollection)atom.getParagraphStyles().getFirst();
        assertEquals(data_d_text_len+1, prprops.getCharactersCovered());
        assertEquals(1, prprops.getTextPropList().size()); //1 property found
        assertEquals(1, prprops.findByName("alignment").getValue());

        TextPropCollection chprops = (TextPropCollection)atom.getCharacterStyles().getFirst();
        assertEquals(data_d_text_len+1, chprops.getCharactersCovered());
        assertEquals(5, chprops.getTextPropList().size()); //5 properties found
        assertEquals(1, chprops.findByName("char_flags").getValue());
        assertEquals(1, chprops.findByName("font.index").getValue());
        assertEquals(20, chprops.findByName("font.size").getValue());
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

TOP

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

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.