diff --git a/base/ctf/msctf/CMakeLists.txt b/base/ctf/msctf/CMakeLists.txt index 4b31a9ed541..fec41c946ca 100644 --- a/base/ctf/msctf/CMakeLists.txt +++ b/base/ctf/msctf/CMakeLists.txt @@ -8,7 +8,6 @@ list(APPEND SOURCE categorymgr.c compartmentmgr.c context.c - displayattributemgr.c documentmgr.c inputprocessor.c msctf.c @@ -17,6 +16,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/msctf_stubs.c) list(APPEND PCH_SKIP_SOURCE + displayattributemgr.cpp langbarmgr.cpp mlng.cpp range.cpp diff --git a/base/ctf/msctf/displayattributemgr.c b/base/ctf/msctf/displayattributemgr.c deleted file mode 100644 index c8bb71e2ce2..00000000000 --- a/base/ctf/msctf/displayattributemgr.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * ITfDisplayAttributeMgr implementation - * - * Copyright 2010 CodeWeavers, Aric Stewart - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#define COBJMACROS - -#include "wine/debug.h" -#include "winbase.h" -#include "winreg.h" -#include "shlwapi.h" - -#include "msctf.h" -#include "msctf_internal.h" - -WINE_DEFAULT_DEBUG_CHANNEL(msctf); - -typedef struct tagDisplayAttributeMgr { - ITfDisplayAttributeMgr ITfDisplayAttributeMgr_iface; - - LONG refCount; - -} DisplayAttributeMgr; - -static inline DisplayAttributeMgr *impl_from_ITfDisplayAttributeMgr(ITfDisplayAttributeMgr *iface) -{ - return CONTAINING_RECORD(iface, DisplayAttributeMgr, ITfDisplayAttributeMgr_iface); -} - -static void DisplayAttributeMgr_Destructor(DisplayAttributeMgr *This) -{ - TRACE("destroying %p\n", This); - - HeapFree(GetProcessHeap(),0,This); -} - -static HRESULT WINAPI DisplayAttributeMgr_QueryInterface(ITfDisplayAttributeMgr *iface, REFIID iid, LPVOID *ppvOut) -{ - DisplayAttributeMgr *This = impl_from_ITfDisplayAttributeMgr(iface); - *ppvOut = NULL; - - if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfDisplayAttributeMgr)) - { - *ppvOut = &This->ITfDisplayAttributeMgr_iface; - } - - if (*ppvOut) - { - ITfDisplayAttributeMgr_AddRef(iface); - return S_OK; - } - - WARN("unsupported interface: %s\n", debugstr_guid(iid)); - return E_NOINTERFACE; -} - -static ULONG WINAPI DisplayAttributeMgr_AddRef(ITfDisplayAttributeMgr *iface) -{ - DisplayAttributeMgr *This = impl_from_ITfDisplayAttributeMgr(iface); - return InterlockedIncrement(&This->refCount); -} - -static ULONG WINAPI DisplayAttributeMgr_Release(ITfDisplayAttributeMgr *iface) -{ - DisplayAttributeMgr *This = impl_from_ITfDisplayAttributeMgr(iface); - ULONG ret; - - ret = InterlockedDecrement(&This->refCount); - if (ret == 0) - DisplayAttributeMgr_Destructor(This); - return ret; -} - -/***************************************************** - * ITfDisplayAttributeMgr functions - *****************************************************/ - -static HRESULT WINAPI DisplayAttributeMgr_OnUpdateInfo(ITfDisplayAttributeMgr *iface) -{ - DisplayAttributeMgr *This = impl_from_ITfDisplayAttributeMgr(iface); - - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; -} - -static HRESULT WINAPI DisplayAttributeMgr_EnumDisplayAttributeInfo(ITfDisplayAttributeMgr *iface, IEnumTfDisplayAttributeInfo **ppEnum) -{ - DisplayAttributeMgr *This = impl_from_ITfDisplayAttributeMgr(iface); - - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; -} - -static HRESULT WINAPI DisplayAttributeMgr_GetDisplayAttributeInfo(ITfDisplayAttributeMgr *iface, REFGUID guid, ITfDisplayAttributeInfo **ppInfo, CLSID *pclsidOwner) -{ - DisplayAttributeMgr *This = impl_from_ITfDisplayAttributeMgr(iface); - - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; -} - -static const ITfDisplayAttributeMgrVtbl DisplayAttributeMgrVtbl = -{ - DisplayAttributeMgr_QueryInterface, - DisplayAttributeMgr_AddRef, - DisplayAttributeMgr_Release, - DisplayAttributeMgr_OnUpdateInfo, - DisplayAttributeMgr_EnumDisplayAttributeInfo, - DisplayAttributeMgr_GetDisplayAttributeInfo -}; - -HRESULT DisplayAttributeMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) -{ - DisplayAttributeMgr *This; - if (pUnkOuter) - return CLASS_E_NOAGGREGATION; - - This = HeapAlloc(GetProcessHeap(),0,sizeof(DisplayAttributeMgr)); - if (This == NULL) - return E_OUTOFMEMORY; - - This->ITfDisplayAttributeMgr_iface.lpVtbl = &DisplayAttributeMgrVtbl; - This->refCount = 1; - - *ppOut = (IUnknown *)&This->ITfDisplayAttributeMgr_iface; - TRACE("returning %p\n", *ppOut); - return S_OK; -} diff --git a/base/ctf/msctf/displayattributemgr.cpp b/base/ctf/msctf/displayattributemgr.cpp new file mode 100644 index 00000000000..1b012e409e8 --- /dev/null +++ b/base/ctf/msctf/displayattributemgr.cpp @@ -0,0 +1,157 @@ +/* + * PROJECT: ReactOS CTF + * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later) + * PURPOSE: ITfDisplayAttributeMgr implementation + * COPYRIGHT: Copyright 2010 CodeWeavers, Aric Stewart + * Copyright 2025 Katayama Hirofumi MZ + */ + +#include +#include +#include +#include +#include +#include + +// Cicero +#include +#include +#include + +#include "displayattributemgr.h" +#include "msctf_internal.h" + +#include +WINE_DEFAULT_DEBUG_CHANNEL(msctf); + +//////////////////////////////////////////////////////////////////////////// +// CDisplayAttributeMgr + +CDisplayAttributeMgr::CDisplayAttributeMgr() + : m_cRefs(1) +{ +} + +CDisplayAttributeMgr::~CDisplayAttributeMgr() +{ +} + +BOOL CDisplayAttributeMgr::_IsInCollection(REFGUID rguid) +{ + FIXME("(%p)\n", wine_dbgstr_guid(&rguid)); + return FALSE; +} + +void CDisplayAttributeMgr::_AdviseMarkupCollection(ITfTextInputProcessor *pProcessor, DWORD dwCookie) +{ + FIXME("(%p, %u)\n", pProcessor, dwCookie); +} + +void CDisplayAttributeMgr::_UnadviseMarkupCollection(DWORD dwCookie) +{ + FIXME("(%u)\n", dwCookie); +} + +void CDisplayAttributeMgr::_SetThis() +{ + FIXME("()\n"); +} + +//////////////////////////////////////////////////////////////////////////// +// ** IUnknown methods ** + +STDMETHODIMP +CDisplayAttributeMgr::QueryInterface(REFIID riid, void **ppvObj) +{ + if (!ppvObj) + return E_INVALIDARG; + + *ppvObj = NULL; + + if (IsEqualIID(riid, IID_IUnknown) || + IsEqualIID(riid, IID_ITfDisplayAttributeMgr) || + IsEqualIID(riid, IID_CDisplayAttributeMgr)) + { + *ppvObj = this; + } + else if (IsEqualIID(riid, IID_ITfDisplayAttributeCollectionMgr)) + { + *ppvObj = static_cast(this); + } + + if (!*ppvObj) + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +STDMETHODIMP_(ULONG) +CDisplayAttributeMgr::AddRef() +{ + return ::InterlockedIncrement(&m_cRefs); +} + +STDMETHODIMP_(ULONG) +CDisplayAttributeMgr::Release() +{ + if (::InterlockedDecrement(&m_cRefs) == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +//////////////////////////////////////////////////////////////////////////// +// ** ITfDisplayAttributeMgr methods ** + +STDMETHODIMP CDisplayAttributeMgr::OnUpdateInfo() +{ + FIXME("()\n"); + return E_NOTIMPL; +} + +STDMETHODIMP +CDisplayAttributeMgr::EnumDisplayAttributeInfo(_Out_ IEnumTfDisplayAttributeInfo **ppEnum) +{ + FIXME("(%p)\n", ppEnum); + return E_NOTIMPL; +} + +STDMETHODIMP +CDisplayAttributeMgr::GetDisplayAttributeInfo( + _In_ REFGUID guid, + _Out_ ITfDisplayAttributeInfo **ppInfo, + _Out_ CLSID *pclsidOwner) +{ + FIXME("(%s, %p, %s)\n", wine_dbgstr_guid(&guid), ppInfo, wine_dbgstr_guid(pclsidOwner)); + return E_NOTIMPL; +} + +//////////////////////////////////////////////////////////////////////////// +// ** ITfDisplayAttributeCollectionMgr methods ** + +STDMETHODIMP +CDisplayAttributeMgr::UnknownMethod(_In_ DWORD unused) +{ + FIXME("(0x%lX)\n", unused); + return E_NOTIMPL; +} + +//////////////////////////////////////////////////////////////////////////// + +EXTERN_C +HRESULT DisplayAttributeMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) +{ + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + CDisplayAttributeMgr *This = new(cicNoThrow) CDisplayAttributeMgr(); + if (!This) + return E_OUTOFMEMORY; + + HRESULT hr = This->QueryInterface(IID_ITfDisplayAttributeMgr, (void **)ppOut); + This->Release(); + return hr; +} diff --git a/base/ctf/msctf/displayattributemgr.h b/base/ctf/msctf/displayattributemgr.h new file mode 100644 index 00000000000..b6988e553e0 --- /dev/null +++ b/base/ctf/msctf/displayattributemgr.h @@ -0,0 +1,40 @@ +#pragma once + +#include + +DEFINE_GUID(IID_CDisplayAttributeMgr, 0xFF4619E8, 0xEA5E, 0x43E5, 0xB3, 0x08, 0x11, 0xCD, 0x26, 0xAB, 0x6B, 0x3A); + +class CDisplayAttributeMgr + : public ITfDisplayAttributeMgr + , public ITfDisplayAttributeCollectionMgr +{ +public: + CDisplayAttributeMgr(); + virtual ~CDisplayAttributeMgr(); + + // ** IUnknown methods ** + STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + + // ** ITfDisplayAttributeMgr methods ** + STDMETHODIMP OnUpdateInfo() override; + STDMETHODIMP EnumDisplayAttributeInfo(_Out_ IEnumTfDisplayAttributeInfo **ppEnum) override; + STDMETHODIMP GetDisplayAttributeInfo( + _In_ REFGUID guid, + _Out_ ITfDisplayAttributeInfo **ppInfo, + _Out_ CLSID *pclsidOwner) override; + + // ** ITfDisplayAttributeCollectionMgr methods ** + STDMETHODIMP UnknownMethod(_In_ DWORD unused) override; // FIXME + +protected: + LONG m_cRefs; + CicArray m_array1; + CicArray m_array2; + + BOOL _IsInCollection(REFGUID rguid); + void _AdviseMarkupCollection(ITfTextInputProcessor *pProcessor, DWORD dwCookie); + void _UnadviseMarkupCollection(DWORD dwCookie); + void _SetThis(); +}; diff --git a/sdk/include/reactos/msctf_undoc.idl b/sdk/include/reactos/msctf_undoc.idl index 7071bbc0fbd..9c53d2c2bde 100644 --- a/sdk/include/reactos/msctf_undoc.idl +++ b/sdk/include/reactos/msctf_undoc.idl @@ -19,6 +19,16 @@ interface ITfRangeAnchor : ITfRange HRESULT SetExtent([in] IAnchor *pAnchorStart, [in] IAnchor *pAnchorEnd); }; +[ + object, + uuid(4e3d2d48-3c17-457d-84a1-f209476de897), + pointer_default(unique) +] +interface ITfDisplayAttributeCollectionMgr : IUnknown +{ + HRESULT UnknownMethod([in] DWORD unused); /* FIXME */ +}; + cpp_quote("BOOL WINAPI TF_InitSystem(VOID);") cpp_quote("BOOL WINAPI TF_UninitSystem(VOID);") cpp_quote("HRESULT WINAPI TF_GetGlobalCompartment(_Out_ ITfCompartmentMgr **ppCompMgr);")