Qt 4.8
qaxtypes.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the ActiveQt framework of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:BSD$
9 ** You may use this file under the terms of the BSD license as follows:
10 **
11 ** "Redistribution and use in source and binary forms, with or without
12 ** modification, are permitted provided that the following conditions are
13 ** met:
14 ** * Redistributions of source code must retain the above copyright
15 ** notice, this list of conditions and the following disclaimer.
16 ** * Redistributions in binary form must reproduce the above copyright
17 ** notice, this list of conditions and the following disclaimer in
18 ** the documentation and/or other materials provided with the
19 ** distribution.
20 ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 ** of its contributors may be used to endorse or promote products derived
22 ** from this software without specific prior written permission.
23 **
24 **
25 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #ifndef QAXTYPES_H
42 #define QAXTYPES_H
43 
44 #if !defined(_WINDOWS_) && !defined(_WINDOWS_H) && !defined(__WINDOWS__)
45 #error Must include windows.h first!
46 #endif
47 
48 #include <QtGui/qcolor.h>
49 #include <QtGui/qfont.h>
50 #include <QtCore/qdatetime.h>
51 #include <QtCore/qvariant.h>
52 
54 
56 
57 QT_MODULE(ActiveQt)
58 
59 #ifndef QT_NO_WIN_ACTIVEQT
60 
61 extern GUID IID_IAxServerBase;
62 struct IAxServerBase : public IUnknown
63 {
64  virtual IUnknown *clientSite() const = 0;
65  virtual void emitPropertyChanged(const char*) = 0;
66  virtual bool emitRequestPropertyChange(const char*) = 0;
67  virtual QObject *qObject() const = 0;
68  virtual void reportError(int code, const QString &src, const QString &desc, const QString &context) = 0;
69 };
70 
71 #define HIMETRIC_PER_INCH 2540
72 #define MAP_PIX_TO_LOGHIM(x,ppli) ((HIMETRIC_PER_INCH*(x) + ((ppli)>>1)) / (ppli))
73 #define MAP_LOGHIM_TO_PIX(x,ppli) (((ppli)*(x) + HIMETRIC_PER_INCH/2) / HIMETRIC_PER_INCH)
74 #define QAX_NUM_PARAMS 8
75 
76 static inline BSTR QStringToBSTR(const QString &str)
77 {
78  return SysAllocStringLen((OLECHAR*)str.unicode(), str.length());
79 }
80 
81 static inline uint QColorToOLEColor(const QColor &col)
82 {
83  return qRgba(col.blue(), col.green(), col.red(), 0x00);
84 }
85 
86 extern QColor OLEColorToQColor(uint col);
87 
88 extern bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName = 0, bool out = false);
89 extern QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint type = 0);
90 extern bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeName, uint type = 0);
91 extern void clearVARIANT(VARIANT *var);
92 
93 #define QAX_INPROC_SERVER (0x51540001)
94 #define QAX_OUTPROC_SERVER (0x51540002)
95 
97 #endif // QT_NO_WIN_ACTIVEQT
98 
100 
101 #endif // QAXTYPES_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
int type
Definition: qmetatype.cpp:239
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
Definition: quuid.h:52
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
QVariant VARIANTToQVariant(const VARIANT &arg, const QByteArray &typeName, uint type=0)
Returns arg as a QVariant of type type.
Definition: qaxtypes.cpp:919
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
virtual void emitPropertyChanged(const char *)=0
virtual bool emitRequestPropertyChange(const char *)=0
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QColor OLEColorToQColor(uint col)
Definition: qaxtypes.cpp:216
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
const char * typeName
Definition: qmetatype.cpp:239
const QChar * unicode() const
Returns a &#39;\0&#39;-terminated Unicode representation of the string.
Definition: qstring.h:706
void clearVARIANT(VARIANT *var)
Definition: qaxtypes.cpp:1408
virtual QObject * qObject() const =0
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
static uint QColorToOLEColor(const QColor &col)
Definition: qaxtypes.h:81
bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName=0, bool out=false)
Definition: qaxtypes.cpp:246
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
static BSTR QStringToBSTR(const QString &str)
Definition: qaxtypes.h:76
GUID IID_IAxServerBase
bool QVariantToVoidStar(const QVariant &var, void *data, const QByteArray &typeName, uint type=0)
Copies the data in var into data.
Definition: qaxtypes.cpp:814
#define QT_END_HEADER
Definition: qglobal.h:137
virtual IUnknown * clientSite() const =0
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
virtual void reportError(int code, const QString &src, const QString &desc, const QString &context)=0