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.

96 lines
3.6 KiB

  1. // Copyright (C) 1996 Microsoft Corporation. All rights reserved.
  2. #if _MSC_VER > 1000
  3. #pragma once
  4. #endif
  5. #ifndef __CONTENT_AUTOMATION_H__
  6. #define __CONTENT_AUTOMATION_H__
  7. #include <stddef.h>
  8. #include "unknown.h"
  9. #include "contain.h"
  10. //=--------------------------------------------------------------------------=
  11. // AUTOMATIONOBJECTINFO
  12. //=--------------------------------------------------------------------------=
  13. // for each automation object type you wish to expose to the programmer/user
  14. // that is not a control, you must fill out one of these structures. if the
  15. // object isn't CoCreatable, then the first four fields should be empty.
  16. // otherwise, they should be filled in with the appropriate information.
  17. // use the macro DEFINE_AUTOMATIONOBJECT to both declare and define your object.
  18. // make sure you have an entry in the global table of objects, g_ObjectInfo
  19. // in the main .Cpp file for your InProc server.
  20. //
  21. typedef struct {
  22. UNKNOWNOBJECTINFO unknowninfo; // fill in with 0's if we're not CoCreatable
  23. long lVersion; // Version number of Object. ONLY USE IF YOU'RE CoCreatable!
  24. const IID *riid; // object's type
  25. LPCSTR pszHelpFile; // the helpfile for this automation object.
  26. ITypeInfo *pTypeInfo; // typeinfo for this object
  27. UINT cTypeInfo; // number of refs to the type info
  28. } AUTOMATIONOBJECTINFO;
  29. #define PPTYPEINFOOFOBJECT(index) &((((AUTOMATIONOBJECTINFO *)(g_ObjectInfo[(index)]).pInfo)->pTypeInfo))
  30. #define CTYPEINFOOFOBJECT(index) ((AUTOMATIONOBJECTINFO *)(g_ObjectInfo[(index)]).pInfo)->cTypeInfo
  31. #define INTERFACEOFOBJECT(index) *(((AUTOMATIONOBJECTINFO *)(g_ObjectInfo[(index)]).pInfo)->riid)
  32. #define VERSIONOFOBJECT(index) ((AUTOMATIONOBJECTINFO *)(g_ObjectInfo[(index)]).pInfo)->lVersion
  33. #define DO_GUIDS_MATCH(riid1, riid2) ((riid1.Data1 == riid2.Data1) && (riid1 == riid2))
  34. //=--------------------------------------------------------------------------=
  35. // these things are used to set up our objects in our global object table
  36. //
  37. #define OI_UNKNOWN 0
  38. #define OI_AUTOMATION 1
  39. #define OI_CONTROL 2
  40. #define OI_PROPERTYPAGE 3
  41. #define OI_BOGUS 0xffff
  42. #define EMPTYOBJECT { OI_BOGUS, NULL }
  43. class CAutomateContent : public CUnknownObject, public IDispatch
  44. {
  45. private:
  46. int m_cRef;
  47. class CContainer * m_pOuter;
  48. IDispatch * m_pIDispatch;
  49. BOOL m_bFirstTime;
  50. public:
  51. CAutomateContent(CContainer *);
  52. virtual ~CAutomateContent();
  53. //Gotta have an IUnknown for delegation.
  54. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  55. STDMETHODIMP_(ULONG) AddRef(void);
  56. STDMETHODIMP_(ULONG) Release(void);
  57. // pass through IDispatch functions to the internal interface
  58. STDMETHOD(GetTypeInfoCount)(UINT*);
  59. STDMETHOD(GetTypeInfo)(UINT, LCID, LPTYPEINFO*);
  60. STDMETHOD(GetIDsOfNames)(REFIID, LPOLESTR*, UINT, LCID, DISPID*);
  61. STDMETHOD(Invoke)(DISPID, REFIID, LCID, WORD, DISPPARAMS*, LPVARIANT,
  62. LPEXCEPINFO, UINT*);
  63. void LookupKeyword(LPCSTR cs);
  64. void OnCommandStateChange(long Command, BOOL Enable);
  65. void OnDownloadBegin();
  66. void OnDownloadComplete();
  67. void OnDocumentComplete();
  68. void OnPropertyChange(LPCTSTR szProperty);
  69. void OnQuit(BOOL* Cancel);
  70. void OnStatusTextChange(LPCTSTR bstrText);
  71. void OnWindowActivated();
  72. void OnTitleChange(LPCTSTR bstrTitle);
  73. // void OnProgressChange(long Progress, long ProgressMax);
  74. void OnBeforeNavigate(LPCTSTR URL, long Flags, LPCTSTR TargetFrameName, VARIANT* PostData, LPCTSTR Headers, BOOL* Cancel);
  75. void OnNavigateComplete(LPCTSTR URL);
  76. int m_ObjectType;
  77. BOOL m_fLoadedTypeInfo;
  78. };
  79. #endif