~ubuntu-branches/ubuntu/breezy/koffice/breezy-security

« back to all changes in this revision

Viewing changes to lib/kofficecore/koPicture.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-10-11 14:49:50 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051011144950-lwpngbifzp8nk0ds
Tags: 1:1.4.1-0ubuntu7
* SECURITY UPDATE: fix heap based buffer overflow in the RTF importer of KWord
* Opening specially crafted RTF files in KWord can cause
  execution of abitrary code.
* Add kubuntu_01_rtfimport_heap_overflow.diff
* References:
  CAN-2005-2971
  CESA-2005-005
  http://www.koffice.org/security/advisory-20051011-1.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
2
   Copyright (c) 2001 Simon Hausmann <hausmann@kde.org>
3
 
   Copyright (C) 2002, 2003 Nicolas GOUTTE <goutte@kde.org>
 
3
   Copyright (C) 2002, 2003, 2004 Nicolas GOUTTE <goutte@kde.org>
4
4
 
5
5
   This library is free software; you can redistribute it and/or
6
6
   modify it under the terms of the GNU Library General Public
23
23
#include <qstring.h>
24
24
#include <qiodevice.h>
25
25
#include <qpixmap.h>
 
26
#include <koffice_export.h>
26
27
 
27
28
#include "koPictureKey.h"
28
29
 
 
30
class KoXmlWriter;
29
31
class QPainter;
30
32
class QSize;
31
33
class QDragObject;
34
36
class KoPictureShared;
35
37
 
36
38
/**
37
 
 * KoPicture is a container class for various types of images supported by KOffice.
 
39
 * KoPicture is a container class for various types of pictures supported by %KOffice.
38
40
 *
39
 
 * @short An image container class
 
41
 * @short A picture container class
40
42
 */
41
 
class KoPicture
 
43
class KOFFICECORE_EXPORT KoPicture
42
44
{
43
45
public:
44
46
    /**
79
81
    bool isNull(void) const;
80
82
 
81
83
    /**
82
 
     * Draw the picture in a painter.
 
84
     * @brief Draw the picture in a painter.
83
85
     *
84
86
     * The parameter @p fastMode allows the picture to be re-sized and drawn quicker if possible
85
87
     *
105
107
    bool load(QIODevice* io, const QString& extension);
106
108
 
107
109
    /**
108
 
     * save file
 
110
     * Save picture into a QIODevice
109
111
     * @param io QIODevice used for saving
110
112
     */
111
 
    bool save(QIODevice* io);
112
 
 
113
 
    /**
114
 
     *  Save picture in the format supported by KOffice 1.1
115
 
     */
116
 
    bool saveAsKOffice1Dot1(QIODevice* io);
 
113
    bool save(QIODevice* io) const;
 
114
 
 
115
    /**
 
116
     * Save picture in the format supported by KOffice 1.1
 
117
     */
 
118
    bool saveAsKOffice1Dot1(QIODevice* io) const;
 
119
 
 
120
    /**
 
121
     * OASIS FlatXML support:
 
122
     * Save picture as base64-encoded data into an XML writer.
 
123
     * The caller will usually do something like
 
124
     * @code
 
125
     *  writer.startElement( "office:binary-data" );
 
126
     *  m_picture.saveAsBase64( writer );
 
127
     *  writer.endElement();
 
128
     * @endcode
 
129
     */
 
130
    bool saveAsBase64( KoXmlWriter& writer ) const;
117
131
 
118
132
    /**
119
133
     * @return the image extension (e.g. png)
150
164
    bool loadFromFile(const QString& fileName);
151
165
 
152
166
    /**
 
167
     * Load the picture from base64-encoded data
 
168
     */
 
169
    bool loadFromBase64(const QCString& str);
 
170
 
 
171
    /**
153
172
     * Load a potentially broken XPM file (for old files of KPresenter)
154
173
     */
155
174
    bool loadXpm(QIODevice* io);
156
175
 
157
176
    /**
158
 
     * @deprecated
 
177
     * @deprecated To be replaced by @ref KoPicture::draw
 
178
     *
159
179
     * Returns a QPixmap from an image
160
180
     * Returns an empty QPixmap if the KoPicture is not an image.
161
 
     *
162
 
     * To be replaced by @ref KoPicture::draw
163
181
     */
164
182
    QPixmap generatePixmap(const QSize& size, bool smoothScale = false);
165
183
 
166
184
    /**
167
185
     * Helper function for saving
 
186
     *
168
187
     * @return true if it is a clipart in KOffice 1.1, false if not
169
188
     */
170
189
    bool isClipartAsKOffice1Dot1(void) const;
171
190
 
172
191
    /**
173
192
     * Download and set the key for a possibly remote file.
 
193
     *
 
194
     * @param url the url to download from
 
195
     * @param window the parent widget for the download. You can pass
 
196
     *               NULL (0) if you absolutely cannot find a parent
 
197
     *               widget to use.
174
198
     */
175
 
    bool setKeyAndDownloadPicture(const KURL& url);
 
199
    bool setKeyAndDownloadPicture(const KURL& url, QWidget *window);
176
200
 
177
201
    /**
178
202
     * Generate a QImage
201
225
    QImage createAlphaMask(int conversion_flags = 0) const;
202
226
 
203
227
    /**
204
 
     * Clear any cache (to avoid using too much memory
205
 
     * especially if the application somehow also caches the KoPicture's output)
 
228
     * @brief Clear any cache
 
229
     *
 
230
     * This is used to avoid using too much memory
 
231
     * especially if the application somehow also caches the KoPicture's output
206
232
     */
207
233
    void clearCache(void);
208
234
 
 
235
    QString uniquePictureId() const;
 
236
    void assignPictureId( uint _id);
 
237
 
209
238
protected:
210
239
    /**
211
240
     * @internal
222
251
     * Creare the shared data if needed
223
252
     */
224
253
    void createSharedData(void);
 
254
    QString uniqueName() const;
225
255
 
226
256
protected:
227
257
    /**
234
264
     * The shared data
235
265
     */
236
266
    KoPictureShared* m_sharedData;
 
267
    static uint uniqueValue;
 
268
    
 
269
    QString m_uniqueName;
237
270
};
238
271
 
239
272
#endif /* __koPicture_h__ */