From 670dadf719798c7ae95a0922d610d2c011df4a29 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Thu, 22 Oct 2020 12:46:47 +0100 Subject: [PATCH] riched20: Return paragraph ptrs from the remaining table insert functions. Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/riched20/editor.c | 8 ++++---- dlls/riched20/editor.h | 4 ++-- dlls/riched20/table.c | 16 +++++++--------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 36c2e108b2d..15dd75b9575 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -966,7 +966,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info) tableDef->row_start = table_insert_row_start_at_para( info->editor, para ); info->nestingLevel = 1; } - ME_InsertTableCellFromCursor(info->editor); + table_insert_cell( info->editor, info->editor->pCursors ); } } else /* v1.0 - v3.0 */ @@ -1018,7 +1018,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info) nRightBoundary += defaultCellSize; cell->member.cell.nRightBoundary = nRightBoundary; } - para = &ME_InsertTableCellFromCursor(info->editor)->member.para; + para = table_insert_cell( info->editor, info->editor->pCursors ); cell = para->pCell; cell->member.cell.nRightBoundary = nRightBoundary; } @@ -1033,7 +1033,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info) cell = cell->member.cell.next_cell; if (!cell) { - para = &ME_InsertTableCellFromCursor(info->editor)->member.para; + para = table_insert_cell( info->editor, info->editor->pCursors ); cell = para->pCell; } } @@ -1056,7 +1056,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info) nChars, TRUE); } - para = &ME_InsertTableRowEndFromCursor(info->editor)->member.para; + para = table_insert_row_end( info->editor, info->editor->pCursors ); para->fmt.dxOffset = abs(info->tableDef->gapH); para->fmt.dxStartIndent = info->tableDef->leftEdge; ME_ApplyBorderProperties( info, ¶->border, tableDef->border ); diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index e9a7a77e234..168a8e58cc2 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -279,9 +279,9 @@ ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN; /* table.c */ BOOL ME_IsInTable(ME_DisplayItem *pItem) DECLSPEC_HIDDEN; -ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN; -ME_DisplayItem *ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN; ME_Paragraph *table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) DECLSPEC_HIDDEN; +ME_Paragraph *table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; +ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c index 1b735638606..aff4f0dc13f 100644 --- a/dlls/riched20/table.c +++ b/dlls/riched20/table.c @@ -113,21 +113,19 @@ ME_Paragraph* table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragrap /* Inserts a diCell and starts a new paragraph for the next cell. * * Returns the first paragraph of the new cell. */ -ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor) +ME_Paragraph* table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor ) { - ME_Paragraph *para; WCHAR tab = '\t'; - para = table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL ); - return para_get_di( para ); + return table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL ); } -ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) +ME_Paragraph* table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) { ME_Paragraph *para; - para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWEND ); - return para_get_di( para_prev( para ) ); + para = table_insert_end_para( editor, cursor, cr_lf, 2, MEPF_ROWEND ); + return para_prev( para ); } ME_Paragraph* table_row_end( ME_Paragraph *para ) @@ -424,13 +422,13 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) while (cell->member.cell.next_cell) { cell = cell->member.cell.next_cell; - para = &ME_InsertTableCellFromCursor( editor )->member.para; + para = table_insert_cell( editor, editor->pCursors ); insertedCell = ME_FindItemBack( para_get_di( para ), diCell ); /* Copy cell properties */ insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary; insertedCell->member.cell.border = cell->member.cell.border; }; - para = &ME_InsertTableRowEndFromCursor(editor)->member.para; + para = table_insert_row_end( editor, editor->pCursors ); para->fmt = prev_table_end->fmt; /* return the table row start for the inserted paragraph */ return para_next( &ME_FindItemFwd( cell, diParagraph )->member.para );