riched20: Return paragraph ptrs from the remaining table insert functions.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-22 12:46:47 +01:00 committed by Alexandre Julliard
parent caa1d4a480
commit 670dadf719
3 changed files with 13 additions and 15 deletions

View File

@ -966,7 +966,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
tableDef->row_start = table_insert_row_start_at_para( info->editor, para ); tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
info->nestingLevel = 1; info->nestingLevel = 1;
} }
ME_InsertTableCellFromCursor(info->editor); table_insert_cell( info->editor, info->editor->pCursors );
} }
} }
else /* v1.0 - v3.0 */ else /* v1.0 - v3.0 */
@ -1018,7 +1018,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
nRightBoundary += defaultCellSize; nRightBoundary += defaultCellSize;
cell->member.cell.nRightBoundary = nRightBoundary; 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 = para->pCell;
cell->member.cell.nRightBoundary = nRightBoundary; cell->member.cell.nRightBoundary = nRightBoundary;
} }
@ -1033,7 +1033,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
cell = cell->member.cell.next_cell; cell = cell->member.cell.next_cell;
if (!cell) if (!cell)
{ {
para = &ME_InsertTableCellFromCursor(info->editor)->member.para; para = table_insert_cell( info->editor, info->editor->pCursors );
cell = para->pCell; cell = para->pCell;
} }
} }
@ -1056,7 +1056,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
nChars, TRUE); 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.dxOffset = abs(info->tableDef->gapH);
para->fmt.dxStartIndent = info->tableDef->leftEdge; para->fmt.dxStartIndent = info->tableDef->leftEdge;
ME_ApplyBorderProperties( info, &para->border, tableDef->border ); ME_ApplyBorderProperties( info, &para->border, tableDef->border );

View File

@ -279,9 +279,9 @@ ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
/* table.c */ /* table.c */
BOOL ME_IsInTable(ME_DisplayItem *pItem) DECLSPEC_HIDDEN; 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_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( 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_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;

View File

@ -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. /* Inserts a diCell and starts a new paragraph for the next cell.
* *
* Returns the first paragraph of the new 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'; WCHAR tab = '\t';
para = table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL ); return table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL );
return para_get_di( para );
} }
ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) ME_Paragraph* table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor )
{ {
ME_Paragraph *para; ME_Paragraph *para;
para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWEND ); para = table_insert_end_para( editor, cursor, cr_lf, 2, MEPF_ROWEND );
return para_get_di( para_prev( para ) ); return para_prev( para );
} }
ME_Paragraph* table_row_end( ME_Paragraph *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) while (cell->member.cell.next_cell)
{ {
cell = 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 ); insertedCell = ME_FindItemBack( para_get_di( para ), diCell );
/* Copy cell properties */ /* Copy cell properties */
insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary; insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
insertedCell->member.cell.border = cell->member.cell.border; 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; para->fmt = prev_table_end->fmt;
/* return the table row start for the inserted paragraph */ /* return the table row start for the inserted paragraph */
return para_next( &ME_FindItemFwd( cell, diParagraph )->member.para ); return para_next( &ME_FindItemFwd( cell, diParagraph )->member.para );