2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / class / System.Drawing / System.Drawing.Printing / PrinterSettings.cs
1 //
2 // System.Drawing.PrinterSettings.cs
3 //
4 // Authors:
5 //   Dennis Hayes (dennish@Raytek.com)
6 //   Herve Poussineau (hpoussineau@fr.st)
7 //   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
8 //
9 // (C) 2002 Ximian, Inc
10 //
11
12 //
13 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 //
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
22 // 
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
25 // 
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 //
34
35 using System;
36 using System.Runtime.InteropServices;
37 using System.Collections;
38 using System.Drawing.Printing;
39
40 namespace System.Drawing.Printing
41 {
42         [Serializable]
43         [ComVisible(false)]
44         public class PrinterSettings : ICloneable
45         {
46                 public PrinterSettings()
47                 {
48                 }
49
50                 // Public subclasses
51
52                 public class PaperSourceCollection : ICollection
53                 {
54                         ArrayList _PaperSources = new ArrayList();
55                         
56                         public PaperSourceCollection(PaperSource[] array) {
57                                 foreach (PaperSource ps in array)
58                                         _PaperSources.Add(ps);
59                         }
60                         
61                         public int Count { get { return _PaperSources.Count; } }
62                         bool ICollection.IsSynchronized { get { return false; } }
63                         object ICollection.SyncRoot { get { return this; } }
64                         
65                         public virtual PaperSource this[int index] {
66                                 get { return _PaperSources[index] as PaperSource; }
67                         }
68                         
69                         public IEnumerator GetEnumerator()
70                         {
71                                 return _PaperSources.GetEnumerator();
72                         }
73                         
74                         void ICollection.CopyTo(Array array, int index)
75                         {
76                                 _PaperSources.CopyTo(array, index);
77                         }
78                 }
79
80                 public class PaperSizeCollection : ICollection
81                 {
82                         ArrayList _PaperSizes = new ArrayList();
83                         
84                         public PaperSizeCollection(PaperSize[] array) {
85                                 foreach (PaperSize ps in array)
86                                         _PaperSizes.Add(ps);
87                         }
88                         
89                         public int Count { get { return _PaperSizes.Count; } }
90                         bool ICollection.IsSynchronized { get { return false; } }
91                         object ICollection.SyncRoot { get { return this; } }
92                         
93                         public virtual PaperSize this[int index] {
94                                 get { return _PaperSizes[index] as PaperSize; }
95                         }
96                         
97                         public IEnumerator GetEnumerator()
98                         {
99                                 return _PaperSizes.GetEnumerator();
100                         }
101                         
102                         void ICollection.CopyTo(Array array, int index)
103                         {
104                                 _PaperSizes.CopyTo(array, index);
105                         }
106                 }
107
108                 public class PrinterResolutionCollection : ICollection
109                 {
110                         ArrayList _PrinterResolutions = new ArrayList();
111                         
112                         public PrinterResolutionCollection(PrinterResolution[] array) {
113                                 foreach (PrinterResolution pr in array)
114                                         _PrinterResolutions.Add(pr);
115                         }
116                         
117                         public int Count { get { return _PrinterResolutions.Count; } }
118                         bool ICollection.IsSynchronized { get { return false; } }
119                         object ICollection.SyncRoot { get { return this; } }
120                         
121                         public virtual PrinterResolution this[int index] {
122                                 get { return _PrinterResolutions[index] as PrinterResolution; }
123                         }
124                         
125                         public IEnumerator GetEnumerator()
126                         {
127                                 return _PrinterResolutions.GetEnumerator();
128                         }
129                         
130                         void ICollection.CopyTo(Array array, int index)
131                         {
132                                 _PrinterResolutions.CopyTo(array, index);
133                         }
134                 }
135
136                 public class StringCollection : ICollection
137                 {
138                         ArrayList _Strings = new ArrayList();
139                         
140                         public StringCollection(string[] array) {
141                                 foreach (string s in array)
142                                         _Strings.Add(s);
143                         }
144                         
145                         public int Count { get { return _Strings.Count; } }
146                         bool ICollection.IsSynchronized { get { return false; } }
147                         object ICollection.SyncRoot { get { return this; } }
148                         
149                         public virtual string this[int index] {
150                                 get { return _Strings[index] as string; }
151                         }
152
153                         public IEnumerator GetEnumerator()
154                         {
155                                 return _Strings.GetEnumerator();
156                         }
157                         
158                         void ICollection.CopyTo(Array array, int index)
159                         {
160                                 _Strings.CopyTo(array, index);
161                         }
162                 }
163                 
164                 //properties
165
166                 [MonoTODO("PrinterSettings.CanDuplex")]
167                 public bool CanDuplex
168                 {
169                         get { throw new NotImplementedException(); }
170                 }
171
172                 [MonoTODO("PrinterSettings.Collate")]
173                 public bool Collate
174                 {
175                         get { throw new NotImplementedException(); }
176                         set { throw new NotImplementedException(); }
177                 }
178
179                 [MonoTODO("PrinterSettings.Copies")]
180                 public short Copies
181                 {
182                         get { throw new NotImplementedException(); }
183                         set { throw new NotImplementedException(); }
184                 }
185
186                 [MonoTODO("PrinterSettings.DefaultPageSettings")]
187                 public PageSettings DefaultPageSettings
188                 {
189                         get
190                         {
191                                 return new PageSettings(
192                                         this,
193                                         // TODO: get default color mode for this printer
194                                         false,
195                                         // TODO: get default orientation for this printer
196                                         false,
197                                         // TODO: get default paper size for this printer
198                                         new PaperSize("A4", 827, 1169),
199                                         // TODO: get default paper source for this printer
200                                         new PaperSource("default", PaperSourceKind.FormSource),
201                                         // TODO: get default resolution for this printer
202                                         new PrinterResolution(300, 300, PrinterResolutionKind.Medium)
203                                 );
204                         }
205                 }
206
207                 [MonoTODO("PrinterSettings.Duplex")]
208                 public Duplex Duplex
209                 {
210                         get { throw new NotImplementedException(); }
211                         set { throw new NotImplementedException(); }
212                 }
213
214                 [MonoTODO("PrinterSettings.FromPage")]
215                 public int FromPage
216                 {
217                         get { throw new NotImplementedException(); }
218                         set { throw new NotImplementedException(); }
219                 }
220
221                 [MonoTODO("PrinterSettings.InstalledPrinters")]
222                 public static PrinterSettings.StringCollection InstalledPrinters
223                 {
224                         get { throw new NotImplementedException(); }
225                 }
226
227                 [MonoTODO("PrinterSettings.IsDefaultPrinter")]
228                 public bool IsDefaultPrinter
229                 {
230                         get { throw new NotImplementedException(); }
231                 }
232
233                 [MonoTODO("PrinterSettings.IsPlotter")]
234                 public bool IsPlotter
235                 {
236                         get { throw new NotImplementedException(); }
237                 }
238
239                 [MonoTODO("PrinterSettings.IsValid")]
240                 public bool IsValid
241                 {
242                         get { throw new NotImplementedException(); }
243                 }
244
245                 [MonoTODO("PrinterSettings.LandscapeAngle")]
246                 public int LandscapeAngle
247                 {
248                         get { throw new NotImplementedException(); }
249                 }
250
251                 [MonoTODO("PrinterSettings.MaximumCopies")]
252                 public int MaximumCopies
253                 {
254                         get { throw new NotImplementedException(); }
255                 }
256
257                 [MonoTODO("PrinterSettings.MaximumPage")]
258                 public int MaximumPage
259                 {
260                         get { throw new NotImplementedException(); }
261                         set { throw new NotImplementedException(); }
262                 }
263
264                 [MonoTODO("PrinterSettings.MinimumPage")]
265                 public int MinimumPage
266                 {
267                         get { throw new NotImplementedException(); }
268                         set { throw new NotImplementedException(); }
269                 }
270
271                 [MonoTODO("PrinterSettings.PaperSizes")]
272                 public PrinterSettings.PaperSizeCollection PaperSizes
273                 {
274                         get { throw new NotImplementedException(); }
275                 }
276
277                 [MonoTODO("PrinterSettings.PaperSources")]
278                 public PrinterSettings.PaperSourceCollection PaperSources
279                 {
280                         get { throw new NotImplementedException(); }
281                 }
282
283                 [MonoTODO("PrinterSettings.PrinterName")]
284                 public string PrinterName
285                 {
286                         get { throw new NotImplementedException(); }
287                         set { throw new NotImplementedException(); }
288                 }
289
290                 [MonoTODO("PrinterSettings.PrinterResolutions")]
291                 public PrinterSettings.PrinterResolutionCollection PrinterResolutions
292                 {
293                         get { throw new NotImplementedException(); }
294                 }
295
296                 [MonoTODO("PrinterSettings.PrintRange")]
297                 public PrintRange PrintRange
298                 {
299                         get { throw new NotImplementedException(); }
300                         set { throw new NotImplementedException(); }
301                 }
302
303                 [MonoTODO("PrinterSettings.PrintToFile")]
304                 public bool PrintToFile
305                 {
306                         get { throw new NotImplementedException(); }
307                         set { throw new NotImplementedException(); }
308                 }
309
310                 [MonoTODO("PrinterSettings.SupportsColor")]
311                 public bool SupportsColor
312                 {
313                         get { throw new NotImplementedException(); }
314                 }
315
316                 [MonoTODO("PrinterSettings.ToPage")]
317                 public int ToPage
318                 {
319                         get { throw new NotImplementedException(); }
320                         set { throw new NotImplementedException(); }
321                 }
322
323                 //methods
324
325                 [MonoTODO("PrinterSettings.Clone")]
326                 public virtual object Clone()
327                 {
328                         throw new NotImplementedException();
329                 }
330
331                 [MonoTODO("PrinterSettings.CreateMeasurementGraphics")]
332                 public Graphics CreateMeasurementGraphics()
333                 {
334                         throw new NotImplementedException();
335                 }
336
337                 [MonoTODO("PrinterSettings.GetHdevmode")]
338                 public IntPtr GetHdevmode()
339                 {
340                         throw new NotImplementedException();
341                 }
342
343                 [MonoTODO("PrinterSettings.GetHdevmode")]
344                 public IntPtr GetHdevmode(PageSettings pageSettings)
345                 {
346                         throw new NotImplementedException();
347                 }
348
349                 [MonoTODO("PrinterSettings.GetHdevname")]
350                 public IntPtr GetHdevnames()
351                 {
352                         throw new NotImplementedException();
353                 }
354
355                 [MonoTODO("PrinterSettings.SetHdevmode")]
356                 public void SetHdevmode(IntPtr hdevmode)
357                 {
358                         throw new NotImplementedException();
359                 }
360
361                 [MonoTODO("PrinterSettings.SetHdevnames")]
362                 public void SetHdevnames(IntPtr hdevnames)
363                 {
364                         throw new NotImplementedException();
365                 }
366
367                 [MonoTODO("PrinterSettings.ToString")]
368                 public override string ToString()
369                 {
370                         throw new NotImplementedException();
371                 }
372         }
373 }