diff --git a/src/ooxml/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java b/src/ooxml/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java index 09674abfe8..ced941ccb3 100644 --- a/src/ooxml/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java +++ b/src/ooxml/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java @@ -27,6 +27,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties * @author Yegor Kozlov */ public abstract class CharacterPropertyFetcher extends ParagraphPropertyFetcher { + public boolean isFetchingFromMaster = false; public CharacterPropertyFetcher(int level) { super(level); diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java index 82a29756a4..27ba5d701b 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java @@ -430,6 +430,8 @@ class RenderableShape { public Stroke applyStroke(Graphics2D graphics) { float lineWidth = (float) _shape.getLineWidth(); + if(lineWidth == 0.0f) lineWidth = 0.25f; // Both PowerPoint and OOo draw zero-length lines as 0.25pt + LineDash lineDash = _shape.getLineDash(); float[] dash = null; float dash_phase = 0; @@ -559,8 +561,6 @@ class RenderableShape { lst.add(new Outline(canvasShape, p)); } - // add any shape-specific stuff here (line decorations, etc.) - lst.addAll(_shape.getCustomOutlines()); return lst; } diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java index b7f1f3d389..cd3a925d54 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java @@ -35,12 +35,13 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTConnector; import org.openxmlformats.schemas.presentationml.x2006.main.CTConnectorNonVisual; import java.awt.Shape; +import java.awt.Graphics2D; +import java.awt.Color; import java.awt.geom.AffineTransform; import java.awt.geom.Ellipse2D; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -206,7 +207,8 @@ public class XSLFConnectorShape extends XSLFSimpleShape { LineEndLength tailLength = getLineTailLength(); LineEndWidth tailWidth = getLineTailWidth(); - double lineWidth = getLineWidth(); + double lineWidth = Math.max(2.5, getLineWidth()); + Rectangle2D anchor = getAnchor(); double x2 = anchor.getX() + anchor.getWidth(), y2 = anchor.getY() + anchor.getHeight(); @@ -264,7 +266,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape { LineEndLength headLength = getLineHeadLength(); LineEndWidth headWidth = getLineHeadWidth(); - double lineWidth = getLineWidth(); + double lineWidth = Math.max(2.5, getLineWidth()); Rectangle2D anchor = getAnchor(); double x1 = anchor.getX(), y1 = anchor.getY(); @@ -287,7 +289,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape { break; case STEALTH: case ARROW: - p = new Path(); + p = new Path(false, true); GeneralPath arrow = new GeneralPath(); arrow.moveTo((float) (lineWidth * 3 * scaleX), (float) (-lineWidth * scaleY * 2)); arrow.lineTo(0, 0); @@ -319,8 +321,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape { return shape == null ? null : new Outline(shape, p); } - @Override - List getCustomOutlines(){ + private List getDecorationOutlines(){ List lst = new ArrayList(); Outline head = getHeadDecoration(); @@ -339,4 +340,23 @@ public class XSLFConnectorShape extends XSLFSimpleShape { public XSLFShadow getShadow() { return null; } + + @Override + public void draw(Graphics2D graphics){ + super.draw(graphics); + + // draw line decorations + Color lineColor = getLineColor(); + if(lineColor != null) { + graphics.setPaint(lineColor); + for(Outline o : getDecorationOutlines()){ + if(o.getPath().isFilled()){ + graphics.fill(o.getOutline()); + } + if(o.getPath().isStroked()){ + graphics.draw(o.getOutline()); + } + } + } + } } \ No newline at end of file diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java index 3159ee98a4..1c68193476 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFGroupShape.java @@ -281,6 +281,11 @@ public class XSLFGroupShape extends XSLFShape { graphics.translate(exterior.getX(), exterior.getY()); double scaleX = exterior.getWidth() / interior.getWidth(); double scaleY = exterior.getHeight() / interior.getHeight(); + + // group transform scales shapes but not fonts + Number prevFontScale = (Number)graphics.getRenderingHint(XSLFRenderingHint.FONT_SCALE); + graphics.setRenderingHint(XSLFRenderingHint.FONT_SCALE, Math.abs(1/scaleY)); + graphics.scale(scaleX, scaleY); graphics.translate(-interior.getX(), -interior.getY()); @@ -296,6 +301,9 @@ public class XSLFGroupShape extends XSLFShape { graphics.setTransform(at); graphics.setRenderingHint(XSLFRenderingHint.GRESTORE, true); } + + graphics.setRenderingHint(XSLFRenderingHint.FONT_SCALE, prevFontScale); + } } \ No newline at end of file diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java index 345d57c4b3..e8d70437ce 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java @@ -19,6 +19,8 @@ package org.apache.poi.xslf.usermodel; +import org.apache.poi.util.Internal; + import java.awt.RenderingHints; /** @@ -71,4 +73,7 @@ public class XSLFRenderingHint extends RenderingHints.Key { * draw text via {@link java.awt.font.TextLayout#draw(java.awt.Graphics2D, float, float)} */ public static final int TEXT_MODE_GLYPHS = 2; + + @Internal + public static final XSLFRenderingHint FONT_SCALE = new XSLFRenderingHint(5); } \ No newline at end of file diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java index 5e62ec87ea..92adf446e0 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java @@ -642,14 +642,6 @@ public abstract class XSLFSimpleShape extends XSLFShape { } - /** - * @return any shape-specific geometry that is not included in presetShapeDefinitions.xml - * (line decorations, etc) - */ - List getCustomOutlines(){ - return Collections.emptyList(); - } - /** * draw any content within this shape (image, text, etc.). * diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java index 4358288ee0..4608736398 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java @@ -26,6 +26,8 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTextField; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStop; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextTabStopList; import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharBullet; @@ -33,6 +35,8 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTColor; import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBulletSizePoint; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextLineBreak; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit; +import org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties; import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder; import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType; @@ -242,7 +246,7 @@ public class XSLFTextParagraph implements Iterable{ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTColor c = pr.isSetBuClr() ? pr.getBuClr() : pr.addNewBuClr(); CTSRgbColor clr = c.isSetSrgbClr() ? c.getSrgbClr() : c.addNewSrgbClr(); - clr.setVal(new byte[]{(byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()}); + clr.setVal(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); } public double getBulletFontSize(){ @@ -333,7 +337,45 @@ public class XSLFTextParagraph implements Iterable{ }; fetchParagraphProperty(fetcher); // if the marL attribute is omitted, then a value of 347663 is implied - return fetcher.getValue() == null ? Units.toPoints(347663) : fetcher.getValue(); + return fetcher.getValue() == null ? 0 : fetcher.getValue(); + } + + /** + * + * @return the default size for a tab character within this paragraph + */ + public double getDefaultTabSize(){ + ParagraphPropertyFetcher fetcher = new ParagraphPropertyFetcher(getLevel()){ + public boolean fetch(CTTextParagraphProperties props){ + if(props.isSetDefTabSz()){ + double val = Units.toPoints(props.getDefTabSz()); + setValue(val); + return true; + } + return false; + } + }; + fetchParagraphProperty(fetcher); + return fetcher.getValue() == null ? 0 : fetcher.getValue(); + } + + public double getTabStop(final int idx){ + ParagraphPropertyFetcher fetcher = new ParagraphPropertyFetcher(getLevel()){ + public boolean fetch(CTTextParagraphProperties props){ + if(props.isSetTabLst()){ + CTTextTabStopList tabStops = props.getTabLst(); + if(idx < tabStops.sizeOfTabArray() ) { + CTTextTabStop ts = tabStops.getTabArray(idx); + double val = Units.toPoints(ts.getPos()); + setValue(val); + return true; + } + } + return false; + } + }; + fetchParagraphProperty(fetcher); + return fetcher.getValue() == null ? getDefaultTabSize() : fetcher.getValue(); } /** @@ -389,7 +431,18 @@ public class XSLFTextParagraph implements Iterable{ } }; fetchParagraphProperty(fetcher); - return fetcher.getValue() == null ? 100 : fetcher.getValue(); + + double lnSpc = fetcher.getValue() == null ? 100 : fetcher.getValue(); + if(lnSpc > 0) { + // check if the percentage value is scaled + CTTextNormalAutofit normAutofit = getParentShape().getTextBodyPr().getNormAutofit(); + if(normAutofit != null) { + double scale = 1 - (double)normAutofit.getLnSpcReduction() / 100000; + lnSpc *= scale; + } + } + + return lnSpc; } /** @@ -443,7 +496,9 @@ public class XSLFTextParagraph implements Iterable{ } }; fetchParagraphProperty(fetcher); - return fetcher.getValue() == null ? 0 : fetcher.getValue(); + + double spcBef = fetcher.getValue() == null ? 0 : fetcher.getValue(); + return spcBef; } /** @@ -535,7 +590,7 @@ public class XSLFTextParagraph implements Iterable{ setValue(false); return true; } - if(props.isSetBuFont()){ + if(props.isSetBuFont() || props.isSetBuChar()){ setValue(true); return true; } @@ -596,7 +651,7 @@ public class XSLFTextParagraph implements Iterable{ width = anchor.getWidth() - leftInset - rightInset - leftMargin; if(firstLine) { if(isBullet()){ - width -= Math.abs(indent); + if(indent > 0) width -= indent; } else { if(indent > 0) width -= indent; // first line indentation else if (indent < 0) { // hanging indentation: the first line start at the left margin @@ -618,28 +673,25 @@ public class XSLFTextParagraph implements Iterable{ double leftMargin = getLeftMargin(); boolean firstLine = true; double indent = getIndent(); + + //The vertical line spacing + double spacing = getLineSpacing(); for(TextFragment line : _lines){ - double penX = x; + double penX = x + leftMargin; if(firstLine) { - if(_bullet != null){ if(indent < 0) { // a negative value means "Hanging" indentation and // indicates the position of the actual bullet character. // (the bullet is shifted to right relative to the text) - _bullet.draw(graphics, penX, penY); - penX -= indent; + _bullet.draw(graphics, penX + indent, penY); } else if(indent > 0){ - penX += leftMargin; // a positive value means the "First Line" indentation: // the first line is indented and other lines start at the bullet ofset _bullet.draw(graphics, penX, penY); penX += indent; } else { - // no special indent. The first line behaves like all others - penX += leftMargin; - // a zero indent means that the bullet and text have the same offset _bullet.draw(graphics, penX, penY); @@ -647,19 +699,8 @@ public class XSLFTextParagraph implements Iterable{ penX += _bullet._layout.getAdvance() + 1; } } else { - if(indent < 0) { - // if bullet=false and indentation=hanging then the first line - // starts at the left offset (penX is not incremented) - } else if(indent > 0) { - // first line indent shifts penX - penX += indent + leftMargin; - } else { - // no special indent. The first line behaves like all others - penX += leftMargin; - } + penX += indent; } - } else { - penX += leftMargin; } @@ -671,14 +712,11 @@ public class XSLFTextParagraph implements Iterable{ penX += (anchor.getWidth() - line.getWidth() - leftInset - rightInset); break; default: - //penX += leftInset; break; } line.draw(graphics, penX, penY); - //The vertical line spacing - double spacing = getLineSpacing(); if(spacing > 0) { // If linespacing >= 0, then linespacing is a percentage of normal line height. penY += spacing*0.01* _maxLineHeight; @@ -689,6 +727,7 @@ public class XSLFTextParagraph implements Iterable{ firstLine = false; } + return penY - y; } @@ -722,6 +761,7 @@ public class XSLFTextParagraph implements Iterable{ } AttributedString getAttributedString(Graphics2D graphics){ + String text = getRenderableText(); AttributedString string = new AttributedString(text); @@ -740,7 +780,11 @@ public class XSLFTextParagraph implements Iterable{ // user can pass an object to convert fonts via a rendering hint string.addAttribute(TextAttribute.FAMILY, run.getFontFamily(), startIndex, endIndex); - string.addAttribute(TextAttribute.SIZE, (float)run.getFontSize(), startIndex, endIndex); + float fontSz = (float)run.getFontSize(); + Number fontScale = (Number)graphics.getRenderingHint(XSLFRenderingHint.FONT_SCALE); + if(fontScale != null) fontSz *= fontScale.floatValue(); + + string.addAttribute(TextAttribute.SIZE, fontSz , startIndex, endIndex); if(run.isBold()) { string.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIndex, endIndex); } @@ -768,30 +812,48 @@ public class XSLFTextParagraph implements Iterable{ return string; } + /** + * ensure that the paragraph contains at least one character + */ + private void ensureNotEmpty(){ + XSLFTextRun r = addNewTextRun(); + r.setText(" "); + CTTextCharacterProperties endPr = _p.getEndParaRPr(); + if(endPr != null) { + if(endPr.isSetSz()) r.setFontSize(endPr.getSz() / 100); + } + } + void breakText(Graphics2D graphics){ _lines = new ArrayList(); + // does this paragraph contain text? + boolean emptyParagraph = _runs.size() == 0; + + // ensure that the paragraph contains at least one character + if(_runs.size() == 0) ensureNotEmpty(); + String text = getRenderableText(); + if(text.length() == 0) return; + AttributedString at = getAttributedString(graphics); AttributedCharacterIterator it = at.getIterator(); - if(it.getBeginIndex() == it.getEndIndex()) { - return; - } LineBreakMeasurer measurer = new LineBreakMeasurer(it, graphics.getFontRenderContext()); for (;;) { int startIndex = measurer.getPosition(); double wrappingWidth = getWrappingWidth(_lines.size() == 0) + 1; // add a pixel to compensate rounding errors - + // shape width can be smaller that the sum of insets (proved by a test file) + if(wrappingWidth < 0) wrappingWidth = 1; int nextBreak = text.indexOf('\n', startIndex + 1); if(nextBreak == -1) nextBreak = it.getEndIndex(); TextLayout layout = measurer.nextLayout((float)wrappingWidth, nextBreak, true); - if (layout == null) { + if (layout == null) { // layout can be null if the entire word at the current position // does not fit within the wrapping width. Try with requireNextWord=false. layout = measurer.nextLayout((float)wrappingWidth, nextBreak, false); - } + } int endIndex = measurer.getPosition(); @@ -809,9 +871,10 @@ public class XSLFTextParagraph implements Iterable{ if(endIndex == it.getEndIndex()) break; } - if(isBullet()) { + if(isBullet() && !emptyParagraph) { String buCharacter = getBulletCharacter(); String buFont = getBulletFont(); + if(buFont == null) buFont = getTextRuns().get(0).getFontFamily(); if(buCharacter != null && buFont != null && _lines.size() > 0) { AttributedString str = new AttributedString(buCharacter); @@ -954,4 +1017,5 @@ public class XSLFTextParagraph implements Iterable{ r2.copy(r1); } } + } diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java index dc79e73c68..4f05caec95 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java @@ -29,8 +29,13 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties; import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType; import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType; +import org.openxmlformats.schemas.drawingml.x2006.main.STSchemeColorVal; import java.awt.Color; +import java.awt.font.FontRenderContext; +import java.awt.font.TextLayout; +import java.awt.font.TextAttribute; +import java.text.AttributedString; /** * Represents a run of text within the containing text body. The run element is the @@ -58,21 +63,54 @@ public class XSLFTextRun { String getRenderableText(){ String txt = _r.getT(); - switch (getTextCap()){ - case ALL: - txt = txt.toUpperCase(); - break; - case SMALL: - txt = txt.toLowerCase(); - break; + + StringBuffer buf = new StringBuffer(); + for(int i = 0; i < txt.length(); i++) { + char c = txt.charAt(i); + if(c == '\t') { + // replace tab with the effective number of white spaces + buf.append(" "); + } else { + switch (getTextCap()){ + case ALL: + buf.append(Character.toUpperCase(c)); + break; + case SMALL: + buf.append(Character.toLowerCase(c)); + break; + default: + buf.append(c); + } + } } - // TODO-1 is is the place to convert wingdings to unicode - - // TODO-2 this is a temporary hack. Rendering text with tabs is not yet supported. - // for now tabs are replaced with some number of spaces. - return txt.replace("\t", " "); + + return buf.toString(); } + /** + * Replace a tab with the effective number of white spaces. + * + * @return + */ + private String tab2space(){ + AttributedString string = new AttributedString(" "); + // user can pass an object to convert fonts via a rendering hint + string.addAttribute(TextAttribute.FAMILY, getFontFamily()); + + string.addAttribute(TextAttribute.SIZE, (float)getFontSize()); + TextLayout l = new TextLayout(string.getIterator(), new FontRenderContext(null, true, true)); + double wspace = l.getAdvance(); + + double tabSz = _p.getDefaultTabSize(); + + int numSpaces = (int)Math.ceil(tabSz / wspace); + StringBuffer buf = new StringBuffer(); + for(int i = 0; i < numSpaces; i++) { + buf.append(' '); + } + return buf.toString(); + } + public void setText(String text){ _r.setT(text); } @@ -98,13 +136,16 @@ public class XSLFTextRun { public Color getFontColor(){ final XSLFTheme theme = _p.getParentShape().getSheet().getTheme(); CTShapeStyle style = _p.getParentShape().getSpStyle(); - final CTSchemeColor shapeStyle = style == null ? null : style.getFontRef().getSchemeClr(); + final CTSchemeColor phClr = style == null ? null : style.getFontRef().getSchemeClr(); CharacterPropertyFetcher fetcher = new CharacterPropertyFetcher(_p.getLevel()){ public boolean fetch(CTTextCharacterProperties props){ CTSolidColorFillProperties solidFill = props.getSolidFill(); if(solidFill != null) { - Color c = new XSLFColor(solidFill, theme, shapeStyle).getColor(); + boolean useCtxColor = + (solidFill.isSetSchemeClr() && solidFill.getSchemeClr().getVal() == STSchemeColorVal.PH_CLR) + || isFetchingFromMaster; + Color c = new XSLFColor(solidFill, theme, useCtxColor ? phClr : null).getColor(); setValue(c); return true; } @@ -410,7 +451,10 @@ public class XSLFTextRun { ok = shape.fetchShapeProperty(fetcher); if(!ok) { CTTextParagraphProperties defaultProps = _p.getDefaultStyle(); - if(defaultProps != null) ok = fetcher.fetch(defaultProps); + if(defaultProps != null) { + fetcher.isFetchingFromMaster = true; + ok = fetcher.fetch(defaultProps); + } } } diff --git a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java b/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java index 455ceae909..bc3ae8619b 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java @@ -16,11 +16,7 @@ ==================================================================== */ package org.apache.poi.xslf; -import java.net.URI; -import java.util.List; - import junit.framework.TestCase; - import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.xslf.usermodel.XMLSlideShow; @@ -28,6 +24,9 @@ import org.apache.poi.xslf.usermodel.XSLFRelation; import org.apache.poi.xslf.usermodel.XSLFSlide; import org.apache.poi.xslf.usermodel.XSLFSlideLayout; +import java.net.URI; +import java.util.List; + public class TestXSLFBugs extends TestCase { public void test51187() throws Exception { diff --git a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java b/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java index 25f7012d37..f82ed00ce0 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFSlideShow.java @@ -17,7 +17,6 @@ package org.apache.poi.xslf; import junit.framework.TestCase; - import org.apache.poi.POIDataSamples; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; diff --git a/src/ooxml/testcases/org/apache/poi/xslf/XSLFTestDataSamples.java b/src/ooxml/testcases/org/apache/poi/xslf/XSLFTestDataSamples.java index b6966d06ef..b307144ff3 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/XSLFTestDataSamples.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/XSLFTestDataSamples.java @@ -16,14 +16,14 @@ ==================================================================== */ package org.apache.poi.xslf; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; - import org.apache.poi.POIDataSamples; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.xslf.usermodel.XMLSlideShow; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; + /** * @author Yegor Kozlov */ diff --git a/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java b/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java index f030f3b101..e2183a7246 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/extractor/TestXSLFPowerPointExtractor.java @@ -16,12 +16,11 @@ ==================================================================== */ package org.apache.poi.xslf.extractor; +import junit.framework.TestCase; import org.apache.poi.POIDataSamples; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.xslf.XSLFSlideShow; -import junit.framework.TestCase; - /** * Tests for HXFPowerPointExtractor */ diff --git a/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java b/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java index 1168003c94..47d2277712 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/geom/TestFormulaParser.java @@ -19,7 +19,10 @@ package org.apache.poi.xslf.geom; import junit.framework.TestCase; -import org.apache.poi.xslf.model.geom.*; +import org.apache.poi.xslf.model.geom.Context; +import org.apache.poi.xslf.model.geom.CustomGeometry; +import org.apache.poi.xslf.model.geom.Formula; +import org.apache.poi.xslf.model.geom.Guide; import org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D; /** diff --git a/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java b/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java index eefdd91b41..7f5e967ccc 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/geom/TestPresetGeometries.java @@ -19,7 +19,12 @@ package org.apache.poi.xslf.geom; import junit.framework.TestCase; -import org.apache.poi.xslf.model.geom.*; +import org.apache.poi.xslf.model.geom.Context; +import org.apache.poi.xslf.model.geom.CustomGeometry; +import org.apache.poi.xslf.model.geom.Guide; +import org.apache.poi.xslf.model.geom.IAdjustableShape; +import org.apache.poi.xslf.model.geom.Path; +import org.apache.poi.xslf.model.geom.PresetGeometries; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXMLSlideShow.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXMLSlideShow.java index e522c375df..0fc4b20aaa 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXMLSlideShow.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXMLSlideShow.java @@ -17,12 +17,9 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.apache.poi.POIDataSamples; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; -import org.apache.poi.xslf.usermodel.XMLSlideShow; -import org.apache.poi.xslf.usermodel.XSLFRelation; import org.openxmlformats.schemas.presentationml.x2006.main.CTNotesMasterIdListEntry; import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideIdListEntry; import org.openxmlformats.schemas.presentationml.x2006.main.CTSlideMasterIdListEntry; diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java index d29cb30662..0ca30a3b94 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java @@ -17,10 +17,9 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.apache.poi.util.Units; -import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType; import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType; +import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java index 108fca327b..a08faf0e38 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFColor.java @@ -17,15 +17,13 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.openxmlformats.schemas.drawingml.x2006.main.CTColor; -import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor; -import org.openxmlformats.schemas.drawingml.x2006.main.STSchemeColorVal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor; import org.openxmlformats.schemas.drawingml.x2006.main.CTHslColor; +import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor; import org.openxmlformats.schemas.drawingml.x2006.main.STPresetColorVal; +import org.openxmlformats.schemas.drawingml.x2006.main.STSchemeColorVal; -import java.awt.*; +import java.awt.Color; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java index dcfd479cc9..7ff45f5c8b 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFConnectorShape.java @@ -17,17 +17,9 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - -import org.apache.poi.util.Units; -import org.apache.poi.xslf.usermodel.LineCap; -import org.apache.poi.xslf.usermodel.LineDash; -import org.openxmlformats.schemas.drawingml.x2006.main.STLineCap; -import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal; +import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndLength; import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndType; import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndWidth; -import org.openxmlformats.schemas.drawingml.x2006.main.STLineEndLength; - -import java.awt.*; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFFreeformShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFFreeformShape.java index f52cc83dde..f212abeae4 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFFreeformShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFFreeformShape.java @@ -18,7 +18,7 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; -import java.awt.*; +import java.awt.Rectangle; import java.awt.geom.Ellipse2D; import java.awt.geom.GeneralPath; diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFGroupShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFGroupShape.java index 13e8eb84d4..7f11ecc762 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFGroupShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFGroupShape.java @@ -18,7 +18,7 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; -import java.awt.*; +import java.awt.Dimension; import java.awt.geom.Rectangle2D; /** diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFHyperlink.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFHyperlink.java index fe968b0b7f..33cf3225e7 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFHyperlink.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFHyperlink.java @@ -17,18 +17,11 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - -import java.awt.*; -import java.awt.geom.Ellipse2D; -import java.awt.geom.GeneralPath; -import java.util.*; -import java.util.List; -import java.net.URI; - -import org.apache.poi.xslf.XSLFTestDataSamples; -import org.apache.poi.xssf.usermodel.XSSFTable; import org.apache.poi.openxml4j.opc.PackageRelationship; import org.apache.poi.openxml4j.opc.TargetMode; +import org.apache.poi.xslf.XSLFTestDataSamples; + +import java.net.URI; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java index 9bd41025fb..61692dba40 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFPictureShape.java @@ -17,15 +17,11 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - -import java.awt.*; -import java.awt.geom.Ellipse2D; -import java.awt.geom.GeneralPath; -import java.util.*; -import java.util.List; - import org.apache.poi.xslf.XSLFTestDataSamples; +import java.util.Arrays; +import java.util.List; + /** * @author Yegor Kozlov */ diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShape.java index ecdcdd032d..e6c4728474 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFShape.java @@ -17,7 +17,6 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.apache.poi.xslf.XSLFTestDataSamples; import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType; diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSheet.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSheet.java index 88af770fef..d605a05198 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSheet.java @@ -17,7 +17,6 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.apache.poi.xslf.XSLFTestDataSamples; /** diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java index e4d4d553b0..f5839fd778 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSimpleShape.java @@ -17,16 +17,13 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.apache.poi.util.Units; -import org.apache.poi.xslf.usermodel.LineCap; -import org.apache.poi.xslf.usermodel.LineDash; import org.apache.poi.xslf.XSLFTestDataSamples; +import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor; import org.openxmlformats.schemas.drawingml.x2006.main.STLineCap; import org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor; -import java.awt.*; +import java.awt.Color; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java index d5e7c61c2b..f658e6b555 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlide.java @@ -17,14 +17,10 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - import org.apache.poi.xslf.XSLFTestDataSamples; -import org.apache.poi.openxml4j.opc.PackagePart; import java.awt.Color; -import java.util.List; import java.util.Arrays; -import java.util.regex.Pattern; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java index 46e10e45d8..c3057d590f 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShow.java @@ -17,13 +17,12 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; +import org.apache.poi.POIXMLDocumentPart; +import org.apache.poi.xslf.XSLFTestDataSamples; import java.awt.Dimension; import java.util.List; -import org.apache.poi.POIXMLDocumentPart; -import org.apache.poi.xslf.XSLFTestDataSamples; - /** * @author Yegor Kozlov */ diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java index a5cdb0d6ca..9a4144752a 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java @@ -17,16 +17,12 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - -import java.awt.*; -import java.awt.geom.Ellipse2D; -import java.awt.geom.GeneralPath; -import java.util.*; -import java.util.List; - import org.apache.poi.xslf.XSLFTestDataSamples; import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame; +import java.awt.Color; +import java.util.List; + /** * @author Yegor Kozlov */ diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableStyles.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableStyles.java index d1ca86be34..0feff27d25 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableStyles.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableStyles.java @@ -18,15 +18,6 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; -import java.awt.*; -import java.awt.geom.Ellipse2D; -import java.awt.geom.GeneralPath; -import java.util.*; -import java.util.List; - -import org.apache.poi.xslf.XSLFTestDataSamples; -import org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame; - /** * @author Yegor Kozlov */ diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java index c426fd15c0..6b9cf596e7 100755 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextParagraph.java @@ -2,13 +2,9 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; -import java.awt.Rectangle; import java.awt.Color; +import java.awt.Rectangle; import java.awt.geom.Rectangle2D; -import java.io.FileOutputStream; - -import org.apache.poi.xssf.dev.XSSFDump; -import org.apache.poi.xslf.util.PPTX2PNG; /** * Created by IntelliJ IDEA. diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java index 6347b63ccf..07e64de1eb 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java @@ -18,11 +18,11 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; import org.apache.poi.xslf.XSLFTestDataSamples; -import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType; -import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder; import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties; +import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder; +import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType; -import java.awt.*; +import java.awt.Color; /** * @author Yegor Kozlov diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java index b01c25e1d5..650bfcd0cf 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTheme.java @@ -17,8 +17,6 @@ package org.apache.poi.xslf.usermodel; import junit.framework.TestCase; - - import org.apache.poi.xslf.XSLFTestDataSamples; import java.awt.Color;