OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/include/fpdfdoc/fpdf_doc.h" | 9 #include "core/include/fpdfdoc/fpdf_doc.h" |
10 | 10 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 if (m_pWidgetDict->KeyExist("A")) { | 240 if (m_pWidgetDict->KeyExist("A")) { |
241 return CPDF_Action(m_pWidgetDict->GetDictBy("A")); | 241 return CPDF_Action(m_pWidgetDict->GetDictBy("A")); |
242 } | 242 } |
243 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A"); | 243 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "A"); |
244 if (!pObj) { | 244 if (!pObj) { |
245 return CPDF_Action(); | 245 return CPDF_Action(); |
246 } | 246 } |
247 return CPDF_Action(pObj->GetDict()); | 247 return CPDF_Action(pObj->GetDict()); |
248 } | 248 } |
| 249 |
249 CPDF_AAction CPDF_FormControl::GetAdditionalAction() { | 250 CPDF_AAction CPDF_FormControl::GetAdditionalAction() { |
250 if (!m_pWidgetDict) { | 251 if (!m_pWidgetDict) |
251 return nullptr; | 252 return CPDF_AAction(); |
252 } | 253 |
253 if (m_pWidgetDict->KeyExist("AA")) { | 254 if (m_pWidgetDict->KeyExist("AA")) |
254 return m_pWidgetDict->GetDictBy("AA"); | 255 return CPDF_AAction(m_pWidgetDict->GetDictBy("AA")); |
255 } | |
256 return m_pField->GetAdditionalAction(); | 256 return m_pField->GetAdditionalAction(); |
257 } | 257 } |
| 258 |
258 CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() { | 259 CPDF_DefaultAppearance CPDF_FormControl::GetDefaultAppearance() { |
259 if (!m_pWidgetDict) { | 260 if (!m_pWidgetDict) |
260 return CFX_ByteString(); | 261 return CPDF_DefaultAppearance(); |
261 } | 262 |
262 if (m_pWidgetDict->KeyExist("DA")) { | 263 if (m_pWidgetDict->KeyExist("DA")) |
263 return m_pWidgetDict->GetStringBy("DA"); | 264 return CPDF_DefaultAppearance(m_pWidgetDict->GetStringBy("DA")); |
264 } | 265 |
265 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA"); | 266 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "DA"); |
266 if (!pObj) { | 267 if (pObj) |
267 return m_pField->m_pForm->GetDefaultAppearance(); | 268 return CPDF_DefaultAppearance(pObj->GetString()); |
268 } | 269 return m_pField->m_pForm->GetDefaultAppearance(); |
269 return pObj->GetString(); | |
270 } | 270 } |
271 | 271 |
272 CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { | 272 CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { |
273 CPDF_DefaultAppearance cDA = GetDefaultAppearance(); | 273 CPDF_DefaultAppearance cDA = GetDefaultAppearance(); |
274 CFX_ByteString csFontNameTag; | 274 CFX_ByteString csFontNameTag; |
275 FX_FLOAT fFontSize; | 275 FX_FLOAT fFontSize; |
276 cDA.GetFont(csFontNameTag, fFontSize); | 276 cDA.GetFont(csFontNameTag, fFontSize); |
277 if (csFontNameTag.IsEmpty()) | 277 if (csFontNameTag.IsEmpty()) |
278 return nullptr; | 278 return nullptr; |
279 | 279 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 CFX_WideString CPDF_ApSettings::GetCaption( | 414 CFX_WideString CPDF_ApSettings::GetCaption( |
415 const CFX_ByteStringC& csEntry) const { | 415 const CFX_ByteStringC& csEntry) const { |
416 return m_pDict ? m_pDict->GetUnicodeTextBy(csEntry) : CFX_WideString(); | 416 return m_pDict ? m_pDict->GetUnicodeTextBy(csEntry) : CFX_WideString(); |
417 } | 417 } |
418 | 418 |
419 CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const { | 419 CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const { |
420 return m_pDict ? m_pDict->GetStreamBy(csEntry) : nullptr; | 420 return m_pDict ? m_pDict->GetStreamBy(csEntry) : nullptr; |
421 } | 421 } |
422 | 422 |
423 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { | 423 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { |
424 return m_pDict ? m_pDict->GetDictBy("IF") : nullptr; | 424 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr); |
425 } | 425 } |
426 | 426 |
427 int CPDF_ApSettings::GetTextPosition() const { | 427 int CPDF_ApSettings::GetTextPosition() const { |
428 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) | 428 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) |
429 : TEXTPOS_CAPTION; | 429 : TEXTPOS_CAPTION; |
430 } | 430 } |
OLD | NEW |