libtdepim

csshelper.h
1 /*
2  csshelper.h
3 
4  This file is part of KMail, the KDE mail client.
5  Copyright (c) 2003 Marc Mutz <mutz@kde.org>
6 
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.
10 
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.
15 
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
19 
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 TQt library by Trolltech AS, Norway (or with modified versions
23  of TQt that use the same license as TQt), 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  TQt. 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
29  your version.
30 */
31 
32 #ifndef KPIM_CSSHELPER_H
33 #define KPIM_CSSHELPER_H
34 
35 #include <tqcolor.h>
36 #include <tqfont.h>
37 #include <tqpaintdevicemetrics.h>
38 
39 class TQString;
40 
41 namespace KPIM {
42 
43 class CSSHelper {
44  public:
49  CSSHelper( const TQPaintDeviceMetrics &pdm );
50 
53  TQString htmlHead( bool fixedFont = false ) const;
54 
56  TQString cssDefinitions( bool fixedFont = false ) const;
57 
60  TQString quoteFontTag( int level ) const;
63  TQString nonQuotedFontTag() const;
64 
65  TQFont bodyFont( bool fixedFont = false, bool printing = false ) const;
66 
67  void setBodyFont( const TQFont& font );
68  void setPrintFont( const TQFont& font );
69 
70  TQColor pgpWarnColor() const;
71 
72  protected:
75  void recalculatePGPColors();
76 
77  protected:
78  TQFont mBodyFont, mPrintFont, mFixedFont, mFixedPrintFont;
79  TQFont mQuoteFont[3];
80  TQColor mQuoteColor[3];
81  bool mRecycleQuoteColors;
82  bool mBackingPixmapOn;
83  bool mShrinkQuotes;
84  TQString mBackingPixmapStr;
85  TQColor mForegroundColor, mLinkColor, mVisitedLinkColor, mBackgroundColor;
86  // colors for PGP (Frame, Header, Body)
87  TQColor cPgpOk1F, cPgpOk1H, cPgpOk1B,
88  cPgpOk0F, cPgpOk0H, cPgpOk0B,
89  cPgpWarnF, cPgpWarnH, cPgpWarnB,
90  cPgpErrF, cPgpErrH, cPgpErrB,
91  cPgpEncrF, cPgpEncrH, cPgpEncrB;
92  // color of frame of warning preceding the source of HTML messages
93  TQColor cHtmlWarning;
94 
95  private:
96  int fontSize( bool fixed, bool print = false ) const;
97  // returns CSS rules specific to the print media type
98  TQString printCssDefinitions( bool fixed ) const;
99  // returns CSS rules specific to the screen media type
100  TQString screenCssDefinitions( const CSSHelper * helper, bool fixed ) const;
101  // returns CSS rules common to both screen and print media types
102  TQString commonCssDefinitions() const;
103 
104  private:
105  const TQPaintDeviceMetrics mMetrics;
106 
107 };
108 
109 } // namespace KPIM
110 
111 #endif // KPIM_CSSHELPER_H
TDEPIM classes for drag and drop of mails.