2006-11-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.UI / Html32TextWriter.cs
1 //
2 // System.Web.UI.Html32TextWriter.cs: Provides a HtmlTextWriter which writes HTML 3.2
3 //
4 // Authors:
5 //      Matthijs ter Woord  [meddochat]  (meddochat@zonnet.nl)
6 //      Gonzalo Paniagua Javier (gonzalo@ximian.com)
7 //
8 // Copyright (C) Matthijs ter Woord, 2004
9 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System.Collections;
32 using System.Globalization;
33 using System.IO;
34 using System.Security.Permissions;
35
36 namespace System.Web.UI
37 {
38         [MonoTODO ("Needs work and verification.")]
39         // CAS
40         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
41         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
42         public class Html32TextWriter : HtmlTextWriter {
43 #if NET_2_0
44                 private bool div_table_substitution;
45                 private bool bold;
46                 private bool italic;
47 #endif
48
49                 public Html32TextWriter (TextWriter writer) : base (writer)
50                 {
51                 }
52
53                 public Html32TextWriter (TextWriter writer, string tabString) : base (writer, tabString)
54                 {
55                 }
56
57 #if NET_2_0
58                 [MonoTODO ("no effect on html generation")]
59                 public bool ShouldPerformDivTableSubstitution {
60                         get { return div_table_substitution; }
61                         set { div_table_substitution = value; }
62                 }
63
64                 [MonoTODO ("no effect on html generation")]
65                 public bool SupportsBold {
66                         get { return bold; }
67                         set { bold = value; }
68                 }
69
70                 [MonoTODO ("no effect on html generation")]
71                 public bool SupportsItalic {
72                         get { return italic; }
73                         set { italic = value; }
74                 }
75 #endif
76
77                 public override void RenderBeginTag (HtmlTextWriterTag tagKey)
78                 {
79                         base.RenderBeginTag (tagKey);
80                 }
81
82                 public override void RenderEndTag ()
83                 {
84                         base.RenderEndTag ();
85                 }
86
87                 protected override string GetTagName (HtmlTextWriterTag tagKey)
88                 {
89                         if (tagKey == HtmlTextWriterTag.Unknown ||
90                             !Enum.IsDefined (typeof (HtmlTextWriterTag), tagKey))
91                                 return "";
92
93                         return tagKey.ToString ().ToLower (CultureInfo.InvariantCulture);
94                         /* The code below is here just in case we need to split things up
95                         switch (tagkey) {
96                         case HtmlTextWriterTag.Unknown:
97                                 return "";
98                         case HtmlTextWriterTag.A:
99                                 return "a";
100                         case HtmlTextWriterTag.Acronym:
101                                 return "acronym";
102                         case HtmlTextWriterTag.Address:
103                                 return "address";
104                         case HtmlTextWriterTag.Area:
105                                 return "area";
106                         case HtmlTextWriterTag.B:
107                                 return "b";
108                         case HtmlTextWriterTag.Base:
109                                 return "base";
110                         case HtmlTextWriterTag.Basefont:
111                                 return "basefont";
112                         case HtmlTextWriterTag.Bdo:
113                                 return "bdo";
114                         case HtmlTextWriterTag.Bgsound:
115                                 return "bgsound";
116                         case HtmlTextWriterTag.Big:
117                                 return "big";
118                         case HtmlTextWriterTag.Blockquote:
119                                 return "blockquote";
120                         case HtmlTextWriterTag.Body:
121                                 return "body";
122                         case HtmlTextWriterTag.Br:
123                                 return "br";
124                         case HtmlTextWriterTag.Button:
125                                 return "button";
126                         case HtmlTextWriterTag.Caption:
127                                 return "caption";
128                         case HtmlTextWriterTag.Center:
129                                 return "center";
130                         case HtmlTextWriterTag.Cite:
131                                 return "cite";
132                         case HtmlTextWriterTag.Code:
133                                 return "code";
134                         case HtmlTextWriterTag.Col:
135                                 return "col";
136                         case HtmlTextWriterTag.Colgroup:
137                                 return "colgroup";
138                         case HtmlTextWriterTag.Dd:
139                                 return "dd";
140                         case HtmlTextWriterTag.Del:
141                                 return "del";
142                         case HtmlTextWriterTag.Dfn:
143                                 return "dfn";
144                         case HtmlTextWriterTag.Dir:
145                                 return "dir";
146                         case HtmlTextWriterTag.Div:
147                                 return "table";
148                         case HtmlTextWriterTag.Dl:
149                                 return "dl";
150                         case HtmlTextWriterTag.Dt:
151                                 return "dt";
152                         case HtmlTextWriterTag.Em:
153                                 return "em";
154                         case HtmlTextWriterTag.Embed:
155                                 return "embed";
156                         case HtmlTextWriterTag.Fieldset:
157                                 return "fieldset";
158                         case HtmlTextWriterTag.Font:
159                                 return "font";
160                         case HtmlTextWriterTag.Form:
161                                 return "form";
162                         case HtmlTextWriterTag.Frame:
163                                 return "frame";
164                         case HtmlTextWriterTag.Frameset:
165                                 return "frameset";
166                         case HtmlTextWriterTag.H1:
167                                 return "h1";
168                         case HtmlTextWriterTag.H2:
169                                 return "h2";
170                         case HtmlTextWriterTag.H3:
171                                 return "h3";
172                         case HtmlTextWriterTag.H4:
173                                 return "h4";
174                         case HtmlTextWriterTag.H5:
175                                 return "h5";
176                         case HtmlTextWriterTag.H6:
177                                 return "h6";
178                         case HtmlTextWriterTag.Head:
179                                 return "head";
180                         case HtmlTextWriterTag.Hr:
181                                 return "hr";
182                         case HtmlTextWriterTag.Html:
183                                 return "html";
184                         case HtmlTextWriterTag.I:
185                                 return "i";
186                         case HtmlTextWriterTag.Iframe:
187                                 return "iframe";
188                         case HtmlTextWriterTag.Img:
189                                 return "img";
190                         case HtmlTextWriterTag.Input:
191                                 return "input";
192                         case HtmlTextWriterTag.Ins:
193                                 return "ins";
194                         case HtmlTextWriterTag.Isindex:
195                                 return "isindex";
196                         case HtmlTextWriterTag.Kbd:
197                                 return "kbd";
198                         case HtmlTextWriterTag.Label:
199                                 return "label";
200                         case HtmlTextWriterTag.Legend:
201                                 return "legend";
202                         case HtmlTextWriterTag.Li:
203                                 return "li";
204                         case HtmlTextWriterTag.Link:
205                                 return "link";
206                         case HtmlTextWriterTag.Map:
207                                 return "map";
208                         case HtmlTextWriterTag.Marquee:
209                                 return "marquee";
210                         case HtmlTextWriterTag.Menu:
211                                 return "menu";
212                         case HtmlTextWriterTag.Meta:
213                                 return "meta";
214                         case HtmlTextWriterTag.Nobr:
215                                 return "nobr";
216                         case HtmlTextWriterTag.Noframes:
217                                 return "noframes";
218                         case HtmlTextWriterTag.Noscript:
219                                 return "noscript";
220                         case HtmlTextWriterTag.Object:
221                                 return "object";
222                         case HtmlTextWriterTag.Ol:
223                                 return "ol";
224                         case HtmlTextWriterTag.Option:
225                                 return "option";
226                         case HtmlTextWriterTag.P:
227                                 return "p";
228                         case HtmlTextWriterTag.Param:
229                                 return "param";
230                         case HtmlTextWriterTag.Pre:
231                                 return "pre";
232                         case HtmlTextWriterTag.Q:
233                                 return "q";
234                         case HtmlTextWriterTag.Rt:
235                                 return "rt";
236                         case HtmlTextWriterTag.Ruby:
237                                 return "ruby";
238                         case HtmlTextWriterTag.S:
239                                 return "s";
240                         case HtmlTextWriterTag.Samp:
241                                 return "samp";
242                         case HtmlTextWriterTag.Script:
243                                 return "script";
244                         case HtmlTextWriterTag.Select:
245                                 return "select";
246                         case HtmlTextWriterTag.Small:
247                                 return "small";
248                         case HtmlTextWriterTag.Span:
249                                 return "span";
250                         case HtmlTextWriterTag.Strike:
251                                 return "strike";
252                         case HtmlTextWriterTag.Strong:
253                                 return "strong";
254                         case HtmlTextWriterTag.Style:
255                                 return "style";
256                         case HtmlTextWriterTag.Sub:
257                                 return "sub";
258                         case HtmlTextWriterTag.Sup:
259                                 return "sup";
260                         case HtmlTextWriterTag.Table:
261                                 return "table";
262                         case HtmlTextWriterTag.Tbody:
263                                 return "tbody";
264                         case HtmlTextWriterTag.Td:
265                                 return "td";
266                         case HtmlTextWriterTag.Textarea:
267                                 return "textarea";
268                         case HtmlTextWriterTag.Tfoot:
269                                 return "tfoot";
270                         case HtmlTextWriterTag.Th:
271                                 return "th";
272                         case HtmlTextWriterTag.Thead:
273                                 return "thead";
274                         case HtmlTextWriterTag.Title:
275                                 return "title";
276                         case HtmlTextWriterTag.Tr:
277                                 return "tr";
278                         case HtmlTextWriterTag.Tt:
279                                 return "tt";
280                         case HtmlTextWriterTag.U:
281                                 return "u";
282                         case HtmlTextWriterTag.Ul:
283                                 return "ul";
284                         case HtmlTextWriterTag.Var:
285                                 return "var";
286                         case HtmlTextWriterTag.Wbr:
287                                 return "wbr";
288                         case HtmlTextWriterTag.Xml:
289                                 return "xml";
290                         default:
291                                 return "";
292                         }
293                         */
294                 }
295
296                 protected override bool OnStyleAttributeRender (string name, string value, HtmlTextWriterStyle key)
297                 {
298                         return base.OnStyleAttributeRender (name, value, key);
299                 }
300
301                 protected override bool OnTagRender (string name, HtmlTextWriterTag key)
302                 {
303                         return base.OnTagRender (name, key);
304                 }
305
306                 protected override string RenderAfterContent ()
307                 {
308                         return base.RenderAfterContent ();
309                 }
310
311                 protected override string RenderAfterTag ()
312                 {
313                         return base.RenderAfterTag ();
314                 }
315
316                 protected override string RenderBeforeContent ()
317                 {
318                         return base.RenderBeforeContent ();
319                 }
320
321                 protected override string RenderBeforeTag ()
322                 {
323                         return base.RenderBeforeTag ();
324                 }
325
326                 [MonoTODO]
327                 protected Stack FontStack {
328                         get {
329                                 return null;
330                         }
331                 }
332         }
333 }
334