Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: fpdfsdk/fsdk_baseform.cpp

Issue 1889863002: Make CPDF_Dictionary methods take CFX_ByteString arguments (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One last caller. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fsdk_baseannot.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "fpdfsdk/include/fsdk_baseform.h" 7 #include "fpdfsdk/include/fsdk_baseform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 switch (nFieldType) { 454 switch (nFieldType) {
455 case FIELDTYPE_PUSHBUTTON: 455 case FIELDTYPE_PUSHBUTTON:
456 case FIELDTYPE_COMBOBOX: 456 case FIELDTYPE_COMBOBOX:
457 case FIELDTYPE_LISTBOX: 457 case FIELDTYPE_LISTBOX:
458 case FIELDTYPE_TEXTFIELD: 458 case FIELDTYPE_TEXTFIELD:
459 case FIELDTYPE_SIGNATURE: 459 case FIELDTYPE_SIGNATURE:
460 return psub->IsStream(); 460 return psub->IsStream();
461 case FIELDTYPE_CHECKBOX: 461 case FIELDTYPE_CHECKBOX:
462 case FIELDTYPE_RADIOBUTTON: 462 case FIELDTYPE_RADIOBUTTON:
463 if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) { 463 if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) {
464 return !!pSubDict->GetStreamBy(GetAppState().AsStringC()); 464 return !!pSubDict->GetStreamBy(GetAppState());
465 } 465 }
466 return FALSE; 466 return FALSE;
467 } 467 }
468 return TRUE; 468 return TRUE;
469 } 469 }
470 470
471 int CPDFSDK_Widget::GetFieldType() const { 471 int CPDFSDK_Widget::GetFieldType() const {
472 return GetFormField()->GetFieldType(); 472 return GetFormField()->GetFieldType();
473 } 473 }
474 474
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 1801
1802 return crFill; 1802 return crFill;
1803 } 1803 }
1804 1804
1805 void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, 1805 void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType,
1806 CPDF_Stream* pImage) { 1806 CPDF_Stream* pImage) {
1807 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); 1807 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
1808 ASSERT(pDoc); 1808 ASSERT(pDoc);
1809 1809
1810 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); 1810 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP");
1811 CPDF_Stream* pStream = pAPDict->GetStreamBy(sAPType.AsStringC()); 1811 CPDF_Stream* pStream = pAPDict->GetStreamBy(sAPType);
1812 CPDF_Dictionary* pStreamDict = pStream->GetDict(); 1812 CPDF_Dictionary* pStreamDict = pStream->GetDict();
1813 CFX_ByteString sImageAlias = "IMG"; 1813 CFX_ByteString sImageAlias = "IMG";
1814 1814
1815 if (CPDF_Dictionary* pImageDict = pImage->GetDict()) { 1815 if (CPDF_Dictionary* pImageDict = pImage->GetDict()) {
1816 sImageAlias = pImageDict->GetStringBy("Name"); 1816 sImageAlias = pImageDict->GetStringBy("Name");
1817 if (sImageAlias.IsEmpty()) 1817 if (sImageAlias.IsEmpty())
1818 sImageAlias = "IMG"; 1818 sImageAlias = "IMG";
1819 } 1819 }
1820 1820
1821 CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources"); 1821 CPDF_Dictionary* pStreamResList = pStreamDict->GetDictBy("Resources");
1822 if (!pStreamResList) { 1822 if (!pStreamResList) {
1823 pStreamResList = new CPDF_Dictionary(); 1823 pStreamResList = new CPDF_Dictionary();
1824 pStreamDict->SetAt("Resources", pStreamResList); 1824 pStreamDict->SetAt("Resources", pStreamResList);
1825 } 1825 }
1826 1826
1827 if (pStreamResList) { 1827 if (pStreamResList) {
1828 CPDF_Dictionary* pXObject = new CPDF_Dictionary; 1828 CPDF_Dictionary* pXObject = new CPDF_Dictionary;
1829 pXObject->SetAtReference(sImageAlias.AsStringC(), pDoc, pImage); 1829 pXObject->SetAtReference(sImageAlias, pDoc, pImage);
1830 pStreamResList->SetAt("XObject", pXObject); 1830 pStreamResList->SetAt("XObject", pXObject);
1831 } 1831 }
1832 } 1832 }
1833 1833
1834 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { 1834 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) {
1835 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP")) { 1835 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP"))
1836 pAPDict->RemoveAt(sAPType.AsStringC()); 1836 pAPDict->RemoveAt(sAPType);
1837 }
1838 } 1837 }
1839 1838
1840 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, 1839 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type,
1841 PDFSDK_FieldAction& data, 1840 PDFSDK_FieldAction& data,
1842 CPDFSDK_PageView* pPageView) { 1841 CPDFSDK_PageView* pPageView) {
1843 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 1842 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
1844 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 1843 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
1845 1844
1846 #ifdef PDF_ENABLE_XFA 1845 #ifdef PDF_ENABLE_XFA
1847 CPDFXFA_Document* pDoc = pDocument->GetXFADocument(); 1846 CPDFXFA_Document* pDoc = pDocument->GetXFADocument();
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2825 break; 2824 break;
2826 } 2825 }
2827 } 2826 }
2828 } 2827 }
2829 2828
2830 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { 2829 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
2831 CFX_FloatRect rcAnnot; 2830 CFX_FloatRect rcAnnot;
2832 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 2831 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
2833 return rcAnnot; 2832 return rcAnnot;
2834 } 2833 }
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_baseannot.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698