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.

287 lines
11 KiB

  1. // FaxDoc.h : Declaration of the CFaxDoc
  2. #ifndef __FAXDOC_H_
  3. #define __FAXDOC_H_
  4. #include "resource.h" // main symbols
  5. #include "faxsvr.h"
  6. #include <winfax.h>
  7. #ifdef FAXBROADCAST_ENABLED
  8. #include "adoid.h"
  9. #include "adoint.h"
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CFaxDoc
  13. class ATL_NO_VTABLE CFaxDoc :
  14. public CComObjectRootEx<CComSingleThreadModel>,
  15. public CComCoClass<CFaxDoc, &CLSID_FaxDoc>,
  16. public ISupportErrorInfo,
  17. public IDispatchImpl<IFaxDoc, &IID_IFaxDoc, &LIBID_FAXCOMLib>
  18. {
  19. public:
  20. CFaxDoc()
  21. {
  22. m_DiscountSend = FALSE;
  23. m_SendCoverpage = FALSE;
  24. m_FaxCoverpageInfo = NULL;
  25. m_FaxJobParams = NULL;
  26. m_FileName = NULL;
  27. m_JobId = 0;
  28. m_TapiConnectionObject = NULL;
  29. CFaxServer* m_pFaxServer = NULL;
  30. m_FaxNumber = NULL;
  31. m_Tsid = NULL;
  32. m_BillingCode = NULL;
  33. m_EmailAddress = NULL;;
  34. m_DocumentName = NULL;;
  35. m_Note = NULL;
  36. m_Subject = NULL;
  37. m_CoverpageName = NULL;
  38. m_RecipientName = NULL;
  39. m_RecipientNumber = NULL;
  40. m_RecipientCompany = NULL;
  41. m_RecipientAddress = NULL;
  42. m_RecipientCity = NULL;
  43. m_RecipientState = NULL;
  44. m_RecipientZip = NULL;
  45. m_RecipientCountry = NULL;
  46. m_RecipientTitle = NULL;
  47. m_RecipientDepartment = NULL;
  48. m_RecipientOffice = NULL;
  49. m_RecipientHomePhone = NULL;
  50. m_RecipientOfficePhone = NULL;
  51. m_SenderName = NULL;
  52. m_SenderCompany = NULL;
  53. m_SenderAddress = NULL;
  54. m_SenderTitle = NULL;
  55. m_SenderDepartment = NULL;
  56. m_SenderOfficeLocation = NULL;
  57. m_SenderHomePhone = NULL;
  58. m_SenderOfficePhone = NULL;
  59. m_SenderFax = NULL;
  60. //
  61. // prefill in the params...
  62. //
  63. FaxCompleteJobParams(&m_FaxJobParams,&m_FaxCoverpageInfo);
  64. if (m_FaxJobParams && m_FaxCoverpageInfo) {
  65. m_CoverpageName =SysAllocString(m_FaxCoverpageInfo->CoverPageName);
  66. m_RecipientName =SysAllocString(m_FaxCoverpageInfo->RecName);
  67. m_RecipientNumber =SysAllocString(m_FaxCoverpageInfo->RecFaxNumber);
  68. m_RecipientCompany =SysAllocString(m_FaxCoverpageInfo->RecCompany);
  69. m_RecipientAddress =SysAllocString(m_FaxCoverpageInfo->RecStreetAddress);
  70. m_RecipientCity =SysAllocString(m_FaxCoverpageInfo->RecCity);
  71. m_RecipientState =SysAllocString(m_FaxCoverpageInfo->RecState);
  72. m_RecipientZip =SysAllocString(m_FaxCoverpageInfo->RecZip);
  73. m_RecipientCountry =SysAllocString(m_FaxCoverpageInfo->RecCountry);
  74. m_RecipientTitle =SysAllocString(m_FaxCoverpageInfo->RecTitle);
  75. m_RecipientDepartment =SysAllocString(m_FaxCoverpageInfo->RecDepartment);
  76. m_RecipientOffice =SysAllocString(m_FaxCoverpageInfo->RecOfficeLocation);
  77. m_RecipientHomePhone =SysAllocString(m_FaxCoverpageInfo->RecHomePhone);
  78. m_RecipientOfficePhone =SysAllocString(m_FaxCoverpageInfo->RecOfficePhone);
  79. m_SenderName =SysAllocString(m_FaxCoverpageInfo->SdrName);
  80. m_SenderFax =SysAllocString(m_FaxCoverpageInfo->SdrFaxNumber);
  81. m_SenderCompany =SysAllocString(m_FaxCoverpageInfo->SdrCompany);
  82. m_SenderAddress =SysAllocString(m_FaxCoverpageInfo->SdrAddress);
  83. m_SenderTitle =SysAllocString(m_FaxCoverpageInfo->SdrTitle);
  84. m_SenderDepartment =SysAllocString(m_FaxCoverpageInfo->SdrDepartment);
  85. m_SenderOfficeLocation =SysAllocString(m_FaxCoverpageInfo->SdrOfficeLocation);
  86. m_SenderHomePhone =SysAllocString(m_FaxCoverpageInfo->SdrHomePhone);
  87. m_SenderOfficePhone =SysAllocString(m_FaxCoverpageInfo->SdrOfficePhone);
  88. m_Note =SysAllocString(m_FaxCoverpageInfo->Note);
  89. m_Subject =SysAllocString(m_FaxCoverpageInfo->Subject);
  90. m_Tsid =SysAllocString(m_FaxJobParams->Tsid);
  91. m_BillingCode =SysAllocString(m_FaxJobParams->BillingCode);
  92. m_EmailAddress =SysAllocString(m_FaxJobParams->DeliveryReportAddress);
  93. m_DocumentName =SysAllocString(m_FaxJobParams->DocumentName);
  94. }
  95. }
  96. DECLARE_REGISTRY_RESOURCEID(IDR_FAXDOC)
  97. BEGIN_COM_MAP(CFaxDoc)
  98. COM_INTERFACE_ENTRY(IFaxDoc)
  99. COM_INTERFACE_ENTRY(IDispatch)
  100. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  101. END_COM_MAP()
  102. // ISupportsErrorInfo
  103. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  104. // IFaxDoc
  105. public:
  106. ~CFaxDoc();
  107. BOOL Init(BSTR FileName,CFaxServer *pFaxServer);
  108. BOOL SetJob();
  109. STDMETHOD(get_FaxNumber)(/*[out, retval]*/ BSTR *pVal);
  110. STDMETHOD(put_FaxNumber)(/*[in]*/ BSTR newVal);
  111. STDMETHOD(Send)(/*[out, retval]*/long *pVal);
  112. STDMETHOD(get_DisplayName)(/*[out, retval]*/ BSTR *pVal);
  113. STDMETHOD(put_DisplayName)(/*[in]*/ BSTR newVal);
  114. STDMETHOD(get_EmailAddress)(/*[out, retval]*/ BSTR *pVal);
  115. STDMETHOD(put_EmailAddress)(/*[in]*/ BSTR newVal);
  116. STDMETHOD(get_BillingCode)(/*[out, retval]*/ BSTR *pVal);
  117. STDMETHOD(put_BillingCode)(/*[in]*/ BSTR newVal);
  118. STDMETHOD(get_Tsid)(/*[out, retval]*/ BSTR *pVal);
  119. STDMETHOD(put_Tsid)(/*[in]*/ BSTR newVal);
  120. STDMETHOD(get_CoverpageSubject)(/*[out, retval]*/ BSTR *pVal);
  121. STDMETHOD(put_CoverpageSubject)(/*[in]*/ BSTR newVal);
  122. STDMETHOD(get_CoverpageNote)(/*[out, retval]*/ BSTR *pVal);
  123. STDMETHOD(put_CoverpageNote)(/*[in]*/ BSTR newVal);
  124. STDMETHOD(get_SenderFax)(/*[out, retval]*/ BSTR *pVal);
  125. STDMETHOD(put_SenderFax)(/*[in]*/ BSTR newVal);
  126. STDMETHOD(get_SenderOfficePhone)(/*[out, retval]*/ BSTR *pVal);
  127. STDMETHOD(put_SenderOfficePhone)(/*[in]*/ BSTR newVal);
  128. STDMETHOD(get_SenderHomePhone)(/*[out, retval]*/ BSTR *pVal);
  129. STDMETHOD(put_SenderHomePhone)(/*[in]*/ BSTR newVal);
  130. STDMETHOD(get_SenderOffice)(/*[out, retval]*/ BSTR *pVal);
  131. STDMETHOD(put_SenderOffice)(/*[in]*/ BSTR newVal);
  132. STDMETHOD(get_SenderDepartment)(/*[out, retval]*/ BSTR *pVal);
  133. STDMETHOD(put_SenderDepartment)(/*[in]*/ BSTR newVal);
  134. STDMETHOD(get_SenderTitle)(/*[out, retval]*/ BSTR *pVal);
  135. STDMETHOD(put_SenderTitle)(/*[in]*/ BSTR newVal);
  136. STDMETHOD(get_SenderAddress)(/*[out, retval]*/ BSTR *pVal);
  137. STDMETHOD(put_SenderAddress)(/*[in]*/ BSTR newVal);
  138. STDMETHOD(get_SenderCompany)(/*[out, retval]*/ BSTR *pVal);
  139. STDMETHOD(put_SenderCompany)(/*[in]*/ BSTR newVal);
  140. STDMETHOD(get_SenderName)(/*[out, retval]*/ BSTR *pVal);
  141. STDMETHOD(put_SenderName)(/*[in]*/ BSTR newVal);
  142. STDMETHOD(get_RecipientOfficePhone)(/*[out, retval]*/ BSTR *pVal);
  143. STDMETHOD(put_RecipientOfficePhone)(/*[in]*/ BSTR newVal);
  144. STDMETHOD(get_RecipientHomePhone)(/*[out, retval]*/ BSTR *pVal);
  145. STDMETHOD(put_RecipientHomePhone)(/*[in]*/ BSTR newVal);
  146. STDMETHOD(get_RecipientOffice)(/*[out, retval]*/ BSTR *pVal);
  147. STDMETHOD(put_RecipientOffice)(/*[in]*/ BSTR newVal);
  148. STDMETHOD(get_RecipientDepartment)(/*[out, retval]*/ BSTR *pVal);
  149. STDMETHOD(put_RecipientDepartment)(/*[in]*/ BSTR newVal);
  150. STDMETHOD(get_RecipientTitle)(/*[out, retval]*/ BSTR *pVal);
  151. STDMETHOD(put_RecipientTitle)(/*[in]*/ BSTR newVal);
  152. STDMETHOD(get_RecipientCountry)(/*[out, retval]*/ BSTR *pVal);
  153. STDMETHOD(put_RecipientCountry)(/*[in]*/ BSTR newVal);
  154. STDMETHOD(get_RecipientZip)(/*[out, retval]*/ BSTR *pVal);
  155. STDMETHOD(put_RecipientZip)(/*[in]*/ BSTR newVal);
  156. STDMETHOD(get_RecipientState)(/*[out, retval]*/ BSTR *pVal);
  157. STDMETHOD(put_RecipientState)(/*[in]*/ BSTR newVal);
  158. STDMETHOD(get_RecipientCity)(/*[out, retval]*/ BSTR *pVal);
  159. STDMETHOD(put_RecipientCity)(/*[in]*/ BSTR newVal);
  160. STDMETHOD(get_RecipientAddress)(/*[out, retval]*/ BSTR *pVal);
  161. STDMETHOD(put_RecipientAddress)(/*[in]*/ BSTR newVal);
  162. STDMETHOD(get_RecipientCompany)(/*[out, retval]*/ BSTR *pVal);
  163. STDMETHOD(put_RecipientCompany)(/*[in]*/ BSTR newVal);
  164. STDMETHOD(get_RecipientName)(/*[out, retval]*/ BSTR *pVal);
  165. STDMETHOD(put_RecipientName)(/*[in]*/ BSTR newVal);
  166. STDMETHOD(get_DiscountSend)(/*[out, retval]*/ BOOL *pVal);
  167. STDMETHOD(put_DiscountSend)(/*[in]*/ BOOL newVal);
  168. STDMETHOD(get_ServerCoverpage)(/*[out, retval]*/ BOOL *pVal);
  169. STDMETHOD(put_ServerCoverpage)(/*[in]*/ BOOL newVal);
  170. STDMETHOD(get_SendCoverpage)(/*[out, retval]*/ BOOL *pVal);
  171. STDMETHOD(put_SendCoverpage)(/*[in]*/ BOOL newVal);
  172. STDMETHOD(get_CoverpageName)(/*[out, retval]*/ BSTR *pVal);
  173. STDMETHOD(put_CoverpageName)(/*[in]*/ BSTR newVal);
  174. STDMETHOD(get_FileName)(/*[out, retval]*/ BSTR *pVal);
  175. STDMETHOD(put_FileName)(/*[in]*/ BSTR newVal);
  176. STDMETHOD(putref_ConnectionObject)(/*[in]*/ IDispatch* newVal);
  177. STDMETHOD(get_CallHandle)(/*[out, retval]*/ long *pVal);
  178. STDMETHOD(put_CallHandle)(/*[in]*/ long newVal);
  179. #ifdef FAXBROADCAST_ENABLED
  180. STDMETHOD(Broadcast)(VARIANT pVal);
  181. friend BOOL CALLBACK BroadcastCallback(HANDLE FaxHandle,
  182. DWORD RecipientNumber,
  183. LPVOID Context,
  184. PFAX_JOB_PARAMW JobParams,
  185. PFAX_COVERPAGE_INFOW CoverpageInfo
  186. );
  187. #endif
  188. private:
  189. CFaxServer* m_pFaxServer;
  190. BOOL m_DiscountSend;
  191. BOOL m_SendCoverpage;
  192. DWORD m_JobId;
  193. PFAX_COVERPAGE_INFO m_FaxCoverpageInfo;
  194. PFAX_JOB_PARAM m_FaxJobParams;
  195. BSTR m_FileName;
  196. IDispatch* m_TapiConnectionObject;
  197. VARIANT* m_pVariant;
  198. //
  199. // job info
  200. //
  201. BSTR m_FaxNumber;
  202. BSTR m_Tsid;
  203. BSTR m_BillingCode;
  204. BSTR m_EmailAddress;
  205. BSTR m_DocumentName;
  206. //
  207. // coverpage info
  208. //
  209. BSTR m_Note;
  210. BSTR m_Subject;
  211. BSTR m_CoverpageName;
  212. BSTR m_RecipientName;
  213. BSTR m_RecipientNumber;
  214. BSTR m_RecipientCompany;
  215. BSTR m_RecipientAddress;
  216. BSTR m_RecipientCity;
  217. BSTR m_RecipientState;
  218. BSTR m_RecipientZip;
  219. BSTR m_RecipientCountry;
  220. BSTR m_RecipientTitle;
  221. BSTR m_RecipientDepartment;
  222. BSTR m_RecipientOffice;
  223. BSTR m_RecipientHomePhone;
  224. BSTR m_RecipientOfficePhone;
  225. BSTR m_SenderName;
  226. BSTR m_SenderCompany;
  227. BSTR m_SenderAddress;
  228. BSTR m_SenderTitle;
  229. BSTR m_SenderDepartment;
  230. BSTR m_SenderOfficeLocation;
  231. BSTR m_SenderHomePhone;
  232. BSTR m_SenderOfficePhone;
  233. BSTR m_SenderFax;
  234. #ifdef FAXBROADCAST_ENABLED
  235. BOOL FreeCoverpageAndJobInfo(PFAX_JOB_PARAMW JobParams,
  236. PFAX_COVERPAGE_INFOW CoverpageInfo
  237. );
  238. VOID InsertTextIntoStructure(LPTSTR txt,
  239. long i,
  240. PFAX_JOB_PARAMW pjp,
  241. PFAX_COVERPAGE_INFOW pci
  242. );
  243. BOOL RetrieveRecipientData(VARIANT* theData,
  244. DWORD DataIndex,
  245. PFAX_JOB_PARAMW JobParams,
  246. PFAX_COVERPAGE_INFOW CoverpageInfo
  247. );
  248. BOOL RetrieveSenderData(PFAX_JOB_PARAMW pjp,
  249. PFAX_COVERPAGE_INFOW pci
  250. );
  251. #endif
  252. };
  253. #endif //__FAXDOC_H_
  254. #ifdef FAXBROADCAST_ENABLED
  255. BOOL CALLBACK BroadcastCallback(HANDLE FaxHandle,
  256. DWORD RecipientNumber,
  257. LPVOID Context,
  258. PFAX_JOB_PARAMW JobParams,
  259. PFAX_COVERPAGE_INFOW CoverpageInfo
  260. );
  261. #endif