Răsfoiți Sursa

checkin for Herv Poussineau <[email protected]>.

svn path=/trunk/mcs/; revision=18235
Alexandre Pigolkine 22 ani în urmă
părinte
comite
bad618a4c0

+ 12 - 1
mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs

@@ -13,7 +13,7 @@ namespace System.Drawing.Printing {
 	/// Summary description for Margins.
 	/// </summary>
 
-	public class Margins {// : IClonable {
+	public class Margins : ICloneable {
 		/// <summary>
 		/// left margin in hundredths of an inch
 		/// </summary>
@@ -89,5 +89,16 @@ namespace System.Drawing.Printing {
 				bottom = value;
 			}
 		}
+		
+		public object Clone()
+		{
+			return new Margins(this.Left, this.Right, this.Top, this.Bottom);
+		}
+		
+		public override string ToString()
+		{
+			string ret = "[Margins Left={0} Right={1} Top={2} Bottom={3}]";
+			return String.Format(ret, this.Left, this.Right, this.Top, this.Bottom);
+		}
 	}
 }

+ 83 - 30
mcs/class/System.Drawing/System.Drawing.Printing/MarginsConverter.cs

@@ -3,48 +3,101 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
 using System;
+using System.ComponentModel;
+using System.Globalization;
+using System.Text.RegularExpressions;
 
 namespace System.Drawing.Printing {
 	/// <summary>
 	/// Summary description for MarginsConverter.
 	/// </summary>
-	public class MarginsConverter {//: ExpandableObjectConverter {
+	public class MarginsConverter : ExpandableObjectConverter {
 		public MarginsConverter() {
 		}
 		#region Methods
-//		[MonoTODO]
-//		public override bool CanConvertFrom(ITypeDescriptorContext context,Type sourceType) {
-//			throw new NotImplementedException ();
-//		}
-//		
-//		[MonoTODO]
-//		public override bool CanConvertTo(ITypeDescriptorContext context,Type destinationType) {
-//			throw new NotImplementedException ();
-//		}
-//		
-//		[MonoTODO]
-//		public override object ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,object value) {
-//			throw new NotImplementedException ();
-//		}
-//		
-//		[MonoTODO]
-//		public override object ConvertTo(ITypeDescriptorContext context,CultureInfo culture,object value,Type destinationType) {
-//			throw new NotImplementedException ();
-//		}
-//		
-//		[MonoTODO]
-//		public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) {
-//			throw new NotImplementedException ();
-//		}
-//		
-//		[MonoTODO]
-//		public override bool GetStandardValuesSupported(ITypeDescriptorContext context) {
-//			throw new NotImplementedException ();
-//		}
+		public override bool CanConvertFrom(ITypeDescriptorContext context,Type sourceType) {
+			if (sourceType == typeof(string))
+				return true;
+			
+			return base.CanConvertFrom(context, sourceType);
+		}
+		
+		public override bool CanConvertTo(ITypeDescriptorContext context,Type destinationType) {
+			if (destinationType == typeof(string))
+				return true;
+			
+			return base.CanConvertTo(context, destinationType);
+		}
+		
+		public override object ConvertFrom(ITypeDescriptorContext context,CultureInfo culture,object value) {
+			if (value is string)
+			{
+				if (value == null)
+					return new Margins();
+				
+				// format [left];[right];[top];[bottom]
+				string separator = @"( |\t)*";
+				separator = separator + ";" + separator;
+				string regex = @"(?<left>\d+)" + separator + @"(?<right>\d+)" + separator + @"(?<top>\d+)" + separator + @"(?<bottom>\d+)";
+				
+				Match match = new Regex(regex).Match(value as string);
+				if (!match.Success)
+					throw new ArgumentException("value");
+				
+				int left, right, top, bottom;
+				try
+				{
+					left = int.Parse(match.Groups["left"].Value);
+					right = int.Parse(match.Groups["right"].Value);
+					top = int.Parse(match.Groups["top"].Value);
+					bottom = int.Parse(match.Groups["bottom"].Value);
+				}
+				catch (Exception e)
+				{
+					throw new ArgumentException("value", e);
+				}
+				return new Margins(left, right, top, bottom);
+			} else
+				return base.ConvertFrom(context, culture, value);
+		}
+		
+		public override object ConvertTo(ITypeDescriptorContext context,CultureInfo culture,object value,Type destinationType) {
+			if (destinationType == typeof(string) && value is Margins)
+			{
+				Margins source = value as Margins;
+				string ret = "{0}; {1}; {2}; {3}";
+				return String.Format(ret, source.Left, source.Right, source.Top, source.Bottom);
+			} else
+				return base.ConvertTo(context, culture, value, destinationType);
+		}
+		
+		public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
+		{
+			return true;
+		}
+		
+		public override object CreateInstance(ITypeDescriptorContext context, System.Collections.IDictionary propertyValues)
+		{
+			try
+			{
+				Margins margins = new Margins();
+				margins.Left = int.Parse(propertyValues["Left"].ToString());
+				margins.Right = int.Parse(propertyValues["Right"].ToString());
+				margins.Top = int.Parse(propertyValues["Top"].ToString());
+				margins.Bottom = int.Parse(propertyValues["Bottom"].ToString());
+				return margins;
+			}
+			catch (Exception)
+			{
+				// in case of error, return null
+				return null;
+			}
+		}
 		#endregion
 	}
 }

+ 97 - 55
mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs

@@ -3,6 +3,7 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
@@ -13,110 +14,151 @@ namespace System.Drawing.Printing
 	/// <summary>
 	/// Summary description for PageSettings.
 	/// </summary>
-	public class PageSettings {//: IClonable
-		//[MonoTODO]
-		public PageSettings()
+	public class PageSettings : ICloneable
+	{
+		bool _Color;
+		bool _Landscape;
+		Margins _Margins = new Margins(100, 100, 100, 100); // default margin: 1 inch for all margins
+		PaperSize _PaperSize;
+		PaperSource _PaperSource;
+		PrinterResolution _PrinterResolution;
+		PrinterSettings _PrinterSettings;
+		
+		public PageSettings() : this(new PrinterSettings())
 		{
-			throw new NotImplementedException ();
+		}
+		
+		public PageSettings(PrinterSettings printerSettings)
+		{
+			PrinterSettings = printerSettings;
+			
+			Color = printerSettings.DefaultPageSettings.Color;
+			Landscape = printerSettings.DefaultPageSettings.Landscape;
+			PaperSize = printerSettings.DefaultPageSettings.PaperSize;
+			PaperSource = printerSettings.DefaultPageSettings.PaperSource;
+			PrinterResolution = printerSettings.DefaultPageSettings.PrinterResolution;
+		}
+		
+		// used by PrinterSettings.DefaultPageSettings
+		internal PageSettings(PrinterSettings printerSettings, bool color, bool landscape, PaperSize paperSize, PaperSource paperSource, PrinterResolution printerResolution)
+		{
+			PrinterSettings = printerSettings;
+			
+			Color = color;
+			Landscape = landscape;
+			PaperSize = paperSize;
+			PaperSource = paperSource;
+			PrinterResolution = printerResolution;
 		}
 //props
-		//[MonoTODO]
-//		public Rectangle Bounds{
-//			get{
-//				throw new NotImplementedException ();
-//			}
-//			set{
-//				throw new NotImplementedException ();
-//			}
-//		}
-		[MonoTODO]
+		public Rectangle Bounds{
+			get{
+				int width = this.PaperSize.Width;
+				int height = this.PaperSize.Height;
+				
+				width -= this.Margins.Left + this.Margins.Right;
+				height -= this.Margins.Top + this.Margins.Bottom;
+				
+				if (this.Landscape) {
+					// swap width and height
+					int tmp = width;
+					width = height;
+					height = tmp;
+				}
+				return new Rectangle(0, 0, width, height);
+			}
+		}
+		
 		public bool Color{
 			get{
-				throw new NotImplementedException ();
+				return _Color;
 			}
 			set{
-				throw new NotImplementedException ();
+				_Color = value;
 			}
 		}
-
-		[MonoTODO]
+		
 		public bool Landscape {
 			get{
-				throw new NotImplementedException ();
+				return _Landscape;
 			}
 			set{
-				throw new NotImplementedException ();
+				_Landscape = value;
 			}
 		}
-		[MonoTODO]
+		
 		public Margins Margins{
 			get{
-				throw new NotImplementedException ();
+				return _Margins;
 			}
 			set{
-				throw new NotImplementedException ();
+				_Margins = value;
 			}
 		}
-		[MonoTODO]
+		
 		public PaperSize PaperSize{
 			get{
-				throw new NotImplementedException ();
+				return _PaperSize;
 			}
 			set{
-				throw new NotImplementedException ();
+				_PaperSize = value;
 			}
 		}
-		[MonoTODO]
+		
 		public PaperSource PaperSource{
 			get{
-				throw new NotImplementedException ();
+				return _PaperSource;
 			}
 			set{
-				throw new NotImplementedException ();
+				_PaperSource = value;
 			}
 		}
-		[MonoTODO]
+		
 		public PrinterResolution PrinterResolution{
 			get{
-				throw new NotImplementedException ();
+				return _PrinterResolution;
 			}
 			set{
-				throw new NotImplementedException ();
+				_PrinterResolution = value;
+			}
+		}
+		
+		public PrinterSettings PrinterSettings{
+			get{
+				return _PrinterSettings;
+			}
+			set{
+				_PrinterSettings = value;
 			}
 		}
-		//[MonoTODO]
-//		public PrinterSetting PrinterSetting{
-//			get{
-//				throw new NotImplementedException ();
-//			}
-//			set{
-//				throw new NotImplementedException ();
-//			}
-//		}
 		//[ComVisible(false)]
-		[MonoTODO]
 		public object Clone(){
-			throw new NotImplementedException ();
+			return new PageSettings(this.PrinterSettings);
 		}
 
 		//[ComVisible(false)]
-		[MonoTODO]
-		public void CopyToHdevmode(IntPtr hdevmode){
-			throw new NotImplementedException ();
-		}
+		//[MonoTODO("PageSettings.CopyToHdevmode")]
+		//public void CopyToHdevmode(IntPtr hdevmode){
+		//	throw new NotImplementedException ();
+		//}
 
 		//[ComVisible(false)]
-		[MonoTODO]
-		public void SetHdevmode(IntPtr hdevmode){
-			throw new NotImplementedException ();
-		}
+		//[MonoTODO("PageSettings.SetHdevmode")]
+		//public void SetHdevmode(IntPtr hdevmode){
+		//	throw new NotImplementedException ();
+		//}
 	
 		//[ComVisible(false)]
-		[MonoTODO]
 		public override string ToString(){
-			//FIXME:  //THIS is wrong! This method is to be overridden!
-			return base.ToString();
+			string ret = "[PageSettings: Color={0}";
+			ret += ", Landscape={1}";
+			ret += ", Margins={2}";
+			ret += ", PaperSize={3}";
+			ret += ", PaperSource={4}";
+			ret += ", PrinterResolution={5}";
+			ret += "]";
+			
+			return String.Format(ret, this.Color, this.Landscape, this.Margins, this.PaperSize, this.PaperSource, this.PrinterResolution);
 		}
-
 	}
 }

+ 17 - 8
mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs

@@ -3,6 +3,7 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
@@ -18,18 +19,22 @@ namespace System.Drawing.Printing
 		string name;
 		int width;
 		int height;
-		//Kind kind;
+		PaperKind kind;
+		
 		public PaperSize(string name, int width, int height)
 		{
 			this.width = width;
 			this.height = height;
 			this.name = name;
+			this.kind = PaperKind.Custom;
 		}
 		public int Width{
 			get{
 				return width;
 			}set
 			 {
+			 	if (Kind != PaperKind.Custom)
+			 		throw new ArgumentException();
 				 width = value;
 			 }
 		}
@@ -38,6 +43,8 @@ namespace System.Drawing.Printing
 				return height;
 			}set
 			 {
+			 	if (Kind != PaperKind.Custom)
+			 		throw new ArgumentException();
 				 height = value;
 			 }
 		}
