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/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/core/cfwl_themepart.h" | 10 #include "xfa/fwl/core/cfwl_themepart.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (dwAttributeMask & FWL_BCDATTRIBUTE_VERSION) { | 163 if (dwAttributeMask & FWL_BCDATTRIBUTE_VERSION) { |
164 m_pBarcodeEngine->SetVersion(pData->GetVersion()); | 164 m_pBarcodeEngine->SetVersion(pData->GetVersion()); |
165 } | 165 } |
166 if (dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL) { | 166 if (dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL) { |
167 m_pBarcodeEngine->SetErrorCorrectionLevel(pData->GetErrorCorrectionLevel()); | 167 m_pBarcodeEngine->SetErrorCorrectionLevel(pData->GetErrorCorrectionLevel()); |
168 } | 168 } |
169 if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED) { | 169 if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED) { |
170 m_pBarcodeEngine->SetTruncated(pData->GetTruncated()); | 170 m_pBarcodeEngine->SetTruncated(pData->GetTruncated()); |
171 } | 171 } |
172 int32_t errorCode = 0; | 172 int32_t errorCode = 0; |
173 m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsWideStringC(), TRUE, errorCode) | 173 m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), TRUE, errorCode) |
174 ? XFA_BCS_EncodeSuccess | 174 ? XFA_BCS_EncodeSuccess |
175 : 0; | 175 : 0; |
176 } | 176 } |
177 void CFWL_BarcodeImp::CreateBarcodeEngine() { | 177 void CFWL_BarcodeImp::CreateBarcodeEngine() { |
178 if ((m_pBarcodeEngine == NULL) && (m_type != BC_UNKNOWN)) { | 178 if ((m_pBarcodeEngine == NULL) && (m_type != BC_UNKNOWN)) { |
179 m_pBarcodeEngine = FX_Barcode_Create(m_type); | 179 m_pBarcodeEngine = FX_Barcode_Create(m_type); |
180 } | 180 } |
181 } | 181 } |
182 void CFWL_BarcodeImp::ReleaseBarcodeEngine() { | 182 void CFWL_BarcodeImp::ReleaseBarcodeEngine() { |
183 if (m_pBarcodeEngine) { | 183 if (m_pBarcodeEngine) { |
(...skipping 29 matching lines...) Expand all Loading... |
213 : CFWL_EditImpDelegate(pOwner) {} | 213 : CFWL_EditImpDelegate(pOwner) {} |
214 FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 214 FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
215 uint32_t dwFlag = pEvent->GetClassID(); | 215 uint32_t dwFlag = pEvent->GetClassID(); |
216 if (dwFlag == FWL_EVTHASH_EDT_TextChanged) { | 216 if (dwFlag == FWL_EVTHASH_EDT_TextChanged) { |
217 CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner); | 217 CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner); |
218 pOwner->ReleaseBarcodeEngine(); | 218 pOwner->ReleaseBarcodeEngine(); |
219 pOwner->m_dwStatus = XFA_BCS_NeedUpdate; | 219 pOwner->m_dwStatus = XFA_BCS_NeedUpdate; |
220 } | 220 } |
221 return CFWL_EditImpDelegate::OnProcessEvent(pEvent); | 221 return CFWL_EditImpDelegate::OnProcessEvent(pEvent); |
222 } | 222 } |
OLD | NEW |