OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ |
9 | 9 |
10 #include "core/include/fxge/fx_ge.h" | 10 #include "core/include/fxge/fx_ge.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 class CPDF_ContentMark : public CFX_CountRef<CPDF_ContentMarkData> { | 321 class CPDF_ContentMark : public CFX_CountRef<CPDF_ContentMarkData> { |
322 public: | 322 public: |
323 int GetMCID() const { return m_pObject ? m_pObject->GetMCID() : -1; } | 323 int GetMCID() const { return m_pObject ? m_pObject->GetMCID() : -1; } |
324 | 324 |
325 FX_BOOL HasMark(const CFX_ByteStringC& mark) const; | 325 FX_BOOL HasMark(const CFX_ByteStringC& mark) const; |
326 | 326 |
327 FX_BOOL LookupMark(const CFX_ByteStringC& mark, | 327 FX_BOOL LookupMark(const CFX_ByteStringC& mark, |
328 CPDF_Dictionary*& pDict) const; | 328 CPDF_Dictionary*& pDict) const; |
329 }; | 329 }; |
330 | 330 |
331 #define PDFPAGE_TEXT 1 | |
332 #define PDFPAGE_PATH 2 | |
333 #define PDFPAGE_IMAGE 3 | |
334 #define PDFPAGE_SHADING 4 | |
335 #define PDFPAGE_FORM 5 | |
336 | |
337 class CPDF_GraphicStates { | 331 class CPDF_GraphicStates { |
338 public: | 332 public: |
339 void CopyStates(const CPDF_GraphicStates& src); | 333 void CopyStates(const CPDF_GraphicStates& src); |
340 | 334 |
341 void DefaultStates(); | 335 void DefaultStates(); |
342 | 336 |
343 CPDF_ClipPath m_ClipPath; | 337 CPDF_ClipPath m_ClipPath; |
344 | 338 |
345 CPDF_GraphState m_GraphState; | 339 CPDF_GraphState m_GraphState; |
346 | 340 |
347 CPDF_ColorState m_ColorState; | 341 CPDF_ColorState m_ColorState; |
348 | 342 |
349 CPDF_TextState m_TextState; | 343 CPDF_TextState m_TextState; |
350 | 344 |
351 CPDF_GeneralState m_GeneralState; | 345 CPDF_GeneralState m_GeneralState; |
352 }; | 346 }; |
353 | 347 |
354 class CPDF_PageObject : public CPDF_GraphicStates { | 348 class CPDF_PageObject : public CPDF_GraphicStates { |
355 public: | 349 public: |
| 350 enum Type { |
| 351 TEXT = 1, |
| 352 PATH, |
| 353 IMAGE, |
| 354 SHADING, |
| 355 FORM, |
| 356 }; |
| 357 |
356 static CPDF_PageObject* Create(int type); | 358 static CPDF_PageObject* Create(int type); |
357 virtual ~CPDF_PageObject(); | 359 virtual ~CPDF_PageObject(); |
358 | 360 |
359 CPDF_PageObject* Clone() const; | 361 CPDF_PageObject* Clone() const; |
360 | |
361 void Copy(const CPDF_PageObject* pSrcObject); | 362 void Copy(const CPDF_PageObject* pSrcObject); |
362 | 363 |
363 virtual void Transform(const CFX_Matrix& matrix) = 0; | 364 virtual void Transform(const CFX_Matrix& matrix) = 0; |
364 | 365 |
365 void RemoveClipPath(); | 366 void RemoveClipPath(); |
366 | |
367 void AppendClipPath(CPDF_Path path, int type, FX_BOOL bAutoMerge); | 367 void AppendClipPath(CPDF_Path path, int type, FX_BOOL bAutoMerge); |
368 | |
369 void CopyClipPath(CPDF_PageObject* pObj); | 368 void CopyClipPath(CPDF_PageObject* pObj); |
370 | |
371 void TransformClipPath(CFX_Matrix& matrix); | 369 void TransformClipPath(CFX_Matrix& matrix); |
372 | |
373 void TransformGeneralState(CFX_Matrix& matrix); | 370 void TransformGeneralState(CFX_Matrix& matrix); |
374 | |
375 void SetColorState(CPDF_ColorState state) { m_ColorState = state; } | 371 void SetColorState(CPDF_ColorState state) { m_ColorState = state; } |
376 | |
377 FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; | 372 FX_RECT GetBBox(const CFX_Matrix* pMatrix) const; |
378 | 373 |
379 int m_Type; | 374 const Type m_Type; |
380 | |
381 FX_FLOAT m_Left; | 375 FX_FLOAT m_Left; |
382 | |
383 FX_FLOAT m_Right; | 376 FX_FLOAT m_Right; |
384 | |
385 FX_FLOAT m_Top; | 377 FX_FLOAT m_Top; |
386 | |
387 FX_FLOAT m_Bottom; | 378 FX_FLOAT m_Bottom; |
388 | |
389 CPDF_ContentMark m_ContentMark; | 379 CPDF_ContentMark m_ContentMark; |
390 | 380 |
391 protected: | 381 protected: |
392 virtual void CopyData(const CPDF_PageObject* pSrcObject) = 0; | 382 virtual void CopyData(const CPDF_PageObject* pSrcObject) = 0; |
393 | 383 |
394 void RecalcBBox(); | 384 void RecalcBBox(); |
395 | 385 CPDF_PageObject(Type type) : m_Type(type) {} |
396 CPDF_PageObject() {} | |
397 }; | 386 }; |
398 | 387 |
399 struct CPDF_TextObjectItem { | 388 struct CPDF_TextObjectItem { |
400 FX_DWORD m_CharCode; | 389 FX_DWORD m_CharCode; |
401 FX_FLOAT m_OriginX; | 390 FX_FLOAT m_OriginX; |
402 FX_FLOAT m_OriginY; | 391 FX_FLOAT m_OriginY; |
403 }; | 392 }; |
404 | 393 |
405 class CPDF_TextObject : public CPDF_PageObject { | 394 class CPDF_TextObject : public CPDF_PageObject { |
406 public: | 395 public: |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 472 |
484 int m_nChars; | 473 int m_nChars; |
485 | 474 |
486 FX_DWORD* m_pCharCodes; | 475 FX_DWORD* m_pCharCodes; |
487 | 476 |
488 FX_FLOAT* m_pCharPos; | 477 FX_FLOAT* m_pCharPos; |
489 }; | 478 }; |
490 | 479 |
491 class CPDF_PathObject : public CPDF_PageObject { | 480 class CPDF_PathObject : public CPDF_PageObject { |
492 public: | 481 public: |
493 CPDF_PathObject() { m_Type = PDFPAGE_PATH; } | 482 CPDF_PathObject() : CPDF_PageObject(PATH) {} |
494 ~CPDF_PathObject() override {} | 483 ~CPDF_PathObject() override {} |
495 | 484 |
496 void Transform(const CFX_Matrix& maxtrix) override; | 485 void Transform(const CFX_Matrix& maxtrix) override; |
497 | 486 |
498 void SetGraphState(CPDF_GraphState GraphState); | 487 void SetGraphState(CPDF_GraphState GraphState); |
499 | 488 |
500 void CalcBoundingBox(); | 489 void CalcBoundingBox(); |
501 | 490 |
502 CPDF_Path m_Path; | 491 CPDF_Path m_Path; |
503 | 492 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 void Transform(const CFX_Matrix& matrix) override; | 529 void Transform(const CFX_Matrix& matrix) override; |
541 | 530 |
542 void CalcBoundingBox(); | 531 void CalcBoundingBox(); |
543 | 532 |
544 protected: | 533 protected: |
545 void CopyData(const CPDF_PageObject* pSrcObject) override; | 534 void CopyData(const CPDF_PageObject* pSrcObject) override; |
546 }; | 535 }; |
547 | 536 |
548 class CPDF_FormObject : public CPDF_PageObject { | 537 class CPDF_FormObject : public CPDF_PageObject { |
549 public: | 538 public: |
550 CPDF_FormObject() { | 539 CPDF_FormObject() : CPDF_PageObject(FORM), m_pForm(nullptr) {} |
551 m_Type = PDFPAGE_FORM; | |
552 m_pForm = NULL; | |
553 } | |
554 ~CPDF_FormObject() override; | 540 ~CPDF_FormObject() override; |
555 | 541 |
556 void Transform(const CFX_Matrix& matrix) override; | 542 void Transform(const CFX_Matrix& matrix) override; |
| 543 void CalcBoundingBox(); |
557 | 544 |
558 CPDF_Form* m_pForm; | 545 CPDF_Form* m_pForm; |
559 | |
560 CFX_Matrix m_FormMatrix; | 546 CFX_Matrix m_FormMatrix; |
561 | 547 |
562 void CalcBoundingBox(); | |
563 | |
564 protected: | 548 protected: |
565 void CopyData(const CPDF_PageObject* pSrcObject) override; | 549 void CopyData(const CPDF_PageObject* pSrcObject) override; |
566 }; | 550 }; |
567 | 551 |
568 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ | 552 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGEOBJ_H_ |
OLD | NEW |