/***********************************************************************
 * Copyright (c) 2004 Actuate 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.layout.area.impl;

import java.util.ArrayList;
import java.util.Iterator;

import org.eclipse.birt.report.engine.content.IContent;
import org.eclipse.birt.report.engine.content.IReportContent;
import org.eclipse.birt.report.engine.content.IStyle;
import org.eclipse.birt.report.engine.layout.area.IArea;
import org.eclipse.birt.report.engine.layout.area.IAreaVisitor;
import org.eclipse.birt.report.engine.layout.area.IContainerArea;
import org.eclipse.birt.report.engine.layout.pdf.util.PropertyUtil;

public abstract class ContainerArea extends AbstractArea
		implements
			IContainerArea
{

	protected boolean needClip;
	protected int maxChildrenBaseLine = 0;
	protected int maxChildrenBaseLineBelow = 0;

	ContainerArea( IContent content )
	{
		super( content );
	}

	ContainerArea( IReportContent report )
	{
		super( report );
	}

	protected ArrayList children = new ArrayList( );

	public Iterator getChildren( )
	{
		return children.iterator( );
	}

	public void addChild( IArea area )
	{
		children.add( area );
	}

	public void removeAll( )
	{
		children.clear( );
	}

	public void removeChild( IArea area )
	{
		children.remove( area );
	}

	public void accept( IAreaVisitor visitor )
	{
		visitor.visitContainer( this );
	}

	public int getChildrenCount( )
	{
		return children.size( );
	}

	public int getContentY( )
	{
		return PropertyUtil.getDimensionValue( style
				.getProperty( IStyle.STYLE_BORDER_TOP_WIDTH ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_PADDING_TOP ) );
	}

	public int getContentX( )
	{
		return PropertyUtil.getDimensionValue( style
				.getProperty( IStyle.STYLE_BORDER_LEFT_WIDTH ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_PADDING_LEFT ) );
	}

	// get height of empty container
	public int getIntrisicHeight( )
	{
		return PropertyUtil.getDimensionValue( style
				.getProperty( IStyle.STYLE_MARGIN_TOP ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_PADDING_TOP ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_BORDER_TOP_WIDTH ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_MARGIN_BOTTOM ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_PADDING_BOTTOM ) )
				+ PropertyUtil.getDimensionValue( style
						.getProperty( IStyle.STYLE_BORDER_BOTTOM_WIDTH ) );
	}
	
	public boolean needClip( )
	{
		return needClip;
	}

	public void setNeedClip( boolean needClip )
	{
		this.needClip = needClip;
	}

	
	public int getMaxChildrenBaseLine( )
	{
		return maxChildrenBaseLine;
	}

	
	public void setMaxChildrenBaseLine( int maxChildrenBaseLine )
	{
		this.maxChildrenBaseLine = maxChildrenBaseLine;
	}

	
	public int getMaxChildrenBaseLineBelow( )
	{
		return maxChildrenBaseLineBelow;
	}

	
	public void setMaxChildrenBaseLineBelow( int maxChildrenBaseLineBelow )
	{
		this.maxChildrenBaseLineBelow = maxChildrenBaseLineBelow;
	}

}

@@ -1966,32 +1966,39 @@
 RDER_TOP_WIDTH )
+, width
  )%0A%09%09%09%09+ Propert
@@ -2074,16 +2074,23 @@
 NG_TOP )
+, width
  );%0A%09%7D%0A%0A
@@ -2208,32 +2208,39 @@
 DER_LEFT_WIDTH )
+, width
  )%0A%09%09%09%09+ Propert
@@ -2317,16 +2317,23 @@
 G_LEFT )
+, width
  );%0A%09%7D%0A%0A

Fix Bugzilla  Bug 228332 [Automation][Regression]Padding does not work correctly in PDF