Commit 103cd9f2 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Return a paragraph ptr from the table insert helper.

parent f0783863
...@@ -58,29 +58,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists); ...@@ -58,29 +58,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
static const WCHAR cr_lf[] = {'\r', '\n', 0}; static const WCHAR cr_lf[] = {'\r', '\n', 0};
static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor, static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cursor,
int nCursor, const WCHAR *eol_str, int eol_len, int para_flags )
const WCHAR *eol_str, int eol_len,
int paraFlags)
{ {
ME_Style *pStyle = style_get_insert_style( editor, editor->pCursors + nCursor ); ME_Style *style = style_get_insert_style( editor, cursor );
ME_Paragraph *para; ME_Paragraph *para;
ME_Cursor* cursor = &editor->pCursors[nCursor];
if (cursor->nOffset) run_split( editor, cursor ); if (cursor->nOffset) run_split( editor, cursor );
para = para_split( editor, &cursor->pRun->member.run, pStyle, eol_str, eol_len, paraFlags ); para = para_split( editor, &cursor->pRun->member.run, style, eol_str, eol_len, para_flags );
ME_ReleaseStyle(pStyle); ME_ReleaseStyle( style );
cursor->pPara = para_get_di( para ); cursor->pPara = para_get_di( para );
cursor->pRun = run_get_di( para_first_run( para ) ); cursor->pRun = run_get_di( para_first_run( para ) );
return para_get_di( para ); return para;
} }
ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor) ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor)
{ {
ME_DisplayItem *para; ME_Paragraph *para;
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWSTART);
return para->member.para.prev_para; para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWSTART );
return para_get_di( para_prev( para ) );
} }
ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor, ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
...@@ -120,17 +118,19 @@ ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor, ...@@ -120,17 +118,19 @@ ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
* Returns the first paragraph of the new cell. */ * Returns the first paragraph of the new cell. */
ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor) ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor)
{ {
ME_DisplayItem *para; ME_Paragraph *para;
WCHAR tab = '\t'; WCHAR tab = '\t';
para = ME_InsertEndParaFromCursor(editor, 0, &tab, 1, MEPF_CELL);
return para; para = table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL );
return para_get_di( para );
} }
ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor)
{ {
ME_DisplayItem *para; ME_Paragraph *para;
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWEND);
return para->member.para.prev_para; para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWEND );
return para_get_di( para_prev( para ) );
} }
ME_Paragraph* table_row_end( ME_Paragraph *para ) ME_Paragraph* table_row_end( ME_Paragraph *para )
......
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