-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGetTextExtentEditSession.cpp
47 lines (40 loc) · 1.64 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
// 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 "EditSession.h"
#include "GetTextExtentEditSession.h"
#include "TfTextLayoutSink.h"
//+---------------------------------------------------------------------------
//
// ctor
//
//----------------------------------------------------------------------------
CGetTextExtentEditSession::CGetTextExtentEditSession(_In_ CSampleIME *pTextService, _In_ ITfContext *pContext,
_In_ ITfContextView *pContextView,
_In_ ITfRange *pRangeComposition,
_In_ CTfTextLayoutSink *pTfTextLayoutSink)
: CEditSessionBase(pTextService, pContext)
{
_pContextView = pContextView;
_pRangeComposition = pRangeComposition;
_pTfTextLayoutSink = pTfTextLayoutSink;
}
//+---------------------------------------------------------------------------
//
// ITfEditSession::DoEditSession
//
//----------------------------------------------------------------------------
STDAPI CGetTextExtentEditSession::DoEditSession(TfEditCookie ec)
{
RECT rc = {0, 0, 0, 0};
BOOL isClipped = TRUE;
if (SUCCEEDED(_pContextView->GetTextExt(ec, _pRangeComposition, &rc, &isClipped)))
{
_pTfTextLayoutSink->_LayoutChangeNotification(&rc);
}
return S_OK;
}