private int shapeId;\r
\r
private StyleTextProp9Atom styleTextProp9Atom;\r
+ \r
+ private boolean _dirty = false;\r
\r
/**\r
* Constructs a Text Run from a Unicode text block.\r
@Override\r
public void setLeftMargin(Double leftMargin) {\r
Integer val = (leftMargin == null) ? null : Units.pointsToMaster(leftMargin);\r
- setPropVal(_paragraphStyle, "text.offset", val);\r
+ setParagraphTextPropVal("text.offset", val);\r
}\r
\r
@Override\r
@Override\r
public void setIndent(Double indent) {\r
Integer val = (indent == null) ? null : Units.pointsToMaster(indent);\r
- setPropVal(_paragraphStyle, "bullet.offset", val);\r
+ setParagraphTextPropVal("bullet.offset", val);\r
}\r
\r
@Override\r
case JUSTIFY_LOW: alignInt = TextAlignmentProp.JUSTIFYLOW; break;\r
case THAI_DIST: alignInt = TextAlignmentProp.THAIDISTRIBUTED; break;\r
}\r
- setPropVal(_paragraphStyle, "alignment", alignInt);\r
+ setParagraphTextPropVal("alignment", alignInt);\r
}\r
\r
@Override\r
*/\r
public void setBulletChar(Character c) {\r
Integer val = (c == null) ? null : (int)c.charValue();\r
- setPropVal(_paragraphStyle, "bullet.char", val);\r
+ setParagraphTextPropVal("bullet.char", val);\r
}\r
\r
/**\r
*/\r
public void setBulletColor(Color color) {\r
Integer val = (color == null) ? null : new Color(color.getBlue(), color.getGreen(), color.getRed(), 254).getRGB();\r
- setPropVal(_paragraphStyle, "bullet.color", val);\r
+ setParagraphTextPropVal("bullet.color", val);\r
}\r
\r
/**\r
FontCollection fc = getSheet().getSlideShow().getFontCollection();\r
int idx = fc.addFont(typeface);\r
\r
- setPropVal(_paragraphStyle, "bullet.font", idx);\r
+ setParagraphTextPropVal("bullet.font", idx);\r
setFlag(ParagraphFlagsTextProp.BULLET_HARDFONT_IDX, true);\r
}\r
\r
if (dval != null) {\r
ival = (dval < 0) ? Units.pointsToMaster(dval) : dval.intValue();\r
}\r
- setPropVal(_paragraphStyle, propName, ival);\r
+ setParagraphTextPropVal(propName, ival);\r
}\r
\r
private boolean getFlag(int index) {\r
private void setFlag(int index, boolean value) {\r
BitMaskTextProp tp = (BitMaskTextProp)_paragraphStyle.addWithName(ParagraphFlagsTextProp.NAME);\r
tp.setSubValue(value, index);\r
+ setDirty();\r
}\r
\r
/**\r
throw new RuntimeException("failed dummy write", e);\r
}\r
}\r
+ \r
+ for (HSLFTextParagraph p : paragraphs) {\r
+ p._dirty = false;\r
+ }\r
}\r
\r
/**\r
}\r
return new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());\r
}\r
+\r
+ /**\r
+ * Sets the value of the given Paragraph TextProp, add if required\r
+ * @param propName The name of the Paragraph TextProp\r
+ * @param val The value to set for the TextProp\r
+ */\r
+ public void setParagraphTextPropVal(String propName, Integer val) {\r
+ setPropVal(_paragraphStyle, propName, val);\r
+ setDirty();\r
+ }\r
+ \r
+ /**\r
+ * marks this paragraph dirty, so its records will be renewed on save\r
+ */\r
+ public void setDirty() {\r
+ _dirty = true;\r
+ }\r
+ \r
+ public boolean isDirty() {\r
+ return _dirty;\r
+ }\r
}\r
package org.apache.poi.hslf.usermodel;
import static org.apache.poi.hslf.usermodel.HSLFTextParagraph.getPropVal;
-import static org.apache.poi.hslf.usermodel.HSLFTextParagraph.setPropVal;
import java.awt.Color;
*/
private void setCharFlagsTextPropVal(int index, boolean value) {
// TODO: check if paragraph/chars can be handled the same ...
- if (getFlag(index) != value) setFlag(index, value);
+ if (getFlag(index) != value) {
+ setFlag(index, value);
+ parentParagraph.setDirty();
+ }
}
/**
* @param val The value to set for the TextProp
*/
public void setCharTextPropVal(String propName, Integer val) {
- setPropVal(characterStyle, propName, val);
+ HSLFTextParagraph.setPropVal(characterStyle, propName, val);
+ parentParagraph.setDirty();
}
* @param val the percentage of the font size. If the value is positive, it is superscript, otherwise it is subscript
*/
public void setSuperscript(int val) {
- setPropVal(characterStyle, "superscript", val);
+ setCharTextPropVal("superscript", val);
}
@Override