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.

232 lines
6.5 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: defcreat.c
  3. *
  4. * Purpose: Handles the various object creation routines, which are exported
  5. * to the DLL writers.
  6. *
  7. * Created: November 1990
  8. *
  9. * Copyright (c) 1985, 1986, 1987, 1988, 1989 Microsoft Corporation
  10. *
  11. * History:
  12. * Srinik (11/12/90) Original
  13. *
  14. \***************************************************************************/
  15. #include <windows.h>
  16. #include "dll.h"
  17. extern OLECLIPFORMAT cfOwnerLink;
  18. extern OLECLIPFORMAT cfObjectLink;
  19. extern OLECLIPFORMAT cfNative;
  20. RENDER_ENTRY stdRender[NUM_RENDER] = {
  21. { "METAFILEPICT", 0, MfLoadFromStream},
  22. { "DIB", 0, DibLoadFromStream},
  23. { "BITMAP", 0, BmLoadFromStream},
  24. { "ENHMETAFILE", 0, EmfLoadFromStream}
  25. };
  26. OLESTATUS FARINTERNAL DefLoadFromStream (
  27. LPOLESTREAM lpstream,
  28. LPSTR lpprotocol,
  29. LPOLECLIENT lpclient,
  30. LHCLIENTDOC lhclientdoc,
  31. LPSTR lpobjname,
  32. LPOLEOBJECT FAR * lplpobj,
  33. LONG objType,
  34. ATOM aClass,
  35. OLECLIPFORMAT cfFormat
  36. ){
  37. OLESTATUS retVal;
  38. int i;
  39. UNREFERENCED_PARAMETER(lpprotocol);
  40. *lplpobj = NULL;
  41. if ((objType == CT_PICTURE) || (objType == CT_STATIC)) {
  42. for (i = 0; i < NUM_RENDER; i++) {
  43. if (stdRender[i].aClass == aClass) {
  44. retVal = (*stdRender[i].Load) (lpstream, lpclient,
  45. lhclientdoc, lpobjname, lplpobj, objType);
  46. if (aClass)
  47. GlobalDeleteAtom (aClass);
  48. return retVal;
  49. }
  50. }
  51. return GenLoadFromStream (lpstream, lpclient, lhclientdoc, lpobjname,
  52. lplpobj, objType, aClass, cfFormat);
  53. }
  54. else {
  55. return LeLoadFromStream (lpstream, lpclient, lhclientdoc, lpobjname,
  56. lplpobj, objType, aClass, cfFormat);
  57. }
  58. }
  59. OLESTATUS FAR PASCAL DefCreateFromClip (
  60. LPSTR lpprotocol,
  61. LPOLECLIENT lpclient,
  62. LHCLIENTDOC lhclientdoc,
  63. LPSTR lpobjname,
  64. LPOLEOBJECT FAR * lplpobj,
  65. OLEOPT_RENDER optRender,
  66. OLECLIPFORMAT cfFormat,
  67. LONG objType
  68. ){
  69. UNREFERENCED_PARAMETER(lpprotocol);
  70. if (objType == CT_EMBEDDED)
  71. return EmbPaste (lpclient, lhclientdoc, lpobjname, lplpobj,
  72. optRender, cfFormat);
  73. if (objType == CT_LINK)
  74. return LnkPaste (lpclient, lhclientdoc, lpobjname, lplpobj,
  75. optRender, cfFormat, cfOwnerLink);
  76. return OLE_ERROR_CLIPBOARD;
  77. }
  78. OLESTATUS FAR PASCAL DefCreateLinkFromClip (
  79. LPSTR lpprotocol,
  80. LPOLECLIENT lpclient,
  81. LHCLIENTDOC lhclientdoc,
  82. LPSTR lpobjname,
  83. LPOLEOBJECT FAR * lplpobj,
  84. OLEOPT_RENDER optRender,
  85. OLECLIPFORMAT cfFormat
  86. ){
  87. UNREFERENCED_PARAMETER(lpprotocol);
  88. return LnkPaste (lpclient, lhclientdoc, lpobjname, lplpobj,
  89. optRender, cfFormat, cfObjectLink);
  90. }
  91. OLESTATUS FAR PASCAL DefCreateFromTemplate (
  92. LPSTR lpprotocol,
  93. LPOLECLIENT lpclient,
  94. LPSTR lptemplate,
  95. LHCLIENTDOC lhclientdoc,
  96. LPSTR lpobjname,
  97. LPOLEOBJECT FAR * lplpoleobject,
  98. OLEOPT_RENDER optRender,
  99. OLECLIPFORMAT cfFormat
  100. ){
  101. UNREFERENCED_PARAMETER(lpprotocol);
  102. return LeCreateFromTemplate (lpclient,
  103. lptemplate,
  104. lhclientdoc,
  105. lpobjname,
  106. lplpoleobject,
  107. optRender,
  108. cfFormat);
  109. }
  110. OLESTATUS FAR PASCAL DefCreate (
  111. LPSTR lpprotocol,
  112. LPOLECLIENT lpclient,
  113. LPSTR lpclass,
  114. LHCLIENTDOC lhclientdoc,
  115. LPSTR lpobjname,
  116. LPOLEOBJECT FAR * lplpoleobject,
  117. OLEOPT_RENDER optRender,
  118. OLECLIPFORMAT cfFormat
  119. ){
  120. UNREFERENCED_PARAMETER(lpprotocol);
  121. return LeCreate (lpclient,
  122. lpclass,
  123. lhclientdoc,
  124. lpobjname,
  125. lplpoleobject,
  126. optRender,
  127. cfFormat);
  128. }
  129. OLESTATUS FAR PASCAL DefCreateFromFile (
  130. LPSTR lpprotocol,
  131. LPOLECLIENT lpclient,
  132. LPSTR lpclass,
  133. LPSTR lpfile,
  134. LHCLIENTDOC lhclientdoc,
  135. LPSTR lpobjname,
  136. LPOLEOBJECT FAR * lplpoleobject,
  137. OLEOPT_RENDER optRender,
  138. OLECLIPFORMAT cfFormat
  139. ){
  140. UNREFERENCED_PARAMETER(lpprotocol);
  141. return CreateEmbLnkFromFile (lpclient,
  142. lpclass,
  143. lpfile,
  144. NULL,
  145. lhclientdoc,
  146. lpobjname,
  147. lplpoleobject,
  148. optRender,
  149. cfFormat,
  150. CT_EMBEDDED);
  151. }
  152. OLESTATUS FAR PASCAL DefCreateLinkFromFile (
  153. LPSTR lpprotocol,
  154. LPOLECLIENT lpclient,
  155. LPSTR lpclass,
  156. LPSTR lpfile,
  157. LPSTR lpitem,
  158. LHCLIENTDOC lhclientdoc,
  159. LPSTR lpobjname,
  160. LPOLEOBJECT FAR * lplpoleobject,
  161. OLEOPT_RENDER optRender,
  162. OLECLIPFORMAT cfFormat
  163. ){
  164. UNREFERENCED_PARAMETER(lpprotocol);
  165. return CreateEmbLnkFromFile (lpclient,
  166. lpclass,
  167. lpfile,
  168. lpitem,
  169. lhclientdoc,
  170. lpobjname,
  171. lplpoleobject,
  172. optRender,
  173. cfFormat,
  174. CT_LINK);
  175. }
  176. OLESTATUS FAR PASCAL DefCreateInvisible (
  177. LPSTR lpprotocol,
  178. LPOLECLIENT lpclient,
  179. LPSTR lpclass,
  180. LHCLIENTDOC lhclientdoc,
  181. LPSTR lpobjname,
  182. LPOLEOBJECT FAR * lplpoleobject,
  183. OLEOPT_RENDER optRender,
  184. OLECLIPFORMAT cfFormat,
  185. BOOL fActivate
  186. ){
  187. UNREFERENCED_PARAMETER(lpprotocol);
  188. return LeCreateInvisible (lpclient,
  189. lpclass,
  190. lhclientdoc,
  191. lpobjname,
  192. lplpoleobject,
  193. optRender,
  194. cfFormat,
  195. fActivate);
  196. }