riched20: Embed PARAFORMAT2 in the paragraph struct rather than its ptr.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-09-29 10:13:11 +01:00 committed by Alexandre Julliard
parent 04f8ecd956
commit b3b5c25628
11 changed files with 120 additions and 122 deletions

View File

@ -445,7 +445,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
continue; continue;
} }
} }
if (delete_all) ME_SetDefaultParaFormat( editor, start_para->member.para.pFmt ); if (delete_all) ME_SetDefaultParaFormat( editor, &start_para->member.para.fmt );
return TRUE; return TRUE;
} }
@ -908,8 +908,8 @@ static ME_DisplayItem* ME_FindPixelPosInTableRow(int x, int y,
/* Return table row delimiter */ /* Return table row delimiter */
para = ME_FindItemFwd(cell, diParagraph); para = ME_FindItemFwd(cell, diParagraph);
assert(para->member.para.nFlags & MEPF_ROWEND); assert(para->member.para.nFlags & MEPF_ROWEND);
assert(para->member.para.pFmt->dwMask & PFM_TABLEROWDELIMITER); assert(para->member.para.fmt.dwMask & PFM_TABLEROWDELIMITER);
assert(para->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER); assert(para->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER);
return para; return para;
} }

View File

@ -902,7 +902,7 @@ void ME_RTFTblAttrHook(RTF_Info *info)
/* Tab stops were used to store cell positions before v4.1 but v4.1 /* Tab stops were used to store cell positions before v4.1 but v4.1
* still seems to set the tabstops without using them. */ * still seems to set the tabstops without using them. */
ME_DisplayItem *para = info->editor->pCursors[0].pPara; ME_DisplayItem *para = info->editor->pCursors[0].pPara;
PARAFORMAT2 *pFmt = para->member.para.pFmt; PARAFORMAT2 *pFmt = &para->member.para.fmt;
pFmt->rgxTabs[cellNum] &= ~0x00FFFFFF; pFmt->rgxTabs[cellNum] &= ~0x00FFFFFF;
pFmt->rgxTabs[cellNum] |= 0x00FFFFFF & info->rtfParam; pFmt->rgxTabs[cellNum] |= 0x00FFFFFF & info->rtfParam;
} }
@ -973,7 +973,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
} }
} else { /* v1.0 - v3.0 */ } else { /* v1.0 - v3.0 */
ME_DisplayItem *para = info->editor->pCursors[0].pPara; ME_DisplayItem *para = info->editor->pCursors[0].pPara;
PARAFORMAT2 *pFmt = para->member.para.pFmt; PARAFORMAT2 *pFmt = &para->member.para.fmt;
if (pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE && if (pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE &&
tableDef->numCellsInserted < tableDef->numCellsDefined) tableDef->numCellsInserted < tableDef->numCellsDefined)
{ {
@ -1059,8 +1059,8 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
} }
para = ME_InsertTableRowEndFromCursor(info->editor); para = ME_InsertTableRowEndFromCursor(info->editor);
para->member.para.pFmt->dxOffset = abs(info->tableDef->gapH); para->member.para.fmt.dxOffset = abs(info->tableDef->gapH);
para->member.para.pFmt->dxStartIndent = info->tableDef->leftEdge; para->member.para.fmt.dxStartIndent = info->tableDef->leftEdge;
ME_ApplyBorderProperties(info, &para->member.para.border, ME_ApplyBorderProperties(info, &para->member.para.border,
tableDef->border); tableDef->border);
info->nestingLevel--; info->nestingLevel--;
@ -1082,7 +1082,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
} else { /* v1.0 - v3.0 */ } else { /* v1.0 - v3.0 */
WCHAR endl = '\r'; WCHAR endl = '\r';
ME_DisplayItem *para = info->editor->pCursors[0].pPara; ME_DisplayItem *para = info->editor->pCursors[0].pPara;
PARAFORMAT2 *pFmt = para->member.para.pFmt; PARAFORMAT2 *pFmt = &para->member.para.fmt;
pFmt->dxOffset = info->tableDef->gapH; pFmt->dxOffset = info->tableDef->gapH;
pFmt->dxStartIndent = info->tableDef->leftEdge; pFmt->dxStartIndent = info->tableDef->leftEdge;
@ -1109,7 +1109,7 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
PARAFORMAT2 *pFmt; PARAFORMAT2 *pFmt;
RTFFlushOutputBuffer(info); RTFFlushOutputBuffer(info);
para = info->editor->pCursors[0].pPara; para = info->editor->pCursors[0].pPara;
pFmt = para->member.para.pFmt; pFmt = &para->member.para.fmt;
if (pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) if (pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)
{ {
/* rtfPar is treated like a space within a table. */ /* rtfPar is treated like a space within a table. */
@ -1526,7 +1526,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
ME_GetTextLength(editor), FALSE); ME_GetTextLength(editor), FALSE);
from = to = 0; from = to = 0;
ME_ClearTempStyle(editor); ME_ClearTempStyle(editor);
ME_SetDefaultParaFormat(editor, editor->pCursors[0].pPara->member.para.pFmt); ME_SetDefaultParaFormat(editor, &editor->pCursors[0].pPara->member.para.fmt);
} }
@ -2333,7 +2333,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
ME_InsertTextFromCursor(editor, 0, &endl, 1, ME_InsertTextFromCursor(editor, 0, &endl, 1,
editor->pCursors[0].pRun->member.run.style); editor->pCursors[0].pRun->member.run.style);
para = editor->pBuffer->pFirst->member.para.next_para; para = editor->pBuffer->pFirst->member.para.next_para;
ME_SetDefaultParaFormat(editor, para->member.para.pFmt); ME_SetDefaultParaFormat(editor, &para->member.para.fmt);
para->member.para.nFlags = MEPF_REWRAP; para->member.para.nFlags = MEPF_REWRAP;
editor->pCursors[0].pPara = para; editor->pCursors[0].pPara = para;
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);

View File

