本文整理汇总了C++中ITfRange::QueryInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ ITfRange::QueryInterface方法的具体用法?C++ ITfRange::QueryInterface怎么用?C++ ITfRange::QueryInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITfRange
的用法示例。
在下文中一共展示了ITfRange::QueryInterface方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SUCCEEDED
STDAPI touchmind::control::DWriteEditControlTextEditSink::OnEndEdit(ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord)
{
std::shared_ptr<control::DWriteEditControl> pEditControl = m_pEditControl.lock();
DisplayAttributeProperties dispAttrProps;
HRESULT hr = m_displayAttribute.GetDisplayAttributeProperties(dispAttrProps);
if (SUCCEEDED(hr)) {
IEnumTfRanges *pEnum;
hr = pEditRecord->GetTextAndPropertyUpdates(TF_GTP_INCL_TEXT,
dispAttrProps.GetPropTablePointer(),
static_cast<ULONG>(dispAttrProps.Count()),
&pEnum);
if (SUCCEEDED(hr) && pEnum) {
ITfRange *pRange;
if (pEnum->Next(1, &pRange, nullptr) == S_OK) {
pRange->Release();
pEditControl->ClearCompositionRenderInfo();
ITfRange *pRangeEntire = nullptr;
ITfRange *pRangeEnd = nullptr;
if (SUCCEEDED(pic->GetStart(ecReadOnly, &pRangeEntire)) &&
SUCCEEDED(pic->GetEnd(ecReadOnly, &pRangeEnd)) &&
SUCCEEDED(pRangeEntire->ShiftEndToRange(ecReadOnly, pRangeEnd, TF_ANCHOR_END))) {
IEnumTfRanges *pEnumRanges;
ITfReadOnlyProperty *pProp = nullptr;
m_displayAttribute.GetDisplayAttributeTrackPropertyRange(pic, dispAttrProps, &pProp);
if (SUCCEEDED(pProp->EnumRanges(ecReadOnly, &pEnumRanges, pRangeEntire))) {
while (pEnumRanges->Next(1, &pRange, nullptr) == S_OK) {
TF_DISPLAYATTRIBUTE da;
ZeroMemory(&da, sizeof(da));
TfGuidAtom guid;
if (m_displayAttribute.GetDisplayAttributeData(ecReadOnly, pProp, pRange, &da, &guid) == S_OK) {
ITfRangeACP *pRangeACP;
if (pRange->QueryInterface(IID_ITfRangeACP, (void **)&pRangeACP) == S_OK) {
LONG nStart;
LONG nEnd;
pRangeACP->GetExtent(&nStart, &nEnd);
pEditControl->AddCompositionRenderInfo(nStart, nStart + nEnd, &da);
pRangeACP->Release();
}
}
}
}
}
if (pRangeEntire) {
pRangeEntire->Release();
}
if (pRangeEnd) {
pRangeEnd->Release();
}
}
pEnum->Release();
}
}
return S_OK;
}
示例2: OnEndEdit
STDAPI CTextEditSink::OnEndEdit(ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord)
{
CDispAttrProps *pDispAttrProps = GetDispAttrProps();
if (pDispAttrProps)
{
IEnumTfRanges *pEnum;
if (SUCCEEDED(pEditRecord->GetTextAndPropertyUpdates(TF_GTP_INCL_TEXT,
pDispAttrProps->GetPropTablePointer(),
pDispAttrProps->Count(),
&pEnum)) && pEnum)
{
ITfRange *pRange;
if (pEnum->Next(1, &pRange, NULL) == S_OK)
{
// We check if there is a range to be changed.
pRange->Release();
_pEditor->ClearCompositionRenderInfo();
// We read the display attribute for entire range.
// It could be optimized by filtering the only delta with ITfEditRecord interface.
ITfRange *pRangeEntire = NULL;
ITfRange *pRangeEnd = NULL;
if (SUCCEEDED(pic->GetStart(ecReadOnly, &pRangeEntire)) &&
SUCCEEDED(pic->GetEnd(ecReadOnly, &pRangeEnd)) &&
SUCCEEDED(pRangeEntire->ShiftEndToRange(ecReadOnly, pRangeEnd, TF_ANCHOR_END)))
{
IEnumTfRanges *pEnumRanges;
ITfReadOnlyProperty *pProp = NULL;
GetDisplayAttributeTrackPropertyRange(ecReadOnly, pic, pRangeEntire, &pProp, pDispAttrProps);
if (SUCCEEDED(pProp->EnumRanges(ecReadOnly, &pEnumRanges, pRangeEntire)))
{
while (pEnumRanges->Next(1, &pRange, NULL) == S_OK)
{
TF_DISPLAYATTRIBUTE da;
TfGuidAtom guid;
if (GetDisplayAttributeData(ecReadOnly, pProp, pRange, &da, &guid) == S_OK)
{
ITfRangeACP *pRangeACP;
if (pRange->QueryInterface(IID_ITfRangeACP, (void **)&pRangeACP) == S_OK)
{
LONG nStart;
LONG nEnd;
pRangeACP->GetExtent(&nStart, &nEnd);
_pEditor->AddCompositionRenderInfo(nStart, nStart + nEnd, &da);
pRangeACP->Release();
}
}
}
}
}
if (pRangeEntire)
pRangeEntire->Release();
if (pRangeEnd)
pRangeEnd->Release();
}
pEnum->Release();
}
delete pDispAttrProps;
}
return S_OK;
}