merge the formfield patch from ooo-build
[ooovba.git] / hwpfilter / source / hwpread.cpp
blobbcf2d07bac6821010557d629584418c082455546
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hwpread.cpp,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 /* $Id: hwpread.cpp,v 1.5 2008-04-10 12:10:14 rt Exp $ */
33 #include "precompile.h"
35 #include "list.hxx"
37 #include "hwpfile.h"
38 #include "hbox.h"
39 #include "hpara.h"
40 #include "drawing.h"
41 #include "htags.h"
42 #include "hcode.h"
44 static short fboxnum = 1;
45 static int zindex = 1;
46 static int lnnumber = 0;
48 int HBox::Read(HWPFile & )
50 // already read
51 return 1;
55 // skip block
57 int SkipBlock::Read(HWPFile & hwpf)
59 hwpf.Read4b(&data_block_len, 1);
60 hwpf.Read2b(&dummy, 1);
62 if (!(IS_SP_SKIP_BLOCK(hh) && (hh == dummy))){
63 return hwpf.SetState(HWP_InvalidFileFormat);
66 data_block = new char[data_block_len];
68 return hwpf.Read1b(data_block, data_block_len);
72 // Field code(5)
73 int FieldCode::Read(HWPFile & hwpf)
75 ulong size;
76 hchar dummy;
77 ulong len1; /* hcharŸÀÔÀÇ ¹®ÀÚ¿­ Å×ÀÌÅÍ #1ÀÇ ±æÀÌ */
78 ulong len2; /* hcharŸÀÔÀÇ ¹®ÀÚ¿­ Å×ÀÌÅÍ #2ÀÇ ±æÀÌ */
79 ulong len3; /* hcharŸÀÔÀÇ ¹®ÀÚ¿­ Å×ÀÌÅÍ #3ÀÇ ±æÀÌ */
80 ulong binlen; /* ÀÓÀÇ Çü½ÄÀÇ ¹ÙÀ̳ʸ® µ¥ÀÌŸ ±æÀÌ */
82 hwpf.Read4b(&size, 1);
83 hwpf.Read2b(&dummy, 1);
84 hwpf.Read1b(&type, 2);
85 hwpf.Read4b(reserved1, 1);
86 hwpf.Read2b(&location_info, 1);
87 hwpf.Read1b(reserved2, 22);
88 hwpf.Read4b(&len1, 1);
89 hwpf.Read4b(&len2, 1);
90 hwpf.Read4b(&len3, 1);
91 hwpf.Read4b(&binlen, 1);
93 str1 = new hchar[len1];
94 str2 = new hchar[len2];
95 str3 = new hchar[len3];
96 bin = new char[binlen];
98 hwpf.Read2b(str1, len1/2);
99 hwpf.Read2b(str2, len2/2);
100 hwpf.Read2b(str3, len3/2);
102 hwpf.ReadBlock(bin, binlen);
104 if( type[0] == 3 && type[1] == 2 ){ /* ¸¸µç³¯Â¥·Î¼­ Æ÷¸ËÀ» »ý¼ºÇØ¾ß ÇÑ´Ù. */
105 DateCode *pDate = new DateCode;
106 for( int i = 0 ;i < (int)(len3/2) ; i++ ){
107 if(str3[i] == 0 ) break;
108 if( i >= DATE_SIZE ) break;
109 pDate->format[i] = str3[i];
111 hwpf.AddDateFormat(pDate);
112 m_pDate = pDate;
115 return true;
119 // book mark(6)
120 int Bookmark::Read(HWPFile & hwpf)
122 long len;
124 hwpf.Read4b(&len, 1);
125 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
127 if (!(len == 34))// 2 * (BMK_COMMENT_LEN + 1) + 2
129 return hwpf.SetState(HWP_InvalidFileFormat);
131 if (!(hh == dummy && dummy == CH_BOOKMARK)){
132 return hwpf.SetState(HWP_InvalidFileFormat);
135 hwpf.Read2b(id, BMK_COMMENT_LEN + 1);
136 hwpf.Read2b(&type, 1);
137 //return hwpf.Read2b(&type, 1);
138 return 1;
142 // date format(7)
144 int DateFormat::Read(HWPFile & hwpf)
146 hwpf.Read2b(format, DATE_SIZE);
147 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
148 if (!(hh == dummy && CH_DATE_FORM == dummy)){
149 return hwpf.SetState(HWP_InvalidFileFormat);
151 return true;
155 // date code(8)
157 int DateCode::Read(HWPFile & hwpf)
159 hwpf.Read2b(format, DATE_SIZE);
160 hwpf.Read2b(date, 6);
161 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
162 if (!(hh == dummy && CH_DATE_CODE == dummy)){
163 return hwpf.SetState(HWP_InvalidFileFormat);
165 hwpf.AddDateFormat(this);
166 return true;
170 // tab(9)
172 int Tab::Read(HWPFile & hwpf)
174 width = hwpf.Read2b();
175 leader = sal::static_int_cast<unsigned short>(hwpf.Read2b());
176 dummy = sal::static_int_cast<hchar>(hwpf.Read2b());
177 if (!(hh == dummy && CH_TAB == dummy)){
178 return hwpf.SetState(HWP_InvalidFileFormat);
180 return true;
184 // tbox(10) TABLE BOX MATH BUTTON HYPERTEXT
186 static void UpdateBBox(FBox * fbox)
188 fbox->boundsy = fbox->pgy;
189 fbox->boundey = fbox->pgy + fbox->ys - 1;
193 void Cell::Read(HWPFile & hwpf)
195 hwpf.Read2b(&p, 1);
196 hwpf.Read2b(&color, 1);
197 hwpf.Read2b(&x, 1);
198 hwpf.Read2b(&y, 1);
199 hwpf.Read2b(&w, 1);
200 hwpf.Read2b(&h, 1);
201 hwpf.Read2b(&txthigh, 1);
202 hwpf.Read2b(&cellhigh, 1);
204 hwpf.Read1b(&flag, 1);
205 hwpf.Read1b(&changed, 1);
206 hwpf.Read1b(&used, 1);
207 hwpf.Read1b(&ver_align, 1);
208 hwpf.Read1b(linetype, 4);
209 hwpf.Read1b(&shade, 1);
210 hwpf.Read1b(&diagonal, 1);
211 hwpf.Read1b(&protect, 1);
215 int TxtBox::Read(HWPFile & hwpf)
217 int ii, ncell;
219 hwpf.Read2b(reserved, 2);
220 hwpf.Read2b(&dummy, 1);
222 if (!(hh == dummy && CH_TEXT_BOX == dummy)){
223 return hwpf.SetState(HWP_InvalidFileFormat);
225 hwpf.AddBox(this);
226 hwpf.Read2b(&style.cap_len, 1);
227 hwpf.Read2b(&dummy1, 1);
228 hwpf.Read2b(&next, 1);
229 hwpf.Read2b(&dummy2, 1);
231 style.boxnum = fboxnum++;
232 zorder = zindex++;
233 hwpf.Read1b(&style.anchor_type, 1);
234 hwpf.Read1b(&style.txtflow, 1);
235 hwpf.Read2b(&style.xpos, 1);
236 hwpf.Read2b(&style.ypos, 1);
237 hwpf.Read2b(&option, 1);
238 hwpf.Read2b(&ctrl_ch, 1);
239 hwpf.Read2b(style.margin, 12);
240 hwpf.AddFBoxStyle(&style);
241 hwpf.Read2b(&box_xs, 1);
242 hwpf.Read2b(&box_ys, 1);
243 hwpf.Read2b(&cap_xs, 1);
244 hwpf.Read2b(&cap_ys, 1);
245 hwpf.Read2b(&style.cap_len, 1);
246 hwpf.Read2b(&xs, 1);
247 hwpf.Read2b(&ys, 1);
248 hwpf.Read2b(&cap_margin, 1);
249 hwpf.Read1b(&xpos_type, 1);
250 hwpf.Read1b(&ypos_type, 1);
251 hwpf.Read1b(&smart_linesp, 1);
252 hwpf.Read1b(&reserved1, 1);
253 hwpf.Read2b(&pgx, 1);
254 hwpf.Read2b(&pgy, 1);
255 hwpf.Read2b(&pgno, 1);
256 if( ( pgno +1 ) != hwpf.getCurrentPage() )
257 pgno = sal::static_int_cast<short>(hwpf.getCurrentPage() -1) ;
259 hwpf.Read2b(&showpg, 1);
260 hwpf.Read2b(&cap_pos, 1);
261 hwpf.Read2b(&num, 1);
262 hwpf.Read2b(&dummy3, 1);
263 hwpf.Read2b(&baseline, 1);
264 hwpf.Read2b(&type, 1);
265 hwpf.Read2b(&nCell, 1);
266 hwpf.Read2b(&protect, 1);
267 switch (type)
269 case 0: //table
270 style.boxtype = 'T';
271 break;
272 case 1: // text-box
273 style.boxtype = 'X';
274 break;
275 case 2: // equation
276 style.boxtype = 'E';
277 break;
278 case 3: // button
279 style.boxtype = 'B';
280 break;
281 default: // other
282 style.boxtype = 'O';
283 break;
286 UpdateBBox(this);
288 ncell = NCell();
289 if (!(ncell > 0)){
290 return hwpf.SetState(HWP_InvalidFileFormat);
293 cell = new Cell[ncell];
294 for (ii = 0; ii < ncell; ii++)
296 cell[ii].Read(hwpf);
297 cell[ii].key = sal::static_int_cast<unsigned char>(ii);
299 if (ncell == 1)
300 style.cell = &cell[0];
301 plists = new LinkedList < HWPPara >[ncell];
302 for (ii = 0; ii < ncell; ii++)
303 hwpf.ReadParaList(plists[ii]);
304 // caption
305 hwpf.ReadParaList(caption);
307 if( type == 0 ){ // if table?
308 Table *tbl = new Table;
309 for( ii = 0 ; ii < ncell; ii++)
311 tbl->columns.insert(cell[ii].x);
312 tbl->columns.insert(cell[ii].x + cell[ii].w);
313 tbl->rows.insert(cell[ii].y);
314 tbl->rows.insert(cell[ii].y + cell[ii].h);
316 TCell* *pArr = new TCell*[ncell];
317 for( ii = 0 ; ii < ncell; ii++)
319 TCell *tcell = new TCell;
320 tcell->nColumnIndex = tbl->columns.getIndex(cell[ii].x);
321 tcell->nColumnSpan = tbl->columns.getIndex(cell[ii].x + cell[ii].w) -
322 tcell->nColumnIndex;
323 tcell->nRowIndex = tbl->rows.getIndex(cell[ii].y);
324 tcell->nRowSpan = tbl->rows.getIndex(cell[ii].y + cell[ii].h) -
325 tcell->nRowIndex;
326 tcell->pCell = &cell[ii];
327 pArr[ii] = tcell;
329 TCell *tmp;
330 // Sort by row and column
331 for( ii = 0 ; ii < ncell - 1; ii++ ){
332 for( int jj = ii ; jj < ncell ; jj++){
333 if( pArr[ii]->nRowIndex > pArr[jj]->nRowIndex ){
334 tmp = pArr[ii];
335 pArr[ii] = pArr[jj];
336 pArr[jj] = tmp;
339 for( int kk = ii ; kk > 0 ; kk--){
340 if( ( pArr[kk]->nRowIndex == pArr[kk-1]->nRowIndex ) &&
341 (pArr[kk]->nColumnIndex < pArr[kk-1]->nColumnIndex )){
342 tmp = pArr[kk];
343 pArr[kk] = pArr[kk-1];
344 pArr[kk-1] = tmp;
348 for( ii = 0 ; ii < ncell ; ii++ ){
349 tbl->cells.insert(pArr[ii]);
351 tbl->box = this;
352 hwpf.AddTable(tbl);
353 m_pTable = tbl;
354 delete[] pArr;
356 else
357 m_pTable = 0L;
359 return !hwpf.State();
363 // picture(11)
364 int Picture::Read(HWPFile & hwpf)
366 hwpf.Read2b(reserved, 2);
367 hwpf.Read2b(&dummy, 1);
369 if (!(hh == dummy && CH_PICTURE == dummy)){
370 return hwpf.SetState(HWP_InvalidFileFormat);
372 hwpf.AddBox(this);
374 hwpf.Read4b(&follow_block_size, 1);
375 hwpf.Read2b(&dummy1, 1); /* ¿¹¾à 4¹ÙÀÌÆ® */
376 hwpf.Read2b(&dummy2, 1);
378 style.boxnum = fboxnum++;
379 zorder = zindex++;
380 hwpf.Read1b(&style.anchor_type, 1); /* ±âÁØÀ§Ä¡ */
381 hwpf.Read1b(&style.txtflow, 1); /* ±×¸²ÇÇÇÔ. 0-2(ÀÚ¸®Â÷Áö,Åõ¸í,¾î¿ï¸²) */
382 hwpf.Read2b(&style.xpos, 1); /* °¡·ÎÀ§Ä¡ : 1 ¿ÞÂÊ, 2¿À¸¥ÂÊ, 3 °¡¿îµ¥, ÀÌ¿Ü = ÀÓÀÇ */
383 hwpf.Read2b(&style.ypos, 1); /* ¼¼·ÎÀ§Ä¡ : 1 À§, 2 ¾Æ·¡, 3 °¡¿îµ¥, ÀÌ¿Ü ÀÓÀÇ */
384 hwpf.Read2b(&option, 1); /* ±âŸ¿É¼Ç : Å׵θ®,±×¸²¹ÝÀü,µî. bit·Î ÀúÀå. */
385 hwpf.Read2b(&ctrl_ch, 1); /* Ç×»ó 11 */
386 hwpf.Read2b(style.margin, 12); /* ¿©¹é : [0-2][] out/in/¼¿,[][0-3] ¿Þ/¿À¸¥/À§/¾Æ·¡ ¿©¹é */
387 hwpf.Read2b(&box_xs, 1); /* ¹Ú½ºÅ©±â °¡·Î */
388 hwpf.Read2b(&box_ys, 1); /* ¼¼·Î */
389 hwpf.Read2b(&cap_xs, 1); /* ĸ¼Ç Å©±â °¡·Î */
390 hwpf.Read2b(&cap_ys, 1); /* ¼¼·Î */
391 hwpf.Read2b(&style.cap_len, 1); /* ±æÀÌ */
392 hwpf.Read2b(&xs, 1); /* Àüü Å©±â(¹Ú½º Å©±â + ĸ¼Ç + ¿©¹é) °¡·Î */
393 hwpf.Read2b(&ys, 1); /* ¼¼·Î */
394 hwpf.Read2b(&cap_margin, 1); /* ĸ¼Ç ¿©¹é */
395 hwpf.Read1b(&xpos_type, 1);
396 hwpf.Read1b(&ypos_type, 1);
397 hwpf.Read1b(&smart_linesp, 1); /* ÁÙ°£°Ý º¸È£ : 0 ¹Ìº¸È£, 1 º¸È£ */
398 hwpf.Read1b(&reserved1, 1);
399 hwpf.Read2b(&pgx, 1); /* ½ÇÁ¦ °è»êµÈ ¹Ú½º °¡·Î */
400 hwpf.Read2b(&pgy, 1); /* ¼¼·Î */
401 hwpf.Read2b(&pgno, 1); /* ÆäÀÌÁö ¼ýÀÚ : 0ºÎÅÍ ½ÃÀÛ */
402 hwpf.Read2b(&showpg, 1); /* ¹Ú½ºº¸¿©ÁÜ */
403 hwpf.Read2b(&cap_pos, 1); /* ĸ¼ÇÀ§Ä¡ 0 - 7 ¸Þ´º¼ø¼­. */
404 hwpf.Read2b(&num, 1); /* ¹Ú½º¹øÈ£ 0ºÎÅÍ ½ÃÀÛÇؼ­ ¸Å±äÀϷùøÈ£ */
406 hwpf.Read1b(&pictype, 1); /* ±×¸²Á¾·ù */
408 skip[0] = (short) hwpf.Read2b(); /* ±×¸²¿¡¼­ ½ÇÁ¦ Ç¥½Ã¸¦ ½ÃÀÛÇÒ À§Ä¡ °¡·Î */
409 skip[1] = (short) hwpf.Read2b(); /* ¼¼·Î */
410 scale[0] = (short) hwpf.Read2b(); /* È®´ëºñÀ² : 0 °íÁ¤, ÀÌ¿Ü ÆÛ¼¾Æ® ´ÜÀ§ °¡·Î */
411 scale[1] = (short) hwpf.Read2b(); /* ¼¼·Î */
413 hwpf.Read1b(picinfo.picun.path, 256); /* ±×¸²ÆÄÀÏ À̸§ : Á¾·ù°¡ DrawingÀÌ ¾Æ´Ò¶§. */
414 hwpf.Read1b(reserved3, 9); /* ¹à±â/¸í¾Ï/±×¸²È¿°ú µî */
416 UpdateBBox(this);
417 if( pictype != PICTYPE_DRAW )
418 style.cell = reserved3;
420 if (follow_block_size != 0)
422 follow = new unsigned char[follow_block_size];
424 hwpf.Read1b(follow, follow_block_size);
425 if (pictype == PICTYPE_DRAW)
427 hmem = new HMemIODev((char *) follow, follow_block_size);
428 LoadDrawingObjectBlock(this);
429 style.cell = picinfo.picdraw.hdo;
430 delete hmem;
432 hmem = 0;
434 else
436 if ((follow[3] << 24 | follow[2] << 16 | follow[1] << 8 | follow[0]) == 0x269)
438 ishyper = true;
443 if( pictype != 3 )
444 style.boxtype = 'G';
445 else
446 style.boxtype = 'D';
447 hwpf.AddFBoxStyle(&style);
449 // cation
450 hwpf.ReadParaList(caption);
452 return !hwpf.State();
456 // line(15)
458 Line::Line():FBox(CH_LINE)
463 int Line::Read(HWPFile & hwpf)
465 hwpf.Read2b(reserved, 2);
466 hwpf.Read2b(&dummy, 1);
468 if (!(hh == dummy && CH_LINE == dummy)){
469 return hwpf.SetState(HWP_InvalidFileFormat);
471 hwpf.AddBox(this);
473 style.boxnum = fboxnum++;
474 zorder = zindex++;
475 style.boxtype = 'L';
476 hwpf.Read1b(&reserved2, 8);
477 hwpf.Read1b(&style.anchor_type, 1);
478 hwpf.Read1b(&style.txtflow, 1);
479 hwpf.Read2b(&style.xpos, 1);
480 hwpf.Read2b(&style.ypos, 1);
481 hwpf.Read2b(&option, 1);
482 hwpf.Read2b(&ctrl_ch, 1);
483 hwpf.Read2b(style.margin, 12);
484 hwpf.AddFBoxStyle(&style);
485 hwpf.Read2b(&box_xs, 1);
486 hwpf.Read2b(&box_ys, 1);
487 hwpf.Read2b(&cap_xs, 1);
488 hwpf.Read2b(&cap_ys, 1);
489 hwpf.Read2b(&style.cap_len, 1);
490 hwpf.Read2b(&xs, 1);
491 hwpf.Read2b(&ys, 1);
492 lnnumber = style.boxnum;
493 hwpf.linenumber = 1;
494 hwpf.Read2b(&boundsy, 1);
495 hwpf.Read2b(&boundey, 1);
496 hwpf.Read1b(&boundx, 1);
497 hwpf.Read1b(&draw, 1);
499 hwpf.Read2b(&pgx, 1);
500 hwpf.Read2b(&pgy, 1);
501 hwpf.Read2b(&pgno, 1);
502 hwpf.Read2b(&showpg, 1);
504 hwpf.Read2b(&sx, 1);
505 hwpf.Read2b(&sy, 1);
506 hwpf.Read2b(&ex, 1);
507 hwpf.Read2b(&sy, 1);
508 hwpf.Read2b(&width, 1);
509 hwpf.Read2b(&shade, 1);
510 hwpf.Read2b(&color, 1);
511 style.xpos = width;
513 return !hwpf.State();
517 // hidden(15)
518 Hidden::Hidden():HBox(CH_HIDDEN)
523 int Hidden::Read(HWPFile & hwpf)
525 hwpf.Read2b(reserved, 2);
526 hwpf.Read2b(&dummy, 1);
527 if (!(hh == dummy && CH_HIDDEN == dummy)){
528 return hwpf.SetState(HWP_InvalidFileFormat);
531 hwpf.Read1b(info, 8);
532 hwpf.ReadParaList(plist);
534 return !hwpf.State();
538 // header/footer(16)
539 HeaderFooter::HeaderFooter():HBox(CH_HEADER_FOOTER)
541 linenumber = 0;
545 int HeaderFooter::Read(HWPFile & hwpf)
547 hwpf.Read2b(reserved, 2);
548 hwpf.Read2b(&dummy, 1);
549 if (!(hh == dummy && CH_HEADER_FOOTER == dummy)){
550 return hwpf.SetState(HWP_InvalidFileFormat);
553 hwpf.Read1b(info, 8);
554 hwpf.Read1b(&type, 1);
555 hwpf.Read1b(&where, 1);
556 lnnumber = 0;
557 hwpf.ReadParaList(plist, CH_HEADER_FOOTER);
558 linenumber = sal::static_int_cast<unsigned char>(lnnumber);
559 m_nPageNumber = hwpf.getCurrentPage();
560 hwpf.setMaxSettedPage();
561 hwpf.AddHeaderFooter(this);
563 return !hwpf.State();
567 // footnote(17)
568 Footnote::Footnote():HBox(CH_FOOTNOTE)
573 int Footnote::Read(HWPFile & hwpf)
575 hwpf.Read2b(reserved, 2);
576 hwpf.Read2b(&dummy, 1);
577 if (!(hh == dummy && CH_FOOTNOTE == dummy)){
578 return hwpf.SetState(HWP_InvalidFileFormat);
581 hwpf.Read1b(info, 8);
582 hwpf.Read2b(&number, 1);
583 hwpf.Read2b(&type, 1);
584 width = (short) hwpf.Read2b();
585 hwpf.ReadParaList(plist, CH_FOOTNOTE);
587 return !hwpf.State();
591 // auto number(18)
592 AutoNum::AutoNum():HBox(CH_AUTO_NUM)
597 int AutoNum::Read(HWPFile & hwpf)
599 hwpf.Read2b(&type, 1);
600 hwpf.Read2b(&number, 1);
601 hwpf.Read2b(&dummy, 1);
603 if (!(hh == dummy)){
604 return hwpf.SetState(HWP_InvalidFileFormat);
606 return !hwpf.State();
610 // new number(19)
611 NewNum::NewNum():HBox(CH_NEW_NUM)
616 int NewNum::Read(HWPFile & hwpf)
618 hwpf.Read2b(&type, 1);
619 hwpf.Read2b(&number, 1);
620 hwpf.Read2b(&dummy, 1);
622 if (!(hh == dummy)){
623 return hwpf.SetState(HWP_InvalidFileFormat);
625 return !hwpf.State();
629 // show page number (20)
630 ShowPageNum::ShowPageNum():HBox(CH_SHOW_PAGE_NUM)
635 int ShowPageNum::Read(HWPFile & hwpf)
637 hwpf.Read2b(&where, 1);
638 hwpf.Read2b(&shape, 1);
639 hwpf.Read2b(&dummy, 1);
641 if (!(hh == dummy)){
642 return hwpf.SetState(HWP_InvalidFileFormat);
644 m_nPageNumber = hwpf.getCurrentPage();
645 hwpf.setMaxSettedPage();
646 hwpf.AddPageNumber(this);
647 return !hwpf.State();
651 /* Ȧ¼öÂʽÃÀÛ/°¨Ãß±â (21) */
652 PageNumCtrl::PageNumCtrl():HBox(CH_PAGE_NUM_CTRL)
657 int PageNumCtrl::Read(HWPFile & hwpf)
659 hwpf.Read2b(&kind, 1);
660 hwpf.Read2b(&what, 1);
661 hwpf.Read2b(&dummy, 1);
663 if (!(hh == dummy)){
664 return hwpf.SetState(HWP_InvalidFileFormat);
666 return !hwpf.State();
670 // mail merge(22)
671 MailMerge::MailMerge():HBox(CH_MAIL_MERGE)
676 int MailMerge::Read(HWPFile & hwpf)
678 hwpf.Read1b(field_name, 20);
679 hwpf.Read2b(&dummy, 1);
681 if (!(hh == dummy)){
682 return hwpf.SetState(HWP_InvalidFileFormat);
684 return !hwpf.State();
688 // char compositon(23)
689 Compose::Compose():HBox(CH_COMPOSE)
694 int Compose::Read(HWPFile & hwpf)
696 hwpf.Read2b(compose, 3);
697 hwpf.Read2b(&dummy, 1);
699 if (!(hh == dummy)){
700 return hwpf.SetState(HWP_InvalidFileFormat);
702 return !hwpf.State();
706 // hyphen(24)
707 Hyphen::Hyphen():HBox(CH_HYPHEN)
712 int Hyphen::Read(HWPFile & hwpf)
714 hwpf.Read2b(&width, 1);
715 hwpf.Read2b(&dummy, 1);
717 if (!(hh == dummy)){
718 return hwpf.SetState(HWP_InvalidFileFormat);
720 return !hwpf.State();
724 // toc mark(25)
725 TocMark::TocMark():HBox(CH_TOC_MARK)
730 int TocMark::Read(HWPFile & hwpf)
732 hwpf.Read2b(&kind, 1);
733 hwpf.Read2b(&dummy, 1);
735 if (!(hh == dummy)){
736 return hwpf.SetState(HWP_InvalidFileFormat);
738 return !hwpf.State();
742 // index mark(26)
743 IndexMark::IndexMark():HBox(CH_INDEX_MARK)
748 int IndexMark::Read(HWPFile & hwpf)
750 hwpf.Read2b(&keyword1, 60);
751 hwpf.Read2b(&keyword2, 60);
752 hwpf.Read2b(&pgno, 1);
753 hwpf.Read2b(&dummy, 1);
755 if (!(hh == dummy)){
756 return hwpf.SetState(HWP_InvalidFileFormat);
758 return !hwpf.State();
762 // outline(28)
763 Outline::Outline():HBox(CH_OUTLINE)
768 int Outline::Read(HWPFile & hwpf)
770 hwpf.Read2b(&kind, 1);
771 hwpf.Read1b(&shape, 1);
772 hwpf.Read1b(&level, 1);
773 hwpf.Read2b(number, 7);
774 hwpf.Read2b(user_shape, 7);
775 hwpf.Read2b(deco, 14);
776 hwpf.Read2b(&dummy, 1);
778 if (!(hh == dummy)){
779 return hwpf.SetState(HWP_InvalidFileFormat);
781 return !hwpf.State();
785 /* ¹­À½ ºóÄ­(30) */
786 KeepSpace::KeepSpace():HBox(CH_KEEP_SPACE)
791 int KeepSpace::Read(HWPFile & hwpf)
793 hwpf.Read2b(&dummy, 1);
795 if (!(hh == dummy)){
796 return hwpf.SetState(HWP_InvalidFileFormat);
798 return !hwpf.State();
802 /* °íÁ¤Æø ºóÄ­(31) */
803 FixedSpace::FixedSpace():HBox(CH_FIXED_SPACE)
808 int FixedSpace::Read(HWPFile & hwpf)
810 hwpf.Read2b(&dummy, 1);
812 if (!(hh == dummy)){
813 return hwpf.SetState(HWP_InvalidFileFormat);
815 return !hwpf.State();