ReactOS 0.4.16-dev-889-g9563c07
para.c
Go to the documentation of this file.
1/*
2 * RichEdit - functions working on paragraphs of text (diParagraph).
3 *
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2006 by Phil Krylov
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include "editor.h"
23
25
27{
28 para->nFlags |= MEPF_REWRAP;
29 para_mark_add( editor, para );
30}
31
33{
35
36 editor_set_default_para_fmt( editor, &item->member.para.fmt );
37 item->member.para.nFlags = MEPF_REWRAP;
38
39 return &item->member.para;
40}
41
43{
44 if (para->nWidth == editor->nTotalWidth)
45 {
46 para->nWidth = 0;
47 editor->nTotalWidth = get_total_width(editor);
48 }
49 editor->total_rows -= para->nRows;
50 ME_DestroyString( para->text );
51 para_num_clear( &para->para_num );
52 para_mark_remove( editor, para );
54}
55
56/* Note para_next/prev will return the start and end doc nodes */
58{
59 if (para->next_para) return &para->next_para->member.para;
60 return NULL;
61}
62
64{
65 if (para->prev_para && para->prev_para->type == diParagraph) return &para->prev_para->member.para;
66 return NULL;
67}
68
70{
71 ME_Paragraph *para;
72 int total_width = 0;
73
74 if (editor->pBuffer->pFirst && editor->pBuffer->pLast)
75 {
76 para = &editor->pBuffer->pFirst->next->member.para;
77 while (para != &editor->pBuffer->pLast->member.para && para->next_para)
78 {
79 total_width = max(total_width, para->nWidth);
80 para = &para->next_para->member.para;
81 }
82 }
83
84 return total_width;
85}
86
87static int para_mark_compare( const void *key, const struct wine_rb_entry *entry )
88{
89 ME_Paragraph *para = WINE_RB_ENTRY_VALUE( entry, ME_Paragraph, marked_entry );
90
91 return *(int *)key - para->nCharOfs;
92}
93
95{
96 wine_rb_remove_key( &editor->marked_paras, &para->nCharOfs );
97}
98
100{
101 wine_rb_put( &editor->marked_paras, &para->nCharOfs, &para->marked_entry );
102}
103
105{
106 ME_DisplayItem *di;
107
108 for (di = para_get_di( para ); di != para->next_para; di = di->next )
109 {
110 if (di->type != diRun) continue;
111 return &di->member.run;
112 }
113 ERR( "failed to find run in paragraph\n" );
114 return NULL;
115}
116
118{
119 return para->eop_run;
120}
121
123{
124 return para->fmt.wEffects & PFE_TABLE;
125}
126
128{
129 return para->cell;
130}
131
133{
135
137 if (!item || item->type != diStartRow) return NULL;
138 return &item->member.row;
139}
140
142{
144
145 para = para_next( para );
147 if (!item || item->type != diStartRow) return NULL;
148 return &item->member.row;
149}
150
152{
155 const CHARFORMATW *host_cf;
156 LOGFONTW lf;
157 HFONT hf;
158 ME_TextBuffer *text = editor->pBuffer;
159 ME_Paragraph *para = para_create( editor );
160 ME_Run *run;
162 int eol_len;
163 HDC hdc = ITextHost_TxGetDC( editor->texthost );
164
165 ME_InitContext( &c, editor, hdc );
166
168 assert(hf);
169 GetObjectW(hf, sizeof(LOGFONTW), &lf);
170 ZeroMemory(&cf, sizeof(cf));
171 cf.cbSize = sizeof(cf);
178
179 cf.dwEffects = CFE_AUTOCOLOR | CFE_AUTOBACKCOLOR;
180 lstrcpyW(cf.szFaceName, lf.lfFaceName);
181 /* Convert system font height from logical units to twips for cf.yHeight */
182 cf.yHeight = (lf.lfHeight * 72 * 1440) / (c.dpi.cy * c.dpi.cy);
183 if (lf.lfWeight > FW_NORMAL) cf.dwEffects |= CFE_BOLD;
184 cf.wWeight = lf.lfWeight;
185 if (lf.lfItalic) cf.dwEffects |= CFE_ITALIC;
186 if (lf.lfUnderline) cf.dwEffects |= CFE_UNDERLINE;
187 cf.bUnderlineType = CFU_UNDERLINE;
188 if (lf.lfStrikeOut) cf.dwEffects |= CFE_STRIKEOUT;
189 cf.bPitchAndFamily = lf.lfPitchAndFamily;
190 cf.bCharSet = lf.lfCharSet;
191 cf.lcid = GetSystemDefaultLCID();
192
194 text->pDefaultStyle = style;
195
196 if (ITextHost_TxGetCharFormat(editor->texthost, &host_cf) == S_OK)
197 {
198 ZeroMemory(&cf, sizeof(cf));
199 cf.cbSize = sizeof(cf);
200 cfany_to_cf2w(&cf, (CHARFORMAT2W *)host_cf);
201 ME_SetDefaultCharFormat(editor, &cf);
202 }
203
204 eol_len = editor->bEmulateVersion10 ? 2 : 1;
205 para->text = ME_MakeStringN( L"\r\n", eol_len );
206
207 run = run_create( style, MERF_ENDPARA );
208 run->nCharOfs = 0;
209 run->len = eol_len;
210 run->para = para;
211 para->eop_run = run;
212
213 ME_InsertBefore( text->pLast, para_get_di( para) );
214 ME_InsertBefore( text->pLast, run_get_di( run ) );
215 para->prev_para = text->pFirst;
216 para->next_para = text->pLast;
217 text->pFirst->member.para.next_para = para_get_di( para );
218 text->pLast->member.para.prev_para = para_get_di( para );
219
220 text->pLast->member.para.nCharOfs = editor->bEmulateVersion10 ? 2 : 1;
221
223 para_mark_add( editor, para );
226}
227
229{
230 while (first != end)
231 {
232 para_mark_rewrap( editor, first );
233 first = para_next( first );
234 }
235}
236
238{
239 para_mark_rewrap_paras( editor, editor_first_para( editor ), editor_end_para( editor ) );
240}
241
243{
245
246 if (para_cell( para )) para->nFlags |= MEPF_CELL;
247 else para->nFlags &= ~MEPF_CELL;
248
250 else para->fmt.wEffects &= ~PFE_TABLEROWDELIMITER;
251
252 if (para->nFlags & (MEPF_ROWSTART | MEPF_CELL | MEPF_ROWEND))
253 para->fmt.wEffects |= PFE_TABLE;
254 else
255 para->fmt.wEffects &= ~PFE_TABLE;
256}
257
259{
260 return item->wNumbering == base->wNumbering &&
261 item->wNumberingStart == base->wNumberingStart &&
262 item->wNumberingStyle == base->wNumberingStyle &&
263 !(item->wNumberingStyle & PFNS_NEWNUMBER);
264}
265
267{
268 ME_DisplayItem *prev;
269 int num = para->fmt.wNumberingStart;
270
271 for (prev = para->prev_para; prev->type == diParagraph;
272 para = &prev->member.para, prev = prev->member.para.prev_para, num++)
273 {
274 if (!para_num_same_list( &prev->member.para.fmt, &para->fmt )) break;
275 }
276 return num;
277}
278
280{
281 /* max 4 Roman letters (representing '8') / decade + '(' + ')' */
282 ME_String *str = ME_MakeStringEmpty( 20 + 2 );
283 WCHAR *p;
284 static const WORD letter_base[] = { 1, 26, 26 * 26, 26 * 26 * 26 };
285 /* roman_base should start on a '5' not a '1', otherwise the 'total' code will need adjusting.
286 'N' and 'O' are what MS uses for 5000 and 10000, their version doesn't work well above 30000,
287 but we'll use 'P' as the obvious extension, this gets us up to 2^16, which is all we care about. */
288 static const struct
289 {
290 int base;
291 char letter;
292 }
293 roman_base[] =
294 {
295 {50000, 'P'}, {10000, 'O'}, {5000, 'N'}, {1000, 'M'},
296 {500, 'D'}, {100, 'C'}, {50, 'L'}, {10, 'X'}, {5, 'V'}, {1, 'I'}
297 };
298 int i, len;
299 WORD letter, total, char_offset = 0;
300
301 if (!str) return NULL;
302
303 p = str->szData;
304
305 if ((para->fmt.wNumberingStyle & 0xf00) == PFNS_PARENS)
306 *p++ = '(';
307
308 switch (para->fmt.wNumbering)
309 {
310 case PFN_ARABIC:
311 default:
312 p += swprintf( p, 20, L"%d", num );
313 break;
314
315 case PFN_LCLETTER:
316 char_offset = 'a' - 'A';
317 /* fall through */
318 case PFN_UCLETTER:
319 if (!num) num = 1;
320
321 /* This is not base-26 (or 27) as zeros don't count unless they are leading zeros.
322 It's simplest to start with the least significant letter, so first calculate how many letters are needed. */
323 for (i = 0, total = 0; i < ARRAY_SIZE( letter_base ); i++)
324 {
325 total += letter_base[i];
326 if (num < total) break;
327 }
328 len = i;
329 for (i = 0; i < len; i++)
330 {
331 num -= letter_base[i];
332 letter = (num / letter_base[i]) % 26;
333 p[len - i - 1] = letter + 'A' + char_offset;
334 }
335 p += len;
336 *p = 0;
337 break;
338
339 case PFN_LCROMAN:
340 char_offset = 'a' - 'A';
341 /* fall through */
342 case PFN_UCROMAN:
343 if (!num) num = 1;
344
345 for (i = 0; i < ARRAY_SIZE( roman_base ); i++)
346 {
347 if (i > 0)
348 {
349 if (i % 2 == 0) /* eg 5000, check for 9000 */
350 total = roman_base[i].base + 4 * roman_base[i + 1].base;
351 else /* eg 1000, check for 4000 */
352 total = 4 * roman_base[i].base;
353
354 if (num / total)
355 {
356 *p++ = roman_base[(i & ~1) + 1].letter + char_offset;
357 *p++ = roman_base[i - 1].letter + char_offset;
358 num -= total;
359 continue;
360 }
361 }
362
363 len = num / roman_base[i].base;
364 while (len--)
365 {
366 *p++ = roman_base[i].letter + char_offset;
367 num -= roman_base[i].base;
368 }
369 }
370 *p = 0;
371 break;
372 }
373
374 switch (para->fmt.wNumberingStyle & 0xf00)
375 {
376 case PFNS_PARENS:
377 case PFNS_PAREN:
378 *p++ = ')';
379 *p = 0;
380 break;
381
382 case PFNS_PERIOD:
383 *p++ = '.';
384 *p = 0;
385 break;
386 }
387
388 str->nLen = p - str->szData;
389 return str;
390}
391
393{
396 SIZE sz;
397
398 if (!para->fmt.wNumbering) return;
399 if (para->para_num.style && para->para_num.text) return;
400
401 if (!para->para_num.style)
402 {
403 style = para->eop_run->style;
404
405 if (para->fmt.wNumbering == PFN_BULLET)
406 {
407 cf.cbSize = sizeof(cf);
408 cf.dwMask = CFM_FACE | CFM_CHARSET;
409 lstrcpyW( cf.szFaceName, L"Symbol" );
410 cf.bCharSet = SYMBOL_CHARSET;
411 style = ME_ApplyStyle( c->editor, style, &cf );
412 }
413 else
414 {
416 }
417
418 para->para_num.style = style;
419 }
420
421 if (!para->para_num.text)
422 {
423 if (para->fmt.wNumbering != PFN_BULLET)
424 para->para_num.text = para_num_get_str( para, para_num_get_num( para ) );
425 else
426 para->para_num.text = ME_MakeStringConst( L"\x00b7", 1 );
427 }
428
429 select_style( c, para->para_num.style );
430 GetTextExtentPointW( c->hDC, para->para_num.text->szData, para->para_num.text->nLen, &sz );
431 para->para_num.width = sz.cx;
432 GetTextExtentPointW( c->hDC, L" ", 1, &sz );
433 para->para_num.width += sz.cx;
434}
435
437{
438 if (pn->style)
439 {
440 ME_ReleaseStyle( pn->style );
441 pn->style = NULL;
442 }
443 ME_DestroyString( pn->text );
444 pn->text = NULL;
445}
446
447static void para_num_clear_list( ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *orig_fmt )
448{
449 do
450 {
451 para_mark_rewrap( editor, para );
452 para_num_clear( &para->para_num );
453 if (para->next_para->type != diParagraph) break;
454 para = &para->next_para->member.para;
455 } while (para_num_same_list( &para->fmt, orig_fmt ));
456}
457
458static BOOL para_set_fmt( ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *pFmt )
459{
461 DWORD dwMask;
462
463 assert(para->fmt.cbSize == sizeof(PARAFORMAT2));
464 dwMask = pFmt->dwMask;
465 if (pFmt->cbSize < sizeof(PARAFORMAT))
466 return FALSE;
467 else if (pFmt->cbSize < sizeof(PARAFORMAT2))
468 dwMask &= PFM_ALL;
469 else
470 dwMask &= PFM_ALL2;
471
472 add_undo_set_para_fmt( editor, para );
473
474 copy = para->fmt;
475
476#define COPY_FIELD(m, f) \
477 if (dwMask & (m)) { \
478 para->fmt.dwMask |= m; \
479 para->fmt.f = pFmt->f; \
480 }
481
482 COPY_FIELD(PFM_NUMBERING, wNumbering);
483 COPY_FIELD(PFM_STARTINDENT, dxStartIndent);
484 if (dwMask & PFM_OFFSETINDENT)
485 para->fmt.dxStartIndent += pFmt->dxStartIndent;
486 COPY_FIELD(PFM_RIGHTINDENT, dxRightIndent);
487 COPY_FIELD(PFM_OFFSET, dxOffset);
488 COPY_FIELD(PFM_ALIGNMENT, wAlignment);
489 if (dwMask & PFM_TABSTOPS)
490 {
491 /* Clamp between 0 and MAX_TAB_STOPS */
492 para->fmt.cTabCount = max(0, min(pFmt->cTabCount, MAX_TAB_STOPS));
493 memcpy(para->fmt.rgxTabs, pFmt->rgxTabs, para->fmt.cTabCount * sizeof(LONG));
494 }
495
496#define EFFECTS_MASK (PFM_RTLPARA|PFM_KEEP|PFM_KEEPNEXT|PFM_PAGEBREAKBEFORE| \
497 PFM_NOLINENUMBER|PFM_NOWIDOWCONTROL|PFM_DONOTHYPHEN|PFM_SIDEBYSIDE| \
498 PFM_TABLE)
499 /* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
500 if (dwMask & EFFECTS_MASK)
501 {
502 para->fmt.dwMask |= dwMask & EFFECTS_MASK;
503 para->fmt.wEffects &= ~HIWORD(dwMask);
504 para->fmt.wEffects |= pFmt->wEffects & HIWORD(dwMask);
505 }
506#undef EFFECTS_MASK
507
508 COPY_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
509 COPY_FIELD(PFM_SPACEAFTER, dySpaceAfter);
510 COPY_FIELD(PFM_LINESPACING, dyLineSpacing);
511 COPY_FIELD(PFM_STYLE, sStyle);
512 COPY_FIELD(PFM_LINESPACING, bLineSpacingRule);
513 COPY_FIELD(PFM_SHADING, wShadingWeight);
514 COPY_FIELD(PFM_SHADING, wShadingStyle);
515 COPY_FIELD(PFM_NUMBERINGSTART, wNumberingStart);
516 COPY_FIELD(PFM_NUMBERINGSTYLE, wNumberingStyle);
517 COPY_FIELD(PFM_NUMBERINGTAB, wNumberingTab);
518 COPY_FIELD(PFM_BORDER, wBorderSpace);
519 COPY_FIELD(PFM_BORDER, wBorderWidth);
520 COPY_FIELD(PFM_BORDER, wBorders);
521
522 para->fmt.dwMask |= dwMask;
523#undef COPY_FIELD
524
525 if (memcmp(&copy, &para->fmt, sizeof(PARAFORMAT2)))
526 {
527 para_mark_rewrap( editor, para );
528 if (((dwMask & PFM_NUMBERING) && (copy.wNumbering != para->fmt.wNumbering)) ||
529 ((dwMask & PFM_NUMBERINGSTART) && (copy.wNumberingStart != para->fmt.wNumberingStart)) ||
530 ((dwMask & PFM_NUMBERINGSTYLE) && (copy.wNumberingStyle != para->fmt.wNumberingStyle)))
531 {
532 para_num_clear_list( editor, para, &copy );
533 }
534 }
535
536 return TRUE;
537}
538
539/* split paragraph at the beginning of the run */
541 const WCHAR *eol_str, int eol_len, int paraFlags )
542{
543 ME_Paragraph *new_para = para_create( editor ), *old_para, *next_para;
544 ME_Run *end_run, *next_run;
545 int ofs, i;
546 int run_flags = MERF_ENDPARA;
547
548 if (!editor->bEmulateVersion10) /* v4.1 */
549 {
550 /* At most 1 of MEPF_CELL, MEPF_ROWSTART, or MEPF_ROWEND should be set. */
551 assert( !(paraFlags & ~(MEPF_CELL | MEPF_ROWSTART | MEPF_ROWEND)) );
552 assert( !(paraFlags & (paraFlags-1)) );
553 if (paraFlags == MEPF_CELL)
554 run_flags |= MERF_ENDCELL;
555 else if (paraFlags == MEPF_ROWSTART)
556 run_flags |= MERF_TABLESTART | MERF_HIDDEN;
557 }
558 else /* v1.0 - v3.0 */
559 assert( !(paraFlags & (MEPF_CELL |MEPF_ROWSTART | MEPF_ROWEND)) );
560
561 old_para = run->para;
562 assert( old_para->fmt.cbSize == sizeof(PARAFORMAT2) );
563
564 /* Clear any cached para numbering following this paragraph */
565 if (old_para->fmt.wNumbering)
566 para_num_clear_list( editor, old_para, &old_para->fmt );
567
568 new_para->text = ME_VSplitString( old_para->text, run->nCharOfs );
569
570 end_run = run_create( style, run_flags );
571 ofs = end_run->nCharOfs = run->nCharOfs;
572 end_run->len = eol_len;
573 end_run->para = run->para;
574 ME_AppendString( old_para->text, eol_str, eol_len );
575 next_para = &old_para->next_para->member.para;
576
577 add_undo_join_paras( editor, old_para->nCharOfs + ofs );
578
579 /* Update selection cursors to point to the correct paragraph. */
580 for (i = 0; i < editor->nCursors; i++)
581 {
582 if (editor->pCursors[i].para == old_para &&
583 run->nCharOfs <= editor->pCursors[i].run->nCharOfs)
584 {
585 editor->pCursors[i].para = new_para;
586 }
587 }
588
589 /* the new paragraph will have a different starting offset, so update its runs */
590 for (next_run = run; next_run; next_run = run_next( next_run ))
591 {
592 next_run->nCharOfs -= ofs;
593 next_run->para = new_para;
594 }
595
596 new_para->nCharOfs = old_para->nCharOfs + ofs;
597 new_para->nCharOfs += eol_len;
598 new_para->nFlags = 0;
599 para_mark_rewrap( editor, new_para );
600
601 /* FIXME initialize format style and call ME_SetParaFormat blah blah */
602 new_para->fmt = old_para->fmt;
603 new_para->border = old_para->border;
604
605 /* insert paragraph into paragraph double linked list */
606 new_para->prev_para = para_get_di( old_para );
607 new_para->next_para = para_get_di( next_para );
608 old_para->next_para = para_get_di( new_para );
609 next_para->prev_para = para_get_di( new_para );
610
611 /* insert end run of the old paragraph, and new paragraph, into DI double linked list */
612 ME_InsertBefore( run_get_di( run ), para_get_di( new_para ) );
613 ME_InsertBefore( para_get_di( new_para ), run_get_di( end_run ) );
614
615 /* Fix up the paras' eop_run ptrs */
616 new_para->eop_run = old_para->eop_run;
617 old_para->eop_run = end_run;
618
619 if (!editor->bEmulateVersion10) /* v4.1 */
620 {
621 if (paraFlags & (MEPF_ROWSTART | MEPF_CELL))
622 {
623 ME_Cell *cell = cell_create();
624 ME_InsertBefore( para_get_di( new_para ), cell_get_di( cell ) );
625 new_para->cell = cell;
626 cell->next_cell = NULL;
627 if (paraFlags & MEPF_ROWSTART)
628 {
629 old_para->nFlags |= MEPF_ROWSTART;
630 cell->prev_cell = NULL;
631 cell->parent_cell = old_para->cell;
632 if (para_cell( old_para ))
633 cell->nNestingLevel = para_cell( old_para )->nNestingLevel + 1;
634 else
635 cell->nNestingLevel = 1;
636 }
637 else
638 {
639 cell->prev_cell = old_para->cell;
640 cell_prev( cell )->next_cell = cell;
641 assert( old_para->nFlags & MEPF_CELL );
642 assert( !(old_para->nFlags & MEPF_ROWSTART) );
643 cell->nNestingLevel = cell_prev( cell )->nNestingLevel;
644 cell->parent_cell = cell_prev( cell )->parent_cell;
645 }
646 }
647 else if (paraFlags & MEPF_ROWEND)
648 {
649 old_para->nFlags |= MEPF_ROWEND;
650 old_para->cell = old_para->cell->parent_cell;
651 new_para->cell = old_para->cell;
652 assert( para_prev( old_para )->nFlags & MEPF_CELL );
653 assert( !(para_prev( old_para )->nFlags & MEPF_ROWSTART) );
654 if (new_para->cell != para_next( new_para )->cell
655 && para_next( new_para )->cell
656 && !cell_prev( para_next( new_para )->cell ))
657 {
658 /* Row starts just after the row that was ended. */
659 new_para->nFlags |= MEPF_ROWSTART;
660 }
661 }
662 else new_para->cell = old_para->cell;
663
664 table_update_flags( old_para );
665 table_update_flags( new_para );
666 }
667
668 /* force rewrap of the */
669 if (old_para->prev_para->type == diParagraph)
670 para_mark_rewrap( editor, &old_para->prev_para->member.para );
671
672 para_mark_rewrap( editor, &new_para->prev_para->member.para );
673
674 /* we've added the end run, so we need to modify nCharOfs in the next paragraphs */
675 editor_propagate_char_ofs( next_para, NULL, eol_len );
676 editor->nParagraphs++;
677
678 return new_para;
679}
680
681/* join para with the next para keeping para's style using the paragraph fmt
682 specified in use_first_fmt */
683ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt )
684{
685 ME_Paragraph *next = para_next( para );
686 ME_Run *end_run, *next_first_run, *tmp_run;
687 ME_Cell *cell = NULL;
688 int i, end_len;
690 ME_Cursor startCur, endCur;
691 ME_String *eol_str;
692
693 assert( next && para_next( next ) );
694
695 /* Clear any cached para numbering following this paragraph */
696 if (para->fmt.wNumbering) para_num_clear_list( editor, para, &para->fmt );
697
698 end_run = para_end_run( para );
699 next_first_run = para_first_run( next );
700
701 end_len = end_run->len;
702 eol_str = ME_VSplitString( para->text, end_run->nCharOfs );
703 ME_AppendString( para->text, next->text->szData, next->text->nLen );
704
705 /* null char format operation to store the original char format for the ENDPARA run */
707 startCur.para = para;
708 startCur.run = end_run;
709 endCur.para = next;
710 endCur.run = next_first_run;
711 startCur.nOffset = endCur.nOffset = 0;
712
713 ME_SetCharFormat(editor, &startCur, &endCur, &fmt);
714
715 if (!editor->bEmulateVersion10) /* v4.1 */
716 {
717 /* Remove cell boundary if it is between the end paragraph run and the next
718 * paragraph display item. */
719 if (para->cell != next->cell) cell = next->cell;
720
721 /* Table cell/row properties are always moved over from the removed para. */
722 para->nFlags = next->nFlags;
723 para->cell = next->cell;
724 }
725
726 add_undo_split_para( editor, next, eol_str, cell );
727
728 if (cell)
729 {
730 ME_Remove( cell_get_di( cell ) );
731 if (cell_prev( cell )) cell_prev( cell )->next_cell = cell_next( cell );
732 if (cell_next( cell )) cell_next( cell )->prev_cell = cell_prev( cell );
734 }
735
736 if (!use_first_fmt)
737 {
738 add_undo_set_para_fmt( editor, para );
739 para->fmt = next->fmt;
740 para->border = next->border;
741 }
742
743 /* Update selection cursors so they don't point to the removed end
744 * paragraph run, and point to the correct paragraph. */
745 for (i = 0; i < editor->nCursors; i++)
746 {
747 if (editor->pCursors[i].run == end_run)
748 {
749 editor->pCursors[i].run = next_first_run;
750 editor->pCursors[i].nOffset = 0;
751 }
752 else if (editor->pCursors[i].para == next)
753 editor->pCursors[i].para = para;
754 }
755
756 for (tmp_run = next_first_run; tmp_run; tmp_run = run_next( tmp_run ))
757 {
758 tmp_run->nCharOfs += next->nCharOfs - para->nCharOfs - end_len;
759 tmp_run->para = para;
760 }
761
762 /* Fix up the para's eop_run ptr */
763 para->eop_run = next->eop_run;
764
765 ME_Remove( run_get_di( end_run ) );
767
768 if (editor->last_sel_start_para == next)
769 editor->last_sel_start_para = para;
770 if (editor->last_sel_end_para == next)
771 editor->last_sel_end_para = para;
772
773 para->next_para = next->next_para;
774 next->next_para->member.para.prev_para = para_get_di( para );
776 para_destroy( editor, next );
777
778 editor_propagate_char_ofs( para_next( para ), NULL, -end_len );
779
780 ME_CheckCharOffsets(editor);
781
782 editor->nParagraphs--;
783 para_mark_rewrap( editor, para );
784 return para;
785}
786
787void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048])
788{
789 char *p;
790 p = buf;
791
792#define DUMP(mask, name, fmt, field) \
793 if (pFmt->dwMask & (mask)) p += sprintf(p, "%-22s" fmt "\n", name, pFmt->field); \
794 else p += sprintf(p, "%-22sN/A\n", name);
795
796/* we take for granted that PFE_xxx is the hiword of the corresponding PFM_xxx */
797#define DUMP_EFFECT(mask, name) \
798 p += sprintf(p, "%-22s%s\n", name, (pFmt->dwMask & (mask)) ? ((pFmt->wEffects & ((mask) >> 16)) ? "yes" : "no") : "N/A");
799
800 DUMP(PFM_NUMBERING, "Numbering:", "%u", wNumbering);
801 DUMP_EFFECT(PFM_DONOTHYPHEN, "Disable auto-hyphen:");
802 DUMP_EFFECT(PFM_KEEP, "No page break in para:");
803 DUMP_EFFECT(PFM_KEEPNEXT, "No page break in para & next:");
804 DUMP_EFFECT(PFM_NOLINENUMBER, "No line number:");
805 DUMP_EFFECT(PFM_NOWIDOWCONTROL, "No widow & orphan:");
806 DUMP_EFFECT(PFM_PAGEBREAKBEFORE, "Page break before:");
807 DUMP_EFFECT(PFM_RTLPARA, "RTL para:");
808 DUMP_EFFECT(PFM_SIDEBYSIDE, "Side by side:");
809 DUMP_EFFECT(PFM_TABLE, "Table:");
810 DUMP(PFM_OFFSETINDENT, "Offset indent:", "%d", dxStartIndent);
811 DUMP(PFM_STARTINDENT, "Start indent:", "%d", dxStartIndent);
812 DUMP(PFM_RIGHTINDENT, "Right indent:", "%d", dxRightIndent);
813 DUMP(PFM_OFFSET, "Offset:", "%d", dxOffset);
814 if (pFmt->dwMask & PFM_ALIGNMENT) {
815 switch (pFmt->wAlignment) {
816 case PFA_LEFT : p += sprintf(p, "Alignment: left\n"); break;
817 case PFA_RIGHT : p += sprintf(p, "Alignment: right\n"); break;
818 case PFA_CENTER : p += sprintf(p, "Alignment: center\n"); break;
819 case PFA_JUSTIFY: p += sprintf(p, "Alignment: justify\n"); break;
820 default : p += sprintf(p, "Alignment: incorrect %d\n", pFmt->wAlignment); break;
821 }
822 }
823 else p += sprintf(p, "Alignment: N/A\n");
824 DUMP(PFM_TABSTOPS, "Tab Stops:", "%d", cTabCount);
825 if (pFmt->dwMask & PFM_TABSTOPS) {
826 int i;
827 p += sprintf(p, "\t");
828 for (i = 0; i < pFmt->cTabCount; i++) p += sprintf(p, "%x ", pFmt->rgxTabs[i]);
829 p += sprintf(p, "\n");
830 }
831 DUMP(PFM_SPACEBEFORE, "Space Before:", "%d", dySpaceBefore);
832 DUMP(PFM_SPACEAFTER, "Space After:", "%d", dySpaceAfter);
833 DUMP(PFM_LINESPACING, "Line spacing:", "%d", dyLineSpacing);
834 DUMP(PFM_STYLE, "Text style:", "%d", sStyle);
835 DUMP(PFM_LINESPACING, "Line spacing rule:", "%u", bLineSpacingRule);
836 /* bOutlineLevel should be 0 */
837 DUMP(PFM_SHADING, "Shading Weight:", "%u", wShadingWeight);
838 DUMP(PFM_SHADING, "Shading Style:", "%u", wShadingStyle);
839 DUMP(PFM_NUMBERINGSTART, "Numbering Start:", "%u", wNumberingStart);
840 DUMP(PFM_NUMBERINGSTYLE, "Numbering Style:", "0x%x", wNumberingStyle);
841 DUMP(PFM_NUMBERINGTAB, "Numbering Tab:", "%u", wNumberingStyle);
842 DUMP(PFM_BORDER, "Border Space:", "%u", wBorderSpace);
843 DUMP(PFM_BORDER, "Border Width:", "%u", wBorderWidth);
844 DUMP(PFM_BORDER, "Borders:", "%u", wBorders);
845
846#undef DUMP
847#undef DUMP_EFFECT
848}
849
851{
852 ME_Cursor *pEndCursor = &editor->pCursors[1];
853
854 *para = editor->pCursors[0].para;
855 *para_end = editor->pCursors[1].para;
856 if (*para == *para_end)
857 return;
858
859 if ((*para_end)->nCharOfs < (*para)->nCharOfs)
860 {
861 ME_Paragraph *tmp = *para;
862
863 *para = *para_end;
864 *para_end = tmp;
865 pEndCursor = &editor->pCursors[0];
866 }
867
868 /* The paragraph at the end of a non-empty selection isn't included
869 * if the selection ends at the start of the paragraph. */
870 if (!pEndCursor->run->nCharOfs && !pEndCursor->nOffset)
871 *para_end = para_prev( *para_end );
872}
873
874
876{
877 ME_Paragraph *para, *para_end;
878
879 editor_get_selection_paras( editor, &para, &para_end );
880
881 do
882 {
883 para_set_fmt( editor, para, fmt );
884 if (para == para_end) break;
885 para = para_next( para );
886 } while(1);
887
888 return TRUE;
889}
890
891static void para_copy_fmt( const ME_Paragraph *para, PARAFORMAT2 *fmt )
892{
893 UINT size = fmt->cbSize;
894
895 if (fmt->cbSize >= sizeof(PARAFORMAT2))
896 *fmt = para->fmt;
897 else
898 {
899 memcpy( fmt, &para->fmt, fmt->cbSize );
900 fmt->dwMask &= PFM_ALL;
901 }
902 fmt->cbSize = size;
903}
904
906{
907 ME_Paragraph *para, *para_end;
908
909 if (fmt->cbSize < sizeof(PARAFORMAT))
910 {
911 fmt->dwMask = 0;
912 return;
913 }
914
915 editor_get_selection_paras( editor, &para, &para_end );
916
917 para_copy_fmt( para, fmt );
918
919 /* Invalidate values that change across the selected paragraphs. */
920 while (para != para_end)
921 {
922 para = para_next( para );
923
924#define CHECK_FIELD(m, f) \
925 if (fmt->f != para->fmt.f) fmt->dwMask &= ~(m);
926
927 CHECK_FIELD(PFM_NUMBERING, wNumbering);
928 CHECK_FIELD(PFM_STARTINDENT, dxStartIndent);
929 CHECK_FIELD(PFM_RIGHTINDENT, dxRightIndent);
930 CHECK_FIELD(PFM_OFFSET, dxOffset);
931 CHECK_FIELD(PFM_ALIGNMENT, wAlignment);
932 if (fmt->dwMask & PFM_TABSTOPS)
933 {
934 if (fmt->cTabCount != para->fmt.cTabCount ||
935 memcmp(fmt->rgxTabs, para->fmt.rgxTabs, para->fmt.cTabCount * sizeof(int) ))
936 fmt->dwMask &= ~PFM_TABSTOPS;
937 }
938
939 if (fmt->cbSize >= sizeof(PARAFORMAT2))
940 {
941 fmt->dwMask &= ~((fmt->wEffects ^ para->fmt.wEffects) << 16);
942 CHECK_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
943 CHECK_FIELD(PFM_SPACEAFTER, dySpaceAfter);
944 CHECK_FIELD(PFM_LINESPACING, dyLineSpacing);
945 CHECK_FIELD(PFM_STYLE, sStyle);
946 CHECK_FIELD(PFM_SPACEAFTER, bLineSpacingRule);
947 CHECK_FIELD(PFM_SHADING, wShadingWeight);
948 CHECK_FIELD(PFM_SHADING, wShadingStyle);
949 CHECK_FIELD(PFM_NUMBERINGSTART, wNumberingStart);
950 CHECK_FIELD(PFM_NUMBERINGSTYLE, wNumberingStyle);
951 CHECK_FIELD(PFM_NUMBERINGTAB, wNumberingTab);
952 CHECK_FIELD(PFM_BORDER, wBorderSpace);
953 CHECK_FIELD(PFM_BORDER, wBorderWidth);
954 CHECK_FIELD(PFM_BORDER, wBorders);
955 }
956#undef CHECK_FIELD
957 }
958}
959
961{
962 const PARAFORMAT2 *host_fmt;
963 HRESULT hr;
964
965 ZeroMemory(pFmt, sizeof(PARAFORMAT2));
966 pFmt->cbSize = sizeof(PARAFORMAT2);
967 pFmt->dwMask = PFM_ALL2;
968 pFmt->wAlignment = PFA_LEFT;
969 pFmt->sStyle = -1;
970 pFmt->bOutlineLevel = TRUE;
971
972 hr = ITextHost_TxGetParaFormat( editor->texthost, (const PARAFORMAT **)&host_fmt );
973 if (SUCCEEDED(hr))
974 {
975 /* Just use the alignment for now */
976 if (host_fmt->dwMask & PFM_ALIGNMENT)
977 pFmt->wAlignment = host_fmt->wAlignment;
979 }
980}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Arabic default style
Definition: afstyles.h:94
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define ERR(fmt,...)
Definition: precomp.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define lstrcpyW
Definition: compat.h:749
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1230
const WCHAR * text
Definition: package.c:1794
void ME_DestroyContext(ME_Context *c)
Definition: context.c:44
void ME_InitContext(ME_Context *c, ME_TextEditor *editor, HDC hDC)
Definition: context.c:23
ME_Paragraph * editor_first_para(ME_TextEditor *editor)
Definition: editor.c:279
ME_Paragraph * editor_end_para(ME_TextEditor *editor)
Definition: editor.c:285
#define swprintf
Definition: precomp.h:40
#define assert(x)
Definition: debug.h:53
void ME_ReleaseStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:462
void ME_InitCharFormat2W(CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: style.c:150
#define ITextHost_OnTxParaFormatChange(This, a)
Definition: editor.h:366
void ME_AddRefStyle(ME_Style *item) DECLSPEC_HIDDEN
Definition: style.c:454
BOOL cfany_to_cf2w(CHARFORMAT2W *to, const CHARFORMAT2W *from) DECLSPEC_HIDDEN
Definition: style.c:36
void ME_CheckCharOffsets(ME_TextEditor *editor) DECLSPEC_HIDDEN
Definition: run.c:173
ME_Run * run_create(ME_Style *s, int nFlags) DECLSPEC_HIDDEN
Definition: run.c:343
ME_Style * ME_ApplyStyle(ME_TextEditor *ed, ME_Style *sSrc, CHARFORMAT2W *style) DECLSPEC_HIDDEN
Definition: style.c:156
void editor_propagate_char_ofs(ME_Paragraph *para, ME_Run *run, int shift) DECLSPEC_HIDDEN
Definition: run.c:147
static ME_DisplayItem * para_get_di(ME_Paragraph *para)
Definition: editor.h:237
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN
Definition: list.c:115
ME_DisplayItem * ME_FindItemBack(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:66
void select_style(ME_Context *c, ME_Style *s) DECLSPEC_HIDDEN
Definition: style.c:369
#define ITextHost_TxGetParaFormat(This, a)
Definition: editor.h:357
ME_Style * ME_MakeStyle(CHARFORMAT2W *style) DECLSPEC_HIDDEN
Definition: style.c:121
static ME_DisplayItem * run_get_di(ME_Run *run)
Definition: editor.h:163
ME_String * ME_MakeStringConst(const WCHAR *str, int len) DECLSPEC_HIDDEN
Definition: string.c:41
ME_String * ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN
Definition: string.c:75
ME_Run * run_next(ME_Run *run) DECLSPEC_HIDDEN
Definition: run.c:68
#define ITextHost_TxGetDC(This)
Definition: editor.h:333
static ME_DisplayItem * cell_get_di(ME_Cell *cell)
Definition: editor.h:319
BOOL ME_AppendString(ME_String *s, const WCHAR *append, int len) DECLSPEC_HIDDEN
Definition: string.c:126
ME_Cell * cell_next(ME_Cell *cell) DECLSPEC_HIDDEN
Definition: table.c:192
ME_Cell * cell_create(void) DECLSPEC_HIDDEN
Definition: table.c:186
void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod) DECLSPEC_HIDDEN
Definition: style.c:524
#define ITextHost_TxReleaseDC(This, a)
Definition: editor.h:334
void ME_Remove(ME_DisplayItem *diWhere) DECLSPEC_HIDDEN
Definition: list.c:35
BOOL add_undo_set_para_fmt(ME_TextEditor *, const ME_Paragraph *para) DECLSPEC_HIDDEN
Definition: undo.c:152
ME_String * ME_MakeStringEmpty(int len) DECLSPEC_HIDDEN
Definition: string.c:58
BOOL add_undo_join_paras(ME_TextEditor *, int pos) DECLSPEC_HIDDEN
Definition: undo.c:176
void ME_InsertBefore(ME_DisplayItem *diWhere, ME_DisplayItem *diWhat) DECLSPEC_HIDDEN
Definition: list.c:26
void ME_DestroyString(ME_String *s) DECLSPEC_HIDDEN
Definition: string.c:96
ME_DisplayItem * ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN
Definition: list.c:133
ME_Cell * cell_prev(ME_Cell *cell) DECLSPEC_HIDDEN
Definition: table.c:197
BOOL add_undo_split_para(ME_TextEditor *, const ME_Paragraph *para, ME_String *eol_str, const ME_Cell *cell) DECLSPEC_HIDDEN
Definition: undo.c:185
ME_DisplayItem * ME_FindItemFwd(ME_DisplayItem *di, ME_DIType nTypeOrClass) DECLSPEC_HIDDEN
Definition: list.c:89
#define ITextHost_TxGetCharFormat(This, a)
Definition: editor.h:356
ME_String * ME_VSplitString(ME_String *orig, int nVPos) DECLSPEC_HIDDEN
Definition: string.c:131
void ME_SetCharFormat(ME_TextEditor *editor, ME_Cursor *start, ME_Cursor *end, CHARFORMAT2W *pFmt) DECLSPEC_HIDDEN
Definition: run.c:777
#define MERF_ENDPARA
Definition: editstr.h:121
#define MERF_HIDDEN
Definition: editstr.h:125
#define MERF_ENDCELL
Definition: editstr.h:108
#define MEPF_CELL
Definition: editstr.h:142
#define MEPF_ROWSTART
Definition: editstr.h:143
#define MEPF_ROWEND
Definition: editstr.h:144
@ diStartRow
Definition: editstr.h:87
@ diRun
Definition: editstr.h:86
@ diStartRowOrParagraph
Definition: editstr.h:91
@ diParagraph
Definition: editstr.h:84
#define MERF_TABLESTART
Definition: editstr.h:127
#define MEPF_REWRAP
Definition: editstr.h:140
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
size_t total
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const GLint * first
Definition: glext.h:5794
GLfloat GLfloat p
Definition: glext.h:8902
GLuint GLuint num
Definition: glext.h:9618
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
uint32_t entry
Definition: isohybrid.c:63
#define c
Definition: ke_i.h:80
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define sprintf(buf, format,...)
Definition: sprintf.c:55
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static int pints_t pn[]
Definition: server.c:129
static ATOM item
Definition: dde.c:856
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
ME_Row * para_first_row(ME_Paragraph *para)
Definition: para.c:132
void editor_get_selection_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *fmt)
Definition: para.c:905
static void para_mark_rewrap_paras(ME_TextEditor *editor, ME_Paragraph *first, const ME_Paragraph *end)
Definition: para.c:228
void editor_set_default_para_fmt(ME_TextEditor *editor, PARAFORMAT2 *pFmt)
Definition: para.c:960
static ME_String * para_num_get_str(ME_Paragraph *para, WORD num)
Definition: para.c:279
#define DUMP(mask, name, fmt, field)
#define EFFECTS_MASK
ME_Row * para_end_row(ME_Paragraph *para)
Definition: para.c:141
ME_Paragraph * para_split(ME_TextEditor *editor, ME_Run *run, ME_Style *style, const WCHAR *eol_str, int eol_len, int paraFlags)
Definition: para.c:540
void para_num_init(ME_Context *c, ME_Paragraph *para)
Definition: para.c:392
void ME_DumpParaStyleToBuf(const PARAFORMAT2 *pFmt, char buf[2048])
Definition: para.c:787
void para_mark_remove(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:94
static ME_Paragraph * para_create(ME_TextEditor *editor)
Definition: para.c:32
ME_Run * para_end_run(ME_Paragraph *para)
Definition: para.c:117
static int para_num_get_num(ME_Paragraph *para)
Definition: para.c:266
ME_Cell * para_cell(ME_Paragraph *para)
Definition: para.c:127
void para_num_clear(struct para_num *pn)
Definition: para.c:436
BOOL editor_set_selection_para_fmt(ME_TextEditor *editor, const PARAFORMAT2 *fmt)
Definition: para.c:875
void para_mark_add(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:99
#define CHECK_FIELD(m, f)
void editor_get_selection_paras(ME_TextEditor *editor, ME_Paragraph **para, ME_Paragraph **para_end)
Definition: para.c:850
ME_Paragraph * para_join(ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt)
Definition: para.c:683
BOOL para_in_table(ME_Paragraph *para)
Definition: para.c:122
#define DUMP_EFFECT(mask, name)
void editor_mark_rewrap_all(ME_TextEditor *editor)
Definition: para.c:237
static BOOL para_set_fmt(ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *pFmt)
Definition: para.c:458
void para_mark_rewrap(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:26
int get_total_width(ME_TextEditor *editor)
Definition: para.c:69
static void table_update_flags(ME_Paragraph *para)
Definition: para.c:242
void ME_MakeFirstParagraph(ME_TextEditor *editor)
Definition: para.c:151
ME_Run * para_first_run(ME_Paragraph *para)
Definition: para.c:104
static int para_mark_compare(const void *key, const struct wine_rb_entry *entry)
Definition: para.c:87
ME_Paragraph * para_prev(ME_Paragraph *para)
Definition: para.c:63
static BOOL para_num_same_list(const PARAFORMAT2 *item, const PARAFORMAT2 *base)
Definition: para.c:258
ME_Paragraph * para_next(ME_Paragraph *para)
Definition: para.c:57
void para_destroy(ME_TextEditor *editor, ME_Paragraph *para)
Definition: para.c:42
static void para_copy_fmt(const ME_Paragraph *para, PARAFORMAT2 *fmt)
Definition: para.c:891
#define COPY_FIELD(m, f)
static void para_num_clear_list(ME_TextEditor *editor, ME_Paragraph *para, const PARAFORMAT2 *orig_fmt)
Definition: para.c:447
long LONG
Definition: pedump.c:60
static unsigned __int64 next
Definition: rand_nt.c:6
#define PFN_UCLETTER
Definition: richedit.h:908
#define PFM_SPACEBEFORE
Definition: richedit.h:847
#define MAX_TAB_STOPS
Definition: richedit.h:218
#define CFM_PROTECTED
Definition: richedit.h:336
#define PFA_RIGHT
Definition: richedit.h:922
#define PFA_CENTER
Definition: richedit.h:923
#define PFM_OFFSETINDENT
Definition: richedit.h:844
#define PFM_NUMBERING
Definition: richedit.h:843
#define CFM_STRIKEOUT
Definition: richedit.h:335
#define CFM_SMALLCAPS
Definition: richedit.h:338
#define PFN_ARABIC
Definition: richedit.h:906
#define CFE_STRIKEOUT
Definition: richedit.h:409
#define CFE_BOLD
Definition: richedit.h:406
#define CFM_SHADOW
Definition: richedit.h:342
#define CFM_STYLE
Definition: richedit.h:351
#define PFA_LEFT
Definition: richedit.h:921
#define CFE_AUTOCOLOR
Definition: richedit.h:414
#define CFM_IMPRINT
Definition: richedit.h:344
#define PFM_NOLINENUMBER
Definition: richedit.h:860
#define PFM_KEEPNEXT
Definition: richedit.h:858
#define PFM_NUMBERINGSTYLE
Definition: richedit.h:853
#define PFM_DONOTHYPHEN
Definition: richedit.h:862
#define CFM_OFFSET
Definition: richedit.h:359
#define CFM_WEIGHT
Definition: richedit.h:354
#define CFE_ITALIC
Definition: richedit.h:407
#define PFNS_NEWNUMBER
Definition: richedit.h:918
#define PFM_LINESPACING
Definition: richedit.h:849
#define CFM_OUTLINE
Definition: richedit.h:341
#define PFM_OFFSET
Definition: richedit.h:840
#define PFN_LCLETTER
Definition: richedit.h:907
#define CFM_SPACING
Definition: richedit.h:353
#define CFM_EMBOSS
Definition: richedit.h:343
#define CFM_SUBSCRIPT
Definition: richedit.h:348
#define PFN_UCROMAN
Definition: richedit.h:910
#define PFM_ALL2
Definition: richedit.h:892
#define CFM_CHARSET
Definition: richedit.h:358
#define CFM_HIDDEN
Definition: richedit.h:340
#define PFM_SHADING
Definition: richedit.h:852
#define PFM_RIGHTINDENT
Definition: richedit.h:839
#define CFE_UNDERLINE
Definition: richedit.h:408
#define CFM_BACKCOLOR
Definition: richedit.h:357
#define CFM_DISABLED
Definition: richedit.h:345
#define CFM_KERNING
Definition: richedit.h:352
#define PFM_TABLE
Definition: richedit.h:870
#define PFNS_PAREN
Definition: richedit.h:913
#define PFN_BULLET
Definition: richedit.h:905
#define CFM_ITALIC
Definition: richedit.h:333
#define CFU_UNDERLINE
Definition: richedit.h:428
struct _paraformat2 PARAFORMAT2
#define CFM_LCID
Definition: richedit.h:356
#define CFM_LINK
Definition: richedit.h:337
#define CFM_SIZE
Definition: richedit.h:362
#define PFM_NOWIDOWCONTROL
Definition: richedit.h:861
#define PFM_PAGEBREAKBEFORE
Definition: richedit.h:859
#define PFE_TABLE
Definition: richedit.h:944
#define CFM_REVISED
Definition: richedit.h:346
#define PFM_BORDER
Definition: richedit.h:851
#define PFM_ALIGNMENT
Definition: richedit.h:841
#define CFE_AUTOBACKCOLOR
Definition: richedit.h:425
#define CFM_REVAUTHOR
Definition: richedit.h:347
#define PFM_SIDEBYSIDE
Definition: richedit.h:863
#define PFA_JUSTIFY
Definition: richedit.h:924
#define CFM_ANIMATION
Definition: richedit.h:350
#define PFM_TABSTOPS
Definition: richedit.h:842
#define PFM_TABLEROWDELIMITER
Definition: richedit.h:868
#define PFN_LCROMAN
Definition: richedit.h:909
#define PFM_STYLE
Definition: richedit.h:850
#define PFNS_PARENS
Definition: richedit.h:914
#define PFM_ALL
Definition: richedit.h:872
#define CFM_BOLD
Definition: richedit.h:332
#define CFM_UNDERLINETYPE
Definition: richedit.h:355
#define PFM_KEEP
Definition: richedit.h:857
#define CFM_FACE
Definition: richedit.h:360
#define PFM_RTLPARA
Definition: richedit.h:856
#define PFM_SPACEAFTER
Definition: richedit.h:848
#define CFM_UNDERLINE
Definition: richedit.h:334
#define PFE_TABLEROWDELIMITER
Definition: richedit.h:942
#define CFM_COLOR
Definition: richedit.h:361
#define CFM_ALLCAPS
Definition: richedit.h:339
#define PFM_STARTINDENT
Definition: richedit.h:838
#define PFNS_PERIOD
Definition: richedit.h:915
#define PFM_NUMBERINGSTART
Definition: richedit.h:855
#define PFM_NUMBERINGTAB
Definition: richedit.h:854
const WCHAR * str
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
static void wine_rb_remove_key(struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:392
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
HRESULT hr
Definition: shlfolder.c:183
BYTE lfStrikeOut
Definition: dimm.idl:66
BYTE lfItalic
Definition: dimm.idl:64
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfUnderline
Definition: dimm.idl:65
BYTE lfCharSet
Definition: dimm.idl:67
BYTE lfPitchAndFamily
Definition: dimm.idl:71
LONG cx
Definition: kdterminal.h:27
BYTE bOutlineLevel
Definition: richedit.h:678
WORD wNumberingStart
Definition: richedit.h:680
WORD wAlignment
Definition: richedit.h:673
DWORD dwMask
Definition: richedit.h:667
SHORT sStyle
Definition: richedit.h:677
WORD wNumberingStyle
Definition: richedit.h:680
UINT cbSize
Definition: richedit.h:666
LONG rgxTabs[MAX_TAB_STOPS]
Definition: richedit.h:675
WORD wNumbering
Definition: richedit.h:668
SHORT cTabCount
Definition: richedit.h:674
WORD wEffects
Definition: richedit.h:669
LONG dxStartIndent
Definition: richedit.h:670
Definition: dsound.c:943
Definition: copy.c:22
struct tagME_Cell * parent_cell
Definition: editstr.h:228
struct tagME_Cell * next_cell
Definition: editstr.h:228
struct tagME_Cell * prev_cell
Definition: editstr.h:228
int nNestingLevel
Definition: editstr.h:222
ME_Paragraph * para
Definition: editstr.h:274
int nOffset
Definition: editstr.h:276
ME_Run * run
Definition: editstr.h:275
ME_DIType type
Definition: editstr.h:255
union tagME_DisplayItem::@555 member
struct tagME_DisplayItem * next
Definition: editstr.h:256
ME_Paragraph para
Definition: editstr.h:261
struct tagME_DisplayItem * next_para
Definition: editstr.h:216
struct para_num para_num
Definition: editstr.h:214
ME_String * text
Definition: editstr.h:204
struct tagME_Cell * cell
Definition: editstr.h:206
struct wine_rb_entry marked_entry
Definition: editstr.h:217
ME_BorderRect border
Definition: editstr.h:207
struct tagME_DisplayItem * prev_para
Definition: editstr.h:216
PARAFORMAT2 fmt
Definition: editstr.h:203
ME_Run * eop_run
Definition: editstr.h:215
int nCharOfs
Definition: editstr.h:161
struct tagME_Paragraph * para
Definition: editstr.h:160
ME_Style * style
Definition: editstr.h:159
int len
Definition: editstr.h:162
ME_DisplayItem * pFirst
Definition: editstr.h:267
ME_DisplayItem * pLast
Definition: editstr.h:267
ME_Paragraph * last_sel_end_para
Definition: editstr.h:411
ITextHost2 * texthost
Definition: editstr.h:384
ME_Paragraph * last_sel_start_para
Definition: editstr.h:411
ME_Cursor * pCursors
Definition: editstr.h:389
ME_TextBuffer * pBuffer
Definition: editstr.h:388
struct wine_rb_tree marked_paras
Definition: editstr.h:451
unsigned int bEmulateVersion10
Definition: editstr.h:385
Definition: rbtree.h:36
#define max(a, b)
Definition: svc.c:63
#define HIWORD(l)
Definition: typedefs.h:247
#define ZeroMemory
Definition: winbase.h:1737
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
#define FW_NORMAL
Definition: wingdi.h:373
#define SYSTEM_FONT
Definition: wingdi.h:911
#define SYMBOL_CHARSET
Definition: wingdi.h:385
__wchar_t WCHAR
Definition: xmlstorage.h:180