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 "fpdfsdk/javascript/Field.h" | 7 #include "fpdfsdk/javascript/Field.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2218 | 2218 |
2219 if (vp.IsSetting()) { | 2219 if (vp.IsSetting()) { |
2220 if (!m_bCanSet) | 2220 if (!m_bCanSet) |
2221 return FALSE; | 2221 return FALSE; |
2222 | 2222 |
2223 bool bVP; | 2223 bool bVP; |
2224 vp >> bVP; | 2224 vp >> bVP; |
2225 | 2225 |
2226 if (m_bDelay) { | 2226 if (m_bDelay) { |
2227 AddDelay_Bool(FP_RICHTEXT, bVP); | 2227 AddDelay_Bool(FP_RICHTEXT, bVP); |
2228 } else { | |
2229 Field::SetRichText(m_pDocument, m_FieldName, m_nFormControlIndex, bVP); | |
2230 } | 2228 } |
2231 } else { | 2229 } else { |
2232 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); | 2230 std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName); |
2233 if (FieldArray.empty()) | 2231 if (FieldArray.empty()) |
2234 return FALSE; | 2232 return FALSE; |
2235 | 2233 |
2236 CPDF_FormField* pFormField = FieldArray[0]; | 2234 CPDF_FormField* pFormField = FieldArray[0]; |
2237 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 2235 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
2238 return FALSE; | 2236 return FALSE; |
2239 | 2237 |
2240 if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT) | 2238 if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT) |
2241 vp << true; | 2239 vp << true; |
2242 else | 2240 else |
2243 vp << false; | 2241 vp << false; |
2244 } | 2242 } |
2245 | 2243 |
2246 return TRUE; | 2244 return TRUE; |
2247 } | 2245 } |
2248 | 2246 |
2249 void Field::SetRichText(CPDFSDK_Document* pDocument, | |
2250 const CFX_WideString& swFieldName, | |
2251 int nControlIndex, | |
2252 bool b) { | |
2253 // Not supported. | |
2254 } | |
2255 | |
2256 FX_BOOL Field::richValue(IJS_Context* cc, | 2247 FX_BOOL Field::richValue(IJS_Context* cc, |
2257 CJS_PropValue& vp, | 2248 CJS_PropValue& vp, |
2258 CFX_WideString& sError) { | 2249 CFX_WideString& sError) { |
2259 return TRUE; | 2250 return TRUE; |
2260 } | 2251 } |
2261 | 2252 |
2262 void Field::SetRichValue(CPDFSDK_Document* pDocument, | |
2263 const CFX_WideString& swFieldName, | |
2264 int nControlIndex) { | |
2265 // Not supported. | |
2266 } | |
2267 | |
2268 FX_BOOL Field::rotation(IJS_Context* cc, | 2253 FX_BOOL Field::rotation(IJS_Context* cc, |
2269 CJS_PropValue& vp, | 2254 CJS_PropValue& vp, |
2270 CFX_WideString& sError) { | 2255 CFX_WideString& sError) { |
2271 ASSERT(m_pDocument); | 2256 ASSERT(m_pDocument); |
2272 | 2257 |
2273 if (vp.IsSetting()) { | 2258 if (vp.IsSetting()) { |
2274 if (!m_bCanSet) | 2259 if (!m_bCanSet) |
2275 return FALSE; | 2260 return FALSE; |
2276 | 2261 |
2277 int nVP; | 2262 int nVP; |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 break; | 3484 break; |
3500 case FP_PASSWORD: | 3485 case FP_PASSWORD: |
3501 Field::SetPassword(pDocument, pData->sFieldName, pData->nControlIndex, | 3486 Field::SetPassword(pDocument, pData->sFieldName, pData->nControlIndex, |
3502 pData->b); | 3487 pData->b); |
3503 break; | 3488 break; |
3504 case FP_RECT: | 3489 case FP_RECT: |
3505 Field::SetRect(pDocument, pData->sFieldName, pData->nControlIndex, | 3490 Field::SetRect(pDocument, pData->sFieldName, pData->nControlIndex, |
3506 pData->rect); | 3491 pData->rect); |
3507 break; | 3492 break; |
3508 case FP_RICHTEXT: | 3493 case FP_RICHTEXT: |
3509 Field::SetRichText(pDocument, pData->sFieldName, pData->nControlIndex, | 3494 // Not supported. |
3510 pData->b); | |
3511 break; | 3495 break; |
3512 case FP_RICHVALUE: | 3496 case FP_RICHVALUE: |
3513 break; | 3497 break; |
3514 case FP_ROTATION: | 3498 case FP_ROTATION: |
3515 Field::SetRotation(pDocument, pData->sFieldName, pData->nControlIndex, | 3499 Field::SetRotation(pDocument, pData->sFieldName, pData->nControlIndex, |
3516 pData->num); | 3500 pData->num); |
3517 break; | 3501 break; |
3518 case FP_STROKECOLOR: | 3502 case FP_STROKECOLOR: |
3519 Field::SetStrokeColor(pDocument, pData->sFieldName, pData->nControlIndex, | 3503 Field::SetStrokeColor(pDocument, pData->sFieldName, pData->nControlIndex, |
3520 pData->color); | 3504 pData->color); |
(...skipping 25 matching lines...) Expand all Loading... |
3546 } | 3530 } |
3547 } | 3531 } |
3548 | 3532 |
3549 void Field::AddField(CPDFSDK_Document* pDocument, | 3533 void Field::AddField(CPDFSDK_Document* pDocument, |
3550 int nPageIndex, | 3534 int nPageIndex, |
3551 int nFieldType, | 3535 int nFieldType, |
3552 const CFX_WideString& sName, | 3536 const CFX_WideString& sName, |
3553 const CFX_FloatRect& rcCoords) { | 3537 const CFX_FloatRect& rcCoords) { |
3554 // Not supported. | 3538 // Not supported. |
3555 } | 3539 } |
OLD | NEW |