Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2013 lines
83 KiB

  1. #ifndef __offcapi_h__
  2. #define __offcapi_h__
  3. #pragma pack( push, 4 )
  4. //////////////////////////////////////////////////////////////////////////////
  5. // FILE : OFFCAPI.H
  6. // PURPOSE: Client apps of office.dll include this file for structs and exports.
  7. // HOW TO USE:
  8. // Either you can link the office.lib (import lib) with your app
  9. // or you can LoadLibrary and GetProcAddress the reqd office routine.
  10. // INIT :
  11. // Before using any of the office.dll supplied features, you must init it
  12. // using Office(ioffcInit,&officeinfo). See below for more details.
  13. //
  14. // FEATURE LIST:
  15. // IntelliSearch
  16. // Shared FileNew
  17. // Extended doc properties
  18. // Office Visual (cool title bar)
  19. // Threaded status indicator
  20. // AutoCorrect
  21. //
  22. //////////////////////////////////////////////////////////////////////////////
  23. #ifndef INC_OLE2
  24. #define INC_OLE2
  25. #include <windows.h>
  26. #include <objbase.h>
  27. #include <oleauto.h>
  28. #endif // INC_OLE2
  29. #define DLLIMPORT
  30. #define DLLEXPORT
  31. #ifdef DLLBUILD
  32. #define DLLFUNC DLLEXPORT
  33. #define OFC_CALLTYPE _stdcall
  34. #else // !DLLBUILD
  35. #define DLLFUNC DLLIMPORT
  36. #ifndef OFC_CALLTYPE
  37. #define OFC_CALLTYPE __stdcall
  38. #endif // OFC_CALLTYPE
  39. #endif // DLLBUILD
  40. #define OFC_CALLBACK __stdcall
  41. #define ioffcInit 0
  42. #define ioffcISearch 1
  43. #define ioffcGetVer 2
  44. //Next two are debug only ioffcs
  45. #define ioffcISearchDebug 3
  46. #define ioffcISearchInputFileTest 4
  47. #define ioffcUninit 5
  48. #define ioffcISearchInWinHelp 6
  49. #define ioffcCanDoMSNConnect 7
  50. #define ioffcDoMSNConnect 8
  51. #define ioffcAWVBAHelp 9
  52. //iseachinfo is used to call IntelliSearch using Office()
  53. //hwnd is the parent window for the IS dlg
  54. //IS callback is for selection checking.First parameter is the topicID. If
  55. //the app can do the ghosting/demo then it returns True. If not in the right
  56. //selection for the demo then return the error text at second buffer for display
  57. //by IS. The third argument is the size of this error buffer.
  58. //cisdb is count of the isdb tables you want the IS to be done on (normally 1)
  59. //pstz[] is the array of ptrs to the path and name of the isdb tables.
  60. typedef struct _isearchinfo
  61. {
  62. HWND hwnd;
  63. union
  64. {
  65. BOOL ((OFC_CALLBACK *pfnISCallback)(int, TCHAR *, int));
  66. struct
  67. {
  68. unsigned fMOM:1;
  69. unsigned fDetachNote:1;
  70. unsigned fAWTabOnTop:1;
  71. unsigned unused:29;
  72. } async;
  73. } callData;
  74. UINT cisdb;//count of the IS dbs
  75. TCHAR *pstz[1];
  76. }ISEARCHINFO;
  77. //use MSOAWVBAHELPINFO when calling Office(ioffcAWVBAHelp,)
  78. //This will display the vba help as usual. In case user asks for
  79. //AnswerWizard it would have setup winhelp to do that
  80. typedef struct _msoawvbahelpinfo
  81. {
  82. TCHAR *pszVBAHelpfilename; //name of the vba help file
  83. UINT idVBAHelp; //id of the help to be displayed
  84. ISEARCHINFO isearchinfo;
  85. }MSOAWVBAHELPINFO;
  86. //the following two are sent as wParam when fDetachNote is set to true
  87. #define wISDetaching 0xfffffffe //when the dll is detached
  88. #define wISInited 0xffffffff //when the init was successful
  89. //_ver is used to get the office.dll version no. using Office()
  90. typedef struct _ver
  91. {
  92. long rmjV;
  93. long rmmV;
  94. long rupV;
  95. }VER;
  96. typedef struct _isdebinfo
  97. {
  98. HWND hwnd;
  99. }ISDEBINFO;
  100. //msomsninfo is used to communicate MSN connection related info.
  101. //Use it when calling ioffcDoMSNConnection.
  102. //Right now it just needs the hwnd of the apps main window.
  103. typedef struct _msomsninfo
  104. {
  105. HWND hwnd;
  106. }MSOMSNINFO;
  107. #ifdef __cplusplus
  108. extern TEXT("C") {
  109. #endif // __cplusplus
  110. LRESULT OFC_CALLTYPE Office(UINT ioffc, void *lpv);
  111. //It returns the message number that you will get for ISearch ghosting.
  112. UINT OFC_CALLTYPE MsoGetWmGhost();
  113. #ifdef __cplusplus
  114. }; // extern "C"
  115. #endif // __cplusplus
  116. /***********************************************************************
  117. Office() is called with ioffc.
  118. 1) ioffc=ioffcInit :: Performs the office.dll initialisation.
  119. -----------------
  120. set lpv=&officeinfo.
  121. set all the fields of officeinfo.
  122. hinst -> hInstance of your app
  123. PAlloc and FreeP -> provide these tow functions for mem alloc and free
  124. if you set PAlloc=NULL then office will use its own alloc and free
  125. pstzOfficeIntlDll is currently ignored
  126. returns TRUE on success else FALSE
  127. 2) ioffc=ioffcUninit :: Performs the office.dll UNInitialisation/cleanup before
  128. quitting.Call this before closing your app.
  129. -----------------
  130. set lpv=NULL.
  131. call Office(ioffcUninit,NULL).
  132. 3) ioffc=ioffcISearch :: Performs IntelliSearch (FOR TESTING USE ONLY)
  133. --------------------
  134. set lpv=&isearchinfo.
  135. returns -1 for no action and topicID if app needs to act.
  136. NOTE: THIS API IS FOR INTERNAL debug USE ONLY. ALL THE APPS SHOULD
  137. CALL ioffcISearchInWinHelp described below for intellisearch.
  138. 4) ioffc=ioffcGetVer :: Use this to get the version number of the dll
  139. ----------------
  140. set lpv=&ver
  141. returns with all the fields of ver set.
  142. 5) ioffcISearchDebug and ioffcISearchInputFileTest are for DEBUG/Test only.
  143. --------------------
  144. 6) ioffcISearchInWinHelp - Performs IntelliSearch as a tab in WinHelp browser.
  145. -----------------------
  146. Call Office(ioffcISearchInWinHelp, pisearchinfo). All the fields of the
  147. isearchinfo struct should be set as follows:
  148. hwnd -> callers main window
  149. fMOM -> set by MOM (Microsoft Office Manager) fFalse for others
  150. fDetachNote -> set this to fTrue if you need to get the wmGhost message
  151. with wParam (0xfffffff) when WinHelp frees the office.dll.
  152. Currently used by MOM only so you should set it to fFalse;
  153. cisdb ->count of the databases
  154. pstz[] -> array of ptrs to database names.
  155. Office will return TRUE or FALSE based on whether it could launch WinHelp
  156. or not.
  157. Ghosting: In WinHelp ISearch works in a separate app(WinHelp).Its like a
  158. modeless dialog. User can choose a ghosting topic anytime. Office will post
  159. a wmGhost message to the hwnd that was provided in isearchinfo. To get the
  160. wmGhost value apps should call MsoGetWmGhost() anytime after calling
  161. Office(ioffcInit). An app can have a global wmGhost and set it either after
  162. ioffcInit or before/after calling IntelliSearch for the first time. Look for the
  163. wmGhost message in the WndProc. The wParam will have the topic that needs
  164. to be ghosted. If the app is not in a state to do the given ghosting, just
  165. give the error. There is no communication back to office.dll
  166. 7) ioffcCanDoMSNConnect
  167. -----------------------
  168. Call this to find out if you mso95 can do MSN connection or not. If
  169. Set lpv=NULL. This will return TRUE if we can do the MSN connection, false
  170. otherwise. Grey the menu if false.
  171. 8) ioffcDoMSNConnect
  172. --------------------
  173. Call this to do the MSN connection by mso95.
  174. Set msomsninfo.hwnd=Handle of your main window.
  175. Set lpv=&msomsninfo. This will bring up the choose topic dialog and connect
  176. the user to MSN if s/he selects connect.
  177. ***********************************************************************/
  178. #ifdef DEBUG
  179. /**********************************************************************
  180. EnumOfficeAllocs is provided for clients to get a list of all
  181. the memory allocated by office.dll at idle.
  182. Provide a ptr to a function which will be called repeatedly for
  183. each memory block that office has allocated.
  184. **********************************************************************/
  185. #ifdef __cplusplus
  186. extern TEXT("C") {
  187. #endif // __cplusplus
  188. VOID OFC_CALLTYPE EnumOfficeAllocs(void (OFC_CALLBACK *)(void *, int));
  189. #ifdef __cplusplus
  190. }; // extern "C"
  191. #endif // __cplusplus
  192. #endif //DEBUG
  193. //*******************************************************************
  194. /* File New Dialog APIs */
  195. //*******************************************************************
  196. #define NFN_SHOWNEWGROUP 0x0001 /* Show the Template/Document group box. */
  197. #define NFN_DOCUMENT 0x0002 /* Document was chosen. */
  198. #define NFN_TEMPLATE 0x0004 /* Template was chosen. */
  199. #define NFN_SHOWMETAFILE 0x0008 /* The lpstrNoPreview is a path to a MF */
  200. #define NFN_NOUITEST 0x0010 /* Do not show UI, just count templates. */
  201. #define NFN_RETURNONONE 0x0020 /* Count number of templates. */
  202. #define NFN_REMEMBERTAB 0x0040 /* Remember the tab category. */
  203. #define NFN_VIEW_ICON 0x0080 /* Start or ended in icon view. */
  204. #define NFN_VIEW_LIST 0x0100 /* Start or ended in list view. */
  205. #define NFN_VIEW_REPORT 0x0200 /* Start or ended in report view. */
  206. #define NFN_SORT_NAME 0x0400 /* Sort by name. */
  207. #define NFN_SORT_TYPE 0x0800 /* Sort by type. */
  208. #define NFN_SORT_SIZE 0x1000 /* Sort by size. */
  209. #define NFN_SORT_MOD 0x2000 /* Sort by date. */
  210. #define NFN_SORT_DESCENDING 0x4000 /* Sort in descending order. */
  211. #define NFN_PLAINPREVIEW 0x8000 /* No anti-aliased preview. */
  212. #define NFT_SHOWMETAFILE 0x0001 /* Same as NFN_* for nft:s. */
  213. /* RETURN CODES */
  214. #define NFNRC_FAILURE -2 // Something went wrong... out of memory?
  215. #define NFNRC_CANCEL -1 // User canceled the dialog.
  216. #define NFNRC_OK 0 // User selected template file.
  217. // >0 : NFT return codes.
  218. typedef struct tagNFT
  219. {
  220. LPCTSTR lpszName;
  221. LPCTSTR lpszType;
  222. DWORD dwReturnCode;
  223. DWORD dwPosition;
  224. LPCTSTR lpszApplication;
  225. LPCTSTR lpszCommand;
  226. LPCTSTR lpszTopic;
  227. LPCTSTR lpszDDEExec;
  228. LPCTSTR lpszPreview;
  229. DWORD dwFlags; /* NFT_SHOWMETAFILE: Text or MF */
  230. } NFT;
  231. #if 0
  232. // This structure is not Win64-compliant (bad alignment)
  233. // Fortunately, we don't use it.
  234. typedef struct tagNFN
  235. {
  236. DWORD lStructSize; // Size of the structure.
  237. HWND hwndOwner; // Parent window of the dialog.
  238. HINSTANCE hInstance; // Modula handle of the calling process.
  239. LPCTSTR lpstrFilter; // File filter, e.g. "*.dot\0*.wiz\0\0"
  240. LPTSTR lpstrFile; // File name buffer. Provided by caller.
  241. DWORD nMaxFile; // Size of lpstrFile.
  242. LPTSTR lpstrFileTitle; // File name without the path.
  243. DWORD nMaxFileTitle; // Size of lpstrFileTitle.
  244. LPCTSTR lpstrTitle; // Dialog title.
  245. LPTSTR lpstrCategory; // Default category.
  246. DWORD nMaxCategory; // Max size of category buffer.
  247. DWORD Flags; // Flags. See NFN_* above.
  248. WORD nFileOffset; // Index into lpstrFile for file name.
  249. WORD nFileExtension; // Index into lpstrFile for extension.
  250. LPTSTR lpstrRegNFT; // Registry key of default items.
  251. NFT *lpNFT; // Explicit enties for non-file templates.
  252. WORD cNFT; // Count of non-file templates.
  253. LPCTSTR lpstrNoPreview; // Msg to use if no thumbnail in template.
  254. POINT ptCenter; // Position to display dialog.
  255. }NEWFILENAME;
  256. #else
  257. typedef struct tagNFN NEWFILENAME; // opaque definition
  258. #endif
  259. #define EnumTemplates(pszPath, pfnCallback, pData) EnumFileSystem(TRUE, \
  260. pszPath, (DWORD)(~FILE_ATTRIBUTE_DIRECTORY), \
  261. TRUE, pfnCallback, pData)
  262. #define EnumTemplatesEx(pszPath, pfnCallback, pData) EnumFileSystemEx(TRUE, \
  263. pszPath, (DWORD)(~FILE_ATTRIBUTE_DIRECTORY), \
  264. TRUE, pfnCallback, pData)
  265. #ifdef __cplusplus
  266. extern TEXT("C") {
  267. #endif // __cplusplus
  268. TCHAR * OFC_CALLTYPE SharedTemplatesPath(TCHAR sz[], long cchMax);
  269. TCHAR * OFC_CALLTYPE LocalTemplatesPath(TCHAR sz[], long cchMax);
  270. LONG OFC_CALLTYPE SetLocalTemplatesPath(LPCTSTR pszPath);
  271. LONG OFC_CALLTYPE SetSharedTemplatesPath(LPCTSTR pszPath);
  272. BOOL OFC_CALLTYPE FIsPlaceHolder(LPCTSTR lpszFileName);
  273. long OFC_CALLTYPE GetNewFileName(NEWFILENAME *pNfn, NFT *pNFT);
  274. TCHAR * OFC_CALLTYPE GetTemplatesPath(TCHAR szPath[], long cchMax, int iId);
  275. /* Window procedure used for sub-classinf the new dialog */
  276. long FAR PASCAL CoreNewWndProc(HWND hwnd,
  277. UINT wMsgId,
  278. WPARAM wParam,
  279. LPARAM lParam);
  280. #ifdef __cplusplus
  281. }; // extern "C"
  282. #endif // __cplusplus
  283. ///////////////////////////////////////////////////////////////////////////////
  284. // THUMBNAIL FUNCTIONS
  285. // Overview:
  286. ///////////////////////////////////////////////////////////////////////////////
  287. typedef struct tagTHUMBNAIL THUMBNAIL;
  288. typedef struct tagPREVIEWPARAM {
  289. HDC hdc;
  290. THUMBNAIL *pNail;
  291. DWORD dwExtX;
  292. DWORD dwExtY;
  293. RECT rcCrop;
  294. POINT ptOffset;
  295. BOOL fImprove;
  296. BOOL fUsePalette;
  297. BOOL fDie;
  298. BOOL fFitWithin;
  299. void (PASCAL *lpprocCleanUp)(struct tagPREVIEWPARAM *);
  300. LPVOID pData;
  301. } PREVIEWPARAM;
  302. #ifdef __cplusplus
  303. extern TEXT("C") {
  304. #endif // __cplusplus
  305. THUMBNAIL * OFC_CALLTYPE LoadThumbnail(LPSTORAGE pIStorage);
  306. THUMBNAIL * OFC_CALLTYPE MakeThumbnail(WORD wType, LPVOID pPicture);
  307. LPSTORAGE OFC_CALLTYPE OpenDocFileA(LPCTSTR lpszDocFile);
  308. void OFC_CALLTYPE DestroyThumbnail(THUMBNAIL *lpTN);
  309. DWORD WINAPI PreviewThumbnail(LPVOID lParam);
  310. HBRUSH OFC_CALLTYPE HbrCreateHalftoneBrush(HDC hdc, COLORREF Color);
  311. HPALETTE OFC_CALLTYPE HPalCreateHalftone(HDC hdc,
  312. const PALETTEENTRY *pShared,
  313. const DWORD nEntries,
  314. const BYTE dH,
  315. const BYTE dS,
  316. const BYTE dV);
  317. #ifdef __cplusplus
  318. }; // extern "C"
  319. #endif // __cplusplus
  320. ////////////////////////////////////////////////////////////////////////////////
  321. // EXTENDED OLE DOC PROPERTIES APIs follow
  322. // Overview:
  323. // To use extended ole properties do the following
  324. // 1.Open your file
  325. // 2.Call FOfficeCreateAndInitObjects: This will create 3 objects which are
  326. // siobj (sum info obj
  327. // dsiobj (doc sum info obj)
  328. // udobj (user defined data or custom obj)
  329. // and provides a pointer to each of these.
  330. // To make any subsequent calls, you will have to provide the pointer to the
  331. // appropriate object.
  332. // 3.Before you close a file call FOfficeDestroyObjects.
  333. ////////////////////////////////////////////////////////////////////////////////
  334. //
  335. // Summary Information interface API.
  336. //
  337. // Notes:
  338. // - define OLE_PROPS to build OLE 2 interface objects too.
  339. //
  340. // The actual data is stored in SUMINFO. The layout of the first
  341. // 3 entries must not be changed, since it will be overlayed with
  342. // other structures. All property exchange data structures have
  343. // this format.
  344. //
  345. // The first parameter of all functions must be LPSIOBJ in order for these
  346. // functions to work as OLE objects.
  347. //
  348. // All functions defined here have "SumInfo" in them.
  349. //
  350. // Several macros are used to hide the stuff that changes in this
  351. // file when it is used to support OLE 2 objects.
  352. // They are:
  353. // SIVTBLSTRUCT - For OLE, expands to the pointer to the interface Vtbl
  354. // - Otherwise, expands to dummy struct same size as Vtbl
  355. // LPSIOBJ - For OLE, expands to a pointer to the interface which is
  356. // just the lpVtbl portion of the data, to be overlayed later.
  357. // - Otherwise, expands to a pointer to the whole data
  358. //
  359. ////////////////////////////////////////////////////////////////////////////////
  360. #include <objbase.h>
  361. #include <oleauto.h>
  362. // Apps should use these for "Create" calls to fill out rglpfn
  363. #define ifnCPConvert 0 // Index of Code Page Converter
  364. #define ifnFSzToNum 1 // Index of Sz To Num routine
  365. #define ifnFNumToSz 2 // Index of Num To Sz routine
  366. #define ifnFUpdateStats 3 // Index of routine to update statistics
  367. #define ifnMax 4 // Max index
  368. // Predefined Security level values for Property Sets in the standard
  369. #define SECURITY_NONE 0x0 /* No security */
  370. #define SECURITY_PASSWORD 0x1 /* Password-protected */
  371. #define SECURITY_READONLYRECOMMEND 0x2 /* Read-only access recommened */
  372. #define SECURITY_READONLYENFORCED 0x4 /* Read-only access enforced */
  373. #define SECURITY_LOCKED 0x8 /* Locked for annotations */
  374. // Define a platform-independent VT_LPxSTR value.
  375. typedef enum _VARENUM_EX
  376. {
  377. VT_LPTSTR = VT_LPWSTR
  378. } VARENUM_EX;
  379. // The types supported by the User-Defined properties
  380. typedef enum _UDTYPES
  381. {
  382. wUDlpsz = VT_LPTSTR,
  383. wUDdate = VT_FILETIME,
  384. wUDdw = VT_I4,
  385. wUDfloat = VT_R8,
  386. wUDbool = VT_BOOL,
  387. wUDinvalid = VT_VARIANT // VT_VARIANT is invalid because it
  388. // must always be combined with VT_VECTOR
  389. } UDTYPES;
  390. #ifdef OLE_PROPS
  391. #include "SInfoI.h"
  392. // Use the real Vtbl for OLE objects
  393. #define SIVTBLSTRUCT struct ISumInfo
  394. // For OLE objects, first param is pointer to interface class
  395. #define LPSIOBJ ISumInfo FAR *
  396. #ifdef __cplusplus
  397. extern TEXT("C") {
  398. #endif // __cplusplus
  399. // Must support IUnknown methods for OLE objects....
  400. HRESULT OFC_CALLTYPE HrSumInfoQueryInterface (IUnknown FAR *,
  401. REFIID riid,
  402. LPVOID FAR* ppvObj);
  403. ULONG OFC_CALLTYPE UlSumInfoAddRef (IUnknown FAR *);
  404. ULONG OFC_CALLTYPE UlSumInfoRelease (IUnkown FAR *);
  405. #ifdef __cplusplus
  406. }; // extern "C"
  407. #endif // __cplusplus
  408. #else // !OLE_PROPS
  409. // Create a placeholder Vtbl for non-OLE objects.
  410. #define SIVTBLSTRUCT struct _SIVTBLSTRUCT { void FAR *lpVtbl; } SIVTBLSTRUCT
  411. // For non-OLE objects, first param is pointer to real data.
  412. #define LPSIOBJ LPOFFICESUMINFO
  413. // For more information on the thumbnail look in OLE 2 Programmer's Reference, Volume 1, pp 874-875.
  414. typedef struct tagSINAIL
  415. {
  416. DWORD cbData; // size of *pdata
  417. DWORD cftag; // either 0,-1,-2,-3, or positive. This decides the size of pFMTID.
  418. BYTE *pbFMTID; // bytes representing the FMTID
  419. BYTE *pbData; // bytes representing the data
  420. } SINAIL;
  421. typedef SINAIL FAR * LPSINAIL;
  422. // Note about tagSINAIL:
  423. //
  424. // if cftag is
  425. // 0 - pFMTID is NULL i.e. no format name
  426. // -1 - Windows built-in Clipboard format. pFMTID points to a DWORD (e.g. CF_DIB)
  427. // -2 - Macintosh Format Value. pFMTID points to a DWORD
  428. // -3 - FMTID. pFMTID points to 16 bytes
  429. // >0 - Length of string. pFMTID points to cftag bytes
  430. //
  431. #endif // OLE_PROPS
  432. // Summary info data. Callers should *never* access this data directly,
  433. // always use the supplied API's.
  434. typedef struct _OFFICESUMINFO {
  435. SIVTBLSTRUCT; // Vtbl goes here for OLE objs,
  436. // Must be here for overlays to work!
  437. BOOL m_fObjChanged; // Indicates the object has changed
  438. ULONG m_ulRefCount; // Reference count
  439. LPVOID m_lpData; // Pointer to the real data
  440. HPROPSHEETPAGE m_hPage; // Handle of property page.
  441. } OFFICESUMINFO, FAR * LPOFFICESUMINFO;
  442. #ifdef __cplusplus
  443. extern TEXT("C") {
  444. #endif // __cplusplus
  445. //
  446. // Indices to pass to API routines to get the specifc data.
  447. //
  448. // Strings
  449. #define SI_TITLE 0
  450. #define SI_SUBJECT 1
  451. #define SI_AUTHOR 2
  452. #define SI_KEYWORDS 3
  453. #define SI_COMMENTS 4
  454. #define SI_TEMPLATE 5
  455. #define SI_LASTAUTH 6
  456. #define SI_REVISION 7
  457. #define SI_APPNAME 8
  458. #define SI_STRINGLAST 8
  459. // Times
  460. #define SI_TOTALEDIT 0
  461. #define SI_LASTPRINT 1
  462. #define SI_CREATION 2
  463. #define SI_LASTSAVE 3
  464. #define SI_TIMELAST 3
  465. // Integer stats
  466. #define SI_PAGES 0
  467. #define SI_WORDS 1
  468. #define SI_CHARS 2
  469. #define SI_SECURITY 3
  470. #define SI_INTLAST 3
  471. //
  472. // Standard I/O routines
  473. //
  474. // Indicates if the summary info data has changed.
  475. //
  476. // Parameters:
  477. //
  478. // lpSIObj - pointer to Summary Info object
  479. //
  480. // Return value:
  481. //
  482. // TRUE -- the data has changed, and should be saved.
  483. // FALSE -- the data has not changed.
  484. //
  485. BOOL OFC_CALLTYPE FSumInfoShouldSave (LPSIOBJ lpSIObj);
  486. //
  487. // Data manipulation
  488. //
  489. // Get the size of a given string property.
  490. //
  491. // Parameters:
  492. //
  493. // lpSIObj - pointer to Summary Info object.
  494. // iw - specifies which string to get the size of and should be
  495. // one of the following values:
  496. // SI_TITLE
  497. // SI_SUBJECT
  498. // SI_AUTHOR
  499. // SI_KEYWORDS
  500. // SI_COMMENTS
  501. // SI_TEMPLATE
  502. // SI_LASTAUTH
  503. // SI_REVISION
  504. // SI_APPNAME
  505. //
  506. // pdw - pointer to a dword, will contain cb on return
  507. //
  508. // Return value:
  509. //
  510. // The function returns TRUE on success, FALSE on error.
  511. BOOL OFC_CALLTYPE FCbSumInfoString (LPSIOBJ lpSIObj, WORD iw, DWORD *pdw);
  512. // Get a given time property.
  513. //
  514. // Parameters:
  515. //
  516. // lpSIObj - pointer to a Summary Info object
  517. // iw - specifies which time to get and should be
  518. // one of the following values:
  519. // SI_TOTALEDIT
  520. // SI_LASTPRINT
  521. // SI_CREATION
  522. // SI_LASTSAVE
  523. //
  524. // lpTime - buffer to hold filetime
  525. //
  526. // Return value:
  527. //
  528. // The function returns TRUE on succes.
  529. // The function returns FALSE on error (bogus argument, or the time
  530. // requested doesn't exist - i.e. has not been set, or loaded).
  531. //
  532. // NOTE: The filetime will be based Coordinated Universal Time (UTC).
  533. // This ensures that the time is displayed correctly all over the
  534. // world.
  535. //
  536. // NOTE: FOR SI_TOTALEDIT lpTime WILL ACTUALLY BE THE TIME
  537. // THE FILE HAS BEEN EDITED, NOT A DATE. THE TIME
  538. // WILL BE EXPRESSED IN UNITS OF 100ns. I KNOW THIS IS
  539. // A WEIRD UNIT TO USE, BUT WE HAVE TO DO THAT FOR BACK-
  540. // WARDS COMPATABILITY REASONS WITH 16-BIT WORD 6.
  541. //
  542. // OFFICE provides a utility routine to convert a number of
  543. // units of 100ns into minutes. Call Convert100nsToMin.
  544. //
  545. BOOL OFC_CALLTYPE FSumInfoGetTime (LPSIOBJ lpSIObj,
  546. WORD iw,
  547. LPFILETIME lpTime);
  548. // Set the time property to a given value
  549. //
  550. // Parameters:
  551. //
  552. // lpSIObj - pointer to a Summary Info object
  553. // iw - specifies which time to set and should be
  554. // one of the following values:
  555. // SI_TOTALEDIT
  556. // SI_LASTPRINT
  557. // SI_CREATION
  558. // SI_LASTSAVE
  559. //
  560. // lpTime - buffer containing new filetime
  561. //
  562. // NOTE: The filetime should be based Coordinated Universal Time (UTC).
  563. // This ensures that the time is displayed correctly all over the
  564. // world.
  565. //
  566. // Return value:
  567. //
  568. // The function returns TRUE on succes.
  569. // The function returns FALSE on error.
  570. //
  571. // Note: The function will dirty the object on success.
  572. //
  573. // NOTE: FOR SI_TOTALEDIT lpTime WILL BE INTERPRETED AS THE TIME
  574. // THE FILE HAS BEEN EDITED, NOT A DATE. THE TIME SHOULD
  575. // BE EXPRESSED IN UNITS OF 100ns. I KNOW THIS IS
  576. // A WEIRD UNIT TO USE, BUT WE HAVE TO DO THAT FOR BACK-
  577. // WARDS COMPATABILITY REASONS WITH 16-BIT WORD 6.
  578. //
  579. // ALSO NOTE THAT THE TIME WILL BE SHOW IN MINUTES IN THE
  580. // PROPERTIES DIALOG.
  581. //
  582. // OFFICE provides a utility routine to convert a number of
  583. // minutes into units of 100ns. Call ConvertMinTo100ns
  584. //
  585. BOOL OFC_CALLTYPE FSumInfoSetTime (LPSIOBJ lpSIObj, WORD iw, LPFILETIME lpTime);
  586. // Get an integer property
  587. //
  588. // Parameters:
  589. //
  590. // lpSIObj - pointer to Summary Info object
  591. // iw - specifies which integer to get and should be
  592. // one of the following values:
  593. // SI_PAGES
  594. // SI_WORDS
  595. // SI_CHARS
  596. // SI_SECURITY
  597. //
  598. // pdw - pointer to a dword, will contain the int on return
  599. // Return value:
  600. //
  601. // The function returns TRUE on succes, FALSE on error.
  602. BOOL OFC_CALLTYPE FDwSumInfoGetInt (LPSIOBJ lpSIObj, WORD iw, DWORD *pdw);
  603. // Set an integer property to a given value
  604. //
  605. // Parameters:
  606. //
  607. // lpSIObj - pointer to Summary Info object
  608. // iw - specifies which integer to set and should be
  609. // one of the following values:
  610. // SI_PAGES
  611. // SI_WORDS
  612. // SI_CHARS
  613. // SI_SECURITY
  614. //
  615. // dw - the value
  616. //
  617. // Return value:
  618. //
  619. // The function returns TRUE on success.
  620. // The function returns FALSE on error.
  621. //
  622. // Note: The function will dirty the object on success.
  623. //
  624. BOOL OFC_CALLTYPE FSumInfoSetInt (LPSIOBJ lpSIObj, WORD iw, DWORD dw);
  625. #ifdef __cplusplus
  626. }; // extern "C"
  627. #endif // __cplusplus
  628. ////////////////////////////////////////////////////////////////////////////////
  629. //
  630. // MS Office Document Summary Information
  631. //
  632. // The Document Summary Information follows the serialized format for
  633. // property sets defined in Appendix B ("OLE Property Sets") of
  634. // "OLE 2 Programmer's Reference, Volume 1"
  635. //
  636. // Notes:
  637. // - define OLE_PROPS to build OLE 2 interface objects too.
  638. //
  639. // The actual data is stored in DOCSUMINFO. The layout of the first
  640. // 3 entries must not be changed, since it will be overlayed with
  641. // other structures. All property exchange data structures have
  642. // this format.
  643. //
  644. // The first parameter of all functions must be LPDSIOBJ in order for these
  645. // functions to work as OLE objects.
  646. //
  647. // All functions defined here have "DocSum" in them.
  648. //
  649. // Several macros are used to hide the stuff that changes in this
  650. // file when it is used to support OLE 2 objects.
  651. // They are:
  652. // DSIVTBLSTRUCT - For OLE, expands to the pointer to the interface Vtbl
  653. // - Otherwise, expands to dummy struct same size as Vtbl
  654. // LPDSIOBJ - For OLE, expands to a pointer to the interface which is
  655. // just the lpVtbl portion of the data, to be overlayed later.
  656. // - Otherwise, expands to a pointer to the whole data
  657. //
  658. ////////////////////////////////////////////////////////////////////////////////
  659. #ifdef OLE_PROPS
  660. #include "DocSumI.h"
  661. // Use the real Vtbl for OLE objects
  662. #define DSIVTBLSTRUCT struct IDocSum
  663. // For OLE objects, first param is pointer to interface class
  664. #define LPDSIOBJ IDocSum FAR *
  665. #else // !OLE_PROPS
  666. // Create a placeholder Vtbl for non-OLE objects.
  667. #define DSIVTBLSTRUCT struct _DSIVTBLSTRUCT { void FAR *lpVtbl; } DSIVTBLSTRUCT
  668. // For non-OLE objects, first param is pointer to real data.
  669. #define LPDSIOBJ LPDOCSUMINFO
  670. #endif // OLE_PROPS
  671. // Our object
  672. typedef struct _DOCSUMINFO {
  673. DSIVTBLSTRUCT; // Vtbl goes here for OLE objs,
  674. // Must be here for overlays to work!
  675. BOOL m_fObjChanged; // Indicates the object has changed
  676. ULONG m_ulRefCount; // Reference count
  677. LPVOID m_lpData; // Pointer to the real data
  678. HPROPSHEETPAGE m_hPage; // Handle of property page.
  679. } DOCSUMINFO, FAR * LPDOCSUMINFO;
  680. #ifdef __cplusplus
  681. extern TEXT("C") {
  682. #endif
  683. //
  684. // Indices to pass to API routines to get the specifc data.
  685. //
  686. // Strings
  687. #define DSI_CATEGORY 0
  688. #define DSI_FORMAT 1
  689. #define DSI_MANAGER 2
  690. #define DSI_COMPANY 3
  691. #define DSI_STRINGLAST 3
  692. // Integer statistics
  693. #define DSI_BYTES 0
  694. #define DSI_LINES 1
  695. #define DSI_PARAS 2
  696. #define DSI_SLIDES 3
  697. #define DSI_NOTES 4
  698. #define DSI_HIDDENSLIDES 5
  699. #define DSI_MMCLIPS 6
  700. #define DSI_INTLAST 6
  701. //
  702. // Standard I/O routines
  703. //
  704. BOOL FCbDocSumString (LPDSIOBJ lpDSIObj, WORD iw, DWORD *pdw);
  705. // Indicates if the Document Summary Infodata has changed.
  706. //
  707. // Parameters:
  708. //
  709. // lpDSIObj - pointer to Document Summary Info object
  710. //
  711. // Return value:
  712. //
  713. // TRUE -- the data has changed, and should be saved.
  714. // FALSE -- the data has not changed.
  715. //
  716. BOOL OFC_CALLTYPE FDocSumShouldSave (LPDSIOBJ lpDSIObj);
  717. //
  718. // Data manipulation routines
  719. //
  720. //
  721. // How Heading and Document parts work:
  722. //
  723. // Heading:
  724. // --------
  725. // Heading is a list of non-indented headings that will be
  726. // displayed in the "Contents" ply.
  727. //
  728. // Associated with each Heading is the number of document parts
  729. // that goes with the particular heading -- this is the concept of a
  730. // Heading Pair.
  731. //
  732. // Document Parts:
  733. // ---------------
  734. // Document Parts is a list of parts associated with a heading.
  735. //
  736. // Example (as it could be implemented in Microsoft Excel):
  737. // ----------------------------------------------
  738. // Worksheets
  739. // Sheet1
  740. // Sheet2
  741. // Modules
  742. // Module1 Figure 1
  743. // Charts
  744. // Chart1
  745. // Chart2
  746. // Chart3
  747. //
  748. // Thus the Heading Pairs would be:
  749. //
  750. // Heading Pair
  751. // string count
  752. //------------------------------------
  753. // Worksheets 2
  754. // Modules 1 Figure 2
  755. // Charts 3
  756. //
  757. //
  758. // And the Document Parts would be:
  759. //
  760. // Document Parts
  761. //--------------------------
  762. // Sheet1
  763. // Sheet2
  764. // Module1
  765. // Chart1 Figure 3
  766. // Chart2
  767. // Chart3
  768. //
  769. //
  770. // Note: Headings and Document Parts are not restricted to be parts of
  771. // a document, but can be whatever the client wants. Car models,
  772. // car makes, customers, etc...
  773. //
  774. // The above is just an example.
  775. //
  776. // Get an integer property
  777. //
  778. // Parameters:
  779. //
  780. // lpDSIObj - pointer to Document Summary Info object
  781. // iw - specifies which integer to get and should be
  782. // one of the following values:
  783. // DSI_BYTES
  784. // DSI_LINES
  785. // DSI_PARAS
  786. // DSI_SLIDES
  787. // DSI_NOTES
  788. // DSI_HIDDENSLIDES
  789. // DSI_MMCLIPS
  790. //
  791. // pdw - pointer to dword, will contain integer
  792. //
  793. // Return value:
  794. //
  795. // The function returns TRUE on success, FALSE on error
  796. //
  797. BOOL OFC_CALLTYPE FDwDocSumGetInt (LPDSIOBJ lpDSIObj, WORD iw, DWORD *pdw);
  798. // Determine if the actual values of the LINKED user defined properties has changed
  799. // This function should only be called right after loading the properties to
  800. // see if the caller should update the link values.
  801. //
  802. // NOTE: The function works by checking the value of the PID_LINKSDIRTY property.
  803. // When this function is called the property will be set to FALSE, so that
  804. // flag is cleared next time the properties are saved.
  805. //
  806. // NOTE: Only the app that created the file that are being loaded should call this
  807. // function. I.e. Excel calls this for .xls files, noone else does, etc...
  808. //
  809. // Parameters:
  810. //
  811. // lpDSIObj - pointer to Document Summary Info object
  812. //
  813. // Return value:
  814. //
  815. // The function returns TRUE if the link values have changed.
  816. // The function returns FALSE if the link value have not
  817. // changed, or on error.
  818. //
  819. BOOL OFC_CALLTYPE FLinkValsChanged(LPDSIOBJ lpDSIObj);
  820. #ifdef __cplusplus
  821. }; // extern "C"
  822. #endif
  823. ////////////////////////////////////////////////////////////////////////////////
  824. //
  825. // MS Office User Defined Property Information
  826. //
  827. // The User Defined Property Information follows the serialized format for
  828. // property sets defined in Appendix B ("OLE Property Sets") of
  829. // "OLE 2 Programmer's Reference, Volume 1"
  830. //
  831. // Notes:
  832. // - define OLE_PROPS to build OLE 2 interface objects too.
  833. //
  834. // The actual data is stored in USERPROP. The layout of the first
  835. // 3 entries must not be changed, since it will be overlayed with
  836. // other structures. All property exchange data structures have
  837. // this format.
  838. //
  839. // The first parameter of all functions must be LPUDOBJ in order for these
  840. // functions to work as OLE objects.
  841. //
  842. // All functions defined here have "UserDef" in them.
  843. //
  844. // Several macros are used to hide the stuff that changes in this
  845. // file when it is used to support OLE 2 objects.
  846. // They are:
  847. // UDPVTBLSTRUCT - For OLE, expands to the pointer to the interface Vtbl
  848. // - Otherwise, expands to dummy struct same size as Vtbl
  849. // LPUDOBJ - For OLE, expands to a pointer to the interface which is
  850. // just the lpVtbl portion of the data, to be overlayed later.
  851. // - Otherwise, expands to a pointer to the whole data
  852. //
  853. ////////////////////////////////////////////////////////////////////////////////
  854. #ifdef OLE_PROPS
  855. #include "UserPrpI.h"
  856. // Use the real Vtbl for OLE objects
  857. #define UDPVTBLSTRUCT struct IUserDef
  858. // For OLE objects, first param is pointer to interface class
  859. #define LPUDOBJ IUserDef FAR *
  860. #ifdef __cplusplus
  861. extern TEXT("C") {
  862. #endif // __cplusplus
  863. // Must support IUnknown methods for OLE objects....
  864. HRESULT OFC_CALLTYPE HrUserDefQueryInterface (IUnknown FAR *,
  865. REFIID riid,
  866. LPVOID FAR* ppvObj);
  867. ULONG OFC_CALLTYPE UlUserDefAddRef (IUnknown FAR *);
  868. ULONG OFC_CALLTYPE UlUserDefRelease (IUnkown FAR *);
  869. #ifdef __cplusplus
  870. }; // extern "C"
  871. #endif // __cplusplus
  872. #else // !OLE_PROPS
  873. // Create a placeholder Vtbl for non-OLE objects.
  874. #define UDPVTBLSTRUCT struct _UDPVTBLSTRUCT { void FAR *lpVtbl; } UDPVTBLSTRUCT
  875. // For non-OLE objects, first param is pointer to real data.
  876. #define LPUDOBJ LPUSERPROP
  877. #endif // OLE_PROPS
  878. // User-defined property data. Callers should *never* access this
  879. // data directly, always use the supplied API's.
  880. typedef struct _USERPROP {
  881. UDPVTBLSTRUCT; // Vtbl goes here for OLE objs,
  882. // Must be here for overlays to work!
  883. BOOL m_fObjChanged; // Indicates the object has changed
  884. ULONG m_ulRefCount; // Reference count
  885. LPVOID m_lpData; // Pointer to the real data
  886. HPROPSHEETPAGE m_hPage; // Handle of property page.
  887. } USERPROP, FAR * LPUSERPROP;
  888. //
  889. // Interface API's for User Property Information.
  890. //
  891. #ifdef __cplusplus
  892. extern TEXT("C") {
  893. #endif
  894. //
  895. // Standard I/O routines
  896. //
  897. // Indicates if the data has changed, meaning a write is needed.
  898. BOOL OFC_CALLTYPE FUserDefShouldSave (LPUDOBJ lpUDObj);
  899. //
  900. // Routines to query and modify data.
  901. //
  902. //
  903. // How User-defined properties work:
  904. //
  905. // See the OLE Property Exchange spec for full details.
  906. //
  907. // Each User-defined type has a string "Name" and integer Property Id
  908. // value associated with it. The Property Id's are sequential, but
  909. // are only good for the current object in memory (i.e. you can't count
  910. // on the Property Id value remaining the same between loads of the
  911. // data. The string will remain the same, if it has not been changed
  912. // or deleted.)
  913. // Currently, the User-defined types can have 5 types for the value:
  914. // String, Date, Integer, float and boolean. When setting and getting the values, you
  915. // must make sure that the type stored matches what you expect to
  916. // retreive. For Int's, the LPVOID should be the int itself, not
  917. // a pointer. In all other cases, the LPVOID should point to a buffer
  918. // of appropriate size for the type.
  919. //
  920. // Masks used for querying property data. Note that these are
  921. // mutually exclusive.
  922. #define UD_STATIC 0x00
  923. #define UD_LINK 0x01
  924. // Returns the type of the given Property Value from the string
  925. // Returns wUDInvalid on error
  926. UDTYPES OFC_CALLTYPE UdtypesUserDefType (LPUDOBJ lpUDObj, LPTSTR lpsz);
  927. // This will return the Property Value for the given Property string.
  928. // lpszProp is the property string
  929. // lpv is a buffer to hold the value, of size cbMax.
  930. // pfLink tells if the value is a link,
  931. // pfIMoniker tells if the value is a moniker.
  932. // pfLinkInvalid tells if the link is invalid
  933. // dwMask is used to specify whether the value returned is the
  934. // static value, link name or IMoniker name.
  935. // Function returns NULL on error.
  936. // WARNING! Be very careful calling this. Be sure that the
  937. // buffer and return value match the type for the Property Value!
  938. LPVOID OFC_CALLTYPE LpvoidUserDefGetPropVal (LPUDOBJ lpUDObj,
  939. LPTSTR lpszProp,
  940. DWORD dwMask,
  941. BOOL *pfLink,
  942. BOOL *pfLinkInvalid);
  943. // This acts exactly as the above routine (LpvoidUserDefGetPropVal),
  944. // except that it returns the value in the forma of a PropVariant.
  945. LPPROPVARIANT OFC_CALLTYPE LppropvarUserDefGetPropVal
  946. (LPUDOBJ lpUDObj,
  947. LPTSTR lpszProp,
  948. BOOL *pfLink,
  949. BOOL *pfLinkInvalid);
  950. // Set the value of a given property to a new value.
  951. // Be careful when setting properties that are linked - be sure
  952. // that the type the iterator is set to matches what the link is to.
  953. // If udtype == wUDinvalid, the type of the iterator will not change,
  954. // the value will be assumed to be the current type.
  955. //
  956. // fLinkInvalid : If the link is no longer valid, set this flag to true.
  957. // A special icon will displayed in the listview and the last
  958. // known value and type will be used. Thus the values passed
  959. // to this function will be ignored in this case.
  960. //
  961. // If fLinkInvalid is true, but the iterator is not a link,
  962. // the function will return FALSE
  963. //
  964. // If fLinkInvalid is true the value will _not_ be changed.
  965. //
  966. // NOTE: If udtype == wUDDate you can set the value to 0 (not NULL)
  967. // This will be interpreted as an invalid date and the date will
  968. // be displayed as the empty string in the list box.
  969. BOOL OFC_CALLTYPE FUserDefChangeVal (LPUDOBJ lpUDObj,
  970. LPTSTR lpszProp,
  971. UDTYPES udtype,
  972. LPVOID lpv,
  973. BOOL fLinkInvalid);
  974. //
  975. // Routines to create and remove data from the Property Set.
  976. //
  977. // This will add a new Property to the set, with the given
  978. // Property string. This function can also be used to modify
  979. // an existing property.
  980. //
  981. // lpUDObj - pointer to the UD properties
  982. // lpszPropName - name of property to be added/modified
  983. // lpvVal - value of the property
  984. // udtype - value type
  985. // lpszLinkMonik - name of the link/moniker
  986. // fLink - true if the property is a link
  987. // fHidden - true if the property is hidden
  988. //
  989. // NOTE: If udtype == wUDbool, lpv must point to a DWORD, but the
  990. // HIWORD must be 0.
  991. //
  992. // WARNING: Be sure that the type matches what the lpv really is!
  993. //
  994. // The caller is responsible for freeing any memory
  995. // associated with a property value after it is added to the
  996. // User-defined Property object.
  997. //
  998. // NOTE: If udtype == wUDDate you can set the value to 0 (not NULL)
  999. // This will be interpreted as an invalid date and the date will
  1000. // be displayed as the empty string in the list box.
  1001. //
  1002. // The function returns a pointer to the PropVariant created for this
  1003. // new value, or NULL if there is an error.
  1004. //
  1005. LPPROPVARIANT OFC_CALLTYPE LppropvarUserDefAddProp
  1006. (LPUDOBJ lpUDObj,
  1007. LPTSTR lpszPropName,
  1008. LPVOID lpvVal,
  1009. UDTYPES udtype,
  1010. LPTSTR lpszLinkMonik,
  1011. BOOL fLink,
  1012. BOOL fHidden);
  1013. // This will delete a Property from the set given a Property string.
  1014. BOOL OFC_CALLTYPE FUserDefDeleteProp (LPUDOBJ lpUDObj, LPTSTR lpsz);
  1015. //
  1016. // Routines to iterate through the User-defined properties
  1017. //
  1018. // Notes: Adding and deleting elements invalidates the iterator.
  1019. //
  1020. // An iterator for User-defined Properties
  1021. typedef struct _UDITER FAR * LPUDITER;
  1022. // Create a User-defined Properties iterator
  1023. LPUDITER OFC_CALLTYPE LpudiUserDefCreateIterator (LPUDOBJ lpUDObj);
  1024. // Destroy a User-defined Properties iterator
  1025. BOOL OFC_CALLTYPE FUserDefDestroyIterator (LPUDITER *lplpUDIter);
  1026. // Determine if an iterator is still valid
  1027. BOOL OFC_CALLTYPE FUserDefIteratorValid (LPUDITER lpUDIter);
  1028. // Iterate to the next element
  1029. // Returns TRUE if we could get to the next element, FALSE otherwise.
  1030. BOOL OFC_CALLTYPE FUserDefIteratorNext (LPUDITER lpUDIter);
  1031. // Returns true if the iterator is a link, false otherwise
  1032. DLLEXPORT BOOL OFC_CALLTYPE FUserDefIteratorIsLink (LPUDITER lpUDIter);
  1033. // This will return the Property Value for the given iterator
  1034. // lpv is a buffer to hold the value, of size cbMax.
  1035. // dwMask is used to specify whether the value returned is the
  1036. // static value, link name or IMoniker name.
  1037. // pfLink tells if the value is a link,
  1038. // pfIMoniker tells if the value is a moniker.
  1039. // pfLinkInvalid tells if the link is invalid.
  1040. // Function returns NULL on error.
  1041. // WARNING! Be very careful calling this. Be sure that the
  1042. // buffer and return value match the type for the Property Value!
  1043. LPPROPVARIANT OFC_CALLTYPE LppropvarUserDefGetIteratorVal
  1044. (LPUDITER lpUDIter,
  1045. BOOL *pfLink,
  1046. BOOL *pfLinkInvalid );
  1047. // This will return the Property String (name) for the property
  1048. LPTSTR OFC_CALLTYPE LpszUserDefIteratorName (LPUDITER lpUDIter);
  1049. //
  1050. // Misc. utility routines
  1051. //
  1052. // Routines dealing with hidden Properties.
  1053. // Hide a Property based on the Property string.
  1054. BOOL OFC_CALLTYPE FUserDefMakeHidden (LPUDOBJ lpUDObj, LPTSTR lpsz);
  1055. #ifdef __cplusplus
  1056. }; // extern "C"
  1057. #endif
  1058. #ifdef __cplusplus
  1059. extern TEXT("C") {
  1060. #endif
  1061. // Commands for DWQUERYLD
  1062. #define QLD_CLINKS 1 /* Return the number of links */
  1063. #define QLD_LINKNAME 2 /* Return a pointer to the string for index */
  1064. #define QLD_LINKTYPE 3 /* Returns the type of the value of the index */
  1065. #define QLD_LINKVAL 4 /* Return value for the index, use same
  1066. rules as for LPVOIDs in UserDef functions */
  1067. // This functions should respond to the above commands by returning the
  1068. // appropriate value. For commands that require an index, the
  1069. // lpszName parameter will be the Name of the link item previously
  1070. // retrieved from the index, if it is not NULL.
  1071. // lplpvBuf is the buffer supplied by "us" (the dll) to copy the
  1072. // value to. Use the function LpvOfficeCopyValToBuffer() to
  1073. // copy the data. This parameter will be NULL for QLD_CLINKS and
  1074. // QLD_VALTYPE
  1075. typedef DWORD_PTR (OFC_CALLBACK *DWQUERYLD)(DWORD dwCommand, DWORD dwi, LPVOID *lplpvBuf, LPTSTR lpszName);
  1076. // Masks for different options
  1077. #define OSPD_ALLOWLINKS 0x1 // The Custom dialog will allow fields to be linked if this is set.
  1078. #define OSPD_NOSAVEPREVIEW 0x2 // Don't show the Save Preview Picture checkbox
  1079. #define OSPD_SAVEPREVIEW_ON 0x4 // Save Preview Picture should be on by default
  1080. // LPUDObj is a pointer to a pointer to a user-defined property object.
  1081. // If *lplpUDObj == NULL, an object will be created by the dialog as needed.
  1082. // Note that the object will use the same malloc & free routines as
  1083. // the lpSIObj uses.
  1084. //
  1085. // lpszFileName is the fully qualified name of the storage as it appears
  1086. // in the filesystem. This can be NULL if no file exists.
  1087. //
  1088. // dwMask contains either 0 or a set of valid flags for various options.
  1089. //
  1090. // LPFN_DWQLD is a callback, that when given a dwCommand of 0
  1091. // returns the number of links, and for any other number 0 < NumLinks,
  1092. // places the link data & static value in the lpld buffer and returns non-0
  1093. // if the function succeeded.
  1094. //
  1095. // The storage for the buffer is to be allocated by the app, and a pointer
  1096. // to that storage passed back.
  1097. //
  1098. // pptCtr - POINT struct filled with the coordinates of the center
  1099. // of the dialog. Used to make sure we are using sticky
  1100. // dialog coordinates. If pPoint->x == -1, we ignore and use
  1101. // the default position for the dialog.
  1102. //
  1103. // pptCtr will be filled with the coordinates of the new position
  1104. // of the dialog on returning.
  1105. //
  1106. // The coordinates should be in client area coordinates, i.e. in
  1107. // hWndParent coordinates.
  1108. //
  1109. // lpszCaption - caption for the dialog. This should be the filename as it is
  1110. // displayed in the apps document title bar.
  1111. // The properties dialog caption will be as follows:
  1112. //
  1113. // <foo> Properties
  1114. //
  1115. // where foo is the string pointed to by lpszCaption.
  1116. //
  1117. // The function returns TRUE on success, FALSE on error or if the user hit Cancel.
  1118. //
  1119. // Note: It's the caller's resposibility to invalidate any links (if appropriate)
  1120. // before calling this function.
  1121. //
  1122. // Note: If lpfnDwQueryLinkData is NULL, the caller must invalidate any linked properties.
  1123. //
  1124. BOOL OFC_CALLTYPE FOfficeShowPropDlg (HWND hWndParent,
  1125. LPTSTR lpszFileName,
  1126. LPSIOBJ lpSIObj,
  1127. LPDSIOBJ lpDSIObj,
  1128. LPUDOBJ FAR *lplpUDObj,
  1129. DWORD dwMask,
  1130. DWQUERYLD lpfnDwQueryLinkData,
  1131. LPPOINT pptCtr,
  1132. LPTSTR lpszCaption);
  1133. // Creates and initializes all non-NULL objects.
  1134. // Create the object and return it. Caller responsible for destruction.
  1135. //
  1136. // rglpfn is an array, with the following callbacks supplied by the user:
  1137. //
  1138. // Code Page Conversion
  1139. //
  1140. // rglpfn[ifnCPConvert] = (BOOL) (OFC_CALLBACK *lpfnFCPConvert) (LPSTR lpsz,
  1141. // DWORD dwFrom,
  1142. // DWORD dwTo,
  1143. // BOOL fMacintosh)
  1144. // lpsz is a 0 terminated C string, dwFrom is the code page
  1145. // lpsz is currently stored as, dwTo is the code page it should
  1146. // be converted to, fMacintosh indicates whether dwFrom is a Mac
  1147. // or Windows code page identifier.
  1148. //
  1149. // Convert an sz to a double
  1150. //
  1151. // rglpfn[ifnFSzToNum] = (BOOL) (OFC_CALLBACK *lpfnFSzToNum)(
  1152. // double *lpdbl,
  1153. // LPSTR lpszNum)
  1154. //
  1155. // lpdbl - pointer to a double, this is set by the app
  1156. // lpszNum - zero-terminated string representing the number
  1157. //
  1158. // Convert a double to an sz
  1159. //
  1160. // rglpfn[ifnFNumToSz] = (BOOL) (OFC_CALLBACK *lpfnFNumToSz)(
  1161. // double *lpdbl,
  1162. // LPSTR lpszNum,
  1163. // DWORD cbMax)
  1164. // lpdbl - pointer to a double
  1165. // lpszNum - on return a zero-terminated string representing the number
  1166. // cbMax - Max number of bytes in lpszNum
  1167. //
  1168. // Update the statistics on the Statistics tab
  1169. //
  1170. // rglpfn[ifnFUpdateStats] = (BOOL) (OFC_CALLBACK *lpfnFUpdateStats)(
  1171. // HWND hwndParent,
  1172. // LPSIOBJ lpSIObj,
  1173. // LPDSIOBJ lpDSIObj)
  1174. //
  1175. // hwndParent - window of the properties dialog, so that the app
  1176. // can put up an alert, letting the user know the the
  1177. // data is being updated.
  1178. //
  1179. // lpSIObj, lpDSIObj - objects to update
  1180. //
  1181. // Note: If the app does not want to set the statistics before bringing up
  1182. // the dialog, they can provide this callback function. If the
  1183. // function pointer is not NULL, the function will be called the first
  1184. // time the user clicks on the Statistics tab. The app should then update
  1185. // all appropriate statistics for the tab and return TRUE on success, FALSE
  1186. // on failure. If the function pointer is NULL, the existing data will be
  1187. // used.
  1188. //
  1189. // Note:
  1190. // Only rglpfn[ifnCPConvert] must be non-NULL. If it is NULL, the
  1191. // function will return FALSE, and the objects will not be created.
  1192. //
  1193. // rglpfn[ifnFSzToNum] and rglpfn[ifnFNumToSz] must either both be
  1194. // non-NULL, or NULL. Otherwise, the function will return FALSE, and
  1195. // the objects will not be created. If both functions are NULL, there
  1196. // will be no floating point support in OLE Extended Properties (i.e. on
  1197. // the Custom tab), but integers will be supported.
  1198. //
  1199. BOOL OFC_CALLTYPE FOfficeCreateAndInitObjects (LPSIOBJ *lplpSIObj,
  1200. LPDSIOBJ *lplpDSIObj,
  1201. LPUDOBJ *lplpUDObj);
  1202. // Clear any non-null objects
  1203. BOOL OFC_CALLTYPE FOfficeClearObjects (LPSIOBJ lpSIObj,
  1204. LPDSIOBJ lpDSIObj,
  1205. LPUDOBJ lpUDObj);
  1206. // Destroy any non-null objects
  1207. BOOL OFC_CALLTYPE FOfficeDestroyObjects (LPSIOBJ *lplpSIObj,
  1208. LPDSIOBJ *lplpDSIObj,
  1209. LPUDOBJ *lplpUDObj);
  1210. // Use these functions to set the dirty flag of the given object.
  1211. // Note: It's the caller's responsibility to make sure that the
  1212. // object is non-NULL
  1213. VOID OFC_CALLTYPE OfficeDirtyUDObj(LPUDOBJ lpUDObj, BOOL fDirty);
  1214. // Flags for Load & Save
  1215. #define OIO_ANSI 0x0001 // The storage is an ANSI storage (UNICODE is the default)
  1216. #define OIO_SAVEIFCHANGEONLY 0x0002 // Only streams that are dirty should be saved.
  1217. #define OIO_SAVESIMPLEDOCFILE 0x0004 // The storage is a simple DOC file.
  1218. // Populate the objects with data. lpStg is the root stream.
  1219. // Returns the number of streams loaded.
  1220. // dwFlags: OIO_ANSI specifies that lpStg is an ANSI storage (UNICODE is the default)
  1221. //
  1222. // The function returns the following:
  1223. //
  1224. #define MSO_IO_ERROR 0 // The stream(s) were found, but the load failed
  1225. #define MSO_IO_NOSTM 1 // The stream(s) were not found
  1226. #define MSO_IO_SUCCESS 2 // The stream(s) were found, and the load succeeded
  1227. //
  1228. // NOTE: The caller can load either the summary info stream (lpSIObj != NULL), or
  1229. // the Document Summary Info stream (lpDSIObj != NULL && lpUDObj != NULL) or
  1230. // both.
  1231. //
  1232. // NOTE: If the caller asks to load both streams, MSO_IO_NOSTM will not be returned, as
  1233. // long as one of the streams exists.
  1234. DWORD OFC_CALLTYPE DwOfficeLoadProperties (LPSTORAGE lpStg,
  1235. LPSIOBJ lpSIObj,
  1236. LPDSIOBJ lpDSIObj,
  1237. LPUDOBJ lpUDObj,
  1238. DWORD dwFlags,
  1239. DWORD grfMode);
  1240. // Write the data in the given objects. lpStg is the root stream.
  1241. // Returns the number of streams saved.
  1242. // dwFlags: OIO_ANSI specifies that lpStg is an ANSI storage (UNICODE is the default)
  1243. //
  1244. // OIO_SAVEIFCHANGEONLY specificies that only streams that are
  1245. // "dirty" will be saved. Do NOT specify this if you are
  1246. // saving to a tmp file. Also do not attempt to "outsmart"
  1247. // the save by passing NULL objects, use this flag instead.
  1248. //
  1249. // OIO_SAVESIMPLEDOCFILE specifies that the storage is a simple DOC file.
  1250. //
  1251. DWORD OFC_CALLTYPE DwOfficeSaveProperties (LPSTORAGE lpStg,
  1252. LPSIOBJ lpSIObj,
  1253. LPDSIOBJ lpDSIObj,
  1254. LPUDOBJ lpUDObj,
  1255. DWORD dwFlags,
  1256. DWORD grfStgMode);
  1257. ////////////////////////////////////////////////////
  1258. // VB support routines - see spec for details.
  1259. ////////////////////////////////////////////////////
  1260. // Creates a Builtin property collection and returns it.
  1261. // pParent is the parent IDispatch object.
  1262. // The new IDispatch object is returned via pvarg.
  1263. BOOL OFC_CALLTYPE FGetBuiltinPropCollection (LCID lcid,
  1264. LPSIOBJ lpSIObj,
  1265. LPDSIOBJ lpDSIObj,
  1266. IDispatch *pParent,
  1267. VARIANT *pvarg);
  1268. // Creates a Custom property collection and returns it.
  1269. // pParent is the parent IDispatch object.
  1270. // The new IDispatch object is returned via pvarg.
  1271. BOOL OFC_CALLTYPE FGetCustomPropCollection (LCID lcid,
  1272. LPUDOBJ lpUDObj,
  1273. IDispatch *pParent,
  1274. VARIANT *pvarg);
  1275. #ifdef __cplusplus
  1276. }; // extern "C"
  1277. #endif
  1278. /////////////////////////////////////////////////////////////////////////
  1279. // Progress Report Thermometer (PRT) routines and data structure //
  1280. /////////////////////////////////////////////////////////////////////////
  1281. /* Usage:
  1282. 1. Most of the functions are performed asynchronously, which means that
  1283. your call causes a message to be sent to a (low-priority) thread,
  1284. that later performs the operation you requested. This implies that
  1285. you don't really know when the thing your requested is going to happen.
  1286. Thus, you should not touch the status line window until you are
  1287. sure the thread is done painting in it. Since this implies you need
  1288. some synchronization, the EndPRT function (described below) is
  1289. made synchronous--after it returns, you are guaranteed the thread
  1290. will not touch the window until you call StartPRT again.
  1291. All the functions except StartPRT are BOOL--they return TRUE in case of success
  1292. and FALSE in case of failure. StartPRT return NULL in case of failure.
  1293. The kinds of failures that may occur are described below, next to each stub.
  1294. Multiple progress report thermometers can be run in different windows
  1295. at one time.
  1296. 2. A few notes on drawing: the PRT functions do not validate any areas
  1297. of your window, nor do they change any attributes of the Device Context
  1298. for the window that you pass in to StartPRT or they get with GetDC (which
  1299. they do if the hdc you pass in to StartPRT is NULL). So, if you want the
  1300. device context attributes (e.g., font) to other than standard,
  1301. you have to take care of that. UpdatePRT assumes the window has
  1302. been untouched since the last PRT call (i.e., it draws the minimum
  1303. needed). RedrawPRT and StartPRT repaint the whole window.
  1304. 3. The data structure. As there are variables my functions need to share
  1305. and access, and we can't package them into a class (as we are working
  1306. in C, not in C++), for every instance of a progress indicator we
  1307. allocate a data structure in StartPRT, whose pointer will always
  1308. be the first argument UpdatePRT, RedrawPRT and EndPRT.
  1309. The data structure's name is PRT; the application need
  1310. not worry/know about what the data structure contains. All it needs
  1311. to do is save its pointer (of type LPPRT) returned by StartPRT and keep
  1312. it around until calling EndPRT. EndPRT will free it.
  1313. 4. StartPRT. To be called every time you need a new progress report.
  1314. Redraws the window completely, putting eveyrthing needed into it.
  1315. Aside from the pointer to PRT structure, takes:
  1316. 1) HWND hwnd--the handle to the window where the progress report
  1317. needs to appear. UNTIL CALLING EndPRT, THE APPLICATION SHOULD
  1318. NOT TOUCH THIS WINDOW. See RedrawPRT for information on how
  1319. to process WM_PAINT messages to it.
  1320. 2) HDC hdc--optional handle to the window's client area device context, with the
  1321. attributes you want selected into it (you cannot change the text
  1322. background color, because the window has to be all background
  1323. cvBtnFace. All the other attributes can be changed). If it is NULL,
  1324. we will get the DC by GetDC(hwnd) every time we draw and release it when
  1325. done drawing. See also "A Few Notes on Drawing" above.
  1326. 2) WORD nMost--the number of "little things" it has to accomplish.
  1327. Used a scaling factor--i.e., the progress report tells the user
  1328. that nDone/nMost things are done. The user will not have
  1329. any idea what nMost is, since the ratio nDone/nMost is all
  1330. that is reflected in the indicator. E.g., if the application has
  1331. 37 disk blocks to write (assuming every write takes about the
  1332. same time), nMost should be 37.
  1333. 3) lpszTitle. A string, to appear as a title to the left of the
  1334. progress indicator. E.g., "Saving the data:" Note that the string
  1335. has to remain unchanged and readable until the call to EndPRT for
  1336. that instance.
  1337. 4) WORD nFrame -- This is a bitfield that indicates which sides of the
  1338. status bar should be painted with a 3D style side. Use the PRT_FRAME_?
  1339. macros to select the side. Use PRT_FRAM_HIDE to do not want a fram. Use
  1340. PRT_FRAME_SHOW if you want a complete frame around the status bar. Note
  1341. that you want to use PRT_FRAME_TOP if you are displaying the status
  1342. barat the bottom of the window, because the window border itself will
  1343. provide the left, right and bottom side of the status bar.
  1344. Returns the pointer to the new prt data structure
  1345. (see "The Data Structure" above).
  1346. Fails and returns NULL if:
  1347. 1) Cannot allocate the new data structure.
  1348. 2) For some strange reason synchronization failed or it was not able
  1349. to communicate to the thread.
  1350. 5. UpdatePRT. To be called whenever you've made some progress. Aside
  1351. from the pointer to PRT structure, takes one argument--WORD nDone,
  1352. which is to indicate how much you accomplished. In order for
  1353. things to work well, nDone should be not greater than nMost and
  1354. at least as big as nDone with which you previously called us
  1355. (after all, we are a progress indicator, not a regress indicator).
  1356. If nDone is greater than nMost, it will force nDone to equal nMost,
  1357. i.e., simply fill up the indicator to its capacity.
  1358. Assumes the window hasn't been touched since the last PRT call--i.e.,
  1359. draws the minimum needed to indicate the change.
  1360. Returns FALSE if:
  1361. 1) The pointer to the PRT was not writeable.
  1362. 2) it had trouble communicating with the thread.
  1363. 6. RedrawPRT. To be called whenever you need the window repainted
  1364. (remember, the application is not allowed to touch the window),
  1365. i.e., whenever you get the WM_PAINT message for that window. Make
  1366. sure to validate the rectangle by calling BeginPaint--EndPaint before
  1367. that (otherwise you will keep getting WM_PAINT messages RedrawPRT
  1368. doesn't validate anything). Redraws the entire window--the little
  1369. white line on top, the title and the thermometer. Takes no arguments
  1370. other than the pointer to PRT.
  1371. Returns FALSE if:
  1372. 1) The pointer to the PRT was not writeable.
  1373. 2) it had trouble communicating with the thread.
  1374. 7. AdjustPRT. To be called when either one of the input parameters of
  1375. StartPRT are to be changed, i.e. the title, the hdc, and/or the
  1376. progress extent (nMost). Use zero or NULL to keep the existing
  1377. value, e.g. AdjustPRT(lpprt, NULL, 0, "xyz") will only change the
  1378. title. Note that this api will only change the internal state of
  1379. the progress bar. A call to RedrawPRT() or UpdatePRT() may be
  1380. needed to updated the screen, depending on the input parameters:
  1381. 1) Title and HDC: RedrawPRT() must be called to force the change
  1382. to be updated on the screen.
  1383. 2) nMost: RedrawPRT() is not needed, as the next call to UpdatePRT()
  1384. will use the new value. Note that changing this value will not
  1385. result in that a fewer number of boxes is painted when UpdatePRT() is
  1386. called, even if nMost is increased. Use RedrawPRT() to completely redraw
  1387. the progress bar with the correct (possibly shortened) length.
  1388. 8. EndPRT. To be called when you don't want the progress report any more,
  1389. and need to draw in the window. Is the only
  1390. synchronous procedure--doesn't return until it is sure the thread
  1391. will not touch the window any more. Thus, you might have to wait
  1392. a little bit for the thread to finish painting. But, if it
  1393. succeeded, you are guaranteed that the thread will not mess with the
  1394. window any more.
  1395. Takes no arguments other than the pointer to PRT. Frees that pointer.
  1396. Returns FALSE if:
  1397. 1) The pointer to the PRT was not writeable.
  1398. 2) It has trouble communticating with the thread, or if it had to wait
  1399. for the thread to finish painting for more than PRT_WAIT_TIMEOUT
  1400. milliseconds (in which case it gives up waiting). You are NOT
  1401. guaranteed that the thread will not touch your window if EndPRT
  1402. returned FALSE.
  1403. */
  1404. /* Data structure where PRT stores its info */
  1405. typedef struct tagPRT * LPPRT;
  1406. #define PRT_FRAME_LEFT 0x01
  1407. #define PRT_FRAME_RIGHT 0x02
  1408. #define PRT_FRAME_TOP 0x04
  1409. #define PRT_FRAME_BOTTOM 0x08
  1410. #define PRT_FRAME_HIDE 0x00
  1411. #define PRT_FRAME_SHOW (PRT_FRAME_LEFT|PRT_FRAME_TOP|PRT_FRAME_RIGHT|PRT_FRAME_BOTTOM)
  1412. #ifdef __cplusplus
  1413. extern TEXT("C") {
  1414. #endif
  1415. LPPRT OFC_CALLTYPE StartPRT(HWND hwnd, HDC hdc,
  1416. const DWORD nMost,
  1417. LPCTSTR lpszTitle,
  1418. const WORD nFrame);
  1419. BOOL OFC_CALLTYPE UpdatePRT(LPPRT lpprt, const DWORD nDone);
  1420. BOOL OFC_CALLTYPE RedrawPRT(LPPRT lpprt);
  1421. BOOL OFC_CALLTYPE AdjustPRT(LPPRT lprrt, HDC hdc,
  1422. const DWORD nMost,
  1423. LPCTSTR lpszTitle,
  1424. const WORD nFrame);
  1425. BOOL OFC_CALLTYPE EndPRT(LPPRT lpprt);
  1426. #ifdef __cplusplus
  1427. }; //Extern "C"
  1428. #endif
  1429. //-------------------------------------------------------------------------
  1430. // Below are the comments for the stylized title bar funcitons
  1431. //
  1432. // 1. SetTitleBar:
  1433. // Initializes the stylized title bar or turns it off.
  1434. //
  1435. // Parameters:
  1436. // hwnd--the window for which you want the stylized title bar on/off.
  1437. // This window has to have the standard for overlapped window
  1438. // border, caption, system menu, and the minimize/maximize/kill
  1439. // buttons on the right of the title bar.
  1440. //
  1441. // fStylized--TRUE if you want the stylized title bar on, FALSE if you
  1442. // want it off.
  1443. //
  1444. // Return value: TRUE on success, FALSE on failure.
  1445. //
  1446. // NOTES:
  1447. // You should evenutally turn the stylized title bar off for every
  1448. // window for which it was turned on. If the window receives the
  1449. // WM_DESTROY message, and after the original window procedure's
  1450. // processing of that message the stylized title bar is still on,
  1451. // the title bar will be turned off by the title bar window procedure.
  1452. // This is done to make sure we re-claim the memory. However, you should
  1453. // rather do it yourself. Read the next paragraph.
  1454. //
  1455. // This function subclasses the window procedure for hwnd when turning on
  1456. // the stylized title bar, and unsubclasses it when turning it off.
  1457. // You want to make sure that unsubclassing takes place in the opposite
  1458. // order than subclassing. Do it yourself--then you are safer.
  1459. //
  1460. // Do NOT free the office dll until the title bar is turned off!
  1461. //
  1462. // Error handling: if, at any point, the stylized title bar can not be
  1463. // successfully drawn, the standard system title bar will be drawn
  1464. // instead.
  1465. //
  1466. // 2. SetTitleBarMDI():
  1467. // This api should be used by standard MDI applications instead of
  1468. // SetTitleBar(). Word and Excel would _not_ use it for example, since
  1469. // they have implemented their own MDI support (heck, they invented it
  1470. // in the first place).
  1471. //
  1472. // Note that this API must be called _after_ the MDI client window has
  1473. // been created. It is used just like SetTitleBar() in all other respects.
  1474. //
  1475. // 3. MsoSetNCAWParam():
  1476. // This api is used by Word to accomplish the impossible - to make their
  1477. // main window look active while it is not (Word is bringing up pop-up
  1478. // dialogs that are now owned by the top-level window, which of course
  1479. // causes the main window to be in-active). Note that this is relying on
  1480. // a side effect in the system and may or may not work in future (or
  1481. // other) versions of Windows (a mega hack in other words.. ;-).
  1482. //-----------------------------------------------------------------------------
  1483. #ifdef __cplusplus
  1484. extern TEXT("C") {
  1485. #endif
  1486. BOOL OFC_CALLTYPE SetTitleBar(HWND hwnd, BOOL fStylized);
  1487. BOOL OFC_CALLTYPE SetTitleBarMDI(HWND hwnd,
  1488. HWND hwndMDIClient,
  1489. BOOL fStylized);
  1490. VOID OFC_CALLTYPE MsoSetNCAWParam(WPARAM wParam);
  1491. #ifdef __cplusplus
  1492. }; // Extern "C"
  1493. #endif
  1494. /*---------------------------------------------------------------
  1495. AUTOCORRECT STUFF
  1496. ----------------------------------------------------------------*/
  1497. #ifdef __cplusplus
  1498. extern TEXT("C") {
  1499. #endif // __cplusplus
  1500. typedef VOID (OFC_CALLBACK *VRECORDVAR)(BOOL fInitCap, BOOL fCapDays, BOOL fReplaceText);
  1501. typedef VOID (OFC_CALLBACK *VRECORDREPL)(int, TCHAR rgSrc[], TCHAR rgDst[]);
  1502. typedef VOID (OFC_CALLBACK *VACADJUST)(int isz, int disz);
  1503. // Values passed in pfnRecordRepl (callback of OFCInitAutoCorrect) when ACXcept
  1504. #define rgchACXAdd ((TCHAR *) -1)
  1505. #define rgchACXDelete ((TCHAR *) -2)
  1506. // Initialize AutoCorrect
  1507. LPVOID OFC_CALLTYPE OFCInitAutoCorrect(VRECORDVAR pfnRecordVar, VRECORDREPL pfnRecordRepl, int fFullServices, VACADJUST pfnACAdjust);
  1508. // Free all AutoCorrect structures (call on exiting)
  1509. VOID OFC_CALLTYPE OFCFreeAutoCorrect(void);
  1510. // Get pointers to original AC and ACX buffers read from Registry
  1511. BOOL FOFCGetAutoCorrectBuffers(TCHAR FAR * FAR *pchAC, TCHAR FAR * FAR *pchACX, DWORD FAR *pcb);
  1512. // Check for AutoCorrection of character ch
  1513. // returns: True if there is a correction in pchTo, False if no autocorrection
  1514. // ch should already be in the buffer when this is called
  1515. BOOL OFC_CALLTYPE FOFCAutoCorrect(TCHAR FAR *hpchBuffer, long cchHpch, DWORD ch, TCHAR pchTo[], long *pcchTo, long *pcchSelection);
  1516. int OFC_CALLTYPE CchOFCAutoCorrectString(TCHAR FAR *hpch, long cchHpch, int ichReplaceStart, TCHAR FAR *hpchBuf, long cchBuf);
  1517. int OFC_CALLTYPE IOFCTriggerFromXchXch(int xch1, int xch2);
  1518. // Return the count of items in the ReplacementList
  1519. long OFC_CALLTYPE OFCAutoCorrectListCount(void);
  1520. // Get item i from ReplacementList
  1521. // fTrue=success, fFalse means invalid i
  1522. BOOL OFC_CALLTYPE FOFCGetAutoCorrectItemSz(long i, TCHAR szFrom[], long cchFrom, TCHAR szTo[], long cchTo);
  1523. // Add a replacement
  1524. BOOL OFC_CALLTYPE FOFCAddAutoCorrection(TCHAR FAR *hpchFrom, long cchFrom, TCHAR FAR *hpchTo, long cchTo, short grfac, int *pi);
  1525. // Flags for Shared Office AutoCorrect bit mask grfac
  1526. #define facACTextRepl 0x0000 // Regular AC repl
  1527. #define facACX 0x0001 // AC Exception
  1528. #define facACStatic 0x1000 // Do not free storage
  1529. #define facACStaticTextRepl (facACTextRepl|facACStatic)
  1530. #define facACStaticACX (facACX|facACStatic)
  1531. // Delete replacement i
  1532. // fTrue=success, fFalse means invalid i
  1533. BOOL OFC_CALLTYPE FOFCDeleteAutoCorrection(long i);
  1534. // Add new AutoCorrect Exception (ACX)
  1535. BOOL OFC_CALLTYPE FOFCAddACXception(int iacx, TCHAR *pch, int cch,
  1536. short grfac);
  1537. // Return the index for the AutoCorrect Exception (ACX)
  1538. BOOL OFC_CALLTYPE FOFCLookupACXception(int iacx, TCHAR *pch, int cch,
  1539. int *pisz);
  1540. // Delete existing AutoCorrect Exception (ACX)
  1541. BOOL OFC_CALLTYPE FOFCDeleteACXception(int isz);
  1542. // Get AutoCorrect settings
  1543. VOID OFC_CALLTYPE OFCGetAutoCorrectVars(BOOL *pfInitCap, BOOL *pfCapDays, BOOL *pfReplaceText);
  1544. // Set AutoCorrect settings
  1545. VOID OFC_CALLTYPE OFCSetAutoCorrectVars(BOOL fInitCap, BOOL fCapDays, BOOL fReplaceText);
  1546. // Find a Replacement and return in i
  1547. // fTrue=found replacement, fFalse means couldn't find the replacement
  1548. BOOL OFC_CALLTYPE FOFCLookupAutoCorrectReplacement(TCHAR rgchFrom[], long cchFrom, long *pi);
  1549. typedef struct _AUTOCORRDLGARG {
  1550. HWND hwndParent; // Parent window of dialog
  1551. LPPOINT pptCtr; // Center point of dialog
  1552. } AUTOCORRDLGARG, FAR * PAUTOCORRDLGARG;
  1553. // Bring up the Auto Correct dialog
  1554. BOOL OFC_CALLTYPE FOFCAutoCorrectDlg(PAUTOCORRDLGARG pArgs);
  1555. // Save the Auto Correct settings to the registry.
  1556. // Should only be called after programmatic changes.
  1557. VOID OFC_CALLTYPE OFCSaveAutoCorrectSettings(void);
  1558. // Synchronize the Auto Correct settings to the Registry.
  1559. // Can be callled even if no programatic changes.
  1560. VOID OFC_CALLTYPE OFCSyncAutoCorrectSettings(void);
  1561. #ifdef __cplusplus
  1562. }; // extern "C"
  1563. #endif // __cplusplus
  1564. /*-------------------------------------------------------------------------
  1565. POST DOCUMENT Functions
  1566. --------------------------------------------------------------------------*/
  1567. #ifdef __cplusplus
  1568. extern TEXT("C") {
  1569. #endif // __cplusplus
  1570. // Mail Systems
  1571. #define OFC_MSEXCHANGE 1 // Microsoft Exchange
  1572. #define OFC_16_BIT_NOTES 2 // 16 bit Lotus Notes
  1573. // Function: FOFCMailSystemInstalled
  1574. //
  1575. // Purpose: Detects if a Mail system is installed
  1576. //
  1577. // Input: dwSystem - one of the Mail Systems constants
  1578. //
  1579. // Returns: True if the system is installed, FALSE otherwise
  1580. //
  1581. // NOTE: DO NOT CALL THIS FUNCTION TO FIGURE OUT IF APP CAN POST DOCUMENTS.
  1582. // CALL DwOFCCanPostDoc INSTEAD.
  1583. //
  1584. BOOL OFC_CALLTYPE FOFCMailSystemInstalled(DWORD dwSystem);
  1585. // Function: DwOFCCanPostDoc
  1586. //
  1587. // Purpose: Check if Post Doc support can be added.
  1588. //
  1589. // Parameters: None.
  1590. //
  1591. // The function returns:
  1592. #define OFC_NO_POSTDOC 0 // No Post Doc support
  1593. #define OFC_EMS_POSTDOC 1 // EMS Post Doc support
  1594. #define OFC_NOTES16_POSTDOC 2 // 16 Bit Notes Post Doc support
  1595. // NOTE: All other values are reserved for current and future use
  1596. //
  1597. DWORD OFC_CALLTYPE DwOFCCanPostDoc();
  1598. // Function: DwOFCPostDoc.
  1599. //
  1600. // Purpose: Posts the document to either EMS or Notes.
  1601. //
  1602. // Parameters:
  1603. //
  1604. // pszFilename - points to a file on disk to be posted,
  1605. // i.e. a temporary copy of the file in memory.
  1606. //
  1607. // pszClassName - Class name of the document (E.g. Word.Document.6). This can be NULL.
  1608. // If NULL, the message icon will be a generic document icon.
  1609. //
  1610. // lpSIObj, lpDSIObj, lpUDObj - contains all the extended properties. These can be
  1611. // the pointers stored in memory since they should con-
  1612. // tain the same info as in the file on disk.
  1613. //
  1614. //
  1615. // pszMessSubj - This will be the subject of the message as it appears in the folder.
  1616. // This should be the real filename, i.e. foo.ext. The file extension
  1617. // should be correct, i.e. .XLS, .DOC, .PPT, .MDB, etc. The reason is that
  1618. // the filename is used to look up the correct icon via the registry.
  1619. // This can be a long filename.
  1620. //
  1621. // !!! NOTE: THE NEXT 2 PARAMETERS ARE IGNORED. APP CAN PASS WHATEVER THEY WANT. !!!
  1622. // pszRecording - the name of the selected database will be copied into this buffer.
  1623. // Caller can use this for recording.
  1624. //
  1625. // cbRecMax - number o' bytes in pszRecording.
  1626. //
  1627. // !!! END O' IGNORANCE !!!
  1628. //
  1629. // lhSession - it is the caller's responsibility to log in to EMS.
  1630. // If lhSession is 0 (invalid session), DwOFCPostDoc will return an error.
  1631. // lhSession will be typecast to a LPMAPISESSION pointer.
  1632. //
  1633. // NOTE: - the session handle should be an Extended MAPI session handle.
  1634. //
  1635. // NOTE: - at this point we are not posting to Notes.
  1636. //
  1637. // hwndParent - Parent window handle
  1638. //
  1639. // The function returns:
  1640. #define OFC_ERROR 0 // An error occurred, document was not posted
  1641. #define OFC_CANCEL 1 // User cancelled dialog
  1642. #define OFC_SUCCESS 2 // Document was posted successfully
  1643. #define OFC_NO_FOLDERS 3 // No folders were found in the storage.
  1644. #define OFC_NO_STORAGE 4 // There was no public subscription storage
  1645. //
  1646. // OFC_ERROR: Function was called when there was no system detected (neither EMS nor Notes
  1647. // on user's machine).
  1648. // Function was called without first having called DwOFCCanPostDoc.
  1649. // Function was called without first logging onto EMS
  1650. // Mail system calls failed.
  1651. // pszFileName was NULL.
  1652. // pszMessSubj was NULL.
  1653. //
  1654. DWORD OFC_CALLTYPE DwOFCPostDoc(LPTSTR pszFilename, // full path of file on disk to post
  1655. LPTSTR pszAppName, // Name of the application
  1656. LPSIOBJ lpSIObj, // Summary Info object
  1657. LPDSIOBJ lpDSIObj, // Document Summary Info object
  1658. LPUDOBJ lpUDObj, // User Defined properties object
  1659. LPTSTR pszMessSubj, // Message Subject
  1660. LPTSTR pszRecording, // Ignored
  1661. DWORD cbRecMax, // "
  1662. LPVOID lhSession, // Session handle
  1663. HWND hwndParent); // Parent window handle
  1664. // NOTES F/X
  1665. //
  1666. // How to:
  1667. //
  1668. // 1) The app gets a message from Notes to create an OLE 1 object.
  1669. // 2) The app creates the object, and gets a SetData message from Notes.
  1670. // 3) In the SetData function, the app should detect that it's Notes
  1671. // asking.
  1672. // 4) Part of the SetData code should be a call to MsoHLoadPropertiesFromNotes.
  1673. // This function returns a handle that should be stored with the object.
  1674. // 5) When the user either updates or closes the object, the app
  1675. // should call MsoWritePropertiesToNotes passing the handle from step 4.
  1676. // 6) Whenever the user closes an object created in step 2, MsoNotesTerm
  1677. // should be called. The app should then set the stored handle to NULL.
  1678. //
  1679. // NOTES: Notes F/X is not supported on NT.
  1680. //
  1681. // Function: MsoLoadPropertiesFromNotes
  1682. //
  1683. // Purpose: Reads the properties from a Notes record, and stuffs
  1684. // them into the OLE Extended properties
  1685. //
  1686. // Parameters: hclip - handle containing the data passed to the SetData function
  1687. // lpSIObj - pointer to a Summary Info object
  1688. // lpDSIObj - pointer to a Document Summary Info object
  1689. // lpUDObj - pointer to a User Defined object
  1690. //
  1691. // Returns: A handle which the caller must store and use in the call to
  1692. // MsoWritePropertiesToNotes.
  1693. //
  1694. // Note: It's the caller's responsibility to store the returned handle
  1695. // with the appropriate object. I.e. doc 1 and doc 2 will have
  1696. // different handles.
  1697. //
  1698. HANDLE OFC_CALLTYPE MsoHLoadPropertiesFromNotes(HANDLE hclip,
  1699. LPSIOBJ lpSIObj,
  1700. LPDSIOBJ lpDSIObj,
  1701. LPUDOBJ lpUDObj);
  1702. // Function: MsoWritePropertiesToNotes
  1703. //
  1704. // Purpose: Stuffs the OLE Extended properties into a Notes record.
  1705. //
  1706. //
  1707. // Parameters: hNote - handle to a Notes note. This is the handle
  1708. // returned by MsoLoadPropertiesFromNotes
  1709. //
  1710. // lpSIObj - pointer to a Summary Info object
  1711. // lpDSIObj - pointer to a Document Summary Info object
  1712. // lpUDObj - pointer to a User Defined object
  1713. // pszClassName - string containing the document's class name (e.g. Excel.Sheet.5)
  1714. // This can be NULL.
  1715. //
  1716. // Returns: Nuthin'.
  1717. //
  1718. VOID OFC_CALLTYPE MsoWritePropertiesToNotes(HANDLE hNote,
  1719. LPSIOBJ lpSIObj,
  1720. LPDSIOBJ lpDSIObj,
  1721. LPUDOBJ lpUDObj,
  1722. LPTSTR pszClassName);
  1723. // Function: MsoHUpdatePropertiesInNotes
  1724. //
  1725. // Purpose: Update the data in Notes
  1726. //
  1727. // Parameters: hNote - handle to a Notes note. This is the handle
  1728. // returned by MsoLoadPropertiesFromNotes
  1729. //
  1730. // Returns: A handle. The caller must use set the lphandle of the
  1731. // GetData method to point to the returned handle.
  1732. // The returned handle will be NULL on failure.
  1733. //
  1734. // How To: When the user selects File/Update from the OLE Server App. the server's
  1735. // GetData method will be invoked twice; first with cfFormat == cfNative,
  1736. // then with cfFormat set to the appropriate format for displaying the
  1737. // object. Then, once Notes sees that the server is registrered to
  1738. // recognize the RequestDataFormats message, the GetData method will be
  1739. // invoked a third time with cfFormat == NoteshNote. In response, the
  1740. // app should call this function.
  1741. //
  1742. HANDLE OFC_CALLTYPE MsoHUpdatePropertiesInNotes(HANDLE hNote);
  1743. // Function: MsoNotesTerm
  1744. //
  1745. // Purpose: To terminate the Notes session
  1746. //
  1747. // Parameters: None.
  1748. //
  1749. // Returns: Nuthin'.
  1750. //
  1751. // Note: This function should be called whenever a object
  1752. // generated (as requested by Notes) is closed.
  1753. //
  1754. VOID OFC_CALLTYPE MsoNotesTerm();
  1755. #ifdef __cplusplus
  1756. }; // extern "C"
  1757. #endif // __cplusplus
  1758. #pragma pack( pop )
  1759. #endif // __offcapi_h__