riched20: Use cell ptrs in the rtf writing code.

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:49 +01:00 committed by Alexandre Julliard
parent 431ee50875
commit b2c812e3a3
1 changed files with 12 additions and 17 deletions

View File

@ -316,7 +316,7 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
ME_Run *run = first; ME_Run *run = first;
ME_FontTableItem *table = pStream->fonttbl; ME_FontTableItem *table = pStream->fonttbl;
unsigned int i; unsigned int i;
ME_DisplayItem *pCell = NULL; ME_Cell *cell = NULL;
ME_Paragraph *prev_para = NULL; ME_Paragraph *prev_para = NULL;
do do
@ -336,12 +336,10 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
if (run->para->fmt.wNumbering) if (run->para->fmt.wNumbering)
add_font_to_fonttbl( pStream, run->para->para_num.style ); add_font_to_fonttbl( pStream, run->para->para_num.style );
if ((pCell = run->para->pCell)) if ((cell = para_cell( run->para )))
{ {
ME_Border* borders[4] = { &pCell->member.cell.border.top, ME_Border* borders[4] = { &cell->border.top, &cell->border.left,
&pCell->member.cell.border.left, &cell->border.bottom, &cell->border.right };
&pCell->member.cell.border.bottom,
&pCell->member.cell.border.right };
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if (borders[i]->width > 0) if (borders[i]->width > 0)
add_color_to_colortbl( pStream, borders[i]->colorRef ); add_color_to_colortbl( pStream, borders[i]->colorRef );
@ -389,7 +387,7 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream, static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream,
ME_Paragraph *para ) ME_Paragraph *para )
{ {
ME_DisplayItem *cell; ME_Cell *cell;
char props[STREAMOUT_BUFFER_SIZE] = ""; char props[STREAMOUT_BUFFER_SIZE] = "";
int i; int i;
const char sideChar[4] = {'t','l','b','r'}; const char sideChar[4] = {'t','l','b','r'};
@ -399,19 +397,16 @@ static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream
if (!editor->bEmulateVersion10) /* v4.1 */ if (!editor->bEmulateVersion10) /* v4.1 */
{ {
PARAFORMAT2 *pFmt = &table_row_end( para )->fmt; PARAFORMAT2 *pFmt = &table_row_end( para )->fmt;
para = table_row_start( para ); cell = table_row_first_cell( para );
cell = para->next_para->member.para.pCell; assert( cell );
assert(cell);
if (pFmt->dxOffset) if (pFmt->dxOffset)
sprintf(props + strlen(props), "\\trgaph%d", pFmt->dxOffset); sprintf(props + strlen(props), "\\trgaph%d", pFmt->dxOffset);
if (pFmt->dxStartIndent) if (pFmt->dxStartIndent)
sprintf(props + strlen(props), "\\trleft%d", pFmt->dxStartIndent); sprintf(props + strlen(props), "\\trleft%d", pFmt->dxStartIndent);
do do
{ {
ME_Border* borders[4] = { &cell->member.cell.border.top, ME_Border* borders[4] = { &cell->border.top, &cell->border.left,
&cell->member.cell.border.left, &cell->border.bottom, &cell->border.right };
&cell->member.cell.border.bottom,
&cell->member.cell.border.right };
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (borders[i]->width) if (borders[i]->width)
@ -425,9 +420,9 @@ static BOOL stream_out_table_props( ME_TextEditor *editor, ME_OutStream *pStream
sprintf(props + strlen(props), "\\brdrcf%u", idx); sprintf(props + strlen(props), "\\brdrcf%u", idx);
} }
} }
sprintf(props + strlen(props), "\\cellx%d", cell->member.cell.nRightBoundary); sprintf( props + strlen(props), "\\cellx%d", cell->nRightBoundary );
cell = cell->member.cell.next_cell; cell = cell_next( cell );
} while (cell->member.cell.next_cell); } while (cell_next( cell ));
} }
else /* v1.0 - 3.0 */ else /* v1.0 - 3.0 */
{ {