Package org.apache.poi.hslf.model.textproperties

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


    protected TextProp[] getCharacterProps(int type, int level){
        if (level != 0 || type >= MAX_INDENT){
            return StyleTextPropAtom.characterTextPropTypes;
        } else
         return new TextProp[] {
        new CharFlagsTextProp(),
        new TextProp(2, 0x10000, "font.index"),
        new TextProp(2, 0x20000, "char_unknown_1"),
        new TextProp(4, 0x40000, "char_unknown_2"),
        new TextProp(2, 0x80000, "font.size"),
        new TextProp(2, 0x100000, "char_unknown_3"),
View Full Code Here


   * Fetch the value of the given flag in the CharFlagsTextProp.
   * Returns false if the CharFlagsTextProp isn't present, since the
   *  text property won't be set if there's no CharFlagsTextProp.
   */
  private boolean isCharFlagsTextPropVal(int index) {
        CharFlagsTextProp cftp = null;
        if (characterStyle != null){
            cftp = (CharFlagsTextProp)characterStyle.findByName("char_flags");
        }
        if (cftp == null){
            Sheet sheet = parentRun.getSheet();
            int txtype = parentRun.getRunType();
            SlideMaster master = (SlideMaster)sheet.getMasterSheet();
            cftp = (CharFlagsTextProp)master.getStyleAttribute(txtype, getIndentLevel(), "char_flags", true);
        }

    return cftp == null ? false : cftp.getSubValue(index);
  }
View Full Code Here

    if(characterStyle == null) {
      parentRun.ensureStyleAtomPresent();
      // characterStyle will now be defined
    }
   
    CharFlagsTextProp cftp = (CharFlagsTextProp)
      fetchOrAddTextProp(characterStyle, "char_flags");
    cftp.setSubValue(value,index);
  }
View Full Code Here

        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

        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

        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

        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

    protected TextProp[] getCharacterProps(int type, int level){
        if (level != 0 || type >= MAX_INDENT){
            return StyleTextPropAtom.characterTextPropTypes;
        }
        return new TextProp[] {
                new CharFlagsTextProp(),
                new TextProp(2, 0x10000, "font.index"),
                new TextProp(2, 0x20000, "char_unknown_1"),
                new TextProp(4, 0x40000, "char_unknown_2"),
                new TextProp(2, 0x80000, "font.size"),
                new TextProp(2, 0x100000, "char_unknown_3"),
View Full Code Here

        TextPropCollection b_ch_2 = b_ch_l.get(1);
        TextPropCollection b_ch_3 = b_ch_l.get(2);
        TextPropCollection b_ch_4 = 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

        TextPropCollection tpca = 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

Related Classes of org.apache.poi.hslf.model.textproperties.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.