|
|
1.1 root 1: /*************************************************************************
2: **
3: ** OLE 2 Sample Code
4: **
5: ** outlname.c
6: **
7: ** This file contains OutlineName functions.
8: **
9: ** (c) Copyright Microsoft Corp. 1992 - 1993 All Rights Reserved
10: **
11: *************************************************************************/
12:
13:
14: #include "outline.h"
15:
16: OLEDBGDATA
17:
18:
19: /* OutlineName_SetName
20: * -------------------
21: *
22: * Change the string of a name.
23: */
24: void OutlineName_SetName(LPOUTLINENAME lpOutlineName, LPSTR lpszName)
25: {
26: lstrcpy(lpOutlineName->m_szName, lpszName);
27: }
28:
29:
30: /* OutlineName_SetSel
31: * ------------------
32: *
33: * Change the line range of a name.
34: */
35: void OutlineName_SetSel(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel, BOOL fRangeModified)
36: {
37: #if defined( OLE_SERVER )
38: // Call OLE server specific function instead
39: ServerName_SetSel((LPSERVERNAME)lpOutlineName, lplrSel, fRangeModified);
40: #else
41:
42: lpOutlineName->m_nStartLine = lplrSel->m_nStartLine;
43: lpOutlineName->m_nEndLine = lplrSel->m_nEndLine;
44: #endif
45: }
46:
47:
48: /* OutlineName_GetSel
49: * ------------------
50: *
51: * Retrieve the line range of a name.
52: */
53: void OutlineName_GetSel(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel)
54: {
55: lplrSel->m_nStartLine = lpOutlineName->m_nStartLine;
56: lplrSel->m_nEndLine = lpOutlineName->m_nEndLine;
57: }
58:
59:
60: /* OutlineName_SaveToStg
61: * ---------------------
62: *
63: * Save a name into a storage
64: */
65: BOOL OutlineName_SaveToStg(LPOUTLINENAME lpOutlineName, LPLINERANGE lplrSel, UINT uFormat, LPSTREAM lpNTStm, BOOL FAR* lpfNameSaved)
66: {
67: HRESULT hrErr = NOERROR;
68: ULONG nWritten;
69:
70: *lpfNameSaved = FALSE;
71:
72: /* if no range given or if the name is completely within the range,
73: ** write it out.
74: */
75: if (!lplrSel ||
76: ((lplrSel->m_nStartLine <= lpOutlineName->m_nStartLine) &&
77: (lplrSel->m_nEndLine >= lpOutlineName->m_nEndLine))) {
78:
79: hrErr = lpNTStm->lpVtbl->Write(
80: lpNTStm,
81: lpOutlineName,
82: sizeof(OUTLINENAME),
83: &nWritten
84: );
85: *lpfNameSaved = TRUE;
86: }
87: return ((hrErr == NOERROR) ? TRUE : FALSE);
88: }
89:
90:
91: /* OutlineName_LoadFromStg
92: * -----------------------
93: *
94: * Load names from an open stream of a storage. if the name already
95: * exits in the OutlineNameTable, it is NOT modified.
96: *
97: * Returns TRUE is all ok, else FALSE.
98: */
99: BOOL OutlineName_LoadFromStg(LPOUTLINENAME lpOutlineName, LPSTREAM lpNTStm)
100: {
101: HRESULT hrErr = NOERROR;
102: ULONG nRead;
103:
104: hrErr = lpNTStm->lpVtbl->Read(
105: lpNTStm,
106: lpOutlineName,
107: sizeof(OUTLINENAME),
108: &nRead
109: );
110:
111: return ((hrErr == NOERROR) ? TRUE : FALSE);
112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.