OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdftext/cpdf_textpagefind.h" | 7 #include "core/fpdftext/cpdf_textpagefind.h" |
8 | 8 |
9 #include <cwchar> | 9 #include <cwchar> |
10 #include <cwctype> | 10 #include <cwctype> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 m_bMatchCase = flags & FPDFTEXT_MATCHCASE; | 94 m_bMatchCase = flags & FPDFTEXT_MATCHCASE; |
95 if (m_strText.IsEmpty()) { | 95 if (m_strText.IsEmpty()) { |
96 m_IsFind = FALSE; | 96 m_IsFind = FALSE; |
97 return TRUE; | 97 return TRUE; |
98 } | 98 } |
99 FX_STRSIZE len = findwhatStr.GetLength(); | 99 FX_STRSIZE len = findwhatStr.GetLength(); |
100 if (!m_bMatchCase) { | 100 if (!m_bMatchCase) { |
101 findwhatStr.MakeLower(); | 101 findwhatStr.MakeLower(); |
102 m_strText.MakeLower(); | 102 m_strText.MakeLower(); |
103 } | 103 } |
104 m_bMatchWholeWord = flags & FPDFTEXT_MATCHWHOLEWORD; | 104 m_bMatchWholeWord = !!(flags & FPDFTEXT_MATCHWHOLEWORD); |
105 m_findNextStart = startPos; | 105 m_findNextStart = startPos; |
106 if (startPos == -1) | 106 if (startPos == -1) |
107 m_findPreStart = m_strText.GetLength() - 1; | 107 m_findPreStart = m_strText.GetLength() - 1; |
108 else | 108 else |
109 m_findPreStart = startPos; | 109 m_findPreStart = startPos; |
110 m_csFindWhatArray.clear(); | 110 m_csFindWhatArray.clear(); |
111 int i = 0; | 111 int i = 0; |
112 while (i < len) { | 112 while (i < len) { |
113 if (findwhatStr.GetAt(i) != ' ') | 113 if (findwhatStr.GetAt(i) != ' ') |
114 break; | 114 break; |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 int CPDF_TextPageFind::GetCurOrder() const { | 399 int CPDF_TextPageFind::GetCurOrder() const { |
400 return GetCharIndex(m_resStart); | 400 return GetCharIndex(m_resStart); |
401 } | 401 } |
402 | 402 |
403 int CPDF_TextPageFind::GetMatchedCount() const { | 403 int CPDF_TextPageFind::GetMatchedCount() const { |
404 int resStart = GetCharIndex(m_resStart); | 404 int resStart = GetCharIndex(m_resStart); |
405 int resEnd = GetCharIndex(m_resEnd); | 405 int resEnd = GetCharIndex(m_resEnd); |
406 return resEnd - resStart + 1; | 406 return resEnd - resStart + 1; |
407 } | 407 } |
OLD | NEW |