Remove global variables from the richedit control.
This commit is contained in:
parent
04279d18cd
commit
0dc42208b5
File diff suppressed because it is too large
Load Diff
|
@ -52,6 +52,7 @@ HANDLE RICHED32_hHeap = NULL;
|
||||||
, \
|
, \
|
||||||
hwnd, (UINT)wParam, (UINT)lParam)
|
hwnd, (UINT)wParam, (UINT)lParam)
|
||||||
|
|
||||||
|
LPVOID* WINAPI CreateIRichEditOle();
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DllMain [Internal] Initializes the internal 'RICHED32.DLL'.
|
* DllMain [Internal] Initializes the internal 'RICHED32.DLL'.
|
||||||
|
@ -94,6 +95,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
INT RICHEDIT_GetSelText(HWND hwnd,LPSTR lpstrBuffer);
|
INT RICHEDIT_GetSelText(HWND hwnd,LPSTR lpstrBuffer);
|
||||||
|
|
||||||
|
|
||||||
|
const WCHAR RichEditInfoStr[] = { '_','R','T','F','_','I','n','f','o', 0 };
|
||||||
|
|
||||||
|
typedef struct _RTFControl_info
|
||||||
|
{
|
||||||
|
HWND hwndEdit;
|
||||||
|
HWND hwndParent;
|
||||||
|
char* rtfBuffer;
|
||||||
|
RTF_Info *parser;
|
||||||
|
} RTFControl_Info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION:
|
||||||
|
@ -103,19 +114,15 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
int RTFToBuffer(char* pBuffer, int nBufferSize);
|
int RTFToBuffer(RTF_Info *parser, char* pBuffer, int nBufferSize);
|
||||||
LONG newstyle = 0;
|
LONG newstyle = 0;
|
||||||
LONG style = 0;
|
LONG style = 0;
|
||||||
|
RTFControl_Info *info;
|
||||||
static HWND hwndEdit;
|
|
||||||
static HWND hwndParent;
|
|
||||||
static char* rtfBuffer;
|
|
||||||
int rtfBufferSize;
|
int rtfBufferSize;
|
||||||
|
|
||||||
CHARRANGE *cr;
|
CHARRANGE *cr;
|
||||||
TRACE("previous hwndEdit: %p hwndParent %p\n",hwndEdit,hwndParent);
|
|
||||||
hwndEdit = GetWindow(hwnd,GW_CHILD);
|
info = GetPropW( hwnd, RichEditInfoStr );
|
||||||
TRACE("uMsg: 0x%x hwnd: %p hwndEdit: %p\n",uMsg,hwnd,hwndEdit);
|
TRACE("uMsg: 0x%x hwnd: %p\n",uMsg,hwnd);
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
|
@ -128,8 +135,14 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
case WM_NCCREATE :
|
case WM_NCCREATE :
|
||||||
TRACE_EDIT_MSG32("WM_NCCREATE");
|
TRACE_EDIT_MSG32("WM_NCCREATE");
|
||||||
|
|
||||||
|
info = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
|
sizeof (RTFControl_Info));
|
||||||
|
info->parser = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
|
sizeof (RTF_Info));
|
||||||
|
SetPropW(hwnd, RichEditInfoStr, (HANDLE)info);
|
||||||
|
|
||||||
/* remove SCROLLBARS from the current window style */
|
/* remove SCROLLBARS from the current window style */
|
||||||
hwndParent = ((LPCREATESTRUCTA) lParam)->hwndParent;
|
info->hwndParent = ((LPCREATESTRUCTA) lParam)->hwndParent;
|
||||||
|
|
||||||
newstyle = style = ((LPCREATESTRUCTA) lParam)->style;
|
newstyle = style = ((LPCREATESTRUCTA) lParam)->style;
|
||||||
newstyle &= ~WS_HSCROLL;
|
newstyle &= ~WS_HSCROLL;
|
||||||
|
@ -138,26 +151,26 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
newstyle &= ~ES_AUTOVSCROLL;
|
newstyle &= ~ES_AUTOVSCROLL;
|
||||||
SetWindowLongA(hwnd,GWL_STYLE, newstyle);
|
SetWindowLongA(hwnd,GWL_STYLE, newstyle);
|
||||||
|
|
||||||
TRACE("previous hwndEdit: %p\n",hwndEdit);
|
TRACE("previous hwndEdit: %p\n",info->hwndEdit);
|
||||||
hwndEdit = CreateWindowA ("edit", ((LPCREATESTRUCTA) lParam)->lpszName,
|
info->hwndEdit = CreateWindowA ("edit", ((LPCREATESTRUCTA) lParam)->lpszName,
|
||||||
style, 0, 0, 0, 0,
|
style, 0, 0, 0, 0,
|
||||||
hwnd, (HMENU) ID_EDIT,
|
hwnd, (HMENU) ID_EDIT,
|
||||||
((LPCREATESTRUCTA) lParam)->hInstance, NULL) ;
|
((LPCREATESTRUCTA) lParam)->hInstance, NULL) ;
|
||||||
TRACE("hwndEdit: %p hwnd: %p\n",hwndEdit,hwnd);
|
TRACE("hwndEdit: %p hwnd: %p\n",info->hwndEdit,hwnd);
|
||||||
|
|
||||||
if (hwndEdit)
|
if (info->hwndEdit)
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
else
|
else
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
|
|
||||||
case WM_SETFOCUS :
|
case WM_SETFOCUS :
|
||||||
TRACE_EDIT_MSG32("WM_SETFOCUS");
|
TRACE_EDIT_MSG32("WM_SETFOCUS");
|
||||||
SetFocus (hwndEdit) ;
|
SetFocus (info->hwndEdit) ;
|
||||||
return 0 ;
|
return 0 ;
|
||||||
|
|
||||||
case WM_SIZE :
|
case WM_SIZE :
|
||||||
TRACE_EDIT_MSG32("WM_SIZE");
|
TRACE_EDIT_MSG32("WM_SIZE");
|
||||||
MoveWindow (hwndEdit, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE) ;
|
MoveWindow (info->hwndEdit, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE) ;
|
||||||
return 0 ;
|
return 0 ;
|
||||||
|
|
||||||
case WM_COMMAND :
|
case WM_COMMAND :
|
||||||
|
@ -169,7 +182,7 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
case EN_SETFOCUS:
|
case EN_SETFOCUS:
|
||||||
case EN_UPDATE:
|
case EN_UPDATE:
|
||||||
case EN_VSCROLL:
|
case EN_VSCROLL:
|
||||||
return SendMessageA(hwndParent, WM_COMMAND,
|
return SendMessageA(info->hwndParent, WM_COMMAND,
|
||||||
wParam, (LPARAM)(hwnd));
|
wParam, (LPARAM)(hwnd));
|
||||||
|
|
||||||
case EN_ERRSPACE:
|
case EN_ERRSPACE:
|
||||||
|
@ -183,22 +196,22 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
TRACE_EDIT_MSG32("EM_STREAMIN");
|
TRACE_EDIT_MSG32("EM_STREAMIN");
|
||||||
|
|
||||||
/* setup the RTF parser */
|
/* setup the RTF parser */
|
||||||
RTFSetEditStream(( EDITSTREAM*)lParam);
|
RTFSetEditStream(info->parser,( EDITSTREAM*)lParam);
|
||||||
rtfFormat = wParam&(SF_TEXT|SF_RTF);
|
info->parser->rtfFormat = wParam&(SF_TEXT|SF_RTF);
|
||||||
WriterInit();
|
WriterInit(info->parser);
|
||||||
RTFInit ();
|
RTFInit (info->parser);
|
||||||
BeginFile();
|
BeginFile(info->parser);
|
||||||
|
|
||||||
/* do the parsing */
|
/* do the parsing */
|
||||||
RTFRead ();
|
RTFRead (info->parser);
|
||||||
|
|
||||||
rtfBufferSize = RTFToBuffer(NULL, 0);
|
rtfBufferSize = RTFToBuffer(info->parser,NULL, 0);
|
||||||
rtfBuffer = HeapAlloc(RICHED32_hHeap, 0,rtfBufferSize*sizeof(char));
|
info->rtfBuffer = HeapAlloc(RICHED32_hHeap, 0,rtfBufferSize*sizeof(char));
|
||||||
if(rtfBuffer)
|
if(info->rtfBuffer)
|
||||||
{
|
{
|
||||||
RTFToBuffer(rtfBuffer, rtfBufferSize);
|
RTFToBuffer(info->parser,info->rtfBuffer, rtfBufferSize);
|
||||||
SetWindowTextA(hwndEdit,rtfBuffer);
|
SetWindowTextA(info->hwndEdit,info->rtfBuffer);
|
||||||
HeapFree(RICHED32_hHeap, 0,rtfBuffer);
|
HeapFree(RICHED32_hHeap, 0,info->rtfBuffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WARN("Not enough memory for a allocating rtfBuffer\n");
|
WARN("Not enough memory for a allocating rtfBuffer\n");
|
||||||
|
@ -226,7 +239,7 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
case EM_EXGETSEL:
|
case EM_EXGETSEL:
|
||||||
TRACE_EDIT_MSG32("EM_EXGETSEL -> EM_GETSEL");
|
TRACE_EDIT_MSG32("EM_EXGETSEL -> EM_GETSEL");
|
||||||
cr = (VOID *) lParam;
|
cr = (VOID *) lParam;
|
||||||
if (hwndEdit) SendMessageA( hwndEdit, EM_GETSEL, (INT)&cr->cpMin, (INT)&cr->cpMax);
|
if (info->hwndEdit) SendMessageA( info->hwndEdit, EM_GETSEL, (INT)&cr->cpMin, (INT)&cr->cpMax);
|
||||||
TRACE("cpMin: 0x%x cpMax: 0x%x\n",(INT)cr->cpMin,(INT)cr->cpMax);
|
TRACE("cpMin: 0x%x cpMax: 0x%x\n",(INT)cr->cpMin,(INT)cr->cpMax);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -238,18 +251,18 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
{
|
{
|
||||||
limit = 0xFFFFFFFF;
|
limit = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
return SendMessageA(hwndEdit,EM_SETLIMITTEXT,limit,0);
|
return SendMessageA(info->hwndEdit,EM_SETLIMITTEXT,limit,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
case EM_EXLINEFROMCHAR:
|
case EM_EXLINEFROMCHAR:
|
||||||
TRACE_EDIT_MSG32("EM_EXLINEFROMCHAR -> LINEFROMCHAR");
|
TRACE_EDIT_MSG32("EM_EXLINEFROMCHAR -> LINEFROMCHAR");
|
||||||
if (hwndEdit) return SendMessageA( hwndEdit, EM_LINEFROMCHAR, lParam, wParam);
|
if (info->hwndEdit) return SendMessageA( info->hwndEdit, EM_LINEFROMCHAR, lParam, wParam);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case EM_EXSETSEL:
|
case EM_EXSETSEL:
|
||||||
TRACE_EDIT_MSG32("EM_EXSETSEL -> EM_SETSEL");
|
TRACE_EDIT_MSG32("EM_EXSETSEL -> EM_SETSEL");
|
||||||
cr = (VOID *) lParam;
|
cr = (VOID *) lParam;
|
||||||
if (hwndEdit) SendMessageA( hwndEdit, EM_SETSEL, cr->cpMin, cr->cpMax);
|
if (info->hwndEdit) SendMessageA( info->hwndEdit, EM_SETSEL, cr->cpMin, cr->cpMax);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case EM_FINDTEXT:
|
case EM_FINDTEXT:
|
||||||
|
@ -338,7 +351,7 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
case EM_GETSELTEXT:
|
case EM_GETSELTEXT:
|
||||||
TRACE_EDIT_MSG32("EM_GETSELTEXT");
|
TRACE_EDIT_MSG32("EM_GETSELTEXT");
|
||||||
return RICHEDIT_GetSelText(hwndEdit,(void *)lParam);
|
return RICHEDIT_GetSelText(info->hwndEdit,(void *)lParam);
|
||||||
|
|
||||||
case EM_GETTEXTEX:
|
case EM_GETTEXTEX:
|
||||||
TRACE_EDIT_MSG32("EM_GETTEXTEX Ignored");
|
TRACE_EDIT_MSG32("EM_GETTEXTEX Ignored");
|
||||||
|
@ -354,7 +367,7 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
|
|
||||||
case EM_GETTEXTRANGE:
|
case EM_GETTEXTRANGE:
|
||||||
TRACE_EDIT_MSG32("EM_GETTEXTRANGE");
|
TRACE_EDIT_MSG32("EM_GETTEXTRANGE");
|
||||||
return RICHEDIT_GetTextRange(hwndEdit,(TEXTRANGEA *)lParam);
|
return RICHEDIT_GetTextRange(info->hwndEdit,(TEXTRANGEA *)lParam);
|
||||||
|
|
||||||
case EM_GETTYPOGRAPHYOPTIONS:
|
case EM_GETTYPOGRAPHYOPTIONS:
|
||||||
TRACE_EDIT_MSG32("EM_GETTYPOGRAPHYOPTIONS Ignored");
|
TRACE_EDIT_MSG32("EM_GETTYPOGRAPHYOPTIONS Ignored");
|
||||||
|
@ -507,139 +520,139 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
/* Messages dispatched to the edit control */
|
/* Messages dispatched to the edit control */
|
||||||
case EM_CANUNDO:
|
case EM_CANUNDO:
|
||||||
TRACE_EDIT_MSG32("EM_CANUNDO Passed to edit control");
|
TRACE_EDIT_MSG32("EM_CANUNDO Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_CHARFROMPOS:
|
case EM_CHARFROMPOS:
|
||||||
TRACE_EDIT_MSG32("EM_CHARFROMPOS Passed to edit control");
|
TRACE_EDIT_MSG32("EM_CHARFROMPOS Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_EMPTYUNDOBUFFER:
|
case EM_EMPTYUNDOBUFFER:
|
||||||
TRACE_EDIT_MSG32("EM_EMPTYUNDOBUFFER Passed to edit control");
|
TRACE_EDIT_MSG32("EM_EMPTYUNDOBUFFER Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_FMTLINES:
|
case EM_FMTLINES:
|
||||||
TRACE_EDIT_MSG32("EM_FMTLINES Passed to edit control");
|
TRACE_EDIT_MSG32("EM_FMTLINES Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETFIRSTVISIBLELINE:
|
case EM_GETFIRSTVISIBLELINE:
|
||||||
TRACE_EDIT_MSG32("EM_GETFIRSTVISIBLELINE Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETFIRSTVISIBLELINE Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETHANDLE:
|
case EM_GETHANDLE:
|
||||||
TRACE_EDIT_MSG32("EM_GETHANDLE Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETHANDLE Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
/* case EM_GETIMESTATUS:*/
|
/* case EM_GETIMESTATUS:*/
|
||||||
case EM_GETLIMITTEXT:
|
case EM_GETLIMITTEXT:
|
||||||
TRACE_EDIT_MSG32("EM_GETLIMITTEXT Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETLIMITTEXT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETLINE:
|
case EM_GETLINE:
|
||||||
TRACE_EDIT_MSG32("EM_GETLINE Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETLINE Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETLINECOUNT:
|
case EM_GETLINECOUNT:
|
||||||
TRACE_EDIT_MSG32("EM_GETLINECOUNT Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETLINECOUNT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETMARGINS:
|
case EM_GETMARGINS:
|
||||||
TRACE_EDIT_MSG32("EM_GETMARGINS Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETMARGINS Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETMODIFY:
|
case EM_GETMODIFY:
|
||||||
TRACE_EDIT_MSG32("EM_GETMODIFY Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETMODIFY Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETPASSWORDCHAR:
|
case EM_GETPASSWORDCHAR:
|
||||||
TRACE_EDIT_MSG32("EM_GETPASSWORDCHAR Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETPASSWORDCHAR Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETRECT:
|
case EM_GETRECT:
|
||||||
TRACE_EDIT_MSG32("EM_GETRECT Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETRECT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETSEL:
|
case EM_GETSEL:
|
||||||
TRACE_EDIT_MSG32("EM_GETSEL Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETSEL Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETTHUMB:
|
case EM_GETTHUMB:
|
||||||
TRACE_EDIT_MSG32("EM_GETTHUMB Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETTHUMB Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_GETWORDBREAKPROC:
|
case EM_GETWORDBREAKPROC:
|
||||||
TRACE_EDIT_MSG32("EM_GETWORDBREAKPROC Passed to edit control");
|
TRACE_EDIT_MSG32("EM_GETWORDBREAKPROC Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_LINEFROMCHAR:
|
case EM_LINEFROMCHAR:
|
||||||
TRACE_EDIT_MSG32("EM_LINEFROMCHAR Passed to edit control");
|
TRACE_EDIT_MSG32("EM_LINEFROMCHAR Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_LINEINDEX:
|
case EM_LINEINDEX:
|
||||||
TRACE_EDIT_MSG32("EM_LINEINDEX Passed to edit control");
|
TRACE_EDIT_MSG32("EM_LINEINDEX Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_LINELENGTH:
|
case EM_LINELENGTH:
|
||||||
TRACE_EDIT_MSG32("EM_LINELENGTH Passed to edit control");
|
TRACE_EDIT_MSG32("EM_LINELENGTH Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_LINESCROLL:
|
case EM_LINESCROLL:
|
||||||
TRACE_EDIT_MSG32("EM_LINESCROLL Passed to edit control");
|
TRACE_EDIT_MSG32("EM_LINESCROLL Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_POSFROMCHAR:
|
case EM_POSFROMCHAR:
|
||||||
TRACE_EDIT_MSG32("EM_POSFROMCHAR Passed to edit control");
|
TRACE_EDIT_MSG32("EM_POSFROMCHAR Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_REPLACESEL:
|
case EM_REPLACESEL:
|
||||||
TRACE_EDIT_MSG32("case EM_REPLACESEL Passed to edit control");
|
TRACE_EDIT_MSG32("case EM_REPLACESEL Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SCROLL:
|
case EM_SCROLL:
|
||||||
TRACE_EDIT_MSG32("case EM_SCROLL Passed to edit control");
|
TRACE_EDIT_MSG32("case EM_SCROLL Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SCROLLCARET:
|
case EM_SCROLLCARET:
|
||||||
TRACE_EDIT_MSG32("EM_SCROLLCARET Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SCROLLCARET Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETHANDLE:
|
case EM_SETHANDLE:
|
||||||
TRACE_EDIT_MSG32("EM_SETHANDLE Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETHANDLE Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
/* case EM_SETIMESTATUS:*/
|
/* case EM_SETIMESTATUS:*/
|
||||||
case EM_SETLIMITTEXT:
|
case EM_SETLIMITTEXT:
|
||||||
TRACE_EDIT_MSG32("EM_SETLIMITTEXT Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETLIMITTEXT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETMARGINS:
|
case EM_SETMARGINS:
|
||||||
TRACE_EDIT_MSG32("case EM_SETMARGINS Passed to edit control");
|
TRACE_EDIT_MSG32("case EM_SETMARGINS Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETMODIFY:
|
case EM_SETMODIFY:
|
||||||
TRACE_EDIT_MSG32("EM_SETMODIFY Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETMODIFY Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETPASSWORDCHAR:
|
case EM_SETPASSWORDCHAR:
|
||||||
TRACE_EDIT_MSG32("EM_SETPASSWORDCHAR Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETPASSWORDCHAR Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETREADONLY:
|
case EM_SETREADONLY:
|
||||||
TRACE_EDIT_MSG32("EM_SETREADONLY Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETREADONLY Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETRECT:
|
case EM_SETRECT:
|
||||||
TRACE_EDIT_MSG32("EM_SETRECT Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETRECT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETRECTNP:
|
case EM_SETRECTNP:
|
||||||
TRACE_EDIT_MSG32("EM_SETRECTNP Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETRECTNP Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETSEL:
|
case EM_SETSEL:
|
||||||
TRACE_EDIT_MSG32("EM_SETSEL Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETSEL Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETTABSTOPS:
|
case EM_SETTABSTOPS:
|
||||||
TRACE_EDIT_MSG32("EM_SETTABSTOPS Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETTABSTOPS Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_SETWORDBREAKPROC:
|
case EM_SETWORDBREAKPROC:
|
||||||
TRACE_EDIT_MSG32("EM_SETWORDBREAKPROC Passed to edit control");
|
TRACE_EDIT_MSG32("EM_SETWORDBREAKPROC Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case EM_UNDO:
|
case EM_UNDO:
|
||||||
TRACE_EDIT_MSG32("EM_UNDO Passed to edit control");
|
TRACE_EDIT_MSG32("EM_UNDO Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
|
|
||||||
case WM_STYLECHANGING:
|
case WM_STYLECHANGING:
|
||||||
TRACE_EDIT_MSG32("WM_STYLECHANGING Passed to edit control");
|
TRACE_EDIT_MSG32("WM_STYLECHANGING Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_STYLECHANGED:
|
case WM_STYLECHANGED:
|
||||||
TRACE_EDIT_MSG32("WM_STYLECHANGED Passed to edit control");
|
TRACE_EDIT_MSG32("WM_STYLECHANGED Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_GETTEXT:
|
case WM_GETTEXT:
|
||||||
TRACE_EDIT_MSG32("WM_GETTEXT Passed to edit control");
|
TRACE_EDIT_MSG32("WM_GETTEXT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_GETTEXTLENGTH:
|
case WM_GETTEXTLENGTH:
|
||||||
TRACE_EDIT_MSG32("WM_GETTEXTLENGTH Passed to edit control");
|
TRACE_EDIT_MSG32("WM_GETTEXTLENGTH Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_SETTEXT:
|
case WM_SETTEXT:
|
||||||
TRACE_EDIT_MSG32("WM_SETTEXT Passed to edit control");
|
TRACE_EDIT_MSG32("WM_SETTEXT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_CUT:
|
case WM_CUT:
|
||||||
TRACE_EDIT_MSG32("WM_CUT Passed to edit control");
|
TRACE_EDIT_MSG32("WM_CUT Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_COPY:
|
case WM_COPY:
|
||||||
TRACE_EDIT_MSG32("WM_COPY Passed to edit control");
|
TRACE_EDIT_MSG32("WM_COPY Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
case WM_PASTE:
|
case WM_PASTE:
|
||||||
TRACE_EDIT_MSG32("WM_PASTE Passed to edit control");
|
TRACE_EDIT_MSG32("WM_PASTE Passed to edit control");
|
||||||
return SendMessageA( hwndEdit, uMsg, wParam, lParam);
|
return SendMessageA( info->hwndEdit, uMsg, wParam, lParam);
|
||||||
|
|
||||||
/* Messages passed to default handler. */
|
/* Messages passed to default handler. */
|
||||||
case WM_NCCALCSIZE:
|
case WM_NCCALCSIZE:
|
||||||
|
@ -678,6 +691,8 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
|
||||||
return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
TRACE_EDIT_MSG32("WM_DESTROY Passed to default");
|
TRACE_EDIT_MSG32("WM_DESTROY Passed to default");
|
||||||
|
HeapFree( GetProcessHeap(), 0, info->parser );
|
||||||
|
HeapFree( GetProcessHeap(), 0, info );
|
||||||
return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
return DefWindowProcA( hwnd,uMsg,wParam,lParam);
|
||||||
case WM_CHILDACTIVATE:
|
case WM_CHILDACTIVATE:
|
||||||
TRACE_EDIT_MSG32("WM_CHILDACTIVATE Passed to default");
|
TRACE_EDIT_MSG32("WM_CHILDACTIVATE Passed to default");
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "richedit.h"
|
#include "richedit.h"
|
||||||
|
|
||||||
void RTFSetEditStream(EDITSTREAM *es);
|
|
||||||
|
|
||||||
|
|
||||||
/* The following defines are automatically generated. Do not edit. */
|
/* The following defines are automatically generated. Do not edit. */
|
||||||
|
|
||||||
|
@ -420,21 +418,6 @@ void RTFSetEditStream(EDITSTREAM *es);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Information pertaining to last token read by RTFToken. The
|
|
||||||
* text is exactly as it occurs in the input file, e.g., "\{"
|
|
||||||
* will be found in rtfTextBuf as "\{", even though it means "{".
|
|
||||||
* These variables are also set when styles are reprocessed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern char *rtfTextBuf; /* text of token */
|
|
||||||
extern int rtfTextLen; /* length of token in rtfTextBuf */
|
|
||||||
extern int rtfClass; /* token class */
|
|
||||||
extern int rtfMajor; /* token major number */
|
|
||||||
extern int rtfMinor; /* token minor number */
|
|
||||||
extern int rtfParam; /* control symbol parameter */
|
|
||||||
extern int rtfFormat; /* either SF_RTF or SF_TEXT */
|
|
||||||
|
|
||||||
# ifdef THINK_C
|
# ifdef THINK_C
|
||||||
# define rtfNoParam (-32768) /* 16-bit max. neg. value */
|
# define rtfNoParam (-32768) /* 16-bit max. neg. value */
|
||||||
# endif
|
# endif
|
||||||
|
@ -442,8 +425,8 @@ extern int rtfFormat; /* either SF_RTF or SF_TEXT */
|
||||||
# define rtfNoParam (-1000000)
|
# define rtfNoParam (-1000000)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
extern long rtfLineNum; /* input line number */
|
|
||||||
extern int rtfLinePos; /* input line position */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For some reason, the no-style number is 222
|
* For some reason, the no-style number is 222
|
||||||
|
@ -1391,46 +1374,167 @@ struct RTFStyleElt
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef void (*RTFFuncPtr) (); /* generic function pointer */
|
#include "charlist.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return pointer to new element of type t, or NULL
|
||||||
|
* if no memory available.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define New(t) ((t *) RTFAlloc ((int) sizeof (t)))
|
||||||
|
|
||||||
|
/* maximum number of character values representable in a byte */
|
||||||
|
|
||||||
|
# define charSetSize 256
|
||||||
|
|
||||||
|
/* charset stack size */
|
||||||
|
|
||||||
|
# define maxCSStack 10
|
||||||
|
|
||||||
|
|
||||||
|
struct _RTF_Info;
|
||||||
|
typedef struct _RTF_Info RTF_Info;
|
||||||
|
|
||||||
|
typedef void (*RTFFuncPtr) (RTF_Info *); /* generic function pointer */
|
||||||
|
|
||||||
|
struct _RTF_Info {
|
||||||
|
/*
|
||||||
|
* Public variables (listed in rtf.h)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Information pertaining to last token read by RTFToken. The
|
||||||
|
* text is exactly as it occurs in the input file, e.g., "\{"
|
||||||
|
* will be found in rtfTextBuf as "\{", even though it means "{".
|
||||||
|
* These variables are also set when styles are reprocessed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int rtfClass;
|
||||||
|
int rtfMajor;
|
||||||
|
int rtfMinor;
|
||||||
|
int rtfParam;
|
||||||
|
int rtfFormat;
|
||||||
|
char *rtfTextBuf;
|
||||||
|
int rtfTextLen;
|
||||||
|
|
||||||
|
long rtfLineNum;
|
||||||
|
int rtfLinePos;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Private stuff
|
||||||
|
*/
|
||||||
|
|
||||||
|
int pushedChar; /* pushback char if read too far */
|
||||||
|
|
||||||
|
int pushedClass; /* pushed token info for RTFUngetToken() */
|
||||||
|
int pushedMajor;
|
||||||
|
int pushedMinor;
|
||||||
|
int pushedParam;
|
||||||
|
char *pushedTextBuf;
|
||||||
|
|
||||||
|
int prevChar;
|
||||||
|
int bumpLine;
|
||||||
|
|
||||||
|
RTFFont *fontList; /* these lists MUST be */
|
||||||
|
RTFColor *colorList; /* initialized to NULL */
|
||||||
|
RTFStyle *styleList;
|
||||||
|
|
||||||
|
char *inputName;
|
||||||
|
char *outputName;
|
||||||
|
|
||||||
|
EDITSTREAM editstream;
|
||||||
|
CHARLIST inputCharList ;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These arrays are used to map RTF input character values onto the standard
|
||||||
|
* character names represented by the values. Input character values are
|
||||||
|
* used as indices into the arrays to produce standard character codes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
char *genCharSetFile ;
|
||||||
|
int genCharCode[charSetSize]; /* general */
|
||||||
|
int haveGenCharSet;
|
||||||
|
|
||||||
|
char *symCharSetFile;
|
||||||
|
int symCharCode[charSetSize]; /* symbol */
|
||||||
|
int haveSymCharSet;
|
||||||
|
|
||||||
|
int curCharSet;
|
||||||
|
int *curCharCode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By default, the reader is configured to handle charset mapping invisibly,
|
||||||
|
* including reading the charset files and switching charset maps as necessary
|
||||||
|
* for Symbol font.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int autoCharSetFlags;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stack for keeping track of charset map on group begin/end. This is
|
||||||
|
* necessary because group termination reverts the font to the previous
|
||||||
|
* value, which may implicitly change it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int csStack[maxCSStack];
|
||||||
|
int csTop;
|
||||||
|
|
||||||
|
RTFFuncPtr ccb[rtfMaxClass]; /* class callbacks */
|
||||||
|
|
||||||
|
RTFFuncPtr dcb[rtfMaxDestination]; /* destination callbacks */
|
||||||
|
|
||||||
|
RTFFuncPtr readHook;
|
||||||
|
|
||||||
|
RTFFuncPtr panicProc;
|
||||||
|
|
||||||
|
FILE *(*libFileOpen) ();
|
||||||
|
|
||||||
|
char *outMap[rtfSC_MaxChar];
|
||||||
|
|
||||||
|
CHARLIST charlist;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public RTF reader routines
|
* Public RTF reader routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void RTFInit ();
|
void RTFInit (RTF_Info *);
|
||||||
void RTFSetInputName ();
|
void RTFSetInputName (RTF_Info *, char *);
|
||||||
char *RTFGetInputName ();
|
char *RTFGetInputName (RTF_Info *);
|
||||||
void RTFSetOutputName ();
|
void RTFSetOutputName (RTF_Info *, char *);
|
||||||
char *RTFGetOutputName ();
|
char *RTFGetOutputName (RTF_Info *);
|
||||||
void RTFSetClassCallback ();
|
void RTFSetClassCallback (RTF_Info *, int, RTFFuncPtr);
|
||||||
RTFFuncPtr RTFGetClassCallback ();
|
RTFFuncPtr RTFGetClassCallback (RTF_Info *, int);
|
||||||
void RTFSetDestinationCallback ();
|
void RTFSetDestinationCallback (RTF_Info *, int, RTFFuncPtr);
|
||||||
RTFFuncPtr RTFGetDestinationCallback ();
|
RTFFuncPtr RTFGetDestinationCallback (RTF_Info *, int);
|
||||||
void RTFRead ();
|
void RTFRead (RTF_Info *);
|
||||||
int RTFGetToken (); /* writer should rarely need this */
|
int RTFGetToken (RTF_Info *); /* writer should rarely need this */
|
||||||
void RTFUngetToken ();
|
void RTFUngetToken (RTF_Info *);
|
||||||
int RTFPeekToken ();
|
int RTFPeekToken (RTF_Info *);
|
||||||
void RTFSetToken ();
|
void RTFSetToken (RTF_Info *, int, int, int, int, char *);
|
||||||
void RTFSetReadHook ();
|
void RTFSetReadHook (RTF_Info *, RTFFuncPtr);
|
||||||
RTFFuncPtr RTFGetReadHook ();
|
RTFFuncPtr RTFGetReadHook (RTF_Info *);
|
||||||
void RTFRouteToken ();
|
void RTFRouteToken (RTF_Info *);
|
||||||
void RTFSkipGroup ();
|
void RTFSkipGroup (RTF_Info *);
|
||||||
void RTFExpandStyle ();
|
void RTFExpandStyle (RTF_Info *, int);
|
||||||
int RTFCheckCM ();
|
int RTFCheckCM (RTF_Info *, int, int);
|
||||||
int RTFCheckCMM ();
|
int RTFCheckCMM (RTF_Info *, int, int, int);
|
||||||
int RTFCheckMM ();
|
int RTFCheckMM (RTF_Info *, int, int);
|
||||||
RTFFont *RTFGetFont ();
|
RTFFont *RTFGetFont (RTF_Info *, int);
|
||||||
RTFColor *RTFGetColor ();
|
RTFColor *RTFGetColor (RTF_Info *, int);
|
||||||
RTFStyle *RTFGetStyle ();
|
RTFStyle *RTFGetStyle (RTF_Info *, int);
|
||||||
# define RTFAlloc(size) _RTFAlloc ((int) size)
|
# define RTFAlloc(size) _RTFAlloc ((int) size)
|
||||||
char *_RTFAlloc ();
|
char *_RTFAlloc (int);
|
||||||
char *RTFStrSave ();
|
char *RTFStrSave (char *);
|
||||||
void RTFFree ();
|
void RTFFree (char *);
|
||||||
int RTFCharToHex (char);
|
int RTFCharToHex ( char);
|
||||||
int RTFHexToChar ();
|
int RTFHexToChar ( int );
|
||||||
void RTFSetMsgProc ();
|
void RTFSetMsgProc ( RTFFuncPtr );
|
||||||
void RTFSetPanicProc ();
|
void RTFSetPanicProc ( RTF_Info *, RTFFuncPtr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following messing around is used to allow RTFMsg() and RTFPanic()
|
* The following messing around is used to allow RTFMsg() and RTFPanic()
|
||||||
|
@ -1439,20 +1543,22 @@ void RTFSetPanicProc ();
|
||||||
* stdarg.h.
|
* stdarg.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void RTFMsg (char *fmt, ...);
|
void RTFMsg (RTF_Info *, char *fmt, ...);
|
||||||
void RTFPanic (char *fmt, ...);
|
void RTFPanic (RTF_Info *, char *fmt, ...);
|
||||||
|
|
||||||
int RTFReadOutputMap ();
|
int RTFReadOutputMap ( RTF_Info *, char *[], int);
|
||||||
int RTFReadCharSetMap ();
|
int RTFReadCharSetMap ( RTF_Info *, int);
|
||||||
void RTFSetCharSetMap ();
|
void RTFSetCharSetMap ( RTF_Info *, char *, int);
|
||||||
int RTFStdCharCode ();
|
int RTFStdCharCode ( RTF_Info *, char *);
|
||||||
char *RTFStdCharName ();
|
char *RTFStdCharName ( RTF_Info *, int);
|
||||||
int RTFMapChar ();
|
int RTFMapChar ( RTF_Info *, int);
|
||||||
int RTFGetCharSet();
|
int RTFGetCharSet( RTF_Info * );
|
||||||
void RTFSetCharSet();
|
void RTFSetCharSet( RTF_Info *, int);
|
||||||
|
|
||||||
/*char *RTFGetLibPrefix();*/
|
/*char *RTFGetLibPrefix();*/
|
||||||
void RTFSetOpenLibFileProc ();
|
void RTFSetOpenLibFileProc ( RTF_Info *, FILE *(*)());
|
||||||
FILE *RTFOpenLibFile ();
|
FILE *RTFOpenLibFile ( RTF_Info *, char *, char *);
|
||||||
|
|
||||||
|
void RTFSetEditStream(RTF_Info *, EDITSTREAM *es);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,20 +45,22 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||||
|
|
||||||
static void TextClass ();
|
static void TextClass (RTF_Info *info);
|
||||||
static void ControlClass ();
|
static void ControlClass (RTF_Info *info);
|
||||||
static void Destination ();
|
static void Destination (RTF_Info *info);
|
||||||
static void SpecialChar ();
|
static void SpecialChar (RTF_Info *info);
|
||||||
static void PutStdChar ();
|
static void PutStdChar (RTF_Info *info, int stdCode);
|
||||||
static void PutLitChar ();
|
static void PutLitChar (RTF_Info *info, int c);
|
||||||
static void PutLitStr ();
|
static void PutLitStr (RTF_Info *info, char *s);
|
||||||
|
|
||||||
|
#if 0
|
||||||
static char *outMap[rtfSC_MaxChar];
|
static char *outMap[rtfSC_MaxChar];
|
||||||
|
|
||||||
static CHARLIST charlist = {0, NULL, NULL};
|
static CHARLIST charlist = {0, NULL, NULL};
|
||||||
|
#endif
|
||||||
|
|
||||||
int RTFToBuffer(char* pBuffer, int nBufferSize);
|
/*int RTFToBuffer(char* pBuffer, int nBufferSize); */
|
||||||
int RTFToBuffer(char* pBuffer, int nBufferSize)
|
int RTFToBuffer(RTF_Info *info, char* pBuffer, int nBufferSize)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* check if the buffer is big enough to hold all characters */
|
/* check if the buffer is big enough to hold all characters */
|
||||||
|
@ -66,13 +68,13 @@ int RTFToBuffer(char* pBuffer, int nBufferSize)
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if(nBufferSize < charlist.nCount + 1) {
|
if(nBufferSize < info->charlist.nCount + 1) {
|
||||||
return charlist.nCount + CHARLIST_CountChar(&charlist, '\n') + 1;
|
return info->charlist.nCount + CHARLIST_CountChar(&info->charlist, '\n') + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(charlist.nCount)
|
while(info->charlist.nCount)
|
||||||
{
|
{
|
||||||
*pBuffer = CHARLIST_Dequeue(&charlist);
|
*pBuffer = CHARLIST_Dequeue(&info->charlist);
|
||||||
if(*pBuffer=='\n')
|
if(*pBuffer=='\n')
|
||||||
{
|
{
|
||||||
*pBuffer = '\r';
|
*pBuffer = '\r';
|
||||||
|
@ -92,19 +94,19 @@ int RTFToBuffer(char* pBuffer, int nBufferSize)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
WriterInit ()
|
WriterInit (RTF_Info *info )
|
||||||
{
|
{
|
||||||
RTFReadOutputMap (outMap,1);
|
RTFReadOutputMap (info, info->outMap,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
BeginFile ()
|
BeginFile (RTF_Info *info )
|
||||||
{
|
{
|
||||||
/* install class callbacks */
|
/* install class callbacks */
|
||||||
|
|
||||||
RTFSetClassCallback (rtfText, TextClass);
|
RTFSetClassCallback (info, rtfText, TextClass);
|
||||||
RTFSetClassCallback (rtfControl, ControlClass);
|
RTFSetClassCallback (info, rtfControl, ControlClass);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -119,38 +121,38 @@ BeginFile ()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
TextClass ()
|
TextClass (RTF_Info *info)
|
||||||
{
|
{
|
||||||
char buf[rtfBufSiz];
|
char buf[rtfBufSiz];
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if (rtfFormat == SF_TEXT)
|
if (info->rtfFormat == SF_TEXT)
|
||||||
PutLitChar (rtfMajor);
|
PutLitChar (info, info->rtfMajor);
|
||||||
else if (rtfMinor != rtfSC_nothing)
|
else if (info->rtfMinor != rtfSC_nothing)
|
||||||
PutStdChar (rtfMinor);
|
PutStdChar (info, info->rtfMinor);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (rtfMajor < 128) /* in ASCII range */
|
if (info->rtfMajor < 128) /* in ASCII range */
|
||||||
sprintf (buf, "[[%c]]", rtfMajor);
|
sprintf (buf, "[[%c]]", info->rtfMajor);
|
||||||
else
|
else
|
||||||
sprintf (buf, "[[\\'%02x]]", rtfMajor);
|
sprintf (buf, "[[\\'%02x]]", info->rtfMajor);
|
||||||
PutLitStr (buf);
|
PutLitStr (info, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ControlClass ()
|
ControlClass (RTF_Info *info)
|
||||||
{
|
{
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
switch (rtfMajor)
|
switch (info->rtfMajor)
|
||||||
{
|
{
|
||||||
case rtfDestination:
|
case rtfDestination:
|
||||||
Destination ();
|
Destination (info);
|
||||||
break;
|
break;
|
||||||
case rtfSpecialChar:
|
case rtfSpecialChar:
|
||||||
SpecialChar ();
|
SpecialChar (info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,12 +165,12 @@ ControlClass ()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Destination ()
|
Destination (RTF_Info *info)
|
||||||
{
|
{
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
switch (rtfMinor)
|
switch (info->rtfMinor)
|
||||||
{
|
{
|
||||||
case rtfPict:
|
case rtfPict:
|
||||||
case rtfFNContSep:
|
case rtfFNContSep:
|
||||||
|
@ -183,7 +185,7 @@ Destination ()
|
||||||
case rtfIComment:
|
case rtfIComment:
|
||||||
case rtfIVersion:
|
case rtfIVersion:
|
||||||
case rtfIDoccomm:
|
case rtfIDoccomm:
|
||||||
RTFSkipGroup ();
|
RTFSkipGroup (info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,52 +197,52 @@ Destination ()
|
||||||
* can be controlled by the text-map file.
|
* can be controlled by the text-map file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void SpecialChar ()
|
void SpecialChar (RTF_Info *info)
|
||||||
{
|
{
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
switch (rtfMinor)
|
switch (info->rtfMinor)
|
||||||
{
|
{
|
||||||
case rtfPage:
|
case rtfPage:
|
||||||
case rtfSect:
|
case rtfSect:
|
||||||
case rtfRow:
|
case rtfRow:
|
||||||
case rtfLine:
|
case rtfLine:
|
||||||
case rtfPar:
|
case rtfPar:
|
||||||
PutLitChar ('\n');
|
PutLitChar (info, '\n');
|
||||||
break;
|
break;
|
||||||
case rtfCell:
|
case rtfCell:
|
||||||
PutStdChar (rtfSC_space); /* make sure cells are separated */
|
PutStdChar (info, rtfSC_space); /* make sure cells are separated */
|
||||||
break;
|
break;
|
||||||
case rtfNoBrkSpace:
|
case rtfNoBrkSpace:
|
||||||
PutStdChar (rtfSC_nobrkspace);
|
PutStdChar (info, rtfSC_nobrkspace);
|
||||||
break;
|
break;
|
||||||
case rtfTab:
|
case rtfTab:
|
||||||
PutLitChar ('\t');
|
PutLitChar (info, '\t');
|
||||||
break;
|
break;
|
||||||
case rtfNoBrkHyphen:
|
case rtfNoBrkHyphen:
|
||||||
PutStdChar (rtfSC_nobrkhyphen);
|
PutStdChar (info, rtfSC_nobrkhyphen);
|
||||||
break;
|
break;
|
||||||
case rtfBullet:
|
case rtfBullet:
|
||||||
PutStdChar (rtfSC_bullet);
|
PutStdChar (info, rtfSC_bullet);
|
||||||
break;
|
break;
|
||||||
case rtfEmDash:
|
case rtfEmDash:
|
||||||
PutStdChar (rtfSC_emdash);
|
PutStdChar (info, rtfSC_emdash);
|
||||||
break;
|
break;
|
||||||
case rtfEnDash:
|
case rtfEnDash:
|
||||||
PutStdChar (rtfSC_endash);
|
PutStdChar (info, rtfSC_endash);
|
||||||
break;
|
break;
|
||||||
case rtfLQuote:
|
case rtfLQuote:
|
||||||
PutStdChar (rtfSC_quoteleft);
|
PutStdChar (info, rtfSC_quoteleft);
|
||||||
break;
|
break;
|
||||||
case rtfRQuote:
|
case rtfRQuote:
|
||||||
PutStdChar (rtfSC_quoteright);
|
PutStdChar (info, rtfSC_quoteright);
|
||||||
break;
|
break;
|
||||||
case rtfLDblQuote:
|
case rtfLDblQuote:
|
||||||
PutStdChar (rtfSC_quotedblleft);
|
PutStdChar (info, rtfSC_quotedblleft);
|
||||||
break;
|
break;
|
||||||
case rtfRDblQuote:
|
case rtfRDblQuote:
|
||||||
PutStdChar (rtfSC_quotedblright);
|
PutStdChar (info, rtfSC_quotedblright);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,7 +257,7 @@ void SpecialChar ()
|
||||||
* obvious and provides incentive to fix it. :-)
|
* obvious and provides incentive to fix it. :-)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PutStdChar (int stdCode)
|
void PutStdChar (RTF_Info *info, int stdCode)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *oStr = (char *) NULL;
|
char *oStr = (char *) NULL;
|
||||||
|
@ -266,28 +268,28 @@ void PutStdChar (int stdCode)
|
||||||
*/
|
*/
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
oStr = outMap[stdCode];
|
oStr = info->outMap[stdCode];
|
||||||
if (oStr == (char *) NULL) /* no output sequence in map */
|
if (oStr == (char *) NULL) /* no output sequence in map */
|
||||||
{
|
{
|
||||||
sprintf (buf, "[[%s]]", RTFStdCharName (stdCode));
|
sprintf (buf, "[[%s]]", RTFStdCharName (info, stdCode));
|
||||||
oStr = buf;
|
oStr = buf;
|
||||||
}
|
}
|
||||||
PutLitStr (oStr);
|
PutLitStr (info, oStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PutLitChar (int c)
|
void PutLitChar (RTF_Info *info, int c)
|
||||||
{
|
{
|
||||||
CHARLIST_Enqueue(&charlist, (char) c);
|
CHARLIST_Enqueue(&info->charlist, (char) c);
|
||||||
/* fputc (c, ostream); */
|
/* fputc (c, ostream); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void PutLitStr (char *s)
|
static void PutLitStr (RTF_Info *info, char *s)
|
||||||
{
|
{
|
||||||
for(;*s;s++)
|
for(;*s;s++)
|
||||||
{
|
{
|
||||||
CHARLIST_Enqueue(&charlist, *s);
|
CHARLIST_Enqueue(&info->charlist, *s);
|
||||||
}
|
}
|
||||||
/* fputs (s, ostream); */
|
/* fputs (s, ostream); */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue