-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComposition.cpp
More file actions
73 lines (61 loc) · 1.9 KB
/
Composition.cpp
File metadata and controls
73 lines (61 loc) · 1.9 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//////////////////////////////////////////////////////////////////////
//
// 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) 2003 Microsoft Corporation. All rights reserved.
//
// Composition.cpp
//
// ITfCompositionSink interface and compositon utilities
//
//////////////////////////////////////////////////////////////////////
#include "Globals.h"
#include "TextService.h"
//+---------------------------------------------------------------------------
//
// OnCompositionTerminated
//
// Callback for ITfCompositionSink. The system calls this method whenever
// someone other than this service ends a composition.
//----------------------------------------------------------------------------
STDAPI CTextService::OnCompositionTerminated(TfEditCookie ecWrite, ITfComposition *pComposition)
{
// releae our cached composition
if (_pComposition != NULL)
{
_pComposition->Release();
_pComposition = NULL;
}
_ResetCompositionState();
return S_OK;
}
//+---------------------------------------------------------------------------
//
// _IsComposing
//
//----------------------------------------------------------------------------
BOOL CTextService::_IsComposing()
{
return _pComposition != NULL;
}
//+---------------------------------------------------------------------------
//
// _SetComposition
//
//----------------------------------------------------------------------------
void CTextService::_SetComposition(ITfComposition *pComposition)
{
_pComposition = pComposition;
if (pComposition != NULL)
{
_compositionState.Begin();
_compositionPhase = _compositionState.GetPhase();
}
else
{
_ResetCompositionState();
}
}