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

Side by Side Diff: xfa/fwl/basewidget/fwl_barcodeimp.cpp

Issue 1890443002: Remove IFX_Barcode. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months 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
« no previous file with comments | « xfa/fwl/basewidget/fwl_barcodeimp.h ('k') | xfa/fwl/basewidget/fxmath_barcodeimp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "xfa/fwl/basewidget/fwl_barcodeimp.h" 7 #include "xfa/fwl/basewidget/fwl_barcodeimp.h"
8 8
9 #include "xfa/fwl/basewidget/fwl_editimp.h" 9 #include "xfa/fwl/basewidget/fwl_editimp.h"
10 #include "xfa/fwl/basewidget/fxmath_barcodeimp.h"
10 #include "xfa/fwl/core/cfwl_themepart.h" 11 #include "xfa/fwl/core/cfwl_themepart.h"
11 #include "xfa/fwl/core/fwl_noteimp.h" 12 #include "xfa/fwl/core/fwl_noteimp.h"
12 #include "xfa/fwl/core/fwl_targetimp.h" 13 #include "xfa/fwl/core/fwl_targetimp.h"
13 #include "xfa/fwl/core/fwl_widgetimp.h" 14 #include "xfa/fwl/core/fwl_widgetimp.h"
14 #include "xfa/fwl/core/ifwl_themeprovider.h" 15 #include "xfa/fwl/core/ifwl_themeprovider.h"
15 16
16 // static 17 // static
17 IFWL_Barcode* IFWL_Barcode::Create(const CFWL_WidgetImpProperties& properties) { 18 IFWL_Barcode* IFWL_Barcode::Create(const CFWL_WidgetImpProperties& properties) {
18 IFWL_Barcode* pBarcode = new IFWL_Barcode; 19 IFWL_Barcode* pBarcode = new IFWL_Barcode;
19 CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, nullptr); 20 CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, nullptr);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 m_pBarcodeEngine->SetErrorCorrectionLevel(pData->GetErrorCorrectionLevel()); 168 m_pBarcodeEngine->SetErrorCorrectionLevel(pData->GetErrorCorrectionLevel());
168 } 169 }
169 if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED) { 170 if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED) {
170 m_pBarcodeEngine->SetTruncated(pData->GetTruncated()); 171 m_pBarcodeEngine->SetTruncated(pData->GetTruncated());
171 } 172 }
172 int32_t errorCode = 0; 173 int32_t errorCode = 0;
173 m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), TRUE, errorCode) 174 m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), TRUE, errorCode)
174 ? XFA_BCS_EncodeSuccess 175 ? XFA_BCS_EncodeSuccess
175 : 0; 176 : 0;
176 } 177 }
178
177 void CFWL_BarcodeImp::CreateBarcodeEngine() { 179 void CFWL_BarcodeImp::CreateBarcodeEngine() {
178 if ((m_pBarcodeEngine == NULL) && (m_type != BC_UNKNOWN)) { 180 if (m_pBarcodeEngine || m_type == BC_UNKNOWN)
179 m_pBarcodeEngine = FX_Barcode_Create(m_type); 181 return;
182
183 m_pBarcodeEngine = new CFX_Barcode;
184 if (!m_pBarcodeEngine->Create(m_type)) {
185 m_pBarcodeEngine->Release();
186 m_pBarcodeEngine = nullptr;
180 } 187 }
181 } 188 }
189
182 void CFWL_BarcodeImp::ReleaseBarcodeEngine() { 190 void CFWL_BarcodeImp::ReleaseBarcodeEngine() {
183 if (m_pBarcodeEngine) { 191 if (m_pBarcodeEngine) {
184 m_pBarcodeEngine->Release(); 192 m_pBarcodeEngine->Release();
185 m_pBarcodeEngine = NULL; 193 m_pBarcodeEngine = NULL;
186 } 194 }
187 } 195 }
188 void CFWL_BarcodeImp::SetType(BC_TYPE type) { 196 void CFWL_BarcodeImp::SetType(BC_TYPE type) {
189 if (m_type == type) { 197 if (m_type == type) {
190 return; 198 return;
191 } 199 }
(...skipping 21 matching lines...) Expand all
213 : CFWL_EditImpDelegate(pOwner) {} 221 : CFWL_EditImpDelegate(pOwner) {}
214 FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { 222 FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
215 uint32_t dwFlag = pEvent->GetClassID(); 223 uint32_t dwFlag = pEvent->GetClassID();
216 if (dwFlag == FWL_EVTHASH_EDT_TextChanged) { 224 if (dwFlag == FWL_EVTHASH_EDT_TextChanged) {
217 CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner); 225 CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner);
218 pOwner->ReleaseBarcodeEngine(); 226 pOwner->ReleaseBarcodeEngine();
219 pOwner->m_dwStatus = XFA_BCS_NeedUpdate; 227 pOwner->m_dwStatus = XFA_BCS_NeedUpdate;
220 } 228 }
221 return CFWL_EditImpDelegate::OnProcessEvent(pEvent); 229 return CFWL_EditImpDelegate::OnProcessEvent(pEvent);
222 } 230 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_barcodeimp.h ('k') | xfa/fwl/basewidget/fxmath_barcodeimp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698