Source code of Windows XP (NT5)
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.

888 lines
31 KiB

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