riched20: Return a para ptr from the insert start table row functions.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
fe70e7beb5
commit
caa1d4a480
|
@ -585,27 +585,29 @@ void ME_RTFParAttrHook(RTF_Info *info)
|
||||||
|
|
||||||
if (!info->editor->bEmulateVersion10) /* v4.1 */
|
if (!info->editor->bEmulateVersion10) /* v4.1 */
|
||||||
{
|
{
|
||||||
if (info->tableDef && info->tableDef->tableRowStart &&
|
if (info->tableDef && info->tableDef->row_start &&
|
||||||
info->tableDef->tableRowStart->member.para.nFlags & MEPF_ROWEND)
|
info->tableDef->row_start->nFlags & MEPF_ROWEND)
|
||||||
{
|
{
|
||||||
ME_Cursor cursor;
|
ME_Cursor cursor;
|
||||||
ME_DisplayItem *para;
|
ME_Paragraph *para;
|
||||||
/* We are just after a table row. */
|
/* We are just after a table row. */
|
||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
cursor = info->editor->pCursors[0];
|
cursor = info->editor->pCursors[0];
|
||||||
para = cursor.pPara;
|
para = &cursor.pPara->member.para;
|
||||||
if (para == info->tableDef->tableRowStart->member.para.next_para
|
if (para == para_next( info->tableDef->row_start )
|
||||||
&& !cursor.nOffset && !cursor.pRun->member.run.nCharOfs)
|
&& !cursor.nOffset && !cursor.pRun->member.run.nCharOfs)
|
||||||
{
|
{
|
||||||
/* Since the table row end, no text has been inserted, and the \intbl
|
/* Since the table row end, no text has been inserted, and the \intbl
|
||||||
* control word has not be used. We can confirm that we are not in a
|
* control word has not be used. We can confirm that we are not in a
|
||||||
* table anymore.
|
* table anymore.
|
||||||
*/
|
*/
|
||||||
info->tableDef->tableRowStart = NULL;
|
info->tableDef->row_start = NULL;
|
||||||
info->canInheritInTbl = FALSE;
|
info->canInheritInTbl = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { /* v1.0 - v3.0 */
|
}
|
||||||
|
else /* v1.0 - v3.0 */
|
||||||
|
{
|
||||||
info->fmt.dwMask |= PFM_TABLE;
|
info->fmt.dwMask |= PFM_TABLE;
|
||||||
info->fmt.wEffects &= ~PFE_TABLE;
|
info->fmt.wEffects &= ~PFE_TABLE;
|
||||||
}
|
}
|
||||||
|
@ -613,26 +615,26 @@ void ME_RTFParAttrHook(RTF_Info *info)
|
||||||
case rtfNestLevel:
|
case rtfNestLevel:
|
||||||
if (!info->editor->bEmulateVersion10) /* v4.1 */
|
if (!info->editor->bEmulateVersion10) /* v4.1 */
|
||||||
{
|
{
|
||||||
while (info->rtfParam > info->nestingLevel) {
|
while (info->rtfParam > info->nestingLevel)
|
||||||
|
{
|
||||||
RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
|
RTFTable *tableDef = heap_alloc_zero(sizeof(*tableDef));
|
||||||
tableDef->parent = info->tableDef;
|
tableDef->parent = info->tableDef;
|
||||||
info->tableDef = tableDef;
|
info->tableDef = tableDef;
|
||||||
|
|
||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
if (tableDef->tableRowStart &&
|
if (tableDef->row_start && tableDef->row_start->nFlags & MEPF_ROWEND)
|
||||||
tableDef->tableRowStart->member.para.nFlags & MEPF_ROWEND)
|
{
|
||||||
|
ME_Paragraph *para = para_next( tableDef->row_start );
|
||||||
|
tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ME_DisplayItem *para = tableDef->tableRowStart;
|
|
||||||
para = para->member.para.next_para;
|
|
||||||
para = ME_InsertTableRowStartAtParagraph(info->editor, para);
|
|
||||||
tableDef->tableRowStart = para;
|
|
||||||
} else {
|
|
||||||
ME_Cursor cursor;
|
ME_Cursor cursor;
|
||||||
WCHAR endl = '\r';
|
WCHAR endl = '\r';
|
||||||
cursor = info->editor->pCursors[0];
|
cursor = info->editor->pCursors[0];
|
||||||
if (cursor.nOffset || cursor.pRun->member.run.nCharOfs)
|
if (cursor.nOffset || cursor.pRun->member.run.nCharOfs)
|
||||||
ME_InsertTextFromCursor(info->editor, 0, &endl, 1, info->style);
|
ME_InsertTextFromCursor(info->editor, 0, &endl, 1, info->style);
|
||||||
tableDef->tableRowStart = ME_InsertTableRowStartFromCursor(info->editor);
|
tableDef->row_start = table_insert_row_start( info->editor, info->editor->pCursors );
|
||||||
}
|
}
|
||||||
|
|
||||||
info->nestingLevel++;
|
info->nestingLevel++;
|
||||||
|
@ -647,21 +649,19 @@ void ME_RTFParAttrHook(RTF_Info *info)
|
||||||
if (info->nestingLevel < 1)
|
if (info->nestingLevel < 1)
|
||||||
{
|
{
|
||||||
RTFTable *tableDef;
|
RTFTable *tableDef;
|
||||||
|
ME_Paragraph *para;
|
||||||
|
|
||||||
if (!info->tableDef)
|
if (!info->tableDef)
|
||||||
info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
|
info->tableDef = heap_alloc_zero(sizeof(*info->tableDef));
|
||||||
tableDef = info->tableDef;
|
tableDef = info->tableDef;
|
||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
if (tableDef->tableRowStart &&
|
if (tableDef->row_start && tableDef->row_start->nFlags & MEPF_ROWEND)
|
||||||
tableDef->tableRowStart->member.para.nFlags & MEPF_ROWEND)
|
para = para_next( tableDef->row_start );
|
||||||
{
|
|
||||||
ME_DisplayItem *para = tableDef->tableRowStart;
|
|
||||||
para = para->member.para.next_para;
|
|
||||||
para = ME_InsertTableRowStartAtParagraph(info->editor, para);
|
|
||||||
tableDef->tableRowStart = para;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
tableDef->tableRowStart = ME_InsertTableRowStartAtParagraph( info->editor,
|
para = &info->editor->pCursors[0].pPara->member.para;
|
||||||
info->editor->pCursors[0].pPara );
|
|
||||||
|
tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
|
||||||
|
|
||||||
info->nestingLevel = 1;
|
info->nestingLevel = 1;
|
||||||
info->canInheritInTbl = TRUE;
|
info->canInheritInTbl = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -956,25 +956,24 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
||||||
if (!tableDef)
|
if (!tableDef)
|
||||||
break;
|
break;
|
||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
if (!info->editor->bEmulateVersion10) { /* v4.1 */
|
if (!info->editor->bEmulateVersion10) /* v4.1 */
|
||||||
if (tableDef->tableRowStart)
|
{
|
||||||
|
if (tableDef->row_start)
|
||||||
{
|
{
|
||||||
if (!info->nestingLevel &&
|
if (!info->nestingLevel && tableDef->row_start->nFlags & MEPF_ROWEND)
|
||||||
tableDef->tableRowStart->member.para.nFlags & MEPF_ROWEND)
|
|
||||||
{
|
{
|
||||||
ME_DisplayItem *para = tableDef->tableRowStart;
|
ME_Paragraph *para = para_next( tableDef->row_start );
|
||||||
para = para->member.para.next_para;
|
tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
|
||||||
para = ME_InsertTableRowStartAtParagraph(info->editor, para);
|
|
||||||
tableDef->tableRowStart = para;
|
|
||||||
info->nestingLevel = 1;
|
info->nestingLevel = 1;
|
||||||
}
|
}
|
||||||
ME_InsertTableCellFromCursor(info->editor);
|
ME_InsertTableCellFromCursor(info->editor);
|
||||||
}
|
}
|
||||||
} else { /* v1.0 - v3.0 */
|
}
|
||||||
ME_DisplayItem *para = info->editor->pCursors[0].pPara;
|
else /* v1.0 - v3.0 */
|
||||||
PARAFORMAT2 *pFmt = ¶->member.para.fmt;
|
{
|
||||||
if (pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE &&
|
ME_Paragraph *para = &info->editor->pCursors[0].pPara->member.para;
|
||||||
tableDef->numCellsInserted < tableDef->numCellsDefined)
|
|
||||||
|
if (para_in_table( para ) && tableDef->numCellsInserted < tableDef->numCellsDefined)
|
||||||
{
|
{
|
||||||
WCHAR tab = '\t';
|
WCHAR tab = '\t';
|
||||||
ME_InsertTextFromCursor(info->editor, 0, &tab, 1, info->style);
|
ME_InsertTextFromCursor(info->editor, 0, &tab, 1, info->style);
|
||||||
|
@ -988,26 +987,24 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
||||||
/* else fall through since v4.1 treats rtfNestRow and rtfRow the same */
|
/* else fall through since v4.1 treats rtfNestRow and rtfRow the same */
|
||||||
case rtfRow:
|
case rtfRow:
|
||||||
{
|
{
|
||||||
ME_DisplayItem *para, *cell, *run;
|
ME_DisplayItem *cell, *run;
|
||||||
|
ME_Paragraph *para;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!tableDef)
|
if (!tableDef)
|
||||||
break;
|
break;
|
||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
if (!info->editor->bEmulateVersion10) { /* v4.1 */
|
if (!info->editor->bEmulateVersion10) /* v4.1 */
|
||||||
if (!tableDef->tableRowStart)
|
{
|
||||||
break;
|
if (!tableDef->row_start) break;
|
||||||
if (!info->nestingLevel &&
|
if (!info->nestingLevel && tableDef->row_start->nFlags & MEPF_ROWEND)
|
||||||
tableDef->tableRowStart->member.para.nFlags & MEPF_ROWEND)
|
|
||||||
{
|
{
|
||||||
para = tableDef->tableRowStart;
|
para = para_next( tableDef->row_start );
|
||||||
para = para->member.para.next_para;
|
tableDef->row_start = table_insert_row_start_at_para( info->editor, para );
|
||||||
para = ME_InsertTableRowStartAtParagraph(info->editor, para);
|
|
||||||
tableDef->tableRowStart = para;
|
|
||||||
info->nestingLevel++;
|
info->nestingLevel++;
|
||||||
}
|
}
|
||||||
para = tableDef->tableRowStart;
|
para = tableDef->row_start;
|
||||||
cell = ME_FindItemFwd(para, diCell);
|
cell = ME_FindItemFwd( para_get_di( para ), diCell );
|
||||||
assert(cell && !cell->member.cell.prev_cell);
|
assert(cell && !cell->member.cell.prev_cell);
|
||||||
if (tableDef->numCellsDefined < 1)
|
if (tableDef->numCellsDefined < 1)
|
||||||
{
|
{
|
||||||
|
@ -1021,10 +1018,12 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
||||||
nRightBoundary += defaultCellSize;
|
nRightBoundary += defaultCellSize;
|
||||||
cell->member.cell.nRightBoundary = nRightBoundary;
|
cell->member.cell.nRightBoundary = nRightBoundary;
|
||||||
}
|
}
|
||||||
para = ME_InsertTableCellFromCursor(info->editor);
|
para = &ME_InsertTableCellFromCursor(info->editor)->member.para;
|
||||||
cell = para->member.para.pCell;
|
cell = para->pCell;
|
||||||
cell->member.cell.nRightBoundary = nRightBoundary;
|
cell->member.cell.nRightBoundary = nRightBoundary;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (i = 0; i < tableDef->numCellsDefined; i++)
|
for (i = 0; i < tableDef->numCellsDefined; i++)
|
||||||
{
|
{
|
||||||
RTFCell *cellDef = &tableDef->cells[i];
|
RTFCell *cellDef = &tableDef->cells[i];
|
||||||
|
@ -1034,8 +1033,8 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
||||||
cell = cell->member.cell.next_cell;
|
cell = cell->member.cell.next_cell;
|
||||||
if (!cell)
|
if (!cell)
|
||||||
{
|
{
|
||||||
para = ME_InsertTableCellFromCursor(info->editor);
|
para = &ME_InsertTableCellFromCursor(info->editor)->member.para;
|
||||||
cell = para->member.para.pCell;
|
cell = para->pCell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Cell for table row delimiter is empty */
|
/* Cell for table row delimiter is empty */
|
||||||
|
@ -1057,45 +1056,47 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
||||||
nChars, TRUE);
|
nChars, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
para = ME_InsertTableRowEndFromCursor(info->editor);
|
para = &ME_InsertTableRowEndFromCursor(info->editor)->member.para;
|
||||||
para->member.para.fmt.dxOffset = abs(info->tableDef->gapH);
|
para->fmt.dxOffset = abs(info->tableDef->gapH);
|
||||||
para->member.para.fmt.dxStartIndent = info->tableDef->leftEdge;
|
para->fmt.dxStartIndent = info->tableDef->leftEdge;
|
||||||
ME_ApplyBorderProperties(info, ¶->member.para.border,
|
ME_ApplyBorderProperties( info, ¶->border, tableDef->border );
|
||||||
tableDef->border);
|
|
||||||
info->nestingLevel--;
|
info->nestingLevel--;
|
||||||
if (!info->nestingLevel)
|
if (!info->nestingLevel)
|
||||||
{
|
{
|
||||||
if (info->canInheritInTbl) {
|
if (info->canInheritInTbl) tableDef->row_start = para;
|
||||||
tableDef->tableRowStart = para;
|
else
|
||||||
} else {
|
{
|
||||||
while (info->tableDef) {
|
while (info->tableDef)
|
||||||
|
{
|
||||||
tableDef = info->tableDef;
|
tableDef = info->tableDef;
|
||||||
info->tableDef = tableDef->parent;
|
info->tableDef = tableDef->parent;
|
||||||
heap_free(tableDef);
|
heap_free(tableDef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
info->tableDef = tableDef->parent;
|
info->tableDef = tableDef->parent;
|
||||||
heap_free(tableDef);
|
heap_free(tableDef);
|
||||||
}
|
}
|
||||||
} else { /* v1.0 - v3.0 */
|
}
|
||||||
|
else /* v1.0 - v3.0 */
|
||||||
|
{
|
||||||
WCHAR endl = '\r';
|
WCHAR endl = '\r';
|
||||||
ME_DisplayItem *para = info->editor->pCursors[0].pPara;
|
|
||||||
PARAFORMAT2 *pFmt = ¶->member.para.fmt;
|
|
||||||
pFmt->dxOffset = info->tableDef->gapH;
|
|
||||||
pFmt->dxStartIndent = info->tableDef->leftEdge;
|
|
||||||
|
|
||||||
ME_ApplyBorderProperties(info, ¶->member.para.border,
|
para = &info->editor->pCursors[0].pPara->member.para;
|
||||||
tableDef->border);
|
para->fmt.dxOffset = info->tableDef->gapH;
|
||||||
|
para->fmt.dxStartIndent = info->tableDef->leftEdge;
|
||||||
|
|
||||||
|
ME_ApplyBorderProperties( info, ¶->border, tableDef->border );
|
||||||
while (tableDef->numCellsInserted < tableDef->numCellsDefined)
|
while (tableDef->numCellsInserted < tableDef->numCellsDefined)
|
||||||
{
|
{
|
||||||
WCHAR tab = '\t';
|
WCHAR tab = '\t';
|
||||||
ME_InsertTextFromCursor(info->editor, 0, &tab, 1, info->style);
|
ME_InsertTextFromCursor(info->editor, 0, &tab, 1, info->style);
|
||||||
tableDef->numCellsInserted++;
|
tableDef->numCellsInserted++;
|
||||||
}
|
}
|
||||||
pFmt->cTabCount = min(tableDef->numCellsDefined, MAX_TAB_STOPS);
|
para->fmt.cTabCount = min(tableDef->numCellsDefined, MAX_TAB_STOPS);
|
||||||
if (!tableDef->numCellsDefined)
|
if (!tableDef->numCellsDefined) para->fmt.wEffects &= ~PFE_TABLE;
|
||||||
pFmt->wEffects &= ~PFE_TABLE;
|
|
||||||
ME_InsertTextFromCursor(info->editor, 0, &endl, 1, info->style);
|
ME_InsertTextFromCursor(info->editor, 0, &endl, 1, info->style);
|
||||||
tableDef->numCellsInserted = 0;
|
tableDef->numCellsInserted = 0;
|
||||||
}
|
}
|
||||||
|
@ -1103,13 +1104,13 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
|
||||||
}
|
}
|
||||||
case rtfTab:
|
case rtfTab:
|
||||||
case rtfPar:
|
case rtfPar:
|
||||||
if (info->editor->bEmulateVersion10) { /* v1.0 - 3.0 */
|
if (info->editor->bEmulateVersion10) /* v1.0 - 3.0 */
|
||||||
ME_DisplayItem *para;
|
{
|
||||||
PARAFORMAT2 *pFmt;
|
ME_Paragraph *para;
|
||||||
|
|
||||||
RTFFlushOutputBuffer(info);
|
RTFFlushOutputBuffer(info);
|
||||||
para = info->editor->pCursors[0].pPara;
|
para = &info->editor->pCursors[0].pPara->member.para;
|
||||||
pFmt = ¶->member.para.fmt;
|
if (para_in_table( para ))
|
||||||
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. */
|
||||||
info->rtfClass = rtfText;
|
info->rtfClass = rtfText;
|
||||||
|
@ -1695,13 +1696,14 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
||||||
/* do the parsing */
|
/* do the parsing */
|
||||||
RTFRead(&parser);
|
RTFRead(&parser);
|
||||||
RTFFlushOutputBuffer(&parser);
|
RTFFlushOutputBuffer(&parser);
|
||||||
if (!editor->bEmulateVersion10) { /* v4.1 */
|
if (!editor->bEmulateVersion10) /* v4.1 */
|
||||||
if (parser.tableDef && parser.tableDef->tableRowStart &&
|
{
|
||||||
|
if (parser.tableDef && parser.tableDef->row_start &&
|
||||||
(parser.nestingLevel > 0 || parser.canInheritInTbl))
|
(parser.nestingLevel > 0 || parser.canInheritInTbl))
|
||||||
{
|
{
|
||||||
/* Delete any incomplete table row at the end of the rich text. */
|
/* Delete any incomplete table row at the end of the rich text. */
|
||||||
int nOfs, nChars;
|
int nOfs, nChars;
|
||||||
ME_DisplayItem *para;
|
ME_Paragraph *para;
|
||||||
|
|
||||||
parser.rtfMinor = rtfRow;
|
parser.rtfMinor = rtfRow;
|
||||||
/* Complete the table row before deleting it.
|
/* Complete the table row before deleting it.
|
||||||
|
@ -1712,23 +1714,24 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
|
||||||
{
|
{
|
||||||
while (parser.nestingLevel > 1)
|
while (parser.nestingLevel > 1)
|
||||||
ME_RTFSpecialCharHook(&parser); /* Decrements nestingLevel */
|
ME_RTFSpecialCharHook(&parser); /* Decrements nestingLevel */
|
||||||
para = parser.tableDef->tableRowStart;
|
para = parser.tableDef->row_start;
|
||||||
ME_RTFSpecialCharHook(&parser);
|
ME_RTFSpecialCharHook(&parser);
|
||||||
} else {
|
}
|
||||||
para = parser.tableDef->tableRowStart;
|
else
|
||||||
|
{
|
||||||
|
para = parser.tableDef->row_start;
|
||||||
ME_RTFSpecialCharHook(&parser);
|
ME_RTFSpecialCharHook(&parser);
|
||||||
assert(para->member.para.nFlags & MEPF_ROWEND);
|
assert( para->nFlags & MEPF_ROWEND );
|
||||||
para = para->member.para.next_para;
|
para = para_next( para );
|
||||||
}
|
}
|
||||||
|
|
||||||
editor->pCursors[1].pPara = para;
|
editor->pCursors[1].pPara = para_get_di( para );
|
||||||
editor->pCursors[1].pRun = ME_FindItemFwd(para, diRun);
|
editor->pCursors[1].pRun = run_get_di( para_first_run( para ) );
|
||||||
editor->pCursors[1].nOffset = 0;
|
editor->pCursors[1].nOffset = 0;
|
||||||
nOfs = ME_GetCursorOfs(&editor->pCursors[1]);
|
nOfs = ME_GetCursorOfs(&editor->pCursors[1]);
|
||||||
nChars = ME_GetCursorOfs(&editor->pCursors[0]) - nOfs;
|
nChars = ME_GetCursorOfs(&editor->pCursors[0]) - nOfs;
|
||||||
ME_InternalDeleteText(editor, &editor->pCursors[1], nChars, TRUE);
|
ME_InternalDeleteText(editor, &editor->pCursors[1], nChars, TRUE);
|
||||||
if (parser.tableDef)
|
if (parser.tableDef) parser.tableDef->row_start = NULL;
|
||||||
parser.tableDef->tableRowStart = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ME_CheckTablesForCorruption(editor);
|
ME_CheckTablesForCorruption(editor);
|
||||||
|
|
|
@ -279,12 +279,11 @@ ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* table.c */
|
/* table.c */
|
||||||
BOOL ME_IsInTable(ME_DisplayItem *pItem) DECLSPEC_HIDDEN;
|
BOOL ME_IsInTable(ME_DisplayItem *pItem) DECLSPEC_HIDDEN;
|
||||||
ME_DisplayItem *ME_InsertTableRowStartFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
|
||||||
ME_DisplayItem *ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
|
|
||||||
ME_DisplayItem *para) DECLSPEC_HIDDEN;
|
|
||||||
ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
ME_DisplayItem *ME_InsertTableCellFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||||
ME_DisplayItem *ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
ME_DisplayItem *ME_InsertTableRowEndFromCursor(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||||
ME_Paragraph *table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) DECLSPEC_HIDDEN;
|
ME_Paragraph *table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) DECLSPEC_HIDDEN;
|
||||||
|
ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
|
||||||
|
ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||||
ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||||
ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||||
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -1035,10 +1035,10 @@ struct RTFTable
|
||||||
int numCellsInserted;
|
int numCellsInserted;
|
||||||
|
|
||||||
/* v4.1 */
|
/* v4.1 */
|
||||||
/* tableRowStart may be the start row paragraph of the table row,
|
/* row_start may be the start row paragraph of the table row,
|
||||||
* or it may store the end of the previous row if it may still be
|
* or it may store the end of the previous row if it may still be
|
||||||
* continued, otherwise NULL is stored. */
|
* continued, otherwise NULL is stored. */
|
||||||
ME_DisplayItem *tableRowStart;
|
ME_Paragraph *row_start;
|
||||||
|
|
||||||
/* Table definitions are stored as a stack to support nested tables. */
|
/* Table definitions are stored as a stack to support nested tables. */
|
||||||
RTFTable *parent;
|
RTFTable *parent;
|
||||||
|
|
|
@ -73,44 +73,41 @@ static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cu
|
||||||
return para;
|
return para;
|
||||||
}
|
}
|
||||||
|
|
||||||
ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor)
|
ME_Paragraph* table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor )
|
||||||
{
|
{
|
||||||
ME_Paragraph *para;
|
ME_Paragraph *para;
|
||||||
|
|
||||||
para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWSTART );
|
para = table_insert_end_para( editor, cursor, cr_lf, 2, MEPF_ROWSTART );
|
||||||
return para_get_di( para_prev( para ) );
|
return para_prev( para );
|
||||||
}
|
}
|
||||||
|
|
||||||
ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
|
ME_Paragraph* table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para )
|
||||||
ME_DisplayItem *para)
|
|
||||||
{
|
{
|
||||||
ME_DisplayItem *prev_para, *end_para;
|
ME_Paragraph *prev_para, *end_para, *start_row;
|
||||||
ME_Cursor savedCursor = editor->pCursors[0];
|
ME_Cursor cursor;
|
||||||
ME_DisplayItem *startRowPara;
|
|
||||||
editor->pCursors[0].pPara = para;
|
|
||||||
editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
|
|
||||||
editor->pCursors[0].nOffset = 0;
|
|
||||||
editor->pCursors[1] = editor->pCursors[0];
|
|
||||||
startRowPara = ME_InsertTableRowStartFromCursor(editor);
|
|
||||||
savedCursor.pPara = ME_GetParagraph(savedCursor.pRun);
|
|
||||||
editor->pCursors[0] = savedCursor;
|
|
||||||
editor->pCursors[1] = editor->pCursors[0];
|
|
||||||
|
|
||||||
end_para = editor->pCursors[0].pPara->member.para.next_para;
|
cursor.pPara = para_get_di( para );
|
||||||
prev_para = startRowPara->member.para.next_para;
|
cursor.pRun = run_get_di( para_first_run( para ) );
|
||||||
para = prev_para->member.para.next_para;
|
cursor.nOffset = 0;
|
||||||
while (para != end_para)
|
|
||||||
{
|
start_row = table_insert_row_start( editor, &cursor );
|
||||||
para->member.para.pCell = prev_para->member.para.pCell;
|
|
||||||
para->member.para.nFlags |= MEPF_CELL;
|
end_para = para_next( &editor->pCursors[0].pPara->member.para );
|
||||||
para->member.para.nFlags &= ~(MEPF_ROWSTART|MEPF_ROWEND);
|
prev_para = para_next( start_row );
|
||||||
para->member.para.fmt.dwMask |= PFM_TABLE|PFM_TABLEROWDELIMITER;
|
para = para_next( prev_para );
|
||||||
para->member.para.fmt.wEffects |= PFE_TABLE;
|
|
||||||
para->member.para.fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
|
while (para != end_para)
|
||||||
prev_para = para;
|
{
|
||||||
para = para->member.para.next_para;
|
para->pCell = prev_para->pCell;
|
||||||
}
|
para->nFlags |= MEPF_CELL;
|
||||||
return startRowPara;
|
para->nFlags &= ~(MEPF_ROWSTART | MEPF_ROWEND);
|
||||||
|
para->fmt.dwMask |= PFM_TABLE | PFM_TABLEROWDELIMITER;
|
||||||
|
para->fmt.wEffects |= PFE_TABLE;
|
||||||
|
para->fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
|
||||||
|
prev_para = para;
|
||||||
|
para = para_next( para );
|
||||||
|
}
|
||||||
|
return start_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inserts a diCell and starts a new paragraph for the next cell.
|
/* Inserts a diCell and starts a new paragraph for the next cell.
|
||||||
|
@ -419,7 +416,7 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row )
|
||||||
editor->pCursors[0].pRun = run_get_di( run );
|
editor->pCursors[0].pRun = run_get_di( run );
|
||||||
editor->pCursors[0].nOffset = 0;
|
editor->pCursors[0].nOffset = 0;
|
||||||
editor->pCursors[1] = editor->pCursors[0];
|
editor->pCursors[1] = editor->pCursors[0];
|
||||||
para = &ME_InsertTableRowStartFromCursor(editor)->member.para;
|
para = table_insert_row_start( editor, editor->pCursors );
|
||||||
insertedCell = ME_FindItemFwd( para_get_di( para ), diCell );
|
insertedCell = ME_FindItemFwd( para_get_di( para ), diCell );
|
||||||
/* Copy cell properties */
|
/* Copy cell properties */
|
||||||
insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
|
insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
|
||||||
|
|
Loading…
Reference in New Issue