]> source.dussan.org Git - poi.git/commitdiff
Bug-61947 add back deprecated methods (removed by accident)
authorPJ Fanning <fanningpj@apache.org>
Mon, 1 Jan 2018 11:54:01 +0000 (11:54 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 1 Jan 2018 11:54:01 +0000 (11:54 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819761 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java

index e832e8b7d29f324a1ffb60a39f3d2de56d7d3b00..eae15813c96c55f9fe4de948d99225de522d6260 100644 (file)
@@ -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();