Warning, file /office/calligra/libs/text/KoTextRangeManager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
0003  * Copyright (c) 2012 C. Boemann <cbo@boemann.dk>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Library General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Library General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 #ifndef KOTEXTRANGEMANAGER_H
0021 #define KOTEXTRANGEMANAGER_H
0022 
0023 #include "KoBookmarkManager.h"
0024 #include "KoAnnotationManager.h"
0025 #include "KoTextRange.h"
0026 #include "kotext_export.h"
0027 
0028 // Qt
0029 #include <QMetaType>
0030 #include <QHash>
0031 #include <QSet>
0032 
0033 
0034 /**
0035  * A container to register all the text ranges with.
0036  */
0037 class KOTEXT_EXPORT KoTextRangeManager : public QObject
0038 {
0039     Q_OBJECT
0040 public:
0041     /// Constructor
0042     explicit KoTextRangeManager(QObject *parent = 0);
0043     ~KoTextRangeManager() override;
0044 
0045     QList<KoTextRange *> textRanges() const;
0046 
0047     /**
0048      * Insert a new text range into the manager.
0049      * @param object the text range to be inserted.
0050      */
0051     void insert(KoTextRange *object);
0052 
0053     /**
0054      * Remove a text range from this manager.
0055      * @param range the text range to be removed
0056      */
0057     void remove(KoTextRange *range);
0058 
0059     /**
0060      * Return the bookmark manager.
0061      */
0062     const KoBookmarkManager *bookmarkManager() const;
0063 
0064     /**
0065      * Return the annotation manager.
0066      */
0067     const KoAnnotationManager *annotationManager() const;
0068 
0069     /**
0070      * Return a multi hash of KoTextRange that have start or end points between first and last
0071      * If the text range is a selection then the opposite end has to be within matchFirst and
0072      * matchLast.
0073      * Single position text ranges is only added once to the hash
0074      */
0075     QHash<int, KoTextRange *> textRangesChangingWithin(const QTextDocument *, int first, int last, int matchFirst, int matchLast) const;
0076 
0077 private:
0078     QSet<KoTextRange *> m_textRanges;
0079     QSet<KoTextRange *> m_deletedTextRanges; // kept around for undo purposes
0080 
0081     KoBookmarkManager m_bookmarkManager;
0082     KoAnnotationManager m_annotationManager;
0083 };
0084 
0085 Q_DECLARE_METATYPE(KoTextRangeManager *)
0086 #endif