aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-06-17 00:20:48 +0000
committerJaven O'Neal <onealj@apache.org>2016-06-17 00:20:48 +0000
commitc2b4c582553071c9e91dcf199bda714a0aa5c8f4 (patch)
tree5bb493103e463c6fa03c84ac54251f985809c40c /src/ooxml
parente817ec9970f296ac9450f8278139839e92127c88 (diff)
downloadpoi-c2b4c582553071c9e91dcf199bda714a0aa5c8f4.tar.gz
poi-c2b4c582553071c9e91dcf199bda714a0aa5c8f4.zip
bug 59170: remove deprecated o.a.p.xwpf.model.XWPFHyperlinkDecorator class
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1748780 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml')
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java4
-rw-r--r--src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java71
-rw-r--r--src/ooxml/testcases/org/apache/poi/xwpf/model/TestXWPFDecorators.java22
3 files changed, 2 insertions, 95 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index e278c16b0a..84b131889b 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -1226,8 +1226,8 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook {
* sh.createRow(0);
* </code></pre>
*
- * New projects should use the preferred options. Note: XSSFWorkbook.xssfSheetIterator
- * is deprecated and will be removed in a future version.
+ * @deprecated 3.13. New projects should use the preferred options. Note: XSSFWorkbook.xssfSheetIterator
+ * is deprecated and will be removed in 3.15.
*
* @return an iterator of the sheets.
*/
diff --git a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java
deleted file mode 100644
index 27e8282eaf..0000000000
--- a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java
+++ /dev/null
@@ -1,71 +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.xwpf.model;
-
-import org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun;
-import org.apache.poi.xwpf.usermodel.XWPFParagraph;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHyperlink;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
-
-/**
- * Decorator class for XWPFParagraph allowing to add hyperlinks
- * found in paragraph to its text.
- * <p/>
- * Note - adds the hyperlink at the end, not in the right place...
- *
- * @deprecated Use {@link XWPFHyperlinkRun} instead
- */
-@Deprecated
-public class XWPFHyperlinkDecorator extends XWPFParagraphDecorator {
- private StringBuffer hyperlinkText;
-
- /**
- * @param nextDecorator The next decorator to use
- * @param outputHyperlinkUrls Should we output the links too, or just the link text?
- */
- public XWPFHyperlinkDecorator(XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
- this(nextDecorator.paragraph, nextDecorator, outputHyperlinkUrls);
- }
-
- /**
- * @param prgrph The paragraph of text to work on
- * @param outputHyperlinkUrls Should we output the links too, or just the link text?
- */
- public XWPFHyperlinkDecorator(XWPFParagraph prgrph, XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
- super(prgrph, nextDecorator);
-
- hyperlinkText = new StringBuffer();
-
- // loop over hyperlink anchors
- for (CTHyperlink link : paragraph.getCTP().getHyperlinkArray()) {
- for (CTR r : link.getRArray()) {
- // Loop over text runs
- for (CTText text : r.getTArray()) {
- hyperlinkText.append(text.getStringValue());
- }
- }
- if (outputHyperlinkUrls && paragraph.getDocument().getHyperlinkByID(link.getId()) != null) {
- hyperlinkText.append(" <" + paragraph.getDocument().getHyperlinkByID(link.getId()).getURL() + ">");
- }
- }
- }
-
- public String getText() {
- return super.getText() + hyperlinkText;
- }
-}
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/model/TestXWPFDecorators.java b/src/ooxml/testcases/org/apache/poi/xwpf/model/TestXWPFDecorators.java
index aa1167dd01..5bf50459e1 100644
--- a/src/ooxml/testcases/org/apache/poi/xwpf/model/TestXWPFDecorators.java
+++ b/src/ooxml/testcases/org/apache/poi/xwpf/model/TestXWPFDecorators.java
@@ -39,7 +39,6 @@ public class TestXWPFDecorators extends TestCase {
comments = XWPFTestDataSamples.openSampleDocument("WordWithAttachments.docx");
}
- @SuppressWarnings("deprecation")
public void testHyperlink() {
XWPFParagraph ps;
XWPFParagraph ph;
@@ -64,27 +63,6 @@ public class TestXWPFDecorators extends TestCase {
XWPFHyperlinkRun link = (XWPFHyperlinkRun) ph.getRuns().get(1);
assertEquals("http://poi.apache.org/", link.getHyperlink(hyperlink).getURL());
-
-
- // Test the old style decorator
- // You probably don't want to still be using it...
- assertEquals(
- "I am a test document",
- (new XWPFHyperlinkDecorator(ps, null, false)).getText()
- );
- assertEquals(
- "I am a test document",
- (new XWPFHyperlinkDecorator(ps, null, true)).getText()
- );
-
- assertEquals(
- "We have a hyperlink here, and another.hyperlink",
- (new XWPFHyperlinkDecorator(ph, null, false)).getText()
- );
- assertEquals(
- "We have a hyperlink here, and another.hyperlink <http://poi.apache.org/>",
- (new XWPFHyperlinkDecorator(ph, null, true)).getText()
- );
}
public void testComments() {