merged tag ooo/DEV300_m102
[LibreOffice.git] / hwpfilter / source / hwpread.cpp
blobfaef616a57555420ff8303c5582360b6364bedc2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 /* $Id: hwpread.cpp,v 1.5 2008-04-10 12:10:14 rt Exp $ */
30 #include "precompile.h"
32 #include "list.hxx"
34 #include "hwpfile.h"
35 #include "hbox.h"
36 #include "hpara.h"
37 #include "drawing.h"
38 #include "htags.h"
39 #include "hcode.h"
41 static short fboxnum = 1;
42 static int zindex = 1;
43 static int lnnumber = 0;
45 int HBox::Read(HWPFile & )
47 // already read
48 return 1;
52 // skip block
54 int SkipBlock::Read(HWPFile & hwpf)
56 hwpf.Read4b(&data_block_len, 1);
57 hwpf.Read2b(&dummy, 1);
59 if (!(IS_SP_SKIP_BLOCK(hh) && (hh == dummy))){
60 return hwpf.SetState(HWP_InvalidFileFormat);
63 data_block = new char[data_block_len];
65 return hwpf.Read1b(data_block, data_block_len);
69 // Field code(5)
70 int FieldCode::Read(HWPFile & hwpf)
72 ulong size;
73 hchar dummy;
74 ulong len1; /* hcharŸÀÔÀÇ ¹®ÀÚ¿­ Å×ÀÌÅÍ #1ÀÇ ±æÀÌ */
75 ulong len2; /* hcharŸÀÔÀÇ ¹®ÀÚ¿­ Å×ÀÌÅÍ #2ÀÇ ±æÀÌ */
76 ulong len3; /* hcharŸÀÔÀÇ ¹®ÀÚ¿­ Å×ÀÌÅÍ #3ÀÇ ±æÀÌ */
77 ulong binlen; /* ÀÓÀÇ Çü½ÄÀÇ ¹ÙÀ̳ʸ® µ¥ÀÌŸ ±æÀÌ */
79 hwpf.Read4b(&size, 1);
80 hwpf.Read2b(&dummy, 1);
81 hwpf.Read1b(&type, 2);
82 hwpf.Read4b(reserved1, 1);
83 hwpf.Read2b(&location_info, 1);
84 hwpf.Read1b(reserved2, 22);
85 hwpf.Read4b(&len1, 1);
86 hwpf.Read4b(&len2, 1);
87 hwpf.Read4b(&len3, 1);
88 hwpf.Read4b(&binlen, 1);
90 str1 = new hchar[len1];
91 str2 = new hchar[len2];
92 str3 = new hchar[len3];
93 bin = new char[binlen];
95 hwpf.Read2b(str1, len1/2);
96 hwpf.Read2b(str2, len2/2);
97 hwpf.Read2b(str3, len3/2);
99 hwpf.ReadBlock(bin, binlen);
101 if( type[0] == 3 && type[1] == 2 ){ /* ¸¸µç³¯Â¥·Î¼­ Æ÷¸ËÀ» »ý¼ºÇØ¾ß ÇÑ´Ù. */
102 DateCode *pDate = new DateCode;
103 for( int i = 0 ;i < (int)(len3/2) ; i++ ){
104 if(str3[i] == 0 ) break;
105 if( i >= DATE_SIZE ) break;
106 pDate->format[i] = str3[i];
108 hwpf.AddDateFormat(pDate);
109 m_pDate = pDate;
112 return true;
116 // book mark(6)
117 int Bookmark::Read(HWPFile & hwpf)
119 long len;
121 hwpf.Read4b(&len, 1);
122 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
124 if (!(len == 34))// 2 * (BMK_COMMENT_LEN + 1) + 2
126 return hwpf.SetState(HWP_InvalidFileFormat);
128 if (!(hh == dummy && dummy == CH_BOOKMARK)){
129 return hwpf.SetState(HWP_InvalidFileFormat);
132 hwpf.Read2b(id, BMK_COMMENT_LEN + 1);
133 hwpf.Read2b(&type, 1);
134 //return hwpf.Read2b(&type, 1);
135 return 1;
139 // date format(7)
141 int DateFormat::Read(HWPFile & hwpf)
143 hwpf.Read2b(format, DATE_SIZE);
144 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
145 if (!(hh == dummy && CH_DATE_FORM == dummy)){
146 return hwpf.SetState(HWP_InvalidFileFormat);
148 return true;
152 // date code(8)
154 int DateCode::Read(HWPFile & hwpf)
156 hwpf.Read2b(format, DATE_SIZE);
157 hwpf.Read2b(date, 6);
158 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
159 if (!(hh == dummy && CH_DATE_CODE == dummy)){
160 return hwpf.SetState(HWP_InvalidFileFormat);
162 hwpf.AddDateFormat(this);
163 return true;
167 // tab(9)
169 int Tab::Read(HWPFile & hwpf)
171 width = hwpf.Read2b();
172 leader = sal::static_int_cast<unsigned short>(hwpf.Read2b());
173 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
174 if (!(hh == dummy && CH_TAB == dummy)){
175 return hwpf.SetState(HWP_InvalidFileFormat);
177 return true;
181 // tbox(10) TABLE BOX MATH BUTTON HYPERTEXT
183 static void UpdateBBox(FBox * fbox)
185 fbox->boundsy = fbox->pgy;
186 fbox->boundey = fbox->pgy + fbox->ys - 1;
190 void Cell::Read(HWPFile & hwpf)
192 hwpf.Read2b(&p, 1);
193 hwpf.Read2b(&color, 1);
194 hwpf.Read2b(&x, 1);
195 hwpf.Read2b(&y, 1);
196 hwpf.Read2b(&w, 1);
197 hwpf.Read2b(&h, 1);
198 hwpf.Read2b(&txthigh, 1);
199 hwpf.Read2b(&cellhigh, 1);
201 hwpf.Read1b(&flag, 1);
202 hwpf.Read1b(&changed, 1);
203 hwpf.Read1b(&used, 1);
204 hwpf.Read1b(&ver_align, 1);
205 hwpf.Read1b(linetype, 4);
206 hwpf.Read1b(&shade, 1);
207 hwpf.Read1b(&diagonal, 1);
208 hwpf.Read1b(&protect, 1);
212 int TxtBox::Read(HWPFile & hwpf)
214 int ii, ncell;
216 hwpf.Read2b(reserved, 2);
217 hwpf.Read2b(&dummy, 1);
219 if (!(hh == dummy && CH_TEXT_BOX == dummy)){
220 return hwpf.SetState(HWP_InvalidFileFormat);
222 hwpf.AddBox(this);
223 hwpf.Read2b(&style.cap_len, 1);
224 hwpf.Read2b(&dummy1, 1);
225 hwpf.Read2b(&next, 1);
226 hwpf.Read2b(&dummy2, 1);
228 style.boxnum = fboxnum++;
229 zorder = zindex++;
230 hwpf.Read1b(&style.anchor_type, 1);
231 hwpf.Read1b(&style.txtflow, 1);
232 hwpf.Read2b(&style.xpos, 1);
233 hwpf.Read2b(&style.ypos, 1);
234 hwpf.Read2b(&option, 1);
235 hwpf.Read2b(&ctrl_ch, 1);
236 hwpf.Read2b(style.margin, 12);
237 hwpf.AddFBoxStyle(&style);
238 hwpf.Read2b(&box_xs, 1);
239 hwpf.Read2b(&box_ys, 1);
240 hwpf.Read2b(&cap_xs, 1);
241 hwpf.Read2b(&cap_ys, 1);
242 hwpf.Read2b(&style.cap_len, 1);
243 hwpf.Read2b(&xs, 1);
244 hwpf.Read2b(&ys, 1);
245 hwpf.Read2b(&cap_margin, 1);
246 hwpf.Read1b(&xpos_type, 1);
247 hwpf.Read1b(&ypos_type, 1);
248 hwpf.Read1b(&smart_linesp, 1);
249 hwpf.Read1b(&reserved1, 1);
250 hwpf.Read2b(&pgx, 1);
251 hwpf.Read2b(&pgy, 1);
252 hwpf.Read2b(&pgno, 1);
253 if( ( pgno +1 ) != hwpf.getCurrentPage() )
254 pgno = sal::static_int_cast<short>(hwpf.getCurrentPage() -1) ;
256 hwpf.Read2b(&showpg, 1);
257 hwpf.Read2b(&cap_pos, 1);
258 hwpf.Read2b(&num, 1);
259 hwpf.Read2b(&dummy3, 1);
260 hwpf.Read2b(&baseline, 1);
261 hwpf.Read2b(&type, 1);
262 hwpf.Read2b(&nCell, 1);
263 hwpf.Read2b(&protect, 1);
264 switch (type)
266 case 0: //table
267 style.boxtype = 'T';
268 break;
269 case 1: // text-box
270 style.boxtype = 'X';
271 break;
272 case 2: // equation
273 style.boxtype = 'E';
274 break;
275 case 3: // button
276 style.boxtype = 'B';
277 break;
278 default: // other
279 style.boxtype = 'O';
280 break;
283 UpdateBBox(this);
285 ncell = NCell();
286 if (!(ncell > 0)){
287 return hwpf.SetState(HWP_InvalidFileFormat);
290 cell = new Cell[ncell];
291 for (ii = 0; ii < ncell; ii++)
293 cell[ii].Read(hwpf);
294 cell[ii].key = sal::static_int_cast<unsigned char>(ii);
296 if (ncell == 1)
297 style.cell = &cell[0];
298 plists = new LinkedList < HWPPara >[ncell];
299 for (ii = 0; ii < ncell; ii++)
300 hwpf.ReadParaList(plists[ii]);
301 // caption
302 hwpf.ReadParaList(caption);
304 if( type == 0 ){ // if table?
305 Table *tbl = new Table;
306 for( ii = 0 ; ii < ncell; ii++)
308 tbl->columns.insert(cell[ii].x);
309 tbl->columns.insert(cell[ii].x + cell[ii].w);
310 tbl->rows.insert(cell[ii].y);
311 tbl->rows.insert(cell[ii].y + cell[ii].h);
313 TCell* *pArr = new TCell*[ncell];
314 for( ii = 0 ; ii < ncell; ii++)
316 TCell *tcell = new TCell;
317 tcell->nColumnIndex = tbl->columns.getIndex(cell[ii].x);
318 tcell->nColumnSpan = tbl->columns.getIndex(cell[ii].x + cell[ii].w) -
319 tcell->nColumnIndex;
320 tcell->nRowIndex = tbl->rows.getIndex(cell[ii].y);
321 tcell->nRowSpan = tbl->rows.getIndex(cell[ii].y + cell[ii].h) -
322 tcell->nRowIndex;
323 tcell->pCell = &cell[ii];
324 pArr[ii] = tcell;
326 TCell *tmp;
327 // Sort by row and column
328 for( ii = 0 ; ii < ncell - 1; ii++ ){
329 for( int jj = ii ; jj < ncell ; jj++){
330 if( pArr[ii]->nRowIndex > pArr[jj]->nRowIndex ){
331 tmp = pArr[ii];
332 pArr[ii] = pArr[jj];
333 pArr[jj] = tmp;
336 for( int kk = ii ; kk > 0 ; kk--){
337 if( ( pArr[kk]->nRowIndex == pArr[kk-1]->nRowIndex ) &&
338 (pArr[kk]->nColumnIndex < pArr[kk-1]->nColumnIndex )){
339 tmp = pArr[kk];
340 pArr[kk] = pArr[kk-1];
341 pArr[kk-1] = tmp;
345 for( ii = 0 ; ii < ncell ; ii++ ){
346 tbl->cells.insert(pArr[ii]);
348 tbl->box = this;
349 hwpf.AddTable(tbl);
350 m_pTable = tbl;
351 delete[] pArr;
353 else
354 m_pTable = 0L;
356 return !hwpf.State();
360 // picture(11)
361 int Picture::Read(HWPFile & hwpf)
363 hwpf.Read2b(reserved, 2);
364 hwpf.Read2b(&dummy, 1);
366 if (!(hh == dummy && CH_PICTURE == dummy)){
367 return hwpf.SetState(HWP_InvalidFileFormat);
369 hwpf.AddBox(this);
371 hwpf.Read4b(&follow_block_size, 1);
372 hwpf.Read2b(&dummy1, 1); /* ¿¹¾à 4¹ÙÀÌÆ® */
373 hwpf.Read2b(&dummy2, 1);
375 style.boxnum = fboxnum++;
376 zorder = zindex++;
377 hwpf.Read1b(&style.anchor_type, 1); /* ±âÁØÀ§Ä¡ */
378 hwpf.Read1b(&style.txtflow, 1); /* ±×¸²ÇÇÇÔ. 0-2(ÀÚ¸®Â÷Áö,Åõ¸í,¾î¿ï¸²) */
379 hwpf.Read2b(&style.xpos, 1); /* °¡·ÎÀ§Ä¡ : 1 ¿ÞÂÊ, 2¿À¸¥ÂÊ, 3 °¡¿îµ¥, ÀÌ¿Ü = ÀÓÀÇ */
380 hwpf.Read2b(&style.ypos, 1); /* ¼¼·ÎÀ§Ä¡ : 1 À§, 2 ¾Æ·¡, 3 °¡¿îµ¥, ÀÌ¿Ü ÀÓÀÇ */
381 hwpf.Read2b(&option, 1); /* ±âŸ¿É¼Ç : Å׵θ®,±×¸²¹ÝÀü,µî. bit·Î ÀúÀå. */
382 hwpf.Read2b(&ctrl_ch, 1); /* Ç×»ó 11 */
383 hwpf.Read2b(style.margin, 12); /* ¿©¹é : [0-2][] out/in/¼¿,[][0-3] ¿Þ/¿À¸¥/À§/¾Æ·¡ ¿©¹é */
384 hwpf.Read2b(&box_xs, 1); /* ¹Ú½ºÅ©±â °¡·Î */
385 hwpf.Read2b(&box_ys, 1); /* ¼¼·Î */
386 hwpf.Read2b(&cap_xs, 1); /* ĸ¼Ç Å©±â °¡·Î */
387 hwpf.Read2b(&cap_ys, 1); /* ¼¼·Î */
388 hwpf.Read2b(&style.cap_len, 1); /* ±æÀÌ */
389 hwpf.Read2b(&xs, 1); /* Àüü Å©±â(¹Ú½º Å©±â + ĸ¼Ç + ¿©¹é) °¡·Î */
390 hwpf.Read2b(&ys, 1); /* ¼¼·Î */
391 hwpf.Read2b(&cap_margin, 1); /* ĸ¼Ç ¿©¹é */
392 hwpf.Read1b(&xpos_type, 1);
393 hwpf.Read1b(&ypos_type, 1);
394 hwpf.Read1b(&smart_linesp, 1); /* ÁÙ°£°Ý º¸È£ : 0 ¹Ìº¸È£, 1 º¸È£ */
395 hwpf.Read1b(&reserved1, 1);
396 hwpf.Read2b(&pgx, 1); /* ½ÇÁ¦ °è»êµÈ ¹Ú½º °¡·Î */
397 hwpf.Read2b(&pgy, 1); /* ¼¼·Î */
398 hwpf.Read2b(&pgno, 1); /* ÆäÀÌÁö ¼ýÀÚ : 0ºÎÅÍ ½ÃÀÛ */
399 hwpf.Read2b(&showpg, 1); /* ¹Ú½ºº¸¿©ÁÜ */
400 hwpf.Read2b(&cap_pos, 1); /* ĸ¼ÇÀ§Ä¡ 0 - 7 ¸Þ´º¼ø¼­. */
401 hwpf.Read2b(&num, 1); /* ¹Ú½º¹øÈ£ 0ºÎÅÍ ½ÃÀÛÇؼ­ ¸Å±äÀϷùøÈ£ */
403 hwpf.Read1b(&pictype, 1); /* ±×¸²Á¾·ù */
405 skip[0] = (short) hwpf.Read2b(); /* ±×¸²¿¡¼­ ½ÇÁ¦ Ç¥½Ã¸¦ ½ÃÀÛÇÒ À§Ä¡ °¡·Î */
406 skip[1] = (short) hwpf.Read2b(); /* ¼¼·Î */
407 scale[0] = (short) hwpf.Read2b(); /* È®´ëºñÀ² : 0 °íÁ¤, ÀÌ¿Ü ÆÛ¼¾Æ® ´ÜÀ§ °¡·Î */
408 scale[1] = (short) hwpf.Read2b(); /* ¼¼·Î */
410 hwpf.Read1b(picinfo.picun.path, 256); /* ±×¸²ÆÄÀÏ À̸§ : Á¾·ù°¡ DrawingÀÌ ¾Æ´Ò¶§. */
411 hwpf.Read1b(reserved3, 9); /* ¹à±â/¸í¾Ï/±×¸²È¿°ú µî */
413 UpdateBBox(this);
414 if( pictype != PICTYPE_DRAW )
415 style.cell = reserved3;
417 if (follow_block_size != 0)
419 follow = new unsigned char[follow_block_size];
421 hwpf.Read1b(follow, follow_block_size);
422 if (pictype == PICTYPE_DRAW)
424 hmem = new HMemIODev((char *) follow, follow_block_size);
425 LoadDrawingObjectBlock(this);
426 style.cell = picinfo.picdraw.hdo;
427 delete hmem;
429 hmem = 0;
431 else
433 if ((follow[3] << 24 | follow[2] << 16 | follow[1] << 8 | follow[0]) == 0x269)
435 ishyper = true;
440 if( pictype != 3 )
441 style.boxtype = 'G';
442 else
443 style.boxtype = 'D';
444 hwpf.AddFBoxStyle(&style);
446 // cation
447 hwpf.ReadParaList(caption);
449 return !hwpf.State();
453 // line(15)
455 Line::Line():FBox(CH_LINE)
460 int Line::Read(HWPFile & hwpf)
462 hwpf.Read2b(reserved, 2);
463 hwpf.Read2b(&dummy, 1);
465 if (!(hh == dummy && CH_LINE == dummy)){
466 return hwpf.SetState(HWP_InvalidFileFormat);
468 hwpf.AddBox(this);
470 style.boxnum = fboxnum++;
471 zorder = zindex++;
472 style.boxtype = 'L';
473 hwpf.Read1b(&reserved2, 8);
474 hwpf.Read1b(&style.anchor_type, 1);
475 hwpf.Read1b(&style.txtflow, 1);
476 hwpf.Read2b(&style.xpos, 1);
477 hwpf.Read2b(&style.ypos, 1);
478 hwpf.Read2b(&option, 1);
479 hwpf.Read2b(&ctrl_ch, 1);
480 hwpf.Read2b(style.margin, 12);
481 hwpf.AddFBoxStyle(&style);
482 hwpf.Read2b(&box_xs, 1);
483 hwpf.Read2b(&box_ys, 1);
484 hwpf.Read2b(&cap_xs, 1);
485 hwpf.Read2b(&cap_ys, 1);
486 hwpf.Read2b(&style.cap_len, 1);
487 hwpf.Read2b(&xs, 1);
488 hwpf.Read2b(&ys, 1);
489 lnnumber = style.boxnum;
490 hwpf.linenumber = 1;
491 hwpf.Read2b(&boundsy, 1);
492 hwpf.Read2b(&boundey, 1);
493 hwpf.Read1b(&boundx, 1);
494 hwpf.Read1b(&draw, 1);
496 hwpf.Read2b(&pgx, 1);
497 hwpf.Read2b(&pgy, 1);
498 hwpf.Read2b(&pgno, 1);
499 hwpf.Read2b(&showpg, 1);
501 hwpf.Read2b(&sx, 1);
502 hwpf.Read2b(&sy, 1);
503 hwpf.Read2b(&ex, 1);
504 hwpf.Read2b(&sy, 1);
505 hwpf.Read2b(&width, 1);
506 hwpf.Read2b(&shade, 1);
507 hwpf.Read2b(&color, 1);
508 style.xpos = width;
510 return !hwpf.State();
514 // hidden(15)
515 Hidden::Hidden():HBox(CH_HIDDEN)
520 int Hidden::Read(HWPFile & hwpf)
522 hwpf.Read2b(reserved, 2);
523 hwpf.Read2b(&dummy, 1);
524 if (!(hh == dummy && CH_HIDDEN == dummy)){
525 return hwpf.SetState(HWP_InvalidFileFormat);
528 hwpf.Read1b(info, 8);
529 hwpf.ReadParaList(plist);
531 return !hwpf.State();
535 // header/footer(16)
536 HeaderFooter::HeaderFooter():HBox(CH_HEADER_FOOTER)
538 linenumber = 0;
542 int HeaderFooter::Read(HWPFile & hwpf)
544 hwpf.Read2b(reserved, 2);
545 hwpf.Read2b(&dummy, 1);
546 if (!(hh == dummy && CH_HEADER_FOOTER == dummy)){
547 return hwpf.SetState(HWP_InvalidFileFormat);
550 hwpf.Read1b(info, 8);
551 hwpf.Read1b(&type, 1);
552 hwpf.Read1b(&where, 1);
553 lnnumber = 0;
554 hwpf.ReadParaList(plist, CH_HEADER_FOOTER);
555 linenumber = sal::static_int_cast<unsigned char>(lnnumber);
556 m_nPageNumber = hwpf.getCurrentPage();
557 hwpf.setMaxSettedPage();
558 hwpf.AddHeaderFooter(this);
560 return !hwpf.State();
564 // footnote(17)
565 Footnote::Footnote():HBox(CH_FOOTNOTE)
570 int Footnote::Read(HWPFile & hwpf)
572 hwpf.Read2b(reserved, 2);
573 hwpf.Read2b(&dummy, 1);
574 if (!(hh == dummy && CH_FOOTNOTE == dummy)){
575 return hwpf.SetState(HWP_InvalidFileFormat);
578 hwpf.Read1b(info, 8);
579 hwpf.Read2b(&number, 1);
580 hwpf.Read2b(&type, 1);
581 width = (short) hwpf.Read2b();
582 hwpf.ReadParaList(plist, CH_FOOTNOTE);
584 return !hwpf.State();
588 // auto number(18)
589 AutoNum::AutoNum():HBox(CH_AUTO_NUM)
594 int AutoNum::Read(HWPFile & hwpf)
596 hwpf.Read2b(&type, 1);
597 hwpf.Read2b(&number, 1);
598 hwpf.Read2b(&dummy, 1);
600 if (!(hh == dummy)){
601 return hwpf.SetState(HWP_InvalidFileFormat);
603 return !hwpf.State();
607 // new number(19)
608 NewNum::NewNum():HBox(CH_NEW_NUM)
613 int NewNum::Read(HWPFile & hwpf)
615 hwpf.Read2b(&type, 1);
616 hwpf.Read2b(&number, 1);
617 hwpf.Read2b(&dummy, 1);
619 if (!(hh == dummy)){
620 return hwpf.SetState(HWP_InvalidFileFormat);
622 return !hwpf.State();
626 // show page number (20)
627 ShowPageNum::ShowPageNum():HBox(CH_SHOW_PAGE_NUM)
632 int ShowPageNum::Read(HWPFile & hwpf)
634 hwpf.Read2b(&where, 1);
635 hwpf.Read2b(&shape, 1);
636 hwpf.Read2b(&dummy, 1);
638 if (!(hh == dummy)){
639 return hwpf.SetState(HWP_InvalidFileFormat);
641 m_nPageNumber = hwpf.getCurrentPage();
642 hwpf.setMaxSettedPage();
643 hwpf.AddPageNumber(this);
644 return !hwpf.State();
648 /* Ȧ¼öÂʽÃÀÛ/°¨Ãß±â (21) */
649 PageNumCtrl::PageNumCtrl():HBox(CH_PAGE_NUM_CTRL)
654 int PageNumCtrl::Read(HWPFile & hwpf)
656 hwpf.Read2b(&kind, 1);
657 hwpf.Read2b(&what, 1);
658 hwpf.Read2b(&dummy, 1);
660 if (!(hh == dummy)){
661 return hwpf.SetState(HWP_InvalidFileFormat);
663 return !hwpf.State();
667 // mail merge(22)
668 MailMerge::MailMerge():HBox(CH_MAIL_MERGE)
673 int MailMerge::Read(HWPFile & hwpf)
675 hwpf.Read1b(field_name, 20);
676 hwpf.Read2b(&dummy, 1);
678 if (!(hh == dummy)){
679 return hwpf.SetState(HWP_InvalidFileFormat);
681 return !hwpf.State();
685 // char compositon(23)
686 Compose::Compose():HBox(CH_COMPOSE)
691 int Compose::Read(HWPFile & hwpf)
693 hwpf.Read2b(compose, 3);
694 hwpf.Read2b(&dummy, 1);
696 if (!(hh == dummy)){
697 return hwpf.SetState(HWP_InvalidFileFormat);
699 return !hwpf.State();
703 // hyphen(24)
704 Hyphen::Hyphen():HBox(CH_HYPHEN)
709 int Hyphen::Read(HWPFile & hwpf)
711 hwpf.Read2b(&width, 1);
712 hwpf.Read2b(&dummy, 1);
714 if (!(hh == dummy)){
715 return hwpf.SetState(HWP_InvalidFileFormat);
717 return !hwpf.State();
721 // toc mark(25)
722 TocMark::TocMark():HBox(CH_TOC_MARK)
727 int TocMark::Read(HWPFile & hwpf)
729 hwpf.Read2b(&kind, 1);
730 hwpf.Read2b(&dummy, 1);
732 if (!(hh == dummy)){
733 return hwpf.SetState(HWP_InvalidFileFormat);
735 return !hwpf.State();
739 // index mark(26)
740 IndexMark::IndexMark():HBox(CH_INDEX_MARK)
745 int IndexMark::Read(HWPFile & hwpf)
747 hwpf.Read2b(&keyword1, 60);
748 hwpf.Read2b(&keyword2, 60);
749 hwpf.Read2b(&pgno, 1);
750 hwpf.Read2b(&dummy, 1);
752 if (!(hh == dummy)){
753 return hwpf.SetState(HWP_InvalidFileFormat);
755 return !hwpf.State();
759 // outline(28)
760 Outline::Outline():HBox(CH_OUTLINE)
765 int Outline::Read(HWPFile & hwpf)
767 hwpf.Read2b(&kind, 1);
768 hwpf.Read1b(&shape, 1);
769 hwpf.Read1b(&level, 1);
770 hwpf.Read2b(number, 7);
771 hwpf.Read2b(user_shape, 7);
772 hwpf.Read2b(deco, 14);
773 hwpf.Read2b(&dummy, 1);
775 if (!(hh == dummy)){
776 return hwpf.SetState(HWP_InvalidFileFormat);
778 return !hwpf.State();
782 /* ¹­À½ ºóÄ­(30) */
783 KeepSpace::KeepSpace():HBox(CH_KEEP_SPACE)
788 int KeepSpace::Read(HWPFile & hwpf)
790 hwpf.Read2b(&dummy, 1);
792 if (!(hh == dummy)){
793 return hwpf.SetState(HWP_InvalidFileFormat);
795 return !hwpf.State();
799 /* °íÁ¤Æø ºóÄ­(31) */
800 FixedSpace::FixedSpace():HBox(CH_FIXED_SPACE)
805 int FixedSpace::Read(HWPFile & hwpf)
807 hwpf.Read2b(&dummy, 1);
809 if (!(hh == dummy)){
810 return hwpf.SetState(HWP_InvalidFileFormat);
812 return !hwpf.State();