OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 |
| 5 #ifndef CONTENT_COMMON_DWRITE_TEXT_ANALYSIS_SOURCE_WIN_H_ |
| 6 #define CONTENT_COMMON_DWRITE_TEXT_ANALYSIS_SOURCE_WIN_H_ |
| 7 |
| 8 #include <dwrite.h> |
| 9 #include <wrl.h> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" |
| 13 #include "content/common/content_export.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // Implements an IDWriteTextAnalysisSource, describing a single pre-defined |
| 18 // chunk of text with a uniform locale, reading direction, and number |
| 19 // substitution. |
| 20 class CONTENT_EXPORT TextAnalysisSource |
| 21 : public Microsoft::WRL::RuntimeClass< |
| 22 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, |
| 23 IDWriteTextAnalysisSource> { |
| 24 public: |
| 25 TextAnalysisSource(); |
| 26 |
| 27 // IDWriteTextAnalysisSource: |
| 28 HRESULT STDMETHODCALLTYPE GetLocaleName(UINT32 text_position, |
| 29 UINT32* text_length, |
| 30 const WCHAR** locale_name) override; |
| 31 HRESULT STDMETHODCALLTYPE GetNumberSubstitution( |
| 32 UINT32 text_position, |
| 33 UINT32* text_length, |
| 34 IDWriteNumberSubstitution** number_substitution) override; |
| 35 DWRITE_READING_DIRECTION STDMETHODCALLTYPE |
| 36 GetParagraphReadingDirection() override; |
| 37 HRESULT STDMETHODCALLTYPE GetTextAtPosition(UINT32 text_position, |
| 38 const WCHAR** text_string, |
| 39 UINT32* text_length) override; |
| 40 HRESULT STDMETHODCALLTYPE GetTextBeforePosition(UINT32 text_position, |
| 41 const WCHAR** text_string, |
| 42 UINT32* text_length) override; |
| 43 |
| 44 HRESULT STDMETHODCALLTYPE |
| 45 RuntimeClassInitialize(const base::string16& text, |
| 46 const base::string16& locale_name, |
| 47 IDWriteNumberSubstitution* number_substitution, |
| 48 DWRITE_READING_DIRECTION reading_direction); |
| 49 |
| 50 protected: |
| 51 ~TextAnalysisSource() override; |
| 52 |
| 53 private: |
| 54 base::string16 text_; |
| 55 base::string16 locale_name_; |
| 56 Microsoft::WRL::ComPtr<IDWriteNumberSubstitution> number_substitution_; |
| 57 DWRITE_READING_DIRECTION reading_direction_; |
| 58 |
| 59 DISALLOW_ASSIGN(TextAnalysisSource); |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_COMMON_DWRITE_TEXT_ANALYSIS_SOURCE_WIN_H_ |
OLD | NEW |