1/*
2 This file is part of the kcalutils library.
3
4 Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22#ifndef KCALUTILS_HTMLEXPORT_H
23#define KCALUTILS_HTMLEXPORT_H
24
25#include "kcalutils_export.h"
26
27#include <kcalcore/event.h>
28#include <kcalcore/incidence.h>
29#include <kcalcore/todo.h>
30
31#include <QtCore/QDateTime>
32#include <QtCore/QString>
33
34namespace KCalCore {
35class MemoryCalendar;
36}
37
38class QTextStream;
39
40namespace KCalUtils {
41
42class HTMLExportSettings;
43
44/**
45 This class provides the functions to export a calendar as a HTML page.
46*/
47class KCALUTILS_EXPORT HtmlExport
48{
49public:
50 /**
51 Create new HTML exporter for calendar.
52 */
53 HtmlExport(KCalCore::MemoryCalendar *calendar, HTMLExportSettings *settings);
54 virtual ~HtmlExport();
55
56 /**
57 Writes out the calendar in HTML format.
58 */
59 bool save(const QString &fileName = QString());
60
61 /**
62 Writes out calendar to text stream.
63 */
64 bool save(QTextStream *ts);
65
66 void addHoliday(const QDate &date, const QString &name);
67
68protected:
69 void createWeekView(QTextStream *ts);
70 void createMonthView(QTextStream *ts);
71 void createEventList(QTextStream *ts);
72 void createTodoList(QTextStream *ts);
73 void createJournalView(QTextStream *ts);
74 void createFreeBusyView(QTextStream *ts);
75
76 void createTodo(QTextStream *ts, const KCalCore::Todo::Ptr &todo);
77
78 void createEvent(QTextStream *ts, const KCalCore::Event::Ptr &event,
79 const QDate &date, bool withDescription = true);
80
81 void createFooter(QTextStream *ts);
82
83 bool checkSecrecy(const KCalCore::Incidence::Ptr &incidence);
84
85 void formatLocation(QTextStream *ts, const KCalCore::Incidence::Ptr &incidence);
86
87 void formatCategories(QTextStream *ts, const KCalCore::Incidence::Ptr &incidence);
88
89 void formatAttendees(QTextStream *ts, const KCalCore::Incidence::Ptr &incidence);
90
91 QString breakString(const QString &text);
92
93 QDate fromDate() const;
94 QDate toDate() const;
95 QString styleSheet() const;
96
97private:
98 //@cond PRIVATE
99 Q_DISABLE_COPY(HtmlExport)
100 class Private;
101 Private *const d;
102 //@endcond
103};
104
105}
106
107#endif
108