From 27a802f1988cf228936596e42f968b5ce8b0f2ad Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 26 Nov 2012 16:56:52 +0100 Subject: fix activeqt module structure The formerly monolithic ActiveQt module has been split into three modules: axserver A static library for creating a server project. axcontainer A static libary for creating a container project. axbase A static library with shared code for the latter two libraries. This module also is responsible for the installation of header files in the include/ActiveQt directory. "CONFIG += qaxserver" has been deprecated. Use "QT += axserver" instead. "CONFIG += qaxcontainer" has been deprecated. Use "QT += axcontainer" instead. Code from qaxtypes.cpp that does not depend on the QAX_SERVER define has been moved to qaxtypefunctions.cpp and resides in the axbase module. Task-number: QTBUG-27776 Change-Id: Ib39fc897ccfce16849be0e3c084817d2cd0fc926 Reviewed-by: Miikka Heikkinen --- doc/src/activeqt-server.qdoc | 4 +- doc/src/snippets/code/doc_src_qaxcontainer.pro | 2 +- doc/src/snippets/code/doc_src_qaxserver.pro | 5 +- examples/activeqt/comapp/comapp.pro | 2 +- examples/activeqt/hierarchy/hierarchy.pro | 4 +- examples/activeqt/menus/menus.pro | 4 +- examples/activeqt/multiple/multiple.pro | 4 +- examples/activeqt/opengl/opengl.pro | 5 +- examples/activeqt/qutlook/qutlook.pro | 3 +- examples/activeqt/simple/simple.pro | 4 +- examples/activeqt/webbrowser/webbrowser.pro | 3 +- examples/activeqt/wrapper/wrapper.pro | 4 +- modules/qt_activeqt.pri | 17 -- src/activeqt/activeqt.pro | 11 +- src/activeqt/axshared.prx | 17 ++ src/activeqt/container/container.pro | 31 +--- src/activeqt/control/control.pro | 33 ++-- src/activeqt/shared/qaxtypefunctions.cpp | 231 +++++++++++++++++++++++++ src/activeqt/shared/qaxtypefunctions.h | 96 ++++++++++ src/activeqt/shared/qaxtypes.cpp | 185 +------------------- src/activeqt/shared/qaxtypes.h | 50 ++---- sync.profile | 2 +- tests/auto/dumpcpp/dumpcpp.pro | 6 +- tests/auto/qaxobject/qaxobject.pro | 4 +- tools/dumpcpp/dumpcpp.pro | 3 +- tools/dumpdoc/dumpdoc.pro | 4 +- tools/testcon/testcon.pro | 4 +- 27 files changed, 419 insertions(+), 319 deletions(-) delete mode 100644 modules/qt_activeqt.pri create mode 100644 src/activeqt/axshared.prx create mode 100644 src/activeqt/shared/qaxtypefunctions.cpp create mode 100644 src/activeqt/shared/qaxtypefunctions.h diff --git a/doc/src/activeqt-server.qdoc b/doc/src/activeqt-server.qdoc index f643d90..285a74c 100644 --- a/doc/src/activeqt-server.qdoc +++ b/doc/src/activeqt-server.qdoc @@ -54,7 +54,7 @@ \section1 Using the Library To turn a standard Qt application into a COM server using the - QAxServer library you must add \c qaxserver as a CONFIG setting + QAxServer library you must add \c axserver to the QT variable in your \c .pro file. An out-of-process executable server is generated from a \c .pro @@ -72,7 +72,7 @@ type library entry, ie. you can add version information or specify a different toolbox icon. - The \c qaxserver configuration will cause the \c qmake tool to add the + Using the \c axserver module will cause the \c qmake tool to add the required build steps to the build system: \list diff --git a/doc/src/snippets/code/doc_src_qaxcontainer.pro b/doc/src/snippets/code/doc_src_qaxcontainer.pro index 011cd26..d3a3c2d 100644 --- a/doc/src/snippets/code/doc_src_qaxcontainer.pro +++ b/doc/src/snippets/code/doc_src_qaxcontainer.pro @@ -39,7 +39,7 @@ ****************************************************************************/ #! [0] -CONFIG += qaxcontainer +QT += axcontainer #! [0] diff --git a/doc/src/snippets/code/doc_src_qaxserver.pro b/doc/src/snippets/code/doc_src_qaxserver.pro index 7fc34d7..dcd3d38 100644 --- a/doc/src/snippets/code/doc_src_qaxserver.pro +++ b/doc/src/snippets/code/doc_src_qaxserver.pro @@ -40,7 +40,7 @@ #! [0] TEMPLATE = app -CONFIG += qaxserver +QT += axserver RC_FILE = qaxserver.rc ... @@ -49,7 +49,8 @@ RC_FILE = qaxserver.rc #! [1] TEMPLATE = lib -CONFIG += qaxserver dll +QT += axserver +CONFIG += dll DEF_FILE = qaxserver.def RC_FILE = qaxserver.rc diff --git a/examples/activeqt/comapp/comapp.pro b/examples/activeqt/comapp/comapp.pro index 4d1cbd6..f82dcf6 100644 --- a/examples/activeqt/comapp/comapp.pro +++ b/examples/activeqt/comapp/comapp.pro @@ -1,5 +1,5 @@ TEMPLATE = app -CONFIG += qaxserver +QT += axserver QT += widgets diff --git a/examples/activeqt/hierarchy/hierarchy.pro b/examples/activeqt/hierarchy/hierarchy.pro index 9d4c665..4429ef6 100644 --- a/examples/activeqt/hierarchy/hierarchy.pro +++ b/examples/activeqt/hierarchy/hierarchy.pro @@ -1,8 +1,8 @@ TEMPLATE = lib TARGET = hierarchyax -CONFIG += qt warn_off qaxserver dll -QT += widgets +CONFIG += qt warn_off dll +QT += widgets axserver SOURCES = objects.cpp main.cpp HEADERS = objects.h diff --git a/examples/activeqt/menus/menus.pro b/examples/activeqt/menus/menus.pro index 150c1ab..de41ac1 100644 --- a/examples/activeqt/menus/menus.pro +++ b/examples/activeqt/menus/menus.pro @@ -1,8 +1,8 @@ TEMPLATE = app TARGET = menusax -CONFIG += qt warn_off qaxserver -QT += widgets +CONFIG += qt warn_off +QT += widgets axserver SOURCES = main.cpp menus.cpp HEADERS = menus.h diff --git a/examples/activeqt/multiple/multiple.pro b/examples/activeqt/multiple/multiple.pro index 295376d..3dbf77e 100644 --- a/examples/activeqt/multiple/multiple.pro +++ b/examples/activeqt/multiple/multiple.pro @@ -1,8 +1,8 @@ TEMPLATE = lib TARGET = multipleax -CONFIG += qt warn_off qaxserver dll -QT += widgets +CONFIG += qt warn_off dll +QT += widgets axserver SOURCES = main.cpp HEADERS = ax1.h ax2.h diff --git a/examples/activeqt/opengl/opengl.pro b/examples/activeqt/opengl/opengl.pro index 6c1360a..283a6e1 100644 --- a/examples/activeqt/opengl/opengl.pro +++ b/examples/activeqt/opengl/opengl.pro @@ -1,9 +1,8 @@ TEMPLATE = app TARGET = openglax -CONFIG += qt warn_off qaxserver - -QT += widgets opengl +CONFIG += qt warn_off +QT += widgets axserver opengl HEADERS = glbox.h \ globjwin.h diff --git a/examples/activeqt/qutlook/qutlook.pro b/examples/activeqt/qutlook/qutlook.pro index 4e0e027..484107d 100644 --- a/examples/activeqt/qutlook/qutlook.pro +++ b/examples/activeqt/qutlook/qutlook.pro @@ -1,8 +1,7 @@ #! [0] #! [1] TEMPLATE = app TARGET = qutlook -CONFIG += qaxcontainer -QT += widgets +QT += widgets axcontainer TYPELIBS = $$system(dumpcpp -getfile {00062FFF-0000-0000-C000-000000000046}) #! [0] diff --git a/examples/activeqt/simple/simple.pro b/examples/activeqt/simple/simple.pro index 297d8e0..31231d6 100644 --- a/examples/activeqt/simple/simple.pro +++ b/examples/activeqt/simple/simple.pro @@ -1,8 +1,8 @@ TEMPLATE = app TARGET = simpleax -CONFIG += qt warn_off qaxserver -QT += widgets +CONFIG += qt warn_off +QT += widgets axserver SOURCES = main.cpp RC_FILE = simple.rc diff --git a/examples/activeqt/webbrowser/webbrowser.pro b/examples/activeqt/webbrowser/webbrowser.pro index 915c7ca..8b29560 100644 --- a/examples/activeqt/webbrowser/webbrowser.pro +++ b/examples/activeqt/webbrowser/webbrowser.pro @@ -1,7 +1,6 @@ TEMPLATE = app -CONFIG += qaxcontainer -QT += widgets +QT += widgets axcontainer HEADERS = webaxwidget.h SOURCES = main.cpp diff --git a/examples/activeqt/wrapper/wrapper.pro b/examples/activeqt/wrapper/wrapper.pro index 1d2c3ae..b07e8f3 100644 --- a/examples/activeqt/wrapper/wrapper.pro +++ b/examples/activeqt/wrapper/wrapper.pro @@ -1,8 +1,8 @@ TEMPLATE = lib TARGET = wrapperax -CONFIG += qt warn_off qaxserver dll -QT += widgets +CONFIG += qt warn_off dll +QT += widgets axserver SOURCES = main.cpp RC_FILE = wrapperax.rc diff --git a/modules/qt_activeqt.pri b/modules/qt_activeqt.pri deleted file mode 100644 index 4ac21a7..0000000 --- a/modules/qt_activeqt.pri +++ /dev/null @@ -1,17 +0,0 @@ -QT.activeqt.VERSION = 5.0.0 -QT.activeqt.MAJOR_VERSION = 5 -QT.activeqt.MINOR_VERSION = 0 -QT.activeqt.PATCH_VERSION = 0 - -QT.activeqt.name = ActiveQt -QT.activeqt.bins = $$QT_MODULE_BIN_BASE -QT.activeqt.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/ActiveQt -QT.activeqt.private_includes = $$QT_MODULE_INCLUDE_BASE/ActiveQt/$$QT.activeqt.VERSION $$QT_MODULE_INCLUDE_BASE/ActiveQt/$$QT.activeqt.VERSION/ActiveQt -QT.activeqt.sources = $$QT_MODULE_BASE/src/activeqt -QT.activeqt.libs = $$QT_MODULE_LIB_BASE -QT.activeqt.plugins = $$QT_MODULE_PLUGIN_BASE -QT.activeqt.imports = $$QT_MODULE_IMPORT_BASE -QT.activeqt.depends = gui -QT.activeqt.DEFINES = QT_ACTIVEQT_LIB - -QT_CONFIG += activeqt diff --git a/src/activeqt/activeqt.pro b/src/activeqt/activeqt.pro index c826882..b6d45e5 100644 --- a/src/activeqt/activeqt.pro +++ b/src/activeqt/activeqt.pro @@ -1,14 +1,7 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS = container +axshared.file = axshared.prx +SUBDIRS = axshared container !wince*: SUBDIRS += control -TARGET = ActiveQt -VERSION = $$QT_VERSION -MODULE = activeqt -MODULE_DEPENDS = widgets -MODULE_PRI = $$section(PWD, /, 0, -3)/modules/qt_activeqt.pri -load(qt_module_fwdpri) -load(qt_module_headers) -load(qt_installs) diff --git a/src/activeqt/axshared.prx b/src/activeqt/axshared.prx new file mode 100644 index 0000000..7a79216 --- /dev/null +++ b/src/activeqt/axshared.prx @@ -0,0 +1,17 @@ +# This modules provides the header files, installed under "ActiveQt/". +# It also contains shared code that is used by axcontainer and axserver. + +TARGET = ActiveQt +CONFIG += static +QT += gui-private + +HEADERS = \ + shared/qaxtypefunctions.h \ + shared/qaxutils_p.h + +SOURCES = \ + shared/qaxtypefunctions.cpp \ + shared/qaxutils.cpp + +MODULE = axbase +load(qt_module) diff --git a/src/activeqt/container/container.pro b/src/activeqt/container/container.pro index 66d4f87..07b4eb3 100644 --- a/src/activeqt/container/container.pro +++ b/src/activeqt/container/container.pro @@ -1,22 +1,7 @@ -TEMPLATE = lib TARGET = QAxContainer -CONFIG += create_prl -contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release -contains(QT_CONFIG, build_all):CONFIG += build_all - -!debug_and_release|build_pass { - CONFIG(debug, debug|release) { - TARGET = $$member(TARGET, 0)d - } -} - -INCLUDEPATH *= $$QT.activeqt.includes - -QT += core-private gui gui-private widgets widgets-private - -CONFIG += qt warn_on static -DESTDIR = $$QT.activeqt.libs +QT += core-private gui gui-private widgets widgets-private axbase +CONFIG += static LIBS += -lole32 -loleaut32 !wince*:LIBS += -luser32 -lgdi32 -ladvapi32 @@ -28,8 +13,7 @@ HEADERS = ../control/qaxaggregated.h \ qaxobject.h \ qaxscript.h \ qaxselect.h \ - ../shared/qaxtypes.h \ - ../shared/qaxutils_p.h + ../shared/qaxtypes.h SOURCES = qaxbase.cpp \ qaxdump.cpp \ @@ -38,9 +22,12 @@ SOURCES = qaxbase.cpp \ qaxscript.cpp \ qaxscriptwrapper.cpp \ qaxselect.cpp \ - ../shared/qaxtypes.cpp \ - ../shared/qaxutils.cpp + ../shared/qaxtypes.cpp FORMS = qaxselect.ui -load(qt_installs) +MODULE = axcontainer +MODULE_CONFIG = dumpcpp +CONFIG += no_module_headers +load(qt_module) +DEFINES -= QT_NO_CAST_TO_ASCII QT_USE_QSTRINGBUILDER diff --git a/src/activeqt/control/control.pro b/src/activeqt/control/control.pro index 157a2fa..41373e3 100644 --- a/src/activeqt/control/control.pro +++ b/src/activeqt/control/control.pro @@ -1,21 +1,7 @@ -TEMPLATE = lib TARGET = QAxServer -CONFIG += create_prl -contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release -contains(QT_CONFIG, build_all):CONFIG += build_all - -!debug_and_release|build_pass { - CONFIG(debug, debug|release) { - TARGET = $$member(TARGET, 0)d - } -} - -INCLUDEPATH *= $$QT.activeqt.includes - -QT += core-private gui-private widgets -CONFIG += qt warn_off static -DESTDIR = $$QT.activeqt.libs +QT += core-private gui-private widgets axbase +CONFIG += static DEFINES += QAX_SERVER win32-g++*:DEFINES += QT_NEEDS_QMAIN @@ -26,8 +12,7 @@ win32-g++*:LIBS += -luuid HEADERS = qaxaggregated.h \ qaxbindable.h \ qaxfactory.h \ - ../shared/qaxtypes.h \ - ../shared/qaxutils_p.h + ../shared/qaxtypes.h SOURCES = qaxserver.cpp \ qaxserverbase.cpp \ @@ -36,7 +21,11 @@ SOURCES = qaxserver.cpp \ qaxservermain.cpp \ qaxserverdll.cpp \ qaxmain.cpp \ - ../shared/qaxtypes.cpp \ - ../shared/qaxutils.cpp - -load(qt_installs) + ../shared/qaxtypes.cpp + +MODULE = axserver +MODULE_DEFINES = QAXSERVER +MODULE_CONFIG = idcidl +CONFIG += no_module_headers +load(qt_module) +DEFINES -= QT_NO_CAST_TO_ASCII QT_USE_QSTRINGBUILDER diff --git a/src/activeqt/shared/qaxtypefunctions.cpp b/src/activeqt/shared/qaxtypefunctions.cpp new file mode 100644 index 0000000..6bba5a0 --- /dev/null +++ b/src/activeqt/shared/qaxtypefunctions.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the ActiveQt framework of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qaxtypefunctions.h" +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +QColor OLEColorToQColor(uint col) +{ + return QColor(GetRValue(col),GetGValue(col),GetBValue(col)); +} + +/*! + Copies the data in \a var into \a data. + + Used by + + QAxServerBase: + - QAxServerBase::qt_metacall (update out parameters/return value) + + QAxBase: + - internalProperty(ReadProperty) + - internalInvoke(update out parameters/return value) + +*/ +bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeName, uint type) +{ + if (!data) + return true; + + if (type == QMetaType::QVariant || type == QVariant::LastType || (type == 0 && typeName == "QVariant")) { + *(QVariant*)data = var; + return true; + } + + switch (var.type()) { + case QVariant::Invalid: + break; + case QVariant::String: + *(QString*)data = var.toString(); + break; + case QVariant::Int: + *(int*)data = var.toInt(); + break; + case QVariant::UInt: + *(uint*)data = var.toUInt(); + break; + case QVariant::Bool: + *(bool*)data = var.toBool(); + break; + case QVariant::Double: + *(double*)data = var.toDouble(); + break; + case QVariant::Color: + *(QColor*)data = qvariant_cast(var); + break; + case QVariant::Date: + *(QDate*)data = var.toDate(); + break; + case QVariant::Time: + *(QTime*)data = var.toTime(); + break; + case QVariant::DateTime: + *(QDateTime*)data = var.toDateTime(); + break; + case QVariant::Font: + *(QFont*)data = qvariant_cast(var); + break; + case QVariant::Pixmap: + *(QPixmap*)data = qvariant_cast(var); + break; +#ifndef QT_NO_CURSOR + case QVariant::Cursor: + *(QCursor*)data = qvariant_cast(var); + break; +#endif + case QVariant::List: + *(QList*)data = var.toList(); + break; + case QVariant::StringList: + *(QStringList*)data = var.toStringList(); + break; + case QVariant::ByteArray: + *(QByteArray*)data = var.toByteArray(); + break; + case QVariant::LongLong: + *(qint64*)data = var.toLongLong(); + break; + case QVariant::ULongLong: + *(quint64*)data = var.toULongLong(); + break; + case QVariant::Rect: + *(QRect*)data = var.toRect(); + break; + case QVariant::Size: + *(QSize*)data = var.toSize(); + break; + case QVariant::Point: + *(QPoint*)data = var.toPoint(); + break; + case QVariant::UserType: + *(void**)data = *(void**)var.constData(); +// qVariantGet(var, *(void**)data, typeName); + break; + default: + qWarning("QVariantToVoidStar: Unhandled QVariant type"); + return false; + } + + return true; +} + +void clearVARIANT(VARIANT *var) +{ + if (var->vt & VT_BYREF) { + switch (var->vt) { + case VT_BSTR|VT_BYREF: + SysFreeString(*var->pbstrVal); + delete var->pbstrVal; + break; + case VT_BOOL|VT_BYREF: + delete var->pboolVal; + break; + case VT_I1|VT_BYREF: + delete var->pcVal; + break; + case VT_I2|VT_BYREF: + delete var->piVal; + break; + case VT_I4|VT_BYREF: + delete var->plVal; + break; + case VT_INT|VT_BYREF: + delete var->pintVal; + break; + case VT_UI1|VT_BYREF: + delete var->pbVal; + break; + case VT_UI2|VT_BYREF: + delete var->puiVal; + break; + case VT_UI4|VT_BYREF: + delete var->pulVal; + break; + case VT_UINT|VT_BYREF: + delete var->puintVal; + break; +#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 + case VT_I8|VT_BYREF: + delete var->pllVal; + break; + case VT_UI8|VT_BYREF: + delete var->pullVal; + break; +#endif + case VT_CY|VT_BYREF: + delete var->pcyVal; + break; + case VT_R4|VT_BYREF: + delete var->pfltVal; + break; + case VT_R8|VT_BYREF: + delete var->pdblVal; + break; + case VT_DATE|VT_BYREF: + delete var->pdate; + break; + case VT_DISPATCH|VT_BYREF: + (*var->ppdispVal)->Release(); + delete var->ppdispVal; + break; + case VT_ARRAY|VT_VARIANT|VT_BYREF: + case VT_ARRAY|VT_UI1|VT_BYREF: + case VT_ARRAY|VT_BSTR|VT_BYREF: + SafeArrayDestroy(*var->pparray); + delete var->pparray; + break; + case VT_VARIANT|VT_BYREF: + delete var->pvarVal; + break; + } + VariantInit(var); + } else { + VariantClear(var); + } +} + +QT_END_NAMESPACE diff --git a/src/activeqt/shared/qaxtypefunctions.h b/src/activeqt/shared/qaxtypefunctions.h new file mode 100644 index 0000000..7bd61c9 --- /dev/null +++ b/src/activeqt/shared/qaxtypefunctions.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the ActiveQt framework of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QAXTYPEFUNCTIONS_P_H +#define QAXTYPEFUNCTIONS_P_H + +#if !defined(_WINDOWS_) && !defined(_WINDOWS_H) && !defined(__WINDOWS__) +#error Must include windows.h first! +#endif + +#include +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_WIN_ACTIVEQT + +extern GUID IID_IAxServerBase; +struct IAxServerBase : public IUnknown +{ + virtual IUnknown *clientSite() const = 0; + virtual void emitPropertyChanged(const char*) = 0; + virtual bool emitRequestPropertyChange(const char*) = 0; + virtual QObject *qObject() const = 0; + virtual void reportError(int code, const QString &src, const QString &desc, const QString &context) = 0; +}; + +#define HIMETRIC_PER_INCH 2540 +#define MAP_PIX_TO_LOGHIM(x,ppli) ((HIMETRIC_PER_INCH*(x) + ((ppli)>>1)) / (ppli)) +#define MAP_LOGHIM_TO_PIX(x,ppli) (((ppli)*(x) + HIMETRIC_PER_INCH/2) / HIMETRIC_PER_INCH) +#define QAX_NUM_PARAMS 8 + +static inline BSTR QStringToBSTR(const QString &str) +{ + return SysAllocStringLen((OLECHAR*)str.unicode(), str.length()); +} + +static inline uint QColorToOLEColor(const QColor &col) +{ + return qRgba(col.blue(), col.green(), col.red(), 0x00); +} + +extern QColor OLEColorToQColor(uint col); +extern bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeName, uint type = 0); +extern void clearVARIANT(VARIANT *var); + +#define QAX_INPROC_SERVER (0x51540001) +#define QAX_OUTPROC_SERVER (0x51540002) + +QT_END_NAMESPACE + +#endif // QT_NO_WIN_ACTIVEQT + +QT_END_HEADER + +#endif // QAXTYPEFUNCTIONS_P_H diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index 24f048e..bca9430 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -63,6 +63,8 @@ QT_BEGIN_NAMESPACE #ifdef QAX_SERVER +# define QVariantToVARIANT QVariantToVARIANT_server +# define VARIANTToQVariant VARIANTToQVariant_server extern ITypeLib *qAxTypeLibrary; CLSID CLSID_QRect = { 0x34030f30, 0xe359, 0x4fe6, {0xab, 0x82, 0x39, 0x76, 0x6f, 0x5d, 0x91, 0xee } }; @@ -71,6 +73,8 @@ CLSID CLSID_QPoint = { 0x3be838a3, 0x3fac, 0xbfc4, {0x4c, 0x6c, 0x37, 0xc4, 0x4d GUID IID_IAxServerBase = { 0xbd2ec165, 0xdfc9, 0x4319, { 0x8b, 0x9b, 0x60, 0xa5, 0x74, 0x78, 0xe9, 0xe3} }; #else +# define QVariantToVARIANT QVariantToVARIANT_container +# define VARIANTToQVariant VARIANTToQVariant_container extern void *qax_createObjectWrapper(int metaType, IUnknown *iface); #endif @@ -215,11 +219,6 @@ static DATE QDateTimeToDATE(const QDateTime &dt) return vtime; } -QColor OLEColorToQColor(uint col) -{ - return QColor(GetRValue(col),GetGValue(col),GetBValue(col)); -} - /* Converts \a var to \a arg, and tries to coerce \a arg to \a type. @@ -796,106 +795,6 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type Q_ASSERT(!out || (arg.vt & VT_BYREF)); return true; } - -/*! - Copies the data in \a var into \a data. - - Used by - - QAxServerBase: - - QAxServerBase::qt_metacall (update out parameters/return value) - - QAxBase: - - internalProperty(ReadProperty) - - internalInvoke(update out parameters/return value) - -*/ -bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeName, uint type) -{ - if (!data) - return true; - - if (type == QMetaType::QVariant || type == QVariant::LastType || (type == 0 && typeName == "QVariant")) { - *(QVariant*)data = var; - return true; - } - - switch (var.type()) { - case QVariant::Invalid: - break; - case QVariant::String: - *(QString*)data = var.toString(); - break; - case QVariant::Int: - *(int*)data = var.toInt(); - break; - case QVariant::UInt: - *(uint*)data = var.toUInt(); - break; - case QVariant::Bool: - *(bool*)data = var.toBool(); - break; - case QVariant::Double: - *(double*)data = var.toDouble(); - break; - case QVariant::Color: - *(QColor*)data = qvariant_cast(var); - break; - case QVariant::Date: - *(QDate*)data = var.toDate(); - break; - case QVariant::Time: - *(QTime*)data = var.toTime(); - break; - case QVariant::DateTime: - *(QDateTime*)data = var.toDateTime(); - break; - case QVariant::Font: - *(QFont*)data = qvariant_cast(var); - break; - case QVariant::Pixmap: - *(QPixmap*)data = qvariant_cast(var); - break; -#ifndef QT_NO_CURSOR - case QVariant::Cursor: - *(QCursor*)data = qvariant_cast(var); - break; -#endif - case QVariant::List: - *(QList*)data = var.toList(); - break; - case QVariant::StringList: - *(QStringList*)data = var.toStringList(); - break; - case QVariant::ByteArray: - *(QByteArray*)data = var.toByteArray(); - break; - case QVariant::LongLong: - *(qint64*)data = var.toLongLong(); - break; - case QVariant::ULongLong: - *(quint64*)data = var.toULongLong(); - break; - case QVariant::Rect: - *(QRect*)data = var.toRect(); - break; - case QVariant::Size: - *(QSize*)data = var.toSize(); - break; - case QVariant::Point: - *(QPoint*)data = var.toPoint(); - break; - case QVariant::UserType: - *(void**)data = *(void**)var.constData(); -// qVariantGet(var, *(void**)data, typeName); - break; - default: - qWarning("QVariantToVoidStar: Unhandled QVariant type"); - return false; - } - - return true; -} /*! Returns \a arg as a QVariant of type \a type. @@ -1408,80 +1307,6 @@ QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint return var; } -void clearVARIANT(VARIANT *var) -{ - if (var->vt & VT_BYREF) { - switch(var->vt) { - case VT_BSTR|VT_BYREF: - SysFreeString(*var->pbstrVal); - delete var->pbstrVal; - break; - case VT_BOOL|VT_BYREF: - delete var->pboolVal; - break; - case VT_I1|VT_BYREF: - delete var->pcVal; - break; - case VT_I2|VT_BYREF: - delete var->piVal; - break; - case VT_I4|VT_BYREF: - delete var->plVal; - break; - case VT_INT|VT_BYREF: - delete var->pintVal; - break; - case VT_UI1|VT_BYREF: - delete var->pbVal; - break; - case VT_UI2|VT_BYREF: - delete var->puiVal; - break; - case VT_UI4|VT_BYREF: - delete var->pulVal; - break; - case VT_UINT|VT_BYREF: - delete var->puintVal; - break; -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 - case VT_I8|VT_BYREF: - delete var->pllVal; - break; - case VT_UI8|VT_BYREF: - delete var->pullVal; - break; -#endif - case VT_CY|VT_BYREF: - delete var->pcyVal; - break; - case VT_R4|VT_BYREF: - delete var->pfltVal; - break; - case VT_R8|VT_BYREF: - delete var->pdblVal; - break; - case VT_DATE|VT_BYREF: - delete var->pdate; - break; - case VT_DISPATCH|VT_BYREF: - (*var->ppdispVal)->Release(); - delete var->ppdispVal; - break; - case VT_ARRAY|VT_VARIANT|VT_BYREF: - case VT_ARRAY|VT_UI1|VT_BYREF: - case VT_ARRAY|VT_BSTR|VT_BYREF: - SafeArrayDestroy(*var->pparray); - delete var->pparray; - break; - case VT_VARIANT|VT_BYREF: - delete var->pvarVal; - break; - } - VariantInit(var); - } else { - VariantClear(var); - } -} - QT_END_NAMESPACE + #endif // QT_NO_WIN_ACTIVEQT diff --git a/src/activeqt/shared/qaxtypes.h b/src/activeqt/shared/qaxtypes.h index 91a02da..692a50d 100644 --- a/src/activeqt/shared/qaxtypes.h +++ b/src/activeqt/shared/qaxtypes.h @@ -41,14 +41,7 @@ #ifndef QAXTYPES_H #define QAXTYPES_H -#if !defined(_WINDOWS_) && !defined(_WINDOWS_H) && !defined(__WINDOWS__) -#error Must include windows.h first! -#endif - -#include -#include -#include -#include +#include "qaxtypefunctions.h" QT_BEGIN_HEADER @@ -56,40 +49,29 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_WIN_ACTIVEQT -extern GUID IID_IAxServerBase; -struct IAxServerBase : public IUnknown -{ - virtual IUnknown *clientSite() const = 0; - virtual void emitPropertyChanged(const char*) = 0; - virtual bool emitRequestPropertyChange(const char*) = 0; - virtual QObject *qObject() const = 0; - virtual void reportError(int code, const QString &src, const QString &desc, const QString &context) = 0; -}; +#ifdef QAX_SERVER +# define QVariantToVARIANTFunc QVariantToVARIANT_server +# define VARIANTToQVariantFunc VARIANTToQVariant_server +#else +# define QVariantToVARIANTFunc QVariantToVARIANT_container +# define VARIANTToQVariantFunc VARIANTToQVariant_container +#endif -#define HIMETRIC_PER_INCH 2540 -#define MAP_PIX_TO_LOGHIM(x,ppli) ((HIMETRIC_PER_INCH*(x) + ((ppli)>>1)) / (ppli)) -#define MAP_LOGHIM_TO_PIX(x,ppli) (((ppli)*(x) + HIMETRIC_PER_INCH/2) / HIMETRIC_PER_INCH) -#define QAX_NUM_PARAMS 8 +extern bool QVariantToVARIANTFunc(const QVariant &var, VARIANT &arg, const QByteArray &typeName = 0, bool out = false); +extern QVariant VARIANTToQVariantFunc(const VARIANT &arg, const QByteArray &typeName, uint type = 0); -static inline BSTR QStringToBSTR(const QString &str) +inline bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName = 0, bool out = false) { - return SysAllocStringLen((OLECHAR*)str.unicode(), str.length()); + return QVariantToVARIANTFunc(var, arg, typeName, out); } -static inline uint QColorToOLEColor(const QColor &col) +inline QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint type = 0) { - return qRgba(col.blue(), col.green(), col.red(), 0x00); + return VARIANTToQVariantFunc(arg, typeName, type); } -extern QColor OLEColorToQColor(uint col); - -extern bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName = 0, bool out = false); -extern QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint type = 0); -extern bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeName, uint type = 0); -extern void clearVARIANT(VARIANT *var); - -#define QAX_INPROC_SERVER (0x51540001) -#define QAX_OUTPROC_SERVER (0x51540002) +#undef QVariantToVARIANTFunc +#undef VARIANTToQVariantFunc QT_END_NAMESPACE #endif // QT_NO_WIN_ACTIVEQT diff --git a/sync.profile b/sync.profile index defa576..62e92bc 100644 --- a/sync.profile +++ b/sync.profile @@ -1,5 +1,5 @@ %modules = ( # path to module name map - "ActiveQt" => "$basedir/src/activeqt", + "ActiveQt" => "$basedir/src/activeqt" ); %moduleheaders = ( # restrict the module headers to those found in relative path ); diff --git a/tests/auto/dumpcpp/dumpcpp.pro b/tests/auto/dumpcpp/dumpcpp.pro index 776aa32..aae7bd8 100644 --- a/tests/auto/dumpcpp/dumpcpp.pro +++ b/tests/auto/dumpcpp/dumpcpp.pro @@ -1,5 +1,5 @@ -CONFIG += testcase qaxcontainer -QT += widgets testlib +CONFIG += testcase +QT += widgets axcontainer testlib SOURCES += tst_dumpcpp.cpp TARGET = tst_dumpcpp @@ -8,4 +8,4 @@ TYPELIBS = $$(SystemRoot)\\system32\\ieframe.dll !exists($$TYPELIBS) { message("Web Browser type library for test not found!") -} \ No newline at end of file +} diff --git a/tests/auto/qaxobject/qaxobject.pro b/tests/auto/qaxobject/qaxobject.pro index 7e0fd69..e6f51a1 100644 --- a/tests/auto/qaxobject/qaxobject.pro +++ b/tests/auto/qaxobject/qaxobject.pro @@ -1,3 +1,3 @@ -CONFIG += testcase qaxcontainer -QT += testlib +CONFIG += testcase +QT += axcontainer testlib SOURCES += tst_qaxobject.cpp diff --git a/tools/dumpcpp/dumpcpp.pro b/tools/dumpcpp/dumpcpp.pro index 5c8f48d..3917298 100644 --- a/tools/dumpcpp/dumpcpp.pro +++ b/tools/dumpcpp/dumpcpp.pro @@ -1,5 +1,4 @@ -CONFIG += qaxcontainer -QT += widgets core-private +QT += axcontainer widgets core-private SOURCES = main.cpp diff --git a/tools/dumpdoc/dumpdoc.pro b/tools/dumpdoc/dumpdoc.pro index 5f3fb4e..9ebc782 100644 --- a/tools/dumpdoc/dumpdoc.pro +++ b/tools/dumpdoc/dumpdoc.pro @@ -1,7 +1,7 @@ TEMPLATE = app -CONFIG += console qaxcontainer -QT += widgets +CONFIG += console +QT += axcontainer widgets SOURCES += main.cpp diff --git a/tools/testcon/testcon.pro b/tools/testcon/testcon.pro index 5204af4..4c27638 100644 --- a/tools/testcon/testcon.pro +++ b/tools/testcon/testcon.pro @@ -1,7 +1,7 @@ TEMPLATE = app -CONFIG += qaxserver qaxserver_no_postlink qaxcontainer -QT += widgets printsupport +CONFIG += qaxserver_no_postlink +QT += widgets axserver axcontainer printsupport SOURCES = main.cpp docuwindow.cpp mainwindow.cpp invokemethod.cpp changeproperties.cpp ambientproperties.cpp controlinfo.cpp HEADERS = docuwindow.h mainwindow.h invokemethod.h changeproperties.h ambientproperties.h controlinfo.h -- cgit v1.2.3