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.
This commit is contained in:
parent
3adf811645
commit
aba425eb70
@ -454,7 +454,9 @@ ME_InsertTableCellFromCursor(ME_TextEditor *editor, int nCursor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(run->type == diParagraph);
|
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);
|
assert(run->member.para.pCells);
|
||||||
p->member.run.pCell = 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 */
|
case rtfParDef: /* restores default paragraph attributes */
|
||||||
fmt.dwMask = PFM_ALIGNMENT | PFM_BORDER | PFM_LINESPACING | PFM_TABSTOPS | PFM_OFFSET |
|
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 */
|
/* TODO: numbering, shading */
|
||||||
fmt.wAlignment = PFA_LEFT;
|
fmt.wAlignment = PFA_LEFT;
|
||||||
fmt.cTabCount = 0;
|
fmt.cTabCount = 0;
|
||||||
@ -462,8 +462,7 @@ static void ME_RTFParAttrHook(RTF_Info *info)
|
|||||||
fmt.bLineSpacingRule = 0;
|
fmt.bLineSpacingRule = 0;
|
||||||
fmt.dySpaceBefore = fmt.dySpaceAfter = 0;
|
fmt.dySpaceBefore = fmt.dySpaceAfter = 0;
|
||||||
fmt.dyLineSpacing = 0;
|
fmt.dyLineSpacing = 0;
|
||||||
RTFFlushOutputBuffer(info);
|
fmt.wEffects &= ~PFE_TABLE;
|
||||||
ME_GetParagraph(info->editor->pCursors[0].pRun)->member.para.bTable = FALSE;
|
|
||||||
break;
|
break;
|
||||||
case rtfInTable:
|
case rtfInTable:
|
||||||
{
|
{
|
||||||
@ -472,8 +471,9 @@ static void ME_RTFParAttrHook(RTF_Info *info)
|
|||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
para = ME_GetParagraph(info->editor->pCursors[0].pRun);
|
para = ME_GetParagraph(info->editor->pCursors[0].pRun);
|
||||||
assert(para->member.para.pCells);
|
assert(para->member.para.pCells);
|
||||||
para->member.para.bTable = TRUE;
|
fmt.dwMask |= PFM_TABLE;
|
||||||
return;
|
fmt.wEffects |= PFE_TABLE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case rtfFirstIndent:
|
case rtfFirstIndent:
|
||||||
ME_GetSelectionParaFormat(info->editor, &fmt);
|
ME_GetSelectionParaFormat(info->editor, &fmt);
|
||||||
|
@ -170,7 +170,6 @@ typedef struct tagME_Paragraph
|
|||||||
{
|
{
|
||||||
PARAFORMAT2 *pFmt;
|
PARAFORMAT2 *pFmt;
|
||||||
|
|
||||||
BOOL bTable; /* this paragraph is a table row */
|
|
||||||
struct tagME_TableCell *pCells; /* list of cells and their properties */
|
struct tagME_TableCell *pCells; /* list of cells and their properties */
|
||||||
struct tagME_TableCell *pLastCell; /* points to the last cell in the list */
|
struct tagME_TableCell *pLastCell; /* points to the last cell in the list */
|
||||||
|
|
||||||
|
@ -152,8 +152,6 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ME
|
|||||||
/* FIXME initialize format style and call ME_SetParaFormat blah blah */
|
/* FIXME initialize format style and call ME_SetParaFormat blah blah */
|
||||||
*new_para->member.para.pFmt = *run_para->member.para.pFmt;
|
*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 */
|
/* Inherit previous cell definitions if any */
|
||||||
new_para->member.para.pCells = NULL;
|
new_para->member.para.pCells = NULL;
|
||||||
if (run_para->member.para.pCells)
|
if (run_para->member.para.pCells)
|
||||||
@ -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 */
|
/* 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
|
/* Paragraph does not have an \intbl keyword, so any table definition
|
||||||
* stored is invalid */
|
* stored is invalid */
|
||||||
|
@ -310,7 +310,7 @@ ME_StreamOutRTFParaProps(ME_OutStream *pStream, const ME_DisplayItem *para)
|
|||||||
if (!ME_StreamOutPrint(pStream, "\\pard"))
|
if (!ME_StreamOutPrint(pStream, "\\pard"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (para->member.para.bTable)
|
if (fmt->dwMask & PFM_TABLE && fmt->wEffects & PFE_TABLE)
|
||||||
strcat(props, "\\intbl");
|
strcat(props, "\\intbl");
|
||||||
|
|
||||||
/* TODO: PFM_BORDER. M$ does not emit any keywords for these properties, and
|
/* 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");
|
strcat(props, "\\rtlpar");
|
||||||
if (fmt->dwMask & PFM_SIDEBYSIDE && fmt->wEffects & PFE_SIDEBYSIDE)
|
if (fmt->dwMask & PFM_SIDEBYSIDE && fmt->wEffects & PFE_SIDEBYSIDE)
|
||||||
strcat(props, "\\sbys");
|
strcat(props, "\\sbys");
|
||||||
if (fmt->dwMask & PFM_TABLE && fmt->dwMask & PFE_TABLE)
|
|
||||||
strcat(props, "\\intbl");
|
|
||||||
|
|
||||||
if (fmt->dwMask & PFM_OFFSET)
|
if (fmt->dwMask & PFM_OFFSET)
|
||||||
sprintf(props + strlen(props), "\\li%d", fmt->dxOffset);
|
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;
|
return FALSE;
|
||||||
nChars--;
|
nChars--;
|
||||||
} else if (p->member.run.nFlags & MERF_ENDPARA) {
|
} 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"))
|
if (!ME_StreamOutPrint(pStream, "\\row \r\n"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user