1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 // XCallback_Impl.cpp : Implementation of DLL Exports. 28 29 30 // Note: Proxy/Stub Information 31 // To build a separate proxy/stub DLL, 32 // run nmake -f XCallback_Implps.mk in the project directory. 33 34 #include "stdafx.h" 35 #include "resource.h" 36 #include <initguid.h> 37 #include "XCallback_Impl.h" 38 39 #include "XCallback_Impl_i.c" 40 #include "Callback.h" 41 #include "Simple.h" 42 43 44 CComModule _Module; 45 46 BEGIN_OBJECT_MAP(ObjectMap) 47 OBJECT_ENTRY(CLSID_Callback, CCallback) 48 OBJECT_ENTRY(CLSID_Simple, CSimple) 49 END_OBJECT_MAP() 50 51 ///////////////////////////////////////////////////////////////////////////// 52 // DLL Entry Point 53 54 extern "C" 55 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) 56 { 57 if (dwReason == DLL_PROCESS_ATTACH) 58 { 59 _Module.Init(ObjectMap, hInstance, &LIBID_XCALLBACK_IMPLLib); 60 DisableThreadLibraryCalls(hInstance); 61 } 62 else if (dwReason == DLL_PROCESS_DETACH) 63 _Module.Term(); 64 return TRUE; // ok 65 } 66 67 ///////////////////////////////////////////////////////////////////////////// 68 // Used to determine whether the DLL can be unloaded by OLE 69 70 STDAPI DllCanUnloadNow(void) 71 { 72 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; 73 } 74 75 ///////////////////////////////////////////////////////////////////////////// 76 // Returns a class factory to create an object of the requested type 77 78 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) 79 { 80 return _Module.GetClassObject(rclsid, riid, ppv); 81 } 82 83 ///////////////////////////////////////////////////////////////////////////// 84 // DllRegisterServer - Adds entries to the system registry 85 86 STDAPI DllRegisterServer(void) 87 { 88 // registers object, typelib and all interfaces in typelib 89 return _Module.RegisterServer(TRUE); 90 } 91 92 ///////////////////////////////////////////////////////////////////////////// 93 // DllUnregisterServer - Removes entries from the system registry 94 95 STDAPI DllUnregisterServer(void) 96 { 97 return _Module.UnregisterServer(TRUE); 98 } 99 100 101 102