fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / hwpfilter / source / hwplib.h
blob87a5bf9f936de3aef54e4e4c5322c9b2946dfb94
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_HWPFILTER_SOURCE_HWPLIB_H
21 #define INCLUDED_HWPFILTER_SOURCE_HWPLIB_H
22 #include "precompile.h"
24 #include <string>
26 /* hwp96부터 hunit가 4byte가 되었다. */
27 /**
28 * size of hunit is 4 since hwp96 version
30 #ifndef _HCHAR_
31 #define _HCHAR_
32 typedef unsigned short hchar;
33 typedef int hunit;
34 typedef unsigned char kchar;
35 #endif // _HCHAR_
37 #ifndef _UTYPE_
38 #define _UTYPE_
39 typedef unsigned char uchar;
40 typedef unsigned short ushort;
41 typedef unsigned int uint;
42 #endif /* _UTYPE_ */
44 typedef ::std::basic_string<hchar> hchar_string;
46 #ifndef _ZZRECT_
47 #define _ZZRECT_
48 /**
49 * @short Point
51 typedef struct
53 int x, y;
54 } ZZPoint;
56 inline void allocPoint(ZZPoint &target, ZZPoint &src)
58 target.x = src.x;
59 target.y = src.y;
62 /**
63 * @short Size
65 typedef struct
67 int w, h;
68 } ZZSize;
70 /**
71 * @short Rectangle
73 typedef struct
75 int x, y;
76 int w, h;
77 } ZZRect;
79 /**
80 * @short Parall
82 typedef struct
84 ZZPoint pt[3];
85 } ZZParall;
87 /**
88 * @short Scale
90 typedef struct
92 int mulX, divX;
93 int mulY, divY;
94 } ZZScaleXY;
95 #endif /* _ZZRECT_ */
97 #if !defined(_WIN32) && !defined(MAX_PATH)
98 # define MAX_PATH 260
99 #endif /* MAX_PATH */
101 #ifndef TRUE
102 # define TRUE 1
103 # define FALSE 0
104 #endif
106 // HWP unit information
108 * HWP unit information
110 #define ONE_POINT 25
111 #define ONE_ENG_CH_WIDTH (ONE_POINT*(10/2))
112 #define ONE_MILI (71)
113 #define ONE_DOT (19)
115 /* HWP 3.0 문서 정보 */
117 #define NLanguage 7
119 /* 제어 문자 */
121 * Control character
123 #define CH_ALIGNSPACE 0
124 #define CH_FIELD 5
125 #define CH_BOOKMARK 6
127 #define CH_DATE_FORM 7
128 #define CH_DATE_CODE 8
129 #define CH_TAB 9
130 #define CH_TEXT_BOX 10
131 #define CH_PICTURE 11
133 #define CH_END_PARA 13
134 #define CH_LINE 14
135 #define CH_HIDDEN 15
136 #define CH_HEADER_FOOTER 16
137 #define CH_FOOTNOTE 17
138 #define CH_AUTO_NUM 18 /* pgnum, footnote/endnote, picture num */
139 #define CH_NEW_NUM 19 /* pgnum, footnote/endnote, picture num */
141 #define CH_SHOW_PAGE_NUM 20
142 #define CH_PAGE_NUM_CTRL 21 /* new chapter, hide pagenum */
143 #define CH_MAIL_MERGE 22
144 #define CH_COMPOSE 23
145 #define CH_HYPHEN 24
147 #define CH_TOC_MARK 25 /* CONT_MARK, TBL_MARK, PIC_MARK */
148 #define CH_INDEX_MARK 26
150 #define CH_COL_DEF 27
151 #define CH_OUTLINE 28
152 #define CH_CROSSREF 29
154 #define CH_KEEP_SPACE 30
155 #define CH_FIXED_SPACE 31
156 #define CH_SPACE 32
158 #define HAVE_SUBPARA_MASK ((1<<CH_TEXT_BOX) | (1<<CH_PICTURE) | (1<<CH_HIDDEN) | (1<<CH_HEADER_FOOTER) | (1<<CH_FOOTNOTE))
160 #define IS_SP_SKIP_BLOCK(hch) ((hch<5) || (hch==12) || (hch==27) || (hch == 29))
162 // file tag
163 #define FILETAG_END_OF_COMPRESSED 0x00000000
165 #define FILETAG_EMBEDDED_PICTURE 0x00000001
166 #define FILETAG_OLE_OBJECT 0x00000002
167 #define FILETAG_HYPERTEXT 0x00000003
168 #define FILETAG_PRESENTATION 0x00000004
170 #define FILETAG_END_OF_UNCOMPRESSED 0x80000000
171 #define FILETAG_PREVIEW_IMAGE 0x80000001
172 #define FILETAG_PREVIEW_TEXT 0x80000002
174 // user error code
175 enum ErrorCode
177 HWP_NoError,
178 // system error = errno
179 // USER_ERROR_BIT = (1 << 16),
180 HWP_InvalidFileName,
181 HWP_InvalidFileFormat,
182 HWP_BrokenFile,
183 HWP_UNSUPPORTED_VERSION,
184 HWP_EMPTY_FILE
187 // debug code
188 enum DebugMask
190 DBG_READ = 0x01,
191 DBG_DISPLAY = 0x02
194 #ifdef _WIN32
195 #ifdef HWPLIB_DLL
196 //# define DLLEXPORT __declspec(dllexport)
197 # define DLLEXPORT
198 #else
199 //# define DLLEXPORT __declspec(dllimport)
200 # define DLLEXPORT
201 #endif
202 #else
203 # define DLLEXPORT
204 #endif
206 #include <sys/stat.h>
207 #include <sys/types.h>
208 #include <fcntl.h>
210 #ifdef _WIN32
211 # include <direct.h>
212 # include <io.h>
213 # define access _access
214 # define stat _stat
215 # define mkdir(x,y) _mkdir(x)
216 # define rmdir _rmdir
217 # define open _open
218 # define write _write
219 # define close _close
220 # define unlink _unlink
221 # define DIRSEP '\\'
222 #else
223 # include <unistd.h>
224 # define DIRSEP '/'
225 #endif
226 #endif // INCLUDED_HWPFILTER_SOURCE_HWPLIB_H
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */