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

« back to all changes in this revision

Viewing changes to kexi/widget/propertyeditor/kexipropertyeditoritem.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
/* This file is part of the KDE project
 
2
   Copyright (C) 2002   Lucijan Busch <lucijan@gmx.at>
 
3
   Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
 
4
   Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
 
5
 
 
6
   This program is free software; you can redistribute it and/or
 
7
   modify it under the terms of the GNU Library General Public
 
8
   License as published by the Free Software Foundation; either
 
9
   version 2 of the License, or (at your option) any later version.
 
10
 
 
11
   This program is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
   Library General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU Library General Public License
 
17
   along with this program; see the file COPYING.  If not, write to
 
18
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
   Boston, MA 02111-1307, USA.
 
20
*/
 
21
 
 
22
#ifndef KEXIPROPERTYEDITORITEM_H
 
23
#define KEXIPROPERTYEDITORITEM_H
 
24
 
 
25
#include <klistview.h>
 
26
#include <qptrlist.h>
 
27
#include <qdict.h>
 
28
 
 
29
#include "kexiproperty.h"
 
30
 
 
31
#define KexiPropertyEditorItem_BranchBoxSize 9
 
32
 
 
33
/** This class is a subclass of KListViewItem which is associated to a property.
 
34
    It also takes care of drawing custom contents.
 
35
 **/
 
36
 //! An item in KexiPropertyEditorItem associated to a property
 
37
class KEXIPROPERTYEDITOR_EXPORT KexiPropertyEditorItem : public KListViewItem
 
38
{
 
39
        public:
 
40
                typedef QAsciiDict<KexiPropertyEditorItem> Dict;
 
41
 
 
42
                /*! Creates a KexiPropertyEditorItem child of \a parent, associated to \a property.
 
43
                 Within property editor, items are created in KexiPropertyEditor::fill(), 
 
44
                 every time the buffer is updated.
 
45
                 It \a property has not desctiption set, its name (i.e. not i18n'ed) is reused.
 
46
                */
 
47
                KexiPropertyEditorItem(KexiPropertyEditorItem *parent, KexiProperty *property, 
 
48
                        KexiPropertyEditorItem *after);
 
49
 
 
50
                //! Creates KexiPropertyEditor Top Item which is necessary for drawing all branches.
 
51
                KexiPropertyEditorItem(KListView *parent, const QString &text);
 
52
 
 
53
                ~KexiPropertyEditorItem();
 
54
 
 
55
                //! \return item's name (ie property's name)
 
56
                const QCString  name() { return m_property->name(); }
 
57
                //! \return item's QVariant::Type (ie property's QVariant::Type)
 
58
                QVariant::Type  type() { return m_property->type(); }
 
59
//              //! \return item's current value
 
60
//              QVariant        value() { return m_value; }
 
61
//              //! \return item's old value (ie property's old value)
 
62
//              QVariant        oldValue() { return m_oldvalue; }
 
63
                //! \return a pointer to the property associated to this item.
 
64
                KexiProperty*   property() { return m_property;}
 
65
 
 
66
//              //! Sets item value to \a value.
 
67
//              void            setValue(QVariant value);
 
68
                /*! \return the composed item value.
 
69
                    This function is used by property editor to update composed items, ie items with child items.
 
70
                    It updates parent item when one of its child changes.
 
71
                */ 
 
72
//              QVariant        getComposedValue();
 
73
                /*! Updates the value of child items, when the value of the parent was changed
 
74
                    with setValue(). Used by PropertyEditor.
 
75
                */
 
76
                void updateChildrenValue();
 
77
 
 
78
                //! \return true if the item has been modified.
 
79
//              bool            modified() { return !(m_value==m_oldvalue);}
 
80
 
 
81
                /*! Updates text on of this item, for current property value. 
 
82
                 If \a alsoParent is true, parent item (if present) is also updated. */
 
83
                virtual void updateValue(bool alsoParent = true);
 
84
 
 
85
/*              typedef enum ItemsOrder {
 
86
                        DefaultOrder = 2;
 
87
                };
 
88
*/
 
89
                //! Reimplemented for sorting
 
90
//              virtual QString key ( int column, bool ascending ) const;
 
91
                virtual int compare( QListViewItem *i, int col, bool ascending ) const;
 
92
 
 
93
                virtual void paintFocus ( QPainter * p, const QColorGroup & cg, const QRect & r );
 
94
 
 
95
        protected:
 
96
                /*! Reimplemented from KListViewItem to draw custom contents. Properties names are wriiten in bold if 
 
97
                    modified. Also takes care of drawing borders around the cells as well as pixmaps or colors if necessary.
 
98
                */
 
99
                virtual void paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int align);
 
100
 
 
101
                /*! Reimplemented from KListViewItem to draw custom contents. It takes care of drawing the [+] and [-]
 
102
                    signs only if the item has children.
 
103
                */
 
104
                virtual void paintBranches(QPainter *p, const QColorGroup &cg, int w, int y, int h);
 
105
 
 
106
                //! Reimplemented from KListViewItem to hide the top item.
 
107
                virtual void setup();
 
108
 
 
109
//              /*! Creates a child item based on property child named by \a name.
 
110
//               \return the newly created child item or 0 if there is not such property child. */
 
111
//              KexiPropertyEditorItem* createChildItem(const QString& name);
 
112
 
 
113
        private:
 
114
//              QVariant        m_value;
 
115
//              QVariant        m_oldvalue;
 
116
                KexiProperty    *m_property;
 
117
//              QPtrList<KexiProperty>  *m_childprop;
 
118
                Dict    *m_children;
 
119
 
 
120
                uint m_order;
 
121
};
 
122
 
 
123
#endif