| Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
This is the verbatim text of the qaxfactory.h include file. It is provided only for illustration; the copyright remains with Trolltech.
/****************************************************************************
** $Id: qt/qaxfactory.h 3.3.8 edited Jan 11 14:46 $
**
** Declaration of the TQAxFactory class
**
** Copyright (C) 2001-2007 Trolltech ASA. All rights reserved.
**
** This file is part of the Active TQt integration.
**
** Licensees holding valid TQt Enterprise Edition
** licenses for Windows may use this file in accordance with the TQt Commercial
** License Agreement provided with the Software.
**
** This file is not available for use under any other license without
** express written permission from the copyright holder.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about TQt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef TQAXFACTORY_H
#define TQAXFACTORY_H
#include <ntqdict.h>
#include <ntquuid.h>
#include <private/qcom_p.h>
#include <ntqmetaobject.h>
// {22B230F6-8722-4051-ADCB-E7C9CE872EB3}
#ifndef IID_QAxFactory
#define IID_QAxFactory TQUuid( 0x22b230f6, 0x8722, 0x4051, 0xad, 0xcb, 0xe7, 0xc9, 0xce, 0x87, 0x2e, 0xb3 )
#endif
class TQWidget;
class TQMetaObject;
class TQSettings;
struct IDispatch;
struct TQAxFactoryInterface : public TQFeatureListInterface
{
public:
#ifndef Q_QDOC
virtual TQWidget *create( const TQString &key, TQWidget *parent = 0, const char *name = 0 ) = 0;
virtual TQObject *createObject( const TQString &key, TQObject *parent = 0, const char *name = 0 ) = 0;
virtual TQMetaObject *metaObject( const TQString &key ) const = 0;
virtual bool createObjectWrapper(TQObject *object, IDispatch **wrapper) = 0;
virtual TQUuid classID( const TQString &key ) const = 0;
virtual TQUuid interfaceID( const TQString &key ) const = 0;
virtual TQUuid eventsID( const TQString &key ) const = 0;
virtual TQUuid typeLibID() const = 0;
virtual TQUuid appID() const = 0;
virtual void registerClass( const TQString &key, TQSettings * ) const = 0;
virtual void unregisterClass( const TQString &key, TQSettings * ) const = 0;
virtual bool validateLicenseKey( const TQString &key, const TQString &licenseKey) const = 0;
virtual TQString exposeToSuperClass( const TQString &key ) const = 0;
virtual bool stayTopLevel( const TQString &key ) const = 0;
virtual bool hasStockEvents( const TQString &key ) const = 0;
virtual bool isService() const = 0;
#endif
};
extern TQAxFactoryInterface *qAxFactory();
class TQAxFactory : public TQAxFactoryInterface
{
public:
TQAxFactory( const TQUuid &, const TQUuid &);
virtual ~TQAxFactory();
TQ_REFCOUNT;
TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface );
#ifdef Q_QDOC
virtual TQStringList featureList() const = 0;
#endif
virtual TQWidget *create( const TQString &key, TQWidget *parent = 0, const char *name = 0 );
virtual TQObject *createObject( const TQString &key, TQObject *parent = 0, const char *name = 0 );
virtual TQMetaObject *metaObject( const TQString &key ) const;
virtual bool createObjectWrapper(TQObject *object, IDispatch **wrapper);
virtual TQUuid classID( const TQString &key ) const;
virtual TQUuid interfaceID( const TQString &key ) const;
virtual TQUuid eventsID( const TQString &key ) const;
virtual TQUuid typeLibID() const;
virtual TQUuid appID() const;
virtual void registerClass( const TQString &key, TQSettings * ) const;
virtual void unregisterClass( const TQString &key, TQSettings * ) const;
virtual bool validateLicenseKey( const TQString &key, const TQString &licenseKey) const;
virtual TQString exposeToSuperClass( const TQString &key ) const;
virtual bool stayTopLevel( const TQString &key ) const;
virtual bool hasStockEvents( const TQString &key ) const;
virtual bool isService() const;
enum ServerType {
SingleInstance,
MultipleInstances
};
static bool isServer();
static TQString serverDirPath();
static TQString serverFilePath();
static bool startServer(ServerType type = MultipleInstances);
static bool stopServer();
private:
TQUuid typelib;
TQUuid app;
};
inline bool TQAxFactory::startServer(ServerType type)
{
// implementation in qaxservermain.cpp
extern bool qax_startServer(ServerType);
return qax_startServer(type);
}
inline bool TQAxFactory::stopServer()
{
// implementation in qaxservermain.cpp
extern bool qax_stopServer();
return qax_stopServer();
}
#define TQAXFACTORY_EXPORT( IMPL, TYPELIB, APPID ) \
TQUnknownInterface *ucm_instantiate() \
{ \
IMPL *impl = new IMPL( TQUuid(TYPELIB), TQUuid(APPID) ); \
TQUnknownInterface* iface = 0; \
impl->queryInterface( IID_QUnknown, &iface ); \
return iface; \
}
#define TQAXFACTORY_DEFAULT( Class, IIDClass, IIDInterface, IIDEvents, IIDTypeLib, IIDApp ) \
class TQAxDefaultFactory : public TQAxFactory \
{ \
public: \
TQAxDefaultFactory( const TQUuid &app, const TQUuid &lib) \
: TQAxFactory( app, lib ) {} \
TQStringList featureList() const \
{ \
TQStringList list; \
list << #Class; \
return list; \
} \
TQMetaObject *metaObject( const TQString &key ) const \
{ \
if ( key == #Class ) \
return Class::staticMetaObject(); \
return 0; \
} \
TQWidget *create( const TQString &key, TQWidget *parent, const char *name ) \
{ \
if ( key == #Class ) \
return new Class( parent, name ); \
return 0; \
} \
TQUuid classID( const TQString &key ) const \
{ \
if ( key == #Class ) \
return TQUuid( IIDClass ); \
return TQUuid(); \
} \
TQUuid interfaceID( const TQString &key ) const \
{ \
if ( key == #Class ) \
return TQUuid( IIDInterface ); \
return TQUuid(); \
} \
TQUuid eventsID( const TQString &key ) const \
{ \
if ( key == #Class ) \
return TQUuid( IIDEvents ); \
return TQUuid(); \
} \
}; \
TQAXFACTORY_EXPORT( TQAxDefaultFactory, IIDTypeLib, IIDApp ) \
template<class T>
class TQAxClass : public TQAxFactory
{
public:
TQAxClass(const TQString &appId, const TQString &libId)
: TQAxFactory(appId, libId)
{}
TQMetaObject *metaObject(const TQString &key) const { return T::staticMetaObject(); }
TQStringList featureList() const { return TQString(T::staticMetaObject()->className()); }
TQWidget *create(const TQString &key, TQWidget *parent, const char *name)
{
if (key != TQString(T::staticMetaObject()->className())) return 0;
if (!qstrcmp(T::staticMetaObject()->classInfo("Creatable", TRUE), "no")) return 0;
return new T(parent, name);
}
};
#define TQAXFACTORY_BEGIN(IDTypeLib, IDApp) \
class TQAxFactoryList : public TQAxFactory \
{ \
TQStringList factoryKeys; \
TQDict<TQAxFactoryInterface> factories; \
public: \
TQAxFactoryList() \
: TQAxFactory(IDApp, IDTypeLib) \
{ \
factories.setAutoDelete(TRUE); \
TQAxFactoryInterface *factory = 0; \
TQStringList keys; \
TQStringList::Iterator it; \
#define TQAXCLASS(Class) \
factory = new TQAxClass<Class>(appID(), typeLibID()); \
keys = factory->featureList(); \
for (it = keys.begin(); it != keys.end(); ++it) { \
factoryKeys += *it; \
factories.insert(*it, factory); \
}\
#define TQAXFACTORY_END() \
} \
TQStringList featureList() const { return factoryKeys; } \
TQWidget *create(const TQString &key, TQWidget *parent, const char *name) { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->create(key, parent, name) : 0; \
} \
TQUuid classID(const TQString &key) { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->classID(key) : TQUuid(); \
} \
TQUuid interfaceID(const TQString &key) { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->interfaceID(key) : TQUuid(); \
} \
TQUuid eventsID(const TQString &key) { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->eventsID(key) : TQUuid(); \
} \
void registerClass( const TQString &key, TQSettings *s ) const { \
TQAxFactoryInterface *f = factories[key]; \
if (f) f->registerClass(key, s); \
} \
void unregisterClass( const TQString &key, TQSettings *s ) const { \
TQAxFactoryInterface *f = factories[key]; \
if (f) f->unregisterClass(key, s); \
} \
TQString exposeToSuperClass( const TQString &key ) const { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->exposeToSuperClass(key) : TQString(); \
} \
bool stayTopLevel( const TQString &key ) const { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->stayTopLevel(key) : FALSE; \
} \
bool hasStockEvents( const TQString &key ) const { \
TQAxFactoryInterface *f = factories[key]; \
return f ? f->hasStockEvents(key) : FALSE; \
} \
}; \
TQUnknownInterface *ucm_instantiate() \
{ \
TQAxFactoryList *impl = new TQAxFactoryList(); \
TQUnknownInterface* iface = 0; \
impl->queryInterface( IID_QUnknown, &iface ); \
return iface; \
}
#endif // TQAXFACTORY_H
| Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|