/* PageSizeConversionUtil.java

	Purpose:
		
	Description:
		
	History:
		August 23, 5:53:16 PM     2010, Created by Ashish Dasnurkar

Copyright (C) 2010 Potix Corporation. All Rights Reserved.
 */
package org.zkoss.zss.model.impl.pdf;

import org.zkoss.poi.ss.usermodel.PrintSetup;

import com.lowagie.text.PageSize;
import com.lowagie.text.Rectangle;

/**
 * Internal Use only. Utility methods for converting POI(excel) page sizes to Pdf page sizes. 
 * @author ashish
 *
 */
/*package*/ class PageSizeConversionUtil {

	/**
	 * returns Pdf page size corresponding to given POI (excel) page size
	 * @param pageSize
	 * @return
	 */
	public static Rectangle getPageSize(short pageSize) {
		Rectangle pdfPageSize = null;
		switch(pageSize) {
			case PrintSetup.A4_PAPERSIZE:
				pdfPageSize = PageSize.A4;
				break;
			case PrintSetup.A3_PAPERSIZE:
				pdfPageSize = PageSize.A3;
				break;
			case PrintSetup.A5_PAPERSIZE:
				pdfPageSize = PageSize.A5;
				break;
			case PrintSetup.B4_PAPERSIZE:
				pdfPageSize = PageSize.B4;
				break;
			case PrintSetup.B5_PAPERSIZE:
				pdfPageSize = PageSize.B5;
				break;
			case PrintSetup.ELEVEN_BY_SEVENTEEN_PAPERSIZE:
				pdfPageSize = PageSize._11X17;
				break;
			case PrintSetup.LETTER_PAPERSIZE:
				pdfPageSize = PageSize.LETTER;
				break;
			case PrintSetup.LETTER_SMALL_PAGESIZE:
				pdfPageSize = PageSize.HALFLETTER;
				break;
			case PrintSetup.LEDGER_PAPERSIZE:
				pdfPageSize = PageSize.LEDGER;
				break;
			case PrintSetup.LEGAL_PAPERSIZE:
				pdfPageSize = PageSize.LEGAL;
				break;
			case PrintSetup.QUARTO_PAPERSIZE:
				pdfPageSize = PageSize.DEMY_QUARTO;
				break;
			case PrintSetup.EXECUTIVE_PAPERSIZE:
				pdfPageSize = PageSize.EXECUTIVE;
				break;
			case PrintSetup.TABLOID_PAPERSIZE:
				pdfPageSize = PageSize.TABLOID;
				break;
			default:
				pdfPageSize = PageSize.A4;
				break;
		}
		return pdfPageSize;
	}
}
