You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.1 KiB
78 lines
2.1 KiB
15 years ago
|
/*
|
||
|
* spellingfilter.h
|
||
|
*
|
||
|
* Copyright (c) 2002 Dave Corrie <kde@davecorrie.com>
|
||
|
*
|
||
|
* This file is part of KMail.
|
||
|
*
|
||
|
* KMail is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
*/
|
||
|
|
||
|
#ifndef SPELLINGFILTER_H_INCLUDED
|
||
|
#define SPELLINGFILTER_H_INCLUDED
|
||
|
|
||
15 years ago
|
#include <tqstring.h>
|
||
|
#include <tqstringlist.h>
|
||
15 years ago
|
#include "linklocator.h"
|
||
|
|
||
13 years ago
|
#include <tdepimmacros.h>
|
||
15 years ago
|
|
||
|
class KDE_EXPORT SpellingFilter
|
||
|
{
|
||
|
public:
|
||
|
enum UrlFiltering { DontFilterUrls, FilterUrls };
|
||
|
enum EmailAddressFiltering { DontFilterEmailAddresses, FilterEmailAddresses };
|
||
|
|
||
15 years ago
|
SpellingFilter(const TQString& text, const TQString& quotePrefix,
|
||
15 years ago
|
UrlFiltering filterUrls = FilterUrls,
|
||
|
EmailAddressFiltering filterEmailAddresses = FilterEmailAddresses,
|
||
15 years ago
|
const TQStringList& filterStrings = TQStringList());
|
||
15 years ago
|
|
||
15 years ago
|
TQString originalText() const;
|
||
|
TQString filteredText() const;
|
||
15 years ago
|
|
||
|
class TextCensor;
|
||
|
|
||
|
private:
|
||
15 years ago
|
const TQString mOriginal;
|
||
|
TQString mFiltered;
|
||
15 years ago
|
};
|
||
|
|
||
|
class SpellingFilter::TextCensor : public LinkLocator
|
||
|
{
|
||
|
public:
|
||
15 years ago
|
TextCensor(const TQString& s);
|
||
15 years ago
|
|
||
15 years ago
|
void censorQuotations(const TQString& quotePrefix);
|
||
15 years ago
|
void censorUrls();
|
||
|
void censorEmailAddresses();
|
||
15 years ago
|
void censorString(const TQString& s);
|
||
15 years ago
|
|
||
15 years ago
|
TQString censoredText() const;
|
||
15 years ago
|
|
||
|
private:
|
||
|
bool atLineStart() const;
|
||
|
void skipLine();
|
||
|
|
||
15 years ago
|
bool atQuotation(const TQString& quotePrefix) const;
|
||
|
void skipQuotation(const TQString& quotePrefix);
|
||
|
void findQuotation(const TQString& quotePrefix);
|
||
15 years ago
|
|
||
|
void findEmailAddress();
|
||
|
};
|
||
|
|
||
|
#endif // SPELLINGFILTER_H_INCLUDED
|
||
|
|