1 17 18 19 20 package org.apache.fop.fo.properties; 21 import org.apache.fop.fo.Constants; 22 import org.apache.fop.fo.PropertyList; 23 24 29 public class VerticalAlignShorthandParser implements ShorthandParser, Constants { 30 31 34 public Property getValueForProperty(int propId, 35 Property property, 36 PropertyMaker maker, 37 PropertyList propertyList) { 38 int propVal = property.getEnum(); 39 switch (propVal) { 40 case EN_BASELINE: 41 switch (propId) { 42 case PR_ALIGNMENT_BASELINE: 43 return EnumProperty.getInstance(EN_BASELINE, "BASELINE"); 44 case PR_ALIGNMENT_ADJUST: 45 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 46 case PR_BASELINE_SHIFT: 47 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 48 case PR_DOMINANT_BASELINE: 49 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 50 } 51 case EN_TOP: 52 switch (propId) { 53 case PR_ALIGNMENT_BASELINE: 54 return EnumProperty.getInstance(EN_BEFORE_EDGE, "BEFORE_EDGE"); 55 case PR_ALIGNMENT_ADJUST: 56 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 57 case PR_BASELINE_SHIFT: 58 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 59 case PR_DOMINANT_BASELINE: 60 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 61 } 62 case EN_TEXT_TOP: 63 switch (propId) { 64 case PR_ALIGNMENT_BASELINE: 65 return EnumProperty.getInstance(EN_TEXT_BEFORE_EDGE, "TEXT_BEFORE_EDGE"); 66 case PR_ALIGNMENT_ADJUST: 67 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 68 case PR_BASELINE_SHIFT: 69 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 70 case PR_DOMINANT_BASELINE: 71 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 72 } 73 case EN_MIDDLE: 74 switch (propId) { 75 case PR_ALIGNMENT_BASELINE: 76 return EnumProperty.getInstance(EN_MIDDLE, "MIDDLE"); 77 case PR_ALIGNMENT_ADJUST: 78 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 79 case PR_BASELINE_SHIFT: 80 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 81 case PR_DOMINANT_BASELINE: 82 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 83 } 84 case EN_BOTTOM: 85 switch (propId) { 86 case PR_ALIGNMENT_BASELINE: 87 return EnumProperty.getInstance(EN_AFTER_EDGE, "AFTER_EDGE"); 88 case PR_ALIGNMENT_ADJUST: 89 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 90 case PR_BASELINE_SHIFT: 91 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 92 case PR_DOMINANT_BASELINE: 93 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 94 } 95 case EN_TEXT_BOTTOM: 96 switch (propId) { 97 case PR_ALIGNMENT_BASELINE: 98 return EnumProperty.getInstance(EN_TEXT_AFTER_EDGE, "TEXT_AFTER_EDGE"); 99 case PR_ALIGNMENT_ADJUST: 100 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 101 case PR_BASELINE_SHIFT: 102 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 103 case PR_DOMINANT_BASELINE: 104 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 105 } 106 case EN_SUB: 107 switch (propId) { 108 case PR_ALIGNMENT_BASELINE: 109 return EnumProperty.getInstance(EN_BASELINE, "BASELINE"); 110 case PR_ALIGNMENT_ADJUST: 111 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 112 case PR_BASELINE_SHIFT: 113 return new EnumLength(EnumProperty.getInstance(EN_SUB, "SUB")); 114 case PR_DOMINANT_BASELINE: 115 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 116 } 117 case EN_SUPER: 118 switch (propId) { 119 case PR_ALIGNMENT_BASELINE: 120 return EnumProperty.getInstance(EN_BASELINE, "BASELINE"); 121 case PR_ALIGNMENT_ADJUST: 122 return new EnumLength(EnumProperty.getInstance(EN_AUTO, "AUTO")); 123 case PR_BASELINE_SHIFT: 124 return new EnumLength(EnumProperty.getInstance(EN_SUPER, "SUPER")); 125 case PR_DOMINANT_BASELINE: 126 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 127 } 128 default: 129 switch (propId) { 130 case PR_ALIGNMENT_BASELINE: 131 return EnumProperty.getInstance(EN_BASELINE, "BASELINE"); 132 case PR_ALIGNMENT_ADJUST: 133 return property; 134 case PR_BASELINE_SHIFT: 135 return new EnumLength(EnumProperty.getInstance(EN_BASELINE, "BASELINE")); 136 case PR_DOMINANT_BASELINE: 137 return EnumProperty.getInstance(EN_AUTO, "AUTO"); 138 } 139 } 140 return null; 141 } 142 143 } 144 | Popular Tags |