Update git submodules
[LibreOffice.git] / hwpfilter / source / hinfo.h
blobfe473f4effc45945d0eef45982508acc42770190
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_HINFO_H
21 #define INCLUDED_HWPFILTER_SOURCE_HINFO_H
23 #include "hwplib.h"
24 #include <string.h>
26 #include <vector>
27 #include <memory>
29 #define CHAIN_MAX_PATH 40
30 #define ANNOTATION_LEN 24
32 class HWPFile;
33 class CTextOut;
34 class CHTMLOut;
36 /**
37 * Information of page (physical)
39 struct PaperInfo
41 unsigned char paper_kind;
42 unsigned char paper_direction;
43 hunit paper_height;
44 hunit paper_width;
45 hunit top_margin;
46 hunit bottom_margin;
47 hunit left_margin;
48 hunit right_margin;
49 hunit header_length;
50 hunit footer_length;
51 hunit gutter_length;
52 PaperInfo()
53 : paper_kind(0)
54 , paper_direction(0)
55 , paper_height(0)
56 , paper_width(0)
57 , top_margin(0)
58 , bottom_margin(0)
59 , left_margin(0)
60 , right_margin(0)
61 , header_length(0)
62 , footer_length(0)
63 , gutter_length(0)
68 /* 페이지 배경색, 배경그림 정보 */
69 struct PaperBackInfo
71 char type; // 0- background color, 1 - external image, 2- embedded image
72 char reserved1[8] = {};
73 int luminance; /* 밝기 ( -100 ~ 100 ) */
74 int contrast; /* 명암 ( -100 ~ 100 ) */
75 char effect; /* 0-원래그림, 1-그레이스케일, 2-흑백 */
76 char reserved2[8] = {};
77 char filename[260 + 1] = {}; // filename
78 unsigned char color[3] = {}; //0 - red, 1 - green, 2 - blue
79 unsigned short flag; /* 0 - 바둑판식, 1 - 가운데로, 2 - 쪽크기, 3 - 용지크기 */
80 int range; /* 0-전체, 1-첫페이지, 3-짝수쪽, 4-홀수쪽 */
81 char reserved3[27] = {};
82 int size;
83 std::vector<char> data; // image data
84 bool isset;
85 PaperBackInfo()
86 : type(0)
87 , luminance(0)
88 , contrast(0)
89 , effect(0)
90 , flag(0)
91 , range(0)
92 , size(0)
93 , isset(false)
98 /* 연결인쇄 정보 */
99 /**
100 * Information of printing for chained page
102 struct DocChainInfo
104 unsigned char chain_page_no;
105 unsigned char chain_footnote_no;
106 unsigned char chain_filename[CHAIN_MAX_PATH] = {};
107 DocChainInfo()
108 : chain_page_no(0)
109 , chain_footnote_no(0)
114 /* 문서 요약 */
116 * Summary of document
118 struct HWPSummary
120 unsigned short title[56];
121 unsigned short subject[56];
122 unsigned short author[56];
123 unsigned short date[56];
124 unsigned short keyword[2][56];
125 unsigned short etc[3][56];
127 bool Read(HWPFile &);
131 HWPInfo class는 HWPFile에 대한 정보를 담고 있는 클래스이다.
132 종이나 여백 등의 레이아웃(layout) 정보는 쪽매기기에서
133 사용하며, 기타 내부 정보를 포함하고 있다. \\
135 HWPInfo 클래스는 HWPFile의 #GetHWPInfo()# 함수를 통해 얻을 수 있다.
137 @memo Hwp 문서 정보
140 * Contains the basic information of the hwp document:
141 * margin, layout, paper and internal data.
143 class DLLEXPORT HWPInfo
145 public:
147 * The column index of a document that is saved at last
149 short cur_col;
151 * The row index of a document that is saved at last
153 short cur_row;
155 * Paper Information
157 PaperInfo paper;
159 PaperBackInfo back_info;
161 * Sets the attribute of read-only or read/write.
163 short readonly;
164 unsigned char reserved1[4] = {};
166 * Information about document chain
168 DocChainInfo chain_info;
169 unsigned char annotation[ANNOTATION_LEN] = {};
170 short encrypted;
171 // unsigned char reserved2[6];
172 short beginpagenum; /* 시작페이지 번호 */
174 * Information about footnote
176 short beginfnnum; /* 각주시작번호 */
177 short countfn; /* 각주 갯수 */
178 hunit splinetext, splinefn;
179 hunit spfnfn;
180 unsigned char fnchar;
181 unsigned char fnlinetype;
182 // layout info
184 * Information about page layout
186 hunit bordermargin[4] = {};
187 short borderline;
189 unsigned char empty_line_hide;
190 unsigned char table_move;
191 unsigned char compressed;
192 unsigned char reserved3;
193 short info_block_len;
194 /* 여기까지가 128 바이트이다 */
196 * Summary of document
198 HWPSummary summary;
199 std::unique_ptr<unsigned char[]> info_block;
201 HWPInfo(void);
202 ~HWPInfo(void);
204 void Read(HWPFile &hwpf);
208 /* 글자 모양 구조체 */
210 * @short Style of character
212 struct CharShape
215 * Index of character style
217 int index; /* 스타일의 인덱스를 저장. */
219 * Font size
221 hunit size;
222 unsigned char color[2];
223 unsigned char font;
224 char space; /* 자간 */
225 unsigned char ratio;
226 unsigned char shade;
227 unsigned char attr;
229 void Read(HWPFile &);
231 CharShape();
234 /* 탭 설정에 대한 구조체 */
236 #define MAXTABS 40
238 * @short Tab properties
240 struct TabSet
242 unsigned char type;
243 unsigned char dot_continue;
244 hunit position;
245 TabSet()
246 : type(0)
247 , dot_continue(0)
248 , position(0)
254 * @short Column properties
256 struct ColumnDef
258 unsigned char ncols;
259 unsigned char separator;
260 hunit spacing;
261 hunit columnlen, columnlen0;
262 ColumnDef()
263 : ncols(0)
264 , separator(0)
265 , spacing(0)
266 , columnlen(0)
267 , columnlen0(0)
273 * @short Style of paragraph
275 struct ParaShape
278 * Index of paragraph style
280 int index; /* 스타일의 인덱스를 저장 */
281 hunit left_margin;
282 hunit right_margin;
283 hunit indent;
284 hunit lspacing;
285 hunit pspacing_prev;
286 hunit pspacing_next;
287 unsigned char condense;
288 unsigned char arrange_type;
289 TabSet tabs[MAXTABS];
290 std::shared_ptr<ColumnDef> xColdef;
291 unsigned char shade;
292 unsigned char outline;
293 unsigned char outline_continue;
294 unsigned char reserved[2];
295 std::shared_ptr<CharShape> cshape;
296 unsigned char pagebreak;
298 void Read(HWPFile &);
300 ParaShape();
302 #endif // INCLUDED_HWPFILTER_SOURCE_HINFO_H
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */