summaryrefslogtreecommitdiffstats
path: root/src/translators/htmlexporter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/translators/htmlexporter.h')
-rw-r--r--src/translators/htmlexporter.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/src/translators/htmlexporter.h b/src/translators/htmlexporter.h
new file mode 100644
index 0000000..be89bbf
--- /dev/null
+++ b/src/translators/htmlexporter.h
@@ -0,0 +1,124 @@
+/***************************************************************************
+ copyright : (C) 2003-2006 by Robby Stephenson
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of version 2 of the GNU General Public License as *
+ * published by the Free Software Foundation; *
+ * *
+ ***************************************************************************/
+
+#ifndef HTMLEXPORTER_H
+#define HTMLEXPORTER_H
+
+class QCheckBox;
+
+#include "exporter.h"
+#include "../stringset.h"
+
+#include <qstringlist.h>
+
+#include <libxml/xmlstring.h>
+
+extern "C" {
+ struct _xmlNode;
+}
+
+namespace Tellico {
+ namespace Data {
+ class Collection;
+ }
+ class XSLTHandler;
+
+ namespace Export {
+
+/**
+ * @author Robby Stephenson
+ */
+class HTMLExporter : public Exporter {
+Q_OBJECT
+
+public:
+ HTMLExporter();
+ HTMLExporter(Data::CollPtr coll);
+ ~HTMLExporter();
+
+ virtual bool exec();
+ virtual void reset();
+ virtual QString formatString() const;
+ virtual QString fileFilter() const;
+
+ virtual QWidget* widget(QWidget* parent, const char* name=0);
+ virtual void readOptions(KConfig*);
+ virtual void saveOptions(KConfig*);
+
+ void setCollectionURL(const KURL& url) { m_collectionURL = url; m_links.clear(); }
+ void setXSLTFile(const QString& filename);
+ void setPrintHeaders(bool printHeaders) { m_printHeaders = printHeaders; }
+ void setPrintGrouped(bool printGrouped) { m_printGrouped = printGrouped; }
+ void setMaxImageSize(int w, int h) { m_imageWidth = w; m_imageHeight = h; }
+ void setGroupBy(const QStringList& groupBy) { m_groupBy = groupBy; }
+ void setSortTitles(const QStringList& l)
+ { m_sort1 = l[0]; m_sort2 = l[1]; m_sort3 = l[2]; }
+ void setColumns(const QStringList& columns) { m_columns = columns; }
+ void setParseDOM(bool parseDOM) { m_parseDOM = parseDOM; reset(); }
+
+ QString text();
+
+public slots:
+ void slotCancel();
+
+private:
+ void setFormattingOptions(Data::CollPtr coll);
+ void writeImages(Data::CollPtr coll);
+ bool writeEntryFiles();
+ KURL fileDir() const;
+ QString fileDirName() const;
+
+ void parseDOM(_xmlNode* node);
+ QString handleLink(const QString& link);
+ const xmlChar* handleLink(const xmlChar* link);
+ QString analyzeInternalCSS(const QString& string);
+ const xmlChar* analyzeInternalCSS(const xmlChar* string);
+ bool copyFiles();
+ bool loadXSLTFile();
+ void createDir();
+
+ XSLTHandler* m_handler;
+ bool m_printHeaders : 1;
+ bool m_printGrouped : 1;
+ bool m_exportEntryFiles : 1;
+ bool m_cancelled : 1;
+ bool m_parseDOM : 1;
+ bool m_checkCreateDir : 1;
+ int m_imageWidth;
+ int m_imageHeight;
+
+ QWidget* m_widget;
+ QCheckBox* m_checkPrintHeaders;
+ QCheckBox* m_checkPrintGrouped;
+ QCheckBox* m_checkExportEntryFiles;
+ QCheckBox* m_checkExportImages;
+
+ KURL m_collectionURL;
+ QString m_xsltFile;
+ QString m_xsltFilePath;
+ QString m_dataDir;
+ QStringList m_groupBy;
+ QString m_sort1;
+ QString m_sort2;
+ QString m_sort3;
+ QStringList m_columns;
+ QString m_entryXSLTFile;
+
+ KURL::List m_files;
+ QMap<QString, QString> m_links;
+ StringSet m_copiedFiles;
+};
+
+ } // end namespace
+} // end namespace
+#endif