-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTexExport.cpp
155 lines (145 loc) · 6.91 KB
/
TexExport.cpp
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#include "TexExport.h"
#include "Note.h"
#include "Article.h"
#include "ImageNote.h"
#include "AudioNote.h"
#include "VideoNote.h"
#include "Document.h"
//TexExport
QString TexExport::header() const
{
return "\%\%\%\%\%\% These exported files need to use movie15 packages for multimedia support\%\%\%\%\%\n\\documentclass[a4paper,11pt]{report}\n\\usepackage{graphicx}\n\\usepackage{movie15}\n\\usepackage{multimedia}\n\\usepackage[french]{babel}\n\\usepackage[latin1]{inputenc}\n\\usepackage[T1]{fontenc}\n\\begin{document}";
}
QString TexExport::footer() const
{
return "\n\\end{document}";
}
QString TexExport::exportNote(const Article *note, unsigned int level) const
{
switch(level){
case 0:
return " \n\\chapter{"+note->getTitle()+"}\n"+note->getText();
case 1:
return " \n\\section{"+note->getTitle()+"}\n"+note->getText();
case 2:
return " \n\\subsection{"+note->getTitle()+"}\n"+note->getText();
case 3:
return " \n\\subsubsection{"+note->getTitle()+"}\n"+note->getText();
case 4:
return " \n\\paragraph{"+note->getTitle()+"}\n"+note->getText();
case 5:
return " \n\\subparagraph{"+note->getTitle()+"}\n"+note->getText();
default:
return " \n\\subparagraph{"+note->getTitle()+"}\n"+note->getText();
}
}
QString TexExport::exportNote(const ImageNote *note, unsigned int level) const
{
switch(level){
case 0:
return " \n\\chapter{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 1:
return " \n\\section{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 2:
return " \n\\subsection{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 3:
return " \n\\subsubsection{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 4:
return " \n\\paragraph{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 5:
return " \n\\subparagraph{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
default:
return " \n\\subparagraph{"+note->getTitle()+"}\n\\begin{center}\n\\includegraphics{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
}
}
QString TexExport::exportNote(const Document *doc, unsigned int level) const
{
QString str;
switch(level){
case 0:
str+=" \n\\chapter{"+doc->getTitle()+"}";
break;
case 1:
str+=" \n\\section{"+doc->getTitle()+"}";
break;
case 2:
str+=" \n\\subsection{"+doc->getTitle()+"}";
break;
case 3:
str+=" \n\\subsubsection{"+doc->getTitle()+"}";
break;
case 4:
str+=" \n\\paragraph{"+doc->getTitle()+"}";
break;
case 5:
str+=" \n\\subparagraph{"+doc->getTitle()+"}";
break;
default:
str+=" \n\\subparagraph{"+doc->getTitle()+"}";
}
level++;
for(QList<Note *>::const_iterator it = doc->begin(); it!=doc->end(); it++)
{
str+=(*it)->exportNote(this, level);
}
return str;
}
QString TexExport::exportNote(const VideoNote *note, unsigned int level) const
{
switch(level){
case 0:
return " \n\\chapter{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 1:
return " \n\\section{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 2:
return " \n\\subsection{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 3:
return " \n\\subsubsection{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 4:
return " \n\\paragraph{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 5:
return " \n\\subparagraph{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
default:
return " \n\\subparagraph{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{320}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
}
}
QString TexExport::exportNote(const AudioNote *note, unsigned int level) const
{
switch(level){
case 0:
return " \n\\chapter{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 1:
return " \n\\section{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 2:
return " \n\\subsection{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 3:
return " \n\\subsubsection{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 4:
return " \n\\paragraph{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
case 5:
return " \n\\subparagraph{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
default:
return " \n\\subparagraph{"+note->getTitle()+"}\n\\begin{center}\n\\includemovie[options]{480}{100}{\""+note->getMediaPath()+"\"}\n\\caption{"+note->getDescription()+\
+"} \n\\end{center}";
}
}