File indexing completed on 2025-01-05 05:23:52
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2023 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_ABSTRACTCOLUMNHTMLRENDERER_HPP 0010 #define KASTEN_ABSTRACTCOLUMNHTMLRENDERER_HPP 0011 0012 class QTextStream; 0013 class QString; 0014 class QChar; 0015 0016 namespace Kasten { 0017 0018 /** 0019 * interface for the HTML export of columns 0020 */ 0021 class AbstractColumnHtmlRenderer 0022 { 0023 private: 0024 static inline constexpr int DefaultNoOfSublines = 1; 0025 0026 protected: 0027 static QString whiteSpace(unsigned int length); 0028 static QString emptyCells(unsigned int length, unsigned int codingWidth); 0029 static QString htmlEscaped(QChar c); 0030 0031 protected: 0032 AbstractColumnHtmlRenderer() = default; 0033 0034 public: 0035 AbstractColumnHtmlRenderer(const AbstractColumnHtmlRenderer&) = delete; 0036 virtual ~AbstractColumnHtmlRenderer(); 0037 0038 AbstractColumnHtmlRenderer& operator=(const AbstractColumnHtmlRenderer&) = delete; 0039 0040 public: // API to be implemented 0041 virtual void renderFirstLine(QTextStream* stream, int lineIndex) const = 0; 0042 virtual void renderNextLine(QTextStream* stream, bool isSubline = false) const = 0; 0043 /// default returns 1 0044 virtual int noOfSublinesNeeded() const; 0045 }; 0046 0047 } 0048 0049 #endif