Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / hwpfilter / source / hpara.h
blobd181aa21f94be67e14b3b7678838215a2cbddba9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_HWPFILTER_SOURCE_HPARA_H
21 #define INCLUDED_HWPFILTER_SOURCE_HPARA_H
23 #include "hwplib.h"
24 #include "hwpfile.h"
25 #include "hinfo.h"
26 #include <map>
27 #include <memory>
28 #include <vector>
30 struct HBox;
32 /**
33 * etc flag
34 * 0 bit : Use page columns
35 * 1 bit : Use page lows
36 * 2 bit : Use section break
37 * 3 bit : Block start
38 * 4 bit : In Block
39 * 5 bit : Block end
40 * 6 bit : Preserve widow orphan
41 * 7 bit : Reserved
43 enum
45 PA_USER_COLUMN = 1,
46 PA_USER_PAGE = 2, /* p user_page definition */
47 PA_SECTION_BREAK = 4,
48 PA_BLOCK_BEGIN = 8,
49 PA_IN_BLOCK = 16,
50 PA_BLOCK_END = 32,
51 PA_WIDOW_ORPHAN = 64
54 class HWPPara;
55 #define FIXED_SPACING_BIT (0x8000)
57 struct LineInfo
59 /* the position of the starting character: the control has a different length */
60 /**
61 * Starting character position
63 unsigned short pos;
64 hunit space_width;
65 hunit height;
66 hunit pgy; /* internal */
67 hunit sx; /* internal */
68 hunit psx; /* internal */
69 hunit pex; /* internal */
70 // for formatting
71 hunit height_sp;
72 unsigned short softbreak; // column, page, section
74 void Read(HWPFile &hwpf, HWPPara const *para);
76 /**
77 * It represents the paragraph.
78 * @short Paragraph
80 class DLLEXPORT HWPPara
82 private:
83 HWPPara *_next;
85 public:
86 // paragraph information
87 /**
88 * Zero is for the new paragraph style.
90 unsigned char reuse_shape; /* the new shape if 0 */
91 unsigned short nch;
92 unsigned short nline;
94 // realking
95 hunit begin_ypos;
96 unsigned char scflag;
98 /**
99 * If the value is 0, all character of paragraph have same style given cshape
101 unsigned char contain_cshape; /* if it's 0, all the characters are representing with representative shape */
102 unsigned char etcflag;
104 * Checks the special characters in the paragraph
106 unsigned long ctrlflag;
107 unsigned char pstyno;
108 std::shared_ptr<CharShape> cshape; /* When characters are all the same shape */
109 std::shared_ptr<ParaShape> pshape; /* if reuse flag is 0, */
111 std::unique_ptr<LineInfo[]> linfo;
112 std::vector<std::shared_ptr<CharShape>> cshapep;
114 * Box object list
116 std::map<unsigned short, std::unique_ptr<HBox>> hhstr;
118 HWPPara(void);
119 ~HWPPara(void);
121 bool Read(HWPFile &hwpf, unsigned char flag);
123 void SetNext(HWPPara *n) { _next = n; };
125 /* Functions for layout */
127 * Returns the character style of paragraph.
129 CharShape *GetCharShape(int pos);
131 * Returns the style of paragraph.
133 ParaShape& GetParaShape(void) { return *pshape; }
136 * Returns next paragraph.
138 HWPPara *Next(void) { return _next;}
140 private:
141 std::unique_ptr<HBox> readHBox(HWPFile &);
144 #endif // INCLUDED_HWPFILTER_SOURCE_HPARA_H
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */