82 lines
2.1 KiB
C++
82 lines
2.1 KiB
C++
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
|
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
|
// PARTICULAR PURPOSE.
|
|
//
|
|
// Copyright (c) Microsoft Corporation. All rights reserved
|
|
|
|
#include "Private.h"
|
|
#include "globals.h"
|
|
#include "SampleIME.h"
|
|
#include "DisplayAttributeInfo.h"
|
|
#include "EnumDisplayAttributeInfo.h"
|
|
|
|
//+---------------------------------------------------------------------------
|
|
//
|
|
// ITfDisplayAttributeProvider::EnumDisplayAttributeInfo
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
STDAPI CSampleIME::EnumDisplayAttributeInfo(__RPC__deref_out_opt IEnumTfDisplayAttributeInfo **ppEnum)
|
|
{
|
|
CEnumDisplayAttributeInfo* pAttributeEnum = nullptr;
|
|
|
|
if (ppEnum == nullptr)
|
|
{
|
|
return E_INVALIDARG;
|
|
}
|
|
|
|
*ppEnum = nullptr;
|
|
|
|
pAttributeEnum = new (std::nothrow) CEnumDisplayAttributeInfo();
|
|
if (pAttributeEnum == nullptr)
|
|
{
|
|
return E_OUTOFMEMORY;
|
|
}
|
|
|
|
*ppEnum = pAttributeEnum;
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
//+---------------------------------------------------------------------------
|
|
//
|
|
// ITfDisplayAttributeProvider::GetDisplayAttributeInfo
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
STDAPI CSampleIME::GetDisplayAttributeInfo(__RPC__in REFGUID guidInfo, __RPC__deref_out_opt ITfDisplayAttributeInfo **ppInfo)
|
|
{
|
|
if (ppInfo == nullptr)
|
|
{
|
|
return E_INVALIDARG;
|
|
}
|
|
|
|
*ppInfo = nullptr;
|
|
|
|
// Which display attribute GUID?
|
|
if (IsEqualGUID(guidInfo, Global::SampleIMEGuidDisplayAttributeInput))
|
|
{
|
|
*ppInfo = new (std::nothrow) CDisplayAttributeInfoInput();
|
|
if ((*ppInfo) == nullptr)
|
|
{
|
|
return E_OUTOFMEMORY;
|
|
}
|
|
}
|
|
else if (IsEqualGUID(guidInfo, Global::SampleIMEGuidDisplayAttributeConverted))
|
|
{
|
|
*ppInfo = new (std::nothrow) CDisplayAttributeInfoConverted();
|
|
if ((*ppInfo) == nullptr)
|
|
{
|
|
return E_OUTOFMEMORY;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return E_INVALIDARG;
|
|
}
|
|
|
|
|
|
return S_OK;
|
|
}
|