Author: ltheussl
Date: Fri Sep 14 04:44:23 2007
New Revision: 575636

URL: http://svn.apache.org/viewvc?rev=575636&view=rev
Log:
Adding a cover page

Modified:
    maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml
    
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
    
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
    maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt
    
maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java

Modified: maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml?rev=575636&r1=575635&r2=575636&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml (original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/pom.xml Fri Sep 14 04:44:23 2007
@@ -23,11 +23,17 @@
   <parent>
     <artifactId>doxia</artifactId>
     <groupId>org.apache.maven.doxia</groupId>
-    <version>1.0-alpha-9-SNAPSHOT</version>
+    <version>1.0-alpha-9</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>doxia-module-fo</artifactId>
+  <version>1.0-alpha-9-SNAPSHOT</version>
   <name>Doxia :: FO Module</name>
+
+  <properties>
+    <doxiaVersion>1.0-alpha-9</doxiaVersion>
+  </properties>
+
   <developers>
     <developer>
       <id>ltheussl</id>
@@ -44,14 +50,19 @@
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-core</artifactId>
-      <version>${projectVersion}</version>
+      <version>${doxiaVersion}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-sink-api</artifactId>
-      <version>${projectVersion}</version>
+      <version>${doxiaVersion}</version>
     </dependency>
-    <dependency> 
+    <dependency>
+      <groupId>org.apache.maven.doxia</groupId>
+      <artifactId>doxia-doc-renderer</artifactId>
+      <version>${doxiaVersion}</version>
+    </dependency>
+    <dependency>
       <groupId>commons-configuration</groupId>
       <artifactId>commons-configuration</artifactId>
       <version>1.4</version>
@@ -71,7 +82,7 @@
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-core</artifactId>
-      <version>${projectVersion}</version>
+      <version>${doxiaVersion}</version>
       <classifier>tests</classifier>
       <scope>test</scope>
     </dependency>

Modified: 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java?rev=575636&r1=575635&r2=575636&view=diff
==============================================================================
--- 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
 (original)
+++ 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
 Fri Sep 14 04:44:23 2007
@@ -21,6 +21,7 @@
 
 import java.io.Writer;
 
+import org.apache.maven.doxia.docrenderer.document.DocumentMeta;
 import org.apache.maven.doxia.util.HtmlTools;
 
 /**
@@ -352,5 +353,124 @@
         }
     }
 
+    public void coverPage( DocumentMeta meta )
+    {
+        String title = meta.getTitle();
+        String author = meta.getAuthor();
+
+        // TODO: remove hard-coded settings
+
+        writeStartTag( "page-sequence", "master-reference", "cover-page" );
+        writeStartTag( "flow", "flow-name", "xsl-region-body" );
+        writeStartTag( "block", "text-align", "center" );
+        //writeStartTag( "table", "table-layout", "fixed" );
+        writeln( "<fo:table table-layout=\"fixed\" width=\"100%\" >" );
+        writeEmptyTag( "table-column", "column-width", "3.125in" );
+        writeEmptyTag( "table-column", "column-width", "3.125in" );
+        writeStartTag( "table-body", null );
+
+        writeStartTag( "table-row", "height", "1.5in" );
+        writeStartTag( "table-cell", null );
+        // TODO: companyLogo
+        writeEmptyTag( "block", null );
+        writeEndTag( "table-cell" );
+        writeStartTag( "table-cell", null );
+        // TODO: projectLogo
+        writeEmptyTag( "block", null );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeln( "<fo:table-row keep-with-previous=\"always\" 
height=\"0.014in\">" );
+        writeStartTag( "table-cell", "number-columns-spanned", "2" );
+        writeStartTag( "block", "line-height", "0.014in" );
+        writeEmptyTag( "leader", "chapter.rule" );
+        writeEndTag( "block" );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeStartTag( "table-row", "height", "7.447in" );
+        writeStartTag( "table-cell", "number-columns-spanned", "2" );
+        //writeStartTag( "table", "table-layout", "fixed" );
+        writeln( "<fo:table table-layout=\"fixed\" width=\"100%\" >" );
+        writeEmptyTag( "table-column", "column-width", "2.083in" );
+        writeEmptyTag( "table-column", "column-width", "2.083in" );
+        writeEmptyTag( "table-column", "column-width", "2.083in" );
+
+        writeStartTag( "table-body", null );
+
+        writeStartTag( "table-row", null );
+        writeStartTag( "table-cell", "number-columns-spanned", "3" );
+        writeEmptyTag( "block", null );
+        writeEmptyTag( "block", "space-before", "3.2235in" );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeStartTag( "table-row", null );
+        writeStartTag( "table-cell", null );
+        writeEmptyTag( "block", "space-after", "0.5in" );
+        writeEndTag( "table-cell" );
+
+        writeStartTag( "table-cell", "number-columns-spanned", "2", 
"cover.border.left" );
+        writeStartTag( "block", "cover.title" );
+        write( title );
+        // TODO: version
+        writeEndTag( "block" );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeStartTag( "table-row", null );
+        writeStartTag( "table-cell", null );
+        writeEmptyTag( "block", null );
+        writeEndTag( "table-cell" );
+
+
+        writeStartTag( "table-cell", "number-columns-spanned", "2", 
"cover.border.left.bottom" );
+        writeStartTag( "block", "cover.subtitle" );
+        // TODO: sub title (cover type)
+        writeEndTag( "block" );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeEndTag( "table-body" );
+        writeEndTag( "table" );
+
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeStartTag( "table-row", "height", "0.014in" );
+        writeStartTag( "table-cell", "number-columns-spanned", "2" );
+        writeln( "<fo:block space-after=\"0.2in\" line-height=\"0.014in\">" );
+        writeEmptyTag( "leader", "chapter.rule" );
+        writeEndTag( "block" );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeStartTag( "table-row", null );
+        writeStartTag( "table-cell", "number-columns-spanned", "2" );
+        writeEmptyTag( "block", null );
+        writeEmptyTag( "block", "space-before", "0.2in" );
+        writeEndTag( "table-cell" );
+        writeEndTag( "table-row" );
+
+        writeStartTag( "table-row", "height", "0.3in" );
+        writeStartTag( "table-cell", null );
+        writeStartTag( "block", "height", "0.3in", "cover.subtitle" );
+        write( author );
+        writeEndTag( "block" );
+        writeEndTag( "table-cell" );
+
+        writeStartTag( "table-cell", null );
+        writeStartTag( "block", "height", "0.3in", "cover.subtitle" );
+        // TODO: date
+        writeEndTag( "block" );
+        writeEndTag( "table-cell" );
+
+        writeEndTag( "table-row" );
+        writeEndTag( "table-body" );
+        writeEndTag( "table" );
+        writeEndTag( "block" );
+        writeEndTag( "flow" );
+        writeEndTag( "page-sequence" );
+    }
 
 }

Modified: 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java?rev=575636&r1=575635&r2=575636&view=diff
==============================================================================
--- 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
 (original)
+++ 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoSink.java
 Fri Sep 14 04:44:23 2007
@@ -927,6 +927,36 @@
     }
 
     /**
+     * Writes a start tag, prepending EOL.
+     *
+     * @param tag The tag name.
+     * @param id An id to add.
+     * @param name The name (value) of the id.
+     * @param attributeId An id identifying the attribute set.
+     */
+    protected void writeStartTag( String tag, String id, String name, String 
attributeId )
+    {
+        String attribs = config.getAttributeSet( attributeId );
+        newline();
+        write( "<fo:" + tag + " " + id + "=\"" + name + "\"" + attribs + ">" );
+    }
+
+
+    /**
+     * Writes an empty tag, prepending EOL.
+     *
+     * @param tag The tag name.
+     * @param id An id to add.
+     * @param name The name (value) of the id.
+     */
+    protected void writeEmptyTag( String tag, String id, String name )
+    {
+        newline();
+        write( "<fo:" + tag + " " + id + "=\"" + name + "\"/>" );
+    }
+
+
+    /**
      * Writes an end tag, appending EOL.
      *
      * @param tag The tag name.

Modified: 
maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt?rev=575636&r1=575635&r2=575636&view=diff
==============================================================================
--- maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt 
(original)
+++ maven/sandbox/trunk/doxia/doxia-module-fo/src/main/resources/fo-styles.xslt 
Fri Sep 14 04:44:23 2007
@@ -271,6 +271,9 @@
         <xsl:attribute name="keep-with-next">always</xsl:attribute>
         <xsl:attribute name="font-size">16pt</xsl:attribute>
         <xsl:attribute name="font-weight">bold</xsl:attribute>
+        <xsl:attribute name="text-align">left</xsl:attribute>
+        <xsl:attribute name="display-align">center</xsl:attribute>
+        <xsl:attribute name="space-after">0.5in</xsl:attribute>
     </xsl:attribute-set>
     <xsl:attribute-set name="cover.subtitle">
         <xsl:attribute name="font-family">Helvetica,sans-serif</xsl:attribute>
@@ -278,6 +281,8 @@
         <xsl:attribute name="keep-with-next">always</xsl:attribute>
         <xsl:attribute name="font-size">12pt</xsl:attribute>
         <xsl:attribute name="font-weight">bold</xsl:attribute>
+        <xsl:attribute name="text-align">left</xsl:attribute>
+        <xsl:attribute name="display-align">center</xsl:attribute>
     </xsl:attribute-set>
     <xsl:attribute-set name="cover.border.left" 
use-attribute-sets="base.pre.style">
         <xsl:attribute name="padding-start">0.2in</xsl:attribute>

Modified: 
maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
URL: 
http://svn.apache.org/viewvc/maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java?rev=575636&r1=575635&r2=575636&view=diff
==============================================================================
--- 
maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
 (original)
+++ 
maven/sandbox/trunk/doxia/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoSinkTest.java
 Fri Sep 14 04:44:23 2007
@@ -22,6 +22,8 @@
 import java.io.File;
 import java.io.Writer;
 
+import org.apache.maven.doxia.docrenderer.document.DocumentMeta;
+
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.AbstractSinkTest;
 import org.apache.maven.doxia.sink.SinkTestDocument;
@@ -63,6 +65,8 @@
 
         fosink.beginDocument();
 
+        fosink.coverPage( getMeta() );
+
         fosink.setDocumentName( "doc1" );
         SinkTestDocument.generate( fosink );
 
@@ -74,6 +78,14 @@
 
         // then generate PDF
         fo2pdf( "aggregate" );
+    }
+
+    private DocumentMeta getMeta()
+    {
+        DocumentMeta meta = new DocumentMeta();
+        meta.setAuthor( "The Apache Maven Project" );
+        meta.setTitle( "Doxia FO Sink" );
+        return meta;
     }
 
     // ----------------------------------------------------------------------


Reply via email to