diff options
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs new file mode 100644 index 00000000000..b77497a20e8 --- /dev/null +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms.RTF/TextMap.cs @@ -0,0 +1,228 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2005 Novell, Inc. (http://www.novell.com) +// +// Authors: +// Peter Bartok (pbartok@novell.com) +// +// + +// This map is for convencience only, any app can create/use it's own +// StdCharCode -> <text> table + +using System.Collections; + +namespace System.Windows.Forms.RTF { + internal class TextMap { + #region Local Variables + private string[] table; + #endregion // Local Variables + + #region Public Constructors + public TextMap() { + table = new string[(int)StandardCharCode.MaxChar]; + + for (int i = 0; i < (int)StandardCharCode.MaxChar; i++) { + table[i] = string.Empty; + } + } + #endregion // Public Constructors + + #region Public Instance Properties + internal string this[StandardCharCode c] { // FIXME - this should be public, if the whole namespace was public (ie standalone RTF parser) + get { + return table[(int)c]; + } + + set { + table[(int)c] = value; + } + } + + public string[] Table { + get { + return table; + } + } + #endregion // Public Instance Properties + + #region Public Static Methods + public static void SetupStandardTable(string[] table) { + table[(int)StandardCharCode.space] = " "; + table[(int)StandardCharCode.exclam] = "!"; + table[(int)StandardCharCode.quotedbl] = "\""; + table[(int)StandardCharCode.numbersign] = "#"; + table[(int)StandardCharCode.dollar] = "$"; + table[(int)StandardCharCode.percent] = "%"; + table[(int)StandardCharCode.ampersand] = "&"; + table[(int)StandardCharCode.quoteright] = "'"; + table[(int)StandardCharCode.parenleft] = "("; + table[(int)StandardCharCode.parenright] = ")"; + table[(int)StandardCharCode.asterisk] = "*"; + table[(int)StandardCharCode.plus] = "+"; + table[(int)StandardCharCode.comma] = ","; + table[(int)StandardCharCode.hyphen] = "-"; + table[(int)StandardCharCode.period] = "."; + table[(int)StandardCharCode.slash] = "/"; + table[(int)StandardCharCode.zero] = "0"; + table[(int)StandardCharCode.one] = "1"; + table[(int)StandardCharCode.two] = "2"; + table[(int)StandardCharCode.three] = "3"; + table[(int)StandardCharCode.four] = "4"; + table[(int)StandardCharCode.five] = "5"; + table[(int)StandardCharCode.six] = "6"; + table[(int)StandardCharCode.seven] = "7"; + table[(int)StandardCharCode.eight] = "8"; + table[(int)StandardCharCode.nine] = "9"; + table[(int)StandardCharCode.colon] = ":"; + table[(int)StandardCharCode.semicolon] = ";"; + table[(int)StandardCharCode.less] = "<"; + table[(int)StandardCharCode.equal] = "="; + table[(int)StandardCharCode.greater] = ">"; + table[(int)StandardCharCode.question] = "?"; + table[(int)StandardCharCode.at] = "@"; + table[(int)StandardCharCode.A] = "A"; + table[(int)StandardCharCode.B] = "B"; + table[(int)StandardCharCode.C] = "C"; + table[(int)StandardCharCode.D] = "D"; + table[(int)StandardCharCode.E] = "E"; + table[(int)StandardCharCode.F] = "F"; + table[(int)StandardCharCode.G] = "G"; + table[(int)StandardCharCode.H] = "H"; + table[(int)StandardCharCode.I] = "I"; + table[(int)StandardCharCode.J] = "J"; + table[(int)StandardCharCode.K] = "K"; + table[(int)StandardCharCode.L] = "L"; + table[(int)StandardCharCode.M] = "M"; + table[(int)StandardCharCode.N] = "N"; + table[(int)StandardCharCode.O] = "O"; + table[(int)StandardCharCode.P] = "P"; + table[(int)StandardCharCode.Q] = "Q"; + table[(int)StandardCharCode.R] = "R"; + table[(int)StandardCharCode.S] = "S"; + table[(int)StandardCharCode.T] = "T"; + table[(int)StandardCharCode.U] = "U"; + table[(int)StandardCharCode.V] = "V"; + table[(int)StandardCharCode.W] = "W"; + table[(int)StandardCharCode.X] = "X"; + table[(int)StandardCharCode.Y] = "Y"; + table[(int)StandardCharCode.Z] = "Z"; + table[(int)StandardCharCode.bracketleft] = "["; + table[(int)StandardCharCode.backslash] = "\\"; + table[(int)StandardCharCode.bracketright] = "]"; + table[(int)StandardCharCode.asciicircum] = "^"; + table[(int)StandardCharCode.underscore] = "_"; + table[(int)StandardCharCode.quoteleft] = "`"; + table[(int)StandardCharCode.a] = "a"; + table[(int)StandardCharCode.b] = "b"; + table[(int)StandardCharCode.c] = "c"; + table[(int)StandardCharCode.d] = "d"; + table[(int)StandardCharCode.e] = "e"; + table[(int)StandardCharCode.f] = "f"; + table[(int)StandardCharCode.g] = "g"; + table[(int)StandardCharCode.h] = "h"; + table[(int)StandardCharCode.i] = "i"; + table[(int)StandardCharCode.j] = "j"; + table[(int)StandardCharCode.k] = "k"; + table[(int)StandardCharCode.l] = "l"; + table[(int)StandardCharCode.m] = "m"; + table[(int)StandardCharCode.n] = "n"; + table[(int)StandardCharCode.o] = "o"; + table[(int)StandardCharCode.p] = "p"; + table[(int)StandardCharCode.q] = "q"; + table[(int)StandardCharCode.r] = "r"; + table[(int)StandardCharCode.s] = "s"; + table[(int)StandardCharCode.t] = "t"; + table[(int)StandardCharCode.u] = "u"; + table[(int)StandardCharCode.v] = "v"; + table[(int)StandardCharCode.w] = "w"; + table[(int)StandardCharCode.x] = "x"; + table[(int)StandardCharCode.y] = "y"; + table[(int)StandardCharCode.z] = "z"; + table[(int)StandardCharCode.braceleft] = "{"; + table[(int)StandardCharCode.bar] = "|"; + table[(int)StandardCharCode.braceright] = "}"; + table[(int)StandardCharCode.asciitilde] = "~"; + table[(int)StandardCharCode.AE] = "AE"; + table[(int)StandardCharCode.OE] = "OE"; + table[(int)StandardCharCode.acute] = "'"; + table[(int)StandardCharCode.ae] = "ae"; + table[(int)StandardCharCode.angleleft] = "<"; + table[(int)StandardCharCode.angleright] = ">"; + table[(int)StandardCharCode.arrowboth] = "<->"; + table[(int)StandardCharCode.arrowdblboth] = "<=>"; + table[(int)StandardCharCode.arrowdblleft] = "<="; + table[(int)StandardCharCode.arrowdblright] = "=>"; + table[(int)StandardCharCode.arrowleft] = "<-"; + table[(int)StandardCharCode.arrowright] = "->"; + table[(int)StandardCharCode.bullet] = "o"; + table[(int)StandardCharCode.cent] = "cent"; + table[(int)StandardCharCode.circumflex] = "^"; + table[(int)StandardCharCode.copyright] = "(c)"; + table[(int)StandardCharCode.copyrightsans] = "(c)"; + table[(int)StandardCharCode.degree] = "deg."; + table[(int)StandardCharCode.divide] = "/"; + table[(int)StandardCharCode.dotlessi] = "i"; + table[(int)StandardCharCode.ellipsis] = "..."; + table[(int)StandardCharCode.emdash] = "--"; + table[(int)StandardCharCode.endash] = "-"; + table[(int)StandardCharCode.fi] = "fi"; + table[(int)StandardCharCode.fl] = "fl"; + table[(int)StandardCharCode.fraction] = "/"; + table[(int)StandardCharCode.germandbls] = "ss"; + table[(int)StandardCharCode.grave] = "`"; + table[(int)StandardCharCode.greaterequal] = ">="; + table[(int)StandardCharCode.guillemotleft] = "<<"; + table[(int)StandardCharCode.guillemotright] = ">>"; + table[(int)StandardCharCode.guilsinglleft] = "<"; + table[(int)StandardCharCode.guilsinglright] = ">"; + table[(int)StandardCharCode.lessequal] = "<="; + table[(int)StandardCharCode.logicalnot] = "~"; + table[(int)StandardCharCode.mathasterisk] = "*"; + table[(int)StandardCharCode.mathequal] = "="; + table[(int)StandardCharCode.mathminus] = "-"; + table[(int)StandardCharCode.mathnumbersign] = "#"; + table[(int)StandardCharCode.mathplus] = "+"; + table[(int)StandardCharCode.mathtilde] = "~"; + table[(int)StandardCharCode.minus] = "-"; + table[(int)StandardCharCode.mu] = "u"; + table[(int)StandardCharCode.multiply] = "x"; + table[(int)StandardCharCode.nobrkhyphen] = "-"; + table[(int)StandardCharCode.nobrkspace] = ""; + table[(int)StandardCharCode.notequal] = "!="; + table[(int)StandardCharCode.oe] = "oe"; + table[(int)StandardCharCode.onehalf] = "1/2"; + table[(int)StandardCharCode.onequarter] = "1/4"; + table[(int)StandardCharCode.periodcentered] = "."; + table[(int)StandardCharCode.plusminus] = "+/-"; + table[(int)StandardCharCode.quotedblbase] = ",,"; + table[(int)StandardCharCode.quotedblleft] = "\""; + table[(int)StandardCharCode.quotedblright] = "\""; + table[(int)StandardCharCode.quotesinglbase] = ","; + table[(int)StandardCharCode.registered] = "reg."; + table[(int)StandardCharCode.registersans] = "reg."; + table[(int)StandardCharCode.threequarters] = "3/4"; + table[(int)StandardCharCode.tilde] = "~"; + table[(int)StandardCharCode.trademark] = "(TM)"; + table[(int)StandardCharCode.trademarksans] = "(TM)"; + } + #endregion // Public Static Methods + } +} |