dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Printing Duplex.cs,NO


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Printing Duplex.cs,NONE,1.1 InvalidPrinterException.cs,NONE,1.1 Makefile,NONE,1.1 Margins.cs,NONE,1.1 MarginsConverter.cs,NONE,1.1 ModeField.cs,NONE,1.1 PageSettings.cs,NONE,1.1 PaperKind.cs,NONE,1.1 PaperSize.cs,NONE,1.1 PaperSource.cs,NONE,1.1 PaperSourceKind.cs,NONE,1.1 PreviewPageInfo.cs,NONE,1.1 PreviewPrintController.cs,NONE,1.1 PrintController.cs,NONE,1.1 PrintDocument.cs,NONE,1.1 PrintEventArgs.cs,NONE,1.1 PrintEventHandler.cs,NONE,1.1 PrintPageEventArgs.cs,NONE,1.1 PrintPageEventHandler.cs,NONE,1.1 PrintRange.cs,NONE,1.1 PrinterResolution.cs,NONE,1.1 PrinterResolutionKind.cs,NONE,1.1 PrinterSettings.cs,NONE,1.1 PrinterUnit.cs,NONE,1.1 PrinterUnitConvert.cs,NONE,1.1 PrintingPermission.cs,NONE,1.1 PrintingPermissionAttribute.cs,NONE,1.1PrintingPermissionLevel.cs,NONE,1.1 QueryPageSettingsEventArgs.cs,NONE,1.1 QueryPageSettingsEventHandler.cs,NONE,1.1 StandardPrintController.cs,NONE,1.1
Date: Sat, 07 Jun 2003 18:41:00 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Printing
In directory subversions:/tmp/cvs-serv12618/System.Drawing/Printing

Added Files:
        Duplex.cs InvalidPrinterException.cs Makefile Margins.cs 
        MarginsConverter.cs ModeField.cs PageSettings.cs PaperKind.cs 
        PaperSize.cs PaperSource.cs PaperSourceKind.cs 
        PreviewPageInfo.cs PreviewPrintController.cs 
        PrintController.cs PrintDocument.cs PrintEventArgs.cs 
        PrintEventHandler.cs PrintPageEventArgs.cs 
        PrintPageEventHandler.cs PrintRange.cs PrinterResolution.cs 
        PrinterResolutionKind.cs PrinterSettings.cs PrinterUnit.cs 
        PrinterUnitConvert.cs PrintingPermission.cs 
        PrintingPermissionAttribute.cs PrintingPermissionLevel.cs 
        QueryPageSettingsEventArgs.cs QueryPageSettingsEventHandler.cs 
        StandardPrintController.cs 
Log Message:


Add the "System.Drawing" and "System.Drawing.Xsharp" assemblies.


