Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 <algorithm> | 7 #include "fpdfsdk/include/cpdfsdk_baannot.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | |
| 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
| 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
| 13 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 12 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
| 14 #include "core/fxcrt/include/fx_ext.h" | 13 #include "fpdfsdk/include/cpdfsdk_datetime.h" |
| 15 #include "core/fxge/include/cfx_renderdevice.h" | |
| 16 #include "fpdfsdk/include/fsdk_baseannot.h" | |
| 17 #include "fpdfsdk/include/fsdk_define.h" | |
| 18 #include "fpdfsdk/include/fsdk_mgr.h" | 14 #include "fpdfsdk/include/fsdk_mgr.h" |
| 19 | 15 |
| 20 #ifdef PDF_ENABLE_XFA | |
| 21 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | |
| 22 #endif // PDF_ENABLE_XFA | |
| 23 | |
| 24 namespace { | |
| 25 | |
| 26 const float kMinWidth = 1.0f; | |
| 27 const float kMinHeight = 1.0f; | |
| 28 | |
| 29 int gAfxGetTimeZoneInSeconds(int8_t tzhour, uint8_t tzminute) { | |
| 30 return (int)tzhour * 3600 + (int)tzminute * (tzhour >= 0 ? 60 : -60); | |
| 31 } | |
| 32 | |
| 33 bool gAfxIsLeapYear(int16_t year) { | |
| 34 return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))); | |
| 35 } | |
| 36 | |
| 37 uint16_t gAfxGetYearDays(int16_t year) { | |
| 38 return (gAfxIsLeapYear(year) ? 366 : 365); | |
| 39 } | |
| 40 | |
| 41 uint8_t gAfxGetMonthDays(int16_t year, uint8_t month) { | |
| 42 uint8_t mDays; | |
| 43 switch (month) { | |
| 44 case 1: | |
| 45 case 3: | |
| 46 case 5: | |
| 47 case 7: | |
| 48 case 8: | |
| 49 case 10: | |
| 50 case 12: | |
| 51 mDays = 31; | |
| 52 break; | |
| 53 | |
| 54 case 4: | |
| 55 case 6: | |
| 56 case 9: | |
| 57 case 11: | |
| 58 mDays = 30; | |
| 59 break; | |
| 60 | |
| 61 case 2: | |
| 62 if (gAfxIsLeapYear(year)) | |
| 63 mDays = 29; | |
| 64 else | |
| 65 mDays = 28; | |
| 66 break; | |
| 67 | |
| 68 default: | |
| 69 mDays = 0; | |
| 70 break; | |
| 71 } | |
| 72 | |
| 73 return mDays; | |
| 74 } | |
| 75 | |
| 76 } // namespace | |
| 77 | |
| 78 CPDFSDK_DateTime::CPDFSDK_DateTime() { | |
| 79 ResetDateTime(); | |
| 80 } | |
| 81 | |
| 82 CPDFSDK_DateTime::CPDFSDK_DateTime(const CFX_ByteString& dtStr) { | |
| 83 ResetDateTime(); | |
| 84 | |
| 85 FromPDFDateTimeString(dtStr); | |
| 86 } | |
| 87 | |
| 88 CPDFSDK_DateTime::CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime) { | |
| 89 operator=(datetime); | |
| 90 } | |
| 91 | |
| 92 CPDFSDK_DateTime::CPDFSDK_DateTime(const FX_SYSTEMTIME& st) { | |
| 93 operator=(st); | |
| 94 } | |
| 95 | |
| 96 void CPDFSDK_DateTime::ResetDateTime() { | |
| 97 tzset(); | |
| 98 | |
| 99 time_t curTime; | |
| 100 time(&curTime); | |
| 101 struct tm* newtime = localtime(&curTime); | |
| 102 | |
| 103 dt.year = newtime->tm_year + 1900; | |
| 104 dt.month = newtime->tm_mon + 1; | |
| 105 dt.day = newtime->tm_mday; | |
| 106 dt.hour = newtime->tm_hour; | |
| 107 dt.minute = newtime->tm_min; | |
| 108 dt.second = newtime->tm_sec; | |
| 109 } | |
| 110 | |
| 111 CPDFSDK_DateTime& CPDFSDK_DateTime::operator=( | |
| 112 const CPDFSDK_DateTime& datetime) { | |
| 113 FXSYS_memcpy(&dt, &datetime.dt, sizeof(FX_DATETIME)); | |
| 114 return *this; | |
| 115 } | |
| 116 | |
| 117 CPDFSDK_DateTime& CPDFSDK_DateTime::operator=(const FX_SYSTEMTIME& st) { | |
| 118 tzset(); | |
| 119 | |
| 120 dt.year = static_cast<int16_t>(st.wYear); | |
| 121 dt.month = static_cast<uint8_t>(st.wMonth); | |
| 122 dt.day = static_cast<uint8_t>(st.wDay); | |
| 123 dt.hour = static_cast<uint8_t>(st.wHour); | |
| 124 dt.minute = static_cast<uint8_t>(st.wMinute); | |
| 125 dt.second = static_cast<uint8_t>(st.wSecond); | |
| 126 return *this; | |
| 127 } | |
| 128 | |
| 129 bool CPDFSDK_DateTime::operator==(const CPDFSDK_DateTime& datetime) const { | |
| 130 return (FXSYS_memcmp(&dt, &datetime.dt, sizeof(FX_DATETIME)) == 0); | |
| 131 } | |
| 132 | |
| 133 bool CPDFSDK_DateTime::operator!=(const CPDFSDK_DateTime& datetime) const { | |
| 134 return !(*this == datetime); | |
| 135 } | |
| 136 | |
| 137 time_t CPDFSDK_DateTime::ToTime_t() const { | |
| 138 struct tm newtime; | |
| 139 | |
| 140 newtime.tm_year = dt.year - 1900; | |
| 141 newtime.tm_mon = dt.month - 1; | |
| 142 newtime.tm_mday = dt.day; | |
| 143 newtime.tm_hour = dt.hour; | |
| 144 newtime.tm_min = dt.minute; | |
| 145 newtime.tm_sec = dt.second; | |
| 146 | |
| 147 return mktime(&newtime); | |
| 148 } | |
| 149 | |
| 150 CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( | |
| 151 const CFX_ByteString& dtStr) { | |
| 152 int strLength = dtStr.GetLength(); | |
| 153 if (strLength <= 0) | |
| 154 return *this; | |
| 155 | |
| 156 int i = 0; | |
| 157 while (i < strLength && !std::isdigit(dtStr[i])) | |
| 158 ++i; | |
| 159 | |
| 160 if (i >= strLength) | |
| 161 return *this; | |
| 162 | |
| 163 int j = 0; | |
| 164 int k = 0; | |
| 165 FX_CHAR ch; | |
| 166 while (i < strLength && j < 4) { | |
| 167 ch = dtStr[i]; | |
| 168 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 169 j++; | |
| 170 if (!std::isdigit(ch)) | |
| 171 break; | |
| 172 i++; | |
| 173 } | |
| 174 dt.year = static_cast<int16_t>(k); | |
| 175 if (i >= strLength || j < 4) | |
| 176 return *this; | |
| 177 | |
| 178 j = 0; | |
| 179 k = 0; | |
| 180 while (i < strLength && j < 2) { | |
| 181 ch = dtStr[i]; | |
| 182 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 183 j++; | |
| 184 if (!std::isdigit(ch)) | |
| 185 break; | |
| 186 i++; | |
| 187 } | |
| 188 dt.month = static_cast<uint8_t>(k); | |
| 189 if (i >= strLength || j < 2) | |
| 190 return *this; | |
| 191 | |
| 192 j = 0; | |
| 193 k = 0; | |
| 194 while (i < strLength && j < 2) { | |
| 195 ch = dtStr[i]; | |
| 196 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 197 j++; | |
| 198 if (!std::isdigit(ch)) | |
| 199 break; | |
| 200 i++; | |
| 201 } | |
| 202 dt.day = static_cast<uint8_t>(k); | |
| 203 if (i >= strLength || j < 2) | |
| 204 return *this; | |
| 205 | |
| 206 j = 0; | |
| 207 k = 0; | |
| 208 while (i < strLength && j < 2) { | |
| 209 ch = dtStr[i]; | |
| 210 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 211 j++; | |
| 212 if (!std::isdigit(ch)) | |
| 213 break; | |
| 214 i++; | |
| 215 } | |
| 216 dt.hour = static_cast<uint8_t>(k); | |
| 217 if (i >= strLength || j < 2) | |
| 218 return *this; | |
| 219 | |
| 220 j = 0; | |
| 221 k = 0; | |
| 222 while (i < strLength && j < 2) { | |
| 223 ch = dtStr[i]; | |
| 224 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 225 j++; | |
| 226 if (!std::isdigit(ch)) | |
| 227 break; | |
| 228 i++; | |
| 229 } | |
| 230 dt.minute = static_cast<uint8_t>(k); | |
| 231 if (i >= strLength || j < 2) | |
| 232 return *this; | |
| 233 | |
| 234 j = 0; | |
| 235 k = 0; | |
| 236 while (i < strLength && j < 2) { | |
| 237 ch = dtStr[i]; | |
| 238 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 239 j++; | |
| 240 if (!std::isdigit(ch)) | |
| 241 break; | |
| 242 i++; | |
| 243 } | |
| 244 dt.second = static_cast<uint8_t>(k); | |
| 245 if (i >= strLength || j < 2) | |
| 246 return *this; | |
| 247 | |
| 248 ch = dtStr[i++]; | |
| 249 if (ch != '-' && ch != '+') | |
| 250 return *this; | |
| 251 if (ch == '-') | |
| 252 dt.tzHour = -1; | |
| 253 else | |
| 254 dt.tzHour = 1; | |
| 255 j = 0; | |
| 256 k = 0; | |
| 257 while (i < strLength && j < 2) { | |
| 258 ch = dtStr[i]; | |
| 259 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 260 j++; | |
| 261 if (!std::isdigit(ch)) | |
| 262 break; | |
| 263 i++; | |
| 264 } | |
| 265 dt.tzHour *= static_cast<int8_t>(k); | |
| 266 if (i >= strLength || j < 2) | |
| 267 return *this; | |
| 268 | |
| 269 if (dtStr[i++] != '\'') | |
| 270 return *this; | |
| 271 j = 0; | |
| 272 k = 0; | |
| 273 while (i < strLength && j < 2) { | |
| 274 ch = dtStr[i]; | |
| 275 k = k * 10 + FXSYS_toDecimalDigit(ch); | |
| 276 j++; | |
| 277 if (!std::isdigit(ch)) | |
| 278 break; | |
| 279 i++; | |
| 280 } | |
| 281 dt.tzMinute = static_cast<uint8_t>(k); | |
| 282 return *this; | |
| 283 } | |
| 284 | |
| 285 CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { | |
| 286 CFX_ByteString str1; | |
| 287 str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", dt.year, dt.month, dt.day, | |
| 288 dt.hour, dt.minute, dt.second); | |
| 289 if (dt.tzHour < 0) | |
| 290 str1 += "-"; | |
| 291 else | |
| 292 str1 += "+"; | |
| 293 CFX_ByteString str2; | |
| 294 str2.Format("%02d:%02u", std::abs(static_cast<int>(dt.tzHour)), dt.tzMinute); | |
| 295 return str1 + str2; | |
| 296 } | |
| 297 | |
| 298 CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { | |
| 299 CFX_ByteString dtStr; | |
| 300 char tempStr[32]; | |
| 301 memset(tempStr, 0, sizeof(tempStr)); | |
| 302 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u", | |
| 303 dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); | |
| 304 dtStr = CFX_ByteString(tempStr); | |
| 305 if (dt.tzHour < 0) | |
| 306 dtStr += CFX_ByteString("-"); | |
| 307 else | |
| 308 dtStr += CFX_ByteString("+"); | |
| 309 memset(tempStr, 0, sizeof(tempStr)); | |
| 310 FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", | |
| 311 std::abs(static_cast<int>(dt.tzHour)), dt.tzMinute); | |
| 312 dtStr += CFX_ByteString(tempStr); | |
| 313 return dtStr; | |
| 314 } | |
| 315 | |
| 316 void CPDFSDK_DateTime::ToSystemTime(FX_SYSTEMTIME& st) { | |
| 317 time_t t = this->ToTime_t(); | |
| 318 struct tm* pTime = localtime(&t); | |
| 319 if (pTime) { | |
| 320 st.wYear = static_cast<uint16_t>(pTime->tm_year) + 1900; | |
| 321 st.wMonth = static_cast<uint16_t>(pTime->tm_mon) + 1; | |
| 322 st.wDay = static_cast<uint16_t>(pTime->tm_mday); | |
| 323 st.wDayOfWeek = static_cast<uint16_t>(pTime->tm_wday); | |
| 324 st.wHour = static_cast<uint16_t>(pTime->tm_hour); | |
| 325 st.wMinute = static_cast<uint16_t>(pTime->tm_min); | |
| 326 st.wSecond = static_cast<uint16_t>(pTime->tm_sec); | |
| 327 st.wMilliseconds = 0; | |
| 328 } | |
| 329 } | |
| 330 | |
| 331 CPDFSDK_DateTime CPDFSDK_DateTime::ToGMT() const { | |
| 332 CPDFSDK_DateTime new_dt = *this; | |
| 333 new_dt.AddSeconds( | |
| 334 -gAfxGetTimeZoneInSeconds(new_dt.dt.tzHour, new_dt.dt.tzMinute)); | |
| 335 new_dt.dt.tzHour = 0; | |
| 336 new_dt.dt.tzMinute = 0; | |
| 337 return new_dt; | |
| 338 } | |
| 339 | |
| 340 CPDFSDK_DateTime& CPDFSDK_DateTime::AddDays(short days) { | |
| 341 if (days == 0) | |
| 342 return *this; | |
| 343 | |
| 344 int16_t y = dt.year; | |
| 345 uint8_t m = dt.month; | |
| 346 uint8_t d = dt.day; | |
| 347 | |
| 348 int ldays = days; | |
| 349 if (ldays > 0) { | |
| 350 int16_t yy = y; | |
| 351 if ((static_cast<uint16_t>(m) * 100 + d) > 300) | |
| 352 yy++; | |
| 353 int ydays = gAfxGetYearDays(yy); | |
| 354 int mdays; | |
| 355 while (ldays >= ydays) { | |
| 356 y++; | |
| 357 ldays -= ydays; | |
| 358 yy++; | |
| 359 mdays = gAfxGetMonthDays(y, m); | |
| 360 if (d > mdays) { | |
| 361 m++; | |
| 362 d -= mdays; | |
| 363 } | |
| 364 ydays = gAfxGetYearDays(yy); | |
| 365 } | |
| 366 mdays = gAfxGetMonthDays(y, m) - d + 1; | |
| 367 while (ldays >= mdays) { | |
| 368 ldays -= mdays; | |
| 369 m++; | |
| 370 d = 1; | |
| 371 mdays = gAfxGetMonthDays(y, m); | |
| 372 } | |
| 373 d += ldays; | |
| 374 } else { | |
| 375 ldays *= -1; | |
| 376 int16_t yy = y; | |
| 377 if ((static_cast<uint16_t>(m) * 100 + d) < 300) | |
| 378 yy--; | |
| 379 int ydays = gAfxGetYearDays(yy); | |
| 380 while (ldays >= ydays) { | |
| 381 y--; | |
| 382 ldays -= ydays; | |
| 383 yy--; | |
| 384 int mdays = gAfxGetMonthDays(y, m); | |
| 385 if (d > mdays) { | |
| 386 m++; | |
| 387 d -= mdays; | |
| 388 } | |
| 389 ydays = gAfxGetYearDays(yy); | |
| 390 } | |
| 391 while (ldays >= d) { | |
| 392 ldays -= d; | |
| 393 m--; | |
| 394 d = gAfxGetMonthDays(y, m); | |
| 395 } | |
| 396 d -= ldays; | |
| 397 } | |
| 398 | |
| 399 dt.year = y; | |
| 400 dt.month = m; | |
| 401 dt.day = d; | |
| 402 | |
| 403 return *this; | |
| 404 } | |
| 405 | |
| 406 CPDFSDK_DateTime& CPDFSDK_DateTime::AddSeconds(int seconds) { | |
| 407 if (seconds == 0) | |
| 408 return *this; | |
| 409 | |
| 410 int n; | |
| 411 int days; | |
| 412 | |
| 413 n = dt.hour * 3600 + dt.minute * 60 + dt.second + seconds; | |
| 414 if (n < 0) { | |
| 415 days = (n - 86399) / 86400; | |
| 416 n -= days * 86400; | |
| 417 } else { | |
| 418 days = n / 86400; | |
| 419 n %= 86400; | |
| 420 } | |
| 421 dt.hour = static_cast<uint8_t>(n / 3600); | |
| 422 dt.hour %= 24; | |
| 423 n %= 3600; | |
| 424 dt.minute = static_cast<uint8_t>(n / 60); | |
| 425 dt.second = static_cast<uint8_t>(n % 60); | |
| 426 if (days != 0) | |
| 427 AddDays(days); | |
| 428 | |
| 429 return *this; | |
| 430 } | |
| 431 | |
| 432 CPDFSDK_Annot::CPDFSDK_Annot(CPDFSDK_PageView* pPageView) | |
| 433 : m_pPageView(pPageView), m_bSelected(FALSE), m_nTabOrder(-1) {} | |
| 434 | |
| 435 CPDFSDK_Annot::~CPDFSDK_Annot() {} | |
| 436 | |
| 437 #ifdef PDF_ENABLE_XFA | |
| 438 | |
| 439 FX_BOOL CPDFSDK_Annot::IsXFAField() { | |
| 440 return FALSE; | |
| 441 } | |
| 442 | |
| 443 CXFA_FFWidget* CPDFSDK_Annot::GetXFAWidget() const { | |
| 444 return nullptr; | |
| 445 } | |
| 446 | |
| 447 #endif // PDF_ENABLE_XFA | |
| 448 | |
| 449 FX_FLOAT CPDFSDK_Annot::GetMinWidth() const { | |
| 450 return kMinWidth; | |
| 451 } | |
| 452 | |
| 453 FX_FLOAT CPDFSDK_Annot::GetMinHeight() const { | |
| 454 return kMinHeight; | |
| 455 } | |
| 456 | |
| 457 int CPDFSDK_Annot::GetLayoutOrder() const { | |
| 458 return 5; | |
| 459 } | |
| 460 | |
| 461 CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const { | |
| 462 return nullptr; | |
| 463 } | |
| 464 | |
| 465 CFX_ByteString CPDFSDK_Annot::GetType() const { | |
| 466 return ""; | |
| 467 } | |
| 468 | |
| 469 CFX_ByteString CPDFSDK_Annot::GetSubType() const { | |
| 470 return ""; | |
| 471 } | |
| 472 | |
| 473 void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {} | |
| 474 | |
| 475 CFX_FloatRect CPDFSDK_Annot::GetRect() const { | |
| 476 return CFX_FloatRect(); | |
| 477 } | |
| 478 | |
| 479 void CPDFSDK_Annot::Annot_OnDraw(CFX_RenderDevice* pDevice, | |
| 480 CFX_Matrix* pUser2Device, | |
| 481 CPDF_RenderOptions* pOptions) {} | |
| 482 | |
| 483 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, | 16 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, |
| 484 CPDFSDK_PageView* pPageView) | 17 CPDFSDK_PageView* pPageView) |
| 485 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} | 18 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} |
| 486 | 19 |
| 487 CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {} | 20 CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {} |
| 488 | 21 |
| 489 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { | 22 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { |
| 490 return m_pAnnot; | 23 return m_pAnnot; |
| 491 } | 24 } |
| 492 | 25 |
| 493 FX_BOOL CPDFSDK_Annot::IsSelected() { | |
| 494 return m_bSelected; | |
| 495 } | |
| 496 | |
| 497 void CPDFSDK_Annot::SetSelected(FX_BOOL bSelected) { | |
| 498 m_bSelected = bSelected; | |
| 499 } | |
| 500 | |
| 501 int CPDFSDK_Annot::GetTabOrder() { | |
| 502 return m_nTabOrder; | |
| 503 } | |
| 504 | |
| 505 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) { | |
| 506 m_nTabOrder = iTabOrder; | |
| 507 } | |
| 508 | |
| 509 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { | 26 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { |
| 510 return m_pAnnot->GetAnnotDict(); | 27 return m_pAnnot->GetAnnotDict(); |
| 511 } | 28 } |
| 512 | 29 |
| 513 void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) { | 30 void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) { |
| 514 ASSERT(rect.right - rect.left >= GetMinWidth()); | 31 ASSERT(rect.right - rect.left >= GetMinWidth()); |
| 515 ASSERT(rect.top - rect.bottom >= GetMinHeight()); | 32 ASSERT(rect.top - rect.bottom >= GetMinHeight()); |
| 516 | 33 |
| 517 m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); | 34 m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); |
| 518 } | 35 } |
| 519 | 36 |
| 520 CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const { | 37 CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const { |
|
dsinclair
2016/08/11 14:01:04
Do we know what BA stands for? Might be worth a fo
jaepark
2016/08/11 18:09:50
I'm not sure what BA stands for. I know that CPDFS
| |
| 521 CFX_FloatRect rect; | 38 CFX_FloatRect rect; |
| 522 m_pAnnot->GetRect(rect); | 39 m_pAnnot->GetRect(rect); |
| 523 return rect; | 40 return rect; |
| 524 } | 41 } |
| 525 | 42 |
| 526 CFX_ByteString CPDFSDK_BAAnnot::GetType() const { | 43 CFX_ByteString CPDFSDK_BAAnnot::GetType() const { |
| 527 return m_pAnnot->GetSubType(); | 44 return m_pAnnot->GetSubType(); |
| 528 } | 45 } |
| 529 | 46 |
| 530 CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { | 47 CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 return CPDF_Action(); | 395 return CPDF_Action(); |
| 879 } | 396 } |
| 880 | 397 |
| 881 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, | 398 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 882 CFX_Matrix* pUser2Device, | 399 CFX_Matrix* pUser2Device, |
| 883 CPDF_RenderOptions* pOptions) { | 400 CPDF_RenderOptions* pOptions) { |
| 884 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); | 401 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
| 885 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 402 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 886 CPDF_Annot::Normal, nullptr); | 403 CPDF_Annot::Normal, nullptr); |
| 887 } | 404 } |
| 888 | |
| 889 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | |
| 890 #ifdef PDF_ENABLE_XFA | |
| 891 return GetPDFXFAPage(); | |
| 892 #else // PDF_ENABLE_XFA | |
| 893 return GetPDFPage(); | |
| 894 #endif // PDF_ENABLE_XFA | |
| 895 } | |
| 896 | |
| 897 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | |
| 898 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | |
| 899 } | |
| 900 | |
| 901 #ifdef PDF_ENABLE_XFA | |
| 902 | |
| 903 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | |
| 904 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | |
| 905 } | |
| 906 | |
| 907 #endif // PDF_ENABLE_XFA | |
| OLD | NEW |