]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
rtf renderer selection mechanism added, no rtf renderer yet
authorBertrand Delacretaz <bdelacretaz@apache.org>
Thu, 31 Oct 2002 17:26:05 +0000 (17:26 +0000)
committerBertrand Delacretaz <bdelacretaz@apache.org>
Thu, 31 Oct 2002 17:26:05 +0000 (17:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195396 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/apps/CommandLineOptions.java
src/org/apache/fop/apps/Driver.java
src/org/apache/fop/tools/anttasks/Fop.java

index 764424308a5a4ea7c02ecb473b5d8250fece5b53..4297d2e5651012d6beff964355578a871260a1c2 100644 (file)
@@ -50,6 +50,8 @@ public class CommandLineOptions {
     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 @@ public class CommandLineOptions {
                     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 @@ public class CommandLineOptions {
         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 @@ public class CommandLineOptions {
      * 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 @@ public class CommandLineOptions {
                                + "  -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 @@ public class CommandLineOptions {
                                + "  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");
     }
@@ -556,6 +571,10 @@ public class CommandLineOptions {
             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:
             log.debug("print directly");
             if (outfile != null) {
index 4b341a0cd2ed8e638a687cbd98e71bbbbc951d3c..d885c9ab2af64de3cff1e7b2a4ed215961f5c508 100644 (file)
@@ -134,6 +134,11 @@ public class Driver implements LogEnabled {
      */
     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
      */
@@ -308,6 +313,7 @@ public class Driver implements LogEnabled {
      * <li>RENDER_PS
      * <li>RENDER_TXT
      * <li>RENDER_SVG
+     * <li>RENDER_RTF
      * </ul>
      * @param renderer the type of renderer to use
      */
@@ -338,6 +344,9 @@ public class Driver implements LogEnabled {
         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");
         }
index cc9e07e3be91b226a1711f4cdf9da5296e8cf85f..47a665c7ef6ca9da2b112d955e3b3d3be977ebc7 100644 (file)
@@ -205,6 +205,10 @@ class FOPTaskStarter extends Starter {
         } 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 @@ class FOPTaskStarter extends Starter {
                 return ".ps";
             case Driver.RENDER_MIF:
                 return ".mif";
+            case Driver.RENDER_RTF:
+                return ".rtf";
             case Driver.RENDER_PCL:
                 return ".pcl";
             case Driver.RENDER_TXT: