New test.
[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         // CAS
39         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
40         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
41         public class Html32TextWriter : HtmlTextWriter {
42 #if NET_2_0
43                 private bool div_table_substitution;
44                 private bool bold;
45                 private bool italic;
46 #endif
47
48                 public Html32TextWriter (TextWriter writer) : base (writer)
49                 {
50                 }
51
52                 public Html32TextWriter (TextWriter writer, string tabString) : base (writer, tabString)
53                 {
54                 }
55
56 #if NET_2_0
57                 [MonoTODO ("no effect on html generation")]
58                 public bool ShouldPerformDivTableSubstitution {
59                         get { return div_table_substitution; }
60                         set { div_table_substitution = value; }
61                 }
62
63                 [MonoTODO ("no effect on html generation")]
64                 public bool SupportsBold {
65                         get { return bold; }
66                         set { bold = value; }
67                 }
68
69                 [MonoTODO ("no effect on html generation")]
70                 public bool SupportsItalic {
71                         get { return italic; }
72                         set { italic = value; }
73                 }
74 #endif
75
76                 public override void RenderBeginTag (HtmlTextWriterTag tagKey)
77                 {
78                         base.RenderBeginTag (tagKey);
79                 }
80
81                 public override void RenderEndTag ()
82                 {
83                         base.RenderEndTag ();
84                 }
85
86                 protected override string GetTagName (HtmlTextWriterTag tagKey)
87                 {
88                         if (tagKey == HtmlTextWriterTag.Unknown ||
89                             !Enum.IsDefined (typeof (HtmlTextWriterTag), tagKey))
90                                 return "";
91
92                         return tagKey.ToString ().ToLower (CultureInfo.InvariantCulture);
93                         /* The code below is here just in case we need to split things up
94                         switch (tagkey) {
95                         case HtmlTextWriterTag.Unknown:
96                                 return "";
97                         case HtmlTextWriterTag.A:
98                                 return "a";
99                         case HtmlTextWriterTag.Acronym:
100                                 return "acronym";
101                         case HtmlTextWriterTag.Address:
102                                 return "address";
103                         case HtmlTextWriterTag.Area:
104                                 return "area";
105                         case HtmlTextWriterTag.B:
106                                 return "b";
107                         case HtmlTextWriterTag.Base:
108                                 return "base";
109                         case HtmlTextWriterTag.Basefont:
110                                 return "basefont";
111                         case HtmlTextWriterTag.Bdo:
112                                 return "bdo";
113                         case HtmlTextWriterTag.Bgsound:
114                                 return "bgsound";
115                         case HtmlTextWriterTag.Big:
116                                 return "big";
117                         case HtmlTextWriterTag.Blockquote:
118                                 return "blockquote";
119                         case HtmlTextWriterTag.Body:
120                                 return "body";
121                         case HtmlTextWriterTag.Br:
122                                 return "br";
123                         case HtmlTextWriterTag.Button:
124                                 return "button";
125                         case HtmlTextWriterTag.Caption:
126                                 return "caption";
127                         case HtmlTextWriterTag.Center:
128                                 return "center";
129                         case HtmlTextWriterTag.Cite:
130                                 return "cite";
131                         case HtmlTextWriterTag.Code:
132                                 return "code";
133                         case HtmlTextWriterTag.Col:
134                                 return "col";
135                         case HtmlTextWriterTag.Colgroup:
136                                 return "colgroup";
137                         case HtmlTextWriterTag.Dd:
138                                 return "dd";
139                         case HtmlTextWriterTag.Del:
140                                 return "del";
141                         case HtmlTextWriterTag.Dfn:
142                                 return "dfn";
143                         case HtmlTextWriterTag.Dir:
144                                 return "dir";
145                         case HtmlTextWriterTag.Div:
146                                 return "table";
147                         case HtmlTextWriterTag.Dl:
148                                 return "dl";
149                         case HtmlTextWriterTag.Dt:
150                                 return "dt";
151                         case HtmlTextWriterTag.Em:
152                                 return "em";
153                         case HtmlTextWriterTag.Embed:
154                                 return "embed";
155                         case HtmlTextWriterTag.Fieldset:
156                                 return "fieldset";
157                         case HtmlTextWriterTag.Font:
158                                 return "font";
159                         case HtmlTextWriterTag.Form:
160                                 return "form";
161                         case HtmlTextWriterTag.Frame:
162                                 return "frame";
163                         case HtmlTextWriterTag.Frameset:
164                                 return "frameset";
165                         case HtmlTextWriterTag.H1:
166                                 return "h1";
167                         case HtmlTextWriterTag.H2:
168                                 return "h2";
169                         case HtmlTextWriterTag.H3:
170                                 return "h3";
171                         case HtmlTextWriterTag.H4:
172                                 return "h4";
173                         case HtmlTextWriterTag.H5:
174                                 return "h5";
175                         case HtmlTextWriterTag.H6:
176                                 return "h6";
177                         case HtmlTextWriterTag.Head:
178                                 return "head";
179                         case HtmlTextWriterTag.Hr:
180                                 return "hr";
181                         case HtmlTextWriterTag.Html:
182                                 return "html";
183                         case HtmlTextWriterTag.I:
184                                 return "i";
185                         case HtmlTextWriterTag.Iframe:
186                                 return "iframe";
187                         case HtmlTextWriterTag.Img:
188                                 return "img";
189                         case HtmlTextWriterTag.Input:
190                                 return "input";
191                         case HtmlTextWriterTag.Ins:
192                                 return "ins";
193                         case HtmlTextWriterTag.Isindex:
194                                 return "isindex";
195                         case HtmlTextWriterTag.Kbd:
196                                 return "kbd";
197                         case HtmlTextWriterTag.Label:
198                                 return "label";
199                         case HtmlTextWriterTag.Legend:
200                                 return "legend";
201                         case HtmlTextWriterTag.Li:
202                                 return "li";
203                         case HtmlTextWriterTag.Link:
204                                 return "link";
205                         case HtmlTextWriterTag.Map:
206                                 return "map";
207                         case HtmlTextWriterTag.Marquee:
208                                 return "marquee";
209                         case HtmlTextWriterTag.Menu:
210                                 return "menu";
211                         case HtmlTextWriterTag.Meta:
212                                 return "meta";
213                         case HtmlTextWriterTag.Nobr:
214                                 return "nobr";
215                         case HtmlTextWriterTag.Noframes:
216                                 return "noframes";
217                         case HtmlTextWriterTag.Noscript:
218                                 return "noscript";
219                         case HtmlTextWriterTag.Object:
220                                 return "object";
221                         case HtmlTextWriterTag.Ol:
222                                 return "ol";
223                         case HtmlTextWriterTag.Option:
224                                 return "option";
225                         case HtmlTextWriterTag.P:
226                                 return "p";
227                         case HtmlTextWriterTag.Param:
228                                 return "param";
229                         case HtmlTextWriterTag.Pre:
230                                 return "pre";
231                         case HtmlTextWriterTag.Q:
232                                 return "q";
233                         case HtmlTextWriterTag.Rt:
234                                 return "rt";
235                         case HtmlTextWriterTag.Ruby:
236                                 return "ruby";
237                         case HtmlTextWriterTag.S:
238                                 return "s";
239                         case HtmlTextWriterTag.Samp:
240                                 return "samp";
241                         case HtmlTextWriterTag.Script:
242                                 return "script";
243                         case HtmlTextWriterTag.Select:
244                                 return "select";
245                         case HtmlTextWriterTag.Small:
246                                 return "small";
247                         case HtmlTextWriterTag.Span:
248                                 return "span";
249                         case HtmlTextWriterTag.Strike:
250                                 return "strike";
251                         case HtmlTextWriterTag.Strong:
252                                 return "strong";
253                         case HtmlTextWriterTag.Style:
254                                 return "style";
255                         case HtmlTextWriterTag.Sub:
256                                 return "sub";
257                         case HtmlTextWriterTag.Sup:
258                                 return "sup";
259                         case HtmlTextWriterTag.Table:
260                                 return "table";
261                         case HtmlTextWriterTag.Tbody:
262                                 return "tbody";
263                         case HtmlTextWriterTag.Td:
264                                 return "td";
265                         case HtmlTextWriterTag.Textarea:
266                                 return "textarea";
267                         case HtmlTextWriterTag.Tfoot:
268                                 return "tfoot";
269                         case HtmlTextWriterTag.Th:
270                                 return "th";
271                         case HtmlTextWriterTag.Thead:
272                                 return "thead";
273                         case HtmlTextWriterTag.Title:
274                                 return "title";
275                         case HtmlTextWriterTag.Tr:
276                                 return "tr";
277                         case HtmlTextWriterTag.Tt:
278                                 return "tt";
279                         case HtmlTextWriterTag.U:
280                                 return "u";
281                         case HtmlTextWriterTag.Ul:
282                                 return "ul";
283                         case HtmlTextWriterTag.Var:
284                                 return "var";
285                         case HtmlTextWriterTag.Wbr:
286                                 return "wbr";
287                         case HtmlTextWriterTag.Xml:
288                                 return "xml";
289                         default:
290                                 return "";
291                         }
292                         */
293                 }
294
295                 protected override bool OnStyleAttributeRender (string name, string value, HtmlTextWriterStyle key)
296                 {
297                         return base.OnStyleAttributeRender (name, value, key);
298                 }
299
300                 protected override bool OnTagRender (string name, HtmlTextWriterTag key)
301                 {
302                         return base.OnTagRender (name, key);
303                 }
304
305                 protected override string RenderAfterContent ()
306                 {
307                         return base.RenderAfterContent ();
308                 }
309
310                 protected override string RenderAfterTag ()
311                 {
312                         return base.RenderAfterTag ();
313                 }
314
315                 protected override string RenderBeforeContent ()
316                 {
317                         return base.RenderBeforeContent ();
318                 }
319
320                 protected override string RenderBeforeTag ()
321                 {
322                         return base.RenderBeforeTag ();
323                 }
324
325                 [MonoTODO("Not implemented, always returns null")]
326                 protected Stack FontStack {
327                         get {
328                                 return null;
329                         }
330                 }
331         }
332 }
333