Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../third_party/base/nonstd_unique_ptr.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fsdk_mgr.h" 9 #include "../include/fsdk_mgr.h"
10 #include "../include/fsdk_baseannot.h" 10 #include "../include/fsdk_baseannot.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 switch (nFieldType) 59 switch (nFieldType)
60 { 60 {
61 case FIELDTYPE_PUSHBUTTON: 61 case FIELDTYPE_PUSHBUTTON:
62 case FIELDTYPE_COMBOBOX: 62 case FIELDTYPE_COMBOBOX:
63 case FIELDTYPE_LISTBOX: 63 case FIELDTYPE_LISTBOX:
64 case FIELDTYPE_TEXTFIELD: 64 case FIELDTYPE_TEXTFIELD:
65 case FIELDTYPE_SIGNATURE: 65 case FIELDTYPE_SIGNATURE:
66 return psub->GetType() == PDFOBJ_STREAM; 66 return psub->GetType() == PDFOBJ_STREAM;
67 case FIELDTYPE_CHECKBOX: 67 case FIELDTYPE_CHECKBOX:
68 case FIELDTYPE_RADIOBUTTON: 68 case FIELDTYPE_RADIOBUTTON:
69 » » if (psub->GetType() == PDFOBJ_DICTIONARY) 69 » » if (psub->GetType() == PDFOBJ_DICTIONARY) {
70 » » {
71 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub; 70 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub;
72
73 return pSubDict->GetStream(GetAppState()) != NULL; 71 return pSubDict->GetStream(GetAppState()) != NULL;
74 } 72 }
75 » » else 73 return FALSE;
76 » » » return FALSE;
77 » » break;
78 } 74 }
79 75
80 return TRUE; 76 return TRUE;
81 } 77 }
82 78
83 int CPDFSDK_Widget::GetFieldType() const 79 int CPDFSDK_Widget::GetFieldType() const
84 { 80 {
85 CPDF_FormField* pField = GetFormField(); 81 CPDF_FormField* pField = GetFormField();
86 ASSERT(pField != NULL); 82 ASSERT(pField != NULL);
87 83
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth); 1344 return CPWL_Utils::DeflateRect(rcWindow, fBorderWidth);
1349 } 1345 }
1350 1346
1351 CPDF_Rect CPDFSDK_Widget::GetRotatedRect() const 1347 CPDF_Rect CPDFSDK_Widget::GetRotatedRect() const
1352 { 1348 {
1353 CPDF_Rect rectAnnot = GetRect(); 1349 CPDF_Rect rectAnnot = GetRect();
1354 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; 1350 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
1355 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; 1351 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
1356 1352
1357 CPDF_FormControl* pControl = GetFormControl(); 1353 CPDF_FormControl* pControl = GetFormControl();
1358 ASSERT(pControl != NULL);
1359
1360 CPDF_Rect rcPDFWindow; 1354 CPDF_Rect rcPDFWindow;
1361 switch(abs(pControl->GetRotation() % 360)) 1355 switch(abs(pControl->GetRotation() % 360))
1362 { 1356 {
1363 case 0: 1357 case 0:
1364 case 180: 1358 case 180:
1365 default: 1359 default:
1366 rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight); 1360 rcPDFWindow = CPDF_Rect(0, 0, fWidth, fHeight);
1367 break; 1361 break;
1368 case 90: 1362 case 90:
1369 case 270: 1363 case 270:
1370 rcPDFWindow = CPDF_Rect(0, 0, fHeight, fWidth); 1364 rcPDFWindow = CPDF_Rect(0, 0, fHeight, fWidth);
1371 break; 1365 break;
1372 } 1366 }
1373 1367
1374 return rcPDFWindow; 1368 return rcPDFWindow;
1375 } 1369 }
1376 1370
1377 CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const 1371 CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const
1378 { 1372 {
1379 CPWL_Color crBackground = GetFillPWLColor(); 1373 CPWL_Color crBackground = GetFillPWLColor();
1380 » if (crBackground.nColorType != COLORTYPE_TRANSPARENT) 1374 » if (crBackground.nColorType != COLORTYPE_TRANSPARENT) {
1381 return CPWL_Utils::GetRectFillAppStream(GetRotatedRect(), crBack ground); 1375 return CPWL_Utils::GetRectFillAppStream(GetRotatedRect(), crBack ground);
1382 » else 1376 }
1383 » » return ""; 1377 return "";
1384 } 1378 }
1385 1379
1386 CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const 1380 CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const
1387 { 1381 {
1388 CPDF_Rect rcWindow = GetRotatedRect(); 1382 CPDF_Rect rcWindow = GetRotatedRect();
1389 CPWL_Color crBorder = GetBorderPWLColor(); 1383 CPWL_Color crBorder = GetBorderPWLColor();
1390 CPWL_Color crBackground = GetFillPWLColor(); 1384 CPWL_Color crBackground = GetFillPWLColor();
1391 CPWL_Color crLeftTop, crRightBottom; 1385 CPWL_Color crLeftTop, crRightBottom;
1392 1386
1393 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); 1387 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth();
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 bChanged = TRUE; 2140 bChanged = TRUE;
2147 } 2141 }
2148 } 2142 }
2149 } 2143 }
2150 2144
2151 return bChanged; 2145 return bChanged;
2152 } 2146 }
2153 2147
2154 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) 2148 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action)
2155 { 2149 {
2156 ASSERT(action);
2157 ASSERT(m_pInterForm != NULL); 2150 ASSERT(m_pInterForm != NULL);
2158
2159 CFX_WideString sDestination = action.GetFilePath(); 2151 CFX_WideString sDestination = action.GetFilePath();
2160 » if (sDestination.IsEmpty()) return FALSE; 2152 » if (sDestination.IsEmpty())
2153 return FALSE;
2161 2154
2162 CPDF_Dictionary* pActionDict = action.GetDict(); 2155 CPDF_Dictionary* pActionDict = action.GetDict();
2163 if (pActionDict->KeyExist("Fields")) 2156 if (pActionDict->KeyExist("Fields"))
2164 { 2157 {
2165 CPDF_ActionFields af = action.GetWidgets(); 2158 CPDF_ActionFields af = action.GetWidgets();
2166 FX_DWORD dwFlags = action.GetFlags(); 2159 FX_DWORD dwFlags = action.GetFlags();
2167
2168 CFX_PtrArray fieldObjects; 2160 CFX_PtrArray fieldObjects;
2169 af.GetAllFields(fieldObjects); 2161 af.GetAllFields(fieldObjects);
2162
2170 CFX_PtrArray fields; 2163 CFX_PtrArray fields;
2171 GetFieldFromObjects(fieldObjects, fields); 2164 GetFieldFromObjects(fieldObjects, fields);
2172
2173 if (fields.GetSize() != 0) 2165 if (fields.GetSize() != 0)
2174 { 2166 {
2175 FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); 2167 FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01);
2176 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeO rExclude)) 2168 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeO rExclude))
2177 {
2178 return FALSE; 2169 return FALSE;
2179 » » » } 2170
2180 return SubmitFields(sDestination, fields, bIncludeOrExcl ude, FALSE); 2171 return SubmitFields(sDestination, fields, bIncludeOrExcl ude, FALSE);
2181 } 2172 }
2182 » » else 2173 }
2183 » » { 2174 if (m_pInterForm->CheckRequiredFields())
2184 » » » if ( m_pInterForm->CheckRequiredFields()) 2175 return FALSE;
2185 » » » {
2186 » » » » return FALSE;
2187 » » » }
2188 2176
2189 » » » return SubmitForm(sDestination, FALSE); 2177 return SubmitForm(sDestination, FALSE);
2190 » » }
2191 » }
2192 » else
2193 » {
2194 » » if ( m_pInterForm->CheckRequiredFields())
2195 » » {
2196 » » » return FALSE;
2197 » » }
2198
2199 » » return SubmitForm(sDestination, FALSE);
2200 » }
2201 } 2178 }
2202 2179
2203 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con st CFX_PtrArray& fields, 2180 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con st CFX_PtrArray& fields,
2204 FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded) 2181 FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded)
2205 { 2182 {
2206 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 2183 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
2207 ASSERT(pEnv != NULL); 2184 ASSERT(pEnv != NULL);
2208 2185
2209 CFX_ByteTextBuf textBuf; 2186 CFX_ByteTextBuf textBuf;
2210 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); 2187 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
2427 if (m_pInterForm->IsValidFormField(pObject)) 2404 if (m_pInterForm->IsValidFormField(pObject))
2428 fields.Add(pObject); 2405 fields.Add(pObject);
2429 } 2406 }
2430 } 2407 }
2431 } 2408 }
2432 2409
2433 /* ----------------------------- CPDF_FormNotify ----------------------------- * / 2410 /* ----------------------------- CPDF_FormNotify ----------------------------- * /
2434 2411
2435 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_W ideString& csValue) 2412 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_W ideString& csValue)
2436 { 2413 {
2437 ASSERT(pField != NULL);
2438
2439 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2414 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2440
2441 int nType = pFormField->GetFieldType(); 2415 int nType = pFormField->GetFieldType();
2442 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) 2416 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD)
2443 { 2417 {
2444 FX_BOOL bRC = TRUE; 2418 FX_BOOL bRC = TRUE;
2445 OnKeyStrokeCommit(pFormField, csValue, bRC); 2419 OnKeyStrokeCommit(pFormField, csValue, bRC);
2446 if (bRC) 2420 if (bRC)
2447 { 2421 {
2448 OnValidate(pFormField, csValue, bRC); 2422 OnValidate(pFormField, csValue, bRC);
2449 » » » if (bRC) 2423 » » » return bRC ? 1 : -1;
2450 » » » » return 1; 2424 }
2451 » » » else 2425 return -1;
2452 » » » » return -1;
2453 » » }
2454 » » else
2455 » » » return -1;
2456 } 2426 }
2457 » else 2427 return 0;
2458 » » return 0;
2459 } 2428 }
2460 2429
2461 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) 2430 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField)
2462 { 2431 {
2463 ASSERT(pField != NULL);
2464
2465 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2432 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2466 int nType = pFormField->GetFieldType(); 2433 int nType = pFormField->GetFieldType();
2467
2468 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) 2434 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD)
2469 { 2435 {
2470 OnCalculate(pFormField); 2436 OnCalculate(pFormField);
2471 FX_BOOL bFormated = FALSE; 2437 FX_BOOL bFormated = FALSE;
2472 CFX_WideString sValue = OnFormat(pFormField, bFormated); 2438 CFX_WideString sValue = OnFormat(pFormField, bFormated);
2473 if (bFormated) 2439 if (bFormated)
2474 ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); 2440 ResetFieldAppearance(pFormField, sValue.c_str(), TRUE);
2475 else 2441 else
2476 ResetFieldAppearance(pFormField, NULL, TRUE); 2442 ResetFieldAppearance(pFormField, NULL, TRUE);
2477 UpdateField(pFormField); 2443 UpdateField(pFormField);
2478 } 2444 }
2479
2480 return 0; 2445 return 0;
2481 } 2446 }
2482 2447
2483 int CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, C FX_WideString& csValue) 2448 int CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, C FX_WideString& csValue)
2484 { 2449 {
2485 » ASSERT(pField != NULL); 2450 » CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2451 » if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX)
2452 » » return 0;
2486 2453
2487 » CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2454 FX_BOOL bRC = TRUE;
2455 OnKeyStrokeCommit(pFormField, csValue, bRC);
2456 if (!bRC)
2457 return -1;
2488 2458
2489 » int nType = pFormField->GetFieldType(); 2459 OnValidate(pFormField, csValue, bRC);
2490 » if (nType == FIELDTYPE_LISTBOX) 2460 if (!bRC)
2491 » { 2461 return -1;
2492 » » FX_BOOL bRC = TRUE; 2462
2493 » » OnKeyStrokeCommit(pFormField, csValue, bRC); 2463 return 1;
2494 » » if (bRC)
2495 » » {
2496 » » » OnValidate(pFormField, csValue, bRC);
2497 » » » if (bRC)
2498 » » » » return 1;
2499 » » » else
2500 » » » » return -1;
2501 » » }
2502 » » else
2503 » » » return -1;
2504 » }
2505 » else
2506 » » return 0;
2507 } 2464 }
2508 2465
2509 int CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField) 2466 int CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField)
2510 { 2467 {
2511 ASSERT(pField != NULL);
2512
2513 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2468 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2514 » int nType = pFormField->GetFieldType(); 2469 » if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX)
2515
2516 » if (nType == FIELDTYPE_LISTBOX)
2517 { 2470 {
2518 OnCalculate(pFormField); 2471 OnCalculate(pFormField);
2519 ResetFieldAppearance(pFormField, NULL, TRUE); 2472 ResetFieldAppearance(pFormField, NULL, TRUE);
2520 UpdateField(pFormField); 2473 UpdateField(pFormField);
2521 } 2474 }
2522
2523 return 0; 2475 return 0;
2524 } 2476 }
2525 2477
2526 int CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField , const CFX_ByteArray& statusArray) 2478 int CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField , const CFX_ByteArray& statusArray)
2527 { 2479 {
2528 ASSERT(pField != NULL);
2529
2530 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2480 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2531 int nType = pFormField->GetFieldType(); 2481 int nType = pFormField->GetFieldType();
2532
2533 if (nType == FIELDTYPE_CHECKBOX || nType == FIELDTYPE_RADIOBUTTON) 2482 if (nType == FIELDTYPE_CHECKBOX || nType == FIELDTYPE_RADIOBUTTON)
2534 { 2483 {
2535 OnCalculate(pFormField); 2484 OnCalculate(pFormField);
2536 UpdateField(pFormField); 2485 UpdateField(pFormField);
2537 } 2486 }
2538
2539 return 0; 2487 return 0;
2540 } 2488 }
2541 2489
2542 int CPDFSDK_InterForm::BeforeFormReset(const CPDF_InterForm* pForm) 2490 int CPDFSDK_InterForm::BeforeFormReset(const CPDF_InterForm* pForm)
2543 { 2491 {
2544 return 0; 2492 return 0;
2545 } 2493 }
2546 2494
2547 int CPDFSDK_InterForm::AfterFormReset(const CPDF_InterForm* pForm) 2495 int CPDFSDK_InterForm::AfterFormReset(const CPDF_InterForm* pForm)
2548 { 2496 {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 m_aHighlightColor[nFieldType-1] = clr; 2539 m_aHighlightColor[nFieldType-1] = clr;
2592 m_bNeedHightlight[nFieldType-1] = TRUE; 2540 m_bNeedHightlight[nFieldType-1] = TRUE;
2593 break; 2541 break;
2594 } 2542 }
2595 } 2543 }
2596 2544
2597 } 2545 }
2598 2546
2599 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) 2547 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType)
2600 { 2548 {
2601 » if(nFieldType <0 || nFieldType >6) return FXSYS_RGB(255,255,255); 2549 » if (nFieldType < 0 || nFieldType > 6)
2602 » if(nFieldType == 0) 2550 return FXSYS_RGB(255,255,255);
2551 » if (nFieldType == 0)
2603 return m_aHighlightColor[0]; 2552 return m_aHighlightColor[0];
2604 » else 2553 return m_aHighlightColor[nFieldType-1];
2605 » » return m_aHighlightColor[nFieldType-1];
2606 } 2554 }
2607 2555
2608 /* ------------------------- CBA_AnnotIterator ------------------------- */ 2556 /* ------------------------- CBA_AnnotIterator ------------------------- */
2609 2557
2610 CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_Byte String& sType, const CFX_ByteString& sSubType) 2558 CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, const CFX_Byte String& sType, const CFX_ByteString& sSubType)
2611 :m_pPageView(pPageView), 2559 :m_pPageView(pPageView),
2612 m_sType(sType), 2560 m_sType(sType),
2613 m_sSubType(sSubType), 2561 m_sSubType(sSubType),
2614 m_nTabs(BAI_STRUCTURE) 2562 m_nTabs(BAI_STRUCTURE)
2615 { 2563 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 CPDFSDK_Annot* CBA_AnnotIterator::GetLastAnnot() 2601 CPDFSDK_Annot* CBA_AnnotIterator::GetLastAnnot()
2654 { 2602 {
2655 if (m_Annots.GetSize() > 0) 2603 if (m_Annots.GetSize() > 0)
2656 return m_Annots[m_Annots.GetSize() - 1]; 2604 return m_Annots[m_Annots.GetSize() - 1];
2657 2605
2658 return NULL; 2606 return NULL;
2659 } 2607 }
2660 2608
2661 CPDFSDK_Annot* CBA_AnnotIterator::GetNextAnnot(CPDFSDK_Annot* pAnnot) 2609 CPDFSDK_Annot* CBA_AnnotIterator::GetNextAnnot(CPDFSDK_Annot* pAnnot)
2662 { 2610 {
2663 » for (int i=0,sz=m_Annots.GetSize(); i<sz; i++) 2611 » for (int i = 0, sz = m_Annots.GetSize(); i < sz; ++i) {
2664 » {
2665 if (m_Annots[i] == pAnnot) 2612 if (m_Annots[i] == pAnnot)
2666 » » { 2613 » » » return (i + 1 < sz) ? m_Annots[i+1] : m_Annots[0];
2667 » » » if (i+1 < sz) 2614 }
2668 » » » » return m_Annots[i+1];
2669 » » » else
2670 » » » » return m_Annots[0];
2671 » » }
2672 » }
2673
2674 return NULL; 2615 return NULL;
2675 } 2616 }
2676 2617
2677 CPDFSDK_Annot* CBA_AnnotIterator::GetPrevAnnot(CPDFSDK_Annot* pAnnot) 2618 CPDFSDK_Annot* CBA_AnnotIterator::GetPrevAnnot(CPDFSDK_Annot* pAnnot)
2678 { 2619 {
2679 » for (int i=0,sz=m_Annots.GetSize(); i<sz; i++) 2620 » for (int i = 0, sz = m_Annots.GetSize(); i < sz; ++i) {
2680 » {
2681 if (m_Annots[i] == pAnnot) 2621 if (m_Annots[i] == pAnnot)
2682 » » { 2622 » » » return (i - 1 >= 0) ? m_Annots[i-1] : m_Annots[sz-1];
2683 » » » if (i-1 >= 0)
2684 » » » » return m_Annots[i-1];
2685 » » » else
2686 » » » » return m_Annots[sz-1];
2687 » » }
2688 } 2623 }
2689
2690 return NULL; 2624 return NULL;
2691 } 2625 }
2692 2626
2693 int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) 2627 int CBA_AnnotIterator::CompareByLeft(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2)
2694 { 2628 {
2695 » ASSERT(p1 != NULL); 2629 » ASSERT(p1);
2696 » ASSERT(p2 != NULL); 2630 » ASSERT(p2);
2697 2631
2698 CPDF_Rect rcAnnot1 = GetAnnotRect(p1); 2632 CPDF_Rect rcAnnot1 = GetAnnotRect(p1);
2699 CPDF_Rect rcAnnot2 = GetAnnotRect(p2); 2633 CPDF_Rect rcAnnot2 = GetAnnotRect(p2);
2700 2634
2701 if (rcAnnot1.left < rcAnnot2.left) 2635 if (rcAnnot1.left < rcAnnot2.left)
2702 return -1; 2636 return -1;
2703 if (rcAnnot1.left > rcAnnot2.left) 2637 if (rcAnnot1.left > rcAnnot2.left)
2704 return 1; 2638 return 1;
2705 return 0; 2639 return 0;
2706 } 2640 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 2869
2936 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 2870 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
2937 ASSERT(pPDFAnnot != NULL); 2871 ASSERT(pPDFAnnot != NULL);
2938 2872
2939 CPDF_Rect rcAnnot; 2873 CPDF_Rect rcAnnot;
2940 pPDFAnnot->GetRect(rcAnnot); 2874 pPDFAnnot->GetRect(rcAnnot);
2941 2875
2942 return rcAnnot; 2876 return rcAnnot;
2943 } 2877 }
2944 2878
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698