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 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 QPainter;
00031 class QSize;
00032 
00033 class KURL;
00034 
00035 class KoPictureBase;
00036 
00043 class KoPictureShared : public QShared
00044 {
00045 public:
00049     KoPictureShared(void);
00050 
00054     ~KoPictureShared(void);
00055 
00061     KoPictureShared(const KoPictureShared &other);
00062 
00068     KoPictureShared& operator=(const KoPictureShared& other);
00069 
00070     KoPictureType::Type getType(void) const;
00071 
00075     bool isNull(void) const;
00076 
00090     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);
00091 
00097     QDragObject* dragObject( QWidget *dragSource = 0L, const char *name = 0L );
00098 
00099     bool load(QIODevice* io, const QString& extension);
00100 
00105     bool save(QIODevice* io);
00106 
00110     bool saveAsKOffice1Dot1(QIODevice* io);
00111 
00112     void setExtension(const QString& extension);
00113 
00114     QString getExtension(void) const;
00115 
00116     QString getExtensionAsKOffice1Dot1(void) const;
00117 
00118     QSize getOriginalSize(void) const;
00119 
00125     void clearAndSetMode(const QString& newMode);
00126 
00130     void clear(void);
00131 
00132     /*
00133      * Load a file
00134      *
00135      * @p fileName is the name of the file to load
00136      */
00137     bool loadFromFile(const QString& fileName);
00138 
00142     bool loadXpm(QIODevice* io);
00143 
00150     QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
00151 
00156     bool isClipartAsKOffice1Dot1(void) const;
00157 
00158     QString getMimeType(void) const;
00159 
00166     QImage generateImage(const QSize& size);
00167 
00168     bool hasAlphaBuffer() const;
00169     void setAlphaBuffer(bool enable);
00170     QImage createAlphaMask(int conversion_flags = 0) const;
00171 
00176     void clearCache(void);
00177 
00178 protected:
00183     bool loadWmf(QIODevice* io);
00184 
00189     bool loadTmp(QIODevice* io);
00190 
00191 protected:
00192     KoPictureBase* m_base;
00193     QString m_extension;
00194 };
00195 
00196 #endif /* __koPictureShared_h__ */
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:24 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003