Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_HWPFILTER_SOURCE_HINFO_H
21 : #define INCLUDED_HWPFILTER_SOURCE_HINFO_H
22 :
23 : #include "hwplib.h"
24 : #include "string.h"
25 :
26 : #define CHAIN_MAX_PATH 40
27 : #define ANNOTATION_LEN 24
28 :
29 : class HWPFile;
30 : class CTextOut;
31 : class CHTMLOut;
32 :
33 : /**
34 : * Information of page (phisical)
35 : */
36 : struct PaperInfo
37 : {
38 : unsigned char paper_kind;
39 : unsigned char paper_direction;
40 : hunit paper_height;
41 : hunit paper_width;
42 : hunit top_margin;
43 : hunit bottom_margin;
44 : hunit left_margin;
45 : hunit right_margin;
46 : hunit header_length;
47 : hunit footer_length;
48 : hunit gutter_length;
49 86 : PaperInfo()
50 : : paper_kind(0)
51 : , paper_direction(0)
52 : , paper_height(0)
53 : , paper_width(0)
54 : , top_margin(0)
55 : , bottom_margin(0)
56 : , left_margin(0)
57 : , right_margin(0)
58 : , header_length(0)
59 : , footer_length(0)
60 86 : , gutter_length(0)
61 : {
62 86 : }
63 : };
64 :
65 : /* ?????? ??????, ???????? ???? */
66 : struct PaperBackInfo
67 : {
68 : char type; // 0- background color, 1 - external image, 2- embedded image
69 : char reserved1[8];
70 : int luminance; /* ???? ( -100 ~ 100 ) */
71 : int contrast; /* ???? ( -100 ~ 100 ) */
72 : char effect; /* 0-????????, 1-????????????, 2-???? */
73 : char reserved2[8];
74 : char filename[260 + 1]; // filename
75 : unsigned char color[3]; //0 - red, 1 - green, 2 - blue
76 : unsigned short flag; /* 0 - ????????, 1 - ????????, 2 - ??????, 3 - ???????? */
77 : int range; /* 0-????, 1-????????, 3-??????, 4-?????? */
78 : char reserved3[27];
79 : int size;
80 : char *data; // image data
81 : bool isset;
82 86 : PaperBackInfo()
83 : : type(0)
84 : , luminance(0)
85 : , contrast(0)
86 : , effect(0)
87 : , flag(0)
88 : , range(0)
89 : , size(0)
90 : , data(NULL)
91 86 : , isset(false)
92 : {
93 86 : memset(reserved1, 0, sizeof(reserved1));
94 86 : memset(reserved2, 0, sizeof(reserved2));
95 86 : memset(filename, 0, sizeof(filename));
96 86 : memset(color, 0, sizeof(color));
97 86 : memset(reserved3, 0, sizeof(reserved3));
98 86 : }
99 : };
100 :
101 : /* ???????? ???? */
102 : /**
103 : * Information of printing for chained page
104 : */
105 : struct DocChainInfo
106 : {
107 : unsigned char chain_page_no;
108 : unsigned char chain_footnote_no;
109 : unsigned char chain_filename[CHAIN_MAX_PATH];
110 86 : DocChainInfo()
111 : : chain_page_no(0)
112 86 : , chain_footnote_no(0)
113 : {
114 86 : memset(chain_filename, 0, sizeof(chain_filename));
115 86 : }
116 : };
117 :
118 : /* ???? ???? */
119 : /**
120 : * Summary of document
121 : */
122 : struct HWPSummary
123 : {
124 : unsigned short title[56];
125 : unsigned short subject[56];
126 : unsigned short author[56];
127 : unsigned short date[56];
128 : unsigned short keyword[2][56];
129 : unsigned short etc[3][56];
130 :
131 : bool Read(HWPFile &);
132 : };
133 :
134 : /**
135 : HWPInfo class?? HWPFile?? ???? ?????? ???? ???? ??????????.
136 : ?????? ???? ???? ????????(layout) ?????? ????????????
137 : ????????, ???? ???? ?????? ???????? ????. \\
138 :
139 : HWPInfo ???????? HWPFile?? #GetHWPInfo()# ?????? ???? ???? ?? ????.
140 :
141 : @memo Hwp ???? ????
142 : */
143 : /**
144 : * Contains the basic information of the hwp document:
145 : * margin, layout, paper and internal data.
146 : */
147 : class DLLEXPORT HWPInfo
148 : {
149 : public:
150 : /**
151 : * The column index of a document that is saved at last
152 : */
153 : short cur_col;
154 : /**
155 : * The row index of a document that is saved at last
156 : */
157 : short cur_row;
158 : /**
159 : * Paper Information
160 : */
161 : PaperInfo paper;
162 :
163 : PaperBackInfo back_info;
164 : /**
165 : * Sets the attribute of read-only or read/write.
166 : */
167 : short readonly;
168 : unsigned char reserved1[4];
169 : /**
170 : * Information about document chain
171 : */
172 : DocChainInfo chain_info;
173 : unsigned char annotation[ANNOTATION_LEN];
174 : short encrypted;
175 : // unsigned char reserved2[6];
176 : short beginpagenum; /* ?????????? ???? */
177 : /**
178 : * Information about footnote
179 : */
180 : short beginfnnum; /* ???????????? */
181 : short countfn; /* ???? ???? */
182 : hunit splinetext, splinefn;
183 : hunit spfnfn;
184 : unsigned char fnchar;
185 : unsigned char fnlinetype;
186 : // layout info
187 : /**
188 : * Information about page layout
189 : */
190 : hunit bordermargin[4];
191 : short borderline;
192 :
193 : unsigned char empty_line_hide;
194 : unsigned char table_move;
195 : unsigned char compressed;
196 : unsigned char reserved3;
197 : short info_block_len;
198 : /* ?????????? 128 ?????????? */
199 : /**
200 : * Summary of document
201 : */
202 : HWPSummary summary;
203 : unsigned char *info_block;
204 :
205 : HWPInfo(void);
206 : ~HWPInfo(void);
207 :
208 : bool Read(HWPFile &hwpf);
209 : bool Write(CTextOut &txtf);
210 : bool Write(CHTMLOut &html);
211 :
212 : };
213 :
214 : /* ???? ???? ?????? */
215 : /**
216 : * @short Style of character
217 : */
218 : struct CharShape
219 : {
220 : /**
221 : * Index of character style
222 : */
223 : int index; /* ???????? ???????? ????. */
224 : /**
225 : * Font size
226 : */
227 : hunit size;
228 : unsigned char font[NLanguage];
229 : unsigned char ratio[NLanguage];
230 : signed char space[NLanguage]; /* ???? */
231 : unsigned char color[2];
232 : unsigned char shade;
233 : unsigned char attr;
234 : unsigned char reserved[4];
235 :
236 : bool Read(HWPFile &);
237 : };
238 :
239 : /* ?? ?????? ???? ?????? */
240 :
241 : #define MAXTABS 40
242 : /**
243 : * @short Tab properties
244 : */
245 : typedef struct
246 : {
247 : unsigned char type;
248 : unsigned char dot_continue;
249 : hunit position;
250 : } TabSet;
251 :
252 : /**
253 : * @short Column properties
254 : */
255 : typedef struct
256 : {
257 : unsigned char ncols;
258 : unsigned char separator;
259 : hunit spacing;
260 : hunit columnlen, columnlen0;
261 : } ColumnDef;
262 :
263 : /**
264 : * @short Style of paragraph
265 : */
266 : struct ParaShape
267 : {
268 : /**
269 : * Index of paragraph style
270 : */
271 : int index; /* ???????? ???????? ???? */
272 : hunit left_margin;
273 : hunit right_margin;
274 : hunit indent;
275 : hunit lspacing;
276 : hunit pspacing_prev;
277 : hunit pspacing_next;
278 : unsigned char condense;
279 : unsigned char arrange_type;
280 : TabSet tabs[MAXTABS];
281 : ColumnDef coldef;
282 : unsigned char shade;
283 : unsigned char outline;
284 : unsigned char outline_continue;
285 : unsigned char reserved[2];
286 : CharShape *cshape;
287 : unsigned char pagebreak;
288 :
289 : bool Read(HWPFile &);
290 : // virtual ~ParaShape();
291 : };
292 : #endif // INCLUDED_HWPFILTER_SOURCE_HINFO_H
293 :
294 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|