libkcal

htmlexport.h

Go to the documentation of this file.
00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef KCAL_HTMLEXPORT_H
00023 #define KCAL_HTMLEXPORT_H
00024 
00025 #include <qstring.h>
00026 #include <qdatetime.h>
00027 #include <qmap.h>
00028 
00029 #include <libkcal/calendar.h>
00030 #include <libkcal/htmlexportsettings.h>
00031 
00032 #include "libkcal_export.h"
00033 
00034 class QFile;
00035 class QTextStream;
00036 
00037 namespace KCal {
00038 
00042 class KDE_EXPORT HtmlExport
00043 {
00044   public:
00048     HtmlExport( Calendar *calendar, HTMLExportSettings *settings );
00049     virtual ~HtmlExport() {}
00050 
00054     bool save( const QString &fileName = QString::null );
00055 
00059     bool save( QTextStream * );
00060 
00061     void addHoliday( const QDate &date, const QString &name );
00062 
00063   protected:
00064     void createWeekView( QTextStream *ts );
00065     void createMonthView( QTextStream *ts );
00066     void createEventList( QTextStream *ts );
00067     void createTodoList( QTextStream *ts );
00068     void createJournalView( QTextStream *ts );
00069     void createFreeBusyView( QTextStream *ts );
00070 
00071     void createTodo( QTextStream *ts, Todo *todo);
00072     void createEvent( QTextStream *ts, Event *event, QDate date,
00073                       bool withDescription = true);
00074     void createFooter( QTextStream *ts );
00075 
00076     bool checkSecrecy( Incidence * );
00077 
00078     void formatLocation( QTextStream *ts, Incidence *event );
00079     void formatCategories( QTextStream *ts, Incidence *event );
00080     void formatAttendees( QTextStream *ts, Incidence *event );
00081 
00082     QString breakString( const QString &text );
00083 
00084     QDate fromDate() const;
00085     QDate toDate() const;
00086     QString styleSheet() const;
00087 
00088   private:
00089     QString cleanChars( const QString &txt );
00090 
00091     Calendar *mCalendar;
00092     HTMLExportSettings *mSettings;
00093     QMap<QDate,QString> mHolidayMap;
00094 
00095     class Private;
00096     Private *d;
00097 };
00098 
00099 }
00100 
00101 #endif