blob: 00bf82957a5a92125629f80a60c6b3c06a606b77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/fwl/core/cfwl_barcode.h"
#include <memory>
#include "third_party/base/ptr_util.h"
namespace {
IFWL_Barcode* ToBarcode(IFWL_Widget* widget) {
return static_cast<IFWL_Barcode*>(widget);
}
} // namespace
CFWL_Barcode::CFWL_Barcode(const IFWL_App* app)
: CFWL_Edit(app), m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {}
CFWL_Barcode::~CFWL_Barcode() {}
void CFWL_Barcode::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_Barcode>(
m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
CFWL_Widget::Initialize();
}
void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
m_eCharEncoding = encoding;
}
void CFWL_Barcode::SetModuleHeight(int32_t height) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
m_nModuleHeight = height;
}
void CFWL_Barcode::SetModuleWidth(int32_t width) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
m_nModuleWidth = width;
}
void CFWL_Barcode::SetDataLength(int32_t dataLength) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
m_nDataLength = dataLength;
ToBarcode(GetWidget())->SetLimit(dataLength);
}
void CFWL_Barcode::SetCalChecksum(bool calChecksum) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
m_bCalChecksum = calChecksum;
}
void CFWL_Barcode::SetPrintChecksum(bool printChecksum) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
m_bPrintChecksum = printChecksum;
}
void CFWL_Barcode::SetTextLocation(BC_TEXT_LOC location) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
m_eTextLocation = location;
}
void CFWL_Barcode::SetWideNarrowRatio(int32_t ratio) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
m_nWideNarrowRatio = ratio;
}
void CFWL_Barcode::SetStartChar(FX_CHAR startChar) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
m_cStartChar = startChar;
}
void CFWL_Barcode::SetEndChar(FX_CHAR endChar) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
m_cEndChar = endChar;
}
void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
m_nECLevel = ecLevel;
}
void CFWL_Barcode::SetTruncated(bool truncated) {
m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
m_bTruncated = truncated;
}
void CFWL_Barcode::SetType(BC_TYPE type) {
if (GetWidget())
ToBarcode(GetWidget())->SetType(type);
}
bool CFWL_Barcode::IsProtectedType() {
return GetWidget() ? ToBarcode(GetWidget())->IsProtectedType() : false;
}
BC_CHAR_ENCODING CFWL_Barcode::GetCharEncoding() const {
return m_eCharEncoding;
}
int32_t CFWL_Barcode::GetModuleHeight() const {
return m_nModuleHeight;
}
int32_t CFWL_Barcode::GetModuleWidth() const {
return m_nModuleWidth;
}
int32_t CFWL_Barcode::GetDataLength() const {
return m_nDataLength;
}
bool CFWL_Barcode::GetCalChecksum() const {
return m_bCalChecksum;
}
bool CFWL_Barcode::GetPrintChecksum() const {
return m_bPrintChecksum;
}
BC_TEXT_LOC CFWL_Barcode::GetTextLocation() const {
return m_eTextLocation;
}
int32_t CFWL_Barcode::GetWideNarrowRatio() const {
return m_nWideNarrowRatio;
}
FX_CHAR CFWL_Barcode::GetStartChar() const {
return m_cStartChar;
}
FX_CHAR CFWL_Barcode::GetEndChar() const {
return m_cEndChar;
}
int32_t CFWL_Barcode::GetVersion() const {
return 0;
}
int32_t CFWL_Barcode::GetErrorCorrectionLevel() const {
return m_nECLevel;
}
bool CFWL_Barcode::GetTruncated() const {
return m_bTruncated;
}
uint32_t CFWL_Barcode::GetBarcodeAttributeMask() const {
return m_dwAttributeMask;
}
|