From a99abc5ff856e1348439c7d8dd55fb0531fe2b66 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Wed, 25 Jul 2018 13:09:54 +0000 Subject: [PATCH] make ReadOnlySharedStringsTable subclassable git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1836627 13f79535-47bb-0310-9956-ffa450edef68 --- .../ReadOnlySharedStringsTable.java | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java index e17e259e82..4879e347f8 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java @@ -23,9 +23,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; @@ -79,31 +77,26 @@ import org.xml.sax.helpers.DefaultHandler; */ public class ReadOnlySharedStringsTable extends DefaultHandler { - private final boolean includePhoneticRuns; + protected final boolean includePhoneticRuns; + /** * An integer representing the total count of strings in the workbook. This count does not * include any numbers, it counts only the total of text strings in the workbook. */ - private int count; + protected int count; /** * An integer representing the total count of unique strings in the Shared String Table. * A string is unique even if it is a copy of another string, but has different formatting applied * at the character level. */ - private int uniqueCount; + protected int uniqueCount; /** * The shared strings table. */ private List strings; - /** - * Map of phonetic strings (if they exist) indexed - * with the integer matching the index in strings - */ - private Map phoneticStrings; - /** * Calls {{@link #ReadOnlySharedStringsTable(OPCPackage, boolean)}} with * a value of true for including phonetic runs @@ -240,7 +233,6 @@ public class ReadOnlySharedStringsTable extends DefaultHandler { if(uniqueCount != null) this.uniqueCount = Integer.parseInt(uniqueCount); this.strings = new ArrayList<>(this.uniqueCount); - this.phoneticStrings = new HashMap<>(); characters = new StringBuilder(64); } else if ("si".equals(localName)) { characters.setLength(0); @@ -255,8 +247,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler { } } - public void endElement(String uri, String localName, String name) - throws SAXException { + public void endElement(String uri, String localName, String name) throws SAXException { if (uri != null && ! uri.equals(NS_SPREADSHEETML)) { return; } @@ -273,8 +264,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler { /** * Captures characters only if a t(ext) element is open. */ - public void characters(char[] ch, int start, int length) - throws SAXException { + public void characters(char[] ch, int start, int length) throws SAXException { if (tIsOpen) { if (inRPh && includePhoneticRuns) { characters.append(ch, start, length); -- 2.39.5