Warning, file /office/calligra/libs/text/KoAnnotationManager.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) 2007 Fredy Yanardi <fyanardi@gmail.com>
0003  * Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se>
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 
0021 #ifndef KOANNOTATIONMANAGER_H
0022 #define KOANNOTATIONMANAGER_H
0023 
0024 #include "kotext_export.h"
0025 
0026 #include <QObject>
0027 #include <QList>
0028 
0029 class KoAnnotation;
0030 class KoAnnotationManagerPrivate;
0031 
0032 /**
0033  * A manager for all annotations in a document. Every annotation is identified by a unique name.
0034  * Note that only SinglePosition and StartAnnotation annotations can be retrieved from this
0035  * manager. An end annotation should be retrieved from it's parent (StartAnnotation) using
0036  * KoAnnotation::endAnnotation()
0037  * This class also maintains a list of annotation names so that it can be easily used to
0038  * show all available annotation.
0039  */
0040 class KOTEXT_EXPORT KoAnnotationManager : public QObject
0041 {
0042     Q_OBJECT
0043 public:
0044     /// constructor
0045     KoAnnotationManager();
0046     ~KoAnnotationManager() override;
0047 
0048     /// @return an annotation with the specified name, or 0 if there is none
0049     KoAnnotation *annotation(const QString &name) const;
0050 
0051     /// @return a list of QString containing all annotation names
0052     QList<QString> annotationNameList() const;
0053 
0054 public Q_SLOTS:
0055     /**
0056      * Insert a new annotation to this manager. The name of the annotation
0057      * will be set to @p name, no matter what name has been set on
0058      * it.
0059      * @param name the name of the annotation
0060      * @param annotation the annotation object to insert
0061      */
0062     void insert(const QString &name, KoAnnotation *annotation);
0063 
0064     /**
0065      * Remove an annotation from this manager.
0066      * @param name the name of the annotation to remove
0067      */
0068     void remove(const QString &name);
0069 
0070     /**
0071      * Rename an annotation
0072      * @param oldName the old name of the annotation
0073      * @param newName the new name of the annotation
0074      */
0075     void rename(const QString &oldName, const QString &newName);
0076 
0077 private:
0078     KoAnnotationManagerPrivate * const d;
0079 };
0080 
0081 #endif