### Eclipse Workspace Patch 1.0 #P ApachePOI Index: src/java/org/apache/poi/ss/usermodel/ShapeContainer.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/ShapeContainer.java (nonexistent) +++ src/java/org/apache/poi/ss/usermodel/ShapeContainer.java (working copy) @@ -0,0 +1,27 @@ +/* ==================================================================== + 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.ss.usermodel; + +/** + * A common interface for shape groups. + * + * @since POI 3.16-beta2 + */ +public interface ShapeContainer extends Iterable { + +} Property changes on: src/java/org/apache/poi/ss/usermodel/ShapeContainer.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: src/java/org/apache/poi/ss/usermodel/Drawing.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/Drawing.java (revision 1775565) +++ src/java/org/apache/poi/ss/usermodel/Drawing.java (working copy) @@ -18,10 +18,8 @@ /** * High level representation of spreadsheet drawing. - * @author Yegor Kozlov - * @author Roman Kashitsyn */ -public interface Drawing { +public interface Drawing extends ShapeContainer { /** * Creates a picture. * @param anchor the client anchor describes how this picture is Index: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFPicture.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFPicture.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFPicture.java (working copy) @@ -20,6 +20,7 @@ import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.ss.usermodel.Picture; import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Shape; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.ImageUtils; import org.apache.poi.util.Internal; @@ -182,7 +183,7 @@ } private float getColumnWidthInPixels(int columnIndex){ - XSSFSheet sheet = getParent(); + XSSFSheet sheet = getSheet(); CTCol col = sheet.getColumnHelper().getColumn(columnIndex, false); double numChars = col == null || !col.isSetWidth() ? DEFAULT_COLUMN_WIDTH : col.getWidth(); @@ -193,7 +194,7 @@ private float getRowHeightInPixels(int rowIndex) { // THE FOLLOWING THREE LINES ARE THE MAIN CHANGE compared to the non-streaming version: use the SXSSF sheet, // not the XSSF sheet (which never contais rows when using SXSSF) - XSSFSheet xssfSheet = getParent(); + XSSFSheet xssfSheet = getSheet(); SXSSFSheet sheet = _wb.getSXSSFSheet(xssfSheet); Row row = sheet.getRow(rowIndex); float height = row != null ? row.getHeightInPoints() : sheet.getDefaultRowHeightInPoints(); @@ -232,11 +233,8 @@ return getCTPicture().getSpPr(); } - private XSSFSheet getParent() { - return (XSSFSheet)_picture.getDrawing().getParent(); - } - - private XSSFAnchor getAnchor() { + @Override + public XSSFAnchor getAnchor() { return _picture.getAnchor(); } @@ -269,4 +267,34 @@ public XSSFSheet getSheet() { return _picture.getSheet(); } + + @Override + public String getShapeName() { + return _picture.getShapeName(); + } + + @Override + public Shape getParent() { + return _picture.getParent(); + } + + @Override + public boolean isNoFill() { + return _picture.isNoFill(); + } + + @Override + public void setNoFill(boolean noFill) { + _picture.setNoFill(noFill); + } + + @Override + public void setFillColor(int red, int green, int blue) { + _picture.setFillColor(red, green, blue); + } + + @Override + public void setLineStyleColor( int red, int green, int blue ) { + _picture.setLineStyleColor(red, green, blue); + } } Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFAnchor.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFAnchor.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFAnchor.java (working copy) @@ -17,21 +17,11 @@ package org.apache.poi.xssf.usermodel; +import org.apache.poi.ss.usermodel.ChildAnchor; + /** * An anchor is what specifics the position of a shape within a client object * or within another containing shape. - * - * @author Yegor Kozlov */ -public abstract class XSSFAnchor { - - public abstract int getDx1(); - public abstract void setDx1( int dx1 ); - public abstract int getDy1(); - public abstract void setDy1( int dy1 ); - public abstract int getDy2(); - public abstract void setDy2( int dy2 ); - public abstract int getDx2(); - public abstract void setDx2( int dx2 ); - +public abstract class XSSFAnchor implements ChildAnchor { } Index: src/java/org/apache/poi/ss/usermodel/Shape.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/Shape.java (nonexistent) +++ src/java/org/apache/poi/ss/usermodel/Shape.java (working copy) @@ -0,0 +1,64 @@ +/* ==================================================================== + 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.ss.usermodel; + +/** + * Common interface for all drawing shapes + * + * @since POI 3.16-beta2 + */ +public interface Shape { + /** + * @return the name of this shape + */ + String getShapeName(); + + /** + * @return the parent shape. + */ + Shape getParent(); + + /** + * @return the anchor that is used by this shape. + */ + ChildAnchor getAnchor(); + + /** + * Whether this shape is not filled with a color + * + * @return true if this shape is not filled with a color. + */ + boolean isNoFill(); + + /** + * Sets whether this shape is filled or transparent. + * + * @param noFill if true then no fill will be applied to the shape element. + */ + void setNoFill(boolean noFill); + + /** + * Sets the color used to fill this shape using the solid fill pattern. + */ + void setFillColor(int red, int green, int blue); + + /** + * The color applied to the lines of this shape. + */ + void setLineStyleColor(int red, int green, int blue); +} Property changes on: src/java/org/apache/poi/ss/usermodel/Shape.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: src/java/org/apache/poi/hssf/usermodel/HSSFShape.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFShape.java (revision 1775565) +++ src/java/org/apache/poi/hssf/usermodel/HSSFShape.java (working copy) @@ -23,6 +23,7 @@ import org.apache.poi.ddf.EscherBoolProperty; import org.apache.poi.ddf.EscherChildAnchorRecord; import org.apache.poi.ddf.EscherClientAnchorRecord; +import org.apache.poi.ddf.EscherComplexProperty; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherOptRecord; import org.apache.poi.ddf.EscherProperties; @@ -32,9 +33,11 @@ import org.apache.poi.ddf.EscherSpRecord; import org.apache.poi.hssf.record.CommonObjectDataSubRecord; import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.ss.usermodel.Shape; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; +import org.apache.poi.util.StringUtil; /** * An abstract shape. @@ -44,7 +47,7 @@ * reverse them and draw shapes vertically or horizontally flipped via * setFlipVertical() or setFlipHorizontally(). */ -public abstract class HSSFShape { +public abstract class HSSFShape implements Shape { private static final POILogger LOG = POILogFactory.getLogger(HSSFShape.class); public static final int LINEWIDTH_ONE_PT = 12700; @@ -152,9 +155,7 @@ return _optRecord; } - /** - * Gets the parent shape. - */ + @Override public HSSFShape getParent() { return parent; } @@ -162,6 +163,7 @@ /** * @return the anchor that is used by this shape. */ + @Override public HSSFAnchor getAnchor() { return anchor; } @@ -231,9 +233,7 @@ setPropertyValue(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, lineStyleColor)); } - /** - * The color applied to the lines of this shape. - */ + @Override public void setLineStyleColor(int red, int green, int blue) { int lineStyleColor = ((blue) << 16) | ((green) << 8) | red; setPropertyValue(new EscherRGBProperty(EscherProperties.LINESTYLE__COLOR, lineStyleColor)); @@ -254,9 +254,7 @@ setPropertyValue(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, fillColor)); } - /** - * The color used to fill this shape. - */ + @Override public void setFillColor(int red, int green, int blue) { int fillColor = ((blue) << 16) | ((green) << 8) | red; setPropertyValue(new EscherRGBProperty(EscherProperties.FILL__FILLCOLOR, fillColor)); @@ -308,17 +306,13 @@ } } - /** - * @return true if this shape is not filled with a color. - */ + @Override public boolean isNoFill() { EscherBoolProperty property = _optRecord.lookup(EscherProperties.FILL__NOFILLHITTEST); return property == null ? NO_FILL_DEFAULT : property.getPropertyValue() == NO_FILLHITTEST_TRUE; } - /** - * @param noFill sets whether this shape is filled or transparent. - */ + @Override public void setNoFill(boolean noFill) { setPropertyValue(new EscherBoolProperty(EscherProperties.FILL__NOFILLHITTEST, noFill ? NO_FILLHITTEST_TRUE : NO_FILLHITTEST_FALSE)); } @@ -417,4 +411,19 @@ protected void setParent(HSSFShape parent) { this.parent = parent; } + + /** + * @return the name of this shape + */ + public String getShapeName() { + EscherOptRecord eor = getOptRecord(); + if (eor == null) { + return null; + } + EscherProperty ep = eor.lookup(EscherProperties.GROUPSHAPE__SHAPENAME); + if (ep instanceof EscherComplexProperty) { + return StringUtil.getFromUnicodeLE(((EscherComplexProperty)ep).getComplexData()); + } + return null; + } } Index: src/java/org/apache/poi/ss/usermodel/Picture.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/Picture.java (revision 1775565) +++ src/java/org/apache/poi/ss/usermodel/Picture.java (working copy) @@ -21,10 +21,8 @@ /** * Repersents a picture in a SpreadsheetML document - * - * @author Yegor Kozlov */ -public interface Picture { +public interface Picture extends Shape { /** * Reset the image to the dimension of the embedded image Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFGraphicFrame.java (working copy) @@ -187,4 +187,9 @@ protected CTShapeProperties getShapeProperties(){ return null; } + + @Override + public String getShapeName() { + return graphicFrame.getNvGraphicFramePr().getCNvPr().getName(); + } } Index: src/java/org/apache/poi/ss/usermodel/ChildAnchor.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/ChildAnchor.java (nonexistent) +++ src/java/org/apache/poi/ss/usermodel/ChildAnchor.java (working copy) @@ -0,0 +1,68 @@ +/* ==================================================================== + 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.ss.usermodel; + +/** + * Common interface for anchors.

