<commit_before>/*******************************************************************************
 * Copyright (c) 2004, 2008Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.emitter.excel;

import org.eclipse.birt.report.engine.content.IImageContent;
import org.eclipse.birt.report.engine.emitter.excel.layout.XlsContainer;
import org.eclipse.birt.report.engine.layout.emitter.Image;
public class ImageData extends SheetData
{

	private String altText, imageUrl;
	private byte[] imageData;
	private Image imageInfo;
	private int width;

	public ImageData( IImageContent image, int styleId, int datatype,
			Image imageInfo, XlsContainer currentContainer, int heightDpi,
			int widthDpi )
	{
		super( );
		this.dataType = datatype;
		this.styleId = styleId;
		height = ExcelUtil.convertDimensionType( image.getHeight( ), imageInfo
				.getHeight( )
				* ExcelUtil.INCH_PT / heightDpi, heightDpi ) / 1000;
		int imageWidth = (int) ExcelUtil.convertDimensionType(
				image.getWidth( ), imageInfo.getWidth( ) * ExcelUtil.INCH_PT
						/ widthDpi, widthDpi );
		width = Math.min( currentContainer.getSizeInfo( ).getWidth( ),
				imageWidth );
		altText = image.getAltText( );
		imageUrl = image.getURI( );
		this.imageData = imageInfo.getData( );
		rowSpanInDesign = 0;
		this.imageInfo = imageInfo;
	}

	public String getDescription( )
	{
		return altText;
	}

	public void setDescription( String description )
	{
		this.altText = description;
	}

	public String getImageUrl( )
	{
		return imageUrl;
	}

	public void setUrl( String url )
	{
		this.imageUrl = url;
	}

	public byte[] getImageData( )
	{
		return imageData;
	}

	public void setImageData( byte[] imageData )
	{
		this.imageData = imageData;
	}

	public Image getImageInfo( )
	{
		return imageInfo;
	}

	public int getWidth( )
	{
		return width;
	}

	public void setWidth( int width )
	{
		this.width = width;
	}

	@Override
	public int getEndX( )
	{
		return getStartX( ) + width;
	}

}<commit_msg>Fix ted issue 20196: Proj 1124: chart's size didn't preserve when exported to Excel as an image in a report contains the grid with xtab.<commit_after>/*******************************************************************************
 * Copyright (c) 2004, 2008Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.emitter.excel;

import org.eclipse.birt.report.engine.content.IImageContent;
import org.eclipse.birt.report.engine.emitter.excel.layout.XlsContainer;
import org.eclipse.birt.report.engine.layout.emitter.Image;
public class ImageData extends SheetData
{

	private String altText, imageUrl;
	private byte[] imageData;
	private Image imageInfo;
	private int width;
	private int imageHeight;

	public ImageData( IImageContent image, int styleId, int datatype,
			Image imageInfo, XlsContainer currentContainer, int heightDpi,
			int widthDpi )
	{
		super( );
		this.dataType = datatype;
		this.styleId = styleId;
		height = ExcelUtil.convertDimensionType( image.getHeight( ), imageInfo
				.getHeight( )
				* ExcelUtil.INCH_PT / heightDpi, heightDpi ) / 1000;
		imageHeight = (int) height;
		int imageWidth = (int) ExcelUtil.convertDimensionType(
				image.getWidth( ), imageInfo.getWidth( ) * ExcelUtil.INCH_PT
						/ widthDpi, widthDpi );
		width = Math.min( currentContainer.getSizeInfo( ).getWidth( ),
				imageWidth );
		altText = image.getAltText( );
		imageUrl = image.getURI( );
		this.imageData = imageInfo.getData( );
		rowSpanInDesign = 0;
		this.imageInfo = imageInfo;
	}

	public String getDescription( )
	{
		return altText;
	}

	public void setDescription( String description )
	{
		this.altText = description;
	}

	public String getImageUrl( )
	{
		return imageUrl;
	}

	public void setUrl( String url )
	{
		this.imageUrl = url;
	}

	public byte[] getImageData( )
	{
		return imageData;
	}

	public void setImageData( byte[] imageData )
	{
		this.imageData = imageData;
	}

	public Image getImageInfo( )
	{
		return imageInfo;
	}

	public int getWidth( )
	{
		return width;
	}

	public void setWidth( int width )
	{
		this.width = width;
	}

	public int getImageHeight( )
	{
		return imageHeight;
	}

	public int getImageWidth( )
	{
		return width / 1000;
	}

	@Override
	public int getEndX( )
	{
		return getStartX( ) + width;
	}

}
{'fraction_non_alphanumeric': 0.15547633194692018, 'fraction_numerical': 0.009308774014656367, 'mean_word_length': 4.116514690982776, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2568321', 'n_tokens_mistral': 1725, 'n_tokens_neox': 1536, 'n_words': 407}