Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions
nsIDocumentEncoder Class Reference

#include <nsIDocumentEncoder.h>

Inheritance diagram for nsIDocumentEncoder:
Inheritance graph
[legend]
Collaboration diagram for nsIDocumentEncoder:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  OutputSelectionOnly = 1, OutputFormatted = 2, OutputRaw = 4, OutputBodyOnly = 8,
  OutputPreformatted = 16, OutputWrap = 32, OutputFormatFlowed = 64, OutputAbsoluteLinks = 128,
  OutputEncodeW3CEntities = 256, OutputCRLineBreak = 512, OutputLFLineBreak = 1024, OutputNoScriptContent = 2048,
  OutputNoFramesContent = 4096, OutputNoFormattingInPre = 8192, OutputEncodeBasicEntities = 16384, OutputEncodeLatin1Entities = 32768,
  OutputEncodeHTMLEntities = 65536
}
 Output methods flag bits. More...

Public Member Functions

NS_IMETHOD Init (nsIDocument *aDocument, const nsAString &aMimeType, PRUint32 flags)=0
 Initialize with a pointer to the document and the mime type.
NS_IMETHOD SetSelection (nsISelection *aSelection)=0
 If the selection is set to a non-null value, then the selection is used for encoding, otherwise the entire document is encoded.
NS_IMETHOD SetRange (nsIDOMRange *aRange)=0
 If the range is set to a non-null value, then the range is used for encoding, otherwise the entire document or selection is encoded.
NS_IMETHOD SetNode (nsIDOMNode *aNode)=0
 If the node is set to a non-null value, then the node is used for encoding, otherwise the entire document or range or selection is encoded.
NS_IMETHOD SetCharset (const nsACString &aCharset)=0
 Documents typically have an intrinsic character set.
NS_IMETHOD SetWrapColumn (PRUint32 aWC)=0
 Set a wrap column.
NS_IMETHOD GetMimeType (nsAString &aMimeType)=0
 Get the mime type preferred by the encoder.
NS_IMETHOD EncodeToStream (nsIOutputStream *aStream)=0
 The document is encoded, the result is sent to the to nsIOutputStream.
NS_IMETHOD EncodeToString (nsAString &aOutputString)=0
NS_IMETHOD EncodeToStringWithContext (nsAString &aEncodedString, nsAString &aContextString, nsAString &aInfoString)=0
 The document is encoded, the result is sent to the to aEncodedString.
NS_IMETHOD SetNodeFixup (nsIDocumentEncoderNodeFixup *aFixup)=0
 Set the fixup object associated with node persistence.

Detailed Description

Definition at line 95 of file nsIDocumentEncoder.h.


Member Enumeration Documentation

anonymous enum

Output methods flag bits.

There are a frightening number of these, because everyone wants something a little bit different!

These should move to an idl file so that Javascript can have access to the symbols, not just the constants.

Enumerator:
OutputSelectionOnly 
OutputFormatted 
OutputRaw 
OutputBodyOnly 
OutputPreformatted 
OutputWrap 
OutputFormatFlowed 
OutputAbsoluteLinks 
OutputEncodeW3CEntities 
OutputCRLineBreak 
OutputLFLineBreak 
OutputNoScriptContent 
OutputNoFramesContent 
OutputNoFormattingInPre 
OutputEncodeBasicEntities 
OutputEncodeLatin1Entities 
OutputEncodeHTMLEntities 

