View | Details | Raw Unified | Return to bug 53400
Collapse All | Expand All

(-)src/documentation/content/xdocs/trunk/running.xml (-1 / +3 lines)
Lines 109-115 Link Here
109
      </p>
109
      </p>
110
      <source><![CDATA[
110
      <source><![CDATA[
111
USAGE
111
USAGE
112
Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>
112
Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-odt|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>
113
 [OPTIONS]
113
 [OPTIONS]
114
  -version          print FOP version and exit
114
  -version          print FOP version and exit
115
  -d                debug mode
115
  -d                debug mode
Lines 164-169 Link Here
164
  -pdfa1b outfile   input will be rendered as PDF/A-1b compliant PDF
164
  -pdfa1b outfile   input will be rendered as PDF/A-1b compliant PDF
165
                    (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b")
165
                    (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b")
166
  -awt              input will be displayed on screen
166
  -awt              input will be displayed on screen
167
  -odt outfile      input will be rendered as ODT (outfile req'd)
167
  -rtf outfile      input will be rendered as RTF (outfile req'd)
168
  -rtf outfile      input will be rendered as RTF (outfile req'd)
168
  -pcl outfile      input will be rendered as PCL (outfile req'd)
169
  -pcl outfile      input will be rendered as PCL (outfile req'd)
169
  -ps outfile       input will be rendered as PostScript (outfile req'd)
170
  -ps outfile       input will be rendered as PostScript (outfile req'd)
Lines 197-202 Link Here
197
  fop -xml foo.xml -xsl foo.xsl -foout foo.fo
198
  fop -xml foo.xml -xsl foo.xsl -foout foo.fo
198
  fop -xml - -xsl foo.xsl -pdf -
199
  fop -xml - -xsl foo.xsl -pdf -
199
  fop foo.fo -mif foo.mif
200
  fop foo.fo -mif foo.mif
201
  fop foo.fo -odt foo.odt
200
  fop foo.fo -rtf foo.rtf
202
  fop foo.fo -rtf foo.rtf
201
  fop foo.fo -print
203
  fop foo.fo -print
202
  fop foo.fo -awt]]></source>
204
  fop foo.fo -awt]]></source>
(-)src/documentation/content/xdocs/trunk/output.xml (+9 lines)
Lines 1112-1117 Link Here
1112
      </section>
1112
      </section>
1113
    </section>
1113
    </section>
1114
  </section>
1114
  </section>
1115
<section id="odt">
1116
  <title>ODT</title>
1117
  <p>
1118
    An open source XSL-FO to ODT converter has been integrated into Apache FOP.
1119
    This will create an ODT (rich text format) document that will
1120
    attempt to contain as much information from the XSL-FO document as
1121
    possible.
1122
  </p>
1123
</section>
1115
<section id="rtf">
1124
<section id="rtf">
1116
  <title>RTF</title>
1125
  <title>RTF</title>
1117
  <p>
1126
  <p>
(-)src/java/org/apache/fop/render/odf/FopOdfConverter.java (+47 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf;
19
20
import java.io.OutputStream;
21
22
import org.apache.fop.fo.FONode;
23
24
/**
25
 * Renderer that renders areas to odt.
26
 */
27
public interface FopOdfConverter {
28
29
    /**
30
     * Initialisation of converter
31
     * @throws OdfException
32
     */
33
    void init() throws OdfException;
34
35
    /**
36
     * Write created odf document to the output stream
37
     * @param os output stream
38
     */
39
    void writeToOutputStream(OutputStream os);
40
41
    /**
42
     * Convert FONode with its children to odf document holden by converter
43
     * @param foNode node of xslfo
44
     */
45
    void convertRecursively(FONode foNode);
46
47
}
(-)src/java/org/apache/fop/render/odf/OdfException.java (+32 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf;
19
20
import org.apache.avalon.framework.CascadingException;
21
22
public class OdfException extends CascadingException {
23
24
    /**
25
     *
26
     */
27
    private static final long serialVersionUID = 6464226563894799824L;
28
29
    public OdfException(String message, Throwable throwable) {
30
        super(message, throwable);
31
    }
32
}
(-)src/java/org/apache/fop/render/odf/ODTHandler.java (+74 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf;
19
20
import java.io.OutputStream;
21
22
import org.xml.sax.SAXException;
23
24
import org.apache.fop.apps.FOUserAgent;
25
import org.apache.fop.fo.FOEventHandler;
26
import org.apache.fop.fo.pagination.PageSequence;
27
28
import org.apache.fop.render.odf.odt.FopOdtConverter;
29
30
/**
31
 * ODT Handler: generates ODT output
32
 */
33
public class ODTHandler extends FOEventHandler {
34
35
    private FopOdfConverter converter = new FopOdtConverter();
36
37
    private final OutputStream os;
38
39
    /**
40
     * Constructor : keeping output stream
41
     */
42
    public ODTHandler(FOUserAgent userAgent, OutputStream os) {
43
        super(userAgent);
44
        this.os = os;
45
    }
46
47
    /**
48
     * {@inheritDoc}
49
     */
50
    @Override
51
    public void startDocument() throws SAXException {
52
        try {
53
            converter.init();
54
        } catch (OdfException e) {
55
            e.printStackTrace();
56
        }
57
    }
58
59
    /**
60
     * {@inheritDoc}
61
     */
62
    @Override
63
    public void endDocument() throws SAXException {
64
        converter.writeToOutputStream(os);
65
    }
66
67
    /**
68
     * {@inheritDoc}
69
     */
70
    @Override
71
    public void endPageSequence(PageSequence pageSeq) {
72
        converter.convertRecursively(pageSeq);
73
    }
74
}
(-)src/java/org/apache/fop/render/odf/FopTagType.java (+26 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf;
19
20
/**
21
 * Defines START and END tags helping to detect hierachical structure of xslfo.
22
 */
23
public enum FopTagType {
24
    START,
25
    END;
26
}
(-)src/java/org/apache/fop/render/odf/odt/Namespace.java (+40 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt;
19
20
/**
21
 * Defines namespeces used for odf attributes.
22
 */
23
public final class Namespace {
24
25
    public static final String OFFICE = "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
26
27
    public static final String FO     = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0";
28
29
    public static final String XLINK  = "http://www.w3.org/1999/xlink";
30
31
    public static final String SVG    = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0";
32
33
    public static final String TABLE  = "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
34
35
    public static final String STYLE = "urn:oasis:names:tc:opendocument:xmlns:style:1.0";
36
37
    public static final String TEXT  = "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
38
39
    private Namespace() {  }
40
}
(-)src/java/org/apache/fop/render/odf/odt/FopOdtConverter.java (+115 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt;
19
20
import java.io.OutputStream;
21
import java.util.Iterator;
22
23
import org.odftoolkit.simple.TextDocument;
24
25
import org.apache.fop.fo.FONode;
26
27
import org.apache.fop.render.odf.FopOdfConverter;
28
import org.apache.fop.render.odf.FopTagType;
29
import org.apache.fop.render.odf.OdfException;
30
import org.apache.fop.render.odf.odt.tags.RootTag;
31
import org.apache.fop.render.odf.odt.tags.Tag;
32
import org.apache.fop.render.odf.odt.tags.TagFactory;
33
34
/**
35
 * Renderer that renders areas to odt.
36
 */
37
public class FopOdtConverter implements FopOdfConverter {
38
39
    TextDocument odt = null;
40
41
    private TagFactory factory = new TagFactory();
42
43
    private Tag actualTag = null;
44
45
    /**
46
     * {@inheritDoc}
47
     * @throws OdfException
48
     */
49
    public void init() throws OdfException {
50
51
        try {
52
            odt = TextDocument.newTextDocument();
53
        } catch (Exception e) {
54
            throw new OdfException("Can't initialize the document", e);
55
        }
56
57
        actualTag = new RootTag(odt);
58
    }
59
60
    /**
61
     * {@inheritDoc}
62
     */
63
    public void writeToOutputStream(OutputStream os) {
64
65
        try {
66
            odt.save(os);
67
        } catch (Exception e) {
68
            System.err.println(e.getMessage());
69
            e.printStackTrace();
70
        }
71
    }
72
73
    /**
74
     * {@inheritDoc}
75
     */
76
    public void convertRecursively(FONode foNode) {
77
        this.convert(foNode, FopTagType.START);
78
79
        if (foNode.getChildNodes() != null) {
80
            for (Iterator<?> it = foNode.getChildNodes(); it.hasNext();) {
81
                FONode fn = (FONode) it.next();
82
                convertRecursively(fn);
83
            }
84
        }
85
86
        this.convert(foNode, FopTagType.END);
87
    }
88
89
    /**
90
     * Convert one tag to the element of odt.
91
     * @param image the image which will be painted
92
     * @param context the renderer context for the current renderer
93
     */
94
    private void convert(FONode foNode, FopTagType type) {
95
        if (type == FopTagType.START) {
96
            try {
97
                actualTag = factory.getTag(this, foNode, actualTag);
98
            } catch (OdfException e1) {
99
                e1.printStackTrace();
100
            }
101
            try {
102
                actualTag.execute();
103
            } catch (OdfException e) {
104
                e.printStackTrace();
105
            }
106
        } else if (type == FopTagType.END) {
107
            try {
108
                actualTag.closeIntercept();
109
            } catch (OdfException e) {
110
                e.printStackTrace();
111
            }
112
            actualTag = actualTag.getParent();
113
        }
114
    }
115
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableCellTag.java (+138 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.element.style.StyleStyleElement;
21
import org.odftoolkit.odfdom.dom.element.style.StyleTableCellPropertiesElement;
22
import org.odftoolkit.odfdom.dom.element.table.TableTableCellElement;
23
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
24
25
import org.apache.fop.fo.flow.table.TableCell;
26
import org.apache.fop.render.odf.OdfException;
27
import org.apache.fop.render.odf.odt.Namespace;
28
29
/**
30
 * TableCell converter
31
 */
32
public class TableCellTag extends Tag {
33
34
    private TableCell tblCell = null;
35
36
    private TableTableCellElement tce = null;
37
38
    TableCellTag(Tag parent, TableCell tblCell) {
39
        super(parent);
40
        this.tblCell = tblCell;
41
    }
42
43
    public TableCell getTableCell() {
44
        return tblCell;
45
    }
46
47
    public TableTableCellElement getTableCellElement() {
48
        return tce;
49
    }
50
51
    /**
52
     * {@inheritDoc}
53
     * @throws OdfException
54
     */
55
    @Override
56
    public void execute() throws OdfException {
57
58
        try {
59
            tce = (TableTableCellElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TableTableCellElement.ELEMENT_NAME);
60
        } catch (Exception e) {
61
            throw new OdfException("Can't create table cell", e);
62
        }
63
64
        StyleStyleElement sse = null;
65
        try {
66
            sse = (StyleStyleElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleStyleElement.ELEMENT_NAME);
67
        } catch (Exception e) {
68
            throw new OdfException("Can't create the style for new table cell", e);
69
        }
70
71
        sse.setAttributeNS(Namespace.STYLE, "style:family", "table-cell");
72
73
        StyleTableCellPropertiesElement stcpe = null;
74
75
        try {
76
            stcpe = (StyleTableCellPropertiesElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleTableCellPropertiesElement.ELEMENT_NAME);
77
        } catch (Exception e) {
78
            throw new OdfException("Can't create style fot table cell", e);
79
        }
80
81
        float borderSize = Math.round(((float)tblCell.getCommonBorderPaddingBackground().getBorderStartWidth(false)) / 100);
82
        borderSize = borderSize / 10;
83
        stcpe.setAttributeNS(Namespace.FO, "fo:border-left", Float.toString(borderSize) + "pt solid #000000");
84
85
        borderSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getBorderEndWidth(false) / 100);
86
        borderSize = borderSize / 10;
87
        stcpe.setAttributeNS(Namespace.FO, "fo:border-right", Float.toString(borderSize) + "pt solid #000000");
88
89
        borderSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getBorderBeforeWidth(false) / 100);
90
        borderSize = borderSize / 10;
91
        stcpe.setAttributeNS(Namespace.FO, "fo:border-top", Float.toString(borderSize) + "pt solid #000000");
92
93
        borderSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getBorderAfterWidth(false) / 100);
94
        borderSize = borderSize / 10;
95
        stcpe.setAttributeNS(Namespace.FO, "fo:border-bottom", Float.toString(borderSize) + "pt solid #000000");
96
97
        float paddingSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getPaddingLengthProperty(0).getLengthValue() / 100);
98
        paddingSize = paddingSize / 10;
99
        stcpe.setAttributeNS(Namespace.FO, "fo:padding-left", Float.toString(paddingSize) + "pt");
100
101
        paddingSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getPaddingLengthProperty(1).getLengthValue() / 100);
102
        paddingSize = paddingSize / 10;
103
        stcpe.setAttributeNS(Namespace.FO, "fo:padding-top", Float.toString(paddingSize) + "pt");
104
105
        paddingSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getPaddingLengthProperty(2).getLengthValue() / 100);
106
        paddingSize = paddingSize / 10;
107
        stcpe.setAttributeNS(Namespace.FO, "fo:padding-right", Float.toString(paddingSize) + "pt");
108
109
        paddingSize = Math.round((float)tblCell.getCommonBorderPaddingBackground().getPaddingLengthProperty(3).getLengthValue() / 100);
110
        paddingSize = paddingSize / 10;
111
        stcpe.setAttributeNS(Namespace.FO, "fo:padding-bottom", Float.toString(paddingSize) + "pt");
112
113
        sse.appendChild(stcpe);
114
115
        tce.setAttributeNS(Namespace.TABLE, "table:number-columns-spanned", Integer.toString(tblCell.getNumberColumnsSpanned()));
116
        tce.setAttributeNS(Namespace.TABLE, "table:number-rows-spanned",     Integer.toString(tblCell.getNumberRowsSpanned()));
117
118
        tce.setStyleName(this.appendNewStyle(sse));
119
120
        parent.executeFromParent(this);
121
    }
122
123
    @Override
124
    public void execute(TableRowTag tag) throws OdfException {
125
        try {
126
            tag.getTableRow().appendChild(tce);
127
        } catch (Exception e) {
128
            throw new OdfException("Can't create table cell", e);
129
        }
130
    }
131
132
    public void executeFromParent(TagExecutable child) throws OdfException {
133
        if (this != child) {
134
            child.execute(this);
135
        }
136
    }
137
138
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableBodyTag.java (+45 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.table.TableBody;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * TableBody converter
25
 */
26
public class TableBodyTag extends Tag {
27
28
    TableBodyTag(Tag parent, TableBody tblBody) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        parent.executeFromParent(child);
44
    }
45
}
(-)src/java/org/apache/fop/render/odf/odt/tags/InstreamForeignObjectTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.InstreamForeignObject;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * InstreamForeignObject converter
25
 */
26
public class InstreamForeignObjectTag extends Tag {
27
28
    InstreamForeignObjectTag(Tag parent, InstreamForeignObject foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/PageNumberCitationTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.PageNumberCitation;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * PageNumberCitation converter
25
 */
26
public class PageNumberCitationTag extends Tag {
27
28
    PageNumberCitationTag(Tag parent, PageNumberCitation foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/LeaderTag.java (+49 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.Leader;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * Leader converter
25
 */
26
public class LeaderTag extends Tag {
27
28
    protected LeaderTag(Tag parent, Leader foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() {
37
        // TODO Auto-generated method stub
38
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     * @throws OdfException
44
     */
45
    public void executeFromParent(TagExecutable child) throws OdfException {
46
        child.execute(this);
47
    }
48
49
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TagFactory.java (+116 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.FONode;
21
import org.apache.fop.fo.FOText;
22
import org.apache.fop.fo.flow.BasicLink;
23
import org.apache.fop.fo.flow.Block;
24
import org.apache.fop.fo.flow.BlockContainer;
25
import org.apache.fop.fo.flow.Character;
26
import org.apache.fop.fo.flow.ExternalGraphic;
27
import org.apache.fop.fo.flow.Footnote;
28
import org.apache.fop.fo.flow.FootnoteBody;
29
import org.apache.fop.fo.flow.Inline;
30
import org.apache.fop.fo.flow.InstreamForeignObject;
31
import org.apache.fop.fo.flow.Leader;
32
import org.apache.fop.fo.flow.ListBlock;
33
import org.apache.fop.fo.flow.ListItem;
34
import org.apache.fop.fo.flow.ListItemBody;
35
import org.apache.fop.fo.flow.ListItemLabel;
36
import org.apache.fop.fo.flow.PageNumber;
37
import org.apache.fop.fo.flow.PageNumberCitation;
38
import org.apache.fop.fo.flow.table.Table;
39
import org.apache.fop.fo.flow.table.TableBody;
40
import org.apache.fop.fo.flow.table.TableCell;
41
import org.apache.fop.fo.flow.table.TableColumn;
42
import org.apache.fop.fo.flow.table.TableFooter;
43
import org.apache.fop.fo.flow.table.TableHeader;
44
import org.apache.fop.fo.flow.table.TableRow;
45
import org.apache.fop.fo.pagination.Flow;
46
import org.apache.fop.fo.pagination.PageSequence;
47
import org.apache.fop.fo.pagination.StaticContent;
48
import org.apache.fop.render.odf.OdfException;
49
import org.apache.fop.render.odf.odt.FopOdtConverter;
50
51
/**
52
 * Factory that creates tag converters
53
 */
54
public class TagFactory {
55
56
    public Tag getTag(FopOdtConverter converter, FONode foNode, Tag actualTag) throws OdfException {
57
        if (foNode instanceof PageSequence)            {
58
            return new PageSequenceTag(actualTag, (PageSequence) foNode, converter);
59
        } else if (foNode instanceof Flow) {
60
            return new FlowTag(actualTag, (Flow) foNode);
61
        } else if (foNode instanceof StaticContent) {
62
            return new StaticContentTag(actualTag, (StaticContent) foNode);
63
        } else if (foNode instanceof ExternalGraphic) {
64
            return new ExternalGraphicTag(actualTag, (ExternalGraphic) foNode);
65
        } else if (foNode instanceof InstreamForeignObject) {
66
            return new InstreamForeignObjectTag(actualTag, (InstreamForeignObject) foNode);
67
        } else if (foNode instanceof Block) {
68
            return new BlockTag(actualTag, (Block) foNode);
69
        } else if (foNode instanceof BlockContainer) {
70
            return new BlockContainerTag(actualTag, (BlockContainer) foNode);
71
        } else if (foNode instanceof BasicLink) {
72
            return new BasicLinkTag(actualTag, (BasicLink) foNode);
73
        } else if (foNode instanceof Inline) {
74
            return new InlineTag(actualTag, (Inline) foNode);
75
        } else if (foNode instanceof FOText) {
76
            return new Text(actualTag, (FOText) foNode);
77
        } else if (foNode instanceof Character) {
78
            return new CharacterTag(actualTag, (Character) foNode);
79
        } else if (foNode instanceof PageNumber) {
80
            return new PageNumberTag(actualTag, (PageNumber) foNode);
81
        } else if (foNode instanceof Footnote) {
82
            return new FootnoteTag(actualTag, (Footnote) foNode);
83
        } else if (foNode instanceof FootnoteBody) {
84
            return new FootnoteBodyTag(actualTag, (FootnoteBody) foNode);
85
        } else if (foNode instanceof ListBlock) {
86
            return new ListBlockTag(actualTag, (ListBlock) foNode);
87
        } else if (foNode instanceof ListItemBody) {
88
            return new ListItemBodyTag(actualTag, (ListItemBody) foNode);
89
        } else if (foNode instanceof ListItem) {
90
            return new ListItemTag(actualTag, (ListItem) foNode, converter);
91
        } else if (foNode instanceof ListItemLabel) {
92
            return new ListItemLabelTag(actualTag, (ListItemLabel) foNode);
93
        } else if (foNode instanceof Table) {
94
            return new TableTag(actualTag, (Table) foNode);
95
        } else if (foNode instanceof TableHeader) {
96
            return new TableHeaderTag(actualTag, (TableHeader) foNode);
97
        } else if (foNode instanceof TableFooter) {
98
            return new TableFooterTag(actualTag, (TableFooter) foNode);
99
        } else if (foNode instanceof TableBody) {
100
            return new TableBodyTag(actualTag, (TableBody) foNode);
101
        } else if (foNode instanceof TableColumn) {
102
            return new TableColumnTag(actualTag, (TableColumn) foNode);
103
        } else if (foNode instanceof TableRow) {
104
            return new TableRowTag(actualTag, (TableRow) foNode);
105
        } else if (foNode instanceof TableCell) {
106
            return new TableCellTag(actualTag, (TableCell) foNode);
107
        } else if (foNode instanceof Leader) {
108
            return new LeaderTag(actualTag, (Leader) foNode);
109
        } else if (foNode instanceof PageNumberCitation) {
110
            return new PageNumberCitationTag(actualTag, (PageNumberCitation) foNode);
111
        } else {
112
            return new UnknownTag(actualTag);
113
        }
114
    }
115
116
}
(-)src/java/org/apache/fop/render/odf/odt/tags/ListItemTag.java (+90 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.element.text.TextListItemElement;
21
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
22
23
import org.apache.fop.fo.flow.ListItem;
24
import org.apache.fop.render.odf.OdfException;
25
import org.apache.fop.render.odf.odt.FopOdtConverter;
26
27
/**
28
 * ListItem converter
29
 */
30
public class ListItemTag extends Tag {
31
32
    private ListItem xslfoListItem = null;
33
34
    private TextListItemElement tlie = null;
35
36
    private FopOdtConverter converter = null;
37
38
    ListItemTag(Tag parent, ListItem foNode, FopOdtConverter converter) {
39
        super(parent);
40
        this.xslfoListItem = foNode;
41
        this.converter = converter;
42
    }
43
44
    public ListItem getXslfoListItem() {
45
        return xslfoListItem;
46
    }
47
48
    public TextListItemElement getTextListItemElement() {
49
        return tlie;
50
    }
51
52
    /**
53
     * {@inheritDoc}
54
     * @throws OdfException
55
     */
56
    @Override
57
    public void execute() throws OdfException {
58
        try {
59
            tlie = (TextListItemElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextListItemElement.ELEMENT_NAME);
60
        } catch (Exception e) {
61
            throw new OdfException("Can't create List Item", e);
62
        }
63
64
        parent.executeFromParent(this);
65
66
        converter.convertRecursively(xslfoListItem.getBody());
67
    }
68
69
    /**
70
     * {@inheritDoc}
71
     * @throws OdfException
72
     */
73
    @Override
74
    public void execute(ListBlockTag tag) throws OdfException {
75
        try {
76
            tag.getTextListElement().appendChild(tlie);
77
        } catch (Exception e) {
78
            throw new OdfException("Can't create List Item", e);
79
        }
80
    }
81
82
    /**
83
     * {@inheritDoc}
84
     * @throws OdfException
85
     */
86
    public void executeFromParent(TagExecutable child) throws OdfException {
87
        child.execute(this);
88
    }
89
90
}
(-)src/java/org/apache/fop/render/odf/odt/tags/Tag.java (+221 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import java.util.Map;
21
import java.util.Random;
22
import java.util.Vector;
23
24
import org.odftoolkit.odfdom.dom.OdfContentDom;
25
import org.odftoolkit.odfdom.dom.element.style.StyleFontFaceElement;
26
import org.odftoolkit.odfdom.dom.element.style.StyleStyleElement;
27
import org.odftoolkit.odfdom.dom.element.text.TextPElement;
28
import org.odftoolkit.odfdom.pkg.OdfElement;
29
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
30
import org.odftoolkit.simple.TextDocument;
31
import org.odftoolkit.simple.text.Paragraph;
32
import org.w3c.dom.DOMException;
33
import org.w3c.dom.Node;
34
35
import org.apache.fop.fo.pagination.Flow;
36
import org.apache.fop.render.odf.FopTagType;
37
import org.apache.fop.render.odf.OdfException;
38
import org.apache.fop.render.odf.odt.Namespace;
39
import org.apache.fop.render.odf.odt.Style;
40
41
/**
42
 * Tag converter abstract class.
43
 */
44
public abstract class Tag implements TagExecutable, TagExecutor {
45
46
    protected Tag parent = null;
47
48
    protected Style currentStyle = null;
49
50
    private static Random rand = new Random();
51
52
    protected Tag(Tag parent) {
53
        this.parent = parent;
54
        if (parent != null) {
55
            currentStyle = new Style(parent.getStyle());
56
        } else {
57
            currentStyle = new Style();
58
        }
59
    }
60
61
    protected TextDocument getOdt() {
62
        return parent != null ? parent.getOdt() : null;
63
    }
64
65
    protected Map<String, StyleStyleElement> getUsedStyles() {
66
        return parent.getUsedStyles();
67
    }
68
69
    protected Vector<String> getUsedFonts() {
70
        return parent.getUsedFonts();
71
    }
72
73
    protected void registerFont(String font) throws OdfException {
74
        if (!this.getUsedFonts().contains(font)) {
75
            StyleFontFaceElement sffe = null;
76
            try {
77
                sffe = (StyleFontFaceElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleFontFaceElement.ELEMENT_NAME);
78
            } catch (Exception e) {
79
                throw new OdfException("Can't create new style.", e);
80
            }
81
82
            if (isOnlyOneParagraph(this.getOdt())) {
83
                removeLastParagraph(this.getOdt());
84
            }
85
86
            sffe.setStyleNameAttribute(font);
87
            sffe.setAttributeNS(Namespace.SVG, "svg:font-family", font);
88
            try {
89
                this.getOdt().getContentDom().getElementsByTagNameNS(Namespace.OFFICE, "font-face-decls").item(0).appendChild(sffe);
90
            } catch (Exception e) {
91
                throw new OdfException("Can't register new font", e);
92
            }
93
            this.getUsedFonts().add(font);
94
        }
95
    }
96
97
    private boolean isOnlyOneParagraph(TextDocument textDocument) {
98
        int i = 0;
99
        try {
100
            i = textDocument.getContentDom().getElementsByTagNameNS(Namespace.TEXT, "p").getLength();
101
        } catch (Exception e) {
102
            return false;
103
        }
104
        return i == 1 ? true : false;
105
    }
106
107
    private void removeLastParagraph(TextDocument textDocument) {
108
        try {
109
            textDocument.getContentDom().getElementsByTagNameNS(Namespace.OFFICE, "text").item(0).removeChild(textDocument.getContentDom().getElementsByTagNameNS(Namespace.TEXT, "p").item(0));
110
        } catch (Exception e) {
111
            e.printStackTrace();
112
        }
113
    }
114
115
    protected Style getStyle() {
116
        return this.currentStyle;
117
    }
118
119
    public Tag getParent() {
120
        return parent;
121
    }
122
123
    protected Paragraph getParagraph() throws OdfException {
124
        return parent != null ? parent.getParagraph() : null;
125
    }
126
127
    protected OdfElement getParagraphContainer() {
128
        return parent != null ? parent.getParagraphContainer() : null;
129
    }
130
131
    protected Paragraph newParagraph(Node paragraphContainer) throws OdfException {
132
133
        TextPElement tpe = null;
134
135
        try {
136
            tpe = (TextPElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextPElement.ELEMENT_NAME);
137
        } catch (Exception e1) {
138
            throw new OdfException("Can't create new style.", e1);
139
        }
140
141
        try {
142
            paragraphContainer.appendChild(tpe);
143
        } catch (DOMException e) {
144
            throw new OdfException("Can't create new paragraph", e);
145
        }
146
147
        return Paragraph.getInstanceof(tpe);
148
    }
149
150
    protected String appendNewStyle(StyleStyleElement sse) throws OdfException {
151
152
        sse.setAttributeNS(Namespace.STYLE, "style:name", "");
153
154
        String styleName = Style.getStyleName(this.getUsedStyles(), sse);
155
156
        if (styleName == null) {
157
            styleName = generateName();
158
            sse.setAttributeNS(Namespace.STYLE, "style:name", styleName);
159
160
            try {
161
                OdfContentDom odf = this.getOdt().getContentDom();
162
                Node odfstyles = odf.getElementsByTagNameNS(Namespace.OFFICE, "automatic-styles").item(0);
163
                odfstyles.appendChild(sse);
164
            } catch (Exception e) {
165
                throw new OdfException("Can't create new style.", e);
166
            }
167
168
            this.getUsedStyles().put(styleName, sse);
169
        }
170
171
        return styleName;
172
    }
173
174
    private String generateName() {
175
        return Integer.toString(rand.nextInt());
176
    }
177
178
    public abstract void execute() throws OdfException;
179
180
    public Tag execute(Flow fl, FopTagType type) {
181
        return this;
182
    }
183
184
    public void closeIntercept() throws OdfException { }
185
186
    public void execute(Tag tag) throws OdfException {
187
    }
188
189
    public void execute(BlockTag tag) throws OdfException {
190
        this.execute((Tag) tag);
191
    }
192
193
    public void execute(InlineTag tag) throws OdfException {
194
        this.execute((Tag) tag);
195
    }
196
197
    public void execute(BasicLinkTag tag) throws OdfException {
198
        this.execute((Tag) tag);
199
    }
200
201
    public void execute(TableTag tag) throws OdfException {
202
        this.execute((Tag) tag);
203
    }
204
205
    public void execute(TableRowTag tag) throws OdfException {
206
        this.execute((Tag) tag);
207
    }
208
209
    public void execute(TableCellTag tag) throws OdfException {
210
        this.execute((Tag) tag);
211
    }
212
213
    public void execute(ListBlockTag tag) throws OdfException {
214
        this.execute((Tag) tag);
215
    }
216
217
    public void execute(ListItemTag tag) throws OdfException {
218
        this.execute((Tag) tag);
219
    }
220
221
}
(-)src/java/org/apache/fop/render/odf/odt/tags/Text.java (+70 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.FOText;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * Text converter
25
 */
26
public class Text extends Tag {
27
28
    private String string = null;
29
30
    Text(Tag parent, FOText textFop) {
31
        super(parent);
32
        this.string = textFop.getCharSequence().toString();
33
    }
34
35
    @Override
36
    public void execute() throws OdfException {
37
38
        if (string.length() == 0) {
39
            return;
40
        }
41
42
        parent.executeFromParent(this);
43
    }
44
45
    @Override
46
    public void execute(Tag parent) throws OdfException {
47
         this.getParagraph().appendTextContent(string, false);
48
    }
49
50
    @Override
51
    public void execute(BlockTag parent) throws OdfException {
52
        this.getParagraph().appendTextContent(string, false);
53
    }
54
55
    @Override
56
    public void execute(InlineTag parent) {
57
        parent.getTextSpanElement().setTextContent(string);
58
    }
59
60
    @Override
61
    public void execute(BasicLinkTag parent) {
62
        parent.getLinkElement().setTextContent(string);
63
    }
64
65
    public void executeFromParent(TagExecutable child) throws OdfException {
66
        if (this != child) {
67
            child.execute(this);
68
        }
69
    }
70
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableFooterTag.java (+39 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.table.TableFooter;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * TableFooter converter
25
 */
26
public class TableFooterTag extends Tag {
27
28
    TableFooterTag(Tag parent, TableFooter tblFooter) {
29
        super(parent);
30
    }
31
32
    @Override
33
    public void execute() { }
34
35
    public void executeFromParent(TagExecutable child) throws OdfException {
36
        child.execute(this);
37
    }
38
39
}
(-)src/java/org/apache/fop/render/odf/odt/tags/BasicLinkTag.java (+108 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.element.text.TextAElement;
21
import org.odftoolkit.odfdom.dom.element.text.TextBookmarkRefElement;
22
import org.odftoolkit.odfdom.pkg.OdfElement;
23
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
24
25
import org.w3c.dom.DOMException;
26
27
import org.apache.fop.fo.flow.BasicLink;
28
import org.apache.fop.render.odf.OdfException;
29
import org.apache.fop.render.odf.odt.Namespace;
30
import org.apache.fop.render.odf.odt.Style;
31
import org.apache.fop.render.odf.odt.Style.Params;
32
33
/**
34
 * VasicLink converter
35
 */
36
public class BasicLinkTag extends Tag {
37
38
    BasicLink basicLink = null;
39
40
    OdfElement oe = null;
41
42
    /**
43
     * Constructor.
44
     */
45
    public BasicLinkTag(Tag parent, BasicLink basicLink) {
46
        super(parent);
47
        this.basicLink = basicLink;
48
49
        this.currentStyle.getParameters().put(Params.FONT_NAME,                                 basicLink.getCommonFont().getFirstFontFamily().split(",")[0]);
50
        this.currentStyle.getParameters().put(Params.FONT_STYLE,  Style.fopFontToOdfFontStyle(  basicLink.getCommonFont()));
51
        this.currentStyle.getParameters().put(Params.FONT_WEIGHT, Style.fopFontToOdfFontWeight( basicLink.getCommonFont()));
52
        this.currentStyle.getParameters().put(Params.FONT_SIZE,   Style.fopLengthToPt(          basicLink.getCommonFont().getFontSize()));
53
        this.currentStyle.getParameters().put(Params.COLOR,       Style.awtColorToOdfColor(     basicLink.getColor()));
54
    }
55
56
    public OdfElement getLinkElement() {
57
        return oe;
58
    }
59
60
    /**
61
     * {@inheritDoc}
62
     */
63
    @Override
64
    public void execute() {
65
        if (basicLink.hasExternalDestination()) {
66
            try {
67
                oe = (TextAElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextAElement.ELEMENT_NAME);
68
            } catch (Exception e1) {
69
                e1.printStackTrace();
70
            }
71
            String url = basicLink.getExternalDestination();
72
            if (url.startsWith("url")) {
73
                url = url.substring(5, url.length() - 2);
74
            }
75
            oe.setAttributeNS(Namespace.XLINK, "xlink:href", url);
76
            oe.setAttributeNS(Namespace.XLINK, "xlink:type", "simple");
77
        } else if (basicLink.hasInternalDestination()) {
78
            try {
79
                oe = (TextBookmarkRefElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextBookmarkRefElement.ELEMENT_NAME);
80
            } catch (Exception e) {
81
                e.printStackTrace();
82
            }
83
            oe.setAttributeNS(Namespace.TEXT, "text:ref-name", basicLink.getInternalDestination());
84
            oe.setAttributeNS(Namespace.TEXT, "text:reference-format", "page");
85
        }
86
    }
87
88
    /**
89
     * {@inheritDoc}
90
     * @throws OdfException
91
     */
92
    @Override
93
    public void closeIntercept() throws OdfException {
94
        try {
95
            this.getParagraph().getOdfElement().appendChild(oe);
96
        } catch (DOMException e) {
97
            e.printStackTrace();
98
        }
99
    }
100
101
    /**
102
     * {@inheritDoc}
103
     * @throws OdfException
104
     */
105
    public void executeFromParent(TagExecutable child) throws OdfException {
106
        child.execute(this);
107
    }
108
}
(-)src/java/org/apache/fop/render/odf/odt/tags/StaticTag.java (+37 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.render.odf.OdfException;
21
22
/**
23
 *
24
 */
25
public class StaticTag extends Tag {
26
27
    protected StaticTag(Tag parent) {
28
        super(parent);
29
    }
30
31
    @Override
32
    public void execute() { }
33
34
    public void executeFromParent(TagExecutable child) throws OdfException {
35
        child.execute(this);
36
    }
37
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableTag.java (+98 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.element.table.TableTableColumnElement;
21
import org.odftoolkit.odfdom.dom.element.table.TableTableElement;
22
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
23
import org.w3c.dom.DOMException;
24
25
26
import org.apache.fop.fo.flow.table.Table;
27
import org.apache.fop.render.odf.OdfException;
28
import org.apache.fop.render.odf.odt.Namespace;
29
30
/**
31
 * Table converter
32
 */
33
public class TableTag extends Tag {
34
35
    private Table table = null;
36
37
    private TableTableElement tte = null;
38
39
    TableTag(Tag parent, Table table) {
40
        super(parent);
41
        this.table = table;
42
    }
43
44
    public TableTableElement getTable() {
45
        return tte;
46
    }
47
48
    /**
49
     * {@inheritDoc}
50
     * @throws OdfException
51
     */
52
    @Override
53
    public void execute() throws OdfException {
54
55
        try {
56
            tte = (TableTableElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TableTableElement.ELEMENT_NAME);
57
        } catch (Exception e) {
58
            throw new OdfException("Can't create new table.", e);
59
        }
60
        tte.setAttributeNS(Namespace.TABLE, "table:align", "margins");
61
62
        if (table.getColumns().size() > 1) {
63
            TableTableColumnElement tcne = null;
64
            try {
65
                tcne = (TableTableColumnElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TableTableColumnElement.ELEMENT_NAME);
66
            } catch (Exception e) {
67
                throw new OdfException("Can't create new table column.", e);
68
            }
69
            tcne.setAttributeNS(Namespace.TABLE,
70
                                "table:number-columns-repeated",
71
                                Integer.toString(table.getColumns().size()));
72
73
            try {
74
                tte.appendChild(tcne);
75
            } catch (Exception e) {
76
                throw new OdfException("Can't create table.", e);
77
            }
78
        }
79
    }
80
81
    /**
82
     * {@inheritDoc}
83
     */
84
    @Override
85
    public void closeIntercept() {
86
        try {
87
            this.getOdt().getTableContainerElement().appendChild(tte);
88
        } catch (DOMException e) {
89
            e.printStackTrace();
90
        } catch (Exception e) {
91
            e.printStackTrace();
92
        }
93
    }
94
95
    public void executeFromParent(TagExecutable child) throws OdfException {
96
        child.execute(this);
97
    }
98
}
(-)src/java/org/apache/fop/render/odf/odt/tags/UnknownTag.java (+38 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.render.odf.OdfException;
21
22
/**
23
 * Unknown tag converter
24
 */
25
public class UnknownTag extends Tag {
26
27
    protected UnknownTag(Tag parent) {
28
        super(parent);
29
    }
30
31
    @Override
32
    public void execute() { }
33
34
    public void executeFromParent(TagExecutable child) throws OdfException {
35
        child.execute(this);
36
    }
37
38
}
(-)src/java/org/apache/fop/render/odf/odt/tags/FootnoteBodyTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.FootnoteBody;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * FootnoteBodyConverter
25
 */
26
public class FootnoteBodyTag extends Tag {
27
28
    protected FootnoteBodyTag(Tag parent, FootnoteBody foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/BlockContainerTag.java (+51 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.BlockContainer;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * BlockContainer converter
25
 */
26
public class BlockContainerTag extends Tag {
27
28
    /**
29
     * Constructor
30
     */
31
    protected BlockContainerTag(Tag parent, BlockContainer foNode) {
32
        super(parent);
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38
    @Override
39
    public void execute() {
40
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     * @throws OdfException
46
     */
47
    public void executeFromParent(TagExecutable child) throws OdfException {
48
        child.execute(this);
49
    }
50
51
}
(-)src/java/org/apache/fop/render/odf/odt/tags/PageSequenceTag.java (+113 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.pagination.PageSequence;
21
import org.apache.fop.fo.pagination.PageSequenceMaster;
22
import org.apache.fop.fo.pagination.SimplePageMaster;
23
import org.apache.fop.render.odf.OdfException;
24
import org.apache.fop.render.odf.odt.FopOdtConverter;
25
26
/**
27
 * Defines a number of standard constants (keys) for use by the RendererContext class.
28
 */
29
public class PageSequenceTag extends Tag {
30
31
    protected PageSequence pageSeq = null;
32
33
    protected FopOdtConverter converter = null;
34
35
    protected SimplePageMaster pagemaster = null;
36
37
    PageSequenceTag(Tag parent, PageSequence pageSeq, FopOdtConverter converter) {
38
        super(parent);
39
        this.pageSeq = pageSeq;
40
        this.converter = converter;
41
42
        String reference = pageSeq.getMasterReference();
43
        this.pagemaster = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(reference);
44
        if (pagemaster == null) {
45
            PageSequenceMaster master = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(reference);
46
            this.pagemaster = master.getNextSimplePageMaster(false, false, false, false, "");
47
        }
48
49
        //if(!isFirstPageSequence()) this.getOdt().addPageBreak();
50
51
        //read page size and margins, if specified
52
        //only simple-page-master supported, so pagemaster may be null
53
54
        //builderContext.pushContainer(sect);
55
56
        //Calculate usable page width for this flow
57
        //int useAblePageWidth = pagemaster.getPageWidth().getValue()
58
        //    - pagemaster.getCommonMarginBlock().marginLeft.getValue()
59
        //    - pagemaster.getCommonMarginBlock().marginRight.getValue()
60
        //percentManager.setDimension(pageSeq, useAblePageWidth);
61
62
        //bHeaderSpecified = false;
63
        //bFooterSpecified = false;
64
65
        /*Region regionBefore = pagemaster.getRegion(Constants.FO_REGION_BEFORE);
66
        if (regionBefore != null) {
67
            FONode staticBefore = (FONode) pageSequence.getFlowMap().get(regionBefore.getRegionName());
68
            if (staticBefore != null) recurseFONode(staticBefore);
69
        }
70
71
        Region regionAfter = pagemaster.getRegion(Constants.FO_REGION_AFTER);
72
        if (regionAfter != null) {
73
            FONode staticAfter = (FONode) pageSequence.getFlowMap().get(regionAfter.getRegionName());
74
            if (staticAfter != null) recurseFONode(staticAfter);
75
        }*/
76
    }
77
78
    //private boolean isFirstPageSequence() {
79
        // TODO Auto-generated method stub
80
    //    return false;
81
    //}
82
83
    /**
84
     * {@inheritDoc}
85
     */
86
    @Override
87
    public void execute() {
88
        setMargins();
89
        converter.convertRecursively(pageSeq.getMainFlow());
90
    }
91
92
    private void setMargins() {
93
        //int a = this.pagemaster.getPageWidth().getValue();
94
        //int b = this.pagemaster.getPageHeight().getValue();
95
        //int c = this.pagemaster.getCommonMarginBlock().marginLeft.getValue();
96
        //int d = this.pagemaster.getCommonMarginBlock().marginRight.getValue();
97
    }
98
99
    /**
100
     * {@inheritDoc}
101
     */
102
    @Override
103
    public void closeIntercept() {
104
    }
105
106
    /**
107
     * {@inheritDoc}
108
     * @throws OdfException
109
     */
110
    public void executeFromParent(TagExecutable child) throws OdfException {
111
        child.execute(this);
112
    }
113
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableColumnTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.table.TableColumn;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * TableColumn converter
25
 */
26
public class TableColumnTag extends Tag {
27
28
    TableColumnTag(Tag parent, TableColumn tblColumn) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/ListItemBodyTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.ListItemBody;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * ListItemBody converter
25
 */
26
public class ListItemBodyTag extends Tag {
27
28
    protected ListItemBodyTag(Tag parent, ListItemBody foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        parent.executeFromParent(child);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/InlineTag.java (+121 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.OdfContentDom;
21
import org.odftoolkit.odfdom.dom.element.style.StyleStyleElement;
22
import org.odftoolkit.odfdom.dom.element.style.StyleTextPropertiesElement;
23
import org.odftoolkit.odfdom.dom.element.text.TextSpanElement;
24
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
25
import org.w3c.dom.Node;
26
27
import org.apache.fop.fo.flow.Inline;
28
import org.apache.fop.render.odf.OdfException;
29
import org.apache.fop.render.odf.odt.Namespace;
30
import org.apache.fop.render.odf.odt.Style;
31
import org.apache.fop.render.odf.odt.Style.Params;
32
33
/**
34
 * Inline converter
35
 */
36
public class InlineTag extends Tag {
37
38
    protected TextSpanElement tse = null;
39
40
    InlineTag(Tag parent, Inline inl) throws OdfException {
41
        super(parent);
42
43
        this.currentStyle.getParameters().put(Params.FONT_NAME,                                 inl.getCommonFont().getFirstFontFamily().split(",")[0]);
44
        this.currentStyle.getParameters().put(Params.FONT_STYLE,  Style.fopFontToOdfFontStyle(  inl.getCommonFont()));
45
        this.currentStyle.getParameters().put(Params.FONT_WEIGHT, Style.fopFontToOdfFontWeight( inl.getCommonFont()));
46
        this.currentStyle.getParameters().put(Params.FONT_SIZE,   Style.fopLengthToPt(          inl.getCommonFont().getFontSize()));
47
        this.currentStyle.getParameters().put(Params.COLOR,       Style.awtColorToOdfColor(     inl.getColor()));
48
49
        registerFont(this.currentStyle.getParameters().get(Params.FONT_NAME));
50
    }
51
52
    public TextSpanElement getTextSpanElement() {
53
        return tse;
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     * @throws OdfException
59
     */
60
    @Override
61
    public void execute() throws OdfException {
62
        try {
63
            tse = (TextSpanElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextSpanElement.ELEMENT_NAME);
64
        } catch (Exception e) {
65
            throw new OdfException("Can't create text span.", e);
66
        }
67
68
        StyleStyleElement sse = null;
69
        try {
70
            sse = (StyleStyleElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleStyleElement.ELEMENT_NAME);
71
        } catch (Exception e) {
72
            throw new OdfException("Can't create new style for text span.", e);
73
        }
74
75
        sse.setAttributeNS(Namespace.STYLE, "style:family", "text");
76
77
        StyleTextPropertiesElement stpe = null;
78
79
        try {
80
            stpe = (StyleTextPropertiesElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleTextPropertiesElement.ELEMENT_NAME);
81
        } catch (Exception e) {
82
            throw new OdfException("Can't create new style for text span.", e);
83
        }
84
85
        stpe.setAttributeNS(Namespace.FO,    "fo:font-size",    this.currentStyle.get(Params.FONT_SIZE));
86
        stpe.setAttributeNS(Namespace.FO,    "fo:font-weight",  this.currentStyle.get(Params.FONT_WEIGHT));
87
        stpe.setAttributeNS(Namespace.FO,    "fo:font-style",   this.currentStyle.get(Params.FONT_STYLE));
88
        stpe.setAttributeNS(Namespace.FO,    "fo:color",        this.currentStyle.get(Params.COLOR));
89
        stpe.setAttributeNS(Namespace.STYLE, "style:font-name", this.currentStyle.get(Params.FONT_NAME));
90
91
        sse.appendChild(stpe);
92
93
        try {
94
            OdfContentDom odf = this.getOdt().getContentDom();
95
            Node odfstyles = odf.getElementsByTagNameNS(Namespace.OFFICE, "automatic-styles").item(0);
96
            odfstyles.appendChild(sse);
97
        } catch (Exception e) {
98
            throw new OdfException("Can't create new style.", e);
99
        }
100
101
        tse.setStyleName(this.appendNewStyle(sse));
102
    }
103
104
    /**
105
     * {@inheritDoc}
106
     * @throws OdfException
107
     */
108
    @Override
109
    public void closeIntercept() throws OdfException {
110
        this.getParagraph().getOdfElement().appendChild(tse);
111
    }
112
113
    /**
114
     * {@inheritDoc}
115
     * @throws OdfException
116
     */
117
    public void executeFromParent(TagExecutable child) throws OdfException {
118
        child.execute(this);
119
    }
120
121
}
(-)src/java/org/apache/fop/render/odf/odt/tags/CharacterTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.Character;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * Character converter
25
 */
26
public class CharacterTag extends Tag {
27
28
    CharacterTag(Tag actualTag, Character foNode) {
29
        super(actualTag);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/FootnoteTag.java (+52 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.Footnote;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * Footnote converter
25
 */
26
public class FootnoteTag extends Tag {
27
28
    FootnoteTag(Tag parent, Footnote foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() {
37
        /*Footnote fn = (Footnote)foNode;
38
39
        recurseFONode(fn.getFootnoteCitation());
40
        recurseFONode(fn.getFootnoteBody()); */
41
42
    }
43
44
    /**
45
     * {@inheritDoc}
46
     * @throws OdfException
47
     */
48
    public void executeFromParent(TagExecutable child) throws OdfException {
49
        child.execute(this);
50
    }
51
52
}
(-)src/java/org/apache/fop/render/odf/odt/tags/FlowTag.java (+45 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.pagination.Flow;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * Flow converter.
25
 */
26
public class FlowTag extends Tag {
27
28
    FlowTag(Tag parent, Flow fl) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
}
(-)src/java/org/apache/fop/render/odf/odt/tags/PageNumberTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.PageNumber;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * PageNumber converter
25
 */
26
public class PageNumberTag extends Tag {
27
28
    PageNumberTag(Tag parent, PageNumber foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/BlockTag.java (+251 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import java.util.Iterator;
21
22
import org.odftoolkit.odfdom.dom.element.style.StyleParagraphPropertiesElement;
23
import org.odftoolkit.odfdom.dom.element.style.StyleStyleElement;
24
import org.odftoolkit.odfdom.dom.element.style.StyleTextPropertiesElement;
25
import org.odftoolkit.odfdom.dom.element.table.TableTableCellElement;
26
import org.odftoolkit.odfdom.dom.element.text.TextBookmarkElement;
27
import org.odftoolkit.odfdom.dom.element.text.TextLineBreakElement;
28
import org.odftoolkit.odfdom.dom.element.text.TextListItemElement;
29
import org.odftoolkit.odfdom.pkg.OdfElement;
30
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
31
import org.odftoolkit.simple.text.Paragraph;
32
33
import org.apache.fop.fo.FONode;
34
import org.apache.fop.fo.FOText;
35
import org.apache.fop.fo.flow.Block;
36
import org.apache.fop.layoutmgr.BlockLayoutManager;
37
import org.apache.fop.render.odf.OdfException;
38
import org.apache.fop.render.odf.odt.Namespace;
39
import org.apache.fop.render.odf.odt.Style;
40
import org.apache.fop.render.odf.odt.Style.Params;
41
/**
42
 * Block converter
43
 */
44
public class BlockTag extends Tag {
45
46
    private Block bl = null;
47
48
    private Paragraph paragraph = null;
49
50
    private OdfElement paragraphContainer = null;
51
52
    /**
53
     * {@inheritDoc}
54
     * @throws OdfException
55
     */
56
    @Override
57
    protected Paragraph getParagraph() throws OdfException {
58
        if (this.paragraph != null) {
59
            return this.paragraph;
60
        } else {
61
            return parent.getParagraph();
62
        }
63
    }
64
65
    /**
66
     * {@inheritDoc}
67
     */
68
    @Override
69
    protected OdfElement getParagraphContainer() {
70
        if (paragraphContainer != null) {
71
            return this.paragraphContainer;
72
        } else {
73
            return parent.getParagraphContainer();
74
        }
75
    }
76
77
    /**
78
     * Constructor
79
     * @throws OdfException
80
     */
81
    BlockTag(Tag parent, Block bl) throws OdfException {
82
        super(parent);
83
        this.bl = bl;
84
        this.currentStyle.getParameters().put(Params.FONT_NAME,                                         bl.getCommonFont().getFirstFontFamily().split(",")[0]);
85
        this.currentStyle.getParameters().put(Params.FONT_STYLE,          Style.fopFontToOdfFontStyle(  bl.getCommonFont()));
86
        this.currentStyle.getParameters().put(Params.FONT_WEIGHT,         Style.fopFontToOdfFontWeight( bl.getCommonFont()));
87
        this.currentStyle.getParameters().put(Params.FONT_SIZE,           Style.fopLengthToPt(          bl.getCommonFont().getFontSize()));
88
        this.currentStyle.getParameters().put(Params.COLOR,               Style.awtColorToOdfColor(     bl.getColor()));
89
        this.currentStyle.getParameters().put(Params.TEXT_ALIGN,          Style.fopAlignToOdfAlign(     bl.getTextAlign()));
90
        this.currentStyle.getParameters().put(Params.SPACE_BEFORE,        Style.fopSpaceBeforeToPt(     bl.getCommonMarginBlock().spaceBefore, new BlockLayoutManager(bl)));
91
        this.currentStyle.getParameters().put(Params.SPACE_AFTER,         Style.fopSpaceAfterToPt(      bl.getCommonMarginBlock().spaceAfter, new BlockLayoutManager(bl)));
92
        this.currentStyle.getParameters().put(Params.MARGIN_LEFT,         Style.fopLengthToPt(          bl.getCommonMarginBlock().marginLeft));
93
        this.currentStyle.getParameters().put(Params.MARGIN_RIGHT,        Style.fopLengthToPt(          bl.getCommonMarginBlock().marginRight));
94
        this.currentStyle.getParameters().put(Params.BACKGROUND_COLOR,    Style.awtColorToString(       bl.getCommonBorderPaddingBackground().backgroundColor));
95
96
        registerFont(this.currentStyle.getParameters().get(Params.FONT_NAME));
97
    }
98
99
    /**
100
     * {@inheritDoc}
101
     * @throws OdfException
102
     */
103
    @Override
104
    public void execute() throws OdfException {
105
        parent.executeFromParent(this);
106
    }
107
108
    /**
109
     * {@inheritDoc}
110
     * @throws OdfException
111
     */
112
    @Override
113
    public void execute(Tag tag) throws OdfException {
114
115
        if (!bl.hasChildren()) {
116
            addLineBreak();
117
        } else {
118
            if (!childrenAreOnlyBlocks(this.bl)) {
119
                this.paragraph = this.newParagraph(parent.getParagraphContainer());
120
121
                if (bl.getId() != null) {
122
                    insertBookmark(bl.getId());
123
                }
124
125
                StyleStyleElement sse = null;
126
                try {
127
                    sse = (StyleStyleElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleStyleElement.ELEMENT_NAME);
128
                } catch (Exception e) {
129
                    throw new OdfException("Can't create new pragraph.", e);
130
                }
131
132
                sse.setAttributeNS(Namespace.STYLE, "style:family", "paragraph");
133
134
                StyleParagraphPropertiesElement sppe = null;
135
                try {
136
                    sppe = (StyleParagraphPropertiesElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleParagraphPropertiesElement.ELEMENT_NAME);
137
                } catch (Exception e) {
138
                    throw new OdfException("Can't create new pragraph.", e);
139
                }
140
141
                sppe.setAttributeNS(Namespace.FO, "fo:margin-top",           this.currentStyle.get(Params.SPACE_BEFORE));
142
                sppe.setAttributeNS(Namespace.FO, "fo:margin-bottom",        this.currentStyle.get(Params.SPACE_AFTER));
143
                sppe.setAttributeNS(Namespace.FO, "fo:margin-left",          this.currentStyle.get(Params.MARGIN_LEFT));
144
                sppe.setAttributeNS(Namespace.FO, "fo:margin-right",         this.currentStyle.get(Params.MARGIN_RIGHT));
145
                sppe.setAttributeNS(Namespace.FO, "fo:background-color",     this.currentStyle.get(Params.BACKGROUND_COLOR));
146
                sppe.setAttributeNS(Namespace.FO, "fo:text-align",           this.currentStyle.get(Params.TEXT_ALIGN));
147
                sse.appendChild(sppe);
148
149
                StyleTextPropertiesElement stpe = null;
150
151
                try {
152
                    stpe = (StyleTextPropertiesElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), StyleTextPropertiesElement.ELEMENT_NAME);
153
                } catch (Exception e) {
154
                    throw new OdfException("Can't create new pragraph.", e);
155
                }
156
157
                stpe.setAttributeNS(Namespace.STYLE, "style:font-name", this.currentStyle.get(Params.FONT_NAME));
158
                stpe.setAttributeNS(Namespace.FO,    "fo:color",        this.currentStyle.get(Params.COLOR));
159
                stpe.setAttributeNS(Namespace.FO,    "fo:font-size",    this.currentStyle.get(Params.FONT_SIZE));
160
                stpe.setAttributeNS(Namespace.FO,    "fo:font-style",   this.currentStyle.get(Params.FONT_STYLE));
161
                stpe.setAttributeNS(Namespace.FO,    "fo:font-weight",  this.currentStyle.get(Params.FONT_WEIGHT));
162
163
                sse.appendChild(stpe);
164
165
                this.paragraph.getOdfElement().setStyleName(this.appendNewStyle(sse));
166
            }
167
        }
168
    }
169
170
    private void insertBookmark(String id) throws OdfException {
171
        TextBookmarkElement tbe = null;
172
        try {
173
            tbe = (TextBookmarkElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextBookmarkElement.ELEMENT_NAME);
174
        } catch (Exception e) {
175
            throw new OdfException("Can't create link intern.", e);
176
        }
177
        tbe.setAttributeNS(Namespace.TEXT, "text:name", id);
178
        this.paragraph.getOdfElement().appendChild(tbe);
179
    }
180
181
    /**
182
     * {@inheritDoc}
183
     * @throws OdfException
184
     */
185
    @Override
186
    public void execute(TableCellTag tag) throws OdfException {
187
        TableTableCellElement ttce = tag.getTableCellElement();
188
189
        this.paragraphContainer = ttce;
190
191
        if (!childrenAreOnlyBlocks(this.bl)) {
192
            this.paragraph = this.newParagraph(this.paragraphContainer);
193
        }
194
    }
195
196
    /**
197
     * {@inheritDoc}
198
     * @throws OdfException
199
     */
200
    @Override
201
    public void execute(ListItemTag tag) throws OdfException {
202
        TextListItemElement tlie = tag.getTextListItemElement();
203
204
        this.paragraphContainer = tlie;
205
206
        if (!childrenAreOnlyBlocks(this.bl)) {
207
            this.paragraph = this.newParagraph(this.paragraphContainer);
208
        }
209
    }
210
211
    private void addLineBreak() throws OdfException {
212
        TextLineBreakElement tlb = null;
213
        try {
214
            tlb = (TextLineBreakElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextLineBreakElement.ELEMENT_NAME);
215
        } catch (Exception e) {
216
            e.printStackTrace();
217
        }
218
219
        this.getParagraph().getOdfElement().appendChild(tlb);
220
    }
221
222
    private boolean childrenAreOnlyBlocks(Block bl) {
223
224
        if (bl.hasChildren()) {
225
            for (Iterator<?> it = bl.getChildNodes(); it.hasNext();) {
226
                FONode next = (FONode) it.next();
227
                if (!(next instanceof Block) ) {
228
                    if (next instanceof FOText) {
229
                        if ( ((FOText) next).length() != 0) {
230
                            return false;
231
                        }
232
                    } else {
233
                        return false;
234
                    }
235
                }
236
            }
237
        } else {
238
            return false;
239
        }
240
241
        return true;
242
    }
243
244
    /**
245
     * {@inheritDoc}
246
     * @throws OdfException
247
     */
248
    public void executeFromParent(TagExecutable child) throws OdfException {
249
        child.execute(this);
250
    }
251
}
(-)src/java/org/apache/fop/render/odf/odt/tags/StaticContentTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.pagination.StaticContent;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 *
25
 */
26
public class StaticContentTag extends Tag {
27
28
    protected StaticContentTag(Tag parent, StaticContent foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/ListItemLabelTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.ListItemLabel;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * ListItemLabel converter
25
 */
26
public class ListItemLabelTag extends Tag {
27
28
    ListItemLabelTag(Tag parent, ListItemLabel foNode) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/RootTag.java (+93 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import java.util.HashMap;
21
import java.util.Map;
22
import java.util.Vector;
23
24
import org.odftoolkit.odfdom.dom.element.style.StyleStyleElement;
25
import org.odftoolkit.odfdom.pkg.OdfElement;
26
import org.odftoolkit.simple.TextDocument;
27
import org.odftoolkit.simple.text.Paragraph;
28
29
import org.apache.fop.render.odf.OdfException;
30
31
/**
32
 *
33
 */
34
public class RootTag extends Tag {
35
36
    private TextDocument outputOdt = null;
37
38
    private Map<String, StyleStyleElement> usedStyles = new HashMap<String, StyleStyleElement>();
39
40
    private Vector<String> usedFonts = new Vector<String>();
41
42
    private Paragraph paragraph = null;
43
44
    public RootTag(TextDocument outputOdt) {
45
        super(null);
46
        this.outputOdt = outputOdt;
47
    }
48
49
    protected TextDocument getOdt() {
50
        return outputOdt;
51
    }
52
53
    @Override
54
    public Map<String, StyleStyleElement> getUsedStyles() {
55
        return usedStyles;
56
    }
57
58
    @Override
59
    public Vector<String> getUsedFonts() {
60
        return usedFonts;
61
    }
62
63
    @Override
64
    protected Paragraph getParagraph() throws OdfException {
65
        this.paragraph = this.newParagraph(getParagraphContainer());
66
        return this.paragraph;
67
    }
68
69
    @Override
70
    protected OdfElement getParagraphContainer() {
71
        try {
72
            return outputOdt.getContentRoot();
73
        } catch (Exception e) {
74
            e.printStackTrace();
75
        }
76
        return null;
77
    }
78
79
    /**
80
     * {@inheritDoc}
81
     */
82
    @Override
83
    public void execute() { }
84
85
    /**
86
     * {@inheritDoc}
87
     * @throws OdfException
88
     */
89
    public void executeFromParent(TagExecutable child) throws OdfException {
90
        child.execute(this);
91
    }
92
93
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableHeaderTag.java (+46 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.fo.flow.table.TableHeader;
21
import org.apache.fop.render.odf.OdfException;
22
23
/**
24
 * TableHeader converter
25
 */
26
public class TableHeaderTag extends Tag {
27
28
    TableHeaderTag(Tag parent, TableHeader tblHeader) {
29
        super(parent);
30
    }
31
32
    /**
33
     * {@inheritDoc}
34
     */
35
    @Override
36
    public void execute() { }
37
38
    /**
39
     * {@inheritDoc}
40
     * @throws OdfException
41
     */
42
    public void executeFromParent(TagExecutable child) throws OdfException {
43
        child.execute(this);
44
    }
45
46
}
(-)src/java/org/apache/fop/render/odf/odt/tags/ExternalGraphicTag.java (+251 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import java.io.IOException;
21
import java.io.InputStream;
22
import java.util.Map;
23
import java.util.Random;
24
25
import org.odftoolkit.odfdom.dom.element.draw.DrawFrameElement;
26
import org.odftoolkit.odfdom.dom.element.draw.DrawImageElement;
27
import org.odftoolkit.odfdom.dom.element.text.TextParagraphElementBase;
28
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
29
30
import org.apache.commons.io.IOUtils;
31
32
import org.apache.xmlgraphics.image.loader.Image;
33
import org.apache.xmlgraphics.image.loader.ImageFlavor;
34
import org.apache.xmlgraphics.image.loader.ImageInfo;
35
import org.apache.xmlgraphics.image.loader.ImageManager;
36
import org.apache.xmlgraphics.image.loader.ImageSessionContext;
37
import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
38
import org.apache.xmlgraphics.image.loader.util.ImageUtil;
39
40
import org.apache.fop.apps.FOUserAgent;
41
42
import org.apache.fop.datatypes.LengthBase;
43
import org.apache.fop.fo.FObj;
44
import org.apache.fop.fo.flow.AbstractGraphics;
45
import org.apache.fop.fo.flow.ExternalGraphic;
46
import org.apache.fop.layoutmgr.inline.ImageLayout;
47
import org.apache.fop.render.odf.OdfException;
48
import org.apache.fop.render.odf.odt.Namespace;
49
50
/**
51
 * External Graphic converter
52
 */
53
public class ExternalGraphicTag extends Tag {
54
55
    public static class PercentBaseContext implements org.apache.fop.datatypes.PercentBaseContext {
56
57
        Image image = null;
58
59
        public PercentBaseContext(Image image) {
60
            this.image = image;
61
        }
62
63
        public int getBaseLength(int lengthBase, FObj fobj) {
64
65
            final ImageInfo info = image.getInfo();
66
67
            switch (lengthBase) {
68
            case LengthBase.IMAGE_INTRINSIC_WIDTH:
69
                return info.getSize().getWidthMpt();
70
            case LengthBase.IMAGE_INTRINSIC_HEIGHT:
71
                return info.getSize().getHeightMpt();
72
            default:
73
                return info.getSize().getHeightMpt();
74
            }
75
        }
76
    }
77
78
    public static final String ODT_IMAGES_PATH = "Pictures/";
79
80
    ExternalGraphic eg = null;
81
82
    ExternalGraphicTag(Tag parent, ExternalGraphic eg) {
83
        super(parent);
84
        this.eg = eg;
85
    }
86
87
    /**
88
     * {@inheritDoc}
89
     * @throws OdfException
90
     */
91
    @Override
92
    public void execute() throws OdfException {
93
94
        ImageInfo info = null;
95
        FOUserAgent userAgent = eg.getUserAgent();
96
        ImageManager manager = userAgent.getFactory().getImageManager();
97
98
        try {
99
            info = manager.getImageInfo(eg.getURL(), userAgent.getImageSessionContext());
100
            putGraphic(eg, info);
101
        } catch (Exception e) {
102
            throw new OdfException("Can't create an image.", e);
103
        }
104
    }
105
106
    private static final ImageFlavor[] FLAVORS = new ImageFlavor[] {
107
        ImageFlavor.RAW_EMF,
108
        ImageFlavor.RAW_PNG,
109
        ImageFlavor.RAW_JPEG
110
    };
111
112
    private void putGraphic(AbstractGraphics abstractGraphic, ImageInfo info)
113
            throws OdfException {
114
115
            FOUserAgent userAgent = abstractGraphic.getUserAgent();
116
            ImageManager manager = userAgent.getFactory().getImageManager();
117
            ImageSessionContext sessionContext = userAgent.getImageSessionContext();
118
            Map<?, ?> hints = ImageUtil.getDefaultHints(sessionContext);
119
            Image image;
120
            try {
121
                image = manager.getImage(info, FLAVORS, hints, sessionContext);
122
            } catch (Exception e) {
123
                throw new OdfException("Can't create an image.", e);
124
            }
125
126
            putGraphic(abstractGraphic, image);
127
    }
128
129
    private void putGraphic(AbstractGraphics abstractGraphic, Image image)
130
            throws OdfException {
131
132
        byte[] rawData;
133
        try {
134
            rawData = getRawData(image);
135
        } catch (IOException e) {
136
            throw new OdfException("Can't create an image.", e);
137
        }
138
139
        if (rawData == null) {
140
            return;
141
        }
142
143
        ImageLayout layout = getImageLayout(abstractGraphic, image);
144
145
        String imageType = image.getInfo().getMimeType().split("/")[1];
146
147
        String filename = createFilename(imageType);
148
149
        putImageFileIntoOdt(rawData, filename, imageType);
150
151
        DrawImageElement die = createImage();
152
153
        die.setAttributeNS(Namespace.XLINK, "xlink:href", ODT_IMAGES_PATH + filename);
154
        die.setAttributeNS(Namespace.XLINK, "xlink:type", "simple");
155
        die.setAttributeNS(Namespace.XLINK, "xlink:show", "embed");
156
        die.setAttributeNS(Namespace.XLINK, "xlink:actuate", "onLoad");
157
158
        DrawFrameElement dfe = createImageFrame();
159
160
        dfe.setAttributeNS(Namespace.SVG, "svg:width", Double.valueOf(layout.getViewportSize().getWidth() / 1000) + "pt");
161
        dfe.setAttributeNS(Namespace.SVG, "svg:height", Double.valueOf(layout.getViewportSize().getHeight() / 1000) + "pt");
162
163
        addImageToImageFrame(die, dfe);
164
165
        addImageFrameToParagraph(dfe, this.getParagraph().getOdfElement());
166
    }
167
168
    private byte[] getRawData(Image image) throws IOException {
169
170
        byte[] rawData = null;
171
172
        if (image instanceof ImageRawStream) {
173
            ImageRawStream rawImage = (ImageRawStream)image;
174
            InputStream in = rawImage.createInputStream();
175
            try {
176
                rawData = IOUtils.toByteArray(in);
177
            } finally {
178
                IOUtils.closeQuietly(in);
179
            }
180
        }
181
        return rawData;
182
    }
183
184
    private ImageLayout getImageLayout(AbstractGraphics abstractGraphic, Image image) {
185
186
        PercentBaseContext pContext = new ExternalGraphicTag.PercentBaseContext(image);
187
188
        return new ImageLayout( abstractGraphic,
189
                                pContext,
190
                                image.getInfo().getSize().getDimensionMpt());
191
    }
192
193
    private void putImageFileIntoOdt(byte[] rawData, String filename, String imageType) {
194
        this.getOdt().getPackage().insert(rawData, ODT_IMAGES_PATH + filename, imageType);
195
    }
196
197
    private String createFilename(String imageType) {
198
        String filename = null;
199
200
        do {
201
            Random randomGenerator = new Random();
202
            filename = randomGenerator.nextInt(100) + "." + imageType;
203
        } while(this.getOdt().getPackage().contains(ODT_IMAGES_PATH + filename));
204
205
        return filename;
206
    }
207
208
    private DrawImageElement createImage() throws OdfException {
209
        DrawImageElement die = null;
210
        try {
211
            die = (DrawImageElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), DrawImageElement.ELEMENT_NAME);
212
        } catch (Exception e) {
213
            throw new OdfException("Can't create an image.", e);
214
        }
215
        return die;
216
    }
217
218
    private DrawFrameElement createImageFrame() {
219
        DrawFrameElement dfe = null;
220
        try {
221
            dfe = (DrawFrameElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), DrawFrameElement.ELEMENT_NAME);
222
        } catch (Exception e) {
223
            e.printStackTrace();
224
        }
225
        return dfe;
226
    }
227
228
    private void addImageToImageFrame(DrawImageElement die, DrawFrameElement dfe) throws OdfException {
229
        try {
230
            dfe.appendChild(die);
231
        } catch (Exception e) {
232
            throw new OdfException("Can't create an image.", e);
233
        }
234
    }
235
236
    private void addImageFrameToParagraph(DrawFrameElement dfe, TextParagraphElementBase tpeb) {
237
        try {
238
            tpeb.appendChild(dfe);
239
        } catch (Exception e) {
240
            e.printStackTrace();
241
        }
242
    }
243
244
    /**
245
     * {@inheritDoc}
246
     * @throws OdfException
247
     */
248
    public void executeFromParent(TagExecutable child) throws OdfException {
249
        child.execute(this);
250
    }
251
}
(-)src/java/org/apache/fop/render/odf/odt/tags/ListBlockTag.java (+71 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.element.text.TextListElement;
21
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
22
23
import org.apache.fop.fo.flow.ListBlock;
24
import org.apache.fop.render.odf.OdfException;
25
26
/**
27
 * ListBlock converter
28
 */
29
public class ListBlockTag extends Tag {
30
31
    protected TextListElement tle = null;
32
33
    ListBlockTag(Tag parent, ListBlock foNode) {
34
        super(parent);
35
    }
36
37
    public TextListElement getTextListElement() {
38
        return tle;
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     * @throws OdfException
44
     */
45
    @Override
46
    public void execute() throws OdfException {
47
        try {
48
            tle = (TextListElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TextListElement.ELEMENT_NAME);
49
        } catch (Exception e) {
50
            throw new OdfException("Can't create the list", e);
51
        }
52
    }
53
54
    @Override
55
    public void closeIntercept() throws OdfException {
56
        try {
57
            this.getOdt().getListContainerElement().appendChild(tle);
58
        } catch (Exception e) {
59
            throw new OdfException("Can't create the list", e);
60
        }
61
     }
62
63
    /**
64
     * {@inheritDoc}
65
     * @throws OdfException
66
     */
67
    public void executeFromParent(TagExecutable child) throws OdfException {
68
        child.execute(this);
69
    }
70
71
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TagExecutor.java (+28 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.render.odf.OdfException;
21
22
/**
23
 * Interface of the converter class that wants to execute in order to its parent converter
24
 */
25
public interface TagExecutor {
26
27
    void executeFromParent(TagExecutable child) throws OdfException;
28
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TagExecutable.java (+44 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.apache.fop.render.odf.OdfException;
21
22
/**
23
 * Interface for the class that accept parent visitor.
24
 */
25
public interface TagExecutable {
26
27
    void execute(Tag tag) throws OdfException;
28
29
    void execute(BlockTag tag) throws OdfException;
30
31
    void execute(InlineTag tag) throws OdfException;
32
33
    void execute(BasicLinkTag tag) throws OdfException;
34
35
    void execute(TableTag tag) throws OdfException;
36
37
    void execute(TableRowTag tag) throws OdfException;
38
39
    void execute(TableCellTag tag) throws OdfException;
40
41
    void execute(ListBlockTag tag) throws OdfException;
42
43
    void execute(ListItemTag tag) throws OdfException;
44
}
(-)src/java/org/apache/fop/render/odf/odt/tags/TableRowTag.java (+75 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt.tags;
19
20
import org.odftoolkit.odfdom.dom.element.table.TableTableRowElement;
21
import org.odftoolkit.odfdom.pkg.OdfXMLFactory;
22
23
import org.apache.fop.fo.flow.table.TableRow;
24
import org.apache.fop.render.odf.OdfException;
25
26
/**
27
 * TableRow converter
28
 */
29
public class TableRowTag extends Tag {
30
31
    private TableTableRowElement tre = null;
32
33
    TableRowTag(Tag parent, TableRow tblRow) {
34
        super(parent);
35
    }
36
37
    public TableTableRowElement getTableRow() {
38
        return this.tre;
39
    }
40
41
    /**
42
     * {@inheritDoc}
43
     * @throws OdfException
44
     */
45
    @Override
46
    public void execute() throws OdfException {
47
        try {
48
            tre = (TableTableRowElement) OdfXMLFactory.newOdfElement(this.getOdt().getContentDom(), TableTableRowElement.ELEMENT_NAME);
49
        } catch (Exception e) {
50
            throw new OdfException("Can't create table row.", e);
51
        }
52
53
        parent.executeFromParent(this);
54
    }
55
56
    /**
57
     * {@inheritDoc}
58
     */
59
    @Override
60
    public void execute(TableTag tag) {
61
        try {
62
            tag.getTable().appendChild(tre);
63
        } catch (Exception e) {
64
            e.printStackTrace();
65
        }
66
    }
67
68
    /**
69
     * {@inheritDoc}
70
     * @throws OdfException
71
     */
72
    public void executeFromParent(TagExecutable child) throws OdfException {
73
        child.execute(this);
74
    }
75
}
(-)src/java/org/apache/fop/render/odf/odt/Style.java (+174 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf.odt;
19
20
import java.util.HashMap;
21
import java.util.Map;
22
import java.util.Map.Entry;
23
24
import org.odftoolkit.odfdom.dom.element.style.StyleStyleElement;
25
import org.odftoolkit.odfdom.type.Color;
26
import org.odftoolkit.simple.style.StyleTypeDefinitions.HorizontalAlignmentType;
27
28
import org.apache.fop.datatypes.Length;
29
import org.apache.fop.fo.Constants;
30
import org.apache.fop.fo.properties.CommonFont;
31
import org.apache.fop.fo.properties.SpaceProperty;
32
import org.apache.fop.layoutmgr.BlockLayoutManager;
33
34
/**
35
 * Main class for style management.
36
 */
37
public class Style {
38
39
    public enum Params {
40
        FONT_NAME,
41
        FONT_STYLE,
42
        FONT_WEIGHT,
43
        FONT_SIZE,
44
        COLOR,
45
        TEXT_ALIGN,
46
        SPACE_BEFORE,
47
        SPACE_AFTER,
48
        MARGIN_LEFT,
49
        MARGIN_RIGHT,
50
        BACKGROUND_COLOR
51
    }
52
53
    private Map<Params, String> parameters = new HashMap<Params, String>();
54
55
    private Style parentStyle = null;
56
57
    /**
58
     * Constructor
59
     */
60
    public Style(Style parentStyle) {
61
        this.parentStyle = parentStyle;
62
    }
63
64
    /**
65
     * Constructor Style for the root tag. Setting default style parameters
66
     */
67
    public Style() {
68
        parameters.put(Params.FONT_NAME, "Times New Roman");
69
        parameters.put(Params.FONT_SIZE, "12pt");
70
        parameters.put(Params.COLOR, "#000000");
71
        parameters.put(Params.TEXT_ALIGN, HorizontalAlignmentType.LEFT.toString());
72
    }
73
74
    /**
75
     * Get all style parameters
76
     */
77
    public Map<Params, String> getParameters() {
78
        return parameters;
79
    }
80
81
    /**
82
     * get an object from parameters.
83
     */
84
    public String get(Params param) {
85
        String value = parameters.get(param);
86
87
        if (value == null && parentStyle != null) {
88
            value = parentStyle.get(param);
89
        }
90
91
        return value;
92
    }
93
94
    public static String getStyleName(Map<String, StyleStyleElement> styles, StyleStyleElement sse) {
95
        for (Entry<String, StyleStyleElement> entry : styles.entrySet()) {
96
            StyleStyleElement style = entry.getValue();
97
            if (style.equals(sse)) {
98
                return entry.getKey();
99
            }
100
        }
101
        return null;
102
    }
103
104
    public static Double fopLengthToDouble(Length length) {
105
        return Double.valueOf((double)length.getValue() / 1000);
106
    }
107
108
    public static String awtColorToOdfColor(java.awt.Color color) {
109
        if (color == null) {
110
            return null;
111
        } else {
112
            return new Color(color.getRed(),
113
                         color.getGreen(),
114
                         color.getBlue()).toString();
115
        }
116
    }
117
118
    public static String fopFontToOdfFontStyle(CommonFont commonFont) {
119
        return commonFont.getFontStyle() == Constants.EN_ITALIC ? "italic" : null;
120
    }
121
122
    public static String fopFontToOdfFontWeight(CommonFont commonFont) {
123
        return commonFont.getFontWeight() >= Constants.EN_700 ? "bold" : null;
124
    }
125
126
    public static String fopAlignToOdfAlign(int textAlign) {
127
128
        if (textAlign == Constants.EN_LEFT) {
129
            return HorizontalAlignmentType.LEFT.toString();
130
        } else if (textAlign == Constants.EN_JUSTIFY) {
131
            return HorizontalAlignmentType.JUSTIFY.toString();
132
        } else if (textAlign == Constants.EN_CENTER) {
133
            return HorizontalAlignmentType.CENTER.toString();
134
        } else if (textAlign == 39) {
135
            return HorizontalAlignmentType.RIGHT.toString();
136
        } else {
137
            return HorizontalAlignmentType.LEFT.toString();
138
        }
139
140
    }
141
142
    public static String fopSpaceBeforeToPt(SpaceProperty spaceBefore, BlockLayoutManager context) {
143
        if (spaceBefore == null) {
144
            return null;
145
        }
146
        Double value = Double.valueOf((double) spaceBefore.getLengthRange().toMinOptMax(context).getOpt() / 1000);
147
        return value + "pt";
148
    }
149
150
    public static String fopSpaceAfterToPt(SpaceProperty spaceAfter, BlockLayoutManager context) {
151
        if (spaceAfter == null) {
152
            return null;
153
        }
154
        Double value = Double.valueOf((double) spaceAfter.getLengthRange().toMinOptMax(context).getOpt() / 1000);
155
        return value + "pt";
156
    }
157
158
    public static String fopLengthToPt(Length l) {
159
        if (l == null) {
160
            return null;
161
        }
162
        Double value = Double.valueOf((double)l.getValue() / 1000);
163
        return value + "pt";
164
    }
165
166
    public static String awtColorToString(java.awt.Color color) {
167
        if (color == null) {
168
            return null;
169
        }
170
        return "#" + Integer.toHexString(color.getRed())
171
                   + Integer.toHexString(color.getGreen())
172
                   + Integer.toHexString(color.getBlue());
173
    }
174
}
(-)src/java/org/apache/fop/render/odf/ODTFOEventHandlerMaker.java (+63 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.fop.render.odf;
19
20
import java.io.OutputStream;
21
22
import org.apache.fop.apps.FOUserAgent;
23
import org.apache.fop.apps.MimeConstants;
24
import org.apache.fop.fo.FOEventHandler;
25
import org.apache.fop.render.AbstractFOEventHandlerMaker;
26
27
/**
28
 * Maker class for ODT support.
29
 */
30
public class ODTFOEventHandlerMaker extends AbstractFOEventHandlerMaker {
31
32
    private static final String[] MIMES = new String[] {
33
        MimeConstants.MIME_ODT
34
    };
35
36
37
    /**
38
     * {@inheritDoc}
39
     * @param ua FOUserAgent
40
     * @param out OutputStream
41
     * @return created ODTHandler
42
     */
43
    public FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out) {
44
        return new ODTHandler(ua, out);
45
    }
46
47
    /**
48
     * {@inheritDoc}
49
     * @return true, if an outputstream is needed
50
     */
51
    public boolean needsOutputStream() {
52
        return true;
53
    }
54
55
    /**
56
     * {@inheritDoc}
57
     * @return array of MIME types
58
     */
59
    public String[] getSupportedMimeTypes() {
60
        return MIMES;
61
    }
62
63
}
(-)src/java/org/apache/fop/cli/CommandLineOptions.java (-1 / +16 lines)
Lines 319-324 Link Here
319
                i = i + parsePDFOutputOption(args, i, "PDF/A-1b");
319
                i = i + parsePDFOutputOption(args, i, "PDF/A-1b");
320
            } else if (args[i].equals("-mif")) {
320
            } else if (args[i].equals("-mif")) {
321
                i = i + parseMIFOutputOption(args, i);
321
                i = i + parseMIFOutputOption(args, i);
322
            } else if (args[i].equals("-odt")) {
323
                i = i + parseODTOutputOption(args, i);
322
            } else if (args[i].equals("-rtf")) {
324
            } else if (args[i].equals("-rtf")) {
323
                i = i + parseRTFOutputOption(args, i);
325
                i = i + parseRTFOutputOption(args, i);
324
            } else if (args[i].equals("-tiff")) {
326
            } else if (args[i].equals("-tiff")) {
Lines 519-524 Link Here
519
        }
521
        }
520
    }
522
    }
521
523
524
    private int parseODTOutputOption(String[] args, int i) throws FOPException {
525
        setOutputMode(MimeConstants.MIME_ODT);
526
        if ((i + 1 == args.length)
527
                || (isOption(args[i + 1]))) {
528
            throw new FOPException("you must specify the ODT output file");
529
        } else {
530
            setOutputFile(args[i + 1]);
531
            return 1;
532
        }
533
    }
534
522
    private void setOutputFile(String filename) {
535
    private void setOutputFile(String filename) {
523
        if (isSystemInOutFile(filename)) {
536
        if (isSystemInOutFile(filename)) {
524
            this.useStdOut = true;
537
            this.useStdOut = true;
Lines 1177-1183 Link Here
1177
    public static void printUsage(PrintStream out) {
1190
    public static void printUsage(PrintStream out) {
1178
        out.println(
1191
        out.println(
1179
              "\nUSAGE\nfop [options] [-fo|-xml] infile [-xsl file] "
1192
              "\nUSAGE\nfop [options] [-fo|-xml] infile [-xsl file] "
1180
                    + "[-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>\n"
1193
                    + "[-awt|-pdf|-mif|-odt|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] <outfile>\n"
1181
            + " [OPTIONS]  \n"
1194
            + " [OPTIONS]  \n"
1182
            + "  -version          print FOP version and exit\n"
1195
            + "  -version          print FOP version and exit\n"
1183
            + "  -d                debug mode   \n"
1196
            + "  -d                debug mode   \n"
Lines 1236-1241 Link Here
1236
            + "  -pdfa1b outfile   input will be rendered as PDF/A-1b compliant PDF\n"
1249
            + "  -pdfa1b outfile   input will be rendered as PDF/A-1b compliant PDF\n"
1237
            + "                    (outfile req'd, same as \"-pdf outfile -pdfprofile PDF/A-1b\")\n"
1250
            + "                    (outfile req'd, same as \"-pdf outfile -pdfprofile PDF/A-1b\")\n"
1238
            + "  -awt              input will be displayed on screen \n"
1251
            + "  -awt              input will be displayed on screen \n"
1252
            + "  -odt outfile      input will be rendered as ODT (outfile req'd)\n"
1239
            + "  -rtf outfile      input will be rendered as RTF (outfile req'd)\n"
1253
            + "  -rtf outfile      input will be rendered as RTF (outfile req'd)\n"
1240
            + "  -pcl outfile      input will be rendered as PCL (outfile req'd) \n"
1254
            + "  -pcl outfile      input will be rendered as PCL (outfile req'd) \n"
1241
            + "  -ps outfile       input will be rendered as PostScript (outfile req'd) \n"
1255
            + "  -ps outfile       input will be rendered as PostScript (outfile req'd) \n"
Lines 1271-1276 Link Here
1271
            + "  fop -xml foo.xml -xsl foo.xsl -foout foo.fo\n"
1285
            + "  fop -xml foo.xml -xsl foo.xsl -foout foo.fo\n"
1272
            + "  fop -xml - -xsl foo.xsl -pdf -\n"
1286
            + "  fop -xml - -xsl foo.xsl -pdf -\n"
1273
            + "  fop foo.fo -mif foo.mif\n"
1287
            + "  fop foo.fo -mif foo.mif\n"
1288
            + "  fop foo.fo -odt foo.odt\n"
1274
            + "  fop foo.fo -rtf foo.rtf\n"
1289
            + "  fop foo.fo -rtf foo.rtf\n"
1275
            + "  fop foo.fo -print\n"
1290
            + "  fop foo.fo -print\n"
1276
            + "  fop foo.fo -awt\n");
1291
            + "  fop foo.fo -awt\n");
(-)src/java/org/apache/fop/apps/MimeConstants.java (+2 lines)
Lines 32-35 Link Here
32
    String MIME_FOP_AREA_TREE   = "application/X-fop-areatree";
32
    String MIME_FOP_AREA_TREE   = "application/X-fop-areatree";
33
    /** Apache FOP's intermediate format XML */
33
    /** Apache FOP's intermediate format XML */
34
    String MIME_FOP_IF          = "application/X-fop-intermediate-format";
34
    String MIME_FOP_IF          = "application/X-fop-intermediate-format";
35
    /** Apache FOP's ODT format */
36
    String MIME_ODT             = "application/vnd.oasis.opendocument.text";
35
}
37
}
(-)src/java/META-INF/services/org.apache.fop.fo.FOEventHandler (-1 / +2 lines)
Line 1 Link Here
1
org.apache.fop.render.rtf.RTFFOEventHandlerMaker
1
org.apache.fop.render.rtf.RTFFOEventHandlerMaker
2
org.apache.fop.render.odf.ODTFOEventHandlerMaker
(-)test/odf/odt/fo_inline/color_font_size_style_weight.fo (+24 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block text-align="justify">
15
				<fo:block font-size="15pt" color="red">
16
					Joad <fo:inline font-weight="bold">rolled</fo:inline> the coat <fo:inline color="blue" font-size="20pt">up more</fo:inline> tightly. "An old turtle," he said. "Picked
17
					him up on the
18
					road. An old bulldozer. <fo:inline font-style="italic">Thought I'd </fo:inline>take 'im to my little brother. Kids
19
					like turtles."
20
				</fo:block>
21
			</fo:block>
22
		</fo:flow>
23
	</fo:page-sequence>
24
</fo:root>
(-)test/odf/odt/basic/text.fo (+28 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
3
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
4
5
  <fo:layout-master-set>
6
    <fo:simple-page-master master-name="simple"
7
                  page-height="29.7cm"
8
                  page-width="21cm"
9
                  margin-top="1cm"
10
                  margin-bottom="2cm"
11
                  margin-left="2.5cm"
12
                  margin-right="2.5cm">
13
      <fo:region-body margin-top="3cm"/>
14
      <fo:region-before extent="3cm"/>
15
      <fo:region-after extent="1.5cm"/>
16
    </fo:simple-page-master>
17
  </fo:layout-master-set>
18
19
  <fo:page-sequence master-reference="simple">
20
    <fo:flow flow-name="xsl-region-body">
21
      <fo:block font-size="12pt"
22
                font-family="sans-serif"
23
                line-height="15pt"
24
                space-after.optimum="3pt"
25
                text-align="justify">This is simple text.</fo:block>
26
    </fo:flow>
27
  </fo:page-sequence>
28
</fo:root>
(-)test/odf/odt/fo_block/font_size.fo (+164 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
3
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
4
5
	<fo:layout-master-set>
6
		<fo:simple-page-master master-name="simple"
7
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
8
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
9
			<fo:region-body margin-top="3cm" />
10
			<fo:region-before extent="3cm" />
11
			<fo:region-after extent="1.5cm" />
12
		</fo:simple-page-master>
13
	</fo:layout-master-set>
14
15
	<fo:page-sequence master-reference="simple">
16
		<fo:flow flow-name="xsl-region-body">
17
			<fo:block>
18
				<fo:block font-size="13pt">
19
					Lokomotywa
20
				</fo:block>
21
				<fo:block font-size="4pt">
22
					Stoi na stacji lokomotywa,
23
					<fo:block />
24
					Ciężka, ogromna i pot z niej spływa -
25
					<fo:block />
26
					Tłusta oliwa.
27
					<fo:block />
28
					Stoi i sapie, dyszy i dmucha,
29
					<fo:block />
30
					Żar z rozgrzanego jej brzucha bucha:
31
					<fo:block />
32
					Buch - jak gorąco!
33
					<fo:block />
34
					Uch - jak gorąco!
35
					<fo:block />
36
					Puff - jak gorąco!
37
					<fo:block />
38
					Uff - jak gorąco!
39
					<fo:block />
40
					Już ledwo sapie, już ledwo zipie,
41
					<fo:block />
42
					A jeszcze palacz węgiel w nią sypie.
43
					<fo:block />
44
					Wagony do niej podoczepiali
45
					<fo:block />
46
					Wielkie i ciężkie, z żelaza, stali,
47
					<fo:block />
48
					I pełno ludzi w każdym wagonie,
49
					<fo:block />
50
					A w jednym krowy, a w drugim konie,
51
					<fo:block />
52
					A w trzecim siedzą same grubasy,
53
					<fo:block />
54
					Siedzą i jedzą tłuste kiełbasy.
55
					<fo:block />
56
					A czwarty wagon pełen bananów,
57
					<fo:block />
58
					A w piątym stoi sześć fortepianów,
59
					<fo:block />
60
					W szóstym armata, o! jaka wielka!
61
					<fo:block />
62
					Pod każdym kołem żelazna belka!
63
					<fo:block />
64
					W siódmym dębowe stoły i szafy,
65
					<fo:block />
66
					W ósmym słoń, niedźwiedź i dwie żyrafy,
67
					<fo:block />
68
					W dziewiątym - same tuczone świnie,
69
					<fo:block />
70
					W dziesiątym - kufry, paki i skrzynie,
71
					<fo:block />
72
					A tych wagonów jest ze czterdzieści,
73
					<fo:block />
74
					Sam nie wiem, co się w nich jeszcze mieści.
75
				</fo:block>
76
				<fo:block font-size="6pt">
77
					Lecz choćby przyszło tysiąc atletów
78
					<fo:block />
79
					I każdy zjadłby tysiąc kotletów,
80
					<fo:block />
81
					I każdy nie wiem jak się natężał,
82
					<fo:block />
83
					To nie udźwigną - taki to ciężar!
84
				</fo:block>
85
				<fo:block font-size="15pt">
86
					Nagle - gwizd!
87
					<fo:block />
88
					Nagle - świst!
89
					<fo:block />
90
					Para - buch!
91
					<fo:block />
92
					Koła - w ruch!
93
				</fo:block>
94
				<fo:block font-size="8pt">
95
					Najpierw
96
					<fo:block />
97
					powoli
98
					<fo:block />
99
					jak żółw
100
					<fo:block />
101
					ociężale
102
					<fo:block />
103
					Ruszyła
104
					<fo:block />
105
					maszyna
106
					<fo:block />
107
					po szynach
108
					<fo:block />
109
					ospale.
110
					<fo:block />
111
					Szarpnęła wagony i ciągnie z mozołem,
112
					<fo:block />
113
					I kręci się, kręci się koło za kołem,
114
					<fo:block />
115
					I biegu przyspiesza, i gna coraz prędzej,
116
					<fo:block />
117
					I dudni, i stuka, łomoce i pędzi.
118
				</fo:block>
119
				<fo:block font-size="11pt">
120
					A dokąd? A dokąd? A dokąd? Na wprost!
121
					<fo:block />
122
					Po torze, po torze, po torze, przez most,
123
					<fo:block />
124
					Przez góry, przez tunel, przez pola, przez las
125
					<fo:block />
126
					I spieszy się, spieszy, by zdążyć na czas,
127
					<fo:block />
128
					Do taktu turkoce i puka, i stuka to:
129
					<fo:block />
130
					Tak to to, tak to to, tak to to, tak to to,
131
					<fo:block />
132
					Gładko tak, lekko tak toczy się w dal,
133
					<fo:block />
134
					Jak gdyby to była piłeczka, nie stal,
135
					<fo:block />
136
					Nie ciężka maszyna zziajana, zdyszana,
137
					<fo:block />
138
					Lecz raszka, igraszka, zabawka blaszana.
139
				</fo:block>
140
				<fo:block font-size="20pt">
141
					A skądże to, jakże to, czemu tak gna?
142
					<fo:block />
143
					A co to to, co to to, kto to tak pcha?
144
					<fo:block />
145
					Że pędzi, że wali, że bucha, buch-buch?
146
					<fo:block />
147
					To para gorąca wprawiła to w ruch,
148
					<fo:block />
149
					To para, co z kotła rurami do tłoków,
150
					<fo:block />
151
					A tłoki kołami ruszają z dwóch boków
152
					<fo:block />
153
					I gnają, i pchają, i pociąg się toczy,
154
					<fo:block />
155
					Bo para te tłoki wciąż tłoczy i tłoczy,,
156
					<fo:block />
157
					I koła turkocą, i puka, i stuka to:
158
					<fo:block />
159
					Tak to to, tak to to, tak to to, tak to to!...
160
				</fo:block>
161
			</fo:block>
162
		</fo:flow>
163
	</fo:page-sequence>
164
</fo:root>
(-)test/odf/odt/fo_block/color.fo (+253 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block font-family="Arial" font-size="13pt">
15
				<fo:block font-size="20pt" color="black" >
16
					Julian Tuwim - Rzepka
17
				</fo:block>
18
				<fo:block color="#00ff00">
19
					Zasadził dziadek rzepkę w ogrodzie,
20
					<fo:block />
21
					Chodził te rzepkę oglądać co dzień.
22
					<fo:block />
23
					Wyrosła rzepka jędrna i krzepka,
24
					<fo:block />
25
					Schrupać by rzepkę z kawałkiem chlebaka!
26
					<fo:block />
27
					Więc ciągnie rzepkę dziadek niebożę,
28
					<fo:block />
29
					Ciągnie i ciągnie, wyciągnąć nie może!
30
				</fo:block>
31
				<fo:block color="red">
32
					Zawołał dziadek na pomoc babcię:
33
					<fo:block />
34
					"Ja złapię rzepkę, ty za mnie złap się!"
35
					<fo:block />
36
					I biedny dziadek z babcią niebogą
37
					<fo:block />
38
					Ciągną i ciągną, wyciągnąć nie mogą!
39
					<fo:block />
40
					Babcia za dziadka,
41
					<fo:block />
42
					Dziadek za rzepkę,
43
					<fo:block />
44
					Oj, przydałby się ktoś na przyczepkę!
45
				</fo:block>
46
				<fo:block color="#445533">
47
					Przyleciał wnuczek, babci się złapał,
48
					<fo:block />
49
					Poci się, stęka, aż się zasapał!
50
					<fo:block />
51
					Wnuczek za babcię,
52
					<fo:block />
53
					Babcia za dziadka,
54
					<fo:block />
55
					Dziadek za rzepkę,
56
					<fo:block />
57
					Oj, przydałby się ktoś na przyczepkę!
58
					<fo:block />
59
					Pocą się, sapią, stękają srogo,
60
					<fo:block />
61
					Ciągną i ciągną, wyciągnąć nie mogą!
62
				</fo:block>
63
				<fo:block color="orange">
64
					Zawołał wnuczek szczeniaczka Mruczka,
65
					<fo:block />
66
					Przyleciał Mruczek i ciągnie wnuczka!
67
					<fo:block />
68
					Mruczek za wnuczka,
69
					<fo:block />
70
					Wnuczek za babcię,
71
					<fo:block />
72
					Babcia za dziadka,
73
					<fo:block />
74
					Dziadek za rzepkę,
75
					<fo:block />
76
					Oj, przydałby się ktoś na przyczepkę!
77
					<fo:block />
78
					Pocą się, sapią, stękają srogo,
79
					<fo:block />
80
					Ciągną i ciągną, wyciągnąć nie mogą!
81
				</fo:block>
82
				<fo:block color="#abcdef">
83
					Na kurkę czyhał kotek w ukryciu,
84
					<fo:block />
85
					Zaszczekał Mruczek: "Pomóż nam, Kiciu!"
86
					<fo:block />
87
					Kicia za Mruczka,
88
					<fo:block />
89
					Mruczek za wnuczka,
90
					<fo:block />
91
					Wnuczek za babcię,
92
					<fo:block />
93
					Babcia za dziadka,
94
					<fo:block />
95
					Dziadek za rzepkę,
96
					<fo:block />
97
					Oj, przydałby się ktoś na przyczepkę!
98
					<fo:block />
99
					Pocą się, sapią, stękają srogo,
100
					<fo:block />
101
					Ciągną i ciągną, wyciągnąć nie mogą!
102
				</fo:block>
103
				<fo:block color="#654321">
104
					Więc woła Kicia kurkę z podwórka,
105
					<fo:block />
106
					Wnet przyleciała usłużna kurka.
107
					<fo:block />
108
					Kurka za Kicię,
109
					<fo:block />
110
					Kicia za Mruczka,
111
					<fo:block />
112
					Mruczek za wnuczka,
113
					<fo:block />
114
					Wnuczek za babcię,
115
					<fo:block />
116
					Babcia za dziadka,
117
					<fo:block />
118
					Dziadek za rzepkę,
119
					<fo:block />
120
					Oj, przydałby się ktoś na przyczepkę!
121
					<fo:block />
122
					Pocą się, sapią, stękają srogo,
123
					<fo:block />
124
					Ciągną i ciągną, wyciągnąć nie mogą!
125
				</fo:block>
126
				<fo:block color="#123456">
127
					Szła sobie gąska ścieżynką wąską,
128
					<fo:block />
129
					Krzyknęła kurka: "ChodĽ no tu gąsko!"
130
					<fo:block />
131
					Gąska za kurkę,
132
					<fo:block />
133
					Kurka za Kicię,
134
					<fo:block />
135
					Kicia za Mruczka,
136
					<fo:block />
137
					Mruczek za wnuczka,
138
					<fo:block />
139
					Wnuczek za babcię,
140
					<fo:block />
141
					Babcia za dziadka,
142
					<fo:block />
143
					Dziadek za rzepkę,
144
					<fo:block />
145
					Oj, przydałby się ktoś na przyczepkę!
146
					<fo:block />
147
					Pocą się, sapią, stękają srogo,
148
					<fo:block />
149
					Ciągną i ciągną, wyciągnąć nie mogą!
150
				</fo:block>
151
				<fo:block color="#334411">
152
					Leciał wysoko bocian-długonos,
153
					<fo:block />
154
					"Fruńże tu, boćku, do nas na pomoc!"
155
					<fo:block />
156
					Bociek za gąskę,
157
					<fo:block />
158
					Gąska za kurkę,
159
					<fo:block />
160
					Kurka za Kicię,
161
					<fo:block />
162
					Kicia za Mruczka,
163
					<fo:block />
164
					Mruczek za wnuczka,
165
					<fo:block />
166
					Wnuczek za babcię,
167
					<fo:block />
168
					Babcia za dziadka,
169
					<fo:block />
170
					Dziadek za rzepkę,
171
					<fo:block />
172
					Oj, przydałby się ktoś na przyczepkę!
173
					<fo:block />
174
					Pocą się, sapią, stękają srogo,
175
					<fo:block />
176
					Ciągną i ciągną, wyciągnąć nie mogą!
177
				</fo:block>
178
				<fo:block color="#aabbcc">
179
					Skakała drogą zielona żabka,
180
					<fo:block />
181
					Złapała boćka - rzadka to gradka!
182
					<fo:block />
183
					Żabka za boćka,
184
					<fo:block />
185
					Bociek za gąskę,
186
					<fo:block />
187
					Gąska za kurkę,
188
					<fo:block />
189
					Kurka za Kicię,
190
					<fo:block />
191
					Kicia za Mruczka,
192
					<fo:block />
193
					Mruczek za wnuczka,
194
					<fo:block />
195
					Wnuczek za babcię,
196
					<fo:block />
197
					Babcia za dziadka,
198
					<fo:block />
199
					Dziadek za rzepkę,
200
					<fo:block />
201
					A na przyczepkę
202
					<fo:block />
203
					Kawka za żabkę
204
					<fo:block />
205
					Bo na tę rzepkę
206
					<fo:block />
207
					Też miała chrapkę.
208
				</fo:block>
209
				<fo:block color="yellow">
210
					Tak się zawzięli,
211
					<fo:block />
212
					Tak się nadęli,
213
					<fo:block />
214
					Ze nagle rzepkę
215
					<fo:block />
216
					Trrrach!! - wyciągnęli!
217
					<fo:block />
218
					Aż wstyd powiedzieć,
219
					<fo:block />
220
					Co było dalej!
221
					<fo:block />
222
					Wszyscy na siebie
223
					<fo:block />
224
					Poupadali:
225
					<fo:block />
226
					Rzepka na dziadka,
227
					<fo:block />
228
					Dziadek na babcię,
229
					<fo:block />
230
					Babcia na wnuczka,
231
					<fo:block />
232
					Wnuczek na Mruczka,
233
					<fo:block />
234
					Mruczek na Kicię,
235
					<fo:block />
236
					Kicia na kurkę,
237
					<fo:block />
238
					Kurka na gąskę,
239
					<fo:block />
240
					Gąska na boćka,
241
					<fo:block />
242
					Bociek na żabkę,
243
					<fo:block />
244
					Żabka na kawkę
245
					<fo:block />
246
					I na ostatku
247
					<fo:block />
248
					Kawka na trawkę.
249
				</fo:block>
250
			</fo:block>
251
		</fo:flow>
252
	</fo:page-sequence>
253
</fo:root>
(-)test/odf/odt/fo_block/font_family.fo (+169 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
3
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
4
5
	<fo:layout-master-set>
6
		<fo:simple-page-master master-name="simple"
7
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
8
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
9
			<fo:region-body margin-top="3cm" />
10
			<fo:region-before extent="3cm" />
11
			<fo:region-after extent="1.5cm" />
12
		</fo:simple-page-master>
13
	</fo:layout-master-set>
14
15
	<fo:page-sequence master-reference="simple">
16
		<fo:flow flow-name="xsl-region-body">
17
			<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
18
				font-size="11pt">
19
				<fo:block font-family="Arial, Helvetica, Symbol, sans-serif">
20
					Lokomotywa
21
				</fo:block>
22
				<fo:block font-family="Helvetica, Symbol, sans-serif"
23
					font-size="11pt">
24
					Stoi na stacji lokomotywa,
25
					<fo:block />
26
					Ciężka, ogromna i pot z niej spływa -
27
					<fo:block />
28
					Tłusta oliwa.
29
					<fo:block />
30
					Stoi i sapie, dyszy i dmucha,
31
					<fo:block />
32
					Żar z rozgrzanego jej brzucha bucha:
33
					<fo:block />
34
					Buch - jak gorąco!
35
					<fo:block />
36
					Uch - jak gorąco!
37
					<fo:block />
38
					Puff - jak gorąco!
39
					<fo:block />
40
					Uff - jak gorąco!
41
					<fo:block />
42
					Już ledwo sapie, już ledwo zipie,
43
					<fo:block />
44
					A jeszcze palacz węgiel w nią sypie.
45
					<fo:block />
46
					Wagony do niej podoczepiali
47
					<fo:block />
48
					Wielkie i ciężkie, z żelaza, stali,
49
					<fo:block />
50
					I pełno ludzi w każdym wagonie,
51
					<fo:block />
52
					A w jednym krowy, a w drugim konie,
53
					<fo:block />
54
					A w trzecim siedzą same grubasy,
55
					<fo:block />
56
					Siedzą i jedzą tłuste kiełbasy.
57
					<fo:block />
58
					A czwarty wagon pełen bananów,
59
					<fo:block />
60
					A w piątym stoi sześć fortepianów,
61
					<fo:block />
62
					W szóstym armata, o! jaka wielka!
63
					<fo:block />
64
					Pod każdym kołem żelazna belka!
65
					<fo:block />
66
					W siódmym dębowe stoły i szafy,
67
					<fo:block />
68
					W ósmym słoń, niedźwiedź i dwie żyrafy,
69
					<fo:block />
70
					W dziewiątym - same tuczone świnie,
71
					<fo:block />
72
					W dziesiątym - kufry, paki i skrzynie,
73
					<fo:block />
74
					A tych wagonów jest ze czterdzieści,
75
					<fo:block />
76
					Sam nie wiem, co się w nich jeszcze mieści.
77
				</fo:block>
78
				<fo:block font-family="sans-serif" font-size="11pt">
79
					Lecz choćby przyszło tysiąc atletów
80
					<fo:block />
81
					I każdy zjadłby tysiąc kotletów,
82
					<fo:block />
83
					I każdy nie wiem jak się natężał,
84
					<fo:block />
85
					To nie udźwigną - taki to ciężar!
86
				</fo:block>
87
				<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
88
					font-size="11pt">
89
					Nagle - gwizd!
90
					<fo:block />
91
					Nagle - świst!
92
					<fo:block />
93
					Para - buch!
94
					<fo:block />
95
					Koła - w ruch!
96
				</fo:block>
97
				<fo:block font-family="Times new Roman" font-size="11pt">
98
					Najpierw
99
					<fo:block />
100
					powoli
101
					<fo:block />
102
					jak żółw
103
					<fo:block />
104
					ociężale
105
					<fo:block />
106
					Ruszyła
107
					<fo:block />
108
					maszyna
109
					<fo:block />
110
					po szynach
111
					<fo:block />
112
					ospale.
113
					<fo:block />
114
					Szarpnęła wagony i ciągnie z mozołem,
115
					<fo:block />
116
					I kręci się, kręci się koło za kołem,
117
					<fo:block />
118
					I biegu przyspiesza, i gna coraz prędzej,
119
					<fo:block />
120
					I dudni, i stuka, łomoce i pędzi.
121
				</fo:block>
122
				<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
123
					font-size="11pt">
124
					A dokąd? A dokąd? A dokąd? Na wprost!
125
					<fo:block />
126
					Po torze, po torze, po torze, przez most,
127
					<fo:block />
128
					Przez góry, przez tunel, przez pola, przez las
129
					<fo:block />
130
					I spieszy się, spieszy, by zdążyć na czas,
131
					<fo:block />
132
					Do taktu turkoce i puka, i stuka to:
133
					<fo:block />
134
					Tak to to, tak to to, tak to to, tak to to,
135
					<fo:block />
136
					Gładko tak, lekko tak toczy się w dal,
137
					<fo:block />
138
					Jak gdyby to była piłeczka, nie stal,
139
					<fo:block />
140
					Nie ciężka maszyna zziajana, zdyszana,
141
					<fo:block />
142
					Lecz raszka, igraszka, zabawka blaszana.
143
				</fo:block>
144
				<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
145
					font-size="11pt">
146
					A skądże to, jakże to, czemu tak gna?
147
					<fo:block />
148
					A co to to, co to to, kto to tak pcha?
149
					<fo:block />
150
					Że pędzi, że wali, że bucha, buch-buch?
151
					<fo:block />
152
					To para gorąca wprawiła to w ruch,
153
					<fo:block />
154
					To para, co z kotła rurami do tłoków,
155
					<fo:block />
156
					A tłoki kołami ruszają z dwóch boków
157
					<fo:block />
158
					I gnają, i pchają, i pociąg się toczy,
159
					<fo:block />
160
					Bo para te tłoki wciąż tłoczy i tłoczy,,
161
					<fo:block />
162
					I koła turkocą, i puka, i stuka to:
163
					<fo:block />
164
					Tak to to, tak to to, tak to to, tak to to!...
165
				</fo:block>
166
			</fo:block>
167
		</fo:flow>
168
	</fo:page-sequence>
169
</fo:root>
(-)test/odf/odt/fo_block/text_align.fo (+77 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block font-size="13pt">
15
				<fo:block text-align="justify">
16
					Joad rolled the coat up more tightly. "An old turtle," he said. "Picked
17
					him up on the
18
					road. An old bulldozer. Thought I'd take 'im to my little brother. Kids
19
					like turtles."
20
				</fo:block>
21
				<fo:block text-align="left">
22
					The preacher nodded his head slowly. "Every kid got a turtle some time
23
					or other.
24
					Nobody can't keep a turtle though. They work at it and work at it, and at
25
					last one day
26
					they get out and away they go—off somewheres. It's like me. I wouldn't
27
					take the good
28
					ol' gospel that was just layin' there to my hand. I got to be pickin'
29
					at it an' workin' at it
30
					until I got it all tore down. Here I got the sperit sometimes an'
31
					nothin' to preach about. I
32
					got the call to lead people, an' no place to lead 'em."
33
				</fo:block>
34
				<fo:block text-align="right">
35
					"Lead 'em around and around," said Joad. "Sling 'em in the irrigation
36
					ditch. Tell 'em
37
					they'll burn in hell if they don't think like you. What the hell you want
38
					to lead 'em
39
					someplace for? Jus' lead 'em."
40
				</fo:block>
41
				<fo:block text-align="center">
42
					The straight trunk shade had stretched out along the ground. Joad
43
					moved gratefully
44
					into it and squatted on his hams and made a new smooth place on which
45
					to draw his
46
					thoughts with a stick. A thick-furred yellow shepherd dog came trotting
47
					down the road,
48
					head low, tongue lolling and dripping. Its tail hung limply curled, and
49
					it panted loudly.
50
					Joad whistled at it, but it only dropped its head an inch and trotted
51
					fast toward some
52
					definite destination. "Goin' someplace," Joad explained, a little piqued.
53
					"Goin' for
54
					home maybe."
55
				</fo:block>
56
				<fo:block>
57
					The preacher could not be thrown from his subject. "Goin' someplace,"
58
					he repeated.
59
					"That's right, he's goin' someplace. Me—I don't know where I'm goin'. Tell
60
					you what—
61
					I used ta get the people jumpin' an' talkin' in tongues and
62
					glory-shoutin' till they just
63
					fell down an' passed out. An' some I'd baptize to bring 'em to. An'
64
					then—you know
65
					what I'd do? I'd take one of them girls out in the grass, an' I'd lay
66
					with her. Done it
67
					ever' time. Then I'd feel bad, an' I'd pray an' pray, but it didn't do
68
					no good. Come the
69
					next time, them an' me was full of the sperit, I'd do it again. I
70
					figgered there just wasn't
71
					no hope for me, an' I was a damned ol' hypocrite. But I didn't mean
72
					to be."
73
				</fo:block>
74
			</fo:block>
75
		</fo:flow>
76
	</fo:page-sequence>
77
</fo:root>
(-)test/odf/odt/fo_block/space_before_after.fo (+64 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block font-size="13pt" text-align="justify">
15
				<fo:block space-before="10pt" space-after="6pt">
16
					Joad had moved
17
					into the imperfect shade of the molting leaves before
18
					the man heard
19
					him coming, stopped his song, and turned his head. It was a long
20
					head,
21
					bony; tight of
22
					skin, and set on a neck as stringy and muscular
23
					as a celery stalk. His
24
					eyeballs were
25
					heavy and protruding; the lids
26
					stretched to cover them, and the lids
27
					were raw and red.
28
					His cheeks
29
					were brown and shiny and hairless and his mouth
30
					full—humorous or
31
					sensual. The nose, beaked and hard, stretched the skin so tightly
32
					that the
33
					bridge showed
34
					white. There was no perspiration on the face,
35
					not even on the tall pale
36
					forehead. It was
37
					an abnormally high
38
					forehead, lined with delicate blue veins at the
39
					temples. Fully half
40
					of the face was above the eyes. His stiff gray hair was mussed back
41
					from his brow as
42
					though he had combed it back with his fingers. For
43
					clothes he wore
44
					overalls and a blue
45
					shirt. A denim coat with brass
46
					buttons and a spotted brown hat creased
47
					like a pork pie
48
					lay on the
49
					ground beside him. Canvas sneakers, gray with dust, lay
50
					near by
51
					where they
52
					had fallen when they were kicked off.
53
				</fo:block>
54
				<fo:block space-before="1pt" space-after="1pt">
55
					The man looked long at Joad. The light seemed to go far into his brown
56
					eyes, and it
57
					picked out little golden specks deep in the irises. The strained bundle
58
					of neck muscles
59
					stood out.
60
				</fo:block>
61
			</fo:block>
62
		</fo:flow>
63
	</fo:page-sequence>
64
</fo:root>
(-)test/odf/odt/fo_block/font_style.fo (+30 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block>
15
				<fo:block>
16
					O KOCIE
17
				</fo:block>
18
				<fo:block font-style="italic">
19
					Słyszał kto kiedy jako ciągą kota? 
20
					<fo:block/>
21
					Nie zawżdy szuka wody ta robota, 
22
					<fo:block/>
23
					Ciągnie go drugi nadobnie na suszy, 
24
					<fo:block/>
25
					Sukniej nie zmacza, ale wżdy mdło duszy.
26
				</fo:block>
27
			</fo:block>
28
		</fo:flow>
29
	</fo:page-sequence>
30
</fo:root>
(-)test/odf/odt/fo_block/font_weight.fo (+33 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
3
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
4
5
	<fo:layout-master-set>
6
		<fo:simple-page-master master-name="simple"
7
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
8
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
9
			<fo:region-body margin-top="3cm" />
10
			<fo:region-before extent="3cm" />
11
			<fo:region-after extent="1.5cm" />
12
		</fo:simple-page-master>
13
	</fo:layout-master-set>
14
15
	<fo:page-sequence master-reference="simple">
16
		<fo:flow flow-name="xsl-region-body">
17
			<fo:block>
18
				<fo:block font-weight="bold">
19
					DO PANIEJ
20
				</fo:block>
21
				<fo:block>
22
					Co usty mówisz byś w sercu myśliła,
23
					<fo:block/>
24
					Barzo byś mię tym, Pani, zniewoliła. 
25
					<fo:block/>
26
					Ale kiedy mię swym miłym mianujesz, 
27
					<fo:block/>
28
					Podobno dawnym zwyczajom folgujesz.
29
				</fo:block>
30
			</fo:block>
31
		</fo:flow>
32
	</fo:page-sequence>
33
</fo:root>
(-)test/odf/odt/fo_external_graphic/simple.fo (+27 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block text-align="justify">
15
				<fo:block font-size="15pt">
16
					Joad rolled the coat up more tightly. "An old turtle," he said. "Picked
17
					him up on the
18
					road. An old bulldozer. Thought I'd take 'im to my little brother. Kids
19
					like turtles."
20
				</fo:block>
21
				<fo:block>
22
					<fo:external-graphic src="./test/odf/odt/fo_external_graphic/img.jpg" />
23
				</fo:block>
24
			</fo:block>
25
		</fo:flow>
26
	</fo:page-sequence>
27
</fo:root>
(-)test/odf/odt/fo_table/simple.fo (+128 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block text-align="justify">
15
				<fo:block font-size="15pt">
16
					Joad rolled the coat up more tightly.
17
					"An old turtle," he said. "Picked
18
					him up on the
19
					road. An old
20
					bulldozer. Thought I'd take 'im to my little brother. Kids
21
					like
22
					turtles."
23
				</fo:block>
24
				<fo:block>
25
					<fo:table>
26
						<fo:table-body>
27
							<fo:table-row>
28
								<fo:table-cell border-style="solid" border-width=".1mm"
29
									padding="1mm">
30
									<fo:block>
31
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
32
											font-size="11pt" space-before="3pt" space-after="0cm">aa</fo:block>
33
									</fo:block>
34
								</fo:table-cell>
35
								<fo:table-cell border-style="solid" border-width=".1mm"
36
									padding="1mm">
37
									<fo:block>
38
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
39
											font-size="11pt" space-before="3pt" space-after="0cm">bb</fo:block>
40
									</fo:block>
41
								</fo:table-cell>
42
								<fo:table-cell border-style="solid" border-width=".1mm"
43
									padding="1mm">
44
									<fo:block>
45
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
46
											font-size="11pt" space-before="3pt" space-after="0cm">cc</fo:block>
47
									</fo:block>
48
								</fo:table-cell>
49
								<fo:table-cell border-style="solid" border-width=".1mm"
50
									padding="1mm">
51
									<fo:block>
52
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
53
											font-size="11pt" space-before="3pt" space-after="0cm">dd</fo:block>
54
									</fo:block>
55
								</fo:table-cell>
56
							</fo:table-row>
57
							<fo:table-row>
58
								<fo:table-cell border-style="solid" border-width=".1mm"
59
									padding="1mm">
60
									<fo:block>
61
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
62
											font-size="11pt" white-space-collapse="true" text-align="justify"
63
											space-before="3pt" space-after="0cm">ff</fo:block>
64
									</fo:block>
65
								</fo:table-cell>
66
								<fo:table-cell border-style="solid" border-width=".1mm"
67
									padding="1mm">
68
									<fo:block>
69
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
70
											font-size="11pt" space-before="3pt" space-after="0cm">gg</fo:block>
71
									</fo:block>
72
								</fo:table-cell>
73
								<fo:table-cell border-style="solid" border-width=".1mm"
74
									padding="1mm">
75
									<fo:block>
76
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
77
											font-size="11pt" space-before="3pt" space-after="0cm">hh</fo:block>
78
									</fo:block>
79
								</fo:table-cell>
80
								<fo:table-cell border-style="solid" border-width=".1mm"
81
									padding="1mm">
82
									<fo:block>
83
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
84
											font-size="11pt" space-before="3pt" space-after="0cm">ii</fo:block>
85
									</fo:block>
86
								</fo:table-cell>
87
							</fo:table-row>
88
							<fo:table-row>
89
								<fo:table-cell border-style="solid" border-width=".1mm"
90
									padding="1mm">
91
									<fo:block>
92
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
93
											font-size="11pt" space-before="3pt" space-after="0cm">jj</fo:block>
94
									</fo:block>
95
								</fo:table-cell>
96
								<fo:table-cell border-style="solid" border-width=".1mm"
97
									padding="1mm" number-rows-spanned="2">
98
									<fo:block>
99
										<fo:block font-family="Arial, Helvetica, Symbol, sans-serif"
100
											font-size="11pt" space-before="3pt" space-after="0cm">kk</fo:block>
101
									</fo:block>
102
								</fo:table-cell>
103
								<fo:table-cell border-style="solid" border-width=".1mm"
104
									padding="1mm" number-columns-spanned="2">
105
									<fo:block />
106
								</fo:table-cell>
107
							</fo:table-row>
108
							<fo:table-row>
109
								<fo:table-cell border-style="solid" border-width=".1mm"
110
									padding="1mm">
111
									<fo:block />
112
								</fo:table-cell>
113
								<fo:table-cell border-style="solid" border-width=".1mm"
114
									padding="1mm">
115
									<fo:block />
116
								</fo:table-cell>
117
								<fo:table-cell border-style="solid" border-width=".1mm"
118
									padding="1mm">
119
									<fo:block />
120
								</fo:table-cell>
121
							</fo:table-row>
122
						</fo:table-body>
123
					</fo:table>
124
				</fo:block>
125
			</fo:block>
126
		</fo:flow>
127
	</fo:page-sequence>
128
</fo:root>
(-)test/odf/odt/fo_list_block/simple.fo (+53 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="utf-8"?>
2
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
	<fo:layout-master-set>
4
		<fo:simple-page-master master-name="simple"
5
			page-height="29.7cm" page-width="21cm" margin-top="1cm"
6
			margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
7
			<fo:region-body margin-top="3cm" />
8
			<fo:region-before extent="3cm" />
9
			<fo:region-after extent="1.5cm" />
10
		</fo:simple-page-master>
11
	</fo:layout-master-set>
12
	<fo:page-sequence master-reference="simple">
13
		<fo:flow flow-name="xsl-region-body">
14
			<fo:block text-align="justify">
15
				<fo:block font-size="15pt">
16
					Joad rolled the coat up more tightly.
17
					"An old turtle," he said. "Picked
18
					him up on the
19
					road. An old
20
					bulldozer. Thought I'd take 'im to my little brother. Kids
21
					like
22
					turtles."
23
				</fo:block>
24
				<fo:list-block>
25
					<fo:list-item>
26
						<fo:list-item-label>
27
							<fo:block>•</fo:block>
28
						</fo:list-item-label>
29
						<fo:list-item-body>
30
							<fo:block>item1</fo:block>
31
						</fo:list-item-body>
32
					</fo:list-item>
33
					<fo:list-item>
34
						<fo:list-item-label>
35
							<fo:block>•</fo:block>
36
						</fo:list-item-label>
37
						<fo:list-item-body>
38
							<fo:block>item2</fo:block>
39
						</fo:list-item-body>
40
					</fo:list-item>
41
					<fo:list-item>
42
						<fo:list-item-label>
43
							<fo:block>•</fo:block>
44
						</fo:list-item-label>
45
						<fo:list-item-body>
46
							<fo:block>item3</fo:block>
47
						</fo:list-item-body>
48
					</fo:list-item>
49
				</fo:list-block>
50
			</fo:block>
51
		</fo:flow>
52
	</fo:page-sequence>
53
</fo:root>

Return to bug 53400