emailquotehighlighter.h

00001 
00020 #ifndef KPIMTEXTEDIT_EMAILQUOTEHIGHLIGHTER_H
00021 #define KPIMTEXTEDIT_EMAILQUOTEHIGHLIGHTER_H
00022 
00023 #include "kpimtextedit_export.h"
00024 
00025 #include <sonnet/highlighter.h>
00026 
00027 #include <memory>
00028 
00029 namespace KPIMTextEdit
00030 {
00031   class TextEdit;
00032 
00044   class KPIMTEXTEDIT_EXPORT EMailQuoteHighlighter : public Sonnet::Highlighter
00045     {
00046     public:
00047 
00052       explicit EMailQuoteHighlighter( TextEdit *textEdit,
00053                                       const QColor &normalColor = Qt::black,
00054                                       const QColor &quoteDepth1 = QColor( 0x00, 0x80, 0x00 ),
00055                                       const QColor &quoteDepth2 = QColor( 0x00, 0x80, 0x00 ),
00056                                       const QColor &quoteDepth3 = QColor( 0x00, 0x80, 0x00 ),
00057                                       const QColor &misspelledColor = Qt::red );
00058 
00059       ~EMailQuoteHighlighter();
00060 
00071       void setQuoteColor( const QColor &normalColor,
00072                           const QColor &quoteDepth1,
00073                           const QColor &quoteDepth2,
00074                           const QColor &quoteDepth3,
00075                           const QColor &misspelledColor = Qt::red );
00076 
00082       void toggleSpellHighlighting( bool on );
00083 
00087       virtual void highlightBlock ( const QString & text );
00088 
00094       static QString highlightText( const QString& text,
00095                                     const QColor &quoteDepth1 = QColor( 0x00, 0x80, 0x00 ),
00096                                     const QColor &quoteDepth2 = QColor( 0x00, 0x80, 0x00 ),
00097                                     const QColor &quoteDepth3 = QColor( 0x00, 0x80, 0x00 ) );
00098 
00103       static QString highlightParagraph( const QString& text,
00104                                     const QColor &quoteDepth1 = QColor( 0x00, 0x80, 0x00 ),
00105                                     const QColor &quoteDepth2 = QColor( 0x00, 0x80, 0x00 ),
00106                                     const QColor &quoteDepth3 = QColor( 0x00, 0x80, 0x00 ) );
00107 
00108     protected:
00109 
00115       virtual void unsetMisspelled( int start,  int count );
00116 
00121       virtual void setMisspelled( int start, int count );
00122 
00123     private:
00124       class EMailQuoteHighlighterPrivate;
00125       std::auto_ptr<EMailQuoteHighlighterPrivate> d;
00126     };
00127 }
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys