Warning, file /office/calligra/libs/text/KoAnnotation.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-2008 Fredy Yanardi <fyanardi@gmail.com> 0003 * Copyright (C) 2011 Boudewijn Rempt <boud@kogmbh.com> 0004 * Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this library; see the file COPYING.LIB. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KOANNOTATION_H 0023 #define KOANNOTATION_H 0024 0025 #include "KoTextRange.h" 0026 #include "kotext_export.h" 0027 0028 class KoShape; 0029 class KoAnnotationManager; 0030 0031 /** 0032 * An annotation is a note made by the user regarding a part of the 0033 * text. The annotation refers to either a position or a range of 0034 * text. The annotation location will be automatically updated if user 0035 * alters the text in the document. 0036 0037 * An annotation is identified by it's name, and all annotations are 0038 * managed by KoAnnotationManager. An annotation can be retrieved from 0039 * the annotation manager by using name as identifier. 0040 * 0041 * @see KoAnnotationManager 0042 */ 0043 class KOTEXT_EXPORT KoAnnotation : public KoTextRange 0044 { 0045 Q_OBJECT 0046 public: 0047 /** 0048 * Constructor. 0049 * 0050 * By default an annotation has the SinglePosition type and an empty name. 0051 * The name is set when the annotation is inserted into the annotation manager. 0052 * 0053 * @param document the text document where this annotation is located 0054 */ 0055 explicit KoAnnotation(const QTextCursor &); 0056 0057 ~KoAnnotation() override; 0058 0059 /// reimplemented from super 0060 void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const override; 0061 0062 /** 0063 * Set the new name for this annotation 0064 * @param name the new name of the annotation 0065 */ 0066 void setName(const QString &name); 0067 0068 /// @return the name of this annotation 0069 QString name() const; 0070 0071 0072 bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override; 0073 0074 /** 0075 * This is called to allow Cut and Paste of annotations. This 0076 * method gives a correct, unique, name 0077 */ 0078 static QString createUniqueAnnotationName(const KoAnnotationManager* kam, 0079 const QString &annotationName, bool isEndMarker); 0080 0081 void setAnnotationShape(KoShape *shape); 0082 0083 KoShape *annotationShape() const; 0084 0085 private: 0086 0087 class Private; 0088 Private *const d; 0089 }; 0090 0091 #endif 0092