From f5c273065a35be668be2c935b31be04d8a2c1198 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 19 Apr 2005 09:24:15 +0000 Subject: [PATCH] ControlWordToken.java, [...]: New files. 2005-04-19 Michael Koch * javax/swing/text/rtf/ControlWordToken.java, javax/swing/text/rtf/RTFEditorKit.java, javax/swing/text/rtf/RTFParseException.java, javax/swing/text/rtf/RTFParser.java, javax/swing/text/rtf/RTFScanner.java, javax/swing/text/rtf/TextToken.java, javax/swing/text/rtf/Token.java: New files. * Makefile.am: Added new files. * Makefile.in: Regenerated. From-SVN: r98393 --- libjava/ChangeLog | 12 + libjava/Makefile.am | 7 + libjava/Makefile.in | 77 ++++- .../swing/text/rtf/ControlWordToken.java | 86 ++++++ .../javax/swing/text/rtf/RTFEditorKit.java | 114 ++++++++ .../swing/text/rtf/RTFParseException.java | 65 +++++ libjava/javax/swing/text/rtf/RTFParser.java | 195 +++++++++++++ libjava/javax/swing/text/rtf/RTFScanner.java | 268 ++++++++++++++++++ libjava/javax/swing/text/rtf/TextToken.java | 65 +++++ libjava/javax/swing/text/rtf/Token.java | 91 ++++++ 10 files changed, 976 insertions(+), 4 deletions(-) create mode 100644 libjava/javax/swing/text/rtf/ControlWordToken.java create mode 100644 libjava/javax/swing/text/rtf/RTFEditorKit.java create mode 100644 libjava/javax/swing/text/rtf/RTFParseException.java create mode 100644 libjava/javax/swing/text/rtf/RTFParser.java create mode 100644 libjava/javax/swing/text/rtf/RTFScanner.java create mode 100644 libjava/javax/swing/text/rtf/TextToken.java create mode 100644 libjava/javax/swing/text/rtf/Token.java diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 38bc818d39e..37cb8d93e1d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,15 @@ +2005-04-19 Michael Koch + + * javax/swing/text/rtf/ControlWordToken.java, + javax/swing/text/rtf/RTFEditorKit.java, + javax/swing/text/rtf/RTFParseException.java, + javax/swing/text/rtf/RTFParser.java, + javax/swing/text/rtf/RTFScanner.java, + javax/swing/text/rtf/TextToken.java, + javax/swing/text/rtf/Token.java: New files. + * Makefile.am: Added new files. + * Makefile.in: Regenerated. + 2005-04-19 Michael Koch * java/awt/geom/QuadCurve2D.java: diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 66da66bb6b3..9c3b6628804 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -1886,6 +1886,13 @@ javax/swing/text/View.java \ javax/swing/text/ViewFactory.java \ javax/swing/text/html/HTML.java \ javax/swing/text/html/parser/ParserDelegator.java \ +javax/swing/text/rtf/ControlWordToken.java \ +javax/swing/text/rtf/RTFEditorKit.java \ +javax/swing/text/rtf/RTFParseException.java \ +javax/swing/text/rtf/RTFParser.java \ +javax/swing/text/rtf/RTFScanner.java \ +javax/swing/text/rtf/TextToken.java \ +javax/swing/text/rtf/Token.java \ javax/swing/tree/TreeNode.java \ javax/swing/tree/AbstractLayoutCache.java \ javax/swing/tree/DefaultMutableTreeNode.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index e61b505f623..4e1bf4f3d7b 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -1765,7 +1765,13 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ javax/swing/text/ViewFactory.java \ javax/swing/text/html/HTML.java \ javax/swing/text/html/parser/ParserDelegator.java \ - javax/swing/tree/TreeNode.java \ + javax/swing/text/rtf/ControlWordToken.java \ + javax/swing/text/rtf/RTFEditorKit.java \ + javax/swing/text/rtf/RTFParseException.java \ + javax/swing/text/rtf/RTFParser.java \ + javax/swing/text/rtf/RTFScanner.java \ + javax/swing/text/rtf/TextToken.java \ + javax/swing/text/rtf/Token.java javax/swing/tree/TreeNode.java \ javax/swing/tree/AbstractLayoutCache.java \ javax/swing/tree/DefaultMutableTreeNode.java \ javax/swing/tree/DefaultTreeCellEditor.java \ @@ -3030,7 +3036,13 @@ am__objects_10 = gnu/awt/LightweightRedirector.lo \ javax/swing/text/Utilities.lo javax/swing/text/View.lo \ javax/swing/text/ViewFactory.lo javax/swing/text/html/HTML.lo \ javax/swing/text/html/parser/ParserDelegator.lo \ - javax/swing/tree/TreeNode.lo \ + javax/swing/text/rtf/ControlWordToken.lo \ + javax/swing/text/rtf/RTFEditorKit.lo \ + javax/swing/text/rtf/RTFParseException.lo \ + javax/swing/text/rtf/RTFParser.lo \ + javax/swing/text/rtf/RTFScanner.lo \ + javax/swing/text/rtf/TextToken.lo \ + javax/swing/text/rtf/Token.lo javax/swing/tree/TreeNode.lo \ javax/swing/tree/AbstractLayoutCache.lo \ javax/swing/tree/DefaultMutableTreeNode.lo \ javax/swing/tree/DefaultTreeCellEditor.lo \ @@ -5557,6 +5569,13 @@ javax/swing/text/View.java \ javax/swing/text/ViewFactory.java \ javax/swing/text/html/HTML.java \ javax/swing/text/html/parser/ParserDelegator.java \ +javax/swing/text/rtf/ControlWordToken.java \ +javax/swing/text/rtf/RTFEditorKit.java \ +javax/swing/text/rtf/RTFParseException.java \ +javax/swing/text/rtf/RTFParser.java \ +javax/swing/text/rtf/RTFScanner.java \ +javax/swing/text/rtf/TextToken.java \ +javax/swing/text/rtf/Token.java \ javax/swing/tree/TreeNode.java \ javax/swing/tree/AbstractLayoutCache.java \ javax/swing/tree/DefaultMutableTreeNode.java \ @@ -12978,6 +12997,32 @@ javax/swing/text/html/parser/$(DEPDIR)/$(am__dirstamp): javax/swing/text/html/parser/ParserDelegator.lo: \ javax/swing/text/html/parser/$(am__dirstamp) \ javax/swing/text/html/parser/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/$(am__dirstamp): + @$(mkdir_p) javax/swing/text/rtf + @: > javax/swing/text/rtf/$(am__dirstamp) +javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp): + @$(mkdir_p) javax/swing/text/rtf/$(DEPDIR) + @: > javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/ControlWordToken.lo: \ + javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/RTFEditorKit.lo: \ + javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/RTFParseException.lo: \ + javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/RTFParser.lo: \ + javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/RTFScanner.lo: \ + javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/TextToken.lo: \ + javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) +javax/swing/text/rtf/Token.lo: javax/swing/text/rtf/$(am__dirstamp) \ + javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) javax/swing/tree/$(am__dirstamp): @$(mkdir_p) javax/swing/tree @: > javax/swing/tree/$(am__dirstamp) @@ -19240,6 +19285,20 @@ mostlyclean-compile: -rm -f javax/swing/text/html/HTML.lo -rm -f javax/swing/text/html/parser/ParserDelegator.$(OBJEXT) -rm -f javax/swing/text/html/parser/ParserDelegator.lo + -rm -f javax/swing/text/rtf/ControlWordToken.$(OBJEXT) + -rm -f javax/swing/text/rtf/ControlWordToken.lo + -rm -f javax/swing/text/rtf/RTFEditorKit.$(OBJEXT) + -rm -f javax/swing/text/rtf/RTFEditorKit.lo + -rm -f javax/swing/text/rtf/RTFParseException.$(OBJEXT) + -rm -f javax/swing/text/rtf/RTFParseException.lo + -rm -f javax/swing/text/rtf/RTFParser.$(OBJEXT) + -rm -f javax/swing/text/rtf/RTFParser.lo + -rm -f javax/swing/text/rtf/RTFScanner.$(OBJEXT) + -rm -f javax/swing/text/rtf/RTFScanner.lo + -rm -f javax/swing/text/rtf/TextToken.$(OBJEXT) + -rm -f javax/swing/text/rtf/TextToken.lo + -rm -f javax/swing/text/rtf/Token.$(OBJEXT) + -rm -f javax/swing/text/rtf/Token.lo -rm -f javax/swing/tree/AbstractLayoutCache.$(OBJEXT) -rm -f javax/swing/tree/AbstractLayoutCache.lo -rm -f javax/swing/tree/DefaultMutableTreeNode.$(OBJEXT) @@ -21817,6 +21876,13 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/$(DEPDIR)/ViewFactory.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/html/$(DEPDIR)/HTML.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/html/parser/$(DEPDIR)/ParserDelegator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/ControlWordToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/RTFEditorKit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/RTFParseException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/RTFParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/RTFScanner.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/TextToken.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@javax/swing/text/rtf/$(DEPDIR)/Token.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/tree/$(DEPDIR)/AbstractLayoutCache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/tree/$(DEPDIR)/DefaultMutableTreeNode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@javax/swing/tree/$(DEPDIR)/DefaultTreeCellEditor.Plo@am__quote@ @@ -22543,6 +22609,7 @@ clean-libtool: -rm -rf javax/swing/text/.libs javax/swing/text/_libs -rm -rf javax/swing/text/html/.libs javax/swing/text/html/_libs -rm -rf javax/swing/text/html/parser/.libs javax/swing/text/html/parser/_libs + -rm -rf javax/swing/text/rtf/.libs javax/swing/text/rtf/_libs -rm -rf javax/swing/tree/.libs javax/swing/tree/_libs -rm -rf javax/swing/undo/.libs javax/swing/undo/_libs -rm -rf javax/transaction/.libs javax/transaction/_libs @@ -23175,6 +23242,8 @@ distclean-generic: -rm -f javax/swing/text/html/$(am__dirstamp) -rm -f javax/swing/text/html/parser/$(DEPDIR)/$(am__dirstamp) -rm -f javax/swing/text/html/parser/$(am__dirstamp) + -rm -f javax/swing/text/rtf/$(DEPDIR)/$(am__dirstamp) + -rm -f javax/swing/text/rtf/$(am__dirstamp) -rm -f javax/swing/tree/$(DEPDIR)/$(am__dirstamp) -rm -f javax/swing/tree/$(am__dirstamp) -rm -f javax/swing/undo/$(DEPDIR)/$(am__dirstamp) @@ -23203,7 +23272,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) + -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/text/rtf/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-local distclean-tags @@ -23234,7 +23303,7 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) + -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/text/rtf/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/libjava/javax/swing/text/rtf/ControlWordToken.java b/libjava/javax/swing/text/rtf/ControlWordToken.java new file mode 100644 index 00000000000..043cae412e7 --- /dev/null +++ b/libjava/javax/swing/text/rtf/ControlWordToken.java @@ -0,0 +1,86 @@ +/* ControlWordToken.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * A special {@link Token} that represents a control word in RTF like + * '\deff0' where 'deff' is the name of the control word and '0' is an + * optional parameter. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class ControlWordToken extends Token +{ + + /** + * The name of the control word. + */ + public String name; + + /** + * The optional parameter of the control word. Absence of a parameter is + * expressed through Integer.MIN_VALUE. + */ + public int param; + + /** + * Constructs a new ControlWordToken with the specified name and without + * a parameter. + * + * @param name the name of the control word + */ + public ControlWordToken(String name) + { + this(name, Integer.MIN_VALUE); + } + + + /** + * Constructs a new ControlWordToken with the specified name and parameter. + * + * @param name the name of the control word + */ + public ControlWordToken(String name, int param) + { + super(Token.CONTROL_WORD); + this.name = name; + this.param = param; + } + +} diff --git a/libjava/javax/swing/text/rtf/RTFEditorKit.java b/libjava/javax/swing/text/rtf/RTFEditorKit.java new file mode 100644 index 00000000000..8a6e88a84e4 --- /dev/null +++ b/libjava/javax/swing/text/rtf/RTFEditorKit.java @@ -0,0 +1,114 @@ +/* RTFEditorKit.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.StyledEditorKit; + +/** + * Provides support for RTF data for use in + * {@link javax.swing.JEditorPane}s. + * + * @author Roman Kennke (roman@ontographics.com) + */ +public class RTFEditorKit + extends StyledEditorKit +{ + + /** + * Constructs a new RTFEditorKit. + */ + public RTFEditorKit() + { + super(); + } + + /** + * Returns the MIME content type. In the case of RTFEditorKit this is + * 'text/rtf' + * + * @return the MIME content type for RTFEditorKit + */ + public String getContentType() + { + return "text/rtf"; + } + + /** + * Reads RTF data from stream into doc at the + * specified position pos. + * + * @param stream the {@link InputStream} from where we read RTF data + * @param doc the {@link Document} into which we read the RTF data + * @param pos the position where to start + * + * @throws IOException if an IO error occurs + * @throws BadLocationException if the position is not valid + */ + public void read(InputStream stream, Document doc, int pos) + throws IOException, BadLocationException + { + RTFParser parser = new RTFParser(stream, doc, pos); + parser.parse(); + } + + + /** + * Reads RTF data from reader into doc at the + * specified position pos. + * + * @param reader the {@link Reader} from where we read RTF data + * @param doc the {@link Document} into which we read the RTF data + * @param pos the position where to start + * + * @throws IOException if an IO error occurs + * @throws BadLocationException if the position is not valid + */ + public void read(Reader reader, Document doc, int pos) + throws IOException, BadLocationException + { + RTFParser parser = new RTFParser(reader, doc, pos); + parser.parse(); + } +} diff --git a/libjava/javax/swing/text/rtf/RTFParseException.java b/libjava/javax/swing/text/rtf/RTFParseException.java new file mode 100644 index 00000000000..dba51d2e0c3 --- /dev/null +++ b/libjava/javax/swing/text/rtf/RTFParseException.java @@ -0,0 +1,65 @@ +/* RTFParseException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * Indicates a parsing error during RTF processing. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFParseException + extends RuntimeException +{ + /** + * Constructs a new RTFParseException without message. + */ + public RTFParseException() + { + super(); + } + + /** + * Constructs a new RTFParseException with the specified message. + */ + public RTFParseException(String message) + { + super(message); + } + +} diff --git a/libjava/javax/swing/text/rtf/RTFParser.java b/libjava/javax/swing/text/rtf/RTFParser.java new file mode 100644 index 00000000000..fe837fbff3a --- /dev/null +++ b/libjava/javax/swing/text/rtf/RTFParser.java @@ -0,0 +1,195 @@ +/* RTFParser.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; + +/** + * Parses an RTF file into a {@link Document}. The parser utilizes + * {@link RTFScanner}. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFParser +{ + + /** + * Our scanner. + */ + private RTFScanner scanner; + + /** + * The document into which we parse. + */ + private Document doc; + + /** + * The current position. + */ + private int pos; + + /** + * Constructs a new RTFParser for the specified document and position, + * without initializing the scanner. This is only used internally. + * + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + private RTFParser(Document doc, int pos) + { + this.doc = doc; + this.pos = pos; + } + + /** + * Constructs a new RTFParser for the specified stream. + * + * @param stream the stream from which we parse + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + public RTFParser(InputStream stream, Document doc, int pos) + { + this(doc, pos); + scanner = new RTFScanner(stream); + } + + /** + * Constructs a new RTFParser for the specified reader. + * + * @param reader the reader from which we parse + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + public RTFParser(Reader reader, Document doc, int pos) + { + this(doc, pos); + scanner = new RTFScanner(reader); + } + + /** + * Returns the {@link Document} in which we parsed the RTF data. + * + * @return the {@link Document} in which we parsed the RTF data + */ + public Document getDocument() + { + return doc; + } + + /** + * Starts the parsing process. + */ + public void parse() + throws IOException, BadLocationException + { + parseFile(); + } + + /** + * The parse rules for <file>. + */ + private void parseFile() + throws IOException, BadLocationException + { + Token t1 = scanner.readToken(); + if (t1.type != Token.LCURLY) + throw new RTFParseException("expected left curly braces"); + + parseHeader(); + parseDocument(); + + Token t2 = scanner.readToken(); + if (t2.type != Token.RCURLY) + throw new RTFParseException("expected right curly braces"); + + } + + /** + * The parse rules for <header>. + * + * TODO: implement this properly + */ + private void parseHeader() + //throws IOException, BadLocationException + { + // TODO add parse rules here + } + + + /** + * The parse rules for <document>. + * + * TODO: implement this properly + */ + private void parseDocument() + throws IOException, BadLocationException + { + // !!! TODO !!! + // This simply emits every TEXT Token as text to the document + // which is plain stupid + + boolean eof = false; + + do { + Token token = scanner.readToken(); + switch (token.type) + { + case Token.TEXT: + TextToken textToken = (TextToken) token; + doc.insertString(pos, textToken.text, null); + pos += textToken.text.length(); + break; + case Token.EOF: + eof = true; + break; + default: + // FIXME + break; + } + } while (!eof); + + } + +} diff --git a/libjava/javax/swing/text/rtf/RTFScanner.java b/libjava/javax/swing/text/rtf/RTFScanner.java new file mode 100644 index 00000000000..d964a43472c --- /dev/null +++ b/libjava/javax/swing/text/rtf/RTFScanner.java @@ -0,0 +1,268 @@ +/* RTFScanner.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; + +/** + * Provides a scanner that scans an {@link InputStream} for tokens of the + * RTF syntax. + * + * This scanner is based upon the RTF specification 1.6 + * available at: + * + * + * RTF specification at MSDN + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFScanner +{ + + /** + * The reader from which we read the RTF data. + */ + private Reader in; + + /** + * This is used to constuct strings from the read in chars. + */ + private StringBuffer buffer; + + /** + * Constructs a new RTFScanner without initializing the {@link Reader}. + */ + private RTFScanner() + { + buffer = new StringBuffer(); + } + + /** + * Constructs a new RTFScanner for the given {@link InputStream}. + * The stream is wrapped into an {@link InputStreamReader} and if it's + * not yet buffered then the Reader is wrapped in a {@link BufferedReader} + * + * @param stream the {@link InputStream} to read RTF data from + */ + public RTFScanner(InputStream stream) + { + this(); + InputStreamReader reader = new InputStreamReader(stream); + in = new BufferedReader(reader); + } + + /** + * Constructs a new RTFScanner for the given {@link Reader}. + * + * If the reader is not an instance of {@link BufferedReader} then it + * is wrapped into a BufferedReader. + * + * @param reader the {@link BufferedReader} to read RTF data from + */ + public RTFScanner(Reader reader) + { + this(); + if (reader instanceof BufferedReader) + { + in = reader; + } + else + { + in = new BufferedReader(reader); + } + } + + /** + * Reads in the next {@link Token} from the stream. + * + * @return the read {@link Token} + * + * @throws IOException if the underlying stream has problems + */ + public Token readToken() + throws IOException + { + Token token = null; + + int c = in.read(); + switch(c) + { + case -1: + token = new Token(Token.EOF); + break; + + case '{': + token = new Token(Token.LCURLY); + break; + + case '}': + token = new Token(Token.RCURLY); + break; + + case '\\': + buffer.delete(0, buffer.length()); + buffer.append((char) c); + token = readControlWord(); + break; + + default: + buffer.delete(0, buffer.length()); + buffer.append((char) c); + token = readText(); + break; + } + + return token; + } + + /** + * Reads in a control word and optional parameter. + * + * @return the read in control word as {@link ControlWordToken} + * + * @throws IOException if the underlying stream has problems + */ + private Token readControlWord() + throws IOException + { + // this flag indicates if we are still reading the name or are already + // in the parameter + boolean readingName = true; + String name = null; + String param = null; + + while (true) + { + in.mark(1); + int c = in.read(); + + // check for 'a'..'z' + if (readingName && (c >= 'a') && (c <= 'z')) + { + buffer.append((char) c); + } + else if ((c >= '0') && (c <= '9')) + { + // if the last char was in the name, then finish reading the name + if (readingName) + { + name = buffer.toString(); + buffer.delete(0, buffer.length()); + readingName = false; + } + buffer.append((char) c); + } + else + { + // if we were in the name, then finish this + if (readingName) + { + name = buffer.toString(); + } + // otherwise finish the parameter + else + { + param = buffer.toString(); + } + + // clear up + buffer.delete(0, buffer.length()); + // reset input buffer to last char + in.reset(); + // break while loop + break; + } + } + + ControlWordToken token = null; + + if (param == null) + token = new ControlWordToken(name); + else + token =new ControlWordToken(name, Integer.parseInt(param)); + + return token; + + } + + /** + * Reads in a block of text. + * + * @return the token for the text + */ + private Token readText() + throws IOException + { + + boolean readingText = true; + while (readingText) + { + in.mark(1); + int c = in.read(); + switch(c) + { + case '\\': + case '{': + case '}': + case -1: + readingText = false; + in.reset(); + break; + + default: + buffer.append((char) c); + break; + } + + } + + String text = buffer.toString(); + Token token = new TextToken(text); + + buffer.delete(0, buffer.length()); + + return token; + + } +} diff --git a/libjava/javax/swing/text/rtf/TextToken.java b/libjava/javax/swing/text/rtf/TextToken.java new file mode 100644 index 00000000000..e326792cc1b --- /dev/null +++ b/libjava/javax/swing/text/rtf/TextToken.java @@ -0,0 +1,65 @@ +/* TextToken.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * A special {@link Token} that represents a piece of text in RTF. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class TextToken extends Token +{ + + /** + * The text. + */ + public String text; + + /** + * Constructs a new TextToken with the specified textual data. + * + * @param text the text for this token + */ + public TextToken(String text) + { + super(Token.TEXT); + this.text = text; + } + +} diff --git a/libjava/javax/swing/text/rtf/Token.java b/libjava/javax/swing/text/rtf/Token.java new file mode 100644 index 00000000000..a7a955269dc --- /dev/null +++ b/libjava/javax/swing/text/rtf/Token.java @@ -0,0 +1,91 @@ +/* Token.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * Represents a simple token that the RTFScanner can read. A simple + * only has a type (like LCURLY or RCURLY). More complex tokens may + * attach data to the token. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class Token +{ + + /** + * This special type inidicates the end of the input stream. + */ + public static final int EOF = -1; + + /** + * A left curly brace '{'. + */ + public static final int LCURLY = 1; + + /** + * A right curly brace '}'. + */ + public static final int RCURLY = 2; + + /** + * A control word like '\rtf1'. Tokens with this type are represented + * through the subclass {@link ControlWordToken}. + */ + public static final int CONTROL_WORD = 3; + + /** + * A token that contains text. This is represented through the subclass + * {@link TextToken}. + */ + public static final int TEXT = 4; + + + /** The token type. */ + public int type; + + /** + * Constructs a new Token with the specified type. + * + * @param type the Token type + */ + public Token(int type) + { + this.type = type; + } +}