mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[RICHED20] Sync with Wine Staging 4.0. CORE-15682
This commit is contained in:
parent
f5580f4c9d
commit
dbfaf10dc0
20 changed files with 968 additions and 584 deletions
|
@ -18,32 +18,27 @@ list(APPEND SOURCE
|
|||
string.c
|
||||
style.c
|
||||
table.c
|
||||
txthost.c
|
||||
txtsrv.c
|
||||
undo.c
|
||||
wrap.c
|
||||
writer.c
|
||||
precomp.h)
|
||||
|
||||
if(MSVC)
|
||||
if(ARCH STREQUAL "i386")
|
||||
list(APPEND SOURCE msvc-thiscall.c)
|
||||
endif()
|
||||
set_source_files_properties(txthost.c txtsrv.c PROPERTIES COMPILE_FLAGS "/FImsvc.h")
|
||||
list(APPEND ADDITIONAL_SOURCE txthost.c txtsrv.c)
|
||||
else()
|
||||
list(APPEND SOURCE txthost.c txtsrv.c)
|
||||
if(MSVC AND (ARCH STREQUAL "i386"))
|
||||
list(APPEND SOURCE msvc-thiscall.c)
|
||||
endif()
|
||||
|
||||
list(APPEND ADDITIONAL_SOURCE
|
||||
version.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/riched20.def)
|
||||
|
||||
list(APPEND riched20_rc_deps
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/riched_tom.rgs
|
||||
${CMAKE_CURRENT_BINARY_DIR}/riched_tom.tlb)
|
||||
|
||||
set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS "${riched20_rc_deps}")
|
||||
|
||||
add_library(riched20 SHARED ${SOURCE} ${ADDITIONAL_SOURCE})
|
||||
add_library(riched20 SHARED
|
||||
${SOURCE}
|
||||
version.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/riched20.def)
|
||||
|
||||
add_typelib(riched_tom.idl)
|
||||
add_dependencies(riched20 stdole2)
|
||||
set_module_type(riched20 win32dll)
|
||||
|
|
|
@ -380,7 +380,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
|
|||
|
||||
c.nOffset -= nCharsToDelete;
|
||||
|
||||
ME_FindItemBack(c.pRun, diParagraph)->member.para.nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, ME_FindItemBack(c.pRun, diParagraph));
|
||||
|
||||
cursor = c;
|
||||
/* nChars is the number of characters that should be deleted from the
|
||||
|
|
|
@ -522,8 +522,8 @@ void ME_RTFCharAttrHook(RTF_Info *info)
|
|||
RTFFont *f = RTFGetFont(info, info->rtfParam);
|
||||
if (f)
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, f->rtfFName, -1, fmt.szFaceName, sizeof(fmt.szFaceName)/sizeof(WCHAR));
|
||||
fmt.szFaceName[sizeof(fmt.szFaceName)/sizeof(WCHAR)-1] = '\0';
|
||||
MultiByteToWideChar(CP_ACP, 0, f->rtfFName, -1, fmt.szFaceName, ARRAY_SIZE(fmt.szFaceName));
|
||||
fmt.szFaceName[ARRAY_SIZE(fmt.szFaceName)-1] = '\0';
|
||||
fmt.bCharSet = f->rtfFCharSet;
|
||||
fmt.dwMask = CFM_FACE | CFM_CHARSET;
|
||||
fmt.bPitchAndFamily = f->rtfFPitch | (f->rtfFFamily << 4);
|
||||
|
@ -2431,6 +2431,181 @@ static void ME_UpdateSelectionLinkAttribute(ME_TextEditor *editor)
|
|||
ME_UpdateLinkAttribute(editor, &start, nChars);
|
||||
}
|
||||
|
||||
static BOOL handle_enter(ME_TextEditor *editor)
|
||||
{
|
||||
BOOL ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000;
|
||||
BOOL shift_is_down = GetKeyState(VK_SHIFT) & 0x8000;
|
||||
|
||||
if (editor->bDialogMode)
|
||||
{
|
||||
if (ctrl_is_down)
|
||||
return TRUE;
|
||||
|
||||
if (!(editor->styleFlags & ES_WANTRETURN))
|
||||
{
|
||||
if (editor->hwndParent)
|
||||
{
|
||||
DWORD dw;
|
||||
dw = SendMessageW(editor->hwndParent, DM_GETDEFID, 0, 0);
|
||||
if (HIWORD(dw) == DC_HASDEFID)
|
||||
{
|
||||
HWND hwDefCtrl = GetDlgItem(editor->hwndParent, LOWORD(dw));
|
||||
if (hwDefCtrl)
|
||||
{
|
||||
SendMessageW(editor->hwndParent, WM_NEXTDLGCTL, (WPARAM)hwDefCtrl, TRUE);
|
||||
PostMessageW(hwDefCtrl, WM_KEYDOWN, VK_RETURN, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (editor->styleFlags & ES_MULTILINE)
|
||||
{
|
||||
static const WCHAR endl = '\r';
|
||||
static const WCHAR endlv10[] = {'\r','\n'};
|
||||
ME_Cursor cursor = editor->pCursors[0];
|
||||
ME_DisplayItem *para = cursor.pPara;
|
||||
int from, to;
|
||||
ME_Style *style, *eop_style;
|
||||
|
||||
if (editor->styleFlags & ES_READONLY)
|
||||
{
|
||||
MessageBeep(MB_ICONERROR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ME_GetSelectionOfs(editor, &from, &to);
|
||||
if (editor->nTextLimit > ME_GetTextLength(editor) - (to-from))
|
||||
{
|
||||
if (!editor->bEmulateVersion10) /* v4.1 */
|
||||
{
|
||||
if (para->member.para.nFlags & MEPF_ROWEND)
|
||||
{
|
||||
/* Add a new table row after this row. */
|
||||
para = ME_AppendTableRow(editor, para);
|
||||
para = para->member.para.next_para;
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_CommitUndo(editor);
|
||||
ME_CheckTablesForCorruption(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
else if (para == editor->pCursors[1].pPara &&
|
||||
cursor.nOffset + cursor.pRun->member.run.nCharOfs == 0 &&
|
||||
para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART &&
|
||||
!para->member.para.prev_para->member.para.nCharOfs)
|
||||
{
|
||||
/* Insert a newline before the table. */
|
||||
para = para->member.para.prev_para;
|
||||
para->member.para.nFlags &= ~MEPF_ROWSTART;
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1,
|
||||
editor->pCursors[0].pRun->member.run.style);
|
||||
para = editor->pBuffer->pFirst->member.para.next_para;
|
||||
ME_SetDefaultParaFormat(editor, ¶->member.para.fmt);
|
||||
para->member.para.nFlags = 0;
|
||||
mark_para_rewrap(editor, para);
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART;
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
ME_CheckTablesForCorruption(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else /* v1.0 - 3.0 */
|
||||
{
|
||||
ME_DisplayItem *para = cursor.pPara;
|
||||
if (ME_IsInTable(para))
|
||||
{
|
||||
if (cursor.pRun->member.run.nFlags & MERF_ENDPARA)
|
||||
{
|
||||
if (from == to)
|
||||
{
|
||||
ME_ContinueCoalescingTransaction(editor);
|
||||
para = ME_AppendTableRow(editor, para);
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ME_ContinueCoalescingTransaction(editor);
|
||||
if (cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 &&
|
||||
!ME_IsInTable(para->member.para.prev_para))
|
||||
{
|
||||
/* Insert newline before table */
|
||||
cursor.pRun = ME_FindItemBack(para, diRun);
|
||||
if (cursor.pRun)
|
||||
{
|
||||
editor->pCursors[0].pRun = cursor.pRun;
|
||||
editor->pCursors[0].pPara = para->member.para.prev_para;
|
||||
}
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1,
|
||||
editor->pCursors[0].pRun->member.run.style);
|
||||
}
|
||||
else
|
||||
{
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
para = ME_AppendTableRow(editor, para);
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
}
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
style = ME_GetInsertStyle(editor, 0);
|
||||
|
||||
/* Normally the new eop style is the insert style, however in a list it is copied from the existing
|
||||
eop style (this prevents the list label style changing when the new eop is inserted).
|
||||
No extra ref is taken here on eop_style. */
|
||||
if (para->member.para.fmt.wNumbering)
|
||||
eop_style = para->member.para.eop_run->style;
|
||||
else
|
||||
eop_style = style;
|
||||
ME_ContinueCoalescingTransaction(editor);
|
||||
if (shift_is_down)
|
||||
ME_InsertEndRowFromCursor(editor, 0);
|
||||
else
|
||||
if (!editor->bEmulateVersion10)
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style);
|
||||
else
|
||||
ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style);
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
SetCursor(NULL);
|
||||
|
||||
ME_UpdateSelectionLinkAttribute(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
ME_SaveTempStyle(editor, style); /* set the temp insert style for the new para */
|
||||
ME_ReleaseStyle(style);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
ME_KeyDown(ME_TextEditor *editor, WORD nKey)
|
||||
{
|
||||
|
@ -2497,161 +2672,8 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
|
|||
ME_SendRequestResize(editor, FALSE);
|
||||
return TRUE;
|
||||
case VK_RETURN:
|
||||
if (editor->bDialogMode)
|
||||
{
|
||||
if (ctrl_is_down)
|
||||
return TRUE;
|
||||
|
||||
if (!(editor->styleFlags & ES_WANTRETURN))
|
||||
{
|
||||
if (editor->hwndParent)
|
||||
{
|
||||
DWORD dw;
|
||||
dw = SendMessageW(editor->hwndParent, DM_GETDEFID, 0, 0);
|
||||
if (HIWORD(dw) == DC_HASDEFID)
|
||||
{
|
||||
HWND hwDefCtrl = GetDlgItem(editor->hwndParent, LOWORD(dw));
|
||||
if (hwDefCtrl)
|
||||
{
|
||||
SendMessageW(editor->hwndParent, WM_NEXTDLGCTL, (WPARAM)hwDefCtrl, TRUE);
|
||||
PostMessageW(hwDefCtrl, WM_KEYDOWN, VK_RETURN, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (editor->styleFlags & ES_MULTILINE)
|
||||
{
|
||||
ME_Cursor cursor = editor->pCursors[0];
|
||||
ME_DisplayItem *para = cursor.pPara;
|
||||
int from, to;
|
||||
const WCHAR endl = '\r';
|
||||
const WCHAR endlv10[] = {'\r','\n'};
|
||||
ME_Style *style, *eop_style;
|
||||
|
||||
if (editor->styleFlags & ES_READONLY) {
|
||||
MessageBeep(MB_ICONERROR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ME_GetSelectionOfs(editor, &from, &to);
|
||||
if (editor->nTextLimit > ME_GetTextLength(editor) - (to-from))
|
||||
{
|
||||
if (!editor->bEmulateVersion10) { /* v4.1 */
|
||||
if (para->member.para.nFlags & MEPF_ROWEND) {
|
||||
/* Add a new table row after this row. */
|
||||
para = ME_AppendTableRow(editor, para);
|
||||
para = para->member.para.next_para;
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_CommitUndo(editor);
|
||||
ME_CheckTablesForCorruption(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
else if (para == editor->pCursors[1].pPara &&
|
||||
cursor.nOffset + cursor.pRun->member.run.nCharOfs == 0 &&
|
||||
para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART &&
|
||||
!para->member.para.prev_para->member.para.nCharOfs)
|
||||
{
|
||||
/* Insert a newline before the table. */
|
||||
para = para->member.para.prev_para;
|
||||
para->member.para.nFlags &= ~MEPF_ROWSTART;
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1,
|
||||
editor->pCursors[0].pRun->member.run.style);
|
||||
para = editor->pBuffer->pFirst->member.para.next_para;
|
||||
ME_SetDefaultParaFormat(editor, ¶->member.para.fmt);
|
||||
para->member.para.nFlags = MEPF_REWRAP;
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART;
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
ME_CheckTablesForCorruption(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
} else { /* v1.0 - 3.0 */
|
||||
ME_DisplayItem *para = cursor.pPara;
|
||||
if (ME_IsInTable(para))
|
||||
{
|
||||
if (cursor.pRun->member.run.nFlags & MERF_ENDPARA)
|
||||
{
|
||||
if (from == to) {
|
||||
ME_ContinueCoalescingTransaction(editor);
|
||||
para = ME_AppendTableRow(editor, para);
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
ME_ContinueCoalescingTransaction(editor);
|
||||
if (cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 &&
|
||||
!ME_IsInTable(para->member.para.prev_para))
|
||||
{
|
||||
/* Insert newline before table */
|
||||
cursor.pRun = ME_FindItemBack(para, diRun);
|
||||
if (cursor.pRun) {
|
||||
editor->pCursors[0].pRun = cursor.pRun;
|
||||
editor->pCursors[0].pPara = para->member.para.prev_para;
|
||||
}
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1,
|
||||
editor->pCursors[0].pRun->member.run.style);
|
||||
} else {
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
para = ME_AppendTableRow(editor, para);
|
||||
editor->pCursors[0].pPara = para;
|
||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
||||
editor->pCursors[0].nOffset = 0;
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
}
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
style = ME_GetInsertStyle(editor, 0);
|
||||
|
||||
/* Normally the new eop style is the insert style, however in a list it is copied from the existing
|
||||
eop style (this prevents the list label style changing when the new eop is inserted).
|
||||
No extra ref is taken here on eop_style. */
|
||||
if (para->member.para.fmt.wNumbering)
|
||||
eop_style = para->member.para.eop_run->style;
|
||||
else
|
||||
eop_style = style;
|
||||
ME_ContinueCoalescingTransaction(editor);
|
||||
if (shift_is_down)
|
||||
ME_InsertEndRowFromCursor(editor, 0);
|
||||
else
|
||||
if (!editor->bEmulateVersion10)
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1, eop_style);
|
||||
else
|
||||
ME_InsertTextFromCursor(editor, 0, endlv10, 2, eop_style);
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
SetCursor(NULL);
|
||||
|
||||
ME_UpdateSelectionLinkAttribute(editor);
|
||||
ME_UpdateRepaint(editor, FALSE);
|
||||
ME_SaveTempStyle(editor, style); /* set the temp insert style for the new para */
|
||||
ME_ReleaseStyle(style);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
if (!editor->bEmulateVersion10)
|
||||
return handle_enter(editor);
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
if (editor->bDialogMode && editor->hwndParent)
|
||||
|
@ -2724,6 +2746,12 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
|
|||
if (editor->bMouseCaptured)
|
||||
return 0;
|
||||
|
||||
if (editor->styleFlags & ES_READONLY)
|
||||
{
|
||||
MessageBeep(MB_ICONERROR);
|
||||
return 0; /* FIXME really 0 ? */
|
||||
}
|
||||
|
||||
if (unicode)
|
||||
wstr = (WCHAR)charCode;
|
||||
else
|
||||
|
@ -2732,10 +2760,8 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
|
|||
MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1);
|
||||
}
|
||||
|
||||
if (editor->styleFlags & ES_READONLY) {
|
||||
MessageBeep(MB_ICONERROR);
|
||||
return 0; /* FIXME really 0 ? */
|
||||
}
|
||||
if (editor->bEmulateVersion10 && wstr == '\r')
|
||||
handle_enter(editor);
|
||||
|
||||
if ((unsigned)wstr >= ' ' || wstr == '\t')
|
||||
{
|
||||
|
@ -3038,6 +3064,8 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->bEmulateVersion10 = bEmulateVersion10;
|
||||
ed->styleFlags = 0;
|
||||
ed->exStyleFlags = 0;
|
||||
ed->first_marked_para = NULL;
|
||||
ed->total_rows = 0;
|
||||
ITextHost_TxGetPropertyBits(texthost,
|
||||
(TXTBIT_RICHTEXT|TXTBIT_MULTILINE|
|
||||
TXTBIT_READONLY|TXTBIT_USEPASSWORD|
|
||||
|
@ -3051,6 +3079,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
ed->pBuffer = ME_MakeText();
|
||||
ed->nZoomNumerator = ed->nZoomDenominator = 0;
|
||||
ed->nAvailWidth = 0; /* wrap to client area */
|
||||
list_init( &ed->style_list );
|
||||
ME_MakeFirstParagraph(ed);
|
||||
/* The four cursors are for:
|
||||
* 0 - The position where the caret is shown
|
||||
|
@ -3150,7 +3179,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
|
||||
ed->wheel_remain = 0;
|
||||
|
||||
list_init( &ed->style_list );
|
||||
list_init( &ed->reobj_list );
|
||||
OleInitialize(NULL);
|
||||
|
||||
|
@ -3159,16 +3187,19 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
|
|||
|
||||
void ME_DestroyEditor(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *pFirst = editor->pBuffer->pFirst;
|
||||
ME_DisplayItem *p = pFirst, *pNext = NULL;
|
||||
ME_DisplayItem *p = editor->pBuffer->pFirst, *pNext = NULL;
|
||||
ME_Style *s, *cursor2;
|
||||
int i;
|
||||
|
||||
ME_ClearTempStyle(editor);
|
||||
ME_EmptyUndoStack(editor);
|
||||
editor->pBuffer->pFirst = NULL;
|
||||
while(p) {
|
||||
pNext = p->next;
|
||||
ME_DestroyDisplayItem(p);
|
||||
if (p->type == diParagraph)
|
||||
destroy_para(editor, p);
|
||||
else
|
||||
ME_DestroyDisplayItem(p);
|
||||
p = pNext;
|
||||
}
|
||||
|
||||
|
@ -3905,17 +3936,17 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
return editor->nEventMask;
|
||||
case EM_SETCHARFORMAT:
|
||||
{
|
||||
CHARFORMAT2W buf, *p;
|
||||
CHARFORMAT2W p;
|
||||
BOOL bRepaint = TRUE;
|
||||
p = ME_ToCF2W(&buf, (CHARFORMAT2W *)lParam);
|
||||
if (p == NULL) return 0;
|
||||
if (!cfany_to_cf2w(&p, (CHARFORMAT2W *)lParam))
|
||||
return 0;
|
||||
if (wParam & SCF_ALL) {
|
||||
if (editor->mode & TM_PLAINTEXT) {
|
||||
ME_SetDefaultCharFormat(editor, p);
|
||||
ME_SetDefaultCharFormat(editor, &p);
|
||||
} else {
|
||||
ME_Cursor start;
|
||||
ME_SetCursorToStart(editor, &start);
|
||||
ME_SetCharFormat(editor, &start, NULL, p);
|
||||
ME_SetCharFormat(editor, &start, NULL, &p);
|
||||
editor->nModifyStep = 1;
|
||||
}
|
||||
} else if (wParam & SCF_SELECTION) {
|
||||
|
@ -3927,13 +3958,13 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
ME_MoveCursorWords(editor, &end, +1);
|
||||
start = end;
|
||||
ME_MoveCursorWords(editor, &start, -1);
|
||||
ME_SetCharFormat(editor, &start, &end, p);
|
||||
ME_SetCharFormat(editor, &start, &end, &p);
|
||||
}
|
||||
bRepaint = ME_IsSelection(editor);
|
||||
ME_SetSelectionCharFormat(editor, p);
|
||||
ME_SetSelectionCharFormat(editor, &p);
|
||||
if (bRepaint) editor->nModifyStep = 1;
|
||||
} else { /* SCF_DEFAULT */
|
||||
ME_SetDefaultCharFormat(editor, p);
|
||||
ME_SetDefaultCharFormat(editor, &p);
|
||||
}
|
||||
ME_CommitUndo(editor);
|
||||
if (bRepaint)
|
||||
|
@ -3957,7 +3988,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
ME_GetDefaultCharFormat(editor, &tmp);
|
||||
else
|
||||
ME_GetSelectionCharFormat(editor, &tmp);
|
||||
ME_CopyToCFAny(dst, &tmp);
|
||||
cf2w_to_cfany(dst, &tmp);
|
||||
return tmp.dwMask;
|
||||
}
|
||||
case EM_SETPARAFORMAT:
|
||||
|
@ -4214,22 +4245,12 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
|
|||
}
|
||||
case EM_GETLINECOUNT:
|
||||
{
|
||||
ME_DisplayItem *item = editor->pBuffer->pFirst->next;
|
||||
int nRows = 0;
|
||||
|
||||
ME_DisplayItem *item = editor->pBuffer->pLast;
|
||||
int nRows = editor->total_rows;
|
||||
ME_DisplayItem *prev_para = NULL, *last_para = NULL;
|
||||
|
||||
while (item != editor->pBuffer->pLast)
|
||||
{
|
||||
assert(item->type == diParagraph);
|
||||
prev_para = ME_FindItemBack(item, diRun);
|
||||
if (prev_para) {
|
||||
assert(prev_para->member.run.nFlags & MERF_ENDPARA);
|
||||
}
|
||||
nRows += item->member.para.nRows;
|
||||
item = item->member.para.next_para;
|
||||
}
|
||||
last_para = ME_FindItemBack(item, diRun);
|
||||
prev_para = ME_FindItemBack(last_para, diRun);
|
||||
assert(last_para);
|
||||
assert(last_para->member.run.nFlags & MERF_ENDPARA);
|
||||
if (editor->bEmulateVersion10 && prev_para &&
|
||||
|
@ -5276,10 +5297,9 @@ static BOOL isurlneutral( WCHAR c )
|
|||
|
||||
/* Some shortcuts */
|
||||
if (isalnum( c )) return FALSE;
|
||||
if (c > neutral_chars[sizeof(neutral_chars) / sizeof(neutral_chars[0]) - 1]) return FALSE;
|
||||
if (c > neutral_chars[ARRAY_SIZE( neutral_chars ) - 1]) return FALSE;
|
||||
|
||||
return !!bsearch( &c, neutral_chars, sizeof(neutral_chars) / sizeof(neutral_chars[0]),
|
||||
sizeof(c), wchar_comp );
|
||||
return !!bsearch( &c, neutral_chars, ARRAY_SIZE( neutral_chars ), sizeof(c), wchar_comp );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5412,7 +5432,7 @@ static BOOL ME_IsCandidateAnURL(ME_TextEditor *editor, const ME_Cursor *start, i
|
|||
unsigned int i;
|
||||
|
||||
ME_GetTextW(editor, bufferW, MAX_PREFIX_LEN, start, nChars, FALSE, FALSE);
|
||||
for (i = 0; i < sizeof(prefixes) / sizeof(*prefixes); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(prefixes); i++)
|
||||
{
|
||||
if (nChars < prefixes[i].length) continue;
|
||||
if (!memcmp(prefixes[i].text, bufferW, prefixes[i].length * sizeof(WCHAR)))
|
||||
|
|
|
@ -63,8 +63,8 @@ void ME_SaveTempStyle(ME_TextEditor *editor, ME_Style *style) DECLSPEC_HIDDEN;
|
|||
void ME_ClearTempStyle(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_DumpStyleToBuf(CHARFORMAT2W *pFmt, char buf[2048]) DECLSPEC_HIDDEN;
|
||||
void ME_DumpStyle(ME_Style *s) DECLSPEC_HIDDEN;
|
||||
CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from) DECLSPEC_HIDDEN;
|
||||
void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from) DECLSPEC_HIDDEN;
|
||||
BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN;
|
||||
BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN;
|
||||
void ME_CopyCharFormat(CHARFORMAT2W *pDest, const CHARFORMAT2W *pSrc) DECLSPEC_HIDDEN; /* only works with 2W structs */
|
||||
void ME_CharFormatFromLogFont(HDC hDC, const LOGFONTW *lf, CHARFORMAT2W *fmt) DECLSPEC_HIDDEN; /* ditto */
|
||||
|
||||
|
@ -79,6 +79,7 @@ ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass
|
|||
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
|
||||
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
|
||||
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
|
||||
void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN;
|
||||
|
||||
/* string.c */
|
||||
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
|
||||
|
@ -203,6 +204,11 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
|||
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
|
||||
void para_num_init( ME_Context *c, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||
void para_num_clear( struct para_num *pn ) DECLSPEC_HIDDEN;
|
||||
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *get_di_from_para(ME_Paragraph *para) DECLSPEC_HIDDEN;
|
||||
void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
|
||||
void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *para) DECLSPEC_HIDDEN;
|
||||
|
||||
/* paint.c */
|
||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN;
|
||||
|
@ -235,7 +241,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, BOOL selected) DECLSPE
|
|||
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
|
||||
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
|
||||
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;
|
||||
void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN;
|
||||
void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj) DECLSPEC_HIDDEN;
|
||||
|
||||
/* editor.c */
|
||||
ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -219,6 +219,7 @@ typedef struct tagME_Paragraph
|
|||
struct para_num para_num;
|
||||
ME_Run *eop_run; /* ptr to the end-of-para run */
|
||||
struct tagME_DisplayItem *prev_para, *next_para;
|
||||
struct tagME_DisplayItem *prev_marked, *next_marked;
|
||||
} ME_Paragraph;
|
||||
|
||||
typedef struct tagME_Cell /* v4.1 */
|
||||
|
@ -396,6 +397,7 @@ typedef struct tagME_TextEditor
|
|||
int nTotalWidth, nLastTotalWidth;
|
||||
int nAvailWidth; /* 0 = wrap to client area, else wrap width in twips */
|
||||
int nUDArrowX;
|
||||
int total_rows;
|
||||
COLORREF rgbBackColor;
|
||||
HBRUSH hbrBackground;
|
||||
BOOL bCaretAtEnd;
|
||||
|
@ -432,6 +434,7 @@ typedef struct tagME_TextEditor
|
|||
int imeStartIndex;
|
||||
DWORD selofs; /* The size of the selection bar on the left side of control */
|
||||
ME_SelectionType nSelectionType;
|
||||
ME_DisplayItem *first_marked_para;
|
||||
|
||||
/* Track previous notified selection */
|
||||
CHARRANGE notified_cr;
|
||||
|
|
|
@ -161,12 +161,6 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
|
|||
{
|
||||
if (0)
|
||||
TRACE("type=%s\n", ME_GetDITypeName(item->type));
|
||||
if (item->type==diParagraph)
|
||||
{
|
||||
ME_DestroyString(item->member.para.text);
|
||||
para_num_clear( &item->member.para.para_num );
|
||||
}
|
||||
|
||||
if (item->type==diRun)
|
||||
{
|
||||
if (item->member.run.reobj)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#define DEFINE_THISCALL_WRAPPER(func,args) \
|
||||
typedef struct {int x[args/4];} _tag_##func; \
|
||||
void __stdcall func(_tag_##func p1); \
|
||||
__declspec(naked) void __stdcall __thiscall_##func(_tag_##func p1) \
|
||||
__declspec(naked) void __thiscall_##func(_tag_##func p1) \
|
||||
{ \
|
||||
__asm pop eax \
|
||||
__asm push ecx \
|
||||
|
@ -52,7 +52,7 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8)
|
|||
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
|
||||
|
||||
#define DEFINE_STDCALL_WRAPPER(num,func,args) \
|
||||
__declspec(naked) void __stdcall __stdcall_##func(_tag_##func p1) \
|
||||
__declspec(naked) void __stdcall_##func(_tag_##func p1) \
|
||||
{ \
|
||||
__asm pop eax \
|
||||
__asm pop ecx \
|
||||
|
|
|
@ -536,7 +536,7 @@ int ME_GetParaBorderWidth(const ME_Context* c, int flags)
|
|||
int idx = (flags >> 8) & 0xF;
|
||||
int width;
|
||||
|
||||
if (idx >= sizeof(border_details) / sizeof(border_details[0]))
|
||||
if (idx >= ARRAY_SIZE(border_details))
|
||||
{
|
||||
FIXME("Unsupported border value %d\n", idx);
|
||||
return 0;
|
||||
|
@ -989,7 +989,7 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
|
|||
}
|
||||
if (me_debug)
|
||||
{
|
||||
const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0};
|
||||
static const WCHAR wszRowDebug[] = {'r','o','w','[','%','d',']',0};
|
||||
WCHAR buf[128];
|
||||
POINT pt = c->pt;
|
||||
wsprintfW(buf, wszRowDebug, no);
|
||||
|
@ -1017,7 +1017,7 @@ static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph)
|
|||
c->pt.y + para->pt.y + run->pt.y + baseline, p, para);
|
||||
if (me_debug)
|
||||
{
|
||||
const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
|
||||
static const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};
|
||||
WCHAR buf[2560];
|
||||
POINT pt;
|
||||
pt.x = c->pt.x + run->pt.x;
|
||||
|
|
|
@ -23,19 +23,137 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||
|
||||
void mark_para_rewrap(ME_TextEditor *editor, ME_DisplayItem *para)
|
||||
{
|
||||
para->member.para.nFlags |= MEPF_REWRAP;
|
||||
add_marked_para(editor, para);
|
||||
}
|
||||
|
||||
ME_DisplayItem *get_di_from_para(ME_Paragraph *para)
|
||||
{
|
||||
return (ME_DisplayItem *)((ptrdiff_t)para - offsetof(ME_DisplayItem, member));
|
||||
}
|
||||
|
||||
static ME_DisplayItem *make_para(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *item = ME_MakeDI(diParagraph);
|
||||
|
||||
ME_SetDefaultParaFormat(editor, &item->member.para.fmt);
|
||||
item->member.para.nFlags = MEPF_REWRAP;
|
||||
item->member.para.next_marked = item->member.para.prev_marked = NULL;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item)
|
||||
{
|
||||
assert(item->type == diParagraph);
|
||||
|
||||
if (item->member.para.nWidth == editor->nTotalWidth)
|
||||
{
|
||||
item->member.para.nWidth = 0;
|
||||
editor->nTotalWidth = get_total_width(editor);
|
||||
}
|
||||
editor->total_rows -= item->member.para.nRows;
|
||||
ME_DestroyString(item->member.para.text);
|
||||
para_num_clear( &item->member.para.para_num );
|
||||
remove_marked_para(editor, item);
|
||||
ME_DestroyDisplayItem(item);
|
||||
}
|
||||
|
||||
int get_total_width(ME_TextEditor *editor)
|
||||
{
|
||||
ME_Paragraph *para;
|
||||
int total_width = 0;
|
||||
|
||||
if (editor->pBuffer->pFirst && editor->pBuffer->pLast)
|
||||
{
|
||||
para = &editor->pBuffer->pFirst->next->member.para;
|
||||
while (para != &editor->pBuffer->pLast->member.para && para->next_para)
|
||||
{
|
||||
total_width = max(total_width, para->nWidth);
|
||||
para = ¶->next_para->member.para;
|
||||
}
|
||||
}
|
||||
|
||||
return total_width;
|
||||
}
|
||||
|
||||
void remove_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
|
||||
{
|
||||
ME_DisplayItem *head = editor->first_marked_para;
|
||||
|
||||
assert(di->type == diParagraph);
|
||||
if (!di->member.para.next_marked && !di->member.para.prev_marked)
|
||||
{
|
||||
if (di == head)
|
||||
editor->first_marked_para = NULL;
|
||||
}
|
||||
else if (di->member.para.next_marked && di->member.para.prev_marked)
|
||||
{
|
||||
di->member.para.prev_marked->member.para.next_marked = di->member.para.next_marked;
|
||||
di->member.para.next_marked->member.para.prev_marked = di->member.para.prev_marked;
|
||||
di->member.para.prev_marked = di->member.para.next_marked = NULL;
|
||||
}
|
||||
else if (di->member.para.next_marked)
|
||||
{
|
||||
assert(di == editor->first_marked_para);
|
||||
editor->first_marked_para = di->member.para.next_marked;
|
||||
di->member.para.next_marked->member.para.prev_marked = NULL;
|
||||
di->member.para.next_marked = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
di->member.para.prev_marked->member.para.next_marked = NULL;
|
||||
di->member.para.prev_marked = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void add_marked_para(ME_TextEditor *editor, ME_DisplayItem *di)
|
||||
{
|
||||
ME_DisplayItem *iter = editor->first_marked_para;
|
||||
|
||||
if (!iter)
|
||||
{
|
||||
editor->first_marked_para = di;
|
||||
return;
|
||||
}
|
||||
while (iter)
|
||||
{
|
||||
if (iter == di)
|
||||
return;
|
||||
else if (di->member.para.nCharOfs < iter->member.para.nCharOfs)
|
||||
{
|
||||
if (iter == editor->first_marked_para)
|
||||
editor->first_marked_para = di;
|
||||
di->member.para.next_marked = iter;
|
||||
iter->member.para.prev_marked = di;
|
||||
break;
|
||||
}
|
||||
else if (di->member.para.nCharOfs >= iter->member.para.nCharOfs)
|
||||
{
|
||||
if (!iter->member.para.next_marked || di->member.para.nCharOfs < iter->member.para.next_marked->member.para.nCharOfs)
|
||||
{
|
||||
if (iter->member.para.next_marked)
|
||||
{
|
||||
di->member.para.next_marked = iter->member.para.next_marked;
|
||||
iter->member.para.next_marked->member.para.prev_marked = di;
|
||||
}
|
||||
di->member.para.prev_marked = iter;
|
||||
iter->member.para.next_marked = di;
|
||||
break;
|
||||
}
|
||||
}
|
||||
iter = iter->member.para.next_marked;
|
||||
}
|
||||
}
|
||||
|
||||
void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
||||
{
|
||||
static const WCHAR cr_lf[] = {'\r','\n',0};
|
||||
ME_Context c;
|
||||
CHARFORMAT2W cf;
|
||||
const CHARFORMATW *host_cf;
|
||||
LOGFONTW lf;
|
||||
HFONT hf;
|
||||
ME_TextBuffer *text = editor->pBuffer;
|
||||
|
@ -43,7 +161,6 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
ME_DisplayItem *run;
|
||||
ME_Style *style;
|
||||
int eol_len;
|
||||
WCHAR cr_lf[] = {'\r','\n',0};
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
|
||||
|
@ -76,6 +193,14 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
style = ME_MakeStyle(&cf);
|
||||
text->pDefaultStyle = style;
|
||||
|
||||
if (ITextHost_TxGetCharFormat(editor->texthost, &host_cf) == S_OK)
|
||||
{
|
||||
ZeroMemory(&cf, sizeof(cf));
|
||||
cf.cbSize = sizeof(cf);
|
||||
cfany_to_cf2w(&cf, (CHARFORMAT2W *)host_cf);
|
||||
ME_SetDefaultCharFormat(editor, &cf);
|
||||
}
|
||||
|
||||
eol_len = editor->bEmulateVersion10 ? 2 : 1;
|
||||
para->member.para.text = ME_MakeStringN( cr_lf, eol_len );
|
||||
|
||||
|
@ -95,6 +220,7 @@ void ME_MakeFirstParagraph(ME_TextEditor *editor)
|
|||
|
||||
text->pLast->member.para.nCharOfs = editor->bEmulateVersion10 ? 2 : 1;
|
||||
|
||||
add_marked_para(editor, para);
|
||||
ME_DestroyContext(&c);
|
||||
}
|
||||
|
||||
|
@ -102,7 +228,7 @@ static void ME_MarkForWrapping(ME_TextEditor *editor, ME_DisplayItem *first, con
|
|||
{
|
||||
while(first != last)
|
||||
{
|
||||
first->member.para.nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, first);
|
||||
first = first->member.para.next_para;
|
||||
}
|
||||
}
|
||||
|
@ -197,7 +323,7 @@ static ME_String *para_num_get_str( ME_Paragraph *para, WORD num )
|
|||
|
||||
/* This is not base-26 (or 27) as zeros don't count unless they are leading zeros.
|
||||
It's simplest to start with the least significant letter, so first calculate how many letters are needed. */
|
||||
for (i = 0, total = 0; i < sizeof(letter_base) / sizeof(letter_base[0]); i++)
|
||||
for (i = 0, total = 0; i < ARRAY_SIZE( letter_base ); i++)
|
||||
{
|
||||
total += letter_base[i];
|
||||
if (num < total) break;
|
||||
|
@ -219,7 +345,7 @@ static ME_String *para_num_get_str( ME_Paragraph *para, WORD num )
|
|||
case PFN_UCROMAN:
|
||||
if (!num) num = 1;
|
||||
|
||||
for (i = 0; i < sizeof(roman_base) / sizeof(roman_base[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE( roman_base ); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
|
@ -325,11 +451,11 @@ void para_num_clear( struct para_num *pn )
|
|||
pn->text = NULL;
|
||||
}
|
||||
|
||||
static void para_num_clear_list( ME_Paragraph *para, const PARAFORMAT2 *orig_fmt )
|
||||
static void para_num_clear_list( ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *orig_fmt )
|
||||
{
|
||||
do
|
||||
{
|
||||
para->nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, get_di_from_para(para));
|
||||
para_num_clear( ¶->para_num );
|
||||
if (para->next_para->type != diParagraph) break;
|
||||
para = ¶->next_para->member.para;
|
||||
|
@ -404,12 +530,12 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
|
|||
|
||||
if (memcmp(©, ¶->fmt, sizeof(PARAFORMAT2)))
|
||||
{
|
||||
para->nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, get_di_from_para(para));
|
||||
if (((dwMask & PFM_NUMBERING) && (copy.wNumbering != para->fmt.wNumbering)) ||
|
||||
((dwMask & PFM_NUMBERINGSTART) && (copy.wNumberingStart != para->fmt.wNumberingStart)) ||
|
||||
((dwMask & PFM_NUMBERINGSTYLE) && (copy.wNumberingStyle != para->fmt.wNumberingStyle)))
|
||||
{
|
||||
para_num_clear_list( para, © );
|
||||
para_num_clear_list( editor, para, © );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -446,7 +572,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
|
|||
|
||||
/* Clear any cached para numbering following this paragraph */
|
||||
if (run_para->member.para.fmt.wNumbering)
|
||||
para_num_clear_list( &run_para->member.para, &run_para->member.para.fmt );
|
||||
para_num_clear_list( editor, &run_para->member.para, &run_para->member.para.fmt );
|
||||
|
||||
new_para->member.para.text = ME_VSplitString( run_para->member.para.text, run->member.run.nCharOfs );
|
||||
|
||||
|
@ -478,7 +604,8 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
|
|||
}
|
||||
new_para->member.para.nCharOfs = run_para->member.para.nCharOfs + ofs;
|
||||
new_para->member.para.nCharOfs += eol_len;
|
||||
new_para->member.para.nFlags = MEPF_REWRAP;
|
||||
new_para->member.para.nFlags = 0;
|
||||
mark_para_rewrap(editor, new_para);
|
||||
|
||||
/* FIXME initialize format style and call ME_SetParaFormat blah blah */
|
||||
new_para->member.para.fmt = run_para->member.para.fmt;
|
||||
|
@ -544,8 +671,10 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
|
|||
}
|
||||
|
||||
/* force rewrap of the */
|
||||
run_para->member.para.prev_para->member.para.nFlags |= MEPF_REWRAP;
|
||||
new_para->member.para.prev_para->member.para.nFlags |= MEPF_REWRAP;
|
||||
if (run_para->member.para.prev_para->type == diParagraph)
|
||||
mark_para_rewrap(editor, run_para->member.para.prev_para);
|
||||
|
||||
mark_para_rewrap(editor, new_para->member.para.prev_para);
|
||||
|
||||
/* we've added the end run, so we need to modify nCharOfs in the next paragraphs */
|
||||
ME_PropagateCharOffset(next_para, eol_len);
|
||||
|
@ -572,7 +701,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
|
|||
|
||||
/* Clear any cached para numbering following this paragraph */
|
||||
if (tp->member.para.fmt.wNumbering)
|
||||
para_num_clear_list( &tp->member.para, &tp->member.para.fmt );
|
||||
para_num_clear_list( editor, &tp->member.para, &tp->member.para.fmt );
|
||||
|
||||
pNext = tp->member.para.next_para;
|
||||
|
||||
|
@ -673,14 +802,14 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
|
|||
tp->member.para.next_para = pNext->member.para.next_para;
|
||||
pNext->member.para.next_para->member.para.prev_para = tp;
|
||||
ME_Remove(pNext);
|
||||
ME_DestroyDisplayItem(pNext);
|
||||
destroy_para(editor, pNext);
|
||||
|
||||
ME_PropagateCharOffset(tp->member.para.next_para, -end_len);
|
||||
|
||||
ME_CheckCharOffsets(editor);
|
||||
|
||||
editor->nParagraphs--;
|
||||
tp->member.para.nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, tp);
|
||||
return tp;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ int _RTFGetChar(RTF_Info *info)
|
|||
}
|
||||
ch = (unsigned char)stream->buffer[stream->dwUsed++];
|
||||
if (!ch)
|
||||
return EOF;
|
||||
return ' ';
|
||||
return ch;
|
||||
}
|
||||
|
||||
|
@ -2175,14 +2175,13 @@ static RTFKey rtfKey[] =
|
|||
|
||||
{ 0, -1, NULL, 0 }
|
||||
};
|
||||
#define RTF_KEY_COUNT (sizeof(rtfKey) / sizeof(RTFKey))
|
||||
|
||||
typedef struct tagRTFHashTableEntry {
|
||||
int count;
|
||||
RTFKey **value;
|
||||
} RTFHashTableEntry;
|
||||
|
||||
static RTFHashTableEntry rtfHashTable[RTF_KEY_COUNT * 2];
|
||||
static RTFHashTableEntry rtfHashTable[ARRAY_SIZE(rtfKey) * 2];
|
||||
|
||||
|
||||
/*
|
||||
|
@ -2199,7 +2198,7 @@ void LookupInit(void)
|
|||
int index;
|
||||
|
||||
rp->rtfKHash = Hash (rp->rtfKStr);
|
||||
index = rp->rtfKHash % (RTF_KEY_COUNT * 2);
|
||||
index = rp->rtfKHash % (ARRAY_SIZE(rtfKey) * 2);
|
||||
if (!rtfHashTable[index].count)
|
||||
rtfHashTable[index].value = heap_alloc(sizeof(RTFKey *));
|
||||
else
|
||||
|
@ -2212,7 +2211,7 @@ void LookupCleanup(void)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<RTF_KEY_COUNT*2; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(rtfKey) * 2; i++)
|
||||
{
|
||||
heap_free( rtfHashTable[i].value );
|
||||
rtfHashTable[i].value = NULL;
|
||||
|
@ -2235,7 +2234,7 @@ static void Lookup(RTF_Info *info, char *s)
|
|||
|
||||
++s; /* skip over the leading \ character */
|
||||
hash = Hash (s);
|
||||
entry = &rtfHashTable[hash % (RTF_KEY_COUNT * 2)];
|
||||
entry = &rtfHashTable[hash % (ARRAY_SIZE(rtfKey) * 2)];
|
||||
for (i = 0; i < entry->count; i++)
|
||||
{
|
||||
rp = entry->value[i];
|
||||
|
@ -2597,13 +2596,13 @@ RTFPutUnicodeString(RTF_Info *info, const WCHAR *string, int length)
|
|||
RTFFlushCPOutputBuffer(info);
|
||||
while (length)
|
||||
{
|
||||
int fit = min(length, sizeof(info->OutputBuffer) / sizeof(WCHAR) - info->dwOutputCount);
|
||||
int fit = min(length, ARRAY_SIZE(info->OutputBuffer) - info->dwOutputCount);
|
||||
|
||||
memmove(info->OutputBuffer + info->dwOutputCount, string, fit * sizeof(WCHAR));
|
||||
info->dwOutputCount += fit;
|
||||
length -= fit;
|
||||
string += fit;
|
||||
if (sizeof(info->OutputBuffer) / sizeof(WCHAR) == info->dwOutputCount)
|
||||
if (ARRAY_SIZE(info->OutputBuffer) == info->dwOutputCount)
|
||||
RTFFlushUnicodeOutputBuffer(info);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ DEFINE_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xa
|
|||
DEFINE_GUID(IID_ITextHost, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
|
||||
DEFINE_GUID(IID_ITextHost2, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
|
||||
DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
|
||||
DEFINE_GUID(IID_ITextDocument2Old, 0x01c25500, 0x4268, 0x11d1, 0x88, 0x3a, 0x3c, 0x8b, 0x00, 0xc1, 0x00, 0x00);
|
||||
DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
|
||||
DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
|
||||
DEFINE_GUID(IID_ITextFont, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
|
||||
|
@ -97,7 +98,7 @@ void release_typelib(void)
|
|||
if (!typelib)
|
||||
return;
|
||||
|
||||
for (i = 0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(typeinfos); i++)
|
||||
if (typeinfos[i])
|
||||
ITypeInfo_Release(typeinfos[i]);
|
||||
|
||||
|
@ -208,7 +209,7 @@ enum range_update_op {
|
|||
typedef struct IRichEditOleImpl {
|
||||
IUnknown IUnknown_inner;
|
||||
IRichEditOle IRichEditOle_iface;
|
||||
ITextDocument ITextDocument_iface;
|
||||
ITextDocument2Old ITextDocument2Old_iface;
|
||||
IUnknown *outer_unk;
|
||||
LONG ref;
|
||||
|
||||
|
@ -267,9 +268,9 @@ static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
|
|||
return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface);
|
||||
}
|
||||
|
||||
static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
|
||||
static inline IRichEditOleImpl *impl_from_ITextDocument2Old(ITextDocument2Old *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface);
|
||||
return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument2Old_iface);
|
||||
}
|
||||
|
||||
static inline IRichEditOleImpl *impl_from_IUnknown(IUnknown *iface)
|
||||
|
@ -633,7 +634,7 @@ static void textrange_set_font(ITextRange *range, ITextFont *font)
|
|||
|
||||
if (ITextFont_GetName(font, &str) == S_OK) {
|
||||
fmt.dwMask |= CFM_FACE;
|
||||
lstrcpynW(fmt.szFaceName, str, sizeof(fmt.szFaceName)/sizeof(WCHAR));
|
||||
lstrcpynW(fmt.szFaceName, str, ARRAY_SIZE(fmt.szFaceName));
|
||||
SysFreeString(str);
|
||||
}
|
||||
|
||||
|
@ -817,7 +818,7 @@ static HRESULT set_textfont_prop(ITextFontImpl *font, enum textfont_prop_id prop
|
|||
fmt.wWeight = value->l;
|
||||
break;
|
||||
case FONT_NAME:
|
||||
lstrcpynW(fmt.szFaceName, value->str, sizeof(fmt.szFaceName)/sizeof(WCHAR));
|
||||
lstrcpynW(fmt.szFaceName, value->str, ARRAY_SIZE(fmt.szFaceName));
|
||||
break;
|
||||
default:
|
||||
FIXME("unhandled font property %d\n", propid);
|
||||
|
@ -943,8 +944,8 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R
|
|||
*ppvObj = &This->IUnknown_inner;
|
||||
else if (IsEqualGUID(riid, &IID_IRichEditOle))
|
||||
*ppvObj = &This->IRichEditOle_iface;
|
||||
else if (IsEqualGUID(riid, &IID_ITextDocument))
|
||||
*ppvObj = &This->ITextDocument_iface;
|
||||
else if (IsEqualGUID(riid, &IID_ITextDocument) || IsEqualGUID(riid, &IID_ITextDocument2Old))
|
||||
*ppvObj = &This->ITextDocument2Old_iface;
|
||||
if (*ppvObj)
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)*ppvObj);
|
||||
|
@ -4114,43 +4115,38 @@ static HRESULT create_textpara(ITextRange *range, ITextPara **ret)
|
|||
}
|
||||
|
||||
/* ITextDocument */
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
|
||||
void** ppvObject)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnQueryInterface(ITextDocument2Old* iface, REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
return IRichEditOle_QueryInterface(&This->IRichEditOle_iface, riid, ppvObject);
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
ITextDocument_fnAddRef(ITextDocument* me)
|
||||
static ULONG WINAPI ITextDocument2Old_fnAddRef(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
return IRichEditOle_AddRef(&This->IRichEditOle_iface);
|
||||
}
|
||||
|
||||
static ULONG WINAPI
|
||||
ITextDocument_fnRelease(ITextDocument* me)
|
||||
static ULONG WINAPI ITextDocument2Old_fnRelease(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
return IRichEditOle_Release(&This->IRichEditOle_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
|
||||
UINT* pctinfo)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfoCount(ITextDocument2Old *iface,
|
||||
UINT *pctinfo)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
TRACE("(%p)->(%p)\n", This, pctinfo);
|
||||
*pctinfo = 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
|
||||
ITypeInfo** ppTInfo)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetTypeInfo(ITextDocument2Old *iface, UINT iTInfo, LCID lcid,
|
||||
ITypeInfo **ppTInfo)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%u,%d,%p)\n", This, iTInfo, lcid, ppTInfo);
|
||||
|
@ -4161,11 +4157,11 @@ ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
|
||||
LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetIDsOfNames(ITextDocument2Old *iface, REFIID riid,
|
||||
LPOLESTR *rgszNames, UINT cNames,
|
||||
LCID lcid, DISPID *rgDispId)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
ITypeInfo *ti;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -4178,12 +4174,12 @@ ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
|
||||
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnInvoke(ITextDocument2Old *iface, DISPID dispIdMember,
|
||||
REFIID riid, LCID lcid, WORD wFlags,
|
||||
DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
||||
EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
ITypeInfo *ti;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -4193,24 +4189,22 @@ ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
|
|||
|
||||
hr = get_typeinfo(ITextDocument_tid, &ti);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = ITypeInfo_Invoke(ti, me, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
hr = ITypeInfo_Invoke(ti, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetName(ITextDocument2Old *iface, BSTR *pName)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetSelection(ITextDocument *me, ITextSelection **selection)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetSelection(ITextDocument2Old *iface, ITextSelection **selection)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", me, selection);
|
||||
TRACE("(%p)->(%p)\n", iface, selection);
|
||||
|
||||
if (!selection)
|
||||
return E_INVALIDARG;
|
||||
|
@ -4228,125 +4222,110 @@ ITextDocument_fnGetSelection(ITextDocument *me, ITextSelection **selection)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetStoryCount(ITextDocument2Old *iface, LONG *pCount)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetStoryRanges(ITextDocument* me,
|
||||
ITextStoryRanges** ppStories)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetStoryRanges(ITextDocument2Old *iface,
|
||||
ITextStoryRanges **ppStories)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetSaved(ITextDocument2Old *iface, LONG *pValue)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnSetSaved(ITextDocument* me, LONG Value)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSetSaved(ITextDocument2Old *iface, LONG Value)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetDefaultTabStop(ITextDocument2Old *iface, float *pValue)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSetDefaultTabStop(ITextDocument2Old *iface, float Value)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnNew(ITextDocument* me)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnNew(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags,
|
||||
LONG CodePage)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnOpen(ITextDocument2Old *iface, VARIANT *pVar,
|
||||
LONG Flags, LONG CodePage)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags,
|
||||
LONG CodePage)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSave(ITextDocument2Old *iface, VARIANT *pVar,
|
||||
LONG Flags, LONG CodePage)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnFreeze(ITextDocument2Old *iface, LONG *pCount)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnUnfreeze(ITextDocument2Old *iface, LONG *pCount)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnBeginEditCollection(ITextDocument* me)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnBeginEditCollection(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnEndEditCollection(ITextDocument* me)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnEndEditCollection(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnUndo(ITextDocument2Old *iface, LONG Count, LONG *prop)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnRedo(ITextDocument2Old *iface, LONG Count, LONG *prop)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -4367,11 +4346,10 @@ static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end, I
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
|
||||
ITextRange** ppRange)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnRange(ITextDocument2Old *iface, LONG cp1, LONG cp2,
|
||||
ITextRange **ppRange)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
TRACE("%p %p %d %d\n", This, ppRange, cp1, cp2);
|
||||
if (!ppRange)
|
||||
|
@ -4381,42 +4359,247 @@ ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
|
|||
return CreateITextRange(This, cp1, cp2, ppRange);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y,
|
||||
ITextRange** ppRange)
|
||||
static HRESULT WINAPI ITextDocument2Old_fnRangeFromPoint(ITextDocument2Old *iface, LONG x, LONG y,
|
||||
ITextRange **ppRange)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument(me);
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
FIXME("stub %p\n",This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const ITextDocumentVtbl tdvt = {
|
||||
ITextDocument_fnQueryInterface,
|
||||
ITextDocument_fnAddRef,
|
||||
ITextDocument_fnRelease,
|
||||
ITextDocument_fnGetTypeInfoCount,
|
||||
ITextDocument_fnGetTypeInfo,
|
||||
ITextDocument_fnGetIDsOfNames,
|
||||
ITextDocument_fnInvoke,
|
||||
ITextDocument_fnGetName,
|
||||
ITextDocument_fnGetSelection,
|
||||
ITextDocument_fnGetStoryCount,
|
||||
ITextDocument_fnGetStoryRanges,
|
||||
ITextDocument_fnGetSaved,
|
||||
ITextDocument_fnSetSaved,
|
||||
ITextDocument_fnGetDefaultTabStop,
|
||||
ITextDocument_fnSetDefaultTabStop,
|
||||
ITextDocument_fnNew,
|
||||
ITextDocument_fnOpen,
|
||||
ITextDocument_fnSave,
|
||||
ITextDocument_fnFreeze,
|
||||
ITextDocument_fnUnfreeze,
|
||||
ITextDocument_fnBeginEditCollection,
|
||||
ITextDocument_fnEndEditCollection,
|
||||
ITextDocument_fnUndo,
|
||||
ITextDocument_fnRedo,
|
||||
ITextDocument_fnRange,
|
||||
ITextDocument_fnRangeFromPoint
|
||||
/* ITextDocument2Old methods */
|
||||
static HRESULT WINAPI ITextDocument2Old_fnAttachMsgFilter(ITextDocument2Old *iface, IUnknown *filter)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, filter);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF cr)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d, 0x%x): stub\n", This, index, cr);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetEffectColor(ITextDocument2Old *iface, LONG index, COLORREF *cr)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d, %p): stub\n", This, index, cr);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetCaretType(ITextDocument2Old *iface, LONG *type)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, type);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSetCaretType(ITextDocument2Old *iface, LONG type)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d): stub\n", This, type);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetImmContext(ITextDocument2Old *iface, LONG *context)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, context);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnReleaseImmContext(ITextDocument2Old *iface, LONG context)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d): stub\n", This, context);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetPreferredFont(ITextDocument2Old *iface, LONG cp, LONG charrep,
|
||||
LONG options, LONG current_charrep, LONG current_fontsize,
|
||||
BSTR *bstr, LONG *pitch_family, LONG *new_fontsize)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d, %d, %d, %d, %d, %p, %p, %p): stub\n", This, cp, charrep, options, current_charrep,
|
||||
current_fontsize, bstr, pitch_family, new_fontsize);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetNotificationMode(ITextDocument2Old *iface, LONG *mode)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, mode);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSetNotificationMode(ITextDocument2Old *iface, LONG mode)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(0x%x): stub\n", This, mode);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetClientRect(ITextDocument2Old *iface, LONG type, LONG *left, LONG *top,
|
||||
LONG *right, LONG *bottom)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d, %p, %p, %p, %p): stub\n", This, type, left, top, right, bottom);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetSelectionEx(ITextDocument2Old *iface, ITextSelection **selection)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, selection);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetWindow(ITextDocument2Old *iface, LONG *hwnd)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, hwnd);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnGetFEFlags(ITextDocument2Old *iface, LONG *flags)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%p): stub\n", This, flags);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnUpdateWindow(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p): stub\n", This);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnCheckTextLimit(ITextDocument2Old *iface, LONG cch, LONG *exceed)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d, %p): stub\n", This, cch, exceed);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnIMEInProgress(ITextDocument2Old *iface, LONG mode)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(0x%x): stub\n", This, mode);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnSysBeep(ITextDocument2Old *iface)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p): stub\n", This);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnUpdate(ITextDocument2Old *iface, LONG mode)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(0x%x): stub\n", This, mode);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ITextDocument2Old_fnNotify(ITextDocument2Old *iface, LONG notify)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_ITextDocument2Old(iface);
|
||||
|
||||
FIXME("(%p)->(%d): stub\n", This, notify);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const ITextDocument2OldVtbl tdvt = {
|
||||
ITextDocument2Old_fnQueryInterface,
|
||||
ITextDocument2Old_fnAddRef,
|
||||
ITextDocument2Old_fnRelease,
|
||||
ITextDocument2Old_fnGetTypeInfoCount,
|
||||
ITextDocument2Old_fnGetTypeInfo,
|
||||
ITextDocument2Old_fnGetIDsOfNames,
|
||||
ITextDocument2Old_fnInvoke,
|
||||
ITextDocument2Old_fnGetName,
|
||||
ITextDocument2Old_fnGetSelection,
|
||||
ITextDocument2Old_fnGetStoryCount,
|
||||
ITextDocument2Old_fnGetStoryRanges,
|
||||
ITextDocument2Old_fnGetSaved,
|
||||
ITextDocument2Old_fnSetSaved,
|
||||
ITextDocument2Old_fnGetDefaultTabStop,
|
||||
ITextDocument2Old_fnSetDefaultTabStop,
|
||||
ITextDocument2Old_fnNew,
|
||||
ITextDocument2Old_fnOpen,
|
||||
ITextDocument2Old_fnSave,
|
||||
ITextDocument2Old_fnFreeze,
|
||||
ITextDocument2Old_fnUnfreeze,
|
||||
ITextDocument2Old_fnBeginEditCollection,
|
||||
ITextDocument2Old_fnEndEditCollection,
|
||||
ITextDocument2Old_fnUndo,
|
||||
ITextDocument2Old_fnRedo,
|
||||
ITextDocument2Old_fnRange,
|
||||
ITextDocument2Old_fnRangeFromPoint,
|
||||
/* ITextDocument2Old methods */
|
||||
ITextDocument2Old_fnAttachMsgFilter,
|
||||
ITextDocument2Old_fnSetEffectColor,
|
||||
ITextDocument2Old_fnGetEffectColor,
|
||||
ITextDocument2Old_fnGetCaretType,
|
||||
ITextDocument2Old_fnSetCaretType,
|
||||
ITextDocument2Old_fnGetImmContext,
|
||||
ITextDocument2Old_fnReleaseImmContext,
|
||||
ITextDocument2Old_fnGetPreferredFont,
|
||||
ITextDocument2Old_fnGetNotificationMode,
|
||||
ITextDocument2Old_fnSetNotificationMode,
|
||||
ITextDocument2Old_fnGetClientRect,
|
||||
ITextDocument2Old_fnGetSelectionEx,
|
||||
ITextDocument2Old_fnGetWindow,
|
||||
ITextDocument2Old_fnGetFEFlags,
|
||||
ITextDocument2Old_fnUpdateWindow,
|
||||
ITextDocument2Old_fnCheckTextLimit,
|
||||
ITextDocument2Old_fnIMEInProgress,
|
||||
ITextDocument2Old_fnSysBeep,
|
||||
ITextDocument2Old_fnUpdate,
|
||||
ITextDocument2Old_fnNotify
|
||||
};
|
||||
|
||||
/* ITextSelection */
|
||||
|
@ -5517,7 +5700,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p
|
|||
|
||||
reo->IUnknown_inner.lpVtbl = &reo_unk_vtbl;
|
||||
reo->IRichEditOle_iface.lpVtbl = &revt;
|
||||
reo->ITextDocument_iface.lpVtbl = &tdvt;
|
||||
reo->ITextDocument2Old_iface.lpVtbl = &tdvt;
|
||||
reo->ref = 1;
|
||||
reo->editor = editor;
|
||||
reo->txtSel = NULL;
|
||||
|
@ -5750,8 +5933,8 @@ void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags)
|
|||
}
|
||||
}
|
||||
|
||||
void ME_GetITextDocumentInterface(IRichEditOle *iface, LPVOID *ppvObj)
|
||||
void ME_GetITextDocument2OldInterface(IRichEditOle *iface, LPVOID *ppvObj)
|
||||
{
|
||||
IRichEditOleImpl *This = impl_from_IRichEditOle(iface);
|
||||
*ppvObj = &This->ITextDocument_iface;
|
||||
*ppvObj = &This->ITextDocument2Old_iface;
|
||||
}
|
||||
|
|
|
@ -103,6 +103,9 @@ void ME_CheckCharOffsets(ME_TextEditor *editor)
|
|||
ME_DisplayItem *p = editor->pBuffer->pFirst;
|
||||
int ofs = 0, ofsp = 0;
|
||||
|
||||
if (!TRACE_ON(richedit_check))
|
||||
return;
|
||||
|
||||
TRACE_(richedit_check)("Checking begin\n");
|
||||
if(TRACE_ON(richedit_lists))
|
||||
{
|
||||
|
@ -229,7 +232,7 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p)
|
|||
int i;
|
||||
assert(p->type == diRun && pNext->type == diRun);
|
||||
assert(p->member.run.nCharOfs != -1);
|
||||
ME_GetParagraph(p)->member.para.nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, ME_GetParagraph(p));
|
||||
|
||||
/* Update all cursors so that they don't contain the soon deleted run */
|
||||
for (i=0; i<editor->nCursors; i++) {
|
||||
|
@ -243,8 +246,7 @@ void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p)
|
|||
ME_Remove(pNext);
|
||||
ME_DestroyDisplayItem(pNext);
|
||||
ME_UpdateRunFlags(editor, &p->member.run);
|
||||
if(TRACE_ON(richedit_check))
|
||||
ME_CheckCharOffsets(editor);
|
||||
ME_CheckCharOffsets(editor);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -282,7 +284,7 @@ ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor)
|
|||
editor->pCursors[i].nOffset -= nOffset;
|
||||
}
|
||||
}
|
||||
cursor->pPara->member.para.nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, cursor->pPara);
|
||||
return run;
|
||||
}
|
||||
|
||||
|
@ -350,7 +352,7 @@ ME_InsertRunAtCursor(ME_TextEditor *editor, ME_Cursor *cursor, ME_Style *style,
|
|||
ME_InsertBefore( insert_before, pDI );
|
||||
TRACE("Shift length:%d\n", len);
|
||||
ME_PropagateCharOffset( insert_before, len );
|
||||
insert_before->member.run.para->nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, get_di_from_para(insert_before->member.run.para));
|
||||
|
||||
/* Move any cursors that were at the end of the previous run to the end of the inserted run */
|
||||
prev = ME_FindItemBack( pDI, diRun );
|
||||
|
@ -615,8 +617,8 @@ int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visu
|
|||
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
|
||||
int startx, int *pAscent, int *pDescent)
|
||||
{
|
||||
static const WCHAR spaceW[] = {' ',0};
|
||||
SIZE size;
|
||||
WCHAR spaceW[] = {' ',0};
|
||||
|
||||
nLen = min( nLen, run->len );
|
||||
|
||||
|
@ -771,7 +773,7 @@ void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, C
|
|||
ME_ReleaseStyle(para->para_num.style);
|
||||
para->para_num.style = NULL;
|
||||
}
|
||||
para->nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, get_di_from_para(para));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ static int all_refs = 0;
|
|||
* sizeof(char[AW])
|
||||
*/
|
||||
|
||||
CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||
BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from)
|
||||
{
|
||||
if (from->cbSize == sizeof(CHARFORMATA))
|
||||
{
|
||||
|
@ -41,9 +41,9 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
|||
CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||
to->cbSize = sizeof(CHARFORMAT2W);
|
||||
if (f->dwMask & CFM_FACE) {
|
||||
MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName));
|
||||
}
|
||||
return to;
|
||||
return TRUE;
|
||||
}
|
||||
if (from->cbSize == sizeof(CHARFORMATW))
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
|||
/* theoretically, we don't need to zero the remaining memory */
|
||||
ZeroMemory(&to->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W, wWeight));
|
||||
to->cbSize = sizeof(CHARFORMAT2W);
|
||||
return to;
|
||||
return TRUE;
|
||||
}
|
||||
if (from->cbSize == sizeof(CHARFORMAT2A))
|
||||
{
|
||||
|
@ -61,17 +61,22 @@ CHARFORMAT2W *ME_ToCF2W(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
|||
CopyMemory(to, f, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||
/* convert face name */
|
||||
if (f->dwMask & CFM_FACE)
|
||||
MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, sizeof(to->szFaceName)/sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, f->szFaceName, -1, to->szFaceName, ARRAY_SIZE(to->szFaceName));
|
||||
/* copy the rest of the 2A structure to 2W */
|
||||
CopyMemory(&to->wWeight, &f->wWeight, sizeof(CHARFORMAT2A)-FIELD_OFFSET(CHARFORMAT2A, wWeight));
|
||||
to->cbSize = sizeof(CHARFORMAT2W);
|
||||
return to;
|
||||
return TRUE;
|
||||
}
|
||||
if (from->cbSize == sizeof(CHARFORMAT2W))
|
||||
{
|
||||
CopyMemory(to, from, sizeof(CHARFORMAT2W));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return (from->cbSize >= sizeof(CHARFORMAT2W)) ? from : NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||
BOOL cf2w_to_cfany(CHARFORMAT2W *to, const CHARFORMAT2W *from)
|
||||
{
|
||||
assert(from->cbSize == sizeof(CHARFORMAT2W));
|
||||
if (to->cbSize == sizeof(CHARFORMATA))
|
||||
|
@ -80,14 +85,14 @@ static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
|||
CopyMemory(t, from, FIELD_OFFSET(CHARFORMATA, szFaceName));
|
||||
WideCharToMultiByte(CP_ACP, 0, from->szFaceName, -1, t->szFaceName, sizeof(t->szFaceName), NULL, NULL);
|
||||
t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
|
||||
return to;
|
||||
return TRUE;
|
||||
}
|
||||
if (to->cbSize == sizeof(CHARFORMATW))
|
||||
{
|
||||
CHARFORMATW *t = (CHARFORMATW *)to;
|
||||
CopyMemory(t, from, sizeof(*t));
|
||||
t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
|
||||
return to;
|
||||
return TRUE;
|
||||
}
|
||||
if (to->cbSize == sizeof(CHARFORMAT2A))
|
||||
{
|
||||
|
@ -99,16 +104,14 @@ static CHARFORMAT2W *ME_ToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
|||
/* copy the rest of the 2A structure to 2W */
|
||||
CopyMemory(&t->wWeight, &from->wWeight, sizeof(CHARFORMAT2W)-FIELD_OFFSET(CHARFORMAT2W,wWeight));
|
||||
t->cbSize = sizeof(*t); /* it was overwritten by CopyMemory */
|
||||
return to;
|
||||
return TRUE;
|
||||
}
|
||||
assert(to->cbSize >= sizeof(CHARFORMAT2W));
|
||||
return from;
|
||||
}
|
||||
|
||||
void ME_CopyToCFAny(CHARFORMAT2W *to, CHARFORMAT2W *from)
|
||||
{
|
||||
if (ME_ToCFAny(to, from) == from)
|
||||
CopyMemory(to, from, to->cbSize);
|
||||
if (to->cbSize == sizeof(CHARFORMAT2W))
|
||||
{
|
||||
CopyMemory(to, from, sizeof(CHARFORMAT2W));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ME_Style *ME_MakeStyle(CHARFORMAT2W *style)
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
|
||||
|
||||
static const WCHAR cr_lf[] = {'\r', '\n', 0};
|
||||
|
||||
static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
|
||||
int nCursor,
|
||||
const WCHAR *eol_str, int eol_len,
|
||||
|
@ -77,7 +79,6 @@ static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
|
|||
ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *para;
|
||||
WCHAR cr_lf[] = {'\r', '\n', 0};
|
||||
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWSTART);
|
||||
return para->member.para.prev_para;
|
||||
}
|
||||
|
@ -128,7 +129,6 @@ ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor)
|
|||
ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *para;
|
||||
WCHAR cr_lf[] = {'\r', '\n', 0};
|
||||
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWEND);
|
||||
return para->member.para.prev_para;
|
||||
}
|
||||
|
|
|
@ -501,10 +501,10 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
|
|||
|
||||
#ifdef __i386__ /* thiscall functions are i386-specific */
|
||||
|
||||
#define THISCALL(func) __thiscall_ ## func
|
||||
#define THISCALL(func) (void *) __thiscall_ ## func
|
||||
#define DEFINE_THISCALL_WRAPPER(func,args) \
|
||||
extern typeof(func) THISCALL(func); \
|
||||
__ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
|
||||
extern HRESULT __thiscall_ ## func(void); \
|
||||
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
|
||||
"popl %eax\n\t" \
|
||||
"pushl %ecx\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
|
@ -559,10 +559,10 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
|
|||
|
||||
#ifdef __i386__ /* thiscall functions are i386-specific */
|
||||
|
||||
#define STDCALL(func) __stdcall_ ## func
|
||||
#define STDCALL(func) (void *) __stdcall_ ## func
|
||||
#define DEFINE_STDCALL_WRAPPER(num,func,args) \
|
||||
extern typeof(func) __stdcall_ ## func; \
|
||||
__ASM_STDCALL_FUNC(__stdcall_ ## func, args, \
|
||||
extern HRESULT __stdcall_ ## func(void); \
|
||||
__ASM_GLOBAL_FUNC(__stdcall_ ## func, \
|
||||
"popl %eax\n\t" \
|
||||
"popl %ecx\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
|
@ -613,45 +613,45 @@ const ITextHostVtbl itextHostStdcallVtbl = {
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
__stdcall_ITextHostImpl_TxGetDC,
|
||||
__stdcall_ITextHostImpl_TxReleaseDC,
|
||||
__stdcall_ITextHostImpl_TxShowScrollBar,
|
||||
__stdcall_ITextHostImpl_TxEnableScrollBar,
|
||||
__stdcall_ITextHostImpl_TxSetScrollRange,
|
||||
__stdcall_ITextHostImpl_TxSetScrollPos,
|
||||
__stdcall_ITextHostImpl_TxInvalidateRect,
|
||||
__stdcall_ITextHostImpl_TxViewChange,
|
||||
__stdcall_ITextHostImpl_TxCreateCaret,
|
||||
__stdcall_ITextHostImpl_TxShowCaret,
|
||||
__stdcall_ITextHostImpl_TxSetCaretPos,
|
||||
__stdcall_ITextHostImpl_TxSetTimer,
|
||||
__stdcall_ITextHostImpl_TxKillTimer,
|
||||
__stdcall_ITextHostImpl_TxScrollWindowEx,
|
||||
__stdcall_ITextHostImpl_TxSetCapture,
|
||||
__stdcall_ITextHostImpl_TxSetFocus,
|
||||
__stdcall_ITextHostImpl_TxSetCursor,
|
||||
__stdcall_ITextHostImpl_TxScreenToClient,
|
||||
__stdcall_ITextHostImpl_TxClientToScreen,
|
||||
__stdcall_ITextHostImpl_TxActivate,
|
||||
__stdcall_ITextHostImpl_TxDeactivate,
|
||||
__stdcall_ITextHostImpl_TxGetClientRect,
|
||||
__stdcall_ITextHostImpl_TxGetViewInset,
|
||||
__stdcall_ITextHostImpl_TxGetCharFormat,
|
||||
__stdcall_ITextHostImpl_TxGetParaFormat,
|
||||
__stdcall_ITextHostImpl_TxGetSysColor,
|
||||
__stdcall_ITextHostImpl_TxGetBackStyle,
|
||||
__stdcall_ITextHostImpl_TxGetMaxLength,
|
||||
__stdcall_ITextHostImpl_TxGetScrollBars,
|
||||
__stdcall_ITextHostImpl_TxGetPasswordChar,
|
||||
__stdcall_ITextHostImpl_TxGetAcceleratorPos,
|
||||
__stdcall_ITextHostImpl_TxGetExtent,
|
||||
__stdcall_ITextHostImpl_OnTxCharFormatChange,
|
||||
__stdcall_ITextHostImpl_OnTxParaFormatChange,
|
||||
__stdcall_ITextHostImpl_TxGetPropertyBits,
|
||||
__stdcall_ITextHostImpl_TxNotify,
|
||||
__stdcall_ITextHostImpl_TxImmGetContext,
|
||||
__stdcall_ITextHostImpl_TxImmReleaseContext,
|
||||
__stdcall_ITextHostImpl_TxGetSelectionBarWidth,
|
||||
STDCALL(ITextHostImpl_TxGetDC),
|
||||
STDCALL(ITextHostImpl_TxReleaseDC),
|
||||
STDCALL(ITextHostImpl_TxShowScrollBar),
|
||||
STDCALL(ITextHostImpl_TxEnableScrollBar),
|
||||
STDCALL(ITextHostImpl_TxSetScrollRange),
|
||||
STDCALL(ITextHostImpl_TxSetScrollPos),
|
||||
STDCALL(ITextHostImpl_TxInvalidateRect),
|
||||
STDCALL(ITextHostImpl_TxViewChange),
|
||||
STDCALL(ITextHostImpl_TxCreateCaret),
|
||||
STDCALL(ITextHostImpl_TxShowCaret),
|
||||
STDCALL(ITextHostImpl_TxSetCaretPos),
|
||||
STDCALL(ITextHostImpl_TxSetTimer),
|
||||
STDCALL(ITextHostImpl_TxKillTimer),
|
||||
STDCALL(ITextHostImpl_TxScrollWindowEx),
|
||||
STDCALL(ITextHostImpl_TxSetCapture),
|
||||
STDCALL(ITextHostImpl_TxSetFocus),
|
||||
STDCALL(ITextHostImpl_TxSetCursor),
|
||||
STDCALL(ITextHostImpl_TxScreenToClient),
|
||||
STDCALL(ITextHostImpl_TxClientToScreen),
|
||||
STDCALL(ITextHostImpl_TxActivate),
|
||||
STDCALL(ITextHostImpl_TxDeactivate),
|
||||
STDCALL(ITextHostImpl_TxGetClientRect),
|
||||
STDCALL(ITextHostImpl_TxGetViewInset),
|
||||
STDCALL(ITextHostImpl_TxGetCharFormat),
|
||||
STDCALL(ITextHostImpl_TxGetParaFormat),
|
||||
STDCALL(ITextHostImpl_TxGetSysColor),
|
||||
STDCALL(ITextHostImpl_TxGetBackStyle),
|
||||
STDCALL(ITextHostImpl_TxGetMaxLength),
|
||||
STDCALL(ITextHostImpl_TxGetScrollBars),
|
||||
STDCALL(ITextHostImpl_TxGetPasswordChar),
|
||||
STDCALL(ITextHostImpl_TxGetAcceleratorPos),
|
||||
STDCALL(ITextHostImpl_TxGetExtent),
|
||||
STDCALL(ITextHostImpl_OnTxCharFormatChange),
|
||||
STDCALL(ITextHostImpl_OnTxParaFormatChange),
|
||||
STDCALL(ITextHostImpl_TxGetPropertyBits),
|
||||
STDCALL(ITextHostImpl_TxNotify),
|
||||
STDCALL(ITextHostImpl_TxImmGetContext),
|
||||
STDCALL(ITextHostImpl_TxImmReleaseContext),
|
||||
STDCALL(ITextHostImpl_TxGetSelectionBarWidth),
|
||||
};
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
|
|
@ -35,10 +35,10 @@
|
|||
|
||||
#ifdef __i386__ /* thiscall functions are i386-specific */
|
||||
|
||||
#define THISCALL(func) __thiscall_ ## func
|
||||
#define THISCALL(func) (void *) __thiscall_ ## func
|
||||
#define DEFINE_THISCALL_WRAPPER(func,args) \
|
||||
extern typeof(func) THISCALL(func); \
|
||||
__ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
|
||||
extern HRESULT __thiscall_ ## func(void); \
|
||||
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
|
||||
"popl %eax\n\t" \
|
||||
"pushl %ecx\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
|
@ -78,12 +78,13 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r
|
|||
*ppv = &This->IUnknown_inner;
|
||||
else if (IsEqualIID(riid, &IID_ITextServices))
|
||||
*ppv = &This->ITextServices_iface;
|
||||
else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument)) {
|
||||
else if (IsEqualIID(riid, &IID_IRichEditOle) || IsEqualIID(riid, &IID_ITextDocument) ||
|
||||
IsEqualIID(riid, &IID_ITextDocument2Old)) {
|
||||
if (!This->editor->reOle)
|
||||
if (!CreateIRichEditOle(This->outer_unk, This->editor, (void **)(&This->editor->reOle)))
|
||||
return E_OUTOFMEMORY;
|
||||
if (IsEqualIID(riid, &IID_ITextDocument))
|
||||
ME_GetITextDocumentInterface(This->editor->reOle, ppv);
|
||||
if (IsEqualIID(riid, &IID_ITextDocument) || IsEqualIID(riid, &IID_ITextDocument2Old))
|
||||
ME_GetITextDocument2OldInterface(This->editor->reOle, ppv);
|
||||
else
|
||||
*ppv = This->editor->reOle;
|
||||
} else {
|
||||
|
@ -182,11 +183,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG
|
|||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
|
||||
*plMin = This->editor->horz_si.nMin;
|
||||
*plMax = This->editor->horz_si.nMax;
|
||||
*plPos = This->editor->horz_si.nPos;
|
||||
*plPage = This->editor->horz_si.nPage;
|
||||
*pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
|
||||
if (plMin)
|
||||
*plMin = This->editor->horz_si.nMin;
|
||||
if (plMax)
|
||||
*plMax = This->editor->horz_si.nMax;
|
||||
if (plPos)
|
||||
*plPos = This->editor->horz_si.nPos;
|
||||
if (plPage)
|
||||
*plPage = This->editor->horz_si.nPage;
|
||||
if (pfEnabled)
|
||||
*pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -195,11 +201,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG
|
|||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
|
||||
*plMin = This->editor->vert_si.nMin;
|
||||
*plMax = This->editor->vert_si.nMax;
|
||||
*plPos = This->editor->vert_si.nPos;
|
||||
*plPage = This->editor->vert_si.nPage;
|
||||
*pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
|
||||
if (plMin)
|
||||
*plMin = This->editor->vert_si.nMin;
|
||||
if (plMax)
|
||||
*plMax = This->editor->vert_si.nMax;
|
||||
if (plPos)
|
||||
*plPos = This->editor->vert_si.nPos;
|
||||
if (plPage)
|
||||
*plPage = This->editor->vert_si.nPage;
|
||||
if (pfEnabled)
|
||||
*pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
|
|||
add_undo_set_para_fmt( editor, ¶->member.para );
|
||||
para->member.para.fmt = undo->u.set_para_fmt.fmt;
|
||||
para->member.para.border = undo->u.set_para_fmt.border;
|
||||
para->member.para.nFlags |= MEPF_REWRAP;
|
||||
mark_para_rewrap(editor, para);
|
||||
break;
|
||||
}
|
||||
case undo_set_char_fmt:
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "editor.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(richedit_check);
|
||||
|
||||
/*
|
||||
* Unsolved problems:
|
||||
|
@ -140,8 +139,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite
|
|||
ME_Cursor cursor = {wc->pPara, item, nVChar};
|
||||
|
||||
assert(item->member.run.nCharOfs != -1);
|
||||
if(TRACE_ON(richedit_check))
|
||||
ME_CheckCharOffsets(editor);
|
||||
ME_CheckCharOffsets(editor);
|
||||
|
||||
run = &item->member.run;
|
||||
|
||||
|
@ -160,8 +158,7 @@ static ME_DisplayItem *split_run_extents(ME_WrapContext *wc, ME_DisplayItem *ite
|
|||
run2->pt.x = run->pt.x+run->nWidth;
|
||||
run2->pt.y = run->pt.y;
|
||||
|
||||
if(TRACE_ON(richedit_check))
|
||||
ME_CheckCharOffsets(editor);
|
||||
ME_CheckCharOffsets(editor);
|
||||
|
||||
TRACE("After split: %s(%d, %d), %s(%d, %d)\n",
|
||||
debugstr_run( run ), run->pt.x, run->pt.y,
|
||||
|
@ -260,7 +257,7 @@ static void layout_row( ME_DisplayItem *start, const ME_DisplayItem *end )
|
|||
TRACE("%d runs\n", num_runs);
|
||||
if (!num_runs) return;
|
||||
|
||||
if (num_runs > sizeof(buf) / (sizeof(buf[0]) * 5))
|
||||
if (num_runs > ARRAY_SIZE( buf ) / 5)
|
||||
vis_to_log = heap_alloc( num_runs * sizeof(int) * 5 );
|
||||
|
||||
log_to_vis = vis_to_log + num_runs;
|
||||
|
@ -733,12 +730,13 @@ static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para)
|
|||
return sp * c->editor->nZoomNumerator / c->editor->nZoomDenominator;
|
||||
}
|
||||
|
||||
static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) {
|
||||
static void ME_PrepareParagraphForWrapping(ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp) {
|
||||
ME_DisplayItem *p;
|
||||
|
||||
tp->member.para.nWidth = 0;
|
||||
/* remove row start items as they will be reinserted by the
|
||||
* paragraph wrapper anyway */
|
||||
editor->total_rows -= tp->member.para.nRows;
|
||||
tp->member.para.nRows = 0;
|
||||
for (p = tp->next; p != tp->member.para.next_para; p = p->next) {
|
||||
if (p->type == diStartRow) {
|
||||
|
@ -766,7 +764,7 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
|
|||
ME_Run *run;
|
||||
ME_DisplayItem *di;
|
||||
SCRIPT_ITEM buf[16], *items = buf;
|
||||
int items_passed = sizeof( buf ) / sizeof( buf[0] ), num_items, cur_item;
|
||||
int items_passed = ARRAY_SIZE( buf ), num_items, cur_item;
|
||||
SCRIPT_CONTROL control = { LANG_USER_DEFAULT, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
FALSE, FALSE, 0 };
|
||||
SCRIPT_STATE state = { 0, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0, 0 };
|
||||
|
@ -870,7 +868,7 @@ static HRESULT shape_para( ME_Context *c, ME_DisplayItem *p )
|
|||
return hr;
|
||||
}
|
||||
|
||||
static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
|
||||
static void ME_WrapTextParagraph(ME_TextEditor *editor, ME_Context *c, ME_DisplayItem *tp) {
|
||||
ME_DisplayItem *p;
|
||||
ME_WrapContext wc;
|
||||
int border = 0;
|
||||
|
@ -881,7 +879,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
|
|||
if (!(tp->member.para.nFlags & MEPF_REWRAP)) {
|
||||
return;
|
||||
}
|
||||
ME_PrepareParagraphForWrapping(c, tp);
|
||||
ME_PrepareParagraphForWrapping(editor, c, tp);
|
||||
|
||||
/* Calculate paragraph numbering label */
|
||||
para_num_init( c, &tp->member.para );
|
||||
|
@ -969,6 +967,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
|
|||
tp->member.para.nFlags &= ~MEPF_REWRAP;
|
||||
tp->member.para.nHeight = wc.pt.y;
|
||||
tp->member.para.nRows = wc.nRow;
|
||||
editor->total_rows += wc.nRow;
|
||||
}
|
||||
|
||||
static void ME_MarkRepaintEnd(ME_DisplayItem *para,
|
||||
|
@ -980,139 +979,179 @@ static void ME_MarkRepaintEnd(ME_DisplayItem *para,
|
|||
*repaint_end = para;
|
||||
}
|
||||
|
||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
||||
static void adjust_para_y(ME_DisplayItem *item, ME_Context *c, ME_DisplayItem *repaint_start, ME_DisplayItem *repaint_end)
|
||||
{
|
||||
ME_DisplayItem *item;
|
||||
ME_Context c;
|
||||
int totalWidth = 0;
|
||||
ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL;
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
c.pt.x = 0;
|
||||
item = editor->pBuffer->pFirst->next;
|
||||
while(item != editor->pBuffer->pLast) {
|
||||
BOOL bRedraw = FALSE;
|
||||
|
||||
assert(item->type == diParagraph);
|
||||
if ((item->member.para.nFlags & MEPF_REWRAP)
|
||||
|| (item->member.para.pt.y != c.pt.y))
|
||||
bRedraw = TRUE;
|
||||
item->member.para.pt = c.pt;
|
||||
|
||||
ME_WrapTextParagraph(&c, item);
|
||||
|
||||
if (bRedraw)
|
||||
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
|
||||
|
||||
if (item->member.para.nFlags & MEPF_ROWSTART)
|
||||
{
|
||||
ME_DisplayItem *cell = ME_FindItemFwd(item, diCell);
|
||||
ME_DisplayItem *endRowPara;
|
||||
int borderWidth = 0;
|
||||
cell->member.cell.pt = c.pt;
|
||||
/* Offset the text by the largest top border width. */
|
||||
while (cell->member.cell.next_cell) {
|
||||
borderWidth = max(borderWidth, cell->member.cell.border.top.width);
|
||||
cell = cell->member.cell.next_cell;
|
||||
}
|
||||
endRowPara = ME_FindItemFwd(cell, diParagraph);
|
||||
assert(endRowPara->member.para.nFlags & MEPF_ROWEND);
|
||||
if (borderWidth > 0)
|
||||
{
|
||||
borderWidth = max(ME_twips2pointsY(&c, borderWidth), 1);
|
||||
while (cell) {
|
||||
cell->member.cell.yTextOffset = borderWidth;
|
||||
cell = cell->member.cell.prev_cell;
|
||||
ME_DisplayItem *cell = ME_FindItemFwd(item, diCell);
|
||||
ME_DisplayItem *endRowPara;
|
||||
int borderWidth = 0;
|
||||
cell->member.cell.pt = c->pt;
|
||||
/* Offset the text by the largest top border width. */
|
||||
while (cell->member.cell.next_cell)
|
||||
{
|
||||
borderWidth = max(borderWidth, cell->member.cell.border.top.width);
|
||||
cell = cell->member.cell.next_cell;
|
||||
}
|
||||
endRowPara = ME_FindItemFwd(cell, diParagraph);
|
||||
assert(endRowPara->member.para.nFlags & MEPF_ROWEND);
|
||||
if (borderWidth > 0)
|
||||
{
|
||||
borderWidth = max(ME_twips2pointsY(c, borderWidth), 1);
|
||||
while (cell)
|
||||
{
|
||||
cell->member.cell.yTextOffset = borderWidth;
|
||||
cell = cell->member.cell.prev_cell;
|
||||
}
|
||||
c->pt.y += borderWidth;
|
||||
}
|
||||
if (endRowPara->member.para.fmt.dxStartIndent > 0)
|
||||
{
|
||||
int dxStartIndent = endRowPara->member.para.fmt.dxStartIndent;
|
||||
cell = ME_FindItemFwd(item, diCell);
|
||||
cell->member.cell.pt.x += ME_twips2pointsX(c, dxStartIndent);
|
||||
c->pt.x = cell->member.cell.pt.x;
|
||||
}
|
||||
c.pt.y += borderWidth;
|
||||
}
|
||||
if (endRowPara->member.para.fmt.dxStartIndent > 0)
|
||||
{
|
||||
int dxStartIndent = endRowPara->member.para.fmt.dxStartIndent;
|
||||
cell = ME_FindItemFwd(item, diCell);
|
||||
cell->member.cell.pt.x += ME_twips2pointsX(&c, dxStartIndent);
|
||||
c.pt.x = cell->member.cell.pt.x;
|
||||
}
|
||||
}
|
||||
else if (item->member.para.nFlags & MEPF_ROWEND)
|
||||
{
|
||||
/* Set all the cells to the height of the largest cell */
|
||||
ME_DisplayItem *startRowPara;
|
||||
int prevHeight, nHeight, bottomBorder = 0;
|
||||
ME_DisplayItem *cell = ME_FindItemBack(item, diCell);
|
||||
item->member.para.nWidth = cell->member.cell.pt.x + cell->member.cell.nWidth;
|
||||
if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWSTART))
|
||||
{
|
||||
/* Last row, the bottom border is added to the height. */
|
||||
cell = cell->member.cell.prev_cell;
|
||||
while (cell)
|
||||
/* Set all the cells to the height of the largest cell */
|
||||
ME_DisplayItem *startRowPara;
|
||||
int prevHeight, nHeight, bottomBorder = 0;
|
||||
ME_DisplayItem *cell = ME_FindItemBack(item, diCell);
|
||||
item->member.para.nWidth = cell->member.cell.pt.x + cell->member.cell.nWidth;
|
||||
if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWSTART))
|
||||
{
|
||||
bottomBorder = max(bottomBorder, cell->member.cell.border.bottom.width);
|
||||
cell = cell->member.cell.prev_cell;
|
||||
/* Last row, the bottom border is added to the height. */
|
||||
cell = cell->member.cell.prev_cell;
|
||||
while (cell)
|
||||
{
|
||||
bottomBorder = max(bottomBorder, cell->member.cell.border.bottom.width);
|
||||
cell = cell->member.cell.prev_cell;
|
||||
}
|
||||
bottomBorder = ME_twips2pointsY(c, bottomBorder);
|
||||
cell = ME_FindItemBack(item, diCell);
|
||||
}
|
||||
bottomBorder = ME_twips2pointsY(&c, bottomBorder);
|
||||
cell = ME_FindItemBack(item, diCell);
|
||||
}
|
||||
prevHeight = cell->member.cell.nHeight;
|
||||
nHeight = cell->member.cell.prev_cell->member.cell.nHeight + bottomBorder;
|
||||
cell->member.cell.nHeight = nHeight;
|
||||
item->member.para.nHeight = nHeight;
|
||||
cell = cell->member.cell.prev_cell;
|
||||
cell->member.cell.nHeight = nHeight;
|
||||
while (cell->member.cell.prev_cell)
|
||||
{
|
||||
prevHeight = cell->member.cell.nHeight;
|
||||
nHeight = cell->member.cell.prev_cell->member.cell.nHeight + bottomBorder;
|
||||
cell->member.cell.nHeight = nHeight;
|
||||
item->member.para.nHeight = nHeight;
|
||||
cell = cell->member.cell.prev_cell;
|
||||
cell->member.cell.nHeight = nHeight;
|
||||
}
|
||||
/* Also set the height of the start row paragraph */
|
||||
startRowPara = ME_FindItemBack(cell, diParagraph);
|
||||
startRowPara->member.para.nHeight = nHeight;
|
||||
c.pt.x = startRowPara->member.para.pt.x;
|
||||
c.pt.y = cell->member.cell.pt.y + nHeight;
|
||||
if (prevHeight < nHeight)
|
||||
{
|
||||
/* The height of the cells has grown, so invalidate the bottom of
|
||||
* the cells. */
|
||||
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
|
||||
cell = ME_FindItemBack(item, diCell);
|
||||
while (cell) {
|
||||
ME_MarkRepaintEnd(ME_FindItemBack(cell, diParagraph), &repaint_start, &repaint_end);
|
||||
cell = cell->member.cell.prev_cell;
|
||||
while (cell->member.cell.prev_cell)
|
||||
{
|
||||
cell = cell->member.cell.prev_cell;
|
||||
cell->member.cell.nHeight = nHeight;
|
||||
}
|
||||
/* Also set the height of the start row paragraph */
|
||||
startRowPara = ME_FindItemBack(cell, diParagraph);
|
||||
startRowPara->member.para.nHeight = nHeight;
|
||||
c->pt.x = startRowPara->member.para.pt.x;
|
||||
c->pt.y = cell->member.cell.pt.y + nHeight;
|
||||
if (prevHeight < nHeight)
|
||||
{
|
||||
/* The height of the cells has grown, so invalidate the bottom of
|
||||
* the cells. */
|
||||
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
|
||||
cell = ME_FindItemBack(item, diCell);
|
||||
while (cell)
|
||||
{
|
||||
ME_MarkRepaintEnd(ME_FindItemBack(cell, diParagraph), &repaint_start, &repaint_end);
|
||||
cell = cell->member.cell.prev_cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item->member.para.pCell &&
|
||||
item->member.para.pCell != item->member.para.next_para->member.para.pCell)
|
||||
{
|
||||
/* The next paragraph is in the next cell in the table row. */
|
||||
ME_Cell *cell = &item->member.para.pCell->member.cell;
|
||||
cell->nHeight = c.pt.y + item->member.para.nHeight - cell->pt.y;
|
||||
/* The next paragraph is in the next cell in the table row. */
|
||||
ME_Cell *cell = &item->member.para.pCell->member.cell;
|
||||
cell->nHeight = c->pt.y + item->member.para.nHeight - cell->pt.y;
|
||||
|
||||
/* Propagate the largest height to the end so that it can be easily
|
||||
* sent back to all the cells at the end of the row. */
|
||||
if (cell->prev_cell)
|
||||
cell->nHeight = max(cell->nHeight, cell->prev_cell->member.cell.nHeight);
|
||||
/* Propagate the largest height to the end so that it can be easily
|
||||
* sent back to all the cells at the end of the row. */
|
||||
if (cell->prev_cell)
|
||||
cell->nHeight = max(cell->nHeight, cell->prev_cell->member.cell.nHeight);
|
||||
|
||||
c.pt.x = cell->pt.x + cell->nWidth;
|
||||
c.pt.y = cell->pt.y;
|
||||
cell->next_cell->member.cell.pt = c.pt;
|
||||
if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWEND))
|
||||
c.pt.y += cell->yTextOffset;
|
||||
c->pt.x = cell->pt.x + cell->nWidth;
|
||||
c->pt.y = cell->pt.y;
|
||||
cell->next_cell->member.cell.pt = c->pt;
|
||||
if (!(item->member.para.next_para->member.para.nFlags & MEPF_ROWEND))
|
||||
c->pt.y += cell->yTextOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item->member.para.pCell) {
|
||||
/* Next paragraph in the same cell. */
|
||||
c.pt.x = item->member.para.pCell->member.cell.pt.x;
|
||||
} else {
|
||||
/* Normal paragraph */
|
||||
c.pt.x = 0;
|
||||
}
|
||||
c.pt.y += item->member.para.nHeight;
|
||||
if (item->member.para.pCell)
|
||||
{
|
||||
/* Next paragraph in the same cell. */
|
||||
c->pt.x = item->member.para.pCell->member.cell.pt.x;
|
||||
}
|
||||
else
|
||||
/* Normal paragraph */
|
||||
c->pt.x = 0;
|
||||
c->pt.y += item->member.para.nHeight;
|
||||
}
|
||||
}
|
||||
|
||||
totalWidth = max(totalWidth, item->member.para.nWidth);
|
||||
item = item->member.para.next_para;
|
||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *item;
|
||||
ME_Context c;
|
||||
int totalWidth = editor->nTotalWidth, diff = 0, prev_width;
|
||||
ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL;
|
||||
ME_Paragraph *para;
|
||||
|
||||
if (!editor->first_marked_para)
|
||||
return FALSE;
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
|
||||
item = editor->first_marked_para;
|
||||
c.pt = item->member.para.pt;
|
||||
while (item != editor->pBuffer->pLast)
|
||||
{
|
||||
assert(item->type == diParagraph);
|
||||
|
||||
prev_width = item->member.para.nWidth;
|
||||
ME_WrapTextParagraph(editor, &c, item);
|
||||
if (prev_width == totalWidth && item->member.para.nWidth < totalWidth)
|
||||
totalWidth = get_total_width(editor);
|
||||
else
|
||||
totalWidth = max(totalWidth, item->member.para.nWidth);
|
||||
|
||||
if (!item->member.para.nCharOfs)
|
||||
ME_MarkRepaintEnd(item->member.para.prev_para, &repaint_start, &repaint_end);
|
||||
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
|
||||
adjust_para_y(item, &c, repaint_start, repaint_end);
|
||||
|
||||
if (item->member.para.next_para)
|
||||
{
|
||||
diff = c.pt.y - item->member.para.next_para->member.para.pt.y;
|
||||
if (diff)
|
||||
{
|
||||
para = &item->member.para;
|
||||
while (para->next_para && para != &item->member.para.next_marked->member.para &&
|
||||
para != &editor->pBuffer->pLast->member.para)
|
||||
{
|
||||
ME_MarkRepaintEnd(para->next_para, &repaint_start, &repaint_end);
|
||||
para->next_para->member.para.pt.y = c.pt.y;
|
||||
adjust_para_y(para->next_para, &c, repaint_start, repaint_end);
|
||||
para = ¶->next_para->member.para;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item->member.para.next_marked)
|
||||
{
|
||||
ME_DisplayItem *rem = item;
|
||||
item = item->member.para.next_marked;
|
||||
remove_marked_para(editor, rem);
|
||||
}
|
||||
else
|
||||
{
|
||||
remove_marked_para(editor, item);
|
||||
item = editor->pBuffer->pLast;
|
||||
}
|
||||
c.pt.y = item->member.para.pt.y;
|
||||
}
|
||||
editor->sizeWindow.cx = c.rcView.right-c.rcView.left;
|
||||
editor->sizeWindow.cy = c.rcView.bottom-c.rcView.top;
|
||||
|
|
|
@ -760,7 +760,7 @@ ME_StreamOutRTFCharProps(ME_OutStream *pStream, CHARFORMAT2W *fmt)
|
|||
{ CFE_STRIKEOUT, "\\strike", "\\strike0" },
|
||||
};
|
||||
|
||||
for (i = 0; i < sizeof(effects) / sizeof(effects[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE( effects ); i++)
|
||||
{
|
||||
if ((old_fmt->dwEffects ^ fmt->dwEffects) & effects[i].effect)
|
||||
strcat( props, fmt->dwEffects & effects[i].effect ? effects[i].on : effects[i].off );
|
||||
|
|
|
@ -158,7 +158,7 @@ reactos/dll/win32/qmgrprxy # Synced to WineStaging-2.9
|
|||
reactos/dll/win32/query # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/rasapi32 # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/resutils # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/riched20 # Synced to WineStaging-3.9
|
||||
reactos/dll/win32/riched20 # Synced to WineStaging-4.0
|
||||
reactos/dll/win32/riched32 # Synced to WineStaging-3.3
|
||||
reactos/dll/win32/rpcrt4 # Synced to WineStaging-4.0
|
||||
reactos/dll/win32/rsabase # Synced to WineStaging-3.3
|
||||
|
|
Loading…
Reference in a new issue