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

0001 /* This file is part of the KDE project
0002    Copyright 2007 Montel Laurent <montel@kde.org>
0003    Copyright 2011 Silvio Heinrich <plassy@web.de>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License as published by the Free Software Foundation; either
0008    version 2 of the License, or (at your option) any later version.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019 */
0020 
0021 #ifndef PICTURE_TOOL
0022 #define PICTURE_TOOL
0023 
0024 #include <KoToolBase.h>
0025 #include <kjob.h>
0026 
0027 class PictureShape;
0028 struct PictureToolUI;
0029 
0030 class PictureTool : public KoToolBase
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit PictureTool(KoCanvasBase* canvas);
0035 
0036     /// reimplemented from KoToolBase
0037     void paint(QPainter&, const KoViewConverter&) override {}
0038     /// reimplemented from KoToolBase
0039     void mousePressEvent(KoPointerEvent*) override;
0040     /// reimplemented from superclass
0041     void mouseDoubleClickEvent(KoPointerEvent *event) override;
0042     /// reimplemented from KoToolBase
0043     void mouseMoveEvent(KoPointerEvent*) override {}
0044     /// reimplemented from KoToolBase
0045     void mouseReleaseEvent(KoPointerEvent*) override {}
0046 
0047     /// reimplemented from KoToolBase
0048     void activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes) override;
0049     /// reimplemented from KoToolBase
0050     void deactivate() override;
0051 
0052 protected:
0053     /// reimplemented from KoToolBase
0054     QWidget *createOptionWidget() override;
0055 
0056 private Q_SLOTS:
0057     void colorModeChanged(int cmbBoxIndex);
0058     void changeUrlPressed();
0059     void cropRegionChanged(const QRectF& rect, bool undoPrev);
0060     void cropEditFieldsChanged();
0061     void aspectCheckBoxChanged(bool checked);
0062     void contourCheckBoxChanged(bool checked);
0063     void fillButtonPressed();
0064     void updateControlElements();
0065     void setImageData(KJob *job);
0066 
0067 private:
0068     PictureShape *m_pictureshape;
0069     PictureToolUI *m_pictureToolUI;
0070 };
0071 
0072 #endif