diff options
author | Frederik Carlier <frederik.carlier@quamotion.mobi> | 2017-06-16 01:57:02 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2017-06-16 01:57:02 +0300 |
commit | 831381caa9533e1ac4f5de291b328e52123558cd (patch) | |
tree | d2c8d62f524d0aff43d9849e3e43a1f9c59e8ef4 /mcs/class/System.Drawing | |
parent | e33294bf2217e2bbe20dc6462af7b1989d12e72f (diff) |
Use CoreFX sources for System.Printing (#5041)
Diffstat (limited to 'mcs/class/System.Drawing')
19 files changed, 33 insertions, 1363 deletions
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs b/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs deleted file mode 100644 index bf54ea69e91..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/Duplex.cs +++ /dev/null @@ -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
- }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterException.cs b/mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterException.cs deleted file mode 100644 index 7fd127cdb0c..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/InvalidPrinterException.cs +++ /dev/null @@ -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); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs b/mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs deleted file mode 100644 index c5bc0696136..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/Margins.cs +++ /dev/null @@ -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); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs index 00bb942e78b..330ba62a2d8 100644 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs +++ b/mcs/class/System.Drawing/System.Drawing.Printing/PageSettings.cs @@ -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); diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs deleted file mode 100644 index d9fb602fa3d..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PaperKind.cs +++ /dev/null @@ -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
- }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs deleted file mode 100644 index d7d48e1ba11..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSize.cs +++ /dev/null @@ -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); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs deleted file mode 100644 index a8db379ada9..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSource.cs +++ /dev/null @@ -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); - } - - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs deleted file mode 100644 index 911ae62d0f5..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PaperSourceKind.cs +++ /dev/null @@ -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
- }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs deleted file mode 100644 index 4998732bf09..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintRange.cs +++ /dev/null @@ -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 - }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs deleted file mode 100644 index 5f101cdf9da..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolution.cs +++ /dev/null @@ -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 + "]"; - }
- }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs deleted file mode 100644 index 167df84f144..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterResolutionKind.cs +++ /dev/null @@ -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
- }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs index 2f8c27de2ec..2184fc2050e 100644 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs +++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs @@ -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; diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnitConvert.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnitConvert.cs deleted file mode 100644 index 00452060da0..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnitConvert.cs +++ /dev/null @@ -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)); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs deleted file mode 100644 index 44e2171bad0..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermission.cs +++ /dev/null @@ -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"); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs deleted file mode 100644 index 35ecd549bb5..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionAttribute.cs +++ /dev/null @@ -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); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServices.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServices.cs index 5eb31d5e1f0..762792395a3 100644 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServices.cs +++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServices.cs @@ -54,10 +54,10 @@ namespace System.Drawing.Printing internal void LoadDefaultResolutions (PrinterSettings.PrinterResolutionCollection col) { - col.Add (new PrinterResolution ((int) PrinterResolutionKind.High, -1, PrinterResolutionKind.High)); - col.Add (new PrinterResolution ((int) PrinterResolutionKind.Medium, -1, PrinterResolutionKind.Medium)); - col.Add (new PrinterResolution ((int) PrinterResolutionKind.Low, -1, PrinterResolutionKind.Low)); - col.Add (new PrinterResolution ((int) PrinterResolutionKind.Draft, -1, PrinterResolutionKind.Draft)); + col.Add (new PrinterResolution (PrinterResolutionKind.High, (int) PrinterResolutionKind.High, -1)); + col.Add (new PrinterResolution (PrinterResolutionKind.Medium, (int) PrinterResolutionKind.Medium, -1)); + col.Add (new PrinterResolution (PrinterResolutionKind.Low, (int) PrinterResolutionKind.Low, -1)); + col.Add (new PrinterResolution (PrinterResolutionKind.Draft, (int) PrinterResolutionKind.Draft, -1)); } #endregion } diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs index 3386004199a..859f726e7b4 100644 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs +++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs @@ -433,7 +433,7 @@ namespace System.Drawing.Printing return null; } - return new PrinterResolution (x_resolution, y_resolution, PrinterResolutionKind.Custom); + return new PrinterResolution (PrinterResolutionKind.Custom, x_resolution, y_resolution); } /// <summary> @@ -452,7 +452,7 @@ namespace System.Drawing.Printing PPD_SIZE size; PaperSize ps; - PaperSize defsize = new PaperSize ("A4", 827, 1169, GetPaperKind (827, 1169), true); + PaperSize defsize = new PaperSize (GetPaperKind (827, 1169), "A4", 827, 1169); ppd = (PPD_FILE) Marshal.PtrToStructure (ppd_handle, typeof (PPD_FILE)); ptr = ppd.sizes; float w, h; @@ -462,8 +462,8 @@ namespace System.Drawing.Printing w = size.width * 100 / 72; h = size.length * 100 / 72; PaperKind kind = GetPaperKind ((int) w, (int) h); - ps = new PaperSize (real_name, (int) w, (int) h, kind, def_size == kind.ToString ()); - ps.SetKind (kind); + ps = new PaperSize (kind, real_name, (int) w, (int) h); + ps.RawKind = (int)kind; if (def_size == ps.Kind.ToString ()) defsize = ps; settings.paper_sizes.Add (ps); @@ -507,7 +507,7 @@ namespace System.Drawing.Printing kind = PaperSourceKind.Custom; break; } - settings.paper_sources.Add (new PaperSource (paper_sources[source], kind, def_source == source)); + settings.paper_sources.Add (new PaperSource (kind, paper_sources[source])); if (def_source == source) defsource = settings.paper_sources[settings.paper_sources.Count-1]; } diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesWin32.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesWin32.cs index 66c3a58e18e..c070eb67599 100644 --- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesWin32.cs +++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesWin32.cs @@ -139,7 +139,7 @@ namespace System.Drawing.Printing y = Marshal.ReadInt32 (ptr); ptr = new IntPtr (ptr.ToInt64 () + Marshal.SizeOf (y)); settings.PrinterResolutions.Add (new PrinterResolution - (x,y, PrinterResolutionKind.Custom)); + (PrinterResolutionKind.Custom, x, y)); } } Marshal.FreeHGlobal (buff); @@ -197,7 +197,7 @@ namespace System.Drawing.Printing ptr_sizes_enum = new IntPtr (ptr_sizes_enum.ToInt64 () + 2); ps = new PaperSize (name, x,y); - ps.SetKind (kind); + ps.RawKind = (int)kind; settings.PaperSizes.Add (ps); } } @@ -261,7 +261,7 @@ namespace System.Drawing.Printing for (int i = 0; i < ret; i++) { name = Marshal.PtrToStringUni (ptr_names); kind = (PaperSourceKind) Marshal.ReadInt16 (ptr_bins); - settings.PaperSources.Add (new PaperSource (name, kind)); + settings.PaperSources.Add (new PaperSource (kind, name)); ptr_names = new IntPtr (ptr_names.ToInt64 () + 24 * 2); ptr_bins = new IntPtr (ptr_bins.ToInt64 () + 2); diff --git a/mcs/class/System.Drawing/System.Drawing.dll.sources b/mcs/class/System.Drawing/System.Drawing.dll.sources index 0516f278c95..097b6cabc98 100755 --- a/mcs/class/System.Drawing/System.Drawing.dll.sources +++ b/mcs/class/System.Drawing/System.Drawing.dll.sources @@ -176,36 +176,36 @@ System.Drawing.Imaging/MetaHeader.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PropertyItem.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/WmfPlaceableFileHeader.cs -System.Drawing.Printing/Duplex.cs -System.Drawing.Printing/InvalidPrinterException.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/Duplex.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/InvalidPrinterException.cs System.Drawing.Printing/MarginsConverter.cs -System.Drawing.Printing/Margins.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/Margins.cs System.Drawing.Printing/PrintingServices.cs System.Drawing.Printing/PrintingServicesWin32.cs System.Drawing.Printing/PrintingServicesUnix.cs System.Drawing.Printing/PageSettings.cs -System.Drawing.Printing/PaperKind.cs -System.Drawing.Printing/PaperSize.cs -System.Drawing.Printing/PaperSource.cs -System.Drawing.Printing/PaperSourceKind.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PaperKinds.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSize.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSource.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PaperSourceKind.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs System.Drawing.Printing/PreviewPrintController.cs System.Drawing.Printing/PrintController.cs System.Drawing.Printing/PrintDocument.cs -System.Drawing.Printing/PrinterResolution.cs -System.Drawing.Printing/PrinterResolutionKind.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolution.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterResolutionKind.cs System.Drawing.Printing/PrinterSettings.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs -System.Drawing.Printing/PrinterUnitConvert.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnitConvert.cs System.Drawing.Printing/PrintEventArgs.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs -System.Drawing.Printing/PrintingPermissionAttribute.cs -System.Drawing.Printing/PrintingPermission.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermission.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionAttribute.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs System.Drawing.Printing/PrintPageEventArgs.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs -System.Drawing.Printing/PrintRange.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintRange.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs System.Drawing.Printing/StandardPrintController.cs |