@@ -47,19 +54,21 @@ namespace System.Drawing.Printing
 				return name;
 			}
 			set{
+				if (Kind != PaperKind.Custom)
+			 		throw new ArgumentException();
 				 name = value;
 			 }
 		}
 	
-//		public PaperKind Kind{
-//			get{
-//				return kind;
-//			}
-//		}
+		public PaperKind Kind{
+			get{
+				return kind;
+			}
+		}
 
-		[MonoTODO]
 		public override string ToString(){
-			return base.ToString();//FIXME: must override!
+			string ret = "[PaperSize {0} Kind={1} Height={2} Width={3}]";
+			return String.Format(ret, this.PaperName, this.Kind, this.Height, this.Width);
 		}
 	}
 }

+ 16 - 6
mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs

@@ -3,6 +3,7 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
@@ -15,19 +16,28 @@ namespace System.Drawing.Printing
 	/// </summary>
 	public class PaperSource
 	{
-		[MonoTODO]
+		PaperSourceKind _Kind;
+		string _SourceName;
+		
+		// NOTE:how to construct this class?
+		// I have added a constructor, but I am not sure of me...
+		internal PaperSource(string sourceName, PaperSourceKind kind)
+		{
+			_SourceName = sourceName;
+			_Kind = kind;
+		}
+		
 		public PaperSourceKind Kind{
 			get {
-			throw new NotImplementedException ();			}
+			return _Kind; }
 		}
