1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include "stdafx.h"
23 #include "resource.h"
24 #include <initguid.h>
25 #include "UAccCOM2.h"
26
27 #include "UAccCOM_i.c"
28 #include "ia2_api_all_i.c"
29
30 #include "MAccessible.h"
31 #include "EnumVariant.h"
32 #include "UNOXWrapper.h"
33 #include "AccComponent.h"
34 #include "AccRelation.h"
35 #include "AccAction.h"
36 #include "AccText.h"
37 #include "AccEditableText.h"
38 #include "AccImage.h"
39 #include "AccValue.h"
40 #include "AccTable.h"
41 #include "AccHyperLink.h"
42 #include "AccHyperText.h"
43
44
45 CComModule _Module;
46
47 BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_MAccessible,CMAccessible)48 OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
49 OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
50 OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
51 OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
52 OBJECT_ENTRY(CLSID_AccAction, CAccAction)
53 OBJECT_ENTRY(CLSID_AccText, CAccText)
54 OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
55 OBJECT_ENTRY(CLSID_AccImage, CAccImage)
56 OBJECT_ENTRY(CLSID_AccValue, CAccValue)
57 OBJECT_ENTRY(CLSID_AccTable, CAccTable)
58 OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
59 OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
60 END_OBJECT_MAP()
61
62 /////////////////////////////////////////////////////////////////////////////
63 // DLL Entry Point
64
65 extern "C"
66 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
67 {
68 if (dwReason == DLL_PROCESS_ATTACH)
69 {
70 _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
71 DisableThreadLibraryCalls(hInstance);
72 }
73 else if (dwReason == DLL_PROCESS_DETACH)
74 _Module.Term();
75 return TRUE; // ok
76 }
77
78 /////////////////////////////////////////////////////////////////////////////
79 // Used to determine whether the DLL can be unloaded by OLE
80
DllCanUnloadNow(void)81 STDAPI DllCanUnloadNow(void)
82 {
83 return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
84 }
85
86 /////////////////////////////////////////////////////////////////////////////
87 // Returns a class factory to create an object of the requested type
88
DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)89 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
90 {
91 return _Module.GetClassObject(rclsid, riid, ppv);
92 }
93
94 /////////////////////////////////////////////////////////////////////////////
95 // DllRegisterServer - Adds entries to the system registry
96
DllRegisterServer(void)97 STDAPI DllRegisterServer(void)
98 {
99 // registers object, typelib and all interfaces in typelib
100 return _Module.RegisterServer(TRUE);
101 }
102
103 /////////////////////////////////////////////////////////////////////////////
104 // DllUnregisterServer - Removes entries from the system registry
105
DllUnregisterServer(void)106 STDAPI DllUnregisterServer(void)
107 {
108 return _Module.UnregisterServer(TRUE);
109 }
110