File indexing completed on 2024-05-12 16:30:49
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2001-2002 Lennart Kudling <kudling@kde.org> 0003 * Copyright (C) 2001-2005,2007 Rob Buis <buis@kde.org> 0004 * Copyright (C) 2002-2003,2005 Tomislav Lukman <tomislav.lukman@ck.t-com.hr> 0005 * Copyright (C) 2002,2005 Laurent Montel <montel@kde.org> 0006 * Copyright (C) 2002,2005,2007 David Faure <faure@kde.org> 0007 * Copyright (C) 2002 Benoit Vautrin <benoit.vautrin@free.fr> 0008 * Copyright (C) 2005-2006 Peter Simonsson <psn@linux.se> 0009 * Copyright (C) 2005-2006 Tim Beaulen <tbscope@gmail.com> 0010 * Copyright (C) 2005-2006 Thomas Zander <zander@kde.org> 0011 * Copyright (C) 2005-2007 Jan Hambrecht <jaham@gmx.net> 0012 * Copyright (C) 2005-2006 Inge Wallin <inge@lysator.liu.se> 0013 * Copyright (C) 2005-2006 C. Boemann <cbo@boemann.dk> 0014 * Copyright (C) 2005-2006 Sven Langkamp <sven.langkamp@gmail.com> 0015 * Copyright (C) 2006 Martin Ellis <martin.ellis@kdemail.net> 0016 * Copyright (C) 2006 Boudewijn Rempt <boud@valdyas.org> 0017 * 0018 * This library is free software; you can redistribute it and/or 0019 * modify it under the terms of the GNU Library General Public 0020 * License as published by the Free Software Foundation; either 0021 * version 2 of the License, or (at your option) any later version. 0022 * 0023 * This library is distributed in the hope that it will be useful, 0024 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0026 * Library General Public License for more details. 0027 * 0028 * You should have received a copy of the GNU Library General Public License 0029 * along with this library; see the file COPYING.LIB. If not, write to 0030 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0031 * Boston, MA 02110-1301, USA. 0032 */ 0033 0034 #ifndef __KARBON_VIEW__ 0035 #define __KARBON_VIEW__ 0036 0037 #include <KoPAView.h> 0038 #include <KoShapeAlignCommand.h> 0039 #include <KoShapeDistributeCommand.h> 0040 #include <karbonui_export.h> 0041 #include "KarbonBooleanCommand.h" 0042 0043 class QDropEvent; 0044 class QResizeEvent; 0045 class QLayout; 0046 0047 class KarbonDocument; 0048 0049 class KoColor; 0050 class KoUnit; 0051 0052 0053 class KarbonPaletteBarWidget; 0054 class KarbonPart; 0055 0056 class KoPACanvas; 0057 class KoCanvasResourceManager; 0058 0059 class KARBONUI_EXPORT KarbonView : public KoPAView 0060 { 0061 Q_OBJECT 0062 0063 public: 0064 KarbonView(KarbonPart *part, KarbonDocument* doc, QWidget* parent = 0); 0065 ~KarbonView() override; 0066 0067 /// Returns the view is attached to 0068 KarbonDocument * part() const; 0069 0070 /// Returns the canvas widget of this view 0071 KoPACanvas *canvasWidget() const; 0072 0073 void reorganizeGUI(); 0074 void setNumberOfRecentFiles(uint number); 0075 0076 /// Reimplemented from QWidget 0077 virtual void setCursor(const QCursor &); 0078 /// Reimplemented from QWidget 0079 void dropEvent(QDropEvent *e) override; 0080 0081 0082 KoCanvasResourceManager *resourceManager() const; 0083 0084 KarbonPaletteBarWidget *colorBar() const; 0085 0086 public Q_SLOTS: 0087 0088 void selectionDuplicate(); 0089 void selectionDistributeHorizontalCenter(); 0090 void selectionDistributeHorizontalGap(); 0091 void selectionDistributeHorizontalLeft(); 0092 void selectionDistributeHorizontalRight(); 0093 void selectionDistributeVerticalCenter(); 0094 void selectionDistributeVerticalGap(); 0095 void selectionDistributeVerticalBottom(); 0096 void selectionDistributeVerticalTop(); 0097 0098 void fileImportGraphic(); 0099 0100 void clipObjects(); 0101 void unclipObjects(); 0102 0103 void flipVertical(); 0104 void flipHorizontal(); 0105 0106 void closePath(); 0107 void combinePath(); 0108 void separatePath(); 0109 void reversePath(); 0110 0111 void intersectPaths(); 0112 void subtractPaths(); 0113 void unitePaths(); 0114 void excludePaths(); 0115 0116 void pathSnapToGrid(); 0117 0118 void selectionChanged() override; 0119 0120 void editGuides(); 0121 void showPalette(); 0122 0123 void replaceActivePage(KoPAPageBase *page, KoPAPageBase *newActivePage); 0124 0125 protected Q_SLOTS: 0126 // Object related operations. 0127 0128 // View 0129 void viewModeChanged(bool); 0130 void zoomSelection(); 0131 void zoomDrawing(); 0132 0133 void mousePositionChanged(const QPoint &position); 0134 0135 void applyFillToSelection(); 0136 void applyStrokeToSelection(); 0137 void applyPaletteColor(const KoColor &color); 0138 0139 protected: 0140 /// Use own configuaration dialog 0141 void openConfiguration() override; 0142 0143 void updateReadWrite(bool readwrite) override; 0144 void resizeEvent(QResizeEvent* event) override; 0145 void dragEnterEvent(QDragEnterEvent * event) override; 0146 0147 void createStrokeDock(); 0148 void createColorDock(); 0149 0150 private: 0151 void initActions(); 0152 void updateRuler(); 0153 0154 void selectionDistribute(KoShapeDistributeCommand::Distribute distribute); 0155 void booleanOperation(KarbonBooleanCommand::BooleanOperation operation); 0156 void selectionFlip(bool horizontally, bool vertically); 0157 0158 /// Returns a list of all selected path shapes 0159 QList<KoPathShape*> selectedPathShapes(); 0160 0161 class Private; 0162 Private * const d; 0163 }; 0164 0165 #endif // __KARBON_VIEW__ 0166