package org.apache.poi.xslf.usermodel;\r
\r
import java.awt.geom.Rectangle2D;\r
-import java.util.Iterator;\r
-import java.util.List;\r
+import java.util.*;\r
import java.util.regex.Pattern;\r
\r
import org.apache.poi.openxml4j.opc.*;\r
* The container will be empty after this call returns.\r
*/\r
public void clear() {\r
- for(XSLFShape shape : getShapes()){\r
+ List<XSLFShape> shapes = new ArrayList<XSLFShape>(getShapes());\r
+ for(XSLFShape shape : shapes){\r
removeShape(shape);\r
}\r
}\r
for (CTGradientStop cgs : gs) {\r
cs[i] = new XSLFColor(cgs, theme, phClr).getColorStyle();\r
fractions[i] = cgs.getPos() / 100000.f;\r
+ i++;\r
}\r
\r
return new GradientPaint() {\r
* The container will be empty after this call returns.
*/
public void clear() {
- for(XSLFShape shape : getShapes()){
+ List<XSLFShape> shapes = new ArrayList<XSLFShape>(getShapes());
+ for(XSLFShape shape : shapes){
removeShape(shape);
}
}
* @return line propeties from the theme of null\r
*/\r
CTLineProperties getDefaultLineProperties() {\r
- CTLineProperties ln = null;\r
CTShapeStyle style = getSpStyle();\r
- if (style != null) {\r
- // 1-based index of a line style within the style matrix\r
- int idx = (int) style.getLnRef().getIdx();\r
- CTStyleMatrix styleMatrix = getSheet().getTheme().getXmlObject().getThemeElements().getFmtScheme();\r
- ln = styleMatrix.getLnStyleLst().getLnArray(idx - 1);\r
- }\r
- return ln;\r
+ if (style == null) return null;\r
+ CTStyleMatrixReference lnRef = style.getLnRef();\r
+ if (lnRef == null) return null;\r
+ // 1-based index of a line style within the style matrix\r
+ int idx = (int)lnRef.getIdx();\r
+ \r
+ XSLFTheme theme = getSheet().getTheme();\r
+ if (theme == null) return null;\r
+ CTBaseStyles styles = theme.getXmlObject().getThemeElements();\r
+ if (styles == null) return null;\r
+ CTStyleMatrix styleMatrix = styles.getFmtScheme();\r
+ if (styleMatrix == null) return null;\r
+ CTLineStyleList lineStyles = styleMatrix.getLnStyleLst();\r
+ if (lineStyles == null || lineStyles.sizeOfLnArray() < idx) return null;\r
+ \r
+ return lineStyles.getLnArray(idx - 1);\r
}\r
\r
/**\r
} else {\r
CTPresetLineDashProperties val = CTPresetLineDashProperties.Factory\r
.newInstance();\r
- val.setVal(STPresetLineDashVal.Enum.forInt(dash.ordinal() + 1));\r
+ val.setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId));\r
CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr\r
.addNewLn();\r
ln.setPrstDash(val);\r
if (ln != null) {\r
CTPresetLineDashProperties ctDash = ln.getPrstDash();\r
if (ctDash != null) {\r
- setValue(LineDash.values()[ctDash.getVal().intValue() - 1]);\r
+ setValue(LineDash.fromOoxmlId(ctDash.getVal().intValue()));\r
return true;\r
}\r
}\r
if (defaultLn != null) {\r
CTPresetLineDashProperties ctDash = defaultLn.getPrstDash();\r
if (ctDash != null) {\r
- dash = LineDash.values()[ctDash.getVal().intValue() - 1];\r
+ dash = LineDash.fromOoxmlId(ctDash.getVal().intValue());\r
}\r
}\r
}\r
} else {\r
CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr\r
.addNewLn();\r
- ln.setCap(STLineCap.Enum.forInt(cap.ordinal() + 1));\r
+ ln.setCap(STLineCap.Enum.forInt(cap.ooxmlId));\r
}\r
}\r
\r
if (ln != null) {\r
STLineCap.Enum stCap = ln.getCap();\r
if (stCap != null) {\r
- setValue(LineCap.values()[stCap.intValue() - 1]);\r
+ setValue(LineCap.fromOoxmlId(stCap.intValue()));\r
return true;\r
}\r
}\r
if (defaultLn != null) {\r
STLineCap.Enum stCap = defaultLn.getCap();\r
if (stCap != null) {\r
- cap = LineCap.values()[stCap.intValue() - 1];\r
+ cap = LineCap.fromOoxmlId(stCap.intValue());\r
}\r
}\r
}\r
if (style == null) {\r
if (lnEnd.isSetType()) lnEnd.unsetType();\r
} else {\r
- lnEnd.setType(STLineEndType.Enum.forInt(style.ordinal() + 1));\r
+ lnEnd.setType(STLineEndType.Enum.forInt(style.ooxmlId));\r
}\r
}\r
\r
if (ln == null || !ln.isSetHeadEnd()) return DecorationShape.NONE;\r
\r
STLineEndType.Enum end = ln.getHeadEnd().getType();\r
- return end == null ? DecorationShape.NONE : DecorationShape.values()[end.intValue() - 1];\r
+ return end == null ? DecorationShape.NONE : DecorationShape.fromOoxmlId(end.intValue());\r
}\r
\r
/**\r
if (style == null) {\r
if (lnEnd.isSetW()) lnEnd.unsetW();\r
} else {\r
- lnEnd.setW(STLineEndWidth.Enum.forInt(style.ordinal() + 1));\r
+ lnEnd.setW(STLineEndWidth.Enum.forInt(style.ooxmlId));\r
}\r
}\r
\r
if (ln == null || !ln.isSetHeadEnd()) return DecorationSize.MEDIUM;\r
\r
STLineEndWidth.Enum w = ln.getHeadEnd().getW();\r
- return w == null ? DecorationSize.MEDIUM : DecorationSize.values()[w.intValue() - 1];\r
+ return w == null ? DecorationSize.MEDIUM : DecorationSize.fromOoxmlId(w.intValue());\r
}\r
\r
/**\r
if (style == null) {\r
if (lnEnd.isSetLen()) lnEnd.unsetLen();\r
} else {\r
- lnEnd.setLen(STLineEndLength.Enum.forInt(style.ordinal() + 1));\r
+ lnEnd.setLen(STLineEndLength.Enum.forInt(style.ooxmlId));\r
}\r
}\r
\r
if (ln == null || !ln.isSetHeadEnd()) return DecorationSize.MEDIUM;\r
\r
STLineEndLength.Enum len = ln.getHeadEnd().getLen();\r
- return len == null ? DecorationSize.MEDIUM : DecorationSize.values()[len.intValue() - 1];\r
+ return len == null ? DecorationSize.MEDIUM : DecorationSize.fromOoxmlId(len.intValue());\r
}\r
\r
/**\r
if (style == null) {\r
if (lnEnd.isSetType()) lnEnd.unsetType();\r
} else {\r
- lnEnd.setType(STLineEndType.Enum.forInt(style.ordinal() + 1));\r
+ lnEnd.setType(STLineEndType.Enum.forInt(style.ooxmlId));\r
}\r
}\r
\r
if (ln == null || !ln.isSetTailEnd()) return DecorationShape.NONE;\r
\r
STLineEndType.Enum end = ln.getTailEnd().getType();\r
- return end == null ? DecorationShape.NONE : DecorationShape.values()[end.intValue() - 1];\r
+ return end == null ? DecorationShape.NONE : DecorationShape.fromOoxmlId(end.intValue());\r
}\r
\r
/**\r
if (style == null) {\r
if (lnEnd.isSetW()) lnEnd.unsetW();\r
} else {\r
- lnEnd.setW(STLineEndWidth.Enum.forInt(style.ordinal() + 1));\r
+ lnEnd.setW(STLineEndWidth.Enum.forInt(style.ooxmlId));\r
}\r
}\r
\r
if (ln == null || !ln.isSetTailEnd()) return DecorationSize.MEDIUM;\r
\r
STLineEndWidth.Enum w = ln.getTailEnd().getW();\r
- return w == null ? DecorationSize.MEDIUM : DecorationSize.values()[w.intValue() - 1];\r
+ return w == null ? DecorationSize.MEDIUM : DecorationSize.fromOoxmlId(w.intValue());\r
}\r
\r
/**\r
if (style == null) {\r
if (lnEnd.isSetLen()) lnEnd.unsetLen();\r
} else {\r
- lnEnd.setLen(STLineEndLength.Enum.forInt(style.ordinal() + 1));\r
+ lnEnd.setLen(STLineEndLength.Enum.forInt(style.ooxmlId));\r
}\r
}\r
\r
if (ln == null || !ln.isSetTailEnd()) return DecorationSize.MEDIUM;\r
\r
STLineEndLength.Enum len = ln.getTailEnd().getLen();\r
- return len == null ? DecorationSize.MEDIUM : DecorationSize.values()[len.intValue() - 1];\r
+ return len == null ? DecorationSize.MEDIUM : DecorationSize.fromOoxmlId(len.intValue());\r
}\r
\r
public boolean isPlaceholder() {\r
==================================================================== */
package org.apache.poi.xslf.usermodel;
+import java.awt.Graphics2D;
import java.io.IOException;
import org.apache.poi.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.sl.draw.DrawFactory;
+import org.apache.poi.sl.draw.Drawable;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.util.Beta;
import org.apache.xmlbeans.XmlException;
int idx = getSlideShow().getSlides().indexOf(this);
return (idx == -1) ? idx : idx+1;
}
+
+ /**
+ * Render this sheet into the supplied graphics object
+ *
+ * @param graphics
+ */
+ @Override
+ public void draw(Graphics2D graphics){
+ DrawFactory drawFact = DrawFactory.getInstance(graphics);
+ Drawable draw = drawFact.getDrawable(this);
+ draw.draw(graphics);
+ }
}
\r
@Override\r
public void setIndent(Double indent){\r
- if (indent == null && !_p.isSetPPr()) return;\r
+ if ((indent == null || indent == -1d) && !_p.isSetPPr()) return;\r
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();\r
if(indent == -1) {\r
if(pr.isSetIndent()) pr.unsetIndent();\r
if(isBullet() == flag) return;\r
\r
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();\r
- if(!flag) {\r
- pr.addNewBuNone();\r
- } else {\r
+ if(flag) {\r
pr.addNewBuFont().setTypeface("Arial");\r
pr.addNewBuChar().setChar("\u2022");\r
+ } else {\r
+ if (pr.isSetBuFont()) pr.unsetBuFont();\r
+ if (pr.isSetBuChar()) pr.unsetBuChar();\r
+ if (pr.isSetBuAutoNum()) pr.unsetBuAutoNum();\r
+ if (pr.isSetBuBlip()) pr.unsetBuBlip();\r
+ if (pr.isSetBuClr()) pr.unsetBuClr();\r
+ if (pr.isSetBuClrTx()) pr.unsetBuClrTx();\r
+ if (pr.isSetBuFont()) pr.unsetBuFont();\r
+ if (pr.isSetBuFontTx()) pr.unsetBuFontTx();\r
+ if (pr.isSetBuSzPct()) pr.unsetBuSzPct();\r
+ if (pr.isSetBuSzPts()) pr.unsetBuSzPts();\r
+ if (pr.isSetBuSzTx()) pr.unsetBuSzTx();\r
+ pr.addNewBuNone();\r
}\r
}\r
\r
}\r
}\r
\r
- double leftMargin = p.getLeftMargin();\r
+ Double leftMargin = p.getLeftMargin();\r
if(leftMargin != getLeftMargin()){\r
setLeftMargin(leftMargin);\r
}\r
\r
- double indent = p.getIndent();\r
+ Double indent = p.getIndent();\r
if(indent != getIndent()){\r
setIndent(indent);\r
}\r
\r
- double spaceAfter = p.getSpaceAfter();\r
+ Double spaceAfter = p.getSpaceAfter();\r
if(spaceAfter != getSpaceAfter()){\r
setSpaceAfter(spaceAfter);\r
}\r
- double spaceBefore = p.getSpaceBefore();\r
+ \r
+ Double spaceBefore = p.getSpaceBefore();\r
if(spaceBefore != getSpaceBefore()){\r
setSpaceBefore(spaceBefore);\r
}\r
- double lineSpacing = p.getLineSpacing();\r
+ \r
+ Double lineSpacing = p.getLineSpacing();\r
if(lineSpacing != getLineSpacing()){\r
setLineSpacing(lineSpacing);\r
}\r
import java.awt.Dimension;\r
import java.awt.Graphics2D;\r
import java.awt.image.BufferedImage;\r
+import java.io.File;\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
+import javax.imageio.ImageIO;\r
+\r
import org.apache.poi.sl.draw.Drawable;\r
import org.apache.poi.util.JvmBugs;\r
import org.apache.poi.xslf.XSLFTestDataSamples;\r
*/\r
public class TestPPTX2PNG {\r
@Test\r
- public void render(){\r
- String[] testFiles = {"layouts.pptx", "sample.pptx", "shapes.pptx",\r
- "themes.pptx", "backgrounds.pptx"};\r
+ public void render() throws Exception {\r
+ String[] testFiles = {"backgrounds.pptx","layouts.pptx", "sample.pptx", "shapes.pptx", "themes.pptx",};\r
for(String sampleFile : testFiles){\r
XMLSlideShow pptx = XSLFTestDataSamples.openSampleDocument(sampleFile);\r
Dimension pg = pptx.getPageSize();\r
+ int slideNo=1;\r
for(XSLFSlide slide : pptx.getSlides()){\r
- BufferedImage img = new BufferedImage(pg.width, pg.height, BufferedImage.TYPE_INT_RGB);\r
+ BufferedImage img = new BufferedImage(pg.width, pg.height, BufferedImage.TYPE_INT_ARGB);\r
Graphics2D graphics = img.createGraphics();\r
fixFonts(graphics);\r
slide.draw(graphics);\r
-\r
+ // ImageIO.write(img, "PNG", new File("build/tmp/"+sampleFile.replaceFirst(".pptx?", "-")+slideNo+".png"));\r
+ slideNo++;\r
}\r
}\r
}\r
XSLFTextParagraph p = shape.addNewTextParagraph();\r
assertEquals(1, shape.getTextParagraphs().size());\r
\r
- assertEquals(0., p.getIndent(), 0);\r
- assertEquals(0., p.getLeftMargin(), 0);\r
- assertEquals(100., p.getLineSpacing(), 0);\r
- assertEquals(0., p.getSpaceAfter(), 0);\r
- assertEquals(0., p.getSpaceBefore(), 0);\r
+ assertNull(p.getIndent());\r
+ assertEquals(0, p.getLeftMargin(), 0);\r
+ assertNull(p.getLineSpacing());\r
+ assertNull(p.getSpaceAfter());\r
+ assertNull(p.getSpaceBefore());\r
assertEquals(0, p.getIndentLevel());\r
\r
p.setIndent(2.0);\r
assertEquals(2.0, p.getIndent(), 0);\r
assertTrue(p.getXmlObject().getPPr().isSetIndent());\r
p.setIndent(-1d);\r
- assertEquals(0.0, p.getIndent(), 0);\r
+ assertNull(p.getIndent());\r
assertFalse(p.getXmlObject().getPPr().isSetIndent());\r
p.setIndent(10.0);\r
assertEquals(10., p.getIndent(), 0);\r
assertEquals(ShapeType.TRIANGLE, shape.getShapeType());\r
\r
for(ShapeType tp : ShapeType.values()) {\r
+ if (tp.ooxmlId == -1 || tp == ShapeType.SEAL) continue;\r
shape.setShapeType(tp);\r
assertEquals(tp, shape.getShapeType());\r
}\r
public class TestXSLFShapeContainer {\r
\r
@SuppressWarnings("unused")\r
- @Test\r
public void verifyContainer(XSLFShapeContainer container) {\r
container.clear();\r
assertEquals(0, container.getShapes().size());\r
assertEquals("accent1", s.getSpStyle().getFillRef().getSchemeClr().getVal().toString());\r
assertEquals(2.0, s.getLineWidth(), 0);\r
assertEquals(LineCap.FLAT, s.getLineCap());\r
- // YK: calculated color is slightly different from PowerPoint\r
- assertEquals(new Color(39, 64, 94), s.getLineColor());\r
+ assertEquals(new Color(79,129,189), s.getLineColor());\r
}\r
\r
XSLFSimpleShape s0 = (XSLFSimpleShape) shapes.get(0);\r
assertEquals(20000, ref1.getLumModArray(0).getVal());\r
assertEquals(80000, ref1.getLumOffArray(0).getVal());\r
assertEquals("accent1", ref1.getVal().toString());\r
- assertEquals(new Color(220, 230, 242), s1.getFillColor());\r
+ assertEquals(new Color(79, 129, 189), s1.getFillColor());\r
\r
// lighter 60%\r
XSLFSimpleShape s2 = (XSLFSimpleShape)shapes.get(2);\r
assertEquals(40000, ref2.getLumModArray(0).getVal());\r
assertEquals(60000, ref2.getLumOffArray(0).getVal());\r
assertEquals("accent1", ref2.getVal().toString());\r
- assertEquals(new Color(185, 205, 229), s2.getFillColor());\r
+ assertEquals(new Color(79, 129, 189), s2.getFillColor());\r
\r
// lighter 40%\r
XSLFSimpleShape s3 = (XSLFSimpleShape)shapes.get(3);\r
assertEquals(60000, ref3.getLumModArray(0).getVal());\r
assertEquals(40000, ref3.getLumOffArray(0).getVal());\r
assertEquals("accent1", ref3.getVal().toString());\r
- assertEquals(new Color(149, 179, 215), s3.getFillColor());\r
+ assertEquals(new Color(79, 129, 189), s3.getFillColor());\r
\r
// darker 25%\r
XSLFSimpleShape s4 = (XSLFSimpleShape)shapes.get(4);\r
assertEquals(0, ref4.sizeOfLumOffArray());\r
assertEquals(75000, ref4.getLumModArray(0).getVal());\r
assertEquals("accent1", ref3.getVal().toString());\r
- // YK: calculated color is slightly different from PowerPoint\r
- assertEquals(new Color(59, 97, 142), s4.getFillColor());\r
+ assertEquals(new Color(79, 129, 189), s4.getFillColor());\r
\r
XSLFSimpleShape s5 = (XSLFSimpleShape)shapes.get(5);\r
CTSchemeColor ref5 = s5.getSpPr().getSolidFill().getSchemeClr();\r
assertEquals(0, ref5.sizeOfLumOffArray());\r
assertEquals(50000, ref5.getLumModArray(0).getVal());\r
assertEquals("accent1", ref5.getVal().toString());\r
- // YK: calculated color is slightly different from PowerPoint\r
- assertEquals(new Color(40, 65, 95), s5.getFillColor());\r
+ assertEquals(new Color(79, 129, 189), s5.getFillColor());\r
}\r
\r
@Test\r
\r
int alpha = fill.getAlpha();\r
if (alpha != -1) {\r
- renderer.setAlpha(fill.getAlpha()/100000.f);\r
+ renderer.setAlpha(alpha/100000.f);\r
}\r
\r
Dimension dim = renderer.getDimension();\r
LineDash lineDash = strokeStyle.getLineDash();\r
if (lineDash == null) {\r
lineDash = LineDash.SOLID;\r
- lineWidth = 0.0f;\r
}\r
\r
int dashPatI[] = lineDash.pattern;\r
- float[] dashPatF = new float[dashPatI.length];\r
final float dash_phase = 0;\r
- for (int i=0; i<dashPatI.length; i++) {\r
- dashPatF[i] = dashPatI[i]*Math.max(1, lineWidth);\r
+ float[] dashPatF = null;\r
+ if (dashPatI != null) {\r
+ dashPatF = new float[dashPatI.length];\r
+ for (int i=0; i<dashPatI.length; i++) {\r
+ dashPatF[i] = dashPatI[i]*Math.max(1, lineWidth);\r
+ }\r
}\r
\r
LineCap lineCapE = strokeStyle.getLineCap();\r
Background bg = sheet.getBackground();\r
if(bg != null) {\r
DrawFactory drawFact = DrawFactory.getInstance(graphics);\r
- DrawBackground<Background> db = drawFact.getDrawable(bg);\r
+ Drawable db = drawFact.getDrawable(bg);\r
db.draw(graphics);\r
}\r
\r
* @param contentType the content type\r
*/\r
public void loadImage(InputStream data, String contentType) throws IOException {\r
- img = ImageIO.read(data);\r
+ img = convertBufferedImage(ImageIO.read(data));\r
}\r
\r
/**\r
* @param contentType the content type\r
*/\r
public void loadImage(byte data[], String contentType) throws IOException {\r
- img = ImageIO.read(new ByteArrayInputStream(data));\r
+ img = convertBufferedImage(ImageIO.read(new ByteArrayInputStream(data)));\r
}\r
\r
+ protected static BufferedImage convertBufferedImage(BufferedImage img) {\r
+ BufferedImage bi = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB);\r
+ Graphics g = bi.getGraphics();\r
+ g.drawImage(img, 0, 0, null);\r
+ g.dispose();\r
+ return bi;\r
+ }\r
+ \r
\r
/**\r
* @return the buffered image\r
* Represents the shape decoration that appears at the ends of lines.\r
*/\r
enum DecorationShape {\r
- NONE,\r
- TRIANGLE,\r
- STEALTH,\r
- DIAMOND,\r
- OVAL,\r
- ARROW\r
+ NONE(1),\r
+ TRIANGLE(2),\r
+ STEALTH(3),\r
+ DIAMOND(4),\r
+ OVAL(5),\r
+ ARROW(6);\r
+ \r
+ public final int ooxmlId;\r
+ \r
+ DecorationShape(int ooxmlId) {\r
+ this.ooxmlId = ooxmlId;\r
+ }\r
+ \r
+ public static DecorationShape fromOoxmlId(int ooxmlId) {\r
+ for (DecorationShape ds : values()) {\r
+ if (ds.ooxmlId == ooxmlId) return ds;\r
+ }\r
+ return null;\r
+ }\r
}\r
\r
enum DecorationSize {\r
- SMALL,\r
- MEDIUM,\r
- LARGE\r
+ SMALL(1),\r
+ MEDIUM(2),\r
+ LARGE(3);\r
+ \r
+ public final int ooxmlId;\r
+ \r
+ DecorationSize(int ooxmlId) {\r
+ this.ooxmlId = ooxmlId;\r
+ }\r
+ \r
+ public static DecorationSize fromOoxmlId(int ooxmlId) {\r
+ for (DecorationSize ds : values()) {\r
+ if (ds.ooxmlId == ooxmlId) return ds;\r
+ }\r
+ return null;\r
+ }\r
}\r
\r
/**\r
public interface StrokeStyle {
enum LineCap {
/** Rounded ends */
- ROUND,
+ ROUND(1),
/** Square protrudes by half line width */
- SQUARE,
+ SQUARE(2),
/** Line ends at end point*/
- FLAT;
+ FLAT(3);
+
+ public final int ooxmlId;
+
+ LineCap(int ooxmlId) {
+ this.ooxmlId = ooxmlId;
+ }
+
+ public static LineCap fromOoxmlId(int ooxmlId) {
+ for (LineCap lc : values()) {
+ if (lc.ooxmlId == ooxmlId) return lc;
+ }
+ return null;
+ }
}
/**
*/
enum LineDash {
/** Solid (continuous) pen - native 1 */
- SOLID(1, 1),
+ SOLID(1, 1, null),
/** square dot style - native 6 */
- DOT(6, 1,1),
+ DOT(6, 2, 1,1),
/** dash style - native 7 */
- DASH(7, 3,4),
+ DASH(7, 3, 3,4),
/** dash short dash - native 9*/
- DASH_DOT(9, 4,3,1,3),
+ DASH_DOT(9, 5, 4,3,1,3),
/** long dash style - native 8 */
- LG_DASH(8, 8,3),
+ LG_DASH(8, 4, 8,3),
/** long dash short dash - native 10 */
- LG_DASH_DOT(10, 8,3,1,3),
+ LG_DASH_DOT(10, 6, 8,3,1,3),
/** long dash short dash short dash - native 11 */
- LG_DASH_DOT_DOT(11, 8,3,1,3,1,3),
+ LG_DASH_DOT_DOT(11, 7, 8,3,1,3,1,3),
/** PS_DASH system dash style - native 2 */
- SYS_DASH(2, 2,2),
+ SYS_DASH(2, 8, 2,2),
/** PS_DOT system dash style - native 3 */
- SYS_DOT(3, 1,1),
+ SYS_DOT(3, 9, 1,1),
/** PS_DASHDOT system dash style - native 4 */
- SYS_DASH_DOT(4, 2,2,1,1),
+ SYS_DASH_DOT(4, 10, 2,2,1,1),
/** PS_DASHDOTDOT system dash style / native 5 */
- SYS_DASH_DOT_DOT(5, 2,2,1,1,1,1);
+ SYS_DASH_DOT_DOT(5, 11, 2,2,1,1,1,1);
public final int pattern[];
public final int nativeId;
+ public final int ooxmlId;
- LineDash(int nativeId, int... pattern) {
+ LineDash(int nativeId, int ooxmlId, int... pattern) {
this.nativeId = nativeId;
- this.pattern = (pattern == null || pattern.length == 0) ? new int[]{1} : pattern;
+ this.ooxmlId = ooxmlId;
+ this.pattern = (pattern == null || pattern.length == 0) ? null : pattern;
}
public static LineDash fromNativeId(int nativeId) {
}
return null;
}
+
+ public static LineDash fromOoxmlId(int ooxmlId) {
+ for (LineDash ld : values()) {
+ if (ld.ooxmlId == ooxmlId) return ld;
+ }
+ return null;
+ }
}
enum LineCompound {