Some general code-fixes found while trying out Java 9
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1742423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
56c5bd05e1
commit
8908412e3a
@ -65,7 +65,7 @@ public class KeyInfoKeySelector extends KeySelector implements KeySelectorResult
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
X509Data x509Data = (X509Data) keyInfoStructure;
|
X509Data x509Data = (X509Data) keyInfoStructure;
|
||||||
List<Object> x509DataList = x509Data.getContent();
|
List<?> x509DataList = x509Data.getContent();
|
||||||
for (Object x509DataObject : x509DataList) {
|
for (Object x509DataObject : x509DataList) {
|
||||||
if (!(x509DataObject instanceof X509Certificate)) {
|
if (!(x509DataObject instanceof X509Certificate)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -32,6 +32,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.xml.crypto.MarshalException;
|
import javax.xml.crypto.MarshalException;
|
||||||
|
import javax.xml.crypto.XMLStructure;
|
||||||
import javax.xml.crypto.dom.DOMStructure;
|
import javax.xml.crypto.dom.DOMStructure;
|
||||||
import javax.xml.crypto.dsig.dom.DOMSignContext;
|
import javax.xml.crypto.dsig.dom.DOMSignContext;
|
||||||
import javax.xml.crypto.dsig.keyinfo.KeyInfo;
|
import javax.xml.crypto.dsig.keyinfo.KeyInfo;
|
||||||
@ -77,7 +78,7 @@ public class KeyInfoSignatureFacet extends SignatureFacet {
|
|||||||
List<Object> x509DataObjects = new ArrayList<Object>();
|
List<Object> x509DataObjects = new ArrayList<Object>();
|
||||||
X509Certificate signingCertificate = signatureConfig.getSigningCertificateChain().get(0);
|
X509Certificate signingCertificate = signatureConfig.getSigningCertificateChain().get(0);
|
||||||
|
|
||||||
List<Object> keyInfoContent = new ArrayList<Object>();
|
List<XMLStructure> keyInfoContent = new ArrayList<XMLStructure>();
|
||||||
|
|
||||||
if (signatureConfig.isIncludeKeyValue()) {
|
if (signatureConfig.isIncludeKeyValue()) {
|
||||||
KeyValue keyValue;
|
KeyValue keyValue;
|
||||||
|
@ -117,56 +117,57 @@ public class PPTX2PNG {
|
|||||||
System.out.println("Processing " + file);
|
System.out.println("Processing " + file);
|
||||||
}
|
}
|
||||||
SlideShow<?,?> ss = SlideShowFactory.create(file, null, true);
|
SlideShow<?,?> ss = SlideShowFactory.create(file, null, true);
|
||||||
List<? extends Slide<?,?>> slides = ss.getSlides();
|
try {
|
||||||
|
List<? extends Slide<?, ?>> slides = ss.getSlides();
|
||||||
|
|
||||||
Set<Integer> slidenum = slideIndexes(slides.size(), slidenumStr);
|
Set<Integer> slidenum = slideIndexes(slides.size(), slidenumStr);
|
||||||
|
|
||||||
if (slidenum.isEmpty()) {
|
if (slidenum.isEmpty()) {
|
||||||
usage("slidenum must be either -1 (for all) or within range: [1.."+slides.size()+"] for "+file);
|
usage("slidenum must be either -1 (for all) or within range: [1.." + slides.size() + "] for " + file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dimension pgsize = ss.getPageSize();
|
||||||
|
int width = (int) (pgsize.width * scale);
|
||||||
|
int height = (int) (pgsize.height * scale);
|
||||||
|
|
||||||
|
for (Integer slideNo : slidenum) {
|
||||||
|
Slide<?, ?> slide = slides.get(slideNo);
|
||||||
|
String title = slide.getTitle();
|
||||||
|
if (!quiet) {
|
||||||
|
System.out.println("Rendering slide " + slideNo + (title == null ? "" : ": " + title));
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics2D graphics = img.createGraphics();
|
||||||
|
DrawFactory.getInstance(graphics).fixFonts(graphics);
|
||||||
|
|
||||||
|
// default rendering options
|
||||||
|
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||||
|
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||||
|
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
|
||||||
|
|
||||||
|
graphics.scale(scale, scale);
|
||||||
|
|
||||||
|
// draw stuff
|
||||||
|
slide.draw(graphics);
|
||||||
|
|
||||||
|
// save the result
|
||||||
|
if (!"null".equals(format)) {
|
||||||
|
String outname = file.getName().replaceFirst(".pptx?", "");
|
||||||
|
outname = String.format(Locale.ROOT, "%1$s-%2$04d.%3$s", outname, slideNo, format);
|
||||||
|
File outfile = new File(outdir, outname);
|
||||||
|
ImageIO.write(img, format, outfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
ss.close();
|
ss.close();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dimension pgsize = ss.getPageSize();
|
|
||||||
int width = (int) (pgsize.width * scale);
|
|
||||||
int height = (int) (pgsize.height * scale);
|
|
||||||
|
|
||||||
for(Integer slideNo : slidenum) {
|
|
||||||
Slide<?,?> slide = slides.get(slideNo);
|
|
||||||
String title = slide.getTitle();
|
|
||||||
if (!quiet) {
|
|
||||||
System.out.println("Rendering slide " + slideNo + (title == null ? "" : ": " + title));
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
Graphics2D graphics = img.createGraphics();
|
|
||||||
DrawFactory.getInstance(graphics).fixFonts(graphics);
|
|
||||||
|
|
||||||
// default rendering options
|
|
||||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
|
||||||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
|
||||||
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
|
|
||||||
|
|
||||||
graphics.scale(scale, scale);
|
|
||||||
|
|
||||||
// draw stuff
|
|
||||||
slide.draw(graphics);
|
|
||||||
|
|
||||||
// save the result
|
|
||||||
if (!"null".equals(format)) {
|
|
||||||
String outname = file.getName().replaceFirst(".pptx?", "");
|
|
||||||
outname = String.format(Locale.ROOT, "%1$s-%2$04d.%3$s", outname, slideNo, format);
|
|
||||||
File outfile = new File(outdir, outname);
|
|
||||||
ImageIO.write(img, format, outfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
System.out.println("Done");
|
System.out.println("Done");
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<Integer> slideIndexes(final int slideCount, String range) {
|
private static Set<Integer> slideIndexes(final int slideCount, String range) {
|
||||||
|
Loading…
Reference in New Issue
Block a user