Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1307)

Side by Side Diff: xfa/fwl/core/cfwl_barcode.h

Issue 2524173002: Merge IFWL and CFWL classes. (Closed)
Patch Set: make chrome build happy Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
11
10 #include "xfa/fwl/core/cfwl_edit.h" 12 #include "xfa/fwl/core/cfwl_edit.h"
11 #include "xfa/fwl/core/fwl_error.h" 13 #include "xfa/fwl/core/cfwl_scrollbar.h"
12 #include "xfa/fwl/core/ifwl_barcode.h" 14 #include "xfa/fwl/core/cfwl_widget.h"
15 #include "xfa/fxbarcode/BC_Library.h"
13 16
14 class CFWL_Barcode : public CFWL_Edit, public IFWL_Barcode::DataProvider { 17 class CFWL_WidgetProperties;
18 class CFX_Barcode;
19 class CFWL_Widget;
20
21 #define XFA_BCS_NeedUpdate 0x0001
22 #define XFA_BCS_EncodeSuccess 0x0002
23
24 enum FWL_BCDAttribute {
25 FWL_BCDATTRIBUTE_NONE = 0,
26 FWL_BCDATTRIBUTE_CHARENCODING = 1 << 0,
27 FWL_BCDATTRIBUTE_MODULEHEIGHT = 1 << 1,
28 FWL_BCDATTRIBUTE_MODULEWIDTH = 1 << 2,
29 FWL_BCDATTRIBUTE_DATALENGTH = 1 << 3,
30 FWL_BCDATTRIBUTE_CALCHECKSUM = 1 << 4,
31 FWL_BCDATTRIBUTE_PRINTCHECKSUM = 1 << 5,
32 FWL_BCDATTRIBUTE_TEXTLOCATION = 1 << 6,
33 FWL_BCDATTRIBUTE_WIDENARROWRATIO = 1 << 7,
34 FWL_BCDATTRIBUTE_STARTCHAR = 1 << 8,
35 FWL_BCDATTRIBUTE_ENDCHAR = 1 << 9,
36 FWL_BCDATTRIBUTE_VERSION = 1 << 10,
37 FWL_BCDATTRIBUTE_ECLEVEL = 1 << 11,
38 FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12
39 };
40
41 class CFWL_Barcode : public CFWL_Edit {
15 public: 42 public:
16 explicit CFWL_Barcode(const CFWL_App* pApp); 43 explicit CFWL_Barcode(const CFWL_App* pApp);
17 ~CFWL_Barcode() override; 44 ~CFWL_Barcode() override;
18 45
19 void Initialize(); 46 // CFWL_Widget
47 FWL_Type GetClassID() const override;
48 void Update() override;
49 void DrawWidget(CFX_Graphics* pGraphics,
50 const CFX_Matrix* pMatrix = nullptr) override;
51 void OnProcessEvent(CFWL_Event* pEvent) override;
20 52
21 // IFWL_Barcode::DataProvider 53 // CFWL_Edit
22 BC_CHAR_ENCODING GetCharEncoding() const override; 54 void SetText(const CFX_WideString& wsText) override;
23 int32_t GetModuleHeight() const override;
24 int32_t GetModuleWidth() const override;
25 int32_t GetDataLength() const override;
26 bool GetCalChecksum() const override;
27 bool GetPrintChecksum() const override;
28 BC_TEXT_LOC GetTextLocation() const override;
29 int32_t GetWideNarrowRatio() const override;
30 FX_CHAR GetStartChar() const override;
31 FX_CHAR GetEndChar() const override;
32 int32_t GetVersion() const override;
33 int32_t GetErrorCorrectionLevel() const override;
34 bool GetTruncated() const override;
35 uint32_t GetBarcodeAttributeMask() const override;
36 55
37 void SetType(BC_TYPE type); 56 void SetType(BC_TYPE type);
38 bool IsProtectedType(); 57 bool IsProtectedType() const;
39 58
40 void SetCharEncoding(BC_CHAR_ENCODING encoding); 59 void SetCharEncoding(BC_CHAR_ENCODING encoding);
41 void SetModuleHeight(int32_t height); 60 void SetModuleHeight(int32_t height);
42 void SetModuleWidth(int32_t width); 61 void SetModuleWidth(int32_t width);
43 void SetDataLength(int32_t dataLength); 62 void SetDataLength(int32_t dataLength);
44 void SetCalChecksum(bool calChecksum); 63 void SetCalChecksum(bool calChecksum);
45 void SetPrintChecksum(bool printChecksum); 64 void SetPrintChecksum(bool printChecksum);
46 void SetTextLocation(BC_TEXT_LOC location); 65 void SetTextLocation(BC_TEXT_LOC location);
47 void SetWideNarrowRatio(int32_t ratio); 66 void SetWideNarrowRatio(int32_t ratio);
48 void SetStartChar(FX_CHAR startChar); 67 void SetStartChar(FX_CHAR startChar);
49 void SetEndChar(FX_CHAR endChar); 68 void SetEndChar(FX_CHAR endChar);
50 void SetErrorCorrectionLevel(int32_t ecLevel); 69 void SetErrorCorrectionLevel(int32_t ecLevel);
51 void SetTruncated(bool truncated); 70 void SetTruncated(bool truncated);
52 71
53 private: 72 private:
73 void GenerateBarcodeImageCache();
74 void CreateBarcodeEngine();
75
76 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
77 uint32_t m_dwStatus;
78 BC_TYPE m_type;
54 BC_CHAR_ENCODING m_eCharEncoding; 79 BC_CHAR_ENCODING m_eCharEncoding;
55 int32_t m_nModuleHeight; 80 int32_t m_nModuleHeight;
56 int32_t m_nModuleWidth; 81 int32_t m_nModuleWidth;
57 int32_t m_nDataLength; 82 int32_t m_nDataLength;
58 bool m_bCalChecksum; 83 bool m_bCalChecksum;
59 bool m_bPrintChecksum; 84 bool m_bPrintChecksum;
60 BC_TEXT_LOC m_eTextLocation; 85 BC_TEXT_LOC m_eTextLocation;
61 int32_t m_nWideNarrowRatio; 86 int32_t m_nWideNarrowRatio;
62 FX_CHAR m_cStartChar; 87 FX_CHAR m_cStartChar;
63 FX_CHAR m_cEndChar; 88 FX_CHAR m_cEndChar;
64 int32_t m_nECLevel; 89 int32_t m_nECLevel;
65 bool m_bTruncated; 90 bool m_bTruncated;
66 uint32_t m_dwAttributeMask; 91 uint32_t m_dwAttributeMask;
67 }; 92 };
68 93
69 #endif // XFA_FWL_CORE_CFWL_BARCODE_H_ 94 #endif // XFA_FWL_CORE_CFWL_BARCODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698