You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Duplex.cs
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
[Serializable]
|
||||
public enum Duplex {
|
||||
Default = -1,
|
||||
Horizontal = 3,
|
||||
Simplex = 1,
|
||||
Vertical = 2
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
//
|
||||
// System.Drawing.InvalidPrinterExecption.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Drawing.Printing {
|
||||
|
||||
[Serializable]
|
||||
public class InvalidPrinterException : SystemException {
|
||||
|
||||
// private PrinterSettings settings;
|
||||
|
||||
public InvalidPrinterException (PrinterSettings settings): base(InvalidPrinterException.GetMessage(settings))
|
||||
{
|
||||
// this.settings = settings;
|
||||
}
|
||||
|
||||
#if !NETSTANDARD1_6
|
||||
protected InvalidPrinterException (SerializationInfo info, StreamingContext context)
|
||||
: base (info, context)
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetObjectData (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException ("info");
|
||||
|
||||
base.GetObjectData (info, context);
|
||||
}
|
||||
#endif
|
||||
|
||||
private static string GetMessage(PrinterSettings settings)
|
||||
{
|
||||
if (settings.PrinterName == null || settings.PrinterName == String.Empty)
|
||||
return "No Printers Installed";
|
||||
return String.Format("Tried to access printer '{0}' with invalid settings.", settings.PrinterName);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,155 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Margins.cs
|
||||
//
|
||||
// Authors:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
[Serializable]
|
||||
[TypeConverter (typeof (MarginsConverter))]
|
||||
public class Margins : ICloneable {
|
||||
int left;
|
||||
int right;
|
||||
int top;
|
||||
int bottom;
|
||||
|
||||
public Margins ()
|
||||
{
|
||||
left = 100;
|
||||
right = 100;
|
||||
top = 100;
|
||||
bottom = 100;
|
||||
}
|
||||
|
||||
public Margins (int left, int right, int top, int bottom)
|
||||
{
|
||||
Left = left;
|
||||
Right = right;
|
||||
Top = top;
|
||||
Bottom = bottom;
|
||||
}
|
||||
|
||||
public int Left {
|
||||
get {
|
||||
return left;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
InvalidMargin ("left");
|
||||
left = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Right {
|
||||
get {
|
||||
return right;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
InvalidMargin ("right");
|
||||
right = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Top {
|
||||
get {
|
||||
return top;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
InvalidMargin ("top");
|
||||
top = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Bottom {
|
||||
get {
|
||||
return bottom;
|
||||
}
|
||||
set {
|
||||
if (value < 0)
|
||||
InvalidMargin ("bottom");
|
||||
bottom = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void InvalidMargin (string property)
|
||||
{
|
||||
string msg = Locale.GetText ("All Margins must be greater than 0");
|
||||
throw new System.ArgumentException (msg, property);
|
||||
}
|
||||
|
||||
public object Clone ()
|
||||
{
|
||||
return new Margins (left, right, top, bottom);
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
return Equals (obj as Margins);
|
||||
}
|
||||
|
||||
private bool Equals (Margins m)
|
||||
{
|
||||
// avoid recursion with == operator
|
||||
if ((object)m == null)
|
||||
return false;
|
||||
return ((m.Left == left) && (m.Right == right) && (m.Top == top) && (m.Bottom == bottom));
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return left | (right << 8) | (right >> 24) | (top << 16) | (top >> 16) | (bottom << 24) | (bottom >> 8);
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
string ret = "[Margins Left={0} Right={1} Top={2} Bottom={3}]";
|
||||
return String.Format (ret, left, right, top, bottom);
|
||||
}
|
||||
|
||||
public static bool operator == (Margins m1, Margins m2)
|
||||
{
|
||||
// avoid recursion with == operator
|
||||
if ((object)m1 == null)
|
||||
return ((object)m2 == null);
|
||||
return m1.Equals (m2);
|
||||
}
|
||||
|
||||
public static bool operator != (Margins m1, Margins m2)
|
||||
{
|
||||
// avoid recursion with == operator
|
||||
if ((object)m1 == null)
|
||||
return ((object)m2 != null);
|
||||
return !m1.Equals (m2);
|
||||
}
|
||||
}
|
||||
}
|
@@ -199,10 +199,10 @@ namespace System.Drawing.Printing
|
||||
public object Clone ()
|
||||
{
|
||||
// We do a deep copy
|
||||
PrinterResolution pres = new PrinterResolution (this.printerResolution.X, this.printerResolution.Y, this.printerResolution.Kind);
|
||||
PaperSource psource = new PaperSource (this.paperSource.SourceName, this.paperSource.Kind);
|
||||
PrinterResolution pres = new PrinterResolution (this.printerResolution.Kind, this.printerResolution.X, this.printerResolution.Y);
|
||||
PaperSource psource = new PaperSource (this.paperSource.Kind, this.paperSource.SourceName);
|
||||
PaperSize psize = new PaperSize (this.paperSize.PaperName, this.paperSize.Width, this.paperSize.Height);
|
||||
psize.SetKind (this.paperSize.Kind);
|
||||
psize.RawKind = (int)this.paperSize.Kind;
|
||||
|
||||
PageSettings ps = new PageSettings (this.printerSettings, this.color, this.landscape,
|
||||
psize, psource, pres);
|
||||
|
@@ -1,155 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PaperKind.cs
|
||||
//
|
||||
// (C) 2002 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
[Serializable]
|
||||
public enum PaperKind
|
||||
{
|
||||
A2 = 66,
|
||||
A3 = 8,
|
||||
A3Extra = 63,
|
||||
A3ExtraTransverse = 68,
|
||||
A3Rotated = 76,
|
||||
A3Transverse = 67,
|
||||
A4 = 9,
|
||||
A4Extra = 53,
|
||||
A4Plus = 60,
|
||||
A4Rotated = 77,
|
||||
A4Small = 10,
|
||||
A4Transverse = 55,
|
||||
A5 = 11,
|
||||
A5Extra = 64,
|
||||
A5Rotated = 78,
|
||||
A5Transverse = 61,
|
||||
A6 = 70,
|
||||
A6Rotated = 83,
|
||||
APlus = 57,
|
||||
B4 = 12,
|
||||
B4Envelope = 33,
|
||||
B4JisRotated = 79,
|
||||
B5 = 13,
|
||||
B5Envelope = 34,
|
||||
B5Extra = 65,
|
||||
B5JisRotated = 80,
|
||||
B5Transverse = 62,
|
||||
B6Envelope = 35,
|
||||
B6Jis = 88,
|
||||
B6JisRotated = 89,
|
||||
BPlus = 58,
|
||||
C3Envelope = 29,
|
||||
C4Envelope = 30,
|
||||
C5Envelope = 28,
|
||||
C65Envelope = 32,
|
||||
C6Envelope = 31,
|
||||
CSheet = 24,
|
||||
Custom = 0,
|
||||
DLEnvelope = 27,
|
||||
DSheet = 25,
|
||||
ESheet = 26,
|
||||
Executive = 7,
|
||||
Folio = 14,
|
||||
GermanLegalFanfold = 41,
|
||||
GermanStandardFanfold = 40,
|
||||
InviteEnvelope = 47,
|
||||
IsoB4 = 42,
|
||||
ItalyEnvelope = 36,
|
||||
JapaneseDoublePostcard = 69,
|
||||
JapaneseDoublePostcardRotated = 82,
|
||||
JapaneseEnvelopeChouNumber3 = 73,
|
||||
JapaneseEnvelopeChouNumber3Rotated = 86,
|
||||
JapaneseEnvelopeChouNumber4 = 74,
|
||||
JapaneseEnvelopeChouNumber4Rotated = 87,
|
||||
JapaneseEnvelopeKakuNumber2 = 71,
|
||||
JapaneseEnvelopeKakuNumber2Rotated = 84,
|
||||
JapaneseEnvelopeKakuNumber3 = 72,
|
||||
JapaneseEnvelopeKakuNumber3Rotated = 85,
|
||||
JapaneseEnvelopeYouNumber4 = 91,
|
||||
JapaneseEnvelopeYouNumber4Rotated = 92,
|
||||
JapanesePostcard = 43,
|
||||
JapanesePostcardRotated = 81,
|
||||
Ledger = 4,
|
||||
Legal = 5,
|
||||
LegalExtra = 51,
|
||||
Letter = 1,
|
||||
LetterExtra = 50,
|
||||
LetterExtraTransverse = 56,
|
||||
LetterPlus = 59,
|
||||
LetterRotated = 75,
|
||||
LetterSmall = 2,
|
||||
LetterTransverse = 54,
|
||||
MonarchEnvelope = 37,
|
||||
Note = 18,
|
||||
Number10Envelope = 20,
|
||||
Number11Envelope = 21,
|
||||
Number12Envelope = 22,
|
||||
Number14Envelope = 23,
|
||||
Number9Envelope = 19,
|
||||
PersonalEnvelope = 38,
|
||||
Prc16K = 93,
|
||||
Prc16KRotated = 106,
|
||||
Prc32K = 94,
|
||||
Prc32KBig = 95,
|
||||
Prc32KBigRotated = 108,
|
||||
Prc32KRotated = 107,
|
||||
PrcEnvelopeNumber1 = 96,
|
||||
PrcEnvelopeNumber10 = 105,
|
||||
PrcEnvelopeNumber10Rotated = 118,
|
||||
PrcEnvelopeNumber1Rotated = 109,
|
||||
PrcEnvelopeNumber2 = 97,
|
||||
PrcEnvelopeNumber2Rotated = 110,
|
||||
PrcEnvelopeNumber3 = 98,
|
||||
PrcEnvelopeNumber3Rotated = 111,
|
||||
PrcEnvelopeNumber4 = 99,
|
||||
PrcEnvelopeNumber4Rotated = 112,
|
||||
PrcEnvelopeNumber5 = 100,
|
||||
PrcEnvelopeNumber5Rotated = 113,
|
||||
PrcEnvelopeNumber6 = 101,
|
||||
PrcEnvelopeNumber6Rotated = 114,
|
||||
PrcEnvelopeNumber7 = 102,
|
||||
PrcEnvelopeNumber7Rotated = 115,
|
||||
PrcEnvelopeNumber8 = 103,
|
||||
PrcEnvelopeNumber8Rotated = 116,
|
||||
PrcEnvelopeNumber9 = 104,
|
||||
PrcEnvelopeNumber9Rotated = 117,
|
||||
Quarto = 15,
|
||||
Standard10x11 = 45,
|
||||
Standard10x14 = 16,
|
||||
Standard11x17 = 17,
|
||||
Standard12x11 = 90,
|
||||
Standard15x11 = 46,
|
||||
Standard9x11 = 44,
|
||||
Statement = 6,
|
||||
Tabloid = 3,
|
||||
TabloidExtra = 52,
|
||||
USStandardFanfold = 39
|
||||
}
|
||||
}
|
@@ -1,133 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PaperSize.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Herve Poussineau (hpoussineau@fr.st)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PaperSize.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PaperSize
|
||||
{
|
||||
string name;
|
||||
int width;
|
||||
int height;
|
||||
PaperKind kind;
|
||||
internal bool is_default;
|
||||
|
||||
public PaperSize ()
|
||||
{
|
||||
|
||||
}
|
||||
public PaperSize(string name, int width, int height)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
internal PaperSize(string name, int width, int height, PaperKind kind, bool isDefault)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.name = name;
|
||||
this.is_default = isDefault;
|
||||
}
|
||||
|
||||
public int Width{
|
||||
get{
|
||||
return width;
|
||||
}set
|
||||
{
|
||||
if (kind != PaperKind.Custom)
|
||||
throw new ArgumentException();
|
||||
width = value;
|
||||
}
|
||||
}
|
||||
public int Height{
|
||||
get{
|
||||
return height;
|
||||
}set
|
||||
{
|
||||
if (kind != PaperKind.Custom)
|
||||
throw new ArgumentException();
|
||||
height = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string PaperName{
|
||||
get{
|
||||
return name;
|
||||
}
|
||||
set{
|
||||
if (kind != PaperKind.Custom)
|
||||
throw new ArgumentException();
|
||||
name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public PaperKind Kind{
|
||||
get{
|
||||
// .net ignores the values that are less than 0
|
||||
// the value returned is not used internally, however.
|
||||
if (kind > PaperKind.PrcEnvelopeNumber10Rotated)
|
||||
return PaperKind.Custom;
|
||||
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
public int RawKind {
|
||||
get {
|
||||
return (int)kind;
|
||||
}
|
||||
set {
|
||||
kind = (PaperKind)value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal bool IsDefault {
|
||||
get { return this.is_default; }
|
||||
set { this.is_default = value; }
|
||||
}
|
||||
|
||||
|
||||
internal void SetKind (PaperKind k) {kind = k;}
|
||||
|
||||
public override string ToString(){
|
||||
string ret = "[PaperSize {0} Kind={1} Height={2} Width={3}]";
|
||||
return String.Format(ret, this.PaperName, this.Kind, this.Height, this.Width);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,104 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PaperSource.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Herve Poussineau (hpoussineau@fr.st)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PaperSource.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class PaperSource
|
||||
{
|
||||
private PaperSourceKind kind;
|
||||
private string source_name;
|
||||
internal bool is_default;
|
||||
|
||||
public PaperSource ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal PaperSource(string sourceName, PaperSourceKind kind)
|
||||
{
|
||||
this.source_name = sourceName;
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
internal PaperSource(string sourceName, PaperSourceKind kind, bool isDefault)
|
||||
{
|
||||
this.source_name = sourceName;
|
||||
this.kind = kind;
|
||||
this.is_default = IsDefault;
|
||||
}
|
||||
|
||||
public PaperSourceKind Kind{
|
||||
get {
|
||||
// Exactly at 256 (as opposed to Custom, which is 257 and the max value of PaperSourceKind),
|
||||
// we must return Custom always.
|
||||
if ((int)kind >= 256)
|
||||
return PaperSourceKind.Custom;
|
||||
|
||||
return this.kind;
|
||||
}
|
||||
}
|
||||
public string SourceName{
|
||||
get {
|
||||
return this.source_name;
|
||||
}
|
||||
set {
|
||||
this.source_name = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int RawKind {
|
||||
get {
|
||||
return (int)kind;
|
||||
}
|
||||
set {
|
||||
kind = (PaperSourceKind)value;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsDefault {
|
||||
get { return is_default;}
|
||||
set { is_default = value;}
|
||||
}
|
||||
|
||||
public override string ToString(){
|
||||
string ret = "[PaperSource {0} Kind={1}]";
|
||||
return String.Format(ret, this.SourceName, this.Kind);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PaperSourceKind.cs
|
||||
//
|
||||
// (C) 2002 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
[Serializable]
|
||||
public enum PaperSourceKind {
|
||||
AutomaticFeed = 7,
|
||||
Cassette = 14,
|
||||
Custom = 257,
|
||||
Envelope = 5,
|
||||
FormSource = 15,
|
||||
LargeCapacity = 11,
|
||||
LargeFormat = 10,
|
||||
Lower = 2,
|
||||
Manual = 4,
|
||||
ManualFeed = 6,
|
||||
Middle = 3,
|
||||
SmallFormat = 9,
|
||||
TractorFeed = 8,
|
||||
Upper = 1
|
||||
}
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PreviewPageInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PreviewPageInfo.
|
||||
/// </summary>
|
||||
public sealed class PreviewPageInfo {
|
||||
Image image;
|
||||
Size physicalSize;
|
||||
public PreviewPageInfo(Image image, Size physicalSize) {
|
||||
this.image = image;
|
||||
this.physicalSize = physicalSize;
|
||||
}
|
||||
public Image Image {
|
||||
get{
|
||||
return image;
|
||||
}
|
||||
}
|
||||
public Size PhysicalSize{
|
||||
get{
|
||||
return physicalSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// Authors:
|
||||
//
|
||||
// Jordi Mas i Hernandez <jordimash@gmail.com>
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
public enum PrintAction
|
||||
{
|
||||
PrintToFile = 0,
|
||||
PrintToPreview = 1,
|
||||
PrintToPrinter = 2
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrintEventHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PrintEventHandler.
|
||||
/// </summary>
|
||||
public delegate void PrintEventHandler(object sender, PrintEventArgs e);
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrintPageEventHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PrintPageEventHandler.
|
||||
/// </summary>
|
||||
public delegate void PrintPageEventHandler(object sender, PrintPageEventArgs e);
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrintRange.cs
|
||||
//
|
||||
// (C) 2002 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
[Serializable]
|
||||
public enum PrintRange {
|
||||
AllPages = 0,
|
||||
Selection = 1,
|
||||
SomePages = 2,
|
||||
CurrentPage = 0x400000
|
||||
}
|
||||
}
|
@@ -1,92 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Printing.PrinterResolution.cs
|
||||
//
|
||||
// Author:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
// (C) 2003 Andreas Nahr
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class PrinterResolution
|
||||
{
|
||||
private PrinterResolutionKind kind = PrinterResolutionKind.Custom;
|
||||
private int x;
|
||||
private int y;
|
||||
|
||||
public PrinterResolution ()
|
||||
{
|
||||
}
|
||||
|
||||
internal PrinterResolution (int x, int y, PrinterResolutionKind kind)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.kind = kind;
|
||||
}
|
||||
|
||||
public int X {
|
||||
get {
|
||||
return x;
|
||||
}
|
||||
set {
|
||||
x = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int Y {
|
||||
get {
|
||||
return y;
|
||||
}
|
||||
set {
|
||||
y = value;
|
||||
}
|
||||
}
|
||||
|
||||
public PrinterResolutionKind Kind {
|
||||
get {
|
||||
return kind;
|
||||
}
|
||||
set {
|
||||
kind = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
if (kind != PrinterResolutionKind.Custom)
|
||||
return "[PrinterResolution " + kind.ToString () + "]";
|
||||
|
||||
return "[PrinterResolution X=" + x + " Y=" + y + "]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrinterResolutionKind.cs
|
||||
//
|
||||
// (C) 2002 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
[Serializable]
|
||||
public enum PrinterResolutionKind {
|
||||
Custom = 0,
|
||||
Draft = -1,
|
||||
High = -4,
|
||||
Low = -2,
|
||||
Medium = -3
|
||||
}
|
||||
}
|
@@ -116,11 +116,11 @@ namespace System.Drawing.Printing
|
||||
if (default_pagesettings == null) {
|
||||
default_pagesettings = new PageSettings (this,
|
||||
SupportsColor,
|
||||
false,
|
||||
// Real defaults are set by LoadPrinterSettings
|
||||
new PaperSize("A4", 827, 1169),
|
||||
new PaperSource("Tray", PaperSourceKind.FormSource),
|
||||
new PrinterResolution(200, 200, PrinterResolutionKind.Medium));
|
||||
false,
|
||||
// Real defaults are set by LoadPrinterSettings
|
||||
new PaperSize("A4", 827, 1169),
|
||||
new PaperSource(PaperSourceKind.FormSource, "Tray"),
|
||||
new PrinterResolution(PrinterResolutionKind.Medium, 200, 200));
|
||||
}
|
||||
|
||||
return default_pagesettings;
|
||||
|
@@ -1,39 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrinterUnit.cs
|
||||
//
|
||||
// (C) 2002 Ximian, Inc. http://www.ximian.com
|
||||
// Author: Dennis Hayes (dennish@raytek.com)
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
public enum PrinterUnit {
|
||||
Display = 0,
|
||||
HundredthsOfAMillimeter = 2,
|
||||
TenthsOfAMillimeter = 3,
|
||||
ThousandthsOfAnInch = 1
|
||||
}
|
||||
}
|
@@ -1,139 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Printing.PrinterUnitConvert.cs
|
||||
//
|
||||
// Authors:
|
||||
// Martin Willemoes Hansen (mwh@sysrq.dk)
|
||||
// Herve Poussineau (hpoussineau@fr.st)
|
||||
//
|
||||
// (C) 2003 Martin Willemoes Hansen
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Drawing.Printing
|
||||
{
|
||||
public sealed class PrinterUnitConvert
|
||||
{
|
||||
private PrinterUnitConvert ()
|
||||
{
|
||||
}
|
||||
|
||||
public static double Convert (double value,
|
||||
PrinterUnit fromUnit,
|
||||
PrinterUnit toUnit)
|
||||
{
|
||||
switch (fromUnit)
|
||||
{
|
||||
case PrinterUnit.Display:
|
||||
switch (toUnit)
|
||||
{
|
||||
case PrinterUnit.Display: return value;
|
||||
case PrinterUnit.ThousandthsOfAnInch: return value * 10;
|
||||
case PrinterUnit.HundredthsOfAMillimeter: return value * 25.4;
|
||||
case PrinterUnit.TenthsOfAMillimeter: return value * 2.54;
|
||||
}
|
||||
break;
|
||||
case PrinterUnit.ThousandthsOfAnInch:
|
||||
switch (toUnit)
|
||||
{
|
||||
case PrinterUnit.Display: return value / 10;
|
||||
case PrinterUnit.ThousandthsOfAnInch: return value;
|
||||
case PrinterUnit.HundredthsOfAMillimeter: return value * 2.54;
|
||||
case PrinterUnit.TenthsOfAMillimeter: return value * 0.254;
|
||||
}
|
||||
break;
|
||||
case PrinterUnit.HundredthsOfAMillimeter:
|
||||
switch (toUnit)
|
||||
{
|
||||
case PrinterUnit.Display: return value / 25.4;
|
||||
case PrinterUnit.ThousandthsOfAnInch: return value / 2.54;
|
||||
case PrinterUnit.HundredthsOfAMillimeter: return value;
|
||||
case PrinterUnit.TenthsOfAMillimeter: return value / 10;
|
||||
}
|
||||
break;
|
||||
case PrinterUnit.TenthsOfAMillimeter:
|
||||
switch (toUnit)
|
||||
{
|
||||
case PrinterUnit.Display: return value / 2.54;
|
||||
case PrinterUnit.ThousandthsOfAnInch: return value / 0.254;
|
||||
case PrinterUnit.HundredthsOfAMillimeter: return value * 10;
|
||||
case PrinterUnit.TenthsOfAMillimeter: return value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// should never happen
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static int Convert (int value,
|
||||
PrinterUnit fromUnit,
|
||||
PrinterUnit toUnit)
|
||||
{
|
||||
double rslt;
|
||||
rslt = Convert ((double) value, fromUnit, toUnit);
|
||||
return (int) Math.Round (rslt);
|
||||
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,244 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrintingPermission.cs
|
||||
//
|
||||
// Authors:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Herve Poussineau (hpoussineau@fr.st)
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Globalization;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.Drawing.Printing {
|
||||
|
||||
[Serializable]
|
||||
public sealed class PrintingPermission : CodeAccessPermission, IUnrestrictedPermission {
|
||||
|
||||
private const int version = 1;
|
||||
|
||||
private PrintingPermissionLevel _Level;
|
||||
|
||||
public PrintingPermission (PermissionState state)
|
||||
{
|
||||
if (CheckPermissionState (state, true) == PermissionState.Unrestricted)
|
||||
_Level = PrintingPermissionLevel.AllPrinting;
|
||||
}
|
||||
|
||||
public PrintingPermission (PrintingPermissionLevel printingLevel)
|
||||
{
|
||||
Level = printingLevel;
|
||||
}
|
||||
|
||||
// properties
|
||||
|
||||
public PrintingPermissionLevel Level{
|
||||
get { return _Level; }
|
||||
set {
|
||||
if (!Enum.IsDefined (typeof (PrintingPermissionLevel), value)) {
|
||||
string msg = Locale.GetText ("Invalid enum {0}");
|
||||
throw new ArgumentException (String.Format (msg, value), "Level");
|
||||
}
|
||||
_Level = value;
|
||||
}
|
||||
}
|
||||
|
||||
// methods
|
||||
|
||||
public override IPermission Copy ()
|
||||
{
|
||||
return new PrintingPermission (this.Level);
|
||||
}
|
||||
|
||||
public override void FromXml (SecurityElement esd)
|
||||
{
|
||||
CheckSecurityElement (esd, "esd", version, version);
|
||||
// Note: we do not (yet) care about the return value
|
||||
// as we only accept version 1 (min/max values)
|
||||
|
||||
if (IsUnrestricted (esd))
|
||||
_Level = PrintingPermissionLevel.AllPrinting;
|
||||
else {
|
||||
string level = esd.Attribute ("Level");
|
||||
if (level != null) {
|
||||
_Level = (PrintingPermissionLevel) Enum.Parse (
|
||||
typeof (PrintingPermissionLevel), level);
|
||||
}
|
||||
else
|
||||
_Level = PrintingPermissionLevel.NoPrinting;
|
||||
}
|
||||
}
|
||||
|
||||
public override IPermission Intersect (IPermission target)
|
||||
{
|
||||
PrintingPermission pp = Cast (target);
|
||||
if ((pp == null) || IsEmpty () || pp.IsEmpty ())
|
||||
return null;
|
||||
|
||||
PrintingPermissionLevel level = (_Level <= pp.Level) ? _Level : pp.Level;
|
||||
return new PrintingPermission (level);
|
||||
}
|
||||
|
||||
public override bool IsSubsetOf (IPermission target)
|
||||
{
|
||||
PrintingPermission pp = Cast (target);
|
||||
if (pp == null)
|
||||
return IsEmpty ();
|
||||
|
||||
return (_Level <= pp.Level);
|
||||
}
|
||||
|
||||
public bool IsUnrestricted ()
|
||||
{
|
||||
return (_Level == PrintingPermissionLevel.AllPrinting);
|
||||
}
|
||||
|
||||
public override SecurityElement ToXml ()
|
||||
{
|
||||
SecurityElement se = Element (version);
|
||||
if (IsUnrestricted ())
|
||||
se.AddAttribute ("Unrestricted", "true");
|
||||
else
|
||||
se.AddAttribute ("Level", _Level.ToString ());
|
||||
return se;
|
||||
}
|
||||
|
||||
public override IPermission Union (IPermission target)
|
||||
{
|
||||
PrintingPermission pp = Cast (target);
|
||||
if (pp == null)
|
||||
return new PrintingPermission (_Level);
|
||||
if (IsUnrestricted () || pp.IsUnrestricted ())
|
||||
return new PrintingPermission (PermissionState.Unrestricted);
|
||||
if (IsEmpty () && pp.IsEmpty ())
|
||||
return null;
|
||||
|
||||
PrintingPermissionLevel level = (_Level > pp.Level) ? _Level : pp.Level;
|
||||
return new PrintingPermission (level);
|
||||
}
|
||||
|
||||
// Internal helpers methods
|
||||
|
||||
private bool IsEmpty ()
|
||||
{
|
||||
return (_Level == PrintingPermissionLevel.NoPrinting);
|
||||
}
|
||||
|
||||
private PrintingPermission Cast (IPermission target)
|
||||
{
|
||||
if (target == null)
|
||||
return null;
|
||||
|
||||
PrintingPermission pp = (target as PrintingPermission);
|
||||
if (pp == null) {
|
||||
ThrowInvalidPermission (target, typeof (PrintingPermission));
|
||||
}
|
||||
|
||||
return pp;
|
||||
}
|
||||
|
||||
// NOTE: The following static methods should be moved out to a (static?) class
|
||||
// if (ever) System.Drawing.dll gets more than one permission in it's assembly.
|
||||
|
||||
// snippet moved from FileIOPermission (nickd) to be reused in all derived classes
|
||||
internal SecurityElement Element (int version)
|
||||
{
|
||||
SecurityElement se = new SecurityElement ("IPermission");
|
||||
Type type = this.GetType ();
|
||||
se.AddAttribute ("class", type.FullName + ", " + type.Assembly.ToString ().Replace ('\"', '\''));
|
||||
se.AddAttribute ("version", version.ToString ());
|
||||
return se;
|
||||
}
|
||||
|
||||
internal static PermissionState CheckPermissionState (PermissionState state, bool allowUnrestricted)
|
||||
{
|
||||
string msg;
|
||||
switch (state) {
|
||||
case PermissionState.None:
|
||||
break;
|
||||
case PermissionState.Unrestricted:
|
||||
if (!allowUnrestricted) {
|
||||
msg = Locale.GetText ("Unrestricted isn't not allowed for identity permissions.");
|
||||
throw new ArgumentException (msg, "state");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
msg = String.Format (Locale.GetText ("Invalid enum {0}"), state);
|
||||
throw new ArgumentException (msg, "state");
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
// logic isn't identical to CodeAccessPermission.CheckSecurityElement - see unit tests
|
||||
internal static int CheckSecurityElement (SecurityElement se, string parameterName, int minimumVersion, int maximumVersion)
|
||||
{
|
||||
if (se == null)
|
||||
throw new ArgumentNullException (parameterName);
|
||||
|
||||
string c = se.Attribute ("class");
|
||||
if (c == null) {
|
||||
string msg = Locale.GetText ("Missing 'class' attribute.");
|
||||
throw new ArgumentException (msg, parameterName);
|
||||
}
|
||||
// we assume minimum version if no version number is supplied
|
||||
int version = minimumVersion;
|
||||
string v = se.Attribute ("version");
|
||||
if (v != null) {
|
||||
try {
|
||||
version = Int32.Parse (v);
|
||||
}
|
||||
catch (Exception e) {
|
||||
string msg = Locale.GetText ("Couldn't parse version from '{0}'.");
|
||||
msg = String.Format (msg, v);
|
||||
throw new ArgumentException (msg, parameterName, e);
|
||||
}
|
||||
}
|
||||
|
||||
if ((version < minimumVersion) || (version > maximumVersion)) {
|
||||
string msg = Locale.GetText ("Unknown version '{0}', expected versions between ['{1}','{2}'].");
|
||||
msg = String.Format (msg, version, minimumVersion, maximumVersion);
|
||||
throw new ArgumentException (msg, parameterName);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
// must be called after CheckSecurityElement (i.e. se != null)
|
||||
internal static bool IsUnrestricted (SecurityElement se)
|
||||
{
|
||||
string value = se.Attribute ("Unrestricted");
|
||||
if (value == null)
|
||||
return false;
|
||||
return (String.Compare (value, Boolean.TrueString, true, CultureInfo.InvariantCulture) == 0);
|
||||
}
|
||||
|
||||
internal static void ThrowInvalidPermission (IPermission target, Type expected)
|
||||
{
|
||||
string msg = Locale.GetText ("Invalid permission type '{0}', expected type '{1}'.");
|
||||
msg = String.Format (msg, target.GetType (), expected);
|
||||
throw new ArgumentException (msg, "target");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
//
|
||||
// System.Drawing.PrintingPermissionAttribute.cs
|
||||
//
|
||||
// Authors:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Herve Poussineau (hpoussineau@fr.st)
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
//
|
||||
// (C) 2002 Ximian, Inc
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.Drawing.Printing {
|
||||
|
||||
[AttributeUsage (AttributeTargets.All, AllowMultiple=true)]
|
||||
// strangely this class isn't [Serializable] like other permission classes
|
||||
public sealed class PrintingPermissionAttribute : CodeAccessSecurityAttribute {
|
||||
|
||||
private PrintingPermissionLevel _level;
|
||||
|
||||
public PrintingPermissionAttribute (SecurityAction action)
|
||||
: base (action)
|
||||
{
|
||||
// seems to always assign PrintingPermissionLevel.NoPrinting ...
|
||||
}
|
||||
|
||||
public PrintingPermissionLevel Level {
|
||||
get { return _level; }
|
||||
set {
|
||||
if (!Enum.IsDefined (typeof (PrintingPermissionLevel), value)) {
|
||||
string msg = Locale.GetText ("Invalid enum {0}");
|
||||
throw new ArgumentException (String.Format (msg, value), "Level");
|
||||
}
|
||||
_level = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override IPermission CreatePermission ()
|
||||
{
|
||||
if (base.Unrestricted)
|
||||
return new PrintingPermission (PermissionState.Unrestricted);
|
||||
else
|
||||
return new PrintingPermission (_level);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user