mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 09:43:40 +00:00
[MSCTF] Translate ITfDocumentMgr into C++ (#8120)
Implementing missing features... JIRA issue: CORE-19361 - Delete documentmgr.c and add documentmgr.cpp. - Make ITfDocumentMgr and IEnumTfContexts C++ code.
This commit is contained in:
parent
44d99fa60f
commit
e26ad0de12
4 changed files with 548 additions and 501 deletions
86
base/ctf/msctf/documentmgr.h
Normal file
86
base/ctf/msctf/documentmgr.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* PROJECT: ReactOS CTF
|
||||
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
||||
* PURPOSE: Implementation of ITfDocumentMgr and IEnumTfContexts
|
||||
* COPYRIGHT: Copyright 2009 Aric Stewart, CodeWeavers
|
||||
* Copyright 2025 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CDocumentMgr
|
||||
|
||||
class CDocumentMgr
|
||||
: public ITfDocumentMgr
|
||||
, public ITfSource
|
||||
{
|
||||
public:
|
||||
CDocumentMgr(ITfThreadMgrEventSink *threadMgrSink);
|
||||
virtual ~CDocumentMgr();
|
||||
|
||||
static HRESULT
|
||||
CreateInstance(
|
||||
_In_ ITfThreadMgrEventSink *pThreadMgrSink,
|
||||
_Out_ ITfDocumentMgr **ppOut);
|
||||
|
||||
// ** IUnknown methods **
|
||||
STDMETHODIMP QueryInterface(REFIID iid, LPVOID *ppvObject) override;
|
||||
STDMETHODIMP_(ULONG) AddRef() override;
|
||||
STDMETHODIMP_(ULONG) Release() override;
|
||||
|
||||
// ** ITfDocumentMgr methods **
|
||||
STDMETHODIMP CreateContext(
|
||||
TfClientId tidOwner,
|
||||
DWORD dwFlags,
|
||||
IUnknown *punk,
|
||||
ITfContext **ppic,
|
||||
TfEditCookie *pecTextStore) override;
|
||||
STDMETHODIMP Push(ITfContext *pic) override;
|
||||
STDMETHODIMP Pop(DWORD dwFlags) override;
|
||||
STDMETHODIMP GetTop(ITfContext **ppic) override;
|
||||
STDMETHODIMP GetBase(ITfContext **ppic) override;
|
||||
STDMETHODIMP EnumContexts(IEnumTfContexts **ppEnum) override;
|
||||
|
||||
// ** ITfSource methods **
|
||||
STDMETHODIMP AdviseSink(REFIID riid, IUnknown *punk, DWORD *pdwCookie) override;
|
||||
STDMETHODIMP UnadviseSink(DWORD pdwCookie) override;
|
||||
|
||||
friend class CEnumTfContext;
|
||||
|
||||
protected:
|
||||
LONG m_cRefs;
|
||||
ITfCompartmentMgr *m_pCompartmentMgr;
|
||||
ITfContext *m_contextStack[2]; // limit of 2 contexts
|
||||
ITfThreadMgrEventSink *m_pThreadMgrSink;
|
||||
struct list m_transitoryExtensionSink;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// CEnumTfContext
|
||||
|
||||
class CEnumTfContext
|
||||
: public IEnumTfContexts
|
||||
{
|
||||
public:
|
||||
CEnumTfContext(_In_opt_ CDocumentMgr *mgr);
|
||||
virtual ~CEnumTfContext();
|
||||
|
||||
static HRESULT CreateInstance(_In_opt_ CDocumentMgr *mgr, _Out_ IEnumTfContexts **ppOut);
|
||||
|
||||
// ** IUnknown methods **
|
||||
STDMETHODIMP QueryInterface(REFIID iid, LPVOID *ppvObject) override;
|
||||
STDMETHODIMP_(ULONG) AddRef() override;
|
||||
STDMETHODIMP_(ULONG) Release() override;
|
||||
|
||||
// ** IEnumTfContexts methods **
|
||||
STDMETHODIMP Next(ULONG ulCount, ITfContext **rgContext, ULONG *pcFetched) override;
|
||||
STDMETHODIMP Skip(ULONG celt) override;
|
||||
STDMETHODIMP Reset() override;
|
||||
STDMETHODIMP Clone(IEnumTfContexts **ppenum) override;
|
||||
|
||||
protected:
|
||||
LONG m_cRefs;
|
||||
DWORD m_index;
|
||||
CDocumentMgr *m_pDocMgr;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue