[MSCTF][SDK] Add CDisplayAttributeMgr stubs (#8116)

Implementing missing features...
JIRA issue: CORE-19361
- Delete displayattributemgr.c and
  add displayattributemgr.cpp.
- Add CDisplayAttributeMgr class
  as stubs.
This commit is contained in:
Katayama Hirofumi MZ 2025-06-13 05:31:01 +09:00 committed by GitHub
parent d809cd0f7f
commit c894716295
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 208 additions and 144 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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 <katayama.hirofumi.mz@gmail.com>
*/
#include <initguid.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <msctf.h>
#include <msctf_undoc.h>
// Cicero
#include <cicbase.h>
#include <cicreg.h>
#include <cicutb.h>
#include "displayattributemgr.h"
#include "msctf_internal.h"
#include <wine/debug.h>
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<ITfDisplayAttributeCollectionMgr *>(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;
}

View file

@ -0,0 +1,40 @@
#pragma once
#include <cicarray.h>
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<IUnknown *> m_array1;
CicArray<DWORD> m_array2;
BOOL _IsInCollection(REFGUID rguid);
void _AdviseMarkupCollection(ITfTextInputProcessor *pProcessor, DWORD dwCookie);
void _UnadviseMarkupCollection(DWORD dwCookie);
void _SetThis();
};