summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_widgetacc.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-09 10:47:23 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-09 17:58:39 +0000
commitef55c79650768a731c22038acd36b2a741706ed6 (patch)
tree496a6f9a063e950006d43d91c774a2e364791a4a /xfa/fxfa/cxfa_widgetacc.cpp
parent95bb9748c9292d282e2425d4500f15f5c48c2b34 (diff)
downloadpdfium-ef55c79650768a731c22038acd36b2a741706ed6.tar.xz
Move barcode code from WidgetAcc to Node
This CL moves the barcode related code from CXFA_WidgetAcc to CXFA_Node. Change-Id: Id3f5f30222535a69a0bf4d59416e57d452c7d8e8 Reviewed-on: https://pdfium-review.googlesource.com/22551 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_widgetacc.cpp')
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp145
1 files changed, 0 insertions, 145 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 870dc53ff9..0531c0fcb0 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -2124,151 +2124,6 @@ Optional<int32_t> CXFA_WidgetAcc::GetNumberOfCells() {
return {};
}
-WideString CXFA_WidgetAcc::GetBarcodeType() {
- CXFA_Node* pUIChild = GetUIChild();
- return pUIChild
- ? WideString(pUIChild->JSObject()->GetCData(XFA_Attribute::Type))
- : WideString();
-}
-
-Optional<BC_CHAR_ENCODING> CXFA_WidgetAcc::GetBarcodeAttribute_CharEncoding() {
- Optional<WideString> wsCharEncoding =
- GetUIChild()->JSObject()->TryCData(XFA_Attribute::CharEncoding, true);
- if (!wsCharEncoding)
- return {};
- if (wsCharEncoding->CompareNoCase(L"UTF-16"))
- return {CHAR_ENCODING_UNICODE};
- if (wsCharEncoding->CompareNoCase(L"UTF-8"))
- return {CHAR_ENCODING_UTF8};
- return {};
-}
-
-Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Checksum() {
- Optional<XFA_AttributeEnum> checksum =
- GetUIChild()->JSObject()->TryEnum(XFA_Attribute::Checksum, true);
- if (!checksum)
- return {};
-
- switch (*checksum) {
- case XFA_AttributeEnum::None:
- return {false};
- case XFA_AttributeEnum::Auto:
- return {true};
- case XFA_AttributeEnum::Checksum_1mod10:
- case XFA_AttributeEnum::Checksum_1mod10_1mod11:
- case XFA_AttributeEnum::Checksum_2mod10:
- default:
- break;
- }
- return {};
-}
-
-Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_DataLength() {
- Optional<WideString> wsDataLength =
- GetUIChild()->JSObject()->TryCData(XFA_Attribute::DataLength, true);
- if (!wsDataLength)
- return {};
-
- return {FXSYS_wtoi(wsDataLength->c_str())};
-}
-
-Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_StartChar() {
- Optional<WideString> wsStartEndChar =
- GetUIChild()->JSObject()->TryCData(XFA_Attribute::StartChar, true);
- if (!wsStartEndChar || wsStartEndChar->IsEmpty())
- return {};
-
- return {static_cast<char>((*wsStartEndChar)[0])};
-}
-
-Optional<char> CXFA_WidgetAcc::GetBarcodeAttribute_EndChar() {
- Optional<WideString> wsStartEndChar =
- GetUIChild()->JSObject()->TryCData(XFA_Attribute::EndChar, true);
- if (!wsStartEndChar || wsStartEndChar->IsEmpty())
- return {};
-
- return {static_cast<char>((*wsStartEndChar)[0])};
-}
-
-Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ECLevel() {
- Optional<WideString> wsECLevel = GetUIChild()->JSObject()->TryCData(
- XFA_Attribute::ErrorCorrectionLevel, true);
- if (!wsECLevel)
- return {};
- return {FXSYS_wtoi(wsECLevel->c_str())};
-}
-
-Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleWidth() {
- Optional<CXFA_Measurement> moduleWidthHeight =
- GetUIChild()->JSObject()->TryMeasure(XFA_Attribute::ModuleWidth, true);
- if (!moduleWidthHeight)
- return {};
-
- return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
-}
-
-Optional<int32_t> CXFA_WidgetAcc::GetBarcodeAttribute_ModuleHeight() {
- Optional<CXFA_Measurement> moduleWidthHeight =
- GetUIChild()->JSObject()->TryMeasure(XFA_Attribute::ModuleHeight, true);
- if (!moduleWidthHeight)
- return {};
-
- return {static_cast<int32_t>(moduleWidthHeight->ToUnit(XFA_Unit::Pt))};
-}
-
-Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_PrintChecksum() {
- return GetUIChild()->JSObject()->TryBoolean(XFA_Attribute::PrintCheckDigit,
- true);
-}
-
-Optional<BC_TEXT_LOC> CXFA_WidgetAcc::GetBarcodeAttribute_TextLocation() {
- Optional<XFA_AttributeEnum> textLocation =
- GetUIChild()->JSObject()->TryEnum(XFA_Attribute::TextLocation, true);
- if (!textLocation)
- return {};
-
- switch (*textLocation) {
- case XFA_AttributeEnum::None:
- return {BC_TEXT_LOC_NONE};
- case XFA_AttributeEnum::Above:
- return {BC_TEXT_LOC_ABOVE};
- case XFA_AttributeEnum::Below:
- return {BC_TEXT_LOC_BELOW};
- case XFA_AttributeEnum::AboveEmbedded:
- return {BC_TEXT_LOC_ABOVEEMBED};
- case XFA_AttributeEnum::BelowEmbedded:
- return {BC_TEXT_LOC_BELOWEMBED};
- default:
- break;
- }
- return {};
-}
-
-Optional<bool> CXFA_WidgetAcc::GetBarcodeAttribute_Truncate() {
- return GetUIChild()->JSObject()->TryBoolean(XFA_Attribute::Truncate, true);
-}
-
-Optional<int8_t> CXFA_WidgetAcc::GetBarcodeAttribute_WideNarrowRatio() {
- Optional<WideString> wsWideNarrowRatio =
- GetUIChild()->JSObject()->TryCData(XFA_Attribute::WideNarrowRatio, true);
- if (!wsWideNarrowRatio)
- return {};
-
- Optional<size_t> ptPos = wsWideNarrowRatio->Find(':');
- if (!ptPos)
- return {static_cast<int8_t>(FXSYS_wtoi(wsWideNarrowRatio->c_str()))};
-
- int32_t fB = FXSYS_wtoi(
- wsWideNarrowRatio->Right(wsWideNarrowRatio->GetLength() - (*ptPos + 1))
- .c_str());
- if (!fB)
- return {0};
-
- int32_t fA = FXSYS_wtoi(wsWideNarrowRatio->Left(*ptPos).c_str());
- float result = static_cast<float>(fA) / static_cast<float>(fB);
- return {static_cast<int8_t>(result)};
-}
-
WideString CXFA_WidgetAcc::GetPasswordChar() {
CXFA_Node* pUIChild = GetUIChild();
return pUIChild ? pUIChild->JSObject()->GetCData(XFA_Attribute::PasswordChar)