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 24 matching lines...) Expand all Loading... |
35 m_pBarcodeEngine(NULL), | 35 m_pBarcodeEngine(NULL), |
36 m_dwStatus(0), | 36 m_dwStatus(0), |
37 m_type(BC_UNKNOWN) {} | 37 m_type(BC_UNKNOWN) {} |
38 CFWL_BarcodeImp::~CFWL_BarcodeImp() { | 38 CFWL_BarcodeImp::~CFWL_BarcodeImp() { |
39 ReleaseBarcodeEngine(); | 39 ReleaseBarcodeEngine(); |
40 } | 40 } |
41 FWL_ERR CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { | 41 FWL_ERR CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { |
42 wsClass = FWL_CLASS_Barcode; | 42 wsClass = FWL_CLASS_Barcode; |
43 return FWL_ERR_Succeeded; | 43 return FWL_ERR_Succeeded; |
44 } | 44 } |
45 FX_DWORD CFWL_BarcodeImp::GetClassID() const { | 45 uint32_t CFWL_BarcodeImp::GetClassID() const { |
46 return FWL_CLASSHASH_Barcode; | 46 return FWL_CLASSHASH_Barcode; |
47 } | 47 } |
48 FWL_ERR CFWL_BarcodeImp::Initialize() { | 48 FWL_ERR CFWL_BarcodeImp::Initialize() { |
49 if (!m_pDelegate) { | 49 if (!m_pDelegate) { |
50 m_pDelegate = new CFWL_BarcodeImpDelegate(this); | 50 m_pDelegate = new CFWL_BarcodeImpDelegate(this); |
51 } | 51 } |
52 if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) | 52 if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) |
53 return FWL_ERR_Indefinite; | 53 return FWL_ERR_Indefinite; |
54 return FWL_ERR_Succeeded; | 54 return FWL_ERR_Succeeded; |
55 } | 55 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (pFontSize) { | 122 if (pFontSize) { |
123 m_pBarcodeEngine->SetFontSize(*pFontSize); | 123 m_pBarcodeEngine->SetFontSize(*pFontSize); |
124 } | 124 } |
125 FX_ARGB* pFontColor = static_cast<FX_ARGB*>( | 125 FX_ARGB* pFontColor = static_cast<FX_ARGB*>( |
126 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_TextColor)); | 126 pTheme->GetCapacity(&part, FWL_WGTCAPACITY_TextColor)); |
127 if (pFontColor) { | 127 if (pFontColor) { |
128 m_pBarcodeEngine->SetFontColor(*pFontColor); | 128 m_pBarcodeEngine->SetFontColor(*pFontColor); |
129 } | 129 } |
130 m_pBarcodeEngine->SetHeight(int32_t(m_rtClient.height)); | 130 m_pBarcodeEngine->SetHeight(int32_t(m_rtClient.height)); |
131 m_pBarcodeEngine->SetWidth(int32_t(m_rtClient.width)); | 131 m_pBarcodeEngine->SetWidth(int32_t(m_rtClient.width)); |
132 FX_DWORD dwAttributeMask = pData->GetBarcodeAttributeMask(); | 132 uint32_t dwAttributeMask = pData->GetBarcodeAttributeMask(); |
133 if (dwAttributeMask & FWL_BCDATTRIBUTE_CHARENCODING) { | 133 if (dwAttributeMask & FWL_BCDATTRIBUTE_CHARENCODING) { |
134 m_pBarcodeEngine->SetCharEncoding(pData->GetCharEncoding()); | 134 m_pBarcodeEngine->SetCharEncoding(pData->GetCharEncoding()); |
135 } | 135 } |
136 if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEHEIGHT) { | 136 if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEHEIGHT) { |
137 m_pBarcodeEngine->SetModuleHeight(pData->GetModuleHeight()); | 137 m_pBarcodeEngine->SetModuleHeight(pData->GetModuleHeight()); |
138 } | 138 } |
139 if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEWIDTH) { | 139 if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEWIDTH) { |
140 m_pBarcodeEngine->SetModuleWidth(pData->GetModuleWidth()); | 140 m_pBarcodeEngine->SetModuleWidth(pData->GetModuleWidth()); |
141 } | 141 } |
142 if (dwAttributeMask & FWL_BCDATTRIBUTE_DATALENGTH) { | 142 if (dwAttributeMask & FWL_BCDATTRIBUTE_DATALENGTH) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 BC_TYPE tEngineType = m_pBarcodeEngine->GetType(); | 205 BC_TYPE tEngineType = m_pBarcodeEngine->GetType(); |
206 if (tEngineType == BC_QR_CODE || tEngineType == BC_PDF417 || | 206 if (tEngineType == BC_QR_CODE || tEngineType == BC_PDF417 || |
207 tEngineType == BC_DATAMATRIX) { | 207 tEngineType == BC_DATAMATRIX) { |
208 return TRUE; | 208 return TRUE; |
209 } | 209 } |
210 return FALSE; | 210 return FALSE; |
211 } | 211 } |
212 CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner) | 212 CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner) |
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 FX_DWORD 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 |