KickJava   Java API By Example, From Geeks To Geeks.

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


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: RtfListStyleBullet.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 bullet list style.
37  */

38 public class RtfListStyleBullet 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) throws IOException JavaDoc {
47         // bulleted list
48
item.writeControlWord("pnlvlblt");
49         item.writeControlWord("ilvl0");
50         item.writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer JavaDoc(item.getNumber()));
51         item.writeOneAttribute("pnindent",
52                 item.getParentList().attrib.getValue(RtfListTable.LIST_INDENT));
53         item.writeControlWord("pnf1");
54         item.writeGroupMark(true);
55         item.writeControlWord("pndec");
56         item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
57         item.writeControlWord("pntxtb");
58         item.writeControlWord("'b7");
59         item.writeGroupMark(false);
60     }
61
62     /**
63      * Gets called before a paragraph, which is contained by a RtfListItem has to be written.
64      * @param element RtfElement in whose context is to be written
65      * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix(RtfElement)
66      * @throws IOException Thrown when an IO-problem occurs
67      */

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

81     public void writeLevelGroup(RtfElement element) throws IOException JavaDoc {
82         element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 23);
83         element.writeGroupMark(true);
84         element.writeOneAttributeNS(RtfListTable.LIST_TEXT_FORM, "\\'01\\'b7");
85         element.writeGroupMark(false);
86             
87         element.writeGroupMark(true);
88         element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION, null);
89         element.writeGroupMark(false);
90             
91         element.attrib.set(RtfListTable.LIST_FONT_TYPE, 2);
92     }
93        
94 }
95
Popular Tags