kviewshell
bookmark.h
Go to the documentation of this file.00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * Copyright (C) 2005 by Stefan Kebekus * 00004 * kebekus@kde.org * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 * This program is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this program; if not, write to the * 00018 * Free Software Foundation, Inc., * 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00020 ***************************************************************************/ 00021 00022 #ifndef _bookmarks_h_ 00023 #define _bookmarks_h_ 00024 00025 #include "anchor.h" 00026 00027 #include <qptrlist.h> 00028 #include <qstring.h> 00029 00030 00042 class Bookmark { 00043 public: 00049 Bookmark() {subordinateBookmarks.setAutoDelete(true);} 00050 00057 Bookmark(const QString &text, const Anchor &pos) { 00058 Bookmark(); 00059 bookmarkText = text; 00060 position = pos; 00061 } 00062 00073 Bookmark(const QString& text, const PageNumber& page, const Length& distance_from_top) { 00074 Bookmark(); 00075 bookmarkText = text; 00076 position.page = page; 00077 position.distance_from_top = distance_from_top; 00078 } 00079 00082 QString bookmarkText; 00083 00085 Anchor position; 00086 00098 QPtrList<Bookmark> subordinateBookmarks; 00099 00100 // Returns true if the bookmark is valid, false otherwise. A 00101 // bookmark is valid if the text is not empty and the anchor is 00102 // valid. 00103 bool isValid() const {return (!bookmarkText.isEmpty()) && position.isValid();} 00104 }; 00105 00106 00107 #endif