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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1722913002: Remove uses of this->foo. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 9 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/src/formfiller/FFL_IFormFiller.cpp ('k') | xfa/src/fgas/src/font/fx_stdfontmgr.h » ('j') | 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 CPDFSDK_Widget::~CPDFSDK_Widget() {} 45 CPDFSDK_Widget::~CPDFSDK_Widget() {}
46 46
47 #ifdef PDF_ENABLE_XFA 47 #ifdef PDF_ENABLE_XFA
48 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const { 48 IXFA_Widget* CPDFSDK_Widget::GetMixXFAWidget() const {
49 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 49 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
50 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 50 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
51 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 51 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
52 if (!m_hMixXFAWidget) { 52 if (!m_hMixXFAWidget) {
53 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) { 53 if (IXFA_DocView* pDocView = pDoc->GetXFADocView()) {
54 CFX_WideString sName; 54 CFX_WideString sName;
55 if (this->GetFieldType() == FIELDTYPE_RADIOBUTTON) { 55 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
56 sName = this->GetAnnotName(); 56 sName = GetAnnotName();
57 if (sName.IsEmpty()) 57 if (sName.IsEmpty())
58 sName = GetName(); 58 sName = GetName();
59 } else 59 } else
60 sName = GetName(); 60 sName = GetName();
61 61
62 if (!sName.IsEmpty()) 62 if (!sName.IsEmpty())
63 m_hMixXFAWidget = pDocView->GetWidgetByName(sName); 63 m_hMixXFAWidget = pDocView->GetWidgetByName(sName);
64 } 64 }
65 } 65 }
66 return m_hMixXFAWidget; 66 return m_hMixXFAWidget;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 case CPDF_AAction::DocumentSaved: 167 case CPDF_AAction::DocumentSaved:
168 case CPDF_AAction::PrintDocument: 168 case CPDF_AAction::PrintDocument:
169 case CPDF_AAction::DocumentPrinted: 169 case CPDF_AAction::DocumentPrinted:
170 break; 170 break;
171 } 171 }
172 172
173 return eEventType; 173 return eEventType;
174 } 174 }
175 175
176 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { 176 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) {
177 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 177 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
178 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 178 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
179 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); 179 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
180 180
181 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && 181 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) &&
182 GetFieldType() == FIELDTYPE_RADIOBUTTON) { 182 GetFieldType() == FIELDTYPE_RADIOBUTTON) {
183 if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWidget()) { 183 if (IXFA_Widget* hGroupWidget = GetGroupMixXFAWidget()) {
184 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget); 184 CXFA_WidgetAcc* pAcc = pXFAWidgetHandler->GetDataAcc(hGroupWidget);
185 if (pXFAWidgetHandler->HasEvent(pAcc, eEventType)) 185 if (pXFAWidgetHandler->HasEvent(pAcc, eEventType))
186 return TRUE; 186 return TRUE;
187 } 187 }
188 } 188 }
(...skipping 10 matching lines...) Expand all
199 199
200 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, 200 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
201 PDFSDK_FieldAction& data, 201 PDFSDK_FieldAction& data,
202 CPDFSDK_PageView* pPageView) { 202 CPDFSDK_PageView* pPageView) {
203 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 203 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
204 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 204 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
205 if (IXFA_Widget* hWidget = GetMixXFAWidget()) { 205 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
206 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); 206 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT);
207 207
208 if (eEventType != XFA_EVENT_Unknown) { 208 if (eEventType != XFA_EVENT_Unknown) {
209 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 209 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
210 CXFA_EventParam param; 210 CXFA_EventParam param;
211 param.m_eType = eEventType; 211 param.m_eType = eEventType;
212 param.m_wsChange = data.sChange; 212 param.m_wsChange = data.sChange;
213 param.m_iCommitKey = data.nCommitKey; 213 param.m_iCommitKey = data.nCommitKey;
214 param.m_bShift = data.bShift; 214 param.m_bShift = data.bShift;
215 param.m_iSelStart = data.nSelStart; 215 param.m_iSelStart = data.nSelStart;
216 param.m_iSelEnd = data.nSelEnd; 216 param.m_iSelEnd = data.nSelEnd;
217 param.m_wsFullText = data.sValue; 217 param.m_wsFullText = data.sValue;
218 param.m_bKeyDown = data.bKeyDown; 218 param.m_bKeyDown = data.bKeyDown;
219 param.m_bModifier = data.bModifier; 219 param.m_bModifier = data.bModifier;
(...skipping 30 matching lines...) Expand all
250 pDocView->UpdateDocView(); 250 pDocView->UpdateDocView();
251 } 251 }
252 } 252 }
253 } 253 }
254 } 254 }
255 255
256 return FALSE; 256 return FALSE;
257 } 257 }
258 258
259 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { 259 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
260 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 260 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
261 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 261 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
262 CPDF_FormField* pFormField = GetFormField(); 262 CPDF_FormField* pFormField = GetFormField();
263 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 263 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
264 switch (GetFieldType()) { 264 switch (GetFieldType()) {
265 case FIELDTYPE_CHECKBOX: 265 case FIELDTYPE_CHECKBOX:
266 case FIELDTYPE_RADIOBUTTON: { 266 case FIELDTYPE_RADIOBUTTON: {
267 CPDF_FormControl* pFormCtrl = GetFormControl(); 267 CPDF_FormControl* pFormCtrl = GetFormControl();
268 XFA_CHECKSTATE eCheckState = 268 XFA_CHECKSTATE eCheckState =
269 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; 269 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off;
270 pWidgetAcc->SetCheckState(eCheckState); 270 pWidgetAcc->SetCheckState(eCheckState);
271 } break; 271 } break;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); 582 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance();
583 CFX_ByteString csFont = ""; 583 CFX_ByteString csFont = "";
584 FX_FLOAT fFontSize = 0.0f; 584 FX_FLOAT fFontSize = 0.0f;
585 pDa.GetFont(csFont, fFontSize); 585 pDa.GetFont(csFont, fFontSize);
586 586
587 return fFontSize; 587 return fFontSize;
588 } 588 }
589 589
590 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { 590 int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const {
591 #ifdef PDF_ENABLE_XFA 591 #ifdef PDF_ENABLE_XFA
592 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 592 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
593 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 593 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
594 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 594 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
595 if (nIndex < pWidgetAcc->CountSelectedItems()) 595 if (nIndex < pWidgetAcc->CountSelectedItems())
596 return pWidgetAcc->GetSelectedItem(nIndex); 596 return pWidgetAcc->GetSelectedItem(nIndex);
597 } 597 }
598 } 598 }
599 } 599 }
600 #endif // PDF_ENABLE_XFA 600 #endif // PDF_ENABLE_XFA
601 CPDF_FormField* pFormField = GetFormField(); 601 CPDF_FormField* pFormField = GetFormField();
602 return pFormField->GetSelectedIndex(nIndex); 602 return pFormField->GetSelectedIndex(nIndex);
603 } 603 }
604 604
605 #ifdef PDF_ENABLE_XFA 605 #ifdef PDF_ENABLE_XFA
606 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const { 606 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const {
607 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 607 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
608 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 608 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
609 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 609 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
610 CFX_WideString sValue; 610 CFX_WideString sValue;
611 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display 611 pWidgetAcc->GetValue(sValue, bDisplay ? XFA_VALUEPICTURE_Display
612 : XFA_VALUEPICTURE_Edit); 612 : XFA_VALUEPICTURE_Edit);
613 return sValue; 613 return sValue;
614 } 614 }
615 } 615 }
616 } 616 }
617 #else 617 #else
618 CFX_WideString CPDFSDK_Widget::GetValue() const { 618 CFX_WideString CPDFSDK_Widget::GetValue() const {
(...skipping 12 matching lines...) Expand all
631 return pFormField->GetOptionLabel(nIndex); 631 return pFormField->GetOptionLabel(nIndex);
632 } 632 }
633 633
634 int CPDFSDK_Widget::CountOptions() const { 634 int CPDFSDK_Widget::CountOptions() const {
635 CPDF_FormField* pFormField = GetFormField(); 635 CPDF_FormField* pFormField = GetFormField();
636 return pFormField->CountOptions(); 636 return pFormField->CountOptions();
637 } 637 }
638 638
639 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { 639 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const {
640 #ifdef PDF_ENABLE_XFA 640 #ifdef PDF_ENABLE_XFA
641 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 641 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
642 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 642 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
643 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 643 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
644 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) 644 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems())
645 return pWidgetAcc->GetItemState(nIndex); 645 return pWidgetAcc->GetItemState(nIndex);
646 646
647 return FALSE; 647 return FALSE;
648 } 648 }
649 } 649 }
650 } 650 }
651 #endif // PDF_ENABLE_XFA 651 #endif // PDF_ENABLE_XFA
652 CPDF_FormField* pFormField = GetFormField(); 652 CPDF_FormField* pFormField = GetFormField();
653 return pFormField->IsItemSelected(nIndex); 653 return pFormField->IsItemSelected(nIndex);
654 } 654 }
655 655
656 int CPDFSDK_Widget::GetTopVisibleIndex() const { 656 int CPDFSDK_Widget::GetTopVisibleIndex() const {
657 CPDF_FormField* pFormField = GetFormField(); 657 CPDF_FormField* pFormField = GetFormField();
658 return pFormField->GetTopVisibleIndex(); 658 return pFormField->GetTopVisibleIndex();
659 } 659 }
660 660
661 FX_BOOL CPDFSDK_Widget::IsChecked() const { 661 FX_BOOL CPDFSDK_Widget::IsChecked() const {
662 #ifdef PDF_ENABLE_XFA 662 #ifdef PDF_ENABLE_XFA
663 if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) { 663 if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
664 if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) { 664 if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
665 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) { 665 if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
666 FX_BOOL bChecked = pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On; 666 FX_BOOL bChecked = pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On;
667 return bChecked; 667 return bChecked;
668 } 668 }
669 } 669 }
670 } 670 }
671 #endif // PDF_ENABLE_XFA 671 #endif // PDF_ENABLE_XFA
672 CPDF_FormControl* pFormCtrl = GetFormControl(); 672 CPDF_FormControl* pFormCtrl = GetFormControl();
673 return pFormCtrl->IsChecked(); 673 return pFormCtrl->IsChecked();
674 } 674 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 FX_BOOL CPDFSDK_Widget::IsAppModified() const { 739 FX_BOOL CPDFSDK_Widget::IsAppModified() const {
740 return m_bAppModified; 740 return m_bAppModified;
741 } 741 }
742 742
743 #ifdef PDF_ENABLE_XFA 743 #ifdef PDF_ENABLE_XFA
744 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) { 744 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) {
745 switch (GetFieldType()) { 745 switch (GetFieldType()) {
746 case FIELDTYPE_TEXTFIELD: 746 case FIELDTYPE_TEXTFIELD:
747 case FIELDTYPE_COMBOBOX: { 747 case FIELDTYPE_COMBOBOX: {
748 FX_BOOL bFormated = FALSE; 748 FX_BOOL bFormated = FALSE;
749 CFX_WideString sValue = this->OnFormat(bFormated); 749 CFX_WideString sValue = OnFormat(bFormated);
750 if (bFormated) 750 ResetAppearance(bFormated ? sValue : nullptr, TRUE);
751 this->ResetAppearance(sValue, TRUE);
752 else
753 this->ResetAppearance(NULL, TRUE);
754 } break; 751 } break;
755 default: 752 default:
756 this->ResetAppearance(NULL, FALSE); 753 ResetAppearance(nullptr, FALSE);
757 break; 754 break;
758 } 755 }
759 } 756 }
760 #endif // PDF_ENABLE_XFA 757 #endif // PDF_ENABLE_XFA
761 758
762 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, 759 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue,
763 FX_BOOL bValueChanged) { 760 FX_BOOL bValueChanged) {
764 SetAppModified(); 761 SetAppModified();
765 762
766 m_nAppAge++; 763 m_nAppAge++;
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 subWord = '*'; 1565 subWord = '*';
1569 pEdit->SetPasswordChar(subWord); 1566 pEdit->SetPasswordChar(subWord);
1570 } 1567 }
1571 1568
1572 int nMaxLen = pField->GetMaxLen(); 1569 int nMaxLen = pField->GetMaxLen();
1573 FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1; 1570 FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1;
1574 FX_FLOAT fFontSize = GetFontSize(); 1571 FX_FLOAT fFontSize = GetFontSize();
1575 1572
1576 #ifdef PDF_ENABLE_XFA 1573 #ifdef PDF_ENABLE_XFA
1577 CFX_WideString sValueTmp; 1574 CFX_WideString sValueTmp;
1578 if (!sValue && (NULL != this->GetMixXFAWidget())) { 1575 if (!sValue && GetMixXFAWidget()) {
1579 sValueTmp = GetValue(TRUE); 1576 sValueTmp = GetValue(TRUE);
1580 sValue = sValueTmp; 1577 sValue = sValueTmp;
1581 } 1578 }
1582 #endif // PDF_ENABLE_XFA 1579 #endif // PDF_ENABLE_XFA
1583 1580
1584 if (nMaxLen > 0) { 1581 if (nMaxLen > 0) {
1585 if (bCharArray) { 1582 if (bCharArray) {
1586 pEdit->SetCharArray(nMaxLen); 1583 pEdit->SetCharArray(nMaxLen);
1587 1584
1588 if (IsFloatZero(fFontSize)) { 1585 if (IsFloatZero(fFontSize)) {
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2861 break; 2858 break;
2862 } 2859 }
2863 } 2860 }
2864 } 2861 }
2865 2862
2866 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { 2863 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
2867 CPDF_Rect rcAnnot; 2864 CPDF_Rect rcAnnot;
2868 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 2865 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
2869 return rcAnnot; 2866 return rcAnnot;
2870 } 2867 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_IFormFiller.cpp ('k') | xfa/src/fgas/src/font/fx_stdfontmgr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698