forked from lpxxn/docx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtext.h
108 lines (72 loc) · 2.21 KB
/
text.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef DOCXTEXT_H
#define DOCXTEXT_H
#include "docx_global.h"
#include "length.h"
#include "shared.h"
#include "./enums/enumtext.h"
#include <QString>
#include <QDomElement>
#include <QList>
#include <QImage>
class QDomDocument;
namespace Docx {
class Run;
class Text;
class CT_RPr;
class CT_PPr;
class DocumentPart;
class InlineShape;
class CT_Inline;
class DOCX_EXPORT Paragraph
{
public:
Paragraph(DocumentPart *part, const QDomElement &element);
Run* addRun(const QString &text = QString(), const QString &style = QString());
void addText(const QString &text);
QString text() const;
void setStyle(const QString &style);
void setAlignment(WD_PARAGRAPH_ALIGNMENT align);
Paragraph* insertParagraphBefore(const QString &text, const QString &style = QString());
virtual ~Paragraph();
public:
DocumentPart *m_part;
QDomDocument *m_dom;
QDomElement *m_pEle;
QList<Run *> m_runs;
CT_PPr *m_style;
friend class CT_PPr;
};
class DOCX_EXPORT Run
{
public:
Run(DocumentPart *part, QDomElement *parent);
Run(DocumentPart *part, QDomElement *parent, const QDomElement &ele);
virtual ~Run();
void addTab();
void addBreak(WD_BREAK breakType = WD_BREAK::PAGE);
void addText(const QString &text);
QString text() const;
InlineShape* addPicture(const QString &path, const Length &width = Length(), const Length &height = Length());
InlineShape* addPicture(const QImage &img, const Length &width = Length(), const Length &height = Length());
void setStyle(const QString &style);
void setAllcaps(bool isallcaps = true);
void setSmallcaps(bool smallcpas = true);
void setBold(bool isbold = true);
void setItalic(bool isItalic = true);
void setDoubleStrike(bool isDoubleStrike = true);
void setShadow(bool shadow = true);
void setUnderLine(WD_UNDERLINE underline);
void addDrawing(CT_Inline *imline);
private:
InlineShape* scalePicture(InlineShape *picture, const Length &width, const Length &height);
private:
QString m_text;
DocumentPart *m_part;
QDomDocument *m_dom;
QDomElement m_rEle;
QDomElement *m_parent;
CT_RPr *m_style = nullptr;
friend class CT_RPr;
};
}
#endif // TEXT_H