package org.openoffice.odf.doc.element.table;

import java.util.List;
import java.util.ArrayList;
import org.openoffice.odf.doc.OdfFileDom;

public class OdfTableExtra extends OdfTable
{
	/**
	 * Construct an OdfTableExtra from owner document.
	 * @param _aOwnerDoc the owner document DOM
	 */
	public OdfTableExtra( OdfFileDom _aOwnerDoc)
	{
		super(_aOwnerDoc);
	}
	
	/**
	 * Add a column with the given style name
	 * @param styleName the style name for this column
	 */
	public OdfTableColumn addTableColumn(String styleName)
	{
		OdfTableColumn result = super.addTableColumn();
		result.setStyleName(styleName);
		return result;
	}
	
	/**
	 * Create a list of OdfTableColumn elements, each with a style name
	 * from a list of String. The return value can be passed to
	 * OdfTable.setColumnList()
	 * @param styleList a <code>List&lt;String&gt;</code> containing the style
	 * names for each column
	 * @return a list of <code>OdfTableColumn</code> elements
	 */
	public List<OdfTableColumn> createColumnStyleList(List<String> styleList)
	{
		ArrayList<OdfTableColumn> list = new ArrayList<OdfTableColumn>();
		OdfTableColumn col;
		OdfFileDom owner = (OdfFileDom) (this.getOwnerDocument());
		for (String styleName : styleList)
		{
			col = new OdfTableColumn(owner);
			col.setStyleName(styleName);
			list.add(col);
		}
		return list;
	}
			
}
