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/fx_dib.h" | 10 #include "core/fxge/fx_dib.h" |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 const CFX_WideString& szUrl, | 753 const CFX_WideString& szUrl, |
754 IFX_Stream* pStream, | 754 IFX_Stream* pStream, |
755 uint16_t wCodePage, | 755 uint16_t wCodePage, |
756 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); | 756 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); |
757 static IFDE_CSSStyleSheet* LoadFromBuffer( | 757 static IFDE_CSSStyleSheet* LoadFromBuffer( |
758 const CFX_WideString& szUrl, | 758 const CFX_WideString& szUrl, |
759 const FX_WCHAR* pBuffer, | 759 const FX_WCHAR* pBuffer, |
760 int32_t iBufSize, | 760 int32_t iBufSize, |
761 uint16_t wCodePage, | 761 uint16_t wCodePage, |
762 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); | 762 uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); |
763 virtual FX_BOOL GetUrl(CFX_WideString& szUrl) = 0; | 763 virtual bool GetUrl(CFX_WideString& szUrl) = 0; |
764 virtual uint32_t GetMediaList() const = 0; | 764 virtual uint32_t GetMediaList() const = 0; |
765 virtual uint16_t GetCodePage() const = 0; | 765 virtual uint16_t GetCodePage() const = 0; |
766 | 766 |
767 virtual int32_t CountRules() const = 0; | 767 virtual int32_t CountRules() const = 0; |
768 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; | 768 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; |
769 }; | 769 }; |
770 | 770 |
771 typedef CFX_ArrayTemplate<IFDE_CSSStyleSheet*> CFDE_CSSStyleSheetArray; | 771 typedef CFX_ArrayTemplate<IFDE_CSSStyleSheet*> CFDE_CSSStyleSheetArray; |
772 | 772 |
773 struct FDE_CSSLENGTH { | 773 struct FDE_CSSLENGTH { |
774 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit) { | 774 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit) { |
775 m_iData = eUnit; | 775 m_iData = eUnit; |
776 return *this; | 776 return *this; |
777 } | 777 } |
778 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { | 778 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { |
779 m_iData = ((intptr_t)(fValue * 1024.0f) << FDE_CSSUNITBITS) | eUnit; | 779 m_iData = ((intptr_t)(fValue * 1024.0f) << FDE_CSSUNITBITS) | eUnit; |
780 return *this; | 780 return *this; |
781 } | 781 } |
782 FDE_CSSLENGTHUNIT GetUnit() const { | 782 FDE_CSSLENGTHUNIT GetUnit() const { |
783 return (FDE_CSSLENGTHUNIT)(m_iData & FDE_CSSUNITMASK); | 783 return (FDE_CSSLENGTHUNIT)(m_iData & FDE_CSSUNITMASK); |
784 } | 784 } |
785 FX_FLOAT GetValue() const { return (m_iData >> FDE_CSSUNITBITS) / 1024.0f; } | 785 FX_FLOAT GetValue() const { return (m_iData >> FDE_CSSUNITBITS) / 1024.0f; } |
786 FX_BOOL NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } | 786 bool NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } |
787 | 787 |
788 private: | 788 private: |
789 intptr_t m_iData; | 789 intptr_t m_iData; |
790 }; | 790 }; |
791 | 791 |
792 struct FDE_CSSPOINT { | 792 struct FDE_CSSPOINT { |
793 FDE_CSSPOINT& Set(FDE_CSSLENGTHUNIT eUnit) { | 793 FDE_CSSPOINT& Set(FDE_CSSLENGTHUNIT eUnit) { |
794 x.Set(eUnit); | 794 x.Set(eUnit); |
795 y.Set(eUnit); | 795 y.Set(eUnit); |
796 return *this; | 796 return *this; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; | 890 virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; |
891 }; | 891 }; |
892 | 892 |
893 class IFDE_CSSComputedStyle : public IFX_Retainable { | 893 class IFDE_CSSComputedStyle : public IFX_Retainable { |
894 public: | 894 public: |
895 virtual void Reset() = 0; | 895 virtual void Reset() = 0; |
896 virtual IFDE_CSSFontStyle* GetFontStyles() = 0; | 896 virtual IFDE_CSSFontStyle* GetFontStyles() = 0; |
897 virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; | 897 virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; |
898 virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; | 898 virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; |
899 virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; | 899 virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; |
900 virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, | 900 virtual bool GetCustomStyle(const CFX_WideStringC& wsName, |
901 CFX_WideString& wsValue) const = 0; | 901 CFX_WideString& wsValue) const = 0; |
902 }; | 902 }; |
903 | 903 |
904 #endif // XFA_FDE_CSS_FDE_CSS_H_ | 904 #endif // XFA_FDE_CSS_FDE_CSS_H_ |
OLD | NEW |