Commit caa1d4a4 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Return a para ptr from the insert start table row functions.

parent fe70e7be
...@@ -279,12 +279,11 @@ ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN; ...@@ -279,12 +279,11 @@ 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_InsertTableRowStartFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
ME_DisplayItem *para) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN; ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
ME_DisplayItem *ME_InsertTableRowEndFromCursor(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_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; ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
......
...@@ -1035,10 +1035,10 @@ struct RTFTable ...@@ -1035,10 +1035,10 @@ struct RTFTable
int numCellsInserted; int numCellsInserted;
/* v4.1 */ /* v4.1 */
/* tableRowStart may be the start row paragraph of the table row, /* row_start may be the start row paragraph of the table row,
* or it may store the end of the previous row if it may still be * or it may store the end of the previous row if it may still be
* continued, otherwise NULL is stored. */ * continued, otherwise NULL is stored. */
ME_DisplayItem *tableRowStart; ME_Paragraph *row_start;
/* Table definitions are stored as a stack to support nested tables. */ /* Table definitions are stored as a stack to support nested tables. */
RTFTable *parent; RTFTable *parent;
......
...@@ -73,44 +73,41 @@ static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cu ...@@ -73,44 +73,41 @@ static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cu
return para; return para;
} }
ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor) ME_Paragraph* table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor )
{ {
ME_Paragraph *para; ME_Paragraph *para;
para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWSTART ); para = table_insert_end_para( editor, cursor, cr_lf, 2, MEPF_ROWSTART );
return para_get_di( para_prev( para ) ); return para_prev( para );
} }
ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor, ME_Paragraph* table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para )
ME_DisplayItem *para)
{ {
ME_DisplayItem *prev_para, *end_para; ME_Paragraph *prev_para, *end_para, *start_row;
ME_Cursor savedCursor = editor->pCursors[0]; ME_Cursor cursor;
ME_DisplayItem *startRowPara;
editor->pCursors[0].pPara = para; cursor.pPara = para_get_di( para );
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); cursor.pRun = run_get_di( para_first_run( para ) );
editor->pCursors[0].nOffset = 0; cursor.nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
startRowPara = ME_InsertTableRowStartFromCursor(editor); start_row = table_insert_row_start( editor, &cursor );
savedCursor.pPara = ME_GetParagraph(savedCursor.pRun);
editor->pCursors[0] = savedCursor; end_para = para_next( &editor->pCursors[0].pPara->member.para );
editor->pCursors[1] = editor->pCursors[0]; prev_para = para_next( start_row );
para = para_next( prev_para );
end_para = editor->pCursors[0].pPara->member.para.next_para;
prev_para = startRowPara->member.para.next_para; while (para != end_para)
para = prev_para->member.para.next_para; {
while (para != end_para) para->pCell = prev_para->pCell;
{ para->nFlags |= MEPF_CELL;
para->member.para.pCell = prev_para->member.para.pCell; para->nFlags &= ~(MEPF_ROWSTART | MEPF_ROWEND);
para->member.para.nFlags |= MEPF_CELL; para->fmt.dwMask |= PFM_TABLE | PFM_TABLEROWDELIMITER;
para->member.para.nFlags &= ~(MEPF_ROWSTART|MEPF_ROWEND); para->fmt.wEffects |= PFE_TABLE;
para->member.para.fmt.dwMask |= PFM_TABLE|PFM_TABLEROWDELIMITER; para->fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
para->member.para.fmt.wEffects |= PFE_TABLE; prev_para = para;
para->member.para.fmt.wEffects &= ~PFE_TABLEROWDELIMITER; para = para_next( para );
prev_para = para; }
para = para->member.para.next_para; return start_row;
}
return startRowPara;
} }
/* Inserts a diCell and starts a new paragraph for the next cell. /* Inserts a diCell and starts a new paragraph for the next cell.
...@@ -419,7 +416,7 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) ...@@ -419,7 +416,7 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row )
editor->pCursors[0].pRun = run_get_di( run ); editor->pCursors[0].pRun = run_get_di( run );
editor->pCursors[0].nOffset = 0; editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0]; editor->pCursors[1] = editor->pCursors[0];
para = &ME_InsertTableRowStartFromCursor(editor)->member.para; para = table_insert_row_start( editor, editor->pCursors );
insertedCell = ME_FindItemFwd( para_get_di( para ), diCell ); insertedCell = ME_FindItemFwd( 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment