| 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/fwl_noteimp.h" | 10 #include "xfa/fwl/core/fwl_noteimp.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); | 154 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); |
| 155 DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); | 155 DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); |
| 156 RenderCaption(pGS, &mtRotate); | 156 RenderCaption(pGS, &mtRotate); |
| 157 CFX_RectF rtWidget; | 157 CFX_RectF rtWidget; |
| 158 m_pNormalWidget->GetWidgetRect(rtWidget); | 158 m_pNormalWidget->GetWidgetRect(rtWidget); |
| 159 CFX_Matrix mt; | 159 CFX_Matrix mt; |
| 160 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); | 160 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); |
| 161 mt.Concat(mtRotate); | 161 mt.Concat(mtRotate); |
| 162 m_pNormalWidget->DrawWidget(pGS, &mt); | 162 m_pNormalWidget->DrawWidget(pGS, &mt); |
| 163 } | 163 } |
| 164 |
| 164 void CXFA_FFBarcode::UpdateWidgetProperty() { | 165 void CXFA_FFBarcode::UpdateWidgetProperty() { |
| 165 CXFA_FFTextEdit::UpdateWidgetProperty(); | 166 CXFA_FFTextEdit::UpdateWidgetProperty(); |
| 166 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; | 167 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; |
| 167 CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); | 168 CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); |
| 168 XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo = | 169 XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo = |
| 169 XFA_GetBarcodeTypeByName(wsType.AsStringC()); | 170 XFA_GetBarcodeTypeByName(wsType.AsStringC()); |
| 171 if (!pBarcodeTypeInfo) |
| 172 return; |
| 173 |
| 170 pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); | 174 pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); |
| 171 CXFA_WidgetAcc* pAcc = GetDataAcc(); | 175 CXFA_WidgetAcc* pAcc = GetDataAcc(); |
| 172 int32_t intVal; | 176 int32_t intVal; |
| 173 FX_CHAR charVal; | 177 FX_CHAR charVal; |
| 174 FX_BOOL boolVal; | 178 FX_BOOL boolVal; |
| 175 FX_FLOAT floatVal; | 179 FX_FLOAT floatVal; |
| 176 if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { | 180 if (pAcc->GetBarcodeAttribute_CharEncoding(intVal)) { |
| 177 pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal); | 181 pBarCodeWidget->SetCharEncoding((BC_CHAR_ENCODING)intVal); |
| 178 } | 182 } |
| 179 if (pAcc->GetBarcodeAttribute_Checksum(intVal)) { | 183 if (pAcc->GetBarcodeAttribute_Checksum(intVal)) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 209 if (pAcc->GetBarcodeAttribute_WideNarrowRatio(floatVal)) { | 213 if (pAcc->GetBarcodeAttribute_WideNarrowRatio(floatVal)) { |
| 210 pBarCodeWidget->SetWideNarrowRatio((int32_t)floatVal); | 214 pBarCodeWidget->SetWideNarrowRatio((int32_t)floatVal); |
| 211 } | 215 } |
| 212 if (pBarcodeTypeInfo->eName == XFA_BARCODETYPE_code3Of9 || | 216 if (pBarcodeTypeInfo->eName == XFA_BARCODETYPE_code3Of9 || |
| 213 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean8 || | 217 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean8 || |
| 214 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean13 || | 218 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_ean13 || |
| 215 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_upcA) { | 219 pBarcodeTypeInfo->eName == XFA_BARCODETYPE_upcA) { |
| 216 pBarCodeWidget->SetPrintChecksum(TRUE); | 220 pBarCodeWidget->SetPrintChecksum(TRUE); |
| 217 } | 221 } |
| 218 } | 222 } |
| 223 |
| 219 FX_BOOL CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, | 224 FX_BOOL CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, |
| 220 FX_FLOAT fx, | 225 FX_FLOAT fx, |
| 221 FX_FLOAT fy) { | 226 FX_FLOAT fy) { |
| 222 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; | 227 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; |
| 223 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { | 228 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { |
| 224 return FALSE; | 229 return FALSE; |
| 225 } | 230 } |
| 226 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { | 231 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { |
| 227 return FALSE; | 232 return FALSE; |
| 228 } | 233 } |
| 229 return CXFA_FFTextEdit::OnLButtonDown(dwFlags, fx, fy); | 234 return CXFA_FFTextEdit::OnLButtonDown(dwFlags, fx, fy); |
| 230 } | 235 } |
| 231 FX_BOOL CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, | 236 FX_BOOL CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, |
| 232 FX_FLOAT fx, | 237 FX_FLOAT fx, |
| 233 FX_FLOAT fy) { | 238 FX_FLOAT fy) { |
| 234 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; | 239 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; |
| 235 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { | 240 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { |
| 236 return FALSE; | 241 return FALSE; |
| 237 } | 242 } |
| 238 return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); | 243 return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); |
| 239 } | 244 } |
| OLD | NEW |