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;
334 if (
item->member.run.para != prev_para)
337 if (
item->member.run.para->fmt.wNumbering)
340 if ((pCell =
item->member.para.pCell))
346 for (
i = 0;
i < 4;
i++)
347 if (borders[
i]->
width > 0)
351 prev_para =
item->member.run.para;
354 if (
item == pLastRun)
398 const char sideChar[4] = {
't',
'l',
'b',
'r'};
416 for (
i = 0;
i < 4;
i++)
444 for (
i = 0;
i < 4;
i++)
470 static const char fmt_label[] =
"{\\*\\pn\\pnlvlbody\\pnf%u\\pnindent%d\\pnstart%d%s%s}";
471 static const char fmt_bullet[] =
"{\\*\\pn\\pnlvlblt\\pnf%u\\pnindent%d{\\pntxtb\\'b7}}";
472 static const char dec[] =
"\\pndec";
473 static const char lcltr[] =
"\\pnlcltr";
474 static const char ucltr[] =
"\\pnucltr";
475 static const char lcrm[] =
"\\pnlcrm";
476 static const char ucrm[] =
"\\pnucrm";
477 static const char period[] =
"{\\pntxta.}";
478 static const char paren[] =
"{\\pntxta)}";
479 static const char parens[] =
"{\\pntxtb(}{\\pntxta)}";
490 if (!pn_dest)
return TRUE;
611 switch (
fmt->wAlignment) {
630 switch (
fmt->bLineSpacingRule) {
674 if (
fmt->dxStartIndent)
676 if (
fmt->dxRightIndent)
679 static const char *
const leader[6] = {
"",
"\\tldot",
"\\tlhyph",
"\\tlul",
"\\tlth",
"\\tleq" };
681 for (
i = 0;
i <
fmt->cTabCount;
i++) {
682 switch ((
fmt->rgxTabs[
i] >> 24) & 0xF) {
696 if (
fmt->rgxTabs[
i] >> 28 <= 5)
702 if (
fmt->dySpaceAfter)
704 if (
fmt->dySpaceBefore)
706 if (
fmt->sStyle != -1)
710 static const char *
const style[16] = {
"",
"\\bgdkhoriz",
"\\bgdkvert",
"\\bgdkfdiag",
711 "\\bgdkbdiag",
"\\bgdkcross",
"\\bgdkdcross",
712 "\\bghoriz",
"\\bgvert",
"\\bgfdiag",
713 "\\bgbdiag",
"\\bgcross",
"\\bgdcross",
715 if (
fmt->wShadingWeight)
717 if (
fmt->wShadingStyle & 0xF)
719 if ((
fmt->wShadingStyle >> 4) & 0xf)
721 if ((
fmt->wShadingStyle >> 8) & 0xf)
743 const char *on, *off;
762 if ((old_fmt->
dwEffects ^
fmt->dwEffects) & effects[
i].effect)
763 strcat(
props,
fmt->dwEffects & effects[
i].effect ? effects[
i].on : effects[
i].off );
786 if (old_fmt->
lcid !=
fmt->lcid)
790 strcat(
props,
"\\noproof\\lang1024\\langnp1024\\langfe1024\\langfenp1024");
797 if (
fmt->yOffset >= 0)
886 for (
i = 0;
i < nBytes;
i++)
896 }
else if (*
text < 128) {
914 else if ((
BYTE)*letter < 128) {
915 if (*letter ==
'{' || *letter ==
'}' || *letter ==
'\\')
919 for (
i = 0;
i < nBytes;
i++)
940 STGMEDIUM med = { TYMED_NULL };
951 hr = IDataObject_QueryGetData(
data, &
fmt );
952 if (
hr !=
S_OK)
goto done;
954 hr = IDataObject_GetData(
data, &
fmt, &med );
956 if (med.tymed != TYMED_ENHMF)
goto done;
962 if (!emf_bits)
goto done;
994 IDataObject_Release(
data );
1027 if (
cursor.pPara != prev_para)
1029 prev_para =
cursor.pPara;
1036 TRACE(
"flags %xh\n",
cursor.pRun->member.run.nFlags);
1078 nChars =
max(0, nChars -
cursor.pRun->member.run.len);
1086 TRACE(
"style %p\n",
cursor.pRun->member.run.style);
1118 nCodePage =
HIWORD(dwFormat);
1127 static const WCHAR szEOL[] = {
'\r',
'\n' };
1137 sizeof(
WCHAR) * nLen);
1143 if (
nSize > nBufLen) {
1187 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 BOOL ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream, ME_DisplayItem *para)
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_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream, ME_DisplayItem *para)
static BOOL ME_StreamOutHexData(ME_OutStream *stream, const BYTE *data, UINT len)
static BOOL ME_StreamOutRTFFontAndColorTbl(ME_OutStream *pStream, ME_DisplayItem *pFirstRun, ME_DisplayItem *pLastRun)
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_graphics(ME_TextEditor *editor, ME_OutStream *stream, ME_Run *run)
static void add_font_to_fonttbl(ME_OutStream *stream, ME_Style *style)
#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)
BOOL ME_NextRun(ME_DisplayItem **para, ME_DisplayItem **run, BOOL all_para) DECLSPEC_HIDDEN
#define ITextHost_TxGetDC(This)
ME_DisplayItem * ME_GetTableRowStart(ME_DisplayItem *para) DECLSPEC_HIDDEN
static WCHAR * get_text(const ME_Run *run, int offset)
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
ME_DisplayItem * ME_GetTableRowEnd(ME_DisplayItem *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,...)
static __ms_va_list valist
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)
struct tagME_DisplayItem * next_cell
union tagME_DisplayItem::@536 member
COLORREF colortbl[STREAMOUT_COLORTBL_SIZE]
ME_FontTableItem fonttbl[STREAMOUT_FONTTBL_SIZE]
char buffer[STREAMOUT_BUFFER_SIZE]
struct tagME_DisplayItem * next_para
struct tagME_DisplayItem * prev_para
#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)