| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 ASSERT(m_pInterForm != NULL); | 389 ASSERT(m_pInterForm != NULL); |
| 390 m_pInterForm->UpdateField(pFormField); | 390 m_pInterForm->UpdateField(pFormField); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, | 393 void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, |
| 394 CPDFSDK_PageView* pPageView) { | 394 CPDFSDK_PageView* pPageView) { |
| 395 ASSERT(m_pInterForm != NULL); | 395 ASSERT(m_pInterForm != NULL); |
| 396 | 396 |
| 397 int nFieldType = GetFieldType(); | 397 int nFieldType = GetFieldType(); |
| 398 if (m_pInterForm->IsNeedHighLight(nFieldType)) { | 398 if (m_pInterForm->IsNeedHighLight(nFieldType)) { |
| 399 // if (nFieldType != FIELDTYPE_PUSHBUTTON) | |
| 400 // { | |
| 401 CPDF_Rect rc = GetRect(); | 399 CPDF_Rect rc = GetRect(); |
| 402 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); | 400 FX_COLORREF color = m_pInterForm->GetHighlightColor(nFieldType); |
| 403 uint8_t alpha = m_pInterForm->GetHighlightAlpha(); | 401 uint8_t alpha = m_pInterForm->GetHighlightAlpha(); |
| 404 | 402 |
| 405 CFX_FloatRect rcDevice; | 403 CFX_FloatRect rcDevice; |
| 406 ASSERT(m_pInterForm->GetDocument()); | 404 ASSERT(m_pInterForm->GetDocument()); |
| 407 CPDFDoc_Environment* pEnv = m_pInterForm->GetDocument()->GetEnv(); | 405 CPDFDoc_Environment* pEnv = m_pInterForm->GetDocument()->GetEnv(); |
| 408 if (!pEnv) | 406 if (!pEnv) |
| 409 return; | 407 return; |
| 410 CFX_AffineMatrix page2device; | 408 CFX_AffineMatrix page2device; |
| 411 pPageView->GetCurrentMatrix(page2device); | 409 pPageView->GetCurrentMatrix(page2device); |
| 412 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom), | 410 page2device.Transform(((FX_FLOAT)rc.left), ((FX_FLOAT)rc.bottom), |
| 413 rcDevice.left, rcDevice.bottom); | 411 rcDevice.left, rcDevice.bottom); |
| 414 // pEnv->FFI_PageToDevice(m_pPageView->GetPDFPage(), rc.left, | |
| 415 // rc.bottom, &rcDevice.left, &rcDevice.bottom); | |
| 416 // pEnv->FFI_PageToDevice(m_pPageView->GetPDFPage(), rc.right, | |
| 417 // rc.top, &rcDevice.right, &rcDevice.top); | |
| 418 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top), | 412 page2device.Transform(((FX_FLOAT)rc.right), ((FX_FLOAT)rc.top), |
| 419 rcDevice.right, rcDevice.top); | 413 rcDevice.right, rcDevice.top); |
| 420 | 414 |
| 421 rcDevice.Normalize(); | 415 rcDevice.Normalize(); |
| 422 | 416 |
| 423 FX_ARGB argb = ArgbEncode((int)alpha, color); | 417 FX_ARGB argb = ArgbEncode((int)alpha, color); |
| 424 FX_RECT rcDev((int)rcDevice.left, (int)rcDevice.top, (int)rcDevice.right, | 418 FX_RECT rcDev((int)rcDevice.left, (int)rcDevice.top, (int)rcDevice.right, |
| 425 (int)rcDevice.bottom); | 419 (int)rcDevice.bottom); |
| 426 pDevice->FillRect(&rcDev, argb); | 420 pDevice->FillRect(&rcDev, argb); |
| 427 /* }*/ | |
| 428 } | 421 } |
| 429 } | 422 } |
| 430 | 423 |
| 431 void CPDFSDK_Widget::ResetAppearance_PushButton() { | 424 void CPDFSDK_Widget::ResetAppearance_PushButton() { |
| 432 CPDF_FormControl* pControl = GetFormControl(); | 425 CPDF_FormControl* pControl = GetFormControl(); |
| 433 ASSERT(pControl != NULL); | 426 ASSERT(pControl != NULL); |
| 434 | 427 |
| 435 CPDF_Rect rcWindow = GetRotatedRect(); | 428 CPDF_Rect rcWindow = GetRotatedRect(); |
| 436 | 429 |
| 437 int32_t nLayout = 0; | 430 int32_t nLayout = 0; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 pImageDict->SetAtString("Name", "ImgC"); | 559 pImageDict->SetAtString("Name", "ImgC"); |
| 567 } | 560 } |
| 568 } | 561 } |
| 569 | 562 |
| 570 CPDF_IconFit iconFit = pControl->GetIconFit(); | 563 CPDF_IconFit iconFit = pControl->GetIconFit(); |
| 571 | 564 |
| 572 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); | 565 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
| 573 ASSERT(pDoc != NULL); | 566 ASSERT(pDoc != NULL); |
| 574 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); | 567 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
| 575 | 568 |
| 576 CBA_FontMap FontMap( | 569 CBA_FontMap FontMap(this, pEnv->GetSysHandler()); |
| 577 this, | |
| 578 pEnv->GetSysHandler()); //, | |
| 579 //ISystemHandle::GetSystemHandler(m_pBaseForm->Ge
tEnv())); | |
| 580 FontMap.Initial(); | 570 FontMap.Initial(); |
| 581 | 571 |
| 582 FontMap.SetAPType("N"); | 572 FontMap.SetAPType("N"); |
| 583 | 573 |
| 584 CFX_ByteString csAP = | 574 CFX_ByteString csAP = |
| 585 CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + | 575 CPWL_Utils::GetRectFillAppStream(rcWindow, crBackground) + |
| 586 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, | 576 CPWL_Utils::GetBorderAppStream(rcWindow, fBorderWidth, crBorder, |
| 587 crLeftTop, crRightBottom, nBorderStyle, | 577 crLeftTop, crRightBottom, nBorderStyle, |
| 588 dsBorder) + | 578 dsBorder) + |
| 589 CPWL_Utils::GetPushButtonAppStream( | 579 CPWL_Utils::GetPushButtonAppStream( |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 | 1119 |
| 1130 CFX_ByteTextBuf sBody, sLines; | 1120 CFX_ByteTextBuf sBody, sLines; |
| 1131 | 1121 |
| 1132 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { | 1122 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { |
| 1133 pEdit->EnableRefresh(FALSE); | 1123 pEdit->EnableRefresh(FALSE); |
| 1134 | 1124 |
| 1135 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); | 1125 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
| 1136 ASSERT(pDoc != NULL); | 1126 ASSERT(pDoc != NULL); |
| 1137 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); | 1127 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
| 1138 | 1128 |
| 1139 CBA_FontMap FontMap( | 1129 CBA_FontMap FontMap(this, pEnv->GetSysHandler()); |
| 1140 this, | |
| 1141 pEnv->GetSysHandler()); //, | |
| 1142 //ISystemHandle::GetSystemHandler(m_pBaseForm->
GetEnv())); | |
| 1143 FontMap.Initial(); | 1130 FontMap.Initial(); |
| 1144 pEdit->SetFontMap(&FontMap); | 1131 pEdit->SetFontMap(&FontMap); |
| 1145 | 1132 |
| 1146 CPDF_Rect rcClient = GetClientRect(); | 1133 CPDF_Rect rcClient = GetClientRect(); |
| 1147 pEdit->SetPlateRect(rcClient); | 1134 pEdit->SetPlateRect(rcClient); |
| 1148 pEdit->SetAlignmentH(pControl->GetControlAlignment()); | 1135 pEdit->SetAlignmentH(pControl->GetControlAlignment()); |
| 1149 | 1136 |
| 1150 FX_DWORD dwFieldFlags = pField->GetFieldFlags(); | 1137 FX_DWORD dwFieldFlags = pField->GetFieldFlags(); |
| 1151 FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; | 1138 FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; |
| 1152 | 1139 |
| (...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2670 ASSERT(pAnnot != NULL); | 2657 ASSERT(pAnnot != NULL); |
| 2671 | 2658 |
| 2672 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 2659 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 2673 ASSERT(pPDFAnnot != NULL); | 2660 ASSERT(pPDFAnnot != NULL); |
| 2674 | 2661 |
| 2675 CPDF_Rect rcAnnot; | 2662 CPDF_Rect rcAnnot; |
| 2676 pPDFAnnot->GetRect(rcAnnot); | 2663 pPDFAnnot->GetRect(rcAnnot); |
| 2677 | 2664 |
| 2678 return rcAnnot; | 2665 return rcAnnot; |
| 2679 } | 2666 } |
| OLD | NEW |