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 "core/fpdfdoc/cpdf_formfield.h" | 7 #include "core/fpdfdoc/cpdf_formfield.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 csValue = pV->GetUnicodeText(); | 212 csValue = pV->GetUnicodeText(); |
213 | 213 |
214 CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV"); | 214 CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV"); |
215 if (!pRV && (csDValue == csValue)) | 215 if (!pRV && (csDValue == csValue)) |
216 return false; | 216 return false; |
217 | 217 |
218 if (bNotify && !NotifyBeforeValueChange(csDValue)) | 218 if (bNotify && !NotifyBeforeValueChange(csDValue)) |
219 return false; | 219 return false; |
220 | 220 |
221 if (pDV) { | 221 if (pDV) { |
222 CPDF_Object* pClone = pDV->Clone(); | 222 std::unique_ptr<CPDF_Object> pClone = pDV->Clone(); |
223 if (!pClone) | 223 if (!pClone) |
224 return false; | 224 return false; |
225 | 225 |
226 m_pDict->SetFor("V", pClone); | 226 m_pDict->SetFor("V", pClone.release()); |
227 if (pRV) { | 227 if (pRV) { |
228 CPDF_Object* pCloneR = pDV->Clone(); | 228 std::unique_ptr<CPDF_Object> pCloneR = pDV->Clone(); |
229 m_pDict->SetFor("RV", pCloneR); | 229 m_pDict->SetFor("RV", pCloneR.release()); |
230 } | 230 } |
231 } else { | 231 } else { |
232 m_pDict->RemoveFor("V"); | 232 m_pDict->RemoveFor("V"); |
233 m_pDict->RemoveFor("RV"); | 233 m_pDict->RemoveFor("RV"); |
234 } | 234 } |
235 if (bNotify) | 235 if (bNotify) |
236 NotifyAfterValueChange(); | 236 NotifyAfterValueChange(); |
237 break; | 237 break; |
238 } | 238 } |
239 } | 239 } |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 case ListBox: | 989 case ListBox: |
990 NotifyAfterSelectionChange(); | 990 NotifyAfterSelectionChange(); |
991 break; | 991 break; |
992 case ComboBox: | 992 case ComboBox: |
993 NotifyAfterValueChange(); | 993 NotifyAfterValueChange(); |
994 break; | 994 break; |
995 default: | 995 default: |
996 break; | 996 break; |
997 } | 997 } |
998 } | 998 } |
OLD | NEW |