~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/htmlparser/src/nsViewSourceHTML.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 
2
/*
 
3
 * The contents of this file are subject to the Netscape Public
 
4
 * License Version 1.1 (the "License"); you may not use this file
 
5
 * except in compliance with the License. You may obtain a copy of
 
6
 * the License at http://www.mozilla.org/NPL/
 
7
 *
 
8
 * Software distributed under the License is distributed on an "AS
 
9
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
10
 * implied. See the License for the specific language governing
 
11
 * rights and limitations under the License.
 
12
 *
 
13
 * The Original Code is mozilla.org code.
 
14
 *
 
15
 * The Initial Developer of the Original Code is Netscape
 
16
 * Communications Corporation.  Portions created by Netscape are
 
17
 * Copyright (C) 1998 Netscape Communications Corporation. All
 
18
 * Rights Reserved.
 
19
 *
 
20
 * Contributor(s): 
 
21
 */
 
22
 
 
23
/**
 
24
 * MODULE NOTES:
 
25
 * @update  gess 4/8/98
 
26
 * 
 
27
 *         
 
28
 */
 
29
 
 
30
#ifndef __NS_VIEWSOURCE_HTML_
 
31
#define __NS_VIEWSOURCE_HTML_
 
32
 
 
33
#include "nsIDTD.h"
 
34
#include "nsISupports.h"
 
35
#include "nsHTMLTokens.h"
 
36
#include "nsIHTMLContentSink.h"
 
37
#include "nsDTDUtils.h"
 
38
#include "nsParserNode.h"
 
39
 
 
40
#define NS_VIEWSOURCE_HTML_IID      \
 
41
  {0xb6003010, 0x7932, 0x11d2, \
 
42
  {0x80, 0x1b, 0x0, 0x60, 0x8, 0xbf, 0xc4, 0x89 }}
 
43
 
 
44
 
 
45
class nsIParserNode;
 
46
class nsParser;
 
47
class nsITokenizer;
 
48
class nsCParserNode;
 
49
 
 
50
class CViewSourceHTML: public nsIDTD
 
51
{
 
52
public:
 
53
 
 
54
    NS_DECL_ISUPPORTS
 
55
    NS_DECL_NSIDTD
 
56
    
 
57
    CViewSourceHTML();
 
58
    virtual ~CViewSourceHTML();
 
59
 
 
60
    /**
 
61
     * Set this to TRUE if you want the DTD to verify its
 
62
     * context stack.
 
63
     * @update  gess 7/23/98
 
64
     * @param 
 
65
     * @return
 
66
     */
 
67
    virtual void SetVerification(PRBool aEnable);
 
68
 
 
69
private:
 
70
    nsresult WriteTag(PRInt32 tagType,
 
71
                      const nsAString &aText,
 
72
                      PRInt32 attrCount,
 
73
                      PRBool aNewlineRequired);
 
74
    
 
75
    nsresult WriteAttributes(PRInt32 attrCount);
 
76
    nsresult GenerateSummary();
 
77
    void StartNewPreBlock(void);
 
78
    // Utility method for adding attributes to the nodes we generate
 
79
    void AddAttrToNode(nsCParserStartNode& aNode,
 
80
                       nsTokenAllocator* aAllocator,
 
81
                       const nsAString& aAttrName,
 
82
                       const nsAString& aAttrValue);
 
83
 
 
84
protected:
 
85
 
 
86
    nsParser*           mParser;
 
87
    nsIHTMLContentSink* mSink;
 
88
    PRInt32             mLineNumber;
 
89
    nsITokenizer*       mTokenizer; // weak
 
90
 
 
91
    PRInt32             mStartTag;
 
92
    PRInt32             mEndTag;
 
93
    PRInt32             mCommentTag;
 
94
    PRInt32             mCDATATag;
 
95
    PRInt32             mMarkupDeclaration;
 
96
    PRInt32             mDocTypeTag;
 
97
    PRInt32             mPITag;
 
98
    PRInt32             mEntityTag;
 
99
    PRInt32             mText;
 
100
    PRInt32             mKey;
 
101
    PRInt32             mValue;
 
102
    PRInt32             mPopupTag;
 
103
    PRInt32             mSummaryTag;
 
104
    PRPackedBool        mSyntaxHighlight;
 
105
    PRPackedBool        mWrapLongLines;
 
106
    PRPackedBool        mHasOpenRoot;
 
107
    PRPackedBool        mHasOpenBody;
 
108
 
 
109
    nsDTDMode           mDTDMode;
 
110
    eParserCommands     mParserCommand;   //tells us to viewcontent/viewsource/viewerrors...
 
111
    eParserDocType      mDocType;
 
112
    nsCString           mMimeType;  
 
113
    PRInt32             mErrorCount;
 
114
    PRInt32             mTagCount;
 
115
 
 
116
    nsString            mFilename;
 
117
    nsString            mTags;
 
118
    nsString            mErrors;
 
119
 
 
120
    PRUint32            mTokenCount;
 
121
};
 
122
 
 
123
extern nsresult NS_NewViewSourceHTML(nsIDTD** aInstancePtrResult);
 
124
 
 
125
#endif 
 
126
 
 
127
 
 
128