Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / hwpfilter / source / hwplib.h
blob39d2f1b171f3cafcfb454a74cec0a9d588036812
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 typedef unsigned short hchar;
31 typedef int hunit;
32 typedef unsigned char kchar;
34 typedef unsigned char uchar;
35 typedef unsigned short ushort;
36 typedef unsigned int uint;
38 typedef ::std::basic_string<hchar> hchar_string;
40 /**
41 * @short Point
43 typedef struct
45 int x, y;
46 } ZZPoint;
48 /**
49 * @short Size
51 typedef struct
53 int w, h;
54 } ZZSize;
56 /**
57 * @short Rectangle
59 typedef struct
61 int x, y;
62 int w, h;
63 } ZZRect;
65 /**
66 * @short Parall
68 typedef struct
70 ZZPoint pt[3];
71 } ZZParall;
73 /**
74 * @short Scale
76 typedef struct
78 int mulX, divX;
79 int mulY, divY;
80 } ZZScaleXY;
82 #if !defined(_WIN32) && !defined(MAX_PATH)
83 # define MAX_PATH 260
84 #endif /* MAX_PATH */
86 #ifndef TRUE
87 # define TRUE 1
88 # define FALSE 0
89 #endif
91 // HWP unit information
92 /**
93 * HWP unit information
95 #define ONE_POINT 25
96 #define ONE_ENG_CH_WIDTH (ONE_POINT*(10/2))
97 #define ONE_MILI (71)
98 #define ONE_DOT (19)
100 /* HWP 3.0 문서 정보 */
102 #define NLanguage 7
104 /* 제어 문자 */
106 * Control character
108 #define CH_ALIGNSPACE 0
109 #define CH_FIELD 5
110 #define CH_BOOKMARK 6
112 #define CH_DATE_FORM 7
113 #define CH_DATE_CODE 8
114 #define CH_TAB 9
115 #define CH_TEXT_BOX 10
116 #define CH_PICTURE 11
118 #define CH_END_PARA 13
119 #define CH_LINE 14
120 #define CH_HIDDEN 15
121 #define CH_HEADER_FOOTER 16
122 #define CH_FOOTNOTE 17
123 #define CH_AUTO_NUM 18 /* pgnum, footnote/endnote, picture num */
124 #define CH_NEW_NUM 19 /* pgnum, footnote/endnote, picture num */
126 #define CH_SHOW_PAGE_NUM 20
127 #define CH_PAGE_NUM_CTRL 21 /* new chapter, hide pagenum */
128 #define CH_MAIL_MERGE 22
129 #define CH_COMPOSE 23
130 #define CH_HYPHEN 24
132 #define CH_TOC_MARK 25 /* CONT_MARK, TBL_MARK, PIC_MARK */
133 #define CH_INDEX_MARK 26
135 #define CH_COL_DEF 27
136 #define CH_OUTLINE 28
137 #define CH_CROSSREF 29
139 #define CH_KEEP_SPACE 30
140 #define CH_FIXED_SPACE 31
141 #define CH_SPACE 32
143 #define HAVE_SUBPARA_MASK ((1<<CH_TEXT_BOX) | (1<<CH_PICTURE) | (1<<CH_HIDDEN) | (1<<CH_HEADER_FOOTER) | (1<<CH_FOOTNOTE))
145 #define IS_SP_SKIP_BLOCK(hch) ((hch<5) || (hch==12) || (hch==27) || (hch == 29))
147 // file tag
148 #define FILETAG_END_OF_COMPRESSED 0x00000000
150 #define FILETAG_EMBEDDED_PICTURE 0x00000001
151 #define FILETAG_OLE_OBJECT 0x00000002
152 #define FILETAG_HYPERTEXT 0x00000003
153 #define FILETAG_PRESENTATION 0x00000004
155 #define FILETAG_END_OF_UNCOMPRESSED 0x80000000
156 #define FILETAG_PREVIEW_IMAGE 0x80000001
157 #define FILETAG_PREVIEW_TEXT 0x80000002
159 // user error code
160 enum ErrorCode
162 HWP_NoError,
163 // system error = errno
164 // USER_ERROR_BIT = (1 << 16),
165 HWP_InvalidFileName,
166 HWP_InvalidFileFormat,
167 HWP_BrokenFile,
168 HWP_UNSUPPORTED_VERSION,
169 HWP_EMPTY_FILE
172 // debug code
173 enum DebugMask
175 DBG_READ = 0x01,
176 DBG_DISPLAY = 0x02
179 #ifdef _WIN32
180 #ifdef HWPLIB_DLL
181 //# define DLLEXPORT __declspec(dllexport)
182 # define DLLEXPORT
183 #else
184 //# define DLLEXPORT __declspec(dllimport)
185 # define DLLEXPORT
186 #endif
187 #else
188 # define DLLEXPORT
189 #endif
191 #include <sys/stat.h>
192 #include <sys/types.h>
193 #include <fcntl.h>
195 #ifdef _WIN32
196 # include <direct.h>
197 # include <io.h>
198 # define access _access
199 # define stat _stat
200 # define mkdir(x,y) _mkdir(x)
201 # define rmdir _rmdir
202 # define open _open
203 # define write _write
204 # define close _close
205 # define unlink _unlink
206 # define DIRSEP '\\'
207 #else
208 # include <unistd.h>
209 # define DIRSEP '/'
210 #endif
211 #endif // INCLUDED_HWPFILTER_SOURCE_HWPLIB_H
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */