summaryrefslogtreecommitdiffstats
path: root/src/scratchpad
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2018-01-01 11:54:01 +0000
committerPJ Fanning <fanningpj@apache.org>2018-01-01 11:54:01 +0000
commit4c4bddf5c776b92783e9691fce853b96990a37be (patch)
treeee93c02e5f62b3d80c3aa1108c6158eb5cffc1f7 /src/scratchpad
parentfe589a664e0b9a942a4a827e36e4f1500e28f7a1 (diff)
downloadpoi-4c4bddf5c776b92783e9691fce853b96990a37be.tar.gz
poi-4c4bddf5c776b92783e9691fce853b96990a37be.zip
Bug-61947 add back deprecated methods (removed by accident)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819761 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java159
1 files changed, 159 insertions, 0 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
index e832e8b7d2..eae15813c9 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
@@ -361,6 +361,165 @@ public class Range { // TODO -instantiable superclass
return getCharacterRun( numCharacterRuns() - 1 );
}
+ /**
+ * Inserts text into the front of this range and it gives that text the
+ * CharacterProperties specified in props.
+ *
+ * @param text
+ * The text to insert.
+ * @param props
+ * The CharacterProperties to give the text.
+ * @return A new CharacterRun that has the given text and properties and is
+ * n ow a part of the document.
+ * @deprecated POI 3.8 beta 4. User code should not work with {@link CharacterProperties}
+ */
+ @Deprecated
+ private CharacterRun insertBefore(String text, CharacterProperties props)
+ {
+ initAll();
+ PAPX papx = _paragraphs.get(_parStart);
+ short istd = papx.getIstd();
+
+ StyleSheet ss = _doc.getStyleSheet();
+ CharacterProperties baseStyle = ss.getCharacterStyle(istd);
+ byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
+ SprmBuffer buf = new SprmBuffer(grpprl, 0);
+ _doc.getCharacterTable().insert(_charStart, _start, buf);
+
+ return insertBefore(text);
+ }
+
+ /**
+ * Inserts text onto the end of this range and gives that text the
+ * CharacterProperties specified in props.
+ *
+ * @param text
+ * The text to insert.
+ * @param props
+ * The CharacterProperties to give the text.
+ * @return A new CharacterRun that has the given text and properties and is
+ * n ow a part of the document.
+ * @deprecated POI 3.8 beta 4. User code should not work with {@link CharacterProperties}
+ */
+ @Deprecated
+ private CharacterRun insertAfter(String text, CharacterProperties props)
+ {
+ initAll();
+ PAPX papx = _paragraphs.get(_parEnd - 1);
+ short istd = papx.getIstd();
+
+ StyleSheet ss = _doc.getStyleSheet();
+ CharacterProperties baseStyle = ss.getCharacterStyle(istd);
+ byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(props, baseStyle);
+ SprmBuffer buf = new SprmBuffer(grpprl, 0);
+ _doc.getCharacterTable().insert(_charEnd, _end, buf);
+ _charEnd++;
+ return insertAfter(text);
+ }
+
+ /**
+ * Inserts and empty paragraph into the front of this range.
+ *
+ * @param props
+ * The properties that the new paragraph will have.
+ * @param styleIndex
+ * The index into the stylesheet for the new paragraph.
+ * @return The newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ private Paragraph insertBefore(ParagraphProperties props, int styleIndex)
+ {
+ return this.insertBefore(props, styleIndex, "\r");
+ }
+
+ /**
+ * Inserts a paragraph into the front of this range. The paragraph will
+ * contain one character run that has the default properties for the
+ * paragraph's style.
+ *
+ * It is necessary for the text to end with the character '\r'
+ *
+ * @param props
+ * The paragraph's properties.
+ * @param styleIndex
+ * The index of the paragraph's style in the style sheet.
+ * @param text
+ * The text to insert.
+ * @return A newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ private Paragraph insertBefore(ParagraphProperties props, int styleIndex, String text)
+ {
+ initAll();
+ StyleSheet ss = _doc.getStyleSheet();
+ ParagraphProperties baseStyle = ss.getParagraphStyle(styleIndex);
+ CharacterProperties baseChp = ss.getCharacterStyle(styleIndex);
+
+ byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
+ byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
+ LittleEndian.putShort(withIndex, 0, (short) styleIndex);
+ System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
+ SprmBuffer buf = new SprmBuffer(withIndex, 2);
+
+ _doc.getParagraphTable().insert(_parStart, _start, buf);
+ insertBefore(text, baseChp);
+ return getParagraph(0);
+ }
+
+ /**
+ * Inserts and empty paragraph into the end of this range.
+ *
+ * @param props
+ * The properties that the new paragraph will have.
+ * @param styleIndex
+ * The index into the stylesheet for the new paragraph.
+ * @return The newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ protected Paragraph insertAfter(ParagraphProperties props, int styleIndex)
+ {
+ return this.insertAfter(props, styleIndex, "\r");
+ }
+
+ /**
+ * Inserts a paragraph into the end of this range. The paragraph will
+ * contain one character run that has the default properties for the
+ * paragraph's style.
+ *
+ * It is necessary for the text to end with the character '\r'
+ *
+ * @param props
+ * The paragraph's properties.
+ * @param styleIndex
+ * The index of the paragraph's style in the style sheet.
+ * @param text
+ * The text to insert.
+ * @return A newly inserted paragraph.
+ * @deprecated POI 3.8 beta 4. Use code shall not work with {@link ParagraphProperties}
+ */
+ @Deprecated
+ protected Paragraph insertAfter(ParagraphProperties props, int styleIndex, String text)
+ {
+ initAll();
+ StyleSheet ss = _doc.getStyleSheet();
+ ParagraphProperties baseStyle = ss.getParagraphStyle(styleIndex);
+ CharacterProperties baseChp = ss.getCharacterStyle(styleIndex);
+
+ byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
+ byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
+ LittleEndian.putShort(withIndex, 0, (short) styleIndex);
+ System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
+ SprmBuffer buf = new SprmBuffer(withIndex, 2);
+
+ _doc.getParagraphTable().insert(_parEnd, _end, buf);
+ _parEnd++;
+ insertAfter(text, baseChp);
+ return getParagraph(numParagraphs() - 1);
+ }
+
public void delete() {
initAll();