本文整理汇总了C++中ITfRange::ShiftStartToRange方法的典型用法代码示例。如果您正苦于以下问题:C++ ITfRange::ShiftStartToRange方法的具体用法?C++ ITfRange::ShiftStartToRange怎么用?C++ ITfRange::ShiftStartToRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITfRange
的用法示例。
在下文中一共展示了ITfRange::ShiftStartToRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _SetText
HRESULT CTextService::_SetText(TfEditCookie ec, ITfContext *pContext, const std::wstring &text, LONG cchCursor, LONG cchOkuri, BOOL fixed)
{
TF_SELECTION tfSelection;
ULONG cFetched = 0;
LONG cch, cchRes;
if(pContext == NULL && _pCandidateList != NULL) //辞書登録用
{
_pCandidateList->_SetText(text, fixed, FALSE, FALSE);
return S_OK;
}
if(!_IsComposing())
{
if(!_StartComposition(pContext))
{
return S_FALSE;
}
}
if(pContext->GetSelection(ec, TF_DEFAULT_SELECTION, 1, &tfSelection, &cFetched) != S_OK)
{
return S_FALSE;
}
if(cFetched != 1)
{
SafeRelease(&tfSelection.range);
return S_FALSE;
}
ITfRange *pRange;
if(_IsComposing() && _pComposition->GetRange(&pRange) == S_OK)
{
if(_IsRangeCovered(ec, tfSelection.range, pRange))
{
pRange->SetText(ec, 0, text.c_str(), (LONG)text.size());
// shift from end to start.
// shift over mathematical operators (U+2200-U+22FF) is rejected by OneNote.
if(cchCursor == 0)
{
cchRes = (LONG)cursoridx - (LONG)kana.size();
if((complement && okuriidx != 0) ||
(!cx_showmodemark && okuriidx != 0 && cursoridx <= okuriidx && cursoridx < kana.size()))
{
cchRes += 1;
}
}
else
{
cchRes = cchCursor - (LONG)text.size();
if(cchRes > 0)
{
cchRes = 0;
}
else if(cchRes < -(LONG)text.size())
{
cchRes = -(LONG)text.size();
}
}
tfSelection.range->ShiftEndToRange(ec, pRange, TF_ANCHOR_END);
tfSelection.range->ShiftStartToRange(ec, pRange, TF_ANCHOR_END);
tfSelection.range->ShiftStart(ec, cchRes, &cch, NULL);
//decide cursor position
tfSelection.range->Collapse(ec, TF_ANCHOR_START);
pContext->SetSelection(ec, 1, &tfSelection);
//composition attribute
if(!fixed)
{
ITfRange *pRangeClone;
if(pRange->Clone(&pRangeClone) == S_OK)
{
pRangeClone->ShiftEndToRange(ec, pRange, TF_ANCHOR_END);
pRangeClone->ShiftStartToRange(ec, pRange, TF_ANCHOR_START);
if(cchCursor == 0 || !showentry)
{
if(inputkey)
{
_SetCompositionDisplayAttributes(ec, pContext, pRangeClone, _gaDisplayAttributeInputMark);
if(cx_showmodemark)
{
pRangeClone->ShiftStart(ec, 1, &cch, NULL);
}
}
if(!display_attribute_series[1] || !inputkey)
{
_SetCompositionDisplayAttributes(ec, pContext, pRangeClone, _gaDisplayAttributeInputText);
}
if(cchOkuri != 0)
{
pRangeClone->ShiftStartToRange(ec, pRange, TF_ANCHOR_START);
pRangeClone->ShiftStart(ec, cchOkuri, &cch, NULL);
if(!display_attribute_series[2])
{
//.........这里部分代码省略.........