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_HBOX_H
21 : #define INCLUDED_HWPFILTER_SOURCE_HBOX_H
22 :
23 : #include <sal/config.h>
24 :
25 : #include <list>
26 :
27 : #include <sal/types.h>
28 :
29 : #include "hwplib.h"
30 : #include "hwpfile.h"
31 : #include "hinfo.h"
32 : #include "hpara.h"
33 :
34 : /**
35 : * The HBox class is the base class for all date classes in hwp document.
36 : * For example, there are special character, table, image, etc.
37 : * It has one character. The ascii code value of special characters are smaller than 32. General character is greater than 32.
38 : *
39 : * @short Base class for characters
40 : */
41 : struct HBox
42 : {
43 : public:
44 : hchar hh;
45 :
46 : /**
47 : * Construct a HBox object with parameter hch.
48 : * @param hch 16bit character being able to have Korean character.
49 : */
50 : HBox( hchar hch );
51 : virtual ~HBox();
52 : /**
53 : * @returns The Size of HBox object
54 : */
55 : virtual int WSize();
56 : /**
57 : * @returns The Height of HBox object as hunit value.
58 : */
59 : virtual hunit Height(CharShape *csty);
60 : /**
61 : * Read properties from HIODevice object like stream, file, memory.
62 : *
63 : * @param hwpf HWPFile Object having all information for a hwp file.
64 : * @returns True if reading from stream is successful.
65 : */
66 : virtual bool Read(HWPFile &hwpf);
67 :
68 : virtual hchar_string GetString();
69 : private:
70 : static int boxCount;
71 : };
72 :
73 : /**
74 : * @short Class for saving data to be skipped.
75 : */
76 : struct SkipData: public HBox
77 : {
78 : ulong data_block_len;
79 : hchar dummy;
80 : char *data_block;
81 :
82 : SkipData(hchar);
83 : virtual ~SkipData();
84 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
85 : };
86 : struct DateCode;
87 : struct FieldCode : public HBox
88 : {
89 : uchar type[2]; /* 2/0 - 계산식, 3/0-문서요약, 3/1-개인정보, 3/2-만든날짜, 4/0-누름틀 */
90 : char *reserved1;
91 : unsigned short location_info; /* 0 - 끝코드, 1 - 시작코드 */
92 : char *reserved2;
93 : hchar *str1;
94 : hchar *str2;
95 : hchar *str3;
96 : char *bin;
97 :
98 : DateCode *m_pDate;
99 :
100 : FieldCode();
101 : virtual ~FieldCode();
102 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
103 : };
104 : /**
105 : * Kind of BOOKMARK
106 : */
107 : enum
108 : {
109 : BM_MARK,
110 : BM_BEGIN,
111 : BM_END
112 : };
113 :
114 : #define BMK_COMMENT_LEN 15
115 :
116 : /**
117 : * @short Class for BOOKMARK
118 : */
119 : struct Bookmark: public HBox
120 : {
121 : hchar dummy;
122 : hchar id[BMK_COMMENT_LEN + 1];
123 : unsigned short type;
124 :
125 : Bookmark();
126 : virtual ~Bookmark();
127 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
128 : };
129 :
130 : // date format(7)
131 : const int DATE_SIZE = 40;
132 :
133 : /**
134 : * @short Class for saving date format made by user
135 : */
136 0 : struct DateFormat: public HBox
137 : {
138 : hchar format[DATE_SIZE];
139 : hchar dummy;
140 :
141 : DateFormat();
142 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
143 : };
144 :
145 : /**
146 : * @short Class for current date and time with specified format.
147 : */
148 0 : struct DateCode: public HBox
149 : {
150 : enum
151 : {
152 : YEAR, MONTH, WEEK, DAY, HOUR, MIN
153 : };
154 :
155 : hchar format[DATE_SIZE];
156 : /**
157 : * year/month/week/day/hour/minute
158 : */
159 : short date[6];
160 : hchar dummy;
161 : unsigned char key;
162 :
163 : DateCode();
164 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
165 :
166 : virtual hchar_string GetString() SAL_OVERRIDE;
167 : };
168 :
169 : /**
170 : * @short Tab object
171 : */
172 0 : struct Tab: public HBox
173 : {
174 : hunit width;
175 : unsigned short leader;
176 : hchar dummy;
177 :
178 : Tab();
179 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
180 : };
181 :
182 : // tbox(10) TABLE BOX MATH BUTTON HYPERTEXT
183 :
184 : enum ttype { TBL_TYPE, TXT_TYPE, EQU_TYPE, BUTTON_TYPE, HYPERTEXT_TYPE };
185 : enum /* TxtBox->margin[n][?] */
186 : {
187 : OUT_M, IN_M, CELL_M
188 : };
189 : enum /* TxtBox->margin[?][n] */
190 : {
191 : L_M, R_M, T_M, B_M
192 : };
193 : enum anchor { CHAR_ANCHOR, PARA_ANCHOR, PAGE_ANCHOR, PAPER_ANCHOR };
194 : enum { TF_OCCUPY_SPACE, TF_TRANSPARENT,TF_ARROUND_TEXT };
195 : enum
196 : {
197 : CAP_OUT_BOT, CAP_OUT_TOP, CAP_IN_BOT, CAP_IN_TOP,
198 : CAP_LEFT_BOT, CAP_LEFT_TOP, CAP_RIGHT_BOT, CAP_RIGHT_TOP,
199 : EQU_CAP_POS
200 : };
201 :
202 : /**
203 : * Definitions for frame's common 'option' member.
204 : */
205 : #define DRAW_FRAME 1 /* <-> no frame, bit 0 */
206 : #define NORMAL_PIC 2 /* <-> reverse, bit 1 */
207 : #define FIT_TO_COLUMN 4 /* fig_xs is columnlen */
208 : #define UNKNOWN_FILE 8 /* need check reverse for pcx mono */
209 : #define HYPERTEXT_FLAG 16
210 : #define UNKNOWN_SIZE 32
211 : #define FOPT_TEMP_BIT 0x00010000 /* temporary starts from 16th bits */
212 :
213 : struct CellLine
214 : {
215 : unsigned char key;
216 : unsigned char top; // 0 - 라인없음, 1-single, 2-thick, 3-double
217 : unsigned char bottom;
218 : unsigned char left;
219 : unsigned char right;
220 : short color; // cell color
221 : unsigned char shade; // <100%
222 : };
223 : /**
224 : * A cell has four properties to specify the position for itself in hwp.
225 : * @li xpos - distance between left border of cell and left border of table
226 : * @li ypos - distance between top border of cell and top border of table
227 : * @li width - distance between left border of cell and right border of cell
228 : * @li height - distance between top border of cell and bottom border of table
229 : * This is differ from the format of other office in fact cell has two properties
230 : * - rowindex and column index.
231 : *
232 : * @short Cell object
233 : */
234 : struct Cell // Cell
235 : {
236 : unsigned char key; // Index value of border style
237 : short p;
238 : short color; // cell color
239 : short x, y; // [x,y] cell pos
240 : short w, h; // [x,y] cell size
241 : short txthigh, cellhigh; // used maximum
242 : unsigned char flag, changed, used; // unused(file)
243 : unsigned char ver_align; // vertical align {1=center}
244 : unsigned char linetype[4]; // [left,right,top,bottom]
245 : unsigned char shade; // <100%
246 : unsigned char diagonal; // { 0=none,\=1,/=2,X=3}
247 : unsigned char protect;
248 :
249 : void Read( HWPFile &hwpf );
250 : };
251 :
252 : /**
253 : * @short Style for floating object
254 : */
255 : struct FBoxStyle
256 : {
257 : /**
258 : * Anchor type : paragraph , page, char
259 : */
260 : unsigned char anchor_type;
261 : /**
262 : * Kind of wrap
263 : */
264 : unsigned char txtflow; /* 그림피함. 0-2(자리차지,투명,어울림) */
265 : /**
266 : * Horizontal alignment
267 : */
268 : short xpos; // left, right, center, xx
269 : /**
270 : * Vertical alignment
271 : */
272 : short ypos; // page top, bottom, yy
273 : /**
274 : * Every margin of border
275 : * [0-2][] : out/in/cell margin
276 : * [][0-3] : left/right/top/bottom
277 : */
278 : short margin[3][4]; // out : left, right, top, bottom
279 : /**
280 : * Index of floating object
281 : */
282 : short boxnum; /* 스타오피스에서 스타일 이름으로 사용될 숫자 */
283 : /**
284 : * Type of floating object : line, txtbox, image, table, equalizer and button
285 : */
286 : unsigned char boxtype; // (L)ine, t(X)tbox, Picture - (G)
287 : short cap_len; /* 캡션의 길이 */
288 :
289 : void *cell;
290 :
291 0 : FBoxStyle()
292 : : anchor_type(0)
293 : , txtflow(0)
294 : , xpos(0)
295 : , ypos(0)
296 : , boxnum(0)
297 : , boxtype(0)
298 : , cap_len(0)
299 0 : , cell(NULL)
300 : {
301 0 : memset(margin, 0, sizeof(margin));
302 0 : }
303 : };
304 :
305 : /**
306 : * This object is for floating object like table, image, line and so on.
307 : *
308 : * @short floating object
309 : */
310 : struct FBox: public HBox
311 : {
312 : int zorder;
313 : short option; // draw frame
314 : hchar ctrl_ch;
315 : FBoxStyle style;
316 :
317 : short box_xs, box_ys;
318 : short cap_xs, cap_ys ;
319 : short xs, ys; // ys = fig_ys + cap_ys + margin
320 : // xs = fig_xs + cap_xs + margin
321 : short cap_margin;
322 : char xpos_type, ypos_type;
323 : unsigned char smart_linesp;
324 :
325 : /* 이 자료는 tbox나 pic에서는 파일에 기록하지 않고 실행시만 있으며,
326 : line에서는 파일에 기록한다.
327 : */
328 : short boundsy, boundey;
329 : unsigned char boundx, draw;
330 :
331 : /**
332 : * Physical x,y position.
333 : */
334 : short pgx, pgy; // physical xpos, ypos
335 : short pgno, showpg; // pageno where code is
336 :
337 : FBox *prev, *next;
338 :
339 : FBox( hchar hch );
340 : virtual ~FBox();
341 : };
342 :
343 : struct Table;
344 : /**
345 : * The TxtBox class saves object properties about table, textbox, equalizer or button
346 : */
347 : struct TxtBox: public FBox
348 : {
349 : hchar reserved[2];
350 : hchar dummy;
351 :
352 : short dummy1; // to not change structure size */
353 : short cap_len;
354 : short next;
355 : short dummy2; // to not change structure size */
356 : unsigned char reserved1;
357 : /**
358 : * caption position
359 : */
360 : short cap_pos; // caption pos
361 : short num; // numbering
362 :
363 : short dummy3;
364 : short baseline; //(for equ)
365 :
366 : /**
367 : * The value of type indicates as the below: zero is table, one is
368 : * textbox, two is equalizer and three is button.
369 : */
370 : short type; // 0-table, 1-textbox, 2-수식, 3-button
371 : /**
372 : * nCell is greater than one only for table, otherwise it is 1.
373 : */
374 : short nCell; //:=1 offset 80
375 : /**
376 : * If value of protect is 1, size of cell cann't change.
377 : */
378 : short protect; //1=size lock
379 :
380 : Cell *cell;
381 : Table *m_pTable;
382 : /**
383 : * Paragraph list
384 : */
385 : std::list<HWPPara*> *plists;
386 : /**
387 : * Caption
388 : */
389 : std::list<HWPPara*> caption;
390 :
391 : TxtBox();
392 : virtual ~TxtBox();
393 :
394 : /**
395 : * @returns Count of cell.
396 : */
397 0 : virtual int NCell() { return nCell; }
398 : /**
399 : * This is one of table, text-box, equalizer and button
400 : * @returns Type of this object.
401 : */
402 0 : virtual int Type() { return type; }
403 :
404 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
405 :
406 : virtual hunit Height(CharShape *csty) SAL_OVERRIDE;
407 : };
408 :
409 : #define ALLOWED_GAP 5
410 : #define INIT_SIZE 20
411 : #define ADD_AMOUNT 10
412 :
413 : struct Columns
414 : {
415 : int *data;
416 : size_t nCount;
417 : size_t nTotal;
418 0 : Columns(){
419 0 : nCount = 0;
420 0 : nTotal = INIT_SIZE;
421 0 : data = new int[nTotal];
422 0 : }
423 0 : ~Columns(){ delete[] data; }
424 :
425 0 : void AddColumnsSize(){
426 0 : int *tmp = data;
427 0 : if (nTotal + ADD_AMOUNT < nTotal) // overflow
428 : {
429 0 : throw ::std::bad_alloc();
430 : }
431 0 : data = new int[nTotal + ADD_AMOUNT];
432 0 : for (size_t i = 0 ; i < nTotal ; i++)
433 0 : data[i] = tmp[i];
434 0 : nTotal += ADD_AMOUNT;
435 0 : delete[] tmp;
436 0 : }
437 :
438 0 : void insert(int pos){
439 0 : if( nCount == 0 ){
440 0 : data[nCount++] = pos;
441 0 : return;
442 : }
443 0 : for (size_t i = 0 ; i < nCount; i++ ) {
444 0 : if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
445 0 : return; // Already exist;
446 0 : if( pos < data[i] ){
447 0 : if( nCount == nTotal )
448 0 : AddColumnsSize();
449 0 : for (size_t j = nCount ; j > i ; j--)
450 0 : data[j] = data[j-1];
451 0 : data[i] = pos;
452 0 : nCount++;
453 0 : return;
454 : }
455 : }
456 : // last position.
457 0 : if( nCount == nTotal )
458 0 : AddColumnsSize();
459 0 : data[nCount++] = pos;
460 : }
461 :
462 0 : int getIndex(int pos)
463 : {
464 0 : if( pos == 0 )
465 0 : return 0;
466 0 : for (size_t i = 0 ; i < nCount; i++) {
467 0 : if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
468 0 : return i;
469 : }
470 0 : return -1;
471 : }
472 : };
473 :
474 : struct Rows
475 : {
476 : int *data;
477 : size_t nCount;
478 : size_t nTotal;
479 0 : Rows(){
480 0 : nCount = 0;
481 0 : nTotal = INIT_SIZE;
482 0 : data = new int[nTotal];
483 0 : }
484 0 : ~Rows(){ delete[] data; }
485 :
486 0 : void AddRowsSize(){
487 0 : int *tmp = data;
488 0 : if (nTotal + ADD_AMOUNT < nTotal) // overflow
489 : {
490 0 : throw ::std::bad_alloc();
491 : }
492 0 : data = new int[nTotal + ADD_AMOUNT];
493 0 : for (size_t i = 0 ; i < nTotal ; i++)
494 0 : data[i] = tmp[i];
495 0 : nTotal += ADD_AMOUNT;
496 0 : delete[] tmp;
497 0 : }
498 :
499 0 : void insert(int pos){
500 0 : if( nCount == 0 ){
501 0 : data[nCount++] = pos;
502 0 : return;
503 : }
504 0 : for (size_t i = 0 ; i < nCount; i++) {
505 0 : if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
506 0 : return; // Already exist;
507 0 : if( pos < data[i] ){
508 0 : if( nCount == nTotal )
509 0 : AddRowsSize();
510 0 : for (size_t j = nCount ; j > i ; j--)
511 0 : data[j] = data[j-1];
512 0 : data[i] = pos;
513 0 : nCount++;
514 0 : return;
515 : }
516 : }
517 : // last position.
518 0 : if( nCount == nTotal )
519 0 : AddRowsSize();
520 0 : data[nCount++] = pos;
521 : }
522 :
523 0 : int getIndex(int pos)
524 : {
525 0 : if( pos == 0 )
526 0 : return 0;
527 0 : for (size_t i = 0 ; i < nCount; i++) {
528 0 : if( pos < data[i] + ALLOWED_GAP && pos > data[i] - ALLOWED_GAP )
529 0 : return i;
530 : }
531 0 : return -1;
532 : }
533 : };
534 :
535 : struct TCell
536 : {
537 : int nColumnIndex;
538 : int nRowIndex;
539 : int nColumnSpan;
540 : int nRowSpan;
541 : Cell *pCell;
542 : };
543 :
544 : struct Table
545 : {
546 0 : Table() : box(NULL) {};
547 0 : ~Table() {
548 0 : std::list<TCell*>::iterator it = cells.begin();
549 0 : for( ; it != cells.end(); ++it)
550 0 : delete *it;
551 0 : };
552 :
553 : Columns columns;
554 : Rows rows;
555 : std::list<TCell*> cells;
556 : TxtBox *box;
557 : };
558 :
559 : /* picture (11) 그림, OLE그림, 삽입그림, 그리기 */
560 : enum pictype
561 : {
562 : PICTYPE_FILE, PICTYPE_OLE, PICTYPE_EMBED,
563 : PICTYPE_DRAW, PICTYPE_UNKNOWN
564 : };
565 : /**
566 : * @short External image file
567 : */
568 : struct PicDefFile
569 : {
570 : char path[256];
571 : void *img;
572 : bool skipfind;
573 : };
574 :
575 : /**
576 : * @short Embedded image file
577 : */
578 : struct PicDefEmbed
579 : {
580 : char embname[16];
581 : };
582 :
583 : /**
584 : * @short Win32 ole object
585 : */
586 : struct PicDefOle
587 : {
588 : char embname[16];
589 : void *hwpole;
590 : };
591 :
592 : /**
593 : * @short Drawing object of hwp
594 : */
595 : struct PicDefDraw
596 : {
597 : void *hdo;
598 : uint zorder;
599 : ZZRect vrect;
600 : int mbrcnt;
601 : };
602 :
603 : /**
604 : * @short For using common case
605 : */
606 : struct PicDefUnknown
607 : {
608 : char path[256];
609 : };
610 :
611 : typedef union
612 : {
613 : PicDefFile picfile;
614 : PicDefEmbed picembed;
615 : PicDefOle picole;
616 : PicDefDraw picdraw;
617 : PicDefUnknown picun;
618 : } PicDef;
619 :
620 : #define PIC_INFO_LEN 348
621 : /**
622 : * There are four kinds of image.
623 : * @li External image
624 : * @li Embedded image
625 : * @li Win32 ole object
626 : * @li Drawing object of hwp
627 : *
628 : * @short Image object
629 : */
630 : struct Picture: public FBox
631 : {
632 : hchar reserved[2];
633 : hchar dummy;
634 : /**
635 : * follow_block_size is the size information of the Drawing object of hwp.
636 : * It's value is greater than 0 if the pictype is PICTYPE_DRAW.
637 : */
638 : ulong follow_block_size; /* 추가정보 길이. */
639 : short dummy1; // to not change structure size */
640 : short dummy2; // to not change structure size */
641 : uchar reserved1;
642 : /**
643 : * Position of caption
644 : */
645 : short cap_pos; // caption pos
646 : /**
647 : * Index of current Picture object
648 : */
649 : short num; // numbering
650 :
651 : /**
652 : * Type of this object
653 : * It is one of external/ole/embedded/drawing picture
654 : */
655 : uchar pictype;
656 : hunit skip[2];
657 : /**
658 : * Ratio of magnification or reduction.
659 : */
660 : hunit scale[2];
661 : PicDef picinfo;
662 : char reserved3[9];
663 :
664 : std::list<HWPPara*> caption;
665 : /**
666 : * It's for the Drawing object
667 : */
668 : unsigned char *follow; /* 그림종류가 drawing일때, 추가정보. */
669 :
670 : bool ishyper;
671 :
672 : Picture();
673 : virtual ~Picture();
674 :
675 : virtual int Type ();
676 : virtual bool Read (HWPFile &hwpf) SAL_OVERRIDE;
677 :
678 : virtual hunit Height (CharShape *sty) SAL_OVERRIDE;
679 : };
680 :
681 : // line (14)
682 : /**
683 : * @short Line
684 : */
685 0 : struct Line: public FBox
686 : {
687 : hchar reserved[2];
688 : hchar dummy;
689 :
690 : char reserved2[8];
691 :
692 : short sx, sy, ex, ey;
693 : short width, shade, color;
694 :
695 : Line();
696 :
697 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
698 : };
699 :
700 : // hidden(15)
701 : /**
702 : * @short Hidden section
703 : */
704 : struct Hidden: public HBox
705 : {
706 : hchar reserved[2];
707 : hchar dummy;
708 :
709 : unsigned char info[8]; // h, next, dummy
710 : std::list<HWPPara*> plist;
711 :
712 : Hidden();
713 : virtual ~Hidden();
714 :
715 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
716 : };
717 :
718 : /**
719 : * @short Header or footer
720 : */
721 : struct HeaderFooter: public HBox
722 : {
723 : hchar reserved[2];
724 : hchar dummy;
725 :
726 : unsigned char info[8];
727 : /**
728 : * Header or footer
729 : */
730 : unsigned char type;
731 : unsigned char where;
732 : unsigned char linenumber;
733 :
734 : unsigned int m_nPageNumber;
735 :
736 : /**
737 : * Paragraph list of header or footer
738 : */
739 : std::list<HWPPara*> plist;
740 :
741 : HeaderFooter();
742 : virtual ~HeaderFooter();
743 :
744 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
745 : };
746 :
747 : /**
748 : * Both footnote and endnote are comment. Footnote is located at the end of paragraph; endnote is located at the end of page. The Footnote class represents footnote and endnote.
749 : * @short Footnote or endnote
750 : */
751 : struct Footnote: public HBox
752 : {
753 : hchar reserved[2];
754 : hchar dummy;
755 :
756 : unsigned char info[8];
757 : /**
758 : * The number of current footnote/endnote
759 : */
760 : unsigned short number;
761 : /**
762 : * Set the type of Footnote either footnote or endnote.
763 : */
764 : unsigned short type;
765 : /**
766 : * The width of the Footnote object.
767 : */
768 : hunit width;
769 : /**
770 : * Paragraph list of Footnote objects
771 : */
772 : std::list<HWPPara*> plist;
773 :
774 : Footnote();
775 : virtual ~Footnote();
776 :
777 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
778 : };
779 :
780 : // auto number(18)
781 : /**
782 : * Kind of auto input number
783 : */
784 : enum
785 : {
786 : PGNUM_AUTO,
787 : FNNUM_AUTO,
788 : ENNUM_AUTO,
789 : PICNUM_AUTO,
790 : TBLNUM_AUTO,
791 : EQUNUM_AUTO
792 : };
793 :
794 : /**
795 : * @short Input current index of page,comment,table and picture.
796 : */
797 0 : struct AutoNum: public HBox
798 : {
799 : unsigned short type;
800 : unsigned short number;
801 : hchar dummy;
802 :
803 : AutoNum();
804 :
805 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
806 : };
807 :
808 : /**
809 : * @short Input new number as current index of page,comment,table and picture.
810 : */
811 0 : struct NewNum: public HBox
812 : {
813 : unsigned short type;
814 : unsigned short number;
815 : hchar dummy;
816 :
817 : NewNum();
818 :
819 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
820 : };
821 :
822 : // page numger(20)
823 : /**
824 : * @short Input page index in footer or header
825 : */
826 0 : struct ShowPageNum: public HBox
827 : {
828 : /**
829 : * Location of page number to be inserted.
830 : */
831 : unsigned short where;
832 : unsigned int m_nPageNumber;
833 : /**
834 : * Shape of page number to be inserted.
835 : */
836 : unsigned short shape;
837 : hchar dummy;
838 :
839 : ShowPageNum();
840 :
841 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
842 : };
843 :
844 : /* 홀수쪽시작 (21) */
845 : #define HIDE_HD 1 /* bit 0 */
846 : #define HIDE_FT 2 /* bit 1 */
847 : #define HIDE_PGNUM 4 /* bit 2 */
848 : #define HIDE_FRAME 8 /* bit 3 */
849 : /**
850 : * Controls the display of page number, header, footer and border.
851 : */
852 0 : struct PageNumCtrl: public HBox
853 : {
854 : /**
855 : * object type
856 : */
857 : unsigned short kind;
858 : /**
859 : * control command.
860 : */
861 : unsigned short what;
862 : hchar dummy;
863 :
864 : PageNumCtrl();
865 :
866 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
867 : };
868 :
869 : // mail merge(22)
870 : /**
871 : * Generates the mailing list automatically using address book and mail body format.
872 : * @short Generates mailing list
873 : */
874 0 : struct MailMerge: public HBox
875 : {
876 : unsigned char field_name[20];
877 : hchar dummy;
878 :
879 : MailMerge();
880 :
881 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
882 : virtual hchar_string GetString() SAL_OVERRIDE;
883 : };
884 :
885 : // char compositon(23)
886 : /**
887 : * The compose struct displays characters at position. The maximum character count for composition is three.
888 : * @short Composition several characters
889 : */
890 0 : struct Compose: public HBox
891 : {
892 : hchar compose[3];
893 : hchar dummy;
894 :
895 : Compose();
896 :
897 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
898 : };
899 :
900 : // hyphen(24)
901 : /**
902 : * @short Hyphen
903 : */
904 0 : struct Hyphen: public HBox
905 : {
906 : /**
907 : * Width of hyphen
908 : */
909 : hchar width;
910 : hchar dummy;
911 :
912 : Hyphen();
913 :
914 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
915 : };
916 :
917 : // toc mark(25)
918 : /**
919 : * The TocMark class is for making the content of a table.
920 : * When you set TocMark on current position, hwp makes it as toc automatically.
921 : * @short Table of contents
922 : */
923 0 : struct TocMark: public HBox
924 : {
925 : hchar kind;
926 : hchar dummy;
927 :
928 : TocMark();
929 :
930 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
931 : };
932 :
933 : // index mark(26)
934 : /**
935 : * IndexMark marks the table of search.
936 : * If you set IndexMark at current position, hwp make it as search index.
937 : * @short Table of search
938 : */
939 0 : struct IndexMark: public HBox
940 : {
941 : hchar keyword1[60];
942 : hchar keyword2[60];
943 : unsigned short pgno;
944 : hchar dummy;
945 :
946 : IndexMark();
947 :
948 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
949 : };
950 :
951 : // outline(28)
952 : #define MAX_OUTLINE_LEVEL 7
953 :
954 : enum
955 : {
956 : OLSTY_USER = 0,
957 : OLSTY_NUMS1 = 1,
958 : OLSTY_NUMS2 = 2,
959 : OLSTY_NUMSIG1 = 3,
960 : OLSTY_NUMSIG2 = 4,
961 : OLSTY_NUMSIG3 = 5,
962 : OLSTY_BULUSER = 128,
963 : OLSTY_BULLET1 = 129,
964 : OLSTY_BULLET2 = 130,
965 : OLSTY_BULLET3 = 131,
966 : OLSTY_BULLET4 = 132,
967 : OLSTY_BULLET5 = 133
968 : };
969 :
970 : // value is in style->userchar[level];
971 : enum
972 : {
973 : UDO_NUM,
974 : UDO_UROM,
975 : UDO_LROM,
976 : UDO_UENG,
977 : UDO_LENG,
978 : UDO_SYLL,
979 : UDO_JAMO,
980 : UDO_HANJA,
981 : UDO_SP_CNUM,
982 : UDO_SP_CLENG,
983 : UDO_SP_CSYLL,
984 : UDO_SP_CJAMO,
985 : N_UDO
986 : };
987 : /**
988 : * Number and format of title.
989 : * @short Number and format of title
990 : */
991 0 : class Outline: public HBox
992 : {
993 : public:
994 : /**
995 : * kind of numbering format
996 : */
997 : unsigned short kind;
998 : unsigned char shape;
999 : /**
1000 : * level of number, Ex) The level of 1.3.2.4 is four
1001 : */
1002 : unsigned char level;
1003 : /**
1004 : * value of level
1005 : */
1006 : unsigned short number[MAX_OUTLINE_LEVEL];
1007 : /**
1008 : * shape of level
1009 : */
1010 : hchar user_shape[MAX_OUTLINE_LEVEL];
1011 : /**
1012 : * decoration character for the level type
1013 : */
1014 : hchar deco[MAX_OUTLINE_LEVEL][2]; /* 사용자 정의시 앞뒤 문자 */
1015 : hchar dummy;
1016 :
1017 : Outline();
1018 :
1019 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
1020 : hchar_string GetUnicode() const;
1021 : };
1022 :
1023 : /* 묶음 빈칸(30) */
1024 : /**
1025 : * The Special space to be treated non-space when a string is
1026 : * cut at the end of line
1027 : * @short Special space
1028 : */
1029 0 : struct KeepSpace: public HBox
1030 : {
1031 : hchar dummy;
1032 :
1033 : KeepSpace();
1034 :
1035 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
1036 : };
1037 :
1038 : /* 고정폭 빈칸(31) */
1039 : /**
1040 : * @short Space with always same width not relation with fonts.
1041 : */
1042 0 : struct FixedSpace: public HBox
1043 : {
1044 : hchar dummy;
1045 :
1046 : FixedSpace();
1047 :
1048 : virtual bool Read(HWPFile &hwpf) SAL_OVERRIDE;
1049 : };
1050 : #endif // INCLUDED_HWPFILTER_SOURCE_HBOX_H
1051 :
1052 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|