KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > rtf > rtflib > rtfdoc > RtfFootnote


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 /* $Id: RtfFootnote.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20
21 package org.apache.fop.render.rtf.rtflib.rtfdoc;
22
23 //Java
24
import java.io.Writer JavaDoc;
25 import java.io.IOException JavaDoc;
26
27 //FOP
28
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTextrun;
29
30 /** Model of an RTF footnote
31  * @author Peter Herweg, pherweg@web.de
32  * @author Marc Wilhelm Kuester
33  */

34 public class RtfFootnote extends RtfContainer
35         implements IRtfTextrunContainer, IRtfListContainer {
36     RtfTextrun textrunInline = null;
37     RtfContainer body = null;
38     RtfList list = null;
39     boolean bBody = false;
40
41     /** Create an RTF list item as a child of given container with default attributes */
42     RtfFootnote(RtfContainer parent, Writer JavaDoc w) throws IOException JavaDoc {
43         super(parent, w);
44         textrunInline = new RtfTextrun(this, writer, null);
45         body = new RtfContainer(this, writer);
46     }
47
48     public RtfTextrun getTextrun() throws IOException JavaDoc {
49         if (bBody) {
50             RtfTextrun textrun = RtfTextrun.getTextrun(body, writer, null);
51             textrun.setSuppressLastPar(true);
52             
53             return textrun;
54         } else {
55             return textrunInline;
56         }
57     }
58
59     /**
60     * write RTF code of all our children
61     * @throws IOException for I/O problems
62     */

63     protected void writeRtfContent() throws IOException JavaDoc {
64         textrunInline.writeRtfContent();
65         
66         writeGroupMark(true);
67         writeControlWord("footnote");
68         writeControlWord("ftnalt");
69         
70         body.writeRtfContent();
71         
72         writeGroupMark(false);
73     }
74     
75     public RtfList newList(RtfAttributes attrs) throws IOException JavaDoc {
76         if (list != null) {
77             list.close();
78         }
79
80         list = new RtfList(body, writer, attrs);
81
82         return list;
83     }
84     
85     public void startBody() {
86         bBody = true;
87     }
88     
89     public void endBody() {
90         bBody = false;
91     }
92 }
93
Popular Tags