<commit_before>
package org.eclipse.birt.report.engine.emitter.excel.layout;

import java.util.logging.Logger;

import org.eclipse.birt.report.engine.content.IContent;
import org.eclipse.birt.report.engine.content.IForeignContent;
import org.eclipse.birt.report.engine.content.IListContent;
import org.eclipse.birt.report.engine.content.ITableContent;
import org.eclipse.birt.report.engine.emitter.EmitterUtil;
import org.eclipse.birt.report.engine.emitter.excel.ExcelUtil;
import org.eclipse.birt.report.engine.ir.DimensionType;
import org.eclipse.birt.report.engine.ir.ExtendedItemDesign;


public class LayoutUtil
{

	private static final Logger log = Logger.getLogger( LayoutUtil.class
			.getName( ) );

	public static ColumnsInfo createTable( int col, int width )
	{
		return new ColumnsInfo( col, width );
	}

	public static ColumnsInfo createTable( IListContent list, int width, int dpi )
	{
		width = getElementWidth( list, width, dpi );
		int[] column = new int[]{width};
		return new ColumnsInfo( column );
	}

	public static ColumnsInfo createChart( IForeignContent content, int width,
			int dpi )
	{
		ExtendedItemDesign design = (ExtendedItemDesign) content
				.getGenerateBy( );
		DimensionType value = design.getWidth( );
		if ( value != null )
		{
			width = getElementWidth( value, width, dpi );
		}
		int[] column = new int[]{width};
		return new ColumnsInfo( column );
	}

	public static ColumnsInfo createImage( int width )
	{
		int[] column = new int[]{width};
		return new ColumnsInfo( column );
	}

	public static int getImageWidth( DimensionType value, int parentWidth,
			int imageInfoWidth, int dpi )
	{
		int width;
		if ( value != null )
		{
			width = getElementWidth( value, parentWidth, dpi );
		}
		else
		{
			width = (int) ( imageInfoWidth * ExcelUtil.INCH_PT / dpi );
		}
		return width;<commit_msg>Fix bugzilla bug 314081: [Automation][Regression]Image height is different from golden file when preview as xls .<commit_after>
package org.eclipse.birt.report.engine.emitter.excel.layout;

import java.util.logging.Logger;

import org.eclipse.birt.report.engine.content.IContent;
import org.eclipse.birt.report.engine.content.IForeignContent;
import org.eclipse.birt.report.engine.content.IListContent;
import org.eclipse.birt.report.engine.content.ITableContent;
import org.eclipse.birt.report.engine.emitter.EmitterUtil;
import org.eclipse.birt.report.engine.emitter.excel.ExcelUtil;
import org.eclipse.birt.report.engine.ir.DimensionType;
import org.eclipse.birt.report.engine.ir.ExtendedItemDesign;


public class LayoutUtil
{

	private static final Logger log = Logger.getLogger( LayoutUtil.class
			.getName( ) );

	public static ColumnsInfo createTable( int col, int width )
	{
		return new ColumnsInfo( col, width );
	}

	public static ColumnsInfo createTable( IListContent list, int width, int dpi )
	{
		width = getElementWidth( list, width, dpi );
		int[] column = new int[]{width};
		return new ColumnsInfo( column );
	}

	public static ColumnsInfo createChart( IForeignContent content, int width,
			int dpi )
	{
		ExtendedItemDesign design = (ExtendedItemDesign) content
				.getGenerateBy( );
		DimensionType value = design.getWidth( );
		if ( value != null )
		{
			width = getElementWidth( value, width, dpi );
		}
		int[] column = new int[]{width};
		return new ColumnsInfo( column );
	}

	public static ColumnsInfo createImage( int width )
	{
		int[] column = new int[]{width};
		return new ColumnsInfo( column );
	}

	public static int getImageWidth( DimensionType value, int parentWidth,
			int imageInfoWidth, int dpi )
	{
		if ( value == null )
		{
			return imageInfoWidth;
		}
		else
		{
			return getElementWidth( value, parentWidth, dpi );
		}
{'fraction_non_alphanumeric': 0.10709468572970057, 'fraction_numerical': 0.0016185594820609657, 'mean_word_length': 4.282051282051282, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3529914', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1166, 'n_words': 299}