SVROUTL.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:33k
源码类别:

Windows编程

开发平台:

Visual C++

  1. /*************************************************************************
  2. **
  3. **    OLE 2.0 Server Sample Code
  4. **
  5. **    svroutl.h
  6. **
  7. **    This file contains file contains data structure defintions,
  8. **    function prototypes, constants, etc. used by the OLE 2.0 server
  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 sample app
  13. **
  14. **    (c) Copyright Microsoft Corp. 1992 - 1996 All Rights Reserved
  15. **
  16. *************************************************************************/
  17. #if !defined( _SVROUTL_H_ )
  18. #define _SVROUTL_H_
  19. #ifndef RC_INVOKED
  20. #pragma message ("INCLUDING SVROUTL.H from " __FILE__)
  21. #endif  /* RC_INVOKED */
  22. #include "oleoutl.h"
  23. #include "ansiapi.h"
  24. /* Defines */
  25. // Enable SVROUTL and ISVROTL to emulate each other (TreatAs aka. ActivateAs)
  26. #define SVR_TREATAS     1
  27. // Enable SVROUTL and ISVROTL to convert each other (TreatAs aka. ActivateAs)
  28. #define SVR_CONVERTTO   1
  29. // Enable ISVROTL to operate as in inside-out style in-place object
  30. #define SVR_INSIDEOUT   1
  31. /* Default name used for container of the embedded object. used if
  32. **    container forgets to call IOleObject::SetHostNames
  33. */
  34. // REVIEW: should load from string resource
  35. #define DEFCONTAINERNAME    "Unknown Document"
  36. /* Default prefix for auto-generated range names. This is used with
  37. **    links to unnamed ranges (pseudo objects).
  38. */
  39. // REVIEW: should load from string resource
  40. #define DEFRANGENAMEPREFIX  "Range"
  41. // Maximum length of strings accepted through IOleObject::SetHostNames
  42. //      (note: this is rather arbitrary; a better strategy would be to
  43. //             dynamically allocated buffers for these strings.)
  44. #define MAXAPPNAME  80
  45. #define MAXCONTAINERNAME    80
  46. // Menu option in embedding mode
  47. #define IDM_F_UPDATE    1151
  48. /* Types */
  49. /* Codes for CallBack events */
  50. typedef enum tagOLE_NOTIFICATION {
  51.    OLE_ONDATACHANGE,        // 0
  52.    OLE_ONSAVE,              // 1
  53.    OLE_ONRENAME,            // 2
  54.    OLE_ONCLOSE              // 3
  55. } OLE_NOTIFICATION;
  56. /* Codes to indicate mode of storage for an object.
  57. **    Mode of the storage is modified by the IPersistStorage methods:
  58. **      Save, HandsOffStorage, and SaveCompleted.
  59. */
  60. typedef enum tagSTGMODE {
  61.    STGMODE_NORMAL      = 0,
  62.    STGMODE_NOSCRIBBLE  = 1,
  63.    STGMODE_HANDSOFF    = 2
  64. } STGMODE;
  65. /* Forward type definitions */
  66. typedef struct tagSERVERAPP FAR* LPSERVERAPP;
  67. typedef struct tagSERVERDOC FAR* LPSERVERDOC;
  68. typedef struct tagPSEUDOOBJ FAR* LPPSEUDOOBJ;
  69. typedef struct tagINPLACEDATA {
  70.    OLEMENUGROUPWIDTHS      menuGroupWidths;
  71.    HOLEMENU                hOlemenu;
  72.    HMENU                   hMenuShared;
  73.    LPOLEINPLACESITE        lpSite;
  74.    LPOLEINPLACEUIWINDOW    lpDoc;
  75.    LPOLEINPLACEFRAME       lpFrame;
  76.    OLEINPLACEFRAMEINFO     frameInfo;
  77.    HWND                    hWndFrame;
  78.    BOOL                    fBorderOn;
  79.    RECT                    rcPosRect;
  80.    RECT                    rcClipRect;
  81. } INPLACEDATA, FAR* LPINPLACEDATA;
  82. /*************************************************************************
  83. ** class SERVERDOC : OLEDOC
  84. **    SERVERDOC is an extention to the abstract base OLEDOC class.
  85. **    The OLEDOC class defines the fields, methods and interfaces that
  86. **    are common to both server and client implementations. The
  87. **    SERVERDOC class adds the fields, methods and interfaces that are
  88. **    specific to OLE 2.0 Server functionality. There is one instance
  89. **    of SERVERDOC object created per document open in the app. The SDI
  90. **    version of the app supports one SERVERDOC at a time. The MDI
  91. **    version of the app can manage multiple documents at one time.
  92. **    The SERVERDOC class inherits all fields from the OLEDOC class.
  93. **    This inheritance is achieved by including a member variable of
  94. **    type OLEDOC as the first field in the SERVERDOC structure. Thus a
  95. **    pointer to a SERVERDOC object can be cast to be a pointer to a
  96. **    OLEDOC object or an OUTLINEDOC object
  97. *************************************************************************/
  98. typedef struct tagSERVERDOC {
  99.    OLEDOC              m_OleDoc;           // ServerDoc inherits from OleDoc
  100.    ULONG               m_cPseudoObj;       // total count of pseudo obj's
  101.    LPOLECLIENTSITE     m_lpOleClientSite;  // Client associated with the obj
  102.    LPOLEADVISEHOLDER   m_lpOleAdviseHldr;  // helper obj to hold ole advises
  103.    LPDATAADVISEHOLDER  m_lpDataAdviseHldr; // helper obj to hold data advises
  104.    BOOL                m_fNoScribbleMode;  // was IPS::Save called
  105.    BOOL                m_fSaveWithSameAsLoad;  // was IPS::Save called with
  106.                                  // fSameAsLoad==TRUE.
  107.    OLECHAR             m_szContainerApp[MAXAPPNAME];
  108.    OLECHAR             m_szContainerObj[MAXCONTAINERNAME];
  109.    ULONG               m_nNextRangeNo;     // next no. for unnamed range
  110.    LINERANGE           m_lrSrcSelOfCopy;   // src sel if doc created for copy
  111.    BOOL                m_fDataChanged;     // data changed when draw disabled
  112.    BOOL                m_fSizeChanged;     // size changed when draw disabled
  113.    BOOL                m_fSendDataOnStop;  // did data ever change?
  114. #if defined( SVR_TREATAS )
  115.    CLSID               m_clsidTreatAs;     // clsid to pretend to be
  116.    LPOLESTR            m_lpszTreatAsType;  // user type name to pretend to be
  117. #endif  // SVR_TREATAS
  118. #if defined( LATER )
  119.    // REVIEW: is it necessary to register a WildCard Moniker
  120.    DWORD               m_dwWildCardRegROT; // key if wildcard reg'ed in ROT
  121. #endif
  122. #if defined( INPLACE_SVR )
  123.    BOOL                m_fInPlaceActive;
  124.    BOOL                m_fInPlaceVisible;
  125.    BOOL                m_fUIActive;
  126.    HWND                m_hWndParent;
  127.    HWND                m_hWndHatch;
  128.    LPINPLACEDATA       m_lpIPData;
  129.    BOOL                m_fMenuHelpMode;// is F1 pressed in menu, give help
  130.    struct CDocOleInPlaceObjectImpl {
  131.       IOleInPlaceObjectVtbl FAR*  lpVtbl;
  132.       LPSERVERDOC                 lpServerDoc;
  133.       int                         cRef;   // interface specific ref count.
  134.    } m_OleInPlaceObject;
  135.    struct CDocOleInPlaceActiveObjectImpl {
  136.       IOleInPlaceActiveObjectVtbl FAR* lpVtbl;
  137.       LPSERVERDOC                      lpServerDoc;
  138.       int                              cRef;// interface specific ref count.
  139.    } m_OleInPlaceActiveObject;
  140. #endif // INPLACE_SVR
  141.    struct CDocOleObjectImpl {
  142.       IOleObjectVtbl FAR*         lpVtbl;
  143.       LPSERVERDOC                 lpServerDoc;
  144.       int                         cRef;   // interface specific ref count.
  145.    } m_OleObject;
  146.    struct CDocPersistStorageImpl {
  147.       IPersistStorageVtbl FAR*    lpVtbl;
  148.       LPSERVERDOC                 lpServerDoc;
  149.       int                         cRef;   // interface specific ref count.
  150.    } m_PersistStorage;
  151. #if defined( SVR_TREATAS )
  152.    struct CDocStdMarshalInfoImpl {
  153.       IStdMarshalInfoVtbl FAR*    lpVtbl;
  154.       LPSERVERDOC                 lpServerDoc;
  155.       int                         cRef;   // interface specific ref count.
  156.    } m_StdMarshalInfo;
  157. #endif  // SVR_TREATAS
  158. } SERVERDOC;
  159. /* ServerDoc methods (functions) */
  160. BOOL ServerDoc_Init(LPSERVERDOC lpServerDoc, BOOL fDataTransferDoc);
  161. BOOL ServerDoc_InitNewEmbed(LPSERVERDOC lpServerDoc);
  162. void ServerDoc_PseudoObjUnlockDoc(
  163.       LPSERVERDOC         lpServerDoc,
  164.       LPPSEUDOOBJ         lpPseudoObj
  165. );
  166. void ServerDoc_PseudoObjLockDoc(LPSERVERDOC lpServerDoc);
  167. BOOL ServerDoc_PasteFormatFromData(
  168.       LPSERVERDOC             lpServerDoc,
  169.       CLIPFORMAT              cfFormat,
  170.       LPDATAOBJECT            lpSrcDataObj,
  171.       BOOL                    fLocalDataObj,
  172.       BOOL                    fLink
  173. );
  174. BOOL ServerDoc_QueryPasteFromData(
  175.       LPSERVERDOC             lpServerDoc,
  176.       LPDATAOBJECT            lpSrcDataObj,
  177.       BOOL                    fLink
  178. );
  179. HRESULT ServerDoc_GetClassID(LPSERVERDOC lpServerDoc, LPCLSID lpclsid);
  180. void ServerDoc_UpdateMenu(LPSERVERDOC lpServerDoc);
  181. void ServerDoc_RestoreMenu(LPSERVERDOC lpServerDoc);
  182. HRESULT ServerDoc_GetData (
  183.       LPSERVERDOC             lpServerDoc,
  184.       LPFORMATETC             lpformatetc,
  185.       LPSTGMEDIUM             lpMedium
  186. );
  187. HRESULT ServerDoc_GetDataHere (
  188.       LPSERVERDOC             lpServerDoc,
  189.       LPFORMATETC             lpformatetc,
  190.       LPSTGMEDIUM             lpMedium
  191. );
  192. HRESULT ServerDoc_QueryGetData(LPSERVERDOC lpServerDoc,LPFORMATETC lpformatetc);
  193. HRESULT ServerDoc_EnumFormatEtc(
  194.       LPSERVERDOC             lpServerDoc,
  195.       DWORD                   dwDirection,
  196.       LPENUMFORMATETC FAR*    lplpenumFormatEtc
  197. );
  198. HANDLE ServerDoc_GetMetafilePictData(
  199.       LPSERVERDOC             lpServerDoc,
  200.       LPLINERANGE             lplrSel
  201. );
  202. void ServerDoc_SendAdvise(
  203.       LPSERVERDOC     lpServerDoc,
  204.       WORD            wAdvise,
  205.       LPMONIKER       lpmkDoc,
  206.       DWORD           dwAdvf
  207. );
  208. HRESULT ServerDoc_GetObject(
  209.       LPSERVERDOC             lpServerDoc,
  210.       LPOLESTR                   lpszItem,
  211.       REFIID                  riid,
  212.       LPVOID FAR*             lplpvObject
  213. );
  214. HRESULT ServerDoc_IsRunning(LPSERVERDOC lpServerDoc, LPOLESTR lpszItem);
  215. LPMONIKER ServerDoc_GetSelRelMoniker(
  216.       LPSERVERDOC             lpServerDoc,
  217.       LPLINERANGE             lplrSel,
  218.       DWORD                   dwAssign
  219. );
  220. LPMONIKER ServerDoc_GetSelFullMoniker(
  221.       LPSERVERDOC             lpServerDoc,
  222.       LPLINERANGE             lplrSel,
  223.       DWORD                   dwAssign
  224. );
  225. #if defined( INPLACE_SVR )
  226. HRESULT ServerDoc_DoInPlaceActivate(
  227.       LPSERVERDOC     lpServerDoc,
  228.       LONG            lVerb,
  229.       LPMSG           lpmsg,
  230.       LPOLECLIENTSITE lpActiveSite
  231. );
  232. HRESULT ServerDoc_DoInPlaceDeactivate(LPSERVERDOC lpServerDoc);
  233. HRESULT ServerDoc_DoInPlaceHide(LPSERVERDOC lpServerDoc);
  234. BOOL ServerDoc_AllocInPlaceData(LPSERVERDOC lpServerDoc);
  235. void ServerDoc_FreeInPlaceData(LPSERVERDOC lpServerDoc);
  236. HRESULT ServerDoc_AssembleMenus(LPSERVERDOC lpServerDoc);
  237. void    ServerDoc_DisassembleMenus(LPSERVERDOC lpServerDoc);
  238. void ServerDoc_CalcInPlaceWindowPos(
  239.       LPSERVERDOC         lpServerDoc,
  240.       LPRECT              lprcListBox,
  241.       LPRECT              lprcDoc,
  242.       LPSCALEFACTOR       lpscale
  243. );
  244. void ServerDoc_UpdateInPlaceWindowOnExtentChange(LPSERVERDOC lpServerDoc);
  245. void ServerDoc_ResizeInPlaceWindow(
  246.       LPSERVERDOC         lpServerDoc,
  247.       LPCRECT             lprcPosRect,
  248.       LPCRECT             lprcClipRect
  249. );
  250. void ServerDoc_ShadeInPlaceBorder(LPSERVERDOC lpServerDoc, BOOL fShadeOn);
  251. void ServerDoc_SetStatusText(LPSERVERDOC lpServerDoc, LPOLESTR lpszMessage);
  252. LPOLEINPLACEFRAME ServerDoc_GetTopInPlaceFrame(LPSERVERDOC lpServerDoc);
  253. void ServerDoc_GetSharedMenuHandles(
  254.       LPSERVERDOC lpServerDoc,
  255.       HMENU FAR*      lphSharedMenu,
  256.       HOLEMENU FAR*   lphOleMenu
  257. );
  258. void ServerDoc_AddFrameLevelUI(LPSERVERDOC lpServerDoc);
  259. void ServerDoc_AddFrameLevelTools(LPSERVERDOC lpServerDoc);
  260. void ServerDoc_UIActivate (LPSERVERDOC lpServerDoc);
  261. #if defined( USE_FRAMETOOLS )
  262. void ServerDoc_RemoveFrameLevelTools(LPSERVERDOC lpServerDoc);
  263. #endif // USE_FRAMETOOLS
  264. #endif // INPLACE_SVR
  265. /* ServerDoc::IOleObject methods (functions) */
  266. STDMETHODIMP SvrDoc_OleObj_QueryInterface(
  267.       LPOLEOBJECT             lpThis,
  268.       REFIID                  riid,
  269.       LPVOID FAR*             lplpvObj
  270. );
  271. STDMETHODIMP_(ULONG) SvrDoc_OleObj_AddRef(LPOLEOBJECT lpThis);
  272. STDMETHODIMP_(ULONG) SvrDoc_OleObj_Release(LPOLEOBJECT lpThis);
  273. STDMETHODIMP SvrDoc_OleObj_SetClientSite(
  274.       LPOLEOBJECT             lpThis,
  275.       LPOLECLIENTSITE         lpclientSite
  276. );
  277. STDMETHODIMP SvrDoc_OleObj_GetClientSite(
  278.       LPOLEOBJECT             lpThis,
  279.       LPOLECLIENTSITE FAR*    lplpClientSite
  280. );
  281. STDMETHODIMP SvrDoc_OleObj_SetHostNames(
  282.       LPOLEOBJECT             lpThis,
  283.       LPCOLESTR               szContainerApp,
  284.       LPCOLESTR               szContainerObj
  285. );
  286. STDMETHODIMP SvrDoc_OleObj_Close(
  287.       LPOLEOBJECT             lpThis,
  288.       DWORD                   dwSaveOption
  289. );
  290. STDMETHODIMP SvrDoc_OleObj_SetMoniker(
  291.       LPOLEOBJECT             lpThis,
  292.       DWORD                   dwWhichMoniker,
  293.       LPMONIKER               lpmk
  294. );
  295. STDMETHODIMP SvrDoc_OleObj_GetMoniker(
  296.       LPOLEOBJECT             lpThis,
  297.       DWORD                   dwAssign,
  298.       DWORD                   dwWhichMoniker,
  299.       LPMONIKER FAR*          lplpmk
  300. );
  301. STDMETHODIMP SvrDoc_OleObj_InitFromData(
  302.       LPOLEOBJECT             lpThis,
  303.       LPDATAOBJECT            lpDataObject,
  304.       BOOL                    fCreation,
  305.       DWORD                   reserved
  306. );
  307. STDMETHODIMP SvrDoc_OleObj_GetClipboardData(
  308.       LPOLEOBJECT             lpThis,
  309.       DWORD                   reserved,
  310.       LPDATAOBJECT FAR*       lplpDataObject
  311. );
  312. STDMETHODIMP SvrDoc_OleObj_DoVerb(
  313.       LPOLEOBJECT             lpThis,
  314.       LONG                    lVerb,
  315.       LPMSG                   lpmsg,
  316.       LPOLECLIENTSITE         lpActiveSite,
  317.       LONG                    lindex,
  318.       HWND                    hwndParent,
  319.       LPCRECT                 lprcPosRect
  320. );
  321. STDMETHODIMP SvrDoc_OleObj_EnumVerbs(
  322.       LPOLEOBJECT             lpThis,
  323.       LPENUMOLEVERB FAR*      lplpenumOleVerb
  324. );
  325. STDMETHODIMP SvrDoc_OleObj_Update(LPOLEOBJECT lpThis);
  326. STDMETHODIMP SvrDoc_OleObj_IsUpToDate(LPOLEOBJECT lpThis);
  327. STDMETHODIMP SvrDoc_OleObj_GetUserClassID(
  328.       LPOLEOBJECT             lpThis,
  329.       LPCLSID                 lpclsid
  330. );
  331. STDMETHODIMP SvrDoc_OleObj_GetUserType(
  332.       LPOLEOBJECT             lpThis,
  333.       DWORD                   dwFormOfType,
  334.       LPOLESTR FAR*           lpszUserType
  335. );
  336. STDMETHODIMP SvrDoc_OleObj_SetExtent(
  337.       LPOLEOBJECT             lpThis,
  338.       DWORD                   dwDrawAspect,
  339.       LPSIZEL                 lplgrc
  340. );
  341. STDMETHODIMP SvrDoc_OleObj_GetExtent(
  342.       LPOLEOBJECT             lpThis,
  343.       DWORD                   dwDrawAspect,
  344.       LPSIZEL                 lplgrc
  345. );
  346. STDMETHODIMP SvrDoc_OleObj_Advise(
  347.       LPOLEOBJECT             lpThis,
  348.       LPADVISESINK            lpAdvSink,
  349.       LPDWORD                 lpdwConnection
  350. );
  351. STDMETHODIMP SvrDoc_OleObj_Unadvise(LPOLEOBJECT lpThis, DWORD dwConnection);
  352. STDMETHODIMP SvrDoc_OleObj_EnumAdvise(
  353.       LPOLEOBJECT             lpThis,
  354.       LPENUMSTATDATA FAR*     lplpenumAdvise
  355. );
  356. STDMETHODIMP SvrDoc_OleObj_GetMiscStatus(
  357.       LPOLEOBJECT             lpThis,
  358.       DWORD                   dwAspect,
  359.       DWORD FAR*              lpdwStatus
  360. );
  361. STDMETHODIMP SvrDoc_OleObj_SetColorScheme(
  362.       LPOLEOBJECT             lpThis,
  363.       LPLOGPALETTE            lpLogpal
  364. );
  365. STDMETHODIMP SvrDoc_OleObj_LockObject(
  366.       LPOLEOBJECT             lpThis,
  367.       BOOL                    fLock
  368. );
  369. /* ServerDoc::IPersistStorage methods (functions) */
  370. STDMETHODIMP SvrDoc_PStg_QueryInterface(
  371.       LPPERSISTSTORAGE        lpThis,
  372.       REFIID                  riid,
  373.       LPVOID FAR*             lplpvObj
  374. );
  375. STDMETHODIMP_(ULONG) SvrDoc_PStg_AddRef(LPPERSISTSTORAGE lpThis);
  376. STDMETHODIMP_(ULONG) SvrDoc_PStg_Release(LPPERSISTSTORAGE lpThis);
  377. STDMETHODIMP SvrDoc_PStg_GetClassID(
  378.       LPPERSISTSTORAGE        lpThis,
  379.       LPCLSID                 lpClassID
  380. );
  381. STDMETHODIMP  SvrDoc_PStg_IsDirty(LPPERSISTSTORAGE  lpThis);
  382. STDMETHODIMP SvrDoc_PStg_InitNew(
  383.       LPPERSISTSTORAGE        lpThis,
  384.       LPSTORAGE               lpStg
  385. );
  386. STDMETHODIMP SvrDoc_PStg_Load(
  387.       LPPERSISTSTORAGE        lpThis,
  388.       LPSTORAGE               lpStg
  389. );
  390. STDMETHODIMP SvrDoc_PStg_Save(
  391.       LPPERSISTSTORAGE        lpThis,
  392.       LPSTORAGE               lpStg,
  393.       BOOL                    fSameAsLoad
  394. );
  395. STDMETHODIMP SvrDoc_PStg_SaveCompleted(
  396.       LPPERSISTSTORAGE        lpThis,
  397.       LPSTORAGE               lpStgNew
  398. );
  399. STDMETHODIMP SvrDoc_PStg_HandsOffStorage(LPPERSISTSTORAGE lpThis);
  400. #if defined( SVR_TREATAS )
  401. /* ServerDoc::IStdMarshalInfo methods (functions) */
  402. STDMETHODIMP SvrDoc_StdMshl_QueryInterface(
  403.       LPSTDMARSHALINFO        lpThis,
  404.       REFIID                  riid,
  405.       LPVOID FAR*             lplpvObj
  406. );
  407. STDMETHODIMP_(ULONG) SvrDoc_StdMshl_AddRef(LPSTDMARSHALINFO lpThis);
  408. STDMETHODIMP_(ULONG) SvrDoc_StdMshl_Release(LPSTDMARSHALINFO lpThis);
  409. STDMETHODIMP SvrDoc_StdMshl_GetClassForHandler(
  410.       LPSTDMARSHALINFO        lpThis,
  411.       DWORD                   dwDestContext,
  412.       LPVOID                  pvDestContext,
  413.       LPCLSID                 lpClassID
  414. );
  415. #endif  // SVR_TREATAS
  416. /*************************************************************************
  417. ** class SERVERAPP : OLEAPP
  418. **    SERVERAPP is an extention to the abstract base OLEAPP class.
  419. **    The OLEAPP class defines the fields, methods and interfaces that
  420. **    are common to both server and client implementations. The
  421. **    SERVERAPP class adds the fields and methods that are specific to
  422. **    OLE 2.0 Server functionality. There is one instance of
  423. **    SERVERAPP object created per running application instance. This
  424. **    object holds many fields that could otherwise be organized as
  425. **    global variables. The SERVERAPP class inherits all fields
  426. **    from the OLEAPP class. This inheritance is achieved by including a
  427. **    member variable of type OLEAPP as the first field in the SERVERAPP
  428. **    structure. OLEAPP inherits from OLEAPP. This inheritance is
  429. **    achieved in the same manner. Thus a pointer to a SERVERAPP object
  430. **    can be cast to be a pointer to an OLEAPP or an OUTLINEAPP object
  431. *************************************************************************/
  432. typedef struct tagSERVERAPP {
  433.    OLEAPP      m_OleApp;       // ServerApp inherits all fields of OleApp
  434. #if defined( INPLACE_SVR )
  435.    HACCEL  m_hAccelIPSvr; // accelerators for server's active object commands
  436.    HACCEL  m_hAccelBaseApp;    // normal accel for non-inplace server mode
  437.    HMENU   m_hMenuEdit;   // handle to Edit menu of the server app
  438.    HMENU   m_hMenuLine;   // handle to Line menu of the server app
  439.    HMENU   m_hMenuName;   // handle to Name menu of the server app
  440.    HMENU   m_hMenuOptions; // handle to Options menu of the server app
  441.    HMENU   m_hMenuDebug;       // handle to Debug menu of the server app
  442.    HMENU   m_hMenuHelp;   // handle to Help menu of the server app
  443.    LPINPLACEDATA   m_lpIPData;
  444. #endif
  445. } SERVERAPP;
  446. /* ServerApp methods (functions) */
  447. BOOL ServerApp_InitInstance(
  448.       LPSERVERAPP             lpServerApp,
  449.       HINSTANCE               hInst,
  450.       int                     nCmdShow
  451. );
  452. BOOL ServerApp_InitVtbls (LPSERVERAPP lpServerApp);
  453. /*************************************************************************
  454. ** class SERVERNAME : OUTLINENAME
  455. **    SERVERNAME class is an extension to the OUTLINENAME base class that
  456. **    adds functionallity required to support linking to ranges (pseudo
  457. **    objects). Pseudo objects are used to allow linking to a range
  458. **    (sub-selection) of a SERVERDOC document. The base class OUTLINENAME
  459. **    stores a particular named selection in the document. The
  460. **    NAMETABLE class holds all of the names defined in a particular
  461. **    document. Each OUTLINENAME object has a string as its key and a
  462. **    starting line index and an ending line index for the named range.
  463. **    The SERVERNAME class, also, stores a pointer to a PSEUDOOBJ if one
  464. **    has been allocated that corresponds to the named selection.
  465. **    The SERVERNAME class inherits all fields from the OUTLINENAME class.
  466. **    This inheritance is achieved by including a member variable of
  467. **    type OUTLINENAME as the first field in the SERVERNAME
  468. **    structure. Thus a pointer to an SERVERNAME object can be cast to be
  469. **    a pointer to a OUTLINENAME object.
  470. *************************************************************************/
  471. typedef struct tagSERVERNAME {
  472.    OUTLINENAME     m_Name;         // ServerName inherits all fields of Name
  473.    LPPSEUDOOBJ m_lpPseudoObj;  // ptr to pseudo object if allocated
  474. } SERVERNAME, FAR* LPSERVERNAME;
  475. /* ServerName methods (functions) */
  476. void ServerName_SetSel(
  477.       LPSERVERNAME            lpServerName,
  478.       LPLINERANGE             lplrSel,
  479.       BOOL                    fRangeModified
  480. );
  481. void ServerName_SendPendingAdvises(LPSERVERNAME lpServerName);
  482. LPPSEUDOOBJ ServerName_GetPseudoObj(
  483.       LPSERVERNAME            lpServerName,
  484.       LPSERVERDOC             lpServerDoc
  485. );
  486. void ServerName_ClosePseudoObj(LPSERVERNAME lpServerName);
  487. /*************************************************************************
  488. ** class PSEUDOOBJ
  489. **    The PSEUDOOBJ (pseudo object) is a concrete class. A pseudo object
  490. **    is created when a link is made to a range of lines within an
  491. **    SERVERDOC document. A pseudo object is dependent on the existance
  492. **    of the SERVERDOC which represents the whole document.
  493. *************************************************************************/
  494. typedef struct tagPSEUDOOBJ {
  495.    ULONG               m_cRef;             // total ref count for obj
  496.    BOOL                m_fObjIsClosing;    // flag to guard recursive close
  497.    LPSERVERNAME        m_lpName;           // named range for this pseudo obj
  498.    LPSERVERDOC         m_lpDoc;            // ptr to whole document
  499.    LPOLEADVISEHOLDER   m_lpOleAdviseHldr;  // helper obj to hold ole advises
  500.    LPDATAADVISEHOLDER  m_lpDataAdviseHldr; // helper obj to hold data advises
  501.    BOOL                m_fDataChanged;     // data changed when draw disabled
  502.    struct CPseudoObjUnknownImpl {
  503.       IUnknownVtbl FAR*       lpVtbl;
  504.       LPPSEUDOOBJ             lpPseudoObj;
  505.       int                     cRef;   // interface specific ref count.
  506.    } m_Unknown;
  507.    struct CPseudoObjOleObjectImpl {
  508.       IOleObjectVtbl FAR*     lpVtbl;
  509.       LPPSEUDOOBJ             lpPseudoObj;
  510.       int                     cRef;   // interface specific ref count.
  511.    } m_OleObject;
  512.    struct CPseudoObjDataObjectImpl {
  513.       IDataObjectVtbl FAR*    lpVtbl;
  514.       LPPSEUDOOBJ             lpPseudoObj;
  515.       int                     cRef;   // interface specific ref count.
  516.    } m_DataObject;
  517. } PSEUDOOBJ;
  518. /* PseudoObj methods (functions) */
  519. void PseudoObj_Init(
  520.       LPPSEUDOOBJ             lpPseudoObj,
  521.       LPSERVERNAME            lpServerName,
  522.       LPSERVERDOC             lpServerDoc
  523. );
  524. ULONG PseudoObj_AddRef(LPPSEUDOOBJ lpPseudoObj);
  525. ULONG PseudoObj_Release(LPPSEUDOOBJ lpPseudoObj);
  526. HRESULT PseudoObj_QueryInterface(
  527.       LPPSEUDOOBJ         lpPseudoObj,
  528.       REFIID              riid,
  529.       LPVOID FAR*         lplpUnk
  530. );
  531. BOOL PseudoObj_Close(LPPSEUDOOBJ lpPseudoObj);
  532. void PseudoObj_Destroy(LPPSEUDOOBJ lpPseudoObj);
  533. void PseudoObj_GetSel(LPPSEUDOOBJ lpPseudoObj, LPLINERANGE lplrSel);
  534. void PseudoObj_GetExtent(LPPSEUDOOBJ lpPseudoObj, LPSIZEL lpsizel);
  535. void PseudoObj_GetExtent(LPPSEUDOOBJ lpPseudoObj, LPSIZEL lpsizel);
  536. void PseudoObj_SendAdvise(
  537.       LPPSEUDOOBJ lpPseudoObj,
  538.       WORD        wAdvise,
  539.       LPMONIKER   lpmkObj,
  540.       DWORD       dwAdvf
  541. );
  542. LPMONIKER PseudoObj_GetFullMoniker(LPPSEUDOOBJ lpPseudoObj, LPMONIKER lpmkDoc);
  543. /* PseudoObj::IUnknown methods (functions) */
  544. STDMETHODIMP PseudoObj_Unk_QueryInterface(
  545.       LPUNKNOWN         lpThis,
  546.       REFIID            riid,
  547.       LPVOID FAR*       lplpvObj
  548. );
  549. STDMETHODIMP_(ULONG) PseudoObj_Unk_AddRef(LPUNKNOWN lpThis);
  550. STDMETHODIMP_(ULONG) PseudoObj_Unk_Release (LPUNKNOWN lpThis);
  551. /* PseudoObj::IOleObject methods (functions) */
  552. STDMETHODIMP PseudoObj_OleObj_QueryInterface(
  553.       LPOLEOBJECT     lpThis,
  554.       REFIID          riid,
  555.       LPVOID FAR*     lplpvObj
  556. );
  557. STDMETHODIMP_(ULONG) PseudoObj_OleObj_AddRef(LPOLEOBJECT lpThis);
  558. STDMETHODIMP_(ULONG) PseudoObj_OleObj_Release(LPOLEOBJECT lpThis);
  559. STDMETHODIMP PseudoObj_OleObj_SetClientSite(
  560.       LPOLEOBJECT         lpThis,
  561.       LPOLECLIENTSITE     lpClientSite
  562. );
  563. STDMETHODIMP PseudoObj_OleObj_GetClientSite(
  564.       LPOLEOBJECT             lpThis,
  565.       LPOLECLIENTSITE FAR*    lplpClientSite
  566. );
  567. STDMETHODIMP PseudoObj_OleObj_SetHostNames(
  568.       LPOLEOBJECT             lpThis,
  569.       LPCOLESTR               szContainerApp,
  570.       LPCOLESTR               szContainerObj
  571. );
  572. STDMETHODIMP PseudoObj_OleObj_Close(
  573.       LPOLEOBJECT             lpThis,
  574.       DWORD                   dwSaveOption
  575. );
  576. STDMETHODIMP PseudoObj_OleObj_SetMoniker(
  577.       LPOLEOBJECT lpThis,
  578.       DWORD       dwWhichMoniker,
  579.       LPMONIKER   lpmk
  580. );
  581. STDMETHODIMP PseudoObj_OleObj_GetMoniker(
  582.       LPOLEOBJECT     lpThis,
  583.       DWORD           dwAssign,
  584.       DWORD           dwWhichMoniker,
  585.       LPMONIKER FAR*  lplpmk
  586. );
  587. STDMETHODIMP PseudoObj_OleObj_InitFromData(
  588.       LPOLEOBJECT             lpThis,
  589.       LPDATAOBJECT            lpDataObject,
  590.       BOOL                    fCreation,
  591.       DWORD                   reserved
  592. );
  593. STDMETHODIMP PseudoObj_OleObj_GetClipboardData(
  594.       LPOLEOBJECT             lpThis,
  595.       DWORD                   reserved,
  596.       LPDATAOBJECT FAR*       lplpDataObject
  597. );
  598. STDMETHODIMP PseudoObj_OleObj_DoVerb(
  599.       LPOLEOBJECT             lpThis,
  600.       LONG                    lVerb,
  601.       LPMSG                   lpmsg,
  602.       LPOLECLIENTSITE         lpActiveSite,
  603.       LONG                    lindex,
  604.       HWND                    hwndParent,
  605.       LPCRECT                 lprcPosRect
  606. );
  607. STDMETHODIMP PseudoObj_OleObj_EnumVerbs(
  608.       LPOLEOBJECT         lpThis,
  609.       LPENUMOLEVERB FAR*  lplpenumOleVerb
  610. );
  611. STDMETHODIMP PseudoObj_OleObj_Update(LPOLEOBJECT lpThis);
  612. STDMETHODIMP PseudoObj_OleObj_IsUpToDate(LPOLEOBJECT lpThis);
  613. STDMETHODIMP PseudoObj_OleObj_GetUserClassID(
  614.       LPOLEOBJECT             lpThis,
  615.       LPCLSID                 lpclsid
  616. );
  617. STDMETHODIMP PseudoObj_OleObj_GetUserType(
  618.       LPOLEOBJECT             lpThis,
  619.       DWORD                   dwFormOfType,
  620.       LPOLESTR FAR*           lpszUserType
  621. );
  622. STDMETHODIMP PseudoObj_OleObj_SetExtent(
  623.       LPOLEOBJECT             lpThis,
  624.       DWORD                   dwDrawAspect,
  625.       LPSIZEL                 lplgrc
  626. );
  627. STDMETHODIMP PseudoObj_OleObj_GetExtent(
  628.       LPOLEOBJECT             lpThis,
  629.       DWORD                   dwDrawAspect,
  630.       LPSIZEL                 lplgrc
  631. );
  632. STDMETHODIMP PseudoObj_OleObj_Advise(
  633.       LPOLEOBJECT lpThis,
  634.       LPADVISESINK lpAdvSink,
  635.       LPDWORD lpdwConnection
  636. );
  637. STDMETHODIMP PseudoObj_OleObj_Unadvise(LPOLEOBJECT lpThis,DWORD dwConnection);
  638. STDMETHODIMP PseudoObj_OleObj_EnumAdvise(
  639.       LPOLEOBJECT lpThis,
  640.       LPENUMSTATDATA FAR* lplpenumAdvise
  641. );
  642. STDMETHODIMP PseudoObj_OleObj_GetMiscStatus(
  643.       LPOLEOBJECT             lpThis,
  644.       DWORD                   dwAspect,
  645.       DWORD FAR*              lpdwStatus
  646. );
  647. STDMETHODIMP PseudoObj_OleObj_SetColorScheme(
  648.       LPOLEOBJECT             lpThis,
  649.       LPLOGPALETTE            lpLogpal
  650. );
  651. STDMETHODIMP PseudoObj_OleObj_LockObject(
  652.       LPOLEOBJECT             lpThis,
  653.       BOOL                    fLock
  654. );
  655. /* PseudoObj::IDataObject methods (functions) */
  656. STDMETHODIMP PseudoObj_DataObj_QueryInterface (
  657.       LPDATAOBJECT      lpThis,
  658.       REFIID            riid,
  659.       LPVOID FAR*       lplpvObj
  660. );
  661. STDMETHODIMP_(ULONG) PseudoObj_DataObj_AddRef(LPDATAOBJECT lpThis);
  662. STDMETHODIMP_(ULONG) PseudoObj_DataObj_Release (LPDATAOBJECT lpThis);
  663. STDMETHODIMP PseudoObj_DataObj_GetData (
  664.       LPDATAOBJECT    lpThis,
  665.       LPFORMATETC     lpformatetc,
  666.       LPSTGMEDIUM     lpMedium
  667. );
  668. STDMETHODIMP PseudoObj_DataObj_GetDataHere (
  669.       LPDATAOBJECT    lpThis,
  670.       LPFORMATETC     lpformatetc,
  671.       LPSTGMEDIUM     lpMedium
  672. );
  673. STDMETHODIMP PseudoObj_DataObj_QueryGetData (
  674.       LPDATAOBJECT    lpThis,
  675.       LPFORMATETC     lpformatetc
  676. );
  677. STDMETHODIMP PseudoObj_DataObj_GetCanonicalFormatEtc (
  678.       LPDATAOBJECT    lpThis,
  679.       LPFORMATETC     lpformatetc,
  680.       LPFORMATETC     lpformatetcOut
  681. );
  682. STDMETHODIMP PseudoObj_DataObj_SetData (
  683.       LPDATAOBJECT    lpThis,
  684.       LPFORMATETC     lpformatetc,
  685.       LPSTGMEDIUM     lpmedium,
  686.       BOOL            fRelease
  687. );
  688. STDMETHODIMP PseudoObj_DataObj_EnumFormatEtc(
  689.       LPDATAOBJECT            lpThis,
  690.       DWORD                   dwDirection,
  691.       LPENUMFORMATETC FAR*    lplpenumFormatEtc
  692. );
  693. STDMETHODIMP PseudoObj_DataObj_DAdvise(
  694.       LPDATAOBJECT    lpThis,
  695.       FORMATETC FAR*  lpFormatetc,
  696.       DWORD           advf,
  697.       LPADVISESINK    lpAdvSink,
  698.       DWORD FAR*      lpdwConnection
  699. );
  700. STDMETHODIMP PseudoObj_DataObj_DUnadvise(LPDATAOBJECT lpThis, DWORD dwConnection);
  701. STDMETHODIMP PseudoObj_DataObj_EnumAdvise(
  702.       LPDATAOBJECT lpThis,
  703.       LPENUMSTATDATA FAR* lplpenumAdvise
  704. );
  705. /*************************************************************************
  706. ** class SERVERNAMETABLE : OUTLINENAMETABLE
  707. **    SERVERNAMETABLE class is an extension to the OUTLINENAMETABLE
  708. **    base class that adds functionallity required to support linking
  709. **    to ranges (pseudo objects). The name table manages the table of
  710. **    named selections in the document. Each name table entry has a
  711. **    string as its key and a starting line index and an ending line
  712. **    index for the named range. The SERVERNAMETABLE entries, in
  713. **    addition, maintain a pointer to a PSEUDOOBJ pseudo object if one
  714. **    has been already allocated. There is always one instance of
  715. **    SERVERNAMETABLE for each SERVERDOC object created.
  716. **    The SERVERNAME class inherits all fields from the NAME class.
  717. **    This inheritance is achieved by including a member variable of
  718. **    type NAME as the first field in the SERVERNAME
  719. **    structure. Thus a pointer to an SERVERNAME object can be cast to be
  720. **    a pointer to a NAME object.
  721. *************************************************************************/
  722. typedef struct tagSERVERNAMETABLE {
  723.    OUTLINENAMETABLE    m_NameTable;    // we inherit from OUTLINENAMETABLE
  724.    // ServerNameTable does NOT add any fields
  725. } SERVERNAMETABLE, FAR* LPSERVERNAMETABLE;
  726. /* ServerNameTable methods (functions) */
  727. void ServerNameTable_EditLineUpdate(
  728.       LPSERVERNAMETABLE       lpServerNameTable,
  729.       int                     nEditIndex
  730. );
  731. void ServerNameTable_InformAllPseudoObjectsDocRenamed(
  732.       LPSERVERNAMETABLE       lpServerNameTable,
  733.       LPMONIKER               lpmkDoc
  734. );
  735. void ServerNameTable_InformAllPseudoObjectsDocSaved(
  736.       LPSERVERNAMETABLE       lpServerNameTable,
  737.       LPMONIKER               lpmkDoc
  738. );
  739. void ServerNameTable_SendPendingAdvises(LPSERVERNAMETABLE lpServerNameTable);
  740. LPPSEUDOOBJ ServerNameTable_GetPseudoObj(
  741.       LPSERVERNAMETABLE       lpServerNameTable,
  742.       LPOLESTR                lpszItem,
  743.       LPSERVERDOC             lpServerDoc
  744. );
  745. void ServerNameTable_CloseAllPseudoObjs(LPSERVERNAMETABLE lpServerNameTable);
  746. #if defined( INPLACE_SVR)
  747. /* ServerDoc::IOleInPlaceObject methods (functions) */
  748. STDMETHODIMP SvrDoc_IPObj_QueryInterface(
  749.       LPOLEINPLACEOBJECT  lpThis,
  750.       REFIID              riid,
  751.       LPVOID FAR *        lplpvObj
  752. );
  753. STDMETHODIMP_(ULONG) SvrDoc_IPObj_AddRef(LPOLEINPLACEOBJECT lpThis);
  754. STDMETHODIMP_(ULONG) SvrDoc_IPObj_Release(LPOLEINPLACEOBJECT lpThis);
  755. STDMETHODIMP SvrDoc_IPObj_GetWindow(
  756.       LPOLEINPLACEOBJECT  lpThis,
  757.       HWND FAR*           lphwnd
  758. );
  759. STDMETHODIMP SvrDoc_IPObj_ContextSensitiveHelp(
  760.       LPOLEINPLACEOBJECT  lpThis,
  761.       BOOL                fEnable
  762. );
  763. STDMETHODIMP SvrDoc_IPObj_InPlaceDeactivate(LPOLEINPLACEOBJECT lpThis);
  764. STDMETHODIMP SvrDoc_IPObj_UIDeactivate(LPOLEINPLACEOBJECT lpThis);
  765. STDMETHODIMP SvrDoc_IPObj_SetObjectRects(
  766.       LPOLEINPLACEOBJECT  lpThis,
  767.       LPCRECT             lprcPosRect,
  768.       LPCRECT             lprcClipRect
  769. );
  770. STDMETHODIMP SvrDoc_IPObj_ReactivateAndUndo(LPOLEINPLACEOBJECT lpThis);
  771. /* ServerDoc::IOleInPlaceActiveObject methods (functions) */
  772. STDMETHODIMP SvrDoc_IPActiveObj_QueryInterface(
  773.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  774.       REFIID                      riidReq,
  775.       LPVOID FAR *                lplpUnk
  776. );
  777. STDMETHODIMP_(ULONG) SvrDoc_IPActiveObj_AddRef(
  778.       LPOLEINPLACEACTIVEOBJECT lpThis
  779. );
  780. STDMETHODIMP_(ULONG) SvrDoc_IPActiveObj_Release(
  781.       LPOLEINPLACEACTIVEOBJECT lpThis
  782. );
  783. STDMETHODIMP SvrDoc_IPActiveObj_GetWindow(
  784.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  785.       HWND FAR*                   lphwnd
  786. );
  787. STDMETHODIMP SvrDoc_IPActiveObj_ContextSensitiveHelp(
  788.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  789.       BOOL                        fEnable
  790. );
  791. STDMETHODIMP SvrDoc_IPActiveObj_TranslateAccelerator(
  792.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  793.       LPMSG                       lpmsg
  794. );
  795. STDMETHODIMP SvrDoc_IPActiveObj_OnFrameWindowActivate(
  796.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  797.       BOOL                        fActivate
  798. );
  799. STDMETHODIMP SvrDoc_IPActiveObj_OnDocWindowActivate(
  800.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  801.       BOOL                        fActivate
  802. );
  803. STDMETHODIMP SvrDoc_IPActiveObj_ResizeBorder(
  804.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  805.       LPCRECT                     lprectBorder,
  806.       LPOLEINPLACEUIWINDOW        lpIPUiWnd,
  807.       BOOL                        fFrameWindow
  808. );
  809. STDMETHODIMP SvrDoc_IPActiveObj_EnableModeless(
  810.       LPOLEINPLACEACTIVEOBJECT    lpThis,
  811.       BOOL                        fEnable
  812. );
  813. #endif // INPLACE_SVR
  814. #endif // _SVROUTL_H_