1/*
2 This file is part of KDE.
3
4 Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
5 Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>
6
7 This library is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Library General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11
12 This library is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to the
19 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 02110-1301, USA.
21*/
22
23#ifndef KPIMTEXTEDIT_TEXTUTILS_H
24#define KPIMTEXTEDIT_TEXTUTILS_H
25
26#include "kpimtextedit_export.h"
27#include <qglobal.h>
28
29class QTextDocument;
30
31namespace KPIMTextEdit {
32
33/**
34 Utility class for methods working with rich text.
35
36 @since 4.5
37*/
38namespace TextUtils {
39
40 /**
41 * Returns whether the QTextDocument @p document contains rich text formatting.
42 */
43 KPIMTEXTEDIT_EXPORT bool containsFormatting( const QTextDocument *document );
44
45 /**
46 * Changes the given text so that each line of it fits into the given maximal length.
47 * At each line, the "indent" string is prepended, which is usually the quote prefix.
48 * The text parameter will be empty afterwards.
49 * @param text the text to indent
50 * @param indent the indentation prefix string
51 * @param maxLength the maximal length the string of text will fit into
52 * Example:
53 * text = "Hello World, this is a test."
54 * indent = "> "
55 * maxLength = 16
56 * Result: "> Hello World,\n"
57 * "> this is a test."
58 */
59 KPIMTEXTEDIT_EXPORT QString flowText( QString &text, const QString &indent, int maxLength );
60
61}
62
63}
64
65#endif
66