--- NEW FILE ---
/*
 * Duplex.cs - Implementation of the
 *                      "System.Drawing.Printing.Duplex" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum Duplex
{
        Default         = -1,
        Simplex         = 1,
        Veritcal        = 2,
        Horizontal      = 3

}; // enum Duplex

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * InvalidPrinterException.cs - Implementation of the
 *                      "System.Drawing.Printing.InvalidPrinterException" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.Drawing.Printing;
using System.Runtime.Serialization;

public class InvalidPrinterException : SystemException
{
        // Internal state.
        private PrinterSettings settings;

        // Constructors.
        public InvalidPrinterException(PrinterSettings settings)
                        : base(S._("Exception_InvalidPrinter"))
                        {
                                this.settings = settings;
                        }
#if !ECMA_COMPAT
        protected InvalidPrinterException
                                (SerializationInfo info, StreamingContext ctxt)
                        : base(info, ctxt)
                        {
                                settings = (PrinterSettings)
                                        info.GetValue("settings", 
typeof(PrinterSettings));
                        }

        // Get the serialization data for this exception.
        public override void GetObjectData(SerializationInfo info,
                                                                           
StreamingContext context)
                        {
                                base.GetObjectData(info, context);
                                info.AddValue("settings", settings, 
typeof(PrinterSettings));
                        }
#endif

}; // class InvalidPrinterException

}; // namespace System.Drawing.Printing

--- NEW FILE ---

all:
        (cd ..; make)

--- NEW FILE ---
/*
 * Margins.cs - Implementation of the
 *                      "System.Drawing.Printing.Margins" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.ComponentModel;
using System.Text;

[TypeConverter("System.Drawing.Printing.MarginsConverter")]
public class Margins : ICloneable
{
        // Internal state.
        private int left;
        private int right;
        private int top;
        private int bottom;

        // Constructors.
        public Margins()
                        {
                                left = 100;
                                right = 100;
                                top = 100;
                                bottom = 100;
                        }
        public Margins(int left, int right, int top, int bottom)
                        {
                                if(left < 0)
                                {
                                        throw new ArgumentException
                                                (S._("ArgRange_NonNegative"), 
"left");
                                }
                                if(right < 0)
                                {
                                        throw new ArgumentException
                                                (S._("ArgRange_NonNegative"), 
"right");
                                }
                                if(top < 0)
                                {
                                        throw new ArgumentException
                                                (S._("ArgRange_NonNegative"), 
"top");
                                }
                                if(bottom < 0)
                                {
                                        throw new ArgumentException
                                                (S._("ArgRange_NonNegative"), 
"bottom");
                                }
                                this.left = left;
                                this.right = right;
                                this.top = top;
                                this.bottom = bottom;
                        }

        // Get or set this object's properties.
        public int Bottom
                        {
                                get
                                {
                                        return bottom;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"), "value");
                                        }
                                        bottom = value;
                                }
                        }
        public int Left
                        {
                                get
                                {
                                        return left;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"), "value");
                                        }
                                        left = value;
                                }
                        }
        public int Right
                        {
                                get
                                {
                                        return right;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"), "value");
                                        }
                                        right = value;
                                }
                        }
        public int Top
                        {
                                get
                                {
                                        return top;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"), "value");
                                        }
                                        top = value;
                                }
                        }

        // Clone this object.
        public Object Clone()
                        {
                                return MemberwiseClone();
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                Margins other = (obj as Margins);
                                if(other != null)
                                {
                                        return (other.left == left && 
other.right == right &&
                                                        other.top == top && 
other.bottom == bottom);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get a hash code for this object.
        public override int GetHashCode()
                        {
                                return (left + right + top + bottom);
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                StringBuilder builder = new StringBuilder();
                                builder.Append("[Margins Left=");
                                builder.Append(left.ToString());
                                builder.Append(" Right=");
                                builder.Append(right.ToString());
                                builder.Append(" Top=");
                                builder.Append(top.ToString());
                                builder.Append(" Bottom=");
                                builder.Append(bottom.ToString());
                                builder.Append(']');
                                return builder.ToString();
                        }

}; // class Margins

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * MarginsConverter.cs - Implementation of the
 *                      "System.Drawing.Printing.MarginsConverter" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.ComponentModel;
using System.Globalization;
using System.Collections;

public class MarginsConverter : ExpandableObjectConverter
{
        // Constructor.
        public MarginsConverter() {}

        // Determine if we can convert from a given type to "Margins".
        public override bool CanConvertFrom
                                (ITypeDescriptorContext context, Type 
sourceType)
                        {
                                if(sourceType == typeof(String))
                                {
                                        return true;
                                }
                                else
                                {
                                        return base.CanConvertFrom(context, 
sourceType);
                                }
                        }

        // Determine if we can convert to a given type from "Margins".
        [TODO]
        public override bool CanConvertTo
                                (ITypeDescriptorContext context, Type 
destinationType)
                        {
                                // TODO
                                return base.CanConvertTo(context, 
destinationType);
                        }

        // Convert from a source type to "Margins".
        [TODO]
        public override Object ConvertFrom
                                (ITypeDescriptorContext context,
                                 CultureInfo culture, Object value)
                        {
                                // TODO
                                return null;
                        }

        // Convert from "Margins" to a destination type.
        [TODO]
        public override Object ConvertTo
                                (ITypeDescriptorContext context,
                                 CultureInfo culture, Object value,
                                 Type destinationType)
                        {
                                // TODO
                                return null;
                        }

        // Create an object instance given a set of property values.
        [TODO]
        public override Object CreateInstance
                                (ITypeDescriptorContext context, IDictionary 
propertyValues)
                        {
                                // TODO
                                return null;
                        }

        // Determine if "CreateInstance" is supported.
        public override bool GetCreateInstanceSupported
                                (ITypeDescriptorContext context)
                        {
                                return true;
                        }

}; // class MarginsConverter

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * ModeField.cs - Implementation of the
 *                      "System.Drawing.Printing.ModeField" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum ModeField
{
        Orientation             = 0,
        PaperSize               = 1,
        PaperLength             = 2,
        PaperWidth              = 3,
        Copies                  = 4,
        DefaultSource   = 5,
        PrintQuality    = 6,
        Color                   = 7,
        Duplex                  = 8,
        YResolution             = 9,
        TTOption                = 10,
        Collate                 = 11

}; // enum ModeField

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PageSettings.cs - Implementation of the
 *                      "System.Drawing.Printing.PageSettings" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.Runtime.InteropServices;
using System.Text;

[ComVisible(false)]
public class PageSettings : ICloneable
{
        // Internal state.
        private PrinterSettings printerSettings;
        private Rectangle bounds;
        private bool color;
        private bool colorSet;
        private bool landscape;
        private bool landscapeSet;
        private Margins margins;
        private PaperSize paperSize;
        private PaperSource paperSource;
        private PrinterResolution printerResolution;

        // Constructors.
        public PageSettings() : this(null) {}
        public PageSettings(PrinterSettings printerSettings)
                        {
                                if(printerSettings != null)
                                {
                                        this.printerSettings = printerSettings;
                                }
                                else
                                {
                                        this.printerSettings = new 
PrinterSettings();
                                }
                                margins = new Margins();
                        }

        // Get or set this object's properties.
        public Rectangle Bounds
                        {
                                get
                                {
                                        PaperSize size = PaperSize;
                                        if(Landscape)
                                        {
                                                return new Rectangle(0, 0, 
size.Height, size.Width);
                                        }
                                        else
                                        {
                                                return new Rectangle(0, 0, 
size.Width, size.Height);
                                        }
                                }
                        }
        public bool Color
                        {
                                get
                                {
                                        if(colorSet)
                                        {
                                                return color;
                                        }
                                        else
                                        {
                                                return 
PrinterSettings.DefaultPageSettings.Color;
                                        }
                                }
                                set
                                {
                                        color = value;
                                        colorSet = true;
                                }
                        }
        public bool Landscape
                        {
                                get
                                {
                                        if(landscapeSet)
                                        {
                                                return landscape;
                                        }
                                        else
                                        {
                                                return 
PrinterSettings.DefaultPageSettings.Landscape;
                                        }
                                }
                                set
                                {
                                        landscape = value;
                                        landscapeSet = true;
                                }
                        }
        public Margins Margins
                        {
                                get
                                {
                                        return margins;
                                }
                                set
                                {
                                        if(value != null)
                                        {
                                                margins = value;
                                        }
                                        else
                                        {
                                                margins = new Margins();
                                        }
                                }
                        }
        public PaperSize PaperSize
                        {
                                get
                                {
                                        if(paperSize != null)
                                        {
                                                return paperSize;
                                        }
                                        else
                                        {
                                                return 
PrinterSettings.DefaultPageSettings.PaperSize;
                                        }
                                }
                                set
                                {
                                        paperSize = value;
                                }
                        }
        public PaperSource PaperSource
                        {
                                get
                                {
                                        if(paperSource != null)
                                        {
                                                return paperSource;
                                        }
                                        else
                                        {
                                                return 
PrinterSettings.DefaultPageSettings.PaperSource;
                                        }
                                }
                                set
                                {
                                        paperSource = value;
                                }
                        }
        public PrinterResolution PrinterResolution
                        {
                                get
                                {
                                        if(printerResolution != null)
                                        {
                                                return printerResolution;
                                        }
                                        else
                                        {
                                                return 
PrinterSettings.DefaultPageSettings.
                                                                        
PrinterResolution;
                                        }
                                }
                                set
                                {
                                        printerResolution = value;
                                }
                        }
        public PrinterSettings PrinterSettings
                        {
                                get
                                {
                                        return printerSettings;
                                }
                                set
                                {
                                        if(value != null)
                                        {
                                                printerSettings = value;
                                        }
                                        else
                                        {
                                                printerSettings = new 
PrinterSettings();
                                        }
                                }
                        }

        // Clone this object.
        public Object Clone()
                        {
                                return MemberwiseClone();
                        }

        // Copy the settings to a Win32 HDEVMODE structure.
        public void CopyToHdevmode(IntPtr hdevmode)
                        {
                                // Not used in this implementation.
                        }

        // Set the settings in this object from a Win32 HDEVMODE structure.
        public void SetHdevmode(IntPtr hdevmode)
                        {
                                // Not used in this implementation.
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                StringBuilder builder = new StringBuilder();
                                builder.Append("[PageSettings: Color=");
                                builder.Append(Color.ToString());
                                builder.Append(", Landscape=");
                                builder.Append(Landscape.ToString());
                                builder.Append(", Margins=");
                                builder.Append(Margins.ToString());
                                builder.Append(", PaperSize=");
                                builder.Append(PaperSize.ToString());
                                builder.Append(", PaperSource=");
                                builder.Append(PaperSource.ToString());
                                builder.Append(", PrinterResolution=");
                                builder.Append(PrinterResolution.ToString());
                                builder.Append(']');
                                return builder.ToString();
                        }

}; // class PageSettings

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PaperKind.cs - Implementation of the
 *                      "System.Drawing.Printing.PaperKind" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum PaperKind
{
        Custom                                                          = 0,
        Letter                                                          = 1,
        LetterSmall                                                     = 2,
        Tabloid                                                         = 3,
        Ledger                                                          = 4,
        Legal                                                           = 5,
        Statement                                                       = 6,
        Executive                                                       = 7,
        A3                                                                      
= 8,
        A4                                                                      
= 9,
        A4Small                                                         = 10,
        A5                                                                      
= 11,
        B4                                                                      
= 12,
        Folio                                                           = 14,
        Quarto                                                          = 15,
        Standard10x14                                           = 16,
        Standard11x17                                           = 17,
        Note                                                            = 18,
        Number9Envelope                                         = 19,
        Number10Envelope                                        = 20,
        Number11Envelope                                        = 21,
        Number12Envelope                                        = 22,
        Number14Envelope                                        = 23,
        CSheet                                                          = 24,
        DSheet                                                          = 25,
        ESheet                                                          = 26,
        DLEnvelope                                                      = 27,
        C3Envelope                                                      = 29,
        C4Envelope                                                      = 30,
        C65Envelope                                                     = 32,
        B4Envelope                                                      = 33,
        C5Envelope                                                      = 34,
        B6Envelope                                                      = 35,
        MonarchEnvelope                                         = 37,
        PersonalEnvelope                                        = 38,
        USStandardFanfold                                       = 39,
        GermanStandardFanfold                           = 40,
        GermanLegalFanfold                                      = 41,
        IsoB4                                                           = 42,
        JapanesePostcard                                        = 43,
        Standard9x11                                            = 44,
        Standard10x11                                           = 45,
        Standard15x11                                           = 46,
        InviteEnvelope                                          = 47,
        LetterExtra                                                     = 50,
        LegalExtra                                                      = 51,
        TabloidExtra                                            = 52,
        A4Extra                                                         = 53,
        LetterTransverse                                        = 54,
        A4Transverse                                            = 55,
        LetterExtraTransverse                           = 56,
        APlus                                                           = 57,
        BPlus                                                           = 58,
        LetterPlus                                                      = 59,
        A4Plus                                                          = 60,
        A5Transverse                                            = 61,
        B5Transverse                                            = 62,
        A3Extra                                                         = 63,
        A5Extra                                                         = 64,
        B5Extra                                                         = 65,
        A2                                                                      
= 66,
        A3Transverse                                            = 67,
        A3ExtraTransverse                                       = 68,
        JapaneseDoublePostcard                          = 69,
        A6                                                                      
= 70,
        JapaneseEnvelopeKakuNumber2                     = 71,
        JapaneseEnvelopeKakuNumber3                     = 72,
        JapaneseEnvelopeChouNumber3                     = 73,
        JapaneseEnvelopeChouNumber4                     = 74,
        LetterRotated                                           = 75,
        A3Rotated                                                       = 76,
        A4Rotated                                                       = 77,
        A5Rotated                                                       = 78,
        B4JisRotated                                            = 79,
        B5JisRotated                                            = 80,
        JapanesePostcardRotated                         = 81,
        JapaneseDoublePostcardRotated           = 82,
        A6Rotated                                                       = 83,
        JapaneseEnvelopeKakuNumber2Rotated      = 84,
        JapaneseEnvelopeKakuNumber3Rotated      = 85,
        JapaneseEnvelopeChouNumber3Rotated      = 86,
        JapaneseEnvelopeChouNumber4Rotated      = 87,
        B6Jis                                                           = 88,
        B6JisRotated                                            = 89,
        Standard12x11                                           = 90,
        JapaneseEnvelopeYouNumber4                      = 91,
        JapaneseEnvelopeYouNumber4Rotated       = 92,
        Prc16K                                                          = 93,
        Prc32K                                                          = 94,
        Prc32KBig                                                       = 95,
        PrcEnvelopeNumber1                                      = 96,
        PrcEnvelopeNumber2                                      = 97,
        PrcEnvelopeNumber3                                      = 98,
        PrcEnvelopeNumber4                                      = 99,
        PrcEnvelopeNumber5                                      = 100,
        PrcEnvelopeNumber6                                      = 101,
        PrcEnvelopeNumber7                                      = 102,
        PrcEnvelopeNumber8                                      = 103,
        PrcEnvelopeNumber9                                      = 104,
        PrcEnvelopeNumber10                                     = 105,
        Prc16KRotated                                           = 106,
        Prc32KRotated                                           = 107,
        Prc32KBigRotated                                        = 108,
        PrcEnvelopeNumber1Rotated                       = 109,
        PrcEnvelopeNumber10Rotated                      = 118,
        PrcEnvelopeNumber2Rotated                       = 110,
        PrcEnvelopeNumber3Rotated                       = 111,
        PrcEnvelopeNumber4Rotated                       = 112,
        PrcEnvelopeNumber5Rotated                       = 113,
        PrcEnvelopeNumber6Rotated                       = 114,
        PrcEnvelopeNumber7Rotated                       = 115,
        PrcEnvelopeNumber8Rotated                       = 116,
        PrcEnvelopeNumber9Rotated                       = 117

}; // enum PaperKind

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PaperSize.cs - Implementation of the
 *                      "System.Drawing.Printing.PaperSize" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.Text;

public class PaperSize
{
        // Internal state.
        private PaperKind kind;
        private String name;
        private int width;
        private int height;

        // Constructors.
        public PaperSize(String name, int width, int height)
                        {
                                this.kind = PaperKind.Custom;
                                this.name = name;
                                this.width = width;
                                this.height = height;
                        }
        internal PaperSize(PaperKind kind)
                        {
                                this.kind = kind;
                                this.name = kind.ToString();
                                // TODO: need to add all of the rest of the 
paper sizes.
                                switch(kind)
                                {
                                        case PaperKind.Letter:
                                        {
                                                this.width = 850;
                                                this.height = 1100;
                                        }
                                        break;

                                        case PaperKind.A4:
                                        {
                                                this.width = 857;
                                                this.height = 1212;
                                        }
                                        break;

                                        case PaperKind.Executive:
                                        {
                                                this.width = 725;
                                                this.height = 1050;
                                        }
                                        break;

                                        case PaperKind.Legal:
                                        {
                                                this.width = 850;
                                                this.height = 1400;
                                        }
                                        break;

                                        default:
                                        {
                                                // Unknown paper size, so 
switch to "Letter".
                                                this.kind = PaperKind.Letter;
                                                this.width = 850;
                                                this.height = 1100;
                                        }
                                        break;
                                }
                        }

        // Get or set this object's properties.
        public int Height
                        {
                                get
                                {
                                        return height;
                                }
                                set
                                {
                                        if(kind != PaperKind.Custom)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Arg_PaperSizeNotCustom"));
                                        }
                                        height = value;
                                }
                        }
        public PaperKind Kind
                        {
                                get
                                {
                                        return kind;
                                }
                        }
        public String PaperName
                        {
                                get
                                {
                                        return name;
                                }
                                set
                                {
                                        if(kind != PaperKind.Custom)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Arg_PaperSizeNotCustom"));
                                        }
                                        name = value;
                                }
                        }
        public int Width
                        {
                                get
                                {
                                        return width;
                                }
                                set
                                {
                                        if(kind != PaperKind.Custom)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Arg_PaperSizeNotCustom"));
                                        }
                                        width = value;
                                }
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                StringBuilder builder = new StringBuilder();
                                builder.Append("[PaperSize ");
                                builder.Append(name);
                                builder.Append(" Kind=");
                                builder.Append(kind.ToString());
                                builder.Append(" Height=");
                                builder.Append(height.ToString());
                                builder.Append(" Width=");
                                builder.Append(width.ToString());
                                builder.Append(']');
                                return builder.ToString();
                        }

}; // class PaperSize

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PaperSource.cs - Implementation of the
 *                      "System.Drawing.Printing.PaperSource" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.Text;

public class PaperSource
{
        // Internal state.
        private PaperSourceKind kind;
        private String name;

        // Constructor.
        internal PaperSource(PaperSourceKind kind, String name)
                        {
                                this.kind = kind;
                                if(name == null)
                                {
                                        this.name = kind.ToString();
                                }
                                else
                                {
                                        this.name = name;
                                }
                        }

        // Get the paper kind.
        public PaperSourceKind Kind
                        {
                                get
                                {
                                        return kind;
                                }
                        }
        public String SourceName
                        {
                                get
                                {
                                        return name;
                                }
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                StringBuilder builder = new StringBuilder();
                                builder.Append("[PaperSource ");
                                builder.Append(name);
                                builder.Append(" Kind=");
                                builder.Append(kind.ToString());
                                builder.Append(']');
                                return builder.ToString();
                        }

}; // class PaperSource

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PaperSourceKind.cs - Implementation of the
 *                      "System.Drawing.Printing.PaperSourceKind" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum PaperSourceKind
{
        Upper                   = 1,
        Lower                   = 2,
        Middle                  = 3,
        Manual                  = 4,
        Envelope                = 5,
        ManualFeed              = 6,
        AutomaticFeed   = 7,
        TractorFeed             = 8,
        SmallFormat             = 9,
        LargeFormat             = 10,
        LargeCapacity   = 11,
        Cassette                = 14,
        FormSource              = 15,
        Custom                  = 257

}; // enum PaperSourceKind

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PreviewPageInfo.cs - Implementation of the
 *                      "System.Drawing.Printing.PreviewPageInfo" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public sealed class PreviewPageInfo
{
        // Internal state.
        private Image image;
        private Size physicalSize;

        // Constructor.
        public PreviewPageInfo(Image image, Size physicalSize)
                        {
                                this.image = image;
                                this.physicalSize = physicalSize;
                        }

        // Get this object's properties.
        public Image Image
                        {
                                get
                                {
                                        return image;
                                }
                        }
        public Size PhysicalSize
                        {
                                get
                                {
                                        return physicalSize;
                                }
                        }

}; // class PreviewPageInfo

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PreviewPrintController.cs - Implementation of the
 *                      "System.Drawing.Printing.PreviewPrintController" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public class PreviewPrintController : PrintController
{
        // Internal state.
        private bool useAntiAlias;

        // Constructor.
        public PreviewPrintController()
                        {
                                this.useAntiAlias = false;
                        }

        // Get or set the anti-alias property.
        public virtual bool UseAntiAlias
                        {
                                get
                                {
                                        return useAntiAlias;
                                }
                                set
                                {
                                        useAntiAlias = value;
                                }
                        }

        // Get the page preview information for all pages.
        [TODO]
        public PreviewPageInfo[] GetPreviewPageInfo()
                        {
                                // TODO
                                return null;
                        }

        // Event that is emitted at the end of a page.
        [TODO]
        public override void OnEndPage
                                (PrintDocument document, PrintPageEventArgs e)
                        {
                                // TODO
                                base.OnEndPage(document, e);
                        }

        // Event that is emitted at the end of the print process.
        [TODO]
        public override void OnEndPrint
                                (PrintDocument document, PrintEventArgs e)
                        {
                                // TODO
                                base.OnEndPrint(document, e);
                        }

        // Event that is emitted at the start of a page.
        [TODO]
        public override void OnStartPage
                                (PrintDocument document, PrintPageEventArgs e)
                        {
                                // TODO
                                base.OnStartPage(document, e);
                        }

        // Event that is emitted at the start of the print process.
        [TODO]
        public override void OnStartPrint
                                (PrintDocument document, PrintEventArgs e)
                        {
                                // TODO
                                base.OnStartPrint(document, e);
                        }

}; // class PreviewPrintController

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintController.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintController" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public abstract class PrintController
{
        // Constructor.
        public PrintController() {}

        // Event that is emitted at the end of a page.
        public virtual void OnEndPage
                                (PrintDocument document, PrintPageEventArgs e)
                        {
                                // Nothing to do here.
                        }

        // Event that is emitted at the end of the print process.
        public virtual void OnEndPrint
                                (PrintDocument document, PrintEventArgs e)
                        {
                                // Nothing to do here.
                        }

        // Event that is emitted at the start of a page.
        public virtual void OnStartPage
                                (PrintDocument document, PrintPageEventArgs e)
                        {
                                // Nothing to do here.
                        }

        // Event that is emitted at the start of the print process.
        public virtual void OnStartPrint
                                (PrintDocument document, PrintEventArgs e)
                        {
                                // Nothing to do here.
                        }

}; // class PrintController

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintDocument.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintDocument" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.ComponentModel;

public class PrintDocument : Component
{
        // Internal state.
        private PageSettings defaultPageSettings;
        private String documentName;
        private bool originAtMargins;
        private PrintController printController;
        private PrinterSettings printerSettings;

        // Constructor.
        public PrintDocument()
                        {
                                this.documentName = "document";
                                this.originAtMargins = false;
                                this.printController = null;
                                this.printerSettings = new PrinterSettings();
                                this.defaultPageSettings = new 
PageSettings(printerSettings);
                        }

        // Get or set the document's properties.
        public PageSettings DefaultPageSettings
                        {
                                get
                                {
                                        return defaultPageSettings;
                                }
                                set
                                {
                                        defaultPageSettings = value;
                                }
                        }
        public String DocumentName
                        {
                                get
                                {
                                        return documentName;
                                }
                                set
                                {
                                        documentName = value;
                                }
                        }
        public bool OriginAtMargins
                        {
                                get
                                {
                                        return originAtMargins;
                                }
                                set
                                {
                                        originAtMargins = value;
                                }
                        }
        [TODO]
        public PrintController PrintController
                        {
                                get
                                {
                                        if(printController == null)
                                        {
                                                // Create a standard print 
controller.
                                                printController = new 
StandardPrintController();

                                                // TODO: wrap the controller 
with a status dialog.
                                        }
                                        return printController;
                                }
                                set
                                {
                                        printController = value;
                                }
                        }
        public PrinterSettings PrinterSettings
                        {
                                get
                                {
                                        return printerSettings;
                                }
                                set
                                {
                                        printerSettings = value;
                                }
                        }

        // Print the document.
        [TODO]
        public void Print()
                        {
                                // TODO
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                return "[PrintDocument " + documentName + "]";
                        }

        // Event that is emitted at the beginning of the print process.
        public event PrintEventHandler BeginPrint;

        // Event that is emitted at the end of the print process.
        public event PrintEventHandler EndPrint;

        // Event that is emitted to print the current page.
        public event PrintPageEventHandler PrintPage;

        // Event that is emitted to query page settings prior to printing a 
page.
        public event QueryPageSettingsEventHandler QueryPageSettings;

        // Raise the "BeginPrint" event.
        protected virtual void OnBeginPrint(PrintEventArgs e)
                        {
                                if(BeginPrint != null)
                                {
                                        BeginPrint(this, e);
                                }
                        }

        // Raise the "EndPrint" event.
        protected virtual void OnEndPrint(PrintEventArgs e)
                        {
                                if(EndPrint != null)
                                {
                                        EndPrint(this, e);
                                }
                        }

        // Raise the "PrintPage" event.
        protected virtual void OnPrintPage(PrintPageEventArgs e)
                        {
                                if(PrintPage != null)
                                {
                                        PrintPage(this, e);
                                }
                        }

        // Raise the "QueryPageSettings" event.
        protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e)
                        {
                                if(QueryPageSettings != null)
                                {
                                        QueryPageSettings(this, e);
                                }
                        }

}; // class PrintDocument

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintEventArgs.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintEventArgs" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.ComponentModel;

public class PrintEventArgs : CancelEventArgs
{

        // Constructor.
        public PrintEventArgs() {}

}; // class PrintEventArgs

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintEventHandler.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintEventHandler" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public delegate void PrintEventHandler(Object sender, PrintEventArgs e);

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintPageEventArgs.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintPageEventArgs" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public class PrintPageEventArgs : EventArgs
{
        // Internal state.
        private bool cancel;
        private bool hasMorePages;
        private Graphics graphics;
        private Rectangle marginBounds;
        private Rectangle pageBounds;
        private PageSettings pageSettings;

        // Constructor.
        public PrintPageEventArgs(Graphics graphics,
                                                          Rectangle 
marginBounds,
                                                          Rectangle pageBounds,
                                                          PageSettings 
pageSettings)
                        {
                                this.cancel = false;
                                this.hasMorePages = false;
                                this.graphics = graphics;
                                this.marginBounds = marginBounds;
                                this.pageBounds = pageBounds;
                                this.pageSettings = pageSettings;
                        }

        // Event properties.
        public bool Cancel
                        {
                                get
                                {
                                        return cancel;
                                }
                                set
                                {
                                        cancel = value;
                                }
                        }
        public Graphics Graphics
                        {
                                get
                                {
                                        return graphics;
                                }
                        }
        public bool HasMorePages
                        {
                                get
                                {
                                        return hasMorePages;
                                }
                                set
                                {
                                        hasMorePages = value;
                                }
                        }
        public Rectangle MarginBounds
                        {
                                get
                                {
                                        return marginBounds;
                                }
                        }
        public Rectangle PageBounds
                        {
                                get
                                {
                                        return pageBounds;
                                }
                        }
        public PageSettings PageSettings
                        {
                                get
                                {
                                        return pageSettings;
                                }
                        }

}; // class PrintPageEventArgs

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintPageEventHandler.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintPageEventHandler" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public delegate void PrintPageEventHandler
                (Object sender, PrintPageEventArgs e);

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintRange.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintRange" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum PrintRange
{
        AllPages        = 0,
        Selection       = 1,
        SomePages       = 2

}; // enum PrintRange

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrinterResolution.cs - Implementation of the
 *                      "System.Drawing.Printing.PrinterResolution" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public class PrinterResolution
{
        // Internal state.
        private PrinterResolutionKind kind;
        private int x;
        private int y;

        // Constructors.
        internal PrinterResolution(PrinterResolutionKind kind, int x, int y)
                        {
                                this.kind = kind;
                                this.x = x;
                                this.y = y;
                        }

        // Get this object's properties.
        public PrinterResolutionKind Kind
                        {
                                get
                                {
                                        return kind;
                                }
                        }
        public int X
                        {
                                get
                                {
                                        return x;
                                }
                        }
        public int Y
                        {
                                get
                                {
                                        return y;
                                }
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                return "[PrinterResolution " + kind.ToString() 
+ "]";
                        }

}; // class PrinterResolution

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrinterResolutionKind.cs - Implementation of the
 *                      "System.Drawing.Printing.PrinterResolutionKind" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum PrinterResolutionKind
{
        High    = -4,
        Medium  = -3,
        Low             = -2,
        Draft   = -1,
        Custom  = 0

}; // enum PrinterResolutionKind

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrinterSettings.cs - Implementation of the
 *                      "System.Drawing.Printing.PrinterSettings" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.Drawing.Toolkit;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Collections;

[Serializable]
[ComVisible(false)]
public class PrinterSettings : ICloneable
{
        // Internal state.
        private bool collate;
        private int copies;
        private PageSettings defaultPageSettings;
        private Duplex duplex;
        private int fromPage;
        private int landscapeAngle;
        private int maximumCopies;
        private int maximumPage;
        private int minimumPage;
        private String printerName;
        private PrintRange printRange;
        private bool printToFile;
        private int toPage;
        private IToolkitPrinter toolkitPrinter;

        // Constructor.
        public PrinterSettings()
                        {
                                collate = false;
                                copies = 1;
                                duplex = Duplex.Default;
                                fromPage = 0;
                                landscapeAngle = 0;
                                maximumCopies = 1;
                                maximumPage = 9999;
                                minimumPage = 0;
                                printerName = null;
                                printRange = PrintRange.AllPages;
                                printToFile = false;
                                toPage = 0;
                                toolkitPrinter = null;
                        }

        // Get or set this object's properties.
        public bool CanDuplex
                        {
                                get
                                {
                                        return ToolkitPrinter.CanDuplex;
                                }
                        }
        public bool Collate
                        {
                                get
                                {
                                        return collate;
                                }
                                set
                                {
                                        collate = value;
                                }
                        }
        public int Copies
                        {
                                get
                                {
                                        return copies;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"));
                                        }
                                        copies = value;
                                }
                        }
        public PageSettings DefaultPageSettings
                        {
                                get
                                {
                                        if(defaultPageSettings == null)
                                        {
                                                LoadDefaults();
                                        }
                                        return defaultPageSettings;
                                }
                        }
        public Duplex Duplex
                        {
                                get
                                {
                                        return duplex;
                                }
                                set
                                {
                                        duplex = value;
                                }
                        }
        public int FromPage
                        {
                                get
                                {
                                        return fromPage;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"));
                                        }
                                        fromPage = value;
                                }
                        }
        public bool IsDefaultPrinter
                        {
                                get
                                {
                                        return (printerName == null);
                                }
                        }
        public bool IsPlotter
                        {
                                get
                                {
                                        return ToolkitPrinter.IsPlotter;
                                }
                        }
        public bool IsValid
                        {
                                get
                                {
                                        lock(this)
                                        {
                                                if(toolkitPrinter != null)
                                                {
                                                        return true;
                                                }
                                                toolkitPrinter =
                                                        
ToolkitManager.PrintingSystem.GetPrinter
                                                                (printerName);
                                                return (toolkitPrinter != null);
                                        }
                                }
                        }
        public int LandscapeAngle
                        {
                                get
                                {
                                        return landscapeAngle;
                                }
                                set
                                {
                                        landscapeAngle = value;
                                }
                        }
        public int MaximumCopies
                        {
                                get
                                {
                                        return maximumCopies;
                                }
                        }
        public int MaximumPage
                        {
                                get
                                {
                                        return maximumPage;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"));
                                        }
                                        maximumPage = value;
                                }
                        }
        public int MinimumPage
                        {
                                get
                                {
                                        return minimumPage;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"));
                                        }
                                        minimumPage = value;
                                }
                        }
        public String PrinterName
                        {
                                get
                                {
                                        if(printerName == null)
                                        {
                                                return 
ToolkitManager.PrintingSystem.DefaultPrinterName;
                                        }
                                        return printerName;
                                }
                                set
                                {
                                        lock(this)
                                        {
                                                printerName = value;
                                                toolkitPrinter = null;
                                        }
                                }
                        }
        public PrintRange PrintRange
                        {
                                get
                                {
                                        return printRange;
                                }
                                set
                                {
                                        printRange = value;
                                }
                        }
        public bool PrintToFile
                        {
                                get
                                {
                                        return printToFile;
                                }
                                set
                                {
                                        printToFile = true;
                                }
                        }
        public bool SupportsColor
                        {
                                get
                                {
                                        return ToolkitPrinter.SupportsColor;
                                }
                        }
        public int ToPage
                        {
                                get
                                {
                                        return toPage;
                                }
                                set
                                {
                                        if(value < 0)
                                        {
                                                throw new ArgumentException
                                                        
(S._("ArgRange_NonNegative"));
                                        }
                                        toPage = value;
                                }
                        }

        // Get the toolkit version of a printer.
        internal IToolkitPrinter ToolkitPrinter
                        {
                                get
                                {
                                        lock(this)
                                        {
                                                if(toolkitPrinter == null)
                                                {
                                                        toolkitPrinter =
                                                                
ToolkitManager.PrintingSystem.GetPrinter
                                                                        
(printerName);
                                                        if(toolkitPrinter == 
null)
                                                        {
                                                                throw new 
InvalidPrinterException(this);
                                                        }
                                                }
                                                return toolkitPrinter;
                                        }
                                }
                        }

        // Get a list of all installed printers on this system.
        public static StringCollection InstalledPrinters
                        {
                                get
                                {
                                        return new StringCollection
                                                
(ToolkitManager.PrintingSystem.InstalledPrinters);
                                }
                        }

        // Get a list of all paper sizes that are supported by this printer.
        public PaperSizeCollection PaperSizes
                        {
                                get
                                {
                                        return new 
PaperSizeCollection(ToolkitPrinter.PaperSizes);
                                }
                        }

        // Get a list of all paper sources that are supported by this printer.
        public PaperSourceCollection PaperSources
                        {
                                get
                                {
                                        return new PaperSourceCollection
                                                (ToolkitPrinter.PaperSources);
                                }
                        }

        // Get a list of all resolutions that are supported by this printer.
        public PrinterResolutionCollection PrinterResolutions
                        {
                                get
                                {
                                        return new PrinterResolutionCollection
                                                
(ToolkitPrinter.PrinterResolutions);
                                }
                        }

        // Clone this object.
        public Object Clone()
                        {
                                return MemberwiseClone();
                        }

        // Create a graphics object that can be used to perform text 
measurement.
        public Graphics CreateMeasurementGraphics()
                        {
                                return ToolkitManager.CreateGraphics
                                        
(ToolkitPrinter.CreateMeasurementGraphics());
                        }

        // Get the Win32-specific DEVMODE information for these printer 
settings.
        public IntPtr GetHdevmode()
                        {
                                return GetHdevmode(null);
                        }
        public IntPtr GetHdevmode(PageSettings pageSettings)
                        {
                                throw new Win32Exception
                                        (0, S._("NotSupp_CannotGetDevMode"));
                        }

        // Get the Win32-specific DEVNAMES information for these printer 
settings.
        public IntPtr GetHdevnames()
                        {
                                throw new Win32Exception
                                        (0, S._("NotSupp_CannotGetDevNames"));
                        }

        // Set the DEVMODE information from a Win32-specific structure.
        public void SetHdevmode(IntPtr hdevmode)
                        {
                                // Not used in this implementation.
                        }

        // Set the DEVNAMES information from a Win32-specific structure.
        public void SetHdevnames(IntPtr hdevnames)
                        {
                                // Not used in this implementation.
                        }

        // Convert this object into a string.
        public override String ToString()
                        {
                                StringBuilder builder = new StringBuilder();
                                builder.Append("[PrinterSettings ");
                                builder.Append(PrinterName);
                                builder.Append(" Copies=");
                                builder.Append(Copies.ToString());
                                builder.Append(" Collate=");
                                builder.Append(Collate.ToString());
                                builder.Append(" Duplex=");
                                builder.Append(Duplex.ToString());
                                builder.Append(" FromPage=");
                                builder.Append(FromPage.ToString());
                                builder.Append(" LandscapeAngle=");
                                builder.Append(LandscapeAngle.ToString());
                                builder.Append(" MaximumCopies=");
                                builder.Append(MaximumCopies.ToString());
                                builder.Append(" OutputPort=");
                                
builder.Append(ToolkitPrinter.OutputPort.ToString());
                                builder.Append(" ToPage=");
                                builder.Append(ToPage.ToString());
                                builder.Append(']');
                                return builder.ToString();
                        }

        // Load the default page settings for the printer.
        private void LoadDefaults()
                        {
                                // Initialize the defaults object.
                                PageSettings defaults = new PageSettings();
                                defaults.Color = false;
                                defaults.Landscape = false;
                                defaults.PaperSize = new 
PaperSize(PaperKind.Letter);
                                defaults.PaperSource =
                                        new 
PaperSource(PaperSourceKind.AutomaticFeed, null);
                                defaults.PrinterResolution =
                                        new PrinterResolution
                                                (PrinterResolutionKind.Medium, 
300, 300);
                                defaultPageSettings = defaults;

                                // Load printer-specific overrides from the 
system.
                                ToolkitPrinter.LoadDefaults(defaults);
                        }

        // Collection of paper sizes for a printer.
        public class PaperSizeCollection : ICollection, IEnumerable
        {
                // Internal state.
                private PaperSize[] array;

                // Constructor.
                public PaperSizeCollection(PaperSize[] array)
                                {
                                        this.array = array;
                                }

                // Get a specific element within this collection.
                public virtual PaperSize this[int index]
                                {
                                        get
                                        {
                                                return array[index];
                                        }
                                }

                // Implement the ICollection interface.
                void ICollection.CopyTo(Array array, int index)
                                {
                                        this.array.CopyTo(array, index);
                                }
                public int Count
                                {
                                        get
                                        {
                                                return array.Length;
                                        }
                                }
                bool ICollection.IsSynchronized
                                {
                                        get
                                        {
                                                return false;
                                        }
                                }
                Object ICollection.SyncRoot
                                {
                                        get
                                        {
                                                return this;
                                        }
                                }

                // Implement the IEnumerable interface.
                public IEnumerator GetEnumerator()
                                {
                                        return array.GetEnumerator();
                                }

        }; // class PaperSizeCollection

        // Collection of paper sources for a printer.
        public class PaperSourceCollection : ICollection, IEnumerable
        {
                // Internal state.
                private PaperSource[] array;

                // Constructor.
                public PaperSourceCollection(PaperSource[] array)
                                {
                                        this.array = array;
                                }

                // Get a specific element within this collection.
                public virtual PaperSource this[int index]
                                {
                                        get
                                        {
                                                return array[index];
                                        }
                                }

                // Implement the ICollection interface.
                void ICollection.CopyTo(Array array, int index)
                                {
                                        this.array.CopyTo(array, index);
                                }
                public int Count
                                {
                                        get
                                        {
                                                return array.Length;
                                        }
                                }
                bool ICollection.IsSynchronized
                                {
                                        get
                                        {
                                                return false;
                                        }
                                }
                Object ICollection.SyncRoot
                                {
                                        get
                                        {
                                                return this;
                                        }
                                }

                // Implement the IEnumerable interface.
                public IEnumerator GetEnumerator()
                                {
                                        return array.GetEnumerator();
                                }

        }; // class PaperSourceCollection

        // Collection of printer resolutions for a printer.
        public class PrinterResolutionCollection : ICollection, IEnumerable
        {
                // Internal state.
                private PrinterResolution[] array;

                // Constructor.
                public PrinterResolutionCollection(PrinterResolution[] array)
                                {
                                        this.array = array;
                                }

                // Get a specific element within this collection.
                public virtual PrinterResolution this[int index]
                                {
                                        get
                                        {
                                                return array[index];
                                        }
                                }

                // Implement the ICollection interface.
                void ICollection.CopyTo(Array array, int index)
                                {
                                        this.array.CopyTo(array, index);
                                }
                public int Count
                                {
                                        get
                                        {
                                                return array.Length;
                                        }
                                }
                bool ICollection.IsSynchronized
                                {
                                        get
                                        {
                                                return false;
                                        }
                                }
                Object ICollection.SyncRoot
                                {
                                        get
                                        {
                                                return this;
                                        }
                                }

                // Implement the IEnumerable interface.
                public IEnumerator GetEnumerator()
                                {
                                        return array.GetEnumerator();
                                }

        }; // class PrinterResolutionCollection

        // String collection for printer names.
        public class StringCollection : ICollection, IEnumerable
        {
                // Internal state.
                private String[] array;

                // Constructor.
                public StringCollection(String[] array)
                                {
                                        this.array = array;
                                }

                // Get a specific element within this collection.
                public virtual String this[int index]
                                {
                                        get
                                        {
                                                return array[index];
                                        }
                                }

                // Implement the ICollection interface.
                void ICollection.CopyTo(Array array, int index)
                                {
                                        this.array.CopyTo(array, index);
                                }
                public int Count
                                {
                                        get
                                        {
                                                return array.Length;
                                        }
                                }
                bool ICollection.IsSynchronized
                                {
                                        get
                                        {
                                                return false;
                                        }
                                }
                Object ICollection.SyncRoot
                                {
                                        get
                                        {
                                                return this;
                                        }
                                }

                // Implement the IEnumerable interface.
                public IEnumerator GetEnumerator()
                                {
                                        return array.GetEnumerator();
                                }

        }; // class StringCollection

}; // class PrinterSettings

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrinterUnit.cs - Implementation of the
 *                      "System.Drawing.Printing.PrinterUnit" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum PrinterUnit
{
        Display                                 = 0,
        ThousandthsOfAnInch             = 1,
        HundredthsOfAMillimeter = 2,
        TenthsOfAMillimeter             = 3

}; // enum PrinterUnit

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrinterUnitConvert.cs - Implementation of the
 *                      "System.Drawing.Printing.PrinterUnitConvert" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public sealed class PrinterUnitConvert
{
        // Cannot instantiate this class.
        private PrinterUnitConvert() {}

        // Convert from one unit to another.
        public static double Convert
                                (double value, PrinterUnit fromUnit, 
PrinterUnit toUnit)
                        {
                                switch(fromUnit)
                                {
                                        case PrinterUnit.Display:
                                        {
                                                switch(toUnit)
                                                {
                                                        case 
PrinterUnit.Display: break;

                                                        case 
PrinterUnit.ThousandthsOfAnInch:
                                                        {
                                                                value /= 10.0;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.HundredthsOfAMillimeter:
                                                        {
                                                                value *= 
0.00245;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.TenthsOfAMillimeter:
                                                        {
                                                                value *= 0.0245;
                                                        }
                                                        break;
                                                }
                                        }
                                        break;

                                        case PrinterUnit.ThousandthsOfAnInch:
                                        {
                                                switch(toUnit)
                                                {
                                                        case 
PrinterUnit.Display:
                                                        {
                                                                value *= 10.0;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.ThousandthsOfAnInch: break;

                                                        case 
PrinterUnit.HundredthsOfAMillimeter:
                                                        {
                                                                value *= 
0.000245;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.TenthsOfAMillimeter:
                                                        {
                                                                value *= 
0.00245;
                                                        }
                                                        break;
                                                }
                                        }
                                        break;

                                        case 
PrinterUnit.HundredthsOfAMillimeter:
                                        {
                                                switch(toUnit)
                                                {
                                                        case 
PrinterUnit.Display:
                                                        {
                                                                value /= 
0.00245;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.ThousandthsOfAnInch:
                                                        {
                                                                value /= 
0.000245;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.HundredthsOfAMillimeter: break;

                                                        case 
PrinterUnit.TenthsOfAMillimeter:
                                                        {
                                                                value /= 10.0;
                                                        }
                                                        break;
                                                }
                                        }
                                        break;

                                        case PrinterUnit.TenthsOfAMillimeter:
                                        {
                                                switch(toUnit)
                                                {
                                                        case 
PrinterUnit.Display:
                                                        {
                                                                value = value / 
0.0245;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.ThousandthsOfAnInch:
                                                        {
                                                                value = value / 
0.00245;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.HundredthsOfAMillimeter:
                                                        {
                                                                value *= 10.0;
                                                        }
                                                        break;

                                                        case 
PrinterUnit.TenthsOfAMillimeter: break;
                                                }
                                        }
                                        break;
                                }
                                return value;
                        }
        public static int Convert
                                (int value, PrinterUnit fromUnit, PrinterUnit 
toUnit)
                        {
                                return (int)Math.Round
                                        (Convert((double)value, fromUnit, 
toUnit));
                        }
        public static Margins Convert
                                (Margins value, PrinterUnit fromUnit, 
PrinterUnit toUnit)
                        {
                                return new Margins
                                        (Convert(value.Left, fromUnit, toUnit),
                                         Convert(value.Right, fromUnit, toUnit),
                                         Convert(value.Top, fromUnit, toUnit),
                                         Convert(value.Bottom, fromUnit, 
toUnit));
                        }
        public static Point Convert
                                (Point value, PrinterUnit fromUnit, PrinterUnit 
toUnit)
                        {
                                return new Point(Convert(value.X, fromUnit, 
toUnit),
                                                                 
Convert(value.Y, fromUnit, toUnit));
                        }
        public static Rectangle Convert
                                (Rectangle value, PrinterUnit fromUnit, 
PrinterUnit toUnit)
                        {
                                return new Rectangle(Convert(value.X, fromUnit, 
toUnit),
                                                                     
Convert(value.Y, fromUnit, toUnit),
                                                                     
Convert(value.Width, fromUnit, toUnit),
                                                                     
Convert(value.Height, fromUnit, toUnit));
                        }
        public static Size Convert
                                (Size value, PrinterUnit fromUnit, PrinterUnit 
toUnit)
                        {
                                return new Size(Convert(value.Width, fromUnit, 
toUnit),
                                                                
Convert(value.Height, fromUnit, toUnit));
                        }

}; // class PrinterUnitConvert

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintingPermission.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintingPermission" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System.Security;
using System.Security.Permissions;

#if !ECMA_COMPAT
[Serializable]
#endif
public sealed class PrintingPermission : CodeAccessPermission
#if !ECMA_COMPAT
        , IUnrestrictedPermission
#endif
{
        // Internal state.
        private PermissionState state;
        private PrintingPermissionLevel level;

        // Constructor.
        public PrintingPermission(PermissionState state)
                        {
                                this.state = state;
                                this.level = PrintingPermissionLevel.NoPrinting;
                        }
        public PrintingPermission(PrintingPermissionLevel level)
                        {
                                this.state = PermissionState.None;
                                this.level = level;
                        }

        // Convert an XML value into a permissions value.
        public override void FromXml(SecurityElement esd)
                        {
                                String value;
                                if(esd == null)
                                {
                                        throw new ArgumentNullException("esd");
                                }
                                if(esd.Attribute("version") != "1")
                                {
                                        throw new 
ArgumentException(S._("Arg_PermissionVersion"));
                                }
                                value = esd.Attribute("Unrestricted");
                                if(value != null && Boolean.Parse(value))
                                {
                                        state = PermissionState.Unrestricted;
                                }
                                else
                                {
                                        state = PermissionState.None;
                                }
                                value = esd.Attribute("Level");
                                if(value != null)
                                {
                                        level = (PrintingPermissionLevel)
                                                
Enum.Parse(typeof(PrintingPermissionLevel), value);
                                }
                                else
                                {
                                        level = 
PrintingPermissionLevel.NoPrinting;
                                }
                        }

        // Convert this permissions object into an XML value.
        public override SecurityElement ToXml()
                        {
                                SecurityElement element;
                                element = new SecurityElement("IPermission");
                                element.AddAttribute
                                        ("class",
                                         
SecurityElement.Escape(typeof(PrintingPermission).
                                                                                
        AssemblyQualifiedName));
                                element.AddAttribute("version", "1");
                                if(level != PrintingPermissionLevel.NoPrinting)
                                {
                                        element.AddAttribute("Level", 
level.ToString());
                                }
                                else if(state == PermissionState.Unrestricted)
                                {
                                        element.AddAttribute("Unrestricted", 
"true");
                                }
                                return element;
                        }

        // Implement the IPermission interface.
        public override IPermission Copy()
                        {
                                if(level != PrintingPermissionLevel.NoPrinting)
                                {
                                        return new PrintingPermission(level);
                                }
                                else
                                {
                                        return new PrintingPermission(state);
                                }
                        }
        public override IPermission Intersect(IPermission target)
                        {
                                PrintingPermissionLevel newLevel;
                                if(target == null)
                                {
                                        return target;
                                }
                                else if(!(target is PrintingPermission))
                                {
                                        throw new 
ArgumentException(S._("Arg_PermissionMismatch"));
                                }
                                else 
if(((PrintingPermission)target).IsUnrestricted())
                                {
                                        if(IsUnrestricted())
                                        {
                                                return Copy();
                                        }
                                        else
                                        {
                                                newLevel = level;
                                        }
                                }
                                else if(IsUnrestricted())
                                {
                                        newLevel = 
((PrintingPermission)target).level;
                                }
                                else
                                {
                                        newLevel = 
((PrintingPermission)target).level;
                                        if(newLevel > level)
                                        {
                                                newLevel = level;
                                        }
                                }
                                if(newLevel == 
PrintingPermissionLevel.NoPrinting)
                                {
                                        return null;
                                }
                                else
                                {
                                        return new PrintingPermission(newLevel);
                                }
                        }
        public override bool IsSubsetOf(IPermission target)
                        {
                                if(target == null)
                                {
                                        return (level == 
PrintingPermissionLevel.NoPrinting);
                                }
                                else if(!(target is PrintingPermission))
                                {
                                        throw new ArgumentException
                                                (S._("Arg_PermissionMismatch"));
                                }
                                else 
if(((PrintingPermission)target).IsUnrestricted())
                                {
                                        return true;
                                }
                                else if(IsUnrestricted())
                                {
                                        return false;
                                }
                                else
                                {
                                        return (level <= 
((PrintingPermission)target).level);
                                }
                        }
        public override IPermission Union(IPermission target)
                        {
                                if(target == null)
                                {
                                        return Copy();
                                }
                                else if(!(target is PrintingPermission))
                                {
                                        throw new ArgumentException
                                                (S._("Arg_PermissionMismatch"));
                                }
                                else if(IsUnrestricted() ||
                                        
((PrintingPermission)target).IsUnrestricted())
                                {
                                        return new PrintingPermission
                                                (PermissionState.Unrestricted);
                                }
                                else
                                {
                                        PrintingPermissionLevel newLevel;
                                        newLevel = 
((PrintingPermission)target).level;
                                        if(newLevel < level)
                                        {
                                                newLevel = level;
                                        }
                                        return new PrintingPermission(newLevel);
                                }
                        }

        // Determine if this object has unrestricted permissions.
#if !ECMA_COMPAT
        public bool IsUnrestricted()
                        {
                                return (state == PermissionState.Unrestricted);
                        }
#endif

        // Get or set the level on this permissions object.
        public PrintingPermissionLevel Level
                        {
                                get
                                {
                                        return level;
                                }
                                set
                                {
                                        level = value;
                                }
                        }

}; // class PrintingPermission

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintingPermissionAttribute.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintingPermissionAttribute" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

using System;
using System.Security;
using System.Security.Permissions;

[AttributeUsage(AttributeTargets.All)]
public sealed class PrintingPermissionAttribute : CodeAccessSecurityAttribute
{
        // Internal state.
        private PrintingPermissionLevel level;

        // Constructors.
        public PrintingPermissionAttribute(SecurityAction action)
                        : base(action)
                        {
                                // Nothing to do here.
                        }

        // Get or set the printing permission level.
        public PrintingPermissionLevel Level
                        {
                                get
                                {
                                        return level;
                                }
                                set
                                {
                                        level = value;
                                }
                        }

        // Create a permission object that corresponds to this attribute.
        public override IPermission CreatePermission()
                        {
                                if(Unrestricted)
                                {
                                        return new PrintingPermission
                                                (PermissionState.Unrestricted);
                                }
                                else
                                {
                                        return new PrintingPermission(level);
                                }
                        }

}; // class PrintingPermissionAttribute

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * PrintingPermissionLevel.cs - Implementation of the
 *                      "System.Drawing.Printing.PrintingPermissionLevel" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public enum PrintingPermissionLevel
{
        NoPrinting              = 0,
        SafePrinting    = 1,
        DefaultPrinting = 2,
        AllPrinting             = 3

}; // enum PrintingPermissionLevel

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * QueryPageSettingsEventArgs.cs - Implementation of the
 *                      "System.Drawing.Printing.QueryPageSettingsEventArgs" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public class QueryPageSettingsEventArgs : PrintEventArgs
{
        // Internal state.
        private PageSettings pageSettings;

        // Constructor.
        public QueryPageSettingsEventArgs(PageSettings pageSettings)
                        {
                                this.pageSettings = pageSettings;
                        }

        // Get or set the page settings.
        public PageSettings PageSettings
                        {
                                get
                                {
                                        return pageSettings;
                                }
                                set
                                {
                                        pageSettings = value;
                                }
                        }

}; // class QueryPageSettingsEventArgs

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * QueryPageSettingsEventHandler.cs - Implementation of the
 *                      "System.Drawing.Printing.QueryPageSettingsEventHandler" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public delegate void QueryPageSettingsEventHandler
                (Object sender, QueryPageSettingsEventArgs e);

}; // namespace System.Drawing.Printing

--- NEW FILE ---
/*
 * StandardPrintController.cs - Implementation of the
 *                      "System.Drawing.Printing.StandardPrintController" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Drawing.Printing
{

public class StandardPrintController : PrintController
{
        // Constructor.
        public StandardPrintController() {}

        // Event that is emitted at the end of a page.
        [TODO]
        public override void OnEndPage
                                (PrintDocument document, PrintPageEventArgs e)
                        {
                                // TODO
                                base.OnEndPage(document, e);
                        }

        // Event that is emitted at the end of the print process.
        [TODO]
        public override void OnEndPrint
                                (PrintDocument document, PrintEventArgs e)
                        {
                                // TODO
                                base.OnEndPrint(document, e);
                        }

        // Event that is emitted at the start of a page.
        [TODO]
        public override void OnStartPage
                                (PrintDocument document, PrintPageEventArgs e)
                        {
                                // TODO
                                base.OnStartPage(document, e);
                        }

        // Event that is emitted at the start of the print process.
        [TODO]
        public override void OnStartPrint
                                (PrintDocument document, PrintEventArgs e)
                        {
                                // TODO
                                base.OnStartPrint(document, e);
                        }

}; // class StandardPrintController

}; // namespace System.Drawing.Printing





reply via email to

[Prev in Thread] Current Thread [Next in Thread]