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.

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