21#define NONAMELESSUNION
28#define STREAMOUT_BUFFER_SIZE 4096
29#define STREAMOUT_FONTTBL_SIZE 8192
30#define STREAMOUT_COLORTBL_SIZE 1024
57 ME_OutStream *pStream = heap_alloc_zero(
sizeof(*pStream));
75 TRACE(
"sending %u bytes\n", pStream->
pos);
76 nWritten = pStream->
pos;
78 pStream->
pos, &nWritten);
79 TRACE(
"error=%u written=%u\n",
stream->dwError, nWritten);
80 if (nWritten == 0 ||
stream->dwError)
84 if (nWritten == pStream->
pos)
95 TRACE(
"total length = %u\n", written);
137#define HEX_BYTES_PER_LINE 40
145 static const char hex[] =
"0123456789abcdef";
167 const char *cCharSet =
NULL;
175 switch (
HIWORD(dwFormat)) {
182 if (nCodePage == 437)
184 else if (nCodePage == 850)
201 nCodePage =
info.CodePage;
224 if (!
ME_StreamOutPrint(pStream,
"\\deff0\\deflang%u\\deflangfe%u", language, language))
243 for (
i = 0;
i <
stream->nFontTblLen;
i++)
264 facename =
fmt->szFaceName;
266 facename =
stream->fonttbl[0].szFaceName;
267 for (
i = 0;
i <
stream->nFontTblLen;
i++)
269 if (facename ==
stream->fonttbl[
i].szFaceName
272 ||
fmt->bCharSet ==
stream->fonttbl[
i].bCharSet)
279 return i <
stream->nFontTblLen;
286 for (
i = 1;
i <
stream->nColorTblLen;
i++)
302 for (
i = 1;
i <
stream->nColorTblLen;
i++)
311 return i <
stream->nFontTblLen;
333 if (run->
para != prev_para)
336 if (run->
para->fmt.wNumbering)
343 for (
i = 0;
i < 4;
i++)
344 if (borders[
i]->
width > 0)
348 prev_para = run->
para;
351 if (run ==
last)
break;
393 const char sideChar[4] = {
't',
'l',
'b',
'r'};
410 for (
i = 0;
i < 4;
i++)
440 for (
i = 0;
i < 4;
i++)
466 static const char fmt_label[] =
"{\\*\\pn\\pnlvlbody\\pnf%u\\pnindent%d\\pnstart%d%s%s}";
467 static const char fmt_bullet[] =
"{\\*\\pn\\pnlvlblt\\pnf%u\\pnindent%d{\\pntxtb\\'b7}}";
468 static const char dec[] =
"\\pndec";
469 static const char lcltr[] =
"\\pnlcltr";
470 static const char ucltr[] =
"\\pnucltr";
471 static const char lcrm[] =
"\\pnlcrm";
472 static const char ucrm[] =
"\\pnucrm";
473 static const char period[] =
"{\\pntxta.}";
474 static const char paren[] =
"{\\pntxta)}";
475 static const char parens[] =
"{\\pntxtb(}{\\pntxta)}";
486 if (!pn_dest)
return TRUE;
601 switch (
fmt->wAlignment)
622 switch (
fmt->bLineSpacingRule)
667 if (
fmt->dxStartIndent)
669 if (
fmt->dxRightIndent)
672 static const char *
const leader[6] = {
"",
"\\tldot",
"\\tlhyph",
"\\tlul",
"\\tlth",
"\\tleq" };
674 for (
i = 0;
i <
fmt->cTabCount;
i++)
676 switch ((
fmt->rgxTabs[
i] >> 24) & 0xf)
691 if (
fmt->rgxTabs[
i] >> 28 <= 5)
697 if (
fmt->dySpaceAfter)
699 if (
fmt->dySpaceBefore)
701 if (
fmt->sStyle != -1)
706 static const char *
const style[16] = {
"",
"\\bgdkhoriz",
"\\bgdkvert",
"\\bgdkfdiag",
707 "\\bgdkbdiag",
"\\bgdkcross",
"\\bgdkdcross",
708 "\\bghoriz",
"\\bgvert",
"\\bgfdiag",
709 "\\bgbdiag",
"\\bgcross",
"\\bgdcross",
711 if (
fmt->wShadingWeight)
713 if (
fmt->wShadingStyle & 0xF)
715 if ((
fmt->wShadingStyle >> 4) & 0xf)
717 if ((
fmt->wShadingStyle >> 8) & 0xf)
739 const char *on, *off;
758 if ((old_fmt->
dwEffects ^
fmt->dwEffects) & effects[
i].effect)
759 strcat(
props,
fmt->dwEffects & effects[
i].effect ? effects[
i].on : effects[
i].off );
782 if (old_fmt->
lcid !=
fmt->lcid)
786 strcat(
props,
"\\noproof\\lang1024\\langnp1024\\langfe1024\\langfenp1024");
793 if (
fmt->yOffset >= 0)
882 for (
i = 0;
i < nBytes;
i++)
892 }
else if (*
text < 128) {
910 else if ((
BYTE)*letter < 128) {
911 if (*letter ==
'{' || *letter ==
'}' || *letter ==
'\\')
915 for (
i = 0;
i < nBytes;
i++)
936 STGMEDIUM med = { TYMED_NULL };
949 hr = IDataObject_QueryGetData(
data, &
fmt );
950 if (
hr !=
S_OK)
goto done;
952 hr = IDataObject_GetData(
data, &
fmt, &med );
954 if (med.tymed != TYMED_ENHMF)
goto done;
960 if (!emf_bits)
goto done;
993 IDataObject_Release(
data );
1027 if (
cursor.para != prev_para)
1091 nChars =
max(0, nChars -
cursor.run->len);
1135 nCodePage =
HIWORD(dwFormat);
1153 sizeof(
WCHAR) * nLen);
1159 if (
nSize > nBufLen) {
1203 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)
static BOOL heap_free(void *mem)
static void * heap_realloc(void *mem, size_t len)
#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 HeapFree(x, y, z)
#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, int *from, int *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_Run * run_next_all_paras(ME_Run *run) DECLSPEC_HIDDEN
ME_Cell * para_cell(ME_Paragraph *para) DECLSPEC_HIDDEN
BOOL para_in_table(ME_Paragraph *para) DECLSPEC_HIDDEN
#define ITextHost_TxGetDC(This)
ME_Cell * table_row_first_cell(ME_Paragraph *para) DECLSPEC_HIDDEN
ME_Cell * cell_next(ME_Cell *cell) DECLSPEC_HIDDEN
BOOL cursor_next_run(ME_Cursor *cursor, BOOL all_para) DECLSPEC_HIDDEN
#define ITextHost_TxReleaseDC(This, a)
ME_Paragraph * para_prev(ME_Paragraph *para) DECLSPEC_HIDDEN
static WCHAR * get_text(const ME_Run *run, int offset)
ME_Paragraph * table_row_end(ME_Paragraph *para) DECLSPEC_HIDDEN
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
#define __ms_va_end(list)
#define __ms_va_start(list, arg)
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)