F:/KPlato/koffice/libs/kofficecore/KoPictureShared.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 __koPictureShared_h__
00021 #define __koPictureShared_h__
00022 
00023 #include <q3shared.h>
00024 #include <QString>
00025 #include <QIODevice>
00026 #include <QPixmap>
00027 
00028 #include "KoPictureKey.h"
00029 
00030 class KoXmlWriter;
00031 class QPainter;
00032 class QSize;
00033 
00034 class KUrl;
00035 
00036 class KoPictureBase;
00037 
00044 class KoPictureShared : public Q3Shared
00045 {
00046 public:
00050     KoPictureShared(void);
00051 
00055     ~KoPictureShared(void);
00056 
00062     KoPictureShared(const KoPictureShared &other);
00063 
00069     KoPictureShared& operator=(const KoPictureShared& other);
00070 
00071     KoPictureType::Type getType(void) const;
00072 
00076     bool isNull(void) const;
00077 
00091     void draw(QPainter& painter, int x, int y, int width, int height, int sx = 0, int sy = 0, int sw = -1, int sh = -1, bool fastMode = false);
00092 
00098     Q3DragObject* dragObject( QWidget *dragSource = 0L, const char *name = 0L );
00099 
00100     bool load(QIODevice* io, const QString& extension);
00101     bool loadFromBase64( const QByteArray& str );
00102 
00107     bool save(QIODevice* io) const;
00108 
00113     bool saveAsBase64( KoXmlWriter& writer ) const;
00114 
00115     void setExtension(const QString& extension);
00116 
00117     QString getExtension(void) const;
00118 
00119     QSize getOriginalSize(void) const;
00120 
00126     void clearAndSetMode(const QString& newMode);
00127 
00131     void clear(void);
00132 
00138     bool loadFromFile(const QString& fileName);
00139 
00143     bool loadXpm(QIODevice* io);
00144 
00151     QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
00152 
00153     QString getMimeType(void) const;
00154 
00162     QImage generateImage(const QSize& size);
00163 
00164     bool hasAlphaBuffer() const;
00165     void setAlphaBuffer(bool enable);
00166     QImage createAlphaMask(Qt::ImageConversionFlags flags = Qt::AutoColor) const;
00167 
00174     void clearCache(void);
00175 
00176     QString uniquePictureId() const;
00177     void assignPictureId( uint _id);
00178 
00179 protected:
00185     bool loadWmf(QIODevice* io);
00186 
00191     bool loadTmp(QIODevice* io);
00192 
00194     bool identifyAndLoad( QByteArray data );
00195 
00206     bool loadCompressed( QIODevice* io, const QString& mimeType, const QString& extension );
00207 
00208 protected:
00209     KoPictureBase* m_base;
00210     QString m_extension;
00211     uint m_pictureId;
00212 };
00213 
00214 #endif /* __koPictureShared_h__ */

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