Debian Codegraph @

extensions/test/ole/unoTocomCalls/XCallback_Impl/XCallback_Impl.cpp

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19 // XCallback_Impl.cpp : Implementation of DLL Exports.
20
21 // Note: Proxy/Stub Information
22 // To build a separate proxy/stub DLL,
23 // run nmake -f XCallback_Implps.mk in the project directory.
24
25 #include "stdafx.h"
26 #include "resource.h"
27 #include <initguid.h>
28 #include "XCallback_Impl.h"
29
30 #include "XCallback_Impl_i.c"
31 #include "Callback.h"
32 #include "Simple.h"
33
34 CComModule _Module;
35
36 BEGIN_OBJECT_MAP(ObjectMap)
37 OBJECT_ENTRY(CLSID_Callback, CCallback)
38 OBJECT_ENTRY(CLSID_Simple, CSimple)
39 END_OBJECT_MAP()
40
41 // DLL Entry Point
42
43 extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
44 {
45 if (dwReason == DLL_PROCESS_ATTACH)
46 {
47 _Module.Init(ObjectMap, hInstance, &LIBID_XCALLBACK_IMPLLib);
48 DisableThreadLibraryCalls(hInstance);
49 }
50 else if (dwReason == DLL_PROCESS_DETACH)
51 _Module.Term();
52 return TRUE; // ok
53 }
54
55 // Used to determine whether the DLL can be unloaded by OLE
56
57 STDAPI DllCanUnloadNow(void) { return (_Module.GetLockCount() == 0) ? S_OK : S_FALSE; }
58
59 // Returns a class factory to create an object of the requested type
60
61 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
62 {
63 return _Module.GetClassObject(rclsid, riid, ppv);
64 }
65
66 // DllRegisterServer - Adds entries to the system registry
67
68 STDAPI DllRegisterServer(void)
69 {
70 // registers object, typelib and all interfaces in typelib
71 return _Module.RegisterServer(TRUE);
72 }
73
74 // DllUnregisterServer - Removes entries from the system registry
75
76 STDAPI DllUnregisterServer(void) { return _Module.UnregisterServer(TRUE); }
77
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */