blob: f8de70d0b5c4f36777d32b558e686012b9f28592 (
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
|
#ifndef _SVG_SPAN_H_INCLUDED_
#define _SVG_SPAN_H_INCLUDED_
#include <string>
#include <vector>
namespace libvisio
{
class VSDOpenSpanOutputElement;
}
/**
* Represents an SVG text span and stores its properties required for laying out/wrapping the text
* within the parent text box.
*/
class SpanC
{
public:
SpanC(
const libvisio::VSDOpenSpanOutputElement *pSpan, const std::wstring &text,
double offsetInch, double widthInch, double lastCharWidthInch, bool hasNewLine);
const libvisio::VSDOpenSpanOutputElement *GetSpan() const;
const std::wstring GetText(bool exclTrailWhiteSpace = true) const;
double GetSpanOffsetInch() const;
double GetSpanWidthInch(bool exclTrailWhiteSpace = true) const;
double GetRowTotalWidthInch() const;
bool EndsWithNewLine() const;
void SetNewLine();
void SetRowTotalWidthInch(double width);
private:
const libvisio::VSDOpenSpanOutputElement *m_pSpan; ///< the original span element
std::wstring m_text; ///< span text (UTF-8 encoded)
double m_offsetInch; ///< horizontal offset of the span counted from the end of the previous span
double m_widthInch; ///< width of the span in inches
double m_lastCharWidthInch; ///< width in inches of the last span character
double m_rowTotalWidthInch; ///< width of all spans in inches on the same row of text
bool m_endsWithNewLine; ///< indicates a new line after this span
};
typedef std::vector<SpanC> SpansTp;
typedef SpansTp::iterator SpansItTp;
typedef SpansTp::const_iterator SpansContItTp;
#endif // _SVG_SPAN_H_INCLUDED_H_
|