- Sync msctf, mscoree, mciqtz32, localspl, inetmib1 with Wine 1.1.21
[reactos.git] / reactos / dll / win32 / msctf / inputprocessor.c
index 7df5575..38e9368 100644 (file)
@@ -288,18 +288,61 @@ static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile(
         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
         REFGUID guidProfiles)
 {
+    HRESULT hr;
+    BOOL enabled;
+    TF_LANGUAGEPROFILE LanguageProfile;
     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
-    FIXME("STUB:(%p)\n",This);
-    return E_NOTIMPL;
+
+    TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles));
+
+    if (langid != This->currentLanguage) return E_INVALIDARG;
+
+    if (get_active_textservice(rclsid,NULL))
+    {
+        TRACE("Already Active\n");
+        return E_FAIL;
+    }
+
+    hr = ITfInputProcessorProfiles_IsEnabledLanguageProfile(iface, rclsid,
+            langid, guidProfiles, &enabled);
+    if (FAILED(hr) || !enabled)
+    {
+        TRACE("Not Enabled\n");
+        return E_FAIL;
+    }
+
+    LanguageProfile.clsid = *rclsid;
+    LanguageProfile.langid = langid;
+    LanguageProfile.guidProfile = *guidProfiles;
+
+    hr = add_active_textservice(&LanguageProfile);
+
+    return hr;
 }
 
 static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile(
         ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid,
         GUID *pguidProfile)
 {
+    TF_LANGUAGEPROFILE profile;
     InputProcessorProfiles *This = (InputProcessorProfiles*)iface;
-    FIXME("STUB:(%p)\n",This);
-    return E_NOTIMPL;
+
+    TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile);
+
+    if (!rclsid || !plangid || !pguidProfile)
+        return E_INVALIDARG;
+
+    if (get_active_textservice(rclsid, &profile))
+    {
+        *plangid = profile.langid;
+        *pguidProfile = profile.guidProfile;
+        return S_OK;
+    }
+    else
+    {
+        *pguidProfile = GUID_NULL;
+        return S_FALSE;
+    }
 }
 
 static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription(
@@ -756,8 +799,7 @@ static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LA
 
         tflp->clsid = clsid;
         tflp->langid = This->langid;
-        /* FIXME */
-        tflp->fActive = FALSE;
+        tflp->fActive = get_active_textservice(&clsid, NULL);
         tflp->guidProfile = profile;
         if (ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
                 &tflp->catid, tipcats, 3) != S_OK)