01: /*
02: * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
03: *
04: * The program is provided "as is" without any warranty express or
05: * implied, including the warranty of non-infringement and the implied
06: * warranties of merchantibility and fitness for a particular purpose.
07: * IBM will not be liable for any damages suffered by you as a result
08: * of using the Program. In no event will IBM be liable for any
09: * special, indirect or consequential damages or lost profits even if
10: * IBM has been advised of the possibility of their occurrence. IBM
11: * will not be liable for any third party claims against you.
12: */
13: package com.ibm.richtext.styledtext;
14:
15: import com.ibm.richtext.textlayout.attributes.AttributeMap;
16:
17: abstract class MParagraphBuffer {
18: static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
19:
20: /**
21: * Returns the start of the paragraph containing offset <tt>pos</tt>.
22: */
23: abstract int paragraphStart(int pos);
24:
25: /**
26: * Returns the limit of the paragraph containing offset <tt>pos</tt>.
27: */
28: abstract int paragraphLimit(int pos);
29:
30: /**
31: * Returns the style of the paragraph containing offset <tt>pos</tt>.
32: */
33: abstract AttributeMap paragraphStyleAt(int offset);
34:
35: /**
36: * Process a character insertion at offset <tt>start</tt>.
37: * If a paragraph break was inserted, propogate paragraph style at
38: * <tt>start</tt> to new paragraph.
39: */
40: abstract void insertText(int start, char insertedChar);
41:
42: /**
43: * Process character insertion at offset <tt>start</tt>.
44: * Each new paragraph gets paragraph style at
45: * <tt>start</tt>.
46: */
47: abstract void insertText(int start, char[] srcChars, int srcStart,
48: int srcLimit);
49:
50: /**
51: * Process deletion by removing paragraph breaks contained in
52: * deleted range. Propogate paragraph styles backward, if necessary.
53: */
54: abstract void deleteText(int start, int limit, int[] damagedRange);
55:
56: /*
57: * Replace paragraph breaks/styles between start and limit with paragraph breaks/styles
58: * from <tt>srcText</tt>.
59: * @param start an offset into the text
60: * @param limit the index after the last character to replace
61: * @param srcText the text from which new paragraphs are taken
62: * @param srcStart the start of the range in <code>srcText</code> to copy
63: * @param srcLimit the first index after the range in <code>srcText</code> to copy
64: */
65: abstract void replace(int start, int limit, MConstText srcText,
66: int srcStart, int srcLimit, int[] damagedRange);
67:
68: /**
69: * Set the style of all paragraphs containing offsets in the range [start, limit) to
70: * <tt>style</tt>.
71: */
72: abstract boolean modifyParagraphStyles(int start, int limit,
73: StyleModifier modifier, int[] damagedRange);
74:
75: /**
76: * Minimize the amount of memory used by this object.
77: */
78: abstract void compress();
79: }
|