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: // Requires Java2
14: package com.ibm.richtext.textformat;
15:
16: import com.ibm.richtext.textlayout.attributes.AttributeMap;
17:
18: import com.ibm.richtext.styledtext.MConstText;
19:
20: ///*JDK12IMPORTS
21: import java.awt.font.FontRenderContext;
22: import java.awt.font.LineBreakMeasurer;
23:
24: //JDK12IMPORTS*/
25:
26: /*JDK11IMPORTS
27: import com.ibm.richtext.textlayout.FontRenderContext;
28: import com.ibm.richtext.textlayout.LineBreakMeasurer;
29: import com.ibm.richtext.textlayout.Graphics2D;
30: JDK11IMPORTS*/
31:
32: /**
33: * ParagraphRenderer is a factory for LayoutInfo objects.
34: */
35: abstract class ParagraphRenderer {
36:
37: static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
38:
39: // If renderers can ever travel with their styles, then this attribute will denote a
40: // renderer. For now, renderers are not added as styles so this isn't needed.
41: //static final TextAttribute PARAGRAPH_RENDERER = new TextAttribute("Paragraph_Renderer") {};
42:
43: /**
44: * Reset the renderer to use information from this style. Since renderers may be shared, you should
45: * make sure the renderer is initialized for the style you wish to render before you use it.
46: */
47: public void initRenderer(AttributeMap pStyle) {
48: }
49:
50: /**
51: * Return a LayoutInfo for the paragraph represented by
52: * measurer.
53: * @param text the text containing the paragraph
54: * @param layoutToReuse clients can pass in a LayoutInfo
55: * which the ParagraphRenderer may choose to reuse
56: * and return. If null, a new LayoutInfo will be
57: * created and returned.
58: * @param measurer the LineBreakMeasurer for this paragraph.
59: * Current position should be the first character on the line.
60: * If null, a 0-length line is generated. If measurer is null
61: * then paragraphStart and paragraphLimit should be equal.
62: * @param frc the FontRenderContext used for measurerment
63: * @param paragraphStart the index in the text where the
64: * current paragraph begins
65: * @param paragraphLimit the index of the first character
66: * after the current paragraph
67: * @param totalFormatWidth the width in which the line should fit
68: * @param lineBound where right-aligned lines are aligned
69: */
70: public abstract LayoutInfo layout(MConstText text,
71: LayoutInfo layoutToReuse, LineBreakMeasurer measurer,
72: FontRenderContext frc, int paragraphStart,
73: int paragraphLimit, int totalFormatWidth, int lineBound);
74:
75: }
|