00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KPROPERTY_SET_H
00023 #define KPROPERTY_SET_H
00024
00025 #include "koproperty_global.h"
00026 #include <QObject>
00027 #include <q3asciidict.h>
00028 #include <QByteArray>
00029 #include <QStringList>
00030 #include <QMap>
00031
00032 namespace KoProperty {
00033
00034 class Property;
00035 class SetPrivate;
00036
00043 class KOPROPERTY_EXPORT Set : public QObject
00044 {
00045 Q_OBJECT
00046
00047 public:
00054 class KOPROPERTY_EXPORT Iterator {
00055 public:
00056 Iterator(const Set &set);
00057 ~Iterator();
00058
00059 void operator ++();
00060 Property* operator *() const;
00061
00062 QByteArray currentKey() const;
00063 Property* current() const;
00064
00065 private:
00066 Q3AsciiDictIterator<Property> *iterator;
00067 friend class Set;
00068 };
00069
00070 explicit Set(QObject *parent=0, const QString &typeName=QString::null);
00071
00074 explicit Set(const Set& set);
00075
00076 virtual ~Set();
00077
00080 void addProperty(Property *property, QByteArray group = "common");
00081
00083 void removeProperty(Property *property);
00084
00087 void removeProperty(const QByteArray &name);
00088
00090 virtual void clear();
00091
00093 uint count() const;
00094
00096 bool isEmpty() const;
00097
00105 bool isReadOnly() const;
00106
00109 void setReadOnly(bool readOnly);
00110
00112 bool contains(const QByteArray &name) const;
00113
00116 Property& property( const QByteArray &name) const;
00117
00132 Property& operator[](const QByteArray &name) const;
00133
00135 const Set& operator= (const Set &set);
00136
00139 void changeProperty(const QByteArray &property, const QVariant &value);
00140
00143 void setGroupDescription(const QByteArray &group, const QString desc);
00144
00148 QString groupDescription(const QByteArray &group) const;
00149
00151 void setGroupIcon(const QByteArray &group, const QString& icon);
00152
00154 QString groupIcon(const QByteArray &group) const;
00155
00158 const QList<QByteArray>& groupNames() const;
00159
00162 const QList<QByteArray>& propertyNamesForGroup(const QByteArray &group) const;
00163
00166 QByteArray prevSelection() const;
00167
00168 void setPrevSelection(const QByteArray& prevSelection);
00169
00176 QString typeName() const;
00177
00179 void debug();
00180
00181 protected:
00183 Set(bool propertyOwner);
00184
00186 void addToGroup(const QByteArray &group, Property *property);
00187
00189 void removeFromGroup(Property *property);
00190
00195 void addPropertyInternal(Property *property, QByteArray group, bool updateSortingKey);
00196
00199 void informAboutClearing(bool& cleared);
00200
00201 signals:
00203 void propertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00204
00207 void propertyChangedInternal(KoProperty::Set& set, KoProperty::Property& property);
00208
00210 void propertyReset(KoProperty::Set& set, KoProperty::Property& property);
00211
00213 void aboutToDeleteProperty(KoProperty::Set& set, KoProperty::Property& property);
00214
00217 void aboutToBeCleared();
00218
00220 void aboutToBeDeleted();
00221
00222 protected:
00223 SetPrivate *d;
00224
00225 friend class Iterator;
00226 friend class Property;
00227 friend class Buffer;
00228 };
00229
00236 class KOPROPERTY_EXPORT Buffer : public Set
00237 {
00238 Q_OBJECT
00239
00240 public:
00241 Buffer();
00242 Buffer(const Set *set);
00243
00245 virtual void intersect(const Set *set);
00246
00247 protected slots:
00248 void intersectedChanged(KoProperty::Set& set, KoProperty::Property& prop);
00249 void intersectedReset(KoProperty::Set& set, KoProperty::Property& prop);
00250
00251 private:
00252 void initialSet(const Set *set);
00253 };
00254
00255 }
00256
00257 #endif