summaryrefslogtreecommitdiff
path: root/xfa/include/fwl/lightwidget/barcode.h
blob: 242b432ab1d7ab0cf2673784e3de62f24afa14eb (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// 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

#ifndef _FWL_BARCODE_LIGHT_H
#define _FWL_BARCODE_LIGHT_H
class CFWL_Widget;
class CFWL_WidgetProperties;
class IFWL_BarcodeDP;
class CFWL_Edit;
class CFWL_Barcode;
class CFWL_BarcodeDP;
class CFWL_Barcode : public CFWL_Edit
{
public:
    static CFWL_Barcode* Create();
    FWL_ERR	Initialize(const CFWL_WidgetProperties *pProperties = NULL);
    void		SetType(BC_TYPE type);
    FX_BOOL		IsProtectedType();
public:
    void		SetCharEncoding(BC_CHAR_ENCODING encoding)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING;
        m_barcodeData.m_eCharEncoding = encoding;
    }
    void		SetModuleHeight(int32_t height)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT;
        m_barcodeData.m_nModuleHeight = height;
    }
    void		SetModuleWidth(int32_t width)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEWIDTH;
        m_barcodeData.m_nModuleWidth = width;
    }
    void		SetDataLength(int32_t dataLength)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
        m_barcodeData.m_nDataLength = dataLength;
        ((IFWL_Barcode*)m_pImp)->SetLimit(dataLength);
    }
    void		SetCalChecksum(int32_t calChecksum)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
        m_barcodeData.m_nCalChecksum = calChecksum;
    }
    void		SetPrintChecksum(FX_BOOL printChecksum)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_PRINTCHECKSUM;
        m_barcodeData.m_bPrintChecksum = printChecksum;
    }
    void		SetTextLocation(BC_TEXT_LOC location)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TEXTLOCATION;
        m_barcodeData.m_eTextLocation = location;
    }
    void		SetWideNarrowRatio(int32_t ratio)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_WIDENARROWRATIO;
        m_barcodeData.m_nWideNarrowRatio = ratio;
    }
    void		SetStartChar(FX_CHAR startChar)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_STARTCHAR;
        m_barcodeData.m_cStartChar = startChar;
    }
    void		SetEndChar(FX_CHAR endChar)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ENDCHAR;
        m_barcodeData.m_cEndChar = endChar;
    }
    void		SetVersion(int32_t version)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION;
        m_barcodeData.m_nVersion = version;
    }
    void		SetErrorCorrectionLevel(int32_t ecLevel)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL;
        m_barcodeData.m_nECLevel = ecLevel;
    }
    void		SetTruncated(FX_BOOL truncated)
    {
        m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_TRUNCATED;
        m_barcodeData.m_bTruncated = truncated;
    }
    void		ResetBarcodeAttributes()
    {
        m_barcodeData.m_dwAttributeMask = 0;
    }
protected:
    CFWL_Barcode();
    virtual ~CFWL_Barcode();
    class CFWL_BarcodeDP : public IFWL_BarcodeDP
    {
    public:
        virtual FWL_ERR				GetCaption(IFWL_Widget *pWidget, CFX_WideString &wsCaption);
        BC_CHAR_ENCODING			m_eCharEncoding;
        virtual BC_CHAR_ENCODING	GetCharEncoding()
        {
            return m_eCharEncoding;
        }
        int32_t					m_nModuleHeight, m_nModuleWidth;
        virtual int32_t			GetModuleHeight()
        {
            return m_nModuleHeight;
        }
        virtual int32_t			GetModuleWidth()
        {
            return m_nModuleWidth;
        }
        int32_t					m_nDataLength;
        virtual int32_t			GetDataLength()
        {
            return m_nDataLength;
        }
        int32_t					m_nCalChecksum;
        virtual int32_t			GetCalChecksum()
        {
            return m_nCalChecksum;
        }
        FX_BOOL						m_bPrintChecksum;
        virtual FX_BOOL				GetPrintChecksum()
        {
            return m_bPrintChecksum;
        }

        BC_TEXT_LOC					m_eTextLocation;
        virtual BC_TEXT_LOC			GetTextLocation()
        {
            return m_eTextLocation;
        }
        int32_t					m_nWideNarrowRatio;
        virtual int32_t			GetWideNarrowRatio()
        {
            return m_nWideNarrowRatio;
        }
        FX_CHAR						m_cStartChar, m_cEndChar;
        virtual FX_CHAR				GetStartChar()
        {
            return m_cStartChar;
        }
        virtual FX_CHAR				GetEndChar()
        {
            return m_cEndChar;
        }
        int32_t					m_nVersion;
        virtual int32_t			GetVersion()
        {
            return m_nVersion;
        }
        int32_t					m_nECLevel;
        virtual int32_t			GetErrorCorrectionLevel()
        {
            return m_nECLevel;
        }
        FX_BOOL						m_bTruncated;
        virtual FX_BOOL				GetTruncated()
        {
            return m_bTruncated;
        }
        FX_DWORD					m_dwAttributeMask;
        virtual FX_DWORD			GetBarcodeAttributeMask()
        {
            return m_dwAttributeMask;
        }
    public:
        CFWL_BarcodeDP()
            : m_dwAttributeMask(0)
        {
        }
    };
    CFWL_BarcodeDP m_barcodeData;
};
#endif