lib Library API Documentation

koPictureShared.h

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., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 #ifndef __koPictureShared_h__
00021 #define __koPictureShared_h__
00022 
00023 #include <qshared.h>
00024 #include <qstring.h>
00025 #include <qiodevice.h>
00026 #include <qpixmap.h>
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 QShared
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     QDragObject* dragObject( QWidget *dragSource = 0L, const char *name = 0L );
00099 
00100     bool load(QIODevice* io, const QString& extension);
00101     bool loadFromBase64( const QCString& str );
00102 
00107     bool save(QIODevice* io) const;
00108 
00112     bool saveAsKOffice1Dot1(QIODevice* io) const;
00113 
00118     bool saveAsBase64( KoXmlWriter& writer ) const;
00119 
00120     void setExtension(const QString& extension);
00121 
00122     QString getExtension(void) const;
00123 
00124     QString getExtensionAsKOffice1Dot1(void) const;
00125 
00126     QSize getOriginalSize(void) const;
00127 
00133     void clearAndSetMode(const QString& newMode);
00134 
00138     void clear(void);
00139 
00145     bool loadFromFile(const QString& fileName);
00146 
00150     bool loadXpm(QIODevice* io);
00151 
00158     QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
00159 
00164     bool isClipartAsKOffice1Dot1(void) const;
00165 
00166     QString getMimeType(void) const;
00167 
00175     QImage generateImage(const QSize& size);
00176 
00177     bool hasAlphaBuffer() const;
00178     void setAlphaBuffer(bool enable);
00179     QImage createAlphaMask(int conversion_flags = 0) const;
00180 
00187     void clearCache(void);
00188 
00189     QString uniquePictureId() const;
00190     void assignPictureId( uint _id);
00191 
00192 protected:
00198     bool loadWmf(QIODevice* io);
00199 
00204     bool loadTmp(QIODevice* io);
00205 
00207     bool identifyAndLoad( QByteArray data );
00208 
00219     bool loadCompressed( QIODevice* io, const QString& mimeType, const QString& extension );
00220 
00221 protected:
00222     KoPictureBase* m_base;
00223     QString m_extension;
00224     uint m_pictureId;
00225 };
00226 
00227 #endif /* __koPictureShared_h__ */
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:04 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003