Examples of CharFlagsTextProp


Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        int font1 = master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        int font2 = master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        assertEquals("Arial", env.getFontCollection().getFontWithId(font1));
        assertEquals("Georgia", env.getFontCollection().getFontWithId(font2));

        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        //now paragraph attributes
        assertEquals(0x266B, master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
        assertEquals(0x2022, master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        SlideShow ppt = new SlideShow(new HSLFSlideShow(home + "/slide_master.ppt"));
        TitleMaster[] master = ppt.getTitleMasters();
        assertEquals(1, master.length);

        assertEquals(32, master[0].getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "font.size", true).getValue());
        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "char_flags", true);
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        assertEquals(20, master[0].getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "font.size", true).getValue());
        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "char_flags", true);
        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

    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);

    // 1st is bold
    CharFlagsTextProp cf_1_1 = (CharFlagsTextProp)b_ch_1.getTextPropList().get(0);
    assertEquals(true,cf_1_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
    assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
   
    // 2nd is italic
    CharFlagsTextProp cf_2_1 = (CharFlagsTextProp)b_ch_2.getTextPropList().get(0);
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
    assertEquals(true,cf_2_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
    assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

    // 3rd is normal, so lacks a CharFlagsTextProp
    assertFalse(b_ch_3.getTextPropList().get(0) instanceof CharFlagsTextProp);
   
    // 4th is underlined
    CharFlagsTextProp cf_4_1 = (CharFlagsTextProp)b_ch_4.getTextPropList().get(0);
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
    assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
   
    // The value for this should be 4
    assertEquals(0x0004, cf_4_1.getValue());
   
    // Now make the 4th bold, italic and not underlined
    cf_4_1.setSubValue(true, CharFlagsTextProp.BOLD_IDX);
    cf_4_1.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
    cf_4_1.setSubValue(false, CharFlagsTextProp.UNDERLINE_IDX);
   
    assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
    assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
    assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
   
    // The value should now be 3
    assertEquals(0x0003, cf_4_1.getValue());
  }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

    TextPropCollection tpca = (TextPropCollection)cs.get(0);
    tpca.updateTextSize(30);
   
    tp = tpca.addWithName("font.size");
    tp.setValue(20);
    CharFlagsTextProp cftp = (CharFlagsTextProp)
      tpca.addWithName("char_flags");
    assertEquals(0, cftp.getValue());
    cftp.setSubValue(true, CharFlagsTextProp.BOLD_IDX);
    assertEquals(1, cftp.getValue());
   
    // Second is 28 long, blue and italic
    TextPropCollection tpcb = stpa.addCharacterTextPropCollection(28);
   
    tp = tpcb.addWithName("font.size");
    tp.setValue(20);
    tp = tpcb.addWithName("font.color");
    tp.setValue(0x05000000);
    cftp = (CharFlagsTextProp)tpcb.addWithName("char_flags");
    cftp.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
    assertEquals(2, cftp.getValue());
   
    // Third is 25 long and red
    TextPropCollection tpcc = stpa.addCharacterTextPropCollection(25);
   
    tp = tpcc.addWithName("font.size");
    tp.setValue(20);
    tp = tpcc.addWithName("font.color");
    tp.setValue(0xfe0033ff);
   
    // Fourth is 96 long, underlined and different+bigger font
    TextPropCollection tpcd = stpa.addCharacterTextPropCollection(96);
   
    tp = tpcd.addWithName("font.size");
    tp.setValue(24);
    tp = tpcd.addWithName("font.index");
    tp.setValue(1);
    cftp = (CharFlagsTextProp)tpcd.addWithName("char_flags");
    cftp.setSubValue(true, CharFlagsTextProp.UNDERLINE_IDX);
    assertEquals(4, cftp.getValue());
   
    // Fifth is 1 long, underlined and different+bigger font + red
    TextPropCollection tpce = stpa.addCharacterTextPropCollection(1);
   
    tp = tpce.addWithName("font.size");
    tp.setValue(24);
    tp = tpce.addWithName("font.index");
    tp.setValue(1);
    tp = tpce.addWithName("font.color");
    tp.setValue(0xfe0033ff);
    cftp = (CharFlagsTextProp)tpce.addWithName("char_flags");
    cftp.setSubValue(true, CharFlagsTextProp.UNDERLINE_IDX);
    assertEquals(4, cftp.getValue());
   
   
    // Check it's as expected
    assertEquals(4, stpa.getParagraphStyles().size());
    assertEquals(5, stpa.getCharacterStyles().size());
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        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);

        // 1st is bold
        CharFlagsTextProp cf_1_1 = (CharFlagsTextProp)b_ch_1.getTextPropList().get(0);
        assertEquals(true,cf_1_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // 2nd is italic
        CharFlagsTextProp cf_2_1 = (CharFlagsTextProp)b_ch_2.getTextPropList().get(0);
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true,cf_2_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // 3rd is normal, so lacks a CharFlagsTextProp
        assertFalse(b_ch_3.getTextPropList().get(0) instanceof CharFlagsTextProp);

        // 4th is underlined
        CharFlagsTextProp cf_4_1 = (CharFlagsTextProp)b_ch_4.getTextPropList().get(0);
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // The value for this should be 4
        assertEquals(0x0004, cf_4_1.getValue());

        // Now make the 4th bold, italic and not underlined
        cf_4_1.setSubValue(true, CharFlagsTextProp.BOLD_IDX);
        cf_4_1.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
        cf_4_1.setSubValue(false, CharFlagsTextProp.UNDERLINE_IDX);

        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // The value should now be 3
        assertEquals(0x0003, cf_4_1.getValue());
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        TextPropCollection tpca = (TextPropCollection)cs.get(0);
        tpca.updateTextSize(30);

        tp = tpca.addWithName("font.size");
        tp.setValue(20);
        CharFlagsTextProp cftp = (CharFlagsTextProp)
            tpca.addWithName("char_flags");
        assertEquals(0, cftp.getValue());
        cftp.setSubValue(true, CharFlagsTextProp.BOLD_IDX);
        assertEquals(1, cftp.getValue());

        // Second is 28 long, blue and italic
        TextPropCollection tpcb = stpa.addCharacterTextPropCollection(28);

        tp = tpcb.addWithName("font.size");
        tp.setValue(20);
        tp = tpcb.addWithName("font.color");
        tp.setValue(0x05000000);
        cftp = (CharFlagsTextProp)tpcb.addWithName("char_flags");
        cftp.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
        assertEquals(2, cftp.getValue());

        // Third is 25 long and red
        TextPropCollection tpcc = stpa.addCharacterTextPropCollection(25);

        tp = tpcc.addWithName("font.size");
        tp.setValue(20);
        tp = tpcc.addWithName("font.color");
        tp.setValue(0xfe0033ff);

        // Fourth is 96 long, underlined and different+bigger font
        TextPropCollection tpcd = stpa.addCharacterTextPropCollection(96);

        tp = tpcd.addWithName("font.size");
        tp.setValue(24);
        tp = tpcd.addWithName("font.index");
        tp.setValue(1);
        cftp = (CharFlagsTextProp)tpcd.addWithName("char_flags");
        cftp.setSubValue(true, CharFlagsTextProp.UNDERLINE_IDX);
        assertEquals(4, cftp.getValue());

        // Fifth is 1 long, underlined and different+bigger font + red
        TextPropCollection tpce = stpa.addCharacterTextPropCollection(1);

        tp = tpce.addWithName("font.size");
        tp.setValue(24);
        tp = tpce.addWithName("font.index");
        tp.setValue(1);
        tp = tpce.addWithName("font.color");
        tp.setValue(0xfe0033ff);
        cftp = (CharFlagsTextProp)tpce.addWithName("char_flags");
        cftp.setSubValue(true, CharFlagsTextProp.UNDERLINE_IDX);
        assertEquals(4, cftp.getValue());


        // Check it's as expected
        assertEquals(4, stpa.getParagraphStyles().size());
        assertEquals(5, stpa.getCharacterStyles().size());
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        int font1 = master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        int font2 = master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "font.index", true).getValue();
        assertEquals("Arial", env.getFontCollection().getFontWithId(font1));
        assertEquals("Georgia", env.getFontCollection().getFontWithId(font2));

        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[1].getStyleAttribute(TextHeaderAtom.TITLE_TYPE, 0, "char_flags", true);
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        //now paragraph attributes
        assertEquals(0x266B, master[0].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
        assertEquals(0x2022, master[1].getStyleAttribute(TextHeaderAtom.BODY_TYPE, 0, "bullet.char", false).getValue());
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        SlideShow ppt = new SlideShow(_slTests.openResourceAsStream("slide_master.ppt"));
        TitleMaster[] master = ppt.getTitleMasters();
        assertEquals(1, master.length);

        assertEquals(32, master[0].getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "font.size", true).getValue());
        CharFlagsTextProp prop1 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.CENTER_TITLE_TYPE, 0, "char_flags", true);
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(true, prop1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        assertEquals(20, master[0].getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "font.size", true).getValue());
        CharFlagsTextProp prop2 = (CharFlagsTextProp)master[0].getStyleAttribute(TextHeaderAtom.CENTRE_BODY_TYPE, 0, "char_flags", true);
        assertEquals(true, prop2.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false, prop2.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        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);

        // 1st is bold
        CharFlagsTextProp cf_1_1 = (CharFlagsTextProp)b_ch_1.getTextPropList().get(0);
        assertEquals(true,cf_1_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(false,cf_1_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // 2nd is italic
        CharFlagsTextProp cf_2_1 = (CharFlagsTextProp)b_ch_2.getTextPropList().get(0);
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true,cf_2_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(false,cf_2_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // 3rd is normal, so lacks a CharFlagsTextProp
        assertFalse(b_ch_3.getTextPropList().get(0) instanceof CharFlagsTextProp);

        // 4th is underlined
        CharFlagsTextProp cf_4_1 = (CharFlagsTextProp)b_ch_4.getTextPropList().get(0);
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // The value for this should be 4
        assertEquals(0x0004, cf_4_1.getValue());

        // Now make the 4th bold, italic and not underlined
        cf_4_1.setSubValue(true, CharFlagsTextProp.BOLD_IDX);
        cf_4_1.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
        cf_4_1.setSubValue(false, CharFlagsTextProp.UNDERLINE_IDX);

        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.BOLD_IDX));
        assertEquals(true,cf_4_1.getSubValue(CharFlagsTextProp.ITALIC_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_1_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.ENABLE_NUMBERING_2_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RELIEF_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.RESET_NUMBERING_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.SHADOW_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.STRIKETHROUGH_IDX));
        assertEquals(false,cf_4_1.getSubValue(CharFlagsTextProp.UNDERLINE_IDX));

        // The value should now be 3
        assertEquals(0x0003, cf_4_1.getValue());
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.textproperties.CharFlagsTextProp

        TextPropCollection tpca = (TextPropCollection)cs.get(0);
        tpca.updateTextSize(30);

        tp = tpca.addWithName("font.size");
        tp.setValue(20);
        CharFlagsTextProp cftp = (CharFlagsTextProp)
            tpca.addWithName("char_flags");
        assertEquals(0, cftp.getValue());
        cftp.setSubValue(true, CharFlagsTextProp.BOLD_IDX);
        assertEquals(1, cftp.getValue());

        // Second is 28 long, blue and italic
        TextPropCollection tpcb = stpa.addCharacterTextPropCollection(28);

        tp = tpcb.addWithName("font.size");
        tp.setValue(20);
        tp = tpcb.addWithName("font.color");
        tp.setValue(0x05000000);
        cftp = (CharFlagsTextProp)tpcb.addWithName("char_flags");
        cftp.setSubValue(true, CharFlagsTextProp.ITALIC_IDX);
        assertEquals(2, cftp.getValue());

        // Third is 25 long and red
        TextPropCollection tpcc = stpa.addCharacterTextPropCollection(25);

        tp = tpcc.addWithName("font.size");
        tp.setValue(20);
        tp = tpcc.addWithName("font.color");
        tp.setValue(0xfe0033ff);

        // Fourth is 96 long, underlined and different+bigger font
        TextPropCollection tpcd = stpa.addCharacterTextPropCollection(96);

        tp = tpcd.addWithName("font.size");
        tp.setValue(24);
        tp = tpcd.addWithName("font.index");
        tp.setValue(1);
        cftp = (CharFlagsTextProp)tpcd.addWithName("char_flags");
        cftp.setSubValue(true, CharFlagsTextProp.UNDERLINE_IDX);
        assertEquals(4, cftp.getValue());

        // Fifth is 1 long, underlined and different+bigger font + red
        TextPropCollection tpce = stpa.addCharacterTextPropCollection(1);

        tp = tpce.addWithName("font.size");
        tp.setValue(24);
        tp = tpce.addWithName("font.index");
        tp.setValue(1);
        tp = tpce.addWithName("font.color");
        tp.setValue(0xfe0033ff);
        cftp = (CharFlagsTextProp)tpce.addWithName("char_flags");
        cftp.setSubValue(true, CharFlagsTextProp.UNDERLINE_IDX);
        assertEquals(4, cftp.getValue());


        // Check it's as expected
        assertEquals(4, stpa.getParagraphStyles().size());
        assertEquals(5, stpa.getCharacterStyles().size());
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.