View | Details | Raw Unified | Return to bug 42374
Collapse All | Expand All

(-)src/java/org/apache/fop/render/rtf/RTFHandler.java (-1 / +10 lines)
Lines 116-121 Link Here
116
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfHyperLink;
116
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfHyperLink;
117
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
117
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
118
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
118
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
119
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListTable;
119
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfPage;
120
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfPage;
120
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
121
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
121
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
122
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
Lines 933-940 Link Here
933
                list = (RtfList)builderContext.getContainer(
934
                list = (RtfList)builderContext.getContainer(
934
                        RtfList.class, true, this);
935
                        RtfList.class, true, this);
935
            }
936
            }
937
            
938
            Block block = (Block)li.getBody().getChildNodes().firstNode();
939
            FOPRtfAttributes attr = new FOPRtfAttributes();
936
940
937
            builderContext.pushContainer(list.newListItem());
941
            if(block!=null)
942
            {
943
              attr.setTwips(RtfListTable.LIST_INDENT, block.getCommonMarginBlock().startIndent.getValue());
944
            }
945
            
946
            builderContext.pushContainer(list.newListItem(attr));
938
        } catch (IOException ioe) {
947
        } catch (IOException ioe) {
939
            handleIOTrouble(ioe);
948
            handleIOTrouble(ioe);
940
        } catch (Exception e) {
949
        } catch (Exception e) {
(-)src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfListItem.java (-4 / +36 lines)
Lines 162-168 Link Here
162
        RtfList list = new RtfList(this, writer, attrs);
162
        RtfList list = new RtfList(this, writer, attrs);
163
        return list;
163
        return list;
164
    }
164
    }
165
    
166
    /**
167
     * The method is calling itself recusively and sums up the indents of the different levels
168
     * of this listitem, when this step has finished the control words are written
169
     * @param attrs attributes of new RftList object
170
     * @return new RtfList
171
     * @throws IOException for I/O problems
172
     */
173
    private void writeIndentSum(RtfListItem item, int sum) throws IOException
174
    {
175
      RtfElement tmp = item.getParentOfClass(RtfListItem.class);
165
176
177
      if(tmp != null)
178
      {
179
        int listindent = Integer.parseInt(tmp.attrib.getValue(RtfListTable.LIST_INDENT).toString());
180
        sum += listindent;
181
        writeIndentSum((RtfListItem) tmp, sum);
182
      }
183
      else
184
      {
185
        int listindent = Integer.parseInt(item.attrib.getValue(RtfListTable.LIST_INDENT).toString());
186
        
187
        //The first row indent value, its the distance from the left edge of the text
188
        //to the bullet (negative value)
189
        //TODO use provisional-label-separation here
190
        writeOneAttribute(RtfText.LEFT_INDENT_FIRST, new Integer(listindent));
191
          
192
        //The sum is set as left indent and also a tabulator
193
        //because if there is long text and a new line begins,
194
        //it also has to be aligned correctly
195
        writeOneAttribute(RtfText.LEFT_INDENT_BODY, new Integer(sum));
196
        writeOneAttribute(RtfText.TABULATOR, new Integer(sum));
197
      }
198
    }