@ -189,7 +189,7 @@ typedef struct tagME_BorderRect
typedef struct tagME_Paragraph typedef struct tagME_Paragraph
{ {
PARAFORMAT2 *pFmt; PARAFORMAT2 fmt;
ME_String *text; ME_String *text;
struct tagME_DisplayItem *pCell; /* v4.1 */ struct tagME_DisplayItem *pCell; /* v4.1 */

View File

@ -163,7 +163,6 @@ void ME_DestroyDisplayItem(ME_DisplayItem *item)
TRACE("type=%s\n", ME_GetDITypeName(item->type)); TRACE("type=%s\n", ME_GetDITypeName(item->type));
if (item->type==diParagraph) if (item->type==diParagraph)
{ {
FREE_OBJ(item->member.para.pFmt);
ME_DestroyString(item->member.para.text); ME_DestroyString(item->member.para.text);
} }

View File

@ -553,16 +553,16 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
BOOL hasParaBorder; BOOL hasParaBorder;
SetRectEmpty(bounds); SetRectEmpty(bounds);
if (!(para->pFmt->dwMask & (PFM_BORDER | PFM_SPACEBEFORE | PFM_SPACEAFTER))) return; if (!(para->fmt.dwMask & (PFM_BORDER | PFM_SPACEBEFORE | PFM_SPACEAFTER))) return;
border_width = top_border = bottom_border = 0; border_width = top_border = bottom_border = 0;
idx = (para->pFmt->wBorders >> 8) & 0xF; idx = (para->fmt.wBorders >> 8) & 0xF;
hasParaBorder = (!(c->editor->bEmulateVersion10 && hasParaBorder = (!(c->editor->bEmulateVersion10 &&
para->pFmt->dwMask & PFM_TABLE && para->fmt.dwMask & PFM_TABLE &&
para->pFmt->wEffects & PFE_TABLE) && para->fmt.wEffects & PFE_TABLE) &&
(para->pFmt->dwMask & PFM_BORDER) && (para->fmt.dwMask & PFM_BORDER) &&
idx != 0 && idx != 0 &&
(para->pFmt->wBorders & 0xF)); (para->fmt.wBorders & 0xF));
if (hasParaBorder) if (hasParaBorder)
{ {
/* FIXME: wBorders is not stored as MSDN says in v1.0 - 4.1 of richedit /* FIXME: wBorders is not stored as MSDN says in v1.0 - 4.1 of richedit
@ -589,29 +589,29 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
* 0x0F00 bottom right * 0x0F00 bottom right
* 0xF000 right bottom * 0xF000 right bottom
*/ */
if (para->pFmt->wBorders & 0x00B0) if (para->fmt.wBorders & 0x00B0)
FIXME("Unsupported border flags %x\n", para->pFmt->wBorders); FIXME("Unsupported border flags %x\n", para->fmt.wBorders);
border_width = ME_GetParaBorderWidth(c, para->pFmt->wBorders); border_width = ME_GetParaBorderWidth(c, para->fmt.wBorders);
if (para->pFmt->wBorders & 4) top_border = border_width; if (para->fmt.wBorders & 4) top_border = border_width;
if (para->pFmt->wBorders & 8) bottom_border = border_width; if (para->fmt.wBorders & 8) bottom_border = border_width;
} }
if (para->pFmt->dwMask & PFM_SPACEBEFORE) if (para->fmt.dwMask & PFM_SPACEBEFORE)
{ {
rc.left = c->rcView.left; rc.left = c->rcView.left;
rc.right = c->rcView.right; rc.right = c->rcView.right;
rc.top = y; rc.top = y;
bounds->top = ME_twips2pointsY(c, para->pFmt->dySpaceBefore); bounds->top = ME_twips2pointsY(c, para->fmt.dySpaceBefore);
rc.bottom = y + bounds->top + top_border; rc.bottom = y + bounds->top + top_border;
FillRect(c->hDC, &rc, c->editor->hbrBackground); FillRect(c->hDC, &rc, c->editor->hbrBackground);
} }
if (para->pFmt->dwMask & PFM_SPACEAFTER) if (para->fmt.dwMask & PFM_SPACEAFTER)
{ {
rc.left = c->rcView.left; rc.left = c->rcView.left;
rc.right = c->rcView.right; rc.right = c->rcView.right;
rc.bottom = y + para->nHeight; rc.bottom = y + para->nHeight;
bounds->bottom = ME_twips2pointsY(c, para->pFmt->dySpaceAfter); bounds->bottom = ME_twips2pointsY(c, para->fmt.dySpaceAfter);
rc.top = rc.bottom - bounds->bottom - bottom_border; rc.top = rc.bottom - bounds->bottom - bottom_border;
FillRect(c->hDC, &rc, c->editor->hbrBackground); FillRect(c->hDC, &rc, c->editor->hbrBackground);
} }
@ -624,11 +624,11 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
HPEN pen = NULL, oldpen = NULL; HPEN pen = NULL, oldpen = NULL;
POINT pt; POINT pt;
if (para->pFmt->wBorders & 64) /* autocolor */ if (para->fmt.wBorders & 64) /* autocolor */
pencr = ITextHost_TxGetSysColor(c->editor->texthost, pencr = ITextHost_TxGetSysColor(c->editor->texthost,
COLOR_WINDOWTEXT); COLOR_WINDOWTEXT);
else else
pencr = pen_colors[(para->pFmt->wBorders >> 12) & 0xF]; pencr = pen_colors[(para->fmt.wBorders >> 12) & 0xF];
rightEdge = c->pt.x + max(c->editor->sizeWindow.cx, rightEdge = c->pt.x + max(c->editor->sizeWindow.cx,
c->editor->nTotalWidth); c->editor->nTotalWidth);
@ -641,9 +641,9 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
/* before & after spaces are not included in border */ /* before & after spaces are not included in border */
/* helper to draw the double lines in case of corner */ /* helper to draw the double lines in case of corner */
#define DD(x) ((para->pFmt->wBorders & (x)) ? (pen_width + 1) : 0) #define DD(x) ((para->fmt.wBorders & (x)) ? (pen_width + 1) : 0)
if (para->pFmt->wBorders & 1) if (para->fmt.wBorders & 1)
{ {
MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL); MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL);
LineTo(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom); LineTo(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom);
@ -658,7 +658,7 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
} }
bounds->left += border_width; bounds->left += border_width;
} }
if (para->pFmt->wBorders & 2) if (para->fmt.wBorders & 2)
{ {
MoveToEx(c->hDC, rightEdge - 1, y + bounds->top, NULL); MoveToEx(c->hDC, rightEdge - 1, y + bounds->top, NULL);
LineTo(c->hDC, rightEdge - 1, y + para->nHeight - bounds->bottom); LineTo(c->hDC, rightEdge - 1, y + para->nHeight - bounds->bottom);
@ -673,7 +673,7 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
} }
bounds->right += border_width; bounds->right += border_width;
} }
if (para->pFmt->wBorders & 4) if (para->fmt.wBorders & 4)
{ {
MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL); MoveToEx(c->hDC, c->pt.x, y + bounds->top, NULL);
LineTo(c->hDC, rightEdge, y + bounds->top); LineTo(c->hDC, rightEdge, y + bounds->top);
@ -683,7 +683,7 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
} }
bounds->top += border_width; bounds->top += border_width;
} }
if (para->pFmt->wBorders & 8) if (para->fmt.wBorders & 8)
{ {
MoveToEx(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom - 1, NULL); MoveToEx(c->hDC, c->pt.x, y + para->nHeight - bounds->bottom - 1, NULL);
LineTo(c->hDC, rightEdge, y + para->nHeight - bounds->bottom - 1); LineTo(c->hDC, rightEdge, y + para->nHeight - bounds->bottom - 1);
@ -841,7 +841,7 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
} }
} else { /* v1.0 - 3.0 */ } else { /* v1.0 - 3.0 */
/* Draw simple table border */ /* Draw simple table border */
if (para->pFmt->dwMask & PFM_TABLE && para->pFmt->wEffects & PFE_TABLE) { if (para->fmt.dwMask & PFM_TABLE && para->fmt.wEffects & PFE_TABLE) {
HPEN pen = NULL, oldpen = NULL; HPEN pen = NULL, oldpen = NULL;
int i, firstX, startX, endX, rowY, rowBottom, nHeight; int i, firstX, startX, endX, rowY, rowBottom, nHeight;
POINT oldPt; POINT oldPt;
@ -853,21 +853,21 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
/* Find the start relative to the text */ /* Find the start relative to the text */
firstX = c->pt.x + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x; firstX = c->pt.x + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x;
/* Go back by the horizontal gap, which is stored in dxOffset */ /* Go back by the horizontal gap, which is stored in dxOffset */
firstX -= ME_twips2pointsX(c, para->pFmt->dxOffset); firstX -= ME_twips2pointsX(c, para->fmt.dxOffset);
/* The left edge, stored in dxStartIndent affected just the first edge */ /* The left edge, stored in dxStartIndent affected just the first edge */
startX = firstX - ME_twips2pointsX(c, para->pFmt->dxStartIndent); startX = firstX - ME_twips2pointsX(c, para->fmt.dxStartIndent);
rowY = c->pt.y + para->pt.y; rowY = c->pt.y + para->pt.y;
if (para->pFmt->dwMask & PFM_SPACEBEFORE) if (para->fmt.dwMask & PFM_SPACEBEFORE)
rowY += ME_twips2pointsY(c, para->pFmt->dySpaceBefore); rowY += ME_twips2pointsY(c, para->fmt.dySpaceBefore);
nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight; nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight;
rowBottom = rowY + nHeight; rowBottom = rowY + nHeight;
/* Draw horizontal lines */ /* Draw horizontal lines */
MoveToEx(c->hDC, firstX, rowY, &oldPt); MoveToEx(c->hDC, firstX, rowY, &oldPt);
i = para->pFmt->cTabCount - 1; i = para->fmt.cTabCount - 1;
endX = startX + ME_twips2pointsX(c, para->pFmt->rgxTabs[i] & 0x00ffffff) + 1; endX = startX + ME_twips2pointsX(c, para->fmt.rgxTabs[i] & 0x00ffffff) + 1;
LineTo(c->hDC, endX, rowY); LineTo(c->hDC, endX, rowY);
pNextFmt = para->next_para->member.para.pFmt; pNextFmt = &para->next_para->member.para.fmt;
/* The bottom of the row only needs to be drawn if the next row is /* The bottom of the row only needs to be drawn if the next row is
* not a table. */ * not a table. */
if (!(pNextFmt && pNextFmt->dwMask & PFM_TABLE && pNextFmt->wEffects && if (!(pNextFmt && pNextFmt->dwMask & PFM_TABLE && pNextFmt->wEffects &&
@ -883,9 +883,9 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph)
/* Draw vertical lines */ /* Draw vertical lines */
MoveToEx(c->hDC, firstX, rowY, NULL); MoveToEx(c->hDC, firstX, rowY, NULL);
LineTo(c->hDC, firstX, rowBottom); LineTo(c->hDC, firstX, rowBottom);
for (i = 0; i < para->pFmt->cTabCount; i++) for (i = 0; i < para->fmt.cTabCount; i++)
{ {
int rightBoundary = para->pFmt->rgxTabs[i] & 0x00ffffff; int rightBoundary = para->fmt.rgxTabs[i] & 0x00ffffff;
endX = startX + ME_twips2pointsX(c, rightBoundary); endX = startX + ME_twips2pointsX(c, rightBoundary);
MoveToEx(c->hDC, endX, rowY, NULL); MoveToEx(c->hDC, endX, rowY, NULL);
LineTo(c->hDC, endX, rowBottom); LineTo(c->hDC, endX, rowBottom);

View File

@ -27,8 +27,7 @@ static ME_DisplayItem *make_para(ME_TextEditor *editor)
{ {
ME_DisplayItem *item = ME_MakeDI(diParagraph); ME_DisplayItem *item = ME_MakeDI(diParagraph);
item->member.para.pFmt = ALLOC_OBJ(PARAFORMAT2); ME_SetDefaultParaFormat(editor, &item->member.para.fmt);
ME_SetDefaultParaFormat(editor, item->member.para.pFmt);
item->member.para.nFlags = MEPF_REWRAP; item->member.para.nFlags = MEPF_REWRAP;
return item; return item;
} }
@ -110,21 +109,21 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor)
static void ME_UpdateTableFlags(ME_DisplayItem *para) static void ME_UpdateTableFlags(ME_DisplayItem *para)
{ {
para->member.para.pFmt->dwMask |= PFM_TABLE|PFM_TABLEROWDELIMITER; para->member.para.fmt.dwMask |= PFM_TABLE|PFM_TABLEROWDELIMITER;
if (para->member.para.pCell) { if (para->member.para.pCell) {
para->member.para.nFlags |= MEPF_CELL; para->member.para.nFlags |= MEPF_CELL;
} else { } else {
para->member.para.nFlags &= ~MEPF_CELL; para->member.para.nFlags &= ~MEPF_CELL;
} }
if (para->member.para.nFlags & MEPF_ROWEND) { if (para->member.para.nFlags & MEPF_ROWEND) {
para->member.para.pFmt->wEffects |= PFE_TABLEROWDELIMITER; para->member.para.fmt.wEffects |= PFE_TABLEROWDELIMITER;
} else { } else {
para->member.para.pFmt->wEffects &= ~PFE_TABLEROWDELIMITER; para->member.para.fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
} }
if (para->member.para.nFlags & (MEPF_ROWSTART|MEPF_CELL|MEPF_ROWEND)) if (para->member.para.nFlags & (MEPF_ROWSTART|MEPF_CELL|MEPF_ROWEND))
para->member.para.pFmt->wEffects |= PFE_TABLE; para->member.para.fmt.wEffects |= PFE_TABLE;
else else
para->member.para.pFmt->wEffects &= ~PFE_TABLE; para->member.para.fmt.wEffects &= ~PFE_TABLE;
} }
static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *pFmt) static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *pFmt)
@ -132,7 +131,7 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
PARAFORMAT2 copy; PARAFORMAT2 copy;
DWORD dwMask; DWORD dwMask;
assert(para->pFmt->cbSize == sizeof(PARAFORMAT2)); assert(para->fmt.cbSize == sizeof(PARAFORMAT2));
dwMask = pFmt->dwMask; dwMask = pFmt->dwMask;
if (pFmt->cbSize < sizeof(PARAFORMAT)) if (pFmt->cbSize < sizeof(PARAFORMAT))
return FALSE; return FALSE;
@ -143,25 +142,25 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
add_undo_set_para_fmt( editor, para ); add_undo_set_para_fmt( editor, para );
copy = *para->pFmt; copy = para->fmt;
#define COPY_FIELD(m, f) \ #define COPY_FIELD(m, f) \
if (dwMask & (m)) { \ if (dwMask & (m)) { \
para->pFmt->dwMask |= m; \ para->fmt.dwMask |= m; \
para->pFmt->f = pFmt->f; \ para->fmt.f = pFmt->f; \
} }
COPY_FIELD(PFM_NUMBERING, wNumbering); COPY_FIELD(PFM_NUMBERING, wNumbering);
COPY_FIELD(PFM_STARTINDENT, dxStartIndent); COPY_FIELD(PFM_STARTINDENT, dxStartIndent);
if (dwMask & PFM_OFFSETINDENT) if (dwMask & PFM_OFFSETINDENT)
para->pFmt->dxStartIndent += pFmt->dxStartIndent; para->fmt.dxStartIndent += pFmt->dxStartIndent;
COPY_FIELD(PFM_RIGHTINDENT, dxRightIndent); COPY_FIELD(PFM_RIGHTINDENT, dxRightIndent);
COPY_FIELD(PFM_OFFSET, dxOffset); COPY_FIELD(PFM_OFFSET, dxOffset);
COPY_FIELD(PFM_ALIGNMENT, wAlignment); COPY_FIELD(PFM_ALIGNMENT, wAlignment);
if (dwMask & PFM_TABSTOPS) if (dwMask & PFM_TABSTOPS)
{ {
para->pFmt->cTabCount = pFmt->cTabCount; para->fmt.cTabCount = pFmt->cTabCount;
memcpy(para->pFmt->rgxTabs, pFmt->rgxTabs, pFmt->cTabCount*sizeof(LONG)); memcpy(para->fmt.rgxTabs, pFmt->rgxTabs, pFmt->cTabCount*sizeof(LONG));
} }
#define EFFECTS_MASK (PFM_RTLPARA|PFM_KEEP|PFM_KEEPNEXT|PFM_PAGEBREAKBEFORE| \ #define EFFECTS_MASK (PFM_RTLPARA|PFM_KEEP|PFM_KEEPNEXT|PFM_PAGEBREAKBEFORE| \
@ -170,9 +169,9 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */ /* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
if (dwMask & EFFECTS_MASK) if (dwMask & EFFECTS_MASK)
{ {
para->pFmt->dwMask |= dwMask & EFFECTS_MASK; para->fmt.dwMask |= dwMask & EFFECTS_MASK;
para->pFmt->wEffects &= ~HIWORD(dwMask); para->fmt.wEffects &= ~HIWORD(dwMask);
para->pFmt->wEffects |= pFmt->wEffects & HIWORD(dwMask); para->fmt.wEffects |= pFmt->wEffects & HIWORD(dwMask);
} }
#undef EFFECTS_MASK #undef EFFECTS_MASK
@ -190,10 +189,10 @@ static BOOL ME_SetParaFormat(ME_TextEditor *editor, ME_Paragraph *para, const PA
COPY_FIELD(PFM_BORDER, wBorderWidth); COPY_FIELD(PFM_BORDER, wBorderWidth);
COPY_FIELD(PFM_BORDER, wBorders); COPY_FIELD(PFM_BORDER, wBorders);
para->pFmt->dwMask |= dwMask; para->fmt.dwMask |= dwMask;
#undef COPY_FIELD #undef COPY_FIELD
if (memcmp(&copy, para->pFmt, sizeof(PARAFORMAT2))) if (memcmp(&copy, &para->fmt, sizeof(PARAFORMAT2)))
para->nFlags |= MEPF_REWRAP; para->nFlags |= MEPF_REWRAP;
return TRUE; return TRUE;
@ -225,7 +224,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
} }
assert(run->type == diRun); assert(run->type == diRun);
run_para = ME_GetParagraph(run); run_para = ME_GetParagraph(run);
assert(run_para->member.para.pFmt->cbSize == sizeof(PARAFORMAT2)); assert(run_para->member.para.fmt.cbSize == sizeof(PARAFORMAT2));
new_para->member.para.text = ME_VSplitString( run_para->member.para.text, run->member.run.nCharOfs ); new_para->member.para.text = ME_VSplitString( run_para->member.para.text, run->member.run.nCharOfs );
@ -260,7 +259,7 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
new_para->member.para.nFlags = MEPF_REWRAP; new_para->member.para.nFlags = MEPF_REWRAP;
/* 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.fmt = run_para->member.para.fmt;
new_para->member.para.border = run_para->member.para.border; new_para->member.para.border = run_para->member.para.border;
/* insert paragraph into paragraph double linked list */ /* insert paragraph into paragraph double linked list */
@ -399,7 +398,7 @@ ME_DisplayItem *ME_JoinParagraphs(ME_TextEditor *editor, ME_DisplayItem *tp,
if (!keepFirstParaFormat) if (!keepFirstParaFormat)
{ {
add_undo_set_para_fmt( editor, &tp->member.para ); add_undo_set_para_fmt( editor, &tp->member.para );
*tp->member.para.pFmt = *pNext->member.para.pFmt; tp->member.para.fmt = pNext->member.para.fmt;
tp->member.para.border = pNext->member.para.border; tp->member.para.border = pNext->member.para.border;
} }
@ -566,9 +565,9 @@ static void ME_GetParaFormat(ME_TextEditor *editor,
{ {
UINT cbSize = pFmt->cbSize; UINT cbSize = pFmt->cbSize;
if (pFmt->cbSize >= sizeof(PARAFORMAT2)) { if (pFmt->cbSize >= sizeof(PARAFORMAT2)) {
*pFmt = *para->member.para.pFmt; *pFmt = para->member.para.fmt;
} else { } else {
CopyMemory(pFmt, para->member.para.pFmt, pFmt->cbSize); CopyMemory(pFmt, &para->member.para.fmt, pFmt->cbSize);
pFmt->dwMask &= PFM_ALL; pFmt->dwMask &= PFM_ALL;
} }
pFmt->cbSize = cbSize; pFmt->cbSize = cbSize;
@ -592,7 +591,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
while (para != para_end) while (para != para_end)
{ {
para = para->member.para.next_para; para = para->member.para.next_para;
curFmt = para->member.para.pFmt; curFmt = &para->member.para.fmt;
#define CHECK_FIELD(m, f) \ #define CHECK_FIELD(m, f) \
if (pFmt->f != curFmt->f) pFmt->dwMask &= ~(m); if (pFmt->f != curFmt->f) pFmt->dwMask &= ~(m);
@ -603,7 +602,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
CHECK_FIELD(PFM_OFFSET, dxOffset); CHECK_FIELD(PFM_OFFSET, dxOffset);
CHECK_FIELD(PFM_ALIGNMENT, wAlignment); CHECK_FIELD(PFM_ALIGNMENT, wAlignment);
if (pFmt->dwMask & PFM_TABSTOPS) { if (pFmt->dwMask & PFM_TABSTOPS) {
if (pFmt->cTabCount != para->member.para.pFmt->cTabCount || if (pFmt->cTabCount != para->member.para.fmt.cTabCount ||
memcmp(pFmt->rgxTabs, curFmt->rgxTabs, curFmt->cTabCount*sizeof(int))) memcmp(pFmt->rgxTabs, curFmt->rgxTabs, curFmt->cTabCount*sizeof(int)))
pFmt->dwMask &= ~PFM_TABSTOPS; pFmt->dwMask &= ~PFM_TABSTOPS;
} }

View File

@ -642,7 +642,7 @@ SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, i
if (run->nFlags & MERF_TAB) if (run->nFlags & MERF_TAB)
{ {
int pos = 0, i = 0, ppos, shift = 0; int pos = 0, i = 0, ppos, shift = 0;
PARAFORMAT2 *pFmt = para->pFmt; const PARAFORMAT2 *pFmt = &para->fmt;
if (c->editor->bEmulateVersion10 && /* v1.0 - 3.0 */ if (c->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE)

View File

@ -105,9 +105,9 @@ ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
para->member.para.pCell = prev_para->member.para.pCell; para->member.para.pCell = prev_para->member.para.pCell;
para->member.para.nFlags |= MEPF_CELL; para->member.para.nFlags |= MEPF_CELL;
para->member.para.nFlags &= ~(MEPF_ROWSTART|MEPF_ROWEND); para->member.para.nFlags &= ~(MEPF_ROWSTART|MEPF_ROWEND);
para->member.para.pFmt->dwMask |= PFM_TABLE|PFM_TABLEROWDELIMITER; para->member.para.fmt.dwMask |= PFM_TABLE|PFM_TABLEROWDELIMITER;
para->member.para.pFmt->wEffects |= PFE_TABLE; para->member.para.fmt.wEffects |= PFE_TABLE;
para->member.para.pFmt->wEffects &= ~PFE_TABLEROWDELIMITER; para->member.para.fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
prev_para = para; prev_para = para;
para = para->member.para.next_para; para = para->member.para.next_para;
} }
@ -205,12 +205,12 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor)
{ {
while (p->type == diParagraph) while (p->type == diParagraph)
{ {
assert(p->member.para.pFmt->dwMask & PFM_TABLE); assert(p->member.para.fmt.dwMask & PFM_TABLE);
assert(p->member.para.pFmt->dwMask & PFM_TABLEROWDELIMITER); assert(p->member.para.fmt.dwMask & PFM_TABLEROWDELIMITER);
if (p->member.para.pCell) if (p->member.para.pCell)
{ {
assert(p->member.para.nFlags & MEPF_CELL); assert(p->member.para.nFlags & MEPF_CELL);
assert(p->member.para.pFmt->wEffects & PFE_TABLE); assert(p->member.para.fmt.wEffects & PFE_TABLE);
} }
if (p->member.para.pCell != pPrev->member.para.pCell) if (p->member.para.pCell != pPrev->member.para.pCell)
{ {
@ -225,11 +225,11 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor)
assert(pPrev->member.para.pCell); assert(pPrev->member.para.pCell);
assert(p->member.para.pCell assert(p->member.para.pCell
== pPrev->member.para.pCell->member.cell.parent_cell); == pPrev->member.para.pCell->member.cell.parent_cell);
assert(p->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER); assert(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER);
} }
else if (p->member.para.pCell) else if (p->member.para.pCell)
{ {
assert(!(p->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER)); assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
assert(pPrev->member.para.pCell || assert(pPrev->member.para.pCell ||
pPrev->member.para.nFlags & MEPF_ROWSTART); pPrev->member.para.nFlags & MEPF_ROWSTART);
if (pPrev->member.para.pCell && if (pPrev->member.para.pCell &&
@ -244,7 +244,7 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor)
} }
else if (!(p->member.para.nFlags & MEPF_ROWSTART)) else if (!(p->member.para.nFlags & MEPF_ROWSTART))
{ {
assert(!(p->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER)); assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
/* ROWSTART must be followed by a cell. */ /* ROWSTART must be followed by a cell. */
assert(!(p->member.para.nFlags & MEPF_CELL)); assert(!(p->member.para.nFlags & MEPF_CELL));
/* ROWSTART must be followed by a cell. */ /* ROWSTART must be followed by a cell. */
@ -257,8 +257,8 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor)
while (p->type == diParagraph) while (p->type == diParagraph)
{ {
assert(!(p->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL))); assert(!(p->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)));
assert(p->member.para.pFmt->dwMask & PFM_TABLE); assert(p->member.para.fmt.dwMask & PFM_TABLE);
assert(!(p->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER)); assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
assert(!p->member.para.pCell); assert(!p->member.para.pCell);
p = p->member.para.next_para; p = p->member.para.next_para;
} }
@ -279,7 +279,7 @@ BOOL ME_IsInTable(ME_DisplayItem *pItem)
pItem = ME_GetParagraph(pItem); pItem = ME_GetParagraph(pItem);
if (pItem->type != diParagraph) if (pItem->type != diParagraph)
return FALSE; return FALSE;
pFmt = pItem->member.para.pFmt; pFmt = &pItem->member.para.fmt;
return pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE; return pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE;
} }
@ -364,8 +364,8 @@ void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nC
int nCharsToBoundary; int nCharsToBoundary;
if ((this_para->member.para.nCharOfs != nOfs || this_para == end_para) && if ((this_para->member.para.nCharOfs != nOfs || this_para == end_para) &&
this_para->member.para.pFmt->dwMask & PFM_TABLE && this_para->member.para.fmt.dwMask & PFM_TABLE &&
this_para->member.para.pFmt->wEffects & PFE_TABLE) this_para->member.para.fmt.wEffects & PFE_TABLE)
{ {
pRun = c->pRun; pRun = c->pRun;
/* Find the next tab or end paragraph to use as a delete boundary */ /* Find the next tab or end paragraph to use as a delete boundary */
@ -375,8 +375,8 @@ void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nC
- c->pRun->member.run.nCharOfs - c->pRun->member.run.nCharOfs
- c->nOffset; - c->nOffset;
*nChars = min(*nChars, nCharsToBoundary); *nChars = min(*nChars, nCharsToBoundary);
} else if (end_para->member.para.pFmt->dwMask & PFM_TABLE && } else if (end_para->member.para.fmt.dwMask & PFM_TABLE &&
end_para->member.para.pFmt->wEffects & PFE_TABLE) end_para->member.para.fmt.wEffects & PFE_TABLE)
{ {
/* The deletion starts from before the row, so don't join it with /* The deletion starts from before the row, so don't join it with
* previous non-empty paragraphs. */ * previous non-empty paragraphs. */
@ -438,12 +438,12 @@ ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor,
insertedCell->member.cell.border = cell->member.cell.border; insertedCell->member.cell.border = cell->member.cell.border;
}; };
para = ME_InsertTableRowEndFromCursor(editor); para = ME_InsertTableRowEndFromCursor(editor);
*para->member.para.pFmt = *prevTableEnd->member.para.pFmt; para->member.para.fmt = prevTableEnd->member.para.fmt;
/* return the table row start for the inserted paragraph */ /* return the table row start for the inserted paragraph */
return ME_FindItemFwd(cell, diParagraph)->member.para.next_para; return ME_FindItemFwd(cell, diParagraph)->member.para.next_para;
} else { /* v1.0 - 3.0 */ } else { /* v1.0 - 3.0 */
run = ME_FindItemBack(table_row->member.para.next_para, diRun); run = ME_FindItemBack(table_row->member.para.next_para, diRun);
pFmt = table_row->member.para.pFmt; pFmt = &table_row->member.para.fmt;
assert(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE); assert(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE);
editor->pCursors[0].pPara = table_row; editor->pCursors[0].pPara = table_row;
editor->pCursors[0].pRun = run; editor->pCursors[0].pRun = run;

View File

@ -155,7 +155,7 @@ BOOL add_undo_set_para_fmt( ME_TextEditor *editor, const ME_Paragraph *para )
if (!undo) return FALSE; if (!undo) return FALSE;
undo->u.set_para_fmt.pos = para->nCharOfs; undo->u.set_para_fmt.pos = para->nCharOfs;
undo->u.set_para_fmt.fmt = *para->pFmt; undo->u.set_para_fmt.fmt = para->fmt;
undo->u.set_para_fmt.border = para->border; undo->u.set_para_fmt.border = para->border;
return TRUE; return TRUE;
@ -189,7 +189,7 @@ BOOL add_undo_split_para( ME_TextEditor *editor, const ME_Paragraph *para, ME_St
undo->u.split_para.pos = para->nCharOfs - eol_str->nLen; undo->u.split_para.pos = para->nCharOfs - eol_str->nLen;
undo->u.split_para.eol_str = eol_str; undo->u.split_para.eol_str = eol_str;
undo->u.split_para.fmt = *para->pFmt; undo->u.split_para.fmt = para->fmt;
undo->u.split_para.border = para->border; undo->u.split_para.border = para->border;
undo->u.split_para.flags = para->prev_para->member.para.nFlags & ~MEPF_CELL; undo->u.split_para.flags = para->prev_para->member.para.nFlags & ~MEPF_CELL;
@ -339,7 +339,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
ME_CursorFromCharOfs(editor, undo->u.set_para_fmt.pos, &tmp); ME_CursorFromCharOfs(editor, undo->u.set_para_fmt.pos, &tmp);
para = ME_FindItemBack(tmp.pRun, diParagraph); para = ME_FindItemBack(tmp.pRun, diParagraph);
add_undo_set_para_fmt( editor, &para->member.para ); add_undo_set_para_fmt( editor, &para->member.para );
*para->member.para.pFmt = undo->u.set_para_fmt.fmt; para->member.para.fmt = undo->u.set_para_fmt.fmt;
para->member.para.border = undo->u.set_para_fmt.border; para->member.para.border = undo->u.set_para_fmt.border;
para->member.para.nFlags |= MEPF_REWRAP; para->member.para.nFlags |= MEPF_REWRAP;
break; break;
@ -398,7 +398,7 @@ static void ME_PlayUndoItem(ME_TextEditor *editor, struct undo_item *undo)
undo->u.split_para.eol_str->szData, undo->u.split_para.eol_str->nLen, paraFlags); undo->u.split_para.eol_str->szData, undo->u.split_para.eol_str->nLen, paraFlags);
if (bFixRowStart) if (bFixRowStart)
new_para->member.para.nFlags |= MEPF_ROWSTART; new_para->member.para.nFlags |= MEPF_ROWSTART;
*new_para->member.para.pFmt = undo->u.split_para.fmt; new_para->member.para.fmt = undo->u.split_para.fmt;
new_para->member.para.border = undo->u.split_para.border; new_para->member.para.border = undo->u.split_para.border;
if (paraFlags) if (paraFlags)
{ {

View File

@ -182,7 +182,7 @@ static void ME_BeginRow(ME_WrapContext *wc)
PARAFORMAT2 *pFmt; PARAFORMAT2 *pFmt;
ME_DisplayItem *para = wc->pPara; ME_DisplayItem *para = wc->pPara;
pFmt = para->member.para.pFmt; pFmt = &para->member.para.fmt;
wc->pRowStart = NULL; wc->pRowStart = NULL;
wc->bOverflown = FALSE; wc->bOverflown = FALSE;
wc->pLastSplittableRun = NULL; wc->pLastSplittableRun = NULL;
@ -204,7 +204,7 @@ static void ME_BeginRow(ME_WrapContext *wc)
width -= cell->prev_cell->member.cell.nRightBoundary; width -= cell->prev_cell->member.cell.nRightBoundary;
if (!cell->prev_cell) if (!cell->prev_cell)
{ {
int rowIndent = ME_GetTableRowEnd(para)->member.para.pFmt->dxStartIndent; int rowIndent = ME_GetTableRowEnd(para)->member.para.fmt.dxStartIndent;
width -= rowIndent; width -= rowIndent;
} }
cell->nWidth = max(ME_twips2pointsX(wc->context, width), 0); cell->nWidth = max(ME_twips2pointsX(wc->context, width), 0);
@ -326,7 +326,7 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
para->nWidth = max(para->nWidth, width); para->nWidth = max(para->nWidth, width);
row = ME_MakeRow(ascent+descent, ascent, width); row = ME_MakeRow(ascent+descent, ascent, width);
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */ if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
(para->pFmt->dwMask & PFM_TABLE) && (para->pFmt->wEffects & PFE_TABLE)) (para->fmt.dwMask & PFM_TABLE) && (para->fmt.wEffects & PFE_TABLE))
{ {
/* The text was shifted down in ME_BeginRow so move the wrap context /* The text was shifted down in ME_BeginRow so move the wrap context
* back to where it should be. */ * back to where it should be. */
@ -337,8 +337,8 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
row->member.row.pt = wc->pt; row->member.row.pt = wc->pt;
row->member.row.nLMargin = (!wc->nRow ? wc->nFirstMargin : wc->nLeftMargin); row->member.row.nLMargin = (!wc->nRow ? wc->nFirstMargin : wc->nLeftMargin);
row->member.row.nRMargin = wc->nRightMargin; row->member.row.nRMargin = wc->nRightMargin;
assert(para->pFmt->dwMask & PFM_ALIGNMENT); assert(para->fmt.dwMask & PFM_ALIGNMENT);
align = para->pFmt->wAlignment; align = para->fmt.wAlignment;
if (align == PFA_CENTER) if (align == PFA_CENTER)
shift = max((wc->nAvailWidth-width)/2, 0); shift = max((wc->nAvailWidth-width)/2, 0);
if (align == PFA_RIGHT) if (align == PFA_RIGHT)
@ -362,7 +362,7 @@ static void ME_InsertRowStart(ME_WrapContext *wc, const ME_DisplayItem *pEnd)
static void ME_WrapEndParagraph(ME_WrapContext *wc, ME_DisplayItem *p) static void ME_WrapEndParagraph(ME_WrapContext *wc, ME_DisplayItem *p)
{ {
ME_DisplayItem *para = wc->pPara; ME_DisplayItem *para = wc->pPara;
PARAFORMAT2 *pFmt = para->member.para.pFmt; PARAFORMAT2 *pFmt = &para->member.para.fmt;
if (wc->pRowStart) if (wc->pRowStart)
ME_InsertRowStart(wc, p); ME_InsertRowStart(wc, p);
if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */ if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */
@ -685,19 +685,19 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p)
static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para) static int ME_GetParaLineSpace(ME_Context* c, ME_Paragraph* para)
{ {
int sp = 0, ls = 0; int sp = 0, ls = 0;
if (!(para->pFmt->dwMask & PFM_LINESPACING)) return 0; if (!(para->fmt.dwMask & PFM_LINESPACING)) return 0;
/* FIXME: how to compute simply the line space in ls ??? */ /* FIXME: how to compute simply the line space in ls ??? */
/* FIXME: does line spacing include the line itself ??? */ /* FIXME: does line spacing include the line itself ??? */
switch (para->pFmt->bLineSpacingRule) switch (para->fmt.bLineSpacingRule)
{ {
case 0: sp = ls; break; case 0: sp = ls; break;
case 1: sp = (3 * ls) / 2; break; case 1: sp = (3 * ls) / 2; break;
case 2: sp = 2 * ls; break; case 2: sp = 2 * ls; break;
case 3: sp = ME_twips2pointsY(c, para->pFmt->dyLineSpacing); if (sp < ls) sp = ls; break; case 3: sp = ME_twips2pointsY(c, para->fmt.dyLineSpacing); if (sp < ls) sp = ls; break;
case 4: sp = ME_twips2pointsY(c, para->pFmt->dyLineSpacing); break; case 4: sp = ME_twips2pointsY(c, para->fmt.dyLineSpacing); break;
case 5: sp = para->pFmt->dyLineSpacing / 20; break; case 5: sp = para->fmt.dyLineSpacing / 20; break;
default: FIXME("Unsupported spacing rule value %d\n", para->pFmt->bLineSpacingRule); default: FIXME("Unsupported spacing rule value %d\n", para->fmt.bLineSpacingRule);
} }
if (c->editor->nZoomNumerator == 0) if (c->editor->nZoomNumerator == 0)
return sp; return sp;
@ -746,7 +746,7 @@ static HRESULT itemize_para( ME_Context *c, ME_DisplayItem *p )
assert( p->type == diParagraph ); assert( p->type == diParagraph );
if (para->pFmt->dwMask & PFM_RTLPARA && para->pFmt->wEffects & PFE_RTLPARA) if (para->fmt.dwMask & PFM_RTLPARA && para->fmt.wEffects & PFE_RTLPARA)
state.uBidiLevel = 1; state.uBidiLevel = 1;
TRACE( "Base embedding level %d\n", state.uBidiLevel ); TRACE( "Base embedding level %d\n", state.uBidiLevel );
@ -863,7 +863,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
shape_para( c, tp ); shape_para( c, tp );
} }
pFmt = tp->member.para.pFmt; pFmt = &tp->member.para.fmt;
wc.context = c; wc.context = c;
wc.pPara = tp; wc.pPara = tp;
@ -874,7 +874,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
} else { } else {
int dxStartIndent = pFmt->dxStartIndent; int dxStartIndent = pFmt->dxStartIndent;
if (tp->member.para.pCell) { if (tp->member.para.pCell) {
dxStartIndent += ME_GetTableRowEnd(tp)->member.para.pFmt->dxOffset; dxStartIndent += ME_GetTableRowEnd(tp)->member.para.fmt.dxOffset;
} }
wc.nFirstMargin = ME_twips2pointsX(c, dxStartIndent); wc.nFirstMargin = ME_twips2pointsX(c, dxStartIndent);
wc.nLeftMargin = wc.nFirstMargin + ME_twips2pointsX(c, pFmt->dxOffset); wc.nLeftMargin = wc.nFirstMargin + ME_twips2pointsX(c, pFmt->dxOffset);
@ -897,7 +897,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) && if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) &&
pFmt->dwMask & PFM_BORDER) pFmt->dwMask & PFM_BORDER)
{ {
border = ME_GetParaBorderWidth(c, tp->member.para.pFmt->wBorders); border = ME_GetParaBorderWidth(c, tp->member.para.fmt.wBorders);
if (pFmt->wBorders & 1) { if (pFmt->wBorders & 1) {
wc.nFirstMargin += border; wc.nFirstMargin += border;
wc.nLeftMargin += border; wc.nLeftMargin += border;
@ -924,7 +924,7 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) && if (!(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE) &&
(pFmt->dwMask & PFM_BORDER) && (pFmt->wBorders & 8)) (pFmt->dwMask & PFM_BORDER) && (pFmt->wBorders & 8))
wc.pt.y += border; wc.pt.y += border;
if (tp->member.para.pFmt->dwMask & PFM_SPACEAFTER) if (tp->member.para.fmt.dwMask & PFM_SPACEAFTER)
wc.pt.y += ME_twips2pointsY(c, pFmt->dySpaceAfter); wc.pt.y += ME_twips2pointsY(c, pFmt->dySpaceAfter);
tp->member.para.nFlags &= ~MEPF_REWRAP; tp->member.para.nFlags &= ~MEPF_REWRAP;
@ -987,9 +987,9 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
} }
c.pt.y += borderWidth; c.pt.y += borderWidth;
} }
if (endRowPara->member.para.pFmt->dxStartIndent > 0) if (endRowPara->member.para.fmt.dxStartIndent > 0)
{ {
int dxStartIndent = endRowPara->member.para.pFmt->dxStartIndent; int dxStartIndent = endRowPara->member.para.fmt.dxStartIndent;
cell = ME_FindItemFwd(item, diCell); cell = ME_FindItemFwd(item, diCell);
cell->member.cell.pt.x += ME_twips2pointsX(&c, dxStartIndent); cell->member.cell.pt.x += ME_twips2pointsX(&c, dxStartIndent);
c.pt.x = cell->member.cell.pt.x; c.pt.x = cell->member.cell.pt.x;

View File

@ -349,7 +349,7 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
if (!ME_StreamOutPrint(pStream, "\\trowd")) if (!ME_StreamOutPrint(pStream, "\\trowd"))
return FALSE; return FALSE;
if (!editor->bEmulateVersion10) { /* v4.1 */ if (!editor->bEmulateVersion10) { /* v4.1 */
PARAFORMAT2 *pFmt = ME_GetTableRowEnd(para)->member.para.pFmt; PARAFORMAT2 *pFmt = &ME_GetTableRowEnd(para)->member.para.fmt;
para = ME_GetTableRowStart(para); para = ME_GetTableRowStart(para);
cell = para->member.para.next_para->member.para.pCell; cell = para->member.para.next_para->member.para.pCell;
assert(cell); assert(cell);
@ -387,7 +387,7 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
&para->member.para.border.left, &para->member.para.border.left,
&para->member.para.border.bottom, &para->member.para.border.bottom,
&para->member.para.border.right }; &para->member.para.border.right };
PARAFORMAT2 *pFmt = para->member.para.pFmt; PARAFORMAT2 *pFmt = &para->member.para.fmt;
assert(!(para->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL))); assert(!(para->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)));
if (pFmt->dxOffset) if (pFmt->dxOffset)
@ -426,7 +426,7 @@ static BOOL
ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream, ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
ME_DisplayItem *para) ME_DisplayItem *para)
{ {
PARAFORMAT2 *fmt = para->member.para.pFmt; PARAFORMAT2 *fmt = &para->member.para.fmt;
char props[STREAMOUT_BUFFER_SIZE] = ""; char props[STREAMOUT_BUFFER_SIZE] = "";
int i; int i;
@ -454,8 +454,8 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
return TRUE; return TRUE;
} }
} else { /* v1.0 - 3.0 */ } else { /* v1.0 - 3.0 */
if (para->member.para.pFmt->dwMask & PFM_TABLE && if (para->member.para.fmt.dwMask & PFM_TABLE &&
para->member.para.pFmt->wEffects & PFE_TABLE) para->member.para.fmt.wEffects & PFE_TABLE)
{ {
if (!ME_StreamOutRTFTableProps(editor, pStream, para)) if (!ME_StreamOutRTFTableProps(editor, pStream, para))
return FALSE; return FALSE;
@ -929,8 +929,8 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
return FALSE; return FALSE;
} else if (cursor.pRun->member.run.nFlags & MERF_TAB) { } else if (cursor.pRun->member.run.nFlags & MERF_TAB) {
if (editor->bEmulateVersion10 && /* v1.0 - 3.0 */ if (editor->bEmulateVersion10 && /* v1.0 - 3.0 */
cursor.pPara->member.para.pFmt->dwMask & PFM_TABLE && cursor.pPara->member.para.fmt.dwMask & PFM_TABLE &&
cursor.pPara->member.para.pFmt->wEffects & PFE_TABLE) cursor.pPara->member.para.fmt.wEffects & PFE_TABLE)
{ {
if (!ME_StreamOutPrint(pStream, "\\cell ")) if (!ME_StreamOutPrint(pStream, "\\cell "))
return FALSE; return FALSE;
@ -948,8 +948,8 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
} }
nChars--; nChars--;
} else if (cursor.pRun->member.run.nFlags & MERF_ENDPARA) { } else if (cursor.pRun->member.run.nFlags & MERF_ENDPARA) {
if (cursor.pPara->member.para.pFmt->dwMask & PFM_TABLE && if (cursor.pPara->member.para.fmt.dwMask & PFM_TABLE &&
cursor.pPara->member.para.pFmt->wEffects & PFE_TABLE && cursor.pPara->member.para.fmt.wEffects & PFE_TABLE &&
!(cursor.pPara->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL))) !(cursor.pPara->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)))
{ {
if (!ME_StreamOutPrint(pStream, "\\row \r\n")) if (!ME_StreamOutPrint(pStream, "\\row \r\n"))