bdelacretaz 2002/10/31 09:26:05 Modified: src/org/apache/fop/apps CommandLineOptions.java Driver.java src/org/apache/fop/tools/anttasks Fop.java Log: rtf renderer selection mechanism added, no rtf renderer yet Revision Changes Path 1.20 +21 -2 xml-fop/src/org/apache/fop/apps/CommandLineOptions.java Index: CommandLineOptions.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/CommandLineOptions.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- CommandLineOptions.java 4 Sep 2002 08:36:35 -0000 1.19 +++ CommandLineOptions.java 31 Oct 2002 17:26:04 -0000 1.20 @@ -50,6 +50,8 @@ private static final int SVG_OUTPUT = 8; /* output: XML area tree */ private static final int AREA_OUTPUT = 9; + /* output: RTF file */ + private static final int RTF_OUTPUT = 10; /* show configuration information */ Boolean dumpConfiguration = Boolean.FALSE; @@ -184,6 +186,15 @@ outfile = new File(args[i + 1]); i++; } + } else if (args[i].equals("-rtf")) { + setOutputMode(RTF_OUTPUT); + if ((i + 1 == args.length) + || (args[i + 1].charAt(0) == '-')) { + throw new FOPException("you must specify the rtf output file"); + } else { + outfile = new File(args[i + 1]); + i++; + } } else if (args[i].equals("-print")) { setOutputMode(PRINT_OUTPUT); // show print help @@ -347,6 +358,8 @@ case AREA_OUTPUT: rendererOptions.put("fineDetail", isCoarseAreaXml()); return Driver.RENDER_XML; + case RTF_OUTPUT: + return Driver.RENDER_RTF; default: throw new FOPException("Invalid Renderer setting!"); } @@ -471,7 +484,7 @@ * shows the commandline syntax including a summary of all available options and some examples */ public static void printUsage() { - System.err.println("\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-pcl|-ps|-txt|-at|-print] <outfile>\n" + System.err.println("\nUSAGE\nFop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-pcl|-ps|-txt|-at|-print] <outfile>\n" + " [OPTIONS] \n" + " -d debug mode \n" + " -x dump configuration settings \n" @@ -489,6 +502,7 @@ + " -pdf outfile input will be rendered as pdf file (outfile req'd) \n" + " -awt input will be displayed on screen \n" + " -mif outfile input will be rendered as mif file (outfile req'd)\n" + + " -rtf outfile input will be rendered as rtf file (outfile req'd)\n" + " -pcl outfile input will be rendered as pcl file (outfile req'd) \n" + " -ps outfile input will be rendered as PostScript file (outfile req'd) \n" + " -txt outfile input will be rendered as text file (outfile req'd) \n" @@ -500,6 +514,7 @@ + " Fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)\n" + " Fop -xsl foo.xsl -xml foo.xml -pdf foo.pdf\n" + " Fop foo.fo -mif foo.mif\n" + + " Fop foo.fo -rtf foo.rtf\n" + " Fop foo.fo -print or Fop -print foo.fo \n" + " Fop foo.fo -awt \n"); } @@ -554,6 +569,10 @@ break; case MIF_OUTPUT: log.debug("mif"); + log.debug("output file: " + outfile.toString()); + break; + case RTF_OUTPUT: + log.debug("rtf"); log.debug("output file: " + outfile.toString()); break; case PRINT_OUTPUT: 1.56 +10 -1 xml-fop/src/org/apache/fop/apps/Driver.java Index: Driver.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- Driver.java 25 Oct 2002 09:29:39 -0000 1.55 +++ Driver.java 31 Oct 2002 17:26:04 -0000 1.56 @@ -135,6 +135,11 @@ public static final int RENDER_SVG = 9; /** + * Render to RTF. OutputStream must be set + */ + public static final int RENDER_RTF = 10; + + /** * the FO tree builder */ private FOTreeBuilder _treeBuilder; @@ -308,6 +313,7 @@ * <li>RENDER_PS * <li>RENDER_TXT * <li>RENDER_SVG + * <li>RENDER_RTF * </ul> * @param renderer the type of renderer to use */ @@ -337,6 +343,9 @@ break; case RENDER_SVG: setRenderer("org.apache.fop.render.svg.SVGRenderer"); + break; + case RENDER_RTF: + if(true) throw new IllegalArgumentException("-rtf option recognized but RTF output is not implemented yet"); break; default: throw new IllegalArgumentException("Unknown renderer type"); 1.22 +7 -1 xml-fop/src/org/apache/fop/tools/anttasks/Fop.java Index: Fop.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/tools/anttasks/Fop.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- Fop.java 15 Sep 2002 23:35:33 -0000 1.21 +++ Fop.java 31 Oct 2002 17:26:05 -0000 1.22 @@ -205,6 +205,10 @@ } else if (format.equalsIgnoreCase("application/vnd.mif") || format.equalsIgnoreCase("mif")) { return Driver.RENDER_MIF; + } else if (format.equalsIgnoreCase("application/msword") || + format.equalsIgnoreCase("application/rtf") || + format.equalsIgnoreCase("rtf")) { + return Driver.RENDER_RTF; } else if (format.equalsIgnoreCase("application/vnd.hp-PCL") || format.equalsIgnoreCase("pcl")) { return Driver.RENDER_PCL; @@ -230,6 +234,8 @@ return ".ps"; case Driver.RENDER_MIF: return ".mif"; + case Driver.RENDER_RTF: + return ".rtf"; case Driver.RENDER_PCL: return ".pcl"; case Driver.RENDER_TXT:
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]