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.

790 lines
33 KiB

  1. /*************************************************************************
  2. **
  3. ** OLE 2 Sample Code
  4. **
  5. ** outline.h
  6. **
  7. ** This file contains file contains data structure defintions,
  8. ** function prototypes, constants, etc. used by the Outline series
  9. ** of sample applications:
  10. ** Outline -- base version of the app (without OLE functionality)
  11. ** SvrOutl -- OLE 2.0 Server sample app
  12. ** CntrOutl -- OLE 2.0 Containter (Container) sample app
  13. ** ISvrOtl -- OLE 2.0 Server sample app
  14. ** CntrOutl -- OLE 2.0 Containter (Container) sample app
  15. **
  16. ** (c) Copyright Microsoft Corp. 1992 - 1993 All Rights Reserved
  17. **
  18. ** For structures which we read from and write to disk we define shadow
  19. ** structures (with the _ONDISK suffix) that allow us to maintain
  20. ** 16-bit Windows and Macintosh compatibility.
  21. **
  22. *************************************************************************/
  23. #if !defined( _OUTLINE_H_ )
  24. #define _OUTLINE_H_
  25. #include <testmess.h>
  26. #if !defined( RC_INVOKED )
  27. #pragma message ("INCLUDING OUTLINE.H from " __FILE__)
  28. #endif /* RC_INVOKED */
  29. // use strict ANSI standard (for DVOBJ.H)
  30. //#define NONAMELESSUNION
  31. // use system defined bitmap, this line must go before windows.h
  32. #define OEMRESOURCE
  33. #ifdef WIN32
  34. #define _INC_OLE
  35. // #define __RPC_H__
  36. #define EXPORT
  37. #define _fstrchr strchr
  38. #else
  39. #define EXPORT _export
  40. #endif
  41. #define SDI_VERSION 1 // ONLY SDI version is currently supported
  42. #if defined( OLE_SERVER ) || defined( OLE_CNTR )
  43. #define OLE_VERSION 1
  44. #define USE_DRAGDROP 1 // enable drag/drop code in OLE versions
  45. #define USE_MSGFILTER 1 // enable IMessageFilter implementation
  46. #endif
  47. #define USE_HEADING 1 // enable the row/col headings
  48. #define USE_STATUSBAR 1 // enable status bar window
  49. #define USE_FRAMETOOLS 1 // enable the toolbar
  50. #ifndef WIN32 //BUGBUG32
  51. #define USE_CTL3D 1 // enable 3D looking dialogs
  52. #endif
  53. #define STRICT 1
  54. #undef UNICODE
  55. #include <windows.h>
  56. #include <string.h>
  57. #include <commdlg.h>
  58. #include <ole2.h>
  59. #include <ole2ui.h>
  60. #include <olestr.h>
  61. #include "outlrc.h"
  62. #define APPMAJORVERSIONNO 3 // major no. incremented for major releases
  63. // (eg. when an incompatible change is made
  64. // to the storage format)
  65. #define APPMINORVERSIONNO 5 // minor no. incremented for minor releases
  66. /* Definition of SCALEFACTOR */
  67. typedef struct tagSCALEFACTOR {
  68. ULONG dwSxN; // numerator in x direction
  69. ULONG dwSxD; // denominator in x direction
  70. ULONG dwSyN; // numerator in y direction
  71. ULONG dwSyD; // denominator in y direction
  72. } SCALEFACTOR, FAR* LPSCALEFACTOR;
  73. #if defined( USE_FRAMETOOLS )
  74. #include "frametls.h"
  75. #endif
  76. #if defined( USE_HEADING )
  77. #include "heading.h"
  78. #endif
  79. /* max line height (in pixels) allowed in a listbox */
  80. #define LISTBOX_HEIGHT_LIMIT 255
  81. #define MAXSTRLEN 80 // max string len in bytes
  82. #define MAXNAMESIZE 30 // max length of names
  83. #define MAXFORMATSIZE 10 // max length of DEFDOCFORMAT (actually size is 5)
  84. #define TABWIDTH 2000 // 2000 in Himetric units, i.e. 2cm
  85. #define DEFFONTPTSIZE 12
  86. #define DEFFONTSIZE ((DEFFONTPTSIZE*HIMETRIC_PER_INCH)/PTS_PER_INCH)
  87. #define DEFFONTFACE "Times New Roman"
  88. #define OUTLINEDOCFORMAT "Outline" // CF_Outline format name
  89. #define IS_FILENAME_DELIM(c) ( (c) == '\\' || (c) == '/' || (c) == ':' )
  90. // REVIEW: some of these strings should be loaded from a resource file
  91. #define UNTITLED "Outline" // title used for untitled document
  92. #define HITTESTDELTA 5
  93. /* Macro to get a random integer within a specified range */
  94. #define getrandom( min, max ) ((rand() % (int)(((max)+1) - (min))) + (min))
  95. // REVIEW: should load strings from string resource file
  96. #define APPFILENAMEFILTER "Outline Files (*.OLN)|*.oln|All files (*.*)|*.*|"
  97. #define DEFEXTENSION "oln" // Default file extension
  98. /* forward type references */
  99. typedef struct tagOUTLINEDOC FAR* LPOUTLINEDOC;
  100. typedef struct tagTEXTLINE FAR* LPTEXTLINE;
  101. typedef enum tagLINETYPE {
  102. UNKNOWNLINETYPE,
  103. TEXTLINETYPE,
  104. CONTAINERLINETYPE
  105. } LINETYPE;
  106. /*************************************************************************
  107. ** class LINE
  108. ** The class LINE is an abstract base class. Instances of class LINE
  109. ** are NOT created; only instances of the concrete subclasses of
  110. ** LINE can be created. In the base app version and the OLE 2.0
  111. ** server-only version only TEXTLINE objects can be created. In the
  112. ** OLE 2.0 client app version either TEXTLINE objects or CONTAINERLINE
  113. ** objects can be created. The LINE class has all fields and methods
  114. ** that are common independent of which subclass of LINE is used.
  115. ** Each LINE object that is created in added to the LINELIST of the
  116. ** OUTLINEDOC document.
  117. *************************************************************************/
  118. typedef struct tagLINE {
  119. LINETYPE m_lineType;
  120. UINT m_nTabLevel;
  121. UINT m_nTabWidthInHimetric;
  122. UINT m_nWidthInHimetric;
  123. UINT m_nHeightInHimetric;
  124. BOOL m_fSelected; // does line have selection feedback
  125. #if defined( USE_DRAGDROP )
  126. BOOL m_fDragOverLine; // does line have drop target feedback
  127. #endif
  128. } LINE, FAR* LPLINE;
  129. /* Line methods (functions) */
  130. void Line_Init(LPLINE lpLine, int nTab, HDC hDC);
  131. void Line_Delete(LPLINE lpLine);
  132. BOOL Line_CopyToDoc(LPLINE lpSrcLine, LPOUTLINEDOC lpDestDoc, int nIndex);
  133. BOOL Line_Edit(LPLINE lpLine, HWND hWndDoc, HDC hDC);
  134. void Line_Draw(
  135. LPLINE lpLine,
  136. HDC hDC,
  137. LPRECT lpRect,
  138. LPRECT lpRectWBounds,
  139. BOOL fHighlight
  140. );
  141. void Line_DrawToScreen(
  142. LPLINE lpLine,
  143. HDC hDC,
  144. LPRECT lprcPix,
  145. UINT itemAction,
  146. UINT itemState,
  147. LPRECT lprcDevice
  148. );
  149. void Line_DrawSelHilight(LPLINE lpLine, HDC hDC, LPRECT lpRect, UINT itemAction, UINT itemState);
  150. void Line_DrawFocusRect(LPLINE lpLine, HDC hDC, LPRECT lpRect, UINT itemAction, UINT itemState);
  151. void Line_Unindent(LPLINE lpLine, HDC hDC);
  152. void Line_Indent(LPLINE lpLine, HDC hDC);
  153. LINETYPE Line_GetLineType(LPLINE lpLine);
  154. UINT Line_GetTotalWidthInHimetric(LPLINE lpLine);
  155. void Line_SetWidthInHimetric(LPLINE lpLine, int nWidth);
  156. UINT Line_GetWidthInHimetric(LPLINE lpLine);
  157. UINT Line_GetHeightInHimetric(LPLINE lpLine);
  158. void Line_SetHeightInHimetric(LPLINE lpLine, int nHeight);
  159. UINT Line_GetTabLevel(LPLINE lpLine);
  160. int Line_GetTextLen(LPLINE lpLine);
  161. void Line_GetTextData(LPLINE lpLine, LPSTR lpszBuf);
  162. BOOL Line_GetOutlineData(LPLINE lpLine, LPTEXTLINE lpBuf);
  163. int Line_CalcTabWidthInHimetric(LPLINE lpLine, HDC hDC);
  164. BOOL Line_SaveToStg(LPLINE lpLine, UINT uFormat, LPSTORAGE lpSrcStg, LPSTORAGE lpDestStg, LPSTREAM lpLLStm, BOOL fRemember);
  165. LPLINE Line_LoadFromStg(LPSTORAGE lpSrcStg, LPSTREAM lpLLStm, LPOUTLINEDOC lpDestDoc);
  166. void Line_DrawDragFeedback(LPLINE lpLine, HDC hDC, LPRECT lpRect, UINT itemState );
  167. BOOL Line_IsSelected(LPLINE lpLine);
  168. /*************************************************************************
  169. ** class TEXTLINE : LINE
  170. ** The class TEXTLINE is a concrete subclass of the abstract base
  171. ** class LINE. The TEXTLINE class holds a string that can be edited
  172. ** by the user. In the base app version and the OLE 2.0
  173. ** server-only version only TEXTLINE objects can be created. In the
  174. ** OLE 2.0 client app version either TEXTLINE objects or CONTAINERLINE
  175. ** objects can be created. The TEXTLINE class inherits all fields
  176. ** from the LINE class. This inheritance is achieved by including a
  177. ** member variable of type LINE as the first field in the TEXTLINE
  178. ** structure. Thus a pointer to a TEXTLINE object can be cast to be
  179. ** a pointer to a LINE object.
  180. ** Each TEXTLINE object that is created in added to the LINELIST of
  181. ** the associated OUTLINEDOC document.
  182. *************************************************************************/
  183. typedef struct tagTEXTLINE {
  184. LINE m_Line; // TextLine inherits all fields of Line
  185. UINT m_nLength;
  186. char m_szText[MAXSTRLEN+1];
  187. } TEXTLINE;
  188. LPTEXTLINE TextLine_Create(HDC hDC, UINT nTab, LPSTR szText);
  189. void TextLine_Init(LPTEXTLINE lpTextLine, int nTab, HDC hDC);
  190. void TextLine_CalcExtents(LPTEXTLINE lpLine, HDC hDC);
  191. void TextLine_SetHeightInHimetric(LPTEXTLINE lpTextLine, int nHeight);
  192. void TextLine_Delete(LPTEXTLINE lpLine);
  193. BOOL TextLine_Edit(LPTEXTLINE lpLine, HWND hWndDoc, HDC hDC);
  194. void TextLine_Draw(
  195. LPTEXTLINE lpTextLine,
  196. HDC hDC,
  197. LPRECT lpRect,
  198. LPRECT lpRectWBounds,
  199. BOOL fHighlight
  200. );
  201. void TextLine_DrawSelHilight(LPTEXTLINE lpTextLine, HDC hDC, LPRECT lpRect, UINT itemAction, UINT itemState);
  202. BOOL TextLine_Copy(LPTEXTLINE lpSrcLine, LPTEXTLINE lpDestLine);
  203. BOOL TextLine_CopyToDoc(LPTEXTLINE lpSrcLine, LPOUTLINEDOC lpDestDoc, int nIndex);
  204. int TextLine_GetTextLen(LPTEXTLINE lpTextLine);
  205. void TextLine_GetTextData(LPTEXTLINE lpTextLine, LPSTR lpszBuf);
  206. BOOL TextLine_GetOutlineData(LPTEXTLINE lpTextLine, LPTEXTLINE lpBuf);
  207. BOOL TextLine_SaveToStm(LPTEXTLINE lpLine, LPSTREAM lpLLStm);
  208. LPLINE TextLine_LoadFromStg(LPSTORAGE lpSrcStg, LPSTREAM lpLLStm, LPOUTLINEDOC lpDestDoc);
  209. /*************************************************************************
  210. ** class LINERANGE
  211. ** The class LINERANGE is a supporting object used to describe a
  212. ** particular range in an OUTLINEDOC. A range is defined by a starting
  213. ** line index and an ending line index.
  214. *************************************************************************/
  215. typedef struct tagLINERANGE {
  216. signed short m_nStartLine;
  217. signed short m_nEndLine;
  218. } LINERANGE, FAR* LPLINERANGE;
  219. /*************************************************************************
  220. ** class OUTLINENAME
  221. ** The class OUTLINENAME stores a particular named selection in the
  222. ** OUTLINEDOC document. The NAMETABLE class holds all of the names
  223. ** defined in a particular OUTLINEDOC document. Each OUTLINENAME
  224. ** object has a string as its key and a starting line index and an
  225. ** ending line index for the named range.
  226. *************************************************************************/
  227. #pragma pack(push, 2)
  228. typedef struct tagOUTLINENAME {
  229. char m_szName[MAXNAMESIZE+1];
  230. signed short m_nStartLine; // must be signed for table update
  231. signed short m_nEndLine; // functions to work
  232. } OUTLINENAME, FAR* LPOUTLINENAME;
  233. #pragma pack(pop)
  234. void OutlineName_SetName(LPOUTLINENAME lpOutlineName, LPSTR lpszName);
  235. void OutlineName_SetSel(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel, BOOL fRangeModified);
  236. void OutlineName_GetSel(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel);
  237. BOOL OutlineName_SaveToStg(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel, UINT uFormat, LPSTREAM lpNTStm, BOOL FAR* lpfNameSaved);
  238. BOOL OutlineName_SaveToStg(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel, UINT uFormat, LPSTREAM lpNTStm, BOOL FAR* lpfNameSaved);
  239. BOOL OutlineName_LoadFromStg(LPOUTLINENAME lpOutlineName, LPSTREAM lpNTStm);
  240. /*************************************************************************
  241. ** class OUTLINENAMETABLE
  242. ** OUTLINENAMETABLE manages the table of named selections in the
  243. ** OUTLINEDOC document. Each OUTLINENAMETABLE entry has a string as its key
  244. ** and a starting line index and an ending line index for the
  245. ** named range. There is always one instance of OUTLINENAMETABLE for each
  246. ** OUTLINEDOC created.
  247. *************************************************************************/
  248. typedef struct tagOUTLINENAMETABLE {
  249. HWND m_hWndListBox;
  250. int m_nCount;
  251. } OUTLINENAMETABLE, FAR* LPOUTLINENAMETABLE;
  252. /* OutlineNameTable methods (functions) */
  253. BOOL OutlineNameTable_Init(LPOUTLINENAMETABLE lpOutlineNameTable, LPOUTLINEDOC lpOutlineDoc);
  254. void OutlineNameTable_Destroy(LPOUTLINENAMETABLE lpOutlineNameTable);
  255. void OutlineNameTable_ClearAll(LPOUTLINENAMETABLE lpOutlineNameTable);
  256. LPOUTLINENAME OutlineNameTable_CreateName(LPOUTLINENAMETABLE lpOutlineNameTable);
  257. void OutlineNameTable_AddName(LPOUTLINENAMETABLE lpOutlineNameTable, LPOUTLINENAME lpOutlineName);
  258. void OutlineNameTable_DeleteName(LPOUTLINENAMETABLE lpOutlineNameTable, int nIndex);
  259. int OutlineNameTable_GetNameIndex(LPOUTLINENAMETABLE lpOutlineNameTable, LPOUTLINENAME lpOutlineName);
  260. LPOUTLINENAME OutlineNameTable_GetName(LPOUTLINENAMETABLE lpOutlineNameTable, int nIndex);
  261. LPOUTLINENAME OutlineNameTable_FindName(LPOUTLINENAMETABLE lpOutlineNameTable, LPSTR lpszName);
  262. LPOUTLINENAME OutlineNameTable_FindNamedRange(LPOUTLINENAMETABLE lpOutlineNameTable, LPLINERANGE lplrSel);
  263. int OutlineNameTable_GetCount(LPOUTLINENAMETABLE lpOutlineNameTable);
  264. void OutlineNameTable_AddLineUpdate(LPOUTLINENAMETABLE lpOutlineNameTable, int nAddIndex);
  265. void OutlineNameTable_DeleteLineUpdate(LPOUTLINENAMETABLE lpOutlineNameTable, int nDeleteIndex);
  266. BOOL OutlineNameTable_LoadFromStg(LPOUTLINENAMETABLE lpOutlineNameTable, LPSTORAGE lpSrcStg);
  267. BOOL OutlineNameTable_SaveSelToStg(
  268. LPOUTLINENAMETABLE lpOutlineNameTable,
  269. LPLINERANGE lplrSel,
  270. UINT uFormat,
  271. LPSTREAM lpNTStm
  272. );
  273. /*************************************************************************
  274. ** class LINELIST
  275. ** The class LINELIST manages the list of Line objects in the
  276. ** OUTLINEDOC document. This class uses a Window's Owner-draw ListBox
  277. ** to hold the list of LINE objects. There is always one instance of
  278. ** LINELIST for each OUTLINEDOC created.
  279. *************************************************************************/
  280. typedef struct tagLINELIST {
  281. HWND m_hWndListBox; // hWnd of OwnerDraw listbox
  282. int m_nNumLines; // number of lines in LineList
  283. int m_nMaxLineWidthInHimetric; // max width of listbox
  284. LPOUTLINEDOC m_lpDoc; // ptr to associated OutlineDoc
  285. LINERANGE m_lrSaveSel; // selection saved on WM_KILLFOCUS
  286. #if defined( USE_DRAGDROP )
  287. int m_iDragOverLine; // line index w/ drop target feedback
  288. #endif
  289. } LINELIST, FAR* LPLINELIST;
  290. /* LineList methods (functions) */
  291. BOOL LineList_Init(LPLINELIST lpLL, LPOUTLINEDOC lpOutlineDoc);
  292. void LineList_Destroy(LPLINELIST lpLL);
  293. void LineList_AddLine(LPLINELIST lpLL, LPLINE lpLine, int nIndex);
  294. void LineList_DeleteLine(LPLINELIST lpLL, int nIndex);
  295. void LineList_ReplaceLine(LPLINELIST lpLL, LPLINE lpLine, int nIndex);
  296. int LineList_GetLineIndex(LPLINELIST lpLL, LPLINE lpLine);
  297. LPLINE LineList_GetLine(LPLINELIST lpLL, int nIndex);
  298. void LineList_SetFocusLine ( LPLINELIST lpLL, WORD wIndex );
  299. BOOL LineList_GetLineRect(LPLINELIST lpLL, int nIndex, LPRECT lpRect);
  300. int LineList_GetFocusLineIndex(LPLINELIST lpLL);
  301. int LineList_GetCount(LPLINELIST lpLL);
  302. BOOL LineList_SetMaxLineWidthInHimetric(
  303. LPLINELIST lpLL,
  304. int nWidthInHimetric
  305. );
  306. void LineList_ScrollLineIntoView(LPLINELIST lpLL, int nIndex);
  307. int LineList_GetMaxLineWidthInHimetric(LPLINELIST lpLL);
  308. BOOL LineList_RecalcMaxLineWidthInHimetric(
  309. LPLINELIST lpLL,
  310. int nWidthInHimetric
  311. );
  312. void LineList_CalcSelExtentInHimetric(
  313. LPLINELIST lpLL,
  314. LPLINERANGE lplrSel,
  315. LPSIZEL lpsizel
  316. );
  317. HWND LineList_GetWindow(LPLINELIST lpLL);
  318. HDC LineList_GetDC(LPLINELIST lpLL);
  319. void LineList_ReleaseDC(LPLINELIST lpLL, HDC hDC);
  320. void LineList_SetLineHeight(LPLINELIST lpLL,int nIndex,int nHeightInHimetric);
  321. void LineList_ReScale(LPLINELIST lpLL, LPSCALEFACTOR lpscale);
  322. void LineList_SetSel(LPLINELIST lpLL, LPLINERANGE lplrSel);
  323. int LineList_GetSel(LPLINELIST lpLL, LPLINERANGE lplrSel);
  324. void LineList_RemoveSel(LPLINELIST lpLL);
  325. void LineList_RestoreSel(LPLINELIST lpLL);
  326. void LineList_SetRedraw(LPLINELIST lpLL, BOOL fEnableDraw);
  327. void LineList_ForceRedraw(LPLINELIST lpLL, BOOL fErase);
  328. void LineList_ForceLineRedraw(LPLINELIST lpLL, int nIndex, BOOL fErase);
  329. int LineList_CopySelToDoc(
  330. LPLINELIST lpSrcLL,
  331. LPLINERANGE lplrSel,
  332. LPOUTLINEDOC lpDestDoc
  333. );
  334. BOOL LineList_SaveSelToStg(
  335. LPLINELIST lpLL,
  336. LPLINERANGE lplrSel,
  337. UINT uFormat,
  338. LPSTORAGE lpSrcStg,
  339. LPSTORAGE lpDestStg,
  340. LPSTREAM lpLLStm,
  341. BOOL fRemember
  342. );
  343. BOOL LineList_LoadFromStg(
  344. LPLINELIST lpLL,
  345. LPSTORAGE lpSrcStg,
  346. LPSTREAM lpLLStm
  347. );
  348. #if defined( USE_DRAGDROP )
  349. void LineList_SetFocusLineFromPointl( LPLINELIST lpLL, POINTL pointl );
  350. void LineList_SetDragOverLineFromPointl ( LPLINELIST lpLL, POINTL pointl );
  351. void LineList_Scroll(LPLINELIST lpLL, DWORD dwScrollDir);
  352. int LineList_GetLineIndexFromPointl(LPLINELIST lpLL, POINTL pointl);
  353. void LineList_RestoreDragFeedback(LPLINELIST lpLL);
  354. #endif
  355. LRESULT FAR PASCAL LineListWndProc(
  356. HWND hWnd,
  357. UINT Message,
  358. WPARAM wParam,
  359. LPARAM lParam
  360. );
  361. // Document initialization type
  362. #define DOCTYPE_UNKNOWN 0 // new doc created but not yet initialized
  363. #define DOCTYPE_NEW 1 // init from scratch (new doc)
  364. #define DOCTYPE_FROMFILE 2 // init from a file (open doc)
  365. /*************************************************************************
  366. ** class OUTLINEDOC
  367. ** There is one instance of the OutlineDoc class created per
  368. ** document open in the app. The SDI version of the app supports one
  369. ** OUTLINEDOC at a time. The MDI version of the app can manage
  370. ** multiple documents at one time.
  371. *************************************************************************/
  372. /* Definition of OUTLINEDOC */
  373. typedef struct tagOUTLINEDOC {
  374. LINELIST m_LineList; // list of lines in the doc
  375. LPOUTLINENAMETABLE m_lpNameTable; // table of names in the doc
  376. HWND m_hWndDoc; // client area window for the Doc
  377. int m_docInitType; // is doc new or loaded from a file?
  378. BOOL m_fDataTransferDoc; // is doc created for copy | drag/drop
  379. CLIPFORMAT m_cfSaveFormat; // format used to save the doc
  380. char m_szFileName[256]; // associated file; "(Untitled)" if none
  381. LPSTR m_lpszDocTitle; // name of doc to appear in window title
  382. BOOL m_fModified; // is the doc dirty (needs to be saved)?
  383. UINT m_nDisableDraw; // enable/disable updating the display
  384. SCALEFACTOR m_scale; // current scale factor of the doc
  385. int m_nLeftMargin; // left margin in Himetric
  386. int m_nRightMargin; // right margin in Himetric
  387. UINT m_uCurrentZoom; // cur. zoom (used for menu checking)
  388. UINT m_uCurrentMargin; // cur. margin (used for menu checking)
  389. #if defined( USE_HEADING )
  390. HEADING m_heading;
  391. #endif
  392. #if defined( USE_FRAMETOOLS )
  393. LPFRAMETOOLS m_lpFrameTools; // ptr to frame tools used by this doc
  394. #endif
  395. } OUTLINEDOC;
  396. /* OutlineDoc methods (functions) */
  397. BOOL OutlineDoc_Init(LPOUTLINEDOC lpOutlineDoc, BOOL fDataTransferDoc);
  398. BOOL OutlineDoc_InitNewFile(LPOUTLINEDOC lpOutlineDoc);
  399. LPOUTLINENAMETABLE OutlineDoc_CreateNameTable(LPOUTLINEDOC lpOutlineDoc);
  400. void OutlineDoc_Destroy(LPOUTLINEDOC lpOutlineDoc);
  401. BOOL OutlineDoc_Close(LPOUTLINEDOC lpOutlineDoc, DWORD dwSaveOption);
  402. void OutlineDoc_ShowWindow(LPOUTLINEDOC lpOutlineDoc);
  403. void OutlineDoc_FrameWindowResized(
  404. LPOUTLINEDOC lpOutlineDoc,
  405. LPRECT lprcFrameRect,
  406. LPBORDERWIDTHS lpFrameToolWidths
  407. );
  408. void OutlineDoc_ClearCommand(LPOUTLINEDOC lpOutlineDoc);
  409. void OutlineDoc_CutCommand(LPOUTLINEDOC lpOutlineDoc);
  410. void OutlineDoc_CopyCommand(LPOUTLINEDOC lpOutlineDoc);
  411. void OutlineDoc_ClearAllLines(LPOUTLINEDOC lpOutlineDoc);
  412. LPOUTLINEDOC OutlineDoc_CreateDataTransferDoc(LPOUTLINEDOC lpSrcOutlineDoc);
  413. void OutlineDoc_PasteCommand(LPOUTLINEDOC lpOutlineDoc);
  414. int OutlineDoc_PasteOutlineData(LPOUTLINEDOC lpOutlineDoc, HGLOBAL hOutline, int nStartIndex);
  415. int OutlineDoc_PasteTextData(LPOUTLINEDOC lpOutlineDoc, HGLOBAL hText, int nStartIndex);
  416. void OutlineDoc_AddTextLineCommand(LPOUTLINEDOC lpOutlineDoc);
  417. void OutlineDoc_AddTopLineCommand(
  418. LPOUTLINEDOC lpOutlineDoc,
  419. UINT nHeightInHimetric
  420. );
  421. void OutlineDoc_EditLineCommand(LPOUTLINEDOC lpOutlineDoc);
  422. void OutlineDoc_IndentCommand(LPOUTLINEDOC lpOutlineDoc);
  423. void OutlineDoc_UnindentCommand(LPOUTLINEDOC lpOutlineDoc);
  424. void OutlineDoc_SetLineHeightCommand(LPOUTLINEDOC lpDoc);
  425. void OutlineDoc_SelectAllCommand(LPOUTLINEDOC lpOutlineDoc);
  426. void OutlineDoc_DefineNameCommand(LPOUTLINEDOC lpOutlineDoc);
  427. void OutlineDoc_GotoNameCommand(LPOUTLINEDOC lpOutlineDoc);
  428. void OutlineDoc_Print(LPOUTLINEDOC lpOutlineDoc, HDC hDC);
  429. BOOL OutlineDoc_SaveToFile(LPOUTLINEDOC lpOutlineDoc, LPCSTR lpszFileName, UINT uFormat, BOOL fRemember);
  430. void OutlineDoc_AddLine(LPOUTLINEDOC lpOutlineDoc, LPLINE lpLine, int nIndex);
  431. void OutlineDoc_DeleteLine(LPOUTLINEDOC lpOutlineDoc, int nIndex);
  432. void OutlineDoc_AddName(LPOUTLINEDOC lpOutlineDoc, LPOUTLINENAME lpOutlineName);
  433. void OutlineDoc_DeleteName(LPOUTLINEDOC lpOutlineDoc, int nIndex);
  434. void OutlineDoc_Resize(LPOUTLINEDOC lpDoc, LPRECT lpRect);
  435. LPOUTLINENAMETABLE OutlineDoc_GetNameTable(LPOUTLINEDOC lpOutlineDoc);
  436. LPLINELIST OutlineDoc_GetLineList(LPOUTLINEDOC lpOutlineDoc);
  437. int OutlineDoc_GetNameCount(LPOUTLINEDOC lpOutlineDoc);
  438. int OutlineDoc_GetLineCount(LPOUTLINEDOC lpOutlineDoc);
  439. void OutlineDoc_SetTitle(LPOUTLINEDOC lpOutlineDoc, BOOL fMakeUpperCase);
  440. BOOL OutlineDoc_CheckSaveChanges(
  441. LPOUTLINEDOC lpOutlineDoc,
  442. LPDWORD lpdwSaveOption
  443. );
  444. BOOL OutlineDoc_IsModified(LPOUTLINEDOC lpOutlineDoc);
  445. void OutlineDoc_SetModified(LPOUTLINEDOC lpOutlineDoc, BOOL fModified, BOOL fDataChanged, BOOL fSizeChanged);
  446. void OutlineDoc_SetRedraw(LPOUTLINEDOC lpOutlineDoc, BOOL fEnableDraw);
  447. BOOL OutlineDoc_LoadFromFile(LPOUTLINEDOC lpOutlineDoc, LPSTR szFileName);
  448. BOOL OutlineDoc_SaveSelToStg(
  449. LPOUTLINEDOC lpOutlineDoc,
  450. LPLINERANGE lplrSel,
  451. UINT uFormat,
  452. LPSTORAGE lpDestStg,
  453. BOOL fSameAsLoad,
  454. BOOL fRemember
  455. );
  456. BOOL OutlineDoc_LoadFromStg(LPOUTLINEDOC lpOutlineDoc, LPSTORAGE lpSrcStg);
  457. BOOL OutlineDoc_SetFileName(LPOUTLINEDOC lpOutlineDoc, LPSTR lpszFileName, LPSTORAGE lpNewStg);
  458. HWND OutlineDoc_GetWindow(LPOUTLINEDOC lpOutlineDoc);
  459. void OutlineDoc_SetSel(LPOUTLINEDOC lpOutlineDoc, LPLINERANGE lplrSel);
  460. int OutlineDoc_GetSel(LPOUTLINEDOC lpOutlineDoc, LPLINERANGE lplrSel);
  461. void OutlineDoc_ForceRedraw(LPOUTLINEDOC lpOutlineDoc, BOOL fErase);
  462. void OutlineDoc_RenderFormat(LPOUTLINEDOC lpOutlineDoc, UINT uFormat);
  463. void OutlineDoc_RenderAllFormats(LPOUTLINEDOC lpOutlineDoc);
  464. HGLOBAL OutlineDoc_GetOutlineData(LPOUTLINEDOC lpOutlineDoc, LPLINERANGE lplrSel);
  465. HGLOBAL OutlineDoc_GetTextData(LPOUTLINEDOC lpOutlineDoc, LPLINERANGE lplrSel);
  466. void OutlineDoc_DialogHelp(HWND hDlg, WPARAM wDlgID);
  467. void OutlineDoc_SetCurrentZoomCommand(
  468. LPOUTLINEDOC lpOutlineDoc,
  469. UINT uCurrentZoom
  470. );
  471. UINT OutlineDoc_GetCurrentZoomMenuCheck(LPOUTLINEDOC lpOutlineDoc);
  472. void OutlineDoc_SetScaleFactor(
  473. LPOUTLINEDOC lpOutlineDoc,
  474. LPSCALEFACTOR lpscale,
  475. LPRECT lprcDoc
  476. );
  477. LPSCALEFACTOR OutlineDoc_GetScaleFactor(LPOUTLINEDOC lpDoc);
  478. void OutlineDoc_SetCurrentMarginCommand(
  479. LPOUTLINEDOC lpOutlineDoc,
  480. UINT uCurrentMargin
  481. );
  482. UINT OutlineDoc_GetCurrentMarginMenuCheck(LPOUTLINEDOC lpOutlineDoc);
  483. void OutlineDoc_SetMargin(LPOUTLINEDOC lpDoc, int nLeftMargin, int nRightMargin);
  484. LONG OutlineDoc_GetMargin(LPOUTLINEDOC lpDoc);
  485. #if defined( USE_FRAMETOOLS )
  486. void OutlineDoc_AddFrameLevelTools(LPOUTLINEDOC lpOutlineDoc);
  487. void OutlineDoc_SetFormulaBarEditText(
  488. LPOUTLINEDOC lpOutlineDoc,
  489. LPLINE lpLine
  490. );
  491. void OutlineDoc_SetFormulaBarEditFocus(
  492. LPOUTLINEDOC lpOutlineDoc,
  493. BOOL fEditFocus
  494. );
  495. BOOL OutlineDoc_IsEditFocusInFormulaBar(LPOUTLINEDOC lpOutlineDoc);
  496. void OutlineDoc_UpdateFrameToolButtons(LPOUTLINEDOC lpOutlineDoc);
  497. #endif // USE_FRAMETOOLS
  498. #if defined( USE_HEADING )
  499. LPHEADING OutlineDoc_GetHeading(LPOUTLINEDOC lpOutlineDoc);
  500. void OutlineDoc_ShowHeading(LPOUTLINEDOC lpOutlineDoc, BOOL fShow);
  501. #endif // USE_HEADING
  502. /*************************************************************************
  503. ** class OUTLINEAPP
  504. ** There is one instance of the OUTLINEAPP class created per running
  505. ** application instance. This object holds many fields that could
  506. ** otherwise be organized as global variables.
  507. *************************************************************************/
  508. /* Definition of OUTLINEAPP */
  509. typedef struct tagOUTLINEAPP {
  510. HWND m_hWndApp; // top-level frame window for the App
  511. HMENU m_hMenuApp; // handle to frame level menu for App
  512. HACCEL m_hAccelApp;
  513. HACCEL m_hAccelFocusEdit;// Accelerator when Edit in Focus
  514. LPOUTLINEDOC m_lpDoc; // main SDI document visible to user
  515. LPOUTLINEDOC m_lpClipboardDoc; // hidden doc for snapshot of copied sel
  516. HWND m_hWndStatusBar; // window for the status bar
  517. HCURSOR m_hcursorSelCur; // cursor used to select lines
  518. HINSTANCE m_hInst;
  519. PRINTDLG m_PrintDlg;
  520. HFONT m_hStdFont; // font used for TextLines
  521. UINT m_cfOutline; // clipboard format for Outline data
  522. HACCEL m_hAccel;
  523. HWND m_hWndAccelTarget;
  524. FARPROC m_ListBoxWndProc; // orig listbox WndProc for subclassing
  525. #if defined ( USE_FRAMETOOLS ) || defined ( INPLACE_CNTR )
  526. BORDERWIDTHS m_FrameToolWidths; // space required by frame-level tools
  527. #endif // USE_FRAMETOOLS || INPLACE_CNTR
  528. #if defined( USE_FRAMETOOLS )
  529. FRAMETOOLS m_frametools; // frame tools (button & formula bars)
  530. #endif // USE_FRAMETOOLS
  531. } OUTLINEAPP, FAR* LPOUTLINEAPP;
  532. /* OutlineApp methods (functions) */
  533. BOOL OutlineApp_InitApplication(LPOUTLINEAPP lpOutlineApp, HINSTANCE hInst);
  534. BOOL OutlineApp_InitInstance(LPOUTLINEAPP lpOutlineApp, HINSTANCE hInst, int nCmdShow);
  535. BOOL OutlineApp_ParseCmdLine(LPOUTLINEAPP lpOutlineApp, LPSTR lpszCmdLine, int nCmdShow);
  536. void OutlineApp_Destroy(LPOUTLINEAPP lpOutlineApp);
  537. LPOUTLINEDOC OutlineApp_CreateDoc(
  538. LPOUTLINEAPP lpOutlineApp,
  539. BOOL fDataTransferDoc
  540. );
  541. HWND OutlineApp_GetWindow(LPOUTLINEAPP lpOutlineApp);
  542. HWND OutlineApp_GetFrameWindow(LPOUTLINEAPP lpOutlineApp);
  543. HINSTANCE OutlineApp_GetInstance(LPOUTLINEAPP lpOutlineApp);
  544. LPOUTLINENAME OutlineApp_CreateName(LPOUTLINEAPP lpOutlineApp);
  545. void OutlineApp_DocUnlockApp(LPOUTLINEAPP lpOutlineApp, LPOUTLINEDOC lpOutlineDoc);
  546. void OutlineApp_InitMenu(LPOUTLINEAPP lpOutlineApp, LPOUTLINEDOC lpDoc, HMENU hMenu);
  547. void OutlineApp_GetFrameRect(LPOUTLINEAPP lpOutlineApp, LPRECT lprcFrameRect);
  548. void OutlineApp_GetClientAreaRect(
  549. LPOUTLINEAPP lpOutlineApp,
  550. LPRECT lprcClientAreaRect
  551. );
  552. void OutlineApp_GetStatusLineRect(
  553. LPOUTLINEAPP lpOutlineApp,
  554. LPRECT lprcStatusLineRect
  555. );
  556. void OutlineApp_ResizeWindows(LPOUTLINEAPP lpOutlineApp);
  557. void OutlineApp_ResizeClientArea(LPOUTLINEAPP lpOutlineApp);
  558. void OutlineApp_AboutCommand(LPOUTLINEAPP lpOutlineApp);
  559. void OutlineApp_NewCommand(LPOUTLINEAPP lpOutlineApp);
  560. void OutlineApp_OpenCommand(LPOUTLINEAPP lpOutlineApp);
  561. void OutlineApp_PrintCommand(LPOUTLINEAPP lpOutlineApp);
  562. BOOL OutlineApp_SaveCommand(LPOUTLINEAPP lpOutlineApp);
  563. BOOL OutlineApp_SaveAsCommand(LPOUTLINEAPP lpOutlineApp);
  564. BOOL OutlineApp_CloseAllDocsAndExitCommand(
  565. LPOUTLINEAPP lpOutlineApp,
  566. BOOL fForceEndSession
  567. );
  568. void OutlineApp_DestroyWindow(LPOUTLINEAPP lpOutlineApp);
  569. #if defined( USE_FRAMETOOLS )
  570. void OutlineApp_SetBorderSpace(
  571. LPOUTLINEAPP lpOutlineApp,
  572. LPBORDERWIDTHS lpBorderWidths
  573. );
  574. LPFRAMETOOLS OutlineApp_GetFrameTools(LPOUTLINEAPP lpOutlineApp);
  575. void OutlineApp_SetFormulaBarAccel(
  576. LPOUTLINEAPP lpOutlineApp,
  577. BOOL fEditFocus
  578. );
  579. #endif // USE_FRAMETOOLS
  580. void OutlineApp_SetStatusText(LPOUTLINEAPP lpOutlineApp, LPSTR lpszMessage);
  581. LPOUTLINEDOC OutlineApp_GetActiveDoc(LPOUTLINEAPP lpOutlineApp);
  582. HMENU OutlineApp_GetMenu(LPOUTLINEAPP lpOutlineApp);
  583. HFONT OutlineApp_GetActiveFont(LPOUTLINEAPP lpOutlineApp);
  584. HDC OutlineApp_GetPrinterDC(LPOUTLINEAPP lpApp);
  585. void OutlineApp_PrinterSetupCommand(LPOUTLINEAPP lpOutlineApp);
  586. void OutlineApp_ErrorMessage(LPOUTLINEAPP lpOutlineApp, LPSTR lpszMsg);
  587. void OutlineApp_GetAppVersionNo(LPOUTLINEAPP lpOutlineApp, int narrAppVersionNo[]);
  588. void OutlineApp_GetAppName(LPOUTLINEAPP lpOutlineApp, LPSTR lpszAppName);
  589. BOOL OutlineApp_VersionNoCheck(LPOUTLINEAPP lpOutlineApp, LPSTR lpszAppName, int narrAppVersionNo[]);
  590. void OutlineApp_SetEditText(LPOUTLINEAPP lpApp);
  591. void OutlineApp_SetFocusEdit(LPOUTLINEAPP lpApp, BOOL bFocusEdit);
  592. BOOL OutlineApp_GetFocusEdit(LPOUTLINEAPP lpApp);
  593. void OutlineApp_ForceRedraw(LPOUTLINEAPP lpOutlineApp, BOOL fErase);
  594. /* struct definition for persistant data storage of OutlineDoc data */
  595. #pragma pack(push, 2)
  596. typedef struct tagOUTLINEDOCHEADER_ONDISK {
  597. char m_szFormatName[32];
  598. short m_narrAppVersionNo[2];
  599. USHORT m_fShowHeading;
  600. DWORD m_reserved1; // space reserved for future use
  601. DWORD m_reserved2; // space reserved for future use
  602. DWORD m_reserved3; // space reserved for future use
  603. DWORD m_reserved4; // space reserved for future use
  604. } OUTLINEDOCHEADER_ONDISK, FAR* LPOUTLINEDOCHEADER_ONDISK;
  605. #pragma pack(pop)
  606. typedef struct tagOUTLINEDOCHEADER {
  607. char m_szFormatName[32];
  608. int m_narrAppVersionNo[2];
  609. BOOL m_fShowHeading;
  610. DWORD m_reserved1; // space reserved for future use
  611. DWORD m_reserved2; // space reserved for future use
  612. DWORD m_reserved3; // space reserved for future use
  613. DWORD m_reserved4; // space reserved for future use
  614. } OUTLINEDOCHEADER, FAR* LPOUTLINEDOCHEADER;
  615. #pragma pack(push,2)
  616. typedef struct tagLINELISTHEADER_ONDISK {
  617. USHORT m_nNumLines;
  618. DWORD m_reserved1; // space reserved for future use
  619. DWORD m_reserved2; // space reserved for future use
  620. } LINELISTHEADER_ONDISK, FAR* LPLINELISTHEADER_ONDISK;
  621. #pragma pack(pop)
  622. typedef struct tagLINELISTHEADER {
  623. int m_nNumLines;
  624. DWORD m_reserved1; // space reserved for future use
  625. DWORD m_reserved2; // space reserved for future use
  626. } LINELISTHEADER, FAR* LPLINELISTHEADER;
  627. #pragma pack(push,2)
  628. typedef struct tagLINERECORD_ONDISK {
  629. USHORT m_lineType;
  630. USHORT m_nTabLevel;
  631. USHORT m_nTabWidthInHimetric;
  632. USHORT m_nWidthInHimetric;
  633. USHORT m_nHeightInHimetric;
  634. DWORD m_reserved; // space reserved for future use
  635. } LINERECORD_ONDISK, FAR* LPLINERECORD_ONDISK;
  636. #pragma pack(pop)
  637. typedef struct tagLINERECORD {
  638. LINETYPE m_lineType;
  639. UINT m_nTabLevel;
  640. UINT m_nTabWidthInHimetric;
  641. UINT m_nWidthInHimetric;
  642. UINT m_nHeightInHimetric;
  643. DWORD m_reserved; // space reserved for future use
  644. } LINERECORD, FAR* LPLINERECORD;
  645. /* Function prototypes in main.c */
  646. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  647. LPSTR lpszCmdLine, int nCmdShow);
  648. BOOL MyTranslateAccelerator(LPMSG lpmsg);
  649. int GetAccelItemCount(HACCEL hAccel);
  650. LRESULT CALLBACK EXPORT AppWndProc(HWND hWnd, UINT Message, WPARAM wParam,
  651. LPARAM lParam);
  652. LRESULT CALLBACK EXPORT DocWndProc(HWND hWnd, UINT Message, WPARAM wParam,
  653. LPARAM lParam);
  654. /* Function prototypes in outldlgs.c */
  655. BOOL InputTextDlg(HWND hWnd, LPSTR lpszText, LPSTR lpszDlgTitle);
  656. BOOL CALLBACK EXPORT AddEditDlgProc(HWND, UINT, WPARAM, LPARAM);
  657. BOOL CALLBACK EXPORT SetLineHeightDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
  658. BOOL CALLBACK EXPORT DefineNameDlgProc(HWND, UINT, WPARAM, LPARAM);
  659. BOOL CALLBACK EXPORT GotoNameDlgProc(HWND, UINT, WPARAM, LPARAM);
  660. void NameDlg_LoadComboBox(LPOUTLINENAMETABLE lpOutlineNameTable,HWND hCombo);
  661. void NameDlg_LoadListBox(LPOUTLINENAMETABLE lpOutlineNameTable,HWND hListBox);
  662. void NameDlg_AddName(HWND hCombo, LPOUTLINEDOC lpOutlineDoc, LPSTR lpszName, LPLINERANGE lplrSel);
  663. void NameDlg_UpdateName(HWND hCombo, LPOUTLINEDOC lpOutlineDoc, int nIndex, LPSTR lpszName, LPLINERANGE lplrSel);
  664. void NameDlg_DeleteName(HWND hCombo, LPOUTLINEDOC lpOutlineDoc, UINT nIndex);
  665. BOOL CALLBACK EXPORT AboutDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
  666. /* Function prototypes in outldata.c */
  667. LPVOID New(DWORD lSize);
  668. void Delete(LPVOID p);
  669. /* Function prototypes in outlprnt.c */
  670. BOOL CALLBACK EXPORT AbortProc (HDC hdc, WORD reserved);
  671. BOOL CALLBACK EXPORT PrintDlgProc(HWND hwnd, WORD msg, WORD wParam, LONG lParam);
  672. /* Function prototypes in debug.c */
  673. void SetDebugLevelCommand(void);
  674. void TraceDebug(HWND, int);
  675. // now declare test functions
  676. extern HWND g_hwndDriver;
  677. void StartClipboardTest1( LPOUTLINEAPP lpOutlineApp );
  678. void ContinueClipboardTest1( LPOUTLINEAPP lpOutlineApp );
  679. #if defined( OLE_VERSION )
  680. #include "oleoutl.h"
  681. #endif // OLE_VERSION
  682. #endif // _OUTLINE_H_
  683. 
  684.