Home | History | Annotate | Download | only in win
      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_
      6 
      7 #include <atlbase.h>
      8 #include <atlcom.h>
      9 #include <UIAutomationCore.h>
     10 
     11 #include "base/compiler_specific.h"
     12 #include "ui/base/ui_export.h"
     13 
     14 namespace base {
     15 namespace win {
     16 
     17   // UIA Text provider implementation for edit controls.
     18 class UI_EXPORT UIATextProvider
     19     : public NON_EXPORTED_BASE(CComObjectRootEx<CComMultiThreadModel>),
     20       public IValueProvider,
     21       public ITextProvider {
     22  public:
     23   BEGIN_COM_MAP(UIATextProvider)
     24     COM_INTERFACE_ENTRY2(IUnknown, ITextProvider)
     25     COM_INTERFACE_ENTRY(IValueProvider)
     26     COM_INTERFACE_ENTRY(ITextProvider)
     27   END_COM_MAP()
     28 
     29   UIATextProvider();
     30 
     31   // Creates an instance of the UIATextProvider class.
     32   // Returns true on success
     33   static bool CreateTextProvider(bool editable, IUnknown** provider);
     34 
     35   void set_editable(bool editable) {
     36     editable_ = editable;
     37   }
     38 
     39   //
     40   // IValueProvider methods.
     41   //
     42   STDMETHOD(get_IsReadOnly)(BOOL* read_only);
     43 
     44   //
     45   // IValueProvider methods not implemented.
     46   //
     47   STDMETHOD(SetValue)(const wchar_t* val) {
     48     return E_NOTIMPL;
     49   }
     50 
     51   STDMETHOD(get_Value)(BSTR* value) {
     52     return E_NOTIMPL;
     53   }
     54 
     55   //
     56   // ITextProvider methods.
     57   //
     58   STDMETHOD(GetSelection)(SAFEARRAY** ret) {
     59     return E_NOTIMPL;
     60   }
     61 
     62   STDMETHOD(GetVisibleRanges)(SAFEARRAY** ret) {
     63     return E_NOTIMPL;
     64   }
     65 
     66   STDMETHOD(RangeFromChild)(IRawElementProviderSimple* child,
     67                             ITextRangeProvider** ret) {
     68     return E_NOTIMPL;
     69   }
     70 
     71   STDMETHOD(RangeFromPoint)(struct UiaPoint point,
     72                             ITextRangeProvider** ret) {
     73     return E_NOTIMPL;
     74   }
     75 
     76   STDMETHOD(get_DocumentRange)(ITextRangeProvider** ret) {
     77     return E_NOTIMPL;
     78   }
     79 
     80   STDMETHOD(get_SupportedTextSelection)(enum SupportedTextSelection* ret) {
     81     return E_NOTIMPL;
     82   }
     83 
     84  private:
     85   bool editable_;
     86 };
     87 
     88 }  // win
     89 }  // base
     90 
     91 #endif  // UI_BASE_WIN_ACCESSIBILITY_MISC_UTILS_H_
     92