26#define STREAMOUT_BUFFER_SIZE 4096
27#define STREAMOUT_FONTTBL_SIZE 8192
28#define STREAMOUT_COLORTBL_SIZE 1024
73 TRACE(
"sending %u bytes\n", pStream->
pos);
74 nWritten = pStream->
pos;
76 pStream->
pos, &nWritten);
77 TRACE(
"error=%lu written=%lu\n",
stream->dwError, nWritten);
78 if (nWritten == 0 ||
stream->dwError)
82 if (nWritten == pStream->
pos)
93 TRACE(
"total length = %lu\n", written);
135#define HEX_BYTES_PER_LINE 40
143 static const char hex[] =
"0123456789abcdef";
165 const char *cCharSet =
NULL;
173 switch (
HIWORD(dwFormat)) {
180 if (nCodePage == 437)
182 else if (nCodePage == 850)
199 nCodePage =
info.CodePage;
222 if (!
ME_StreamOutPrint(pStream,
"\\deff0\\deflang%u\\deflangfe%u", language, language))
241 for (
i = 0;
i <
stream->nFontTblLen;
i++)
262 facename =
fmt->szFaceName;
264 facename =
stream->fonttbl[0].szFaceName;
265 for (
i = 0;
i <
stream->nFontTblLen;
i++)
267 if (facename ==
stream->fonttbl[
i].szFaceName
270 ||
fmt->bCharSet ==
stream->fonttbl[
i].bCharSet)
277 return i <
stream->nFontTblLen;
284 for (
i = 1;
i <
stream->nColorTblLen;
i++)
300 for (
i = 1;
i <
stream->nColorTblLen;
i++)
309 return i <
stream->nFontTblLen;
331 if (run->
para != prev_para)
334 if (run->
para->fmt.wNumbering)
341 for (
i = 0;
i < 4;
i++)
342 if (borders[
i]->
width > 0)
346 prev_para = run->
para;
349 if (run ==
last)
break;
391 const char sideChar[4] = {
't',
'l',
'b',
'r'};
408 for (
i = 0;
i < 4;
i++)
438 for (
i = 0;
i < 4;
i++)
464 static const char fmt_label[] =
"{\\*\\pn\\pnlvlbody\\pnf%u\\pnindent%d\\pnstart%d%s%s}";
465 static const char fmt_bullet[] =
"{\\*\\pn\\pnlvlblt\\pnf%u\\pnindent%d{\\pntxtb\\'b7}}";
466 static const char dec[] =
"\\pndec";
467 static const char lcltr[] =
"\\pnlcltr";
468 static const char ucltr[] =
"\\pnucltr";
469 static const char lcrm[] =
"\\pnlcrm";
470 static const char ucrm[] =
"\\pnucrm";
471 static const char period[] =
"{\\pntxta.}";
472 static const char paren[] =
"{\\pntxta)}";
473 static const char parens[] =
"{\\pntxtb(}{\\pntxta)}";
484 if (!pn_dest)
return TRUE;
599 switch (
fmt->wAlignment)
620 switch (
fmt->bLineSpacingRule)
665 if (
fmt->dxStartIndent)
667 if (
fmt->dxRightIndent)
670 static const char *
const leader[6] = {
"",
"\\tldot",
"\\tlhyph",
"\\tlul",
"\\tlth",
"\\tleq" };
672 for (
i = 0;
i <
fmt->cTabCount;
i++)
674 switch ((
fmt->rgxTabs[
i] >> 24) & 0xf)
689 if (
fmt->rgxTabs[
i] >> 28 <= 5)
695 if (
fmt->dySpaceAfter)
697 if (
fmt->dySpaceBefore)
699 if (
fmt->sStyle != -1)
704 static const char *
const style[16] = {
"",
"\\bgdkhoriz",
"\\bgdkvert",
"\\bgdkfdiag",
705 "\\bgdkbdiag",
"\\bgdkcross",
"\\bgdkdcross",
706 "\\bghoriz",
"\\bgvert",
"\\bgfdiag",
707 "\\bgbdiag",
"\\bgcross",
"\\bgdcross",
709 if (
fmt->wShadingWeight)
711 if (
fmt->wShadingStyle & 0xF)
713 if ((
fmt->wShadingStyle >> 4) & 0xf)
715 if ((
fmt->wShadingStyle >> 8) & 0xf)
737 const char *on, *off;
756 if ((old_fmt->
dwEffects ^
fmt->dwEffects) & effects[
i].effect)
757 strcat(
props,
fmt->dwEffects & effects[
i].effect ? effects[
i].on : effects[
i].off );
780 if (old_fmt->
lcid !=
fmt->lcid)
784 strcat(
props,
"\\noproof\\lang1024\\langnp1024\\langfe1024\\langfenp1024");
791 if (
fmt->yOffset >= 0)
880 for (
i = 0;
i < nBytes;
i++)
890 }
else if (*
text < 128) {
908 else if ((
BYTE)*letter < 128) {
909 if (*letter ==
'{' || *letter ==
'}' || *letter ==
'\\')
913 for (
i = 0;
i < nBytes;
i++)
934 STGMEDIUM med = { TYMED_NULL };
947 hr = IDataObject_QueryGetData(
data, &
fmt );
948 if (
hr !=
S_OK)
goto done;
950 hr = IDataObject_GetData(
data, &
fmt, &med );
952 if (med.tymed != TYMED_ENHMF)
goto done;
958 if (!emf_bits)
goto done;
991 IDataObject_Release(
data );
1025 if (
cursor.para != prev_para)
1089 nChars =
max(0, nChars -
cursor.run->len);
1133 nCodePage =
HIWORD(dwFormat);
1151 sizeof(
WCHAR) * nLen);
1157 if (
nSize > nBufLen) {
1201 nChars = nTo - nStart;
ios_base &_STLP_CALL dec(ios_base &__s)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
static __inline const char * debugstr_an(const char *s, int n)
#define WideCharToMultiByte
BOOL WINAPI GetCPInfoExW(UINT codepage, DWORD dwFlags, LPCPINFOEXW cpinfo)
LANGID WINAPI GetUserDefaultLangID(void)
UINT WINAPI GetOEMCP(void)
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
void ME_SetCursorToStart(ME_TextEditor *editor, ME_Cursor *cursor)
int ME_MoveCursorChars(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs, BOOL final_eop)
int ME_GetSelectionOfs(ME_TextEditor *editor, LONG *from, LONG *to)
int ME_GetTextLength(ME_TextEditor *editor)
void ME_DestroyContext(ME_Context *c)
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
int RTFCharSetToCodePage(RTF_Info *info, int charset)
static BOOL find_font_in_fonttbl(ME_OutStream *stream, CHARFORMAT2W *fmt, unsigned int *idx)
#define HEX_BYTES_PER_LINE
#define STREAMOUT_BUFFER_SIZE
static LONG ME_StreamOutFree(ME_OutStream *pStream)
static ME_OutStream * ME_StreamOutInit(ME_TextEditor *editor, EDITSTREAM *stream)
static void add_color_to_colortbl(ME_OutStream *stream, COLORREF color)
static BOOL ME_StreamOutRTFHeader(ME_OutStream *pStream, int dwFormat)
LRESULT ME_StreamOutRange(ME_TextEditor *editor, DWORD dwFormat, const ME_Cursor *start, int nChars, EDITSTREAM *stream)
struct tagME_OutStream ME_OutStream
static BOOL find_color_in_colortbl(ME_OutStream *stream, COLORREF color, unsigned int *idx)
static BOOL ME_StreamOutRTFCharProps(ME_OutStream *pStream, CHARFORMAT2W *fmt)
static BOOL ME_StreamOutText(ME_TextEditor *editor, ME_OutStream *pStream, const ME_Cursor *start, int nChars, DWORD dwFormat)
static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream, const ME_Cursor *start, int nChars, int dwFormat)
static BOOL ME_StreamOutHexData(ME_OutStream *stream, const BYTE *data, UINT len)
static BOOL stream_out_font_and_colour_tbls(ME_OutStream *pStream, ME_Run *first, ME_Run *last)
LRESULT ME_StreamOut(ME_TextEditor *editor, DWORD dwFormat, EDITSTREAM *stream)
static BOOL WINAPIV ME_StreamOutPrint(ME_OutStream *pStream, const char *format,...)
static BOOL stream_out_para_props(ME_TextEditor *editor, ME_OutStream *pStream, ME_Paragraph *para)
static BOOL stream_out_graphics(ME_TextEditor *editor, ME_OutStream *stream, ME_Run *run)
static void add_font_to_fonttbl(ME_OutStream *stream, ME_Style *style)
static BOOL stream_out_table_props(ME_TextEditor *editor, ME_OutStream *pStream, ME_Paragraph *para)
#define STREAMOUT_COLORTBL_SIZE
static BOOL stream_out_para_num(ME_OutStream *stream, ME_Paragraph *para, BOOL pn_dest)
static BOOL ME_StreamOutRTFText(ME_OutStream *pStream, const WCHAR *text, LONG nChars)
#define STREAMOUT_FONTTBL_SIZE
static BOOL ME_StreamOutFlush(ME_OutStream *pStream)
static BOOL ME_StreamOutMove(ME_OutStream *pStream, const char *buffer, int len)
ME_Cell * cell_next(ME_Cell *cell)
BOOL cursor_next_run(ME_Cursor *cursor, BOOL all_para)
ME_Cell * table_row_first_cell(ME_Paragraph *para)
ME_Cell * para_cell(ME_Paragraph *para)
ME_Paragraph * table_row_end(ME_Paragraph *para)
#define ITextHost_TxGetDC(This)
BOOL para_in_table(ME_Paragraph *para)
#define ITextHost_TxReleaseDC(This, a)
ME_Paragraph * para_prev(ME_Paragraph *para)
static WCHAR * get_text(const ME_Run *run, int offset)
ME_Run * run_next_all_paras(ME_Run *run)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLenum GLuint GLint GLenum face
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memmove(s1, s2, n)
#define sprintf(buf, format,...)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
const GUID IID_IDataObject
#define CFU_UNDERLINEDOUBLE
#define PFE_NOWIDOWCONTROL
#define CFU_UNDERLINEWORD
#define PFM_NOWIDOWCONTROL
#define PFM_PAGEBREAKBEFORE
#define PFE_PAGEBREAKBEFORE
#define CFE_AUTOBACKCOLOR
#define CFU_UNDERLINENONE
#define CFU_UNDERLINEDOTTED
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
COLORREF colortbl[STREAMOUT_COLORTBL_SIZE]
ME_FontTableItem fonttbl[STREAMOUT_FONTTBL_SIZE]
char buffer[STREAMOUT_BUFFER_SIZE]
struct tagME_Paragraph * para
unsigned int bEmulateVersion10
#define FIELD_OFFSET(t, f)
static const WCHAR props[]
#define success(from, fromstr, to, tostr)
*nSize LPSTR _Inout_ LPDWORD nSize
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)