199
166
    /**
200
    /**
167
     * Overridden to setup the list: start a group with appropriate attributes
201
     * Overridden to setup the list: start a group with appropriate attributes
168
     * @throws IOException for I/O problems
202
     * @throws IOException for I/O problems
Lines 174-184 Link Here
174
            writeControlWord("pard");
208
            writeControlWord("pard");
175
        }
209
        }
176
210
177
        writeOneAttribute(RtfText.LEFT_INDENT_FIRST,
211
        int firstInd = Integer.parseInt(attrib.getValue(RtfListTable.LIST_INDENT).toString());
178
                "360"); //attrib.getValue(RtfListTable.LIST_INDENT));
179
212
180
        writeOneAttribute(RtfText.LEFT_INDENT_BODY,
213
        writeIndentSum(this, firstInd);
181
                attrib.getValue(RtfText.LEFT_INDENT_BODY));
182
214
183
        // group for list setup info
215
        // group for list setup info
184
        writeGroupMark(true);
216
        writeGroupMark(true);
(-)src/java/org/apache/fop/render/rtf/TextAttributesConverter.java (-4 / +8 lines)
Lines 34-39 Link Here
34
import org.apache.fop.fo.flow.BlockContainer;
34
import org.apache.fop.fo.flow.BlockContainer;
35
import org.apache.fop.fo.flow.Inline;
35
import org.apache.fop.fo.flow.Inline;
36
import org.apache.fop.fo.flow.Leader;
36
import org.apache.fop.fo.flow.Leader;
37
import org.apache.fop.fo.flow.ListItemBody;
37
import org.apache.fop.fo.flow.PageNumber;
38
import org.apache.fop.fo.flow.PageNumber;
38
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
39
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
39
import org.apache.fop.fo.properties.CommonFont;
40
import org.apache.fop.fo.properties.CommonFont;
Lines 77-83 Link Here
77
        attrFontColor(fobj.getColor(), attrib);
78
        attrFontColor(fobj.getColor(), attrib);
78
        //attrTextDecoration(fobj.getTextDecoration(), attrib);
79
        //attrTextDecoration(fobj.getTextDecoration(), attrib);
79
        attrBlockBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
80
        attrBlockBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
80
        attrBlockMargin(fobj.getCommonMarginBlock(), attrib);
81
        attrBlockMargin(fobj.getCommonMarginBlock(), attrib, fobj.getParent() instanceof ListItemBody);
81
        attrBlockTextAlign(fobj.getTextAlign(), attrib);
82
        attrBlockTextAlign(fobj.getTextAlign(), attrib);
82
        attrBorder(fobj.getCommonBorderPaddingBackground(), attrib, fobj);
83
        attrBorder(fobj.getCommonBorderPaddingBackground(), attrib, fobj);
83
84
Lines 92-98 Link Here
92
                throws FOPException {
93
                throws FOPException {
93
        FOPRtfAttributes attrib = new FOPRtfAttributes();
94
        FOPRtfAttributes attrib = new FOPRtfAttributes();
94
        attrBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
95
        attrBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
95
        attrBlockMargin(fobj.getCommonMarginBlock(), attrib);
96
        attrBlockMargin(fobj.getCommonMarginBlock(), attrib, false);
96
        //attrBlockDimension(fobj, attrib);
97
        //attrBlockDimension(fobj, attrib);
97
        attrBorder(fobj.getCommonBorderPaddingBackground(), attrib, fobj);
98
        attrBorder(fobj.getCommonBorderPaddingBackground(), attrib, fobj);
98
99
Lines 329-340 Link Here
329
        }
330
        }
330
    }
331
    }
331
332
332
    private static void attrBlockMargin(CommonMarginBlock cmb, FOPRtfAttributes rtfAttr) {
333
    private static void attrBlockMargin(CommonMarginBlock cmb, FOPRtfAttributes rtfAttr, boolean suppressIndent) {
333
        rtfAttr.setTwips(RtfText.SPACE_BEFORE,
334
        rtfAttr.setTwips(RtfText.SPACE_BEFORE,
334
                cmb.spaceBefore.getOptimum(null).getLength());
335
                cmb.spaceBefore.getOptimum(null).getLength());
335
        rtfAttr.setTwips(RtfText.SPACE_AFTER,
336
        rtfAttr.setTwips(RtfText.SPACE_AFTER,
336
                cmb.spaceAfter.getOptimum(null).getLength());
337
                cmb.spaceAfter.getOptimum(null).getLength());
337
        rtfAttr.setTwips(RtfText.LEFT_INDENT_BODY, cmb.startIndent);
338
        //For ListItemBody Elements the indent has to be ignored to align it correctly
339
        if(!suppressIndent){
340
          rtfAttr.setTwips(RtfText.LEFT_INDENT_BODY, cmb.startIndent);
341
        }
338
        rtfAttr.setTwips(RtfText.RIGHT_INDENT_BODY, cmb.endIndent);
342
        rtfAttr.setTwips(RtfText.RIGHT_INDENT_BODY, cmb.endIndent);
339
    }
343
    }
340
344
(-)src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfText.java (+2 lines)
Lines 95-100 Link Here
95
    public static final String ALIGN_JUSTIFIED = "qj";
95
    public static final String ALIGN_JUSTIFIED = "qj";
96
    /** constant for align distributed */
96
    /** constant for align distributed */
97
    public static final String ALIGN_DISTRIBUTED = "qd";
97
    public static final String ALIGN_DISTRIBUTED = "qd";
98
    /** constant for a tabulator */
99
    public static final String TABULATOR ="tx";
98
100
99
    /** RtfText attributes: border attributes */
101
    /** RtfText attributes: border attributes */
100
    //added by Chris Scott
102
    //added by Chris Scott
(-)src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java (+13 lines)
Lines 69-74 Link Here
69
     * @return new RtfListItem
69
     * @return new RtfListItem
70
     * @throws IOException for I/O problems
70
     * @throws IOException for I/O problems
71
     */
71
     */
72
    public RtfListItem newListItem(RtfAttributes attr) throws IOException {
73
        if (item != null) {
74
            item.close();
75
        }
76
        item = new RtfListItem(this, writer, attr);
77
        return item;
78
    }
79
    
80
    /**
81
     * Close current list item and start a new one
82
     * @return new RtfListItem
83
     * @throws IOException for I/O problems
84
     */
72
    public RtfListItem newListItem() throws IOException {
85
    public RtfListItem newListItem() throws IOException {
73
        if (item != null) {
86
        if (item != null) {
74
            item.close();
87
            item.close();

Return to bug 42374