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