From 0977e51818d0e0ba6b6788232684886f0a8d5e58 Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Wed, 14 Sep 2016 02:41:01 +0000 Subject: [PATCH] bug 59907: restore ClientAnchor#setAnchorType(int) that was removed in POI 3.14 beta 1 and broke backwards compatibility without a 2 release deprecation notice git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1760617 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/usermodel/HSSFClientAnchor.java | 10 ++++++++++ .../org/apache/poi/ss/usermodel/ClientAnchor.java | 8 ++++++++ .../apache/poi/xssf/usermodel/XSSFClientAnchor.java | 12 ++++++++++++ 3 files changed, 30 insertions(+) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java b/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java index 4b8a25e302..e71e362b82 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java @@ -250,6 +250,7 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor { /** * Gets the anchor type + * Changed from returning an int to an enum in POI 3.14 beta 1. * @return the anchor type */ @Override @@ -260,11 +261,20 @@ public final class HSSFClientAnchor extends HSSFAnchor implements ClientAnchor { /** * Sets the anchor type * @param anchorType the anchor type to set + * @since POI 3.14 */ @Override public void setAnchorType(AnchorType anchorType) { _escherClientAnchor.setFlag(anchorType.value); } + /** + * Sets the anchor type + * @param anchorType the anchor type to set + * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead. + */ + public void setAnchorType(int anchorType) { + _escherClientAnchor.setFlag((short) anchorType); + } private void checkRange(int value, int minRange, int maxRange, String varName) { if (value < minRange || value > maxRange) diff --git a/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java b/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java index 672c1e2302..65e69d87d9 100644 --- a/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java +++ b/src/java/org/apache/poi/ss/usermodel/ClientAnchor.java @@ -288,11 +288,19 @@ public interface ClientAnchor { /** * Sets the anchor type * @param anchorType the anchor type to set + * @since POI 3.14 */ public void setAnchorType( AnchorType anchorType ); + /** + * Sets the anchor type + * @param anchorType the anchor type to set + * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead. + */ + public void setAnchorType( int anchorType ); /** * Gets the anchor type + * Changed from returning an int to an enum in POI 3.14 beta 1. * @return the anchor type */ public AnchorType getAnchorType(); diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java index 8045912abf..19d7d81099 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java @@ -218,15 +218,27 @@ public final class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor { /** * Sets the anchor type * @param anchorType the anchor type to set + * @since POI 3.14 */ @Override public void setAnchorType( AnchorType anchorType ) { this.anchorType = anchorType; } + /** + * Sets the anchor type + * @param anchorType the anchor type to set + * @deprecated POI 3.15. Use {@link #setAnchorType(AnchorType)} instead + */ + @Override + public void setAnchorType( int anchorType ) + { + this.anchorType = AnchorType.byId(anchorType); + } /** * Gets the anchor type + * Changed from returning an int to an enum in POI 3.14 beta 1. * @return the anchor type */ @Override -- 2.39.5