importabstractautocorrection.h 1.76 KB
Newer Older
1
/*
2
  SPDX-FileCopyrightText: 2012-2020 Laurent Montel <montel@kde.org>
3

4
  SPDX-License-Identifier: GPL-2.0-or-later
5 6 7 8 9 10 11 12 13 14
*/

#ifndef IMPORTABSTRACTAUTOCORRECTION_H
#define IMPORTABSTRACTAUTOCORRECTION_H

#include <QSet>
#include <QString>
#include <QHash>

#include "autocorrection/autocorrection.h"
15
#include "pimcommon_private_export.h"
Laurent Montel's avatar
Laurent Montel committed
16
namespace PimCommon {
17
class PIMCOMMON_TESTS_EXPORT ImportAbstractAutocorrection
18
{
Laurent Montel's avatar
Laurent Montel committed
19
    Q_GADGET
20 21 22 23 24
public:
    enum LoadAttribute {
        All = 0,
        SuperScript
    };
Laurent Montel's avatar
Laurent Montel committed
25
    Q_ENUM(LoadAttribute)
26 27 28 29 30 31

    explicit ImportAbstractAutocorrection(QWidget *parent);
    virtual ~ImportAbstractAutocorrection();

    virtual bool import(const QString &fileName, ImportAbstractAutocorrection::LoadAttribute loadAttribute = All) = 0;

Laurent Montel's avatar
Laurent Montel committed
32 33 34 35
    Q_REQUIRED_RESULT QSet<QString> upperCaseExceptions() const;
    Q_REQUIRED_RESULT QSet<QString> twoUpperLetterExceptions() const;
    Q_REQUIRED_RESULT QHash<QString, QString> autocorrectEntries() const;
    Q_REQUIRED_RESULT QHash<QString, QString> superScriptEntries() const;
36

Laurent Montel's avatar
Laurent Montel committed
37 38
    Q_REQUIRED_RESULT AutoCorrection::TypographicQuotes typographicSingleQuotes() const;
    Q_REQUIRED_RESULT AutoCorrection::TypographicQuotes typographicDoubleQuotes() const;
39

Laurent Montel's avatar
Laurent Montel committed
40
    Q_REQUIRED_RESULT int maxFindStringLenght() const;
41

Laurent Montel's avatar
Laurent Montel committed
42
    Q_REQUIRED_RESULT int minFindStringLenght() const;
43

44
protected:
Laurent Montel's avatar
Laurent Montel committed
45 46
    int mMaxFindStringLenght = 0;
    int mMinFindStringLenght = 0;
47 48 49 50 51 52
    QSet<QString> mUpperCaseExceptions;
    QSet<QString> mTwoUpperLetterExceptions;
    QHash<QString, QString> mAutocorrectEntries;
    QHash<QString, QString> mSuperScriptEntries;
    AutoCorrection::TypographicQuotes mTypographicSingleQuotes;
    AutoCorrection::TypographicQuotes mTypographicDoubleQuotes;
Laurent Montel's avatar
Laurent Montel committed
53
    QWidget *const mParent;
54 55 56 57
};
}

#endif // IMPORTABSTRACTAUTOCORRECTION_H