//**************************************************************************** //! \file wcommentui.hpp //! \date 30-10-2004 //! \class WCommentObject //! \brief A comment within the text //! \class WCommentUI //! \brief The comment user interface //**************************************************************************** // This file is part of Weird Reader. // // The Weird Reader is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // The Weird Reader is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Weird Reader; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //**************************************************************************** #ifndef WCOMMENTUI_HPP #define WCOMMENTUI_HPP #include #include #include #include #include "wtexter.hpp" class WTextHandler; //*************************************************************************** class WCommentObject //! a comment object to be used by WTextHandler //*************************************************************************** { protected: enum WCOSpecies { WCO_Comment, WCO_Remark, WCO_Reference};//!< an enum to describe the species of the given comment QString text;//!< the text of the comment int pos;//!< the position of the comment in the text WCOSpecies spec;//!< the species of this comment public: //! \brief constructs an empty comment WCommentObject() {}; //! \brief constructs a comment with the given parameters //! \param comment the text of the given comment //! \param position the position of the comment in the text (default = -1 means no position associated) //! \param species the species of the comment (default = WCO_Comment) WCommentObject( const QString comment, const int position = -1, const WCOSpecies species = WCO_Comment) : text( comment), pos( position), spec( species) {}; //! \brief copy constructor //! \param copy the commment to be copied WCommentObject( const WCommentObject ©) : text( copy.text), pos( copy.pos), spec( copy.spec) {}; //! \brief destructor ~WCommentObject() {}; //! \brief returns the text of the Comment QString getText() const { return text; } //! \brief sets the text of the comment //! \param text the new text void setText( const QString &comment) { text = comment; } //! \brief returns the position of the Comment int getPos() const { return pos; } //! \brief sets the position of the comment //! \param position the new position void setPos( const int &position) { pos = position; } //! \brief returns the species of the Comment int getSpecies() const { return spec; } //! \brief sets the Species of the comment //! \param species the new species void setSpecies( const WCOSpecies &species) { spec = species; } //! \brief comparison operator to enable sorting //! \param rhs the right hand side of the operator bool operator< ( const WCommentObject &rhs) const { return pos::iterator cit;//!< the iterator of the comments container public slots: //! \brief open the comment insertion dialog void insertComment( int para, int); //! \brief open the comment deletion dialog void deleteComment(); //! \brief open the comment browser void browseComment(); public: //! \brief the constructor //! \param texter pointer to the texthandler WCommentUI( WTextHandler *texter, QObject * parent = 0, const char * name = 0) : QObject( parent, name), tH( texter) {}; //! \brief the destructor ~WCommentUI() {}; }; #endif