riched20: Use more cell helpers in some of the table 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-11-06 08:32:20 +00:00 committed by Alexandre Julliard
parent 96097c072b
commit b692fb5e08
1 changed files with 17 additions and 18 deletions

View File

@ -96,7 +96,7 @@ ME_Paragraph* table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragrap
while (para != end_para) while (para != end_para)
{ {
para->pCell = prev_para->pCell; para->pCell = cell_get_di( para_cell( prev_para ) );
para->nFlags |= MEPF_CELL; para->nFlags |= MEPF_CELL;
para->nFlags &= ~(MEPF_ROWSTART | MEPF_ROWEND); para->nFlags &= ~(MEPF_ROWSTART | MEPF_ROWEND);
para->fmt.dwMask |= PFM_TABLE | PFM_TABLEROWDELIMITER; para->fmt.dwMask |= PFM_TABLE | PFM_TABLEROWDELIMITER;
@ -128,32 +128,31 @@ ME_Paragraph* table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor )
ME_Paragraph* table_row_end( ME_Paragraph *para ) ME_Paragraph* table_row_end( ME_Paragraph *para )
{ {
ME_DisplayItem *cell; ME_Cell *cell;
assert( para );
if (para->nFlags & MEPF_ROWEND) return para; if (para->nFlags & MEPF_ROWEND) return para;
if (para->nFlags & MEPF_ROWSTART) para = para_next( para ); if (para->nFlags & MEPF_ROWSTART) para = para_next( para );
cell = para->pCell; cell = para_cell( para );
assert(cell && cell->type == diCell); while (cell_next( cell ))
while (cell->member.cell.next_cell) cell = cell_next( cell );
cell = cell->member.cell.next_cell;
para = &ME_FindItemFwd( cell, diParagraph )->member.para; para = &ME_FindItemFwd( cell_get_di( cell ), diParagraph )->member.para;
assert( para && para->nFlags & MEPF_ROWEND ); assert( para && para->nFlags & MEPF_ROWEND );
return para; return para;
} }
ME_Paragraph* table_row_start( ME_Paragraph *para ) ME_Paragraph* table_row_start( ME_Paragraph *para )
{ {
ME_DisplayItem *cell; ME_Cell *cell;
assert( para );
if (para->nFlags & MEPF_ROWSTART) return para; if (para->nFlags & MEPF_ROWSTART) return para;
if (para->nFlags & MEPF_ROWEND) para = para_prev( para ); if (para->nFlags & MEPF_ROWEND) para = para_prev( para );
cell = para->pCell; cell = para_cell( para );
assert(cell && cell->type == diCell);
while (cell->member.cell.prev_cell)
cell = cell->member.cell.prev_cell;
para = &ME_FindItemBack( cell, diParagraph )->member.para; while (cell_prev( cell ))
cell = cell_prev( cell );
para = &ME_FindItemBack( cell_get_di( cell ), diParagraph )->member.para;
assert( para && para->nFlags & MEPF_ROWSTART ); assert( para && para->nFlags & MEPF_ROWSTART );
return para; return para;
} }
@ -161,11 +160,11 @@ ME_Paragraph* table_row_start( ME_Paragraph *para )
ME_Paragraph* table_outer_para( ME_Paragraph *para ) ME_Paragraph* table_outer_para( ME_Paragraph *para )
{ {
if (para->nFlags & MEPF_ROWEND) para = para_prev( para ); if (para->nFlags & MEPF_ROWEND) para = para_prev( para );
while (para->pCell) while (para_cell( para ))
{ {
para = table_row_start( para ); para = table_row_start( para );
if (!para->pCell) break; if (!para_cell( para )) break;
para = &ME_FindItemBack( para->pCell, diParagraph )->member.para; para = &ME_FindItemBack( cell_get_di( para_cell( para ) ), diParagraph )->member.para;
} }
return para; return para;
} }