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
|
/***************************************************************************
cexportmanager.h - description
-------------------
begin : Mon Feb 25 2002
copyright : (C) 2002 by The BibleTime team
email : info@bibletime.de
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CEXPORTMANAGER_H
#define CEXPORTMANAGER_H
//BibleTime includes
#include "cbtconfig.h"
#include "util/cpointers.h"
//Qt includes
#include <qstring.h>
#include <qptrlist.h>
class ListKey;
class CSwordKey;
class CSwordModuleInfo;
class QProgressDialog;
typedef std::pair<QString, QString> QStringPair;
typedef QValueList<QStringPair> PrintItemList;
/**Contains the functions to export text to disk, clipboard or printer.
*@author The BibleTime team
*/
class CExportManager : CPointers {
public:
enum Format {
HTML,
Text
};
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());
const bool saveKey(CSwordKey* key, const Format format, const bool addText);
const bool saveKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
const bool saveKeyList(QPtrList<CSwordKey> list, const Format format, const bool addText );
const bool copyKey(CSwordKey* key, const Format format, const bool addText);
const bool copyKeyList(sword::ListKey* list, CSwordModuleInfo* module, const Format format, const bool addText);
const bool copyKeyList(QPtrList<CSwordKey> list, const Format format, const bool addText );
const bool printKey(CSwordKey* key, const QString& description = QString::null);
const bool printByHyperlink(const QString& hyperlink);
const bool printKeyList(sword::ListKey* list, CSwordModuleInfo* module);
const bool printKeyList(const PrintItemList& list,CSwordModuleInfo* module);
const bool printKey( CSwordModuleInfo* module, const QString& startKey, const QString& stopKey, const QString& description = QString::null );
protected: // Protected methods
/**
* Returns the string for the filedialogs to show the correct files.
*/
const QString filterString( const Format format );
/**
* Returns a filename to save a file.
*/
const QString getSaveFileName(const Format format);
/**
* Returns a string containing the linebreak for the current format.
*/
const QString lineBreak( const Format format );
private:
QString m_caption;
QString m_progressLabel;
bool m_showProgress;
CSwordBackend::FilterOptions m_filterOptions;
CSwordBackend::DisplayOptions m_displayOptions;
QProgressDialog* m_progressDialog;
/**
* Creates the progress dialog with the correct settings.
*/
QProgressDialog* const progressDialog();
/**
* Returns the CSS string used in HTML pages.
*/
void setProgressRange( const int item );
const QString htmlCSS(CSwordModuleInfo* module);
/**
* Increments the progress by one item.
*/
inline void incProgress();
const bool progressWasCancelled();
/**
* Closes the progress dialog immediatly.
*/
void closeProgressDialog();
};
#endif
|