00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 #ifndef INC_MI32_HTMLDOC_H
00114 #define INC_MI32_HTMLDOC_H
00115
00116 #ifndef INC_MI32_MISTRINGLIST_H
00117 #include <mi32/mistringlist.h>
00118 #endif
00119
00120 #ifndef INC_MI32_DELEGATE_H
00121 #include <mi32/delegate.h>
00122 #endif
00123
00124 #ifndef INC_MI32_XML_H
00125 #include <mi32/xml.h>
00126 #endif
00127
00128 struct TEXTSTYLE;
00129 struct DPOINT2D;
00130 struct DRECT2D;
00131 class REGION2D;
00132 class TRANS2D_AFFINE;
00133 namespace MGD {
00134 class DEVICE;
00135 class CONTEXT;
00136 }
00137
00138 namespace HTML {
00139 class ELEMENT;
00140
00141 #ifndef GENERATING_DOXYGEN_OUTPUT
00142 class STYLESHEET;
00143 struct INLINE_POS;
00144 #endif
00145
00146
00147 class HTMLDOC : public XMLDOC {
00148 public:
00149 typedef fastdelegate::FastDelegate<void(const DRECT2D& clip)> DELEGATE_REDRAW;
00150
00151 HTMLDOC();
00152 virtual ~HTMLDOC();
00153
00159 void AddInlineImage (
00160 const MISTRING& key,
00161 MGD::DEVICE* Device,
00162 bool bTakeOwnership
00163 );
00164
00167 void DoLayout (
00168 MGD::CONTEXT* context,
00169 double MaxWidth
00170 );
00171
00173 void Draw (
00174 MGD::CONTEXT* context,
00175 const DPOINT2D* offset = 0,
00176 const DRECT2D* cliprect = 0,
00177 bool bDrawAll = true
00178 );
00179
00181 const ELEMENT* FindElement (
00182 const DPOINT2D& pt
00183 ) const;
00184
00186 ELEMENT* FindElement (
00187 const DPOINT2D& pt
00188 );
00189
00190
00191 void GetDirtyRegion (
00192 REGION2D& region
00193 );
00194
00200 double GetHeight (
00201 ) const { return (m_Height); }
00202
00206 bool GetLink (
00207 const DPOINT2D& pt,
00208 MISTRING& href
00209 ) const;
00210
00211
00216 void GetTitleOrFirstLine (
00217 MISTRING& string,
00218 int maxlen = 80
00219 ) const;
00220
00225 bool GetTooltip (
00226 const DPOINT2D& pt,
00227 MISTRING& tooltip
00228 ) const;
00229
00235 double GetWidth (
00236 ) const { return (m_Width); }
00237
00238 double GetZoom (
00239 ) const { return m_Zoom; }
00240
00243 bool GetAccurateZoom (
00244 ) const;
00245
00248 bool GetFullRedraw (
00249 ) const;
00250
00253 ERRVALUE Parse (
00254 const UINT8* buffer
00255 );
00256
00258 ERRVALUE Read (
00259 const FILEPATH& filepath
00260 );
00261
00263 void SetDefaultTextStyle (
00264 const TEXTSTYLE& Style
00265 );
00266
00274 void SetTransAffine (
00275 const TRANS2D_AFFINE& trans
00276 );
00277
00283 void SetSourceFile (
00284 const FILEPATH& url
00285 );
00286
00290 void SetSourceURL (
00291 const MISTRING& url
00292 );
00297 void SetZoom (
00298 double zoom
00299 );
00300
00305 void SetAccurateZoom (
00306 bool val = true
00307 );
00308
00312 void SetDelegateRedraw (
00313 DELEGATE_REDRAW delegate
00314 ) { m_DelegateRedraw = delegate; }
00315
00316 #ifndef GENERATING_DOXYGEN_OUTPUT
00317 private:
00318 friend class ELEMENT;
00319 friend class BORDER;
00320 friend class STYLESHEET;
00321
00322 class PRIV;
00323 PRIV* m_Priv;
00324
00325 double m_Height;
00326 double m_Width;
00327 double m_Zoom;
00328 DELEGATE_REDRAW m_DelegateRedraw;
00329
00330 ERRVALUE BuildTree(XMLNODE*);
00331 ERRVALUE BuildTreeStyleNode(XMLNODE*);
00332
00333 bool GetFirstLine (MISTRING& mistr, XMLNODE*node, int maxlen = 80) const;
00334
00335 #endif
00336 };
00337
00338
00341 bool TextIsHTML (
00342 const MIUNICODE* string
00343 );
00344
00347 bool TextIsHTMLFragment (
00348 const MIUNICODE* string
00349 );
00350
00362 void CombineHTMLFragments (
00363 MISTRING& Result,
00364 const MISTRINGLIST& fragments,
00365 MISTRING* pHead = 0
00366 );
00367
00368 }
00369
00370
00371 #endif
00372