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 "core/include/fpdfdoc/fpdf_doc.h" | 7 #include "core/include/fpdfdoc/fpdf_doc.h" |
8 | 8 |
9 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, | 9 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, |
10 CPDF_Dictionary* pWidgetDict) { | 10 CPDF_Dictionary* pWidgetDict) { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 if (csOldAS == csAS) { | 143 if (csOldAS == csAS) { |
144 return; | 144 return; |
145 } | 145 } |
146 m_pWidgetDict->SetAtName("AS", csAS); | 146 m_pWidgetDict->SetAtName("AS", csAS); |
147 m_pForm->m_bUpdated = TRUE; | 147 m_pForm->m_bUpdated = TRUE; |
148 } | 148 } |
149 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 149 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
150 CPDF_Annot::AppearanceMode mode); | 150 CPDF_Annot::AppearanceMode mode); |
151 void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, | 151 void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, |
152 CFX_AffineMatrix* pMatrix, | 152 CFX_Matrix* pMatrix, |
153 CPDF_Page* pPage, | 153 CPDF_Page* pPage, |
154 CPDF_Annot::AppearanceMode mode, | 154 CPDF_Annot::AppearanceMode mode, |
155 const CPDF_RenderOptions* pOptions) { | 155 const CPDF_RenderOptions* pOptions) { |
156 if (m_pWidgetDict->GetInteger("F") & ANNOTFLAG_HIDDEN) { | 156 if (m_pWidgetDict->GetInteger("F") & ANNOTFLAG_HIDDEN) { |
157 return; | 157 return; |
158 } | 158 } |
159 CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); | 159 CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); |
160 if (pStream == NULL) { | 160 if (pStream == NULL) { |
161 return; | 161 return; |
162 } | 162 } |
163 CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox"); | 163 CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox"); |
164 CFX_AffineMatrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); | 164 CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); |
165 form_matrix.TransformRect(form_bbox); | 165 form_matrix.TransformRect(form_bbox); |
166 CFX_FloatRect arect = m_pWidgetDict->GetRect("Rect"); | 166 CFX_FloatRect arect = m_pWidgetDict->GetRect("Rect"); |
167 CFX_AffineMatrix matrix; | 167 CFX_Matrix matrix; |
168 matrix.MatchRect(arect, form_bbox); | 168 matrix.MatchRect(arect, form_bbox); |
169 matrix.Concat(*pMatrix); | 169 matrix.Concat(*pMatrix); |
170 CPDF_Form form(m_pField->m_pForm->m_pDocument, | 170 CPDF_Form form(m_pField->m_pForm->m_pDocument, |
171 m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); | 171 m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); |
172 form.ParseContent(NULL, NULL, NULL, NULL); | 172 form.ParseContent(NULL, NULL, NULL, NULL); |
173 CPDF_RenderContext context; | 173 CPDF_RenderContext context; |
174 context.Create(pPage); | 174 context.Create(pPage); |
175 context.DrawObjectList(pDevice, &form, &matrix, pOptions); | 175 context.DrawObjectList(pDevice, &form, &matrix, pOptions); |
176 } | 176 } |
177 const FX_CHAR* g_sHighlightingMode[] = {"N", "I", "O", "P", "T", ""}; | 177 const FX_CHAR* g_sHighlightingMode[] = {"N", "I", "O", "P", "T", ""}; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 421 } |
422 | 422 |
423 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { | 423 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { |
424 return m_pDict ? m_pDict->GetDict(FX_BSTRC("IF")) : nullptr; | 424 return m_pDict ? m_pDict->GetDict(FX_BSTRC("IF")) : nullptr; |
425 } | 425 } |
426 | 426 |
427 int CPDF_ApSettings::GetTextPosition() const { | 427 int CPDF_ApSettings::GetTextPosition() const { |
428 return m_pDict ? m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION) | 428 return m_pDict ? m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION) |
429 : TEXTPOS_CAPTION; | 429 : TEXTPOS_CAPTION; |
430 } | 430 } |
OLD | NEW |