PrinterSettings.cs 9.3 KB

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