akregator
articleformatter.h
Go to the documentation of this file.00001 /* 00002 This file is part of Akregator. 00003 00004 Copyright (C) 2006 Frank Osterfeld <osterfeld@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of Qt, and distribute the resulting executable, 00022 without including the source code for Qt in the source distribution. 00023 */ 00024 00025 #ifndef AKREGATOR_ARTICLEFORMATTER_H 00026 #define AKREGATOR_ARTICLEFORMATTER_H 00027 00028 #include <kurl.h> 00029 00030 class QPaintDevice; 00031 class QString; 00032 00033 namespace Akregator { 00034 00035 class Article; 00036 class TreeNode; 00037 00038 class ArticleFormatter 00039 { 00040 public: 00041 00042 enum IconOption { 00043 NoIcon, 00044 ShowIcon 00045 }; 00046 00047 explicit ArticleFormatter( QPaintDevice* device = 0 ); 00048 00049 virtual ~ArticleFormatter(); 00050 00051 void setPaintDevice(QPaintDevice* device); 00052 00053 virtual QString formatArticle(const Article& article, IconOption icon) const = 0; 00054 00055 virtual QString formatSummary(TreeNode* node) const = 0; 00056 00057 virtual QString getCss() const = 0; 00058 00059 protected: 00060 00061 int pointsToPixel(int pointSize) const; 00062 00063 private: 00064 class Private; 00065 Private* const d; 00066 Q_DISABLE_COPY( ArticleFormatter ) 00067 }; 00068 00069 class DefaultNormalViewFormatter : public ArticleFormatter 00070 { 00071 public: 00072 00073 explicit DefaultNormalViewFormatter( const KUrl& imageDir, QPaintDevice* device = 0 ); 00074 ~DefaultNormalViewFormatter(); 00075 00076 QString formatArticle(const Article& article, IconOption option) const; 00077 00078 QString formatSummary(TreeNode* node) const; 00079 00080 QString getCss() const; 00081 00082 private: 00083 DefaultNormalViewFormatter(); 00084 00085 KUrl m_imageDir; 00086 class SummaryVisitor; 00087 SummaryVisitor* m_summaryVisitor; 00088 }; 00089 00090 class DefaultCombinedViewFormatter : public ArticleFormatter 00091 { 00092 00093 public: 00094 00095 explicit DefaultCombinedViewFormatter( const KUrl& imageDir, QPaintDevice* device = 0 ); 00096 00097 QString formatArticle(const Article& article, IconOption option) const; 00098 00099 QString formatSummary(TreeNode* node) const; 00100 00101 QString getCss() const; 00102 00103 private: 00104 DefaultCombinedViewFormatter(); 00105 00106 KUrl m_imageDir; 00107 }; 00108 00109 } // namespace Akregator 00110 00111 #endif // AKREGATOR_ARTICLEFORMATTER_H
KDE 4.2 API Reference