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/include/fsdk_baseform.h" | 7 #include "fpdfsdk/include/fsdk_baseform.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); | 1427 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); |
1428 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); | 1428 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); |
1429 | 1429 |
1430 CBA_FontMap font_map(this, pEnv->GetSysHandler()); | 1430 CBA_FontMap font_map(this, pEnv->GetSysHandler()); |
1431 pEdit->SetFontMap(&font_map); | 1431 pEdit->SetFontMap(&font_map); |
1432 | 1432 |
1433 pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); | 1433 pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); |
1434 | 1434 |
1435 FX_FLOAT fFontSize = GetFontSize(); | 1435 FX_FLOAT fFontSize = GetFontSize(); |
1436 | 1436 |
1437 if (IsFloatZero(fFontSize)) | 1437 pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize); |
1438 pEdit->SetFontSize(12.0f); | |
1439 else | |
1440 pEdit->SetFontSize(fFontSize); | |
1441 | 1438 |
1442 pEdit->Initialize(); | 1439 pEdit->Initialize(); |
1443 | 1440 |
1444 CFX_ByteTextBuf sList; | 1441 CFX_ByteTextBuf sList; |
1445 FX_FLOAT fy = rcClient.top; | 1442 FX_FLOAT fy = rcClient.top; |
1446 | 1443 |
1447 int32_t nTop = pField->GetTopVisibleIndex(); | 1444 int32_t nTop = pField->GetTopVisibleIndex(); |
1448 int32_t nCount = pField->CountOptions(); | 1445 int32_t nCount = pField->CountOptions(); |
1449 int32_t nSelCount = pField->CountSelectedItems(); | 1446 int32_t nSelCount = pField->CountSelectedItems(); |
1450 | 1447 |
1451 for (int32_t i = nTop; i < nCount; i++) { | 1448 for (int32_t i = nTop; i < nCount; ++i) { |
1452 FX_BOOL bSelected = FALSE; | 1449 bool bSelected = false; |
1453 for (int32_t j = 0; j < nSelCount; j++) { | 1450 for (int32_t j = 0; j < nSelCount; ++j) { |
1454 if (pField->GetSelectedIndex(j) == i) { | 1451 if (pField->GetSelectedIndex(j) == i) { |
1455 bSelected = TRUE; | 1452 bSelected = true; |
1456 break; | 1453 break; |
1457 } | 1454 } |
1458 } | 1455 } |
1459 | 1456 |
1460 pEdit->SetText(pField->GetOptionLabel(i).c_str()); | 1457 pEdit->SetText(pField->GetOptionLabel(i).c_str()); |
1461 | 1458 |
1462 CFX_FloatRect rcContent = pEdit->GetContentRect(); | 1459 CFX_FloatRect rcContent = pEdit->GetContentRect(); |
1463 FX_FLOAT fItemHeight = rcContent.Height(); | 1460 FX_FLOAT fItemHeight = rcContent.Height(); |
1464 | 1461 |
1465 if (bSelected) { | 1462 if (bSelected) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 switch (GetBorderStyle()) { | 1599 switch (GetBorderStyle()) { |
1603 case BBS_SOLID: { | 1600 case BBS_SOLID: { |
1604 CFX_ByteString sColor = | 1601 CFX_ByteString sColor = |
1605 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); | 1602 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); |
1606 if (sColor.GetLength() > 0) { | 1603 if (sColor.GetLength() > 0) { |
1607 sLines << "q\n" | 1604 sLines << "q\n" |
1608 << GetBorderWidth() << " w\n" | 1605 << GetBorderWidth() << " w\n" |
1609 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) | 1606 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) |
1610 << " 2 J 0 j\n"; | 1607 << " 2 J 0 j\n"; |
1611 | 1608 |
1612 for (int32_t i = 1; i < nMaxLen; i++) { | 1609 for (int32_t i = 1; i < nMaxLen; ++i) { |
1613 sLines << rcClient.left + | 1610 sLines << rcClient.left + |
1614 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1611 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1615 << " " << rcClient.bottom << " m\n" | 1612 << " " << rcClient.bottom << " m\n" |
1616 << rcClient.left + | 1613 << rcClient.left + |
1617 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1614 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1618 << " " << rcClient.top << " l S\n"; | 1615 << " " << rcClient.top << " l S\n"; |
1619 } | 1616 } |
1620 | 1617 |
1621 sLines << "Q\n"; | 1618 sLines << "Q\n"; |
1622 } | 1619 } |
1623 } break; | 1620 } break; |
1624 case BBS_DASH: { | 1621 case BBS_DASH: { |
1625 CFX_ByteString sColor = | 1622 CFX_ByteString sColor = |
1626 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); | 1623 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); |
1627 if (sColor.GetLength() > 0) { | 1624 if (sColor.GetLength() > 0) { |
1628 CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); | 1625 CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); |
1629 | 1626 |
1630 sLines << "q\n" | 1627 sLines << "q\n" |
1631 << GetBorderWidth() << " w\n" | 1628 << GetBorderWidth() << " w\n" |
1632 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) | 1629 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) |
1633 << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " | 1630 << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " |
1634 << dsBorder.nPhase << " d\n"; | 1631 << dsBorder.nPhase << " d\n"; |
1635 | 1632 |
1636 for (int32_t i = 1; i < nMaxLen; i++) { | 1633 for (int32_t i = 1; i < nMaxLen; ++i) { |
1637 sLines << rcClient.left + | 1634 sLines << rcClient.left + |
1638 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1635 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1639 << " " << rcClient.bottom << " m\n" | 1636 << " " << rcClient.bottom << " m\n" |
1640 << rcClient.left + | 1637 << rcClient.left + |
1641 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1638 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1642 << " " << rcClient.top << " l S\n"; | 1639 << " " << rcClient.top << " l S\n"; |
1643 } | 1640 } |
1644 | 1641 |
1645 sLines << "Q\n"; | 1642 sLines << "Q\n"; |
1646 } | 1643 } |
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 break; | 2819 break; |
2823 } | 2820 } |
2824 } | 2821 } |
2825 } | 2822 } |
2826 | 2823 |
2827 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { | 2824 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { |
2828 CFX_FloatRect rcAnnot; | 2825 CFX_FloatRect rcAnnot; |
2829 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2826 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
2830 return rcAnnot; | 2827 return rcAnnot; |
2831 } | 2828 } |
OLD | NEW |