HTMLFILT.HXX
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:4k
源码类别:

Windows编程

开发平台:

Visual C++

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Copyright (C) 1992 - 1997 Microsoft Corporation.
  4. //
  5. //  File:       htmlfilt.hxx
  6. //
  7. //  Contents:   Html filter
  8. //
  9. //  Classes:    HtmlIFilter
  10. //
  11. //----------------------------------------------------------------------------
  12. #ifndef __HTMLFILT_HXX__
  13. #define __HTMLFILT_HXX__
  14. #include <htmliflt.hxx>
  15. #include <bag.hxx>
  16. class CHtmlElement;
  17. class CFullPropSpec;
  18. //+---------------------------------------------------------------------------
  19. //
  20. //  Class:      CHtmlIFilter
  21. //
  22. //  Purpose:    Html Filter
  23. //
  24. //----------------------------------------------------------------------------
  25. class CHtmlIFilter: public CHtmlIFilterBase
  26. {
  27. public:
  28.     CHtmlIFilter();
  29.     ~CHtmlIFilter();
  30.     //
  31.     // Functions inherited from IFilter and IPersistFile
  32.     //
  33.     SCODE STDMETHODCALLTYPE Init( ULONG grfFlags,
  34.                                   ULONG cAttributes,
  35.                                   FULLPROPSPEC const * aAttributes,
  36.                                   ULONG * pFlags );
  37.     SCODE STDMETHODCALLTYPE GetChunk( STAT_CHUNK * pStat );
  38.     SCODE STDMETHODCALLTYPE GetText( ULONG * pcwcOutput,
  39.                                      WCHAR * awcBuffer );
  40.     SCODE STDMETHODCALLTYPE GetValue( VARIANT ** ppPropValue );
  41.     SCODE STDMETHODCALLTYPE BindRegion( FILTERREGION origPos,
  42.                                         REFIID riid,
  43.                                         void ** ppunk );
  44.     SCODE STDMETHODCALLTYPE GetClassID(CLSID * pClassID);
  45.     SCODE STDMETHODCALLTYPE IsDirty();
  46.     SCODE STDMETHODCALLTYPE Load(LPCWSTR pszFileName, DWORD dwMode);
  47.     SCODE STDMETHODCALLTYPE Save(LPCWSTR pszFileName, BOOL fRemember);
  48.     SCODE STDMETHODCALLTYPE SaveCompleted(LPCWSTR pszFileName);
  49.     SCODE STDMETHODCALLTYPE GetCurFile(LPWSTR * ppszFileName);
  50.     //
  51.     // Html specific functions
  52.     //
  53.     void            ChangeState( CHtmlElement *pHtmlElemNewState );
  54.     CHtmlElement *  QueryHtmlElement( HtmlTokenType eTokType );
  55.     CHtmlElement *  GetCurHtmlElement()           { return _pHtmlElement; }
  56.     BOOL            IsStopToken( CToken& token );
  57.     ULONG           GetNextChunkId();
  58.     BOOL            FFilterContent()               { return _fFilterContent; }
  59.     LCID            GetLocale()                    { return _locale; }
  60.     void            SetLocale( LCID locale )       { _locale = locale; }
  61. private:
  62.     BOOL            IsNonHtmlFile();
  63.     CHtmlElement *            _pHtmlElement;       // Current processing element
  64.     BOOL                      _fNonHtmlFile;       // IE workaround: Set to true
  65.                                                    //   if a non-html file
  66.                                                    //   such as .gif file has been
  67.                                                    //   asked to be filtered by html
  68.                                                    //   filter
  69.     BOOL                      _fFilterContent;     // Filter contents ?
  70.     BOOL                      _fFilterMetaTag;     // Filter meta tag ?
  71.     BOOL                      _fFilterScriptTag;   // Filter script tag ?
  72.     ULONG                     _cAttributes;        // Count of attributes
  73.     CFullPropSpec *           _pAttributes;        // Attributes to filter
  74.     WCHAR *                   _pwszFileName;       // File that has been loaded
  75.     ULONG                     _ulChunkID;          // Current chunk id
  76.     LCID                      _locale;             // Locale
  77.     CHtmlElementBag           _htmlElementBag;     // Bag of various Html elements
  78.     CSerialStream             _serialStream;       // Input Stream
  79. };
  80. #endif  //  __HTMLFILT_HXX__