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/cfwl_barcode.h" | 7 #include "xfa/fwl/core/cfwl_barcode.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
| 11 #include "third_party/base/ptr_util.h" |
| 12 |
11 namespace { | 13 namespace { |
12 | 14 |
13 IFWL_Barcode* ToBarcode(IFWL_Widget* widget) { | 15 IFWL_Barcode* ToBarcode(IFWL_Widget* widget) { |
14 return static_cast<IFWL_Barcode*>(widget); | 16 return static_cast<IFWL_Barcode*>(widget); |
15 } | 17 } |
16 | 18 |
17 } // namespace | 19 } // namespace |
18 | 20 |
19 CFWL_Barcode::CFWL_Barcode(const IFWL_App* app) : CFWL_Edit(app) {} | 21 CFWL_Barcode::CFWL_Barcode(const IFWL_App* app) : CFWL_Edit(app) {} |
20 | 22 |
21 CFWL_Barcode::~CFWL_Barcode() {} | 23 CFWL_Barcode::~CFWL_Barcode() {} |
22 | 24 |
23 void CFWL_Barcode::Initialize() { | 25 void CFWL_Barcode::Initialize() { |
24 ASSERT(!m_pIface); | 26 ASSERT(!m_pIface); |
25 std::unique_ptr<IFWL_Barcode> pBarcode(new IFWL_Barcode( | |
26 m_pApp, m_pProperties->MakeWidgetImpProperties(&m_barcodeData))); | |
27 pBarcode->Initialize(); | |
28 | 27 |
29 m_pIface = std::move(pBarcode); | 28 m_pIface = pdfium::MakeUnique<IFWL_Barcode>( |
| 29 m_pApp, m_pProperties->MakeWidgetImpProperties(&m_barcodeData)); |
| 30 |
30 CFWL_Widget::Initialize(); | 31 CFWL_Widget::Initialize(); |
31 } | 32 } |
32 | 33 |
33 void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { | 34 void CFWL_Barcode::SetCharEncoding(BC_CHAR_ENCODING encoding) { |
34 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; | 35 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CHARENCODING; |
35 m_barcodeData.m_eCharEncoding = encoding; | 36 m_barcodeData.m_eCharEncoding = encoding; |
36 } | 37 } |
37 void CFWL_Barcode::SetModuleHeight(int32_t height) { | 38 void CFWL_Barcode::SetModuleHeight(int32_t height) { |
38 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT; | 39 m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_MODULEHEIGHT; |
39 m_barcodeData.m_nModuleHeight = height; | 40 m_barcodeData.m_nModuleHeight = height; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return m_nECLevel; | 153 return m_nECLevel; |
153 } | 154 } |
154 | 155 |
155 FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const { | 156 FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() const { |
156 return m_bTruncated; | 157 return m_bTruncated; |
157 } | 158 } |
158 | 159 |
159 uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const { | 160 uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() const { |
160 return m_dwAttributeMask; | 161 return m_dwAttributeMask; |
161 } | 162 } |
OLD | NEW |