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 #include "xfa/fwl/core/cfx_barcode.h" | 7 #include "xfa/fwl/core/cfx_barcode.h" |
8 | 8 |
9 #include "xfa/fxbarcode/cbc_codabar.h" | 9 #include "xfa/fxbarcode/cbc_codabar.h" |
10 #include "xfa/fxbarcode/cbc_code128.h" | 10 #include "xfa/fxbarcode/cbc_code128.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 bool CFX_Barcode::SetModuleWidth(int32_t moduleWidth) { | 72 bool CFX_Barcode::SetModuleWidth(int32_t moduleWidth) { |
73 return m_pBCEngine ? m_pBCEngine->SetModuleWidth(moduleWidth) : false; | 73 return m_pBCEngine ? m_pBCEngine->SetModuleWidth(moduleWidth) : false; |
74 } | 74 } |
75 bool CFX_Barcode::SetHeight(int32_t height) { | 75 bool CFX_Barcode::SetHeight(int32_t height) { |
76 return m_pBCEngine ? m_pBCEngine->SetHeight(height) : false; | 76 return m_pBCEngine ? m_pBCEngine->SetHeight(height) : false; |
77 } | 77 } |
78 bool CFX_Barcode::SetWidth(int32_t width) { | 78 bool CFX_Barcode::SetWidth(int32_t width) { |
79 return m_pBCEngine ? m_pBCEngine->SetWidth(width) : false; | 79 return m_pBCEngine ? m_pBCEngine->SetWidth(width) : false; |
80 } | 80 } |
81 bool CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) { | 81 |
82 switch (GetType()) { | |
83 case BC_CODE39: | |
84 case BC_CODABAR: | |
85 case BC_CODE128: | |
86 case BC_CODE128_B: | |
87 case BC_CODE128_C: | |
88 case BC_EAN8: | |
89 case BC_EAN13: | |
90 case BC_UPCA: | |
91 return m_pBCEngine | |
92 ? static_cast<CBC_OneCode*>(m_pBCEngine.get()) | |
93 ->CheckContentValidity(contents) | |
94 : true; | |
95 default: | |
96 return true; | |
97 } | |
98 } | |
99 bool CFX_Barcode::SetPrintChecksum(bool checksum) { | 82 bool CFX_Barcode::SetPrintChecksum(bool checksum) { |
100 switch (GetType()) { | 83 switch (GetType()) { |
101 case BC_CODE39: | 84 case BC_CODE39: |
102 case BC_CODABAR: | 85 case BC_CODABAR: |
103 case BC_CODE128: | 86 case BC_CODE128: |
104 case BC_CODE128_B: | 87 case BC_CODE128_B: |
105 case BC_CODE128_C: | 88 case BC_CODE128_C: |
106 case BC_EAN8: | 89 case BC_EAN8: |
107 case BC_EAN13: | 90 case BC_EAN13: |
108 case BC_UPCA: | 91 case BC_UPCA: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 case BC_EAN13: | 161 case BC_EAN13: |
179 case BC_UPCA: | 162 case BC_UPCA: |
180 return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) | 163 return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) |
181 ->SetFontSize(size), | 164 ->SetFontSize(size), |
182 true) | 165 true) |
183 : false; | 166 : false; |
184 default: | 167 default: |
185 return false; | 168 return false; |
186 } | 169 } |
187 } | 170 } |
188 bool CFX_Barcode::SetFontStyle(int32_t style) { | 171 |
189 switch (GetType()) { | |
190 case BC_CODE39: | |
191 case BC_CODABAR: | |
192 case BC_CODE128: | |
193 case BC_CODE128_B: | |
194 case BC_CODE128_C: | |
195 case BC_EAN8: | |
196 case BC_EAN13: | |
197 case BC_UPCA: | |
198 return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get()) | |
199 ->SetFontStyle(style), | |
200 true) | |
201 : false; | |
202 default: | |
203 return false; | |
204 } | |
205 } | |
206 bool CFX_Barcode::SetFontColor(FX_ARGB color) { | 172 bool CFX_Barcode::SetFontColor(FX_ARGB color) { |
207 switch (GetType()) { | 173 switch (GetType()) { |
208 case BC_CODE39: | 174 case BC_CODE39: |
209 case BC_CODABAR: | 175 case BC_CODABAR: |
210 case BC_CODE128: | 176 case BC_CODE128: |
211 case BC_CODE128_B: | 177 case BC_CODE128_B: |
212 case BC_CODE128_C: | 178 case BC_CODE128_C: |
213 case BC_EAN8: | 179 case BC_EAN8: |
214 case BC_EAN13: | 180 case BC_EAN13: |
215 case BC_UPCA: | 181 case BC_UPCA: |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 bool isDevice, | 291 bool isDevice, |
326 int32_t& e) { | 292 int32_t& e) { |
327 return m_pBCEngine && m_pBCEngine->Encode(contents, isDevice, e); | 293 return m_pBCEngine && m_pBCEngine->Encode(contents, isDevice, e); |
328 } | 294 } |
329 | 295 |
330 bool CFX_Barcode::RenderDevice(CFX_RenderDevice* device, | 296 bool CFX_Barcode::RenderDevice(CFX_RenderDevice* device, |
331 const CFX_Matrix* matrix, | 297 const CFX_Matrix* matrix, |
332 int32_t& e) { | 298 int32_t& e) { |
333 return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix, e); | 299 return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix, e); |
334 } | 300 } |
335 | |
336 bool CFX_Barcode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) { | |
337 return m_pBCEngine && m_pBCEngine->RenderBitmap(pOutBitmap, e); | |
338 } | |
OLD | NEW |