Search in sources :

Example 1 with BitMaskTextProp

use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp in project poi by apache.

the class TextStyleListing method showTextProps.

public static void showTextProps(TextPropCollection tpc) {
    List<TextProp> textProps = tpc.getTextPropList();
    System.out.println("    Contains " + textProps.size() + " TextProps");
    for (int i = 0; i < textProps.size(); i++) {
        TextProp tp = textProps.get(i);
        System.out.println("      " + i + " - " + tp.getName());
        System.out.println("          = " + tp.getValue());
        System.out.println("          @ " + tp.getMask());
        if (tp instanceof BitMaskTextProp) {
            BitMaskTextProp bmtp = (BitMaskTextProp) tp;
            String[] subPropNames = bmtp.getSubPropNames();
            boolean[] subPropMatches = bmtp.getSubPropMatches();
            for (int j = 0; j < subPropNames.length; j++) {
                System.out.println("            -> " + j + " - " + subPropNames[j]);
                System.out.println("               " + j + " = " + subPropMatches[j]);
            }
        }
    }
}
Also used : BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp) BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp) TextProp(org.apache.poi.hslf.model.textproperties.TextProp)

Example 2 with BitMaskTextProp

use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp in project poi by apache.

the class HSLFTextRun method getFlag.

protected boolean getFlag(int index) {
    if (characterStyle == null) {
        return false;
    }
    BitMaskTextProp prop = (BitMaskTextProp) characterStyle.findByName(CharFlagsTextProp.NAME);
    if (prop == null || !prop.getSubPropMatches()[index]) {
        int txtype = parentParagraph.getRunType();
        HSLFSheet sheet = parentParagraph.getSheet();
        if (sheet != null) {
            HSLFMasterSheet master = sheet.getMasterSheet();
            if (master != null) {
                prop = (BitMaskTextProp) master.getStyleAttribute(txtype, parentParagraph.getIndentLevel(), CharFlagsTextProp.NAME, true);
            }
        } else {
            logger.log(POILogger.WARN, "MasterSheet is not available");
        }
    }
    return prop == null ? false : prop.getSubValue(index);
}
Also used : BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp) SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint) DrawPaint(org.apache.poi.sl.draw.DrawPaint)

Example 3 with BitMaskTextProp

use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp in project poi by apache.

the class HSLFTextRun method setFlag.

protected void setFlag(int index, boolean value) {
    BitMaskTextProp prop = (BitMaskTextProp) characterStyle.addWithName(CharFlagsTextProp.NAME);
    prop.setSubValue(value, index);
}
Also used : BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp)

Example 4 with BitMaskTextProp

use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp in project poi by apache.

the class HSLFTextParagraph method getMasterPropVal.

private TextProp getMasterPropVal(TextPropCollection props, TextPropCollection masterProps, String propName) {
    boolean isChar = props.getTextPropType() == TextPropType.character;
    // check if we can delegate to master for the property
    if (!isChar) {
        BitMaskTextProp maskProp = (BitMaskTextProp) props.findByName(ParagraphFlagsTextProp.NAME);
        boolean hardAttribute = (maskProp != null && maskProp.getValue() == 0);
        if (hardAttribute) {
            return null;
        }
    }
    String[] propNames = propName.split(",");
    if (masterProps == null) {
        HSLFSheet sheet = getSheet();
        int txtype = getRunType();
        HSLFMasterSheet master = sheet.getMasterSheet();
        if (master == null) {
            logger.log(POILogger.WARN, "MasterSheet is not available");
            return null;
        }
        for (String pn : propNames) {
            TextProp prop = master.getStyleAttribute(txtype, getIndentLevel(), pn, isChar);
            if (prop != null) {
                return prop;
            }
        }
    } else {
        for (String pn : propNames) {
            TextProp prop = masterProps.findByName(pn);
            if (prop != null) {
                return prop;
            }
        }
    }
    return null;
}
Also used : BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp) BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp) TextProp(org.apache.poi.hslf.model.textproperties.TextProp) ParagraphFlagsTextProp(org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp) DrawPaint(org.apache.poi.sl.draw.DrawPaint) SolidPaint(org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)

Example 5 with BitMaskTextProp

use of org.apache.poi.hslf.model.textproperties.BitMaskTextProp in project poi by apache.

the class HSLFTextParagraph method setFlag.

private void setFlag(int index, boolean value) {
    BitMaskTextProp tp = (BitMaskTextProp) _paragraphStyle.addWithName(ParagraphFlagsTextProp.NAME);
    tp.setSubValue(value, index);
    setDirty();
}
Also used : BitMaskTextProp(org.apache.poi.hslf.model.textproperties.BitMaskTextProp)

Aggregations

BitMaskTextProp (org.apache.poi.hslf.model.textproperties.BitMaskTextProp)5 TextProp (org.apache.poi.hslf.model.textproperties.TextProp)2 DrawPaint (org.apache.poi.sl.draw.DrawPaint)2 SolidPaint (org.apache.poi.sl.usermodel.PaintStyle.SolidPaint)2 ParagraphFlagsTextProp (org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp)1