update dev300-m58
[ooovba.git] / hwpfilter / source / hwplib.h
blob627ce699274c32f6cf6a04e84023ab00363cd0c4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hwplib.h,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /* $Id: hwplib.h,v 1.5 2008-04-10 12:09:50 rt Exp $ */
33 #ifndef _HWPLIB_H_
34 #define _HWPLIB_H_
35 #include "precompile.h"
36 /* hwp96ºÎÅÍ hunit°¡ 4byte°¡ µÇ¾ú´Ù. */
37 /**
38 * size of hunit is 4 since hwp96 version
40 #ifndef _HCHAR_
41 #define _HCHAR_
42 typedef unsigned short hchar;
43 typedef int hunit;
44 typedef unsigned char kchar;
45 typedef unsigned char echar;
46 #endif // _HCHAR_
48 #if !defined(WIN32)
49 #if !defined(_BOOL_T_) && !defined(OS2)
50 typedef unsigned short BOOL;
51 #endif /* _BOOL_T_ */
52 typedef unsigned short WORD;
53 typedef int SIZE;
54 typedef unsigned long DWORD;
55 typedef long LONG;
56 #endif /* WIN32 */
58 #ifndef _UTYPE_
59 #define _UTYPE_
60 typedef unsigned char uchar;
61 typedef unsigned short ushort;
62 typedef unsigned int uint;
63 typedef unsigned long ulong;
64 #endif /* _UTYPE_ */
66 #ifndef _ZZRECT_
67 #define _ZZRECT_
68 /**
69 * @short Point
71 typedef struct
73 int x, y;
74 } ZZPoint;
76 inline void allocPoint(ZZPoint &target, ZZPoint &src)
78 target.x = src.x;
79 target.y = src.y;
82 /**
83 * @short Size
85 typedef struct
87 int w, h;
88 } ZZSize;
90 /**
91 * @short Rectangle
93 typedef struct
95 int x, y;
96 int w, h;
97 } ZZRect;
99 /**
100 * @short Parall
102 typedef struct
104 ZZPoint pt[3];
105 } ZZParall;
108 * @short Scale
110 typedef struct
112 int mulX, divX;
113 int mulY, divY;
114 } ZZScaleXY;
115 #endif /* _ZZRECT_ */
117 #if !defined(_WIN32) && !defined(MAX_PATH)
118 # define MAX_PATH 260
119 #endif /* MAX_PATH */
121 #ifndef TRUE
122 # define TRUE 1
123 # define FALSE 0
124 #endif
126 // HWP unit information
128 * HWP unit information
130 #define ONE_POINT 25
131 #define ONE_ENG_CH_WIDTH (ONE_POINT*(10/2))
132 #define ONE_MILI (71)
133 #define ONE_DOT (19)
135 /* HWP 3.0 ¹®¼­ Á¤º¸ */
137 #define NLanguage 7
139 /* Á¦¾î ¹®ÀÚ */
141 * Control character
143 #define CH_ALIGNSPACE 0
144 #define CH_FIELD 5
145 #define CH_BOOKMARK 6
147 #define CH_DATE_FORM 7
148 #define CH_DATE_CODE 8
149 #define CH_TAB 9
150 #define CH_TEXT_BOX 10
151 #define CH_PICTURE 11
153 #define CH_END_PARA 13
154 #define CH_LINE 14
155 #define CH_HIDDEN 15
156 #define CH_HEADER_FOOTER 16
157 #define CH_FOOTNOTE 17
158 #define CH_AUTO_NUM 18 /* pgnum, footnote/endnote, picture num */
159 #define CH_NEW_NUM 19 /* pgnum, footnote/endnote, picture num */
161 #define CH_SHOW_PAGE_NUM 20
162 #define CH_PAGE_NUM_CTRL 21 /* new chapter, hide pagenum */
163 #define CH_MAIL_MERGE 22
164 #define CH_COMPOSE 23
165 #define CH_HYPHEN 24
167 #define CH_TOC_MARK 25 /* CONT_MARK, TBL_MARK, PIC_MARK */
168 #define CH_INDEX_MARK 26
170 #define CH_COL_DEF 27
171 #define CH_OUTLINE 28
172 #define CH_CROSSREF 29
174 #define CH_KEEP_SPACE 30
175 #define CH_FIXED_SPACE 31
176 #define CH_SPACE 32
178 #define HAVE_SUBPARA_MASK ((1<<CH_TEXT_BOX) | (1<<CH_PICTURE) | (1<<CH_HIDDEN) | (1<<CH_HEADER_FOOTER) | (1<<CH_FOOTNOTE))
180 #define IS_SP_SKIP_BLOCK(hch) ((hch<5) || (hch==12) || (hch==27) || (hch == 29))
182 // file tag
183 #define FILETAG_UNCOMPRESSED_BIT 0x80000000
184 #define FILETAG_END_OF_COMPRESSED 0x00000000
186 #define FILETAG_EMBEDDED_PICTURE 0x00000001
187 #define FILETAG_OLE_OBJECT 0x00000002
188 #define FILETAG_HYPERTEXT 0x00000003
189 #define FILETAG_PRESENTATION 0x00000004
191 #define FILETAG_END_OF_UNCOMPRESSED 0x80000000
192 #define FILETAG_PREVIEW_IMAGE 0x80000001
193 #define FILETAG_PREVIEW_TEXT 0x80000002
195 // user error code
196 enum ErrorCode
198 HWP_NoError,
199 // system error = errno
200 // USER_ERROR_BIT = (1 << 16),
201 HWP_InvalidFileName,
202 HWP_InvalidFileFormat,
203 HWP_BrokenFile,
204 HWP_UNSUPPORTED_VERSION,
205 HWP_EMPTY_FILE
208 // debug code
209 enum DebugMask
211 DBG_READ = 0x01,
212 DBG_DISPLAY = 0x02
215 #ifdef _WIN32
216 #ifdef HWPLIB_DLL
217 //# define DLLEXPORT __declspec(dllexport)
218 # define DLLEXPORT
219 #else
220 //# define DLLEXPORT __declspec(dllimport)
221 # define DLLEXPORT
222 #endif
223 #else
224 # define DLLEXPORT
225 #endif
227 #include <sys/stat.h>
228 #include <sys/types.h>
229 #include <fcntl.h>
231 #ifdef _WIN32
232 # include <direct.h>
233 # include <io.h>
234 # define access _access
235 # define stat _stat
236 # define mkdir(x,y) _mkdir(x)
237 # define rmdir _rmdir
238 # define open _open
239 # define write _write
240 # define close _close
241 # define unlink _unlink
242 # define DIRSEP '\\'
243 #else
244 # include <unistd.h>
245 # define DIRSEP '/'
246 #endif
247 #endif /* _HWPLIB_H_*/