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.

855 lines
32 KiB

  1. /*************************************************************************
  2. **
  3. ** OLE 2.0 Container Sample Code
  4. **
  5. ** cntroutl.h
  6. **
  7. ** This file contains file contains data structure defintions,
  8. ** function prototypes, constants, etc. used by the OLE 2.0 container
  9. ** app version of the Outline series of sample applications:
  10. ** Outline -- base version of the app (without OLE functionality)
  11. ** SvrOutl -- OLE 2.0 Server sample app
  12. ** CntrOutl -- OLE 2.0 Containter (Container) sample app
  13. **
  14. ** (c) Copyright Microsoft Corp. 1992 - 1993 All Rights Reserved
  15. **
  16. *************************************************************************/
  17. #if !defined( _CNTROUTL_H_ )
  18. #define _CNTROUTL_H_
  19. #ifndef RC_INVOKED
  20. #pragma message ("INCLUDING CNTROUTL.H from " __FILE__)
  21. #endif /* RC_INVOKED */
  22. #include "oleoutl.h"
  23. #include "cntrrc.h"
  24. // REVIEW: should load from string resource
  25. #define DEFOBJNAMEPREFIX "Obj" // Prefix for auto-generated stg names
  26. #define DEFOBJWIDTH 5000 // default size for embedded obj.
  27. #define DEFOBJHEIGHT 5000 // default size for embedded obj.
  28. #define UNKNOWN_OLEOBJ_TYPE "Unknown OLE Object Type"
  29. #define szOLEOBJECT "Object"
  30. #define szOLELINK "Link"
  31. #define CONTAINERDOCFORMAT "CntrOutl" // CF_CntrOutl format name
  32. /* Forward definition of types */
  33. typedef struct tagCONTAINERDOC FAR* LPCONTAINERDOC;
  34. typedef struct tagCONTAINERLINE FAR* LPCONTAINERLINE;
  35. // Flags to specify type of OLECREATE???FROMDATA call required
  36. typedef enum tagOLECREATEFROMDATATYPE {
  37. OLECREATEFROMDATA_LINK = 1,
  38. OLECREATEFROMDATA_OBJECT = 2,
  39. OLECREATEFROMDATA_STATIC = 3
  40. } OLECREATEFROMDATATYPE;
  41. /*************************************************************************
  42. ** class CONTAINERLINE : LINE
  43. ** The class CONTAINERLINE is a concrete subclass of the abstract base
  44. ** class LINE. The CONTAINERLINE maintains all information about the
  45. ** place within the CONTAINERDOC that an OLE object is embedded. This
  46. ** object implements the following OLE 2.0 interfaces:
  47. ** IOleClientSite
  48. ** IAdviseSink
  49. ** In the CntrOutl client app either CONTAINERLINE objects or TEXTLINE
  50. ** objects can be created. The CONTAINERLINE class inherits all fields
  51. ** from the LINE class. This inheritance is achieved by including a
  52. ** member variable of type LINE as the first field in the CONTAINERLINE
  53. ** structure. Thus a pointer to a CONTAINERLINE object can be cast to be
  54. ** a pointer to a LINE object.
  55. ** Each CONTAINERLINE object that is created in added to the LINELIST of
  56. ** the associated OUTLINEDOC document.
  57. *************************************************************************/
  58. typedef struct tagCONTAINERLINE {
  59. LINE m_Line; // ContainerLine inherits fields of Line
  60. ULONG m_cRef; // total ref count for line
  61. char m_szStgName[CWCSTORAGENAME]; // stg name w/i cntr stg
  62. BOOL m_fObjWinOpen; // is obj window open? if so, shade obj.
  63. BOOL m_fMonikerAssigned; // has a moniker been assigned to obj
  64. DWORD m_dwDrawAspect; // current display aspect for obj
  65. // (either DVASPECT_CONTENT or
  66. // DVASPECT_ICON)
  67. BOOL m_fGuardObj; // Guard against re-entrancy while
  68. // loading or creating an OLE object
  69. BOOL m_fDoGetExtent; // indicates extents may have changed
  70. BOOL m_fDoSetExtent; // obj was resized when not running
  71. // IOO::SetExtent needed on next run
  72. SIZEL m_sizeInHimetric; // extents of obj in himetric units
  73. LPSTORAGE m_lpStg; // open pstg when obj is loaded
  74. LPCONTAINERDOC m_lpDoc; // ptr to associated client doc
  75. LPOLEOBJECT m_lpOleObj; // ptr to IOleObject* when obj is loaded
  76. LPVIEWOBJECT2 m_lpViewObj2; // ptr to IViewObject2* when obj is loaded
  77. LPPERSISTSTORAGE m_lpPersistStg;// ptr to IPersistStorage* when obj loaded
  78. LPOLELINK m_lpOleLink; // ptr to IOleLink* if link is loaded
  79. DWORD m_dwLinkType; // is it a linked object?
  80. // 0 -- NOT a link
  81. // OLEUPDATE_ALWAYS (1) -- auto link
  82. // OLEUPDATE_ONCALL (3) -- man. link
  83. BOOL m_fLinkUnavailable; // is the link unavailable?
  84. LPSTR m_lpszShortType;// short type name of OLE object needed
  85. // to make the Edit.Object.Verb menu
  86. int m_nHorizScrollShift; // horiz scroll shift required
  87. // for object's inplace window.
  88. // (note: this is ICNTROTL specific)
  89. #if defined( INPLACE_CNTR )
  90. BOOL m_fIpActive; // is object in-place active (undo valid)
  91. BOOL m_fUIActive; // is object UIActive
  92. BOOL m_fIpVisible; // is object's in-place window visible
  93. BOOL m_fInsideOutObj;// is obj inside-out (visible when loaded)
  94. LPOLEINPLACEOBJECT m_lpOleIPObj; // IOleInPlaceObject* of in-place obj
  95. BOOL m_fIpChangesUndoable; // can in-place object do undo
  96. BOOL m_fIpServerRunning; // is in-place server running
  97. HWND m_hWndIpObject;
  98. struct COleInPlaceSiteImpl {
  99. IOleInPlaceSiteVtbl FAR* lpVtbl;
  100. LPCONTAINERLINE lpContainerLine;
  101. int cRef; // interface specific ref count.
  102. } m_OleInPlaceSite;
  103. #endif // INPLACE_CNTR
  104. struct CUnknownImpl {
  105. IUnknownVtbl FAR* lpVtbl;
  106. LPCONTAINERLINE lpContainerLine;
  107. int cRef; // interface specific ref count.
  108. } m_Unknown;
  109. struct COleClientSiteImpl {
  110. IOleClientSiteVtbl FAR* lpVtbl;
  111. LPCONTAINERLINE lpContainerLine;
  112. int cRef; // interface specific ref count.
  113. } m_OleClientSite;
  114. struct CAdviseSinkImpl {
  115. IAdviseSinkVtbl FAR* lpVtbl;
  116. LPCONTAINERLINE lpContainerLine;
  117. int cRef; // interface specific ref count.
  118. } m_AdviseSink;
  119. } CONTAINERLINE;
  120. /* ContainerLine methods (functions) */
  121. void ContainerLine_Init(LPCONTAINERLINE lpContainerLine, int nTab, HDC hDC);
  122. BOOL ContainerLine_SetupOleObject(
  123. LPCONTAINERLINE lpContainerLine,
  124. BOOL fDisplayAsIcon,
  125. HGLOBAL hMetaPict
  126. );
  127. LPCONTAINERLINE ContainerLine_Create(
  128. DWORD dwOleCreateType,
  129. HDC hDC,
  130. UINT nTab,
  131. LPCONTAINERDOC lpContainerDoc,
  132. LPCLSID lpclsid,
  133. LPSTR lpszFileName,
  134. BOOL fDisplayAsIcon,
  135. HGLOBAL hMetaPict,
  136. LPSTR lpszStgName
  137. );
  138. LPCONTAINERLINE ContainerLine_CreateFromData(
  139. HDC hDC,
  140. UINT nTab,
  141. LPCONTAINERDOC lpContainerDoc,
  142. LPDATAOBJECT lpSrcDataObj,
  143. DWORD dwCreateType,
  144. CLIPFORMAT cfFormat,
  145. BOOL fDisplayAsIcon,
  146. HGLOBAL hMetaPict,
  147. LPSTR lpszStgName
  148. );
  149. ULONG ContainerLine_AddRef(LPCONTAINERLINE lpContainerLine);
  150. ULONG ContainerLine_Release(LPCONTAINERLINE lpContainerLine);
  151. HRESULT ContainerLine_QueryInterface(
  152. LPCONTAINERLINE lpContainerLine,
  153. REFIID riid,
  154. LPVOID FAR* lplpUnk
  155. );
  156. BOOL ContainerLine_CloseOleObject(
  157. LPCONTAINERLINE lpContainerLine,
  158. DWORD dwSaveOption
  159. );
  160. void ContainerLine_UnloadOleObject(
  161. LPCONTAINERLINE lpContainerLine,
  162. DWORD dwSaveOption
  163. );
  164. void ContainerLine_Delete(LPCONTAINERLINE lpContainerLine);
  165. void ContainerLine_Destroy(LPCONTAINERLINE lpContainerLine);
  166. BOOL ContainerLine_CopyToDoc(
  167. LPCONTAINERLINE lpSrcLine,
  168. LPOUTLINEDOC lpDestDoc,
  169. int nIndex
  170. );
  171. BOOL ContainerLine_LoadOleObject(LPCONTAINERLINE lpContainerLine);
  172. BOOL ContainerLine_UpdateExtent(
  173. LPCONTAINERLINE lpContainerLine,
  174. LPSIZEL lpsizelHim
  175. );
  176. BOOL ContainerLine_DoVerb(
  177. LPCONTAINERLINE lpContainerLine,
  178. LONG iVerb,
  179. LPMSG lpMsg,
  180. BOOL fMessage,
  181. BOOL fAction
  182. );
  183. LPUNKNOWN ContainerLine_GetOleObject(
  184. LPCONTAINERLINE lpContainerLine,
  185. REFIID riid
  186. );
  187. HRESULT ContainerLine_RunOleObject(LPCONTAINERLINE lpContainerLine);
  188. BOOL ContainerLine_ProcessOleRunError(
  189. LPCONTAINERLINE lpContainerLine,
  190. HRESULT hrErr,
  191. BOOL fAction,
  192. BOOL fMenuInvoked
  193. );
  194. HRESULT ContainerLine_ReCreateLinkBecauseClassDiff(
  195. LPCONTAINERLINE lpContainerLine
  196. );
  197. BOOL ContainerLine_IsOleLink(LPCONTAINERLINE lpContainerLine);
  198. void ContainerLine_BindLinkIfLinkSrcIsRunning(LPCONTAINERLINE lpContainerLine);
  199. void ContainerLine_Draw(
  200. LPCONTAINERLINE lpContainerLine,
  201. HDC hDC,
  202. LPRECT lpRect,
  203. LPRECT lpRectWBounds,
  204. BOOL fHighlight
  205. );
  206. void ContainerLine_DrawSelHilight(
  207. LPCONTAINERLINE lpContainerLine,
  208. HDC hDC,
  209. LPRECT lpRect,
  210. UINT itemAction,
  211. UINT itemState
  212. );
  213. BOOL ContainerLine_Edit(LPCONTAINERLINE lpContainerLine,HWND hWndDoc,HDC hDC);
  214. void ContainerLine_SetHeightInHimetric(LPCONTAINERLINE lpContainerLine, int nHeight);
  215. void ContainerLine_SetLineHeightFromObjectExtent(
  216. LPCONTAINERLINE lpContainerLine,
  217. LPSIZEL lpsizelOleObject
  218. );
  219. BOOL ContainerLine_SaveToStm(
  220. LPCONTAINERLINE lpContainerLine,
  221. LPSTREAM lpLLStm
  222. );
  223. BOOL ContainerLine_SaveOleObjectToStg(
  224. LPCONTAINERLINE lpContainerLine,
  225. LPSTORAGE lpSrcStg,
  226. LPSTORAGE lpDestStg,
  227. BOOL fRemember
  228. );
  229. LPLINE ContainerLine_LoadFromStg(
  230. LPSTORAGE lpSrcStg,
  231. LPSTREAM lpLLStm,
  232. LPOUTLINEDOC lpDestDoc
  233. );
  234. LPMONIKER ContainerLine_GetRelMoniker(
  235. LPCONTAINERLINE lpContainerLine,
  236. DWORD dwAssign
  237. );
  238. LPMONIKER ContainerLine_GetFullMoniker(
  239. LPCONTAINERLINE lpContainerLine,
  240. DWORD dwAssign
  241. );
  242. int ContainerLine_GetTextLen(LPCONTAINERLINE lpContainerLine);
  243. void ContainerLine_GetTextData(LPCONTAINERLINE lpContainerLine,LPSTR lpszBuf);
  244. BOOL ContainerLine_GetOutlineData(
  245. LPCONTAINERLINE lpContainerLine,
  246. LPTEXTLINE lpBuf
  247. );
  248. void ContainerLine_GetOleObjectRectInPixels(
  249. LPCONTAINERLINE lpContainerLine,
  250. LPRECT lprc
  251. );
  252. void ContainerLine_GetPosRect(
  253. LPCONTAINERLINE lpContainerLine,
  254. LPRECT lprcPosRect
  255. );
  256. void ContainerLine_GetOleObjectSizeInHimetric(
  257. LPCONTAINERLINE lpContainerLine,
  258. LPSIZEL lpsizel
  259. );
  260. #if defined( INPLACE_CNTR )
  261. void ContainerLine_UIDeactivate(LPCONTAINERLINE lpContainerLine);
  262. void ContainerLine_InPlaceDeactivate(LPCONTAINERLINE lpContainerLine);
  263. void ContainerLine_UpdateInPlaceObjectRects(
  264. LPCONTAINERLINE lpContainerLine,
  265. LPRECT lprcClipRect
  266. );
  267. void ContainerLine_ContextSensitiveHelp(
  268. LPCONTAINERLINE lpContainerLine,
  269. BOOL fEnterMode
  270. );
  271. void ContainerLine_ForwardPaletteChangedMsg(
  272. LPCONTAINERLINE lpContainerLine,
  273. HWND hwndPalChg
  274. );
  275. void ContainerDoc_ContextSensitiveHelp(
  276. LPCONTAINERDOC lpContainerDoc,
  277. BOOL fEnterMode,
  278. BOOL fInitiatedByObj
  279. );
  280. void ContainerDoc_ForwardPaletteChangedMsg(
  281. LPCONTAINERDOC lpContainerDoc,
  282. HWND hwndPalChg
  283. );
  284. #endif // INPLACE_CNTR
  285. /* ContainerLine::IUnknown methods (functions) */
  286. STDMETHODIMP CntrLine_Unk_QueryInterface(
  287. LPUNKNOWN lpThis,
  288. REFIID riid,
  289. LPVOID FAR* lplpvObj
  290. );
  291. STDMETHODIMP_(ULONG) CntrLine_Unk_AddRef(LPUNKNOWN lpThis);
  292. STDMETHODIMP_(ULONG) CntrLine_Unk_Release(LPUNKNOWN lpThis);
  293. /* ContainerLine::IOleClientSite methods (functions) */
  294. STDMETHODIMP CntrLine_CliSite_QueryInterface(
  295. LPOLECLIENTSITE lpThis,
  296. REFIID riid,
  297. LPVOID FAR* lplpvObj
  298. );
  299. STDMETHODIMP_(ULONG) CntrLine_CliSite_AddRef(LPOLECLIENTSITE lpThis);
  300. STDMETHODIMP_(ULONG) CntrLine_CliSite_Release(LPOLECLIENTSITE lpThis);
  301. STDMETHODIMP CntrLine_CliSite_SaveObject(LPOLECLIENTSITE lpThis);
  302. STDMETHODIMP CntrLine_CliSite_GetMoniker(
  303. LPOLECLIENTSITE lpThis,
  304. DWORD dwAssign,
  305. DWORD dwWhichMoniker,
  306. LPMONIKER FAR* lplpmk
  307. );
  308. STDMETHODIMP CntrLine_CliSite_GetContainer(
  309. LPOLECLIENTSITE lpThis,
  310. LPOLECONTAINER FAR* lplpContainer
  311. );
  312. STDMETHODIMP CntrLine_CliSite_ShowObject(LPOLECLIENTSITE lpThis);
  313. STDMETHODIMP CntrLine_CliSite_OnShowWindow(LPOLECLIENTSITE lpThis,BOOL fShow);
  314. STDMETHODIMP CntrLine_CliSite_RequestNewObjectLayout(LPOLECLIENTSITE lpThis);
  315. /* ContainerLine::IAdviseSink methods (functions) */
  316. STDMETHODIMP CntrLine_AdvSink_QueryInterface(
  317. LPADVISESINK lpThis,
  318. REFIID riid,
  319. LPVOID FAR* lplpvObj
  320. );
  321. STDMETHODIMP_(ULONG) CntrLine_AdvSink_AddRef(LPADVISESINK lpThis);
  322. STDMETHODIMP_(ULONG) CntrLine_AdvSink_Release (LPADVISESINK lpThis);
  323. STDMETHODIMP_(void) CntrLine_AdvSink_OnDataChange(
  324. LPADVISESINK lpThis,
  325. FORMATETC FAR* lpFormatetc,
  326. STGMEDIUM FAR* lpStgmed
  327. );
  328. STDMETHODIMP_(void) CntrLine_AdvSink_OnViewChange(
  329. LPADVISESINK lpThis,
  330. DWORD aspects,
  331. LONG lindex
  332. );
  333. STDMETHODIMP_(void) CntrLine_AdvSink_OnRename(
  334. LPADVISESINK lpThis,
  335. LPMONIKER lpmk
  336. );
  337. STDMETHODIMP_(void) CntrLine_AdvSink_OnSave(LPADVISESINK lpThis);
  338. STDMETHODIMP_(void) CntrLine_AdvSink_OnClose(LPADVISESINK lpThis);
  339. #if defined( INPLACE_CNTR )
  340. /* ContainerLine::IOleInPlaceSite methods (functions) */
  341. STDMETHODIMP CntrLine_IPSite_QueryInterface(
  342. LPOLEINPLACESITE lpThis,
  343. REFIID riid,
  344. LPVOID FAR* lplpvObj
  345. );
  346. STDMETHODIMP_(ULONG) CntrLine_IPSite_AddRef(LPOLEINPLACESITE lpThis);
  347. STDMETHODIMP_(ULONG) CntrLine_IPSite_Release(LPOLEINPLACESITE lpThis);
  348. STDMETHODIMP CntrLine_IPSite_GetWindow(
  349. LPOLEINPLACESITE lpThis,
  350. HWND FAR* lphwnd
  351. );
  352. STDMETHODIMP CntrLine_IPSite_ContextSensitiveHelp(
  353. LPOLEINPLACESITE lpThis,
  354. BOOL fEnterMode
  355. );
  356. STDMETHODIMP CntrLine_IPSite_CanInPlaceActivate(LPOLEINPLACESITE lpThis);
  357. STDMETHODIMP CntrLine_IPSite_OnInPlaceActivate(LPOLEINPLACESITE lpThis);
  358. STDMETHODIMP CntrLine_IPSite_OnUIActivate (LPOLEINPLACESITE lpThis);
  359. STDMETHODIMP CntrLine_IPSite_GetWindowContext(
  360. LPOLEINPLACESITE lpThis,
  361. LPOLEINPLACEFRAME FAR* lplpFrame,
  362. LPOLEINPLACEUIWINDOW FAR* lplpDoc,
  363. LPRECT lprcPosRect,
  364. LPRECT lprcClipRect,
  365. LPOLEINPLACEFRAMEINFO lpFrameInfo
  366. );
  367. STDMETHODIMP CntrLine_IPSite_Scroll(
  368. LPOLEINPLACESITE lpThis,
  369. SIZE scrollExtent
  370. );
  371. STDMETHODIMP CntrLine_IPSite_OnUIDeactivate(
  372. LPOLEINPLACESITE lpThis,
  373. BOOL fUndoable
  374. );
  375. STDMETHODIMP CntrLine_IPSite_OnInPlaceDeactivate(LPOLEINPLACESITE lpThis);
  376. STDMETHODIMP CntrLine_IPSite_DiscardUndoState(LPOLEINPLACESITE lpThis);
  377. STDMETHODIMP CntrLine_IPSite_DeactivateAndUndo(LPOLEINPLACESITE lpThis);
  378. STDMETHODIMP CntrLine_IPSite_OnPosRectChange(
  379. LPOLEINPLACESITE lpThis,
  380. LPCRECT lprcPosRect
  381. );
  382. #endif // INPLACE_CNTR
  383. /* struct definition for persistant data storage of ContainerLine */
  384. #pragma pack(push, 2)
  385. typedef struct tagCONTAINERLINERECORD_ONDISK
  386. {
  387. char m_szStgName[CWCSTORAGENAME]; // stg name w/i cntr stg
  388. USHORT m_fMonikerAssigned; // has a moniker been assigned to obj
  389. DWORD m_dwDrawAspect; // current display aspect for obj
  390. // (either DVASPECT_CONTENT or
  391. // DVASPECT_ICON)
  392. SIZEL m_sizeInHimetric; // extents of obj in himetric units
  393. DWORD m_dwLinkType; // is it a linked object?
  394. // 0 -- NOT a link
  395. // OLEUPDATE_ALWAYS (1) -- auto link
  396. // OLEUPDATE_ONCALL (3) -- man. link
  397. USHORT m_fDoSetExtent; // obj was resized when not running
  398. // IOO::SetExtent needed on next run
  399. } CONTAINERLINERECORD_ONDISK, FAR* LPCONTAINERLINERECORD_ONDISK;
  400. #pragma pack(pop)
  401. typedef struct tagCONTAINERLINERECORD {
  402. char m_szStgName[CWCSTORAGENAME]; // stg name w/i cntr stg
  403. BOOL m_fMonikerAssigned; // has a moniker been assigned to obj
  404. DWORD m_dwDrawAspect; // current display aspect for obj
  405. // (either DVASPECT_CONTENT or
  406. // DVASPECT_ICON)
  407. SIZEL m_sizeInHimetric; // extents of obj in himetric units
  408. DWORD m_dwLinkType; // is it a linked object?
  409. // 0 -- NOT a link
  410. // OLEUPDATE_ALWAYS (1) -- auto link
  411. // OLEUPDATE_ONCALL (3) -- man. link
  412. BOOL m_fDoSetExtent; // obj was resized when not running
  413. // IOO::SetExtent needed on next run
  414. } CONTAINERLINERECORD, FAR* LPCONTAINERLINERECORD;
  415. /*************************************************************************
  416. ** class CONTAINERDOC : OUTLINEDOC
  417. ** CONTAINERDOC is an extention to the base OUTLINEDOC object (structure)
  418. ** that adds OLE 2.0 Container functionality. There is one instance of
  419. ** CONTAINERDOC object created per document open in the app. The SDI
  420. ** version of the app supports one CONTAINERDOC at a time. The MDI
  421. ** version of the app can manage multiple documents at one time.
  422. ** The CONTAINERDOC class inherits all fields
  423. ** from the OUTLINEDOC class. This inheritance is achieved by including a
  424. ** member variable of type OUTLINEDOC as the first field in the
  425. ** CONTAINERDOC structure. Thus a pointer to a CONTAINERDOC object
  426. ** can be cast to be a pointer to a OUTLINEDOC object.
  427. *************************************************************************/
  428. typedef struct tagCONTAINERDOC {
  429. OLEDOC m_OleDoc; // ContainerDoc inherits all fields of OleDoc
  430. ULONG m_nNextObjNo; // next available obj no. for stg name
  431. LPSTORAGE m_lpNewStg; // holds new pStg when SaveAs is pending
  432. BOOL m_fEmbeddedObjectAvail; // is single OLE embed copied to doc
  433. CLSID m_clsidOleObjCopied; // if obj copied, CLSID of obj
  434. DWORD m_dwAspectOleObjCopied; // if obj copied, draw aspect of obj
  435. LPCONTAINERLINE m_lpSrcContainerLine; // src line if doc created for copy
  436. BOOL m_fShowObject; // show object flag
  437. #if defined( INPLACE_CNTR )
  438. LPCONTAINERLINE m_lpLastIpActiveLine; // last in-place active line
  439. LPCONTAINERLINE m_lpLastUIActiveLine; // last UIActive line
  440. HWND m_hWndUIActiveObj; // HWND of UIActive obj.
  441. BOOL m_fAddMyUI; // if adding tools/menu postponed
  442. int m_cIPActiveObjects;
  443. #if defined( INPLACE_CNTRSVR )
  444. LPOLEINPLACEFRAME m_lpTopIPFrame; // ptr to Top In-place frame.
  445. LPOLEINPLACEFRAME m_lpTopIPDoc; // ptr to Top In-place Doc window.
  446. HMENU m_hSharedMenu; // combined obj/cntr menu
  447. // NULL if we are top container
  448. HOLEMENU m_hOleMenu; // returned by OleCreateMenuDesc.
  449. // NULL if we are top container
  450. #endif // INPLACE_CNTRSVR
  451. #endif // INPLACE_CNTR
  452. struct CDocOleUILinkContainerImpl {
  453. IOleUILinkContainerVtbl FAR* lpVtbl;
  454. LPCONTAINERDOC lpContainerDoc;
  455. int cRef; // interface specific ref count.
  456. } m_OleUILinkContainer;
  457. } CONTAINERDOC;
  458. /* ContainerDoc methods (functions) */
  459. BOOL ContainerDoc_Init(LPCONTAINERDOC lpContainerDoc, BOOL fDataTransferDoc);
  460. LPCONTAINERLINE ContainerDoc_GetNextLink(
  461. LPCONTAINERDOC lpContainerDoc,
  462. LPCONTAINERLINE lpContainerLine
  463. );
  464. void ContainerDoc_UpdateLinks(LPCONTAINERDOC lpContainerDoc);
  465. void ContainerDoc_SetShowObjectFlag(LPCONTAINERDOC lpContainerDoc, BOOL fShow);
  466. BOOL ContainerDoc_GetShowObjectFlag(LPCONTAINERDOC lpContainerDoc);
  467. void ContainerDoc_InsertOleObjectCommand(LPCONTAINERDOC lpContainerDoc);
  468. void ContainerDoc_EditLinksCommand(LPCONTAINERDOC lpContainerDoc);
  469. void ContainerDoc_PasteLinkCommand(LPCONTAINERDOC lpContainerDoc);
  470. void ContainerDoc_ConvertCommand(
  471. LPCONTAINERDOC lpContainerDoc,
  472. BOOL fServerNotRegistered
  473. );
  474. BOOL ContainerDoc_PasteFormatFromData(
  475. LPCONTAINERDOC lpContainerDoc,
  476. CLIPFORMAT cfFormat,
  477. LPDATAOBJECT lpSrcDataObj,
  478. BOOL fLocalDataObj,
  479. BOOL fLink,
  480. BOOL fDisplayAsIcon,
  481. HGLOBAL hMetaPict,
  482. LPSIZEL lpSizelInSrc
  483. );
  484. int ContainerDoc_PasteCntrOutlData(
  485. LPCONTAINERDOC lpDestContainerDoc,
  486. LPSTORAGE lpSrcStg,
  487. int nStartIndex
  488. );
  489. BOOL ContainerDoc_QueryPasteFromData(
  490. LPCONTAINERDOC lpContainerDoc,
  491. LPDATAOBJECT lpSrcDataObj,
  492. BOOL fLink
  493. );
  494. int ContainerDoc_PasteOleObject(
  495. LPCONTAINERDOC lpContainerDoc,
  496. LPDATAOBJECT lpSrcDataObj,
  497. DWORD dwCreateType,
  498. CLIPFORMAT cfFormat,
  499. int nIndex,
  500. BOOL fDisplayAsIcon,
  501. HGLOBAL hMetaPict,
  502. LPSIZEL lpSizelInSrc
  503. );
  504. BOOL ContainerDoc_CloseAllOleObjects(
  505. LPCONTAINERDOC lpContainerDoc,
  506. DWORD dwSaveOption
  507. );
  508. void ContainerDoc_UnloadAllOleObjectsOfClass(
  509. LPCONTAINERDOC lpContainerDoc,
  510. REFCLSID rClsid,
  511. DWORD dwSaveOption
  512. );
  513. void ContainerDoc_InformAllOleObjectsDocRenamed(
  514. LPCONTAINERDOC lpContainerDoc,
  515. LPMONIKER lpmkDoc
  516. );
  517. void ContainerDoc_UpdateExtentOfAllOleObjects(LPCONTAINERDOC lpContainerDoc);
  518. BOOL ContainerDoc_SaveToFile(
  519. LPCONTAINERDOC lpContainerDoc,
  520. LPCSTR lpszFileName,
  521. UINT uFormat,
  522. BOOL fRemember
  523. );
  524. void ContainerDoc_ContainerLineDoVerbCommand(
  525. LPCONTAINERDOC lpContainerDoc,
  526. LONG iVerb
  527. );
  528. void ContainerDoc_GetNextStgName(
  529. LPCONTAINERDOC lpContainerDoc,
  530. LPSTR lpszStgName,
  531. int nLen
  532. );
  533. BOOL ContainerDoc_IsStgNameUsed(
  534. LPCONTAINERDOC lpContainerDoc,
  535. LPSTR lpszStgName
  536. );
  537. LPSTORAGE ContainerDoc_GetStg(LPCONTAINERDOC lpContainerDoc);
  538. HRESULT ContainerDoc_GetObject(
  539. LPCONTAINERDOC lpContainerDoc,
  540. LPOLESTR lpszItem,
  541. DWORD dwSpeedNeeded,
  542. REFIID riid,
  543. LPVOID FAR* lplpvObject
  544. );
  545. HRESULT ContainerDoc_GetObjectStorage(
  546. LPCONTAINERDOC lpContainerDoc,
  547. LPOLESTR lpszItem,
  548. LPSTORAGE FAR* lplpStg
  549. );
  550. HRESULT ContainerDoc_IsRunning(LPCONTAINERDOC lpContainerDoc, LPOLESTR lpszItem);
  551. LPUNKNOWN ContainerDoc_GetSingleOleObject(
  552. LPCONTAINERDOC lpContainerDoc,
  553. REFIID riid,
  554. LPCONTAINERLINE FAR* lplpContainerLine
  555. );
  556. BOOL ContainerDoc_IsSelAnOleObject(
  557. LPCONTAINERDOC lpContainerDoc,
  558. REFIID riid,
  559. LPUNKNOWN FAR* lplpvObj,
  560. int FAR* lpnIndex,
  561. LPCONTAINERLINE FAR* lplpContainerLine
  562. );
  563. HRESULT ContainerDoc_GetData (
  564. LPCONTAINERDOC lpContainerDoc,
  565. LPFORMATETC lpformatetc,
  566. LPSTGMEDIUM lpMedium
  567. );
  568. HRESULT ContainerDoc_GetDataHere (
  569. LPCONTAINERDOC lpContainerDoc,
  570. LPFORMATETC lpformatetc,
  571. LPSTGMEDIUM lpMedium
  572. );
  573. HRESULT ContainerDoc_QueryGetData (
  574. LPCONTAINERDOC lpContainerDoc,
  575. LPFORMATETC lpformatetc
  576. );
  577. HRESULT ContainerDoc_SetData (
  578. LPCONTAINERDOC lpContainerDoc,
  579. LPFORMATETC lpformatetc,
  580. LPSTGMEDIUM lpmedium,
  581. BOOL fRelease
  582. );
  583. HRESULT ContainerDoc_EnumFormatEtc(
  584. LPCONTAINERDOC lpContainerDoc,
  585. DWORD dwDirection,
  586. LPENUMFORMATETC FAR* lplpenumFormatEtc
  587. );
  588. BOOL ContainerDoc_SetupDocGetFmts(
  589. LPCONTAINERDOC lpContainerDoc,
  590. LPCONTAINERLINE lpContainerLine
  591. );
  592. #if defined( INPLACE_CNTR )
  593. void ContainerDoc_ShutDownLastInPlaceServerIfNotNeeded(
  594. LPCONTAINERDOC lpContainerDoc,
  595. LPCONTAINERLINE lpNextActiveLine
  596. );
  597. BOOL ContainerDoc_IsUIDeactivateNeeded(
  598. LPCONTAINERDOC lpContainerDoc,
  599. POINT pt
  600. );
  601. HWND ContainerDoc_GetUIActiveWindow(LPCONTAINERDOC lpContainerDoc);
  602. void ContainerDoc_UpdateInPlaceObjectRects(LPCONTAINERDOC lpContainerDoc, int nIndex);
  603. void ContainerDoc_GetClipRect(
  604. LPCONTAINERDOC lpContainerDoc,
  605. LPRECT lprcClipRect
  606. );
  607. void ContainerDoc_FrameWindowResized(LPCONTAINERDOC lpContainerDoc);
  608. LPOLEINPLACEFRAME ContainerDoc_GetTopInPlaceFrame(
  609. LPCONTAINERDOC lpContainerDoc
  610. );
  611. void ContainerDoc_GetSharedMenuHandles(
  612. LPCONTAINERDOC lpContainerDoc,
  613. HMENU FAR* lphSharedMenu,
  614. HOLEMENU FAR* lphOleMenu
  615. );
  616. void ContainerDoc_RemoveFrameLevelTools(LPCONTAINERDOC lpContainerDoc);
  617. void ContainerDoc_AddFrameLevelUI(LPCONTAINERDOC lpContainerDoc);
  618. void ContainerDoc_AddFrameLevelTools(LPCONTAINERDOC lpContainerDoc);
  619. #if defined( INPLACE_CNTRSVR ) || defined( INPLACE_MDICNTR )
  620. LPOLEINPLACEUIWINDOW ContainerDoc_GetTopInPlaceDoc(
  621. LPCONTAINERDOC lpContainerDoc
  622. );
  623. void ContainerDoc_RemoveDocLevelTools(LPCONTAINERDOC lpContainerDoc);
  624. void ContainerDoc_AddDocLevelTools(LPCONTAINERDOC lpContainerDoc);
  625. #endif // INPLACE_CNTRSVR || INPLACE_MDICNTR
  626. #endif // INPLACE_CNTR
  627. /* ContainerDoc::IOleUILinkContainer methods (functions) */
  628. STDMETHODIMP CntrDoc_LinkCont_QueryInterface(
  629. LPOLEUILINKCONTAINER lpThis,
  630. REFIID riid,
  631. LPVOID FAR* lplpvObj
  632. );
  633. STDMETHODIMP_(ULONG) CntrDoc_LinkCont_AddRef(LPOLEUILINKCONTAINER lpThis);
  634. STDMETHODIMP_(ULONG) CntrDoc_LinkCont_Release(LPOLEUILINKCONTAINER lpThis);
  635. STDMETHODIMP_(DWORD) CntrDoc_LinkCont_GetNextLink(
  636. LPOLEUILINKCONTAINER lpThis,
  637. DWORD dwLink
  638. );
  639. STDMETHODIMP CntrDoc_LinkCont_SetLinkUpdateOptions(
  640. LPOLEUILINKCONTAINER lpThis,
  641. DWORD dwLink,
  642. DWORD dwUpdateOpt
  643. );
  644. STDMETHODIMP CntrDoc_LinkCont_GetLinkUpdateOptions(
  645. LPOLEUILINKCONTAINER lpThis,
  646. DWORD dwLink,
  647. DWORD FAR* dwUpdateOpt
  648. );
  649. STDMETHODIMP CntrDoc_LinkCont_SetLinkSource(
  650. LPOLEUILINKCONTAINER lpThis,
  651. DWORD dwLink,
  652. LPSTR lpszDisplayName,
  653. ULONG clenFileName,
  654. ULONG FAR* lpchEaten,
  655. BOOL fValidateSource
  656. );
  657. STDMETHODIMP CntrDoc_LinkCont_GetLinkSource(
  658. LPOLEUILINKCONTAINER lpThis,
  659. DWORD dwLink,
  660. LPSTR FAR* lplpszDisplayName,
  661. ULONG FAR* lplenFileName,
  662. LPSTR FAR* lplpszFullLinkType,
  663. LPSTR FAR* lplpszShortLinkType,
  664. BOOL FAR* lpfSourceAvailable,
  665. BOOL FAR* lpfIsSelected
  666. );
  667. STDMETHODIMP CntrDoc_LinkCont_OpenLinkSource(
  668. LPOLEUILINKCONTAINER lpThis,
  669. DWORD dwLink
  670. );
  671. STDMETHODIMP CntrDoc_LinkCont_UpdateLink(
  672. LPOLEUILINKCONTAINER lpThis,
  673. DWORD dwLink,
  674. BOOL fErrorMessage,
  675. BOOL fErrorAction
  676. );
  677. STDMETHODIMP CntrDoc_LinkCont_CancelLink(
  678. LPOLEUILINKCONTAINER lpThis,
  679. DWORD dwLink
  680. );
  681. /*************************************************************************
  682. ** class CONTAINERAPP : OLEAPP
  683. ** CONTAINERAPP is an extention to the base OLEAPP object (structure)
  684. ** that adds special Container functionality. There is one instance of
  685. ** CONTAINERApp object created per running application instance. This
  686. ** object holds many fields that could otherwise be organized as
  687. ** global variables. The CONTAINERAPP class inherits all fields
  688. ** from the OLEAPP class. This inheritance is achieved by including a
  689. ** member variable of type OLEAPP as the first field in the CONTAINERAPP
  690. ** structure. OLEAPP inherits from OUTLINEAPP. This inheritance is
  691. ** achieved in the same manner. Thus a pointer to a CONTAINERAPP object
  692. ** can be cast to be a pointer to an OLEAPP or an OUTLINEAPP object
  693. *************************************************************************/
  694. /* Forward definition of types */
  695. typedef struct tagCONTAINERAPP FAR* LPCONTAINERAPP;
  696. typedef struct tagCONTAINERAPP {
  697. OLEAPP m_OleApp; // ContainerApp inherits all fields of OleApp
  698. UINT m_cfCntrOutl; // clipboard format for CntrOutl (client ver) data
  699. int m_nSingleObjGetFmts; // no. formats avail when single obj copied
  700. FORMATETC m_arrSingleObjGetFmts[MAXNOFMTS];
  701. // array of FormatEtc's available via
  702. // IDataObject::GetData when a single
  703. // OLE object is copied.
  704. #if defined( INPLACE_CNTR )
  705. HACCEL m_hAccelIPCntr; // accelerators for container's workspace commands
  706. HMENU m_hMenuFile; // handle to File menu of container app
  707. HMENU m_hMenuView; // handle to View menu of container app
  708. HMENU m_hMenuDebug; // handle to Debug menu of container app
  709. LPOLEINPLACEACTIVEOBJECT m_lpIPActiveObj; // ptr to inplace active OLE obj
  710. HWND m_hWndUIActiveObj; // HWND of UIActive obj.
  711. BOOL m_fPendingUIDeactivate; // should app UIDeactivate on LBUTTONUP
  712. BOOL m_fMustResizeClientArea;// if client area resize pending
  713. // (see Doc_FrameWindowResized)
  714. BOOL m_fMenuHelpMode;// is F1 pressed in menu, if so give help
  715. #ifdef _DEBUG
  716. BOOL m_fOutSideIn;
  717. #endif
  718. struct COleInPlaceFrameImpl {
  719. IOleInPlaceFrameVtbl FAR* lpVtbl;
  720. LPCONTAINERAPP lpContainerApp;
  721. int cRef; // interface specific ref count.
  722. } m_OleInPlaceFrame;
  723. #endif // INPLACE_CNTR
  724. } CONTAINERAPP;
  725. /* ContainerApp methods (functions) */
  726. BOOL ContainerApp_InitInstance(
  727. LPCONTAINERAPP lpContainerApp,
  728. HINSTANCE hInst,
  729. int nCmdShow
  730. );
  731. BOOL ContainerApp_InitVtbls(LPCONTAINERAPP lpApp);
  732. #if defined( INPLACE_CNTR )
  733. /* ContainerApp::IOleInPlaceFrame methods (functions) */
  734. STDMETHODIMP CntrApp_IPFrame_QueryInterface(
  735. LPOLEINPLACEFRAME lpThis,
  736. REFIID riid,
  737. LPVOID FAR* lplpvObj
  738. );
  739. STDMETHODIMP_(ULONG) CntrApp_IPFrame_AddRef(LPOLEINPLACEFRAME lpThis);
  740. STDMETHODIMP_(ULONG) CntrApp_IPFrame_Release(LPOLEINPLACEFRAME lpThis);
  741. STDMETHODIMP CntrApp_IPFrame_GetWindow(
  742. LPOLEINPLACEFRAME lpThis,
  743. HWND FAR* lphwnd
  744. );
  745. STDMETHODIMP CntrApp_IPFrame_ContextSensitiveHelp(
  746. LPOLEINPLACEFRAME lpThis,
  747. BOOL fEnterMode
  748. );
  749. STDMETHODIMP CntrApp_IPFrame_GetBorder(
  750. LPOLEINPLACEFRAME lpThis,
  751. LPRECT lprectBorder
  752. );
  753. STDMETHODIMP CntrApp_IPFrame_RequestBorderSpace(
  754. LPOLEINPLACEFRAME lpThis,
  755. LPCBORDERWIDTHS lpWidths
  756. );
  757. STDMETHODIMP CntrApp_IPFrame_SetBorderSpace(
  758. LPOLEINPLACEFRAME lpThis,
  759. LPCBORDERWIDTHS lpWidths
  760. );
  761. STDMETHODIMP CntrApp_IPFrame_SetActiveObject(
  762. LPOLEINPLACEFRAME lpThis,
  763. LPOLEINPLACEACTIVEOBJECT lpActiveObject,
  764. LPCOLESTR lpszObjName
  765. );
  766. STDMETHODIMP CntrApp_IPFrame_InsertMenus(
  767. LPOLEINPLACEFRAME lpThis,
  768. HMENU hmenu,
  769. LPOLEMENUGROUPWIDTHS lpMenuWidths
  770. );
  771. STDMETHODIMP CntrApp_IPFrame_SetMenu(
  772. LPOLEINPLACEFRAME lpThis,
  773. HMENU hmenuShared,
  774. HOLEMENU holemenu,
  775. HWND hwndActiveObject
  776. );
  777. STDMETHODIMP CntrApp_IPFrame_RemoveMenus(
  778. LPOLEINPLACEFRAME lpThis,
  779. HMENU hmenu
  780. );
  781. STDMETHODIMP CntrApp_IPFrame_SetStatusText(
  782. LPOLEINPLACEFRAME lpThis,
  783. LPCOLESTR lpszStatusText
  784. );
  785. STDMETHODIMP CntrApp_IPFrame_EnableModeless(
  786. LPOLEINPLACEFRAME lpThis,
  787. BOOL fEnable
  788. );
  789. STDMETHODIMP CntrApp_IPFrame_TranslateAccelerator(
  790. LPOLEINPLACEFRAME lpThis,
  791. LPMSG lpmsg,
  792. WORD wID
  793. );
  794. #endif // INPLACE_CNTR
  795. #endif // _CNTROUTL_H_