00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _KO_SHAPE_FACTORY_
00022 #define _KO_SHAPE_FACTORY_
00023
00024 #include <QString>
00025 #include <QWidget>
00026 #include <QList>
00027
00028 #include <KoID.h>
00029
00030 #include <koffice_export.h>
00031
00032 class KoShape;
00033 class KoProperties;
00034 class KoShapeConfigFactory;
00035 class KoShapeConfigWidgetBase;
00036
00037
00043 struct FLAKE_EXPORT KoShapeTemplate {
00044 KoShapeTemplate() {
00045 id="";
00046 name="";
00047 toolTip="";
00048 icon="";
00049 }
00050 QString id;
00051 QString name;
00052 QString toolTip;
00053 QString icon;
00054
00058 KoProperties *properties;
00059 };
00060
00082 class FLAKE_EXPORT KoShapeFactory : public QObject {
00083 Q_OBJECT
00084 public:
00085
00093 KoShapeFactory(QObject *parent, const QString &id, const QString &name);
00094 virtual ~KoShapeFactory() {}
00095
00104 virtual KoShape * createDefaultShape() = 0;
00112 virtual KoShape * createShape(const KoProperties * params) const = 0;
00120 virtual QList<KoShapeConfigWidgetBase*> createShapeOptionPanels() {
00121 return QList<KoShapeConfigWidgetBase*>();
00122 }
00123
00138 void setOptionPanels(QList<KoShapeConfigFactory*> &panelFactories);
00139
00144 const QList<KoShapeConfigFactory*> &panelFactories();
00145
00149 const KoID id() const;
00154 const QString & shapeId() const;
00159 const QList<KoShapeTemplate> templates() const { return m_templates; }
00164 const QString & toolTip() const;
00169 const QString & icon() const;
00174 const QString & name() const;
00175
00176 protected:
00177
00183 void addTemplate(KoShapeTemplate params);
00188 void setToolTip(const QString & tooltip);
00194 void setIcon(const QString & iconName);
00195
00196 private:
00197
00198 QList<KoShapeTemplate> m_templates;
00199 QList<KoShapeConfigFactory*> m_configPanels;
00200 const QString m_id, m_name;
00201 QString m_tooltip;
00202 QString m_iconName;
00203 };
00204
00205 #endif // _KO_SHAPE_FACTORY_