Commit aba425eb authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

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.
parent 3adf8116
......@@ -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;
}
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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 {
......
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