1 /************************************************************************/
2 /*									*/
3 /*  Document Editing: Copying over (part of) a document to the same	*/
4 /*  document or another one.						*/
5 /*									*/
6 /************************************************************************/
7 
8 #   ifndef		DOC_DOCUMENT_COPY_JOB_H
9 #   define		DOC_DOCUMENT_COPY_JOB_H
10 
11 #   include		<docBuf.h>
12 #   include		"docEditOperation.h"
13 #   include		<docDocumentAttributeMap.h>
14 
15 /************************************************************************/
16 /*									*/
17 /*  For copying information from one location to another. Possibly	*/
18 /*  between different documents.					*/
19 /*									*/
20 /************************************************************************/
21 
22 typedef struct FieldCopyStackLevel
23     {
24     DocumentField *			fcslField;
25     struct FieldCopyStackLevel *	fcslPrev;
26     } FieldCopyStackLevel;
27 
28 typedef struct DocumentCopyJob
29     {
30     EditOperation *		dcjEditOperation;
31     SelectionScope		dcjTargetSelectionScope;
32 
33     DocumentTree *		dcjTargetTree;
34     BufferDocument *		dcjSourceDocument;
35     DocumentTree *		dcjSourceTree;
36 				    /**
37 				     *  Are we in an excursion to an
38 				     *  external tree?
39 				     */
40     int				dcjInExternalTree;
41 
42     int				dcjCopyFields;
43     int *			dcjFieldMap;
44     FieldCopyStackLevel *	dcjFieldStack;
45 
46     DocumentAttributeMap	dcjAttributeMap;
47     int				dcjForceAttributeTo;
48 
49 				    /**
50 				     *  The file name that we paste to.
51 				     *  This is to avoid that hyperlinks
52 				     *  within the document become absolute.
53 				     */
54     MemoryBuffer		dcjRefFileName;
55 
56     int				dcjCurrentTextAttributeNumberFrom;
57     int				dcjCurrentTextAttributeNumberTo;
58 
59     IndexSet			dcjNoteFieldsCopied;
60     int				dcjBulletsCopied;
61 
62 				/**
63 				 *  Transfer the paragraph properties of the
64 				 *  first paragraph of the source to the target?
65 				 *  [Only relevant with multi-paragraph inserts]
66 				 */
67     unsigned char		dcjCopyHeadParaProperties;
68 				/**
69 				 *  Transfer the paragraph properties of the
70 				 *  last paragraph of the source to the target?
71 				 *  [Only relevant with multi-paragraph inserts]
72 				 */
73     unsigned char		dcjCopyTailParaProperties;
74     } DocumentCopyJob;
75 
76 /************************************************************************/
77 /*									*/
78 /*  Routine Declarations.						*/
79 /*									*/
80 /************************************************************************/
81 
82 extern int docMapTextAttributeNumber(
83 				DocumentCopyJob *	dcj,
84 				int			attributeNumberFrom );
85 
86 extern int docMapTextAttributeNumberFromTo(
87 				BufferDocument *	bdTo,
88 				const BufferDocument *	bdFrom,
89 				int			attributeNumberFrom );
90 
91 extern void docInitDocumentCopyJob(	DocumentCopyJob *	dcj );
92 extern void docCleanDocumentCopyJob(	DocumentCopyJob *	dcj );
93 
94 extern int docSet1DocumentCopyJob(	DocumentCopyJob *	dcj,
95 					EditOperation *		eo,
96 					int			copyFields );
97 
98 extern int docSetTraceDocumentCopyJob(	DocumentCopyJob *	dcj,
99 					EditOperation *		eo,
100 					BufferDocument *	bdFrom );
101 
102 extern int docSet2DocumentCopyJob(
103 				DocumentCopyJob *	dcj,
104 				EditOperation *		eo,
105 				BufferDocument *	bdFrom,
106 				DocumentTree *		eiFrom,
107 				const MemoryBuffer *	refFileName,
108 				int			forceAttributeTo );
109 
110 extern int docPushFieldOnCopyStack(	DocumentCopyJob *	dcj,
111 					DocumentField *		df );
112 
113 extern void docMapTextAttribute(	TextAttribute *		taTo,
114 					const TextAttribute *	taFrom,
115 					const DocumentCopyJob *	dcj );
116 
117 #   endif	/*	DOC_DOCUMENT_COPY_JOB_H	*/
118