Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 276 of file table.c.
Referenced by ME_InternalDeleteText().
{ int nOfs = ME_GetCursorOfs(c); ME_Cursor c2 = *c; ME_DisplayItem *this_para = c->pPara; ME_DisplayItem *end_para; ME_MoveCursorChars(editor, &c2, *nChars); end_para = c2.pPara; if (c2.pRun->member.run.nFlags & MERF_ENDPARA) { /* End offset might be in the middle of the end paragraph run. * If this is the case, then we need to use the next paragraph as the last * paragraphs. */ int remaining = nOfs + *nChars - c2.pRun->member.run.nCharOfs - end_para->member.para.nCharOfs; if (remaining) { assert(remaining < c2.pRun->member.run.strText->nLen); end_para = end_para->member.para.next_para; } } if (!editor->bEmulateVersion10) { /* v4.1 */ if (this_para->member.para.pCell != end_para->member.para.pCell || ((this_para->member.para.nFlags|end_para->member.para.nFlags) & (MEPF_ROWSTART|MEPF_ROWEND))) { while (this_para != end_para) { ME_DisplayItem *next_para = this_para->member.para.next_para; BOOL bTruancateDeletion = FALSE; if (this_para->member.para.nFlags & MEPF_ROWSTART) { /* The following while loop assumes that next_para is MEPF_ROWSTART, * so moving back one paragraph let's it be processed as the start * of the row. */ next_para = this_para; this_para = this_para->member.para.prev_para; } else if (next_para->member.para.pCell != this_para->member.para.pCell || this_para->member.para.nFlags & MEPF_ROWEND) { /* Start of the deletion from after the start of the table row. */ bTruancateDeletion = TRUE; } while (!bTruancateDeletion && next_para->member.para.nFlags & MEPF_ROWSTART) { next_para = ME_GetTableRowEnd(next_para)->member.para.next_para; if (next_para->member.para.nCharOfs > nOfs + *nChars) { /* End of deletion is not past the end of the table row. */ next_para = this_para->member.para.next_para; /* Delete the end paragraph preceding the table row if the * preceding table row will be empty. */ if (this_para->member.para.nCharOfs >= nOfs) { next_para = next_para->member.para.next_para; } bTruancateDeletion = TRUE; } else { this_para = next_para->member.para.prev_para; } } if (bTruancateDeletion) { ME_Run *end_run = &ME_FindItemBack(next_para, diRun)->member.run; int nCharsNew = (next_para->member.para.nCharOfs - nOfs - end_run->strText->nLen); nCharsNew = max(nCharsNew, 0); assert(nCharsNew <= *nChars); *nChars = nCharsNew; break; } this_para = next_para; } } } else { /* v1.0 - 3.0 */ ME_DisplayItem *pRun; int nCharsToBoundary; if ((this_para->member.para.nCharOfs != nOfs || this_para == end_para) && this_para->member.para.pFmt->dwMask & PFM_TABLE && this_para->member.para.pFmt->wEffects & PFE_TABLE) { pRun = c->pRun; /* Find the next tab or end paragraph to use as a delete boundary */ while (!(pRun->member.run.nFlags & (MERF_TAB|MERF_ENDPARA))) pRun = ME_FindItemFwd(pRun, diRun); nCharsToBoundary = pRun->member.run.nCharOfs - c->pRun->member.run.nCharOfs - c->nOffset; *nChars = min(*nChars, nCharsToBoundary); } else if (end_para->member.para.pFmt->dwMask & PFM_TABLE && end_para->member.para.pFmt->wEffects & PFE_TABLE) { /* The deletion starts from before the row, so don't join it with * previous non-empty paragraphs. */ ME_DisplayItem *curPara; pRun = NULL; if (nOfs > this_para->member.para.nCharOfs) { pRun = ME_FindItemBack(end_para, diRun); curPara = end_para->member.para.prev_para; } if (!pRun) { pRun = ME_FindItemFwd(end_para, diRun); curPara = end_para; } if (pRun) { nCharsToBoundary = curPara->member.para.nCharOfs + pRun->member.run.nCharOfs - nOfs; if (nCharsToBoundary >= 0) *nChars = min(*nChars, nCharsToBoundary); } } if (*nChars < 0) nChars = 0; } }