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/fpdfapi/fpdf_font/include/cpdf_font.h" | 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
8 #include "core/fpdfdoc/cpvt_wordinfo.h" | 8 #include "core/fpdfdoc/cpvt_wordinfo.h" |
9 #include "core/fpdfdoc/csection.h" | 9 #include "core/fpdfdoc/csection.h" |
10 #include "core/fpdfdoc/include/cpdf_variabletext.h" | 10 #include "core/fpdfdoc/include/cpdf_variabletext.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 m_bLimitWidth(FALSE), | 249 m_bLimitWidth(FALSE), |
250 m_bAutoFontSize(FALSE), | 250 m_bAutoFontSize(FALSE), |
251 m_nAlignment(0), | 251 m_nAlignment(0), |
252 m_fLineLeading(0.0f), | 252 m_fLineLeading(0.0f), |
253 m_fCharSpace(0.0f), | 253 m_fCharSpace(0.0f), |
254 m_nHorzScale(100), | 254 m_nHorzScale(100), |
255 m_wSubWord(0), | 255 m_wSubWord(0), |
256 m_fFontSize(0.0f), | 256 m_fFontSize(0.0f), |
257 m_bInitial(FALSE), | 257 m_bInitial(FALSE), |
258 m_bRichText(FALSE), | 258 m_bRichText(FALSE), |
259 m_pVTProvider(nullptr), | 259 m_pVTProvider(nullptr) {} |
260 m_pVTIterator(nullptr) {} | |
261 | 260 |
262 CPDF_VariableText::~CPDF_VariableText() { | 261 CPDF_VariableText::~CPDF_VariableText() { |
263 delete m_pVTIterator; | |
264 ResetAll(); | 262 ResetAll(); |
265 } | 263 } |
266 | 264 |
267 void CPDF_VariableText::Initialize() { | 265 void CPDF_VariableText::Initialize() { |
268 if (!m_bInitial) { | 266 if (!m_bInitial) { |
269 CPVT_SectionInfo secinfo; | 267 CPVT_SectionInfo secinfo; |
270 if (m_bRichText) { | 268 if (m_bRichText) { |
271 secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); | 269 secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); |
272 secinfo.pWordProps = new CPVT_WordProps( | 270 secinfo.pWordProps = new CPVT_WordProps( |
273 GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0); | 271 GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0); |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 int32_t CPDF_VariableText::GetDefaultFontIndex() { | 1140 int32_t CPDF_VariableText::GetDefaultFontIndex() { |
1143 return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; | 1141 return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; |
1144 } | 1142 } |
1145 | 1143 |
1146 FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) { | 1144 FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) { |
1147 return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE; | 1145 return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE; |
1148 } | 1146 } |
1149 | 1147 |
1150 CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() { | 1148 CPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() { |
1151 if (!m_pVTIterator) | 1149 if (!m_pVTIterator) |
1152 m_pVTIterator = new CPDF_VariableText::Iterator(this); | 1150 m_pVTIterator.reset(new CPDF_VariableText::Iterator(this)); |
1153 return m_pVTIterator; | 1151 return m_pVTIterator.get(); |
1154 } | 1152 } |
1155 | 1153 |
1156 void CPDF_VariableText::SetProvider(CPDF_VariableText::Provider* pProvider) { | 1154 void CPDF_VariableText::SetProvider(CPDF_VariableText::Provider* pProvider) { |
1157 m_pVTProvider = pProvider; | 1155 m_pVTProvider = pProvider; |
1158 } | 1156 } |
OLD | NEW |