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

Side by Side Diff: xfa/fwl/core/ifwl_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
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_FWL_CORE_IFWL_BARCODE_H_
8 #define XFA_FWL_CORE_IFWL_BARCODE_H_
9
10 #include <memory>
11
12 #include "xfa/fwl/core/cfwl_scrollbar.h"
13 #include "xfa/fwl/core/ifwl_edit.h"
14 #include "xfa/fwl/core/ifwl_widget.h"
15 #include "xfa/fxbarcode/BC_Library.h"
16
17 class CFWL_WidgetProperties;
18 class CFX_Barcode;
19 class IFWL_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 IFWL_Barcode : public IFWL_Edit {
42 public:
43 class DataProvider {
44 public:
45 virtual BC_CHAR_ENCODING GetCharEncoding() const = 0;
46 virtual int32_t GetModuleHeight() const = 0;
47 virtual int32_t GetModuleWidth() const = 0;
48 virtual int32_t GetDataLength() const = 0;
49 virtual bool GetCalChecksum() const = 0;
50 virtual bool GetPrintChecksum() const = 0;
51 virtual BC_TEXT_LOC GetTextLocation() const = 0;
52 virtual int32_t GetWideNarrowRatio() const = 0;
53 virtual FX_CHAR GetStartChar() const = 0;
54 virtual FX_CHAR GetEndChar() const = 0;
55 virtual int32_t GetVersion() const = 0;
56 virtual int32_t GetErrorCorrectionLevel() const = 0;
57 virtual bool GetTruncated() const = 0;
58 virtual uint32_t GetBarcodeAttributeMask() const = 0;
59 };
60
61 IFWL_Barcode(const CFWL_App* app,
62 std::unique_ptr<CFWL_WidgetProperties> properties);
63 ~IFWL_Barcode() override;
64
65 // IFWL_Widget
66 FWL_Type GetClassID() const override;
67 void Update() override;
68 void DrawWidget(CFX_Graphics* pGraphics,
69 const CFX_Matrix* pMatrix = nullptr) override;
70 void OnProcessEvent(CFWL_Event* pEvent) override;
71
72 // IFWL_Edit
73 void SetText(const CFX_WideString& wsText) override;
74
75 void SetType(BC_TYPE type);
76 bool IsProtectedType() const;
77
78 void SetDataProvider(IFWL_Barcode::DataProvider* provider) {
79 m_pDataProvider = provider;
80 }
81
82 private:
83 void GenerateBarcodeImageCache();
84 void CreateBarcodeEngine();
85
86 std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
87 IFWL_Barcode::DataProvider* m_pDataProvider; // Not owned.
88 uint32_t m_dwStatus;
89 BC_TYPE m_type;
90 };
91
92 #endif // XFA_FWL_CORE_IFWL_BARCODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698