[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qaxfactory.h:1 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>qaxfactory.h Include File</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qaxfactory.h</h1>
|
---|
| 33 |
|
---|
| 34 | <p>This is the verbatim text of the qaxfactory.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
| 35 | <hr>
|
---|
| 36 | <pre>
|
---|
| 37 | /****************************************************************************
|
---|
| 38 | ** $Id: qaxfactory-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
| 39 | **
|
---|
| 40 | ** Declaration of the QAxFactory class
|
---|
| 41 | **
|
---|
| 42 | ** Copyright (C) 2001-2007 Trolltech ASA. All rights reserved.
|
---|
| 43 | **
|
---|
| 44 | ** This file is part of the Active Qt integration.
|
---|
| 45 | **
|
---|
| 46 | ** Licensees holding valid Qt Enterprise Edition
|
---|
| 47 | ** licenses for Windows may use this file in accordance with the Qt Commercial
|
---|
| 48 | ** License Agreement provided with the Software.
|
---|
| 49 | **
|
---|
| 50 | ** This file is not available for use under any other license without
|
---|
| 51 | ** express written permission from the copyright holder.
|
---|
| 52 | **
|
---|
| 53 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 54 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 55 | **
|
---|
| 56 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 57 | ** information about Qt Commercial License Agreements.
|
---|
| 58 | **
|
---|
| 59 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 60 | ** not clear to you.
|
---|
| 61 | **
|
---|
| 62 | **********************************************************************/
|
---|
| 63 |
|
---|
| 64 | #ifndef QAXFACTORY_H
|
---|
| 65 | #define QAXFACTORY_H
|
---|
| 66 |
|
---|
| 67 | #include <qdict.h>
|
---|
| 68 | #include <quuid.h>
|
---|
| 69 | #include <private/qcom_p.h>
|
---|
| 70 | #include <qmetaobject.h>
|
---|
| 71 |
|
---|
| 72 | // {22B230F6-8722-4051-ADCB-E7C9CE872EB3}
|
---|
| 73 | #ifndef IID_QAxFactory
|
---|
| 74 | #define IID_QAxFactory QUuid( 0x22b230f6, 0x8722, 0x4051, 0xad, 0xcb, 0xe7, 0xc9, 0xce, 0x87, 0x2e, 0xb3 )
|
---|
| 75 | #endif
|
---|
| 76 |
|
---|
| 77 | class QWidget;
|
---|
| 78 | class QMetaObject;
|
---|
| 79 | class QSettings;
|
---|
| 80 | struct IDispatch;
|
---|
| 81 |
|
---|
| 82 | struct QAxFactoryInterface : public QFeatureListInterface
|
---|
| 83 | {
|
---|
| 84 | public:
|
---|
| 85 | #ifndef Q_QDOC
|
---|
| 86 | virtual QWidget *create( const QString &key, QWidget *parent = 0, const char *name = 0 ) = 0;
|
---|
| 87 | virtual QObject *createObject( const QString &key, QObject *parent = 0, const char *name = 0 ) = 0;
|
---|
| 88 | virtual QMetaObject *metaObject( const QString &key ) const = 0;
|
---|
| 89 | virtual bool createObjectWrapper(QObject *object, IDispatch **wrapper) = 0;
|
---|
| 90 |
|
---|
| 91 | virtual QUuid classID( const QString &key ) const = 0;
|
---|
| 92 | virtual QUuid interfaceID( const QString &key ) const = 0;
|
---|
| 93 | virtual QUuid eventsID( const QString &key ) const = 0;
|
---|
| 94 | virtual QUuid typeLibID() const = 0;
|
---|
| 95 | virtual QUuid appID() const = 0;
|
---|
| 96 |
|
---|
| 97 | virtual void registerClass( const QString &key, QSettings * ) const = 0;
|
---|
| 98 | virtual void unregisterClass( const QString &key, QSettings * ) const = 0;
|
---|
| 99 |
|
---|
| 100 | virtual bool validateLicenseKey( const QString &key, const QString &licenseKey) const = 0;
|
---|
| 101 |
|
---|
| 102 | virtual QString exposeToSuperClass( const QString &key ) const = 0;
|
---|
| 103 | virtual bool stayTopLevel( const QString &key ) const = 0;
|
---|
| 104 | virtual bool hasStockEvents( const QString &key ) const = 0;
|
---|
| 105 | virtual bool isService() const = 0;
|
---|
| 106 | #endif
|
---|
| 107 | };
|
---|
| 108 |
|
---|
| 109 | extern QAxFactoryInterface *qAxFactory();
|
---|
| 110 |
|
---|
| 111 | class QAxFactory : public QAxFactoryInterface
|
---|
| 112 | {
|
---|
| 113 | public:
|
---|
| 114 | QAxFactory( const QUuid &, const QUuid &);
|
---|
| 115 | virtual ~QAxFactory();
|
---|
| 116 | Q_REFCOUNT;
|
---|
| 117 |
|
---|
| 118 | QRESULT queryInterface( const QUuid &iid, QUnknownInterface **iface );
|
---|
| 119 |
|
---|
| 120 | #ifdef Q_QDOC
|
---|
| 121 | virtual QStringList featureList() const = 0;
|
---|
| 122 | #endif
|
---|
| 123 | virtual QWidget *create( const QString &key, QWidget *parent = 0, const char *name = 0 );
|
---|
| 124 | virtual QObject *createObject( const QString &key, QObject *parent = 0, const char *name = 0 );
|
---|
| 125 | virtual QMetaObject *metaObject( const QString &key ) const;
|
---|
| 126 | virtual bool createObjectWrapper(QObject *object, IDispatch **wrapper);
|
---|
| 127 |
|
---|
| 128 | virtual QUuid classID( const QString &key ) const;
|
---|
| 129 | virtual QUuid interfaceID( const QString &key ) const;
|
---|
| 130 | virtual QUuid eventsID( const QString &key ) const;
|
---|
| 131 |
|
---|
| 132 | virtual QUuid typeLibID() const;
|
---|
| 133 | virtual QUuid appID() const;
|
---|
| 134 |
|
---|
| 135 | virtual void registerClass( const QString &key, QSettings * ) const;
|
---|
| 136 | virtual void unregisterClass( const QString &key, QSettings * ) const;
|
---|
| 137 |
|
---|
| 138 | virtual bool validateLicenseKey( const QString &key, const QString &licenseKey) const;
|
---|
| 139 |
|
---|
| 140 | virtual QString exposeToSuperClass( const QString &key ) const;
|
---|
| 141 | virtual bool stayTopLevel( const QString &key ) const;
|
---|
| 142 | virtual bool hasStockEvents( const QString &key ) const;
|
---|
| 143 | virtual bool isService() const;
|
---|
| 144 |
|
---|
| 145 | enum ServerType {
|
---|
| 146 | SingleInstance,
|
---|
| 147 | MultipleInstances
|
---|
| 148 | };
|
---|
| 149 |
|
---|
| 150 | static bool isServer();
|
---|
| 151 | static QString serverDirPath();
|
---|
| 152 | static QString serverFilePath();
|
---|
| 153 | static bool startServer(ServerType type = MultipleInstances);
|
---|
| 154 | static bool stopServer();
|
---|
| 155 |
|
---|
| 156 | private:
|
---|
| 157 | QUuid typelib;
|
---|
| 158 | QUuid app;
|
---|
| 159 | };
|
---|
| 160 |
|
---|
| 161 | inline bool QAxFactory::startServer(ServerType type)
|
---|
| 162 | {
|
---|
| 163 | // implementation in qaxservermain.cpp
|
---|
| 164 | extern bool qax_startServer(ServerType);
|
---|
| 165 | return qax_startServer(type);
|
---|
| 166 | }
|
---|
| 167 |
|
---|
| 168 | inline bool QAxFactory::stopServer()
|
---|
| 169 | {
|
---|
| 170 | // implementation in qaxservermain.cpp
|
---|
| 171 | extern bool qax_stopServer();
|
---|
| 172 | return qax_stopServer();
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | #define QAXFACTORY_EXPORT( IMPL, TYPELIB, APPID ) \
|
---|
| 176 | QUnknownInterface *ucm_instantiate() \
|
---|
| 177 | { \
|
---|
| 178 | IMPL *impl = new IMPL( QUuid(TYPELIB), QUuid(APPID) ); \
|
---|
| 179 | QUnknownInterface* iface = 0; \
|
---|
| 180 | impl->queryInterface( IID_QUnknown, &iface ); \
|
---|
| 181 | return iface; \
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | #define QAXFACTORY_DEFAULT( Class, IIDClass, IIDInterface, IIDEvents, IIDTypeLib, IIDApp ) \
|
---|
| 185 | class QAxDefaultFactory : public QAxFactory \
|
---|
| 186 | { \
|
---|
| 187 | public: \
|
---|
| 188 | QAxDefaultFactory( const QUuid &app, const QUuid &lib) \
|
---|
| 189 | : QAxFactory( app, lib ) {} \
|
---|
| 190 | QStringList featureList() const \
|
---|
| 191 | { \
|
---|
| 192 | QStringList list; \
|
---|
| 193 | list << #Class; \
|
---|
| 194 | return list; \
|
---|
| 195 | } \
|
---|
| 196 | QMetaObject *metaObject( const QString &key ) const \
|
---|
| 197 | { \
|
---|
| 198 | if ( key == #Class ) \
|
---|
| 199 | return Class::staticMetaObject(); \
|
---|
| 200 | return 0; \
|
---|
| 201 | } \
|
---|
| 202 | QWidget *create( const QString &key, QWidget *parent, const char *name ) \
|
---|
| 203 | { \
|
---|
| 204 | if ( key == #Class ) \
|
---|
| 205 | return new Class( parent, name ); \
|
---|
| 206 | return 0; \
|
---|
| 207 | } \
|
---|
| 208 | QUuid classID( const QString &key ) const \
|
---|
| 209 | { \
|
---|
| 210 | if ( key == #Class ) \
|
---|
| 211 | return QUuid( IIDClass ); \
|
---|
| 212 | return QUuid(); \
|
---|
| 213 | } \
|
---|
| 214 | QUuid interfaceID( const QString &key ) const \
|
---|
| 215 | { \
|
---|
| 216 | if ( key == #Class ) \
|
---|
| 217 | return QUuid( IIDInterface ); \
|
---|
| 218 | return QUuid(); \
|
---|
| 219 | } \
|
---|
| 220 | QUuid eventsID( const QString &key ) const \
|
---|
| 221 | { \
|
---|
| 222 | if ( key == #Class ) \
|
---|
| 223 | return QUuid( IIDEvents ); \
|
---|
| 224 | return QUuid(); \
|
---|
| 225 | } \
|
---|
| 226 | }; \
|
---|
| 227 | QAXFACTORY_EXPORT( QAxDefaultFactory, IIDTypeLib, IIDApp ) \
|
---|
| 228 |
|
---|
| 229 | template<class T>
|
---|
| 230 | class QAxClass : public QAxFactory
|
---|
| 231 | {
|
---|
| 232 | public:
|
---|
| 233 | QAxClass(const QString &appId, const QString &libId)
|
---|
| 234 | : QAxFactory(appId, libId)
|
---|
| 235 | {}
|
---|
| 236 |
|
---|
| 237 | QMetaObject *metaObject(const QString &key) const { return T::staticMetaObject(); }
|
---|
| 238 | QStringList featureList() const { return QString(T::staticMetaObject()->className()); }
|
---|
| 239 | QWidget *create(const QString &key, QWidget *parent, const char *name)
|
---|
| 240 | {
|
---|
| 241 | if (key != QString(T::staticMetaObject()->className())) return 0;
|
---|
| 242 | if (!qstrcmp(T::staticMetaObject()->classInfo("Creatable", TRUE), "no")) return 0;
|
---|
| 243 | return new T(parent, name);
|
---|
| 244 | }
|
---|
| 245 | };
|
---|
| 246 |
|
---|
| 247 | #define QAXFACTORY_BEGIN(IDTypeLib, IDApp) \
|
---|
| 248 | class QAxFactoryList : public QAxFactory \
|
---|
| 249 | { \
|
---|
| 250 | QStringList factoryKeys; \
|
---|
| 251 | QDict<QAxFactoryInterface> factories; \
|
---|
| 252 | public: \
|
---|
| 253 | QAxFactoryList() \
|
---|
| 254 | : QAxFactory(IDApp, IDTypeLib) \
|
---|
| 255 | { \
|
---|
| 256 | factories.setAutoDelete(TRUE); \
|
---|
| 257 | QAxFactoryInterface *factory = 0; \
|
---|
| 258 | QStringList keys; \
|
---|
| 259 | QStringList::Iterator it; \
|
---|
| 260 |
|
---|
| 261 | #define QAXCLASS(Class) \
|
---|
| 262 | factory = new QAxClass<Class>(appID(), typeLibID()); \
|
---|
| 263 | keys = factory->featureList(); \
|
---|
| 264 | for (it = keys.begin(); it != keys.end(); ++it) { \
|
---|
| 265 | factoryKeys += *it; \
|
---|
| 266 | factories.insert(*it, factory); \
|
---|
| 267 | }\
|
---|
| 268 |
|
---|
| 269 | #define QAXFACTORY_END() \
|
---|
| 270 | } \
|
---|
| 271 | QStringList featureList() const { return factoryKeys; } \
|
---|
| 272 | QWidget *create(const QString &key, QWidget *parent, const char *name) { \
|
---|
| 273 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 274 | return f ? f->create(key, parent, name) : 0; \
|
---|
| 275 | } \
|
---|
| 276 | QUuid classID(const QString &key) { \
|
---|
| 277 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 278 | return f ? f->classID(key) : QUuid(); \
|
---|
| 279 | } \
|
---|
| 280 | QUuid interfaceID(const QString &key) { \
|
---|
| 281 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 282 | return f ? f->interfaceID(key) : QUuid(); \
|
---|
| 283 | } \
|
---|
| 284 | QUuid eventsID(const QString &key) { \
|
---|
| 285 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 286 | return f ? f->eventsID(key) : QUuid(); \
|
---|
| 287 | } \
|
---|
| 288 | void registerClass( const QString &key, QSettings *s ) const { \
|
---|
| 289 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 290 | if (f) f->registerClass(key, s); \
|
---|
| 291 | } \
|
---|
| 292 | void unregisterClass( const QString &key, QSettings *s ) const { \
|
---|
| 293 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 294 | if (f) f->unregisterClass(key, s); \
|
---|
| 295 | } \
|
---|
| 296 | QString exposeToSuperClass( const QString &key ) const { \
|
---|
| 297 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 298 | return f ? f->exposeToSuperClass(key) : QString(); \
|
---|
| 299 | } \
|
---|
| 300 | bool stayTopLevel( const QString &key ) const { \
|
---|
| 301 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 302 | return f ? f->stayTopLevel(key) : FALSE; \
|
---|
| 303 | } \
|
---|
| 304 | bool hasStockEvents( const QString &key ) const { \
|
---|
| 305 | QAxFactoryInterface *f = factories[key]; \
|
---|
| 306 | return f ? f->hasStockEvents(key) : FALSE; \
|
---|
| 307 | } \
|
---|
| 308 | }; \
|
---|
| 309 | QUnknownInterface *ucm_instantiate() \
|
---|
| 310 | { \
|
---|
| 311 | QAxFactoryList *impl = new QAxFactoryList(); \
|
---|
| 312 | QUnknownInterface* iface = 0; \
|
---|
| 313 | impl->queryInterface( IID_QUnknown, &iface ); \
|
---|
| 314 | return iface; \
|
---|
| 315 | }
|
---|
| 316 |
|
---|
| 317 |
|
---|
| 318 | #endif // QAXFACTORY_H
|
---|
| 319 | </pre>
|
---|
| 320 | <!-- eof -->
|
---|
| 321 | <p><address><hr><div align=center>
|
---|
| 322 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 323 | <td>Copyright © 2007
|
---|
| 324 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 325 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 326 | </table></div></address></body>
|
---|
| 327 | </html>
|
---|