John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 7 | #include "core/include/fxcrt/fx_ext.h" |
| 8 | #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" |
Lei Zhang | bde53d2 | 2015-11-12 22:21:30 -0800 | [diff] [blame] | 9 | #include "fpdfsdk/include/fsdk_baseannot.h" |
| 10 | #include "fpdfsdk/include/fsdk_define.h" |
| 11 | #include "fpdfsdk/include/fsdk_mgr.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 12 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 13 | int _gAfxGetTimeZoneInSeconds(FX_CHAR tzhour, uint8_t tzminute) { |
| 14 | return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 15 | } |
| 16 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 17 | FX_BOOL _gAfxIsLeapYear(int16_t year) { |
| 18 | return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 19 | } |
| 20 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 21 | FX_WORD _gAfxGetYearDays(int16_t year) { |
| 22 | return (_gAfxIsLeapYear(year) == TRUE ? 366 : 365); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 23 | } |
| 24 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 25 | uint8_t _gAfxGetMonthDays(int16_t year, uint8_t month) { |
| 26 | uint8_t mDays; |
| 27 | switch (month) { |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 28 | case 1: |
| 29 | case 3: |
| 30 | case 5: |
| 31 | case 7: |
| 32 | case 8: |
| 33 | case 10: |
| 34 | case 12: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 35 | mDays = 31; |
| 36 | break; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 37 | |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 38 | case 4: |
| 39 | case 6: |
| 40 | case 9: |
| 41 | case 11: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 42 | mDays = 30; |
| 43 | break; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 44 | |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 45 | case 2: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 46 | if (_gAfxIsLeapYear(year) == TRUE) |
| 47 | mDays = 29; |
| 48 | else |
| 49 | mDays = 28; |
| 50 | break; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 51 | |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 52 | default: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 53 | mDays = 0; |
| 54 | break; |
| 55 | } |
| 56 | |
| 57 | return mDays; |
| 58 | } |
| 59 | |
| 60 | CPDFSDK_DateTime::CPDFSDK_DateTime() { |
| 61 | ResetDateTime(); |
| 62 | } |
| 63 | |
| 64 | CPDFSDK_DateTime::CPDFSDK_DateTime(const CFX_ByteString& dtStr) { |
| 65 | ResetDateTime(); |
| 66 | |
| 67 | FromPDFDateTimeString(dtStr); |
| 68 | } |
| 69 | |
| 70 | CPDFSDK_DateTime::CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime) { |
| 71 | operator=(datetime); |
| 72 | } |
| 73 | |
| 74 | CPDFSDK_DateTime::CPDFSDK_DateTime(const FX_SYSTEMTIME& st) { |
| 75 | operator=(st); |
| 76 | } |
| 77 | |
| 78 | void CPDFSDK_DateTime::ResetDateTime() { |
| 79 | tzset(); |
| 80 | |
| 81 | time_t curTime; |
| 82 | time(&curTime); |
| 83 | struct tm* newtime; |
| 84 | // newtime = gmtime(&curTime); |
| 85 | newtime = localtime(&curTime); |
| 86 | |
| 87 | dt.year = newtime->tm_year + 1900; |
| 88 | dt.month = newtime->tm_mon + 1; |
| 89 | dt.day = newtime->tm_mday; |
| 90 | dt.hour = newtime->tm_hour; |
| 91 | dt.minute = newtime->tm_min; |
| 92 | dt.second = newtime->tm_sec; |
| 93 | // dt.tzHour = _timezone / 3600 * -1; |
| 94 | // dt.tzMinute = (abs(_timezone) % 3600) / 60; |
| 95 | } |
| 96 | |
| 97 | CPDFSDK_DateTime& CPDFSDK_DateTime::operator=( |
| 98 | const CPDFSDK_DateTime& datetime) { |
| 99 | FXSYS_memcpy(&dt, &datetime.dt, sizeof(FX_DATETIME)); |
| 100 | return *this; |
| 101 | } |
| 102 | |
| 103 | CPDFSDK_DateTime& CPDFSDK_DateTime::operator=(const FX_SYSTEMTIME& st) { |
| 104 | tzset(); |
| 105 | |
| 106 | dt.year = (int16_t)st.wYear; |
| 107 | dt.month = (uint8_t)st.wMonth; |
| 108 | dt.day = (uint8_t)st.wDay; |
| 109 | dt.hour = (uint8_t)st.wHour; |
| 110 | dt.minute = (uint8_t)st.wMinute; |
| 111 | dt.second = (uint8_t)st.wSecond; |
| 112 | // dt.tzHour = _timezone / 3600 * -1; |
| 113 | // dt.tzMinute = (abs(_timezone) % 3600) / 60; |
| 114 | return *this; |
| 115 | } |
| 116 | |
| 117 | FX_BOOL CPDFSDK_DateTime::operator==(CPDFSDK_DateTime& datetime) { |
| 118 | return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0); |
| 119 | } |
| 120 | |
| 121 | FX_BOOL CPDFSDK_DateTime::operator!=(CPDFSDK_DateTime& datetime) { |
| 122 | return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) != 0); |
| 123 | } |
| 124 | |
| 125 | FX_BOOL CPDFSDK_DateTime::operator>(CPDFSDK_DateTime& datetime) { |
| 126 | CPDFSDK_DateTime dt1 = ToGMT(); |
| 127 | CPDFSDK_DateTime dt2 = datetime.ToGMT(); |
| 128 | int d1 = |
| 129 | (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day; |
| 130 | int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | |
| 131 | (int)dt1.dt.second; |
| 132 | int d3 = |
| 133 | (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day; |
| 134 | int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | |
| 135 | (int)dt2.dt.second; |
| 136 | |
| 137 | if (d1 > d3) |
| 138 | return TRUE; |
| 139 | if (d2 > d4) |
| 140 | return TRUE; |
| 141 | return FALSE; |
| 142 | } |
| 143 | |
| 144 | FX_BOOL CPDFSDK_DateTime::operator>=(CPDFSDK_DateTime& datetime) { |
| 145 | CPDFSDK_DateTime dt1 = ToGMT(); |
| 146 | CPDFSDK_DateTime dt2 = datetime.ToGMT(); |
| 147 | int d1 = |
| 148 | (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day; |
| 149 | int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | |
| 150 | (int)dt1.dt.second; |
| 151 | int d3 = |
| 152 | (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day; |
| 153 | int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | |
| 154 | (int)dt2.dt.second; |
| 155 | |
| 156 | if (d1 >= d3) |
| 157 | return TRUE; |
| 158 | if (d2 >= d4) |
| 159 | return TRUE; |
| 160 | return FALSE; |
| 161 | } |
| 162 | |
| 163 | FX_BOOL CPDFSDK_DateTime::operator<(CPDFSDK_DateTime& datetime) { |
| 164 | CPDFSDK_DateTime dt1 = ToGMT(); |
| 165 | CPDFSDK_DateTime dt2 = datetime.ToGMT(); |
| 166 | int d1 = |
| 167 | (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day; |
| 168 | int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | |
| 169 | (int)dt1.dt.second; |
| 170 | int d3 = |
| 171 | (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day; |
| 172 | int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | |
| 173 | (int)dt2.dt.second; |
| 174 | |
| 175 | if (d1 < d3) |
| 176 | return TRUE; |
| 177 | if (d2 < d4) |
| 178 | return TRUE; |
| 179 | return FALSE; |
| 180 | } |
| 181 | |
| 182 | FX_BOOL CPDFSDK_DateTime::operator<=(CPDFSDK_DateTime& datetime) { |
| 183 | CPDFSDK_DateTime dt1 = ToGMT(); |
| 184 | CPDFSDK_DateTime dt2 = datetime.ToGMT(); |
| 185 | int d1 = |
| 186 | (((int)dt1.dt.year) << 16) | (((int)dt1.dt.month) << 8) | (int)dt1.dt.day; |
| 187 | int d2 = (((int)dt1.dt.hour) << 16) | (((int)dt1.dt.minute) << 8) | |
| 188 | (int)dt1.dt.second; |
| 189 | int d3 = |
| 190 | (((int)dt2.dt.year) << 16) | (((int)dt2.dt.month) << 8) | (int)dt2.dt.day; |
| 191 | int d4 = (((int)dt2.dt.hour) << 16) | (((int)dt2.dt.minute) << 8) | |
| 192 | (int)dt2.dt.second; |
| 193 | |
| 194 | if (d1 <= d3) |
| 195 | return TRUE; |
| 196 | if (d2 <= d4) |
| 197 | return TRUE; |
| 198 | return FALSE; |
| 199 | } |
| 200 | |
| 201 | CPDFSDK_DateTime::operator time_t() { |
| 202 | struct tm newtime; |
| 203 | |
| 204 | newtime.tm_year = dt.year - 1900; |
| 205 | newtime.tm_mon = dt.month - 1; |
| 206 | newtime.tm_mday = dt.day; |
| 207 | newtime.tm_hour = dt.hour; |
| 208 | newtime.tm_min = dt.minute; |
| 209 | newtime.tm_sec = dt.second; |
| 210 | |
| 211 | return mktime(&newtime); |
| 212 | } |
| 213 | |
| 214 | CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( |
| 215 | const CFX_ByteString& dtStr) { |
| 216 | int strLength = dtStr.GetLength(); |
| 217 | if (strLength > 0) { |
| 218 | int i = 0; |
| 219 | int j, k; |
| 220 | FX_CHAR ch; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 221 | while (i < strLength && !std::isdigit(dtStr[i])) |
| 222 | ++i; |
| 223 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 224 | if (i >= strLength) |
| 225 | return *this; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 226 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 227 | j = 0; |
| 228 | k = 0; |
| 229 | while (i < strLength && j < 4) { |
| 230 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 231 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 232 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 233 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 234 | break; |
| 235 | i++; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 236 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 237 | dt.year = (int16_t)k; |
| 238 | if (i >= strLength || j < 4) |
| 239 | return *this; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 240 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 241 | j = 0; |
| 242 | k = 0; |
| 243 | while (i < strLength && j < 2) { |
| 244 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 245 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 246 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 247 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 248 | break; |
| 249 | i++; |
| 250 | } |
| 251 | dt.month = (uint8_t)k; |
| 252 | if (i >= strLength || j < 2) |
| 253 | return *this; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 254 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 255 | j = 0; |
| 256 | k = 0; |
| 257 | while (i < strLength && j < 2) { |
| 258 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 259 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 260 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 261 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 262 | break; |
| 263 | i++; |
| 264 | } |
| 265 | dt.day = (uint8_t)k; |
| 266 | if (i >= strLength || j < 2) |
| 267 | return *this; |
| 268 | |
| 269 | j = 0; |
| 270 | k = 0; |
| 271 | while (i < strLength && j < 2) { |
| 272 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 273 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 274 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 275 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 276 | break; |
| 277 | i++; |
| 278 | } |
| 279 | dt.hour = (uint8_t)k; |
| 280 | if (i >= strLength || j < 2) |
| 281 | return *this; |
| 282 | |
| 283 | j = 0; |
| 284 | k = 0; |
| 285 | while (i < strLength && j < 2) { |
| 286 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 287 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 288 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 289 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 290 | break; |
| 291 | i++; |
| 292 | } |
| 293 | dt.minute = (uint8_t)k; |
| 294 | if (i >= strLength || j < 2) |
| 295 | return *this; |
| 296 | |
| 297 | j = 0; |
| 298 | k = 0; |
| 299 | while (i < strLength && j < 2) { |
| 300 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 301 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 302 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 303 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 304 | break; |
| 305 | i++; |
| 306 | } |
| 307 | dt.second = (uint8_t)k; |
| 308 | if (i >= strLength || j < 2) |
| 309 | return *this; |
| 310 | |
| 311 | ch = dtStr[i++]; |
| 312 | if (ch != '-' && ch != '+') |
| 313 | return *this; |
| 314 | if (ch == '-') |
| 315 | dt.tzHour = -1; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 316 | else |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 317 | dt.tzHour = 1; |
| 318 | j = 0; |
| 319 | k = 0; |
| 320 | while (i < strLength && j < 2) { |
| 321 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 322 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 323 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 324 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 325 | break; |
| 326 | i++; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 327 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 328 | dt.tzHour *= (FX_CHAR)k; |
| 329 | if (i >= strLength || j < 2) |
| 330 | return *this; |
| 331 | |
| 332 | ch = dtStr[i++]; |
| 333 | if (ch != '\'') |
| 334 | return *this; |
| 335 | j = 0; |
| 336 | k = 0; |
| 337 | while (i < strLength && j < 2) { |
| 338 | ch = dtStr[i]; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 339 | k = k * 10 + FXSYS_toDecimalDigit(ch); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 340 | j++; |
Dan Sinclair | 10cfea1 | 2015-11-16 13:09:00 -0500 | [diff] [blame] | 341 | if (!std::isdigit(ch)) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 342 | break; |
| 343 | i++; |
| 344 | } |
| 345 | dt.tzMinute = (uint8_t)k; |
| 346 | if (i >= strLength || j < 2) |
| 347 | return *this; |
| 348 | } |
| 349 | |
| 350 | return *this; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 351 | } |
| 352 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 353 | CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { |
| 354 | CFX_ByteString str1; |
| 355 | str1.Format("%04d-%02d-%02d %02d:%02d:%02d ", dt.year, dt.month, dt.day, |
| 356 | dt.hour, dt.minute, dt.second); |
| 357 | if (dt.tzHour < 0) |
| 358 | str1 += "-"; |
| 359 | else |
| 360 | str1 += "+"; |
| 361 | CFX_ByteString str2; |
| 362 | str2.Format("%02d:%02d", abs(dt.tzHour), dt.tzMinute); |
| 363 | return str1 + str2; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 364 | } |
| 365 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 366 | CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { |
| 367 | CFX_ByteString dtStr; |
| 368 | char tempStr[32]; |
| 369 | memset(tempStr, 0, sizeof(tempStr)); |
| 370 | FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02d%02d%02d%02d%02d", |
| 371 | dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); |
| 372 | dtStr = CFX_ByteString(tempStr); |
| 373 | if (dt.tzHour < 0) |
| 374 | dtStr += CFX_ByteString("-"); |
| 375 | else |
| 376 | dtStr += CFX_ByteString("+"); |
| 377 | memset(tempStr, 0, sizeof(tempStr)); |
| 378 | FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02d'", abs(dt.tzHour), |
| 379 | dt.tzMinute); |
| 380 | dtStr += CFX_ByteString(tempStr); |
| 381 | return dtStr; |
| 382 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 383 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 384 | void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { |
| 385 | CPDFSDK_DateTime dt = *this; |
| 386 | time_t t = (time_t)dt; |
| 387 | struct tm* pTime = localtime(&t); |
| 388 | if (pTime) { |
| 389 | st.wYear = (FX_WORD)pTime->tm_year + 1900; |
| 390 | st.wMonth = (FX_WORD)pTime->tm_mon + 1; |
| 391 | st.wDay = (FX_WORD)pTime->tm_mday; |
| 392 | st.wDayOfWeek = (FX_WORD)pTime->tm_wday; |
| 393 | st.wHour = (FX_WORD)pTime->tm_hour; |
| 394 | st.wMinute = (FX_WORD)pTime->tm_min; |
| 395 | st.wSecond = (FX_WORD)pTime->tm_sec; |
| 396 | st.wMilliseconds = 0; |
| 397 | } |
| 398 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 399 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 400 | CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() { |
| 401 | CPDFSDK_DateTime dt = *this; |
| 402 | dt.AddSeconds(-_gAfxGetTimeZoneInSeconds(dt.dt.tzHour, dt.dt.tzMinute)); |
| 403 | dt.dt.tzHour = 0; |
| 404 | dt.dt.tzMinute = 0; |
| 405 | return dt; |
| 406 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 407 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 408 | CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { |
| 409 | if (days == 0) |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 410 | return *this; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 411 | |
| 412 | int16_t y = dt.year, yy; |
| 413 | uint8_t m = dt.month; |
| 414 | uint8_t d = dt.day; |
| 415 | int mdays, ydays, ldays; |
| 416 | |
| 417 | ldays = days; |
| 418 | if (ldays > 0) { |
| 419 | yy = y; |
| 420 | if (((FX_WORD)m * 100 + d) > 300) |
| 421 | yy++; |
| 422 | ydays = _gAfxGetYearDays(yy); |
| 423 | while (ldays >= ydays) { |
| 424 | y++; |
| 425 | ldays -= ydays; |
| 426 | yy++; |
| 427 | mdays = _gAfxGetMonthDays(y, m); |
| 428 | if (d > mdays) { |
| 429 | m++; |
| 430 | d -= mdays; |
| 431 | } |
| 432 | ydays = _gAfxGetYearDays(yy); |
| 433 | } |
| 434 | mdays = _gAfxGetMonthDays(y, m) - d + 1; |
| 435 | while (ldays >= mdays) { |
| 436 | ldays -= mdays; |
| 437 | m++; |
| 438 | d = 1; |
| 439 | mdays = _gAfxGetMonthDays(y, m); |
| 440 | } |
| 441 | d += ldays; |
| 442 | } else { |
| 443 | ldays *= -1; |
| 444 | yy = y; |
| 445 | if (((FX_WORD)m * 100 + d) < 300) |
| 446 | yy--; |
| 447 | ydays = _gAfxGetYearDays(yy); |
| 448 | while (ldays >= ydays) { |
| 449 | y--; |
| 450 | ldays -= ydays; |
| 451 | yy--; |
| 452 | mdays = _gAfxGetMonthDays(y, m); |
| 453 | if (d > mdays) { |
| 454 | m++; |
| 455 | d -= mdays; |
| 456 | } |
| 457 | ydays = _gAfxGetYearDays(yy); |
| 458 | } |
| 459 | while (ldays >= d) { |
| 460 | ldays -= d; |
| 461 | m--; |
| 462 | mdays = _gAfxGetMonthDays(y, m); |
| 463 | d = mdays; |
| 464 | } |
| 465 | d -= ldays; |
| 466 | } |
| 467 | |
| 468 | dt.year = y; |
| 469 | dt.month = m; |
| 470 | dt.day = d; |
| 471 | |
| 472 | return *this; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 473 | } |
| 474 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 475 | CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) { |
| 476 | if (seconds == 0) |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 477 | return *this; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 478 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 479 | int n; |
| 480 | int days; |
| 481 | |
| 482 | n = dt.hour * 3600 + dt.minute * 60 + dt.second + seconds; |
| 483 | if (n < 0) { |
| 484 | days = (n - 86399) / 86400; |
| 485 | n -= days * 86400; |
| 486 | } else { |
| 487 | days = n / 86400; |
| 488 | n %= 86400; |
| 489 | } |
| 490 | dt.hour = (uint8_t)(n / 3600); |
| 491 | dt.hour %= 24; |
| 492 | n %= 3600; |
| 493 | dt.minute = (uint8_t)(n / 60); |
| 494 | dt.second = (uint8_t)(n % 60); |
| 495 | if (days != 0) |
| 496 | AddDays(days); |
| 497 | |
| 498 | return *this; |
| 499 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 500 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 501 | CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) |
Dan Sinclair | bfe042a | 2015-11-04 14:04:13 -0500 | [diff] [blame] | 502 | : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) { |
| 503 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 504 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 505 | CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, |
| 506 | CPDFSDK_PageView* pPageView) |
Dan Sinclair | bfe042a | 2015-11-04 14:04:13 -0500 | [diff] [blame] | 507 | : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) { |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 508 | } |
| 509 | |
Tom Sepez | 3343d14 | 2015-11-02 09:54:54 -0800 | [diff] [blame] | 510 | CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 511 | return m_pAnnot; |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 512 | } |
| 513 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 514 | FX_BOOL CPDFSDK_Annot::IsSelected() { |
| 515 | return m_bSelected; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 516 | } |
| 517 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 518 | void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { |
| 519 | m_bSelected = bSelected; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 520 | } |
| 521 | |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 522 | // Tab Order |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 523 | int CPDFSDK_Annot::GetTabOrder() { |
| 524 | return m_nTabOrder; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 525 | } |
| 526 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 527 | void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { |
| 528 | m_nTabOrder = iTabOrder; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 529 | } |
| 530 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 531 | CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { |
| 532 | ASSERT(m_pAnnot != NULL); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 533 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 534 | return m_pAnnot->GetAnnotDict(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 535 | } |
| 536 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 537 | void CPDFSDK_BAAnnot::SetRect(const CPDF_Rect& rect) { |
| 538 | ASSERT(rect.right - rect.left >= GetMinWidth()); |
| 539 | ASSERT(rect.top - rect.bottom >= GetMinHeight()); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 540 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 541 | m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 542 | } |
| 543 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 544 | CPDF_Rect CPDFSDK_BAAnnot::GetRect() const { |
| 545 | ASSERT(m_pAnnot != NULL); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 546 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 547 | CPDF_Rect rect; |
| 548 | m_pAnnot->GetRect(rect); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 549 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 550 | return rect; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 551 | } |
| 552 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 553 | CFX_ByteString CPDFSDK_BAAnnot::GetType() const { |
| 554 | ASSERT(m_pAnnot != NULL); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 555 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 556 | return m_pAnnot->GetSubType(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 557 | } |
| 558 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 559 | CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { |
| 560 | return ""; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 561 | } |
| 562 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 563 | void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, |
| 564 | const CPDF_Matrix* pUser2Device, |
| 565 | CPDF_Annot::AppearanceMode mode, |
| 566 | const CPDF_RenderOptions* pOptions) { |
| 567 | ASSERT(m_pPageView != NULL); |
| 568 | ASSERT(m_pAnnot != NULL); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 569 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 570 | m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 571 | mode, pOptions); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 572 | } |
| 573 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 574 | FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { |
| 575 | return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 576 | } |
| 577 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 578 | FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { |
| 579 | CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
| 580 | if (pAP == NULL) |
| 581 | return FALSE; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 582 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 583 | // Choose the right sub-ap |
| 584 | const FX_CHAR* ap_entry = "N"; |
| 585 | if (mode == CPDF_Annot::Down) |
| 586 | ap_entry = "D"; |
| 587 | else if (mode == CPDF_Annot::Rollover) |
| 588 | ap_entry = "R"; |
| 589 | if (!pAP->KeyExist(ap_entry)) |
| 590 | ap_entry = "N"; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 591 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 592 | // Get the AP stream or subdirectory |
| 593 | CPDF_Object* psub = pAP->GetElementValue(ap_entry); |
| 594 | if (psub == NULL) |
| 595 | return FALSE; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 596 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 597 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 598 | } |
| 599 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 600 | void CPDFSDK_BAAnnot::DrawBorder(CFX_RenderDevice* pDevice, |
| 601 | const CPDF_Matrix* pUser2Device, |
| 602 | const CPDF_RenderOptions* pOptions) { |
| 603 | ASSERT(m_pAnnot != NULL); |
| 604 | m_pAnnot->DrawBorder(pDevice, pUser2Device, pOptions); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 605 | } |
| 606 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 607 | void CPDFSDK_BAAnnot::ClearCachedAP() { |
| 608 | ASSERT(m_pAnnot != NULL); |
| 609 | m_pAnnot->ClearCachedAP(); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 610 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 611 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 612 | void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { |
| 613 | if (sContents.IsEmpty()) |
| 614 | m_pAnnot->GetAnnotDict()->RemoveAt("Contents"); |
| 615 | else |
| 616 | m_pAnnot->GetAnnotDict()->SetAtString("Contents", |
| 617 | PDF_EncodeText(sContents)); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 618 | } |
| 619 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 620 | CFX_WideString CPDFSDK_BAAnnot::GetContents() const { |
| 621 | return m_pAnnot->GetAnnotDict()->GetUnicodeText("Contents"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 622 | } |
| 623 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 624 | void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { |
| 625 | if (sName.IsEmpty()) |
| 626 | m_pAnnot->GetAnnotDict()->RemoveAt("NM"); |
| 627 | else |
| 628 | m_pAnnot->GetAnnotDict()->SetAtString("NM", PDF_EncodeText(sName)); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 629 | } |
| 630 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 631 | CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const { |
| 632 | return m_pAnnot->GetAnnotDict()->GetUnicodeText("NM"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 633 | } |
| 634 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 635 | void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { |
| 636 | CPDFSDK_DateTime dt(st); |
| 637 | CFX_ByteString str = dt.ToPDFDateTimeString(); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 638 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 639 | if (str.IsEmpty()) |
| 640 | m_pAnnot->GetAnnotDict()->RemoveAt("M"); |
| 641 | else |
| 642 | m_pAnnot->GetAnnotDict()->SetAtString("M", str); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 643 | } |
| 644 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 645 | FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { |
| 646 | FX_SYSTEMTIME systime; |
| 647 | CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetString("M"); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 648 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 649 | CPDFSDK_DateTime dt(str); |
| 650 | dt.ToSystemTime(systime); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 651 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 652 | return systime; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 653 | } |
| 654 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 655 | void CPDFSDK_BAAnnot::SetFlags(int nFlags) { |
| 656 | m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 657 | } |
| 658 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 659 | int CPDFSDK_BAAnnot::GetFlags() const { |
| 660 | return m_pAnnot->GetAnnotDict()->GetInteger("F"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 661 | } |
| 662 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 663 | void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) { |
| 664 | if (str.IsEmpty()) |
| 665 | m_pAnnot->GetAnnotDict()->RemoveAt("AS"); |
| 666 | else |
| 667 | m_pAnnot->GetAnnotDict()->SetAtString("AS", str); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 668 | } |
| 669 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 670 | CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const { |
| 671 | return m_pAnnot->GetAnnotDict()->GetString("AS"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 672 | } |
| 673 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 674 | void CPDFSDK_BAAnnot::SetStructParent(int key) { |
| 675 | m_pAnnot->GetAnnotDict()->SetAtInteger("StructParent", key); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 676 | } |
| 677 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 678 | int CPDFSDK_BAAnnot::GetStructParent() const { |
| 679 | return m_pAnnot->GetAnnotDict()->GetInteger("StructParent"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 680 | } |
| 681 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 682 | // border |
| 683 | void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { |
| 684 | CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 685 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 686 | if (pBorder) { |
Tom Sepez | ae51c81 | 2015-08-05 12:34:06 -0700 | [diff] [blame] | 687 | pBorder->SetAt(2, new CPDF_Number(nWidth)); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 688 | } else { |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 689 | CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 690 | |
| 691 | if (!pBSDict) { |
Tom Sepez | ae51c81 | 2015-08-05 12:34:06 -0700 | [diff] [blame] | 692 | pBSDict = new CPDF_Dictionary; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 693 | m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 694 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 695 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 696 | pBSDict->SetAtInteger("W", nWidth); |
| 697 | } |
| 698 | } |
| 699 | |
| 700 | int CPDFSDK_BAAnnot::GetBorderWidth() const { |
| 701 | if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border")) { |
| 702 | return pBorder->GetInteger(2); |
| 703 | } |
| 704 | if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS")) { |
| 705 | return pBSDict->GetInteger("W", 1); |
| 706 | } |
| 707 | return 1; |
| 708 | } |
| 709 | |
| 710 | void CPDFSDK_BAAnnot::SetBorderStyle(int nStyle) { |
| 711 | CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
| 712 | if (!pBSDict) { |
| 713 | pBSDict = new CPDF_Dictionary; |
| 714 | m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
| 715 | } |
| 716 | |
| 717 | switch (nStyle) { |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 718 | case BBS_SOLID: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 719 | pBSDict->SetAtName("S", "S"); |
| 720 | break; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 721 | case BBS_DASH: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 722 | pBSDict->SetAtName("S", "D"); |
| 723 | break; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 724 | case BBS_BEVELED: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 725 | pBSDict->SetAtName("S", "B"); |
| 726 | break; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 727 | case BBS_INSET: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 728 | pBSDict->SetAtName("S", "I"); |
| 729 | break; |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 730 | case BBS_UNDERLINE: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 731 | pBSDict->SetAtName("S", "U"); |
| 732 | break; |
| 733 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 734 | } |
| 735 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 736 | int CPDFSDK_BAAnnot::GetBorderStyle() const { |
| 737 | CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
| 738 | if (pBSDict) { |
| 739 | CFX_ByteString sBorderStyle = pBSDict->GetString("S", "S"); |
| 740 | if (sBorderStyle == "S") |
| 741 | return BBS_SOLID; |
| 742 | if (sBorderStyle == "D") |
| 743 | return BBS_DASH; |
| 744 | if (sBorderStyle == "B") |
| 745 | return BBS_BEVELED; |
| 746 | if (sBorderStyle == "I") |
| 747 | return BBS_INSET; |
| 748 | if (sBorderStyle == "U") |
| 749 | return BBS_UNDERLINE; |
| 750 | } |
| 751 | |
| 752 | CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
| 753 | if (pBorder) { |
| 754 | if (pBorder->GetCount() >= 4) { |
| 755 | CPDF_Array* pDP = pBorder->GetArray(3); |
| 756 | if (pDP && pDP->GetCount() > 0) |
| 757 | return BBS_DASH; |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | return BBS_SOLID; |
| 762 | } |
| 763 | |
| 764 | void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) { |
| 765 | CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
| 766 | if (!pBSDict) { |
| 767 | pBSDict = new CPDF_Dictionary; |
| 768 | m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
| 769 | } |
| 770 | |
Tom Sepez | ae51c81 | 2015-08-05 12:34:06 -0700 | [diff] [blame] | 771 | CPDF_Array* pArray = new CPDF_Array; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 772 | for (int i = 0, sz = array.GetSize(); i < sz; i++) { |
| 773 | pArray->AddInteger(array[i]); |
| 774 | } |
| 775 | |
| 776 | pBSDict->SetAt("D", pArray); |
| 777 | } |
| 778 | |
| 779 | void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const { |
| 780 | CPDF_Array* pDash = NULL; |
| 781 | |
| 782 | CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
| 783 | if (pBorder) { |
| 784 | pDash = pBorder->GetArray(3); |
| 785 | } else { |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 786 | CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 787 | if (pBSDict) { |
| 788 | pDash = pBSDict->GetArray("D"); |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | if (pDash) { |
| 793 | for (int i = 0, sz = pDash->GetCount(); i < sz; i++) { |
| 794 | array.Add(pDash->GetInteger(i)); |
| 795 | } |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { |
| 800 | CPDF_Array* pArray = new CPDF_Array; |
| 801 | pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); |
| 802 | pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); |
| 803 | pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); |
| 804 | m_pAnnot->GetAnnotDict()->SetAt("C", pArray); |
| 805 | } |
| 806 | |
| 807 | void CPDFSDK_BAAnnot::RemoveColor() { |
| 808 | m_pAnnot->GetAnnotDict()->RemoveAt("C"); |
| 809 | } |
| 810 | |
| 811 | FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { |
| 812 | if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C")) { |
| 813 | int nCount = pEntry->GetCount(); |
| 814 | if (nCount == 1) { |
| 815 | FX_FLOAT g = pEntry->GetNumber(0) * 255; |
| 816 | |
| 817 | color = FXSYS_RGB((int)g, (int)g, (int)g); |
| 818 | |
| 819 | return TRUE; |
| 820 | } else if (nCount == 3) { |
| 821 | FX_FLOAT r = pEntry->GetNumber(0) * 255; |
| 822 | FX_FLOAT g = pEntry->GetNumber(1) * 255; |
| 823 | FX_FLOAT b = pEntry->GetNumber(2) * 255; |
| 824 | |
| 825 | color = FXSYS_RGB((int)r, (int)g, (int)b); |
| 826 | |
| 827 | return TRUE; |
| 828 | } else if (nCount == 4) { |
| 829 | FX_FLOAT c = pEntry->GetNumber(0); |
| 830 | FX_FLOAT m = pEntry->GetNumber(1); |
| 831 | FX_FLOAT y = pEntry->GetNumber(2); |
| 832 | FX_FLOAT k = pEntry->GetNumber(3); |
| 833 | |
| 834 | FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); |
| 835 | FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); |
| 836 | FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); |
| 837 | |
| 838 | color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); |
| 839 | |
| 840 | return TRUE; |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | return FALSE; |
| 845 | } |
| 846 | |
| 847 | void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, |
| 848 | const CPDF_Rect& rcBBox, |
| 849 | const CPDF_Matrix& matrix, |
| 850 | const CFX_ByteString& sContents, |
| 851 | const CFX_ByteString& sAPState) { |
| 852 | CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
| 853 | |
| 854 | if (!pAPDict) { |
| 855 | pAPDict = new CPDF_Dictionary; |
| 856 | m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); |
| 857 | } |
| 858 | |
Dan Sinclair | bfe042a | 2015-11-04 14:04:13 -0500 | [diff] [blame] | 859 | CPDF_Stream* pStream = nullptr; |
| 860 | CPDF_Dictionary* pParentDict = nullptr; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 861 | |
| 862 | if (sAPState.IsEmpty()) { |
| 863 | pParentDict = pAPDict; |
| 864 | pStream = pAPDict->GetStream(sAPType); |
| 865 | } else { |
| 866 | CPDF_Dictionary* pAPTypeDict = pAPDict->GetDict(sAPType); |
| 867 | if (!pAPTypeDict) { |
Tom Sepez | ae51c81 | 2015-08-05 12:34:06 -0700 | [diff] [blame] | 868 | pAPTypeDict = new CPDF_Dictionary; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 869 | pAPDict->SetAt(sAPType, pAPTypeDict); |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 870 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 871 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 872 | pParentDict = pAPTypeDict; |
| 873 | pStream = pAPTypeDict->GetStream(sAPState); |
| 874 | } |
| 875 | |
| 876 | if (!pStream) { |
Dan Sinclair | bfe042a | 2015-11-04 14:04:13 -0500 | [diff] [blame] | 877 | pStream = new CPDF_Stream(nullptr, 0, nullptr); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 878 | |
Dan Sinclair | bfe042a | 2015-11-04 14:04:13 -0500 | [diff] [blame] | 879 | CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 880 | int32_t objnum = pDoc->AddIndirectObject(pStream); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 881 | pParentDict->SetAtReference(sAPType, pDoc, objnum); |
| 882 | } |
| 883 | |
| 884 | CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 885 | if (!pStreamDict) { |
Tom Sepez | ae51c81 | 2015-08-05 12:34:06 -0700 | [diff] [blame] | 886 | pStreamDict = new CPDF_Dictionary; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 887 | pStreamDict->SetAtName("Type", "XObject"); |
| 888 | pStreamDict->SetAtName("Subtype", "Form"); |
| 889 | pStreamDict->SetAtInteger("FormType", 1); |
Dan Sinclair | bfe042a | 2015-11-04 14:04:13 -0500 | [diff] [blame] | 890 | pStream->InitStream(nullptr, 0, pStreamDict); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 891 | } |
| 892 | |
| 893 | if (pStreamDict) { |
| 894 | pStreamDict->SetAtMatrix("Matrix", matrix); |
| 895 | pStreamDict->SetAtRect("BBox", rcBBox); |
| 896 | } |
| 897 | |
| 898 | pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength(), FALSE, |
| 899 | FALSE); |
| 900 | } |
| 901 | |
| 902 | #define BA_ANNOT_MINWIDTH 1 |
| 903 | #define BA_ANNOT_MINHEIGHT 1 |
| 904 | |
| 905 | FX_FLOAT CPDFSDK_Annot::GetMinWidth() const { |
| 906 | return BA_ANNOT_MINWIDTH; |
| 907 | } |
| 908 | |
| 909 | FX_FLOAT CPDFSDK_Annot::GetMinHeight() const { |
| 910 | return BA_ANNOT_MINHEIGHT; |
| 911 | } |
| 912 | |
| 913 | FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() { |
| 914 | return TRUE; |
| 915 | } |
| 916 | FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { |
| 917 | int nFlags = GetFlags(); |
| 918 | return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || |
| 919 | (nFlags & ANNOTFLAG_NOVIEW)); |
| 920 | } |
| 921 | |
| 922 | CPDF_Action CPDFSDK_BAAnnot::GetAction() const { |
| 923 | return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A")); |
| 924 | } |
| 925 | |
| 926 | void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { |
| 927 | ASSERT(action); |
| 928 | if ((CPDF_Action&)action != |
| 929 | CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A"))) { |
| 930 | CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
| 931 | CPDF_Dictionary* pDict = action.GetDict(); |
| 932 | if (pDict && pDict->GetObjNum() == 0) { |
| 933 | pDoc->AddIndirectObject(pDict); |
Tom Sepez | 2f2ffec | 2015-07-23 14:42:09 -0700 | [diff] [blame] | 934 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 935 | m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum()); |
| 936 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 937 | } |
| 938 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 939 | void CPDFSDK_BAAnnot::RemoveAction() { |
| 940 | m_pAnnot->GetAnnotDict()->RemoveAt("A"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 941 | } |
| 942 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 943 | CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { |
| 944 | return m_pAnnot->GetAnnotDict()->GetDict("AA"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 945 | } |
| 946 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 947 | void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { |
| 948 | ASSERT(aa != NULL); |
| 949 | |
| 950 | if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) |
| 951 | m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 952 | } |
| 953 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 954 | void CPDFSDK_BAAnnot::RemoveAAction() { |
| 955 | m_pAnnot->GetAnnotDict()->RemoveAt("AA"); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 956 | } |
| 957 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 958 | CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { |
| 959 | CPDF_AAction AAction = GetAAction(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 960 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 961 | if (AAction.ActionExist(eAAT)) |
| 962 | return AAction.GetAction(eAAT); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 963 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 964 | if (eAAT == CPDF_AAction::ButtonUp) |
| 965 | return GetAction(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 966 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 967 | return CPDF_Action(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 968 | } |
| 969 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 970 | FX_BOOL CPDFSDK_BAAnnot::IsXFAField() { |
| 971 | return FALSE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 972 | } |
| 973 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 974 | void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 975 | CPDF_Matrix* pUser2Device, |
| 976 | CPDF_RenderOptions* pOptions) { |
| 977 | m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
| 978 | m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 979 | CPDF_Annot::Normal, NULL); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 980 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 981 | return; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 982 | } |
| 983 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 984 | CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 985 | if (m_pPageView) |
| 986 | return m_pPageView->GetPDFPage(); |
| 987 | return NULL; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 988 | } |
| 989 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 990 | CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 991 | if (m_pPageView) |
| 992 | return m_pPageView->GetPDFXFAPage(); |
| 993 | return NULL; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 994 | } |