From aba425eb70adf376a71e8743f313a7e6fa306046 Mon Sep 17 00:00:00 2001 From: Dylan Smith Date: Tue, 8 Jul 2008 13:38:54 -0400 Subject: [PATCH] richedit: PFE_TABLE flag is now used instead of private bTable value. The PARAFORMAT structure has a bit in wEffects to indicate whether the paragraph is a table or not, so this should be used instead of a private bTable value, since this structure can be retrieved with EM_GETPARAFORMAT. --- dlls/riched20/caret.c | 4 +++- dlls/riched20/editor.c | 10 +++++----- dlls/riched20/editstr.h | 3 +-- dlls/riched20/para.c | 6 +++--- dlls/riched20/writer.c | 8 ++++---- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index a76f2db9533..08e903636a0 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -454,7 +454,9 @@ ME_InsertTableCellFromCursor(ME_TextEditor *editor, int nCursor) } } assert(run->type == diParagraph); - assert(run->member.para.bTable); + assert(run->member.para.pFmt); + assert(run->member.para.pFmt->dwMask & PFM_TABLE); + assert(run->member.para.pFmt->wEffects & PFE_TABLE); assert(run->member.para.pCells); p->member.run.pCell = run->member.para.pCells; } diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 8a099a65f50..4665845ce23 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -452,7 +452,7 @@ static void ME_RTFParAttrHook(RTF_Info *info) { case rtfParDef: /* restores default paragraph attributes */ fmt.dwMask = PFM_ALIGNMENT | PFM_BORDER | PFM_LINESPACING | PFM_TABSTOPS | PFM_OFFSET | - PFM_RIGHTINDENT | PFM_SPACEAFTER | PFM_SPACEBEFORE | PFM_STARTINDENT; + PFM_RIGHTINDENT | PFM_SPACEAFTER | PFM_SPACEBEFORE | PFM_STARTINDENT | PFM_TABLE; /* TODO: numbering, shading */ fmt.wAlignment = PFA_LEFT; fmt.cTabCount = 0; @@ -462,8 +462,7 @@ static void ME_RTFParAttrHook(RTF_Info *info) fmt.bLineSpacingRule = 0; fmt.dySpaceBefore = fmt.dySpaceAfter = 0; fmt.dyLineSpacing = 0; - RTFFlushOutputBuffer(info); - ME_GetParagraph(info->editor->pCursors[0].pRun)->member.para.bTable = FALSE; + fmt.wEffects &= ~PFE_TABLE; break; case rtfInTable: { @@ -472,8 +471,9 @@ static void ME_RTFParAttrHook(RTF_Info *info) RTFFlushOutputBuffer(info); para = ME_GetParagraph(info->editor->pCursors[0].pRun); assert(para->member.para.pCells); - para->member.para.bTable = TRUE; - return; + fmt.dwMask |= PFM_TABLE; + fmt.wEffects |= PFE_TABLE; + break; } case rtfFirstIndent: ME_GetSelectionParaFormat(info->editor, &fmt); diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index e3f29b3a4d3..f3e837ef549 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -169,8 +169,7 @@ typedef struct tagME_TableCell typedef struct tagME_Paragraph { PARAFORMAT2 *pFmt; - - BOOL bTable; /* this paragraph is a table row */ + struct tagME_TableCell *pCells; /* list of cells and their properties */ struct tagME_TableCell *pLastCell; /* points to the last cell in the list */ diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index de69794c33d..c0f1857ca45 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -151,8 +151,6 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME new_para->member.para.nFlags = MEPF_REWRAP; /* FIXME copy flags (if applicable) */ /* FIXME initialize format style and call ME_SetParaFormat blah blah */ *new_para->member.para.pFmt = *run_para->member.para.pFmt; - - new_para->member.para.bTable = run_para->member.para.bTable; /* Inherit previous cell definitions if any */ new_para->member.para.pCells = NULL; @@ -174,7 +172,9 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME } /* fix paragraph properties. FIXME only needed when called from RTF reader */ - if (run_para->member.para.pCells && !run_para->member.para.bTable) + if (run_para->member.para.pCells && + !(run_para->member.para.pFmt->wEffects & PFE_TABLE + && run_para->member.para.pFmt->dwMask & PFM_TABLE)) { /* Paragraph does not have an \intbl keyword, so any table definition * stored is invalid */ diff --git a/dlls/riched20/writer.c b/dlls/riched20/writer.c index ce9e8537d7f..98454173320 100644 --- a/dlls/riched20/writer.c +++ b/dlls/riched20/writer.c @@ -310,7 +310,7 @@ ME_StreamOutRTFParaProps(ME_OutStream *pStream, const ME_DisplayItem *para) if (!ME_StreamOutPrint(pStream, "\\pard")) return FALSE; - if (para->member.para.bTable) + if (fmt->dwMask & PFM_TABLE && fmt->wEffects & PFE_TABLE) strcat(props, "\\intbl"); /* TODO: PFM_BORDER. M$ does not emit any keywords for these properties, and @@ -376,8 +376,6 @@ ME_StreamOutRTFParaProps(ME_OutStream *pStream, const ME_DisplayItem *para) strcat(props, "\\rtlpar"); if (fmt->dwMask & PFM_SIDEBYSIDE && fmt->wEffects & PFE_SIDEBYSIDE) strcat(props, "\\sbys"); - if (fmt->dwMask & PFM_TABLE && fmt->dwMask & PFE_TABLE) - strcat(props, "\\intbl"); if (fmt->dwMask & PFM_OFFSET) sprintf(props + strlen(props), "\\li%d", fmt->dxOffset); @@ -704,7 +702,9 @@ ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream, int nStart, int nC return FALSE; nChars--; } else if (p->member.run.nFlags & MERF_ENDPARA) { - if (pPara->member.para.bTable) { + if (pPara->member.para.pFmt->dwMask & PFM_TABLE + && pPara->member.para.pFmt->wEffects & PFE_TABLE) + { if (!ME_StreamOutPrint(pStream, "\\row \r\n")) return FALSE; } else { -- 2.11.4.GIT