Bump for 3.6-28
[LibreOffice.git] / hwpfilter / source / hpara.h
blob48a4dde4539b16c3828285c4dd2b833ff0b681cd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _HWPPARA_H_
30 #define _HWPPARA_H_
32 #include <hwplib.h>
33 #include <hwpfile.h>
34 #include <hinfo.h>
36 struct HBox;
38 /**
39 * etc flag
40 * 0 bit : Use page columns
41 * 1 bit : Use page lows
42 * 2 bit : Use section break
43 * 3 bit : Block start
44 * 4 bit : In Block
45 * 5 bit : Block end
46 * 6 bit : Preserve widow orphan
47 * 7 bit : Reserved
49 enum
51 PA_USER_COLUMN = 1,
52 PA_USER_PAGE = 2, /* p user_page definiton */
53 PA_SECTION_BREAK = 4,
54 PA_BLOCK_BEGIN = 8,
55 PA_IN_BLOCK = 16,
56 PA_BLOCK_END = 32,
57 PA_WIDOW_ORPHAN = 64
60 class HWPPara;
61 #define FIXED_SPACING_BIT (0x8000)
63 struct LineInfo
65 /* ½ÃÀÛÇÏ´Â ±ÛÀÚÀÇ À§Ä¡ : ÄÜÆ®·ÑÀº ¿©·¯ ±æÀ̸¦ °¡Áø´Ù */
66 /**
67 * Starting character position
69 unsigned short pos;
70 hunit space_width;
71 hunit height;
72 hunit pgy; /* internal */
73 hunit sx; /* internal */
74 hunit psx; /* internal */
75 hunit pex; /* internal */
76 // for formating
77 hunit height_sp;
78 unsigned short softbreak; // column, page, section
80 bool Read(HWPFile &hwpf, HWPPara *para);
82 /**
83 * It represents the paragraph.
84 * @short Paragraph
86 class DLLEXPORT HWPPara
88 private:
89 HWPPara *_next;
91 public:
92 // paragraph information
93 /**
94 * Zero is for the new paragraph style.
96 unsigned char reuse_shape; /* 0ÀÌ¸é »õ¸ð¾ç */
97 unsigned short nch;
98 unsigned short nline;
100 // realking
101 hunit begin_ypos;
102 unsigned char scflag;
105 * If the value is 0, all character of paragraph have same style given cshape
107 unsigned char contain_cshape; /* 0ÀÌ¸é ¸ðµç ±ÛÀÚ°¡ ´ëÇ¥ ±ÛÀÚ ¸ð¾ç */
108 unsigned char etcflag;
110 * Checks the special characters in the paragraph
112 unsigned long ctrlflag;
113 unsigned char pstyno;
114 CharShape cshape; /* ±ÛÀÚ°¡ ¸ðµÎ °°Àº ¸ð¾çÀ϶§ */
115 ParaShape pshape; /* reuse flag°¡ 0À̸é */
116 int pno; /* run-time only */
118 LineInfo *linfo;
119 CharShape *cshapep;
121 * Box object list
123 HBox **hhstr;
125 HWPPara(void);
126 ~HWPPara(void);
128 int Read(HWPFile &hwpf, unsigned char flag = 0);
129 int Write(CTextOut &txtf);
130 int Write(CHTMLOut &html);
132 void SetNext(HWPPara *n) { _next = n; };
134 /* layoutÀ» À§ÇÑ ÇÔ¼ö */
136 * Returns the character sytle of paragraph.
138 CharShape *GetCharShape(int pos);
140 * Returns the sytle of paragraph.
142 ParaShape *GetParaShape(void);
145 * Returns previous paragraph.
147 HWPPara *Prev(void);
149 * Returns next paragraph.
151 HWPPara *Next(void);
153 int HomePos(int line) const;
154 int EndPos(int line) const;
155 int LineLen(int line) const;
157 private:
158 HBox *readHBox(HWPFile &);
161 // inline functions
163 inline int HWPPara::HomePos(int line) const
165 if( nline < line + 1 ) return nch;
166 return linfo[line].pos;
170 inline int HWPPara::EndPos(int line) const
172 if( nline <= line + 1 ) return nch;
173 else return HomePos(line + 1);
177 inline int HWPPara::LineLen(int line) const
179 return EndPos(line) - HomePos(line);
181 #endif /* _HWPPARA_H_ */
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */