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) 2008 Novell, Inc. 21 // 22 // Authors: 23 // Andreia Gaita (avidigal@novell.com) 24 // 25 26 using System; 27 28 namespace Mono.Mozilla.DOM 29 { 30 31 32 internal enum DocumentEncoderFlags: uint 33 { 34 /** 35 * Output only the selection (as opposed to the whole document). 36 */ 37 OutputSelectionOnly = (1 << 0), 38 39 /** Plaintext output: Convert html to plaintext that looks like the html. 40 * Implies wrap (except inside <pre>), since html wraps. 41 * HTML output: always do prettyprinting, ignoring existing formatting. 42 * (Probably not well tested for HTML output.) 43 */ 44 OutputFormatted = (1 << 1), 45 46 /** Don't do prettyprinting of HTML. Don't do any wrapping that's not in 47 * the existing HTML source. This option overrides OutputFormatted if both 48 * are set. 49 * @note This option does not affect entity conversion. 50 */ 51 OutputRaw = (1 << 2), 52 53 /** 54 * Do not print html head tags. 55 */ 56 OutputBodyOnly = (1 << 3), 57 58 /** 59 * Wrap even if we're not doing formatted output (e.g. for text fields) 60 * XXXbz this doesn't seem to be used by all serializers... document? How 61 * does this interact with 62 * OutputFormatted/OutputRaw/OutputWrap/OutputFormatFlowed? 63 */ 64 OutputPreformatted = (1 << 4), 65 66 /** 67 * Output as though the content is preformatted 68 * (e.g. maybe it's wrapped in a MOZ_PRE or MOZ_PRE_WRAP style tag) 69 * XXXbz this doesn't seem to be used by all serializers... document? How 70 * does this interact with 71 * OutputFormatted/OutputRaw/OutputPreformatted/OutputFormatFlowed? 72 */ 73 OutputWrap = (1 << 5), 74 75 /** 76 * Output for format flowed (RFC 2646). This is used when converting 77 * to text for mail sending. This differs just slightly 78 * but in an important way from normal formatted, and that is that 79 * lines are space stuffed. This can't (correctly) be done later. 80 * XXXbz this doesn't seem to be used by all serializers... document? How 81 * does this interact with 82 * OutputFormatted/OutputRaw/OutputPreformatted/OutputWrap? 83 */ 84 OutputFormatFlowed = (1 << 6), 85 86 /** 87 * Convert links, image src, and script src to absolute URLs when possible 88 */ 89 OutputAbsoluteLinks = (1 << 7), 90 91 /** 92 * Attempt to encode entities standardized at W3C (HTML, MathML, etc). 93 * This is a catch-all flag for documents with mixed contents. Beware of 94 * interoperability issues. See below for other flags which might likely 95 * do what you want. 96 */ 97 OutputEncodeW3CEntities = (1 << 8), 98 99 /** 100 * LineBreak processing: if this flag is set than CR line breaks will 101 * be written. If neither this nor OutputLFLineBreak is set, then we 102 * will use platform line breaks. The combination of the two flags will 103 * cause CRLF line breaks to be written. 104 */ 105 OutputCRLineBreak = (1 << 9), 106 107 /** 108 * LineBreak processing: if this flag is set than LF line breaks will 109 * be written. If neither this nor OutputCRLineBreak is set, then we 110 * will use platform line breaks. The combination of the two flags will 111 * cause CRLF line breaks to be written. 112 */ 113 OutputLFLineBreak = (1 << 10), 114 115 /** 116 * Output the content of noscript elements (only for serializing 117 * to plaintext). 118 */ 119 OutputNoScriptContent = (1 << 11), 120 121 /** 122 * Output the content of noframes elements (only for serializing 123 * to plaintext). 124 */ 125 OutputNoFramesContent = (1 << 12), 126 127 /** 128 * Don't allow any formatting nodes (e.g. <br>, <b>) inside a <pre>. 129 * This is used primarily by mail. 130 */ 131 OutputNoFormattingInPre = (1 << 13), 132 133 /** 134 * Encode entities when outputting to a string. 135 * E.g. If set, we'll output if clear, we'll output 0xa0. 136 * The basic set is just & < > " for interoperability 137 * with older products that don't support α and friends. 138 */ 139 OutputEncodeBasicEntities = (1 << 14), 140 141 /** 142 * Encode entities when outputting to a string. 143 * The Latin1 entity set additionally includes 8bit accented letters 144 * between 128 and 255. 145 */ 146 OutputEncodeLatin1Entities = (1 << 15), 147 148 /** 149 * Encode entities when outputting to a string. 150 * The HTML entity set additionally includes accented letters, greek 151 * letters, and other special markup symbols as defined in HTML4. 152 */ 153 OutputEncodeHTMLEntities = (1 << 16), 154 155 /** 156 * Normally is replaced with a space character when 157 * encoding data as plain text, set this flag if that's 158 * not desired. 159 */ 160 OutputPersistNBSP = (1 << 17), 161 162 } 163 } 164