KickJava   Java API By Example, From Geeks To Geeks.

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


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: RtfListStyleNumber.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.render.rtf.rtflib.rtfdoc;
21
22 /*
23  * This file is part of the RTF library of the FOP project, which was originally
24  * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
25  * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
26  * the FOP project.
27  */

28
29 //Java
30
import java.io.IOException JavaDoc;
31
32 //FOP
33
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
34
35 /**
36  * Class to handle number list style.
37  */

38 public class RtfListStyleNumber extends RtfListStyle {
39     
40     /**
41      * Gets called before a RtfListItem has to be written.
42      * @param item RtfListItem whose prefix has to be written
43      * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeListPrefix(RtfListItem)
44      * @throws IOException Thrown when an IO-problem occurs
45      */

46     public void writeListPrefix(RtfListItem item)
47     throws IOException JavaDoc {
48         item.writeControlWord("pnlvlbody");
49         item.writeControlWord("ilvl0");
50         item.writeOneAttribute(RtfListTable.LIST_NUMBER, "0");
51         item.writeControlWord("pndec");
52         item.writeOneAttribute("pnstart", new Integer JavaDoc(1));
53         item.writeOneAttribute("pnindent",
54                 item.attrib.getValue(RtfListTable.LIST_INDENT));
55         item.writeControlWord("pntxta.");
56     }
57     
58     /**
59      * Gets called before a paragraph, which is contained by a RtfListItem has to be written.
60      *
61      * @param element RtfElement in whose context is to be written
62      * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix(RtfElement)
63      * @throws IOException Thrown when an IO-problem occurs
64      */

65     public void writeParagraphPrefix(RtfElement element)
66     throws IOException JavaDoc {
67         element.writeGroupMark(true);
68         element.writeControlWord("pntext");
69         element.writeControlWord("f" + RtfFontManager.getInstance().getFontNumber("Symbol"));
70         element.writeControlWord("'b7");
71         element.writeControlWord("tab");
72         element.writeGroupMark(false);
73     }
74     
75     /**
76      * Gets called when the list table has to be written.
77      *
78      * @param element RtfElement in whose context is to be written
79      * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeLevelGroup(RtfElement)
80      * @throws IOException Thrown when an IO-problem occurs
81      */

82     public void writeLevelGroup(RtfElement element)
83     throws IOException JavaDoc {
84         element.writeOneAttributeNS(
85                 RtfListTable.LIST_START_AT, new Integer JavaDoc(1));
86         element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 0);
87         
88         element.writeGroupMark(true);
89         element.writeOneAttributeNS(
90                 RtfListTable.LIST_TEXT_FORM, "\\'03\\\'00. ;");
91         element.writeGroupMark(false);
92             
93         element.writeGroupMark(true);
94         element.writeOneAttributeNS(
95                 RtfListTable.LIST_NUM_POSITION, "\\'01;");
96         element.writeGroupMark(false);
97             
98         element.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, new Integer JavaDoc(0));
99     }
100 }
101
Popular Tags