Warning, file /office/calligra/libs/text/KoBookmark.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 C. Boemann <cbo@boemann.dk>
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 KOBOOKMARK_H
0023 #define KOBOOKMARK_H
0024 
0025 #include "KoTextRange.h"
0026 #include "kotext_export.h"
0027 
0028 class KoBookmarkManager;
0029 
0030 /**
0031  * A document can store a set of cursor positions/selected cursor locations which can be
0032  * retrieved again later to go to those locations from any location in the document.
0033  * The bookmark location will be automatically updated if user alters the text in the document.
0034  * A bookmark is identified by it's name, and all bookmarks are managed by KoBookmarkManager. A
0035  * bookmark can be retrieved from the bookmark manager by using name as identifier.
0036  * @see KoBookmarkManager
0037  */
0038 class KOTEXT_EXPORT KoBookmark : public KoTextRange
0039 {
0040     Q_OBJECT
0041 public:
0042     /**
0043      * Constructor.
0044      *
0045      * By default a bookmark has the SinglePosition type and an empty name.
0046      * The name is set when the book is inserted into the bookmark manager.
0047      *
0048      * @param document the text document where this bookmark is located
0049      */
0050     explicit KoBookmark(const QTextCursor &);
0051 
0052     ~KoBookmark() override;
0053 
0054     /// reimplemented from super
0055     void saveOdf(KoShapeSavingContext &context, int position, TagType tagType) const override;
0056 
0057     /**
0058      * Set the new name for this bookmark
0059      * @param name the new name of the bookmark
0060      */
0061     void setName(const QString &name);
0062 
0063     /// @return the name of this bookmark
0064     QString name() const;
0065 
0066     bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context) override;
0067 
0068     /**
0069      * This is called to allow Cut and Paste of bookmarks. This
0070      * method gives a correct, unique, name
0071      */
0072     static QString createUniqueBookmarkName(const KoBookmarkManager* bmm, const QString &bookmarkName, bool isEndMarker);
0073 private:
0074 
0075     class Private;
0076     Private *const d;
0077 };
0078 
0079 #endif
0080