01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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;
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 {
47: // bulleted list
48: item.writeControlWord("pnlvlblt");
49: item.writeControlWord("ilvl0");
50: item.writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer(
51: item.getNumber()));
52: item.writeOneAttribute("pnindent", item.getParentList().attrib
53: .getValue(RtfListTable.LIST_INDENT));
54: item.writeControlWord("pnf1");
55: item.writeGroupMark(true);
56: item.writeControlWord("pndec");
57: item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2");
58: item.writeControlWord("pntxtb");
59: item.writeControlWord("'b7");
60: item.writeGroupMark(false);
61: }
62:
63: /**
64: * Gets called before a paragraph, which is contained by a RtfListItem has to be written.
65: * @param element RtfElement in whose context is to be written
66: * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix(RtfElement)
67: * @throws IOException Thrown when an IO-problem occurs
68: */
69: public void writeParagraphPrefix(RtfElement element)
70: throws IOException {
71: element.writeGroupMark(true);
72: element.writeControlWord("pntext");
73: element.writeGroupMark(false);
74: }
75:
76: /**
77: * Gets called when the list table has to be written.
78: *
79: * @param element RtfElement in whose context is to be written
80: * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeLevelGroup(RtfElement)
81: * @throws IOException Thrown when an IO-problem occurs
82: */
83: public void writeLevelGroup(RtfElement element) throws IOException {
84: element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 23);
85: element.writeGroupMark(true);
86: element.writeOneAttributeNS(RtfListTable.LIST_TEXT_FORM,
87: "\\'01\\'b7");
88: element.writeGroupMark(false);
89:
90: element.writeGroupMark(true);
91: element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION,
92: null);
93: element.writeGroupMark(false);
94:
95: element.attrib.set(RtfListTable.LIST_FONT_TYPE, 2);
96: }
97:
98: }
|