001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /* $Id: RtfListStyleNumber.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020: package org.apache.fop.render.rtf.rtflib.rtfdoc;
021:
022: /*
023: * This file is part of the RTF library of the FOP project, which was originally
024: * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
025: * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
026: * the FOP project.
027: */
028:
029: //Java
030: import java.io.IOException;
031:
032: //FOP
033: import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement;
034:
035: /**
036: * Class to handle number list style.
037: */
038: public class RtfListStyleNumber extends RtfListStyle {
039:
040: /**
041: * Gets called before a RtfListItem has to be written.
042: * @param item RtfListItem whose prefix has to be written
043: * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeListPrefix(RtfListItem)
044: * @throws IOException Thrown when an IO-problem occurs
045: */
046: public void writeListPrefix(RtfListItem item) throws IOException {
047: item.writeControlWord("pnlvlbody");
048: item.writeControlWord("ilvl0");
049: item.writeOneAttribute(RtfListTable.LIST_NUMBER, "0");
050: item.writeControlWord("pndec");
051: item.writeOneAttribute("pnstart", new Integer(1));
052: item.writeOneAttribute("pnindent", item.attrib
053: .getValue(RtfListTable.LIST_INDENT));
054: item.writeControlWord("pntxta.");
055: }
056:
057: /**
058: * Gets called before a paragraph, which is contained by a RtfListItem has to be written.
059: *
060: * @param element RtfElement in whose context is to be written
061: * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeParagraphPrefix(RtfElement)
062: * @throws IOException Thrown when an IO-problem occurs
063: */
064: public void writeParagraphPrefix(RtfElement element)
065: throws IOException {
066: element.writeGroupMark(true);
067: element.writeControlWord("pntext");
068: element.writeControlWord("f"
069: + RtfFontManager.getInstance().getFontNumber("Symbol"));
070: element.writeControlWord("'b7");
071: element.writeControlWord("tab");
072: element.writeGroupMark(false);
073: }
074:
075: /**
076: * Gets called when the list table has to be written.
077: *
078: * @param element RtfElement in whose context is to be written
079: * @see org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListStyle#writeLevelGroup(RtfElement)
080: * @throws IOException Thrown when an IO-problem occurs
081: */
082: public void writeLevelGroup(RtfElement element) throws IOException {
083: element.writeOneAttributeNS(RtfListTable.LIST_START_AT,
084: new Integer(1));
085: element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 0);
086:
087: element.writeGroupMark(true);
088: element.writeOneAttributeNS(RtfListTable.LIST_TEXT_FORM,
089: "\\'03\\\'00. ;");
090: element.writeGroupMark(false);
091:
092: element.writeGroupMark(true);
093: element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION,
094: "\\'01;");
095: element.writeGroupMark(false);
096:
097: element.writeOneAttribute(RtfListTable.LIST_FONT_TYPE,
098: new Integer(0));
099: }
100: }
|