Fix make dist.
[mono.git] / mcs / class / System.Windows.Forms / System.Windows.Forms.RTF / Charset.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
21 //
22 // Authors:
23 //      Peter Bartok    (pbartok@novell.com)
24 //
25 //
26
27 using System;
28
29 // COMPLETE
30
31 namespace System.Windows.Forms.RTF {
32
33 #if RTF_LIB
34         public
35 #else
36         internal
37 #endif
38         class Charset {
39                 #region Local Variables
40                 private CharsetType     id;
41                 private CharsetFlags    flags;
42                 private Charcode        code;
43                 private string          file;
44                 #endregion      // Local Variables
45
46                 #region Public Constructors
47                 public Charset() {
48                         flags = CharsetFlags.Read | CharsetFlags.Switch;
49                         id = CharsetType.General;
50                         file = string.Empty;
51                         this.ReadMap();
52                 }
53                 #endregion      // Public Constructors
54
55                 #region Public Instance Properties
56                 public Charcode Code {
57                         get {
58                                 return code;
59                         }
60
61                         set {
62                                 code = value;
63                         }
64                 }
65
66                 public CharsetFlags Flags {
67                         get {
68                                 return flags;
69                         }
70
71                         set {
72                                 flags = value;
73                         }
74                 }
75
76                 public CharsetType ID {
77                         get {
78                                 return id;
79                         }
80
81                         set {
82                                 switch(value) {
83                                         case CharsetType.Symbol: {
84                                                 id = CharsetType.Symbol;
85                                                 return;
86                                         }
87
88                                         default:
89                                         case CharsetType.General: {
90                                                 id = CharsetType.General;
91                                                 return;
92                                         }
93                                 }
94                         }
95                 }
96
97                 public string File {
98                         get {
99                                 return file;
100                         }
101
102                         set {
103                                 if (file != value) {
104                                         file = value;
105                                 }
106                         }
107                 }
108
109                 public StandardCharCode this[int c] {
110                         get {
111                                 return code[c];
112                         }
113                 }
114
115                 #endregion      // Public Instance Properties
116
117                 #region Public Instance Methods
118                 public bool ReadMap() {
119                         switch (id) {
120                                 case CharsetType.General: {
121                                         if (file == string.Empty) {
122                                                 code = Charcode.AnsiGeneric;
123                                                 return true;
124                                         }
125                                         // FIXME - implement reading charmap from file...
126                                         return true;
127                                 }
128
129                                 case CharsetType.Symbol: {
130                                         if (file == string.Empty) {
131                                                 code = Charcode.AnsiSymbol;
132                                                 return true;
133                                         }
134
135                                         // FIXME - implement reading charmap from file...
136                                         return true;
137                                 }
138
139                                 default: {
140                                         return false;
141                                 }
142                         }
143                 }
144
145                 public char StdCharCode(string name) {
146                         // FIXME - finish this
147                         return ' ';
148                         
149                 }
150
151                 public string StdCharName(char code) {
152                         // FIXME - finish this
153                         return String.Empty;
154                 }
155                 #endregion      // Public Instance Methods
156         }
157 }