Huw Davies : riched20: Use cell ptrs in the rtf writing code.

Alexandre Julliard julliard at winehq.org
Thu Oct 22 15:27:31 CDT 2020


Module: wine
Branch: master
Commit: b2c812e3a3f8c3286373433635c4b653704c3d61
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b2c812e3a3f8c3286373433635c4b653704c3d61

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Oct 22 12:46:49 2020 +0100

riched20: Use cell ptrs in the rtf writing code.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/writer.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c
index 182a725dbad..9e79eda274d 100644
--- a/dlls/riched20/writer.c
+++ b/dlls/riched20/writer.c
@@ -316,7 +316,7 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
   ME_Run *run = first;
   ME_FontTableItem *table = pStream->fonttbl;
   unsigned int i;
-  ME_DisplayItem *pCell = NULL;
+  ME_Cell *cell = NULL;
   ME_Paragraph *prev_para = NULL;
 
   do
@@ -336,12 +336,10 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
       if (run->para->fmt.wNumbering)
         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,
-                                  &pCell->member.cell.border.left,
-                                  &pCell->member.cell.border.bottom,
-                                  &pCell->member.cell.border.right };
+        ME_Border* borders[4] = { &cell->border.top, &cell->border.left,
+                                  &cell->border.bottom, &cell->border.right };
         for (i = 0; i < 4; i++)
           if (borders[i]->width > 0)
             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,
                                     ME_Paragraph *para )
 {
-  ME_DisplayItem *cell;
+  ME_Cell *cell;
   char props[STREAMOUT_BUFFER_SIZE] = "";
   int i;
   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 */
   {
     PARAFORMAT2 *pFmt = &table_row_end( para )->fmt;
-    para = table_row_start( para );
-    cell = para->next_para->member.para.pCell;
-    assert(cell);
+    cell = table_row_first_cell( para );
+    assert( cell );
     if (pFmt->dxOffset)
       sprintf(props + strlen(props), "\\trgaph%d", pFmt->dxOffset);
     if (pFmt->dxStartIndent)
       sprintf(props + strlen(props), "\\trleft%d", pFmt->dxStartIndent);
     do
     {
-      ME_Border* borders[4] = { &cell->member.cell.border.top,
-                                &cell->member.cell.border.left,
-                                &cell->member.cell.border.bottom,
-                                &cell->member.cell.border.right };
+      ME_Border* borders[4] = { &cell->border.top, &cell->border.left,
+                                &cell->border.bottom, &cell->border.right };
       for (i = 0; i < 4; i++)
       {
         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), "\\cellx%d", cell->member.cell.nRightBoundary);
-      cell = cell->member.cell.next_cell;
-    } while (cell->member.cell.next_cell);
+      sprintf( props + strlen(props), "\\cellx%d", cell->nRightBoundary );
+      cell = cell_next( cell );
+    } while (cell_next( cell ));
   }
   else /* v1.0 - 3.0 */
   {




More information about the wine-cvs mailing list