merged tag ooo/DEV300_m102
[LibreOffice.git] / hwpfilter / source / hpara.h
blobdf8e57b8121a0d304189011802962caac0d3d1b8
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: hpara.h,v 1.5 2008-06-04 09:59:48 vg Exp $ */
30 #ifndef _HWPPARA_H_
31 #define _HWPPARA_H_
33 #include <hwplib.h>
34 #include <hwpfile.h>
35 #include <hinfo.h>
37 struct HBox;
39 /**
40 * etc flag
41 * 0 bit : Use page columns
42 * 1 bit : Use page lows
43 * 2 bit : Use section break
44 * 3 bit : Block start
45 * 4 bit : In Block
46 * 5 bit : Block end
47 * 6 bit : Preserve widow orphan
48 * 7 bit : Reserved
50 enum
52 PA_USER_COLUMN = 1,
53 PA_USER_PAGE = 2, /* p user_page definiton */
54 PA_SECTION_BREAK = 4,
55 PA_BLOCK_BEGIN = 8,
56 PA_IN_BLOCK = 16,
57 PA_BLOCK_END = 32,
58 PA_WIDOW_ORPHAN = 64
61 class HWPPara;
62 #define FIXED_SPACING_BIT (0x8000)
64 struct LineInfo
66 /* ½ÃÀÛÇÏ´Â ±ÛÀÚÀÇ À§Ä¡ : ÄÜÆ®·ÑÀº ¿©·¯ ±æÀ̸¦ °¡Áø´Ù */
67 /**
68 * Starting character position
70 unsigned short pos;
71 hunit space_width;
72 hunit height;
73 hunit pgy; /* internal */
74 hunit sx; /* internal */
75 hunit psx; /* internal */
76 hunit pex; /* internal */
77 // for formating
78 hunit height_sp;
79 unsigned short softbreak; // column, page, section
81 bool Read(HWPFile &hwpf, HWPPara *para);
83 /**
84 * It represents the paragraph.
85 * @short Paragraph
87 class DLLEXPORT HWPPara
89 private:
90 HWPPara *_next;
92 public:
93 // paragraph information
94 /**
95 * Zero is for the new paragraph style.
97 unsigned char reuse_shape; /* 0ÀÌ¸é »õ¸ð¾ç */
98 unsigned short nch;
99 unsigned short nline;
101 // realking
102 hunit begin_ypos;
103 unsigned char scflag;
106 * If the value is 0, all character of paragraph have same style given cshape
108 unsigned char contain_cshape; /* 0ÀÌ¸é ¸ðµç ±ÛÀÚ°¡ ´ëÇ¥ ±ÛÀÚ ¸ð¾ç */
109 unsigned char etcflag;
111 * Checks the special characters in the paragraph
113 unsigned long ctrlflag;
114 unsigned char pstyno;
115 CharShape cshape; /* ±ÛÀÚ°¡ ¸ðµÎ °°Àº ¸ð¾çÀ϶§ */
116 ParaShape pshape; /* reuse flag°¡ 0À̸é */
117 int pno; /* run-time only */
119 LineInfo *linfo;
120 CharShape *cshapep;
122 * Box object list
124 HBox **hhstr;
126 HWPPara(void);
127 ~HWPPara(void);
129 int Read(HWPFile &hwpf, unsigned char flag = 0);
130 int Write(CTextOut &txtf);
131 int Write(CHTMLOut &html);
133 void SetNext(HWPPara *n) { _next = n; };
135 /* layoutÀ» À§ÇÑ ÇÔ¼ö */
137 * Returns the character sytle of paragraph.
139 CharShape *GetCharShape(int pos);
141 * Returns the sytle of paragraph.
143 ParaShape *GetParaShape(void);
146 * Returns previous paragraph.
148 HWPPara *Prev(void);
150 * Returns next paragraph.
152 HWPPara *Next(void);
154 int HomePos(int line) const;
155 int EndPos(int line) const;
156 int LineLen(int line) const;
158 private:
159 HBox *readHBox(HWPFile &);
162 // inline functions
164 inline int HWPPara::HomePos(int line) const
166 if( nline < line + 1 ) return nch;
167 return linfo[line].pos;
171 inline int HWPPara::EndPos(int line) const
173 if( nline <= line + 1 ) return nch;
174 else return HomePos(line + 1);
178 inline int HWPPara::LineLen(int line) const
180 return EndPos(line) - HomePos(line);
182 #endif /* _HWPPARA_H_ */