| java.lang.Object com.ibm.richtext.styledtext.MParagraphBuffer com.ibm.richtext.styledtext.ParagraphBuffer
ParagraphBuffer | final class ParagraphBuffer extends MParagraphBuffer implements Externalizable(Code) | | This class stores offsets where paragraph breaks occur, and the style applied to
each paragraph.
The offsets where paragraph breaks occur are stored in a RunArray object. This is
not strictly necessary, but it makes scanning the text for paragraph breaks unnecessary.
However, it makes determining where paragraphs start a little confusing. If there is a
paragraph break at offset p, then there will be a paragraph start at offset p+1.
If the last character in the text is a paragraph break, there will be a run array entry
for that character (and also a paragraph style for that paragraph, even though the
style does not apply to any text).
The style of the first paragraph in the text is in the fFirstStyle member. Other
paragraph styles are stored in the fStyleTable array, in the following manner: the
paragraph with begins at offset fRunArray.fRunStart[i]+1 has style fStyleTable[i].
The style table's "gap range" is kept in sync with the RunArray.
This class propogates paragraph styles in the "Microsoft Word" fashion: styles
propogate backward from paragraph breaks.
This class maintains a time stamp, which changes every time extra formatting (formatting
on a range other than the current selection) is needed; for example, when a paragraph
break is removed.
|
Constructor Summary | |
| ParagraphBuffer(MCharBuffer charBuffer) Construct a new paragraph buffer from the characters in charBuffer. | public | ParagraphBuffer() Note: this constructor is ONLY for use by the Serialization
mechanism. |
Method Summary | |
void | compress() | public void | deleteText(int start, int limit, int[] damagedRange) Process deletion by removing paragraph breaks contained in
deleted range. | public void | insertText(int start, char insertedChar) Process a character insertion at offset start. | public void | insertText(int start, char srcChars, int srcStart, int srcLimit) Process character insertion at offset start. | public boolean | modifyParagraphStyles(int start, int limit, StyleModifier modifier, int[] damagedRange) Modify the style of all paragraphs containing offsets in the range [start, limit) to
style. | public int | paragraphLimit(int pos) Returns the limit of the paragraph containing offset pos. | public int | paragraphStart(int pos) Returns the start of the paragraph containing offset pos. | public AttributeMap | paragraphStyleAt(int offset) Returns the style of the paragraph containing offset pos. | public void | readExternal(ObjectInput in) | public void | replace(int start, int limit, MConstText srcText, int srcStart, int srcLimit, int[] damagedRange) Replace paragraph breaks/styles between start and length with paragraph breaks/styles
from srcText. | public void | writeExternal(ObjectOutput out) |
ParagraphBuffer | ParagraphBuffer(MCharBuffer charBuffer)(Code) | | Construct a new paragraph buffer from the characters in charBuffer.
|
ParagraphBuffer | public ParagraphBuffer()(Code) | | Note: this constructor is ONLY for use by the Serialization
mechanism. It does not leave this object in a valid state!
|
compress | void compress()(Code) | | |
deleteText | public void deleteText(int start, int limit, int[] damagedRange)(Code) | | Process deletion by removing paragraph breaks contained in
deleted range. Propogate paragraph styles backward, if necessary.
|
insertText | public void insertText(int start, char insertedChar)(Code) | | Process a character insertion at offset start.
If a paragraph break was inserted, propogate paragraph style at
start to new paragraph.
|
insertText | public void insertText(int start, char srcChars, int srcStart, int srcLimit)(Code) | | Process character insertion at offset start.
Each new paragraph gets paragraph style at
start.
|
modifyParagraphStyles | public boolean modifyParagraphStyles(int start, int limit, StyleModifier modifier, int[] damagedRange)(Code) | | Modify the style of all paragraphs containing offsets in the range [start, limit) to
style.
|
paragraphLimit | public int paragraphLimit(int pos)(Code) | | Returns the limit of the paragraph containing offset pos.
|
paragraphStart | public int paragraphStart(int pos)(Code) | | Returns the start of the paragraph containing offset pos.
|
paragraphStyleAt | public AttributeMap paragraphStyleAt(int offset)(Code) | | Returns the style of the paragraph containing offset pos.
|
replace | public void replace(int start, int limit, MConstText srcText, int srcStart, int srcLimit, int[] damagedRange)(Code) | | Replace paragraph breaks/styles between start and length with paragraph breaks/styles
from srcText.
Parameters: start - an offset into the text Parameters: limit - the index after the last character to replace Parameters: srcText - the text from which new paragraphs are taken Parameters: srcStart - the start of the range in srcText to copy Parameters: srcLimit - the first index after the range in srcText to copy |
Fields inherited from com.ibm.richtext.styledtext.MParagraphBuffer | final static String COPYRIGHT(Code)(Java Doc)
|
Methods inherited from com.ibm.richtext.styledtext.MParagraphBuffer | abstract void compress()(Code)(Java Doc) abstract void deleteText(int start, int limit, int[] damagedRange)(Code)(Java Doc) abstract void insertText(int start, char insertedChar)(Code)(Java Doc) abstract void insertText(int start, char[] srcChars, int srcStart, int srcLimit)(Code)(Java Doc) abstract boolean modifyParagraphStyles(int start, int limit, StyleModifier modifier, int[] damagedRange)(Code)(Java Doc) abstract int paragraphLimit(int pos)(Code)(Java Doc) abstract int paragraphStart(int pos)(Code)(Java Doc) abstract AttributeMap paragraphStyleAt(int offset)(Code)(Java Doc) abstract void replace(int start, int limit, MConstText srcText, int srcStart, int srcLimit, int[] damagedRange)(Code)(Java Doc)
|
|
|