private void createBlockAndLineProperties()

in fop-core/src/main/java/org/apache/fop/fo/FOPropertyMapping.java [1532:1724]


    private void createBlockAndLineProperties() {
        PropertyMaker m;

        // hyphenation-keep
        m  = new EnumProperty.Maker(PR_HYPHENATION_KEEP);
        m.setInherited(true);
        m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
        m.addEnum("column", getEnumProperty(EN_COLUMN, "COLUMN"));
        m.addEnum("page", getEnumProperty(EN_PAGE, "PAGE"));
        m.setDefault("auto");
        addPropertyMaker("hyphenation-keep", m);

        // hyphenation-ladder-count
        m  = new NumberProperty.Maker(PR_HYPHENATION_LADDER_COUNT);
        m.setInherited(true);
        m.addEnum("no-limit", getEnumProperty(EN_NO_LIMIT, "NO_LIMIT"));
        m.setDefault("no-limit");
        addPropertyMaker("hyphenation-ladder-count", m);

        // last-line-end-indent
        m  = new LengthProperty.Maker(PR_LAST_LINE_END_INDENT);
        m.setInherited(true);
        m.setDefault("0pt");
        m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
        addPropertyMaker("last-line-end-indent", m);

        // line-height
        m  = new LineHeightPropertyMaker(PR_LINE_HEIGHT);
        m.useGeneric(genericSpace);
        m.setInherited(true);
        m.addKeyword("normal", "1.2");
        m.setPercentBase(LengthBase.FONTSIZE);
        m.setDefault("normal", true);
        m.addShorthand(generics[PR_FONT]);
        addPropertyMaker("line-height", m);

        // line-height-shift-adjustment
        m  = new EnumProperty.Maker(PR_LINE_HEIGHT_SHIFT_ADJUSTMENT);
        m.setInherited(true);
        m.addEnum("consider-shifts", getEnumProperty(EN_CONSIDER_SHIFTS, "CONSIDER_SHIFTS"));
        m.addEnum("disregard-shifts", getEnumProperty(EN_DISREGARD_SHIFTS, "DISREGARD_SHIFTS"));
        m.setDefault("consider-shifts");
        addPropertyMaker("line-height-shift-adjustment", m);

        // line-stacking-strategy
        m  = new EnumProperty.Maker(PR_LINE_STACKING_STRATEGY);
        m.setInherited(true);
        m.addEnum("line-height", getEnumProperty(EN_LINE_HEIGHT, "LINE_HEIGHT"));
        m.addEnum("font-height", getEnumProperty(EN_FONT_HEIGHT, "FONT_HEIGHT"));
        m.addEnum("max-height", getEnumProperty(EN_MAX_HEIGHT, "MAX_HEIGHT"));
        m.setDefault("max-height");
        addPropertyMaker("line-stacking-strategy", m);

        // linefeed-treatment
        m  = new EnumProperty.Maker(PR_LINEFEED_TREATMENT);
        m.setInherited(true);
        m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE"));
        m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE"));
        m.addEnum("treat-as-space", getEnumProperty(EN_TREAT_AS_SPACE, "TREAT_AS_SPACE"));
        m.addEnum("treat-as-zero-width-space",
                  getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE,
                                  "TREAT_AS_ZERO_WIDTH_SPACE"));
        m.setDefault("treat-as-space");
        m.addShorthand(generics[PR_WHITE_SPACE]);
        addPropertyMaker("linefeed-treatment", m);

        // white-space-treatment
        m  = new EnumProperty.Maker(PR_WHITE_SPACE_TREATMENT);
        m.setInherited(true);
        m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE"));
        m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE"));
        m.addEnum("ignore-if-before-linefeed",
                  getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED,
                                  "IGNORE_IF_BEFORE_LINEFEED"));
        m.addEnum("ignore-if-after-linefeed",
                  getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED,
                                  "IGNORE_IF_AFTER_LINEFEED"));
        m.addEnum("ignore-if-surrounding-linefeed",
                  getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED,
                                  "IGNORE_IF_SURROUNDING_LINEFEED"));
        m.setDefault("ignore-if-surrounding-linefeed");
        m.addShorthand(generics[PR_WHITE_SPACE]);
        addPropertyMaker("white-space-treatment", m);

        // text-align TODO: make it a StringProperty with enums.
        m  = new EnumProperty.Maker(PR_TEXT_ALIGN) {
            @Override
            public Property get(int subpropId, PropertyList propertyList,
                    boolean bTryInherit, boolean bTryDefault) throws PropertyException {
                Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault);
                if (p != null) {
                    int pv = p.getEnum();
                    if ((pv == EN_LEFT) || (pv == EN_RIGHT)) {
                        p = calcWritingModeDependent(
                            pv, propertyList.get(Constants.PR_WRITING_MODE).getEnum());
                    }
                }
                return p;
            }
        };
        m.setInherited(true);
        m.addEnum("center", getEnumProperty(EN_CENTER, "CENTER"));
        m.addEnum("end", getEnumProperty(EN_END, "END"));
        m.addEnum("start", getEnumProperty(EN_START, "START"));
        m.addEnum("justify", getEnumProperty(EN_JUSTIFY, "JUSTIFY"));
        // [GA] must defer writing-mode relative mapping of left/right
        m.addEnum("left", getEnumProperty(EN_LEFT, "LEFT"));
        m.addEnum("right", getEnumProperty(EN_RIGHT, "RIGHT"));
        // [GA] inside and outside are not correctly implemented by the following mapping
        m.addEnum("inside", getEnumProperty(EN_START, "START"));
        m.addEnum("outside", getEnumProperty(EN_END, "END"));
        m.setDefault("start");
        addPropertyMaker("text-align", m);

        // text-align-last
        m  = new EnumProperty.Maker(PR_TEXT_ALIGN_LAST) {
            @Override
            public Property get(int subpropId, PropertyList propertyList,
                    boolean bTryInherit, boolean bTryDefault) throws PropertyException {
                Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault);
                if (p != null && p.getEnum() == EN_RELATIVE) {
                    //The default may have been returned, so check inherited value
                    p = propertyList.getNearestSpecified(PR_TEXT_ALIGN_LAST);
                    if (p.getEnum() == EN_RELATIVE) {
                        return calcRelative(propertyList);
                    }
                }
                return p;
            }
            private Property calcRelative(PropertyList propertyList) throws PropertyException {
                Property corresponding = propertyList.get(PR_TEXT_ALIGN);
                if (corresponding == null) {
                    return null;
                }
                int correspondingValue = corresponding.getEnum();
                if (correspondingValue == EN_JUSTIFY) {
                    return getEnumProperty(EN_START, "START");
                } else if (correspondingValue == EN_END) {
                    return getEnumProperty(EN_END, "END");
                } else if (correspondingValue == EN_START) {
                    return getEnumProperty(EN_START, "START");
                } else if (correspondingValue == EN_CENTER) {
                    return getEnumProperty(EN_CENTER, "CENTER");
                } else if (correspondingValue == EN_LEFT) {
                    return calcWritingModeDependent(
                        EN_LEFT, propertyList.get(Constants.PR_WRITING_MODE).getEnum());
                } else if (correspondingValue == EN_RIGHT) {
                    return calcWritingModeDependent(
                        EN_RIGHT, propertyList.get(Constants.PR_WRITING_MODE).getEnum());
                } else {
                    return null;
                }
            }
        };
        m.setInherited(false); //Actually it's "true" but the special PropertyMaker compensates
        // Note: both 'end', 'right' and 'outside' are mapped to END
        //       both 'start', 'left' and 'inside' are mapped to START
        m.addEnum("relative", getEnumProperty(EN_RELATIVE, "RELATIVE"));
        m.addEnum("center", getEnumProperty(EN_CENTER, "CENTER"));
        m.addEnum("end", getEnumProperty(EN_END, "END"));
        m.addEnum("right", getEnumProperty(EN_END, "END"));
        m.addEnum("start", getEnumProperty(EN_START, "START"));
        m.addEnum("left", getEnumProperty(EN_START, "START"));
        m.addEnum("justify", getEnumProperty(EN_JUSTIFY, "JUSTIFY"));
        m.addEnum("inside", getEnumProperty(EN_START, "START"));
        m.addEnum("outside", getEnumProperty(EN_END, "END"));
        m.setDefault("relative", true);
        addPropertyMaker("text-align-last", m);

        // text-indent
        m  = new LengthProperty.Maker(PR_TEXT_INDENT);
        m.setInherited(true);
        m.setDefault("0pt");
        m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
        addPropertyMaker("text-indent", m);

        // white-space-collapse
        m  = new EnumProperty.Maker(PR_WHITE_SPACE_COLLAPSE);
        m.useGeneric(genericBoolean);
        m.setInherited(true);
        m.setDefault("true");
        m.addShorthand(generics[PR_WHITE_SPACE]);
        addPropertyMaker("white-space-collapse", m);

        // wrap-option
        m  = new EnumProperty.Maker(PR_WRAP_OPTION);
        m.setInherited(true);
        m.addEnum("wrap", getEnumProperty(EN_WRAP, "WRAP"));
        m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP"));
        m.setDefault("wrap");
        m.addShorthand(generics[PR_WHITE_SPACE]);
        addPropertyMaker("wrap-option", m);
    }