1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include "precompile.h"
29 static bool HWPReadInfoBlock(void *ptr
, int len
, HWPFile
& hwpf
)
31 hwpf
.info_block_len
= len
;
35 return hwpf
.ReadBlock(ptr
, len
) ? true : false;
39 // Document Information
41 HWPInfo::HWPInfo(void)
44 back_info
.isset
= false;
48 HWPInfo::~HWPInfo(void)
57 * ¹®¼Á¤º¸¸¦ ÀоîµéÀÌ´Â ÇÔ¼ö ( 128 bytes )
58 * ¹®¼Á¤º¸´Â ÆÄÀÏÀνÄÁ¤º¸( 30 bytes ) ´ÙÀ½¿¡ À§Ä¡ÇÑ Á¤º¸ÀÌ´Ù.
60 bool HWPInfo::Read(HWPFile
& hwpf
)
62 hwpf
.Read2b(&cur_col
, 1); /* ¹®¼¸¦ ÀúÀåÇÒ ´ç½ÃÀÇ Ä¿¼°¡ À§Ä¡ÇÑ ¹®´Ü¹øÈ£ */
63 hwpf
.Read2b(&cur_row
, 1); /* ¹®´Ü Ä */
65 hwpf
.Read1b(&paper
.paper_kind
, 1); /* ¿ëÁö Á¾·ù */
66 hwpf
.Read1b(&paper
.paper_direction
, 1); /* ¿ëÁö ¹æÇâ */
68 // paper geometry information
69 paper
.paper_height
= (short) hwpf
.Read2b(); /* ¿ëÁö ±æÀÌ */
70 paper
.paper_width
= (short) hwpf
.Read2b(); /* ¿ëÁö ³Êºñ */
71 paper
.top_margin
= (short) hwpf
.Read2b(); /* À§ÂÊ ¿©¹é */
72 paper
.bottom_margin
= (short) hwpf
.Read2b(); /* ¾Æ·¡ÂÊ ¿©¹é */
73 paper
.left_margin
= (short) hwpf
.Read2b(); /* ¿ÞÂÊ ¿©¹é */
74 paper
.right_margin
= (short) hwpf
.Read2b(); /* ¿À¸¥ÂÊ ¿©¹é */
75 paper
.header_length
= (short) hwpf
.Read2b(); /* ¸Ó¸®¸» ±æÀÌ */
76 paper
.footer_length
= (short) hwpf
.Read2b(); /* ²¿¸®¸» ±æÀÌ */
77 paper
.gutter_length
= (short) hwpf
.Read2b(); /* Á¦º»¿©¹é */
78 hwpf
.Read2b(&readonly
, 1); /* ¿¹¾à */
79 hwpf
.Read1b(reserved1
, 4); /* ¿¹¾à */
80 hwpf
.Read1b(&chain_info
.chain_page_no
, 1); /* ÂÊ ¹øÈ£ ¿¬°á 1-¿¬°á, 0-»õ·Î½ÃÀÛ (¿¬°áÀμ⿡¼ »ç¿ë) */
81 hwpf
.Read1b(&chain_info
.chain_footnote_no
, 1);/* °¢ÁÖ¹øÈ£ ¿¬°á 1-¿¬°á 0-»õ·Î½ÃÀÛ */
82 /* ¿¬°áÀμâÇÒ ÆÄÀÏÀÇ À̸§ */
83 hwpf
.Read1b(chain_info
.chain_filename
, CHAIN_MAX_PATH
);
85 hwpf
.Read1b(annotation
, ANNOTATION_LEN
); /* µ¡ºÙÀÌ´Â ¸» ( ÆÄÀÏ ÀúÀåÇÒ ¶§ µ¡ºÙÀÌ´Â ¸»¿¡ ÁöÁ¤ÇÑ ³»¿ë ) */
86 hwpf
.Read2b(&encrypted
, 1); /* ¾ÏÈ£ ¿©ºÎ 0-º¸ÅëÆÄÀÏ, ±×¿Ü-¾ÏÈ£°É¸° ÆÄÀÏ */
87 //hwpf.Read1b(reserved2, 6); /* ¾Æ·¡ 3°³ÀÇ°ªÀ¸·Î ¹Ù²î¾ú´Ù. */
88 hwpf
.Read2b(&beginpagenum
,1); /* ÆäÀÌÁö½ÃÀÛ¹øÈ£ */
91 hwpf
.Read2b(&beginfnnum
,1); /* °¢ÁÖ ½ÃÀÛ¹øÈ£ */
92 hwpf
.Read2b(&countfn
,1); /* °¢ÁÖ °¹¼ö */
93 splinetext
= (short) hwpf
.Read2b();
94 splinefn
= (short) hwpf
.Read2b();
95 spfnfn
= (short) hwpf
.Read2b();
96 hwpf
.Read1b(&fnchar
, 1);
97 hwpf
.Read1b(&fnlinetype
, 1);
99 for (int ii
= 0; ii
< 4; ++ii
)
100 bordermargin
[ii
] = (short) hwpf
.Read2b();
101 hwpf
.Read2b(&borderline
, 1);
103 hwpf
.Read1b(&empty_line_hide
, 1);
104 hwpf
.Read1b(&table_move
, 1);
105 hwpf
.Read1b(&compressed
, 1);
107 hwpf
.Read1b(&reserved3
, 1);
109 hwpf
.Read2b(&info_block_len
, 1);
113 /* ¹®¼ ¿ä¾àÀ» Àд´Ù. */
114 if (!summary
.Read(hwpf
))
116 if (info_block_len
> 0)
118 info_block
= new unsigned char[info_block_len
+ 1];
120 if (0 == info_block
||
121 !HWPReadInfoBlock(info_block
, info_block_len
, hwpf
))
125 /* hwpfÀÇ °ªÀ» Àç¼³Á¤ ÇÑ´Ù. */
126 hwpf
.compressed
= compressed
? true : false;
127 hwpf
.encrypted
= encrypted
? true : false;
128 hwpf
.info_block_len
= info_block_len
;
129 hwpf
.SetCompressed(hwpf
.compressed
);
131 return (!hwpf
.State());
137 bool HWPSummary::Read(HWPFile
& hwpf
)
139 hwpf
.Read2b(title
, 56);
140 hwpf
.Read2b(subject
, 56);
141 hwpf
.Read2b(author
, 56);
142 hwpf
.Read2b(date
, 56);
143 hwpf
.Read2b(keyword
[0], 56);
144 hwpf
.Read2b(keyword
[1], 56);
145 hwpf
.Read2b(etc
[0], 56);
146 hwpf
.Read2b(etc
[1], 56);
147 hwpf
.Read2b(etc
[2], 56);
149 return (!hwpf
.State());
153 bool ParaShape::Read(HWPFile
& hwpf
)
156 left_margin
= (short) hwpf
.Read2b();
157 right_margin
= (short) hwpf
.Read2b();
158 indent
= (short) hwpf
.Read2b();
159 lspacing
= (short) hwpf
.Read2b();
160 pspacing_next
= (short) hwpf
.Read2b();
162 hwpf
.Read1b(&condense
, 1);
163 hwpf
.Read1b(&arrange_type
, 1);
164 for (int ii
= 0; ii
< MAXTABS
; ii
++)
166 hwpf
.Read1b(&tabs
[ii
].type
, 1);
167 hwpf
.Read1b(&tabs
[ii
].dot_continue
, 1);
168 tabs
[ii
].position
= (short) hwpf
.Read2b();
170 hwpf
.Read1b(&coldef
.ncols
, 1);
171 hwpf
.Read1b(&coldef
.separator
, 1);
172 coldef
.spacing
= (short) hwpf
.Read2b();
173 coldef
.columnlen
= (short) hwpf
.Read2b();
174 coldef
.columnlen0
= (short) hwpf
.Read2b();
175 hwpf
.Read1b(&shade
, 1);
176 hwpf
.Read1b(&outline
, 1);
177 hwpf
.Read1b(&outline_continue
, 1);
178 pspacing_prev
= (short) hwpf
.Read2b();
180 hwpf
.Read1b(reserved
, 2);
181 return (!hwpf
.State());
185 bool CharShape::Read(HWPFile
& hwpf
)
187 size
= (short) hwpf
.Read2b();
188 hwpf
.Read1b(font
, NLanguage
);
189 hwpf
.Read1b(ratio
, NLanguage
);
190 hwpf
.Read1b(space
, NLanguage
);
191 hwpf
.Read1b(color
, 2);
192 hwpf
.Read1b(&shade
, 1);
193 hwpf
.Read1b(&attr
, 1);
194 hwpf
.Read1b(reserved
, 4);
196 return (!hwpf
.State());
199 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */