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/fxfa/app/xfa_ffbarcode.h" | 7 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
8 | 8 |
9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 #include "xfa/fwl/core/cfwl_barcode.h" | 10 #include "xfa/fwl/core/cfwl_barcode.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 } // namespace. | 117 } // namespace. |
118 | 118 |
119 CXFA_FFBarcode::CXFA_FFBarcode(CXFA_FFPageView* pPageView, | 119 CXFA_FFBarcode::CXFA_FFBarcode(CXFA_FFPageView* pPageView, |
120 CXFA_WidgetAcc* pDataAcc) | 120 CXFA_WidgetAcc* pDataAcc) |
121 : CXFA_FFTextEdit(pPageView, pDataAcc) {} | 121 : CXFA_FFTextEdit(pPageView, pDataAcc) {} |
122 | 122 |
123 CXFA_FFBarcode::~CXFA_FFBarcode() {} | 123 CXFA_FFBarcode::~CXFA_FFBarcode() {} |
124 | 124 |
125 FX_BOOL CXFA_FFBarcode::LoadWidget() { | 125 bool CXFA_FFBarcode::LoadWidget() { |
126 CFWL_Barcode* pFWLBarcode = new CFWL_Barcode(GetFWLApp()); | 126 CFWL_Barcode* pFWLBarcode = new CFWL_Barcode(GetFWLApp()); |
127 pFWLBarcode->Initialize(); | 127 pFWLBarcode->Initialize(); |
128 | 128 |
129 m_pNormalWidget = pFWLBarcode; | 129 m_pNormalWidget = pFWLBarcode; |
130 m_pNormalWidget->SetLayoutItem(this); | 130 m_pNormalWidget->SetLayoutItem(this); |
131 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); | 131 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); |
132 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); | 132 CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); |
133 pNoteDriver->RegisterEventTarget(pWidget, pWidget); | 133 pNoteDriver->RegisterEventTarget(pWidget, pWidget); |
134 | 134 |
135 m_pOldDelegate = m_pNormalWidget->GetDelegate(); | 135 m_pOldDelegate = m_pNormalWidget->GetDelegate(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); | 172 CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); |
173 XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo = | 173 XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo = |
174 XFA_GetBarcodeTypeByName(wsType.AsStringC()); | 174 XFA_GetBarcodeTypeByName(wsType.AsStringC()); |
175 if (!pBarcodeTypeInfo) | 175 if (!pBarcodeTypeInfo) |
176 return; | 176 return; |
177 | 177 |
178 pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); | 178 pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); |
179 CXFA_WidgetAcc* pAcc = GetDataAcc(); | 179 CXFA_WidgetAcc* pAcc = GetDataAcc(); |
180 int32_t intVal; | 180 int32_t intVal; |
181 FX_CHAR charVal; | 181 FX_CHAR charVal; |
182 FX_BOOL boolVal; | 182 bool boolVal; |
183 FX_FLOAT floatVal; | 183 FX_FLOAT floatVal; |
184 if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { | 184 if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { |
185 pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal); | 185 pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal); |
186 } | 186 } |
187 if (pAcc->GetBarcodeAttribute_Checksum(boolVal)) { | 187 if (pAcc->GetBarcodeAttribute_Checksum(boolVal)) { |
188 pBarCodeWidget->SetCalChecksum(boolVal); | 188 pBarCodeWidget->SetCalChecksum(boolVal); |
189 } | 189 } |
190 if (pAcc->GetBarcodeAttribute_DataLength(intVal)) { | 190 if (pAcc->GetBarcodeAttribute_DataLength(intVal)) { |
191 pBarCodeWidget->SetDataLength(intVal); | 191 pBarCodeWidget->SetDataLength(intVal); |
192 } | 192 } |
(...skipping 21 matching lines...) Expand all Loading... |
214 if (pAcc->GetBarcodeAttribute_Truncate(boolVal)) { | 214 if (pAcc->GetBarcodeAttribute_Truncate(boolVal)) { |
215 pBarCodeWidget->SetTruncated(boolVal); | 215 pBarCodeWidget->SetTruncated(boolVal); |
216 } | 216 } |
217 if (pAcc->GetBarcodeAttribute_WideNarrowRatio(floatVal)) { | 217 if (pAcc->GetBarcodeAttribute_WideNarrowRatio(floatVal)) { |
218 pBarCodeWidget->SetWideNarrowRatio((int32_t)floatVal); | 218 pBarCodeWidget->SetWideNarrowRatio((int32_t)floatVal); |
219 } | 219 } |
220 if (pBarcodeTypeInfo->eName == XFA_BARCODETYPE_code3Of9 || | 220 if (pBarcodeTypeInfo->eName == XFA_BARCODETYPE_code3Of9 || |
221 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean8 || | 221 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean8 || |
222 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean13 || | 222 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean13 || |
223 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_upcA) { | 223 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_upcA) { |
224 pBarCodeWidget->SetPrintChecksum(TRUE); | 224 pBarCodeWidget->SetPrintChecksum(true); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 FX_BOOL CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, | 228 bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
229 FX_FLOAT fx, | |
230 FX_FLOAT fy) { | |
231 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; | 229 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; |
232 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { | 230 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { |
233 return FALSE; | 231 return false; |
234 } | 232 } |
235 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { | 233 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { |
236 return FALSE; | 234 return false; |
237 } | 235 } |
238 return CXFA_FFTextEdit::OnLButtonDown(dwFlags, fx, fy); | 236 return CXFA_FFTextEdit::OnLButtonDown(dwFlags, fx, fy); |
239 } | 237 } |
240 FX_BOOL CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, | 238 bool CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
241 FX_FLOAT fx, | |
242 FX_FLOAT fy) { | |
243 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; | 239 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; |
244 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { | 240 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { |
245 return FALSE; | 241 return false; |
246 } | 242 } |
247 return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); | 243 return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); |
248 } | 244 } |
OLD | NEW |