10
10
#ifndef CEXPORTMANAGER_H
11
11
#define CEXPORTMANAGER_H
13
#include "util/cpointers.h"
13
17
#include "backend/config/cbtconfig.h"
14
18
#include "backend/managers/cswordbackend.h"
15
#include "util/cpointers.h"
22
22
class CSwordModuleInfo;
23
24
class QProgressDialog;
25
26
/** Contains the functions to export text to disk, clipboard or printer.
26
27
* @author The BibleTime team
28
29
class CExportManager : CPointers {
30
/** The format the export actions should have
37
CExportManager(const QString& caption, const bool showProgress = true, const QString& progressLabel = QString::null, const CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults(), const CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults());
39
bool saveKey(CSwordKey* key, const Format format, const bool addText);
40
bool saveKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
41
bool saveKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
43
bool copyKey(CSwordKey* key, const Format format, const bool addText);
44
bool copyKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
45
bool copyKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
47
bool printKey(CSwordKey* key, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
48
bool printKey( CSwordModuleInfo* module, const QString& startKey, const QString& stopKey, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions );
49
bool printByHyperlink(const QString& hyperlink, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
50
bool printKeyList(sword::ListKey* list, CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
51
bool printKeyList(const QStringList& list,CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
53
protected: // Protected methods
55
* Returns the string for the filedialogs to show the correct files.
57
const QString filterString( const Format format );
59
* Returns a filename to save a file.
61
const QString getSaveFileName(const Format format);
63
* Returns a string containing the linebreak for the current format.
65
const QString lineBreak( const Format format );
69
QString m_progressLabel;
71
CSwordBackend::FilterOptions m_filterOptions;
72
CSwordBackend::DisplayOptions m_displayOptions;
74
QProgressDialog* m_progressDialog;
77
* Creates the progress dialog with the correct settings.
79
QProgressDialog* progressDialog();
81
* Returns the CSS string used in HTML pages.
83
void setProgressRange( const int item );
85
* Increments the progress by one item.
87
inline void incProgress();
88
bool progressWasCancelled();
90
* Closes the progress dialog immediately.
92
void closeProgressDialog();
31
/** The format the export actions should have
38
CExportManager(const QString& caption, const bool showProgress = true, const QString& progressLabel = QString::null, const CSwordBackend::FilterOptions filterOptions = CBTConfig::getFilterOptionDefaults(), const CSwordBackend::DisplayOptions displayOptions = CBTConfig::getDisplayOptionDefaults());
40
bool saveKey(CSwordKey* key, const Format format, const bool addText);
41
bool saveKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
42
bool saveKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
44
bool copyKey(CSwordKey* key, const Format format, const bool addText);
45
bool copyKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
46
bool copyKeyList(QList<CSwordKey*>& list, const Format format, const bool addText );
48
bool printKey(CSwordKey* key, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
49
bool printKey( CSwordModuleInfo* module, const QString& startKey, const QString& stopKey, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions );
50
bool printByHyperlink(const QString& hyperlink, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
51
bool printKeyList(sword::ListKey* list, CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
52
bool printKeyList(const QStringList& list, CSwordModuleInfo* module, CSwordBackend::DisplayOptions displayOptions, CSwordBackend::FilterOptions filterOptions);
54
protected: // Protected methods
56
* Returns the string for the filedialogs to show the correct files.
58
const QString filterString( const Format format );
60
* Returns a filename to save a file.
62
const QString getSaveFileName(const Format format);
64
* Returns a string containing the linebreak for the current format.
66
const QString lineBreak( const Format format );
69
QString m_caption; ///< \todo Useless field
70
QString m_progressLabel;
72
CSwordBackend::FilterOptions m_filterOptions;
73
CSwordBackend::DisplayOptions m_displayOptions;
75
QProgressDialog* m_progressDialog;
78
* Creates the progress dialog with the correct settings.
80
QProgressDialog* progressDialog();
82
* Returns the CSS string used in HTML pages.
84
void setProgressRange( const int item );
86
* Increments the progress by one item.
88
inline void incProgress();
89
bool progressWasCancelled();
91
* Closes the progress dialog immediately.
93
void closeProgressDialog();