1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright IBM Corporation 2010.
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org.  If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #include "stdafx.h"
30 #include "resource.h"
31 #include <initguid.h>
32 #include "UAccCOM2.h"
33 
34 #include "UAccCOM_i.c"
35 #include "Accessible2_i.c"
36 #include "AccessibleComponent_i.c"
37 #include "AccessibleText_i.c"
38 #include "AccessibleEditableText_i.c"
39 #include "AccessibleImage_i.c"
40 #include "AccessibleTable_i.c"
41 #include "AccessibleAction_i.c"
42 #include "AccessibleValue_i.c"
43 #include "AccessibleHyperText_i.c"
44 #include "AccessibleRelation_i.c"
45 #include "AccessibleHyperLink_i.c"
46 
47 #include "MAccessible.h"
48 #include "EnumVariant.h"
49 #include "UNOXWrapper.h"
50 #include "AccComponent.h"
51 #include "AccRelation.h"
52 #include "AccAction.h"
53 #include "AccText.h"
54 #include "AccEditableText.h"
55 #include "AccImage.h"
56 #include "AccValue.h"
57 #include "AccTable.h"
58 #include "AccHyperLink.h"
59 #include "AccHyperText.h"
60 
61 
62 CComModule _Module;
63 
64 BEGIN_OBJECT_MAP(ObjectMap)
65 OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
66 OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
67 OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
68 OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
69 OBJECT_ENTRY(CLSID_AccAction, CAccAction)
70 OBJECT_ENTRY(CLSID_AccText, CAccText)
71 OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
72 OBJECT_ENTRY(CLSID_AccImage, CAccImage)
73 OBJECT_ENTRY(CLSID_AccValue, CAccValue)
74 OBJECT_ENTRY(CLSID_AccTable, CAccTable)
75 OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
76 OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
77 END_OBJECT_MAP()
78 
79 /////////////////////////////////////////////////////////////////////////////
80 // DLL Entry Point
81 
82 extern "C"
83     BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
84 {
85     if (dwReason == DLL_PROCESS_ATTACH)
86     {
87         _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
88         DisableThreadLibraryCalls(hInstance);
89     }
90     else if (dwReason == DLL_PROCESS_DETACH)
91         _Module.Term();
92     return TRUE;    // ok
93 }
94 
95 /////////////////////////////////////////////////////////////////////////////
96 // Used to determine whether the DLL can be unloaded by OLE
97 
98 STDAPI DllCanUnloadNow(void)
99 {
100     return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
101 }
102 
103 /////////////////////////////////////////////////////////////////////////////
104 // Returns a class factory to create an object of the requested type
105 
106 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
107 {
108     return _Module.GetClassObject(rclsid, riid, ppv);
109 }
110 
111 /////////////////////////////////////////////////////////////////////////////
112 // DllRegisterServer - Adds entries to the system registry
113 
114 STDAPI DllRegisterServer(void)
115 {
116     // registers object, typelib and all interfaces in typelib
117     return _Module.RegisterServer(TRUE);
118 }
119 
120 /////////////////////////////////////////////////////////////////////////////
121 // DllUnregisterServer - Removes entries from the system registry
122 
123 STDAPI DllUnregisterServer(void)
124 {
125     return _Module.UnregisterServer(TRUE);
126 }
127