Bump for 3.6-28
[LibreOffice.git] / hwpfilter / source / hwplib.h
blob9b9f37ec57a1c24e2175280d22cd400d55570966
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _HWPLIB_H_
30 #define _HWPLIB_H_
31 #include "precompile.h"
33 #include <string>
35 /* hwp96ºÎÅÍ hunit°¡ 4byte°¡ µÇ¾ú´Ù. */
36 /**
37 * size of hunit is 4 since hwp96 version
39 #ifndef _HCHAR_
40 #define _HCHAR_
41 typedef unsigned short hchar;
42 typedef int hunit;
43 typedef unsigned char kchar;
44 typedef unsigned char echar;
45 #endif // _HCHAR_
47 #if !defined(WIN32)
48 #if !defined(_BOOL_T_) && !defined(OS2)
49 typedef unsigned short BOOL;
50 #endif /* _BOOL_T_ */
51 typedef unsigned short WORD;
52 typedef int SIZE;
53 typedef unsigned long DWORD;
54 typedef long LONG;
55 #endif /* WIN32 */
57 #ifndef _UTYPE_
58 #define _UTYPE_
59 typedef unsigned char uchar;
60 typedef unsigned short ushort;
61 typedef unsigned int uint;
62 typedef unsigned long ulong;
63 #endif /* _UTYPE_ */
65 typedef ::std::basic_string<hchar> hchar_string;
67 #ifndef _ZZRECT_
68 #define _ZZRECT_
69 /**
70 * @short Point
72 typedef struct
74 int x, y;
75 } ZZPoint;
77 inline void allocPoint(ZZPoint &target, ZZPoint &src)
79 target.x = src.x;
80 target.y = src.y;
83 /**
84 * @short Size
86 typedef struct
88 int w, h;
89 } ZZSize;
91 /**
92 * @short Rectangle
94 typedef struct
96 int x, y;
97 int w, h;
98 } ZZRect;
101 * @short Parall
103 typedef struct
105 ZZPoint pt[3];
106 } ZZParall;
109 * @short Scale
111 typedef struct
113 int mulX, divX;
114 int mulY, divY;
115 } ZZScaleXY;
116 #endif /* _ZZRECT_ */
118 #if !defined(_WIN32) && !defined(MAX_PATH)
119 # define MAX_PATH 260
120 #endif /* MAX_PATH */
122 #ifndef TRUE
123 # define TRUE 1
124 # define FALSE 0
125 #endif
127 // HWP unit information
129 * HWP unit information
131 #define ONE_POINT 25
132 #define ONE_ENG_CH_WIDTH (ONE_POINT*(10/2))
133 #define ONE_MILI (71)
134 #define ONE_DOT (19)
136 /* HWP 3.0 ¹®¼­ Á¤º¸ */
138 #define NLanguage 7
140 /* Á¦¾î ¹®ÀÚ */
142 * Control character
144 #define CH_ALIGNSPACE 0
145 #define CH_FIELD 5
146 #define CH_BOOKMARK 6
148 #define CH_DATE_FORM 7
149 #define CH_DATE_CODE 8
150 #define CH_TAB 9
151 #define CH_TEXT_BOX 10
152 #define CH_PICTURE 11
154 #define CH_END_PARA 13
155 #define CH_LINE 14
156 #define CH_HIDDEN 15
157 #define CH_HEADER_FOOTER 16
158 #define CH_FOOTNOTE 17
159 #define CH_AUTO_NUM 18 /* pgnum, footnote/endnote, picture num */
160 #define CH_NEW_NUM 19 /* pgnum, footnote/endnote, picture num */
162 #define CH_SHOW_PAGE_NUM 20
163 #define CH_PAGE_NUM_CTRL 21 /* new chapter, hide pagenum */
164 #define CH_MAIL_MERGE 22
165 #define CH_COMPOSE 23
166 #define CH_HYPHEN 24
168 #define CH_TOC_MARK 25 /* CONT_MARK, TBL_MARK, PIC_MARK */
169 #define CH_INDEX_MARK 26
171 #define CH_COL_DEF 27
172 #define CH_OUTLINE 28
173 #define CH_CROSSREF 29
175 #define CH_KEEP_SPACE 30
176 #define CH_FIXED_SPACE 31
177 #define CH_SPACE 32
179 #define HAVE_SUBPARA_MASK ((1<<CH_TEXT_BOX) | (1<<CH_PICTURE) | (1<<CH_HIDDEN) | (1<<CH_HEADER_FOOTER) | (1<<CH_FOOTNOTE))
181 #define IS_SP_SKIP_BLOCK(hch) ((hch<5) || (hch==12) || (hch==27) || (hch == 29))
183 // file tag
184 #define FILETAG_UNCOMPRESSED_BIT 0x80000000
185 #define FILETAG_END_OF_COMPRESSED 0x00000000
187 #define FILETAG_EMBEDDED_PICTURE 0x00000001
188 #define FILETAG_OLE_OBJECT 0x00000002
189 #define FILETAG_HYPERTEXT 0x00000003
190 #define FILETAG_PRESENTATION 0x00000004
192 #define FILETAG_END_OF_UNCOMPRESSED 0x80000000
193 #define FILETAG_PREVIEW_IMAGE 0x80000001
194 #define FILETAG_PREVIEW_TEXT 0x80000002
196 // user error code
197 enum ErrorCode
199 HWP_NoError,
200 // system error = errno
201 // USER_ERROR_BIT = (1 << 16),
202 HWP_InvalidFileName,
203 HWP_InvalidFileFormat,
204 HWP_BrokenFile,
205 HWP_UNSUPPORTED_VERSION,
206 HWP_EMPTY_FILE
209 // debug code
210 enum DebugMask
212 DBG_READ = 0x01,
213 DBG_DISPLAY = 0x02
216 #ifdef _WIN32
217 #ifdef HWPLIB_DLL
218 //# define DLLEXPORT __declspec(dllexport)
219 # define DLLEXPORT
220 #else
221 //# define DLLEXPORT __declspec(dllimport)
222 # define DLLEXPORT
223 #endif
224 #else
225 # define DLLEXPORT
226 #endif
228 #include <sys/stat.h>
229 #include <sys/types.h>
230 #include <fcntl.h>
232 #ifdef _WIN32
233 # include <direct.h>
234 # include <io.h>
235 # define access _access
236 # define stat _stat
237 # define mkdir(x,y) _mkdir(x)
238 # define rmdir _rmdir
239 # define open _open
240 # define write _write
241 # define close _close
242 # define unlink _unlink
243 # define DIRSEP '\\'
244 #else
245 # include <unistd.h>
246 # define DIRSEP '/'
247 #endif
248 #endif /* _HWPLIB_H_*/
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */