update dev300-m58
[ooovba.git] / hwpfilter / source / hpara.h
blob014fc23d633f965a3888836efff113765aad150d
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: hpara.h,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: hpara.h,v 1.5 2008-06-04 09:59:48 vg Exp $ */
33 #ifndef _HWPPARA_H_
34 #define _HWPPARA_H_
36 #include <hwplib.h>
37 #include <hwpfile.h>
38 #include <hinfo.h>
40 struct HBox;
42 /**
43 * etc flag
44 * 0 bit : Use page columns
45 * 1 bit : Use page lows
46 * 2 bit : Use section break
47 * 3 bit : Block start
48 * 4 bit : In Block
49 * 5 bit : Block end
50 * 6 bit : Preserve widow orphan
51 * 7 bit : Reserved
53 enum
55 PA_USER_COLUMN = 1,
56 PA_USER_PAGE = 2, /* p user_page definiton */
57 PA_SECTION_BREAK = 4,
58 PA_BLOCK_BEGIN = 8,
59 PA_IN_BLOCK = 16,
60 PA_BLOCK_END = 32,
61 PA_WIDOW_ORPHAN = 64
64 class HWPPara;
65 #define FIXED_SPACING_BIT (0x8000)
67 struct LineInfo
69 /* ½ÃÀÛÇÏ´Â ±ÛÀÚÀÇ À§Ä¡ : ÄÜÆ®·ÑÀº ¿©·¯ ±æÀ̸¦ °¡Áø´Ù */
70 /**
71 * Starting character position
73 unsigned short pos;
74 hunit space_width;
75 hunit height;
76 hunit pgy; /* internal */
77 hunit sx; /* internal */
78 hunit psx; /* internal */
79 hunit pex; /* internal */
80 // for formating
81 hunit height_sp;
82 unsigned short softbreak; // column, page, section
84 bool Read(HWPFile &hwpf, HWPPara *para);
86 /**
87 * It represents the paragraph.
88 * @short Paragraph
90 class DLLEXPORT HWPPara
92 private:
93 HWPPara *_next;
95 public:
96 // paragraph information
97 /**
98 * Zero is for the new paragraph style.
100 unsigned char reuse_shape; /* 0ÀÌ¸é »õ¸ð¾ç */
101 unsigned short nch;
102 unsigned short nline;
104 // realking
105 hunit begin_ypos;
106 unsigned char scflag;
109 * If the value is 0, all character of paragraph have same style given cshape
111 unsigned char contain_cshape; /* 0ÀÌ¸é ¸ðµç ±ÛÀÚ°¡ ´ëÇ¥ ±ÛÀÚ ¸ð¾ç */
112 unsigned char etcflag;
114 * Checks the special characters in the paragraph
116 unsigned long ctrlflag;
117 unsigned char pstyno;
118 CharShape cshape; /* ±ÛÀÚ°¡ ¸ðµÎ °°Àº ¸ð¾çÀ϶§ */
119 ParaShape pshape; /* reuse flag°¡ 0À̸é */
120 int pno; /* run-time only */
122 LineInfo *linfo;
123 CharShape *cshapep;
125 * Box object list
127 HBox **hhstr;
129 HWPPara(void);
130 ~HWPPara(void);
132 int Read(HWPFile &hwpf, unsigned char flag = 0);
133 int Write(CTextOut &txtf);
134 int Write(CHTMLOut &html);
136 void SetNext(HWPPara *n) { _next = n; };
138 /* layoutÀ» À§ÇÑ ÇÔ¼ö */
140 * Returns the character sytle of paragraph.
142 CharShape *GetCharShape(int pos);
144 * Returns the sytle of paragraph.
146 ParaShape *GetParaShape(void);
149 * Returns previous paragraph.
151 HWPPara *Prev(void);
153 * Returns next paragraph.
155 HWPPara *Next(void);
157 int HomePos(int line) const;
158 int EndPos(int line) const;
159 int LineLen(int line) const;
161 private:
162 HBox *readHBox(HWPFile &);
165 // inline functions
167 inline int HWPPara::HomePos(int line) const
169 if( nline < line + 1 ) return nch;
170 return linfo[line].pos;
174 inline int HWPPara::EndPos(int line) const
176 if( nline <= line + 1 ) return nch;
177 else return HomePos(line + 1);
181 inline int HWPPara::LineLen(int line) const
183 return EndPos(line) - HomePos(line);
185 #endif /* _HWPPARA_H_ */