Annotation of mstools/ole20/samples/outline/outline.h, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.