1 /************************************************************************/
2 /* */
3 /* Format changes to the document/selection. */
4 /* */
5 /************************************************************************/
6
7 # include "tedConfig.h"
8
9 # include <stddef.h>
10 # include <stdio.h>
11 # include <ctype.h>
12
13 # include <docLayout.h>
14 # include "tedEdit.h"
15 # include "tedDocFront.h"
16 # include "tedLayout.h"
17 # include "tedDocument.h"
18 # include <docRtfTrace.h>
19 # include <docParaRulerAdmin.h>
20 # include <docEditCommand.h>
21
22 # include <appDebugon.h>
23
24 /************************************************************************/
25 /* */
26 /* Change properties of the current selection. */
27 /* */
28 /************************************************************************/
29
tedEditChangeSelectionPropertiesImpl(TedEditOperation * teo,const DocumentSelection * ds,const PropertyMask * taSetMask,const TextAttribute * taSet,const PropertyMask * ppSetMask,const ParagraphProperties * ppSet,const PropertyMask * cpSetMask,const CellProperties * cpSet,const PropertyMask * rpSetMask,const RowProperties * rpSet,const PropertyMask * spSetMask,const SectionProperties * spSet,const PropertyMask * dpSetMask,const DocumentProperties * dpSet)30 int tedEditChangeSelectionPropertiesImpl(
31 TedEditOperation * teo,
32 const DocumentSelection * ds,
33
34 const PropertyMask * taSetMask,
35 const TextAttribute * taSet,
36
37 const PropertyMask * ppSetMask,
38 const ParagraphProperties * ppSet,
39
40 const PropertyMask * cpSetMask,
41 const CellProperties * cpSet,
42
43 const PropertyMask * rpSetMask,
44 const RowProperties * rpSet,
45
46 const PropertyMask * spSetMask,
47 const SectionProperties * spSet,
48
49 const PropertyMask * dpSetMask,
50 const DocumentProperties * dpSet )
51 {
52 int rval = 0;
53 EditOperation * eo= &(teo->teoEo);
54 BufferDocument * bd= eo->eoDocument;
55
56 PropertyMask selTaDoneMask;
57 PropertyMask selPpDoneMask;
58 PropertyMask selCpDoneMask;
59 PropertyMask selRpDoneMask;
60 PropertyMask selSpDoneMask;
61 PropertyMask docDpDoneMask;
62
63 if ( taSetMask && utilPropMaskIsEmpty( taSetMask ) )
64 { taSetMask= (const PropertyMask *)0; }
65 if ( ppSetMask && utilPropMaskIsEmpty( ppSetMask ) )
66 { ppSetMask= (const PropertyMask *)0; }
67 if ( cpSetMask && utilPropMaskIsEmpty( cpSetMask ) )
68 { cpSetMask= (const PropertyMask *)0; }
69 if ( rpSetMask && utilPropMaskIsEmpty( rpSetMask ) )
70 { rpSetMask= (const PropertyMask *)0; }
71 if ( spSetMask && utilPropMaskIsEmpty( spSetMask ) )
72 { spSetMask= (const PropertyMask *)0; }
73 if ( dpSetMask && utilPropMaskIsEmpty( dpSetMask ) )
74 { dpSetMask= (const PropertyMask *)0; }
75
76 utilPropMaskClear( &selTaDoneMask );
77 utilPropMaskClear( &selPpDoneMask );
78 utilPropMaskClear( &selCpDoneMask );
79 utilPropMaskClear( &selRpDoneMask );
80 utilPropMaskClear( &selSpDoneMask );
81 utilPropMaskClear( &docDpDoneMask );
82
83 if ( docChangeSelectionProperties( eo, ds,
84 &selTaDoneMask, taSetMask, taSet,
85 &selPpDoneMask, ppSetMask, ppSet,
86 &selCpDoneMask, cpSetMask, cpSet,
87 &selRpDoneMask, rpSetMask, rpSet,
88 &selSpDoneMask, spSetMask, spSet,
89 &docDpDoneMask, dpSetMask, dpSet ) )
90 { LDEB(1); rval= -1; goto ready; }
91
92 if ( taSetMask )
93 {
94 PropertyMask taDoneMask;
95
96 utilPropMaskClear( &taDoneMask );
97
98 utilUpdateTextAttribute( &taDoneMask, &(teo->teoSavedTextAttribute),
99 taSetMask, taSet );
100 if ( ! utilPropMaskIsEmpty( &taDoneMask ) )
101 {
102 teo->teoSavedTextAttributeNumber= docTextAttributeNumber( bd,
103 &(teo->teoSavedTextAttribute) );
104 }
105 }
106
107 if ( dpSetMask || spSetMask )
108 {
109 PropertyMask dgDoneMask;
110 PropertyMask dgMask;
111 PropertyMask mask;
112
113 utilPropMaskClear( &dgDoneMask );
114 utilPropMaskClear( &dgMask );
115 utilPropMaskFill( &dgMask, DGprop_COUNT );
116
117 utilPropMaskAnd( &mask, &selSpDoneMask, &dgMask );
118 utilPropMaskOr( &dgDoneMask, &dgDoneMask, &mask );
119
120 utilPropMaskAnd( &mask, &docDpDoneMask, &dgMask );
121 utilPropMaskOr( &dgDoneMask, &dgDoneMask, &mask );
122
123 if ( ! utilPropMaskIsEmpty( &dgDoneMask ) )
124 { teo->teoRefreshScreenRectangle= 1; }
125 }
126
127 ready:
128
129 return rval;
130 }
131
132 /************************************************************************/
133 /* */
134 /* Change properties of the current selection. */
135 /* */
136 /************************************************************************/
137
tedEditChangeSelectionProperties(TedEditOperation * teo,const DocumentSelection * ds,int level,int command,const PropertyMask * taSetMask,const TextAttribute * taSet,const PropertyMask * ppSetMask,const ParagraphProperties * ppSet,const PropertyMask * cpSetMask,const CellProperties * cpSet,const PropertyMask * rpSetMask,const RowProperties * rpSet,const PropertyMask * spSetMask,const SectionProperties * spSet,const PropertyMask * dpSetMask,const DocumentProperties * dpSet)138 int tedEditChangeSelectionProperties(
139 TedEditOperation * teo,
140 const DocumentSelection * ds,
141 int level,
142 int command,
143
144 const PropertyMask * taSetMask,
145 const TextAttribute * taSet,
146
147 const PropertyMask * ppSetMask,
148 const ParagraphProperties * ppSet,
149
150 const PropertyMask * cpSetMask,
151 const CellProperties * cpSet,
152
153 const PropertyMask * rpSetMask,
154 const RowProperties * rpSet,
155
156 const PropertyMask * spSetMask,
157 const SectionProperties * spSet,
158
159 const PropertyMask * dpSetMask,
160 const DocumentProperties * dpSet )
161 {
162 int rval = 0;
163 EditOperation * eo= &(teo->teoEo);
164
165 DocumentSelection dsTraced= *ds;
166
167 if ( taSetMask && utilPropMaskIsEmpty( taSetMask ) )
168 { taSetMask= (const PropertyMask *)0; }
169 if ( ppSetMask && utilPropMaskIsEmpty( ppSetMask ) )
170 { ppSetMask= (const PropertyMask *)0; }
171 if ( cpSetMask && utilPropMaskIsEmpty( cpSetMask ) )
172 { cpSetMask= (const PropertyMask *)0; }
173 if ( rpSetMask && utilPropMaskIsEmpty( rpSetMask ) )
174 { rpSetMask= (const PropertyMask *)0; }
175 if ( spSetMask && utilPropMaskIsEmpty( spSetMask ) )
176 { spSetMask= (const PropertyMask *)0; }
177 if ( dpSetMask && utilPropMaskIsEmpty( dpSetMask ) )
178 { dpSetMask= (const PropertyMask *)0; }
179
180 if ( tedEditStartStep( teo, command ) )
181 { LDEB(1); rval= -1; goto ready; }
182
183 if ( teo->teoEditTrace )
184 {
185 if ( docRtfTraceOldProperties( &dsTraced, eo, level,
186 taSetMask, ppSetMask,
187 cpSetMask, rpSetMask,
188 spSetMask, dpSetMask ) )
189 { LDEB(1); rval= -1; goto ready; }
190
191 if ( docRtfTraceNewProperties( eo,
192 taSetMask, taSet,
193 ppSetMask, ppSet,
194 cpSetMask, cpSet,
195 rpSetMask, rpSet,
196 spSetMask, spSet,
197 dpSetMask, dpSet ) )
198 { LDEB(1); rval= -1; goto ready; }
199 }
200
201 if ( tedEditChangeSelectionPropertiesImpl( teo, &dsTraced,
202 taSetMask, taSet,
203 ppSetMask, ppSet,
204 cpSetMask, cpSet,
205 rpSetMask, rpSet,
206 spSetMask, spSet,
207 dpSetMask, dpSet ) )
208 { LDEB(1); rval= -1; goto ready; }
209
210 if ( cpSetMask )
211 {
212 EditRange * er= &(eo->eoSelectedRange);
213 DocumentSelection dsNew;
214
215 docInitDocumentSelection( &dsNew );
216
217 if ( docSelectionForEditPositionsInTree( &dsNew, eo->eoTree,
218 &(er->erHead), &(er->erTail) ) )
219 { LDEB(1); return -1; }
220
221 if ( dsNew.dsCol0 >= 0 && dsNew.dsCol1 >= 0 )
222 { docAvoidMergedTail( &dsNew, er ); }
223 }
224
225 docSetEditRange( &(eo->eoAffectedRange), &dsTraced );
226
227 if ( tedEditFinishOldSelection( teo ) )
228 { LDEB(1); rval= -1; goto ready; }
229
230 if ( teo->teoEditTrace )
231 {
232 docRtfTraceNewPosition( eo, (const SelectionScope *)0, SELposALL );
233 }
234
235 /* Activate text attribute setting for future typing */
236 if ( docIsIBarSelection( ds ) && taSetMask )
237 {
238 EditDocument * ed= teo->teoEditDocument;
239 TedDocument * td= (TedDocument *)ed->edPrivateData;
240 BufferDocument * bd= td->tdDocument;
241 SelectionDescription * sd= &(td->tdSelectionDescription);
242 TextAttribute * ta= &(sd->sdTextAttribute);
243
244 PropertyMask taDoneMask;
245
246 utilPropMaskClear( &taDoneMask );
247
248 utilUpdateTextAttribute( &taDoneMask, ta, taSetMask, taSet );
249
250 if ( ! utilPropMaskIsEmpty( &taDoneMask ) )
251 {
252 const IndexMapping * a2s= &(td->tdAttributeToScreenFont);
253
254 sd->sdTextAttributeNumber= docTextAttributeNumber( bd, ta );
255
256 td->tdCurrentScreenFont= utilIndexMappingGet( a2s,
257 td->tdSelectionDescription.sdTextAttributeNumber );
258 }
259 }
260
261 tedFinishEditOperation( teo );
262
263 ready:
264
265 return rval;
266 }
267
tedDocChangeSelectionProperties(EditDocument * ed,int command,const PropertyMask * taSetMask,const TextAttribute * taSet,const PropertyMask * ppSetMask,const ParagraphProperties * ppSet,const PropertyMask * cpSetMask,const CellProperties * cpSet,const PropertyMask * rpSetMask,const RowProperties * rpSet,const PropertyMask * spSetMask,const SectionProperties * spSet,const PropertyMask * dpSetMask,const DocumentProperties * dpSet,int traced)268 static int tedDocChangeSelectionProperties(
269 EditDocument * ed,
270 int command,
271
272 const PropertyMask * taSetMask,
273 const TextAttribute * taSet,
274
275 const PropertyMask * ppSetMask,
276 const ParagraphProperties * ppSet,
277
278 const PropertyMask * cpSetMask,
279 const CellProperties * cpSet,
280
281 const PropertyMask * rpSetMask,
282 const RowProperties * rpSet,
283
284 const PropertyMask * spSetMask,
285 const SectionProperties * spSet,
286
287 const PropertyMask * dpSetMask,
288 const DocumentProperties * dpSet,
289
290 int traced )
291 {
292 int rval= 0;
293 const int level= DOClevSPAN;
294
295 TedEditOperation teo;
296 EditOperation * eo= &(teo.teoEo);
297 SelectionGeometry sg;
298 SelectionDescription sd;
299
300 DocumentSelection ds;
301
302 const int fullWidth= 1;
303
304 tedStartEditOperation( &teo, &sg, &sd, ed, fullWidth, traced );
305
306 docEditOperationGetSelection( &ds, eo );
307
308 if ( tedEditChangeSelectionProperties( &teo, &ds, level, command,
309 taSetMask, taSet,
310 ppSetMask, ppSet,
311 cpSetMask, cpSet,
312 rpSetMask, rpSet,
313 spSetMask, spSet,
314 dpSetMask, dpSet ) )
315 { LDEB(1); rval= -1; goto ready; }
316
317 ready:
318
319 tedCleanEditOperation( &teo );
320
321 return rval;
322 }
323
324 /************************************************************************/
325 /* */
326 /* Utility routines around tedDocChangeSelectionProperties(): */
327 /* */
328 /************************************************************************/
329
tedDocChangeSectionProperties(EditDocument * ed,const PropertyMask * spSetMask,const SectionProperties * spSet,int traced)330 int tedDocChangeSectionProperties( EditDocument * ed,
331 const PropertyMask * spSetMask,
332 const SectionProperties * spSet,
333 int traced )
334 {
335 if ( tedDocChangeSelectionProperties( ed, EDITcmdUPD_SECT_PROPS,
336 (const PropertyMask *)0, (const TextAttribute *)0,
337 (const PropertyMask *)0, (const ParagraphProperties *)0,
338 (const PropertyMask *)0, (const CellProperties *)0,
339 (const PropertyMask *)0, (const RowProperties *)0,
340 spSetMask, spSet,
341 (const PropertyMask *)0, (const DocumentProperties *)0,
342 traced ) )
343 { XDEB(spSetMask); return -1; }
344
345 return 0;
346 }
347
tedDocChangeParagraphProperties(EditDocument * ed,const PropertyMask * ppSetMask,const ParagraphProperties * ppSet,int traced)348 int tedDocChangeParagraphProperties(
349 EditDocument * ed,
350 const PropertyMask * ppSetMask,
351 const ParagraphProperties * ppSet,
352 int traced )
353 {
354 if ( tedDocChangeSelectionProperties( ed, EDITcmdUPD_PARA_PROPS,
355 (const PropertyMask *)0, (const TextAttribute *)0,
356 ppSetMask, ppSet,
357 (const PropertyMask *)0, (const CellProperties *)0,
358 (const PropertyMask *)0, (const RowProperties *)0,
359 (const PropertyMask *)0, (const SectionProperties *)0,
360 (const PropertyMask *)0, (const DocumentProperties *)0,
361 traced ) )
362 { XDEB(ppSetMask); return -1; }
363
364 return 0;
365 }
366
tedDocChangeTextAttribute(EditDocument * ed,const PropertyMask * taSetMask,const TextAttribute * taSet,int traced)367 void tedDocChangeTextAttribute( EditDocument * ed,
368 const PropertyMask * taSetMask,
369 const TextAttribute * taSet,
370 int traced )
371 {
372 LayoutContext lc;
373
374 layoutInitContext( &lc );
375 tedSetScreenLayoutContext( &lc, ed );
376
377 if ( tedDocChangeSelectionProperties( ed, EDITcmdUPD_SPAN_PROPS,
378 taSetMask, taSet,
379 (const PropertyMask *)0, (const ParagraphProperties *)0,
380 (const PropertyMask *)0, (const CellProperties *)0,
381 (const PropertyMask *)0, (const RowProperties *)0,
382 (const PropertyMask *)0, (const SectionProperties *)0,
383 (const PropertyMask *)0, (const DocumentProperties *)0,
384 traced ) )
385 { LDEB(1); }
386
387 return;
388 }
389
390 /************************************************************************/
391 /* */
392 /* Change table properties. */
393 /* */
394 /************************************************************************/
395
tedDocSetTableProperties(EditDocument * ed,int wholeRow,int wholeColumn,const PropertyMask * cpSetMask,const CellProperties * cpSet,const PropertyMask * rpSetMask,const RowProperties * rpSet,int traced)396 int tedDocSetTableProperties( EditDocument * ed,
397 int wholeRow,
398 int wholeColumn,
399 const PropertyMask * cpSetMask,
400 const CellProperties * cpSet,
401 const PropertyMask * rpSetMask,
402 const RowProperties * rpSet,
403 int traced )
404 {
405 int rval= 0;
406
407 TedEditOperation teo;
408 EditOperation * eo= &(teo.teoEo);
409 SelectionGeometry sg;
410 SelectionDescription sd;
411
412 DocumentSelection ds;
413
414 int level= DOClevCELL;
415 int command= EDITcmdUPD_TABLE_PROPS;
416
417 const int fullWidth= 1;
418
419 tedStartEditOperation( &teo, &sg, &sd, ed, fullWidth, traced );
420
421 docInitDocumentSelection( &ds );
422
423 docEditOperationGetSelection( &ds, eo );
424
425 if ( wholeRow )
426 {
427 if ( wholeColumn )
428 { level= DOClevTABLE; }
429 else{ level= DOClevROW; }
430 }
431 else{
432 if ( wholeColumn )
433 { level= DOClevCOLUMN; }
434 else{ level= DOClevCELL; }
435 }
436
437 if ( tedEditChangeSelectionProperties( &teo, &ds,
438 level, command,
439 (const PropertyMask *)0, (const TextAttribute *)0,
440 (const PropertyMask *)0, (const ParagraphProperties *)0,
441 cpSetMask, cpSet, rpSetMask, rpSet,
442 (const PropertyMask *)0, (const SectionProperties *)0,
443 (const PropertyMask *)0, (const DocumentProperties *)0 ) )
444 { LDEB(1); rval= -1; goto ready; }
445
446 ready:
447
448 tedCleanEditOperation( &teo );
449
450 return rval;
451 }
452
453 /************************************************************************/
454 /* */
455 /* Change the tabs of a paragraph. */
456 /* */
457 /************************************************************************/
458
tedDocSetParagraphTabs(EditDocument * ed,const TabStopList * tsl,int traced)459 int tedDocSetParagraphTabs( EditDocument * ed,
460 const TabStopList * tsl,
461 int traced )
462 {
463 TedDocument * td= (TedDocument *)ed->edPrivateData;
464 BufferDocument * bd= td->tdDocument;
465
466 ParagraphProperties ppSet;
467 PropertyMask ppSetMask;
468
469 docInitParagraphProperties( &ppSet );
470 utilPropMaskClear( &ppSetMask );
471 PROPmaskADD( &ppSetMask, PPpropTAB_STOPS );
472
473 ppSet.ppTabStopListNumber= docTabStopListNumber( bd, tsl );
474
475 return tedDocChangeParagraphProperties( ed, &ppSetMask, &ppSet, traced );
476 }
477
478 /************************************************************************/
479 /* */
480 /* Change properties of all sections. */
481 /* */
482 /* 9) Eventually this routine must be combined with the set document */
483 /* properties routine. Now it is called in conjunction with its */
484 /* colleague that takes care of reformats and redraws. */
485 /* */
486 /************************************************************************/
487
tedDocChangeAllSectionProperties(EditDocument * ed,const PropertyMask * spSetMask,const SectionProperties * spSet,const PropertyMask * dpSetMask,const DocumentProperties * dpSet,int traced)488 int tedDocChangeAllSectionProperties(
489 EditDocument * ed,
490 const PropertyMask * spSetMask,
491 const SectionProperties * spSet,
492 const PropertyMask * dpSetMask,
493 const DocumentProperties * dpSet,
494 int traced )
495 {
496 int rval= 0;
497
498 TedEditOperation teo;
499 EditOperation * eo= &(teo.teoEo);
500 SelectionGeometry sg;
501 SelectionDescription sd;
502
503 DocumentSelection ds;
504
505 const int fullWidth= 1;
506
507 tedStartEditOperation( &teo, &sg, &sd, ed, fullWidth, traced );
508
509 docInitDocumentSelection( &ds );
510
511 if ( docSelectWholeBody( &ds, eo->eoDocument ) )
512 { LDEB(1); rval= -1; goto ready; }
513
514 if ( tedEditChangeSelectionProperties( &teo, &ds,
515 DOClevSECT, EDITcmdUPD_SECTDOC_PROPS,
516 (const PropertyMask *)0, (const TextAttribute *)0,
517 (const PropertyMask *)0, (const ParagraphProperties *)0,
518 (const PropertyMask *)0, (const CellProperties *)0,
519 (const PropertyMask *)0, (const RowProperties *)0,
520 spSetMask, spSet, dpSetMask, dpSet ) )
521 { LDEB(1); rval= -1; goto ready; }
522
523 ready:
524
525 tedCleanEditOperation( &teo );
526
527 return rval;
528 }
529
530 /************************************************************************/
531 /* */
532 /* Change document properties. */
533 /* */
534 /************************************************************************/
535
tedDocSetDocumentProperties(EditDocument * ed,const PropertyMask * dpSetMask,const DocumentProperties * dpSet,int traced)536 int tedDocSetDocumentProperties( EditDocument * ed,
537 const PropertyMask * dpSetMask,
538 const DocumentProperties * dpSet,
539 int traced )
540 {
541 if ( tedDocChangeSelectionProperties( ed, EDITcmdUPD_DOC_PROPS,
542 (const PropertyMask *)0, (const TextAttribute *)0,
543 (const PropertyMask *)0, (const ParagraphProperties *)0,
544 (const PropertyMask *)0, (const CellProperties *)0,
545 (const PropertyMask *)0, (const RowProperties *)0,
546 (const PropertyMask *)0, (const SectionProperties *)0,
547 dpSetMask, dpSet,
548 traced ) )
549 { XDEB(dpSetMask); return -1; }
550
551 return 0;
552 }
553
554 /************************************************************************/
555 /* */
556 /* Menu options to change paragraph alignment. */
557 /* */
558 /************************************************************************/
559
tedDocFormatSetParaAlignment(EditDocument * ed,int align,int traced)560 void tedDocFormatSetParaAlignment( EditDocument * ed,
561 int align,
562 int traced )
563 {
564 ParagraphProperties ppSet;
565 PropertyMask ppSetMask;
566
567 utilPropMaskClear( &ppSetMask );
568 PROPmaskADD( &ppSetMask, PPpropALIGNMENT );
569
570 docInitParagraphProperties( &ppSet );
571 ppSet.ppAlignment= align;
572
573 if ( tedDocChangeParagraphProperties( ed, &ppSetMask, &ppSet, traced ) )
574 { LDEB(1); }
575
576 docCleanParagraphProperties( &ppSet );
577
578 return;
579 }
580
581 /************************************************************************/
582 /* */
583 /* Menu options to change paragraph alignment. */
584 /* */
585 /************************************************************************/
586
tedDocSetParaOutlineLevel(EditDocument * ed,int level,int traced)587 void tedDocSetParaOutlineLevel( EditDocument * ed,
588 int level,
589 int traced )
590 {
591 ParagraphProperties ppSet;
592 PropertyMask ppSetMask;
593
594 utilPropMaskClear( &ppSetMask );
595 PROPmaskADD( &ppSetMask, PPpropOUTLINELEVEL );
596
597 docInitParagraphProperties( &ppSet );
598 ppSet.ppOutlineLevel= level;
599
600 if ( tedDocChangeParagraphProperties( ed, &ppSetMask, &ppSet, traced ) )
601 { LDEB(1); }
602
603 docCleanParagraphProperties( &ppSet );
604
605 return;
606 }
607
608 /************************************************************************/
609 /* */
610 /* Change the document geometry: Callback from the page layout tool */
611 /* etc. */
612 /* */
613 /************************************************************************/
614
tedDocSetPageLayout(EditDocument * ed,const PropertyMask * dgSetMask,const DocumentGeometry * dgSet,int wholeDocument,int traced)615 void tedDocSetPageLayout( EditDocument * ed,
616 const PropertyMask * dgSetMask,
617 const DocumentGeometry * dgSet,
618 int wholeDocument,
619 int traced )
620 {
621 SectionProperties spSet;
622 DocumentProperties dpSet;
623
624 docInitSectionProperties( &spSet );
625 docInitDocumentProperties( &dpSet );
626
627 utilUpdDocumentGeometry( (PropertyMask *)0, &(spSet.spDocumentGeometry),
628 dgSetMask, dgSet );
629 utilUpdDocumentGeometry( (PropertyMask *)0, &(dpSet.dpGeometry),
630 dgSetMask, dgSet );
631
632 if ( wholeDocument )
633 {
634 if ( tedDocChangeAllSectionProperties( ed,
635 dgSetMask, &spSet,
636 dgSetMask, &dpSet,
637 traced ) )
638 { LDEB(wholeDocument); goto ready; }
639 }
640 else{
641 if ( tedDocChangeSectionProperties( ed, dgSetMask, &spSet, traced ) )
642 { XDEB(dgSetMask); goto ready; }
643 }
644
645 ready:
646
647 docCleanSectionProperties( &spSet );
648 docCleanDocumentProperties( &dpSet );
649
650 return;
651 }
652
653 /************************************************************************/
654 /* */
655 /* Increase/Decrease the indentation level of the paragraphs in the */
656 /* selection. */
657 /* */
658 /************************************************************************/
659
tedFormatShiftIndent(EditDocument * ed,int step,int traced)660 int tedFormatShiftIndent( EditDocument * ed,
661 int step,
662 int traced )
663 {
664 int rval= 0;
665
666 SelectionGeometry sg;
667 SelectionDescription sd;
668
669 TedEditOperation teo;
670 EditOperation * eo= &(teo.teoEo);
671
672 PropertyMask ppSetMask;
673
674 DocumentSelection dsTraced;
675
676 const int fullWidth= 1;
677
678 utilPropMaskClear( &ppSetMask );
679 PROPmaskADD( &ppSetMask, PPpropLISTLEVEL );
680 PROPmaskADD( &ppSetMask, PPpropLEFT_INDENT );
681 PROPmaskADD( &ppSetMask, PPpropFIRST_INDENT );
682
683 tedStartEditOperation( &teo, &sg, &sd, ed, fullWidth, traced );
684
685 if ( step >= 0 )
686 {
687 if ( tedEditStartStep( &teo, EDITcmdSHIFT_RIGHT ) )
688 { LDEB(1); rval= -1; goto ready; }
689 }
690 else{
691 if ( tedEditStartStep( &teo, EDITcmdSHIFT_LEFT ) )
692 { LDEB(1); rval= -1; goto ready; }
693 }
694
695 if ( teo.teoEditTrace )
696 {
697 if ( docRtfTraceOldProperties( &dsTraced, eo, DOClevPARA,
698 (PropertyMask *)0, &ppSetMask,
699 (PropertyMask *)0, (PropertyMask *)0,
700 (PropertyMask *)0, (PropertyMask *)0 ) )
701 { LDEB(1); rval= -1; goto ready; }
702 }
703
704 if ( docEditShiftIndent( eo, step ) )
705 { LDEB(1); rval= -1; goto ready; }
706
707 if ( tedEditFinishOldSelection( &teo ) )
708 { LDEB(1); }
709
710 if ( teo.teoEditTrace )
711 {
712 docRtfTraceNewPosition( eo, (const SelectionScope *)0, SELposALL );
713 }
714
715 tedFinishEditOperation( &teo );
716
717 ready:
718
719 tedCleanEditOperation( &teo );
720
721 return rval;
722 }
723
724