Leaked source code of windows server 2003
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.

215 lines
6.8 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. };
  25. OLESTATUS FARINTERNAL DefLoadFromStream (lpstream, lpprotocol, lpclient, lhclientdoc, lpobjname, lplpobj, objType, aClass, cfFormat)
  26. LPOLESTREAM lpstream;
  27. LPSTR lpprotocol;
  28. LPOLECLIENT lpclient;
  29. LHCLIENTDOC lhclientdoc;
  30. LPSTR lpobjname;
  31. LPOLEOBJECT FAR * lplpobj;
  32. LONG objType;
  33. ATOM aClass;
  34. OLECLIPFORMAT cfFormat;
  35. {
  36. OLESTATUS retVal;
  37. int i;
  38. *lplpobj = NULL;
  39. if ((objType == CT_PICTURE) || (objType == CT_STATIC)) {
  40. for (i = 0; i < NUM_RENDER; i++) {
  41. if (stdRender[i].aClass == aClass) {
  42. retVal = (*stdRender[i].Load) (lpstream, lpclient,
  43. lhclientdoc, lpobjname, lplpobj, objType);
  44. if (aClass)
  45. GlobalDeleteAtom (aClass);
  46. return retVal;
  47. }
  48. }
  49. return GenLoadFromStream (lpstream, lpclient, lhclientdoc, lpobjname,
  50. lplpobj, objType, aClass, cfFormat);
  51. }
  52. else {
  53. return LeLoadFromStream (lpstream, lpclient, lhclientdoc, lpobjname,
  54. lplpobj, objType, aClass, cfFormat);
  55. }
  56. }
  57. OLESTATUS FAR PASCAL DefCreateFromClip (lpprotocol, lpclient, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat, objType)
  58. LPSTR lpprotocol;
  59. LPOLECLIENT lpclient;
  60. LHCLIENTDOC lhclientdoc;
  61. LPSTR lpobjname;
  62. LPOLEOBJECT FAR * lplpobj;
  63. OLEOPT_RENDER optRender;
  64. OLECLIPFORMAT cfFormat;
  65. LONG objType;
  66. {
  67. if (objType == CT_EMBEDDED)
  68. return EmbPaste (lpclient, lhclientdoc, lpobjname, lplpobj,
  69. optRender, cfFormat);
  70. if (objType == CT_LINK)
  71. return LnkPaste (lpclient, lhclientdoc, lpobjname, lplpobj,
  72. optRender, cfFormat, cfOwnerLink);
  73. return OLE_ERROR_CLIPBOARD;
  74. }
  75. OLESTATUS FAR PASCAL DefCreateLinkFromClip (lpprotocol, lpclient, lhclientdoc, lpobjname, lplpobj, optRender, cfFormat)
  76. LPSTR lpprotocol;
  77. LPOLECLIENT lpclient;
  78. LHCLIENTDOC lhclientdoc;
  79. LPSTR lpobjname;
  80. LPOLEOBJECT FAR * lplpobj;
  81. OLEOPT_RENDER optRender;
  82. OLECLIPFORMAT cfFormat;
  83. {
  84. return LnkPaste (lpclient, lhclientdoc, lpobjname, lplpobj,
  85. optRender, cfFormat, cfObjectLink);
  86. }
  87. OLESTATUS FAR PASCAL DefCreateFromTemplate (lpprotocol, lpclient, lptemplate, lhclientdoc, lpobjname, lplpoleobject, optRender, cfFormat)
  88. LPSTR lpprotocol;
  89. LPOLECLIENT lpclient;
  90. LPSTR lptemplate;
  91. LHCLIENTDOC lhclientdoc;
  92. LPSTR lpobjname;
  93. LPOLEOBJECT FAR * lplpoleobject;
  94. OLEOPT_RENDER optRender;
  95. OLECLIPFORMAT cfFormat;
  96. {
  97. return LeCreateFromTemplate (lpclient,
  98. lptemplate,
  99. lhclientdoc,
  100. lpobjname,
  101. lplpoleobject,
  102. optRender,
  103. cfFormat);
  104. }
  105. OLESTATUS FAR PASCAL DefCreate (lpprotocol, lpclient, lpclass, lhclientdoc, lpobjname, lplpoleobject, optRender, cfFormat)
  106. LPSTR lpprotocol;
  107. LPOLECLIENT lpclient;
  108. LPSTR lpclass;
  109. LHCLIENTDOC lhclientdoc;
  110. LPSTR lpobjname;
  111. LPOLEOBJECT FAR * lplpoleobject;
  112. OLEOPT_RENDER optRender;
  113. OLECLIPFORMAT cfFormat;
  114. {
  115. return LeCreate (lpclient,
  116. lpclass,
  117. lhclientdoc,
  118. lpobjname,
  119. lplpoleobject,
  120. optRender,
  121. cfFormat);
  122. }
  123. OLESTATUS FAR PASCAL DefCreateFromFile (lpprotocol, lpclient, lpclass, lpfile, lhclientdoc, lpobjname, lplpoleobject, optRender, cfFormat)
  124. LPSTR lpprotocol;
  125. LPOLECLIENT lpclient;
  126. LPSTR lpclass;
  127. LPSTR lpfile;
  128. LHCLIENTDOC lhclientdoc;
  129. LPSTR lpobjname;
  130. LPOLEOBJECT FAR * lplpoleobject;
  131. OLEOPT_RENDER optRender;
  132. OLECLIPFORMAT cfFormat;
  133. {
  134. return CreateEmbLnkFromFile (lpclient,
  135. lpclass,
  136. lpfile,
  137. NULL,
  138. lhclientdoc,
  139. lpobjname,
  140. lplpoleobject,
  141. optRender,
  142. cfFormat,
  143. CT_EMBEDDED);
  144. }
  145. OLESTATUS FAR PASCAL DefCreateLinkFromFile (lpprotocol, lpclient, lpclass, lpfile, lpitem, lhclientdoc, lpobjname, lplpoleobject, optRender, cfFormat)
  146. LPSTR lpprotocol;
  147. LPOLECLIENT lpclient;
  148. LPSTR lpclass;
  149. LPSTR lpfile;
  150. LPSTR lpitem;
  151. LHCLIENTDOC lhclientdoc;
  152. LPSTR lpobjname;
  153. LPOLEOBJECT FAR * lplpoleobject;
  154. OLEOPT_RENDER optRender;
  155. OLECLIPFORMAT cfFormat;
  156. {
  157. return CreateEmbLnkFromFile (lpclient,
  158. lpclass,
  159. lpfile,
  160. lpitem,
  161. lhclientdoc,
  162. lpobjname,
  163. lplpoleobject,
  164. optRender,
  165. cfFormat,
  166. CT_LINK);
  167. }
  168. OLESTATUS FAR PASCAL DefCreateInvisible (lpprotocol, lpclient, lpclass, lhclientdoc, lpobjname, lplpoleobject, optRender, cfFormat, fActivate)
  169. LPSTR lpprotocol;
  170. LPOLECLIENT lpclient;
  171. LPSTR lpclass;
  172. LHCLIENTDOC lhclientdoc;
  173. LPSTR lpobjname;
  174. LPOLEOBJECT FAR * lplpoleobject;
  175. OLEOPT_RENDER optRender;
  176. OLECLIPFORMAT cfFormat;
  177. BOOL fActivate;
  178. {
  179. return LeCreateInvisible (lpclient,
  180. lpclass,
  181. lhclientdoc,
  182. lpobjname,
  183. lplpoleobject,
  184. optRender,
  185. cfFormat,
  186. fActivate);
  187. }