File indexing completed on 2024-05-12 16:34:58

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef REVIEWTOOL_H
0021 #define REVIEWTOOL_H
0022 
0023 class KoCanvasBase;
0024 class KoPointerEvent;
0025 class KoTextEditor;
0026 class KoTextShapeData;
0027 class KoViewConverter;
0028 class TextShape;
0029 
0030 class QAction;
0031 
0032 class QPainter;
0033 class QKeyEvent;
0034 template <class T> class QVector;
0035 /// This tool allows to manipulate the tracked changes of a document. You can accept or reject changes.
0036 
0037 #include <TextTool.h>
0038 
0039 class ReviewTool : public TextTool
0040 {
0041     Q_OBJECT
0042 public:
0043     explicit ReviewTool(KoCanvasBase *canvas);
0044     ~ReviewTool() override;
0045 
0046     void mouseReleaseEvent(KoPointerEvent* event) override;
0047     void mouseMoveEvent(KoPointerEvent* event) override;
0048     void mousePressEvent(KoPointerEvent* event) override;
0049     void paint(QPainter& painter, const KoViewConverter& converter) override;
0050     void keyPressEvent(QKeyEvent* event) override;
0051     void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
0052     void deactivate() override;
0053     void createActions() override;
0054 
0055     QList<QPointer<QWidget> > createOptionWidgets() override;
0056 
0057 public Q_SLOTS:
0058     void removeAnnotation();
0059 
0060 private:
0061 
0062     KoTextEditor *m_textEditor;
0063     KoTextShapeData *m_textShapeData;
0064     KoCanvasBase *m_canvas;
0065     TextShape *m_textShape;
0066     QAction *m_removeAnnotationAction;
0067     KoShape *m_currentAnnotationShape;
0068 };
0069 
0070 #endif // REVIEWTOOL_H