| 1 | /* |
| 2 | * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #ifndef SYNRTFEXPORTER_H |
| 18 | #define SYNRTFEXPORTER_H |
| 19 | |
| 20 | #include "synexporter.h" |
| 21 | |
| 22 | namespace QSynedit { |
| 23 | |
| 24 | class SynRTFExporter : public SynExporter |
| 25 | { |
| 26 | public: |
| 27 | explicit SynRTFExporter(const QByteArray charset); |
| 28 | private: |
| 29 | bool mAttributesChanged; |
| 30 | QList<QColor> mListColors; |
| 31 | QString ColorToRTF(const QColor& AColor) const; |
| 32 | int GetColorIndex(const QColor& AColor); |
| 33 | QString GetFontTable(); |
| 34 | |
| 35 | // SynExporter interface |
| 36 | protected: |
| 37 | void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged) override; |
| 38 | void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged) override; |
| 39 | void FormatAfterLastAttribute() override; |
| 40 | void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged) override; |
| 41 | void FormatNewLine() override; |
| 42 | QString () override; |
| 43 | QString GetFormatName() override; |
| 44 | QString () override; |
| 45 | }; |
| 46 | |
| 47 | } |
| 48 | #endif // SYNRTFEXPORTER_H |
| 49 | |