1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef _FDE_CSS 8 #define _FDE_CSS 9 class IFDE_HTMNotify; 10 class IFDE_CSSValue; 11 class IFDE_CSSPrimitiveValue; 12 class IFDE_CSSValueList; 13 class IFDE_CSSDeclaration; 14 class IFDE_CSSSelector; 15 class IFDE_CSSRule; 16 class IFDE_CSSStyleRule; 17 class IFDE_CSSMediaRule; 18 class IFDE_CSSFontFaceRule; 19 class IFDE_CSSStyleSheet; 20 class IFDE_CSSStyleSheetCache; 21 class IFDE_CSSSyntaxParser; 22 class IFDE_CSSRubyStyle; 23 class IFDE_CSSMultiColumnStyle; 24 class IFDE_CSSGeneratedContentStyle; 25 class IFDE_CSSFontStyle; 26 class IFDE_CSSBoundaryStyle; 27 class IFDE_CSSPositionStyle; 28 class IFDE_CSSParagraphStyle; 29 class IFDE_CSSBackgroundStyle; 30 class IFDE_CSSListStyle; 31 class IFDE_CSSTableStyle; 32 class IFDE_CSSVisualStyle; 33 class IFDE_CSSComputedStyle; 34 class IFDE_CSSTagProvider; 35 class IFDE_CSSAccelerator; 36 class IFDE_CSSStyleSelector; 37 class IFDE_CSSCounterContext; 38 class IFDE_CSSCounterManager; 39 class IFDE_CSSQuoteContext; 40 class IFDE_CSSContentContext; 41 class IFDE_CSSMultiColumnContext; 42 class IFDE_CSSFloatContext; 43 enum FDE_CSSVALUETYPE { 44 FDE_CSSVALUETYPE_Primitive = 1, 45 FDE_CSSVALUETYPE_List = 2, 46 FDE_CSSVALUETYPE_Shorthand, 47 }; 48 enum FDE_CSSPRIMITIVETYPE { 49 FDE_CSSPRIMITIVETYPE_Unknown = 0, 50 FDE_CSSPRIMITIVETYPE_Number = 1, 51 FDE_CSSPRIMITIVETYPE_Percent = 2, 52 FDE_CSSPRIMITIVETYPE_EMS = 3, 53 FDE_CSSPRIMITIVETYPE_EXS = 4, 54 FDE_CSSPRIMITIVETYPE_PX = 5, 55 FDE_CSSPRIMITIVETYPE_CM = 6, 56 FDE_CSSPRIMITIVETYPE_MM = 7, 57 FDE_CSSPRIMITIVETYPE_IN = 8, 58 FDE_CSSPRIMITIVETYPE_PT = 9, 59 FDE_CSSPRIMITIVETYPE_PC = 10, 60 FDE_CSSPRIMITIVETYPE_String = 19, 61 FDE_CSSPRIMITIVETYPE_URI = 20, 62 FDE_CSSPRIMITIVETYPE_RGB = 25, 63 FDE_CSSPRIMITIVETYPE_Enum, 64 FDE_CSSPRIMITIVETYPE_Function, 65 }; 66 enum FDE_CSSPROPERTYVALUE { 67 FDE_CSSPROPERTYVALUE_Bolder, 68 FDE_CSSPROPERTYVALUE_LowerLatin, 69 FDE_CSSPROPERTYVALUE_Lowercase, 70 FDE_CSSPROPERTYVALUE_LowerGreek, 71 FDE_CSSPROPERTYVALUE_Sesame, 72 FDE_CSSPROPERTYVALUE_None, 73 FDE_CSSPROPERTYVALUE_NwResize, 74 FDE_CSSPROPERTYVALUE_WResize, 75 FDE_CSSPROPERTYVALUE_Dot, 76 FDE_CSSPROPERTYVALUE_End, 77 FDE_CSSPROPERTYVALUE_Ltr, 78 FDE_CSSPROPERTYVALUE_Pre, 79 FDE_CSSPROPERTYVALUE_Rtl, 80 FDE_CSSPROPERTYVALUE_Sub, 81 FDE_CSSPROPERTYVALUE_Top, 82 FDE_CSSPROPERTYVALUE_Visible, 83 FDE_CSSPROPERTYVALUE_Filled, 84 FDE_CSSPROPERTYVALUE_SwResize, 85 FDE_CSSPROPERTYVALUE_NoRepeat, 86 FDE_CSSPROPERTYVALUE_Default, 87 FDE_CSSPROPERTYVALUE_Transparent, 88 FDE_CSSPROPERTYVALUE_Ridge, 89 FDE_CSSPROPERTYVALUE_Right, 90 FDE_CSSPROPERTYVALUE_HorizontalTb, 91 FDE_CSSPROPERTYVALUE_DistributeLetter, 92 FDE_CSSPROPERTYVALUE_DoubleCircle, 93 FDE_CSSPROPERTYVALUE_Ruby, 94 FDE_CSSPROPERTYVALUE_Collapse, 95 FDE_CSSPROPERTYVALUE_Normal, 96 FDE_CSSPROPERTYVALUE_Avoid, 97 FDE_CSSPROPERTYVALUE_UpperRoman, 98 FDE_CSSPROPERTYVALUE_Auto, 99 FDE_CSSPROPERTYVALUE_Text, 100 FDE_CSSPROPERTYVALUE_XSmall, 101 FDE_CSSPROPERTYVALUE_Thin, 102 FDE_CSSPROPERTYVALUE_Repeat, 103 FDE_CSSPROPERTYVALUE_Small, 104 FDE_CSSPROPERTYVALUE_NeResize, 105 FDE_CSSPROPERTYVALUE_NoContent, 106 FDE_CSSPROPERTYVALUE_Outside, 107 FDE_CSSPROPERTYVALUE_EResize, 108 FDE_CSSPROPERTYVALUE_TableRow, 109 FDE_CSSPROPERTYVALUE_Bottom, 110 FDE_CSSPROPERTYVALUE_Underline, 111 FDE_CSSPROPERTYVALUE_CjkIdeographic, 112 FDE_CSSPROPERTYVALUE_SeResize, 113 FDE_CSSPROPERTYVALUE_Fixed, 114 FDE_CSSPROPERTYVALUE_Double, 115 FDE_CSSPROPERTYVALUE_Solid, 116 FDE_CSSPROPERTYVALUE_RubyBaseGroup, 117 FDE_CSSPROPERTYVALUE_OpenQuote, 118 FDE_CSSPROPERTYVALUE_Lighter, 119 FDE_CSSPROPERTYVALUE_LowerRoman, 120 FDE_CSSPROPERTYVALUE_Strict, 121 FDE_CSSPROPERTYVALUE_TableCaption, 122 FDE_CSSPROPERTYVALUE_Oblique, 123 FDE_CSSPROPERTYVALUE_Decimal, 124 FDE_CSSPROPERTYVALUE_Loose, 125 FDE_CSSPROPERTYVALUE_Hebrew, 126 FDE_CSSPROPERTYVALUE_Hidden, 127 FDE_CSSPROPERTYVALUE_Dashed, 128 FDE_CSSPROPERTYVALUE_Embed, 129 FDE_CSSPROPERTYVALUE_TableRowGroup, 130 FDE_CSSPROPERTYVALUE_TableColumn, 131 FDE_CSSPROPERTYVALUE_Static, 132 FDE_CSSPROPERTYVALUE_Outset, 133 FDE_CSSPROPERTYVALUE_DecimalLeadingZero, 134 FDE_CSSPROPERTYVALUE_KeepWords, 135 FDE_CSSPROPERTYVALUE_KatakanaIroha, 136 FDE_CSSPROPERTYVALUE_Super, 137 FDE_CSSPROPERTYVALUE_Center, 138 FDE_CSSPROPERTYVALUE_TableHeaderGroup, 139 FDE_CSSPROPERTYVALUE_Inside, 140 FDE_CSSPROPERTYVALUE_XxLarge, 141 FDE_CSSPROPERTYVALUE_Triangle, 142 FDE_CSSPROPERTYVALUE_RubyTextGroup, 143 FDE_CSSPROPERTYVALUE_Circle, 144 FDE_CSSPROPERTYVALUE_Hiragana, 145 FDE_CSSPROPERTYVALUE_RepeatX, 146 FDE_CSSPROPERTYVALUE_RepeatY, 147 FDE_CSSPROPERTYVALUE_Move, 148 FDE_CSSPROPERTYVALUE_HiraganaIroha, 149 FDE_CSSPROPERTYVALUE_RubyBase, 150 FDE_CSSPROPERTYVALUE_Scroll, 151 FDE_CSSPROPERTYVALUE_Smaller, 152 FDE_CSSPROPERTYVALUE_TableFooterGroup, 153 FDE_CSSPROPERTYVALUE_Baseline, 154 FDE_CSSPROPERTYVALUE_Separate, 155 FDE_CSSPROPERTYVALUE_Armenian, 156 FDE_CSSPROPERTYVALUE_Open, 157 FDE_CSSPROPERTYVALUE_Relative, 158 FDE_CSSPROPERTYVALUE_Thick, 159 FDE_CSSPROPERTYVALUE_Justify, 160 FDE_CSSPROPERTYVALUE_Middle, 161 FDE_CSSPROPERTYVALUE_Always, 162 FDE_CSSPROPERTYVALUE_DistributeSpace, 163 FDE_CSSPROPERTYVALUE_LineEdge, 164 FDE_CSSPROPERTYVALUE_PreWrap, 165 FDE_CSSPROPERTYVALUE_Medium, 166 FDE_CSSPROPERTYVALUE_NResize, 167 FDE_CSSPROPERTYVALUE_ListItem, 168 FDE_CSSPROPERTYVALUE_Show, 169 FDE_CSSPROPERTYVALUE_Currentcolor, 170 FDE_CSSPROPERTYVALUE_NoCloseQuote, 171 FDE_CSSPROPERTYVALUE_VerticalLr, 172 FDE_CSSPROPERTYVALUE_VerticalRl, 173 FDE_CSSPROPERTYVALUE_Pointer, 174 FDE_CSSPROPERTYVALUE_XxSmall, 175 FDE_CSSPROPERTYVALUE_Bold, 176 FDE_CSSPROPERTYVALUE_Both, 177 FDE_CSSPROPERTYVALUE_SmallCaps, 178 FDE_CSSPROPERTYVALUE_Katakana, 179 FDE_CSSPROPERTYVALUE_After, 180 FDE_CSSPROPERTYVALUE_Horizontal, 181 FDE_CSSPROPERTYVALUE_Dotted, 182 FDE_CSSPROPERTYVALUE_Disc, 183 FDE_CSSPROPERTYVALUE_Georgian, 184 FDE_CSSPROPERTYVALUE_Inline, 185 FDE_CSSPROPERTYVALUE_Overline, 186 FDE_CSSPROPERTYVALUE_Wait, 187 FDE_CSSPROPERTYVALUE_BreakAll, 188 FDE_CSSPROPERTYVALUE_UpperAlpha, 189 FDE_CSSPROPERTYVALUE_Capitalize, 190 FDE_CSSPROPERTYVALUE_Nowrap, 191 FDE_CSSPROPERTYVALUE_TextBottom, 192 FDE_CSSPROPERTYVALUE_NoOpenQuote, 193 FDE_CSSPROPERTYVALUE_Groove, 194 FDE_CSSPROPERTYVALUE_Progress, 195 FDE_CSSPROPERTYVALUE_Larger, 196 FDE_CSSPROPERTYVALUE_CloseQuote, 197 FDE_CSSPROPERTYVALUE_TableCell, 198 FDE_CSSPROPERTYVALUE_PreLine, 199 FDE_CSSPROPERTYVALUE_Absolute, 200 FDE_CSSPROPERTYVALUE_InlineTable, 201 FDE_CSSPROPERTYVALUE_BidiOverride, 202 FDE_CSSPROPERTYVALUE_InlineBlock, 203 FDE_CSSPROPERTYVALUE_Inset, 204 FDE_CSSPROPERTYVALUE_Crosshair, 205 FDE_CSSPROPERTYVALUE_UpperLatin, 206 FDE_CSSPROPERTYVALUE_Help, 207 FDE_CSSPROPERTYVALUE_Hide, 208 FDE_CSSPROPERTYVALUE_Uppercase, 209 FDE_CSSPROPERTYVALUE_SResize, 210 FDE_CSSPROPERTYVALUE_Table, 211 FDE_CSSPROPERTYVALUE_Blink, 212 FDE_CSSPROPERTYVALUE_Block, 213 FDE_CSSPROPERTYVALUE_Start, 214 FDE_CSSPROPERTYVALUE_TableColumnGroup, 215 FDE_CSSPROPERTYVALUE_Italic, 216 FDE_CSSPROPERTYVALUE_LineThrough, 217 FDE_CSSPROPERTYVALUE_KeepAll, 218 FDE_CSSPROPERTYVALUE_LowerAlpha, 219 FDE_CSSPROPERTYVALUE_RunIn, 220 FDE_CSSPROPERTYVALUE_Square, 221 FDE_CSSPROPERTYVALUE_XLarge, 222 FDE_CSSPROPERTYVALUE_Large, 223 FDE_CSSPROPERTYVALUE_Before, 224 FDE_CSSPROPERTYVALUE_Left, 225 FDE_CSSPROPERTYVALUE_TextTop, 226 FDE_CSSPROPERTYVALUE_RubyText, 227 FDE_CSSPROPERTYVALUE_NoDisplay, 228 FDE_CSSPROPERTYVALUE_MAX 229 }; 230 class IFDE_CSSValue { 231 public: 232 virtual ~IFDE_CSSValue() {} 233 virtual FDE_CSSVALUETYPE GetType() const = 0; 234 }; 235 class IFDE_CSSPrimitiveValue : public IFDE_CSSValue { 236 public: 237 virtual FDE_CSSVALUETYPE GetType() const { 238 return FDE_CSSVALUETYPE_Primitive; 239 } 240 virtual FDE_CSSPRIMITIVETYPE GetPrimitiveType() const = 0; 241 virtual FX_ARGB GetRGBColor() const = 0; 242 virtual FX_FLOAT GetFloat() const = 0; 243 virtual const FX_WCHAR* GetString(int32_t& iLength) const = 0; 244 virtual FDE_CSSPROPERTYVALUE GetEnum() const = 0; 245 virtual const FX_WCHAR* GetFuncName() const = 0; 246 virtual int32_t CountArgs() const = 0; 247 virtual IFDE_CSSValue* GetArgs(int32_t index) const = 0; 248 }; 249 class IFDE_CSSValueList : public IFDE_CSSValue { 250 public: 251 virtual FDE_CSSVALUETYPE GetType() const { return FDE_CSSVALUETYPE_List; } 252 virtual int32_t CountValues() const = 0; 253 virtual IFDE_CSSValue* GetValue(int32_t index) const = 0; 254 }; 255 enum FDE_CSSPROPERTY { 256 FDE_CSSPROPERTY_WritingMode, 257 FDE_CSSPROPERTY_ColumnRuleWidth, 258 FDE_CSSPROPERTY_BorderLeft, 259 FDE_CSSPROPERTY_ColumnRule, 260 FDE_CSSPROPERTY_Height, 261 FDE_CSSPROPERTY_CounterReset, 262 FDE_CSSPROPERTY_Content, 263 FDE_CSSPROPERTY_RubyPosition, 264 FDE_CSSPROPERTY_BackgroundColor, 265 FDE_CSSPROPERTY_Width, 266 FDE_CSSPROPERTY_Src, 267 FDE_CSSPROPERTY_Top, 268 FDE_CSSPROPERTY_Margin, 269 FDE_CSSPROPERTY_BorderColor, 270 FDE_CSSPROPERTY_Widows, 271 FDE_CSSPROPERTY_BorderBottomColor, 272 FDE_CSSPROPERTY_TextIndent, 273 FDE_CSSPROPERTY_Right, 274 FDE_CSSPROPERTY_TextEmphasisStyle, 275 FDE_CSSPROPERTY_PaddingLeft, 276 FDE_CSSPROPERTY_ColumnWidth, 277 FDE_CSSPROPERTY_MarginLeft, 278 FDE_CSSPROPERTY_Border, 279 FDE_CSSPROPERTY_BorderTop, 280 FDE_CSSPROPERTY_RubyOverhang, 281 FDE_CSSPROPERTY_PageBreakBefore, 282 FDE_CSSPROPERTY_MaxHeight, 283 FDE_CSSPROPERTY_MinWidth, 284 FDE_CSSPROPERTY_BorderLeftColor, 285 FDE_CSSPROPERTY_Bottom, 286 FDE_CSSPROPERTY_Quotes, 287 FDE_CSSPROPERTY_MaxWidth, 288 FDE_CSSPROPERTY_PaddingRight, 289 FDE_CSSPROPERTY_ListStyleImage, 290 FDE_CSSPROPERTY_WhiteSpace, 291 FDE_CSSPROPERTY_BorderBottom, 292 FDE_CSSPROPERTY_ListStyleType, 293 FDE_CSSPROPERTY_WordBreak, 294 FDE_CSSPROPERTY_OverflowX, 295 FDE_CSSPROPERTY_OverflowY, 296 FDE_CSSPROPERTY_BorderTopColor, 297 FDE_CSSPROPERTY_FontFamily, 298 FDE_CSSPROPERTY_Cursor, 299 FDE_CSSPROPERTY_RubyAlign, 300 FDE_CSSPROPERTY_ColumnRuleColor, 301 FDE_CSSPROPERTY_FontWeight, 302 FDE_CSSPROPERTY_BorderRightStyle, 303 FDE_CSSPROPERTY_MinHeight, 304 FDE_CSSPROPERTY_Color, 305 FDE_CSSPROPERTY_LetterSpacing, 306 FDE_CSSPROPERTY_EmptyCells, 307 FDE_CSSPROPERTY_TextAlign, 308 FDE_CSSPROPERTY_RubySpan, 309 FDE_CSSPROPERTY_Position, 310 FDE_CSSPROPERTY_BorderStyle, 311 FDE_CSSPROPERTY_BorderBottomStyle, 312 FDE_CSSPROPERTY_BorderCollapse, 313 FDE_CSSPROPERTY_ColumnCount, 314 FDE_CSSPROPERTY_BorderRightWidth, 315 FDE_CSSPROPERTY_UnicodeBidi, 316 FDE_CSSPROPERTY_VerticalAlign, 317 FDE_CSSPROPERTY_PaddingTop, 318 FDE_CSSPROPERTY_Columns, 319 FDE_CSSPROPERTY_Overflow, 320 FDE_CSSPROPERTY_TableLayout, 321 FDE_CSSPROPERTY_FontVariant, 322 FDE_CSSPROPERTY_ListStyle, 323 FDE_CSSPROPERTY_BackgroundPosition, 324 FDE_CSSPROPERTY_BorderWidth, 325 FDE_CSSPROPERTY_TextEmphasisColor, 326 FDE_CSSPROPERTY_BorderLeftStyle, 327 FDE_CSSPROPERTY_PageBreakInside, 328 FDE_CSSPROPERTY_TextEmphasis, 329 FDE_CSSPROPERTY_BorderBottomWidth, 330 FDE_CSSPROPERTY_ColumnGap, 331 FDE_CSSPROPERTY_Orphans, 332 FDE_CSSPROPERTY_BorderRight, 333 FDE_CSSPROPERTY_FontSize, 334 FDE_CSSPROPERTY_PageBreakAfter, 335 FDE_CSSPROPERTY_CaptionSide, 336 FDE_CSSPROPERTY_BackgroundRepeat, 337 FDE_CSSPROPERTY_BorderTopStyle, 338 FDE_CSSPROPERTY_BorderSpacing, 339 FDE_CSSPROPERTY_TextTransform, 340 FDE_CSSPROPERTY_FontStyle, 341 FDE_CSSPROPERTY_Font, 342 FDE_CSSPROPERTY_LineHeight, 343 FDE_CSSPROPERTY_MarginRight, 344 FDE_CSSPROPERTY_Float, 345 FDE_CSSPROPERTY_BorderLeftWidth, 346 FDE_CSSPROPERTY_Display, 347 FDE_CSSPROPERTY_Clear, 348 FDE_CSSPROPERTY_ColumnRuleStyle, 349 FDE_CSSPROPERTY_TextCombine, 350 FDE_CSSPROPERTY_ListStylePosition, 351 FDE_CSSPROPERTY_Visibility, 352 FDE_CSSPROPERTY_PaddingBottom, 353 FDE_CSSPROPERTY_BackgroundAttachment, 354 FDE_CSSPROPERTY_BackgroundImage, 355 FDE_CSSPROPERTY_LineBreak, 356 FDE_CSSPROPERTY_Background, 357 FDE_CSSPROPERTY_BorderTopWidth, 358 FDE_CSSPROPERTY_WordSpacing, 359 FDE_CSSPROPERTY_BorderRightColor, 360 FDE_CSSPROPERTY_CounterIncrement, 361 FDE_CSSPROPERTY_Left, 362 FDE_CSSPROPERTY_TextDecoration, 363 FDE_CSSPROPERTY_Padding, 364 FDE_CSSPROPERTY_MarginBottom, 365 FDE_CSSPROPERTY_MarginTop, 366 FDE_CSSPROPERTY_Direction, 367 FDE_CSSPROPERTY_MAX 368 }; 369 class IFDE_CSSDeclaration { 370 public: 371 virtual ~IFDE_CSSDeclaration() {} 372 virtual IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, 373 FX_BOOL& bImportant) const = 0; 374 virtual FX_POSITION GetStartPosition() const = 0; 375 virtual void GetNextProperty(FX_POSITION& pos, 376 FDE_CSSPROPERTY& eProperty, 377 IFDE_CSSValue*& pValue, 378 FX_BOOL& bImportant) const = 0; 379 virtual FX_POSITION GetStartCustom() const = 0; 380 virtual void GetNextCustom(FX_POSITION& pos, 381 CFX_WideString& wsName, 382 CFX_WideString& wsValue) const = 0; 383 }; 384 typedef CFX_ArrayTemplate<IFDE_CSSDeclaration*> CFDE_CSSDeclarationArray; 385 enum FDE_CSSPERSUDO { 386 FDE_CSSPERSUDO_After, 387 FDE_CSSPERSUDO_Before, 388 FDE_CSSPERSUDO_NONE 389 }; 390 enum FDE_CSSSELECTORTYPE { 391 FDE_CSSSELECTORTYPE_Element, 392 FDE_CSSSELECTORTYPE_Descendant, 393 FDE_CSSSELECTORTYPE_Class, 394 FDE_CSSSELECTORTYPE_Persudo, 395 FDE_CSSSELECTORTYPE_ID, 396 }; 397 class IFDE_CSSSelector { 398 public: 399 virtual ~IFDE_CSSSelector() {} 400 virtual FDE_CSSSELECTORTYPE GetType() const = 0; 401 virtual FX_DWORD GetNameHash() const = 0; 402 virtual IFDE_CSSSelector* GetNextSelector() const = 0; 403 }; 404 #define FDE_CSSMEDIATYPE_Braille 0x01 405 #define FDE_CSSMEDIATYPE_Emboss 0x02 406 #define FDE_CSSMEDIATYPE_Handheld 0x04 407 #define FDE_CSSMEDIATYPE_Print 0x08 408 #define FDE_CSSMEDIATYPE_Projection 0x10 409 #define FDE_CSSMEDIATYPE_Screen 0x20 410 #define FDE_CSSMEDIATYPE_TTY 0x40 411 #define FDE_CSSMEDIATYPE_TV 0x80 412 #define FDE_CSSMEDIATYPE_ALL 0xFF 413 enum FDE_CSSRULETYPE { 414 FDE_CSSRULETYPE_Unknown = 0, 415 FDE_CSSRULETYPE_Style = 1, 416 FDE_CSSRULETYPE_Media = 4, 417 FDE_CSSRULETYPE_FontFace = 5, 418 }; 419 class IFDE_CSSRule { 420 public: 421 virtual ~IFDE_CSSRule() {} 422 virtual FDE_CSSRULETYPE GetType() const = 0; 423 }; 424 typedef CFX_MassArrayTemplate<IFDE_CSSRule*> CFDE_CSSRuleArray; 425 class IFDE_CSSStyleRule : public IFDE_CSSRule { 426 public: 427 virtual FDE_CSSRULETYPE GetType() const { return FDE_CSSRULETYPE_Style; } 428 virtual int32_t CountSelectorLists() const = 0; 429 virtual IFDE_CSSSelector* GetSelectorList(int32_t index) const = 0; 430 virtual IFDE_CSSDeclaration* GetDeclaration() const = 0; 431 }; 432 class IFDE_CSSMediaRule : public IFDE_CSSRule { 433 public: 434 virtual FDE_CSSRULETYPE GetType() const { return FDE_CSSRULETYPE_Media; } 435 virtual FX_DWORD GetMediaList() const = 0; 436 virtual int32_t CountRules() const = 0; 437 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; 438 }; 439 class IFDE_CSSFontFaceRule : public IFDE_CSSRule { 440 public: 441 virtual FDE_CSSRULETYPE GetType() const { return FDE_CSSRULETYPE_FontFace; } 442 virtual IFDE_CSSDeclaration* GetDeclaration() const = 0; 443 }; 444 class IFDE_CSSStyleSheet : public IFX_Unknown { 445 public: 446 static IFDE_CSSStyleSheet* LoadHTMLStandardStyleSheet(); 447 static IFDE_CSSStyleSheet* LoadFromStream( 448 const CFX_WideString& szUrl, 449 IFX_Stream* pStream, 450 FX_WORD wCodePage, 451 FX_DWORD dwMediaList = FDE_CSSMEDIATYPE_ALL); 452 static IFDE_CSSStyleSheet* LoadFromBuffer( 453 const CFX_WideString& szUrl, 454 const FX_WCHAR* pBuffer, 455 int32_t iBufSize, 456 FX_WORD wCodePage, 457 FX_DWORD dwMediaList = FDE_CSSMEDIATYPE_ALL); 458 virtual FX_BOOL GetUrl(CFX_WideString& szUrl) = 0; 459 virtual FX_DWORD GetMediaList() const = 0; 460 virtual FX_WORD GetCodePage() const = 0; 461 462 virtual int32_t CountRules() const = 0; 463 virtual IFDE_CSSRule* GetRule(int32_t index) = 0; 464 }; 465 typedef CFX_ArrayTemplate<IFDE_CSSStyleSheet*> CFDE_CSSStyleSheetArray; 466 #define FDE_CSSUSERSTYLESHEET (FX_BSTRC("#USERSHEET")) 467 #define FDE_CSSUAGENTSTYLESHEET (FX_BSTRC("#AGENTSHEET")) 468 class IFDE_CSSStyleSheetCache { 469 public: 470 static IFDE_CSSStyleSheetCache* Create(); 471 virtual ~IFDE_CSSStyleSheetCache() {} 472 virtual void Release() = 0; 473 virtual void SetMaxItems(int32_t iMaxCount = 5) = 0; 474 virtual void AddStyleSheet(const CFX_ByteStringC& szKey, 475 IFDE_CSSStyleSheet* pStyleSheet) = 0; 476 virtual IFDE_CSSStyleSheet* GetStyleSheet( 477 const CFX_ByteStringC& szKey) const = 0; 478 virtual void RemoveStyleSheet(const CFX_ByteStringC& szKey) = 0; 479 }; 480 enum FDE_CSSSYNTAXSTATUS { 481 FDE_CSSSYNTAXSTATUS_Error, 482 FDE_CSSSYNTAXSTATUS_EOS, 483 FDE_CSSSYNTAXSTATUS_None, 484 FDE_CSSSYNTAXSTATUS_Charset, 485 FDE_CSSSYNTAXSTATUS_ImportRule, 486 FDE_CSSSYNTAXSTATUS_ImportClose, 487 FDE_CSSSYNTAXSTATUS_PageRule, 488 FDE_CSSSYNTAXSTATUS_StyleRule, 489 FDE_CSSSYNTAXSTATUS_FontFaceRule, 490 FDE_CSSSYNTAXSTATUS_MediaRule, 491 FDE_CSSSYNTAXSTATUS_MediaType, 492 FDE_CSSSYNTAXSTATUS_URI, 493 FDE_CSSSYNTAXSTATUS_Selector, 494 FDE_CSSSYNTAXSTATUS_DeclOpen, 495 FDE_CSSSYNTAXSTATUS_DeclClose, 496 FDE_CSSSYNTAXSTATUS_PropertyName, 497 FDE_CSSSYNTAXSTATUS_PropertyValue, 498 }; 499 class IFDE_CSSSyntaxParser { 500 public: 501 static IFDE_CSSSyntaxParser* Create(); 502 virtual ~IFDE_CSSSyntaxParser() {} 503 virtual void Release() = 0; 504 virtual FX_BOOL Init(IFX_Stream* pStream, 505 int32_t iCSSPlaneSize, 506 int32_t iTextDataSize = 32, 507 FX_BOOL bOnlyDeclaration = FALSE) = 0; 508 virtual FX_BOOL Init(const FX_WCHAR* pBuffer, 509 int32_t iBufferSize, 510 int32_t iTextDatSize = 32, 511 FX_BOOL bOnlyDeclaration = FALSE) = 0; 512 513 virtual FDE_CSSSYNTAXSTATUS DoSyntaxParse() = 0; 514 virtual const FX_WCHAR* GetCurrentString(int32_t& iLength) const = 0; 515 }; 516 enum FDE_CSSLENGTHUNIT { 517 FDE_CSSLENGTHUNIT_Auto, 518 FDE_CSSLENGTHUNIT_None, 519 FDE_CSSLENGTHUNIT_Normal, 520 FDE_CSSLENGTHUNIT_Point, 521 FDE_CSSLENGTHUNIT_Percent, 522 }; 523 #define FDE_CSSUNITBITS (3) 524 #define FDE_CSSUNITMASK ((1 << FDE_CSSUNITBITS) - 1) 525 struct FDE_CSSLENGTH { 526 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit) { 527 m_iData = eUnit; 528 return *this; 529 } 530 FDE_CSSLENGTH& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { 531 m_iData = ((intptr_t)(fValue * 1024.0f) << FDE_CSSUNITBITS) | eUnit; 532 return *this; 533 } 534 FDE_CSSLENGTHUNIT GetUnit() const { 535 return (FDE_CSSLENGTHUNIT)(m_iData & FDE_CSSUNITMASK); 536 } 537 FX_FLOAT GetValue() const { return (m_iData >> FDE_CSSUNITBITS) / 1024.0f; } 538 FX_BOOL NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } 539 540 private: 541 intptr_t m_iData; 542 }; 543 struct FDE_CSSPOINT { 544 FDE_CSSPOINT& Set(FDE_CSSLENGTHUNIT eUnit) { 545 x.Set(eUnit); 546 y.Set(eUnit); 547 return *this; 548 } 549 FDE_CSSPOINT& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { 550 x.Set(eUnit, fValue); 551 y.Set(eUnit, fValue); 552 return *this; 553 } 554 FDE_CSSLENGTH x, y; 555 }; 556 struct FDE_CSSSIZE { 557 FDE_CSSSIZE& Set(FDE_CSSLENGTHUNIT eUnit) { 558 cx.Set(eUnit); 559 cy.Set(eUnit); 560 return *this; 561 } 562 FDE_CSSSIZE& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { 563 cx.Set(eUnit, fValue); 564 cy.Set(eUnit, fValue); 565 return *this; 566 } 567 FDE_CSSLENGTH cx, cy; 568 }; 569 struct FDE_CSSRECT { 570 FDE_CSSRECT& Set(FDE_CSSLENGTHUNIT eUnit) { 571 left.Set(eUnit); 572 top.Set(eUnit); 573 right.Set(eUnit); 574 bottom.Set(eUnit); 575 return *this; 576 } 577 FDE_CSSRECT& Set(FDE_CSSLENGTHUNIT eUnit, FX_FLOAT fValue) { 578 left.Set(eUnit, fValue); 579 top.Set(eUnit, fValue); 580 right.Set(eUnit, fValue); 581 bottom.Set(eUnit, fValue); 582 return *this; 583 } 584 585 FDE_CSSLENGTH left, top, right, bottom; 586 }; 587 enum FDE_CSSBKGATTACHMENT { 588 FDE_CSSBKGATTACHMENT_Scroll, 589 FDE_CSSBKGATTACHMENT_Fixed, 590 }; 591 enum FDE_CSSBKGREPEAT { 592 FDE_CSSBKGREPEAT_Repeat, 593 FDE_CSSBKGREPEAT_RepeatX, 594 FDE_CSSBKGREPEAT_RepeatY, 595 FDE_CSSBKGREPEAT_NoRepeat, 596 }; 597 enum FDE_CSSBORDERSTYLE { 598 FDE_CSSBORDERSTYLE_None, 599 FDE_CSSBORDERSTYLE_Hidden, 600 FDE_CSSBORDERSTYLE_Dotted, 601 FDE_CSSBORDERSTYLE_Dashed, 602 FDE_CSSBORDERSTYLE_Solid, 603 FDE_CSSBORDERSTYLE_Double, 604 FDE_CSSBORDERSTYLE_Groove, 605 FDE_CSSBORDERSTYLE_Ridge, 606 FDE_CSSBORDERSTYLE_Inset, 607 FDE_CSSBORDERSTYLE_outset, 608 }; 609 enum FDE_CSSCLEAR { 610 FDE_CSSCLEAR_None, 611 FDE_CSSCLEAR_Left, 612 FDE_CSSCLEAR_Right, 613 FDE_CSSCLEAR_Both, 614 }; 615 enum FDE_CSSDISPLAY { 616 FDE_CSSDISPLAY_None, 617 FDE_CSSDISPLAY_ListItem, 618 FDE_CSSDISPLAY_RunIn, 619 FDE_CSSDISPLAY_Block, 620 FDE_CSSDISPLAY_Inline, 621 FDE_CSSDISPLAY_InlineBlock, 622 FDE_CSSDISPLAY_InlineTable, 623 FDE_CSSDISPLAY_Table, 624 FDE_CSSDISPLAY_TableRow, 625 FDE_CSSDISPLAY_TableCell, 626 FDE_CSSDISPLAY_TableCaption, 627 FDE_CSSDISPLAY_TableColumn, 628 FDE_CSSDISPLAY_TableRowGroup, 629 FDE_CSSDISPLAY_TableColumnGroup, 630 FDE_CSSDISPLAY_TableHeaderGroup, 631 FDE_CSSDISPLAY_TableFooterGroup, 632 FDE_CSSDISPLAY_Ruby, 633 FDE_CSSDISPLAY_RubyBase, 634 FDE_CSSDISPLAY_RubyText, 635 FDE_CSSDISPLSY_RubyBaseGroup, 636 FDE_CSSDISPLAY_RubyTextGroup, 637 }; 638 enum FDE_CSSVISIBILITY { 639 FDE_CSSVISIBILITY_Visible, 640 FDE_CSSVISIBILITY_Hidden, 641 FDE_CSSVISIBILITY_Collapse, 642 }; 643 enum FDE_CSSFONTSTYLE { 644 FDE_CSSFONTSTYLE_Normal, 645 FDE_CSSFONTSTYLE_Italic, 646 }; 647 enum FDE_CSSFLOAT { 648 FDE_CSSFLOAT_None, 649 FDE_CSSFLOAT_Left, 650 FDE_CSSFLOAT_Right, 651 }; 652 enum FDE_CSSWRITINGMODE { 653 FDE_CSSWRITINGMODE_HorizontalTb, 654 FDE_CSSWRITINGMODE_VerticalRl, 655 FDE_CSSWRITINGMODE_VerticalLr, 656 }; 657 enum FDE_CSSWORDBREAK { 658 FDE_CSSWORDBREAK_Normal, 659 FDE_CSSWORDBREAK_KeepAll, 660 FDE_CSSWORDBREAK_BreakAll, 661 FDE_CSSWORDBREAK_KeepWords, 662 }; 663 enum FDE_CSSPAGEBREAK { 664 FDE_CSSPAGEBREAK_Auto, 665 FDE_CSSPAGEBREAK_Always, 666 FDE_CSSPAGEBREAK_Avoid, 667 FDE_CSSPAGEBREAK_Left, 668 FDE_CSSPAGEBREAK_Right, 669 }; 670 enum FDE_CSSOVERFLOW { 671 FDE_CSSOVERFLOW_Visible, 672 FDE_CSSOVERFLOW_Hidden, 673 FDE_CSSOVERFLOW_Scroll, 674 FDE_CSSOVERFLOW_Auto, 675 FDE_CSSOVERFLOW_NoDisplay, 676 FDE_CSSOVERFLOW_NoContent, 677 }; 678 enum FDE_CSSLINEBREAK { 679 FDE_CSSLINEBREAK_Auto, 680 FDE_CSSLINEBREAK_Loose, 681 FDE_CSSLINEBREAK_Normal, 682 FDE_CSSLINEBREAK_Strict, 683 }; 684 enum FDE_CSSTEXTEMPHASISFILL { 685 FDE_CSSTEXTEMPHASISFILL_Filled, 686 FDE_CSSTEXTEMPHASISFILL_Open, 687 }; 688 enum FDE_CSSTEXTEMPHASISMARK { 689 FDE_CSSTEXTEMPHASISMARK_None, 690 FDE_CSSTEXTEMPHASISMARK_Auto, 691 FDE_CSSTEXTEMPHASISMARK_Dot, 692 FDE_CSSTEXTEMPHASISMARK_Circle, 693 FDE_CSSTEXTEMPHASISMARK_DoubleCircle, 694 FDE_CSSTEXTEMPHASISMARK_Triangle, 695 FDE_CSSTEXTEMPHASISMARK_Sesame, 696 FDE_CSSTEXTEMPHASISMARK_Custom, 697 }; 698 enum FDE_CSSTEXTCOMBINE { 699 FDE_CSSTEXTCOMBINE_Horizontal, 700 FDE_CSSTEXTCOMBINE_None, 701 }; 702 enum FDE_CSSCURSOR { 703 FDE_CSSCURSOR_Auto, 704 FDE_CSSCURSOR_Crosshair, 705 FDE_CSSCURSOR_Default, 706 FDE_CSSCURSOR_Pointer, 707 FDE_CSSCURSOR_Move, 708 FDE_CSSCURSOR_EResize, 709 FDE_CSSCURSOR_NeResize, 710 FDE_CSSCURSOR_NwResize, 711 FDE_CSSCURSOR_NResize, 712 FDE_CSSCURSOR_SeResize, 713 FDE_CSSCURSOR_SwResize, 714 FDE_CSSCURSOR_SResize, 715 FDE_CSSCURSOR_WResize, 716 FDE_CSSCURSOR_Text, 717 FDE_CSSCURSOR_Wait, 718 FDE_CSSCURSOR_Help, 719 FDE_CSSCURSOR_Progress, 720 }; 721 enum FDE_CSSPOSITION { 722 FDE_CSSPOSITION_Static, 723 FDE_CSSPOSITION_Relative, 724 FDE_CSSPOSITION_Absolute, 725 FDE_CSSPOSITION_Fixed, 726 }; 727 enum FDE_CSSCAPTIONSIDE { 728 FDE_CSSCAPTIONSIDE_Top, 729 FDE_CSSCAPTIONSIDE_Bottom, 730 FDE_CSSCAPTIONSIDE_Left, 731 FDE_CSSCAPTIONSIDE_Right, 732 FDE_CSSCAPTIONSIDE_Before, 733 FDE_CSSCAPTIONSIDE_After, 734 }; 735 enum FDE_CSSRUBYALIGN { 736 FDE_CSSRUBYALIGN_Auto, 737 FDE_CSSRUBYALIGN_Start, 738 FDE_CSSRUBYALIGN_Left, 739 FDE_CSSRUBYALIGN_Center, 740 FDE_CSSRUBYALIGN_End, 741 FDE_CSSRUBYALIGN_Right, 742 FDE_CSSRUBYALIGN_DistributeLetter, 743 FDE_CSSRUBYALIGN_DistributeSpace, 744 FDE_CSSRUBYALIGN_LineEdge, 745 }; 746 enum FDE_CSSRUBYOVERHANG { 747 FDE_CSSRUBYOVERHANG_Auto, 748 FDE_CSSRUBYOVERHANG_Start, 749 FDE_CSSRUBYOVERHANG_End, 750 FDE_CSSRUBYOVERHANG_None, 751 }; 752 enum FDE_CSSRUBYPOSITION { 753 FDE_CSSRUBYPOSITION_Before, 754 FDE_CSSRUBYPOSITION_After, 755 FDE_CSSRUBYPOSITION_Right, 756 FDE_CSSRUBYPOSITION_Inline, 757 }; 758 enum FDE_CSSRUBYSPAN { 759 FDE_CSSRUBYSPAN_None, 760 FDE_CSSRUBYSPAN_Attr, 761 }; 762 enum FDE_CSSTEXTALIGN { 763 FDE_CSSTEXTALIGN_Left, 764 FDE_CSSTEXTALIGN_Right, 765 FDE_CSSTEXTALIGN_Center, 766 FDE_CSSTEXTALIGN_Justify, 767 FDE_CSSTEXTALIGN_JustifyAll, 768 }; 769 enum FDE_CSSVERTICALALIGN { 770 FDE_CSSVERTICALALIGN_Baseline, 771 FDE_CSSVERTICALALIGN_Sub, 772 FDE_CSSVERTICALALIGN_Super, 773 FDE_CSSVERTICALALIGN_Top, 774 FDE_CSSVERTICALALIGN_TextTop, 775 FDE_CSSVERTICALALIGN_Middle, 776 FDE_CSSVERTICALALIGN_Bottom, 777 FDE_CSSVERTICALALIGN_TextBottom, 778 FDE_CSSVERTICALALIGN_Number, 779 }; 780 enum FDE_CSSLISTSTYLETYPE { 781 FDE_CSSLISTSTYLETYPE_Disc, 782 FDE_CSSLISTSTYLETYPE_Circle, 783 FDE_CSSLISTSTYLETYPE_Square, 784 FDE_CSSLISTSTYLETYPE_Decimal, 785 FDE_CSSLISTSTYLETYPE_DecimalLeadingZero, 786 FDE_CSSLISTSTYLETYPE_LowerRoman, 787 FDE_CSSLISTSTYLETYPE_UpperRoman, 788 FDE_CSSLISTSTYLETYPE_LowerGreek, 789 FDE_CSSLISTSTYLETYPE_LowerLatin, 790 FDE_CSSLISTSTYLETYPE_UpperLatin, 791 FDE_CSSLISTSTYLETYPE_Armenian, 792 FDE_CSSLISTSTYLETYPE_Georgian, 793 FDE_CSSLISTSTYLETYPE_LowerAlpha, 794 FDE_CSSLISTSTYLETYPE_UpperAlpha, 795 FDE_CSSLISTSTYLETYPE_None, 796 FDE_CSSLISTSTYLETYPE_CjkIdeographic, 797 FDE_CSSLISTSTYLETYPE_Hebrew, 798 FDE_CSSLISTSTYLETYPE_Hiragana, 799 FDE_CSSLISTSTYLETYPE_HiraganaIroha, 800 FDE_CSSLISTSTYLETYPE_Katakana, 801 FDE_CSSLISTSTYLETYPE_KatakanaIroha, 802 }; 803 enum FDE_CSSLISTSTYLEPOSITION { 804 FDE_CSSLISTSTYLEPOSITION_Outside, 805 FDE_CSSLISTSTYLEPOSITION_Inside, 806 }; 807 enum FDE_CSSWHITESPACE { 808 FDE_CSSWHITESPACE_Normal, 809 FDE_CSSWHITESPACE_Pre, 810 FDE_CSSWHITESPACE_Nowrap, 811 FDE_CSSWHITESPACE_PreWrap, 812 FDE_CSSWHITESPACE_PreLine, 813 }; 814 enum FDE_CSSFONTVARIANT { 815 FDE_CSSFONTVARIANT_Normal, 816 FDE_CSSFONTVARIANT_SmallCaps, 817 }; 818 enum FDE_CSSTEXTTRANSFORM { 819 FDE_CSSTEXTTRANSFORM_None, 820 FDE_CSSTEXTTRANSFORM_Capitalize, 821 FDE_CSSTEXTTRANSFORM_UpperCase, 822 FDE_CSSTEXTTRANSFORM_LowerCase, 823 }; 824 enum FDE_CSSTEXTDECORATION { 825 FDE_CSSTEXTDECORATION_None = 0, 826 FDE_CSSTEXTDECORATION_Underline = 1, 827 FDE_CSSTEXTDECORATION_Overline = 2, 828 FDE_CSSTEXTDECORATION_LineThrough = 4, 829 FDE_CSSTEXTDECORATION_Blink = 8, 830 FDE_CSSTEXTDECORATION_Double = 16, 831 }; 832 class IFDE_CSSRubyStyle { 833 public: 834 virtual ~IFDE_CSSRubyStyle() {} 835 virtual FDE_CSSRUBYALIGN GetRubyAlign() const = 0; 836 virtual FDE_CSSRUBYOVERHANG GetRubyOverhang() const = 0; 837 virtual FDE_CSSRUBYPOSITION GetRubyPosition() const = 0; 838 virtual FDE_CSSRUBYSPAN GetRubySpanType() const = 0; 839 virtual IFDE_CSSValue* GetRubySpanAttr() const = 0; 840 }; 841 class IFDE_CSSMultiColumnStyle { 842 public: 843 virtual ~IFDE_CSSMultiColumnStyle() {} 844 virtual const FDE_CSSLENGTH& GetColumnCount() const = 0; 845 virtual const FDE_CSSLENGTH& GetColumnGap() const = 0; 846 virtual FX_ARGB GetColumnRuleColor() const = 0; 847 virtual FDE_CSSBORDERSTYLE GetColumnRuleStyle() const = 0; 848 virtual const FDE_CSSLENGTH& GetColumnRuleWidth() const = 0; 849 virtual const FDE_CSSLENGTH& GetColumnWidth() const = 0; 850 virtual void SetColumnCount(const FDE_CSSLENGTH& columnCount) = 0; 851 virtual void SetColumnGap(const FDE_CSSLENGTH& columnGap) = 0; 852 virtual void SetColumnRuleColor(FX_ARGB dwColumnRuleColor) = 0; 853 virtual void SetColumnRuleStyle(FDE_CSSBORDERSTYLE eColumnRuleStyle) = 0; 854 virtual void SetColumnRuleWidth(const FDE_CSSLENGTH& columnRuleWidth) = 0; 855 virtual void SetColumnWidth(const FDE_CSSLENGTH& columnWidth) = 0; 856 }; 857 class IFDE_CSSGeneratedContentStyle { 858 public: 859 virtual ~IFDE_CSSGeneratedContentStyle() {} 860 virtual int32_t CountCounters() = 0; 861 virtual const FX_WCHAR* GetCounterIdentifier(int32_t index) = 0; 862 virtual FX_BOOL GetCounterReset(int32_t index, int32_t& iValue) = 0; 863 virtual FX_BOOL GetCounterIncrement(int32_t index, int32_t& iValue) = 0; 864 virtual IFDE_CSSValueList* GetContent() const = 0; 865 virtual int32_t CountQuotes() const = 0; 866 virtual const FX_WCHAR* GetQuotes(int32_t index) const = 0; 867 }; 868 class IFDE_CSSFontStyle { 869 public: 870 virtual ~IFDE_CSSFontStyle() {} 871 virtual int32_t CountFontFamilies() const = 0; 872 virtual const FX_WCHAR* GetFontFamily(int32_t index) const = 0; 873 virtual FX_WORD GetFontWeight() const = 0; 874 virtual FDE_CSSFONTVARIANT GetFontVariant() const = 0; 875 virtual FDE_CSSFONTSTYLE GetFontStyle() const = 0; 876 virtual FX_FLOAT GetFontSize() const = 0; 877 virtual FX_ARGB GetColor() const = 0; 878 virtual void SetFontWeight(FX_WORD wFontWeight) = 0; 879 virtual void SetFontVariant(FDE_CSSFONTVARIANT eFontVariant) = 0; 880 virtual void SetFontStyle(FDE_CSSFONTSTYLE eFontStyle) = 0; 881 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; 882 virtual void SetColor(FX_ARGB dwFontColor) = 0; 883 }; 884 class IFDE_CSSBoundaryStyle { 885 public: 886 virtual ~IFDE_CSSBoundaryStyle() {} 887 virtual FX_ARGB GetBorderLeftColor() const = 0; 888 virtual FX_ARGB GetBorderTopColor() const = 0; 889 virtual FX_ARGB GetBorderRightColor() const = 0; 890 virtual FX_ARGB GetBorderBottomColor() const = 0; 891 virtual FDE_CSSBORDERSTYLE GetBorderLeftStyle() const = 0; 892 virtual FDE_CSSBORDERSTYLE GetBorderTopStyle() const = 0; 893 virtual FDE_CSSBORDERSTYLE GetBorderRightStyle() const = 0; 894 virtual FDE_CSSBORDERSTYLE GetBorderBottomStyle() const = 0; 895 virtual const FDE_CSSRECT* GetBorderWidth() const = 0; 896 virtual const FDE_CSSRECT* GetMarginWidth() const = 0; 897 virtual const FDE_CSSRECT* GetPaddingWidth() const = 0; 898 virtual void SetBorderLeftColor(FX_ARGB dwBorderColor) = 0; 899 virtual void SetBorderTopColor(FX_ARGB dwBorderColor) = 0; 900 virtual void SetBorderRightColor(FX_ARGB dwBorderColor) = 0; 901 virtual void SetBorderBottomColor(FX_ARGB dwBorderColor) = 0; 902 903 virtual void SetBorderLeftStyle(FDE_CSSBORDERSTYLE eBorderStyle) = 0; 904 virtual void SetBorderTopStyle(FDE_CSSBORDERSTYLE eBorderStyle) = 0; 905 virtual void SetBorderRightStyle(FDE_CSSBORDERSTYLE eBorderStyle) = 0; 906 virtual void SetBorderBottomStyle(FDE_CSSBORDERSTYLE eBorderStyle) = 0; 907 908 virtual void SetBorderWidth(const FDE_CSSRECT& rect) = 0; 909 virtual void SetMarginWidth(const FDE_CSSRECT& rect) = 0; 910 virtual void SetPaddingWidth(const FDE_CSSRECT& rect) = 0; 911 }; 912 class IFDE_CSSPositionStyle { 913 public: 914 virtual ~IFDE_CSSPositionStyle() {} 915 virtual FDE_CSSDISPLAY GetDisplay() const = 0; 916 virtual const FDE_CSSSIZE& GetBoxSize() const = 0; 917 virtual const FDE_CSSSIZE& GetMinBoxSize() const = 0; 918 virtual const FDE_CSSSIZE& GetMaxBoxSize() const = 0; 919 virtual FDE_CSSFLOAT GetFloat() const = 0; 920 virtual FDE_CSSCLEAR GetClear() const = 0; 921 virtual FDE_CSSPOSITION GetPosition() const = 0; 922 virtual FDE_CSSLENGTH GetTop() const = 0; 923 virtual FDE_CSSLENGTH GetBottom() const = 0; 924 virtual FDE_CSSLENGTH GetLeft() const = 0; 925 virtual FDE_CSSLENGTH GetRight() const = 0; 926 virtual void SetDisplay(FDE_CSSDISPLAY eDisplay) = 0; 927 virtual void SetBoxSize(const FDE_CSSSIZE& boxSize) = 0; 928 virtual void SetMinBoxSize(const FDE_CSSSIZE& minBoxSize) = 0; 929 virtual void SetMaxBoxSize(const FDE_CSSSIZE& maxBoxSize) = 0; 930 virtual void SetFloat(FDE_CSSFLOAT eFloat) = 0; 931 virtual void SetClear(FDE_CSSCLEAR eClear) = 0; 932 }; 933 class IFDE_CSSParagraphStyle { 934 public: 935 virtual ~IFDE_CSSParagraphStyle() {} 936 virtual FX_FLOAT GetLineHeight() const = 0; 937 virtual FDE_CSSWHITESPACE GetWhiteSpace() const = 0; 938 virtual const FDE_CSSLENGTH& GetTextIndent() const = 0; 939 virtual FDE_CSSTEXTALIGN GetTextAlign() const = 0; 940 virtual FDE_CSSVERTICALALIGN GetVerticalAlign() const = 0; 941 virtual FX_FLOAT GetNumberVerticalAlign() const = 0; 942 virtual FDE_CSSTEXTTRANSFORM GetTextTransform() const = 0; 943 virtual FX_DWORD GetTextDecoration() const = 0; 944 virtual const FDE_CSSLENGTH& GetLetterSpacing() const = 0; 945 virtual const FDE_CSSLENGTH& GetWordSpacing() const = 0; 946 virtual FDE_CSSWRITINGMODE GetWritingMode() const = 0; 947 virtual FDE_CSSWORDBREAK GetWordBreak() const = 0; 948 virtual int32_t GetWidows() const = 0; 949 virtual FX_ARGB GetTextEmphasisColor() const = 0; 950 virtual FDE_CSSPAGEBREAK GetPageBreakBefore() const = 0; 951 virtual FDE_CSSPAGEBREAK GetPageBreakAfter() const = 0; 952 virtual FDE_CSSPAGEBREAK GetPageBreakInside() const = 0; 953 virtual int32_t GetOrphans() const = 0; 954 virtual FDE_CSSLINEBREAK GetLineBreak() const = 0; 955 virtual FDE_CSSTEXTEMPHASISMARK GetTextEmphasisMark() const = 0; 956 virtual FDE_CSSTEXTEMPHASISFILL GetTextEmphasisFill() const = 0; 957 virtual const FX_WCHAR* GetTextEmphasisCustom() const = 0; 958 virtual FDE_CSSTEXTCOMBINE GetTextCombineType() const = 0; 959 virtual FX_BOOL HasTextCombineNumber() const = 0; 960 virtual FX_FLOAT GetTextCombineNumber() const = 0; 961 virtual void SetLineHeight(FX_FLOAT fLineHeight) = 0; 962 virtual void SetWhiteSpace(FDE_CSSWHITESPACE eWhiteSpace) = 0; 963 virtual void SetTextIndent(const FDE_CSSLENGTH& textIndent) = 0; 964 virtual void SetTextAlign(FDE_CSSTEXTALIGN eTextAlign) = 0; 965 virtual void SetVerticalAlign(FDE_CSSVERTICALALIGN eVerticalAlign) = 0; 966 virtual void SetNumberVerticalAlign(FX_FLOAT fAlign) = 0; 967 virtual void SetTextTransform(FDE_CSSTEXTTRANSFORM eTextTransform) = 0; 968 virtual void SetTextDecoration(FX_DWORD dwTextDecoration) = 0; 969 virtual void SetLetterSpacing(const FDE_CSSLENGTH& letterSpacing) = 0; 970 virtual void SetWordSpacing(const FDE_CSSLENGTH& wordSpacing) = 0; 971 virtual void SetWritingMode(FDE_CSSWRITINGMODE eWritingMode) = 0; 972 virtual void SetWordBreak(FDE_CSSWORDBREAK eWordBreak) = 0; 973 virtual void SetWidows(int32_t iWidows) = 0; 974 virtual void SetTextEmphasisColor(FX_ARGB dwTextEmphasisColor) = 0; 975 virtual void SetPageBreakBefore(FDE_CSSPAGEBREAK ePageBreakBefore) = 0; 976 virtual void SetPageBreakAfter(FDE_CSSPAGEBREAK ePageBreakAfter) = 0; 977 virtual void SetPageBreakInside(FDE_CSSPAGEBREAK ePageBreakInside) = 0; 978 virtual void SetOrphans(int32_t iOrphans) = 0; 979 virtual void SetLineBreak(FDE_CSSLINEBREAK eLineBreak) = 0; 980 }; 981 class IFDE_CSSBackgroundStyle { 982 public: 983 virtual ~IFDE_CSSBackgroundStyle() {} 984 virtual FX_ARGB GetBKGColor() const = 0; 985 virtual const FX_WCHAR* GetBKGImage() const = 0; 986 virtual FDE_CSSBKGREPEAT GetBKGRepeat() const = 0; 987 virtual FDE_CSSBKGATTACHMENT GetBKGAttachment() const = 0; 988 virtual const FDE_CSSPOINT& GetBKGPosition() const = 0; 989 virtual void SetBKGColor(FX_ARGB dwBKGColor) = 0; 990 virtual void SetBKGPosition(const FDE_CSSPOINT& bkgPosition) = 0; 991 }; 992 class IFDE_CSSListStyle { 993 public: 994 virtual ~IFDE_CSSListStyle() {} 995 virtual FDE_CSSLISTSTYLETYPE GetListStyleType() const = 0; 996 virtual FDE_CSSLISTSTYLEPOSITION GetListStylePosition() const = 0; 997 virtual const FX_WCHAR* GetListStyleImage() const = 0; 998 virtual void SetListStyleType(FDE_CSSLISTSTYLETYPE eListStyleType) = 0; 999 virtual void SetListStylePosition( 1000 FDE_CSSLISTSTYLEPOSITION eListStylePosition) = 0; 1001 }; 1002 class IFDE_CSSTableStyle { 1003 public: 1004 virtual ~IFDE_CSSTableStyle() {} 1005 virtual FDE_CSSCAPTIONSIDE GetCaptionSide() const = 0; 1006 }; 1007 class IFDE_CSSVisualStyle { 1008 public: 1009 virtual ~IFDE_CSSVisualStyle() {} 1010 virtual FDE_CSSVISIBILITY GetVisibility() const = 0; 1011 virtual FDE_CSSOVERFLOW GetOverflowX() const = 0; 1012 virtual FDE_CSSOVERFLOW GetOverflowY() const = 0; 1013 virtual void SetVisibility(FDE_CSSVISIBILITY eVisibility) = 0; 1014 }; 1015 class IFDE_CSSComputedStyle : public IFX_Unknown { 1016 public: 1017 virtual void Reset() = 0; 1018 virtual IFDE_CSSFontStyle* GetFontStyles() const = 0; 1019 virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() const = 0; 1020 virtual IFDE_CSSPositionStyle* GetPositionStyles() const = 0; 1021 virtual IFDE_CSSParagraphStyle* GetParagraphStyles() const = 0; 1022 virtual IFDE_CSSBackgroundStyle* GetBackgroundStyles() const = 0; 1023 virtual IFDE_CSSVisualStyle* GetVisualStyles() const = 0; 1024 virtual IFDE_CSSListStyle* GetListStyles() const = 0; 1025 virtual IFDE_CSSMultiColumnStyle* GetMultiColumnStyle() const = 0; 1026 virtual IFDE_CSSTableStyle* GetTableStyle() const = 0; 1027 virtual IFDE_CSSGeneratedContentStyle* GetGeneratedContentStyle() const = 0; 1028 virtual IFDE_CSSRubyStyle* GetRubyStyle() const = 0; 1029 virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, 1030 CFX_WideString& wsValue) const = 0; 1031 }; 1032 enum FDE_CSSSTYLESHEETGROUP { 1033 FDE_CSSSTYLESHEETGROUP_UserAgent, 1034 FDE_CSSSTYLESHEETGROUP_User, 1035 FDE_CSSSTYLESHEETGROUP_Author, 1036 FDE_CSSSTYLESHEETGROUP_MAX, 1037 }; 1038 enum FDE_CSSSTYLESHEETPRIORITY { 1039 FDE_CSSSTYLESHEETPRIORITY_High, 1040 FDE_CSSSTYLESHEETPRIORITY_Mid, 1041 FDE_CSSSTYLESHEETPRIORITY_Low, 1042 FDE_CSSSTYLESHEETPRIORITY_MAX, 1043 }; 1044 class IFDE_CSSTagProvider { 1045 public: 1046 virtual ~IFDE_CSSTagProvider() {} 1047 virtual CFX_WideStringC GetTagName() = 0; 1048 virtual FX_POSITION GetFirstAttribute() = 0; 1049 virtual void GetNextAttribute(FX_POSITION& pos, 1050 CFX_WideStringC& wsAttr, 1051 CFX_WideStringC& wsValue) = 0; 1052 }; 1053 class IFDE_CSSAccelerator { 1054 public: 1055 virtual ~IFDE_CSSAccelerator() {} 1056 virtual void OnEnterTag(IFDE_CSSTagProvider* pTag) = 0; 1057 virtual void OnLeaveTag(IFDE_CSSTagProvider* pTag) = 0; 1058 }; 1059 class IFDE_CSSStyleSelector { 1060 public: 1061 static IFDE_CSSStyleSelector* Create(); 1062 virtual ~IFDE_CSSStyleSelector() {} 1063 virtual void Release() = 0; 1064 virtual void SetFontMgr(IFX_FontMgr* pFontMgr) = 0; 1065 virtual void SetDefFontSize(FX_FLOAT fFontSize) = 0; 1066 virtual FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, 1067 IFDE_CSSStyleSheet* pSheet) = 0; 1068 virtual FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, 1069 const CFDE_CSSStyleSheetArray* pArray) = 0; 1070 virtual void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, 1071 FDE_CSSSTYLESHEETPRIORITY ePriority) = 0; 1072 virtual void UpdateStyleIndex(FX_DWORD dwMediaList) = 0; 1073 virtual IFDE_CSSAccelerator* InitAccelerator() = 0; 1074 virtual IFDE_CSSComputedStyle* CreateComputedStyle( 1075 IFDE_CSSComputedStyle* pParentStyle) = 0; 1076 virtual int32_t MatchDeclarations( 1077 IFDE_CSSTagProvider* pTag, 1078 CFDE_CSSDeclarationArray& matchedDecls, 1079 FDE_CSSPERSUDO ePersudoType = FDE_CSSPERSUDO_NONE) = 0; 1080 virtual void ComputeStyle(IFDE_CSSTagProvider* pTag, 1081 const IFDE_CSSDeclaration** ppDeclArray, 1082 int32_t iDeclCount, 1083 IFDE_CSSComputedStyle* pDestStyle) = 0; 1084 }; 1085 #endif 1086