1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #ifndef UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_
5 #define UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_
9 #include <UIAutomationCore.h>
11 #include "base/compiler_specific.h"
12 #include "base/strings/string16.h"
13 #include "ui/base/ui_base_export.h"
18 // UIA Text provider implementation for edit controls.
19 class UI_BASE_EXPORT UIATextProvider
20 : public NON_EXPORTED_BASE(CComObjectRootEx
<CComMultiThreadModel
>),
21 public IValueProvider
,
22 public ITextProvider
{
24 BEGIN_COM_MAP(UIATextProvider
)
25 COM_INTERFACE_ENTRY2(IUnknown
, ITextProvider
)
26 COM_INTERFACE_ENTRY(IValueProvider
)
27 COM_INTERFACE_ENTRY(ITextProvider
)
32 // Creates an instance of the UIATextProvider class.
33 // Returns true on success
34 static bool CreateTextProvider(const string16
& value
,
38 void set_editable(bool editable
) {
42 void set_value(const string16
& value
) { value_
= value
; }
45 // IValueProvider methods.
47 STDMETHOD(get_IsReadOnly
)(BOOL
* read_only
) override
;
50 // IValueProvider methods not implemented.
52 STDMETHOD(SetValue
)(const wchar_t* val
) override
{ return E_NOTIMPL
; }
54 STDMETHOD(get_Value
)(BSTR
* value
) override
;
57 // ITextProvider methods.
59 STDMETHOD(GetSelection
)(SAFEARRAY
** ret
) override
{ return E_NOTIMPL
; }
61 STDMETHOD(GetVisibleRanges
)(SAFEARRAY
** ret
) override
{ return E_NOTIMPL
; }
63 STDMETHOD(RangeFromChild
)(IRawElementProviderSimple
* child
,
64 ITextRangeProvider
** ret
) override
{
68 STDMETHOD(RangeFromPoint
)(struct UiaPoint point
,
69 ITextRangeProvider
** ret
) override
{
73 STDMETHOD(get_DocumentRange
)(ITextRangeProvider
** ret
) override
{
77 STDMETHOD(get_SupportedTextSelection
)(
78 enum SupportedTextSelection
* ret
) override
{
90 #endif // UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_