From fce876b4eff2f6629656648bf0e955b39ab79683 Mon Sep 17 00:00:00 2001 From: Andreas Beeker Date: Fri, 14 Dec 2018 00:44:40 +0000 Subject: [PATCH] merge trunk git-svn-id: https://svn.apache.org/repos/asf/poi/branches/hemf@1848906 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 387 +++++++---------- doap_POI.rdf | 7 + .../poi/xslf/usermodel/ChartFromScratch.java | 145 +++++++ .../usermodel/examples/ChartFromScratch.java | 140 +++++++ .../org/apache/poi/TestAllFiles.java | 1 + .../apache/poi/stress/XSSFFileHandler.java | 9 +- .../org/apache/poi/ddf/EscherProperties.java | 30 +- .../org/apache/poi/hpsf/VariantSupport.java | 2 +- .../poi/hpsf/wellknown/PropertyIDMap.java | 7 +- .../poi/hssf/model/InternalWorkbook.java | 2 + .../poi/hssf/record/RecordInputStream.java | 19 +- .../org/apache/poi/hssf/record/SSTRecord.java | 8 +- .../poi/hssf/record/SharedFormulaRecord.java | 6 +- .../hssf/record/SharedValueRecordBase.java | 12 +- .../crypt/ChunkedCipherOutputStream.java | 26 +- .../crypt/cryptoapi/CryptoAPIEncryptor.java | 8 +- .../poi/poifs/filesystem/FileMagic.java | 24 +- .../apache/poi/sl/draw/DrawBackground.java | 6 +- .../apache/poi/sl/draw/DrawFreeformShape.java | 36 +- .../org/apache/poi/sl/draw/DrawPaint.java | 125 +++--- .../apache/poi/sl/draw/DrawSimpleShape.java | 14 +- .../apache/poi/sl/draw/DrawTableShape.java | 6 +- .../apache/poi/sl/draw/PathGradientPaint.java | 47 ++- .../org/apache/poi/sl/draw/geom/Context.java | 22 +- .../poi/sl/draw/geom/PresetGeometries.java | 45 +- .../poi/sl/usermodel/FreeformShape.java | 15 +- .../poi/ss/formula/SheetNameFormatter.java | 11 +- .../SheetRangeAndWorkbookIndexFormatter.java | 73 ++++ .../ss/formula/functions/MatrixFunction.java | 2 +- .../apache/poi/ss/formula/ptg/Area3DPxg.java | 13 +- .../apache/poi/ss/formula/ptg/Ref3DPxg.java | 16 +- .../poi/util/RecordFormatException.java | 4 +- src/java/org/apache/poi/util/StringUtil.java | 2 +- src/java/org/apache/poi/util/Units.java | 2 +- .../apache/poi/ooxml/POIXMLDocumentPart.java | 2 +- .../extractor/CommandLineTextExtractor.java | 58 ++- .../poi/ooxml/util/POIXMLConstants.java | 1 + .../poi/openxml4j/opc/internal/ZipHelper.java | 2 - .../util/ZipInputStreamZipEntrySource.java | 2 +- .../crypt/dsig/SignatureOutputStream.java | 8 +- .../poi/xddf/usermodel/chart/XDDFChart.java | 46 +- .../poi/xslf/usermodel/XMLSlideShow.java | 15 +- .../apache/poi/xslf/usermodel/XSLFChart.java | 57 +++ .../poi/xslf/usermodel/XSLFDrawing.java | 13 + .../poi/xslf/usermodel/XSLFFreeformShape.java | 33 +- .../apache/poi/xslf/usermodel/XSLFSheet.java | 31 +- .../poi/xslf/usermodel/XSLFSimpleShape.java | 1 - .../poi/xssf/streaming/SXSSFWorkbook.java | 24 +- .../apache/poi/xwpf/usermodel/XWPFChart.java | 4 +- .../poi/xwpf/usermodel/XWPFDocument.java | 3 +- .../poi/ooxml/TestPOIXMLProperties.java | 5 +- .../poi/poifs/crypt/TestSignatureInfo.java | 3 + .../usermodel/TestNecessaryOOXMLClasses.java | 6 + .../extractor/TestXDGFVisioExtractor.java | 2 +- .../poi/xslf/usermodel/TestPPTX2PNG.java | 4 +- .../poi/xslf/usermodel/TestXSLFSlide.java | 31 +- .../apache/poi/xssf/XSSFTestDataSamples.java | 51 +-- .../xwpf/extractor/TestXWPFWordExtractor.java | 8 + .../poi/hslf/record/CurrentUserAtom.java | 4 +- .../poi/hslf/usermodel/HSLFAutoShape.java | 395 +++++++++++++++++- .../apache/poi/hslf/usermodel/HSLFFill.java | 49 ++- .../poi/hslf/usermodel/HSLFFreeformShape.java | 264 +----------- .../apache/poi/hslf/usermodel/HSLFShape.java | 23 +- .../poi/hslf/usermodel/HSLFSimpleShape.java | 6 +- .../poi/hslf/usermodel/HSLFSlideShow.java | 1 + .../poi/hslf/usermodel/HSLFSlideShowImpl.java | 19 +- .../poi/hslf/model/AllHSLFModelTests.java | 1 - .../apache/poi/hslf/model/TestFreeform.java | 2 +- .../hslf/usermodel/AllHSLFUserModelTests.java | 1 + .../{model => usermodel}/TestBackground.java | 2 +- .../poi/poifs/filesystem/TestFileMagic.java | 81 ++++ .../poifs/filesystem/TestPOIFSFileSystem.java | 15 + ...eetRangeAndWorkbookIndexFormatterTest.java | 66 +++ .../TestExcelStyleDateFormatter.java | 4 +- test-data/document/60316.docx | Bin 0 -> 48142 bytes test-data/document/60316b.dotx | Bin 0 -> 14726 bytes test-data/slideshow/customGeo.ppt | Bin 0 -> 3333632 bytes test-data/slideshow/customGeo.pptx | Bin 0 -> 1046067 bytes test-data/slideshow/keyframes.pptx | Bin 0 -> 389330 bytes test-data/slideshow/pp40only.ppt | Bin 0 -> 263681 bytes 80 files changed, 1741 insertions(+), 874 deletions(-) create mode 100644 src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java create mode 100644 src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java create mode 100644 src/java/org/apache/poi/ss/formula/SheetRangeAndWorkbookIndexFormatter.java rename src/scratchpad/testcases/org/apache/poi/hslf/{model => usermodel}/TestBackground.java (99%) create mode 100644 src/testcases/org/apache/poi/poifs/filesystem/TestFileMagic.java create mode 100644 src/testcases/org/apache/poi/ss/formula/SheetRangeAndWorkbookIndexFormatterTest.java create mode 100644 test-data/document/60316.docx create mode 100644 test-data/document/60316b.dotx create mode 100644 test-data/slideshow/customGeo.ppt create mode 100644 test-data/slideshow/customGeo.pptx create mode 100644 test-data/slideshow/keyframes.pptx create mode 100644 test-data/slideshow/pp40only.ppt diff --git a/build.xml b/build.xml index 207acc4c68..ce3c83c860 100644 --- a/build.xml +++ b/build.xml @@ -60,6 +60,10 @@ under the License. + + + + - - - - - - - - - - @@ -1180,6 +1173,59 @@ under the License. + + + + + + + + + + + sun/java2d/pipe/AAShapePipe.renderTiles(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;Lsun/java2d/pipe/AATileGenerator;[I)V + sun/java2d/pipe/AlphaPaintPipe.renderPathTile(Ljava/lang/Object;[BIIIIII)V + java/awt/TexturePaintContext.getRaster(IIII)Ljava/awt/image/Raster; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1219,39 +1265,23 @@ under the License. - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + @@ -1306,6 +1336,7 @@ under the License. + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -1500,45 +1514,23 @@ under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -1559,72 +1551,35 @@ under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1650,34 +1605,16 @@ under the License. unless="integration.test.notRequired" xmlns:jacoco="antlib:org.jacoco.ant"> - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -1739,33 +1676,16 @@ under the License. - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + @@ -1791,6 +1711,9 @@ under the License. + + + @@ -1828,7 +1751,7 @@ under the License. - + POI API Documentation]]> @@ -2113,6 +2036,7 @@ under the License. sonar/*/src/**, compile-lib/**, ooxml-lib/**, + ooxml-testlib/**, scripts/**, TEST*, *.ipr, @@ -2303,7 +2227,10 @@ under the License. - + + @@ -2453,7 +2380,7 @@ under the License. - + diff --git a/doap_POI.rdf b/doap_POI.rdf index f1d21a8cee..88ba48f04d 100644 --- a/doap_POI.rdf +++ b/doap_POI.rdf @@ -35,6 +35,13 @@ Java + + + Apache POI 4.0.1 + 2018-12-03 + 4.0.1 + + Apache POI 4.0.0 diff --git a/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java b/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java new file mode 100644 index 0000000000..12f96fa6fd --- /dev/null +++ b/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java @@ -0,0 +1,145 @@ +/* + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.apache.poi.xslf.usermodel; + +import java.awt.geom.Rectangle2D; +import java.io.BufferedReader; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xddf.usermodel.chart.AxisCrosses; +import org.apache.poi.xddf.usermodel.chart.AxisPosition; +import org.apache.poi.xddf.usermodel.chart.BarDirection; +import org.apache.poi.xddf.usermodel.chart.ChartTypes; +import org.apache.poi.xddf.usermodel.chart.LegendPosition; +import org.apache.poi.xddf.usermodel.chart.XDDFBarChartData; +import org.apache.poi.xddf.usermodel.chart.XDDFChart; +import org.apache.poi.xddf.usermodel.chart.XDDFChartAxis; +import org.apache.poi.xddf.usermodel.chart.XDDFChartLegend; +import org.apache.poi.xddf.usermodel.chart.XDDFDataSource; +import org.apache.poi.xddf.usermodel.chart.XDDFDataSourcesFactory; +import org.apache.poi.xddf.usermodel.chart.XDDFNumericalDataSource; +import org.apache.poi.xddf.usermodel.chart.XDDFValueAxis; + +/** + * Build a chart without reading template file + */ +public class ChartFromScratch { + private static void usage(){ + System.out.println("Usage: BarChartExample "); + System.out.println(" bar-chart-data.txt the model to set. First line is chart title, " + + "then go pairs {axis-label value}"); + } + + public static void main(String[] args) throws Exception { + if(args.length < 1) { + usage(); + return; + } + + try (BufferedReader modelReader = new BufferedReader(new FileReader(args[0]))) { + + String chartTitle = modelReader.readLine(); // first line is chart title + String[] series = modelReader.readLine().split(","); + + // Category Axis Data + List listLanguages = new ArrayList<>(10); + + // Values + List listCountries = new ArrayList<>(10); + List listSpeakers = new ArrayList<>(10); + + // set model + String ln; + while((ln = modelReader.readLine()) != null) { + String[] vals = ln.split(","); + listCountries.add(Double.valueOf(vals[0])); + listSpeakers.add(Double.valueOf(vals[1])); + listLanguages.add(vals[2]); + } + + String[] categories = listLanguages.toArray(new String[listLanguages.size()]); + Double[] values1 = listCountries.toArray(new Double[listCountries.size()]); + Double[] values2 = listSpeakers.toArray(new Double[listSpeakers.size()]); + + try { + + XMLSlideShow ppt = new XMLSlideShow(); + XSLFSlide slide = ppt.createSlide(); + XSLFChart chart = ppt.createChart(); + Rectangle2D rect2D = new java.awt.Rectangle(XDDFChart.DEFAULT_X, XDDFChart.DEFAULT_Y, + XDDFChart.DEFAULT_WIDTH, XDDFChart.DEFAULT_HEIGHT); + slide.addChart(chart, rect2D); + setBarData(chart, chartTitle, series, categories, values1, values2); + // save the result + try (OutputStream out = new FileOutputStream("bar-chart-demo-output.pptx")) { + ppt.write(out); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + System.out.println("Done"); + } + + private static void setBarData(XSLFChart chart, String chartTitle, String[] series, String[] categories, Double[] values1, Double[] values2) { + // Use a category axis for the bottom axis. + XDDFChartAxis bottomAxis = chart.createCategoryAxis(AxisPosition.BOTTOM); + bottomAxis.setTitle(series[2]); + XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT); + leftAxis.setTitle(series[0]+","+series[1]); + leftAxis.setCrosses(AxisCrosses.AUTO_ZERO); + + final int numOfPoints = categories.length; + final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 0, 0)); + final String valuesDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 1, 1)); + final String valuesDataRange2 = chart.formatRange(new CellRangeAddress(1, numOfPoints, 2, 2)); + final XDDFDataSource categoriesData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange, 0); + final XDDFNumericalDataSource valuesData = XDDFDataSourcesFactory.fromArray(values1, valuesDataRange, 1); + values1[6] = 16.0; // if you ever want to change the underlying data + final XDDFNumericalDataSource valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, 2); + + + XDDFBarChartData bar = (XDDFBarChartData) chart.createData(ChartTypes.BAR, bottomAxis, leftAxis); + XDDFBarChartData.Series series1 = (XDDFBarChartData.Series) bar.addSeries(categoriesData, valuesData); + series1.setTitle(series[0], chart.setSheetTitle(series[0], 1)); + + XDDFBarChartData.Series series2 = (XDDFBarChartData.Series) bar.addSeries(categoriesData, valuesData2); + series2.setTitle(series[1], chart.setSheetTitle(series[1], 2)); + + bar.setVaryColors(true); + bar.setBarDirection(BarDirection.COL); + chart.plot(bar); + + XDDFChartLegend legend = chart.getOrAddLegend(); + legend.setPosition(LegendPosition.LEFT); + legend.setOverlay(false); + + chart.setTitleText(chartTitle); + chart.setTitleOverlay(false); + } +} + diff --git a/src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java b/src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java new file mode 100644 index 0000000000..4a1a78150f --- /dev/null +++ b/src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java @@ -0,0 +1,140 @@ +/* + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ==================================================================== + */ + +package org.apache.poi.xwpf.usermodel.examples; + +import java.io.BufferedReader; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xddf.usermodel.chart.AxisCrosses; +import org.apache.poi.xddf.usermodel.chart.AxisPosition; +import org.apache.poi.xddf.usermodel.chart.BarDirection; +import org.apache.poi.xddf.usermodel.chart.ChartTypes; +import org.apache.poi.xddf.usermodel.chart.LegendPosition; +import org.apache.poi.xddf.usermodel.chart.XDDFBarChartData; +import org.apache.poi.xddf.usermodel.chart.XDDFChart; +import org.apache.poi.xddf.usermodel.chart.XDDFChartAxis; +import org.apache.poi.xddf.usermodel.chart.XDDFChartLegend; +import org.apache.poi.xddf.usermodel.chart.XDDFDataSource; +import org.apache.poi.xddf.usermodel.chart.XDDFDataSourcesFactory; +import org.apache.poi.xddf.usermodel.chart.XDDFNumericalDataSource; +import org.apache.poi.xddf.usermodel.chart.XDDFValueAxis; +import org.apache.poi.xwpf.usermodel.XWPFChart; +import org.apache.poi.xwpf.usermodel.XWPFDocument; + +/** + * Build a chart without reading template file + */ +public class ChartFromScratch { + private static void usage(){ + System.out.println("Usage: BarChartExample "); + System.out.println(" bar-chart-data.txt the model to set. First line is chart title, " + + "then go pairs {axis-label value}"); + } + + public static void main(String[] args) throws Exception { + if(args.length < 1) { + usage(); + return; + } + + try (BufferedReader modelReader = new BufferedReader(new FileReader(args[0]))) { + + String chartTitle = modelReader.readLine(); // first line is chart title + String[] series = modelReader.readLine().split(","); + + // Category Axis Data + List listLanguages = new ArrayList<>(10); + + // Values + List listCountries = new ArrayList<>(10); + List listSpeakers = new ArrayList<>(10); + + // set model + String ln; + while((ln = modelReader.readLine()) != null) { + String[] vals = ln.split(","); + listCountries.add(Double.valueOf(vals[0])); + listSpeakers.add(Double.valueOf(vals[1])); + listLanguages.add(vals[2]); + } + + String[] categories = listLanguages.toArray(new String[listLanguages.size()]); + Double[] values1 = listCountries.toArray(new Double[listCountries.size()]); + Double[] values2 = listSpeakers.toArray(new Double[listSpeakers.size()]); + + try (XWPFDocument doc = new XWPFDocument()) { + XWPFChart chart = doc.createChart(XDDFChart.DEFAULT_WIDTH, XDDFChart.DEFAULT_HEIGHT); + setBarData(chart, chartTitle, series, categories, values1, values2); + // save the result + try (OutputStream out = new FileOutputStream("bar-chart-demo-output.docx")) { + doc.write(out); + } + } + catch(Exception e) + { + e.printStackTrace(); + } + } + System.out.println("Done"); + } + + private static void setBarData(XWPFChart chart, String chartTitle, String[] series, String[] categories, Double[] values1, Double[] values2) { + // Use a category axis for the bottom axis. + XDDFChartAxis bottomAxis = chart.createCategoryAxis(AxisPosition.BOTTOM); + bottomAxis.setTitle(series[2]); + XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT); + leftAxis.setTitle(series[0]+","+series[1]); + leftAxis.setCrosses(AxisCrosses.AUTO_ZERO); + + final int numOfPoints = categories.length; + final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 0, 0)); + final String valuesDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 1, 1)); + final String valuesDataRange2 = chart.formatRange(new CellRangeAddress(1, numOfPoints, 2, 2)); + final XDDFDataSource categoriesData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange, 0); + final XDDFNumericalDataSource valuesData = XDDFDataSourcesFactory.fromArray(values1, valuesDataRange, 1); + values1[6] = 16.0; // if you ever want to change the underlying data + final XDDFNumericalDataSource valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, 2); + + + XDDFBarChartData bar = (XDDFBarChartData) chart.createData(ChartTypes.BAR, bottomAxis, leftAxis); + XDDFBarChartData.Series series1 = (XDDFBarChartData.Series) bar.addSeries(categoriesData, valuesData); + series1.setTitle(series[0], chart.setSheetTitle(series[0], 1)); + + XDDFBarChartData.Series series2 = (XDDFBarChartData.Series) bar.addSeries(categoriesData, valuesData2); + series2.setTitle(series[1], chart.setSheetTitle(series[1], 2)); + + bar.setVaryColors(true); + bar.setBarDirection(BarDirection.COL); + chart.plot(bar); + + XDDFChartLegend legend = chart.getOrAddLegend(); + legend.setPosition(LegendPosition.LEFT); + legend.setOverlay(false); + + chart.setTitleText(chartTitle); + chart.setTitleOverlay(false); + } +} + diff --git a/src/integrationtest/org/apache/poi/TestAllFiles.java b/src/integrationtest/org/apache/poi/TestAllFiles.java index 61c47b9e88..40f19f9c85 100644 --- a/src/integrationtest/org/apache/poi/TestAllFiles.java +++ b/src/integrationtest/org/apache/poi/TestAllFiles.java @@ -289,6 +289,7 @@ public class TestAllFiles { "document/Bug50955.doc", "document/57843.doc", "slideshow/PPT95.ppt", + "slideshow/pp40only.ppt", "slideshow/Divino_Revelado.pptx", "openxml4j/OPCCompliance_CoreProperties_DCTermsNamespaceLimitedUseFAIL.docx", "openxml4j/OPCCompliance_CoreProperties_DoNotUseCompatibilityMarkupFAIL.docx", diff --git a/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java b/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java index 5c47d9af7e..48a30a2569 100644 --- a/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/XSSFFileHandler.java @@ -35,7 +35,6 @@ import java.util.Iterator; import java.util.Locale; import java.util.Set; -import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import org.apache.poi.EncryptedDocumentException; @@ -148,7 +147,7 @@ public class XSSFFileHandler extends SpreadsheetHandler { } private void exportToXML(XSSFWorkbook wb) throws SAXException, - ParserConfigurationException, TransformerException { + TransformerException { for (XSSFMap map : wb.getCustomXMLMappings()) { XSSFExportToXml exporter = new XSSFExportToXml(map); @@ -165,7 +164,6 @@ public class XSSFFileHandler extends SpreadsheetHandler { // zip-bomb EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/54764.xlsx"); EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/54764-2.xlsx"); - EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/54764.xlsx"); EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/poc-xmlbomb.xlsx"); EXPECTED_ADDITIONAL_FAILURES.add("spreadsheet/poc-xmlbomb-empty.xlsx"); // strict OOXML @@ -185,18 +183,19 @@ public class XSSFFileHandler extends SpreadsheetHandler { public void handleAdditional(File file) throws Exception { // redirect stdout as the examples often write lots of text PrintStream oldOut = System.out; + String testFile = file.getParentFile().getName() + "/" + file.getName(); try { System.setOut(new NullPrintStream()); FromHowTo.main(new String[]{file.getAbsolutePath()}); XLSX2CSV.main(new String[]{file.getAbsolutePath()}); assertFalse("Expected Extraction to fail for file " + file + " and handler " + this + ", but did not fail!", - EXPECTED_ADDITIONAL_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName())); + EXPECTED_ADDITIONAL_FAILURES.contains(testFile)); } catch (OLE2NotOfficeXmlFileException e) { // we have some files that are not actually OOXML and thus cannot be tested here } catch (IllegalArgumentException | InvalidFormatException | POIXMLException | IOException e) { - if(!EXPECTED_ADDITIONAL_FAILURES.contains(file.getParentFile().getName() + "/" + file.getName())) { + if(!EXPECTED_ADDITIONAL_FAILURES.contains(testFile)) { throw e; } } finally { diff --git a/src/java/org/apache/poi/ddf/EscherProperties.java b/src/java/org/apache/poi/ddf/EscherProperties.java index acff6241c2..482bce95c5 100644 --- a/src/java/org/apache/poi/ddf/EscherProperties.java +++ b/src/java/org/apache/poi/ddf/EscherProperties.java @@ -26,6 +26,7 @@ import java.util.Map; * * @author Glen Stampoultzis (glens at apache.org) */ +@SuppressWarnings("WeakerAccess") public final class EscherProperties { // Property constants @@ -117,6 +118,15 @@ public final class EscherProperties { public static final short GEOMETRY__ADJUST8VALUE = 334; public static final short GEOMETRY__ADJUST9VALUE = 335; public static final short GEOMETRY__ADJUST10VALUE = 336; + public static final short GEOMETRY__PCONNECTIONSITES = 337; + public static final short GEOMETRY__PCONNECTIONSITESDIR = 338; + public static final short GEOMETRY__XLIMO = 339; + public static final short GEOMETRY__YLIMO = 340; + public static final short GEOMETRY__PADJUSTHANDLES = 341; + public static final short GEOMETRY__PGUIDES = 342; + public static final short GEOMETRY__PINSCRIBE = 343; + public static final short GEOMETRY__CXK = 344; + public static final short GEOMETRY__PFRAGMENTS = 345; public static final short GEOMETRY__SHADOWok = 378; public static final short GEOMETRY__3DOK = 379; public static final short GEOMETRY__LINEOK = 380; @@ -333,6 +343,9 @@ public final class EscherProperties { private static final Map properties = initProps(); + private EscherProperties() { + } + private static Map initProps() { Map m = new HashMap<>(); addProp(m, TRANSFORM__ROTATION, "transform.rotation"); @@ -423,6 +436,15 @@ public final class EscherProperties { addProp(m, GEOMETRY__ADJUST8VALUE, "geometry.adjust8value"); addProp(m, GEOMETRY__ADJUST9VALUE, "geometry.adjust9value"); addProp(m, GEOMETRY__ADJUST10VALUE, "geometry.adjust10value"); + addProp(m, GEOMETRY__PCONNECTIONSITES, "geometry.pConnectionSites"); + addProp(m, GEOMETRY__PCONNECTIONSITESDIR, "geometry.pConnectionSitesDir"); + addProp(m, GEOMETRY__XLIMO, "geometry.xLimo"); + addProp(m, GEOMETRY__YLIMO, "geometry.yLimo"); + addProp(m, GEOMETRY__PADJUSTHANDLES, "geometry.pAdjustHandles"); + addProp(m, GEOMETRY__PGUIDES, "geometry.pGuides"); + addProp(m, GEOMETRY__PINSCRIBE, "geometry.pInscribe"); + addProp(m, GEOMETRY__CXK, "geometry.cxk"); + addProp(m, GEOMETRY__PFRAGMENTS, "geometry.pFragments"); addProp(m, GEOMETRY__SHADOWok, "geometry.shadowOK"); addProp(m, GEOMETRY__3DOK, "geometry.3dok"); addProp(m, GEOMETRY__LINEOK, "geometry.lineok"); @@ -641,20 +663,20 @@ public final class EscherProperties { } private static void addProp(Map m, int s, String propName) { - m.put(Short.valueOf((short) s), new EscherPropertyMetaData(propName)); + m.put((short) s, new EscherPropertyMetaData(propName)); } private static void addProp(Map m, int s, String propName, byte type) { - m.put(Short.valueOf((short) s), new EscherPropertyMetaData(propName, type)); + m.put((short) s, new EscherPropertyMetaData(propName, type)); } public static String getPropertyName(short propertyId) { - EscherPropertyMetaData o = properties.get(Short.valueOf(propertyId)); + EscherPropertyMetaData o = properties.get(propertyId); return o == null ? "unknown" : o.getDescription(); } public static byte getPropertyType(short propertyId) { - EscherPropertyMetaData escherPropertyMetaData = properties.get(Short.valueOf(propertyId)); + EscherPropertyMetaData escherPropertyMetaData = properties.get(propertyId); return escherPropertyMetaData == null ? 0 : escherPropertyMetaData.getType(); } } diff --git a/src/java/org/apache/poi/hpsf/VariantSupport.java b/src/java/org/apache/poi/hpsf/VariantSupport.java index e60679027d..0e8dc08c6e 100644 --- a/src/java/org/apache/poi/hpsf/VariantSupport.java +++ b/src/java/org/apache/poi/hpsf/VariantSupport.java @@ -36,7 +36,7 @@ import org.apache.poi.util.POILogger; * Supports reading and writing of variant data.

* * FIXME (3): Reading and writing should be made more - * uniform than it is now. The following items should be resolved:

+ * uniform than it is now. The following items should be resolved: * *