forked from KDE/ghostwriter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExportFormat.cpp
More file actions
145 lines (126 loc) · 4.41 KB
/
Copy pathExportFormat.cpp
File metadata and controls
145 lines (126 loc) · 4.41 KB
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
/***********************************************************************
*
* Copyright (C) 2015-2016 wereturtle
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***********************************************************************/
#include "ExportFormat.h"
// Definitions of common export format constants.
const ExportFormat* const ExportFormat::HTML =
new ExportFormat("HTML", "(*.html *.htm)", "html");
const ExportFormat* const ExportFormat::HTML5
= new ExportFormat("HTML 5", "(*.html *.htm)", "html");
const ExportFormat* const ExportFormat::ODT
= new ExportFormat("OpenDocument Text", "(*.odt)", "odt", true);
const ExportFormat* const ExportFormat::ODF
= new ExportFormat("OpenDocument Flat XML Format", "(*.odt *.fodt *.xml)", "odt");
const ExportFormat* const ExportFormat::RTF
= new ExportFormat("Rich Text Format", "(*.rtf)", "rtf", true);
const ExportFormat* const ExportFormat::DOCX
= new ExportFormat("Word Document", "(*.docx)", "docx", true);
const ExportFormat* const ExportFormat::PDF
= new ExportFormat("PDF", "(*.pdf)", "pdf", true);
const ExportFormat* const ExportFormat::PDF_LATEX
= new ExportFormat("PDF (LaTeX)", "(*.pdf)", "pdf", true);
const ExportFormat* const ExportFormat::PDF_CONTEXT
= new ExportFormat("PDF (ConTeXt)", "(*.pdf)", "pdf", true);
const ExportFormat* const ExportFormat::PDF_WKHTML
= new ExportFormat("PDF (wkhtmltopdf)", "(*.pdf)", "pdf", true);
const ExportFormat* const ExportFormat::EPUBV2
= new ExportFormat("EPUB v2 Book", "(*.epub)", "epub", true);
const ExportFormat* const ExportFormat::EPUBV3
= new ExportFormat("EPUB v3 Book", "(*.epub)", "epub", true);
const ExportFormat* const ExportFormat::FICTIONBOOK2
= new ExportFormat("FictionBook2 e-book", "(*.fb2)", "fb2", true);
const ExportFormat* const ExportFormat::LATEX
= new ExportFormat("LaTeX", "(*.tex *.ltx *.latex)", "tex");
const ExportFormat* const ExportFormat::LYX
= new ExportFormat("LyX", "(*.lyx)", "lyx", true);
const ExportFormat* const ExportFormat::MEMOIR
= new ExportFormat("memoir", "(*.tex *.ltx *.latex)", "tex");
const ExportFormat* const ExportFormat::GROFFMAN
= new ExportFormat("groff man page", "(*.man *.1 *.2 *.3 *.4 *.5 *.6 *.7 *.8)", "man", true);
const ExportFormat* const ExportFormat::MANPAGE
= new ExportFormat("man page", "(*.man *.1 *.2 *.3 *.4 *.5 *.6 *.7 *.8)", "man", true);
ExportFormat::ExportFormat()
: fileExtensionMandatoryFlag(false)
{
}
ExportFormat::ExportFormat
(
const QString& name,
const QString& fileFilter,
const QString& defaultFileExtension,
bool fileExtensionMandatory
)
: defaultFileExtension(defaultFileExtension),
fileExtensionMandatoryFlag(fileExtensionMandatory)
{
setName(name);
setFileFilter(fileFilter);
}
ExportFormat::~ExportFormat()
{
}
QString ExportFormat::getName() const
{
return name;
}
void ExportFormat::setName(const QString& value)
{
name = value;
createNamedFilter();
}
QString ExportFormat::getFileFilter() const
{
return fileFilter;
}
void ExportFormat::setFileFilter(const QString& value)
{
fileFilter = value;
createNamedFilter();
}
QString ExportFormat::getNamedFilter() const
{
return namedFilter;
}
QString ExportFormat::getDefaultFileExtension() const
{
return defaultFileExtension;
}
void ExportFormat::setDefaultFileExtension(const QString& value)
{
defaultFileExtension = value;
}
bool ExportFormat::isFileExtensionMandatory() const
{
return fileExtensionMandatoryFlag;
}
void ExportFormat::setFileExtenstionMandatory(bool mandatory)
{
fileExtensionMandatoryFlag = mandatory;
}
void ExportFormat::createNamedFilter()
{
namedFilter = "";
if (!name.isNull() && !name.isEmpty())
{
namedFilter = name + QString(" ");
}
if (!fileFilter.isNull() && !fileFilter.isEmpty())
{
namedFilter += fileFilter;
}
}