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 XFA_FDE_CSS_FDE_CSS_H_ | 7 #ifndef XFA_FDE_CSS_FDE_CSS_H_ |
8 #define XFA_FDE_CSS_FDE_CSS_H_ | 8 #define XFA_FDE_CSS_FDE_CSS_H_ |
9 | 9 |
10 #include "core/fxge/include/fx_dib.h" | 10 #include "core/fxge/include/fx_dib.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 }; | 683 }; |
684 | 684 |
685 class IFDE_CSSValue { | 685 class IFDE_CSSValue { |
686 public: | 686 public: |
687 virtual ~IFDE_CSSValue() {} | 687 virtual ~IFDE_CSSValue() {} |
688 virtual FDE_CSSVALUETYPE GetType() const = 0; | 688 virtual FDE_CSSVALUETYPE GetType() const = 0; |
689 }; | 689 }; |
690 | 690 |
691 class IFDE_CSSPrimitiveValue : public IFDE_CSSValue { | 691 class IFDE_CSSPrimitiveValue : public IFDE_CSSValue { |
692 public: | 692 public: |
693 virtual FDE_CSSVALUETYPE GetType() const { | 693 // IFDE_CSSValue |
694 return FDE_CSSVALUETYPE_Primitive; | 694 FDE_CSSVALUETYPE GetType() const override; |
695 } | 695 |
696 virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const = 0; | 696 virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const = 0; |
697 virtual FX_ARGB GetRGBColor() const = 0; | 697 virtual FX_ARGB GetRGBColor() const = 0; |
698 virtual FX_FLOAT GetFloat() const = 0; | 698 virtual FX_FLOAT GetFloat() const = 0; |
699 virtual const FX_WCHAR* GetString(int32_t& iLength) const = 0; | 699 virtual const FX_WCHAR* GetString(int32_t& iLength) const = 0; |
700 virtual FDE_CSSPROPERTYVALUE GetEnum() const = 0; | 700 virtual FDE_CSSPROPERTYVALUE GetEnum() const = 0; |
701 virtual const FX_WCHAR* GetFuncName() const = 0; | 701 virtual const FX_WCHAR* GetFuncName() const = 0; |
702 virtual int32_t CountArgs() const = 0; | 702 virtual int32_t CountArgs() const = 0; |
703 virtual IFDE_CSSValue* GetArgs(int32_t index) const = 0; | 703 virtual IFDE_CSSValue* GetArgs(int32_t index) const = 0; |
704 }; | 704 }; |
705 | 705 |
706 class IFDE_CSSValueList : public IFDE_CSSValue { | 706 class IFDE_CSSValueList : public IFDE_CSSValue { |
707 public: | 707 public: |
708 virtual FDE_CSSVALUETYPE GetType() const { return FDE_CSSVALUETYPE_List; } | 708 // IFDE_CSSValue |
| 709 FDE_CSSVALUETYPE GetType() const override; |
| 710 |
709 virtual int32_t CountValues() const = 0; | 711 virtual int32_t CountValues() const = 0; |
710 virtual IFDE_CSSValue* GetValue(int32_t index) const = 0; | 712 virtual IFDE_CSSValue* GetValue(int32_t index) const = 0; |
711 }; | 713 }; |
712 | 714 |
713 class IFDE_CSSRule { | 715 class IFDE_CSSRule { |
714 public: | 716 public: |
715 virtual ~IFDE_CSSRule() {} | 717 virtual ~IFDE_CSSRule() {} |
716 virtual FDE_CSSRULETYPE GetType() const = 0; | 718 virtual FDE_CSSRULETYPE GetType() const = 0; |
717 }; | 719 }; |
| 720 |
718 typedef CFX_MassArrayTemplate<IFDE_CSSRule*> CFDE_CSSRuleArray; | 721 typedef CFX_MassArrayTemplate<IFDE_CSSRule*> CFDE_CSSRuleArray; |
719 | 722 |
720 class IFDE_CSSStyleRule : public IFDE_CSSRule { | 723 class IFDE_CSSStyleRule : public IFDE_CSSRule { |
721 public: | 724 public: |
722 virtual FDE_CSSRULETYPE GetType() const { return FDE_CSSRULETYPE_Style; } | 725 // IFDE_CSSValue |
| 726 FDE_CSSRULETYPE GetType() const override; |
| 727 |
723 virtual int32_t CountSelectorLists() const = 0; | 728 virtual int32_t CountSelectorLists() const = 0; |
724 virtual CFDE_CSSSelector* GetSelectorList(int32_t index) const = 0; | 729 virtual CFDE_CSSSelector* GetSelectorList(int32_t index) const = 0; |
725 virtual CFDE_CSSDeclaration* GetDeclaration() = 0; | 730 virtual CFDE_CSSDeclaration* GetDeclaration() = 0; |
726 }; | 731 }; |
727 | 732 |
728 class IFDE_CSSMediaRule : public IFDE_CSSRule { | 733 class IFDE_CSSMediaRule : public IFDE_CSSRule { |
729 public: | 734 public: |
730 virtual FDE_CSSRULETYPE GetType() const { return FDE_CSSRULETYPE_Media; } | 735 // IFDE_CSSValue |
| 736 FDE_CSSRULETYPE GetType() const override; |
| 737 |
731 virtual uint32_t GetMediaList() const = 0; | 738 virtual uint32_t GetMediaList() const = 0; |
732 virtual int32_t CountRules() const = 0; | 739 virtual int32_t CountRules() const = 0; |
733 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; | 740 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; |
734 }; | 741 }; |
735 | 742 |
736 class IFDE_CSSFontFaceRule : public IFDE_CSSRule { | 743 class IFDE_CSSFontFaceRule : public IFDE_CSSRule { |
737 public: | 744 public: |
738 virtual FDE_CSSRULETYPE GetType() const { return FDE_CSSRULETYPE_FontFace; } | 745 // IFDE_CSSValue |
| 746 FDE_CSSRULETYPE GetType() const override; |
| 747 |
739 virtual CFDE_CSSDeclaration* GetDeclaration() = 0; | 748 virtual CFDE_CSSDeclaration* GetDeclaration() = 0; |
740 }; | 749 }; |
741 | 750 |
742 class IFDE_CSSStyleSheet : public IFX_Retainable { | 751 class IFDE_CSSStyleSheet : public IFX_Retainable { |
743 public: | 752 public: |
744 static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet(); | 753 static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet(); |
745 static IFDE_CSSStyleSheet* LoadFromStream( | 754 static IFDE_CSSStyleSheet* LoadFromStream( |
746 const CFX_WideString& szUrl, | 755 const CFX_WideString& szUrl, |
747 IFX_Stream* pStream, | 756 IFX_Stream* pStream, |
748 uint16_t wCodePage, | 757 uint16_t wCodePage, |
749 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); | 758 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); |
750 static IFDE_CSSStyleSheet* LoadFromBuffer( | 759 static IFDE_CSSStyleSheet* LoadFromBuffer( |
751 const CFX_WideString& szUrl, | 760 const CFX_WideString& szUrl, |
752 const FX_WCHAR* pBuffer, | 761 const FX_WCHAR* pBuffer, |
753 int32_t iBufSize, | 762 int32_t iBufSize, |
754 uint16_t wCodePage, | 763 uint16_t wCodePage, |
755 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); | 764 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); |
756 virtual FX_BOOL GetUrl(CFX_WideString& szUrl) = 0; | 765 virtual FX_BOOL GetUrl(CFX_WideString& szUrl) = 0; |
757 virtual uint32_t GetMediaList() const = 0; | 766 virtual uint32_t GetMediaList() const = 0; |
758 virtual uint16_t GetCodePage() const = 0; | 767 virtual uint16_t GetCodePage() const = 0; |
759 | 768 |
760 virtual int32_t CountRules() const = 0; | 769 virtual int32_t CountRules() const = 0; |
761 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; | 770 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; |
762 }; | 771 }; |
| 772 |
763 typedef CFX_ArrayTemplate<IFDE_CSSStyleSheet*> CFDE_CSSStyleSheetArray; | 773 typedef CFX_ArrayTemplate<IFDE_CSSStyleSheet*> CFDE_CSSStyleSheetArray; |
764 | 774 |
765 struct FDE_CSSLENGTH { | 775 struct FDE_CSSLENGTH { |
766 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit) { | 776 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit) { |
767 m_iData = eUnit; | 777 m_iData = eUnit; |
768 return *this; | 778 return *this; |
769 } | 779 } |
770 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { | 780 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { |
771 m_iData = ((intptr_t)(fValue * 1024.0f) << FDE_CSSUNITBITS) | eUnit; | 781 m_iData = ((intptr_t)(fValue * 1024.0f) << FDE_CSSUNITBITS) | eUnit; |
772 return *this; | 782 return *this; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 virtual void Reset() = 0; | 897 virtual void Reset() = 0; |
888 virtual IFDE_CSSFontStyle* GetFontStyles() = 0; | 898 virtual IFDE_CSSFontStyle* GetFontStyles() = 0; |
889 virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; | 899 virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; |
890 virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; | 900 virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; |
891 virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; | 901 virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; |
892 virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, | 902 virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, |
893 CFX_WideString& wsValue) const = 0; | 903 CFX_WideString& wsValue) const = 0; |
894 }; | 904 }; |
895 | 905 |
896 #endif // XFA_FDE_CSS_FDE_CSS_H_ | 906 #endif // XFA_FDE_CSS_FDE_CSS_H_ |
OLD | NEW |