Definition at line 110 of file nsIDocumentEncoder.h.

       {
    // Output only the selection (as opposed to the whole document).
    OutputSelectionOnly = 1,

    // Plaintext output: Convert html to plaintext that looks like the html.
    // Implies wrap (except inside <pre>), since html wraps.
    // HTML output: always do prettyprinting, ignoring existing formatting.
    // (Probably not well tested for HTML output.)
    OutputFormatted     = 2,

    // Don't do prettyprinting of HTML.  Don't do any wrapping that's not in
    // the existing HTML source.  This option overrides OutputFormatted if both
    // are set.  Note that this option does not affect entity conversion.
    OutputRaw           = 4,

    // No html head tags
    OutputBodyOnly      = 8,

    // Wrap even if we're not doing formatted output (e.g. for text fields)
    // XXXbz this doesn't seem to be used by all serializers... document?  How
    // does this interact with
    // OutputFormatted/OutputRaw/OutputWrap/OutputFormatFlowed?
    OutputPreformatted  = 16,

    // Output as though the content is preformatted
    // (e.g. maybe it's wrapped in a MOZ_PRE or MOZ_PRE_WRAP style tag)
    // XXXbz this doesn't seem to be used by all serializers... document?  How
    // does this interact with
    // OutputFormatted/OutputRaw/OutputPreformatted/OutputFormatFlowed?
    OutputWrap          = 32,

    // Output for format flowed (RFC 2646). This is used when converting
    // to text for mail sending. This differs just slightly
    // but in an important way from normal formatted, and that is that
    // lines are space stuffed. This can't (correctly) be done later.
    // XXXbz this doesn't seem to be used by all serializers... document?  How
    // does this interact with
    // OutputFormatted/OutputRaw/OutputPreformatted/OutputWrap?
    OutputFormatFlowed  = 64,

    // Convert links, image src, and script src to absolute URLs when possible
    OutputAbsoluteLinks = 128,

    // Attempt to encode entities standardized at W3C (HTML, MathML, etc).
    // This is a catch-all flag for documents with mixed contents. Beware of
    // interoperability issues. See below for other flags which might likely
    // do what you want.
    OutputEncodeW3CEntities = 256,

    // LineBreak processing: we can do either platform line breaks,
    // CR, LF, or CRLF.  If neither of these flags is set, then we
    // will use platform line breaks.
    OutputCRLineBreak = 512,
    OutputLFLineBreak = 1024,

    // Output the content of noscript elements (only for serializing
    // to plaintext).
    OutputNoScriptContent = 2048,

    // Output the content of noframes elements (only for serializing
    // to plaintext).
    OutputNoFramesContent = 4096,

    // Don't allow any formatting nodes (e.g. <br>, <b>) inside a <pre>.
    // This is used primarily by mail.
    OutputNoFormattingInPre = 8192,

    // Encode entities when outputting to a string.
    // E.g. If set, we'll output &nbsp; if clear, we'll output 0xa0.
    // The basic set is just &nbsp; &amp; &lt; &gt; &quot; for interoperability
    // with older products that don't support &alpha; and friends.
    // The Latin1 entity set additionally includes 8bit accented letters
    // between 128 and 255.
    // The HTML entity set additionally includes accented letters, greek
    // letters, and other special markup symbols as defined in HTML4.
    OutputEncodeBasicEntities = 16384,
    OutputEncodeLatin1Entities = 32768,
    OutputEncodeHTMLEntities = 65536
  };

Member Function Documentation

The document is encoded, the result is sent to the to nsIOutputStream.

Possible result codes are passing along whatever stream errors might have been encountered.

Implemented in nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::EncodeToString ( nsAString &  aOutputString) [pure virtual]

Implemented in nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::EncodeToStringWithContext ( nsAString &  aEncodedString,
nsAString &  aContextString,
nsAString &  aInfoString 
) [pure virtual]

The document is encoded, the result is sent to the to aEncodedString.

Parent heirarchy information is encoded to aContextString. Extra context info is encoded in aInfoString.

Implemented in nsHTMLCopyEncoder, and nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::GetMimeType ( nsAString &  aMimeType) [pure virtual]

Get the mime type preferred by the encoder.

This piece of api was added because the copy encoder may need to switch mime types on you if you ask it to copy html that really represents plaintext content. Call this AFTER Init() and SetSelection() have both been called.

Implemented in nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::Init ( nsIDocument aDocument,
const nsAString &  aMimeType,
PRUint32  flags 
) [pure virtual]

Initialize with a pointer to the document and the mime type.

Implemented in nsHTMLCopyEncoder, and nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::SetCharset ( const nsACString &  aCharset) [pure virtual]

Documents typically have an intrinsic character set.

If no intrinsic value is found, the platform character set is used. aCharset overrides the both the intrinsic or platform character set when encoding the document.

Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER

Implemented in nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::SetNode ( nsIDOMNode aNode) [pure virtual]

If the node is set to a non-null value, then the node is used for encoding, otherwise the entire document or range or selection is encoded.

Implemented in nsDocumentEncoder.

Set the fixup object associated with node persistence.

Implemented in nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::SetRange ( nsIDOMRange aRange) [pure virtual]

If the range is set to a non-null value, then the range is used for encoding, otherwise the entire document or selection is encoded.

Implemented in nsDocumentEncoder.

NS_IMETHOD nsIDocumentEncoder::SetSelection ( nsISelection aSelection) [pure virtual]

If the selection is set to a non-null value, then the selection is used for encoding, otherwise the entire document is encoded.

Implemented in nsHTMLCopyEncoder, and nsDocumentEncoder.

Set a wrap column.

This may have no effect in some types of encoders.

Implemented in nsDocumentEncoder.


The documentation for this class was generated from the following file: