nss: upgrade to release 3.73
[LibreOffice.git] / hwpfilter / source / hpara.h
blobd3b0b788970e4b623e35ff68ecbd75f2b5223e88
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 <tools/long.hxx>
27 #include <map>
28 #include <memory>
29 #include <vector>
31 struct HBox;
33 /**
34 * etc flag
35 * 0 bit : Use page columns
36 * 1 bit : Use page lows
37 * 2 bit : Use section break
38 * 3 bit : Block start
39 * 4 bit : In Block
40 * 5 bit : Block end
41 * 6 bit : Preserve widow orphan
42 * 7 bit : Reserved
44 enum
46 PA_USER_COLUMN = 1,
47 PA_USER_PAGE = 2, /* p user_page definition */
48 PA_SECTION_BREAK = 4,
49 PA_BLOCK_BEGIN = 8,
50 PA_IN_BLOCK = 16,
51 PA_BLOCK_END = 32,
52 PA_WIDOW_ORPHAN = 64
55 class HWPPara;
56 #define FIXED_SPACING_BIT (0x8000)
58 struct LineInfo
60 /* the position of the starting character: the control has a different length */
61 /**
62 * Starting character position
64 unsigned short pos;
65 hunit space_width;
66 hunit height;
67 hunit pgy; /* internal */
68 hunit sx; /* internal */
69 hunit psx; /* internal */
70 hunit pex; /* internal */
71 // for formatting
72 hunit height_sp;
73 unsigned short softbreak; // column, page, section
75 void Read(HWPFile &hwpf, HWPPara const *para);
77 /**
78 * It represents the paragraph.
79 * @short Paragraph
81 class DLLEXPORT HWPPara
83 private:
84 HWPPara *_next;
86 public:
87 // paragraph information
88 /**
89 * Zero is for the new paragraph style.
91 unsigned char reuse_shape; /* the new shape if 0 */
92 unsigned short nch;
93 unsigned short nline;
95 // realking
96 hunit begin_ypos;
97 unsigned char scflag;
99 /**
100 * If the value is 0, all character of paragraph have same style given cshape
102 unsigned char contain_cshape; /* if it's 0, all the characters are representing with representative shape */
103 unsigned char etcflag;
105 * Checks the special characters in the paragraph
107 tools::ULong ctrlflag;
108 unsigned char pstyno;
109 std::shared_ptr<CharShape> cshape; /* When characters are all the same shape */
110 std::shared_ptr<ParaShape> pshape; /* if reuse flag is 0, */
112 std::unique_ptr<LineInfo[]> linfo;
113 std::vector<std::shared_ptr<CharShape>> cshapep;
115 * Box object list
117 std::map<unsigned short, std::unique_ptr<HBox>> hhstr;
119 HWPPara(void);
120 ~HWPPara(void);
122 bool Read(HWPFile &hwpf, unsigned char flag);
124 void SetNext(HWPPara *n) { _next = n; };
126 /* Functions for layout */
128 * Returns the character style of paragraph.
130 CharShape *GetCharShape(int pos);
132 * Returns the style of paragraph.
134 ParaShape& GetParaShape(void) { return *pshape; }
137 * Returns next paragraph.
139 HWPPara *Next(void) { return _next;}
141 private:
142 std::unique_ptr<HBox> readHBox(HWPFile &);
145 #endif // INCLUDED_HWPFILTER_SOURCE_HPARA_H
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */