Add richedit support for a plain text stream.

This commit is contained in:
Duane Clark 2002-07-08 19:37:18 +00:00 committed by Alexandre Julliard
parent 52ab395c00
commit 577ea0cbc3
4 changed files with 21 additions and 5 deletions

View File

@ -123,6 +123,7 @@ int rtfClass;
int rtfMajor; int rtfMajor;
int rtfMinor; int rtfMinor;
int rtfParam; int rtfParam;
int rtfFormat;
char *rtfTextBuf = (char *) NULL; char *rtfTextBuf = (char *) NULL;
int rtfTextLen; int rtfTextLen;
@ -540,9 +541,8 @@ RTFFuncPtr p;
(*p) (); /* give read hook a look at token */ (*p) (); /* give read hook a look at token */
/* Silently discard newlines, carriage returns, nulls. */ /* Silently discard newlines, carriage returns, nulls. */
if (!(rtfClass == rtfText if (!(rtfClass == rtfText && rtfFormat != SF_TEXT
&& (rtfMajor == '\n' || rtfMajor == '\r' && (rtfMajor == '\r' || rtfMajor == '\n' || rtfMajor == '\0')))
|| rtfMajor == '\0')))
break; break;
} }
return (rtfClass); return (rtfClass);
@ -604,6 +604,18 @@ RTFFont *fp;
TRACE("\n"); TRACE("\n");
if (rtfFormat == SF_TEXT) {
rtfMajor = GetChar ();
rtfMinor = rtfSC_nothing;
rtfParam = rtfNoParam;
rtfTextBuf[rtfTextLen = 0] = '\0';
if (rtfMajor == EOF)
rtfClass = rtfEOF;
else
rtfClass = rtfText;
return;
}
/* first check for pushed token from RTFUngetToken() */ /* first check for pushed token from RTFUngetToken() */
if (pushedClass >= 0) if (pushedClass >= 0)

View File

@ -175,6 +175,7 @@ static LRESULT WINAPI RICHED32_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
/* setup the RTF parser */ /* setup the RTF parser */
RTFSetEditStream(( EDITSTREAM*)lParam); RTFSetEditStream(( EDITSTREAM*)lParam);
rtfFormat = wParam&(SF_TEXT|SF_RTF);
WriterInit(); WriterInit();
RTFInit (); RTFInit ();
BeginFile(); BeginFile();

View File

@ -432,6 +432,7 @@ extern int rtfClass; /* token class */
extern int rtfMajor; /* token major number */ extern int rtfMajor; /* token major number */
extern int rtfMinor; /* token minor number */ extern int rtfMinor; /* token minor number */
extern int rtfParam; /* control symbol parameter */ 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 */

View File

@ -124,8 +124,10 @@ TextClass ()
char buf[rtfBufSiz]; char buf[rtfBufSiz];
TRACE("\n"); TRACE("\n");
if (rtfMinor != rtfSC_nothing) if (rtfFormat == SF_TEXT)
PutLitChar (rtfMajor);
else if (rtfMinor != rtfSC_nothing)
PutStdChar (rtfMinor); PutStdChar (rtfMinor);
else else
{ {