4 This file is part of KMail, the KDE mail client.
5 Copyright (c) 2003 Marc Mutz <mutz@kde.org>
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the Qt library by Trolltech AS, Norway (or with modified versions
23 of Qt that use the same license as Qt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 Qt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
32 #ifndef MESSAGEVIEWER_CSSHELPERBASE_H
33 #define MESSAGEVIEWER_CSSHELPERBASE_H
35 #include "messageviewer_export.h"
42 namespace MessageViewer
{
44 class MESSAGEVIEWER_EXPORT CSSHelperBase
{
46 /** Construct a CSSHelper object and set its font and color settings to
48 Sub-Classes should put their config loading here.
50 CSSHelperBase( const QPaintDevice
*pd
);
52 /** @return HTML head including style sheet definitions and the
54 QString
htmlHead( bool fixedFont
= false ) const;
56 /** @return The collected CSS definitions as a string */
57 QString
cssDefinitions( bool fixedFont
= false ) const;
59 /** @return a <div> start tag with embedded style
60 information suitable for quoted text with quote level @p level */
61 QString
quoteFontTag( int level
) const;
62 /** @return a <div> start tag with embedded style
63 information suitable for non-quoted text */
64 QString
nonQuotedFontTag() const;
66 QFont
bodyFont( bool fixedFont
= false, bool printing
= false ) const;
68 void setBodyFont( const QFont
& font
);
69 void setPrintFont( const QFont
& font
);
71 /** @return the quote color for the given level, where level ranges from 0 to 2 **/
72 QColor
quoteColor( int level
);
74 QColor
pgpWarnColor() const;
77 /** Recalculate PGP frame and body colors (should be called after changing
79 void recalculatePGPColors();
82 QFont mBodyFont
, mPrintFont
, mFixedFont
, mFixedPrintFont
;
84 QColor mQuoteColor
[3];
85 bool mRecycleQuoteColors
;
86 bool mBackingPixmapOn
;
88 QString mBackingPixmapStr
;
89 QColor mForegroundColor
, mLinkColor
, mVisitedLinkColor
, mBackgroundColor
;
90 // colors for PGP (Frame, Header, Body)
91 QColor cPgpOk1F
, cPgpOk1H
, cPgpOk1B
,
92 cPgpOk0F
, cPgpOk0H
, cPgpOk0B
,
93 cPgpWarnF
, cPgpWarnH
, cPgpWarnB
,
94 cPgpErrF
, cPgpErrH
, cPgpErrB
,
95 cPgpEncrF
, cPgpEncrH
, cPgpEncrB
;
96 // color of frame of warning preceding the source of HTML messages
100 int fontSize( bool fixed
, bool print
= false ) const;
101 // returns CSS rules specific to the print media type
102 QString
printCssDefinitions( bool fixed
) const;
103 // returns CSS rules specific to the screen media type
104 QString
screenCssDefinitions( const CSSHelperBase
* helper
, bool fixed
) const;
105 // returns CSS rules common to both screen and print media types
106 QString
commonCssDefinitions() const;
109 const QPaintDevice
*mPaintDevice
;