private TableTableRowElement createDefaultRow(int columnCount, boolean createRepeatedCell) {
OdfFileDom dom = (OdfFileDom) mTableElement.getOwnerDocument();
TableTableRowElement aRow = (TableTableRowElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
OdfDocumentNamespace.TABLE, "table-row"));
if (createRepeatedCell) {
TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
OdfDocumentNamespace.TABLE, "table-cell"));
if (columnCount > 1) {
aCell.setTableNumberColumnsRepeatedAttribute(columnCount);
}
if (!mIsSpreadsheet) {
OdfOfficeAutomaticStyles automaticStyles = mTableElement.getAutomaticStyles();
OdfStyle borderStyle = automaticStyles.newStyle(OdfStyleFamily.TableCell);
setRightTopBorderStyleProperties(borderStyle);
aCell.setStyleName(borderStyle.getStyleNameAttribute());
}
} else {
OdfStyle lefttopStyle = null, righttopStyle = null;
// create 2 kinds of styles
if (!mIsSpreadsheet) {
OdfOfficeAutomaticStyles automaticStyles = mTableElement.getAutomaticStyles();
lefttopStyle = automaticStyles.newStyle(OdfStyleFamily.TableCell);
setLeftTopBorderStyleProperties(lefttopStyle);
righttopStyle = automaticStyles.newStyle(OdfStyleFamily.TableCell);
setRightTopBorderStyleProperties(righttopStyle);
}
for (int j = 0; j < columnCount; j++) {
TableTableCellElement aCell = (TableTableCellElement) OdfXMLFactory.newOdfElement(dom, OdfName.newName(
OdfDocumentNamespace.TABLE, "table-cell"));
if (!mIsSpreadsheet) {
if (j + 1 == columnCount) {
aCell.setStyleName(righttopStyle.getStyleNameAttribute());
} else {
aCell.setStyleName(lefttopStyle.getStyleNameAttribute());
}
}
aRow.appendChild(aCell);
}
}