KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > rtf > ListAttributesConverter


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: ListAttributesConverter.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.render.rtf;
21
22 //FOP
23
import org.apache.fop.apps.FOPException;
24 import org.apache.fop.fo.flow.ListBlock;
25 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
26 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListTable;
27 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText;
28
29  /**
30   * @autor bdelacretaz, bdelacretaz@codeconsult.ch
31   * @autor Christopher Scott, scottc@westinghouse.com
32   * Portions created by Christopher Scott are Coypright (C) 2001
33   * Westinghouse Electric Company. All Rights Reserved.
34   * @autor Peter Herweg, pherweg@web.de
35   */

36
37 /**
38  * Provides methods to convert list attributes to RtfAttributes.
39  */

40 public final class ListAttributesConverter {
41     
42     /**
43      * Constructor is private, because it's just a utility class.
44      */

45     private ListAttributesConverter() {
46     }
47     
48     /**
49      * Reads an FO object's properties and adds returns them as RtfAttributes.
50      * @param fobj FO object
51      * @return RtfAttributes object which contains the read values.
52      * @throws FOPException Thrown when an IO-problem occurs.
53      */

54     static RtfAttributes convertAttributes(ListBlock fobj)
55     throws FOPException {
56         
57         FOPRtfAttributes attrib = new FOPRtfAttributes();
58         
59         attrib.setTwips(RtfListTable.LIST_INDENT, fobj.getCommonMarginBlock().startIndent);
60         attrib.setTwips(RtfText.LEFT_INDENT_BODY, fobj.getCommonMarginBlock().endIndent);
61         
62         /*
63          * set list table defaults
64          */

65
66         //set a simple list type
67
attrib.set(RtfListTable.LIST, "simple");
68         //set following char as tab
69
attrib.set(RtfListTable.LIST_FOLLOWING_CHAR, 0);
70         
71         return attrib;
72     }
73 }
Popular Tags