Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1993 - 1998.
  5. //
  6. // File: tfilt.hxx
  7. //
  8. // Contents: Text filter
  9. //
  10. // Classes: CTextIFilter
  11. //
  12. // History: 16-Jul-93 AmyA Created
  13. // 08-Mar-94 KyleP Cleaned up
  14. //
  15. //----------------------------------------------------------------------------
  16. #pragma once
  17. #include <stdio.h>
  18. #include <txtifilt.hxx>
  19. #include <mmstrm.hxx>
  20. #include <mmistrm.hxx>
  21. #include <mmscbuf.hxx>
  22. class CTextIFilterBase;
  23. //+---------------------------------------------------------------------------
  24. //
  25. // Class: CTextIFilter
  26. //
  27. // Purpose: Text Filter
  28. //
  29. // History: 16-Jul-93 AmyA Created
  30. //
  31. //----------------------------------------------------------------------------
  32. class CTextIFilter : public CTextIFilterBase
  33. {
  34. public:
  35. //
  36. // Since text files have no language specifier, just use the
  37. // default locale.
  38. //
  39. CTextIFilter( LCID locale = GetSystemDefaultLCID() );
  40. virtual ~CTextIFilter();
  41. //
  42. // From IFilter
  43. //
  44. SCODE STDMETHODCALLTYPE Init( ULONG grfFlags,
  45. ULONG cAttributes,
  46. FULLPROPSPEC const * aAttributes,
  47. ULONG * pFlags );
  48. SCODE STDMETHODCALLTYPE GetChunk( STAT_CHUNK * pStat );
  49. SCODE STDMETHODCALLTYPE GetText( ULONG * pcwcBuffer,
  50. WCHAR * awcBuffer );
  51. SCODE STDMETHODCALLTYPE GetValue( PROPVARIANT ** ppPropValue );
  52. SCODE STDMETHODCALLTYPE BindRegion( FILTERREGION origPos,
  53. REFIID riid,
  54. void ** ppunk );
  55. //
  56. // From IPersistFile
  57. //
  58. SCODE STDMETHODCALLTYPE GetClassID(CLSID * pClassID);
  59. SCODE STDMETHODCALLTYPE IsDirty();
  60. SCODE STDMETHODCALLTYPE Load(LPCWSTR pszFileName, DWORD dwMode);
  61. SCODE STDMETHODCALLTYPE Save(LPCWSTR pszFileName, BOOL fRemember);
  62. SCODE STDMETHODCALLTYPE SaveCompleted(LPCWSTR pszFileName);
  63. SCODE STDMETHODCALLTYPE GetCurFile(LPWSTR * ppszFileName);
  64. //
  65. // From IPersistStream
  66. //
  67. SCODE STDMETHODCALLTYPE Load( IStream * pStm );
  68. SCODE STDMETHODCALLTYPE Save( IStream * pStm, BOOL fClearDirty );
  69. SCODE STDMETHODCALLTYPE GetSizeMax( ULARGE_INTEGER * pcbSize );
  70. private:
  71. BOOL IsFileBased() { return (0 != _pwszFileName); }
  72. BOOL IsStreamBased() { return (0 != _pStream); }
  73. inline BOOL IsLastCharDBCSLeadByte( BYTE *pbIn, ULONG cChIn );
  74. BOOL IsDBCSCodePage( ULONG ulCodePage );
  75. ULONG _idChunk; // Current chunk id
  76. CMmStream _mmStream; // File-based stream
  77. CMmIStream _mmIStream; // IStream-based stream
  78. CMmStreamConsecBuf _mmStreamBuf; // Stream buffer (common)
  79. ULONG _bytesReadFromChunk; // Bytes read from current chunk
  80. LPWSTR _pwszFileName; // File being filtered
  81. IStream * _pStream; // ...or, IStream being filtered
  82. ULONG _ulCodePage; // Code page (for UniCode translation)
  83. LCID _locale; // Locale
  84. BOOL _fUniCode; // TRUE if file is UniCode text
  85. BOOL _fBigEndian; // TRUE if UniCode stored Big-endian
  86. BOOL _fContents; // TRUE if content property requested
  87. BOOL _fNSS; // TRUE if NTFS Structured Storage (not supported)
  88. BOOL _fDBCSCodePage; // Is _ulCodePage a DBCS code page ?
  89. BOOL _fDBCSSplitChar; // True, if a DBCS sequences is split across
  90. // two mappings, False otherwise
  91. BYTE _abDBCSInput[2]; // Buffer for two byte DBCS sequence
  92. };