From 11a403469f50175627dbca7eba27e5aee7b7e697 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 16 Sep 2017 12:16:29 +0000 Subject: [PATCH] remove some deprecated code slated for removal in 3.18 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808535 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/hpsf/TypeWriter.java | 195 ------------------ .../poi/xslf/usermodel/DrawingTable.java | 45 ---- .../xslf/usermodel/XSLFCommonSlideData.java | 125 ----------- .../apache/poi/xslf/usermodel/XSLFNotes.java | 2 - .../poi/xslf/usermodel/XSLFNotesMaster.java | 1 - .../apache/poi/xslf/usermodel/XSLFSheet.java | 13 -- .../apache/poi/xslf/usermodel/XSLFSlide.java | 2 - .../poi/xslf/usermodel/XSLFSlideLayout.java | 1 - .../poi/xslf/usermodel/XSLFSlideMaster.java | 1 - 9 files changed, 385 deletions(-) delete mode 100644 src/java/org/apache/poi/hpsf/TypeWriter.java delete mode 100644 src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTable.java delete mode 100644 src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFCommonSlideData.java diff --git a/src/java/org/apache/poi/hpsf/TypeWriter.java b/src/java/org/apache/poi/hpsf/TypeWriter.java deleted file mode 100644 index ec9ba4c34f..0000000000 --- a/src/java/org/apache/poi/hpsf/TypeWriter.java +++ /dev/null @@ -1,195 +0,0 @@ -/* ==================================================================== - 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.hpsf; - -import java.io.IOException; -import java.io.OutputStream; - -import org.apache.poi.util.LittleEndian; -import org.apache.poi.util.LittleEndianConsts; -import org.apache.poi.util.Removal; - -/** - * Class for writing little-endian data and more. - * @deprecated POI 3.16 beta 2 - use LittleEndian instead - */ -@Deprecated -@Removal(version="3.18") -public class TypeWriter -{ - - /** - *

Writes a two-byte value (short) to an output stream.

- * - * @param out The stream to write to. - * @param n The value to write. - * @return The number of bytes that have been written. - * @exception IOException if an I/O error occurs - */ - public static int writeToStream( final OutputStream out, final short n ) - throws IOException - { - LittleEndian.putShort( out, n ); // FIXME: unsigned - return LittleEndianConsts.SHORT_SIZE; - } - - /** - *

Writes a four-byte value to an output stream.

- * - * @param out The stream to write to. - * @param n The value to write. - * @exception IOException if an I/O error occurs - * @return The number of bytes written to the output stream. - */ - public static int writeToStream( final OutputStream out, final int n ) - throws IOException - { - LittleEndian.putInt( n, out ); - return LittleEndianConsts.INT_SIZE; - } - - /** - *

Writes a eight-byte value to an output stream.

- * - * @param out The stream to write to. - * @param n The value to write. - * @exception IOException if an I/O error occurs - * @return The number of bytes written to the output stream. - */ - public static int writeToStream( final OutputStream out, final long n ) - throws IOException - { - LittleEndian.putLong( n, out ); - return LittleEndianConsts.LONG_SIZE; - } - - /** - *

Writes an unsigned two-byte value to an output stream.

- * - * @param out The stream to write to - * @param n The value to write - * @exception IOException if an I/O error occurs - */ - public static void writeUShortToStream( final OutputStream out, final int n ) - throws IOException - { - int high = n & 0xFFFF0000; - if ( high != 0 ) { - throw new IllegalPropertySetDataException( "Value " + n - + " cannot be represented by 2 bytes." ); - } - LittleEndian.putUShort( n, out ); - } - - /** - *

Writes an unsigned four-byte value to an output stream.

- * - * @param out The stream to write to. - * @param n The value to write. - * @return The number of bytes that have been written to the output stream. - * @exception IOException if an I/O error occurs - */ - public static int writeUIntToStream( final OutputStream out, final long n ) - throws IOException - { - long high = n & 0xFFFFFFFF00000000L; - if ( high != 0 && high != 0xFFFFFFFF00000000L ) { - throw new IllegalPropertySetDataException( "Value " + n - + " cannot be represented by 4 bytes." ); - } - LittleEndian.putUInt( n, out ); - return LittleEndianConsts.INT_SIZE; - } - - /** - *

Writes a 16-byte {@link ClassID} to an output stream.

- * - * @param out The stream to write to - * @param n The value to write - * @return The number of bytes written - * @exception IOException if an I/O error occurs - */ - public static int writeToStream(final OutputStream out, final ClassID n) - throws IOException - { - byte[] b = new byte[16]; - n.write(b, 0); - out.write(b, 0, b.length); - return b.length; - } - - - - /** - *

Writes an array of {@link Property} instances to an output stream - * according to the Horrible Property Stream Format.

- * - * @param out The stream to write to - * @param properties The array to write to the stream - * @param codepage The codepage number to use for writing strings - * @exception IOException if an I/O error occurs - * @throws UnsupportedVariantTypeException if HPSF does not support some - * variant type. - */ - public static void writeToStream(final OutputStream out, - final Property[] properties, - final int codepage) - throws IOException, UnsupportedVariantTypeException - { - /* If there are no properties don't write anything. */ - if (properties == null) { - return; - } - - /* Write the property list. This is a list containing pairs of property - * ID and offset into the stream. */ - for (int i = 0; i < properties.length; i++) - { - final Property p = properties[i]; - writeUIntToStream(out, p.getID()); - writeUIntToStream(out, p.getSize(codepage)); - } - - /* Write the properties themselves. */ - for (int i = 0; i < properties.length; i++) - { - final Property p = properties[i]; - long type = p.getType(); - writeUIntToStream(out, type); - VariantSupport.write(out, (int) type, p.getValue(), codepage); - } - } - - - - /** - *

Writes a double value value to an output stream.

- * - * @param out The stream to write to. - * @param n The value to write. - * @exception IOException if an I/O error occurs - * @return The number of bytes written to the output stream. - */ - public static int writeToStream( final OutputStream out, final double n ) - throws IOException - { - LittleEndian.putDouble( n, out ); - return LittleEndianConsts.DOUBLE_SIZE; - } - -} diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTable.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTable.java deleted file mode 100644 index b59a5bb234..0000000000 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/DrawingTable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* ==================================================================== - 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 org.apache.poi.util.Removal; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTable; -import org.openxmlformats.schemas.drawingml.x2006.main.CTTableRow; - -/* - * @deprecated POI 3.16 beta 1. use {@link XSLFTable} instead - */ -@Removal(version="3.18") -public class DrawingTable { - private final CTTable table; - - public DrawingTable(CTTable table) { - this.table = table; - } - - public DrawingTableRow[] getRows() { - CTTableRow[] ctTableRows = table.getTrArray(); - DrawingTableRow[] o = new DrawingTableRow[ctTableRows.length]; - - for (int i=0; i getDrawingText() { - CTGroupShape gs = data.getSpTree(); - - List out = new ArrayList<>(); - - processShape(gs, out); - - for (CTGroupShape shape : gs.getGrpSpArray()) { - processShape(shape, out); - } - - for (CTGraphicalObjectFrame frame: gs.getGraphicFrameArray()) { - CTGraphicalObjectData data = frame.getGraphic().getGraphicData(); - XmlCursor c = data.newCursor(); - c.selectPath("declare namespace pic='"+CTTable.type.getName().getNamespaceURI()+"' .//pic:tbl"); - - while (c.toNextSelection()) { - XmlObject o = c.getObject(); - - if (o instanceof XmlAnyTypeImpl) { - // Pesky XmlBeans bug - see Bugzilla #49934 - try { - o = CTTable.Factory.parse(o.toString(), DEFAULT_XML_OPTIONS); - } catch (XmlException e) { - throw new POIXMLException(e); - } - } - - if (o instanceof CTTable) { - DrawingTable table = new DrawingTable((CTTable) o); - - for (DrawingTableRow row : table.getRows()) { - for (DrawingTableCell cell : row.getCells()) { - DrawingTextBody textBody = cell.getTextBody(); - out.add(textBody); - } - } - } - } - - c.dispose(); - } - - return out; - } - public List getText() { - List paragraphs = new ArrayList<>(); - for(DrawingTextBody textBody : getDrawingText()) { - paragraphs.addAll(Arrays.asList(textBody.getParagraphs())); - } - return paragraphs; - } - - private void processShape(CTGroupShape gs, List out) { - for (CTShape shape : gs.getSpArray()) { - CTTextBody ctTextBody = shape.getTxBody(); - if (ctTextBody==null) { - continue; - } - - DrawingTextBody textBody; - CTApplicationNonVisualDrawingProps nvpr = shape.getNvSpPr().getNvPr(); - if(nvpr.isSetPh()) { - textBody = new DrawingTextPlaceholder(ctTextBody, nvpr.getPh()); - } else { - textBody = new DrawingTextBody(ctTextBody); - } - - out.add(textBody); - } - } -} diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java index 180659a061..6eee234f78 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotes.java @@ -42,7 +42,6 @@ implements Notes { XSLFNotes() { super(); _notes = prototype(); - setCommonSlideData(_notes.getCSld()); } /** @@ -61,7 +60,6 @@ implements Notes { NotesDocument doc = NotesDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS); _notes = doc.getNotes(); - setCommonSlideData(_notes.getCSld()); } private static CTNotesSlide prototype(){ diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java index 3c96e37795..59d8d67461 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java @@ -66,7 +66,6 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument; NotesMasterDocument doc = NotesMasterDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS); _slide = doc.getNotesMaster(); - setCommonSlideData(_slide.getCSld()); } private static CTNotesMaster prototype() { diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java index 6b0734f257..aed2ff7c49 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSheet.java @@ -58,7 +58,6 @@ public abstract class XSLFSheet extends POIXMLDocumentPart implements XSLFShapeContainer, Sheet { private static POILogger LOG = POILogFactory.getLogger(XSLFSheet.class); - private XSLFCommonSlideData _commonSlideData; private XSLFDrawing _drawing; private List _shapes; private CTGroupShape _spTree; @@ -141,18 +140,6 @@ implements XSLFShapeContainer, Sheet { */ public abstract XmlObject getXmlObject(); - /* - * @deprecated POI 3.16 beta 1. use {@link XSLFTable} instead - */ - @Removal(version="3.18") - protected void setCommonSlideData(CTCommonSlideData data) { - if(data == null) { - _commonSlideData = null; - } else { - _commonSlideData = new XSLFCommonSlideData(data); - } - } - private XSLFDrawing getDrawing(){ initDrawingAndShapes(); return _drawing; diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java index 625b26aa80..e443fa3106 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java @@ -60,7 +60,6 @@ implements Slide { XSLFSlide() { super(); _slide = prototype(); - setCommonSlideData(_slide.getCSld()); } /** @@ -83,7 +82,6 @@ implements Slide { SldDocument doc = SldDocument.Factory.parse(_doc, DEFAULT_XML_OPTIONS); _slide = doc.getSld(); - setCommonSlideData(_slide.getCSld()); } private static CTSlide prototype(){ diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java index b06dcf42bf..14684b4c6e 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideLayout.java @@ -51,7 +51,6 @@ implements MasterSheet { SldLayoutDocument doc = SldLayoutDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS); _layout = doc.getSldLayout(); - setCommonSlideData(_layout.getCSld()); } public String getName() { diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java index cdf034aafb..967441a938 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java @@ -76,7 +76,6 @@ import org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument; SldMasterDocument doc = SldMasterDocument.Factory.parse(getPackagePart().getInputStream(), DEFAULT_XML_OPTIONS); _slide = doc.getSldMaster(); - setCommonSlideData(_slide.getCSld()); } @Override -- 2.39.5