+ * + * An anchor is what specifics the position of a shape within a client object + * or within another containing shape. + * + * @since POI 3.16-beta2 + */ +public interface ChildAnchor { + /** + * @return x coordinate of the left up corner + */ + int getDx1(); + + /** + * @param dx1 x coordinate of the left up corner + */ + void setDx1(int dx1); + + /** + * @return y coordinate of the left up corner + */ + int getDy1(); + + /** + * @param dy1 y coordinate of the left up corner + */ + void setDy1(int dy1); + + /** + * @return y coordinate of the right down corner + */ + int getDy2(); + + /** + * @param dy2 y coordinate of the right down corner + */ + void setDy2(int dy2); + + /** + * @return x coordinate of the right down corner + */ + int getDx2(); + + /** + * @param dx2 x coordinate of the right down corner + */ + void setDx2(int dx2); +} Property changes on: src/java/org/apache/poi/ss/usermodel/ChildAnchor.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: src/java/org/apache/poi/hssf/usermodel/HSSFAnchor.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFAnchor.java (revision 1775565) +++ src/java/org/apache/poi/hssf/usermodel/HSSFAnchor.java (working copy) @@ -22,12 +22,13 @@ import org.apache.poi.ddf.EscherClientAnchorRecord; import org.apache.poi.ddf.EscherContainerRecord; import org.apache.poi.ddf.EscherRecord; +import org.apache.poi.ss.usermodel.ChildAnchor; /** * An anchor is what specifics the position of a shape within a client object * or within another containing shape. */ -public abstract class HSSFAnchor { +public abstract class HSSFAnchor implements ChildAnchor { protected boolean _isHorizontallyFlipped = false; protected boolean _isVerticallyFlipped = false; @@ -56,46 +57,6 @@ } /** - * @return x coordinate of the left up corner - */ - public abstract int getDx1(); - - /** - * @param dx1 x coordinate of the left up corner - */ - public abstract void setDx1(int dx1); - - /** - * @return y coordinate of the left up corner - */ - public abstract int getDy1(); - - /** - * @param dy1 y coordinate of the left up corner - */ - public abstract void setDy1(int dy1); - - /** - * @return y coordinate of the right down corner - */ - public abstract int getDy2(); - - /** - * @param dy2 y coordinate of the right down corner - */ - public abstract void setDy2(int dy2); - - /** - * @return x coordinate of the right down corner - */ - public abstract int getDx2(); - - /** - * @param dx2 x coordinate of the right down corner - */ - public abstract void setDx2(int dx2); - - /** * @return whether this shape is horizontally flipped */ public abstract boolean isHorizontallyFlipped(); Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConnector.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConnector.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFConnector.java (working copy) @@ -134,4 +134,8 @@ return ctShape.getSpPr(); } + @Override + public String getShapeName() { + return ctShape.getNvCxnSpPr().getCNvPr().getName(); + } } Index: src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java (revision 1775565) +++ src/java/org/apache/poi/hssf/usermodel/HSSFShapeGroup.java (working copy) @@ -381,6 +381,7 @@ return isRemoved; } + @Override public Iterator iterator() { return shapes.iterator(); } Index: src/java/org/apache/poi/hssf/usermodel/HSSFShapeContainer.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFShapeContainer.java (revision 1775565) +++ src/java/org/apache/poi/hssf/usermodel/HSSFShapeContainer.java (working copy) @@ -19,10 +19,12 @@ import java.util.List; +import org.apache.poi.ss.usermodel.ShapeContainer; + /** * An interface that indicates whether a class can contain children. */ -public interface HSSFShapeContainer extends Iterable +public interface HSSFShapeContainer extends ShapeContainer { /** * @return Any children contained by this shape. Index: src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java (revision 1775565) +++ src/java/org/apache/poi/hssf/usermodel/HSSFSimpleShape.java (working copy) @@ -17,14 +17,29 @@ package org.apache.poi.hssf.usermodel; -import org.apache.poi.ddf.*; -import org.apache.poi.hssf.record.*; +import org.apache.poi.ddf.DefaultEscherRecordFactory; +import org.apache.poi.ddf.EscherBoolProperty; +import org.apache.poi.ddf.EscherClientDataRecord; +import org.apache.poi.ddf.EscherContainerRecord; +import org.apache.poi.ddf.EscherOptRecord; +import org.apache.poi.ddf.EscherProperties; +import org.apache.poi.ddf.EscherRGBProperty; +import org.apache.poi.ddf.EscherShapePathProperty; +import org.apache.poi.ddf.EscherSimpleProperty; +import org.apache.poi.ddf.EscherSpRecord; +import org.apache.poi.ddf.EscherTextboxRecord; +import org.apache.poi.hssf.record.CommonObjectDataSubRecord; +import org.apache.poi.hssf.record.EndSubRecord; +import org.apache.poi.hssf.record.EscherAggregate; +import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.hssf.record.TextObjectRecord; import org.apache.poi.ss.usermodel.RichTextString; +import org.apache.poi.ss.usermodel.SimpleShape; /** * Represents a simple shape such as a line, rectangle or oval. */ -public class HSSFSimpleShape extends HSSFShape +public class HSSFSimpleShape extends HSSFShape implements SimpleShape { // The commented out ones haven't been tested yet or aren't supported // by HSSFSimpleShape. Index: src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFDrawing.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFDrawing.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFDrawing.java (working copy) @@ -17,6 +17,8 @@ package org.apache.poi.xssf.streaming; +import java.util.Iterator; + import org.apache.poi.ss.usermodel.Chart; import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.Comment; @@ -23,6 +25,7 @@ import org.apache.poi.ss.usermodel.Drawing; import org.apache.poi.xssf.usermodel.XSSFDrawing; import org.apache.poi.xssf.usermodel.XSSFPicture; +import org.apache.poi.xssf.usermodel.XSSFShape; /** * Streaming version of Drawing. @@ -29,7 +32,7 @@ * Delegates most tasks to the non-streaming XSSF code. * TODO: Potentially, Comment and Chart need a similar streaming wrapper like Picture. */ -public class SXSSFDrawing implements Drawing { +public class SXSSFDrawing implements Drawing { private final SXSSFWorkbook _wb; private final XSSFDrawing _drawing; @@ -58,5 +61,10 @@ public ClientAnchor createAnchor(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2) { return _drawing.createAnchor(dx1, dy1, dx2, dy2, col1, row1, col2, row2); } + + @Override + public Iterator iterator() { + return _drawing.getShapes().iterator(); + } } Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFShape.java (working copy) @@ -17,6 +17,7 @@ package org.apache.poi.xssf.usermodel; +import org.apache.poi.ss.usermodel.Shape; import org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties; import org.openxmlformats.schemas.drawingml.x2006.main.CTNoFillProperties; import org.openxmlformats.schemas.drawingml.x2006.main.CTPresetLineDashProperties; @@ -27,10 +28,8 @@ /** * Represents a shape in a SpreadsheetML drawing. - * - * @author Yegor Kozlov */ -public abstract class XSSFShape { +public abstract class XSSFShape implements Shape { public static final int EMU_PER_PIXEL = 9525; public static final int EMU_PER_POINT = 12700; @@ -61,9 +60,7 @@ return drawing; } - /** - * Gets the parent shape. - */ + @Override public XSSFShapeGroup getParent() { return parent; @@ -72,6 +69,7 @@ /** * @return the anchor that is used by this shape. */ + @Override public XSSFAnchor getAnchor() { return anchor; @@ -84,20 +82,12 @@ */ protected abstract CTShapeProperties getShapeProperties(); - /** - * Whether this shape is not filled with a color - * - * @return true if this shape is not filled with a color. - */ + @Override public boolean isNoFill() { return getShapeProperties().isSetNoFill(); } - /** - * Sets whether this shape is filled or transparent. - * - * @param noFill if true then no fill will be applied to the shape element. - */ + @Override public void setNoFill(boolean noFill) { CTShapeProperties props = getShapeProperties(); //unset solid and pattern fills if they are set @@ -107,9 +97,7 @@ props.setNoFill(CTNoFillProperties.Factory.newInstance()); } - /** - * Sets the color used to fill this shape using the solid fill pattern. - */ + @Override public void setFillColor(int red, int green, int blue) { CTShapeProperties props = getShapeProperties(); CTSolidColorFillProperties fill = props.isSetSolidFill() ? props.getSolidFill() : props.addNewSolidFill(); @@ -118,9 +106,7 @@ fill.setSrgbClr(rgb); } - /** - * The color applied to the lines of this shape. - */ + @Override public void setLineStyleColor( int red, int green, int blue ) { CTShapeProperties props = getShapeProperties(); CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn(); Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java (working copy) @@ -23,6 +23,7 @@ import java.util.Locale; import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.SimpleShape; import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.util.Internal; import org.apache.poi.util.Units; @@ -37,7 +38,7 @@ * Represents a shape with a predefined geometry in a SpreadsheetML drawing. * Possible shape types are defined in {@link org.apache.poi.ss.usermodel.ShapeTypes} */ -public class XSSFSimpleShape extends XSSFShape implements Iterable { // TODO - instantiable superclass +public class XSSFSimpleShape extends XSSFShape implements Iterable, SimpleShape { /** * List of the paragraphs that make up the text in this shape */ @@ -863,4 +864,9 @@ } } } + + @Override + public String getShapeName() { + return ctShape.getNvSpPr().getCNvPr().getName(); + } } Index: src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java =================================================================== --- src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java (revision 1775565) +++ src/java/org/apache/poi/hssf/usermodel/HSSFPatriarch.java (working copy) @@ -57,7 +57,7 @@ * The patriarch is the toplevel container for shapes in a sheet. It does * little other than act as a container for other shapes and groups. */ -public final class HSSFPatriarch implements HSSFShapeContainer, Drawing { +public final class HSSFPatriarch implements HSSFShapeContainer, Drawing { // private static POILogger log = POILogFactory.getLogger(HSSFPatriarch.class); private final List _shapes = new ArrayList(); @@ -556,6 +556,7 @@ } } + @Override public Iterator iterator() { return _shapes.iterator(); } Index: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java =================================================================== --- src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java (revision 1775565) +++ src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java (working copy) @@ -284,4 +284,9 @@ public XSSFSheet getSheet() { return (XSSFSheet)getDrawing().getParent(); } + + @Override + public String getShapeName() { + return ctPicture.getNvPicPr().getCNvPr().getName(); + } } Index: src/java/org/apache/poi/ss/usermodel/SimpleShape.java =================================================================== --- src/java/org/apache/poi/ss/usermodel/SimpleShape.java (nonexistent) +++ src/java/org/apache/poi/ss/usermodel/SimpleShape.java (working copy) @@ -0,0 +1,28 @@ +/* ==================================================================== + 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.ss.usermodel; + +/** + * A common interface for simple shapes. + * (Currently the HSSF and XSSF classes don't share common method signatures ...) + * + * @since POI 3.16-beta2 + */ +public interface SimpleShape extends Shape { + +} Property changes on: src/java/org/apache/poi/ss/usermodel/SimpleShape.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property