1 /************************************************************************/
2 /*									*/
3 /*  Text Buffer: Obects inserted in the text.				*/
4 /*  Objects are independent entities that are embedded in the text.	*/
5 /*									*/
6 /************************************************************************/
7 
8 #   ifndef	DOC_OBJECT_H
9 #   define	DOC_OBJECT_H
10 
11 #   include	<utilMemoryBuffer.h>
12 
13 #   include	<bitmap.h>
14 #   include	"docLayoutPosition.h"
15 #   include	"docPictureProperties.h"
16 
17 struct DrawingSurface;
18 struct BufferDocument;
19 struct BufferItem;
20 struct TextParticule;
21 struct DrawingShape;
22 
23 /************************************************************************/
24 /*									*/
25 /*  Kinds of object.							*/
26 /*									*/
27 /************************************************************************/
28 
29 typedef struct InsertedObject
30     {
31     int			ioKind;		/*  Kind of object.		*/
32     int			ioResultKind;	/*  Kind of object.		*/
33     int			ioTwipsWide;	/*  objw			*/
34     int			ioTwipsHigh;	/*  objh			*/
35 					/*  NOTE: this is a property of	*/
36 					/*  the object. Not of the way	*/
37 					/*  in which it is included.	*/
38 					/*  That is controlled by the	*/
39 					/*  scale.			*/
40     short int		ioScaleXSet;	/*  In %.			*/
41     short int		ioScaleYSet;	/*  In %.			*/
42     short int		ioScaleXUsed;	/*  In %.			*/
43     short int		ioScaleYUsed;	/*  In %.			*/
44     int			ioPixelsWide;	/*  Width of object on screen	*/
45     int			ioPixelsHigh;	/*  Height of object on screen	*/
46 
47     PictureProperties	ioPictureProperties;
48 
49     LayoutPosition	ioY0Position;
50     int			ioX0Twips;
51 
52     unsigned int	ioRtfResultKind:4; /*  From rslt* tags.		*/
53     unsigned int	ioRtfEmbedKind:4;  /*  From objemb.. tags.	*/
54 
55     unsigned int	ioInline:8;  	/*  Part of the text flow?	*/
56 
57     int			ioTopCropTwips;
58     int			ioBottomCropTwips;
59     int			ioLeftCropTwips;
60     int			ioRightCropTwips;
61 
62     MemoryBuffer	ioObjectData;
63     MemoryBuffer	ioResultData;
64 
65     char *		ioObjectName;
66     char *		ioObjectClass;
67 
68     struct DrawingShape *	ioDrawingShape;
69 
70     struct DrawingSurface *	ioDrawingSurface;
71     RasterImage		ioRasterImage;
72     } InsertedObject;
73 
74 typedef void (*DOC_CLOSE_OBJECT)(
75 				const struct BufferDocument *	bd,
76 				const struct TextParticule *	tp );
77 
78 /************************************************************************/
79 /*									*/
80 /*  Routine declarations.						*/
81 /*									*/
82 /************************************************************************/
83 
84 extern int docObjectSetData(	InsertedObject *		io,
85 				const char *			bytes,
86 				int				size );
87 
88 extern int docSetResultData(	InsertedObject *		io,
89 				const char *			bytes,
90 				int				size );
91 
92 extern int docSaveObjectTag(	InsertedObject *		io,
93 				const char *			tag,
94 				int				arg );
95 
96 extern int docSaveResultTag(	InsertedObject *		io,
97 				const char *			tag,
98 				int				arg );
99 
100 extern int docSetObjectName(	InsertedObject *		io,
101 				const char *			name,
102 				int				len );
103 
104 extern int docSetObjectClass(	InsertedObject *		io,
105 				const char *			name,
106 				int				len );
107 
108 extern void docInitInsertedObject(	InsertedObject *		io );
109 extern void docCleanInsertedObject(	InsertedObject *		io );
110 
111 extern void docObjectAdaptToPictureGeometry(
112 				InsertedObject *		io,
113 				const PictureProperties *	pip );
114 
115 extern int docReadWmfObject(		InsertedObject *	io,
116 					const MemoryBuffer *	filename );
117 
118 extern int docReadEmfObject(		InsertedObject *	io,
119 					const MemoryBuffer *	filename );
120 
121 extern int docReadBitmapObject(		InsertedObject *	io,
122 					const MemoryBuffer *	filename );
123 
124 extern int docReadEpsObject(		const MemoryBuffer *	fullName,
125 					InsertedObject *	io );
126 
127 extern int docReadFileObject(		const MemoryBuffer *	fullName,
128 					InsertedObject *	io );
129 
130 extern void docObjectGetCropRect(	DocumentRectangle *		dr,
131 					const PictureProperties *	pip,
132 					const BitmapDescription *	bd );
133 
134 extern void docObjectSetPixelSize(	InsertedObject *		io,
135 					double pixelsPerTwip		);
136 
137 #   endif	/*  DOC_OBJECT_H	*/
138