public void writeRowAndCellsDefintions()

in fop-core/src/main/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java [161:281]


    public void writeRowAndCellsDefintions() throws IOException {
        // render the row and cells definitions
        writeControlWord("trowd");

        if (!getTable().isNestedTable()) {
            writeControlWord("itap0");
        }

        //check for keep-together
        if (attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
            writeControlWord(ROW_KEEP_TOGETHER);
        }

        writePaddingAttributes();

        final RtfTable parentTable = (RtfTable) parent;
        adjustBorderProperties(parentTable);

        writeAttributes(attrib, new String[]{ITableAttributes.ATTR_HEADER});
        writeAttributes(attrib, ITableAttributes.ROW_BORDER);
        writeAttributes(attrib, ITableAttributes.CELL_BORDER);
        writeAttributes(attrib, IBorderAttributes.BORDERS);

        if (attrib.isSet(ITableAttributes.ROW_HEIGHT)) {
            writeOneAttribute(
                    ITableAttributes.ROW_HEIGHT,
                    attrib.getValue(ITableAttributes.ROW_HEIGHT));
        }

        // write X positions of our cells
        int xPos = 0;

        final Object leftIndent = attrib.getValue(ITableAttributes.ATTR_ROW_LEFT_INDENT);
        if (leftIndent != null) {
            xPos = (Integer) leftIndent;
        }

        RtfAttributes tableBorderAttributes = getTable().getBorderAttributes();

        int index = 0;
        for (Object o : getChildren()) {
            final RtfElement e = (RtfElement) o;
            if (e instanceof RtfTableCell) {

                RtfTableCell rtfcell = (RtfTableCell) e;

                // Adjust the cell's display attributes so the table's/row's borders
                // are drawn properly.

                if (tableBorderAttributes != null) {
                    // get border attributes from table
                    if (index == 0) {
                        String border = ITableAttributes.CELL_BORDER_LEFT;
                        if (!rtfcell.getRtfAttributes().isSet(border)) {
                            rtfcell.getRtfAttributes().set(border,
                                    (RtfAttributes) tableBorderAttributes.getValue(border));
                        }
                    }

                    if (index == this.getChildCount() - 1) {
                        String border = ITableAttributes.CELL_BORDER_RIGHT;
                        if (!rtfcell.getRtfAttributes().isSet(border)) {
                            rtfcell.getRtfAttributes().set(border,
                                    (RtfAttributes) tableBorderAttributes.getValue(border));
                        }
                    }

                    if (isFirstRow()) {
                        String border = ITableAttributes.CELL_BORDER_TOP;
                        if (!rtfcell.getRtfAttributes().isSet(border)) {
                            rtfcell.getRtfAttributes().set(border,
                                    (RtfAttributes) tableBorderAttributes.getValue(border));
                        }
                    }

                    if ((parentTable != null) && (parentTable.isHighestRow(id))) {
                        String border = ITableAttributes.CELL_BORDER_BOTTOM;
                        if (!rtfcell.getRtfAttributes().isSet(border)) {
                            rtfcell.getRtfAttributes().set(border,
                                    (RtfAttributes) tableBorderAttributes.getValue(border));
                        }
                    }
                }

                // get border attributes from row
                if (index == 0) {
                    if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_LEFT)) {
                        rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_LEFT,
                                (String) attrib.getValue(ITableAttributes.ROW_BORDER_LEFT));
                    }
                }

                if (index == this.getChildCount() - 1) {
                    if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_RIGHT)) {
                        rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_RIGHT,
                                (String) attrib.getValue(ITableAttributes.ROW_BORDER_RIGHT));
                    }
                }

                if (isFirstRow()) {
                    if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_TOP)) {
                        rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_TOP,
                                (String) attrib.getValue(ITableAttributes.ROW_BORDER_TOP));
                    }
                }

                if ((parentTable != null) && (parentTable.isHighestRow(id))) {
                    if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_BOTTOM)) {
                        rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_BOTTOM,
                                (String) attrib.getValue(ITableAttributes.ROW_BORDER_BOTTOM));
                    }
                }

                // write cell's definition
                xPos = rtfcell.writeCellDef(xPos);
            }
            index++; // Added by Boris POUDEROUS on 2002/07/02
        }

        newLine();
    }