KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > etranslate > tm > processing > rtf > RTFParserDelegate


1 /*
2  * Copyright (C) 2001 eTranslate, Inc. All Rights Reserved
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * Contact: <eric@etranslate.com>
19  */

20
21 package com.etranslate.tm.processing.rtf;
22
23 import java.util.List JavaDoc;
24
25 /**
26  * Implemented by classes that receive RTFParser messages.
27  *
28  * Created: Tue Jul 3 10:29:05 2001
29  *
30  * @author Eric Friedman
31  * @version $Id: RTFParserDelegate.java,v 1.2 2001/07/10 03:07:53 eric Exp $
32  */

33
34 public interface RTFParserDelegate {
35     /** CVS version info for this interface */
36     public static final String JavaDoc VERSION = "$Id: RTFParserDelegate.java,v 1.2 2001/07/10 03:07:53 eric Exp $";
37
38     /** constants representing RTF contexts in which text events may occur */
39     public static final int IN_DOCUMENT = 0;
40     public static final int IN_FONTTBL = 1;
41     public static final int IN_FILETBL = 2;
42     public static final int IN_COLORTBL = 3;
43     public static final int IN_STYLESHEET = 4;
44     public static final int IN_LISTTABLE = 5;
45     public static final int IN_STYLE = 6;
46     public static final int IN_REVTBL = 7;
47     public static final int IN_INFO = 8;
48     public static final int IN_PNTEXT = 9;
49     public static final String JavaDoc NO_STYLE = new String JavaDoc();
50     
51     /**
52      * Receive a block of text from the RTF document. The text is
53      * in the named style and occurs in <code>context</code.
54      *
55      * <p>Style is guaranteed to have object identity with one of the
56      * styles in the list provided by the styleList message, if that
57      * has been called.</p>
58      *
59      * @param text a <code>String</code> value
60      * @param style a <code>String</code> value
61      * @param context an <code>int</code> value
62      */

63     public void text(String JavaDoc text, String JavaDoc style, int context);
64
65     /**
66      * Receive a control symbol in a particular context.
67      *
68      * @param controlSymbol a <code>String</code> value
69      * @param context an <code>int</code> value
70      */

71     public void controlSymbol(String JavaDoc controlSymbol, int context);
72
73     /**
74      * Receive a control word in a particular context. The value, if
75      * not provided, will be <code>0</code> as per the RTF spec.
76      *
77      * @param controlWord a <code>String</code> value
78      * @param value an <code>int</code> value
79      * @param context an <code>int</code> value
80      */

81     public void controlWord(String JavaDoc controlWord, int value, int context);
82
83     /**
84      * Receive notification about the opening of an RTF group with the
85      * specified depth. The depth value is that of the group just opened.
86      *
87      * @param depth an <code>int</code> value
88      */

89     public void openGroup(int depth);
90
91     /**
92      * Receive notification about the closing of an RTF group with the
93      * specified depth. The depth value is that of the group just closed.
94      *
95      * @param depth an <code>int</code> value
96      */

97     public void closeGroup(int depth);
98
99     /**
100      * Receive notification about the list of style names defined for the
101      * document
102      *
103      * @param styles a <code>List</code> of <code>String</code> objects.
104      */

105     public void styleList(List JavaDoc styles);
106     
107     /**
108      * The document parsing has begun.
109      *
110      */

111     public void startDocument();
112
113     /**
114      * Parsing is complete.
115      *
116      */

117     public void endDocument();
118
119 }// RTFParserDelegate
120
Popular Tags