| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
package net.sourceforge.jeuclid.elements.presentation.script; |
| 20 | |
|
| 21 | |
import net.sourceforge.jeuclid.Constants; |
| 22 | |
import net.sourceforge.jeuclid.LayoutContext; |
| 23 | |
import net.sourceforge.jeuclid.context.InlineLayoutContext; |
| 24 | |
import net.sourceforge.jeuclid.context.RelativeScriptlevelLayoutContext; |
| 25 | |
import net.sourceforge.jeuclid.elements.AbstractJEuclidElement; |
| 26 | |
|
| 27 | |
import org.apache.batik.dom.AbstractDocument; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
public abstract class AbstractScriptElement extends AbstractJEuclidElement { |
| 35 | |
|
| 36 | |
|
| 37 | |
public static final String ATTR_SUBSCRIPTSHIFT = "subscriptshift"; |
| 38 | |
|
| 39 | |
|
| 40 | |
public static final String ATTR_SUPERSCRIPTSHIFT = "superscriptshift"; |
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
public AbstractScriptElement(final String qname, final AbstractDocument odoc) { |
| 51 | 8569 | super(qname, odoc); |
| 52 | |
|
| 53 | 8569 | this.setDefaultMathAttribute(AbstractScriptElement.ATTR_SUBSCRIPTSHIFT, |
| 54 | |
Constants.ZERO); |
| 55 | 8569 | this.setDefaultMathAttribute( |
| 56 | |
AbstractScriptElement.ATTR_SUPERSCRIPTSHIFT, Constants.ZERO); |
| 57 | 8569 | } |
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
|
| 62 | |
public String getSubscriptshift() { |
| 63 | 2299 | return this.getMathAttribute(AbstractScriptElement.ATTR_SUBSCRIPTSHIFT); |
| 64 | |
} |
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
public void setSubscriptshift(final String subscriptshift) { |
| 71 | 0 | this.setAttribute(AbstractScriptElement.ATTR_SUBSCRIPTSHIFT, |
| 72 | |
subscriptshift); |
| 73 | 0 | } |
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
public String getSuperscriptshift() { |
| 79 | 2299 | return this |
| 80 | |
.getMathAttribute(AbstractScriptElement.ATTR_SUPERSCRIPTSHIFT); |
| 81 | |
} |
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | |
|
| 87 | |
public void setSuperscriptshift(final String superscriptshift) { |
| 88 | 0 | this.setAttribute(AbstractScriptElement.ATTR_SUPERSCRIPTSHIFT, |
| 89 | |
superscriptshift); |
| 90 | 0 | } |
| 91 | |
|
| 92 | |
|
| 93 | |
@Override |
| 94 | |
public LayoutContext getChildLayoutContext(final int childNum, |
| 95 | |
final LayoutContext context) { |
| 96 | 5643 | final LayoutContext now = this.applyLocalAttributesToContext(context); |
| 97 | 5643 | if (childNum == 0) { |
| 98 | 2299 | return now; |
| 99 | |
} else { |
| 100 | 3344 | return new RelativeScriptlevelLayoutContext( |
| 101 | |
new InlineLayoutContext(now), 1); |
| 102 | |
} |
| 103 | |
} |
| 104 | |
|
| 105 | |
} |