| Index: win8/metro_driver/ime/text_store.h
|
| diff --git a/ui/base/ime/win/tsf_text_store.h b/win8/metro_driver/ime/text_store.h
|
| similarity index 87%
|
| copy from ui/base/ime/win/tsf_text_store.h
|
| copy to win8/metro_driver/ime/text_store.h
|
| index 87cd6b42991ed09c07ef272d1781d9d01c37cd76..e2aa3d6323fe253e799cf767934ef171fa073dc1 100644
|
| --- a/ui/base/ime/win/tsf_text_store.h
|
| +++ b/win8/metro_driver/ime/text_store.h
|
| @@ -2,22 +2,24 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef UI_BASE_IME_WIN_TSF_TEXT_STORE_H_
|
| -#define UI_BASE_IME_WIN_TSF_TEXT_STORE_H_
|
| +#ifndef WIN8_METRO_DRIVER_IME_TEXT_STORE_H_
|
| +#define WIN8_METRO_DRIVER_IME_TEXT_STORE_H_
|
|
|
| +#include <inputscope.h>
|
| #include <msctf.h>
|
| +
|
| #include <deque>
|
| +#include <vector>
|
|
|
| #include "base/basictypes.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/strings/string16.h"
|
| #include "base/win/scoped_comptr.h"
|
| -#include "ui/base/ime/composition_underline.h"
|
| -#include "ui/base/ui_export.h"
|
| -#include "ui/gfx/range/range.h"
|
| +#include "ui/metro_viewer/ime_types.h"
|
| +
|
| +namespace metro_driver {
|
|
|
| -namespace ui {
|
| -class TextInputClient;
|
| +class TextStoreDelegate;
|
|
|
| // TSFTextStore is used to interact with the input method via TSF manager.
|
| // TSFTextStore have a string buffer which is manipulated by TSF manager through
|
| @@ -81,11 +83,14 @@ class TextInputClient;
|
| //
|
| // More information about TSF can be found here:
|
| // http://msdn.microsoft.com/en-us/library/ms629032
|
| -class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| - public ITfContextOwnerCompositionSink,
|
| - public ITfTextEditSink {
|
| +// TODO(yukawa): Rename TSFTextStore to TextStore.
|
| +class TSFTextStore : public ITextStoreACP,
|
| + public ITfContextOwnerCompositionSink,
|
| + public ITfTextEditSink {
|
| public:
|
| - TSFTextStore();
|
| + TSFTextStore(HWND window_handle,
|
| + const std::vector<InputScope>& input_scopes,
|
| + TextStoreDelegate* delegate);
|
| virtual ~TSFTextStore();
|
|
|
| // ITextStoreACP:
|
| @@ -196,12 +201,6 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| STDMETHOD(OnEndEdit)(ITfContext* context, TfEditCookie read_only_edit_cookie,
|
| ITfEditRecord* edit_record) OVERRIDE;
|
|
|
| - // Sets currently focused TextInputClient.
|
| - void SetFocusedTextInputClient(HWND focused_window,
|
| - TextInputClient* text_input_client);
|
| - // Removes currently focused TextInputClient.
|
| - void RemoveFocusedTextInputClient(TextInputClient* text_input_client);
|
| -
|
| // Cancels the ongoing composition if exists.
|
| bool CancelComposition();
|
|
|
| @@ -212,9 +211,6 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| void SendOnLayoutChange();
|
|
|
| private:
|
| - friend class TSFTextStoreTest;
|
| - friend class TSFTextStoreTestCallback;
|
| -
|
| // Checks if the document has a read-only lock.
|
| bool HasReadLock() const;
|
|
|
| @@ -226,10 +222,11 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| TF_DISPLAYATTRIBUTE* attribute);
|
|
|
| // Gets the committed string size and underline information of the context.
|
| - bool GetCompositionStatus(ITfContext* context,
|
| - const TfEditCookie read_only_edit_cookie,
|
| - size_t* committed_size,
|
| - CompositionUnderlines* undelines);
|
| + bool GetCompositionStatus(
|
| + ITfContext* context,
|
| + const TfEditCookie read_only_edit_cookie,
|
| + size_t* committed_size,
|
| + std::vector<metro_viewer::UnderlineInfo>* undelines);
|
|
|
| // The refrence count of this instance.
|
| volatile LONG ref_count_;
|
| @@ -240,11 +237,11 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| // The current mask of |text_store_acp_sink_|.
|
| DWORD text_store_acp_sink_mask_;
|
|
|
| - // HWND of the current view window which is set in SetFocusedTextInputClient.
|
| + // HWND of the attached window.
|
| HWND window_handle_;
|
|
|
| - // Current TextInputClient which is set in SetFocusedTextInputClient.
|
| - TextInputClient* text_input_client_;
|
| + // The delegate attached to this text store.
|
| + TextStoreDelegate* delegate_;
|
|
|
| // |string_buffer_| contains committed string and composition string.
|
| // Example: "aoi" is committed, and "umi" is under composition.
|
| @@ -256,20 +253,21 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| // |selection_start_| and |selection_end_| indicates the selection range.
|
| // Example: "iue" is selected
|
| // |string_buffer_|: "aiueo"
|
| - // |selection_.start()|: 1
|
| - // |selection_.end()|: 4
|
| - gfx::Range selection_;
|
| + // |selection_start_|: 1
|
| + // |selection_end_|: 4
|
| + size_t selection_start_;
|
| + size_t selection_end_;
|
|
|
| // |start_offset| and |end_offset| of |composition_undelines_| indicates
|
| // the offsets in |string_buffer_|.
|
| // Example: "aoi" is committed. There are two underlines in "umi" and "no".
|
| // |string_buffer_|: "aoiumino"
|
| // |committed_size_|: 3
|
| - // composition_undelines_.underlines[0].start_offset: 3
|
| - // composition_undelines_.underlines[0].end_offset: 6
|
| - // composition_undelines_.underlines[1].start_offset: 6
|
| - // composition_undelines_.underlines[1].end_offset: 8
|
| - CompositionUnderlines composition_undelines_;
|
| + // underlines_[0].start_offset: 3
|
| + // underlines_[0].end_offset: 6
|
| + // underlines_[1].start_offset: 6
|
| + // underlines_[1].end_offset: 8
|
| + std::vector<metro_viewer::UnderlineInfo> underlines_;
|
|
|
| // |edit_flag_| indicates that the status is edited during
|
| // ITextStoreACPSink::OnLockGranted().
|
| @@ -289,9 +287,12 @@ class UI_EXPORT TSFTextStore : public ITextStoreACP,
|
| base::win::ScopedComPtr<ITfCategoryMgr> category_manager_;
|
| base::win::ScopedComPtr<ITfDisplayAttributeMgr> display_attribute_manager_;
|
|
|
| + // Represents the context information of this text.
|
| + base::win::ScopedComPtr<ITfInputScope> input_scope_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(TSFTextStore);
|
| };
|
|
|
| -} // namespace ui
|
| +} // namespace metro_driver
|
|
|
| -#endif // UI_BASE_IME_WIN_TSF_TEXT_STORE_H_
|
| +#endif // WIN8_METRO_DRIVER_IME_TEXT_STORE_H_
|
|
|