forked from jrywu/DIME
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetTextExtentEditSession.cpp
50 lines (40 loc) · 1.51 KB
/
GetTextExtentEditSession.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
//
// Derived from Microsoft Sample IME by Jeremy '13,7,17
//
//
#include "Private.h"
#include "EditSession.h"
#include "GetTextExtentEditSession.h"
#include "TfTextLayoutSink.h"
#include "DIME.h"
//+---------------------------------------------------------------------------
//
// ctor
//
//----------------------------------------------------------------------------
CGetTextExtentEditSession::CGetTextExtentEditSession(_In_ CDIME *pTextService, _In_ ITfContext *pContext, _In_ ITfContextView *pContextView, _In_ ITfRange *pRangeComposition, _In_ CTfTextLayoutSink *pTfTextLayoutSink) : CEditSessionBase(pTextService, pContext)
{
debugPrint(L"CGetTextExtentEditSession::CGetTextExtentEditSession(): pContext = %x, pTfTextLayoutSink = %x \n",pContext, pTfTextLayoutSink);
_pTextService = pTextService;
_pContextView = pContextView;
_pRangeComposition = pRangeComposition;
_pTfTextLayoutSink = pTfTextLayoutSink;
}
//+---------------------------------------------------------------------------
//
// ITfEditSession::DoEditSession
//
//----------------------------------------------------------------------------
STDAPI CGetTextExtentEditSession::DoEditSession(TfEditCookie ec)
{
debugPrint(L"CGetTextExtentEditSession::DoEditSession() ec = %x \n", ec);
RECT rc = {0, 0, 0, 0};
BOOL isClipped = TRUE;
if (SUCCEEDED(_pContextView->GetTextExt(ec, _pRangeComposition, &rc, &isClipped)))
{
if(_pTfTextLayoutSink)
_pTfTextLayoutSink->_LayoutChangeNotification(&rc);
}
return S_OK;
}