00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef INC_MI32_HTMLMEASUREMENT_H
00018 #define INC_MI32_HTMLMEASUREMENT_H
00019
00020 #ifndef INC_MI32_CSSPROPERTIES_H
00021 #include <mi32/cssproperties.h>
00022 #endif
00023
00024 #ifndef INC_MI32_SCRNUNIT_H
00025 #include <mi32/scrnunit.h>
00026 #endif
00027
00028 #ifndef INC_MI32_XML_H
00029 #include <mi32/xml.h>
00030 #endif
00031
00032
00033 #ifndef GENERATING_DOXYGEN_OUTPUT
00034 namespace MGD {
00035 class CONTEXT;
00036 }
00037 #endif
00038
00039 namespace HTML {
00040 class ELEMENT;
00041
00043 class MEASUREMENT {
00044 public:
00045
00046 enum RELATIVETO {
00047 RELATIVETO_NotAllowed = 0,
00048 RELATIVETO_ParentBlockWidth,
00049 RELATIVETO_ParentBlockHeight,
00050 RELATIVETO_TextHeight,
00051 RELATIVETO_ParentTextHeight,
00052 RELATIVETO_LineHeight,
00053 RELATIVETO_SelfHeight,
00054 RELATIVETO_SelfWidth
00055 };
00056
00057 MEASUREMENT (
00058 CSS_PROPERTY property,
00059 RELATIVETO relative = RELATIVETO_NotAllowed
00060 );
00061
00062 MEASUREMENT(const MEASUREMENT&);
00063
00064 bool operator==(const MEASUREMENT& rhs) const;
00065 bool operator!=(const MEASUREMENT& rhs) const;
00066
00067 void Clear (
00068 ) {
00069 m_State = STATE_NotSet;
00070 m_value = 0.0;
00071 }
00072
00073 void Combine(const MEASUREMENT& rhs);
00074
00075 const char* Parse(const char*);
00076
00077 SCREENUNIT GetUnits (
00078 ) const { return m_units; }
00079
00080 double GetValue (
00081 ) const { return m_value; }
00082
00085 double GetValue (
00086 MGD::CONTEXT* gc,
00087 const ELEMENT* Element
00088 ) const;
00089
00093 MISTRING GetValueCSS (
00094 ) const;
00095
00096 bool IsAuto (
00097 ) const { return (m_State == STATE_Auto); }
00098
00099 bool IsPercent (
00100 ) const { return (m_State == STATE_Percent); }
00101
00102 bool IsSet (
00103 ) const { return (m_State != STATE_NotSet); }
00104
00105 void Set (
00106 double value,
00107 SCREENUNIT units
00108 ) {
00109 m_value = value;
00110 m_units = units;
00111 m_State = STATE_Set;
00112 }
00113
00114 void SetProperty (
00115 CSS_PROPERTY property
00116 ) { m_Property = property; }
00117
00118 void SetRelativeTo (
00119 RELATIVETO rel
00120 ) { m_RelativeTo = rel; }
00121
00122 #ifndef GENERATING_DOXYGEN_OUTPUT
00123 private:
00124 enum STATE {
00125 STATE_NotSet = 0,
00126 STATE_Set,
00127 STATE_Percent,
00128 STATE_Auto,
00129 STATE_Inherit
00130 };
00131 STATE m_State;
00132 SCREENUNIT m_units;
00133 RELATIVETO m_RelativeTo;
00134 CSS_PROPERTY m_Property;
00135 double m_value;
00136 #endif
00137 };
00138
00139 }
00140
00141 #endif