|
|
1.1 root 1: /*************************************************************************
2: **
3: ** OLE 2.0 Sample Code
4: **
5: ** oleoutl.h
6: **
7: ** This file contains file contains data structure defintions,
8: ** function prototypes, constants, etc. which are common to the
9: ** server version and the container version of the app.
10: ** app version of the Outline series of sample applications:
11: ** Outline -- base version of the app (without OLE functionality)
12: ** SvrOutl -- OLE 2.0 Server sample app
13: ** CntrOutl -- OLE 2.0 Containter sample app
14: **
15: ** (c) Copyright Microsoft Corp. 1992 - 1993 All Rights Reserved
16: **
17: *************************************************************************/
18:
19: #if !defined( _OLEOUTL_H_ )
20: #define _OLEOUTL_H_
21:
22: #ifndef RC_INVOKED
23: #pragma message ("INCLUDING OLEOUTL.H from " __FILE__)
24: // make 'different levels of inderection' considered an error
25: #pragma warning (error:4047)
26: #endif /* RC_INVOKED */
27:
28: #if defined( USE_MSGFILTER )
29: #include <msgfiltr.h>
30: #endif // USE_MSGFILTER
31:
32: /* Defines */
33:
34: #if defined( INITCLSID )
35: // OLE2NOTE: we must force our CLSID GUIDs to be initialized exactly once.
36: // Each dll/exe must initialize its GUIDs once. This is done by
37: // including initguid.h after including ole2.h but prior to any GUID
38: // defintion statements (DEFINE_OLEGUID statements).
39:
40: #include "initguid.h" // forces our GUIDs to be initialized
41: #endif
42:
43: /* CLASS ID CONSTANTS (GUID's)
44: ** OLE2NOTE: these class id values are allocated out of a private pool
45: ** of GUID's allocated to the OLE 2.0 development team. GUID's of
46: ** the following range have been allocated to OLE 2.0 sample code:
47: ** 00000400-0000-0000-C000-000000000046
48: ** 000004FF-0000-0000-C000-000000000046
49: **
50: ** values reserverd thus far:
51: ** 00000400 -- Ole 2.0 Server Sample Outline
52: ** 00000401 -- Ole 2.0 Container Sample Outline
53: ** 00000402 -- Ole 2.0 In-Place Server Outline
54: ** 00000403 -- Ole 2.0 In-Place Container Outline
55: ** 00000404 : 0000040F -- reserved for Outline Series
56: ** 000004F0 : 000004FF -- Developer Relations Series
57: */
58: DEFINE_OLEGUID(CLSID_SvrOutl, 0x00000400, 0, 0);
59: DEFINE_OLEGUID(CLSID_CntrOutl, 0x00000401, 0, 0);
60: DEFINE_OLEGUID(CLSID_ISvrOtl, 0x00000402, 0, 0);
61: DEFINE_OLEGUID(CLSID_ICntrOtl, 0x00000403, 0, 0);
62:
63: /* OLE2NOTE: these strings should correspond to the strings registered
64: ** in the registration database.
65: */
66: // REVIEW: should load strings from resource file
67: #if defined( INPLACE_SVR )
68:
69: #define CLSID_APP CLSID_ISvrOtl
70: #define FULLUSERTYPENAME "Ole 2.0 In-Place Server Outline"
71: #define SHORTUSERTYPENAME "Outline" // max 15 chars
72: #undef APPFILENAMEFILTER
73: #define APPFILENAMEFILTER "Outline Files (*.OLN)|*.oln|All files (*.*)|*.*|"
74: #undef DEFEXTENSION
75: #define DEFEXTENSION "oln" // Default file extension
76:
77: #elif defined( INPLACE_CNTR )
78:
79: #define CLSID_APP CLSID_ICntrOtl
80: #define FULLUSERTYPENAME "Ole 2.0 In-Place Container Outline"
81: // #define SHORTUSERTYPENAME "Outline" // max 15 chars
82: #undef APPFILENAMEFILTER
83: #define APPFILENAMEFILTER "CntrOutl Files (*.OLC)|*.olc|Outline Files (*.OLN)|*.oln|All files (*.*)|*.*|"
84: #undef DEFEXTENSION
85: #define DEFEXTENSION "olc" // Default file extension
86:
87: #elif defined( OLE_SERVER )
88:
89: #define CLSID_APP CLSID_SvrOutl
90: #define FULLUSERTYPENAME "Ole 2.0 Server Sample Outline"
91: #define SHORTUSERTYPENAME "Outline"
92: #undef APPFILENAMEFILTER
93: #define APPFILENAMEFILTER "Outline Files (*.OLN)|*.oln|All files (*.*)|*.*|"
94: #undef DEFEXTENSION
95: #define DEFEXTENSION "oln" // Default file extension
96:
97: #elif defined( OLE_CNTR )
98:
99: #define CLSID_APP CLSID_CntrOutl
100: #define FULLUSERTYPENAME "Ole 2.0 Container Sample Outline"
101: // #define SHORTUSERTYPENAME "Outline" // max 15 chars
102: #undef APPFILENAMEFILTER
103: #define APPFILENAMEFILTER "CntrOutl Files (*.OLC)|*.olc|Outline Files (*.OLN)|*.oln|All files (*.*)|*.*|"
104: #undef DEFEXTENSION
105: #define DEFEXTENSION "olc" // Default file extension
106:
107: #endif
108:
109: // Maximum number of formats offered by IDataObject::GetData/SetData
110: #define MAXNOFMTS 10
111: #define MAXNOLINKTYPES 3
112:
113: #if defined( USE_DRAGDROP )
114: #define DD_SEL_THRESH HITTESTDELTA // Border threshold to start drag
115: #define MAX_SEL_ITEMS 0x0080
116: #endif // USE_DRAGDROP
117:
118:
119:
120: /* Positions of the various menus */
121: #define POS_FILEMENU 0
122: #define POS_EDITMENU 1
123: #define POS_VIEWMENU 2
124: #define POS_LINEMENU 3
125: #define POS_NAMEMENU 4
126: #define POS_OPTIONSMENU 5
127: #define POS_DEBUGMENU 6
128: #define POS_HELPMENU 7
129:
130:
131: #define POS_OBJECT 11
132:
133:
134: /* Types */
135:
136: // Document initialization type
137: #define DOCTYPE_EMBEDDED 3 // init from an IStorage* of an embedded obj
138: #define DOCTYPE_FROMSTG 4 // init from an IStorage* with doc bit set
139:
140:
141: /* Forward type definitions */
142: typedef struct tagOLEAPP FAR* LPOLEAPP;
143: typedef struct tagOLEDOC FAR* LPOLEDOC;
144:
145: /* Flags to control Moniker assignment for OleDoc_GetFullMoniker */
146: // REVIEW: should use official OLEGETMONIKER type for final version
147: typedef enum tagGETMONIKERTYPE {
148: GETMONIKER_ONLYIFTHERE = 1,
149: GETMONIKER_FORCEASSIGN = 2,
150: GETMONIKER_UNASSIGN = 3,
151: GETMONIKER_TEMPFORUSER = 4
152: } GETMONIKERTYPE;
153:
154: /* Flags to control direction for drag scrolling */
155: typedef enum tagSCROLLDIR {
156: SCROLLDIR_NULL = 0,
157: SCROLLDIR_UP = 1,
158: SCROLLDIR_DOWN = 2,
159: SCROLLDIR_RIGHT = 3, // currently not used
160: SCROLLDIR_LEFT = 4 // currently not used
161: } SCROLLDIR;
162:
163:
164: /*************************************************************************
165: ** class OLEDOC : OUTLINEDOC
166: ** OLEDOC is an extention to the base OUTLINEDOC object (structure)
167: ** that adds common OLE 2.0 functionality used by both the server
168: ** and container versions. This is an abstract class. You do not
169: ** instantiate an instance of OLEDOC directly but instead
170: ** instantiate one of its concrete subclasses: SERVERDOC or
171: ** CONTAINERDOC. There is one instance of an document
172: ** object created per document open in the app. The SDI
173: ** version of the app supports one ServerDoc at a time. The MDI
174: ** version of the app can manage multiple documents at one time.
175: ** The OLEDOC class inherits all fields from the OUTLINEDOC class.
176: ** This inheritance is achieved by including a member variable of
177: ** type OUTLINEDOC as the first field in the OLEDOC
178: ** structure. Thus a pointer to an OLEDOC object can be cast to be
179: ** a pointer to a OUTLINEDOC object.
180: *************************************************************************/
181:
182: typedef struct tagOLEDOC {
183: OUTLINEDOC m_OutlineDoc; // ServerDoc inherits from OutlineDoc
184: ULONG m_cRef; // total ref count for document
185: ULONG m_cLock; // total lock count for document
186: BOOL m_fObjIsClosing; // flag to guard recursive close call
187: BOOL m_fObjIsDestroying; // flag to guard recursiv destroy call
188: DWORD m_dwRegROT; // key if doc registered as running
189: LPMONIKER m_lpFileMoniker; // moniker if file-based/untitled doc
190: BOOL m_fLinkSourceAvail; // can doc offer CF_LINKSOURCE
191: LPOLEDOC m_lpSrcDocOfCopy; // src doc if doc created for copy
192: BOOL m_fUpdateEditMenu; // need to update edit menu??
193:
194: #if defined( USE_DRAGDROP )
195: DWORD m_dwTimeEnterScrollArea; // start time for scroll delay
196: DWORD m_lastdwScrollDir; // current dir for drag scroll
197: BOOL m_fRegDragDrop; // is doc registered as drop target?
198: BOOL m_fLocalDrag; // is doc source of the drag
199: BOOL m_fLocalDrop; // was doc target of the drop
200: BOOL m_fCanDropCopy; // is Drag/Drop copy/move possible?
201: BOOL m_fCanDropLink; // is Drag/Drop link possible?
202: BOOL m_fDragLeave; // has drag left
203: BOOL m_fPendingDrag; // LButtonDown--possible drag pending
204: POINT m_ptButDown; // LButtonDown coordinates
205:
206: #endif // USE_DRAGDROP
207:
208: struct CDocUnknownImpl {
209: IUnknownVtbl FAR* lpVtbl;
210: LPOLEDOC lpOleDoc;
211: int cRef; // interface specific ref count.
212: } m_Unknown;
213:
214: struct CDocPersistFileImpl {
215: IPersistFileVtbl FAR* lpVtbl;
216: LPOLEDOC lpOleDoc;
217: int cRef; // interface specific ref count.
218: } m_PersistFile;
219:
220: struct CDocOleItemContainerImpl {
221: IOleItemContainerVtbl FAR* lpVtbl;
222: LPOLEDOC lpOleDoc;
223: int cRef; // interface specific ref count.
224: } m_OleItemContainer;
225:
226: struct CDocDataObjectImpl {
227: IDataObjectVtbl FAR* lpVtbl;
228: LPOLEDOC lpOleDoc;
229: int cRef; // interface specific ref count.
230: } m_DataObject;
231:
232: #ifdef USE_DRAGDROP
233: struct CDocDropSourceImpl {
234: IDropSourceVtbl FAR* lpVtbl;
235: LPOLEDOC lpOleDoc;
236: int cRef; // interface specific ref count.
237: } m_DropSource;
238:
239: struct CDocDropTargetImpl {
240: IDropTargetVtbl FAR* lpVtbl;
241: LPOLEDOC lpOleDoc;
242: int cRef; // interface specific ref count.
243: } m_DropTarget;
244: #endif // USE_DRAGDROP
245:
246: } OLEDOC;
247:
248: /* OleDoc methods (functions) */
249: BOOL OleDoc_Init(LPOLEDOC lpOleDoc, BOOL fDataTransferDoc);
250: BOOL OleDoc_InitNewFile(LPOLEDOC lpOleDoc);
251: void OleDoc_ShowWindow(LPOLEDOC lpOleDoc);
252: void OleDoc_HideWindow(LPOLEDOC lpOleDoc, BOOL fShutDown);
253: HRESULT OleDoc_Lock(LPOLEDOC lpOleDoc, BOOL fLock, BOOL fLastUnlockReleases);
254: ULONG OleDoc_AddRef(LPOLEDOC lpOleDoc);
255: ULONG OleDoc_Release (LPOLEDOC lpOleDoc);
256: HRESULT OleDoc_QueryInterface(
257: LPOLEDOC lpOleDoc,
258: REFIID riid,
259: LPVOID FAR* lplpUnk
260: );
261: BOOL OleDoc_Close(LPOLEDOC lpOleDoc, DWORD dwSaveOption);
262: void OleDoc_Destroy(LPOLEDOC lpOleDoc);
263: void OleDoc_SetUpdateEditMenuFlag(LPOLEDOC lpOleDoc, BOOL fUpdate);
264: BOOL OleDoc_GetUpdateEditMenuFlag(LPOLEDOC lpOleDoc);
265: void OleDoc_GetExtent(LPOLEDOC lpOleDoc, LPSIZEL lpsizel);
266: HGLOBAL OleDoc_GetObjectDescriptorData(
267: LPOLEDOC lpOleDoc,
268: LPLINERANGE lplrSel
269: );
270: LPMONIKER OleDoc_GetFullMoniker(LPOLEDOC lpOleDoc, DWORD dwAssign);
271: void OleDoc_GetExtent(LPOLEDOC lpOleDoc, LPSIZEL lpsizel);
272: void OleDoc_DocRenamedUpdate(LPOLEDOC lpOleDoc, LPMONIKER lpmkDoc);
273: void OleDoc_PasteCommand(LPOLEDOC lpOleDoc);
274: void OleDoc_PasteSpecialCommand(LPOLEDOC lpOleDoc);
275: BOOL OleDoc_PasteFromData(
276: LPOLEDOC lpOleDoc,
277: LPDATAOBJECT lpSrcDataObj,
278: BOOL fLocalDataObj,
279: BOOL fLink
280: );
281: BOOL OleDoc_PasteFormatFromData(
282: LPOLEDOC lpOleDoc,
283: CLIPFORMAT cfFormat,
284: LPDATAOBJECT lpSrcDataObj,
285: BOOL fLocalDataObj,
286: BOOL fLink,
287: BOOL fDisplayAsIcon,
288: HGLOBAL hMetaPict
289: );
290: BOOL OleDoc_QueryPasteFromData(
291: LPOLEDOC lpOleDoc,
292: LPDATAOBJECT lpSrcDataObj,
293: BOOL fLink
294: );
295:
296: #if defined( USE_DRAGDROP )
297:
298: BOOL OleDoc_QueryDrag( LPOLEDOC lpOleDoc, int y );
299: BOOL OleDoc_QueryDrop (
300: LPOLEDOC lpOleDoc,
301: DWORD grfKeyState,
302: POINTL pointl,
303: BOOL fDragScroll,
304: LPDWORD lpdwEffect
305: );
306: DWORD OleDoc_DoDragDrop (LPOLEDOC lpSrcOleDoc);
307: BOOL OleDoc_DoDragScroll(LPOLEDOC lpOleDoc, POINTL pointl);
308:
309: #endif // USE_DRAGDROP
310:
311: /* OleDoc::IUnknown methods (functions) */
312: STDMETHODIMP OleDoc_Unk_QueryInterface(
313: LPUNKNOWN lpThis,
314: REFIID riid,
315: LPVOID FAR* lplpvObj
316: );
317: STDMETHODIMP_(ULONG) OleDoc_Unk_AddRef(LPUNKNOWN lpThis);
318: STDMETHODIMP_(ULONG) OleDoc_Unk_Release (LPUNKNOWN lpThis);
319:
320: /* OleDoc::IPersistFile methods (functions) */
321: STDMETHODIMP OleDoc_PFile_QueryInterface(
322: LPPERSISTFILE lpThis,
323: REFIID riid,
324: LPVOID FAR* lplpvObj
325: );
326: STDMETHODIMP_(ULONG) OleDoc_PFile_AddRef(LPPERSISTFILE lpThis);
327: STDMETHODIMP_(ULONG) OleDoc_PFile_Release (LPPERSISTFILE lpThis);
328: STDMETHODIMP OleDoc_PFile_GetClassID (
329: LPPERSISTFILE lpThis,
330: CLSID FAR* lpclsid
331: );
332: STDMETHODIMP OleDoc_PFile_IsDirty(LPPERSISTFILE lpThis);
333: STDMETHODIMP OleDoc_PFile_Load (
334: LPPERSISTFILE lpThis,
335: LPCSTR lpszFileName,
336: DWORD grfMode
337: );
338: STDMETHODIMP OleDoc_PFile_Save (
339: LPPERSISTFILE lpThis,
340: LPCSTR lpszFileName,
341: BOOL fRemember
342: );
343: STDMETHODIMP OleDoc_PFile_SaveCompleted (
344: LPPERSISTFILE lpThis,
345: LPCSTR lpszFileName
346: );
347: STDMETHODIMP OleDoc_PFile_GetCurFile (
348: LPPERSISTFILE lpThis,
349: LPSTR FAR* lplpszFileName
350: );
351:
352: /* OleDoc::IOleItemContainer methods (functions) */
353: STDMETHODIMP OleDoc_ItemCont_QueryInterface(
354: LPOLEITEMCONTAINER lpThis,
355: REFIID riid,
356: LPVOID FAR* lplpvObj
357: );
358: STDMETHODIMP_(ULONG) OleDoc_ItemCont_AddRef(LPOLEITEMCONTAINER lpThis);
359: STDMETHODIMP_(ULONG) OleDoc_ItemCont_Release(LPOLEITEMCONTAINER lpThis);
360: STDMETHODIMP OleDoc_ItemCont_ParseDisplayName(
361: LPOLEITEMCONTAINER lpThis,
362: LPBC lpbc,
363: LPSTR lpszDisplayName,
364: ULONG FAR* lpchEaten,
365: LPMONIKER FAR* lplpmkOut
366: );
367:
368: STDMETHODIMP OleDoc_ItemCont_EnumObjects(
369: LPOLEITEMCONTAINER lpThis,
370: DWORD grfFlags,
371: LPENUMUNKNOWN FAR* lplpenumUnknown
372: );
373: STDMETHODIMP OleDoc_ItemCont_LockContainer(
374: LPOLEITEMCONTAINER lpThis,
375: BOOL fLock
376: );
377: STDMETHODIMP OleDoc_ItemCont_GetObject(
378: LPOLEITEMCONTAINER lpThis,
379: LPSTR lpszItem,
380: DWORD dwSpeedNeeded,
381: LPBINDCTX lpbc,
382: REFIID riid,
383: LPVOID FAR* lplpvObject
384: );
385: STDMETHODIMP OleDoc_ItemCont_GetObjectStorage(
386: LPOLEITEMCONTAINER lpThis,
387: LPSTR lpszItem,
388: LPBINDCTX lpbc,
389: REFIID riid,
390: LPVOID FAR* lplpvStorage
391: );
392: STDMETHODIMP OleDoc_ItemCont_IsRunning(
393: LPOLEITEMCONTAINER lpThis,
394: LPSTR lpszItem
395: );
396:
397: /* OleDoc::IDataObject methods (functions) */
398: STDMETHODIMP OleDoc_DataObj_QueryInterface (
399: LPDATAOBJECT lpThis,
400: REFIID riid,
401: LPVOID FAR* lplpvObj
402: );
403: STDMETHODIMP_(ULONG) OleDoc_DataObj_AddRef(LPDATAOBJECT lpThis);
404: STDMETHODIMP_(ULONG) OleDoc_DataObj_Release (LPDATAOBJECT lpThis);
405: STDMETHODIMP OleDoc_DataObj_GetData (
406: LPDATAOBJECT lpThis,
407: LPFORMATETC lpFormatetc,
408: LPSTGMEDIUM lpMedium
409: );
410: STDMETHODIMP OleDoc_DataObj_GetDataHere (
411: LPDATAOBJECT lpThis,
412: LPFORMATETC lpFormatetc,
413: LPSTGMEDIUM lpMedium
414: );
415: STDMETHODIMP OleDoc_DataObj_QueryGetData (
416: LPDATAOBJECT lpThis,
417: LPFORMATETC lpFormatetc
418: );
419: STDMETHODIMP OleDoc_DataObj_GetCanonicalFormatEtc(
420: LPDATAOBJECT lpThis,
421: LPFORMATETC lpformatetc,
422: LPFORMATETC lpformatetcOut
423: );
424: STDMETHODIMP OleDoc_DataObj_SetData (
425: LPDATAOBJECT lpThis,
426: LPFORMATETC lpFormatetc,
427: LPSTGMEDIUM lpMedium,
428: BOOL fRelease
429: );
430: STDMETHODIMP OleDoc_DataObj_EnumFormatEtc(
431: LPDATAOBJECT lpThis,
432: DWORD dwDirection,
433: LPENUMFORMATETC FAR* lplpenumFormatEtc
434: );
435: STDMETHODIMP OleDoc_DataObj_DAdvise(
436: LPDATAOBJECT lpThis,
437: FORMATETC FAR* lpFormatetc,
438: DWORD advf,
439: LPADVISESINK lpAdvSink,
440: DWORD FAR* lpdwConnection
441: );
442: STDMETHODIMP OleDoc_DataObj_DUnadvise(LPDATAOBJECT lpThis,DWORD dwConnection);
443: STDMETHODIMP OleDoc_DataObj_EnumDAdvise(
444: LPDATAOBJECT lpThis,
445: LPENUMSTATDATA FAR* lplpenumAdvise
446: );
447:
448:
449: #ifdef USE_DRAGDROP
450:
451: /* OleDoc::IDropSource methods (functions) */
452: STDMETHODIMP OleDoc_DropSource_QueryInterface(
453: LPDROPSOURCE lpThis,
454: REFIID riid,
455: LPVOID FAR* lplpvObj
456: );
457: STDMETHODIMP_(ULONG) OleDoc_DropSource_AddRef( LPDROPSOURCE lpThis );
458: STDMETHODIMP_(ULONG) OleDoc_DropSource_Release ( LPDROPSOURCE lpThis);
459: STDMETHODIMP OleDoc_DropSource_QueryContinueDrag (
460: LPDROPSOURCE lpThis,
461: BOOL fEscapePressed,
462: DWORD grfKeyState
463: );
464: STDMETHODIMP OleDoc_DropSource_GiveFeedback (
465: LPDROPSOURCE lpThis,
466: DWORD dwEffect
467: );
468:
469: /* OleDoc::IDropTarget methods (functions) */
470: STDMETHODIMP OleDoc_DropTarget_QueryInterface(
471: LPDROPTARGET lpThis,
472: REFIID riid,
473: LPVOID FAR* lplpvObj
474: );
475: STDMETHODIMP_(ULONG) OleDoc_DropTarget_AddRef(LPDROPTARGET lpThis);
476: STDMETHODIMP_(ULONG) OleDoc_DropTarget_Release ( LPDROPTARGET lpThis);
477: STDMETHODIMP OleDoc_DropTarget_DragEnter (
478: LPDROPTARGET lpThis,
479: LPDATAOBJECT lpDataObj,
480: DWORD grfKeyState,
481: POINTL pointl,
482: LPDWORD lpdwEffect
483: );
484: STDMETHODIMP OleDoc_DropTarget_DragOver (
485: LPDROPTARGET lpThis,
486: DWORD grfKeyState,
487: POINTL pointl,
488: LPDWORD lpdwEffect
489: );
490: STDMETHODIMP OleDoc_DropTarget_DragLeave ( LPDROPTARGET lpThis);
491: STDMETHODIMP OleDoc_DropTarget_Drop (
492: LPDROPTARGET lpThis,
493: LPDATAOBJECT lpDataObj,
494: DWORD grfKeyState,
495: POINTL pointl,
496: LPDWORD lpdwEffect
497: );
498:
499: #endif // USE_DRAGDROP
500:
501:
502: /*************************************************************************
503: ** class APPCLASSFACTORY
504: ** APPCLASSFACTORY implements the IClassFactory interface. it
505: ** instantiates document instances of the correct type depending on
506: ** how the application is compiled (either ServerDoc or ContainerDoc
507: ** instances). by implementing this
508: ** interface in a seperate interface from the App object itself, it
509: ** is easier to manage when the IClassFactory should be
510: ** registered/revoked. when the OleApp object is first initialized
511: ** in OleApp_InitInstance an instance of APPCLASSFACTORY is created
512: ** and registered (CoRegisterClassObject called). when the App
513: ** object gets destroyed (in OleApp_Destroy) this APPCLASSFACTORY is
514: ** revoked (CoRevokeClassObject called) and released. the simple
515: ** fact that the IClassFactory is registered does not on its own keep
516: ** the application alive.
517: *************************************************************************/
518:
519: typedef struct tagAPPCLASSFACTORY {
520: IClassFactoryVtbl FAR* m_lpVtbl;
521: UINT m_cRef;
522: LONG m_cLock;
523: } APPCLASSFACTORY, FAR* LPAPPCLASSFACTORY;
524:
525: /* PUBLIC FUNCTIONS */
526: LPCLASSFACTORY WINAPI AppClassFactory_Create(void);
527:
528: /* interface IClassFactory implementation */
529: STDMETHODIMP AppClassFactory_QueryInterface(
530: LPCLASSFACTORY lpThis, REFIID riid, LPVOID FAR* ppvObj);
531: STDMETHODIMP_(ULONG) AppClassFactory_AddRef(LPCLASSFACTORY lpThis);
532: STDMETHODIMP_(ULONG) AppClassFactory_Release(LPCLASSFACTORY lpThis);
533: STDMETHODIMP AppClassFactory_CreateInstance (
534: LPCLASSFACTORY lpThis,
535: LPUNKNOWN lpUnkOuter,
536: REFIID riid,
537: LPVOID FAR* lplpvObj
538: );
539: STDMETHODIMP AppClassFactory_LockServer (
540: LPCLASSFACTORY lpThis,
541: BOOL fLock
542: );
543:
544:
545: /*************************************************************************
546: ** class OLEAPP : OUTLINEAPP
547: ** OLEAPP is an extention to the base OUTLINEAPP object (structure)
548: ** that adds common OLE 2.0 functionality used by both the server
549: ** and container versions. This is an abstract class. You do not
550: ** instantiate an instance of OLEAPP directly but instead
551: ** instantiate one of its concrete subclasses: SERVERAPP or
552: ** CONTAINERAPP. There is one instance of an document application
553: ** object created per running application instance. This
554: ** object holds many fields that could otherwise be organized as
555: ** global variables. The OLEAPP class inherits all fields
556: ** from the OUTLINEAPP class. This inheritance is achieved by including a
557: ** member variable of type OUTLINEAPP as the first field in the OLEAPP
558: ** structure. Thus a pointer to a OLEAPP object can be cast to be
559: ** a pointer to a OUTLINEAPP object.
560: *************************************************************************/
561:
562: typedef struct tagOLEAPP {
563: OUTLINEAPP m_OutlineApp; // inherits all fields of OutlineApp
564: ULONG m_cRef; // total ref count for app
565: ULONG m_cDoc; // total count of open documents
566: BOOL m_fUserCtrl; // does user control life-time of app?
567: DWORD m_dwRegClassFac; // value returned by CoRegisterClassObject
568: LPCLASSFACTORY m_lpClassFactory;// ptr to allocated ClassFactory instance
569: #if defined( USE_MSGFILTER )
570: LPMESSAGEFILTER m_lpMsgFilter; // ptr to allocated MsgFilter instance
571: MSGPENDINGPROC m_lpfnMsgPending;// ptr to msg pending callback function
572: #endif // USE_MSGFILTER
573: BOOL m_fOleInitialized; // was OleInitialize called
574: UINT m_cfEmbedSource; // OLE 2.0 clipboard format
575: UINT m_cfEmbeddedObject; // OLE 2.0 clipboard format
576: UINT m_cfLinkSource; // OLE 2.0 clipboard format
577: UINT m_cfObjectDescriptor; // OLE 2.0 clipboard format
578: UINT m_cfLinkSrcDescriptor; // OLE 2.0 clipboard format
579: UINT m_cfFileName; // std Windows clipboard format
580: FORMATETC m_arrDocGetFmts[MAXNOFMTS]; // fmts offered by copy & GetData
581: UINT m_nDocGetFmts; // no of fmtetc's for GetData
582: OLEUIPASTEENTRY m_arrPasteEntries[MAXNOFMTS];
583: int m_nPasteEntries;
584: UINT m_arrLinkTypes[MAXNOLINKTYPES];
585: int m_nLinkTypes;
586:
587: #if defined( USE_DRAGDROP )
588: int m_nScrollDelay; // time delay (in msec) before scroll
589: int m_nScrollInset; // Border threshold for drag scroll
590: HCURSOR m_hcursorDragMove; // cursor used to show drag is pending
591:
592: #if defined( IF_SPECIAL_DD_CURSORS_NEEDED )
593: // This would be used if the app wanted to have custom drag/drop cursors
594: HCURSOR m_hcursorDragNone;
595: HCURSOR m_hcursorDragCopy;
596: HCURSOR m_hcursorDragLink;
597: #endif // IF_SPECIAL_DD_CURSORS_NEEDED
598: #endif // USE_DRAGDROP
599:
600: struct CAppUnknownImpl {
601: IUnknownVtbl FAR* lpVtbl;
602: LPOLEAPP lpOleApp;
603: int cRef; // interface specific ref count.
604: } m_Unknown;
605:
606: } OLEAPP;
607:
608: /* ServerApp methods (functions) */
609: BOOL OleApp_InitInstance(LPOLEAPP lpOleApp, HINSTANCE hInst, int nCmdShow);
610: void OleApp_TerminateApplication(LPOLEAPP lpOleApp);
611: BOOL OleApp_ParseCmdLine(LPOLEAPP lpOleApp, LPSTR lpszCmdLine, int nCmdShow);
612: void OleApp_Destroy(LPOLEAPP lpOleApp);
613: BOOL OleApp_CloseAllDocsAndExitCommand(LPOLEAPP lpOleApp);
614: void OleApp_ShowWindow(LPOLEAPP lpOleApp, BOOL fGiveUserCtrl);
615: void OleApp_HideWindow(LPOLEAPP lpOleApp);
616: void OleApp_HideIfNoReasonToStayVisible(LPOLEAPP lpOleApp);
617: void OleApp_DocLockApp(LPOLEAPP lpOleApp);
618: void OleApp_DocUnlockApp(LPOLEAPP lpOleApp, LPOUTLINEDOC lpOutlineDoc);
619: HRESULT OleApp_Lock(LPOLEAPP lpOleApp, BOOL fLock, BOOL fLastUnlockReleases);
620: ULONG OleApp_AddRef(LPOLEAPP lpOleApp);
621: ULONG OleApp_Release (LPOLEAPP lpOleApp);
622: HRESULT OleApp_QueryInterface (
623: LPOLEAPP lpOleApp,
624: REFIID riid,
625: LPVOID FAR* lplpUnk
626: );
627: void OleApp_RejectInComingCalls(LPOLEAPP lpOleApp, BOOL fReject);
628: BOOL OleApp_InitVtbls (LPOLEAPP lpOleApp);
629: void OleApp_InitMenu(
630: LPOLEAPP lpOleApp,
631: LPOLEDOC lpOleDoc,
632: HMENU hMenu
633: );
634: void OleApp_UpdateEditMenu(
635: LPOLEAPP lpOleApp,
636: LPOUTLINEDOC lpOutlineDoc,
637: HMENU hMenuEdit
638: );
639: BOOL OleApp_RegisterClassFactory(LPOLEAPP lpOleApp);
640: void OleApp_RevokeClassFactory(LPOLEAPP lpOleApp);
641:
642: #if defined( USE_MSGFILTER )
643: BOOL OleApp_RegisterMessageFilter(LPOLEAPP lpOleApp);
644: void OleApp_RevokeMessageFilter(LPOLEAPP lpOleApp);
645: BOOL FAR PASCAL EXPORT MessagePendingProc(MSG FAR *lpMsg);
646: #endif // USE_MSGFILTER
647:
648: void OleApp_FlushClipboard(LPOLEAPP lpOleApp);
649: void OleApp_NewCommand(LPOLEAPP lpOleApp);
650: void OleApp_OpenCommand(LPOLEAPP lpOleApp);
651:
652:
653: /* OleApp::IUnknown methods (functions) */
654: STDMETHODIMP OleApp_Unk_QueryInterface(
655: LPUNKNOWN lpThis,
656: REFIID riid,
657: LPVOID FAR* lplpvObj
658: );
659: STDMETHODIMP_(ULONG) OleApp_Unk_AddRef(LPUNKNOWN lpThis);
660: STDMETHODIMP_(ULONG) OleApp_Unk_Release (LPUNKNOWN lpThis);
661:
662:
663: /* Function prototypes in debug.c */
664: void InstallMessageFilterCommand(void);
665: void RejectIncomingCommand(void);
666:
667:
668: #if defined( OLE_SERVER )
669: #include "svroutl.h"
670: #elif defined( OLE_CNTR )
671: #include "cntroutl.h"
672: #endif
673:
674: #endif // _OLEOUTL_H_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.