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.

63 lines
1.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1994.
  5. //
  6. // File: TSource.hxx
  7. //
  8. // Contents: TEXT_SOURCE implementation
  9. //
  10. // Classes: CTextSource
  11. //
  12. // History: 14-Apr-94 KyleP Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include "pageman.hxx"
  17. class CSourceMapper;
  18. class CTextSource : public tagTEXT_SOURCE
  19. {
  20. public:
  21. CTextSource( IFilter * pFilter, STAT_CHUNK & Stat, CSourceMapper* pMapper = 0 );
  22. inline SCODE GetStatus();
  23. protected:
  24. CTextSource ( STAT_CHUNK & Stat)
  25. : _pFilter(0), _Stat(Stat), _sc(E_FAIL), _pMapper(0)
  26. { pfnFillTextBuffer = 0; }
  27. static SCODE FillBuf( TEXT_SOURCE * pTextSource );
  28. IFilter * _pFilter; // Source of text
  29. SCODE _sc; // State of last call to IFilter.
  30. STAT_CHUNK & _Stat; // Current chunk info.
  31. CSourceMapper* _pMapper; // Maps current position into filter region
  32. WCHAR _awcFilterBuffer[PAGE_SIZE/sizeof(WCHAR)]; // For awcBuffer
  33. private:
  34. static void DebugPrintBuffer( CTextSource *pThis );
  35. };
  36. inline SCODE CTextSource::GetStatus()
  37. {
  38. //
  39. // WBREAK_E_END_OF_TEXT is not an error for clients of CTextSource. _sc
  40. // is set to this value to prevent further calls to fillbuf from doing
  41. // any damage.
  42. //
  43. if ( _sc == WBREAK_E_END_OF_TEXT )
  44. return S_OK;
  45. else
  46. return _sc;
  47. }