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 "../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 #include "../include/fsdk_mgr.h" | 9 #include "../include/fsdk_mgr.h" |
10 #include "../include/fsdk_baseannot.h" | 10 #include "../include/fsdk_baseannot.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 CFX_ByteString CPDFSDK_Widget::GetSubType() const { | 93 CFX_ByteString CPDFSDK_Widget::GetSubType() const { |
94 int nType = GetFieldType(); | 94 int nType = GetFieldType(); |
95 | 95 |
96 if (nType == FIELDTYPE_SIGNATURE) | 96 if (nType == FIELDTYPE_SIGNATURE) |
97 return BFFT_SIGNATURE; | 97 return BFFT_SIGNATURE; |
98 return CPDFSDK_Annot::GetSubType(); | 98 return CPDFSDK_Annot::GetSubType(); |
99 } | 99 } |
100 | 100 |
101 CPDF_FormField* CPDFSDK_Widget::GetFormField() const { | 101 CPDF_FormField* CPDFSDK_Widget::GetFormField() const { |
102 ASSERT(m_pInterForm != NULL); | 102 return GetFormControl()->GetField(); |
103 | |
104 CPDF_FormControl* pCtrl = GetFormControl(); | |
105 ASSERT(pCtrl != NULL); | |
106 | |
107 return pCtrl->GetField(); | |
108 } | 103 } |
109 | 104 |
110 CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const { | 105 CPDF_FormControl* CPDFSDK_Widget::GetFormControl() const { |
111 ASSERT(m_pInterForm != NULL); | |
112 | |
113 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); | 106 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); |
114 ASSERT(pPDFInterForm != NULL); | |
115 | |
116 return pPDFInterForm->GetControlByDict(GetAnnotDict()); | 107 return pPDFInterForm->GetControlByDict(GetAnnotDict()); |
117 } | 108 } |
118 | 109 |
119 CPDF_FormControl* CPDFSDK_Widget::GetFormControl(CPDF_InterForm* pInterForm, | 110 CPDF_FormControl* CPDFSDK_Widget::GetFormControl( |
120 CPDF_Dictionary* pAnnotDict) { | 111 CPDF_InterForm* pInterForm, |
121 ASSERT(pInterForm != NULL); | 112 const CPDF_Dictionary* pAnnotDict) { |
122 ASSERT(pAnnotDict != NULL); | 113 ASSERT(pAnnotDict != NULL); |
123 | 114 return pInterForm->GetControlByDict(pAnnotDict); |
124 CPDF_FormControl* pControl = pInterForm->GetControlByDict(pAnnotDict); | |
125 | |
126 return pControl; | |
127 } | 115 } |
128 | 116 |
129 int CPDFSDK_Widget::GetRotate() const { | 117 int CPDFSDK_Widget::GetRotate() const { |
130 CPDF_FormControl* pCtrl = GetFormControl(); | 118 CPDF_FormControl* pCtrl = GetFormControl(); |
131 ASSERT(pCtrl != NULL); | |
132 | |
133 return pCtrl->GetRotation() % 360; | 119 return pCtrl->GetRotation() % 360; |
134 } | 120 } |
135 | 121 |
136 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { | 122 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { |
137 CPDF_FormControl* pFormCtrl = GetFormControl(); | 123 CPDF_FormControl* pFormCtrl = GetFormControl(); |
138 ASSERT(pFormCtrl != NULL); | 124 ASSERT(pFormCtrl != NULL); |
139 | 125 |
140 int iColorType = 0; | 126 int iColorType = 0; |
141 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); | 127 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); |
142 | 128 |
(...skipping 2416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 break; | 2545 break; |
2560 } | 2546 } |
2561 } | 2547 } |
2562 } | 2548 } |
2563 | 2549 |
2564 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 2550 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
2565 CPDF_Rect rcAnnot; | 2551 CPDF_Rect rcAnnot; |
2566 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2552 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
2567 return rcAnnot; | 2553 return rcAnnot; |
2568 } | 2554 } |
OLD | NEW |