]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/ole/oleutils.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: ole/oleutils.cpp
3 // Purpose: implementation of OLE helper functions
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "oleutils.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
27 #if defined(__BORLANDC__)
37 #include <wx/msw/ole/uuid.h>
38 #include <wx/msw/ole/oleutils.h>
40 #if defined(__VISUALC__) && (__VISUALC__ > 1000)
44 // ============================================================================
46 // ============================================================================
48 // return TRUE if the iid is in the array
49 bool IsIidFromList(REFIID riid
, const IID
*aIids
[], size_t nCount
)
51 for ( size_t i
= 0; i
< nCount
; i
++ ) {
52 if ( riid
== *aIids
[i
] )
59 #if wxUSE_DRAG_AND_DROP
61 // ----------------------------------------------------------------------------
63 // ----------------------------------------------------------------------------
65 #if defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ > 1000)
66 const char *GetIidName(REFIID riid
)
68 // an association between symbolic name and numeric value of an IID
74 // construct the table containing all known interfaces
75 #define ADD_KNOWN_IID(name) { &IID_I##name, #name }
77 static const KNOWN_IID aKnownIids
[] = {
78 ADD_KNOWN_IID(AdviseSink
),
79 ADD_KNOWN_IID(AdviseSink2
),
80 ADD_KNOWN_IID(BindCtx
),
81 ADD_KNOWN_IID(ClassFactory
),
82 #if !defined( __VISUALC__) || (__VISUALC__!=1010)
83 ADD_KNOWN_IID(ContinueCallback
),
84 ADD_KNOWN_IID(EnumOleDocumentViews
),
85 ADD_KNOWN_IID(OleCommandTarget
),
86 ADD_KNOWN_IID(OleDocument
),
87 ADD_KNOWN_IID(OleDocumentSite
),
88 ADD_KNOWN_IID(OleDocumentView
),
91 ADD_KNOWN_IID(DataAdviseHolder
),
92 ADD_KNOWN_IID(DataObject
),
94 ADD_KNOWN_IID(DebugStream
),
95 ADD_KNOWN_IID(DfReserved1
),
96 ADD_KNOWN_IID(DfReserved2
),
97 ADD_KNOWN_IID(DfReserved3
),
98 ADD_KNOWN_IID(Dispatch
),
99 ADD_KNOWN_IID(DropSource
),
100 ADD_KNOWN_IID(DropTarget
),
101 ADD_KNOWN_IID(EnumCallback
),
102 ADD_KNOWN_IID(EnumFORMATETC
),
103 ADD_KNOWN_IID(EnumGeneric
),
104 ADD_KNOWN_IID(EnumHolder
),
105 ADD_KNOWN_IID(EnumMoniker
),
106 ADD_KNOWN_IID(EnumOLEVERB
),
107 ADD_KNOWN_IID(EnumSTATDATA
),
108 ADD_KNOWN_IID(EnumSTATSTG
),
109 ADD_KNOWN_IID(EnumString
),
110 ADD_KNOWN_IID(EnumUnknown
),
111 ADD_KNOWN_IID(EnumVARIANT
),
112 ADD_KNOWN_IID(ExternalConnection
),
113 ADD_KNOWN_IID(InternalMoniker
),
114 ADD_KNOWN_IID(LockBytes
),
115 ADD_KNOWN_IID(Malloc
),
116 ADD_KNOWN_IID(Marshal
),
117 ADD_KNOWN_IID(MessageFilter
),
118 ADD_KNOWN_IID(Moniker
),
119 ADD_KNOWN_IID(OleAdviseHolder
),
120 ADD_KNOWN_IID(OleCache
),
121 ADD_KNOWN_IID(OleCache2
),
122 ADD_KNOWN_IID(OleCacheControl
),
123 ADD_KNOWN_IID(OleClientSite
),
124 ADD_KNOWN_IID(OleContainer
),
125 ADD_KNOWN_IID(OleInPlaceActiveObject
),
126 ADD_KNOWN_IID(OleInPlaceFrame
),
127 ADD_KNOWN_IID(OleInPlaceObject
),
128 ADD_KNOWN_IID(OleInPlaceSite
),
129 ADD_KNOWN_IID(OleInPlaceUIWindow
),
130 ADD_KNOWN_IID(OleItemContainer
),
131 ADD_KNOWN_IID(OleLink
),
132 ADD_KNOWN_IID(OleManager
),
133 ADD_KNOWN_IID(OleObject
),
134 ADD_KNOWN_IID(OlePresObj
),
135 ADD_KNOWN_IID(OleWindow
),
136 ADD_KNOWN_IID(PSFactory
),
137 ADD_KNOWN_IID(ParseDisplayName
),
138 ADD_KNOWN_IID(Persist
),
139 ADD_KNOWN_IID(PersistFile
),
140 ADD_KNOWN_IID(PersistStorage
),
141 ADD_KNOWN_IID(PersistStream
),
142 ADD_KNOWN_IID(ProxyManager
),
143 ADD_KNOWN_IID(RootStorage
),
144 ADD_KNOWN_IID(RpcChannel
),
145 ADD_KNOWN_IID(RpcProxy
),
146 ADD_KNOWN_IID(RpcStub
),
147 ADD_KNOWN_IID(RunnableObject
),
148 ADD_KNOWN_IID(RunningObjectTable
),
149 ADD_KNOWN_IID(StdMarshalInfo
),
150 ADD_KNOWN_IID(Storage
),
151 ADD_KNOWN_IID(Stream
),
152 ADD_KNOWN_IID(StubManager
),
153 ADD_KNOWN_IID(Unknown
),
154 ADD_KNOWN_IID(ViewObject
),
155 ADD_KNOWN_IID(ViewObject2
),
158 // don't clobber preprocessor name space
161 // try to find the interface in the table
162 for ( size_t ui
= 0; ui
< WXSIZEOF(aKnownIids
); ui
++ ) {
163 if ( riid
== *aKnownIids
[ui
].pIid
) {
164 return aKnownIids
[ui
].szName
;
168 // unknown IID, just transform to string
174 void wxLogQueryInterface(const char *szInterface
, REFIID riid
)
176 wxLogTrace("%s::QueryInterface (iid = %s)", szInterface
, GetIidName(riid
));
179 void wxLogAddRef(const char *szInterface
, ULONG cRef
)
181 wxLogTrace("After %s::AddRef: m_cRef = %d", szInterface
, cRef
+ 1);
184 void wxLogRelease(const char *szInterface
, ULONG cRef
)
186 wxLogTrace("After %s::Release: m_cRef = %d", szInterface
, cRef
- 1);
189 #elif defined(__WXDEBUG__) && defined(__VISUALC__) && (__VISUALC__ <= 1000)
192 void wxLogQueryInterface(const char *szInterface
, REFIID riid
)
194 wxLogTrace("%s::QueryInterface", szInterface
);
197 void wxLogAddRef(const char *szInterface
, ULONG cRef
)
199 wxLogTrace("After %s::AddRef: m_cRef = %d", szInterface
, cRef
+ 1);
202 void wxLogRelease(const char *szInterface
, ULONG cRef
)
204 wxLogTrace("After %s::Release: m_cRef = %d", szInterface
, cRef
- 1);
210 // wxUSE_DRAG_AND_DROP