krita/ui

kis_doc2.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (c) 1999-2000 Matthias Elter  <me@kde.org>
00003  *  Copyright (c) 2001 Toshitaka Fujioka  <fujioka@kde.org>
00004  *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
00005  *  Copyright (c) 2004-2007 Boudewijn Rempt <boud@valdyas.org<
00006  *  Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org>
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  */
00022 #ifndef KIS_DOC_2_H_
00023 #define KIS_DOC_2_H_
00024 
00025 #include <kis_debug.h>
00026 
00027 #include <KoDocument.h>
00028 
00029 #include "kis_types.h"
00030 
00031 #include <krita_export.h>
00032 
00033 class QString;
00034 
00035 class KoColorSpace;
00036 class KoColor;
00037 class KoShape;
00038 
00039 class KoShapeControllerBase;
00040 class KisView2;
00041 class KisChildDoc;
00042 class KisUndoAdapter;
00043 class KisNodeModel;
00058 class KRITAUI_EXPORT KisDoc2 : public KoDocument
00059 {
00060 
00061     Q_OBJECT
00062 
00063 public:
00064     KisDoc2(QWidget *parentWidget = 0, QObject* parent = 0, bool singleViewMode = true);
00065     virtual ~KisDoc2();
00066 
00067 public:
00068     // Overide KoDocument
00069     virtual bool wantExportConfirmation() const {
00070         return false;
00071     }
00072     virtual bool completeLoading(KoStore *store);
00073     virtual bool completeSaving(KoStore*);
00074 
00076     virtual bool loadOdf(KoOdfReadStore & odfStore);
00078     virtual bool saveOdf(SavingContext &documentContext);
00079 
00080     virtual QDomDocument saveXML();
00081     virtual bool loadXML(const KoXmlDocument& doc, KoStore* store);
00082 
00083     virtual QByteArray mimeType() const;
00084     virtual QList<KoDocument::CustomDocumentWidgetItem> createCustomDocumentWidgets(QWidget *parent);
00085 
00089     virtual void paintContent(QPainter& painter, const QRect& rect);
00090 
00091     void showStartUpWidget(KoMainWindow* parent, bool alwaysShow);
00092 
00094     virtual QPixmap generatePreview(const QSize& size);
00095 
00096     virtual void setUndo(bool undo);
00097     virtual bool undo() const;
00098 
00099 public slots:
00100 
00105     virtual void initEmpty();
00106 
00107     void showErrorAndDie();
00108 
00109 public:
00110 
00115     bool newImage(const QString& name, qint32 width, qint32 height, const KoColorSpace * cs, const KoColor &bgColor, const QString &imageDescription, const double imageResolution);
00116 
00121     KisImageWSP newImage(const QString& name, qint32 width, qint32 height, const KoColorSpace * colorspace);
00122 
00123     KisImageWSP image() const;
00124 
00128     void prepareForImport();
00129 
00133     void setCurrentImage(KisImageWSP image);
00134 
00135     KisUndoAdapter * undoAdapter() const;
00136 
00141     KoShapeControllerBase * shapeController() const;
00142 
00143     KoShape * shapeForNode(KisNodeSP layer) const;
00144 
00148     KoShape * addShape(const KisNodeSP node);
00149 
00154     KisNodeModel * nodeModel() const;
00155 
00156 signals:
00157 
00158     void sigLoadingFinished();
00159 
00160 public:
00161 
00162     // Overide KoDocument
00163     virtual KoView* createViewInstance(QWidget *parent);
00164 
00165 protected slots:
00166 
00167     void slotLoadingFinished();
00168 
00169     // Overide KoDocument
00170     virtual void openExistingFile(const KUrl& url);
00171     virtual void openTemplate(const KUrl& url);
00172 
00173 private slots:
00174 
00175     void undoIndexChanged(int idx);
00176 
00177 private:
00178 
00179     bool init();
00180 
00181 private:
00182 
00183     class KisDocPrivate;
00184     KisDocPrivate * const m_d;
00185 
00186 };
00187 
00188 #endif // KIS_DOC_H_