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 #ifndef XFA_FWL_CORE_CFWL_BARCODE_H_ | 7 #ifndef XFA_FWL_CORE_CFWL_BARCODE_H_ |
8 #define XFA_FWL_CORE_CFWL_BARCODE_H_ | 8 #define XFA_FWL_CORE_CFWL_BARCODE_H_ |
9 | 9 |
10 #include "xfa/fwl/core/cfwl_edit.h" | 10 #include "xfa/fwl/core/cfwl_edit.h" |
11 #include "xfa/fwl/core/fwl_error.h" | 11 #include "xfa/fwl/core/fwl_error.h" |
12 #include "xfa/fwl/core/ifwl_barcode.h" | 12 #include "xfa/fwl/core/ifwl_barcode.h" |
13 | 13 |
14 class CFWL_Widget; | 14 class CFWL_Widget; |
15 class CFWL_WidgetProperties; | 15 class CFWL_WidgetProperties; |
16 | 16 |
17 class CFWL_Barcode : public CFWL_Edit { | 17 class CFWL_Barcode : public CFWL_Edit { |
18 public: | 18 public: |
19 CFWL_Barcode(const IFWL_App*); | 19 CFWL_Barcode(const IFWL_App*); |
20 ~CFWL_Barcode() override; | 20 ~CFWL_Barcode() override; |
21 | 21 |
22 IFWL_Barcode* GetWidget() override; | |
23 const IFWL_Barcode* GetWidget() const override; | |
24 | |
25 void Initialize(); | 22 void Initialize(); |
26 | 23 |
27 void SetType(BC_TYPE type); | 24 void SetType(BC_TYPE type); |
28 FX_BOOL IsProtectedType(); | 25 FX_BOOL IsProtectedType(); |
29 | 26 |
30 void SetCharEncoding(BC_CHAR_ENCODING encoding) { | 27 void SetCharEncoding(BC_CHAR_ENCODING encoding); |
31 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; | 28 void SetModuleHeight(int32_t height); |
32 m_barcodeData.m_eCharEncoding = encoding; | 29 void SetModuleWidth(int32_t width); |
33 } | 30 void SetDataLength(int32_t dataLength); |
34 void SetModuleHeight(int32_t height) { | 31 void SetCalChecksum(FX_BOOL calChecksum); |
35 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT; | 32 void SetPrintChecksum(FX_BOOL printChecksum); |
36 m_barcodeData.m_nModuleHeight = height; | 33 void SetTextLocation(BC_TEXT_LOC location); |
37 } | 34 void SetWideNarrowRatio(int32_t ratio); |
38 void SetModuleWidth(int32_t width) { | 35 void SetStartChar(FX_CHAR startChar); |
39 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH; | 36 void SetEndChar(FX_CHAR endChar); |
40 m_barcodeData.m_nModuleWidth = width; | 37 void SetVersion(int32_t version); |
41 } | 38 void SetErrorCorrectionLevel(int32_t ecLevel); |
42 void SetDataLength(int32_t dataLength) { | 39 void SetTruncated(FX_BOOL truncated); |
43 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH; | 40 void ResetBarcodeAttributes(); |
44 m_barcodeData.m_nDataLength = dataLength; | |
45 GetWidget()->SetLimit(dataLength); | |
46 } | |
47 void SetCalChecksum(FX_BOOL calChecksum) { | |
48 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM; | |
49 m_barcodeData.m_bCalChecksum = calChecksum; | |
50 } | |
51 void SetPrintChecksum(FX_BOOL printChecksum) { | |
52 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM; | |
53 m_barcodeData.m_bPrintChecksum = printChecksum; | |
54 } | |
55 void SetTextLocation(BC_TEXT_LOC location) { | |
56 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION; | |
57 m_barcodeData.m_eTextLocation = location; | |
58 } | |
59 void SetWideNarrowRatio(int32_t ratio) { | |
60 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO; | |
61 m_barcodeData.m_nWideNarrowRatio = ratio; | |
62 } | |
63 void SetStartChar(FX_CHAR startChar) { | |
64 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR; | |
65 m_barcodeData.m_cStartChar = startChar; | |
66 } | |
67 void SetEndChar(FX_CHAR endChar) { | |
68 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR; | |
69 m_barcodeData.m_cEndChar = endChar; | |
70 } | |
71 void SetVersion(int32_t version) { | |
72 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION; | |
73 m_barcodeData.m_nVersion = version; | |
74 } | |
75 void SetErrorCorrectionLevel(int32_t ecLevel) { | |
76 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL; | |
77 m_barcodeData.m_nECLevel = ecLevel; | |
78 } | |
79 void SetTruncated(FX_BOOL truncated) { | |
80 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED; | |
81 m_barcodeData.m_bTruncated = truncated; | |
82 } | |
83 void ResetBarcodeAttributes() { | |
84 m_barcodeData.m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE; | |
85 } | |
86 | 41 |
87 protected: | 42 protected: |
88 class CFWL_BarcodeDP : public IFWL_BarcodeDP { | 43 class CFWL_BarcodeDP : public IFWL_BarcodeDP { |
89 public: | 44 public: |
90 CFWL_BarcodeDP(); | 45 CFWL_BarcodeDP(); |
91 | 46 |
92 // IFWL_DataProvider | 47 // IFWL_DataProvider |
93 FWL_Error GetCaption(IFWL_Widget* pWidget, | 48 FWL_Error GetCaption(IFWL_Widget* pWidget, |
94 CFX_WideString& wsCaption) override; | 49 CFX_WideString& wsCaption) override; |
95 | 50 |
(...skipping 26 matching lines...) Expand all Loading... |
122 int32_t m_nVersion; | 77 int32_t m_nVersion; |
123 int32_t m_nECLevel; | 78 int32_t m_nECLevel; |
124 FX_BOOL m_bTruncated; | 79 FX_BOOL m_bTruncated; |
125 uint32_t m_dwAttributeMask; | 80 uint32_t m_dwAttributeMask; |
126 }; | 81 }; |
127 | 82 |
128 CFWL_BarcodeDP m_barcodeData; | 83 CFWL_BarcodeDP m_barcodeData; |
129 }; | 84 }; |
130 | 85 |
131 #endif // XFA_FWL_CORE_CFWL_BARCODE_H_ | 86 #endif // XFA_FWL_CORE_CFWL_BARCODE_H_ |
OLD | NEW |