blob: 578c90963a469291384adf4d28a37fc9b2b504be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#ifndef _SVG_PARAGRAPH_H_INCLUDED_
#define _SVG_PARAGRAPH_H_INCLUDED_
#include <map>
#include <string>
#include <vector>
namespace librevenge
{
class RVNGPropertyList;
}
namespace libvisio
{
class VSDOpenParagraphOutputElement;
class VSDOpenListElementOutputElement;
class VSDOpenSpanOutputElement;
}
/**
* Represents a paragraph of text within the original text box. Manages individual spans of text
* and stores information about partial text extents.
*/
class ParagraphC
{
public:
typedef std::vector<double> TextExtentsTp;
typedef std::map<int, const libvisio::VSDOpenSpanOutputElement *> SpanMarksTp;
typedef SpanMarksTp::const_iterator SpanMarksConstItTp;
ParagraphC();
double GetMarginLeftInch() const;
double GetMarginRightInch() const;
double GetMarginTopInch() const;
double GetMarginBottomInch() const;
double GetLineHeightInch(double fontSizeInch) const;
void Reset(const libvisio::VSDOpenParagraphOutputElement *pOpenParagraph);
void Reset(const libvisio::VSDOpenListElementOutputElement *pOpenListElem);
void Reset(const librevenge::RVNGPropertyList &properties);
void AddSpan(const libvisio::VSDOpenSpanOutputElement *pSpan);
void AddText(const std::wstring &text, const TextExtentsTp &extents);
double GetCurrentTextExtentInch() const;
const std::string &GetHorizontalAlignment() const;
const std::wstring &GetText() const;
const TextExtentsTp &GetTextExtents() const;
const SpanMarksTp &GetSpanMarks() const;
const libvisio::VSDOpenSpanOutputElement *GetSpanFromIndex(unsigned int index);
private:
double m_margLeftInch; ///< left margin in inches
double m_margRightInch; ///< right margin in inches
double m_margTopInch; ///<< top margin in inches
double m_margBottomInch; ///< bottom margin in inches
double m_lineHeight; ///< line height (relative or absolute in inches)
bool m_isLineHeightRel; ///< indicates if m_lineHeight is a relative value
std::string m_horizontalAlignment; ///< horizontal alignment of the text
std::wstring m_text; ///< paragraph text
TextExtentsTp m_textExtents; ///< contiguous line of extents of characters within the paragraph
SpanMarksTp m_spanMarks; ///< maps indices of characters within paragraph text to Span elements
};
#endif // _SVG_PARAGRAPH_H_INCLUDED_
|