F:/KPlato/koffice/libs/kofficecore/KoPicture.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (c) 2001 Simon Hausmann <hausmann@kde.org>
00003    Copyright (C) 2002, 2003, 2004 Nicolas GOUTTE <goutte@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 #ifndef __koPicture_h__
00021 #define __koPicture_h__
00022 
00023 #include <QString>
00024 #include <QIODevice>
00025 #include <QPixmap>
00026 #include <koffice_export.h>
00027 
00028 #include "KoPictureKey.h"
00029 
00030 class KoXmlWriter;
00031 class QPainter;
00032 class QSize;
00033 class Q3DragObject;
00034 class KUrl;
00035 
00036 class KoPictureShared;
00037 
00043 class KOFFICECORE_EXPORT KoPicture
00044 {
00045 public:
00049     KoPicture(void);
00050 
00054     ~KoPicture(void);
00055 
00059     KoPicture(const KoPicture &other);
00060 
00064     KoPicture& operator=(const KoPicture& other);
00065 
00066     KoPictureType::Type getType(void) const;
00067 
00071     KoPictureKey getKey(void) const;
00072 
00076     void setKey(const KoPictureKey& key);
00077 
00081     bool isNull(void) const;
00082 
00097     void draw(QPainter& painter, int x, int y, int width, int height, int sx = 0, int sy = 0,
00098               int sw = -1, int sh = -1, bool fastMode = false);
00099 
00106     Q3DragObject* dragObject( QWidget *dragSource = 0L, const char *name = 0L );
00107 
00108     bool load(QIODevice* io, const QString& extension);
00109 
00114     bool save(QIODevice* io) const;
00115 
00126     bool saveAsBase64( KoXmlWriter& writer ) const;
00127 
00131     QString getExtension(void) const;
00132 
00136     QString getMimeType(void) const;
00137 
00141     QSize getOriginalSize(void) const;
00142 
00148     void clearAndSetMode(const QString& newMode);
00149 
00153     void clear(void);
00154 
00158     bool loadFromFile(const QString& fileName);
00159 
00163     bool loadFromBase64(const QByteArray& str);
00164 
00168     bool loadXpm(QIODevice* io);
00169 
00176     QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
00177 
00186     bool setKeyAndDownloadPicture(const KUrl& url, QWidget *window);
00187 
00194     QImage generateImage(const QSize& size);
00195 
00199     bool hasAlphaBuffer() const;
00200 
00204     void setAlphaBuffer(bool enable);
00205 
00212     QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
00213 
00220     void clearCache(void);
00221 
00222     QString uniquePictureId() const;
00223     void assignPictureId( uint _id);
00224 
00225 protected:
00230     void unlinkSharedData(void);
00235     void linkSharedData(void) const;
00240     void createSharedData(void);
00241     QString uniqueName() const;
00242 
00243 protected:
00248     KoPictureKey m_key;
00253     KoPictureShared* m_sharedData;
00254     static uint uniqueValue;
00255 
00256     QString m_uniqueName;
00257 };
00258 
00259 #endif /* __koPicture_h__ */

Généré le Wed Nov 22 23:41:03 2006 pour KPlato par  doxygen 1.5.1-p1