Dylan Smith : richedit: PFE_TABLE flag is now used instead of private bTable value.
Alexandre Julliard
julliard at winehq.org
Wed Jul 9 06:10:16 CDT 2008
Module: wine
Branch: master
Commit: aba425eb70adf376a71e8743f313a7e6fa306046
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aba425eb70adf376a71e8743f313a7e6fa306046
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Tue Jul 8 13:38:54 2008 -0400
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 a76f2db..08e9036 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 8a099a6..4665845 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 e3f29b3..f3e837e 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 de69794..c0f1857 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 ce9e853..9845417 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 {
More information about the wine-cvs
mailing list