infosoft: Add a word breaker for English.
[wine] / dlls / infosoft / infosoft_main.c
1 /*
2  *    Word splitter Implementation
3  *
4  * Copyright 2006 Mike McCormack
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #define COBJMACROS
22
23 #include "config.h"
24
25 #include <stdarg.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "winreg.h"
31 #include "ole2.h"
32 #include "indexsvr.h"
33 #include "initguid.h"
34
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
38
39 DEFINE_GUID(CLSID_wb_en_us,
40             0x59e09780,0x8099,0x101b,0x8d,0xf3,0x00,0x00,0x0b,0x65,0xc3,0xb5);
41
42 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
43 {
44     switch(fdwReason)
45     {
46     case DLL_WINE_PREATTACH:
47         return FALSE;  /* prefer native version */
48     case DLL_PROCESS_ATTACH:
49         DisableThreadLibraryCalls(hInstDLL);
50         break;
51     case DLL_PROCESS_DETACH:
52         break;
53     }
54     return TRUE;
55 }
56
57 extern HRESULT WINAPI wb_en_us_Constructor(IUnknown*, REFIID, LPVOID *);
58
59 typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
60
61 typedef struct
62 {
63     const IClassFactoryVtbl *lpVtbl;
64     LPFNCREATEINSTANCE      lpfnCI;
65 } CFImpl;
66
67 static HRESULT WINAPI infosoftcf_fnQueryInterface ( LPCLASSFACTORY iface,
68         REFIID riid, LPVOID *ppvObj)
69 {
70     CFImpl *This = (CFImpl *)iface;
71
72     TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
73
74     *ppvObj = NULL;
75
76     if (IsEqualIID(riid, &IID_IUnknown) ||
77         IsEqualIID(riid, &IID_IClassFactory))
78     {
79         *ppvObj = This;
80         return S_OK;
81     }
82
83     TRACE("-- E_NOINTERFACE\n");
84     return E_NOINTERFACE;
85 }
86
87 static ULONG WINAPI infosoftcf_fnAddRef (LPCLASSFACTORY iface)
88 {
89     return 2;
90 }
91
92 static ULONG WINAPI infosoftcf_fnRelease(LPCLASSFACTORY iface)
93 {
94     return 1;
95 }
96
97 static HRESULT WINAPI infosoftcf_fnCreateInstance( LPCLASSFACTORY iface,
98         LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
99 {
100     CFImpl *This = (CFImpl *)iface;
101
102     TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
103
104     *ppvObject = NULL;
105
106     return This->lpfnCI(pUnkOuter, riid, ppvObject);
107 }
108
109 static HRESULT WINAPI infosoftcf_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
110 {
111     FIXME("%p %d\n", iface, fLock);
112     return E_NOTIMPL;
113 }
114
115 static const IClassFactoryVtbl infosoft_cfvt =
116 {
117     infosoftcf_fnQueryInterface,
118     infosoftcf_fnAddRef,
119     infosoftcf_fnRelease,
120     infosoftcf_fnCreateInstance,
121     infosoftcf_fnLockServer
122 };
123
124 static CFImpl wb_en_us_cf = { &infosoft_cfvt, &wb_en_us_Constructor };
125
126 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
127 {
128     IClassFactory   *pcf = NULL;
129
130     TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
131
132     if (!ppv)
133         return E_INVALIDARG;
134     *ppv = NULL;
135
136     if (IsEqualIID(rclsid, &CLSID_wb_en_us))
137         pcf = (IClassFactory*) &wb_en_us_cf;
138     else
139         return CLASS_E_CLASSNOTAVAILABLE;
140
141     return IClassFactory_QueryInterface(pcf, iid, ppv);
142 }
143
144
145 HRESULT WINAPI DllCanUnloadNow(void)
146 {
147     FIXME("\n");
148     return S_FALSE;
149 }
150
151 HRESULT WINAPI DllRegisterServer(void)
152 {
153     FIXME("\n");
154     return S_OK;
155 }