-		[MonoTODO]
 		public string SourceName{
 			get {
-			throw new NotImplementedException ();			}
+			return _SourceName; }
 		}
-		[MonoTODO]
 		public override string ToString(){
-			return SourceName;
+			string ret = "[PaperSource {0} Kind={1}]";
+			return String.Format(ret, this.SourceName, this.Kind);
 		}
 	}
 }

+ 16 - 16
mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs

@@ -14,21 +14,21 @@ namespace System.Drawing.Printing
 	/// Summary description for PreviewPageInfo.
 	/// </summary>
 	public sealed class PreviewPageInfo {
-		//Image image;
-		//Size physicalSize;
-		//public PreviewPageInfo(Image image, Size physicalSize) {
-		//	this.image = image;
-		//	this.physicalSize = physicalSize;
-		//}
-		//public Image Image {
-		//	get{
-		//		return image;
-		//	}
-		//}
-		//public Size PhysicalSize{
-		//	get{
-		//		return physicalSize;
-		//	}
-		//}
+		Image image;
+		Size physicalSize;
+		public PreviewPageInfo(Image image, Size physicalSize) {
+			this.image = image;
+			this.physicalSize = physicalSize;
+		}
+		public Image Image {
+			get{
+				return image;
+			}
+		}
+		public Size PhysicalSize{
+			get{
+				return physicalSize;
+			}
+		}
 	}
 }

+ 1 - 15
mcs/class/System.Drawing/System.Drawing.Printing/PrintController.cs

@@ -15,28 +15,14 @@ namespace System.Drawing.Printing
 	/// </summary>
 	public abstract class PrintController
 	{
-		public PrintController()
-		{
-			//
-			// TODO: Add constructor logic here
-			//
-		}
-
-		[MonoTODO]
 		public virtual void OnEndPage(PrintDocument document, PrintPageEventArgs e){
-			throw new NotImplementedException ();
 		}
-		[MonoTODO]
 		public virtual void OnStartPrint(PrintDocument document, PrintEventArgs e){
-			throw new NotImplementedException ();
 		}
-		[MonoTODO]
 		public virtual void OnEndPrint(PrintDocument document, PrintEventArgs e){
-			throw new NotImplementedException ();
 		}
-		//[MonoTODO]
 		public virtual Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e){
-			throw new NotImplementedException ();
+			throw new NotImplementedException();
 		}
 	}
 }

+ 74 - 29
mcs/class/System.Drawing/System.Drawing.Printing/PrintDocument.cs

@@ -3,6 +3,7 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
@@ -12,16 +13,23 @@ namespace System.Drawing.Printing {
 	/// <summary>
 	/// Summary description for PrintDocument.
 	/// </summary>
-	public class PrintDocument{// : Component {
+	public class PrintDocument : System.ComponentModel.Component {
 		private PageSettings defaultpagesettings;
+		private PrinterSettings printersettings;
+		private PrintController printcontroller;
 		private string documentname;
-		private bool originAtMargins; // .NET V1.1 Beta
+#if !(NET_1_0)
+		private bool originAtMargins = false; // .NET V1.1 Beta
+#endif
 
-		//[MonoTODO]
 		public PrintDocument() {
-			//FIXME: do we need to init defaultpagesetting, or does pagesettings do that?
-			documentname = "Document"; //offical default.
+			documentname = "document"; //offical default.
+			defaultpagesettings = new PageSettings(); // use default values of default printer
+			printersettings = new PrinterSettings(); // use default values
+			printcontroller = new StandardPrintController();
 		}
+		
+// properties
 		public PageSettings DefaultPageSettings{
 			get{
 				return defaultpagesettings;
@@ -33,7 +41,6 @@ namespace System.Drawing.Printing {
 		/// <summary>
 		/// Name of the document, not the file!
 		/// </summary>
-
 		public string DocumentName{
 			get{
 				return documentname;
@@ -42,25 +49,23 @@ namespace System.Drawing.Printing {
 				documentname = value;
 			}
 		}
-		[MonoTODO]
 		public PrintController PrintController{
 			get{
-				throw new NotImplementedException ();				
+				return printcontroller;
 			}
 			set{
-				throw new NotImplementedException ();
+				printcontroller = value;
 			}
 		}
-		[MonoTODO]
 		public PrinterSettings PrinterSettings{
 			get{
-				throw new NotImplementedException ();				
+				return printersettings;
 			}
 			set{
-				throw new NotImplementedException ();
+				printersettings = value;
 			}
 		}
-		[MonoTODO]
+#if !(NET_1_0)
 		public bool OriginAtMargins{// .NET V1.1 Beta
 			get{
 				return originAtMargins;
@@ -69,37 +74,77 @@ namespace System.Drawing.Printing {
 				originAtMargins = value;
 			}
 		}
+#endif
+
+// methods
 		public void Print(){
-			throw new NotImplementedException ();
+			PrintEventArgs printArgs = new PrintEventArgs();
+			this.OnBeginPrint(printArgs);
+			if (printArgs.Cancel)
+				return;
+			PrintController.OnStartPrint(this, printArgs);
+			if (printArgs.Cancel)
+				return;
+			
+			// while there is more pages
+			PrintPageEventArgs printPageArgs;
+			do
+			{
+				PageSettings pageSettings = DefaultPageSettings.Clone() as PageSettings;
+				this.OnQueryPageSettings(new QueryPageSettingsEventArgs(pageSettings));
+				
+				printPageArgs = new PrintPageEventArgs(
+						null,
+						pageSettings.Bounds,
+						new Rectangle(0, 0, pageSettings.PaperSize.Width, pageSettings.PaperSize.Height),
+						pageSettings);
+				Graphics g = PrintController.OnStartPage(this, printPageArgs);
+				// assign Graphics in printPageArgs
+				printPageArgs.SetGraphics(g);
+				
+				if (!printPageArgs.Cancel)
+					this.OnPrintPage(printPageArgs);
+				
+				PrintController.OnEndPage(this, printPageArgs);
+				if (printPageArgs.Cancel)
+					break;
+			} while (printPageArgs.HasMorePages);
+			
+			this.OnEndPrint(printArgs);
+			PrintController.OnEndPrint(this, printArgs);
 		}
 		public override string ToString(){
-			throw new NotImplementedException ();
+			return "[PrintDocument " + this.DocumentName + "]";
 		}
-		[MonoTODO]
+		
+// events
 		protected virtual void OnBeginPrint(PrintEventArgs e){
 			//fire the event
+			if (BeginPrint != null)
+				BeginPrint(this, e);
 		}
-		[MonoTODO]
+		
 		protected virtual void OnEndPrint(PrintEventArgs e){
 			//fire the event
+			if (EndPrint != null)
+				EndPrint(this, e);
 		}
-		[MonoTODO]
-		protected virtual void OnPrintPage(PrintEventArgs e){
-			//fire the event
-		}
-		[MonoTODO]
-		protected virtual void OnQueryPageSettings(PrintEventArgs e){
+		
+		protected virtual void OnPrintPage(PrintPageEventArgs e){
 			//fire the event
+			if (PrintPage != null)
+				PrintPage(this, e);
 		}
-		[MonoTODO]
-		protected virtual void OnBeginPaint(PrintEventArgs e){
+		
+		protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e){
 			//fire the event
+			if (QuerypageSettings != null)
+				QuerypageSettings(this, e);
 		}
+		
 		public event PrintEventHandler BeginPrint;
 		public event PrintEventHandler EndPrint;
-		public event PrintEventHandler PrintPage;
-		public event PrintEventHandler QuerypageSettings;
-
-
+		public event PrintPageEventHandler PrintPage;
+		public event QueryPageSettingsEventHandler QuerypageSettings;
 	}
 }

+ 1 - 1
mcs/class/System.Drawing/System.Drawing.Printing/PrintEventArgs.cs

@@ -13,7 +13,7 @@ namespace System.Drawing.Printing
 	/// <summary>
 	/// Summary description for PrintEventArgs.
 	/// </summary>
-	public class PrintEventArgs //: CancelEventArgs
+	public class PrintEventArgs : System.ComponentModel.CancelEventArgs
 	{
 		public PrintEventArgs()
 		{

+ 1 - 1
mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs

@@ -13,5 +13,5 @@ namespace System.Drawing.Printing
 	/// <summary>
 	/// Summary description for PrintEventHandler.
 	/// </summary>
-	public delegate void PrintEventHandler(object sender);//, PrintEventHandlerArgs e);
+	public delegate void PrintEventHandler(object sender, PrintEventArgs e);
 }

+ 34 - 35
mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventArgs.cs

@@ -3,6 +3,7 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
@@ -14,15 +15,19 @@ namespace System.Drawing.Printing {
 	/// </summary>
 	public class PrintPageEventArgs : EventArgs {
 		bool cancel;
-		//Graphics graphics;
+		Graphics graphics;
 		bool hasmorePages;
-		//Rectangle marginBounds;
-		//Rectangle pageBounds;
+		Rectangle marginBounds;
+		Rectangle pageBounds;
 		PageSettings pageSettings;
 
-//		public PrintPageEventArgs(Graphics graphics, rectangle marginBounds,
-//			Rectangle pageBounds, PageSettings pageSettings) {
-//		}
+		public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds,
+			Rectangle pageBounds, PageSettings pageSettings) {
+			this.graphics = graphics;
+			this.marginBounds = marginBounds;
+			this.pageBounds = pageBounds;
+			this.pageSettings = pageSettings;
+		}
 		public bool Cancel {
 			get{
 				return cancel;
@@ -31,45 +36,39 @@ namespace System.Drawing.Printing {
 				cancel = value;
 			}
 		}
-//		public Graphics Graphics {
-//			get{
-//				return graphics;
-//			}
-//			set{
-//				graphics = value;
-//			}
-//		}
+		public Graphics Graphics {
+			get{
+				return graphics;
+			}
+		}
 		public bool HasMorePages {
 			get{
-				return HasMorePages;
+				return hasmorePages;
 			}
 			set{
-				HasMorePages = value;
+				hasmorePages = value;
+			}
+		}
+		public Rectangle MarginBounds {
+			get{
+                return marginBounds;
+			}
+		}
+		public Rectangle PageBounds {
+			get{
+				return pageBounds;
 			}
 		}
-//		public Rectangle MarginBounds {
-//			get{
-//                return marginBounds;
-//			}
-//			set{
-//				marginBounds = value;
-//			}
-//		}
-//		public Rectangle PageBounds {
-//			get{
-//				return pageBounds;
-//			}
-//			set{
-//				pageBounds = value;
-//			}
-//		}
 		public PageSettings PageSettings {
 			get{
 				return pageSettings;
 			}
-			set{
-				pageSettings = value;
-			}
+		}
+		
+		// used in PrintDocument.Print()
+		internal void SetGraphics(Graphics g)
+		{
+			graphics = g;
 		}
 }
 }

+ 280 - 7
mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs

@@ -3,10 +3,13 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
 using System;
+using System.Collections;
+using System.Drawing.Printing;
 
 namespace System.Drawing.Printing
 {
@@ -16,7 +19,7 @@ namespace System.Drawing.Printing
 	/// 
 	[Serializable]
 	//[ComVisible(false)]
-	public class PrinterSettings {//: IClonable
+	public class PrinterSettings : ICloneable{
 		public PrinterSettings()
 		{
 		}
@@ -24,23 +27,293 @@ namespace System.Drawing.Printing
 		/// <summary>
 		/// Summary description for PaperSourceCollection.
 		/// </summary>
-		public class PaperSourceCollection {
-			public PaperSourceCollection() {
+		public class PaperSourceCollection : ICollection, IEnumerable {
+			ArrayList _PaperSources = new ArrayList();
+			
+			public PaperSourceCollection(PaperSource[] array) {
+				foreach (PaperSource ps in array)
+					_PaperSources.Add(ps);
+			}
+			
+			public int Count { get { return _PaperSources.Count; } }
+			bool ICollection.IsSynchronized { get { return false; } }
+			object ICollection.SyncRoot { get { return this; } }
+			
+			public virtual PaperSource this[int index] {
+				get { return _PaperSources[index] as PaperSource; }
+			}
+			
+			IEnumerator IEnumerable.GetEnumerator()
+			{
+				return _PaperSources.GetEnumerator();
+			}
+			
+			void ICollection.CopyTo(Array array, int index)
+			{
+				_PaperSources.CopyTo(array, index);
 			}
 		}
 		/// <summary>
 		/// Summary description for PaperSizeCollection.
 		/// </summary>
-		public class PaperSizeCollection {
-			public PaperSizeCollection() {
+		public class PaperSizeCollection : ICollection, IEnumerable {
+			ArrayList _PaperSizes = new ArrayList();
+			
+			public PaperSizeCollection(PaperSize[] array) {
+				foreach (PaperSize ps in array)
+					_PaperSizes.Add(ps);
+			}
+			
+			public int Count { get { return _PaperSizes.Count; } }
+			bool ICollection.IsSynchronized { get { return false; } }
+			object ICollection.SyncRoot { get { return this; } }
+			
+			public virtual PaperSize this[int index] {
+				get { return _PaperSizes[index] as PaperSize; }
+			}
+			
+			IEnumerator IEnumerable.GetEnumerator()
+			{
+				return _PaperSizes.GetEnumerator();
+			}
+			
+			void ICollection.CopyTo(Array array, int index)
+			{
+				_PaperSizes.CopyTo(array, index);
+			}
+		}
+		/// <summary>
+		/// Summary description for PrinterResolutionCollection.
+		/// </summary>
+		public class PrinterResolutionCollection : ICollection, IEnumerable {
+			ArrayList _PrinterResolutions = new ArrayList();
+			
+			public PrinterResolutionCollection(PrinterResolution[] array) {
+				foreach (PrinterResolution pr in array)
+					_PrinterResolutions.Add(pr);
+			}
+			
+			public int Count { get { return _PrinterResolutions.Count; } }
+			bool ICollection.IsSynchronized { get { return false; } }
+			object ICollection.SyncRoot { get { return this; } }
+			
+			public virtual PrinterResolution this[int index] {
+				get { return _PrinterResolutions[index] as PrinterResolution; }
+			}
+			
+			IEnumerator IEnumerable.GetEnumerator()
+			{
+				return _PrinterResolutions.GetEnumerator();
+			}
+			
+			void ICollection.CopyTo(Array array, int index)
+			{
+				_PrinterResolutions.CopyTo(array, index);
 			}
 		}
 		/// <summary>
 		/// Summary description for PrinterResolutionCollection.
 		/// </summary>
-		public class PrinterResolutionCollection {
-			public PrinterResolutionCollection() {
+		public class StringCollection : ICollection, IEnumerable {
+			ArrayList _Strings = new ArrayList();
+			
+			public StringCollection(string[] array) {
+				foreach (string s in array)
+					_Strings.Add(s);
 			}
+			
+			int ICollection.Count { get { return _Strings.Count; } }
+			bool ICollection.IsSynchronized { get { return false; } }
+			object ICollection.SyncRoot { get { return this; } }
+			
+			IEnumerator IEnumerable.GetEnumerator()
+			{
+				return _Strings.GetEnumerator();
+			}
+			
+			void ICollection.CopyTo(Array array, int index)
+			{
+				_Strings.CopyTo(array, index);
+			}
+		}
+		
+//props
+		//[MonoTODO("PrinterSettings.CanDuplex")]
+		//public bool CanDuplex
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.Collate")]
+		//public bool Collate
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.Copies")]
+		//public short Copies
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		[MonoTODO("PrinterSettings.DefaultPageSettings")]
+		public PageSettings DefaultPageSettings
+		{
+			get
+			{
+				return new PageSettings(
+					this,
+					// TODO: get default color mode for this printer
+					false,
+					// TODO: get default orientation for this printer
+					false,
+					// TODO: get default paper size for this printer
+					new PaperSize("A4", 827, 1169),
+					// TODO: get default paper source for this printer
+					new PaperSource("default", PaperSourceKind.FormSource),
+					// TODO: get default resolution for this printer
+					new PrinterResolution(300, 300, PrinterResolutionKind.Medium)
+				);
+			}
+		}
+		//[MonoTODO("PrinterSettings.Duplex")]
+		//public Duplex Duplex
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.FromPage)]
+		//public int FromPage
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.InstalledPrinters")]
+		//public static PrinterSettings.StringCollection InstalledPrinters
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.IsDefaultPrinter")]
+		//public bool IsDefaultPrinter
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.IsPlotter")]
+		//public bool IsPlotter
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.IsValid")]
+		//public bool IsValid
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.LandscapeAngle")]
+		//public int LandscapeAngle
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.MaximumCopies")]
+		//public int MaximumCopies
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.MaximumPage")]
+		//public int MaximumPage
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.MinimumPage")]
+		//public int MinimumPage
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.PaperSizes")]
+		//public PrinterSettings.PaperSizeCollection PaperSizes
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.PaperSources")]
+		//public PrinterSettings.PaperSourceCollection PaperSources
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.PrinterName")]
+		//public string PrinterName
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.PrinterResolutions")]
+		//public PrinterSettings.PrinterResolutionCollection PrinterResolutions
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.PrintRange")]
+		//public PrintRange PrintRange
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.PrintToFile")]
+		//public bool PrintToFile
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.SupportsColor")]
+		//public bool SupportsColor
+		//{
+		//	get { throw new NotImplementedException(); }
+		//}
+		//[MonoTODO("PrinterSettings.ToPage")]
+		//public int ToPage
+		//{
+		//	get { throw new NotImplementedException(); }
+		//	set { throw new NotImplementedException(); }
+		//}
+
+//methods
+		[MonoTODO("PrinterSettings.Clone")]
+		public virtual object Clone()
+		{
+			throw new NotImplementedException();
 		}
+		//[MonoTODO("PrinterSettings.CreateMeasurementGraphics")]
+		//public Graphics CreateMeasurementGraphics()
+		//{
+		//	throw new NotImplementedException();
+		//}
+		//[MonoTODO("PrinterSettings.GetHdevmode")]
+		//public IntPtr GetHdevmode()
+		//{
+		//	throw new NotImplementedException();
+		//}
+		//[MonoTODO("PrinterSettings.GetHdevmode")]
+		//public IntPtr GetHdevmode(PageSettings pageSettings)
+		//{
+		//	throw new NotImplementedException();
+		//}
+		//[MonoTODO("PrinterSettings.GetHdevname")]
+		//public IntPtr GetHdevnames()
+		//{
+		//	throw new NotImplementedException();
+		//}
+		//[MonoTODO("PrinterSettings.SetHdevmode")]
+		//public void SetHdevmode(IntPtr hdevmode)
+		//{
+		//	throw new NotImplementedException();
+		//}
+		//[MonoTODO("PrinterSettings.SetHdevnames")]
+		//public void SetHdevnames(IntPtr hdevnames)
+		//{
+		//	throw new NotImplementedException();
+		//}
+		//[MonoTODO("PrinterSettings.ToString"]
+		//public override string ToString()
+		//{
+		//	throw new NotImplementedException();
+		//}
 	}
 }

+ 59 - 12
mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnitConvert.cs

@@ -3,60 +3,107 @@
 //
 // Authors:
 //      Martin Willemoes Hansen ([email protected])
+//      Herve Poussineau ([email protected])
 //
 // (C) 2003 Martin Willemoes Hansen
 //
 
 namespace System.Drawing.Printing
 {
-        public sealed class PrinterUnitConvert
+	public sealed class PrinterUnitConvert
 	{
-		[MonoTODO]
 		public static double Convert (double value,
 					      PrinterUnit fromUnit,
 					      PrinterUnit toUnit)
 		{
+			switch (fromUnit)
+			{
+				case PrinterUnit.Display:
+					switch (toUnit)
+					{
+						case PrinterUnit.Display: return value;
+						case PrinterUnit.ThousandthsOfAnInch: return value * 10;
+						case PrinterUnit.HundredthsOfAMillimeter: return value * 2.54;
+						case PrinterUnit.TenthsOfAMillimeter: return value * .254;
+					}
+					break;
+				case PrinterUnit.ThousandthsOfAnInch:
+					switch (toUnit)
+					{
+						case PrinterUnit.Display: return value / 10;
+						case PrinterUnit.ThousandthsOfAnInch: return value;
+						case PrinterUnit.HundredthsOfAMillimeter: return value * .254;
+						case PrinterUnit.TenthsOfAMillimeter: return value * .0254;
+					}
+					break;
+				case PrinterUnit.HundredthsOfAMillimeter:
+					switch (toUnit)
+					{
+						case PrinterUnit.Display: return value / 2.54;
+						case PrinterUnit.ThousandthsOfAnInch: return value / .254;
+						case PrinterUnit.HundredthsOfAMillimeter: return value;
+						case PrinterUnit.TenthsOfAMillimeter: return value / 10;
+					}
+					break;
+				case PrinterUnit.TenthsOfAMillimeter:
+					switch (toUnit)
+					{
+						case PrinterUnit.Display: return value / .254;
+						case PrinterUnit.ThousandthsOfAnInch: return value / .0254;
+						case PrinterUnit.HundredthsOfAMillimeter: return value * 10;
+						case PrinterUnit.TenthsOfAMillimeter: return value;
+					}
+					break;
+			}
+			// should never happen
 			throw new NotImplementedException();
 		}
 
-		[MonoTODO]
 		public static int Convert (int value,
 					   PrinterUnit fromUnit,
 					   PrinterUnit toUnit)
 		{
-			throw new NotImplementedException();
+			return (int)Convert((double)value, fromUnit, toUnit);
 		}
 
-		[MonoTODO]
 		public static Margins Convert (Margins value,
 					       PrinterUnit fromUnit,
 					       PrinterUnit toUnit)
 		{
-			throw new NotImplementedException();
+			return new Margins(
+				Convert(value.Left, fromUnit, toUnit),
+				Convert(value.Right, fromUnit, toUnit),
+				Convert(value.Top, fromUnit, toUnit),
+				Convert(value.Bottom, fromUnit, toUnit));
 		}
 
-		[MonoTODO]
 		public static Point Convert (Point value,
 					     PrinterUnit fromUnit,
 					     PrinterUnit toUnit)
 		{
-			throw new NotImplementedException();
+			return new Point(
+				Convert(value.X, fromUnit, toUnit),
+				Convert(value.Y, fromUnit, toUnit));
 		}
 
-		[MonoTODO]
 		public static Rectangle Convert (Rectangle value,
 						 PrinterUnit fromUnit,
 						 PrinterUnit toUnit)
 		{
-			throw new NotImplementedException();
+			return new Rectangle(
+				Convert(value.X, fromUnit, toUnit),
+				Convert(value.Y, fromUnit, toUnit),
+				Convert(value.Width, fromUnit, toUnit),
+				Convert(value.Height, fromUnit, toUnit));
 		}
 
-		[MonoTODO]
 		public static Size Convert (Size value,
 					    PrinterUnit fromUnit,
 					    PrinterUnit toUnit)
 		{
-			throw new NotImplementedException();
+			return new Size(
+				Convert(value.Width, fromUnit, toUnit),
+				Convert(value.Height, fromUnit, toUnit));
 		}
 	}
 }

+ 79 - 24
mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs

@@ -3,10 +3,13 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
 using System;
+using System.Security;
+using System.Security.Permissions;
 
 namespace System.Drawing.Printing
 {
@@ -15,30 +18,82 @@ namespace System.Drawing.Printing
 	/// </summary>
 	/// 
 	[Serializable]
-	public sealed class PrintingPermission //: CodeAccessPermission, IUnrestrictedPermission
+	public sealed class PrintingPermission : CodeAccessPermission, IUnrestrictedPermission
 	{
-//		[MonoTODO]
-//		public PrintingPermission(PermissionState state) {
-//			throw new NotImplementedException ();
-//		}
-//		[MonoTODO]
-//		public PrintingPermission(PrintingPermissionLevel PrintingLevel) {
-//			throw new NotImplementedException ();
-//		}
-		//[MonoTODO]
-//		[Serializable]
-//		public PrintingPermissionlevel Level{
-//			get{
-//				throw new NotImplementedException ();
-//			}
-//			set{
-//				throw new NotImplementedException ();
-//			}
-//		}
-		//[MonoTODO]
-//		[Serializable]
-//		public override IPermission Copy(){
-//			throw new NotImplementedException ();
-//		}
+		private PrintingPermissionLevel _Level;
+		
+		public PrintingPermission(PermissionState state) {
+			switch (state)
+			{
+				case PermissionState.None:
+					Level = PrintingPermissionLevel.NoPrinting;
+					break;
+				case PermissionState.Unrestricted:
+					Level = PrintingPermissionLevel.AllPrinting;
+					break;
+				default:
+					// should never happen
+					throw new ArgumentException("state");
+			}
+		}
+		public PrintingPermission(PrintingPermissionLevel printingLevel) {
+			Level = printingLevel;
+		}
+		
+// properties
+		public PrintingPermissionLevel Level{
+			get{
+				return _Level;
+			}
+			set{
+				_Level = value;
+			}
+		}
+
+// methods
+		public override IPermission Copy(){
+			return new PrintingPermission(this.Level);
+		}
+		
+		[MonoTODO("PrintingPermission.FromXml")]
+		public override void FromXml(SecurityElement esd)
+		{
+			throw new NotImplementedException();
+		}
+		
+		public override IPermission Intersect(IPermission target)
+		{
+			if (this.IsSubsetOf(target))
+				return this.Copy();
+			else
+				return target.Copy();
+		}
+		
+		public override bool IsSubsetOf(IPermission target)
+		{
+			if (!(target is PrintingPermission))
+				throw new ArgumentException("target");
+			
+			return this.Level <= (target as PrintingPermission).Level;
+		}
+		
+		public bool IsUnrestricted()
+		{
+			return (this.Level == PrintingPermissionLevel.AllPrinting);
+		}
+		
+		[MonoTODO("PrintingPermission.ToXml")]
+		public override SecurityElement ToXml()
+		{
+			throw new NotImplementedException();
+		}
+		
+		public override IPermission Union(IPermission target)
+		{
+			if (this.IsSubsetOf(target))
+				return target.Copy();
+			else
+				return this.Copy();
+		}
 	}
 }

+ 25 - 23
mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs

@@ -3,10 +3,13 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
 using System;
+using System.Security;
+using System.Security.Permissions;
 
 namespace System.Drawing.Printing
 {
@@ -14,29 +17,28 @@ namespace System.Drawing.Printing
 	/// Summary description for PrintingPermissionAttribute.
 	/// </summary>
 	/// 
-	//[AttributeUsage(AttributeTargets.All)]
-	public sealed class PrintingPermissionAttribute //: CodeAccessSecurityAttribute
+	[AttributeUsage(AttributeTargets.All)]
+	public sealed class PrintingPermissionAttribute : CodeAccessSecurityAttribute
 	{
-//		[MonoTODO]
-//		[AttributeUsage(AttributeTargets.All)]
-//		public PrintingPermissionAttribute(SecurityAction action)
-//		{
-//			throw new NotImplementedException ();
-//		}
-//		[MonoTODO]
-//		[AttributeUsage(AttributeTargets.All)]
-//		public PrintingPermissionLevel Level {
-//			get{
-//				throw new NotImplementedException ();
-//			}
-//			set{
-//				throw new NotImplementedException ();
-//			}
-//		}
-//		[MonoTODO]
-//		[AttributeUsage(AttributeTargets.All)]
-//		public override IPermission CreatePermission(){
-//			throw new NotImplementedException ();
-//		}
+		private PrintingPermissionLevel _Level;
+		
+		public PrintingPermissionAttribute(SecurityAction action) : base(action)
+		{
+			// seems to always assign PrintingPermissionLevel.NoPrinting ...
+			Level = PrintingPermissionLevel.NoPrinting;
+		}
+		
+		public PrintingPermissionLevel Level {
+			get{
+				return _Level;
+			}
+			set{
+				_Level = value;
+			}
+		}
+		
+		public override IPermission CreatePermission(){
+			return new PrintingPermission(this.Level);
+		}
 	}
 }

+ 1 - 1
mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs

@@ -13,5 +13,5 @@ namespace System.Drawing.Printing
 	/// <summary>
 	/// Summary description for QueryPageSettingsEventHandler.
 	/// </summary>
-	//public delegate void QueryPageSettingsEventHandler(object sender, QueryPageSettingsEventArgs e);
+	public delegate void QueryPageSettingsEventHandler(object sender, QueryPageSettingsEventArgs e);
 }

+ 46 - 20
mcs/class/System.Drawing/System.Drawing.Printing/StandardPrintController.cs

@@ -3,6 +3,7 @@
 //
 // Author:
 //   Dennis Hayes ([email protected])
+//   Herve Poussineau ([email protected])
 //
 // (C) 2002 Ximian, Inc
 //
@@ -13,25 +14,50 @@ namespace System.Drawing.Printing {
 	/// Summary description for StandardPrintController.
 	/// </summary>
 	public class StandardPrintController : PrintController {
-//		[MonoTODO]
-//		public StandardPrintController() {
-//			throw new NotImplementedException ();
-//		}
-//		[MonoTODO]
-//		public override void OnEndPage(PrintDocument document, PrintPageEventArgs e){
-//			throw new NotImplementedException ();
-//		}
-//		[MonoTODO]
-//		public override void OnStartPrint(PrintDocument document, PrintPageEventArgs e){
-//			throw new NotImplementedException ();
-//		}
-//		[MonoTODO]
-//		public override void OnEndPrint(PrintDocument document, PrintPageEventArgs e){
-//			throw new NotImplementedException ();
-//		}
-//		[MonoTODO]
-//		public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e){
-//			throw new NotImplementedException ();
-//		}
+		private int page;
+		private Image image;
+		
+		public StandardPrintController() {
+		}
+		[MonoTODO("StandardPrintController.OnEndPage")]
+		public override void OnEndPage(PrintDocument document, PrintPageEventArgs e){
+			//TODO: print current page
+			// - image to print is this.image
+			// - page settings are in e.PageSettings
+			// - printer settings are in document.PrinterSettings
+			// - don't forget to use document.OriginAtMargins (only if .NET 1.1)
+			
+			// actually, "print" == "save to a file"
+			try
+			{
+				string fileName = document.DocumentName + " " + page.ToString("D4") + ".jpg";
+				Console.WriteLine("StandardPrintController: Print page \"{0}\"", fileName);
+				image.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
+			}
+			catch (Exception) {}
+			
+			if (e.Graphics != null)
+				e.Graphics.Dispose();
+		}
+		[MonoTODO("StandardPrintController.OnStartPrint")]
+		public override void OnStartPrint(PrintDocument document, PrintEventArgs e){
+			page = 0;
+		}
+		//[MonoTODO("StandardPrintController.OnEndPrint")]
+		//public override void OnEndPrint(PrintDocument document, PrintEventArgs e){
+		//	throw new NotImplementedException ();
+		//}
+		[MonoTODO("StandardPrintController.OnStartPage")]
+		public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e){
+			//FIXME: I'm not sure of what I'm doing
+			// I don't know what size to give to image
+			// and why I have to clear it
+			page++;
+			// returns a new (empty) graphics
+			image = new Bitmap(e.MarginBounds.Width, e.MarginBounds.Height);
+			Graphics g = Graphics.FromImage(image);
+			g.Clear(Color.White);
+			return g;
+		}
 	}
 }

+ 26 - 0
mcs/class/System.Drawing/System.Drawing.Printing/changelog

@@ -1,3 +1,29 @@
+2003-09-21  Alexandre Pigolkine <[email protected]>
+				Checkin for Hervé Poussineau <[email protected]>
+	* Margins.cs				
+	* MarginsConverter.cs
+	* PageSettings.cs
+	* PaperSize.cs
+	* PaperSource.cs
+	* PreviewPageInfo.cs
+	* PrintController.cs
+	* PrintDocument.cs
+	* PrintEventArgs.cs
+	* PrintEventHandler.cs
+	* PrintPageEventArgs.cs
+	* PrinterSettings.cs
+	* PrinterUnitConvert.cs
+	* PrintingPermission.cs
+	* PrintingPermissionAttribute.cs
+	* QueryPageSettingsEventHandler.cs
+	* StandardPrintController.cs
+				Implemented.
+	
+	* PaperSourceCollection.cs: subclass of PrinterSettings
+  * PaperUnitConvert.cs: not found in .NET documentation
+				Deleted.
+
+
 2003-07-17  Andreas Nahr <[email protected]>
 
 	* PrinterResolution.cs: Fixed signature, implemented, restyled, removed non-CLS compliant members