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

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

Issue 1254703002: FX_BOOL considered harmful, part 2. (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
« no previous file with comments | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fsdk_baseannot.h" 9 #include "../include/fsdk_baseannot.h"
10 10
11 11
12 //--------------------------------------------------------------------------- 12 //---------------------------------------------------------------------------
13 // CPDFSDK_DateTime 13 // CPDFSDK_DateTime
14 //--------------------------------------------------------------------------- 14 //---------------------------------------------------------------------------
15 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) 15 int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute)
16 { 16 {
17 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); 17 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60);
18 } 18 }
19 19
20 FX_BOOL _gAfxIsLeapYear(int16_t year) 20 bool _gAfxIsLeapYear(int16_t year)
21 { 21 {
22 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); 22 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)));
23 } 23 }
24 24
25 FX_WORD _gAfxGetYearDays(int16_t year) 25 FX_WORD _gAfxGetYearDays(int16_t year)
26 { 26 {
27 return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365); 27 return (_gAfxIsLeapYear(year) == true ? 366 : 365);
28 } 28 }
29 29
30 uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month) 30 uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month)
31 { 31 {
32 uint8_t mDays; 32 uint8_t mDays;
33 switch (month) 33 switch (month)
34 { 34 {
35 case 1: 35 case 1:
36 case 3: 36 case 3:
37 case 5: 37 case 5:
38 case 7: 38 case 7:
39 case 8: 39 case 8:
40 case 10: 40 case 10:
41 case 12: 41 case 12:
42 mDays = 31; 42 mDays = 31;
43 break; 43 break;
44 44
45 case 4: 45 case 4:
46 case 6: 46 case 6:
47 case 9: 47 case 9:
48 case 11: 48 case 11:
49 mDays = 30; 49 mDays = 30;
50 break; 50 break;
51 51
52 case 2: 52 case 2:
53 if (_gAfxIsLeapYear(year) == TRUE) 53 if (_gAfxIsLeapYear(year) == true)
54 mDays = 29; 54 mDays = 29;
55 else 55 else
56 mDays = 28; 56 mDays = 28;
57 break; 57 break;
58 58
59 default: 59 default:
60 mDays = 0; 60 mDays = 0;
61 break; 61 break;
62 } 62 }
63 63
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 dt.month = (uint8_t)st.wMonth; 121 dt.month = (uint8_t)st.wMonth;
122 dt.day = (uint8_t)st.wDay; 122 dt.day = (uint8_t)st.wDay;
123 dt.hour = (uint8_t)st.wHour; 123 dt.hour = (uint8_t)st.wHour;
124 dt.minute = (uint8_t)st.wMinute; 124 dt.minute = (uint8_t)st.wMinute;
125 dt.second = (uint8_t)st.wSecond; 125 dt.second = (uint8_t)st.wSecond;
126 // dt.tzHour = _timezone / 3600 * -1; 126 // dt.tzHour = _timezone / 3600 * -1;
127 // dt.tzMinute = (abs(_timezone) % 3600) / 60; 127 // dt.tzMinute = (abs(_timezone) % 3600) / 60;
128 return *this; 128 return *this;
129 } 129 }
130 130
131 FX_BOOL CPDFSDK_DateTime::operator == (CPDFSDK_DateTime& datetime) 131 bool CPDFSDK_DateTime::operator == (CPDFSDK_DateTime& datetime)
132 { 132 {
133 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0); 133 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0);
134 } 134 }
135 135
136 FX_BOOL CPDFSDK_DateTime::operator != (CPDFSDK_DateTime& datetime) 136 bool CPDFSDK_DateTime::operator != (CPDFSDK_DateTime& datetime)
137 { 137 {
138 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0); 138 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0);
139 } 139 }
140 140
141 FX_BOOL CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime) 141 bool CPDFSDK_DateTime::operator > (CPDFSDK_DateTime& datetime)
142 { 142 {
143 CPDFSDK_DateTime dt1 = ToGMT(); 143 CPDFSDK_DateTime dt1 = ToGMT();
144 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 144 CPDFSDK_DateTime dt2 = datetime.ToGMT();
145 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day; 145 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day;
146 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second; 146 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second;
147 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day; 147 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day;
148 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second; 148 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second;
149 149
150 if (d1 > d3) return TRUE; 150 if (d1 > d3) return true;
151 if (d2 > d4) return TRUE; 151 if (d2 > d4) return true;
152 return FALSE; 152 return false;
153 } 153 }
154 154
155 FX_BOOL CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime) 155 bool CPDFSDK_DateTime::operator >= (CPDFSDK_DateTime& datetime)
156 { 156 {
157 CPDFSDK_DateTime dt1 = ToGMT(); 157 CPDFSDK_DateTime dt1 = ToGMT();
158 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 158 CPDFSDK_DateTime dt2 = datetime.ToGMT();
159 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day; 159 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day;
160 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second; 160 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second;
161 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day; 161 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day;
162 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second; 162 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second;
163 163
164 if (d1 >= d3) return TRUE; 164 if (d1 >= d3) return true;
165 if (d2 >= d4) return TRUE; 165 if (d2 >= d4) return true;
166 return FALSE; 166 return false;
167 } 167 }
168 168
169 FX_BOOL CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime) 169 bool CPDFSDK_DateTime::operator < (CPDFSDK_DateTime& datetime)
170 { 170 {
171 CPDFSDK_DateTime dt1 = ToGMT(); 171 CPDFSDK_DateTime dt1 = ToGMT();
172 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 172 CPDFSDK_DateTime dt2 = datetime.ToGMT();
173 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day; 173 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day;
174 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second; 174 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second;
175 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day; 175 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day;
176 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second; 176 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second;
177 177
178 if (d1 < d3) return TRUE; 178 if (d1 < d3) return true;
179 if (d2 < d4) return TRUE; 179 if (d2 < d4) return true;
180 return FALSE; 180 return false;
181 } 181 }
182 182
183 FX_BOOL CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime) 183 bool CPDFSDK_DateTime::operator <= (CPDFSDK_DateTime& datetime)
184 { 184 {
185 CPDFSDK_DateTime dt1 = ToGMT(); 185 CPDFSDK_DateTime dt1 = ToGMT();
186 CPDFSDK_DateTime dt2 = datetime.ToGMT(); 186 CPDFSDK_DateTime dt2 = datetime.ToGMT();
187 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day; 187 int d1 = (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1. dt.day;
188 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second; 188 int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | (int)dt1 .dt.second;
189 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day; 189 int d3 = (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2. dt.day;
190 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second; 190 int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | (int)dt2 .dt.second;
191 191
192 if (d1 <= d3) return TRUE; 192 if (d1 <= d3) return true;
193 if (d2 <= d4) return TRUE; 193 if (d2 <= d4) return true;
194 return FALSE; 194 return false;
195 } 195 }
196 196
197 CPDFSDK_DateTime::operator time_t() 197 CPDFSDK_DateTime::operator time_t()
198 { 198 {
199 struct tm newtime; 199 struct tm newtime;
200 200
201 newtime.tm_year = dt.year - 1900; 201 newtime.tm_year = dt.year - 1900;
202 newtime.tm_mon = dt.month - 1; 202 newtime.tm_mon = dt.month - 1;
203 newtime.tm_mday = dt.day; 203 newtime.tm_mday = dt.day;
204 newtime.tm_hour = dt.hour; 204 newtime.tm_hour = dt.hour;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return *this; 499 return *this;
500 } 500 }
501 501
502 502
503 //--------------------------------------------------------------------------- 503 //---------------------------------------------------------------------------
504 // CPDFSDK_Annot 504 // CPDFSDK_Annot
505 //--------------------------------------------------------------------------- 505 //---------------------------------------------------------------------------
506 CPDFSDK_Annot::CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) : 506 CPDFSDK_Annot::CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView) :
507 m_pAnnot(pAnnot), 507 m_pAnnot(pAnnot),
508 m_pPageView(pPageView), 508 m_pPageView(pPageView),
509 m_bSelected(FALSE), 509 m_bSelected(false),
510 m_nTabOrder(-1) 510 m_nTabOrder(-1)
511 { 511 {
512 } 512 }
513 513
514 CPDFSDK_Annot::~CPDFSDK_Annot() 514 CPDFSDK_Annot::~CPDFSDK_Annot()
515 { 515 {
516 m_pAnnot = NULL; 516 m_pAnnot = NULL;
517 m_pPageView = NULL; 517 m_pPageView = NULL;
518 } 518 }
519 519
(...skipping 12 matching lines...) Expand all
532 void CPDFSDK_Annot::SetPage(CPDFSDK_PageView* pPageView) 532 void CPDFSDK_Annot::SetPage(CPDFSDK_PageView* pPageView)
533 { 533 {
534 m_pPageView = pPageView; 534 m_pPageView = pPageView;
535 } 535 }
536 536
537 CPDFSDK_PageView* CPDFSDK_Annot::GetPageView() 537 CPDFSDK_PageView* CPDFSDK_Annot::GetPageView()
538 { 538 {
539 return m_pPageView; 539 return m_pPageView;
540 } 540 }
541 541
542 FX_BOOL CPDFSDK_Annot::IsSelected() 542 bool CPDFSDK_Annot::IsSelected()
543 { 543 {
544 return m_bSelected; 544 return m_bSelected;
545 } 545 }
546 546
547 void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) 547 void CPDFSDK_Annot::SetSelected(bool bSelected)
548 { 548 {
549 m_bSelected = bSelected; 549 m_bSelected = bSelected;
550 } 550 }
551 551
552 // Tab Order 552 // Tab Order
553 int CPDFSDK_Annot::GetTabOrder() 553 int CPDFSDK_Annot::GetTabOrder()
554 { 554 {
555 return m_nTabOrder; 555 return m_nTabOrder;
556 } 556 }
557 557
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 599
600 void CPDFSDK_Annot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device, 600 void CPDFSDK_Annot::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
601 CPDF_Annot::AppearanceMode mode, const CPDF_R enderOptions* pOptions) 601 CPDF_Annot::AppearanceMode mode, const CPDF_R enderOptions* pOptions)
602 { 602 {
603 ASSERT(m_pPageView != NULL); 603 ASSERT(m_pPageView != NULL);
604 ASSERT(m_pAnnot != NULL); 604 ASSERT(m_pAnnot != NULL);
605 605
606 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, m ode, pOptions); 606 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, m ode, pOptions);
607 } 607 }
608 608
609 FX_BOOL CPDFSDK_Annot::IsAppearanceValid() 609 bool CPDFSDK_Annot::IsAppearanceValid()
610 { 610 {
611 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; 611 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL;
612 } 612 }
613 613
614 FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) 614 bool CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode)
615 { 615 {
616 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); 616 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
617 if (pAP == NULL) return FALSE; 617 if (pAP == NULL) return false;
618 618
619 // Choose the right sub-ap 619 // Choose the right sub-ap
620 const FX_CHAR* ap_entry = "N"; 620 const FX_CHAR* ap_entry = "N";
621 if (mode == CPDF_Annot::Down) 621 if (mode == CPDF_Annot::Down)
622 ap_entry = "D"; 622 ap_entry = "D";
623 else if (mode == CPDF_Annot::Rollover) 623 else if (mode == CPDF_Annot::Rollover)
624 ap_entry = "R"; 624 ap_entry = "R";
625 if (!pAP->KeyExist(ap_entry)) 625 if (!pAP->KeyExist(ap_entry))
626 ap_entry = "N"; 626 ap_entry = "N";
627 627
628 // Get the AP stream or subdirectory 628 // Get the AP stream or subdirectory
629 CPDF_Object* psub = pAP->GetElementValue(ap_entry); 629 CPDF_Object* psub = pAP->GetElementValue(ap_entry);
630 if (psub == NULL) return FALSE; 630 if (psub == NULL) return false;
631 631
632 return TRUE; 632 return true;
633 } 633 }
634 634
635 void CPDFSDK_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUs er2Device, 635 void CPDFSDK_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUs er2Device,
636 const CPDF_RenderOptions* pOptions) 636 const CPDF_RenderOptions* pOptions)
637 { 637 {
638 ASSERT(m_pAnnot != NULL); 638 ASSERT(m_pAnnot != NULL);
639 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); 639 m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions);
640 } 640 }
641 641
642 void CPDFSDK_Annot::ClearCachedAP() 642 void CPDFSDK_Annot::ClearCachedAP()
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); 868 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f);
869 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); 869 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f);
870 m_pAnnot->GetAnnotDict()->SetAt("C", pArray); 870 m_pAnnot->GetAnnotDict()->SetAt("C", pArray);
871 } 871 }
872 872
873 void CPDFSDK_Annot::RemoveColor() 873 void CPDFSDK_Annot::RemoveColor()
874 { 874 {
875 m_pAnnot->GetAnnotDict()->RemoveAt("C"); 875 m_pAnnot->GetAnnotDict()->RemoveAt("C");
876 } 876 }
877 877
878 FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const 878 bool CPDFSDK_Annot::GetColor(FX_COLORREF& color) const
879 { 879 {
880 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C")) 880 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C"))
881 { 881 {
882 int nCount = pEntry->GetCount(); 882 int nCount = pEntry->GetCount();
883 if (nCount == 1) 883 if (nCount == 1)
884 { 884 {
885 FX_FLOAT g = pEntry->GetNumber(0) * 255; 885 FX_FLOAT g = pEntry->GetNumber(0) * 255;
886 886
887 color = FXSYS_RGB((int)g, (int)g, (int)g); 887 color = FXSYS_RGB((int)g, (int)g, (int)g);
888 888
889 return TRUE; 889 return true;
890 } 890 }
891 else if (nCount == 3) 891 else if (nCount == 3)
892 { 892 {
893 FX_FLOAT r = pEntry->GetNumber(0) * 255; 893 FX_FLOAT r = pEntry->GetNumber(0) * 255;
894 FX_FLOAT g = pEntry->GetNumber(1) * 255; 894 FX_FLOAT g = pEntry->GetNumber(1) * 255;
895 FX_FLOAT b = pEntry->GetNumber(2) * 255; 895 FX_FLOAT b = pEntry->GetNumber(2) * 255;
896 896
897 color = FXSYS_RGB((int)r, (int)g, (int)b); 897 color = FXSYS_RGB((int)r, (int)g, (int)b);
898 898
899 return TRUE; 899 return true;
900 } 900 }
901 else if (nCount == 4) 901 else if (nCount == 4)
902 { 902 {
903 FX_FLOAT c = pEntry->GetNumber(0); 903 FX_FLOAT c = pEntry->GetNumber(0);
904 FX_FLOAT m = pEntry->GetNumber(1); 904 FX_FLOAT m = pEntry->GetNumber(1);
905 FX_FLOAT y = pEntry->GetNumber(2); 905 FX_FLOAT y = pEntry->GetNumber(2);
906 FX_FLOAT k = pEntry->GetNumber(3); 906 FX_FLOAT k = pEntry->GetNumber(3);
907 907
908 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); 908 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k);
909 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); 909 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k);
910 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); 910 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k);
911 911
912 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); 912 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255));
913 913
914 return TRUE; 914 return true;
915 } 915 }
916 } 916 }
917 917
918 return FALSE; 918 return false;
919 } 919 }
920 920
921 921
922 void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re ct& rcBBox, 922 void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re ct& rcBBox,
923 const CPDF_Matrix& matrix, const CFX_ByteString& sContents, 923 const CPDF_Matrix& matrix, const CFX_ByteString& sContents,
924 const CFX_ByteString& sAPState) 924 const CFX_ByteString& sAPState)
925 { 925 {
926 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); 926 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP");
927 927
928 if (!pAPDict) 928 if (!pAPDict)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 pStreamDict->SetAtInteger("FormType", 1); 969 pStreamDict->SetAtInteger("FormType", 1);
970 pStream->InitStream(NULL,0,pStreamDict); 970 pStream->InitStream(NULL,0,pStreamDict);
971 } 971 }
972 972
973 if (pStreamDict) 973 if (pStreamDict)
974 { 974 {
975 pStreamDict->SetAtMatrix("Matrix",matrix); 975 pStreamDict->SetAtMatrix("Matrix",matrix);
976 pStreamDict->SetAtRect("BBox", rcBBox); 976 pStreamDict->SetAtRect("BBox", rcBBox);
977 } 977 }
978 978
979 pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, FALSE); 979 pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), false, false);
980 } 980 }
981 981
982 #define BA_ANNOT_MINWIDTH 1 982 #define BA_ANNOT_MINWIDTH 1
983 #define BA_ANNOT_MINHEIGHT 1 983 #define BA_ANNOT_MINHEIGHT 1
984 984
985 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const 985 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const
986 { 986 {
987 return BA_ANNOT_MINWIDTH; 987 return BA_ANNOT_MINWIDTH;
988 } 988 }
989 989
990 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const 990 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const
991 { 991 {
992 return BA_ANNOT_MINHEIGHT; 992 return BA_ANNOT_MINHEIGHT;
993 } 993 }
994 994
995 FX_BOOL CPDFSDK_Annot::CreateFormFiller() 995 bool CPDFSDK_Annot::CreateFormFiller()
996 { 996 {
997 return TRUE; 997 return true;
998 } 998 }
999 FX_BOOL CPDFSDK_Annot::IsVisible() const 999 bool CPDFSDK_Annot::IsVisible() const
1000 { 1000 {
1001 int nFlags = GetFlags(); 1001 int nFlags = GetFlags();
1002 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || (n Flags & ANNOTFLAG_NOVIEW)); 1002 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || (n Flags & ANNOTFLAG_NOVIEW));
1003 } 1003 }
1004 1004
1005 CPDF_Action CPDFSDK_Annot::GetAction() const 1005 CPDF_Action CPDFSDK_Annot::GetAction() const
1006 { 1006 {
1007 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A")); 1007 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A"));
1008 } 1008 }
1009 1009
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 return ; 1066 return ;
1067 } 1067 }
1068 1068
1069 CPDF_Page* CPDFSDK_Annot::GetPDFPage() 1069 CPDF_Page* CPDFSDK_Annot::GetPDFPage()
1070 { 1070 {
1071 if(m_pPageView) 1071 if(m_pPageView)
1072 return m_pPageView->GetPDFPage(); 1072 return m_pPageView->GetPDFPage();
1073 return NULL; 1073 return NULL;
1074 } 1074 }
1075 1075
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_annothandler.cpp ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698