File indexing completed on 2024-05-05 05:21:42
0001 /* 0002 This file is part of KDE. 0003 0004 SPDX-FileCopyrightText: 2009 Thomas McGuire <mcguire@kde.org> 0005 SPDX-FileCopyrightText: 2010 Stephen Kelly <steveire@gmail.com> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include "kpimtextedit_export.h" 0013 #include <qglobal.h> 0014 class QTextDocument; 0015 0016 namespace KPIMTextEdit 0017 { 0018 /** 0019 Utility class for methods working with rich text. 0020 0021 @since 4.5 0022 */ 0023 namespace TextUtils 0024 { 0025 /** 0026 * Returns whether the QTextDocument @p document contains rich text formatting. 0027 */ 0028 [[nodiscard]] KPIMTEXTEDIT_EXPORT bool containsFormatting(const QTextDocument *document); 0029 0030 /** 0031 * Changes the given text so that each line of it fits into the given maximal length. 0032 * At each line, the "indent" string is prepended, which is usually the quote prefix. 0033 * The text parameter will be empty afterwards. 0034 * @param text the text to indent 0035 * @param indent the indentation prefix string 0036 * @param maxLength the maximal length the string of text will fit into 0037 * Example: 0038 * text = "Hello World, this is a test." 0039 * indent = "> " 0040 * maxLength = 16 0041 * Result: "> Hello World,\n" 0042 * "> this is a test." 0043 */ 0044 [[nodiscard]] KPIMTEXTEDIT_EXPORT QString flowText(QString &text, const QString &indent, int maxLength); 0045 } 0046 }