1 /* AbiWord
2  * Copyright (C) 1998 AbiSource, Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301 USA.
18  */
19 
20 #ifndef PT_TYPES_H
21 #define PT_TYPES_H
22 
23 #include "ut_types.h"
24 
25 //! index to actual document data
26 typedef UT_uint32 PT_BufIndex;
27 //! index to Attribute/Property Tables
28 typedef UT_uint32 PT_AttrPropIndex;
29 
30 //! absolute document position
31 typedef UT_uint32 PT_DocPosition;
32 //! block-relative document position
33 typedef UT_uint32 PT_BlockOffset;
34 
35 class PD_Document;
36 /*!
37  PD_DocumentRange identifies a piece of the document, using two
38  PT_DocPosition absolute document positions as limits.
39 */
40 
41 class ABI_EXPORT PD_DocumentRange
42 {
43 public:
44 	//! Dummy constructor.
45 	//! Resulting range is invalid until it is initialized with set
PD_DocumentRange(void)46 	PD_DocumentRange(void)
47 		: m_pDoc(NULL), m_pos1(0), m_pos2(0)
48 		{
49 		}
50 
51 	//! Initializing constructor.
PD_DocumentRange(PD_Document * pDoc,PT_DocPosition k1,PT_DocPosition k2)52 	PD_DocumentRange(PD_Document * pDoc, PT_DocPosition k1, PT_DocPosition k2)
53 		: m_pDoc(pDoc), m_pos1(k1), m_pos2(k2)
54 		{
55 		}
56 
57 	//! Set range limits
set(PD_Document * pDoc,PT_DocPosition k1,PT_DocPosition k2)58 	void set(PD_Document * pDoc, PT_DocPosition k1, PT_DocPosition k2)
59 		{
60 			m_pDoc = pDoc;
61 			m_pos1 = k1;
62 			m_pos2 = k2;
63 		}
64 
65 	//! Document this range is in
66 	PD_Document *		m_pDoc;
67 	//! Lower limit of range
68 	PT_DocPosition		m_pos1;
69 	//! Upper limit of range
70 	PT_DocPosition		m_pos2;
71 };
72 
73 //! PTStruxType tells the sub-type of a FragStrux.
74 typedef enum _PTStruxType
75 {
76 	PTX_Section = 0,       	// 0 -- maker sure that we can cast into uint
77 	PTX_Block,           	// 1
78 	PTX_SectionHdrFtr,   	// 2
79 	PTX_SectionEndnote,  	// 3
80 	PTX_SectionTable,    	// 4
81 	PTX_SectionCell,     	// 5
82 	PTX_SectionFootnote, 	// 6
83 	PTX_SectionMarginnote, 	// 7
84 	PTX_SectionAnnotation,  // 8
85 	PTX_SectionFrame,      	// 9
86 	PTX_SectionTOC,			// 10
87 	PTX_EndCell,          	// 11
88 	PTX_EndTable,
89         PTX_EndFootnote,
90         PTX_EndMarginnote,
91         PTX_EndEndnote,
92 	PTX_EndAnnotation,
93         PTX_EndFrame,
94 	PTX_EndTOC,
95 	PTX_StruxDummy
96 } PTStruxType;
97 
98 //! PTObjectType tells the sub-type of an FragObject.
99 
100 typedef enum _PTObjectType
101 {
102     PTO_Image = 0,
103     PTO_Field,
104     PTO_Bookmark,
105     PTO_Hyperlink,
106     PTO_Math,
107     PTO_Embed,
108     PTO_Annotation,
109     PTO_RDFAnchor
110 } PTObjectType;
111 
112 //! PieceTable states
113 typedef enum _PTState { PTS_Create=0, PTS_Loading=1, PTS_Editing=2 } PTState;
114 //! ChangeFormat types
115 typedef enum _PTChangeFmt
116   { PTC_AddFmt=0,
117     PTC_RemoveFmt=1,
118     PTC_AddStyle=2,
119     PTC_SetFmt=3,
120     PTC_SetExactly=4} PTChangeFmt;
121 
122 typedef enum _PLListenerType
123 {
124 	PTL_UNKNOWN,
125 	PTL_DocLayout,
126 	PTL_CollabExport,
127 	PTL_CollabServiceExport
128 	/* add more types here ONLY as necessary */
129 } PLListenerType;
130 
131 //! ID of a listener - this is its location in m_vecListeners
132 typedef UT_uint32 PL_ListenerId;
133 
134 #define PT_PROPS_ATTRIBUTE_NAME			(static_cast<const gchar *>("props"))
135 #define PT_STYLE_ATTRIBUTE_NAME			(static_cast<const gchar *>("style"))
136 #define PT_LEVEL_ATTRIBUTE_NAME			(static_cast<const gchar *>("level"))
137 #define PT_LISTID_ATTRIBUTE_NAME		(static_cast<const gchar *>("listid"))
138 #define PT_PARENTID_ATTRIBUTE_NAME		(static_cast<const gchar *>("parentid"))
139 #define PT_NAME_ATTRIBUTE_NAME			(static_cast<const gchar *>("name"))
140 #define PT_TYPE_ATTRIBUTE_NAME			(static_cast<const gchar *>("type"))
141 #define PT_BASEDON_ATTRIBUTE_NAME		(static_cast<const gchar *>("basedon"))
142 #define PT_FOLLOWEDBY_ATTRIBUTE_NAME	(static_cast<const gchar *>("followedby"))
143 #define PT_ID_ATTRIBUTE_NAME            (static_cast<const gchar *>("id"))
144 #define PT_HEADER_ATTRIBUTE_NAME	    (static_cast<const gchar *>("header"))
145 #define PT_HEADEREVEN_ATTRIBUTE_NAME	(static_cast<const gchar *>("header-even"))
146 #define PT_HEADERFIRST_ATTRIBUTE_NAME	(static_cast<const gchar *>("header-first"))
147 #define PT_HEADERLAST_ATTRIBUTE_NAME	(static_cast<const gchar *>("header-last"))
148 #define PT_FOOTER_ATTRIBUTE_NAME	    (static_cast<const gchar *>("footer"))
149 #define PT_FOOTEREVEN_ATTRIBUTE_NAME	(static_cast<const gchar *>("footer-even"))
150 #define PT_FOOTERFIRST_ATTRIBUTE_NAME	(static_cast<const gchar *>("footer-first"))
151 #define PT_FOOTERLAST_ATTRIBUTE_NAME	(static_cast<const gchar *>("footer-last"))
152 #define PT_REVISION_ATTRIBUTE_NAME      (static_cast<const gchar *>("revision"))
153 #define PT_REVISION_DESC_ATTRIBUTE_NAME      (static_cast<const gchar *>("revision-desc"))
154 #define PT_REVISION_TIME_ATTRIBUTE_NAME      (static_cast<const gchar *>("revision-time"))
155 #define PT_REVISION_VERSION_ATTRIBUTE_NAME      (static_cast<const gchar *>("revision-ver"))
156 #define PT_DOCPROP_ATTRIBUTE_NAME      (static_cast<const gchar *>("docprop"))
157 #define PT_STRUX_IMAGE_DATAID           (static_cast<const gchar *>("strux-image-dataid"))
158 #define PT_XID_ATTRIBUTE_NAME           (static_cast<const gchar *>("xid"))
159 #define PT_DATAITEM_ATTRIBUTE_NAME           (static_cast<const gchar *>("dataitem"))
160 #define PT_IMAGE_DATAID           (static_cast<const gchar *>("dataid"))
161 #define PT_IMAGE_TITLE           (static_cast<const gchar *>("title"))
162 #define PT_IMAGE_DESCRIPTION           (static_cast<const gchar *>("alt"))
163 #define PT_DATA_PREVIEW           (static_cast<const gchar *>("preview"))
164 #define PT_HYPERLINK_TARGET_NAME  (static_cast<const gchar *>("xlink:href"))
165 #define PT_AUTHOR_NAME          (static_cast<const gchar *>("author"))
166 #define PT_ANNOTATION_NUMBER     (static_cast<const gchar *>("annotation"))
167 #define PT_RDF_XMLID             (static_cast<const gchar *>("xml:id"))
168 #define PT_XMLID                 (static_cast<const gchar *>("xml:id"))
169 #define PT_RDF_END               (static_cast<const gchar *>("rdf:end"))
170 #define PT_CHANGETRACKING_SPLIT_ID     (static_cast<const gchar *>("ct:split-id"))
171 #define PT_CHANGETRACKING_SPLIT_ID_REF (static_cast<const gchar *>("ct:split-id-ref"))
172 #define PT_CHANGETRACKING_SPLIT_IS_NEW (static_cast<const gchar *>("ct:split-is-new"))
173 
174 
175 #define ABIATTR_PARA_START_DELETED_REVISION (static_cast<const gchar *>("abi-para-start-deleted-revision"))
176 #define ABIATTR_PARA_END_DELETED_REVISION   (static_cast<const gchar *>("abi-para-end-deleted-revision"))
177 #define ABIATTR_PARA_DELETED_REVISION   (static_cast<const gchar *>("abi-para-deleted-revision"))
178 
179 #endif /* PT_TYPES_H */
180